summaryrefslogtreecommitdiffstats
path: root/sys/pccard/pccard_nbk.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1999-10-15 17:29:21 +0000
committerimp <imp@FreeBSD.org>1999-10-15 17:29:21 +0000
commit9f89acc8ccb787d8e0e9e50b9489441a50c52ff4 (patch)
tree7a31d68bbb8d2f04dff22a0de848dfb580df4ff7 /sys/pccard/pccard_nbk.c
parent99455ff0f7319d665313ec3f969a1f2163778d7c (diff)
downloadFreeBSD-src-9f89acc8ccb787d8e0e9e50b9489441a50c52ff4.zip
FreeBSD-src-9f89acc8ccb787d8e0e9e50b9489441a50c52ff4.tar.gz
Reorganize the attachement point for pcic (it was unattached and
floating before). Attach pccard devices to pcic, one per slot (although this may change to one per pcic). pcic is now attached to isa (to act as a bridge) and pccard is attached to pcic, cbb and pc98ic (the last two are card bus bridge and the pc98ic version of pcic, neither of which are in the tree yet). Move pccard compat code into pccard/pccard_compat.c. THIS REQUIRES A CONFIG FILE CHANGE. You must change your pcic/card entries to be: # PCCARD (PCMCIA) support controller pcic0 at isa? controller pcic1 at isa? controller card0 The old system was upside down and this corrects that problem. It will make it easier to add support for YENTA pccard/card bus bridges. Much more cleanup needs to happen before newbus devices can have pccard attachments. My previous commit's comments were premature.
Diffstat (limited to 'sys/pccard/pccard_nbk.c')
-rw-r--r--sys/pccard/pccard_nbk.c173
1 files changed, 4 insertions, 169 deletions
diff --git a/sys/pccard/pccard_nbk.c b/sys/pccard/pccard_nbk.c
index 6c0853a..a10f0e2 100644
--- a/sys/pccard/pccard_nbk.c
+++ b/sys/pccard/pccard_nbk.c
@@ -86,7 +86,7 @@ pccard_add_children(device_t dev, int busno)
static int
pccard_probe(device_t dev)
{
- device_set_desc(dev, "PC Card bus -- KLUDGE version");
+ device_set_desc(dev, "PC Card bus -- kludge version");
return pccard_add_children(dev, device_get_unit(dev));
}
@@ -162,171 +162,6 @@ static driver_t pccard_driver = {
1, /* no softc */
};
-
-DRIVER_MODULE(pccard, nexus, pccard_driver, pccard_devclass, 0, 0);
-
-/* ============================================================ */
-
-static int
-pccnbk_probe(device_t dev)
-{
- char devnam[128];
- const char *name;
- struct pccard_devinfo *devi = device_get_ivars(dev);
-
- if (devi) {
- name = device_get_name(dev);
- snprintf(devnam, sizeof(devnam), "pccard-%s",
- devi->drv->name);
- if (!name || strcmp(name, devnam) != 0)
- return ENXIO;
- device_set_desc(dev, devi->drv->name);
- return 0;
- }
- return ENXIO;
-}
-
-static int
-pccnbk_attach(device_t dev)
-{
- struct pccard_devinfo *devi = device_get_ivars(dev);
- struct pccard_device *drv;
- struct slot *slt;
- int err;
- int s;
-
- slt = devi->slt;
- drv = devi->drv;
- devi->next = slt->devices;
- slt->devices = devi;
- s = splhigh();
- err = drv->enable(devi);
- splx(s);
- /*
- * If the enable functions returns no error, then the
- * device has been successfully installed. If so, then
- * attach it to the slot, otherwise free it and return
- * the error. We assume that when we free the device,
- * it will also set 'running' to off.
- */
- if (err) {
- printf("pccard: %s%d Enable failed %d\n", devi->drv->name,
- devi->isahd.id_unit, err);
- pccard_remove_device(devi);
- }
- return(err);
-}
-
-/*
- * Allocate resources for this device in the rman system.
- */
-int
-pccnbk_alloc_resources(device_t dev)
-{
- struct pccard_devinfo *devi = device_get_ivars(dev);
- int rid;
- u_long start;
- u_long end;
- u_long count;
-
- start = devi->isahd.id_iobase;
- count = devi->isahd.id_iosize;
- end = start + count - 1;
-
- rid = 0;
- devi->iorv = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev,
- SYS_RES_IOPORT, &rid, start, end, count, RF_ACTIVE);
- if (!devi->iorv) {
- printf("Cannot allocate ports 0x%lx-0x%lx\n", start, end);
- return (ENOMEM);
- }
- rid = 0;
- start = end = ffs(devi->isahd.id_irq) - 1;
- count = 1;
- devi->irqrv = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev,
- SYS_RES_IRQ, &rid, start, end, count, RF_ACTIVE);
- if (!devi->irqrv) {
- return (ENOMEM);
- }
- return(0);
-}
-
-void
-pccnbk_release_resources(device_t dev)
-{
- struct pccard_devinfo *devi = device_get_ivars(dev);
- u_long start;
- u_long end;
- u_long count;
-
- start = devi->isahd.id_iobase;
- count = devi->isahd.id_iosize;
- end = start + count - 1;
-
- if (devi->iorv) {
- BUS_RELEASE_RESOURCE(device_get_parent(dev), dev,
- SYS_RES_IOPORT, 0, devi->iorv);
- devi->iorv = NULL;
- }
- if (devi->irqrv) {
- BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, SYS_RES_IRQ,
- 0, devi->irqrv);
- devi->irqrv = NULL;
- }
-}
-
-static device_method_t pccnbk_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, pccnbk_probe),
- DEVMETHOD(device_attach, pccnbk_attach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
-
- /* Bus interface */
- DEVMETHOD(bus_print_child, bus_generic_print_child),
- DEVMETHOD(bus_driver_added, bus_generic_driver_added),
- DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
- DEVMETHOD(bus_release_resource, bus_generic_release_resource),
- DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
- DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
- DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
- DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
-
- { 0, 0 }
-};
-
-void
-pccnbk_wrap_old_driver(struct pccard_device *drv)
-{
- char devnam[128];
- char *nm;
- driver_t *driver;
-
- snprintf(devnam, sizeof(devnam), "pccard-%s", drv->name);
- driver = malloc(sizeof(driver_t), M_DEVBUF, M_NOWAIT);
- if (!driver)
- return;
- bzero(driver, sizeof(driver_t));
- /* XXX May create a memory leak for load/unload :-( XXX */
- nm = malloc(strlen(devnam) + 1, M_DEVBUF, M_NOWAIT);
- strcpy(nm, devnam);
- driver->name = nm;
- driver->methods = pccnbk_methods;
- driver->softc = sizeof(struct pccard_device);
- driver->priv = drv;
- devclass_add_driver(pccard_devclass, driver);
- drv->driver = driver;
-}
-
-#if 0
-static devclass_t pccnbk_devclass;
-
-static driver_t pccnbk_driver = {
- "pccnbk",
- pccnbk_methods,
- 1, /* no softc */
-};
-
-DRIVER_MODULE(pccnbk, pccard, pccnbk_driver, pccnbk_devclass, 0, 0);
-#endif
+DRIVER_MODULE(pccard, pcic, pccard_driver, pccard_devclass, 0, 0);
+DRIVER_MODULE(pccard, pc98pcic, pccard_driver, pccard_devclass, 0, 0);
+DRIVER_MODULE(pccard, cbb, pccard_driver, pccard_devclass, 0, 0);
OpenPOWER on IntegriCloud