Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/luna68k Explicitly check machine type (LUNA-II) on ...



details:   https://anonhg.NetBSD.org/src/rev/d01127326218
branches:  trunk
changeset: 374445:d01127326218
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Apr 23 06:57:59 2023 +0000

description:
Explicitly check machine type (LUNA-II) on secondary spc(4) probe.

So that individual mainbus_attach_args for both LUNA and LUNA-II
are no longer necessary.
While here, use proper address macro in <machine/board.h>.

Tested on both LUNA and LUNA-II.

diffstat:

 sys/arch/luna68k/dev/spc.c         |  19 ++++++++++++-----
 sys/arch/luna68k/luna68k/mainbus.c |  41 ++++++++++++-------------------------
 2 files changed, 27 insertions(+), 33 deletions(-)

diffs (119 lines):

diff -r 9e8b0255844a -r d01127326218 sys/arch/luna68k/dev/spc.c
--- a/sys/arch/luna68k/dev/spc.c        Sun Apr 23 06:30:58 2023 +0000
+++ b/sys/arch/luna68k/dev/spc.c        Sun Apr 23 06:57:59 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spc.c,v 1.10 2013/01/22 15:44:25 tsutsui Exp $ */
+/* $NetBSD: spc.c,v 1.11 2023/04/23 06:57:59 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: spc.c,v 1.10 2013/01/22 15:44:25 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spc.c,v 1.11 2023/04/23 06:57:59 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -40,6 +40,7 @@
 #include <machine/bus.h>
 #include <machine/cpu.h>
 #include <machine/autoconf.h>
+#include <machine/board.h>
 
 #include <dev/scsipi/scsi_all.h>
 #include <dev/scsipi/scsipi_all.h>
@@ -66,11 +67,17 @@ spc_mainbus_match(device_t parent, cfdat
 
        if (strcmp(ma->ma_name, spc_cd.cd_name))
                return 0;
-#if 0
-       if (badaddr((void *)ma->ma_addr, 4))
+
+       /*
+        * LUNA-I doesn't have the secondary SCSI.
+        * However we cannot check it by badaddr() at the address range
+        * of the secondary SCSI on LUNA-II because the address bus lines
+        * are not fully decoded on LUNA-I and the primary SCSI registers
+        * are also accessible at the seconadary address range.
+        */
+       if (machtype == LUNA_I && ma->ma_addr != SCSI_ADDR)
                return 0;
-       /* Experiments proved 2nd SPC address does NOT make a buserror. */
-#endif
+
        return 1;
 }
 
diff -r 9e8b0255844a -r d01127326218 sys/arch/luna68k/luna68k/mainbus.c
--- a/sys/arch/luna68k/luna68k/mainbus.c        Sun Apr 23 06:30:58 2023 +0000
+++ b/sys/arch/luna68k/luna68k/mainbus.c        Sun Apr 23 06:57:59 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.20 2023/04/13 11:44:10 tsutsui Exp $ */
+/* $NetBSD: mainbus.c,v 1.21 2023/04/23 06:57:59 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.20 2023/04/13 11:44:10 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.21 2023/04/23 06:57:59 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -39,26 +39,17 @@
 
 #include <machine/cpu.h>
 #include <machine/autoconf.h>
+#include <machine/board.h>
 
 static const struct mainbus_attach_args luna_devs[] = {
-       { "clock",  0x45000000, -1 },   /* Mostek TimeKeeper */
-       { "lcd",    0x4d000000, -1 },   /* Sharp LM16X212 LCD module */
-       { "le",     0xf1000000, 3 },    /* Am7990 */
-       { "sio",    0x51000000, 6 },    /* uPD7201A */
-       { "xpbus",  0x71000000, -1 },   /* HD647180XP */
-       { "fb",     0xc1100000, -1 },   /* BrookTree RAMDAC */
-       { "spc",    0xe1000000, 2 },    /* MB89352 */
-};
-
-static const struct mainbus_attach_args luna2_devs[] = {
-       { "clock",  0x45000000, -1 },   /* Dallas TimeKeeper */
-       { "lcd",    0x4d000000, -1 },   /* Sharp LM16X212 LCD module */
-       { "le",     0xf1000000, 3 },    /* Am7990 */
-       { "sio",    0x51000000, 6 },    /* uPD7201A */
-       { "xpbus",  0x71000000, -1 },   /* HD647180XP */
-       { "fb",     0xc1100000, -1 },   /* BrookTree RAMDAC */
-       { "spc",    0xe1000000, 2 },    /* internal MB89352 */
-       { "spc",    0xe1000040, 2 },    /* external MB89352 */
+       { "clock",  NVRAM_ADDR, -1 },   /* Mostek/Dallas TimeKeeper */
+       { "lcd",    OBIO_PIO1A, -1 },   /* Sharp LM16X212 LCD module */
+       { "le",     LANCE_ADDR, 3 },    /* Am7990 */
+       { "sio",    OBIO_SIO, 6 },      /* uPD7201A */
+       { "xpbus",  TRI_PORT_RAM, -1 }, /* HD647180XP */
+       { "fb",     BMAP_PALLET2, -1 }, /* BrookTree RAMDAC */
+       { "spc",    SCSI_ADDR, 2 },     /* internal MB89352 */
+       { "spc",    SCSI_2_ADDR, 2 },   /* external MB89352 (on LUNA-II) */
 };
 
 static void mainbus_attach(device_t, device_t, void *);
@@ -87,13 +78,9 @@ mainbus_attach(device_t parent, device_t
        const struct mainbus_attach_args *devs;
        struct mainbus_attach_args ma;
 
-       if (machtype == LUNA_II) {
-               devs = luna2_devs;
-               ndevs = __arraycount(luna2_devs);
-       } else {
-               devs = luna_devs;
-               ndevs = __arraycount(luna_devs);
-       }
+       devs = luna_devs;
+       ndevs = __arraycount(luna_devs);
+
        aprint_normal("\n");
        for (i = 0; i < ndevs; i++) {
                ma = devs[i];



Home | Main Index | Thread Index | Old Index