NetBSD Problem Report #57004

From www@netbsd.org  Sun Sep 11 01:26:13 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 4A81F1A923D
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 11 Sep 2022 01:26:13 +0000 (UTC)
Message-Id: <20220911012611.DEF601A9244@mollari.NetBSD.org>
Date: Sun, 11 Sep 2022 01:26:11 +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:         57004
>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:   Sun Sep 11 01:30:00 +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;

NetBSD Home
NetBSD PR Database Search

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