Locate the ACPI XSDT
This commit is contained in:
parent
2ee920fdd2
commit
7471a846ec
@ -399,6 +399,33 @@ private void jump_to_hulk()
|
||||
hulk_header().entry, hulk_virt_stack_top());
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the ACPI XSDT.
|
||||
*
|
||||
* @return Whether it was found.
|
||||
*/
|
||||
private bool find_acpi_xsdt()
|
||||
{
|
||||
for (size_t i = 0u; i < st.NumberOfTableEntries; i++)
|
||||
{
|
||||
if ((st.ConfigurationTable[i].VendorGuid == EFI_ACPI_TABLE_GUID) ||
|
||||
(st.ConfigurationTable[i].VendorGuid == ACPI_TABLE_GUID))
|
||||
{
|
||||
enum ulong rsdp_magic = 0x20525450_20445352u;
|
||||
const(EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER) * rdsp = cast(const(EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER) *)st.ConfigurationTable[i].VendorTable;
|
||||
if (rdsp.Signature == rsdp_magic)
|
||||
{
|
||||
if (rdsp.Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION)
|
||||
{
|
||||
bootinfo().acpi_xsdt_phys = rdsp.XsdtAddress;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* EFI application entry point.
|
||||
*
|
||||
@ -414,6 +441,13 @@ extern (C) EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * st)
|
||||
console.writeln("Welcome to HELLO, HOS EFI Lightweight LOader, v0.1.0");
|
||||
console.writeln("Firmware vendor: '%S', version: 0x%x", st.FirmwareVendor, st.FirmwareVendor);
|
||||
|
||||
if (!find_acpi_xsdt())
|
||||
{
|
||||
console.writeln("Error: Could not locate ACPI XSDT");
|
||||
console.wait_key();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
bootinfo().pt_phys = cast(ulong)scratch.current();
|
||||
|
||||
if (!set_graphics_mode())
|
||||
|
@ -73,4 +73,7 @@ struct BootInfo
|
||||
|
||||
/* Size of page tables while jumping to HULK. */
|
||||
ulong pt_size;
|
||||
|
||||
/* Physical address of ACPI XSDT table. */
|
||||
ulong acpi_xsdt_phys;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user