From b3d39a56aecc4feb1ea053c7411ce412f07615f1 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Sat, 25 Nov 2000 03:36:09 +0000 Subject: 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. --- sys/dev/ed/if_ed.c | 6 ++++++ sys/dev/ed/if_ed_pccard.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 72fb2ef173ac..a1222b4096ae 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 68b17a7f0499..86549128b39d 100644 --- a/sys/dev/ed/if_ed_pccard.c +++ b/sys/dev/ed/if_ed_pccard.c @@ -49,11 +49,14 @@ #include #include #include +#include + #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); -- cgit v1.3