From a73a026ef8a4cd7ddc1e33304fadbc78a9fcce7b Mon Sep 17 00:00:00 2001 From: Jozef Nagy Date: Wed, 21 May 2025 22:04:08 +0200 Subject: [PATCH] Various update --- efi_rs.h | 4 +++- efilib.h | 4 ++++ protocols/device_path.h | 9 +++++++++ protocols/pci_bus.h | 7 +++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/efi_rs.h b/efi_rs.h index 88aa90a..9d35565 100644 --- a/efi_rs.h +++ b/efi_rs.h @@ -46,6 +46,8 @@ #define EFI_CAPSULE_REPORT_GUID {0x39b68c46,0xf7fb,0x441b, {0xb6,0xec,0x16,0xb0,0xf6,0x98,0x21,0xf3}} +#define EFI_GLOBAL_VARIABLE {0x8be4df61,0x93ca,0x11d2, {0xaa,0x0d,0x00,0xe0,0x98,0x03,0x2b,0x8c}} + typedef struct _EFI_RUNTIME_SERVICES EFI_RUNTIME_SERVICES; typedef enum { @@ -284,7 +286,7 @@ typedef struct _EFI_RUNTIME_SERVICES { // Time Services EFI_GET_TIME GetTime; - EFI_SET_TIME SetTime; + EFI_SET_TIME SetTime; EFI_GET_WAKEUP_TIME GetWakeupTime; EFI_SET_WAKEUP_TIME SetWakeupTime; diff --git a/efilib.h b/efilib.h index 5a2907b..c91a8d7 100644 --- a/efilib.h +++ b/efilib.h @@ -5,6 +5,10 @@ #define EFI_ERROR(status) (((EFI_INTN)(status)) < 0) +#define EFI_PAGE_MASK 0xFFF +#define EFI_PAGE_SHIFT 12 +#define EFI_SIZE_TO_PAGES(size) (((size) >> EFI_PAGE_SHIFT) + (((size) & EFI_PAGE_MASK) ? 1 : 0)) + static inline const char *efi_status_to_str(EFI_STATUS s) { switch (s) { diff --git a/protocols/device_path.h b/protocols/device_path.h index 3024cd0..c49d9b8 100644 --- a/protocols/device_path.h +++ b/protocols/device_path.h @@ -8,6 +8,7 @@ #define EFI_DEVICE_PATH_PROTOCOL_GUID {0x09576e91,0x6d3f,0x11d2,{0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b}} typedef struct _EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH_PROTOCOL; +typedef struct _EFI_MEMMAP_DEVICE_PATH EFI_MEMMAP_DEVICE_PATH; typedef struct _EFI_DEVICE_PATH_PROTOCOL { EFI_UINT8 Type; @@ -15,6 +16,14 @@ typedef struct _EFI_DEVICE_PATH_PROTOCOL { EFI_UINT8 Length[2]; } EFI_DEVICE_PATH_PROTOCOL; +struct _EFI_MEMMAP_DEVICE_PATH +{ + EFI_DEVICE_PATH_PROTOCOL Header; + EFI_UINT32 MemoryType; + EFI_PHYSICAL_ADDRESS StartingAddress; + EFI_PHYSICAL_ADDRESS EndingAddress; +}; + //// // EFI Device Path Utilities Protocol /// diff --git a/protocols/pci_bus.h b/protocols/pci_bus.h index 87750bc..fa76181 100644 --- a/protocols/pci_bus.h +++ b/protocols/pci_bus.h @@ -1,6 +1,13 @@ #ifndef EFI_PROTOCOLS_PCI_BUS_H #define EFI_PROTOCOLS_PCI_BUS_H +#define EFI_PCI_ADDRESS(bus, dev, func, reg) \ + (EFI_UINT64)( \ + (((EFI_UINTN)bus) << 24) | \ + (((EFI_UINTN)dev) << 16) | \ + (((EFI_UINTN)func) << 8) | \ + (((EFI_UINTN)(reg)) < 256 ? ((EFI_UINTN)(reg)) : (EFI_UINT64)((reg) << 32))) + //// // PCI Root Bridge I/O Protocol ///