summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2001-05-21 07:32:46 +0000
committerimp <imp@FreeBSD.org>2001-05-21 07:32:46 +0000
commitc65c10ec83e1ab12358a1571f7f75953c4dfe8ee (patch)
tree0fb53887ca5deed42ecae227e3b0ffafc6f33b0c
parentf7d282ea3828a1ca17113361093844bed305303c (diff)
downloadFreeBSD-src-c65c10ec83e1ab12358a1571f7f75953c4dfe8ee.zip
FreeBSD-src-c65c10ec83e1ab12358a1571f7f75953c4dfe8ee.tar.gz
Move allocation of ExCA registers from the base driver into the bus
attachment code.
-rw-r--r--sys/pccard/pcic.c27
-rw-r--r--sys/pccard/pcic_isa.c11
-rw-r--r--sys/pccard/pcicvar.h13
3 files changed, 17 insertions, 34 deletions
diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c
index f8d5fc9..06dede0 100644
--- a/sys/pccard/pcic.c
+++ b/sys/pccard/pcic.c
@@ -108,7 +108,7 @@ putw(struct pcic_slot *sp, int reg, unsigned short word)
/*
* Free up resources allocated so far.
*/
-static void
+void
pcic_dealloc(device_t dev)
{
struct pcic_softc *sc;
@@ -125,7 +125,6 @@ pcic_dealloc(device_t dev)
bus_teardown_intr(dev, sc->irqres, sc->ih);
if (sc->irqres)
bus_release_resource(dev, SYS_RES_IRQ, sc->irqrid, sc->irqres);
-
}
/*
@@ -295,30 +294,6 @@ pcic_attach(device_t dev)
sp->sc = sc;
}
- if (sc->flags & PCIC_IO_MAPPED) {
- rid = 0;
- r = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1,
- RF_ACTIVE);
- if (!r) {
- pcic_dealloc(dev);
- return (ENXIO);
- }
- sc->iorid = rid;
- sc->iores = r;
- }
-
- if (sc->flags & PCIC_MEM_MAPPED) {
- rid = 0;
- r = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1,
- RF_ACTIVE);
- if (!r) {
- pcic_dealloc(dev);
- return (ENXIO);
- }
- sc->memrid = rid;
- sc->memres = r;
- }
-
irq = bus_get_resource_start(dev, SYS_RES_IRQ, 0);
if (irq == 0) {
/* See if the user has requested a specific IRQ */
diff --git a/sys/pccard/pcic_isa.c b/sys/pccard/pcic_isa.c
index e5eb205..e69baba 100644
--- a/sys/pccard/pcic_isa.c
+++ b/sys/pccard/pcic_isa.c
@@ -286,9 +286,18 @@ static int
pcic_isa_attach(device_t dev)
{
struct pcic_softc *sc;
+ int rid;
+ struct resource *r;
sc = device_get_softc(dev);
- sc->flags |= PCIC_IO_MAPPED;
+ rid = 0;
+ r = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE);
+ if (!r) {
+ pcic_dealloc(dev);
+ return (ENXIO);
+ }
+ sc->iorid = rid;
+ sc->iores = r;
return (pcic_attach(dev));
}
diff --git a/sys/pccard/pcicvar.h b/sys/pccard/pcicvar.h
index 1f2329d..3d66040 100644
--- a/sys/pccard/pcicvar.h
+++ b/sys/pccard/pcicvar.h
@@ -44,13 +44,11 @@ struct pcic_softc
{
u_int32_t slotmask; /* Mask of valid slots */
u_int32_t flags; /* Interesting flags */
-#define PCIC_IO_MAPPED 0x00000001 /* ExCA registers are io mapped */
-#define PCIC_MEM_MAPPED 0x00000002 /* ExCA registers mem mapped */
-#define PCIC_VG_POWER 0x00000004 /* Uses VG power regs */
-#define PCIC_DF_POWER 0x00000008 /* Uses DF step regs */
-#define PCIC_PD_POWER 0x00000010 /* Uses CL-PD regs */
-#define PCIC_KING_POWER 0x00000020 /* Uses IBM KING regs */
-#define PCIC_AB_POWER 0x00000040 /* Use old A/B step power */
+#define PCIC_AB_POWER 0x00000001 /* Use old A/B step power */
+#define PCIC_DF_POWER 0x00000002 /* Uses DF step regs */
+#define PCIC_PD_POWER 0x00000004 /* Uses CL-PD regs */
+#define PCIC_VG_POWER 0x00000008 /* Uses VG power regs */
+#define PCIC_KING_POWER 0x00000010 /* Uses IBM KING regs */
int iorid; /* Rid of I/O region */
struct resource *iores; /* resource for I/O region */
int memrid;
@@ -84,3 +82,4 @@ int pcic_set_memory_offset(device_t bus, device_t child, int rid,
u_int32_t offset, u_int32_t *deltap);
void pcic_clrb(struct pcic_slot *sp, int reg, unsigned char mask);
void pcic_setb(struct pcic_slot *sp, int reg, unsigned char mask);
+void pcic_dealloc(device_t dev);
OpenPOWER on IntegriCloud