diff options
author | imp <imp@FreeBSD.org> | 2005-09-13 19:28:03 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2005-09-13 19:28:03 +0000 |
commit | e0251ac0113ad7446f0c2eada18d29def9bec110 (patch) | |
tree | be61cde0b2d088cfe16d51f96dfd9b8e1fdf34a0 /sys/dev/ex | |
parent | f3a87b01d9d8c59b18a6a62c32a31f20de63ba91 (diff) | |
download | FreeBSD-src-e0251ac0113ad7446f0c2eada18d29def9bec110.zip FreeBSD-src-e0251ac0113ad7446f0c2eada18d29def9bec110.tar.gz |
MFp4:
o Move to new pccard_cis_scan convenience function.
o Remove compat layer goo.
Diffstat (limited to 'sys/dev/ex')
-rw-r--r-- | sys/dev/ex/if_ex_pccard.c | 113 |
1 files changed, 40 insertions, 73 deletions
diff --git a/sys/dev/ex/if_ex_pccard.c b/sys/dev/ex/if_ex_pccard.c index 76caccb..3a3cb0b 100644 --- a/sys/dev/ex/if_ex_pccard.c +++ b/sys/dev/ex/if_ex_pccard.c @@ -61,80 +61,9 @@ static const struct pccard_product ex_pccard_products[] = { }; /* Bus Front End Functions */ -static int ex_pccard_match(device_t); static int ex_pccard_probe(device_t); static int ex_pccard_attach(device_t); -static device_method_t ex_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, pccard_compat_probe), - DEVMETHOD(device_attach, pccard_compat_attach), - DEVMETHOD(device_detach, ex_detach), - - /* Card interface */ - DEVMETHOD(card_compat_match, ex_pccard_match), - DEVMETHOD(card_compat_probe, ex_pccard_probe), - DEVMETHOD(card_compat_attach, ex_pccard_attach), - - { 0, 0 } -}; - -static driver_t ex_pccard_driver = { - "ex", - ex_pccard_methods, - sizeof(struct ex_softc), -}; - -DRIVER_MODULE(ex, pccard, ex_pccard_driver, ex_devclass, 0, 0); - -static int -ex_pccard_match(device_t dev) -{ - const struct pccard_product *pp; - int error; - uint32_t fcn = PCCARD_FUNCTION_UNSPEC; - - /* Make sure we're a network function */ - error = pccard_get_function(dev, &fcn); - if (error != 0) - return (error); - if (fcn != PCCARD_FUNCTION_NETWORK) - return (ENXIO); - - if ((pp = pccard_product_lookup(dev, ex_pccard_products, - sizeof(ex_pccard_products[0]), NULL)) != NULL) { - if (pp->pp_name != NULL) - device_set_desc(dev, pp->pp_name); - return 0; - } - return EIO; -} - -static int -ex_pccard_probe(device_t dev) -{ - u_int iobase; - u_int irq; - - iobase = bus_get_resource_start(dev, SYS_RES_IOPORT, 0); - if (!iobase) { - printf("ex: no iobase?\n"); - return(ENXIO); - } - - if (bootverbose) - printf("ex: ex_pccard_probe() found card at 0x%03x\n", iobase); - - irq = bus_get_resource_start(dev, SYS_RES_IRQ, 0); - - if (irq == 0) { - printf("ex: invalid IRQ.\n"); - return(ENXIO); - } - - return(0); -} - static int ex_pccard_enet_ok(u_char *enaddr) { @@ -168,8 +97,30 @@ ex_pccard_silicom_cb(const struct pccard_tuple *tuple, void *arg) static void ex_pccard_get_silicom_mac(device_t dev, u_char *ether_addr) { - CARD_CIS_SCAN(device_get_parent(dev), ex_pccard_silicom_cb, - ether_addr); + pccard_cis_scan(dev, ex_pccard_silicom_cb, ether_addr); +} + +static int +ex_pccard_probe(device_t dev) +{ + const struct pccard_product *pp; + int error; + uint32_t fcn = PCCARD_FUNCTION_UNSPEC; + + /* Make sure we're a network function */ + error = pccard_get_function(dev, &fcn); + if (error != 0) + return (error); + if (fcn != PCCARD_FUNCTION_NETWORK) + return (ENXIO); + + if ((pp = pccard_product_lookup(dev, ex_pccard_products, + sizeof(ex_pccard_products[0]), NULL)) != NULL) { + if (pp->pp_name != NULL) + device_set_desc(dev, pp->pp_name); + return 0; + } + return EIO; } static int @@ -225,3 +176,19 @@ bad: ex_release_resources(dev); return (error); } +static device_method_t ex_pccard_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ex_pccard_probe), + DEVMETHOD(device_attach, ex_pccard_attach), + DEVMETHOD(device_detach, ex_detach), + + { 0, 0 } +}; + +static driver_t ex_pccard_driver = { + "ex", + ex_pccard_methods, + sizeof(struct ex_softc), +}; + +DRIVER_MODULE(ex, pccard, ex_pccard_driver, ex_devclass, 0, 0); |