Source-Changes-HG archive

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

[src/trunk]: src/sys/stand/efiboot efiboot: Make FDT support optional on a pe...



details:   https://anonhg.NetBSD.org/src/rev/3db470548518
branches:  trunk
changeset: 988270:3db470548518
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Oct 06 10:13:19 2021 +0000

description:
efiboot: Make FDT support optional on a per-arch basis.

diffstat:

 sys/stand/efiboot/Makefile.efiboot     |   21 +-
 sys/stand/efiboot/boot.c               |   42 ++-
 sys/stand/efiboot/bootaa64/Makefile    |    7 +-
 sys/stand/efiboot/bootarm/Makefile     |    3 +-
 sys/stand/efiboot/bootmenu.c           |    4 +-
 sys/stand/efiboot/bootriscv64/Makefile |    3 +-
 sys/stand/efiboot/efiacpi.c            |   56 +----
 sys/stand/efiboot/efiacpi.h            |    9 +-
 sys/stand/efiboot/efiboot.c            |   92 +-------
 sys/stand/efiboot/efiboot.h            |    9 +-
 sys/stand/efiboot/efifdt.c             |  323 ++++++++++++++++++++++++++++++++-
 sys/stand/efiboot/efifdt.h             |    6 +-
 sys/stand/efiboot/efigetsecs.c         |    4 +-
 sys/stand/efiboot/efigop.c             |    4 +-
 sys/stand/efiboot/exec.c               |  146 +-------------
 15 files changed, 436 insertions(+), 293 deletions(-)

diffs (truncated from 1158 to 300 lines):

diff -r 2db10ed4d44c -r 3db470548518 sys/stand/efiboot/Makefile.efiboot
--- a/sys/stand/efiboot/Makefile.efiboot        Wed Oct 06 09:06:21 2021 +0000
+++ b/sys/stand/efiboot/Makefile.efiboot        Wed Oct 06 10:13:19 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.23 2021/09/28 11:37:45 jmcneill Exp $
+# $NetBSD: Makefile.efiboot,v 1.24 2021/10/06 10:13:19 jmcneill Exp $
 
 S=             ${.CURDIR}/../../..
 
@@ -22,15 +22,24 @@
 .PATH: ${EFIDIR}/gnuefi
 SOURCES=       crt0-efi-${GNUEFIARCH}.S reloc_${GNUEFIARCH}.c
 SOURCES+=      boot.c bootmenu.c conf.c console.c dev_net.c devopen.c exec.c \
-               module.c overlay.c panic.c prompt.c
-SOURCES+=      efiboot.c efichar.c efidev.c efigetsecs.c efifdt.c \
-               efifile.c efiblock.c efinet.c efipxe.c efiacpi.c efirng.c \
+               module.c panic.c prompt.c
+SOURCES+=      efiboot.c efichar.c efidev.c efigetsecs.c \
+               efifile.c efiblock.c efinet.c efipxe.c efirng.c \
                efiwatchdog.c efigop.c smbios.c
 
+.if ${EFIBOOT_FDT:Uno} == "yes"
+CPPFLAGS+=     -DEFIBOOT_FDT
+SOURCES+=      efifdt.c overlay.c
 .PATH: ${S}/external/bsd/libfdt/dist
 CPPFLAGS+=     -I${S}/external/bsd/libfdt/dist
 SOURCES+=      fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c
 SOURCES+=      fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c fdt_wip.c
+.endif
+
+.if ${EFIBOOT_ACPI:Uno} == "yes"
+CPPFLAGS+=     -DEFIBOOT_ACPI
+SOURCES+=      efiacpi.c
+.endif
 
 SRCS= ${SOURCES} ${EXTRA_SOURCES}
 
@@ -146,9 +155,9 @@
 CLEANFILES+=   ${PROG}.so ${PROG}.tmp
 
 ${PROG}: ${PROG}.so
-       ${OBJCOPY} -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
+       ${OBJCOPY} -j .text -j .sdata -j .data -j .dynamic -j .dynsym \
            -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \
-           -j .reloc -O binary ${PROG}.so ${.TARGET}
+           -j .reloc ${OBJCOPY_FORMAT} ${PROG}.so ${.TARGET}
 
 .include <bsd.prog.mk>
 
diff -r 2db10ed4d44c -r 3db470548518 sys/stand/efiboot/boot.c
--- a/sys/stand/efiboot/boot.c  Wed Oct 06 09:06:21 2021 +0000
+++ b/sys/stand/efiboot/boot.c  Wed Oct 06 10:13:19 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: boot.c,v 1.37 2021/09/28 11:37:45 jmcneill Exp $       */
+/*     $NetBSD: boot.c,v 1.38 2021/10/06 10:13:19 jmcneill Exp $       */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -30,12 +30,18 @@
 #include "efiboot.h"
 #include "efiblock.h"
 #include "efifile.h"
-#include "efifdt.h"
-#include "efiacpi.h"
 #include "efirng.h"
 #include "module.h"
+#include "bootmenu.h"
+
+#ifdef EFIBOOT_FDT
+#include "efifdt.h"
 #include "overlay.h"
-#include "bootmenu.h"
+#endif
+
+#ifdef EFIBOOT_ACPI
+#include "efiacpi.h"
+#endif
 
 #include <sys/bootblock.h>
 #include <sys/boot_flag.h>
@@ -90,11 +96,13 @@
 
 void   command_boot(char *);
 void   command_dev(char *);
-void   command_dtb(char *);
 void   command_initrd(char *);
 void   command_rndseed(char *);
+#ifdef EFIBOOT_FDT
+void   command_dtb(char *);
 void   command_dtoverlay(char *);
 void   command_dtoverlays(char *);
+#endif
 void   command_modules(char *);
 void   command_load(char *);
 void   command_unload(char *);
@@ -109,12 +117,14 @@
 const struct boot_command commands[] = {
        { "boot",       command_boot,           "boot [dev:][filename] [args]\n     (ex. \"hd0a:\\netbsd.old -s\"" },
        { "dev",        command_dev,            "dev" },
+#ifdef EFIBOOT_FDT
        { "dtb",        command_dtb,            "dtb [dev:][filename]" },
+       { "dtoverlay",  command_dtoverlay,      "dtoverlay [dev:][filename]" },
+       { "dtoverlays", command_dtoverlays,     "dtoverlays [{on|off|reset}]" },
+#endif
        { "initrd",     command_initrd,         "initrd [dev:][filename]" },
        { "fs",         command_initrd,         NULL },
        { "rndseed",    command_rndseed,        "rndseed [dev:][filename]" },
-       { "dtoverlay",  command_dtoverlay,      "dtoverlay [dev:][filename]" },
-       { "dtoverlays", command_dtoverlays,     "dtoverlays [{on|off|reset}]" },
        { "modules",    command_modules,        "modules [{on|off|reset}]" },
        { "load",       command_load,           "load <module_name>" },
        { "unload",     command_unload,         "unload <module_name>" },
@@ -196,12 +206,6 @@
 }
 
 void
-command_dtb(char *arg)
-{
-       set_dtb_path(arg);
-}
-
-void
 command_initrd(char *arg)
 {
        set_initrd_path(arg);
@@ -213,6 +217,13 @@
        set_rndseed_path(arg);
 }
 
+#ifdef EFIBOOT_FDT
+void
+command_dtb(char *arg)
+{
+       set_dtb_path(arg);
+}
+
 void
 command_dtoverlays(char *arg)
 {
@@ -243,6 +254,7 @@
 
        dtoverlay_add(arg);
 }
+#endif
 
 void
 command_modules(char *arg)
@@ -359,8 +371,12 @@
                printf("Config path: %s\n", pathbuf);
        }
 
+#ifdef EFIBOOT_FDT
        efi_fdt_show();
+#endif
+#ifdef EFIBOOT_ACPI
        efi_acpi_show();
+#endif
        efi_rng_show();
        efi_md_show();
        efi_gop_show();
diff -r 2db10ed4d44c -r 3db470548518 sys/stand/efiboot/bootaa64/Makefile
--- a/sys/stand/efiboot/bootaa64/Makefile       Wed Oct 06 09:06:21 2021 +0000
+++ b/sys/stand/efiboot/bootaa64/Makefile       Wed Oct 06 10:13:19 2021 +0000
@@ -1,10 +1,14 @@
-# $NetBSD: Makefile,v 1.10 2020/09/10 14:30:14 jakllsch Exp $
+# $NetBSD: Makefile,v 1.11 2021/10/06 10:13:19 jmcneill Exp $
 
 PROG=          bootaa64.efi
 OBJFMT=                binary
 NEWVERSWHAT=   "efiboot (arm64)"
 GNUEFIARCH=    aarch64
 LIBGNUEFI_ARCH=        aarch64
+OBJCOPY_FORMAT=        -O binary
+
+EFIBOOT_ACPI=  yes
+EFIBOOT_FDT=   yes
 
 EXTRA_SOURCES= efibootaa64.c
 EXTRA_SOURCES+=        cache.S
@@ -14,7 +18,6 @@
 CFLAGS+=       -DEFIBOOT_ALIGN=0x200000
 CFLAGS+=       -DEFIBOOT_RUNTIME_ADDRESS=0xffff800000000000L
 CFLAGS+=       -DEFIBOOT_RUNTIME_SIZE=0x40000000UL
-CFLAGS+=       -DEFIBOOT_ACPI
 CFLAGS+=       -DEFIBOOT_MODULE_MACHINE=\"evbarm\"
 LDFLAGS+=      -EL
 
diff -r 2db10ed4d44c -r 3db470548518 sys/stand/efiboot/bootarm/Makefile
--- a/sys/stand/efiboot/bootarm/Makefile        Wed Oct 06 09:06:21 2021 +0000
+++ b/sys/stand/efiboot/bootarm/Makefile        Wed Oct 06 10:13:19 2021 +0000
@@ -1,10 +1,11 @@
-# $NetBSD: Makefile,v 1.6 2020/09/08 15:36:37 jmcneill Exp $
+# $NetBSD: Makefile,v 1.7 2021/10/06 10:13:20 jmcneill Exp $
 
 PROG=          bootarm.efi
 OBJFMT=                binary
 NEWVERSWHAT=   "efiboot (arm)"
 GNUEFIARCH=    arm
 LIBGNUEFI_ARCH=        arm
+OBJCOPY_FORMAT=        -O binary
 
 EXTRA_SOURCES= efibootarm.c
 EXTRA_SOURCES+=        cache.S
diff -r 2db10ed4d44c -r 3db470548518 sys/stand/efiboot/bootmenu.c
--- a/sys/stand/efiboot/bootmenu.c      Wed Oct 06 09:06:21 2021 +0000
+++ b/sys/stand/efiboot/bootmenu.c      Wed Oct 06 10:13:19 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootmenu.c,v 1.2 2020/06/26 03:23:04 thorpej Exp $     */
+/*     $NetBSD: bootmenu.c,v 1.3 2021/10/06 10:13:19 jmcneill Exp $    */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -64,8 +64,10 @@
        else if (strcmp(cmd, BOOTCFG_CMD_USERCONF) == 0)
                userconf_add(arg);
 #endif
+#ifdef EFIBOOT_FDT
        else if (strcmp(cmd, "dtoverlay") == 0)
                dtoverlay_add(arg);
+#endif
 }
 
 int
diff -r 2db10ed4d44c -r 3db470548518 sys/stand/efiboot/bootriscv64/Makefile
--- a/sys/stand/efiboot/bootriscv64/Makefile    Wed Oct 06 09:06:21 2021 +0000
+++ b/sys/stand/efiboot/bootriscv64/Makefile    Wed Oct 06 10:13:19 2021 +0000
@@ -1,10 +1,11 @@
-# $NetBSD: Makefile,v 1.1 2021/05/02 15:22:27 jmcneill Exp $
+# $NetBSD: Makefile,v 1.2 2021/10/06 10:13:20 jmcneill Exp $
 
 PROG=          bootriscv64.efi
 OBJFMT=                binary
 NEWVERSWHAT=   "efiboot (riscv64)"
 GNUEFIARCH=    riscv64
 LIBGNUEFI_ARCH=        riscv64
+OBJCOPY_FORMAT=        -O binary
 
 EXTRA_SOURCES= efibootriscv64.c
 
diff -r 2db10ed4d44c -r 3db470548518 sys/stand/efiboot/efiacpi.c
--- a/sys/stand/efiboot/efiacpi.c       Wed Oct 06 09:06:21 2021 +0000
+++ b/sys/stand/efiboot/efiacpi.c       Wed Oct 06 10:13:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efiacpi.c,v 1.10 2021/07/23 21:33:00 jmcneill Exp $ */
+/* $NetBSD: efiacpi.c,v 1.11 2021/10/06 10:13:19 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -31,7 +31,6 @@
 
 #include "efiboot.h"
 #include "efiacpi.h"
-#include "efifdt.h"
 #include "smbios.h"
 
 struct acpi_rdsp {
@@ -46,10 +45,6 @@
        uint8_t reserved[3];
 };
 
-#include <libfdt.h>
-
-#define        ACPI_FDT_SIZE   (128 * 1024)
-
 static EFI_GUID Acpi20TableGuid = ACPI_20_TABLE_GUID;
 static EFI_GUID Smbios3TableGuid = SMBIOS3_TABLE_GUID;
 static EFI_GUID SmbiosTableGuid = SMBIOS_TABLE_GUID;
@@ -96,9 +91,21 @@
        acpi_enable = enable;
 }
 
+void *
+efi_acpi_root(void)
+{
+       return acpi_root;
+}
+
+void *
+efi_acpi_smbios(void)
+{
+       return smbios_table;
+}
+
 static char model_buf[128];
 
-static const char *
+const char *
 efi_acpi_get_model(void)
 {
        struct smbtable smbios;
@@ -144,38 +151,3 @@
        if (smbios_table)
                printf("SMBIOS: %s\n", efi_acpi_get_model());
 }
-
-int
-efi_acpi_create_fdt(void)
-{
-       int error;
-       void *fdt;



Home | Main Index | Thread Index | Old Index