svn commit: r271289 - stable/10/sys/amd64/amd64

Ed Maste emaste at FreeBSD.org
Mon Sep 8 21:10:51 UTC 2014


Author: emaste
Date: Mon Sep  8 21:10:51 2014
New Revision: 271289
URL: http://svnweb.freebsd.org/changeset/base/271289

Log:
  MFC r265014: Report boot method (BIOS/UEFI) via sysctl machdep.bootmethod
  
  Approved by:	re
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/10/sys/amd64/amd64/machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/10/sys/amd64/amd64/machdep.c	Mon Sep  8 19:40:59 2014	(r271288)
+++ stable/10/sys/amd64/amd64/machdep.c	Mon Sep  8 21:10:51 2014	(r271289)
@@ -1519,6 +1519,10 @@ add_efi_map_entries(struct efi_map_heade
 	}
 }
 
+static char bootmethod[16] = "";
+SYSCTL_STRING(_machdep, OID_AUTO, bootmethod, CTLFLAG_RD, bootmethod, 0,
+    "System firmware boot method");
+
 /*
  * Populate the (physmap) array with base/bound pairs describing the
  * available physical memory in the system, then test this memory and
@@ -1549,12 +1553,15 @@ getmemsize(caddr_t kmdp, u_int64_t first
 	smapbase = (struct bios_smap *)preload_search_info(kmdp,
 	    MODINFO_METADATA | MODINFOMD_SMAP);
 
-	if (efihdr != NULL)
+	if (efihdr != NULL) {
 		add_efi_map_entries(efihdr, physmap, &physmap_idx);
-	else if (smapbase != NULL)
+		strlcpy(bootmethod, "UEFI", sizeof(bootmethod));
+	} else if (smapbase != NULL) {
 		add_smap_entries(smapbase, physmap, &physmap_idx);
-	else
+		strlcpy(bootmethod, "BIOS", sizeof(bootmethod));
+	} else {
 		panic("No BIOS smap or EFI map info from loader!");
+	}
 
 	/*
 	 * Find the 'base memory' segment for SMP


More information about the svn-src-all mailing list