Port-sun3 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: __BROKEN_CONFIG_UNIT_USAGE ?



On Sun, Dec 06, 2009 at 02:27:36PM -0600, David Young wrote:
> It looks to me like the relationships can be expressed in the
> kernel configuration file.  I am going to delete all of the #ifdef
> __BROKEN_CONFIG_UNIT_USAGE code from sys/kern/subr_autoconf.c in a week.
> I will send an untested patch to try to ease sun3's transition.

I think that something like the attached will do.

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933
Index: conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/conf/GENERIC,v
retrieving revision 1.148
diff -p -u -u -p -r1.148 GENERIC
--- conf/GENERIC        17 Jan 2009 07:31:57 -0000      1.148
+++ conf/GENERIC        6 Dec 2009 21:01:56 -0000
@@ -205,12 +205,20 @@ si1 at vme2 addr 0x204000 ipl 2 vect 0x4
 # Xylogics 450/451 controllers (VME A16/D16)
 xyc0 at vme0 addr 0xee40 ipl 2 vect 0x48
 xyc1 at vme0 addr 0xee48 ipl 2 vect 0x49
-xy* at xyc? drive ?
+xy0 at xyc0 drive 0
+xy1 at xyc0 drive 1
+xy2 at xyc1 drive 0
+xy3 at xyc1 drive 1
 
 # Xylogics 7053 controllers (VME A16/D32)
 xdc0 at vme1 addr 0xee80 ipl 2 vect 0x44
 xdc1 at vme1 addr 0xee90 ipl 2 vect 0x45
-xd* at xdc? drive ?
+xd0 at xdc0 drive 0
+xd1 at xdc0 drive 1
+xd2 at xdc0 drive 2
+xd3 at xdc0 drive 3
+xd4 at xdc1 drive 2
+xd5 at xdc1 drive 3
 
 # Xylogics 472 tape controllers?
 
Index: conf/GENERIC3X
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/conf/GENERIC3X,v
retrieving revision 1.105
diff -p -u -u -p -r1.105 GENERIC3X
--- conf/GENERIC3X      17 Jan 2009 07:31:57 -0000      1.105
+++ conf/GENERIC3X      6 Dec 2009 21:01:56 -0000
@@ -196,12 +196,20 @@ si1 at vme2 addr 0x204000 ipl 2 vect 0x4
 # Xylogics 450/451 controllers (VME A16/D16)
 xyc0 at vme0 addr 0xee40 ipl 2 vect 0x48
 xyc1 at vme0 addr 0xee48 ipl 2 vect 0x49
-xy* at xyc? drive ?
+xy0 at xyc0 drive 0
+xy1 at xyc0 drive 1
+xy2 at xyc1 drive 0
+xy3 at xyc1 drive 1
 
 # Xylogics 7053 controllers (VME A16/D32)
 xdc0 at vme1 addr 0xee80 ipl 2 vect 0x44
 xdc1 at vme1 addr 0xee90 ipl 2 vect 0x45
-xd* at xdc? drive ?
+xd0 at xdc0 drive 0
+xd1 at xdc0 drive 1
+xd2 at xdc0 drive 2
+xd3 at xdc0 drive 3
+xd4 at xdc1 drive 2
+xd5 at xdc1 drive 3
 
 # Xylogics 472 tape controllers?
 
Index: conf/INSTALL
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/conf/INSTALL,v
retrieving revision 1.45
diff -p -u -u -p -r1.45 INSTALL
--- conf/INSTALL        6 Mar 2009 20:31:53 -0000       1.45
+++ conf/INSTALL        6 Dec 2009 21:01:56 -0000
@@ -151,12 +151,20 @@ si1 at vme2 addr 0x204000 ipl 2 vect 0x4
 # Xylogics 450/451 controllers (VME A16/D16)
 xyc0 at vme0 addr 0xee40 ipl 2 vect 0x48
 xyc1 at vme0 addr 0xee48 ipl 2 vect 0x49
-xy* at xyc? drive ?
+xy0 at xyc0 drive 0
+xy1 at xyc0 drive 1
+xy2 at xyc1 drive 0
+xy3 at xyc1 drive 1
 
 # Xylogics 7053 controllers (VME A16/D32)
 xdc0 at vme1 addr 0xee80 ipl 2 vect 0x44
 xdc1 at vme1 addr 0xee90 ipl 2 vect 0x45
-xd* at xdc? drive ?
+xd0 at xdc0 drive 0
+xd1 at xdc0 drive 1
+xd2 at xdc0 drive 2
+xd3 at xdc0 drive 3
+xd4 at xdc1 drive 2
+xd5 at xdc1 drive 3
 
 # Xylogics 472 tape controllers?
 
