Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/efi/loader/arch/amd64/elf64_freebsd.c
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | elf64_exec(struct preloaded_file *fp) | ||||
struct file_metadata *md; | struct file_metadata *md; | ||||
Elf_Ehdr *ehdr; | Elf_Ehdr *ehdr; | ||||
vm_offset_t modulep, kernend, trampcode, trampstack; | vm_offset_t modulep, kernend, trampcode, trampstack; | ||||
int err, i; | int err, i; | ||||
ACPI_TABLE_RSDP *rsdp; | ACPI_TABLE_RSDP *rsdp; | ||||
char buf[24]; | char buf[24]; | ||||
int revision; | int revision; | ||||
/* | |||||
* Report the RSDP to the kernel. While this can be found with | |||||
* a BIOS boot, the RSDP may be elsewhere when booted from UEFI. | |||||
* The old code used the 'hints' method to communite this to | |||||
* the kernel. However, while convenient, the 'hints' method | |||||
* is fragile and does not work when static hints are compiled | |||||
* into the kernel. Instead, move to setting different tunables | |||||
* that start with acpi. The old 'hints' can be removed before | |||||
* we branch for FreeBSD 12. | |||||
*/ | |||||
rsdp = efi_get_table(&acpi20_guid); | rsdp = efi_get_table(&acpi20_guid); | ||||
if (rsdp == NULL) { | if (rsdp == NULL) { | ||||
rsdp = efi_get_table(&acpi_guid); | rsdp = efi_get_table(&acpi_guid); | ||||
} | } | ||||
if (rsdp != NULL) { | if (rsdp != NULL) { | ||||
sprintf(buf, "0x%016llx", (unsigned long long)rsdp); | sprintf(buf, "0x%016llx", (unsigned long long)rsdp); | ||||
setenv("hint.acpi.0.rsdp", buf, 1); | setenv("hint.acpi.0.rsdp", buf, 1); | ||||
setenv("acpi.rsdp", buf, 1); | |||||
revision = rsdp->Revision; | revision = rsdp->Revision; | ||||
if (revision == 0) | if (revision == 0) | ||||
revision = 1; | revision = 1; | ||||
sprintf(buf, "%d", revision); | sprintf(buf, "%d", revision); | ||||
setenv("hint.acpi.0.revision", buf, 1); | setenv("hint.acpi.0.revision", buf, 1); | ||||
setenv("acpi.revision", buf, 1); | |||||
strncpy(buf, rsdp->OemId, sizeof(rsdp->OemId)); | strncpy(buf, rsdp->OemId, sizeof(rsdp->OemId)); | ||||
buf[sizeof(rsdp->OemId)] = '\0'; | buf[sizeof(rsdp->OemId)] = '\0'; | ||||
setenv("hint.acpi.0.oem", buf, 1); | setenv("hint.acpi.0.oem", buf, 1); | ||||
setenv("acpi.oem", buf, 1); | |||||
sprintf(buf, "0x%016x", rsdp->RsdtPhysicalAddress); | sprintf(buf, "0x%016x", rsdp->RsdtPhysicalAddress); | ||||
setenv("hint.acpi.0.rsdt", buf, 1); | setenv("hint.acpi.0.rsdt", buf, 1); | ||||
setenv("acpi.rsdt", buf, 1); | |||||
if (revision >= 2) { | if (revision >= 2) { | ||||
/* XXX extended checksum? */ | /* XXX extended checksum? */ | ||||
sprintf(buf, "0x%016llx", | sprintf(buf, "0x%016llx", | ||||
(unsigned long long)rsdp->XsdtPhysicalAddress); | (unsigned long long)rsdp->XsdtPhysicalAddress); | ||||
setenv("hint.acpi.0.xsdt", buf, 1); | setenv("hint.acpi.0.xsdt", buf, 1); | ||||
setenv("acpi.xsdt", buf, 1); | |||||
sprintf(buf, "%d", rsdp->Length); | sprintf(buf, "%d", rsdp->Length); | ||||
setenv("hint.acpi.0.xsdt_length", buf, 1); | setenv("hint.acpi.0.xsdt_length", buf, 1); | ||||
setenv("acpi.xsdt_length", buf, 1); | |||||
} | } | ||||
} | } | ||||
if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) | if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) | ||||
return(EFTYPE); | return(EFTYPE); | ||||
ehdr = (Elf_Ehdr *)&(md->md_data); | ehdr = (Elf_Ehdr *)&(md->md_data); | ||||
trampcode = (vm_offset_t)0x0000000040000000; | trampcode = (vm_offset_t)0x0000000040000000; | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |