diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index f171d77e08bc..ff9a9c06b0dd 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -117,7 +117,7 @@ dev/sbni/if_sbni_pci.c optional sbni pci dev/sio/sio.c optional sio dev/sio/sio_isa.c optional sio isa dev/sio/sio_pccard.c optional sio card -#dev/sio/sio_pccard.c optional sio pccard +dev/sio/sio_pccard.c optional sio pccard dev/sio/sio_pci.c optional sio pci dev/sr/if_sr_isa.c optional sr isa dev/syscons/apm/apm_saver.c optional apm_saver apm diff --git a/sys/conf/files.pc98 b/sys/conf/files.pc98 index f0639986a938..fb1cdf86647f 100644 --- a/sys/conf/files.pc98 +++ b/sys/conf/files.pc98 @@ -399,6 +399,8 @@ pc98/pc98/scgdcrndr.c optional sc gdc pc98/pc98/scterm-sck.c optional sc pc98/pc98/scvtbpc98.c optional sc pc98/pc98/sio.c optional sio +#pc98/pc98/sio_pccard.c optional card +#pc98/pc98/sio_pccard.c optional pccard pc98/pc98/spkr.c optional speaker pc98/pc98/syscons.c optional sc pc98/pc98/syscons_pc98.c optional sc diff --git a/sys/dev/sio/sio_pccard.c b/sys/dev/sio/sio_pccard.c index 3d154984d6f0..c25709d7d8ef 100644 --- a/sys/dev/sio/sio_pccard.c +++ b/sys/dev/sio/sio_pccard.c @@ -40,18 +40,28 @@ #include #include +#include +#include +#include + #include static int sio_pccard_attach __P((device_t dev)); static int sio_pccard_detach __P((device_t dev)); +static int sio_pccard_match __P((device_t self)); static int sio_pccard_probe __P((device_t dev)); static device_method_t sio_pccard_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, sio_pccard_probe), - DEVMETHOD(device_attach, sio_pccard_attach), + DEVMETHOD(device_probe, pccard_compat_probe), + DEVMETHOD(device_attach, pccard_compat_attach), DEVMETHOD(device_detach, sio_pccard_detach), + /* Card interface */ + DEVMETHOD(card_compat_match, sio_pccard_match), + DEVMETHOD(card_compat_probe, sio_pccard_probe), + DEVMETHOD(card_compat_attach, sio_pccard_attach), + { 0, 0 } }; @@ -61,6 +71,24 @@ static driver_t sio_pccard_driver = { sizeof(struct com_s), }; +static int +sio_pccard_match(device_t dev) +{ + int error = 0; + u_int32_t fcn = PCCARD_FUNCTION_UNSPEC; + + error = pccard_get_function(dev, &fcn); + if (error != 0) + return (error); + /* + * If a serial card, we are likely the right driver. + */ + if (fcn == PCCARD_FUNCTION_SERIAL) + return (0); + + return(ENXIO); +} + static int sio_pccard_probe(dev) device_t dev;