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.
This commit is contained in:
Peter Wemm 2000-11-25 03:36:09 +00:00
parent 249849e0b9
commit b3d39a56ae
3 changed files with 37 additions and 3 deletions

View File

@ -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

View File

@ -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;

View File

@ -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);