Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jun 2018 19:07:37 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335231 - head/stand/efi/loader
Message-ID:  <201806151907.w5FJ7baq096250@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806151907.w5FJ7baq096250>