Module Name:    src
Committed By:   martin
Date:           Mon Jun 17 16:43:05 UTC 2024

Modified Files:
        src/sys/arch/hp300/hp300 [netbsd-9]: autoconf.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1842):

        sys/arch/hp300/hp300/autoconf.c: revision 1.113

Fix a 20 years old botch by me in setbootdev() on switching to MI SCSI.
setbootdev() updates bootdev data shared between BOOTROM and
it notifies BOOTROM to choose a current root device as a boot device
on the next boot, but I didn't understand the intention and then
it has been broken on SCSI disks. Sigh.

(I wonder if no one has noticed this old feature for 20 years..)


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.106.2.1 src/sys/arch/hp300/hp300/autoconf.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/hp300/hp300/autoconf.c
diff -u src/sys/arch/hp300/hp300/autoconf.c:1.106 src/sys/arch/hp300/hp300/autoconf.c:1.106.2.1
--- src/sys/arch/hp300/hp300/autoconf.c:1.106	Sat Jun 29 02:41:17 2019
+++ src/sys/arch/hp300/hp300/autoconf.c	Mon Jun 17 16:43:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.106 2019/06/29 02:41:17 tsutsui Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.106.2.1 2024/06/17 16:43:05 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2002 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.106 2019/06/29 02:41:17 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.106.2.1 2024/06/17 16:43:05 martin Exp $");
 
 #include "dvbox.h"
 #include "gbox.h"
@@ -654,10 +654,9 @@ setbootdev(void)
 	 */
 	switch (type) {
 	case 2: /* rd */
-	case 4: /* sd */
 		/*
 		 * "rd" -> "hpibbus" -> "fhpib"
-		 * "sd" -> "scsibus" -> "spc"
+		 * "rd" -> "hpibbus" -> "nhpib"
 		 */
 		for (cdd = LIST_FIRST(&dev_data_list_hpib), ctlr = 0;
 		    cdd != NULL; cdd = LIST_NEXT(cdd, dd_clist), ctlr++) {
@@ -673,6 +672,24 @@ setbootdev(void)
 			}
 		}
 		break;
+	case 4: /* sd */
+		/*
+		 * "sd" -> "scsibus" -> "spc"
+		 */
+		for (cdd = LIST_FIRST(&dev_data_list_scsi), ctlr = 0;
+		    cdd != NULL; cdd = LIST_NEXT(cdd, dd_clist), ctlr++) {
+			if (cdd->dd_dev ==
+			    device_parent(device_parent(root_device))) {
+				/*
+				 * Found it!
+				 */
+				bootdev = MAKEBOOTDEV(type,
+				    ctlr, dd->dd_slave, dd->dd_punit,
+				    DISKPART(rootdev));
+				break;
+			}
+		}
+		break;
 	}
 
  out:

Reply via email to