Index: conf/INSTALL3X
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/conf/INSTALL3X,v
retrieving revision 1.44
diff -p -u -u -p -r1.44 INSTALL3X
--- conf/INSTALL3X      6 Mar 2009 20:31:53 -0000       1.44
+++ conf/INSTALL3X      6 Dec 2009 21:01:56 -0000
@@ -156,12 +156,20 @@ si1 at vme2 addr 0x204000 ipl 2 vect 0x4
 # Xylogics 450/451 controllers (VME A16/D16)
 xyc0 at vme0 addr 0xee40 ipl 2 vect 0x48
 xyc1 at vme0 addr 0xee48 ipl 2 vect 0x49
-xy* at xyc? drive ?
+xy0 at xyc0 drive 0
+xy1 at xyc0 drive 1
+xy2 at xyc1 drive 0
+xy3 at xyc1 drive 1
 
 # Xylogics 7053 controllers (VME A16/D32)
 xdc0 at vme1 addr 0xee80 ipl 2 vect 0x44
 xdc1 at vme1 addr 0xee90 ipl 2 vect 0x45
-xd* at xdc? drive ?
+xd0 at xdc0 drive 0
+xd1 at xdc0 drive 1
+xd2 at xdc0 drive 2
+xd3 at xdc0 drive 3
+xd4 at xdc1 drive 2
+xd5 at xdc1 drive 3
 
 # Xylogics 472 tape controllers?
 
Index: conf/RAMDISK
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/conf/RAMDISK,v
retrieving revision 1.50
diff -p -u -u -p -r1.50 RAMDISK
--- conf/RAMDISK        6 Feb 2009 18:50:28 -0000       1.50
+++ conf/RAMDISK        6 Dec 2009 21:01:56 -0000
@@ -105,12 +105,20 @@ si1 at vme2 addr 0x204000 ipl 2 vect 0x4
 # Xylogics 450/451 controllers (VME A16/D16)
 xyc0 at vme0 addr 0xee40 ipl 2 vect 0x48
 xyc1 at vme0 addr 0xee48 ipl 2 vect 0x49
-xy* at xyc? drive ?
+xy0 at xyc0 drive 0
+xy1 at xyc0 drive 1
+xy2 at xyc1 drive 0
+xy3 at xyc1 drive 1
 
 # Xylogics 7053 controllers (VME A16/D32)
 xdc0 at vme1 addr 0xee80 ipl 2 vect 0x44
 xdc1 at vme1 addr 0xee90 ipl 2 vect 0x45
-xd* at xdc? drive ?
+xd0 at xdc0 drive 0
+xd1 at xdc0 drive 1
+xd2 at xdc0 drive 2
+xd3 at xdc0 drive 3
+xd4 at xdc1 drive 2
+xd5 at xdc1 drive 3
 
 # Xylogics 472 tape controllers?
 
Index: conf/RAMDISK3X
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/conf/RAMDISK3X,v
retrieving revision 1.38
diff -p -u -u -p -r1.38 RAMDISK3X
--- conf/RAMDISK3X      6 Feb 2009 18:50:28 -0000       1.38
+++ conf/RAMDISK3X      6 Dec 2009 21:01:56 -0000
@@ -110,12 +110,20 @@ si1 at vme2 addr 0x204000 ipl 2 vect 0x4
 # Xylogics 450/451 controllers (VME A16/D16)
 xyc0 at vme0 addr 0xee40 ipl 2 vect 0x48
 xyc1 at vme0 addr 0xee48 ipl 2 vect 0x49
-xy* at xyc? drive ?
+xy0 at xyc0 drive 0
+xy1 at xyc0 drive 1
+xy2 at xyc1 drive 0
+xy3 at xyc1 drive 1
 
 # Xylogics 7053 controllers (VME A16/D32)
 xdc0 at vme1 addr 0xee80 ipl 2 vect 0x44
 xdc1 at vme1 addr 0xee90 ipl 2 vect 0x45
-xd* at xdc? drive ?
+xd0 at xdc0 drive 0
+xd1 at xdc0 drive 1
+xd2 at xdc0 drive 2
+xd3 at xdc0 drive 3
+xd4 at xdc1 drive 2
+xd5 at xdc1 drive 3
 
 # Xylogics 472 tape controllers?
 
Index: dev/xd.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/dev/xd.c,v
retrieving revision 1.67
diff -p -u -u -p -r1.67 xd.c
--- dev/xd.c    13 Jan 2009 13:35:52 -0000      1.67
+++ dev/xd.c    6 Dec 2009 21:01:57 -0000
@@ -533,13 +533,6 @@ xdc_print(void *aux, const char *name)
 int 
 xdmatch(device_t parent, cfdata_t cf, void *aux)
 {
-       struct xdc_attach_args *xa = aux;
-       int xd_unit;
-
-       /* Match only on the "wired-down" controller+disk. */
-       xd_unit = device_unit(parent) * 2 + xa->driveno;
-       if (cf->cf_unit != xd_unit)
-               return 0;
 
        return 1;
 }
