From owner-svn-src-stable-10@FreeBSD.ORG Mon Sep 8 21:10:51 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ADFB96E7; Mon, 8 Sep 2014 21:10:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 994701D38; Mon, 8 Sep 2014 21:10:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s88LApeE096923; Mon, 8 Sep 2014 21:10:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s88LAppo096922; Mon, 8 Sep 2014 21:10:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201409082110.s88LAppo096922@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 8 Sep 2014 21:10:51 +0000 (UTC) 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 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Sep 2014 21:10:51 -0000 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