NetBSD Problem Report #58909

From www@netbsd.org  Sun Dec 15 22:33:47 2024
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)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 614151A923C
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 15 Dec 2024 22:33:47 +0000 (UTC)
Message-Id: <20241215223345.DD3051A923D@mollari.NetBSD.org>
Date: Sun, 15 Dec 2024 22:33:45 +0000 (UTC)
From: jack@zage.org.uk
Reply-To: jack@zage.org.uk
To: gnats-bugs@NetBSD.org
Subject: model_init not called / defaults not set
X-Send-Pr-Version: www-1.0

>Number:         58909
>Category:       port-ofppc
>Synopsis:       model_init not called / defaults not set
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-ofppc-maintainer
>State:          pending-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 15 22:35:00 +0000 2024
>Closed-Date:    
>Last-Modified:  Tue Dec 31 01:20:01 +0000 2024
>Originator:     Jack Dunn
>Release:        current
>Organization:
>Environment:
NetBSD bull 10.99.12 NetBSD 10.99.12 (ESCALA) #3: Tue Dec 10 11:01:11 GMT 2024  jack@eclipse:/home/jack/bull_build/sys/arch/ofppc/compile/ESCALA ofppc
>Description:
In NetBSD 9.4 model_init() was called if the system had either a "name" or "model" property in the OpenFirmware root node. In commit v1.118 of sys/arch/ofppc/ofppc/machdep.c the code was slightly modified which results in model_init() only being called if the system has both a "name" and "model" property.

model_init() sets a few defaults which (for my system at least) are required for later stages of the boot process.

Since model_init() sets defaults for a few parameters it appears that it should be called regardless of the system having a model/name string.
>How-To-Repeat:
Boot a machine which has an OpenFirmware "model" prop but no "name" prop. Defaults such as ranges_offset and pciiodata will not be set resulting in failures further in the boot process.
>Fix:
Always call model_init() even if the system does not have a model/name to allow defaults to be set.

Here is a patch that always calls model_init.

--- a/sys/arch/ofppc/ofppc/machdep.c
+++ b/sys/arch/ofppc/ofppc/machdep.c
@@ -136,9 +136,9 @@ initppc(u_int startkernel, u_int endkernel, char *args)
 		if (i == -1) {
 			OF_getprop(node, "name", model_name,
 			    sizeof(model_name));
-			model_init();
 		}
 	}
+	model_init();

 	if ((oeacpufeat & OEACPU_NOBAT) == 0) {
 		node = OF_finddevice("/");

Tested on my Bull Escala T604.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->pending-pullups
State-Changed-By: martin@NetBSD.org
State-Changed-When: Mon, 16 Dec 2024 11:56:12 +0000
State-Changed-Why:
[pullup-10 #1030]


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58909 CVS commit: src/sys/arch/ofppc/ofppc
Date: Mon, 16 Dec 2024 11:52:43 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Mon Dec 16 11:52:43 UTC 2024

 Modified Files:
 	src/sys/arch/ofppc/ofppc: machdep.c

 Log Message:
 PR 58909: call model_init() always, even if we could not fetch a "model"
 or "name" property.


 To generate a diff of this commit:
 cvs rdiff -u -r1.120 -r1.121 src/sys/arch/ofppc/ofppc/machdep.c

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

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58909 CVS commit: [netbsd-10] src/sys/arch/ofppc/ofppc
Date: Tue, 31 Dec 2024 01:17:02 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Tue Dec 31 01:17:02 UTC 2024

 Modified Files:
 	src/sys/arch/ofppc/ofppc [netbsd-10]: machdep.c

 Log Message:
 Pull up following revision(s) (requested by martin in ticket #1030):
 	sys/arch/ofppc/ofppc/machdep.c: 1.121
 PR 58909: call model_init() always, even if we could not fetch a "model"
 or "name" property.


 To generate a diff of this commit:
 cvs rdiff -u -r1.119 -r1.119.18.1 src/sys/arch/ofppc/ofppc/machdep.c

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.