mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 04:43:53 +00:00
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
This commit is contained in:
parent
0c0d8a4f7e
commit
b11aebff4d
|
@ -40,8 +40,10 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <machine/metadata.h>
|
#include <machine/metadata.h>
|
||||||
#include <machine/psl.h>
|
#include <machine/psl.h>
|
||||||
|
|
||||||
|
#ifdef EFI
|
||||||
#include <efi.h>
|
#include <efi.h>
|
||||||
#include <efilib.h>
|
#include <efilib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "bootstrap.h"
|
#include "bootstrap.h"
|
||||||
#include "modinfo.h"
|
#include "modinfo.h"
|
||||||
|
@ -50,8 +52,10 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <machine/specialreg.h>
|
#include <machine/specialreg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EFI
|
||||||
#include "loader_efi.h"
|
#include "loader_efi.h"
|
||||||
#include "gfx_fb.h"
|
#include "gfx_fb.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(LOADER_FDT_SUPPORT)
|
#if defined(LOADER_FDT_SUPPORT)
|
||||||
#include <fdt_platform.h>
|
#include <fdt_platform.h>
|
||||||
|
@ -67,10 +71,12 @@ int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
|
||||||
static int
|
static int
|
||||||
bi_getboothowto(char *kargs)
|
bi_getboothowto(char *kargs)
|
||||||
{
|
{
|
||||||
|
#ifdef EFI
|
||||||
const char *sw, *tmp;
|
const char *sw, *tmp;
|
||||||
char *opts;
|
char *opts;
|
||||||
int speed, port;
|
int speed, port;
|
||||||
char buf[50];
|
char buf[50];
|
||||||
|
#endif
|
||||||
char *console;
|
char *console;
|
||||||
int howto;
|
int howto;
|
||||||
|
|
||||||
|
@ -83,6 +89,7 @@ bi_getboothowto(char *kargs)
|
||||||
howto |= RB_SERIAL;
|
howto |= RB_SERIAL;
|
||||||
if (strcmp(console, "nullconsole") == 0)
|
if (strcmp(console, "nullconsole") == 0)
|
||||||
howto |= RB_MUTE;
|
howto |= RB_MUTE;
|
||||||
|
#ifdef EFI
|
||||||
#if defined(__i386__) || defined(__amd64__)
|
#if defined(__i386__) || defined(__amd64__)
|
||||||
if (strcmp(console, "efi") == 0 &&
|
if (strcmp(console, "efi") == 0 &&
|
||||||
getenv("efi_8250_uid") != NULL &&
|
getenv("efi_8250_uid") != NULL &&
|
||||||
|
@ -121,12 +128,14 @@ bi_getboothowto(char *kargs)
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return (howto);
|
return (howto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef EFI
|
||||||
static EFI_STATUS
|
static EFI_STATUS
|
||||||
efi_do_vmap(EFI_MEMORY_DESCRIPTOR *mm, UINTN sz, UINTN mmsz, UINT32 mmver)
|
efi_do_vmap(EFI_MEMORY_DESCRIPTOR *mm, UINTN sz, UINTN mmsz, UINT32 mmver)
|
||||||
{
|
{
|
||||||
|
@ -295,6 +304,7 @@ bi_load_efi_data(struct preloaded_file *kfp, bool exit_bs)
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load the information expected by an amd64 kernel.
|
* Load the information expected by an amd64 kernel.
|
||||||
|
@ -351,8 +361,10 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef EFI
|
||||||
/* Try reading the /etc/fstab file to select the root device */
|
/* Try reading the /etc/fstab file to select the root device */
|
||||||
getrootmount(devformat(rootdev));
|
getrootmount(devformat(rootdev));
|
||||||
|
#endif
|
||||||
|
|
||||||
addr = 0;
|
addr = 0;
|
||||||
for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
|
for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
|
||||||
|
@ -408,11 +420,15 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs)
|
||||||
#ifdef MODINFOMD_MODULEP
|
#ifdef MODINFOMD_MODULEP
|
||||||
file_addmetadata(kfp, MODINFOMD_MODULEP, sizeof(module), &module);
|
file_addmetadata(kfp, MODINFOMD_MODULEP, sizeof(module), &module);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef EFI
|
||||||
file_addmetadata(kfp, MODINFOMD_FW_HANDLE, sizeof(ST), &ST);
|
file_addmetadata(kfp, MODINFOMD_FW_HANDLE, sizeof(ST), &ST);
|
||||||
|
#endif
|
||||||
#ifdef LOADER_GELI_SUPPORT
|
#ifdef LOADER_GELI_SUPPORT
|
||||||
geli_export_key_metadata(kfp);
|
geli_export_key_metadata(kfp);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef EFI
|
||||||
bi_load_efi_data(kfp, exit_bs);
|
bi_load_efi_data(kfp, exit_bs);
|
||||||
|
#endif
|
||||||
|
|
||||||
size = md_copymodules(0, is64); /* Find the size of the modules */
|
size = md_copymodules(0, is64); /* Find the size of the modules */
|
||||||
kernend = roundup(addr + size, PAGE_SIZE);
|
kernend = roundup(addr + size, PAGE_SIZE);
|
||||||
|
|
Loading…
Reference in a new issue