From 2276cee521e2c15d1f2bbecdf4ce3868e76b49b8 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 19 Sep 2000 04:39:20 +0000 Subject: 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. --- sys/dev/ep/if_ep_pccard.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'sys/dev/ep') diff --git a/sys/dev/ep/if_ep_pccard.c b/sys/dev/ep/if_ep_pccard.c index 6b39711025115..d27d5fdf8fdbb 100644 --- a/sys/dev/ep/if_ep_pccard.c +++ b/sys/dev/ep/if_ep_pccard.c @@ -58,6 +58,9 @@ #include #include +#include "card_if.h" +#include + static const char *ep_pccard_identify(u_short id); /* @@ -238,12 +241,23 @@ ep_pccard_detach(device_t dev) return (0); } +static int +ep_pccard_match(device_t dev) +{ + return EIO; +} + static device_method_t ep_pccard_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, ep_pccard_probe), - DEVMETHOD(device_attach, ep_pccard_attach), + DEVMETHOD(device_probe, pccard_compat_probe), + DEVMETHOD(device_attach, pccard_compat_attach), DEVMETHOD(device_detach, ep_pccard_detach), + /* Card interface */ + DEVMETHOD(card_compat_match, ep_pccard_match), + DEVMETHOD(card_compat_probe, ep_pccard_probe), + DEVMETHOD(card_compat_attach, ep_pccard_attach), + { 0, 0 } }; -- cgit v1.3