Module Name: src
Committed By: maya
Date: Sun Oct 22 00:59:28 UTC 2017
Modified Files:
src/sys/arch/amd64/amd64: autoconf.c
src/sys/arch/i386/i386: autoconf.c
src/sys/arch/x86/include: efi.h
src/sys/arch/x86/x86: efi.c
Log Message:
Move initialization code out of efi_probe into efi_init
and call it from cpu_configure
To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amd64/amd64/autoconf.c
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/i386/i386/autoconf.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/include/efi.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/x86/efi.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/amd64/amd64/autoconf.c
diff -u src/sys/arch/amd64/amd64/autoconf.c:1.27 src/sys/arch/amd64/amd64/autoconf.c:1.28
--- src/sys/arch/amd64/amd64/autoconf.c:1.27 Sat Jul 22 09:01:46 2017
+++ src/sys/arch/amd64/amd64/autoconf.c Sun Oct 22 00:59:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.27 2017/07/22 09:01:46 maxv Exp $ */
+/* $NetBSD: autoconf.c,v 1.28 2017/10/22 00:59:28 maya Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.27 2017/07/22 09:01:46 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.28 2017/10/22 00:59:28 maya Exp $");
#include "opt_multiprocessor.h"
#include "opt_intrdebug.h"
@@ -78,6 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
extern void platform_init(void);
#endif
+#include <x86/efi.h>
#include <x86/x86/tsc.h>
/*
@@ -89,6 +90,7 @@ cpu_configure(void)
startrtclock();
#if NBIOS32 > 0
+ efi_init();
bios32_init();
platform_init();
/* identify hypervisor type from SMBIOS */
Index: src/sys/arch/i386/i386/autoconf.c
diff -u src/sys/arch/i386/i386/autoconf.c:1.104 src/sys/arch/i386/i386/autoconf.c:1.105
--- src/sys/arch/i386/i386/autoconf.c:1.104 Sat Jul 29 06:29:31 2017
+++ src/sys/arch/i386/i386/autoconf.c Sun Oct 22 00:59:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.104 2017/07/29 06:29:31 maxv Exp $ */
+/* $NetBSD: autoconf.c,v 1.105 2017/10/22 00:59:28 maya Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.104 2017/07/29 06:29:31 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.105 2017/10/22 00:59:28 maya Exp $");
#include "opt_intrdebug.h"
#include "opt_multiprocessor.h"
@@ -90,6 +90,7 @@ extern void platform_init(void);
#include <dev/pci/pcivar.h>
#include <i386/pci/pcibios.h>
#endif
+#include <x86/efi.h>
/*
* Determine i/o configuration for a machine.
@@ -102,6 +103,7 @@ cpu_configure(void)
startrtclock();
#if NBIOS32 > 0
+ efi_init();
bios32_init();
platform_init();
/* identify hypervisor type from SMBIOS */
Index: src/sys/arch/x86/include/efi.h
diff -u src/sys/arch/x86/include/efi.h:1.7 src/sys/arch/x86/include/efi.h:1.8
--- src/sys/arch/x86/include/efi.h:1.7 Sat Mar 11 07:21:10 2017
+++ src/sys/arch/x86/include/efi.h Sun Oct 22 00:59:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: efi.h,v 1.7 2017/03/11 07:21:10 nonaka Exp $ */
+/* $NetBSD: efi.h,v 1.8 2017/10/22 00:59:28 maya Exp $ */
/*-
* Copyright (c) 2004 Marcel Moolenaar
@@ -53,6 +53,8 @@ extern const struct uuid EFI_UUID_ACPI10
extern const struct uuid EFI_UUID_SMBIOS;
extern const struct uuid EFI_UUID_SMBIOS3;
+extern bool bootmethod_efi;
+
enum efi_reset {
EFI_RESET_COLD,
EFI_RESET_WARM
@@ -214,6 +216,7 @@ struct efi_systbl64 {
};
#endif
+void efi_init(void);
bool efi_probe(void);
paddr_t efi_getsystblpa(void);
struct efi_systbl *efi_getsystbl(void);
Index: src/sys/arch/x86/x86/efi.c
diff -u src/sys/arch/x86/x86/efi.c:1.12 src/sys/arch/x86/x86/efi.c:1.13
--- src/sys/arch/x86/x86/efi.c:1.12 Sun Oct 22 00:45:32 2017
+++ src/sys/arch/x86/x86/efi.c Sun Oct 22 00:59:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: efi.c,v 1.12 2017/10/22 00:45:32 maya Exp $ */
+/* $NetBSD: efi.c,v 1.13 2017/10/22 00:59:28 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.12 2017/10/22 00:45:32 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.13 2017/10/22 00:59:28 maya Exp $");
#include <sys/kmem.h>
#include <sys/param.h>
@@ -54,6 +54,7 @@ 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 {
@@ -391,19 +392,29 @@ efi_getsystbl(void)
/*
* EFI is available if we are able to locate the EFI System Table.
*/
-bool
-efi_probe(void)
+void
+efi_init(void)
{
+
if (efi_getsystbl() == NULL) {
aprint_debug("efi: missing or invalid systbl\n");
- return false;
+ bootmethod_efi = false;
+ return;
}
if (efi_getcfgtblhead() == NULL) {
aprint_debug("efi: missing or invalid cfgtbl\n");
efi_relva((vaddr_t) efi_systbl_va);
- return false;
+ bootmethod_efi = false;
+ return;
}
- return true;
+ bootmethod_efi = true;
+}
+
+bool
+efi_probe(void)
+{
+
+ return bootmethod_efi;
}
int