Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Move initialization code out of efi_probe into efi_...



details:   https://anonhg.NetBSD.org/src/rev/3695ca1bcf44
branches:  trunk
changeset: 827250:3695ca1bcf44
user:      maya <maya%NetBSD.org@localhost>
date:      Sun Oct 22 00:59:28 2017 +0000

description:
Move initialization code out of efi_probe into efi_init

and call it from cpu_configure

diffstat:

 sys/arch/amd64/amd64/autoconf.c |   6 ++++--
 sys/arch/i386/i386/autoconf.c   |   6 ++++--
 sys/arch/x86/include/efi.h      |   5 ++++-
 sys/arch/x86/x86/efi.c          |  25 ++++++++++++++++++-------
 4 files changed, 30 insertions(+), 12 deletions(-)

diffs (155 lines):

diff -r 4bba24f0a22b -r 3695ca1bcf44 sys/arch/amd64/amd64/autoconf.c
--- a/sys/arch/amd64/amd64/autoconf.c   Sun Oct 22 00:45:32 2017 +0000
+++ b/sys/arch/amd64/amd64/autoconf.c   Sun Oct 22 00:59:28 2017 +0000
@@ -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 @@
 extern void platform_init(void);
 #endif
 
+#include <x86/efi.h>
 #include <x86/x86/tsc.h>
 
 /*
@@ -89,6 +90,7 @@
        startrtclock();
 
 #if NBIOS32 > 0
+       efi_init();
        bios32_init();
        platform_init();
        /* identify hypervisor type from SMBIOS */
diff -r 4bba24f0a22b -r 3695ca1bcf44 sys/arch/i386/i386/autoconf.c
--- a/sys/arch/i386/i386/autoconf.c     Sun Oct 22 00:45:32 2017 +0000
+++ b/sys/arch/i386/i386/autoconf.c     Sun Oct 22 00:59:28 2017 +0000
@@ -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 @@
 #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 @@
        startrtclock();
 
 #if NBIOS32 > 0
+       efi_init();
        bios32_init();
        platform_init();
        /* identify hypervisor type from SMBIOS */
diff -r 4bba24f0a22b -r 3695ca1bcf44 sys/arch/x86/include/efi.h
--- a/sys/arch/x86/include/efi.h        Sun Oct 22 00:45:32 2017 +0000
+++ b/sys/arch/x86/include/efi.h        Sun Oct 22 00:59:28 2017 +0000
@@ -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_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 @@
 };
 #endif
 
+void               efi_init(void);
 bool               efi_probe(void);
 paddr_t            efi_getsystblpa(void);
 struct efi_systbl *efi_getsystbl(void);
diff -r 4bba24f0a22b -r 3695ca1bcf44 sys/arch/x86/x86/efi.c
--- a/sys/arch/x86/x86/efi.c    Sun Oct 22 00:45:32 2017 +0000
+++ b/sys/arch/x86/x86/efi.c    Sun Oct 22 00:59:28 2017 +0000
@@ -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 @@
 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 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



Home | Main Index | Thread Index | Old Index