svn commit: r335231 - head/stand/efi/loader

Warner Losh imp at FreeBSD.org
Fri Jun 15 19:07:40 UTC 2018


Author: imp
Date: Fri Jun 15 19:07:37 2018
New Revision: 335231
URL: https://svnweb.freebsd.org/changeset/base/335231

Log:
  There's no need to walk through the tables looking for the smbios
  table if we're just going to ignore it on arm, so expand, slightly,
  the reach of the ifdef. Move the buffer to the inner block so we
  don't have a separate #ifdef far away from these lines.
  
  The issue on arm is that smbios_detect does unaligned accesses, which
  in the u-boot implementing EFI context causes a crash.

Modified:
  head/stand/efi/loader/main.c

Modified: head/stand/efi/loader/main.c
==============================================================================
--- head/stand/efi/loader/main.c	Fri Jun 15 19:07:31 2018	(r335230)
+++ head/stand/efi/loader/main.c	Fri Jun 15 19:07:37 2018	(r335231)
@@ -511,9 +511,6 @@ main(int argc, CHAR16 *argv[])
 	size_t sz;
 	UINT16 boot_order[100];
 	EFI_LOADED_IMAGE *img;
-#if !defined(__arm__)
-	char buf[40];
-#endif
 
 	archsw.arch_autoload = efi_autoload;
 	archsw.arch_getdev = efi_getdev;
@@ -655,18 +652,20 @@ main(int argc, CHAR16 *argv[])
 	efi_init_environment();
 	setenv("LINES", "24", 1);	/* optional */
 
+#if !defined(__arm__)
 	for (k = 0; k < ST->NumberOfTableEntries; k++) {
 		guid = &ST->ConfigurationTable[k].VendorGuid;
-#if !defined(__arm__)
 		if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) {
+			char buf[40];
+
 			snprintf(buf, sizeof(buf), "%p",
 			    ST->ConfigurationTable[k].VendorTable);
 			setenv("hint.smbios.0.mem", buf, 1);
 			smbios_detect(ST->ConfigurationTable[k].VendorTable);
 			break;
 		}
-#endif
 	}
+#endif
 
 	interact();			/* doesn't return */
 


More information about the svn-src-head mailing list