summaryrefslogtreecommitdiffstats
path: root/sys/dev/pcic
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2000-08-19 19:20:25 +0000
committerimp <imp@FreeBSD.org>2000-08-19 19:20:25 +0000
commitb7be66adbf36427ea4323d9b43d4f413abfed6f3 (patch)
treef52b48d0215c03c3b4fffc5223a79eb3bcc95bbe /sys/dev/pcic
parenta6b42f87ece61549e3838515bb431377fbbbc5c5 (diff)
downloadFreeBSD-src-b7be66adbf36427ea4323d9b43d4f413abfed6f3.zip
FreeBSD-src-b7be66adbf36427ea4323d9b43d4f413abfed6f3.tar.gz
o move to using PCIC_SOFTC(dev) to get the softc
o move pcic_deactivate into pcic_detach o Better debug messages
Diffstat (limited to 'sys/dev/pcic')
-rw-r--r--sys/dev/pcic/i82365.c22
-rw-r--r--sys/dev/pcic/i82365_isa.c4
-rw-r--r--sys/dev/pcic/i82365var.h2
3 files changed, 13 insertions, 15 deletions
diff --git a/sys/dev/pcic/i82365.c b/sys/dev/pcic/i82365.c
index 8e0ac34..f5df2b9 100644
--- a/sys/dev/pcic/i82365.c
+++ b/sys/dev/pcic/i82365.c
@@ -199,8 +199,7 @@ pcic_vendor_to_string(int vendor)
static int
pcic_activate(device_t dev)
{
- struct pcic_softc *sc = (struct pcic_softc *)
- device_get_softc(dev);
+ struct pcic_softc *sc = PCIC_SOFTC(dev);
int err;
sc->port_rid = 0;
@@ -250,7 +249,7 @@ pcic_activate(device_t dev)
void
pcic_deactivate(device_t dev)
{
- struct pcic_softc *sc = device_get_softc(dev);
+ struct pcic_softc *sc = PCIC_SOFTC(dev);
if (sc->intrhand)
bus_teardown_intr(dev, sc->irq_res, sc->intrhand);
@@ -273,8 +272,7 @@ pcic_deactivate(device_t dev)
int
pcic_attach(device_t dev)
{
- struct pcic_softc *sc = (struct pcic_softc *)
- device_get_softc(dev);
+ struct pcic_softc *sc = PCIC_SOFTC(dev);
struct pcic_handle *h;
int vendor, count, i, reg, error;
@@ -713,28 +711,28 @@ pcic_queue_event(struct pcic_handle *h, int event)
static void
pcic_attach_card(struct pcic_handle *h)
{
- DPRINTF(("pcic_attach_card h %p h->dev %p %s %s\n", h, h->dev,
- device_get_name(h->dev), device_get_name(device_get_parent(h->dev))));
+ DPRINTF(("pcic_attach_card h %p h->dev %p\n", h, h->dev));
if (!(h->flags & PCIC_FLAG_CARDP)) {
+ DPRINTF(("Calling MI attach function\n"));
/* call the MI attach function */
CARD_ATTACH_CARD(h->dev);
h->flags |= PCIC_FLAG_CARDP;
} else {
- DPRINTF(("pcic_attach_card: already attached"));
+ DPRINTF(("pcic_attach_card: already attached\n"));
}
}
static void
pcic_detach_card(struct pcic_handle *h, int flags)
{
-
+ DPRINTF(("pcic_detach_card h %p h->dev %p\n", h, h->dev));
if (h->flags & PCIC_FLAG_CARDP) {
h->flags &= ~PCIC_FLAG_CARDP;
/* call the MI detach function */
CARD_DETACH_CARD(h->dev, flags);
} else {
- DPRINTF(("pcic_detach_card: already detached"));
+ DPRINTF(("pcic_detach_card: already detached\n"));
}
}
@@ -1517,18 +1515,18 @@ pcic_start_threads(void *arg)
int
pcic_detach(device_t dev)
{
- device_t pccarddev;
device_t *kids;
int nkids;
int i;
int ret;
+ pcic_deactivate(dev);
ret = bus_generic_detach(dev);
if (ret != 0)
return (ret);
device_get_children(dev, &kids, &nkids);
for (i = 0; i < nkids; i++) {
- if ((ret = device_delete_child(pccarddev, kids[i])) != 0)
+ if ((ret = device_delete_child(dev, kids[i])) != 0)
device_printf(dev, "delete of %s failed: %d\n",
device_get_nameunit(kids[i]), ret);
}
diff --git a/sys/dev/pcic/i82365_isa.c b/sys/dev/pcic/i82365_isa.c
index 6518460..1f1ef1f 100644
--- a/sys/dev/pcic/i82365_isa.c
+++ b/sys/dev/pcic/i82365_isa.c
@@ -122,8 +122,7 @@ static struct isa_pnp_id pcic_ids[] = {
static void
pcic_isa_bus_width_probe (device_t dev)
{
- struct pcic_softc *sc = (struct pcic_softc *)
- device_get_softc(dev);
+ struct pcic_softc *sc = PCIC_SOFTC(dev);
bus_space_handle_t ioh_high;
int i, iobuswidth, tmp1, tmp2;
int rid;
@@ -358,7 +357,6 @@ pcic_isa_attach(device_t dev)
static int
pcic_isa_detach(device_t dev)
{
- pcic_deactivate(dev);
pcic_detach(dev);
return 0;
}
diff --git a/sys/dev/pcic/i82365var.h b/sys/dev/pcic/i82365var.h
index b926ffd..af14075 100644
--- a/sys/dev/pcic/i82365var.h
+++ b/sys/dev/pcic/i82365var.h
@@ -194,3 +194,5 @@ int pcic_set_res_flags(device_t dev, device_t child, int type, int rid,
u_int32_t flags);
int pcic_set_memory_offset(device_t dev, device_t child, int rid,
u_int32_t offset);
+
+#define PCIC_SOFTC(d) (struct pcic_softc *) device_get_softc(d)
OpenPOWER on IntegriCloud