xen/boot: allow specifying boot method when booted from Xen
Allow setting the bootmethod variable from the Xen PVH entry point, in order to be able to correctly set the underlying firmware mode when booted as a dom0. Move the bootmethod variable to be defined in x86/cpu_machdep.c instead so it can be shared by both i386 and amd64. Sponsored by: Citrix Systems R&D Reviewed by: kib Differential revision: https://reviews.freebsd.org/D28619
This commit is contained in:
parent
adda2797eb
commit
a2495c3667
@ -1169,10 +1169,6 @@ add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap,
|
||||
}
|
||||
}
|
||||
|
||||
static char bootmethod[16] = "";
|
||||
SYSCTL_STRING(_machdep, OID_AUTO, bootmethod, CTLFLAG_RD, bootmethod, 0,
|
||||
"System firmware boot method");
|
||||
|
||||
static void
|
||||
native_parse_memmap(caddr_t kmdp, vm_paddr_t *physmap, int *physmap_idx)
|
||||
{
|
||||
|
@ -1237,10 +1237,6 @@ u_long bootdev; /* not a struct cdev *- encoding is different */
|
||||
SYSCTL_ULONG(_machdep, OID_AUTO, guessed_bootdev,
|
||||
CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in struct cdev *format)");
|
||||
|
||||
static char bootmethod[16] = "BIOS";
|
||||
SYSCTL_STRING(_machdep, OID_AUTO, bootmethod, CTLFLAG_RD, bootmethod, 0,
|
||||
"System firmware boot method");
|
||||
|
||||
/*
|
||||
* Initialize 386 and configure to run kernel
|
||||
*/
|
||||
@ -2348,6 +2344,9 @@ init386(int first)
|
||||
/* Init basic tunables, hz etc */
|
||||
init_param1();
|
||||
|
||||
/* Set bootmethod to BIOS: it's the only supported on i386. */
|
||||
strlcpy(bootmethod, "BIOS", sizeof(bootmethod));
|
||||
|
||||
/*
|
||||
* Make gdt memory segments. All segments cover the full 4GB
|
||||
* of address space and permissions are enforced at page level.
|
||||
|
@ -95,6 +95,7 @@ extern int x86_taa_enable;
|
||||
extern int cpu_flush_rsb_ctxsw;
|
||||
extern int x86_rngds_mitg_enable;
|
||||
extern int cpu_amdc1e_bug;
|
||||
extern char bootmethod[16];
|
||||
|
||||
struct pcb;
|
||||
struct thread;
|
||||
|
@ -111,6 +111,10 @@ static u_int cpu_reset_proxyid;
|
||||
static volatile u_int cpu_reset_proxy_active;
|
||||
#endif
|
||||
|
||||
char bootmethod[16];
|
||||
SYSCTL_STRING(_machdep, OID_AUTO, bootmethod, CTLFLAG_RD, bootmethod, 0,
|
||||
"System firmware boot method");
|
||||
|
||||
struct msr_op_arg {
|
||||
u_int msr;
|
||||
int op;
|
||||
|
@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/ctype.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/smp.h>
|
||||
#include <sys/efi.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_extern.h>
|
||||
@ -65,6 +66,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <machine/pc/bios.h>
|
||||
#include <machine/smp.h>
|
||||
#include <machine/intr_machdep.h>
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/metadata.h>
|
||||
|
||||
#include <xen/xen-os.h>
|
||||
@ -630,6 +632,11 @@ xen_pvh_parse_preload_data(uint64_t modulep)
|
||||
if (envp != NULL)
|
||||
envp += off;
|
||||
xen_pvh_set_env(envp, reject_option);
|
||||
|
||||
if (MD_FETCH(kmdp, MODINFOMD_EFI_MAP, void *) != NULL)
|
||||
strlcpy(bootmethod, "UEFI", sizeof(bootmethod));
|
||||
else
|
||||
strlcpy(bootmethod, "BIOS", sizeof(bootmethod));
|
||||
} else {
|
||||
/* Parse the extra boot information given by Xen */
|
||||
if (start_info->cmdline_paddr != 0)
|
||||
@ -637,6 +644,7 @@ xen_pvh_parse_preload_data(uint64_t modulep)
|
||||
(char *)(start_info->cmdline_paddr + KERNBASE),
|
||||
",");
|
||||
kmdp = NULL;
|
||||
strlcpy(bootmethod, "XEN", sizeof(bootmethod));
|
||||
}
|
||||
|
||||
boothowto |= boot_env_to_howto();
|
||||
|
Loading…
Reference in New Issue
Block a user