diff options
author | imp <imp@FreeBSD.org> | 2000-09-19 04:39:20 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2000-09-19 04:39:20 +0000 |
commit | 222e32bc4941211d514ad22676414f71c1360b50 (patch) | |
tree | 0f24f269148f98c6cc905cfdaff28f51b9f78ecf /sys/dev/sn/if_sn_pccard.c | |
parent | 2186ce0d36ca105027459f0241b56f0740595d42 (diff) | |
download | FreeBSD-src-222e32bc4941211d514ad22676414f71c1360b50.zip FreeBSD-src-222e32bc4941211d514ad22676414f71c1360b50.tar.gz |
Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.
Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.
compat devices should use the following:
/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */
This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.
Drivers wishing to not retain OLDCARD compatibility needn't do this.
ep driver minorly updated.
sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
Diffstat (limited to 'sys/dev/sn/if_sn_pccard.c')
-rw-r--r-- | sys/dev/sn/if_sn_pccard.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/sys/dev/sn/if_sn_pccard.c b/sys/dev/sn/if_sn_pccard.c index 4220dea..5e41bec 100644 --- a/sys/dev/sn/if_sn_pccard.c +++ b/sys/dev/sn/if_sn_pccard.c @@ -55,13 +55,22 @@ #include <dev/sn/if_snvar.h> #include <dev/pccard/pccardvar.h> +#include <dev/pccard/pccarddevs.h> + +#include "card_if.h" + /* * Initialize the device - called from Slot manager. */ static int sn_pccard_probe(device_t dev) { - return (sn_probe(dev, 1)); + int err; + + printf ("Probing sn driver\n"); + err = sn_probe(dev, 1); + printf("sn_probe says %d\n", err); + return (err); } static int @@ -80,7 +89,6 @@ sn_pccard_attach(device_t dev) sc->pccard_enaddr = 1; bcopy(ether_addr, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); } - return (sn_attach(dev)); } @@ -95,12 +103,23 @@ sn_pccard_detach(device_t dev) return 0; } +static int +sn_pccard_match(device_t dev) +{ + return EIO; +} + static device_method_t sn_pccard_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, sn_pccard_probe), - DEVMETHOD(device_attach, sn_pccard_attach), + DEVMETHOD(device_probe, pccard_compat_probe), + DEVMETHOD(device_attach, pccard_compat_attach), DEVMETHOD(device_detach, sn_pccard_detach), + /* Card interface */ + DEVMETHOD(card_compat_match, sn_pccard_match), + DEVMETHOD(card_compat_probe, sn_pccard_probe), + DEVMETHOD(card_compat_attach, sn_pccard_attach), + { 0, 0 } }; @@ -112,4 +131,6 @@ static driver_t sn_pccard_driver = { extern devclass_t sn_devclass; -DRIVER_MODULE(sn, pccard, sn_pccard_driver, sn_devclass, 0, 0); +DRIVER_MODULE(if_sn, pccard, sn_pccard_driver, sn_devclass, 0, 0); +MODULE_DEPEND(if_sn, pccard, 1, 1, 1); +MODULE_DEPEND(if_sn, pcic, 1, 1, 1); /* XXX */ |