1 typedef ushort CHAR16; 2 3 typedef uchar UINT8; 4 typedef ushort UINT16; 5 typedef ulong UINT32; 6 typedef uvlong UINT64; 7 typedef UINT8 BOOLEAN; 8 9 typedef uintptr UINTN; 10 11 typedef void* EFI_HANDLE; 12 typedef UINT32 EFI_STATUS; 13 14 enum { 15 AllHandles, 16 ByRegisterNotify, 17 ByProtocol, 18 }; 19 20 typedef struct { 21 UINT32 Data1; 22 UINT16 Data2; 23 UINT16 Data3; 24 UINT8 Data4[8]; 25 } EFI_GUID; 26 27 typedef struct { 28 UINT16 ScanCode; 29 CHAR16 UnicodeChar; 30 } EFI_INPUT_KEY; 31 32 typedef struct { 33 void *Reset; 34 void *ReadKeyStroke; 35 void *WaitForKey; 36 } EFI_SIMPLE_TEXT_INPUT_PROTOCOL; 37 38 typedef struct { 39 void *Reset; 40 void *OutputString; 41 void *TestString; 42 void *QueryMode; 43 void *SetMode; 44 void *SetAttribute; 45 void *ClearScreen; 46 void *SetCursorPosition; 47 void *EnableCursor; 48 void *Mode; 49 } EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL; 50 51 typedef struct { 52 UINT32 Revision; 53 EFI_HANDLE ParentHandle; 54 void *SystemTable; 55 EFI_HANDLE DeviceHandle; 56 void *FilePath; 57 void *Reserved; 58 UINT32 LoadOptionsSize; 59 void *LoadOptions; 60 void *ImageBase; 61 UINT64 ImageSize; 62 UINT32 ImageCodeType; 63 UINT32 ImageDataType; 64 void *Unload; 65 } EFI_LOADED_IMAGE_PROTOCOL; 66 67 typedef struct { 68 UINT32 RedMask; 69 UINT32 GreenMask; 70 UINT32 BlueMask; 71 UINT32 ReservedMask; 72 } EFI_PIXEL_BITMASK; 73 74 enum { 75 PixelRedGreenBlueReserved8BitPerColor, 76 PixelBlueGreenRedReserved8BitPerColor, 77 PixelBitMask, 78 PixelBltOnly, 79 PixelFormatMax, 80 }; 81 82 typedef struct { 83 UINT32 Version; 84 UINT32 HorizontalResolution; 85 UINT32 VerticalResolution; 86 UINT32 PixelFormat; 87 EFI_PIXEL_BITMASK PixelInformation; 88 UINT32 PixelsPerScanLine; 89 } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION; 90 91 typedef struct { 92 UINT32 MaxMode; 93 UINT32 Mode; 94 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; 95 UINTN SizeOfInfo; 96 UINT64 FrameBufferBase; 97 UINTN FrameBufferSize; 98 } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE; 99 100 typedef struct { 101 void *QueryMode; 102 void *SetMode; 103 void *Blt; 104 EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode; 105 } EFI_GRAPHICS_OUTPUT_PROTOCOL; 106 107 enum { 108 EfiReservedMemoryType, 109 EfiLoaderCode, 110 EfiLoaderData, 111 EfiBootServicesCode, 112 EfiBootServicesData, 113 EfiRuntimeServicesCode, 114 EfiRuntimeServicesData, 115 EfiConventionalMemory, 116 EfiUnusableMemory, 117 EfiACPIReclaimMemory, 118 EfiACPIMemoryNVS, 119 EfiMemoryMappedIO, 120 EfiMemoryMappedIOPortSpace, 121 EfiPalCode, 122 EfiMaxMemoryType, 123 }; 124 125 typedef struct { 126 UINT32 Type; 127 UINT32 Reserved; 128 UINT64 PhysicalStart; 129 UINT64 VirtualStart; 130 UINT64 NumberOfPages; 131 UINT64 Attribute; 132 } EFI_MEMORY_DESCRIPTOR; 133 134 135 typedef struct { 136 UINT64 Signature; 137 UINT32 Revision; 138 UINT32 HeaderSize; 139 UINT32 CRC32; 140 UINT32 Reserved; 141 } EFI_TABLE_HEADER; 142 143 typedef struct { 144 EFI_TABLE_HEADER; 145 146 void *RaiseTPL; 147 void *RestoreTPL; 148 void *AllocatePages; 149 void *FreePages; 150 void *GetMemoryMap; 151 void *AllocatePool; 152 void *FreePool; 153 154 void *CreateEvent; 155 void *SetTimer; 156 void *WaitForEvent; 157 void *SignalEvent; 158 void *CloseEvent; 159 void *CheckEvent; 160 161 void **InstallProtocolInterface; 162 void **ReinstallProtocolInterface; 163 void **UninstallProtocolInterface; 164 165 void *HandleProtocol; 166 void *Reserved; 167 void *RegisterProtocolNotify; 168 169 void *LocateHandle; 170 void *LocateDevicePath; 171 void *InstallConfigurationTable; 172 173 void *LoadImage; 174 void *StartImage; 175 void *Exit; 176 void *UnloadImage; 177 void *ExitBootServices; 178 179 void *GetNextMonotonicCount; 180 void *Stall; 181 void *SetWatchdogTimer; 182 183 void *ConnectController; 184 void *DisconnectController; 185 186 void *OpenProtocol; 187 void *CloseProtocol; 188 189 void *OpenProtocolInformation; 190 void *ProtocolsPerHandle; 191 void *LocateHandleBuffer; 192 void *LocateProtocol; 193 194 void *InstallMultipleProtocolInterfaces; 195 void *UninstallMultipleProtocolInterfaces; 196 197 void *CalculateCrc32; 198 199 void *CopyMem; 200 void *SetMem; 201 void *CreateEventEx; 202 } EFI_BOOT_SERVICES; 203 204 typedef struct { 205 EFI_TABLE_HEADER; 206 207 void *GetTime; 208 void *SetTime; 209 void *GetWakeupTime; 210 void *SetWakeupTime; 211 212 void *SetVirtualAddressMap; 213 void *ConvertPointer; 214 215 void *GetVariable; 216 void *GetNextVariableName; 217 void *SetVariable; 218 219 void *GetNextHighMonotonicCount; 220 void *ResetSystem; 221 222 void *UpdateCapsule; 223 void *QueryCapsuleCapabilities; 224 225 void *QueryVariableInfo; 226 } EFI_RUNTIME_SERVICES; 227 228 typedef struct { 229 EFI_GUID VendorGuid; 230 void *VendorTable; 231 } EFI_CONFIGURATION_TABLE; 232 233 typedef struct { 234 EFI_TABLE_HEADER; 235 236 CHAR16 *FirmwareVendor; 237 UINT32 FirmwareRevision; 238 239 EFI_HANDLE ConsoleInHandle; 240 EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn; 241 242 EFI_HANDLE ConsoleOutHandle; 243 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut; 244 245 EFI_HANDLE StandardErrorHandle; 246 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *StdErr; 247 248 EFI_RUNTIME_SERVICES *RuntimeServices; 249 EFI_BOOT_SERVICES *BootServices; 250 251 UINTN NumberOfTableEntries; 252 EFI_CONFIGURATION_TABLE *ConfigurationTable; 253 } EFI_SYSTEM_TABLE; 254 255 extern EFI_SYSTEM_TABLE *ST; 256 extern EFI_HANDLE IH; 257