Index: dev/xy.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/dev/xy.c,v
retrieving revision 1.71
diff -p -u -u -p -r1.71 xy.c
--- dev/xy.c    13 Jan 2009 13:35:52 -0000      1.71
+++ dev/xy.c    6 Dec 2009 21:01:57 -0000
@@ -468,13 +468,6 @@ xyc_print(void *aux, const char *name)
 static int 
 xymatch(device_t parent, cfdata_t cf, void *aux)
 {
-       struct xyc_attach_args *xa = aux;
-       int xy_unit;
-
-       /* Match only on the "wired-down" controller+disk. */
-       xy_unit = device_unit(parent) * 2 + xa->driveno;
-       if (cf->cf_unit != xy_unit)
-               return 0;
 
        return 1;
 }
Index: include/types.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/include/types.h,v
retrieving revision 1.17
diff -p -u -u -p -r1.17 types.h
--- include/types.h     20 Jan 2008 18:09:09 -0000      1.17
+++ include/types.h     6 Dec 2009 21:01:57 -0000
@@ -1,5 +1,3 @@
 /*     $NetBSD: types.h,v 1.17 2008/01/20 18:09:09 joerg Exp $ */
 
 #include <m68k/types.h>
-
-#define        __BROKEN_CONFIG_UNIT_USAGE
Index: sun3/vme.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/sun3/vme.c,v
retrieving revision 1.21
diff -p -u -u -p -r1.21 vme.c
--- sun3/vme.c  28 Jun 2008 12:13:38 -0000      1.21
+++ sun3/vme.c  6 Dec 2009 21:01:57 -0000
@@ -50,24 +50,23 @@ __KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.21
 extern int cpu_has_vme;
 
 /*
- * Convert vme unit number to bus type,
+ * Convert vme bus type to bus type parameters,
  * but only for supported bus types.
  * (See autoconf.h and vme.h)
  */
-#define VME_UNITS      6
 static const struct {
-       int bustype;
+       bool present;
        const char *name;
        int pmtype;
        vaddr_t base;
        vaddr_t mask;
-} vme_info[VME_UNITS] = {
-       { BUS_VME16D16, "A16/D16", PMAP_VME16, VME16_BASE, VME16_MASK },
-       { BUS_VME16D32, "A16/D32", PMAP_VME32, VME16_BASE, VME16_MASK },
-       { BUS_VME24D16, "A24/D16", PMAP_VME16, VME24_BASE, VME24_MASK },
-       { BUS_VME24D32, "A24/D32", PMAP_VME32, VME24_BASE, VME24_MASK },
-       { BUS_VME32D16, "A32/D16", PMAP_VME16, VME32_BASE, VME32_MASK },
-       { BUS_VME32D32, "A32/D32", PMAP_VME32, VME32_BASE, VME32_MASK },
+} vme_info[] = {
+       [BUS_VME16D16] = {true, "A16/D16", PMAP_VME16, VME16_BASE, VME16_MASK},
+       [BUS_VME16D32] = {true, "A16/D32", PMAP_VME32, VME16_BASE, VME16_MASK},
+       [BUS_VME24D16] = {true, "A24/D16", PMAP_VME16, VME24_BASE, VME24_MASK},
+       [BUS_VME24D32] = {true, "A24/D32", PMAP_VME32, VME24_BASE, VME24_MASK},
+       [BUS_VME32D16] = {true, "A32/D16", PMAP_VME16, VME32_BASE, VME32_MASK},
+       [BUS_VME32D32] = {true, "A32/D32", PMAP_VME32, VME32_BASE, VME32_MASK},
 };
 
 static int  vme_match(device_t , cfdata_t, void *);
@@ -109,16 +108,12 @@ static int 
 vme_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct confargs *ca = aux;
-       int unit;
 
        if (cpu_has_vme == 0)
                return 0;
 
-       unit = cf->cf_unit;
-       if (unit >= VME_UNITS)
-               return 0;
-
-       if (ca->ca_bustype != vme_info[unit].bustype)
+       if (ca->ca_bustype >= __arraycount(vme_info) ||
+           !vme_info[ca->ca_bustype].present)
                return 0;
 
        return 1;
@@ -130,16 +125,14 @@ vme_attach(device_t parent, device_t sel
        struct confargs *ca = aux;
        struct vme_softc *sc = device_private(self);
        struct confargs vmea;
-       int unit;
 
        sc->sc_dev = self;
 
-       unit = device_unit(self);
-       aprint_normal(": (%s)\n", vme_info[unit].name);
-
        sc->sc_bustag = ca->ca_bustag;
        sc->sc_dmatag = ca->ca_dmatag;
-       sc->sc_bustype = unit;
+       sc->sc_bustype = ca->ca_bustype;
+
+       aprint_normal(": (%s)\n", vme_info[sc->sc_bustype].name);
 
        vme_space_tag.cookie = sc;
        vme_space_tag.parent = sc->sc_bustag;


Home | Main Index | Thread Index | Old Index