#include <x86/acpi/acpi.h>
#include <string.h>
#include <errno.h>
+#include <kvm/efi.h>
#include <uk/plat/common/bootinfo.h>
#define RSDP10_LEN 20
}
#endif /* UK_DEBUG */
+static struct acpi_rsdp *acpi_get_efi_st_rsdp(void)
+{
+ struct ukplat_bootinfo *bi = ukplat_bootinfo_get();
+ uk_efi_uintn_t ct_count, i;
+ struct uk_efi_cfg_tbl *ct;
+ struct acpi_rsdp *rsdp;
+
+ UK_ASSERT(bi);
+
+ if (!bi->efi_st)
+ return NULL;
+
+ ct = ((struct uk_efi_sys_tbl *)bi->efi_st)->configuration_table;
+ ct_count = ((struct uk_efi_sys_tbl *)bi->efi_st)->number_of_table_entries;
+
+ UK_ASSERT(ct);
+ UK_ASSERT(ct_count);
+
+ rsdp = NULL;
+ for (i = 0; i < ct_count; i++)
+ if (!memcmp(&ct[i].vendor_guid, UK_EFI_ACPI20_TABLE_GUID,
+ sizeof(ct[i].vendor_guid))) {
+ rsdp = ct[i].vendor_table;
+
+ break;
+ } else if (!memcmp(&ct[i].vendor_guid, UK_EFI_ACPI10_TABLE_GUID,
+ sizeof(ct[i].vendor_guid))) {
+ rsdp = ct[i].vendor_table;
+ }
+
+ uk_pr_debug("ACPI RSDP present at %p\n", rsdp);
+
+ return rsdp;
+}
+
#if defined(__X86_64__)
static struct acpi_rsdp *acpi_get_bios_rom_rsdp(void)
{
static struct acpi_rsdp *acpi_get_rsdp(void)
{
+ struct acpi_rsdp *rsdp;
+
+ rsdp = acpi_get_efi_st_rsdp();
+ if (rsdp)
+ return rsdp;
+
return acpi_get_bios_rom_rsdp();
}
struct uk_efi_mem_desc entry[1];
};
+#define UK_EFI_ACPI10_TABLE_GUID \
+ (&(struct uk_efi_guid){ \
+ .b0_3 = 0xeb9d2d30, \
+ .b4_5 = 0x2d88, \
+ .b6_7 = 0x11d3, \
+ .b8_15 = {0x9a, 0x16, 0x00, 0x90, \
+ 0x27, 0x3f, 0xc1, 0x4d}, \
+ })
+#define UK_EFI_ACPI20_TABLE_GUID \
+ (&(struct uk_efi_guid){ \
+ .b0_3 = 0x8868e871, \
+ .b4_5 = 0xe4f1, \
+ .b6_7 = 0x11d3, \
+ .b8_15 = {0xbc, 0x22, 0x00, 0x80, \
+ 0xc7, 0x3c, 0x88, 0x81}, \
+ })
struct uk_efi_cfg_tbl {
struct uk_efi_guid vendor_guid;
void *vendor_table;