Module Name:    src
Committed By:   tsutsui
Date:           Mon Jan 14 01:37:58 UTC 2013

Modified Files:
        src/sys/arch/luna68k/stand/boot: autoconf.c ioconf.c samachdep.h sc.c
            sd.c ufs_disksubr.c version

Log Message:
Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/autoconf.c \
    src/sys/arch/luna68k/stand/boot/ioconf.c \
    src/sys/arch/luna68k/stand/boot/sc.c src/sys/arch/luna68k/stand/boot/sd.c \
    src/sys/arch/luna68k/stand/boot/version
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/luna68k/stand/boot/samachdep.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/stand/boot/ufs_disksubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/luna68k/stand/boot/autoconf.c
diff -u src/sys/arch/luna68k/stand/boot/autoconf.c:1.2 src/sys/arch/luna68k/stand/boot/autoconf.c:1.3
--- src/sys/arch/luna68k/stand/boot/autoconf.c:1.2	Sat Jan 12 13:39:47 2013
+++ src/sys/arch/luna68k/stand/boot/autoconf.c	Mon Jan 14 01:37:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.2 2013/01/12 13:39:47 tsutsui Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.3 2013/01/14 01:37:57 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -80,6 +80,7 @@
 
 #include <sys/param.h>
 #include <sys/dkstat.h>
+#include <machine/cpu.h>
 #include <lib/libkern/libkern.h>
 #include <luna68k/stand/boot/samachdep.h>
 #include <luna68k/stand/boot/device.h>
@@ -499,6 +500,10 @@ find_devs(void)
 	setup_hw(hw, (char *) 0xe1000000, 0xe, SCSI,     0xe, "MB89352  (SPC)");
 	hw++;
 
+	if (machtype == LUNA_II && !badaddr((void *) 0xe1000040)) {
+		setup_hw(hw, (char *) 0xe1000040, 0xe, SCSI,     0xe, "MB89352  (SPC)");
+		hw++;
+	}
 	if (!badaddr((void *) 0xf1000000)) {
 		setup_hw(hw, (char *) 0xf1000000, 0xf, NET,      0xf, "Am7990 (LANCE)");
 		hw++;
Index: src/sys/arch/luna68k/stand/boot/ioconf.c
diff -u src/sys/arch/luna68k/stand/boot/ioconf.c:1.2 src/sys/arch/luna68k/stand/boot/ioconf.c:1.3
--- src/sys/arch/luna68k/stand/boot/ioconf.c:1.2	Sun Jan 13 14:10:55 2013
+++ src/sys/arch/luna68k/stand/boot/ioconf.c	Mon Jan 14 01:37:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ioconf.c,v 1.2 2013/01/13 14:10:55 tsutsui Exp $	*/
+/*	$NetBSD: ioconf.c,v 1.3 2013/01/14 01:37:57 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -86,6 +86,7 @@ extern struct driver stdriver;
 struct hp_ctlr hp_cinit[] = {
 /*	driver,		unit,	alive,	addr,	flags */
 	{ &scdriver,	0,	0,	C 0x0,	0x0 },
+	{ &scdriver,	1,	0,	C 0x0,	0x0 },
 	{0},
 };
 
