diff options
author | peter <peter@FreeBSD.org> | 2000-11-25 03:36:09 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2000-11-25 03:36:09 +0000 |
commit | 7c1d527781b35711a5231f301b2e66d66d27686e (patch) | |
tree | 7ce6bf3b4026088e4d563bcbd63943bddf45a5a5 | |
parent | a177d57cb0bf5d68c28a8d74c9638eb4c906e656 (diff) | |
download | FreeBSD-src-7c1d527781b35711a5231f301b2e66d66d27686e.zip FreeBSD-src-7c1d527781b35711a5231f301b2e66d66d27686e.tar.gz |
Update the ed driver to probe and attach under a NEWCARD kernel (I was
using a cardbus based system with pccbb providing the pcic interface).
Something isn't quite right.. when the driver allocates and activates
its resources, the IO space that was requested reads as all zeros (versus
the original 0xff's as it normally is when there is no device responding).
Also, deactivate the resources before releasing them. OLDCARD doesn't
seem to care but NEWCARD/CARDBUS get rather unhappy if you release
a resource that hasn't been deactivated yet.
Make pcic_p.c only compile with oldcard kernels.
-rw-r--r-- | sys/conf/files | 3 | ||||
-rw-r--r-- | sys/dev/ed/if_ed.c | 6 | ||||
-rw-r--r-- | sys/dev/ed/if_ed_pccard.c | 31 |
3 files changed, 37 insertions, 3 deletions
diff --git a/sys/conf/files b/sys/conf/files index 6bb991b..87dd8ba 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -270,6 +270,7 @@ dev/dpt/dpt_pci.c optional dpt pci dev/dpt/dpt_scsi.c optional dpt dev/ed/if_ed.c optional ed dev/ed/if_ed_pccard.c optional ed card +dev/ed/if_ed_pccard.c optional ed pccard dev/ed/if_ed_pci.c optional ed pci dev/en/midway.c count en dev/ep/if_ep.c optional ep @@ -1092,7 +1093,7 @@ dev/pccbb/pccbb.c optional pccbb pci/pci.c count pci pci/pci_compat.c optional pci compat_oldpci \ warning "Old PCI driver compatability shims present." -pci/pcic_p.c optional pcic pci +pci/pcic_p.c optional pcic pci card pci/pcisupport.c optional pci pci/pci_if.m optional pci pci/pcib_if.m optional pci diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 72fb2ef..a1222b4 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -1590,16 +1590,22 @@ ed_release_resources(dev) struct ed_softc *sc = device_get_softc(dev); if (sc->port_res) { + bus_deactivate_resource(dev, SYS_RES_IOPORT, + sc->port_rid, sc->port_res); bus_release_resource(dev, SYS_RES_IOPORT, sc->port_rid, sc->port_res); sc->port_res = 0; } if (sc->mem_res) { + bus_deactivate_resource(dev, SYS_RES_MEMORY, + sc->mem_rid, sc->mem_res); bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, sc->mem_res); sc->mem_res = 0; } if (sc->irq_res) { + bus_deactivate_resource(dev, SYS_RES_IRQ, + sc->irq_rid, sc->irq_res); bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq_res); sc->irq_res = 0; diff --git a/sys/dev/ed/if_ed_pccard.c b/sys/dev/ed/if_ed_pccard.c index 68b17a7..8654912 100644 --- a/sys/dev/ed/if_ed_pccard.c +++ b/sys/dev/ed/if_ed_pccard.c @@ -49,11 +49,14 @@ #include <dev/ed/if_edreg.h> #include <dev/ed/if_edvar.h> #include <dev/pccard/pccardvar.h> +#include <dev/pccard/pccarddevs.h> + #include "card_if.h" /* * PC-Card (PCMCIA) specific code. */ +static int ed_pccard_match(device_t); static int ed_pccard_probe(device_t); static int ed_pccard_attach(device_t); static int ed_pccard_detach(device_t); @@ -64,10 +67,14 @@ static int linksys; static device_method_t ed_pccard_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, ed_pccard_probe), - DEVMETHOD(device_attach, ed_pccard_attach), + DEVMETHOD(device_probe, pccard_compat_probe), + DEVMETHOD(device_attach, pccard_compat_attach), DEVMETHOD(device_detach, ed_pccard_detach), + /* Card interface */ + DEVMETHOD(card_compat_match, ed_pccard_match), + DEVMETHOD(card_compat_probe, ed_pccard_probe), + DEVMETHOD(card_compat_attach, ed_pccard_attach), { 0, 0 } }; @@ -109,6 +116,25 @@ ed_pccard_detach(device_t dev) return (0); } +const struct pccard_product sn_pccard_products[] = { + { PCCARD_STR_KINGSTON_KNE2, PCCARD_VENDOR_KINGSTON, + PCCARD_PRODUCT_KINGSTON_KNE2, 0, NULL, NULL }, + { NULL } +}; + +static int +ed_pccard_match(device_t dev) +{ + const struct pccard_product *pp; + + if ((pp = pccard_product_lookup(dev, sn_pccard_products, + sizeof(sn_pccard_products[0]), NULL)) != NULL) { + device_set_desc(dev, pp->pp_name); + return 0; + } + return EIO; +} + /* * Probe framework for pccards. Replicates the standard framework, * minus the pccard driver registration and ignores the ether address @@ -269,6 +295,7 @@ ed_pccard_memwrite(device_t dev, off_t offset, u_char byte) bus_space_write_1(rman_get_bustag(cis), rman_get_bushandle(cis), offset, byte); + bus_deactivate_resource(dev, SYS_RES_MEMORY, cis_rid, cis); bus_release_resource(dev, SYS_RES_MEMORY, cis_rid, cis); return (0); |