summaryrefslogtreecommitdiffstats
path: root/sys/dev/pcic
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1999-11-28 21:11:13 +0000
committerimp <imp@FreeBSD.org>1999-11-28 21:11:13 +0000
commitd2ef3b0fa085c1fa1e97986e1c9d0ddf51390bda (patch)
tree82840b50bf19e2c0ba1298210687873d0189ffe3 /sys/dev/pcic
parentadae2d80cb4279c4c32d86cdc6c4d28cff604c38 (diff)
downloadFreeBSD-src-d2ef3b0fa085c1fa1e97986e1c9d0ddf51390bda.zip
FreeBSD-src-d2ef3b0fa085c1fa1e97986e1c9d0ddf51390bda.tar.gz
Add resource activation routines to pcic driver. Minor cleanup of
socket attach code. We now have at least a chance for pccard devices appearing in the future. This is a snapshot of ongoing work. Proceed at your own risk.
Diffstat (limited to 'sys/dev/pcic')
-rw-r--r--sys/dev/pcic/i82365.c53
-rw-r--r--sys/dev/pcic/i82365_isa.c24
-rw-r--r--sys/dev/pcic/i82365var.h12
3 files changed, 58 insertions, 31 deletions
diff --git a/sys/dev/pcic/i82365.c b/sys/dev/pcic/i82365.c
index caa1330..ccfa673 100644
--- a/sys/dev/pcic/i82365.c
+++ b/sys/dev/pcic/i82365.c
@@ -83,8 +83,8 @@ int pcic_debug = 0;
#define PCIC_MEM_ALIGN PCIC_MEM_PAGESIZE
-void pcic_attach_socket __P((struct pcic_handle *));
-void pcic_init_socket __P((struct pcic_handle *));
+static void pcic_attach_socket(device_t, struct pcic_handle *);
+static void pcic_init_socket(struct pcic_handle *);
#if XXX
int pcic_submatch __P((struct device *, struct cfdata *, void *));
@@ -343,23 +343,19 @@ pcic_attach(device_t dev)
}
void
-pcic_attach_sockets(sc)
- struct pcic_softc *sc;
+pcic_attach_sockets(device_t dev)
{
+ struct pcic_softc *sc = (struct pcic_softc *) device_get_softc(dev);
int i;
for (i = 0; i < PCIC_NSLOTS; i++)
if (sc->handle[i].flags & PCIC_FLAG_SOCKETP)
- pcic_attach_socket(&sc->handle[i]);
+ pcic_attach_socket(dev, &sc->handle[i]);
}
void
-pcic_attach_socket(h)
- struct pcic_handle *h;
+pcic_attach_socket(device_t dev, struct pcic_handle *h)
{
- struct pccardbus_attach_args paa;
- struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
-
/* initialize the rest of the handle */
h->shutdown = 0;
@@ -367,20 +363,19 @@ pcic_attach_socket(h)
h->ioalloc = 0;
h->ih_irq = 0;
- /* now, config one pccard device per socket */
-
- paa.paa_busname = "pccard";
- paa.pct = (pccard_chipset_tag_t) sc->pct;
- paa.pch = (pccard_chipset_handle_t) h;
- paa.iobase = sc->iobase;
- paa.iosize = sc->iosize;
-
-#if XXX
- h->pccard = config_found_sm(&sc->dev, &paa, pcic_print,
- pcic_submatch);
-#endif
+ /*
+ * now, config one pccard device per socket
+ *
+ * XXX This should add all devices that can attach to pcic, which
+ * is what we want in the general case.
+ *
+ * XXX Notice we don't use h AT ALL. This should be considered to
+ * XXX be BAD.
+ */
+ device_add_child(dev, NULL, -1, NULL);
/* if there's actually a pccard device attached, initialize the slot */
+ /* XXX WE SHOULD MOVE THIS TO CHILD ATTACHED */
if (h->pccard)
pcic_init_socket(h);
@@ -518,7 +513,7 @@ pcic_init_socket(h)
*/
#ifdef DIAGNOSTIC
if (h->event_thread != NULL)
- panic("pcic_attach_socket: event thread");
+ panic("pcic_init_socket: event thread");
#endif
pcic_create_event_thread(h);
@@ -1440,3 +1435,15 @@ st_pcic_write(h, idx, data)
bus_space_write_1(h->ph_bus_t, h->ph_bus_h, PCIC_REG_DATA, data);
}
+
+int pcic_activate_resource(device_t dev, device_t child, int type, int rid,
+ struct resource *r)
+{
+ return bus_generic_activate_resource(dev, child, type, rid, r);
+}
+
+int pcic_deactivate_resource(device_t dev, device_t child, int type, int rid,
+ struct resource *r)
+{
+ return bus_generic_deactivate_resource(dev, child, type, rid, r);
+}
diff --git a/sys/dev/pcic/i82365_isa.c b/sys/dev/pcic/i82365_isa.c
index 85cfe94..ec2f7fc 100644
--- a/sys/dev/pcic/i82365_isa.c
+++ b/sys/dev/pcic/i82365_isa.c
@@ -170,8 +170,6 @@ pcic_isa_attach(device_t dev)
((rman_get_end(sc->mem_res) - rman_get_start(sc->mem_res) + 1) /
PCIC_MEM_PAGESIZE)) - 1;
- sc->pct = (pccard_chipset_tag_t) & pcic_isa_functions;
-
sc->irq_rid = 0;
sc->irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->irq_rid,
0, ~0, 1, RF_ACTIVE);
@@ -210,7 +208,7 @@ pcic_isa_attach(device_t dev)
rman_get_start(sc->port_res),
rman_get_end(sc->port_res) - rman_get_end(sc->port_res) + 1);
- pcic_attach_sockets(sc);
+ pcic_attach_sockets(dev);
#endif
return 0;
error:
@@ -232,14 +230,30 @@ pcic_isa_detach(device_t dev)
return 0;
}
-
-
static device_method_t pcic_isa_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, pcic_isa_probe),
DEVMETHOD(device_attach, pcic_isa_attach),
DEVMETHOD(device_detach, pcic_isa_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+
+ /* Bus Interface */
+ DEVMETHOD(bus_driver_added, bus_generic_driver_added),
+ DEVMETHOD(bus_activate_resource, pcic_activate_resource),
+ DEVMETHOD(bus_deactivate_resource, pcic_deactivate_resource),
+ DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
+ DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
+#if 0
+ /* pccard/cardbus interface */
+ DEVMETHOD(card_set_resource_attribute, pcic_set_resource_attribute),
+ DEVMETHOD(card_get_resource_attribute, pcic_get_resource_attribute),
+
+ /* Power Interface */
+ /* Not yet */
+#endif
{ 0, 0 }
};
diff --git a/sys/dev/pcic/i82365var.h b/sys/dev/pcic/i82365var.h
index cb3bc76..6ff9671 100644
--- a/sys/dev/pcic/i82365var.h
+++ b/sys/dev/pcic/i82365var.h
@@ -120,8 +120,6 @@ struct pcic_softc {
/* XXX isa_chipset_tag_t, pci_chipset_tag_t, etc. */
void *intr_est;
- pccard_chipset_tag_t pct;
-
/* this needs to be large enough to hold PCIC_MEM_PAGES bits */
int subregionmask;
#define PCIC_MAX_MEM_PAGES (8 * sizeof(int))
@@ -151,7 +149,7 @@ int pcic_vendor __P((struct pcic_handle *));
char *pcic_vendor_to_string __P((int));
void pcic_attach(device_t dev);
-void pcic_attach_sockets __P((struct pcic_softc *));
+void pcic_attach_sockets(device_t dev);
int pcic_intr __P((void *arg));
int pcic_chip_mem_alloc __P((pccard_chipset_handle_t, bus_size_t,
@@ -207,3 +205,11 @@ pcic_write(h, idx, data)
(*(h)->ph_write)((h), (idx), (data))
#endif
+
+/*
+ * bus/device/etc routines
+ */
+int pcic_activate_resource(device_t dev, device_t child, int type, int rid,
+ struct resource *r);
+int pcic_deactivate_resource(device_t dev, device_t child, int type, int rid,
+ struct resource *r);
OpenPOWER on IntegriCloud