summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/efi.h
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-01-04 14:30:09 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-01-04 14:30:09 +0000
commite320df4527999e14b6082e03c1be697051a48df8 (patch)
tree7ade71e9d0a8053588fa1fb576e69a9bbe4bd4d4 /sys/dev/acpi/efi.h
parentc958d05fc1cde30074d5123466f1bedf54e5f926 (diff)
Implement support for calling EFI runtime services and use it to implement
a time-of-day clock device based on the GetTime() and SetTime() services. The virtual memory mappings for the runtime services calls are implemented through a separate pmap that is only activated when we make a runtime services call. ok tom@, visa@ tested by naddy@
Diffstat (limited to 'sys/dev/acpi/efi.h')
-rw-r--r--sys/dev/acpi/efi.h75
1 files changed, 74 insertions, 1 deletions
diff --git a/sys/dev/acpi/efi.h b/sys/dev/acpi/efi.h
index 91f8ade4985..a3500787958 100644
--- a/sys/dev/acpi/efi.h
+++ b/sys/dev/acpi/efi.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: efi.h,v 1.1 2017/05/25 21:21:18 kettenis Exp $ */
+/* $OpenBSD: efi.h,v 1.2 2018/01/04 14:30:08 kettenis Exp $ */
/* Public Domain */
@@ -6,10 +6,22 @@
#define _MACHINE_EFI_H_
typedef uint8_t UINT8;
+typedef int16_t INT16;
+typedef uint16_t UINT16;
typedef uint32_t UINT32;
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;
+typedef VOID *EFI_HANDLE;
+
+typedef VOID *EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
+typedef VOID *EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
+typedef VOID *EFI_BOOT_SERVICES;
typedef enum {
EfiReservedMemoryType,
@@ -57,4 +69,65 @@ typedef struct {
#define NextMemoryDescriptor(Ptr, Size) \
((EFI_MEMORY_DESCRIPTOR *)(((UINT8 *)Ptr) + Size))
+typedef struct {
+ UINT64 Signature;
+ UINT32 Revision;
+ UINT32 HeaderSize;
+ UINT32 CRC32;
+ UINT32 Reserved;
+} EFI_TABLE_HEADER;
+
+typedef struct {
+ UINT16 Year;
+ UINT8 Month;
+ UINT8 Day;
+ UINT8 Hour;
+ UINT8 Minute;
+ UINT8 Second;
+ UINT8 Pad1;
+ UINT32 Nanosecond;
+ INT16 TimeZone;
+ UINT8 Daylight;
+ UINT8 Pad2;
+} EFI_TIME;
+
+typedef VOID *EFI_TIME_CAPABILITIES;
+
+typedef EFI_STATUS (*EFI_GET_TIME)(EFI_TIME *, EFI_TIME_CAPABILITIES *);
+typedef EFI_STATUS (*EFI_SET_TIME)(EFI_TIME *);
+typedef EFI_STATUS (*EFI_SET_VIRTUAL_ADDRESS_MAP)(UINTN, UINTN, UINT32, EFI_MEMORY_DESCRIPTOR *);
+
+typedef struct {
+ EFI_TABLE_HEADER Hdr;
+ EFI_GET_TIME GetTime;
+ EFI_SET_TIME SetTime;
+ VOID *GetWakeupTime;
+ VOID *SetWakeupTime;
+
+ EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
+} EFI_RUNTIME_SERVICES;
+
+typedef struct {
+ EFI_GUID VendorGuid;
+ VOID *VendorTable;
+} EFI_CONFIGURATION_TABLE;
+
+typedef struct {
+ EFI_TABLE_HEADER Hdr;
+ CHAR16 *FirmwareVendor;
+ UINT32 FirmwareRevision;
+ EFI_HANDLE ConsoleInHandle;
+ EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;
+ EFI_HANDLE ConsoleOutHandle;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
+ EFI_HANDLE StandardErrorHandle;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *StdErr;
+ EFI_RUNTIME_SERVICES *RuntimeServices;
+ EFI_BOOT_SERVICES *BootServices;
+ UINTN NumberOfTableEntries;
+ EFI_CONFIGURATION_TABLE *ConfigurationTable;
+} EFI_SYSTEM_TABLE;
+
+#define EFI_SUCCESS 0
+
#endif /* _MACHINE_EFI_H_ */