diff options
author | andrew <andrew@FreeBSD.org> | 2015-06-11 14:02:23 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2015-06-11 14:02:23 +0000 |
commit | 9b79279d8a3385bc84c84c0a1c489d101fc43fe8 (patch) | |
tree | 5b90ed59a2444a49c5ba04dd6ed767bdce5e617e /sys/boot/efi/loader | |
parent | c834aadf0c28dc5e6a679d382de0b425e96c2138 (diff) | |
download | FreeBSD-src-9b79279d8a3385bc84c84c0a1c489d101fc43fe8.zip FreeBSD-src-9b79279d8a3385bc84c84c0a1c489d101fc43fe8.tar.gz |
Pass the ACPI table pointer to the arm64 kernel from loader.efi.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/boot/efi/loader')
-rw-r--r-- | sys/boot/efi/loader/arch/arm64/exec.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/sys/boot/efi/loader/arch/arm64/exec.c b/sys/boot/efi/loader/arch/arm64/exec.c index 1f72269..d13e97b 100644 --- a/sys/boot/efi/loader/arch/arm64/exec.c +++ b/sys/boot/efi/loader/arch/arm64/exec.c @@ -42,6 +42,15 @@ __FBSDID("$FreeBSD$"); #include "loader_efi.h" #include "cache.h" +#include "platform/acfreebsd.h" +#include "acconfig.h" +#define ACPI_SYSTEM_XFACE +#include "actypes.h" +#include "actbl.h" + +static EFI_GUID acpi_guid = ACPI_TABLE_GUID; +static EFI_GUID acpi20_guid = ACPI_20_TABLE_GUID; + static int elf64_exec(struct preloaded_file *amp); static int elf64_obj_exec(struct preloaded_file *amp); @@ -64,12 +73,41 @@ elf64_exec(struct preloaded_file *fp) vm_offset_t clean_addr; size_t clean_size; struct file_metadata *md; + ACPI_TABLE_RSDP *rsdp; EFI_STATUS status; EFI_PHYSICAL_ADDRESS addr; Elf_Ehdr *ehdr; - int err; + char buf[24]; + int err, revision; void (*entry)(vm_offset_t); + rsdp = efi_get_table(&acpi20_guid); + if (rsdp == NULL) { + rsdp = efi_get_table(&acpi_guid); + } + if (rsdp != NULL) { + sprintf(buf, "0x%016llx", (unsigned long long)rsdp); + setenv("hint.acpi.0.rsdp", buf, 1); + revision = rsdp->Revision; + if (revision == 0) + revision = 1; + sprintf(buf, "%d", revision); + setenv("hint.acpi.0.revision", buf, 1); + strncpy(buf, rsdp->OemId, sizeof(rsdp->OemId)); + buf[sizeof(rsdp->OemId)] = '\0'; + setenv("hint.acpi.0.oem", buf, 1); + sprintf(buf, "0x%016x", rsdp->RsdtPhysicalAddress); + setenv("hint.acpi.0.rsdt", buf, 1); + if (revision >= 2) { + /* XXX extended checksum? */ + sprintf(buf, "0x%016llx", + (unsigned long long)rsdp->XsdtPhysicalAddress); + setenv("hint.acpi.0.xsdt", buf, 1); + sprintf(buf, "%d", rsdp->Length); + setenv("hint.acpi.0.xsdt_length", buf, 1); + } + } + if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) return(EFTYPE); |