NetBSD Problem Report #56991
From www@netbsd.org Sat Sep 3 03:51:31 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 940651A921F
for <gnats-bugs@gnats.NetBSD.org>; Sat, 3 Sep 2022 03:51:31 +0000 (UTC)
Message-Id: <20220903035129.A93001A923B@mollari.NetBSD.org>
Date: Sat, 3 Sep 2022 03:51:29 +0000 (UTC)
From: sciatic.tribune.0o@icloud.com
Reply-To: sciatic.tribune.0o@icloud.com
To: gnats-bugs@NetBSD.org
Subject: mvme68k systems fail to mount root from SCSI targets other than zero
X-Send-Pr-Version: www-1.0
>Number: 56991
>Category: port-mvme68k
>Synopsis: mvme68k systems fail to mount root from SCSI targets other than zero
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: port-mvme68k-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Sep 03 03:55:01 +0000 2022
>Last-Modified: Sat Sep 03 14:05:01 +0000 2022
>Originator: Mike
>Release: netbsd-9-3-RELEASE
>Organization:
>Environment:
NetBSD netbsd_mvme68k 9.3 NetBSD 9.3 (GENERIC) #2: Thu Sep 1 19:17:13 PDT 2022 anon@netbsd_amd64:/home/anon/obj/sys/arch/mvme68k/compile/GENERIC mvme68
>Description:
The MVME ROM passes a "devlun" argument to bootloader, containing the SCSI target ID and LUN of the disk being booted from. This is subsequently passed to the kernel where it is recovered in locore, and then used in autoconf.c:device_register() to determine whether a device is the boot disk.
The passed-in value encodes the target ID and LUN in the low byte; high 4 bits containing the target ID, low 4 bits the LUN. Unfortunately, device_register() compares the passed-in value directly with a candidate 'sd' device's target ID. This works when the passed-in value is zero (target/LUN zero), but for any other value the comparison fails and the kernel falls back to prompting for the root device.
>How-To-Repeat:
Boot an MVME board from a SCSI disk with a target ID != 0.
>Fix:
Index: sys/arch/mvme68k/include/autoconf.h
===================================================================
RCS file: /cvsroot/src/sys/arch/mvme68k/include/autoconf.h,v
retrieving revision 1.8
diff -u -r1.8 autoconf.h
--- sys/arch/mvme68k/include/autoconf.h 1 Feb 2011 20:19:31 -0000 1.8
+++ sys/arch/mvme68k/include/autoconf.h 3 Sep 2022 03:47:16 -0000
@@ -37,4 +37,7 @@
extern int bootdevlun; /* dev_lun of boot device */
extern int bootpart; /* boot partition (disk) */
+#define MVME_BOOTDEV(_devlun) ((_devlun) >> 4)
+#define MVME_BOOTLUN(_devlun) ((_devlun) & 0xf)
+
#endif /* _MVME68K_AUTOCONF_H */
cvs diff: Diffing sys/arch/mvme68k/mvme68k
Index: sys/arch/mvme68k/mvme68k/autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mvme68k/mvme68k/autoconf.c,v
retrieving revision 1.47
diff -u -r1.47 autoconf.c
--- sys/arch/mvme68k/mvme68k/autoconf.c 27 Oct 2012 17:18:04 -0000 1.47
+++ sys/arch/mvme68k/mvme68k/autoconf.c 3 Sep 2022 03:47:16 -0000
@@ -190,8 +190,10 @@
struct scsipibus_attach_args *sa = aux;
if (device_parent(parent) != controller ||
- bootdevlun != sa->sa_periph->periph_target)
+ MVME_BOOTDEV(bootdevlun) != sa->sa_periph->periph_target ||
+ MVME_BOOTLUN(bootdevlun) != sa->sa_periph->periph_lun) {
return;
+ }
booted_device = dev;
foundboot = 1;
>Audit-Trail:
From: Rin Okuyama <rokuyama.rk@gmail.com>
To: gnats-bugs@netbsd.org, port-mvme68k-maintainer@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, sciatic.tribune.0o@icloud.com
Cc:
Subject: Re: port-mvme68k/56991: mvme68k systems fail to mount root from SCSI
targets other than zero
Date: Sat, 3 Sep 2022 20:26:30 +0900
Thank you very much for your report and patch.
Is there any reference for parameters passed from PROM and
their definitions? I'd like to cite it in comment or commit
log if possible.
Thanks,
rin
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: rokuyama.rk@gmail.com
Cc: gnats-bugs@netbsd.org, sciatic.tribune.0o@icloud.com,
tsutsui@ceres.dti.ne.jp
Subject: Re: port-mvme68k/56991: mvme68k systems fail to mount root from SCSItargets
other than zero
Date: Sat, 3 Sep 2022 23:00:06 +0900
> Is there any reference for parameters passed from PROM and
> their definitions?
It looks:
(1) bootdevlun is set by locore.s per arg passed from bootloader
https://nxr.netbsd.org/xref/src/sys/arch/mvme68k/mvme68k/locore.s?r=1.118#116
(2) the bootdevlun is from bootloader passed as bootars.dev_lun in bugargs:
https://nxr.netbsd.org/xref/src/sys/arch/mvme68k/stand/libsa/exec_mvme.c?r=1.16#75
(3) "bugargs" is defined in mvme68k/include/prom.h:
https://nxr.netbsd.org/xref/src/sys/arch/mvme68k/include/prom.h?r=1.18#136
(4) the prom.h came from OpenBSD and it had "get_taget()" function
to determine target, bus, and lun per host controllers?
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/mvme68k/mvme68k/Attic/autoconf.c?rev=1.47&content-type=text/x-cvsweb-markup
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/mvme68k/mvme68k/Attic/autoconf.c.diff?r1=1.42&r2=1.43
Maybe the attached patch in this PR will work on MVME327, but not MVME328?
---
Izumi Tsutsui
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.