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..)

Should be pulled up to netbsd-10 and netbsd-9.
This commit is contained in:
tsutsui 2024-05-11 09:55:11 +00:00
parent 9f63894909
commit 615d944ef6
1 changed files with 21 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.112 2024/01/16 07:07:00 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.113 2024/05/11 09:55:11 tsutsui 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.112 2024/01/16 07:07:00 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.113 2024/05/11 09:55:11 tsutsui Exp $");
#include "dvbox.h"
#include "gbox.h"
@ -678,10 +678,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++) {
@ -697,6 +696,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: