aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2022-12-06 17:55:58 +0000
committerWarner Losh <imp@FreeBSD.org>2023-01-24 21:49:43 +0000
commit693894521c5e3f5c7f632ecb7d9f33711f4d57e2 (patch)
tree10a365c8e47e73aa0f1e11b61d3420bea79f5ba5
parent8eed237164540d1e02ad77605380708eefb80c0e (diff)
downloadsrc-693894521c5e3f5c7f632ecb7d9f33711f4d57e2.tar.gz
src-693894521c5e3f5c7f632ecb7d9f33711f4d57e2.zip
kboot: Mark the EFI specific parts of bootinfo.c
bootinfo.c is about to be shared with kboot since they create substantially similar environments / metadata tagging / etc. Tag this with #ifdef EFI for the moment until the proper abstracting out can happen. Sponsored by: Netflix (cherry picked from commit b11aebff4d4a301bfeac516b5be45080c8a11142)
-rw-r--r--stand/efi/loader/bootinfo.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c
index e05197189a46..a6b722b947e9 100644
--- a/stand/efi/loader/bootinfo.c
+++ b/stand/efi/loader/bootinfo.c
@@ -40,8 +40,10 @@ __FBSDID("$FreeBSD$");
#include <machine/metadata.h>
#include <machine/psl.h>
+#ifdef EFI
#include <efi.h>
#include <efilib.h>
+#endif
#include "bootstrap.h"
#include "modinfo.h"
@@ -50,8 +52,10 @@ __FBSDID("$FreeBSD$");
#include <machine/specialreg.h>
#endif
+#ifdef EFI
#include "loader_efi.h"
#include "gfx_fb.h"
+#endif
#if defined(LOADER_FDT_SUPPORT)
#include <fdt_platform.h>
@@ -69,10 +73,12 @@ int boot_services_gone;
static int
bi_getboothowto(char *kargs)
{
+#ifdef EFI
const char *sw, *tmp;
char *opts;
int speed, port;
char buf[50];
+#endif
char *console;
int howto;
@@ -85,6 +91,7 @@ bi_getboothowto(char *kargs)
howto |= RB_SERIAL;
if (strcmp(console, "nullconsole") == 0)
howto |= RB_MUTE;
+#ifdef EFI
#if defined(__i386__) || defined(__amd64__)
if (strcmp(console, "efi") == 0 &&
getenv("efi_8250_uid") != NULL &&
@@ -124,11 +131,13 @@ bi_getboothowto(char *kargs)
}
}
#endif
+#endif
}
return (howto);
}
+#ifdef EFI
static EFI_STATUS
efi_do_vmap(EFI_MEMORY_DESCRIPTOR *mm, UINTN sz, UINTN mmsz, UINT32 mmver)
{
@@ -297,6 +306,7 @@ bi_load_efi_data(struct preloaded_file *kfp, bool exit_bs)
return (0);
}
+#endif
/*
* Load the information expected by an amd64 kernel.
@@ -353,8 +363,10 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs)
return(EINVAL);
}
+#ifdef EFI
/* Try reading the /etc/fstab file to select the root device */
getrootmount(devformat(rootdev));
+#endif
addr = 0;
for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
@@ -410,11 +422,15 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs)
#ifdef MODINFOMD_MODULEP
file_addmetadata(kfp, MODINFOMD_MODULEP, sizeof(module), &module);
#endif
+#ifdef EFI
file_addmetadata(kfp, MODINFOMD_FW_HANDLE, sizeof(ST), &ST);
+#endif
#ifdef LOADER_GELI_SUPPORT
geli_export_key_metadata(kfp);
#endif
+#ifdef EFI
bi_load_efi_data(kfp, exit_bs);
+#endif
size = md_copymodules(0, is64); /* Find the size of the modules */
kernend = roundup(addr + size, PAGE_SIZE);