diff options
Diffstat (limited to 'Private/EFIKit')
| -rw-r--r-- | Private/EFIKit/EFI.hxx | 122 |
1 files changed, 119 insertions, 3 deletions
diff --git a/Private/EFIKit/EFI.hxx b/Private/EFIKit/EFI.hxx index 17f2da48..fac59f8b 100644 --- a/Private/EFIKit/EFI.hxx +++ b/Private/EFIKit/EFI.hxx @@ -9,10 +9,113 @@ #pragma once +/** +@brief HCore Implementation of UEFI protocols. +*/ + #include <NewKit/Defines.hpp> using namespace hCore; +struct EfiTableHeader; +struct EfiLoadFileProtocol; +struct EfiSimpleTextOutputProtocol; +struct EfiDevicePathProtocol; + +/// What's boot policy? +/// If TRUE, indicates that the request originates from the boot manager, and that the boot manager is attempting to +/// load FilePath as a boot selection. If FALSE, then FilePath must match an exact file to be loaded. + +typedef UInt64 (*EfiTextString)(struct EfiSimpleTextOutputProtocol *This, const WideChar *OutputString); +typedef UInt64 (*EfiLoadFile)(EfiLoadFileProtocol *This, EfiDevicePathProtocol *FilePath, Boolean BootPolicy, + UInt32 *BufferSize, Void *Buffer); + +/// EFI pool helpers + +typedef enum EfiMemoryType +{ + /// + /// Not used. + /// + EfiReservedMemoryType, + /// + /// The code portions of a loaded application. + /// (Note that UEFI OS loaders are UEFI applications.) + /// + EfiLoaderCode, + /// + /// The data portions of a loaded application and the default data allocation + /// type used by an application to allocate pool memory. + /// + EfiLoaderData, + /// + /// The code portions of a loaded Boot Services Driver. + /// + EfiBootServicesCode, + /// + /// The data portions of a loaded Boot Serves Driver, and the default data + /// allocation type used by a Boot Services Driver to allocate pool memory. + /// + EfiBootServicesData, + /// + /// The code portions of a loaded Runtime Services Driver. + /// + EfiRuntimeServicesCode, + /// + /// The data portions of a loaded Runtime Services Driver and the default + /// data allocation type used by a Runtime Services Driver to allocate pool memory. + /// + EfiRuntimeServicesData, + /// + /// Free (unallocated) memory. + /// + EfiConventionalMemory, + /// + /// Memory in which errors have been detected. + /// + EfiUnusableMemory, + /// + /// Memory that holds the ACPI tables. + /// + EfiACPIReclaimMemory, + /// + /// Address space reserved for use by the firmware. + /// + EfiACPIMemoryNVS, + /// + /// Used by system firmware to request that a memory-mapped IO region + /// be mapped by the OS to a virtual address so it can be accessed by EFI runtime services. + /// + EfiMemoryMappedIO, + /// + /// System memory-mapped IO region that is used to translate memory + /// cycles to IO cycles by the processor. + /// + EfiMemoryMappedIOPortSpace, + /// + /// Address space reserved by the firmware for code that is part of the processor. + /// + EfiPalCode, + /// + /// A memory region that operates as EfiConventionalMemory, + /// however it happens to also support byte-addressable non-volatility. + /// + EfiPersistentMemory, + /// + /// A memory region that describes system memory that has not been accepted + /// by a corresponding call to the underlying isolation architecture. + /// + EfiUnacceptedMemoryType, + /// + /// The last type of memory. + /// Not a real type. + /// + EfiMaxMemoryType, +} EfiMemoryType; + +typedef UInt64 (*EfiAllocatePool)(EfiMemoryType PoolType, UInt32 Size, Void **Buffer); +typedef UInt64 (*EfiFreePool)(Void *Buffer); + typedef struct EfiTableHeader { UInt64 signature; @@ -22,9 +125,20 @@ typedef struct EfiTableHeader UInt32 reserved; } EfiTableHeader; -struct EfiSimpleTextOutputProtocol; +typedef struct EfiLoadFileProtocol +{ + EfiLoadFile loadFile; +} EfiLoadFileProtocol; -typedef UInt64 (*EfiTextString)(struct EfiSimpleTextOutputProtocol *self, const wchar_t *string); +typedef struct EfiDevicePathProtocol +{ + UInt8 type; + UInt8 subType; + UInt8 lenData[2]; +} EfiDevicePathProtocol; + +#define kEntireDevPath 0xFF +#define kThisInstancePath 0x01 typedef struct EfiSimpleTextOutputProtocol { @@ -43,7 +157,7 @@ typedef struct EfiSimpleTextOutputProtocol typedef struct EfiSystemTable { EfiTableHeader hdr; - wchar_t *firmwareVendor; + WideChar *firmwareVendor; UInt32 firmwareRevision; VoidPtr consoleInHandle; UInt64 conIn; @@ -58,3 +172,5 @@ typedef struct EfiSystemTable } EfiSystemTable; #define EfiMain efi_main + +#define kEfiOk 0 |
