svn commit: r341423 - head/sys/powerpc/powerpc

Justin Hibbits jhibbits at FreeBSD.org
Mon Dec 3 04:56:07 UTC 2018


Author: jhibbits
Date: Mon Dec  3 04:56:06 2018
New Revision: 341423
URL: https://svnweb.freebsd.org/changeset/base/341423

Log:
  powerpc: Check for a fdt in the metadata if it doesn't already exist
  
  It's possible the fdt pointer was passed in via the metadata, as is done in
  ubldr.  Check for the fdt here, instead of working with a NULL fdt, and
  panicking.

Modified:
  head/sys/powerpc/powerpc/machdep.c

Modified: head/sys/powerpc/powerpc/machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/machdep.c	Mon Dec  3 04:47:28 2018	(r341422)
+++ head/sys/powerpc/powerpc/machdep.c	Mon Dec  3 04:56:06 2018	(r341423)
@@ -137,6 +137,10 @@ int cacheline_size = 32;
 #endif
 int hw_direct_map = 1;
 
+#ifdef BOOKE
+extern vm_paddr_t kernload;
+#endif
+
 extern void *ap_pcpu;
 
 struct pcpu __pcpu[MAXCPU];
@@ -295,6 +299,8 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offs
 #ifdef AIM
 		if ((uintptr_t)&powerpc_init > DMAP_BASE_ADDRESS)
 			md_offset = DMAP_BASE_ADDRESS;
+#else /* BOOKE */
+		md_offset = VM_MIN_KERNEL_ADDRESS - kernload;
 #endif
 
 		preload_metadata = mdp;
@@ -309,6 +315,11 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offs
 			if (envp != NULL)
 				envp += md_offset;
 			init_static_kenv(envp, 0);
+			if (fdt == 0) {
+				fdt = MD_FETCH(kmdp, MODINFOMD_DTBP, uintptr_t);
+				if (fdt != 0)
+					fdt += md_offset;
+			}
 			kernelendphys = MD_FETCH(kmdp, MODINFOMD_KERNEND,
 			    vm_offset_t);
 			if (kernelendphys != 0)


More information about the svn-src-all mailing list