diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-06-24 10:38:45 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-06-24 10:38:45 +0000 |
commit | 55f3b637fb79201b185463f48f6ba6b9c77620f8 (patch) | |
tree | 690b28a14e5a80991c415dfde3f7c86f75585c17 /sys | |
parent | 106fec6e99768aba6188d4e652e00e98a27a446c (diff) |
If ACPI tables are present, set a global variable to point at their
(physical) address such that acpidump(8) can read it and dump the tables
on arm64 systems.
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm64/dev/efi.c | 22 | ||||
-rw-r--r-- | sys/dev/acpi/efi.h | 18 |
2 files changed, 30 insertions, 10 deletions
diff --git a/sys/arch/arm64/dev/efi.c b/sys/arch/arm64/dev/efi.c index cecaecf03d1..f82aac00210 100644 --- a/sys/arch/arm64/dev/efi.c +++ b/sys/arch/arm64/dev/efi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efi.c,v 1.4 2018/04/06 19:09:05 kettenis Exp $ */ +/* $OpenBSD: efi.c,v 1.5 2018/06/24 10:38:44 kettenis Exp $ */ /* * Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org> @@ -41,6 +41,8 @@ extern uint32_t mmap_desc_ver; extern EFI_MEMORY_DESCRIPTOR *mmap; +uint64_t efi_acpi_table; + struct efi_softc { struct device sc_dev; struct pmap *sc_pm; @@ -168,18 +170,25 @@ efi_attach(struct device *parent, struct device *self, void *aux) } /* - * The FirmwareVendor field has been converted from a physical - * pointer to a virtual pointer, so we have to activate our - * pmap to access it. + * The FirmwareVendor and ConfigurationTable fields have been + * converted from a physical pointer to a virtual pointer, so + * we have to activate our pmap to access them. */ + efi_enter(sc); if (st->FirmwareVendor) { printf("%s: ", sc->sc_dev.dv_xname); - efi_enter(sc); for (i = 0; st->FirmwareVendor[i]; i++) printf("%c", st->FirmwareVendor[i]); - efi_leave(sc); printf(" rev 0x%x\n", st->FirmwareRevision); } + for (i = 0; i < st->NumberOfTableEntries; i++) { + EFI_CONFIGURATION_TABLE *ct = &st->ConfigurationTable[i]; + static EFI_GUID acpi_guid = EFI_ACPI_20_TABLE_GUID; + + if (efi_guidcmp(&acpi_guid, &ct->VendorGuid) == 0) + efi_acpi_table = (uint64_t)ct->VendorTable; + } + efi_leave(sc); if (rs == NULL) return; @@ -278,4 +287,3 @@ efi_settime(struct todr_chip_handle *handle, struct timeval *tv) return EIO; return 0; } - diff --git a/sys/dev/acpi/efi.h b/sys/dev/acpi/efi.h index a3500787958..d747a2f4315 100644 --- a/sys/dev/acpi/efi.h +++ b/sys/dev/acpi/efi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: efi.h,v 1.2 2018/01/04 14:30:08 kettenis Exp $ */ +/* $OpenBSD: efi.h,v 1.3 2018/06/24 10:38:44 kettenis Exp $ */ /* Public Domain */ @@ -13,7 +13,6 @@ typedef uint64_t UINT64; typedef u_long UINTN; typedef uint16_t CHAR16; typedef void VOID; -typedef uint32_t EFI_GUID[4]; typedef uint64_t EFI_PHYSICAL_ADDRESS; typedef uint64_t EFI_VIRTUAL_ADDRESS; typedef UINTN EFI_STATUS; @@ -23,6 +22,17 @@ typedef VOID *EFI_SIMPLE_TEXT_INPUT_PROTOCOL; typedef VOID *EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL; typedef VOID *EFI_BOOT_SERVICES; +typedef struct { + UINT32 Data1; + UINT16 Data2; + UINT16 Data3; + UINT8 Data4[8]; +} EFI_GUID; + +#define EFI_ACPI_20_TABLE_GUID \ + { 0x8868e871, 0xe4f1, 0x11d3, \ + { 0xbc, 0x22, 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81} } + typedef enum { EfiReservedMemoryType, EfiLoaderCode, @@ -130,4 +140,6 @@ typedef struct { #define EFI_SUCCESS 0 -#endif /* _MACHINE_EFI_H_ */ +#define efi_guidcmp(_a, _b) memcmp((_a), (_b), sizeof(EFI_GUID)) + +#endif /* _DEV_ACPI_EFI_H_ */ |