@@ -93,6 +94,8 @@ struct hp_device hp_dinit[] = {
 /*driver,	cdriver,	unit,	ctlr,	slave,	addr,	dk,	flags*/
 { &sddriver,	&scdriver,	0,	0,	6,	C 0x0,	1,	0x0 },
 { &sddriver,	&scdriver,	1,	0,	5,	C 0x0,	1,	0x0 },
+{ &sddriver,	&scdriver,	2,	1,	6,	C 0x0,	1,	0x0 },
+{ &sddriver,	&scdriver,	3,	1,	5,	C 0x0,	1,	0x0 },
 { &ledriver,	NULL,		0,	0,	0,	C 0x0,	0,	0x0 },
 #ifdef notyet
 { &stdriver,	&scdriver,	0,	0,	4,	C 0x0,	0,	0x0 },
Index: src/sys/arch/luna68k/stand/boot/sc.c
diff -u src/sys/arch/luna68k/stand/boot/sc.c:1.2 src/sys/arch/luna68k/stand/boot/sc.c:1.3
--- src/sys/arch/luna68k/stand/boot/sc.c:1.2	Sun Jan 13 04:39:28 2013
+++ src/sys/arch/luna68k/stand/boot/sc.c	Mon Jan 14 01:37:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sc.c,v 1.2 2013/01/13 04:39:28 tsutsui Exp $	*/
+/*	$NetBSD: sc.c,v 1.3 2013/01/14 01:37:57 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -76,7 +76,7 @@
  */
 
 
-#define NSC	1
+#define NSC	2
 
 #include <sys/param.h>
 #include <luna68k/stand/boot/samachdep.h>
@@ -111,7 +111,14 @@ int
 scinit(void *arg)
 {
 	struct hp_ctlr *hc = arg;
-	struct scsi_softc *hs = &scsi_softc[hc->hp_unit];
+	struct scsi_softc *hs;
+	int unit;
+
+	unit = hc->hp_unit;
+	if (unit < 0 || unit >= NSC)
+		return 0;
+
+	hs = &scsi_softc[unit];
 
 	hc->hp_ipl    = SCSI_IPL;
 	hs->sc_hc     = hc;
Index: src/sys/arch/luna68k/stand/boot/sd.c
diff -u src/sys/arch/luna68k/stand/boot/sd.c:1.2 src/sys/arch/luna68k/stand/boot/sd.c:1.3
--- src/sys/arch/luna68k/stand/boot/sd.c:1.2	Sun Jan 13 04:39:28 2013
+++ src/sys/arch/luna68k/stand/boot/sd.c	Mon Jan 14 01:37:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sd.c,v 1.2 2013/01/13 04:39:28 tsutsui Exp $	*/
+/*	$NetBSD: sd.c,v 1.3 2013/01/14 01:37:57 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -252,7 +252,7 @@ sdinit(void *arg)
 	/*
 	 * read disklabel
 	 */
-	msg = readdisklabel(hd->hp_slave, sdstrategy, lp);
+	msg = readdisklabel(hd->hp_ctlr, hd->hp_slave, lp);
 	if (msg != NULL)
 		printf("sd%d: %s\n", hd->hp_unit, msg);
 
Index: src/sys/arch/luna68k/stand/boot/version
diff -u src/sys/arch/luna68k/stand/boot/version:1.2 src/sys/arch/luna68k/stand/boot/version:1.3
--- src/sys/arch/luna68k/stand/boot/version:1.2	Sun Jan 13 14:10:55 2013
+++ src/sys/arch/luna68k/stand/boot/version	Mon Jan 14 01:37:57 2013
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.2 2013/01/13 14:10:55 tsutsui Exp $
+$NetBSD: version,v 1.3 2013/01/14 01:37:57 tsutsui Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -6,3 +6,4 @@ is taken as the current.
 
 1.0:	Initial revision, based on 4.4BSD-Lite2/luna68k and NetBSD/hp300
 1.1:	Add netboot support.
+1.2:	Add support for secondary SPC SCSI on LUNA-II.

Index: src/sys/arch/luna68k/stand/boot/samachdep.h
diff -u src/sys/arch/luna68k/stand/boot/samachdep.h:1.3 src/sys/arch/luna68k/stand/boot/samachdep.h:1.4
--- src/sys/arch/luna68k/stand/boot/samachdep.h:1.3	Sun Jan 13 14:10:55 2013
+++ src/sys/arch/luna68k/stand/boot/samachdep.h	Mon Jan 14 01:37:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: samachdep.h,v 1.3 2013/01/13 14:10:55 tsutsui Exp $	*/
+/*	$NetBSD: samachdep.h,v 1.4 2013/01/14 01:37:57 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -208,7 +208,7 @@ int tape(int, char **);
 void trap(int, unsigned int, unsigned int, struct frame);
 
 /* ufs_disklabel.c */
-char *readdisklabel(int dev, int (*)(void *, int, daddr_t, size_t, void *, size_t *), struct disklabel *);
+char *readdisklabel(int, int, struct disklabel *);
 
 
 #define DELAY(n)							\

Index: src/sys/arch/luna68k/stand/boot/ufs_disksubr.c
diff -u src/sys/arch/luna68k/stand/boot/ufs_disksubr.c:1.1 src/sys/arch/luna68k/stand/boot/ufs_disksubr.c:1.2
--- src/sys/arch/luna68k/stand/boot/ufs_disksubr.c:1.1	Sat Jan  5 17:44:24 2013
+++ src/sys/arch/luna68k/stand/boot/ufs_disksubr.c	Mon Jan 14 01:37:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_disksubr.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $	*/
+/*	$NetBSD: ufs_disksubr.c,v 1.2 2013/01/14 01:37:57 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -89,7 +89,7 @@
  * Returns null on success and an error string on failure.
  */
 char *
-readdisklabel(int dev, int (*strat)(void *, int, daddr_t, size_t, void *, size_t *), struct disklabel *lp)
+readdisklabel(int ctlr, int id, struct disklabel *lp)
 {
 	u_char *bp = lbl_buff;
 	struct disklabel *dlp;
@@ -106,7 +106,7 @@ readdisklabel(int dev, int (*strat)(void
 		lp->d_partitions[0].p_size = 0x1fffffff;
 	lp->d_partitions[0].p_offset = 0;
 
-	if (scsi_immed_command(0, dev, 0, &cdb, bp, DEV_BSIZE) != 0) {
+	if (scsi_immed_command(ctlr, id, 0, &cdb, bp, DEV_BSIZE) != 0) {
 		msg = "I/O error";
 	} else {
 		for (dlp = (struct disklabel *)bp;

Reply via email to