diff options
author | emaste <emaste@FreeBSD.org> | 2014-09-08 21:10:51 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2014-09-08 21:10:51 +0000 |
commit | 352b5da28f11128c7b6be5ce5e553c8e8904dbd8 (patch) | |
tree | 5cbb9add372bc12651fa2986337a4d0b557d85fd /sys/amd64 | |
parent | 7bed52c05ca12043d7c337b875d7d6420427f516 (diff) | |
download | FreeBSD-src-352b5da28f11128c7b6be5ce5e553c8e8904dbd8.zip FreeBSD-src-352b5da28f11128c7b6be5ce5e553c8e8904dbd8.tar.gz |
MFC r265014: Report boot method (BIOS/UEFI) via sysctl machdep.bootmethod
Approved by: re
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 4fefcb5..3395098 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1519,6 +1519,10 @@ add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap, } } +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 |