Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: GENERIC64 aarch64 failure to autoboot



On Mon, Mar 06, 2023 at 07:44:20AM +1030, Brett Lymn wrote:
> On Sun, Mar 05, 2023 at 03:01:02PM -0000, Michael van Elst wrote:
> >  
> > -		if (guid != NULL && len == 16)
> > +		if (guid == NULL || len == 16)
> > +
> 
> Shouldn't that be "len != 16"?

Yes, and another error. The wedge device is 'dv' not 'dev'.

Here is a patch that works for me:


Index: sys/arch/evbarm/fdt/fdt_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/fdt/fdt_machdep.c,v
retrieving revision 1.100
diff -p -u -r1.100 fdt_machdep.c
--- sys/arch/evbarm/fdt/fdt_machdep.c	5 Feb 2023 22:42:39 -0000	1.100
+++ sys/arch/evbarm/fdt/fdt_machdep.c	5 Mar 2023 21:54:09 -0000
@@ -209,6 +209,15 @@ fdt_add_boot_physmem(const struct fdt_me
 	bp->bp_pages = atop(eaddr) - bp->bp_start;
 	bp->bp_freelist = VM_FREELIST_DEFAULT;
 
+#ifdef VM_FREELIST_4GB
+	if (eaddr < (paddr_t)4 * 1024 * 1024 * 1024)
+		bp->bp_freelist = VM_FREELIST_4GB;
+#endif
+#ifdef VM_FREELIST_1GB
+	if (eaddr < (paddr_t)1 * 1024 * 1024 * 1024)
+		bp->bp_freelist = VM_FREELIST_1GB;
+#endif
+
 #ifdef PMAP_NEED_ALLOC_POOLPAGE
 	const uint64_t memory_size = *(uint64_t *)arg;
 	if (atop(memory_size) > bp->bp_pages) {
@@ -743,9 +752,6 @@ fdt_detect_root_device(device_t dev)
 {
 	int error, len;
 
-	if (booted_device)
-		return;
-
 	const int chosen = OF_finddevice("/chosen");
 	if (chosen < 0)
 		return;
@@ -801,8 +807,15 @@ fdt_detect_root_device(device_t dev)
 		const struct uuid *guid =
 		    fdtbus_get_prop(chosen, "netbsd,gpt-guid", &len);
 
-		if (guid != NULL && len == 16)
-			booted_device = dev;
+		if (guid == NULL || len != 16)
+			return;
+
+		char guidstr[UUID_STR_LEN];
+		uuid_snprintf(guidstr, sizeof(guidstr), guid);
+
+		device_t dv = dkwedge_find_by_wname(guidstr);
+		if (dv != NULL)
+			booted_device = dv;
 
 		return;
 	}
@@ -895,8 +908,7 @@ fdt_cpu_rootconf(void)
 		if (device_class(dev) != DV_DISK)
 			continue;
 
-		if (device_is_a(dev, "ld") || device_is_a(dev, "sd") || device_is_a(dev, "wd"))
-			fdt_detect_root_device(dev);
+		fdt_detect_root_device(dev);
 
 		if (booted_device != NULL)
 			break;


-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index