isa(4) is an indirect bus, which means that drivers that attach to it
need to provide an xxxprobe() method instead of an xxxmatch() method.
The critical difference is xxxprobe() is given a device softc for the
second argument, whereas a xxxmatch() is given the cfdata as the
second argument.

However, a number of our ISA device drivers treat the second argument
as a cfdata instead of a softc.  Diff below addresses this.  (Only
complication: unlike isa(4), isapnp(4) is a direct bus, and if_we.c
used the same probe/match code for both.)

Does this look right?  (Compile tested on i386, but I don't have any
ISA hardware, and I'm not having any luck with qemu's "isapc" machine
at the moment...)


Index: if_lc_isa.c
===================================================================
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/isa/if_lc_isa.c,v
retrieving revision 1.8
diff -u -p -r1.8 if_lc_isa.c
--- if_lc_isa.c 10 Aug 2009 22:08:04 -0000      1.8
+++ if_lc_isa.c 14 Jun 2011 05:38:30 -0000
@@ -182,7 +182,7 @@ lemac_isa_probe(parent, match, aux)
        void *aux;
 {
        struct isa_attach_args *ia = aux;
-       struct cfdata *cf = match;
+       struct cfdata *cf = ((struct device *)match)->dv_cfdata;
        struct lemac_softc sc;
 
        snprintf(sc.sc_dv.dv_xname, sizeof sc.sc_dv.dv_xname, "%s%d",
Index: if_we.c
===================================================================
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/isa/if_we.c,v
retrieving revision 1.20
diff -u -p -r1.20 if_we.c
--- if_we.c     26 Jun 2008 05:42:16 -0000      1.20
+++ if_we.c     14 Jun 2011 05:41:34 -0000
@@ -110,6 +110,7 @@ struct we_softc {
 };
 
 int    we_probe(struct device *, void *, void *);
+int    we_match(struct device *, void *, void *);
 void   we_attach(struct device *, struct device *, void *);
 
 struct cfattach we_isa_ca = {
@@ -118,7 +119,7 @@ struct cfattach we_isa_ca = {
 
 #if NWE_ISAPNP
 struct cfattach we_isapnp_ca = {
-       sizeof(struct we_softc), we_probe, we_attach
+       sizeof(struct we_softc), we_match, we_attach
 };
 #endif /* NWE_ISAPNP */
 
@@ -185,6 +186,14 @@ do { \
 
 int
 we_probe(struct device *parent, void *match, void *aux)
+{
+       struct cfdata *cf = ((struct device *)match)->dv_cfdata;
+
+       return (we_match(parent, cf, aux));
+}
+
+int
+we_match(struct device *parent, void *match, void *aux)
 {
        struct isa_attach_args *ia = aux;
        struct cfdata *cf = match;
Index: radiotrack2.c
===================================================================
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/isa/radiotrack2.c,v
retrieving revision 1.3
diff -u -p -r1.3 radiotrack2.c
--- radiotrack2.c       7 Jan 2002 18:32:19 -0000       1.3
+++ radiotrack2.c       14 Jun 2011 05:34:52 -0000
@@ -127,7 +127,7 @@ rtii_probe(struct device *parent, void *
        struct isa_attach_args *ia = aux;
        bus_space_tag_t iot = ia->ia_iot;
        bus_space_handle_t ioh;
-       struct cfdata *cf = match;
+       struct cfdata *cf = ((struct device *)match)->dv_cfdata;
        int iosize = 1, iobase = ia->ia_iobase;
 
        if (!RTII_BASE_VALID(iobase)) {
Index: sf16fmr2.c
===================================================================
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/isa/sf16fmr2.c,v
retrieving revision 1.6
diff -u -p -r1.6 sf16fmr2.c
--- sf16fmr2.c  15 Oct 2002 15:00:11 -0000      1.6
+++ sf16fmr2.c  14 Jun 2011 05:34:32 -0000
@@ -140,7 +140,7 @@ sf2r_probe(struct device *parent, void *
        struct isa_attach_args *ia = aux;
        bus_space_tag_t iot = ia->ia_iot;
        bus_space_handle_t ioh;
-       struct cfdata *cf = match;
+       struct cfdata *cf = ((struct device *)match)->dv_cfdata;
        int iosize = 1, iobase = ia->ia_iobase;
 
        if (!SF16FMR2_BASE_VALID(iobase)) {
Index: wdc_isa.c
===================================================================
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/isa/wdc_isa.c,v
retrieving revision 1.14
diff -u -p -r1.14 wdc_isa.c
--- wdc_isa.c   9 May 2011 22:33:54 -0000       1.14
+++ wdc_isa.c   14 Jun 2011 05:34:05 -0000
@@ -83,7 +83,7 @@ wdc_isa_probe(struct device *parent, voi
 {
        struct channel_softc ch;
        struct isa_attach_args *ia = aux;
-       struct cfdata *cf = match;
+       struct cfdata *cf = ((struct device *)match)->dv_cfdata;
        int result = 0;
 
        bzero(&ch, sizeof ch);

Reply via email to