diff options
author | imp <imp@FreeBSD.org> | 2001-03-22 06:00:07 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2001-03-22 06:00:07 +0000 |
commit | a77b88f03f66bb9d64d759476ce0fe4a0857a33e (patch) | |
tree | 54e26e4bfa421ac8eee633024a1b1e5e6060663b /sys | |
parent | ba4eff10d20740d2c46baf0f7dceca11fc7fa682 (diff) | |
download | FreeBSD-src-a77b88f03f66bb9d64d759476ce0fe4a0857a33e.zip FreeBSD-src-a77b88f03f66bb9d64d759476ce0fe4a0857a33e.tar.gz |
First step towards making loadable modules independent of having
pccard in the kernel for those drivers with pccard attachments. This
makes the compat layer a little larger by introducing some inlines,
but should almost make it possible to have independent attachments.
The pccard_match function are the only one left, which I will take
care of shortly.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pccard/card_if.m | 29 | ||||
-rw-r--r-- | sys/dev/pccard/pccard.c | 10 | ||||
-rw-r--r-- | sys/dev/pccard/pccardvar.h | 14 | ||||
-rw-r--r-- | sys/pccard/pccard_nbk.c | 10 |
4 files changed, 53 insertions, 10 deletions
diff --git a/sys/dev/pccard/card_if.m b/sys/dev/pccard/card_if.m index 621a041..9abb579 100644 --- a/sys/dev/pccard/card_if.m +++ b/sys/dev/pccard/card_if.m @@ -30,6 +30,9 @@ INTERFACE card; +# WARNING: THIS FILE IS USED BY BOTH OLDCARD AND NEWCARD. MAKE SURE +# YOU TEST BOTH KERNELS IF CHANGING THIS FILE. + # # Companion interface for pccard. We need to set attributes for memory # and i/o port mappings (as well as other types of attributes) that have @@ -149,6 +152,10 @@ METHOD int deactivate_function { # # Drivers wishing to not retain OLDCARD compatibility needn't do this. # +# The compat_do_* versions are so that we can make the pccard_compat_probe +# and _attach static lines and have the bus system pick the right version +# to use so we don't enshrine pccard_* symbols in the driver's module. +# METHOD int compat_probe { device_t dev; } @@ -157,6 +164,28 @@ METHOD int compat_attach { device_t dev; } +CODE { + static int null_do_probe(device_t bus, device_t dev) + { + return (CARD_COMPAT_DO_PROBE(device_get_parent(bus), dev)); + } + + static int null_do_attach(device_t bus, device_t dev) + { + return (CARD_COMPAT_DO_ATTACH(device_get_parent(bus), dev)); + } +} + +METHOD int compat_do_probe { + device_t bus; + device_t dev; +} DEFAULT null_do_attach; + +METHOD int compat_do_attach { + device_t bus; + device_t dev; +} DEFAULT null_do_attach; + # # Helper method for the above. When a compatibility driver is converted, # one must write a match routine. This routine is unused on OLDCARD but diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c index 258d2b5..72c18a8 100644 --- a/sys/dev/pccard/pccard.c +++ b/sys/dev/pccard/pccard.c @@ -673,14 +673,14 @@ pccard_io_unmap(struct pccard_function *pf, int window) * needs to grab devices while in the old they were assigned to the device by * the pccardd process. These symbols are exported to the upper layers. */ -int -pccard_compat_probe(device_t dev) +static int +pccard_compat_do_probe(device_t bus, device_t dev) { return (CARD_COMPAT_MATCH(dev)); } -int -pccard_compat_attach(device_t dev) +static int +pccard_compat_do_attach(device_t bus, device_t dev) { int err; @@ -1106,6 +1106,8 @@ static device_method_t pccard_methods[] = { DEVMETHOD(card_get_type, pccard_card_gettype), DEVMETHOD(card_attach_card, pccard_attach_card), DEVMETHOD(card_detach_card, pccard_detach_card), + DEVMETHOD(card_compat_do_probe, pccard_compat_do_probe), + DEVMETHOD(card_compat_do_attach, pccard_compat_do_attach), { 0, 0 } }; diff --git a/sys/dev/pccard/pccardvar.h b/sys/dev/pccard/pccardvar.h index 7e66e62..11e33ad 100644 --- a/sys/dev/pccard/pccardvar.h +++ b/sys/dev/pccard/pccardvar.h @@ -34,6 +34,7 @@ #include <sys/queue.h> #include <machine/bus.h> +#include "card_if.h" extern int pccard_verbose; @@ -294,8 +295,17 @@ void pccard_io_unmap(struct pccard_function *, int); (pccard_chip_mem_unmap((pf)->sc->pct, (pf)->sc->pch, (window))) /* compat layer */ -int pccard_compat_probe(device_t dev); -int pccard_compat_attach(device_t dev); +static __inline int +pccard_compat_probe(device_t dev) +{ + return (CARD_COMPAT_DO_PROBE(device_get_parent(dev), dev)); +} + +static __inline int +pccard_compat_attach(device_t dev) +{ + return (CARD_COMPAT_DO_ATTACH(device_get_parent(dev), dev)); +} /* ivar interface */ enum { diff --git a/sys/pccard/pccard_nbk.c b/sys/pccard/pccard_nbk.c index c610a8b..5e5d618 100644 --- a/sys/pccard/pccard_nbk.c +++ b/sys/pccard/pccard_nbk.c @@ -80,14 +80,14 @@ devclass_t pccard_devclass; /* * glue for NEWCARD/OLDCARD compat layer */ -int -pccard_compat_probe(device_t dev) +static int +pccard_compat_do_probe(device_t bus, device_t dev) { return (CARD_COMPAT_PROBE(dev)); } -int -pccard_compat_attach(device_t dev) +static int +pccard_compat_do_attach(device_t bus, device_t dev) { return (CARD_COMPAT_ATTACH(dev)); } @@ -376,6 +376,8 @@ static device_method_t pccard_methods[] = { DEVMETHOD(card_get_function, pccard_get_function), DEVMETHOD(card_activate_function, pccard_activate_function), DEVMETHOD(card_deactivate_function, pccard_deactivate_function), + DEVMETHOD(card_compat_do_probe, pccard_compat_do_probe), + DEVMETHOD(card_compat_do_attach, pccard_compat_do_attach), { 0, 0 } }; |