Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Sep 2014 21:10:51 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r271289 - stable/10/sys/amd64/amd64
Message-ID:  <201409082110.s88LAppo096922@svn.freebsd.org>

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



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