Changeset View
Standalone View
sys/amd64/amd64/machdep.c
Show First 20 Lines • Show All 1,170 Lines • ▼ Show 20 Lines | efihdr = (struct efi_map_header *)preload_search_info(kmdp, | ||||
MODINFO_METADATA | MODINFOMD_EFI_MAP); | MODINFO_METADATA | MODINFOMD_EFI_MAP); | ||||
smap = (struct bios_smap *)preload_search_info(kmdp, | smap = (struct bios_smap *)preload_search_info(kmdp, | ||||
MODINFO_METADATA | MODINFOMD_SMAP); | MODINFO_METADATA | MODINFOMD_SMAP); | ||||
if (efihdr == NULL && smap == NULL) | if (efihdr == NULL && smap == NULL) | ||||
panic("No BIOS smap or EFI map info from loader!"); | panic("No BIOS smap or EFI map info from loader!"); | ||||
if (efihdr != NULL) { | if (efihdr != NULL) { | ||||
add_efi_map_entries(efihdr, physmap, physmap_idx); | add_efi_map_entries(efihdr, physmap, physmap_idx); | ||||
strlcpy(bootmethod, "UEFI", sizeof(bootmethod)); | firmware_type = FW_UEFI; | ||||
} else { | } else { | ||||
size = *((u_int32_t *)smap - 1); | size = *((u_int32_t *)smap - 1); | ||||
bios_add_smap_entries(smap, size, physmap, physmap_idx); | bios_add_smap_entries(smap, size, physmap, physmap_idx); | ||||
strlcpy(bootmethod, "BIOS", sizeof(bootmethod)); | firmware_type = FW_BIOS; | ||||
} | } | ||||
} | } | ||||
#define PAGES_PER_GB (1024 * 1024 * 1024 / PAGE_SIZE) | #define PAGES_PER_GB (1024 * 1024 * 1024 / PAGE_SIZE) | ||||
/* | /* | ||||
* Populate the (physmap) array with base/bound pairs describing the | * Populate the (physmap) array with base/bound pairs describing the | ||||
* available physical memory in the system, then test this memory and | * available physical memory in the system, then test this memory and | ||||
▲ Show 20 Lines • Show All 438 Lines • ▼ Show 20 Lines | hammer_time(u_int64_t modulep, u_int64_t physfree) | ||||
/* Fix-up for 2M hole */ | /* Fix-up for 2M hole */ | ||||
physfree += kernphys; | physfree += kernphys; | ||||
kernphys += NBPDR; | kernphys += NBPDR; | ||||
kmdp = init_ops.parse_preload_data(modulep); | kmdp = init_ops.parse_preload_data(modulep); | ||||
efi_boot = preload_search_info(kmdp, MODINFO_METADATA | | efi_boot = preload_search_info(kmdp, MODINFO_METADATA | | ||||
MODINFOMD_EFI_MAP) != NULL; | MODINFOMD_EFI_MAP) != NULL; | ||||
kib: How could firmware_type not be FW_NONE there? | |||||
Done Inline ActionsIf xen_pvh_parse_reload_data() (as init_ops.parse_preload_data()) sets firmware_type = FW_HYPER;. Your asking this seems to suggest you think init_ops.parse_preload_data() should always set firmware_type even though that results in a bit of code duplication (both native_parse_preload_data() and xen_pvh_parse_reload_data() end up with this conditional). I had been wondering whether to do that instead. ehem_freebsd_m5p.com: If `xen_pvh_parse_reload_data()` (as `init_ops.parse_preload_data()`) sets `firmware_type =… | |||||
Not Done Inline ActionsSo does xen pv emulate low bios data? I highly doubt it, but I cannot deny it. I do believe that the answer is no, and think that all existing uses of if (!efi_boot) should be translated into if (firmware_type == FW_BIOS). That said, why do you need FW_HYPER? Also why not FW_XEN? kib: So does xen pv emulate low bios data? I highly doubt it, but I cannot deny it.
I do believe… | |||||
Done Inline ActionsOriginally I was thinking set firmare_type = FW_HYPER; vm_guest = VM_GUEST_XEN; would be the way to handle this. The response would be Xen is the only one which features direct kernel loading. Other hypervisors load an emulated BIOS or UEFI environment, and use that to load FreeBSD or other OS. In this case Xen really is a genuinely distinct firmware_type/bootmethod and deserves a distinct value. So, having thought about it, the current version has FW_XEN, rather than FW_HYPER. ehem_freebsd_m5p.com: Originally I was thinking set `firmare_type = FW_HYPER; vm_guest = VM_GUEST_XEN;` would be the… | |||||
if (!efi_boot) { | if (!efi_boot) { | ||||
Done Inline ActionsIf doing this way, the condition should be firmware_type == FW_BIOS kib: If doing this way, the condition should be `firmware_type == FW_BIOS` | |||||
Done Inline ActionsThat changes the logic if firmware_type == FW_HYPER (of course that change could be correct). ehem_freebsd_m5p.com: That changes the logic if `firmware_type == FW_HYPER` (of course that change //could// be… | |||||
/* Tell the bios to warmboot next time */ | /* Tell the bios to warmboot next time */ | ||||
atomic_store_short((u_short *)0x472, 0x1234); | atomic_store_short((u_short *)0x472, 0x1234); | ||||
} | } | ||||
Not Done Inline Actionsfirmware_type = preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP) != NULL ? FW_UEFI : FW_BIOS; kib: `firmware_type = preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP) != NULL ? | |||||
Done Inline ActionsWhat you typed works if inside the outer if. firmware_type = preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP) != NULL ? FW_UEFI : firmware_type == FW_NONE ? FW_BIOS : FW_TYPE; if you want to capture everything. I was emulating existing style and shying away from the conditional operator. ehem_freebsd_m5p.com: What you typed works if inside the outer `if`. `firmware_type = preload_search_info(kmdp… | |||||
Done Inline ActionsAlways spot the typo afterwards. s/FW_TYPE/firmware_type/ ehem_freebsd_m5p.com: Always spot the typo afterwards. s/FW_TYPE/firmware_type/ | |||||
physfree += ucode_load_bsp(physfree - kernphys + KERNSTART); | physfree += ucode_load_bsp(physfree - kernphys + KERNSTART); | ||||
physfree = roundup2(physfree, PAGE_SIZE); | physfree = roundup2(physfree, PAGE_SIZE); | ||||
identify_cpu1(); | identify_cpu1(); | ||||
identify_hypervisor(); | identify_hypervisor(); | ||||
identify_cpu_fixup_bsp(); | identify_cpu_fixup_bsp(); | ||||
identify_cpu2(); | identify_cpu2(); | ||||
initializecpucache(); | initializecpucache(); | ||||
▲ Show 20 Lines • Show All 1,183 Lines • Show Last 20 Lines |
How could firmware_type not be FW_NONE there?