Module Name: src
Committed By: maya
Date: Sun Oct 22 01:29:26 UTC 2017
Modified Files:
src/sys/arch/x86/x86: efi.c x86_machdep.c
Log Message:
Add sysctl machdep.bootmethod
either "UEFI" or "BIOS" to mimic freebsd
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/x86/efi.c
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/x86/x86/x86_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/efi.c
diff -u src/sys/arch/x86/x86/efi.c:1.13 src/sys/arch/x86/x86/efi.c:1.14
--- src/sys/arch/x86/x86/efi.c:1.13 Sun Oct 22 00:59:28 2017
+++ src/sys/arch/x86/x86/efi.c Sun Oct 22 01:29:26 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: efi.c,v 1.13 2017/10/22 00:59:28 maya Exp $ */
+/* $NetBSD: efi.c,v 1.14 2017/10/22 01:29:26 maya Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.13 2017/10/22 00:59:28 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.14 2017/10/22 01:29:26 maya Exp $");
#include <sys/kmem.h>
#include <sys/param.h>
@@ -54,7 +54,6 @@ void efi_aprintuuid(const struct uuid
bool efi_uuideq(const struct uuid *, const struct uuid *);
static bool efi_is32x64 = false;
-bool bootmethod_efi = true;
static struct efi_systbl *efi_systbl_va = NULL;
static struct efi_cfgtbl *efi_cfgtblhead_va = NULL;
static struct efi_e820memmap {
Index: src/sys/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.98 src/sys/arch/x86/x86/x86_machdep.c:1.99
--- src/sys/arch/x86/x86/x86_machdep.c:1.98 Mon Oct 9 17:49:28 2017
+++ src/sys/arch/x86/x86/x86_machdep.c Sun Oct 22 01:29:26 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: x86_machdep.c,v 1.98 2017/10/09 17:49:28 maya Exp $ */
+/* $NetBSD: x86_machdep.c,v 1.99 2017/10/22 01:29:26 maya Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.98 2017/10/09 17:49:28 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.99 2017/10/22 01:29:26 maya Exp $");
#include "opt_modular.h"
#include "opt_physmem.h"
@@ -104,6 +104,8 @@ struct bootinfo bootinfo;
/* --------------------------------------------------------------------- */
+bool bootmethod_efi;
+
static kauth_listener_t x86_listener;
extern paddr_t lowmem_rsvd, avail_start, avail_end;
@@ -1114,6 +1116,23 @@ sysctl_machdep_booted_kernel(SYSCTLFN_AR
}
static int
+sysctl_machdep_bootmethod(SYSCTLFN_ARGS)
+{
+ struct sysctlnode node;
+ char buf[5];
+
+ node = *rnode;
+ node.sysctl_data = buf;
+ if (bootmethod_efi)
+ memcpy(node.sysctl_data, "UEFI", 5);
+ else
+ memcpy(node.sysctl_data, "BIOS", 5);
+
+ return sysctl_lookup(SYSCTLFN_CALL(&node));
+}
+
+
+static int
sysctl_machdep_diskinfo(SYSCTLFN_ARGS)
{
struct sysctlnode node;
@@ -1198,10 +1217,14 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
CTL_MACHDEP, CPU_BOOTED_KERNEL, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
+ CTLTYPE_STRING, "bootmethod", NULL,
+ sysctl_machdep_bootmethod, 0, NULL, 0,
+ CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
CTLTYPE_STRUCT, "diskinfo", NULL,
sysctl_machdep_diskinfo, 0, NULL, 0,
CTL_MACHDEP, CPU_DISKINFO, CTL_EOL);
-
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "cpu_brand", NULL,