StupidOS/boot/efi/uefi.inc

418 lines
10 KiB
HTML

;; File: uefi.inc
struc BOOLEAN
{
. db ?
}
struc UINT64
{
align 8
. dq ?
}
struc UINT32
{
align 4
. dd ?
}
struc INT32
{
align 4
. dd ?
}
struc UINT16
{
align 2
. dw ?
}
struc INT16
{
align 2
. dw ?
}
struc UINT8
{
. db ?
}
struc UINTN
{
align 4
. dd ?
}
struc EFI_HANDLE
{
align 4
. dd ?
}
struc UINTPTR
{
align 4
. dd ?
}
struc EFI_GUID
{
.Data1 dd ?
.Data2 dw ?
.Data3 dw ?
.Data4 db 8 dup(?)
}
struc EFI_TIME
{
.Year UINT16
.Month UINT8
.Day UINT8
.Hour UINT8
.Minute UINT8
.Second UINT8
.Pad1 UINT8
.Nanosecond UINT32
.TimeZone INT16
.Daylight UINT8
.Pad2 UINT8
}
defn EFI_TIME
struc EFI_TABLE_HEADER
{
.Signature UINT64
.Revision UINT32
.HeaderSize UINT32
.CRC32 UINT32
.Reserved UINT32
}
defn EFI_TABLE_HEADER
;; ========================================================================
;; EFI_SYSTEM_TABLE
;; ========================================================================
EFI_SYSTEM_TABLE_SIGNATURE = 0x5453595320494249
EFI_2_90_SYSTEM_TABLE_REVISION = ((2 shl 16) or (90))
EFI_2_80_SYSTEM_TABLE_REVISION = ((2 shl 16) or (80))
EFI_2_70_SYSTEM_TABLE_REVISION = ((2 shl 16) or (70))
EFI_2_60_SYSTEM_TABLE_REVISION = ((2 shl 16) or (60))
EFI_2_50_SYSTEM_TABLE_REVISION = ((2 shl 16) or (50))
EFI_2_40_SYSTEM_TABLE_REVISION = ((2 shl 16) or (40))
EFI_2_31_SYSTEM_TABLE_REVISION = ((2 shl 16) or (31))
EFI_2_30_SYSTEM_TABLE_REVISION = ((2 shl 16) or (30))
EFI_2_20_SYSTEM_TABLE_REVISION = ((2 shl 16) or (20))
EFI_2_10_SYSTEM_TABLE_REVISION = ((2 shl 16) or (10))
EFI_2_00_SYSTEM_TABLE_REVISION = ((2 shl 16) or (00))
EFI_1_10_SYSTEM_TABLE_REVISION = ((1 shl 16) or (10))
EFI_1_02_SYSTEM_TABLE_REVISION = ((1 shl 16) or (02))
EFI_SYSTEM_TABLE_REVISION = EFI_2_90_SYSTEM_TABLE_REVISION
EFI_SPECIFICATION_VERSION = EFI_SYSTEM_TABLE_REVISION
;; Struct: EFI_SYSTEM_TABLE
struc EFI_SYSTEM_TABLE
{
.Hdr EFI_TABLE_HEADER
.FirmwareVendor UINTPTR
.FirmwareRevision UINT32
.ConsoleInHandle EFI_HANDLE
.ConIn UINTPTR
.ConsoleOutHandle EFI_HANDLE
.ConOut UINTPTR
.StandardErrorHandle EFI_HANDLE
.StdErr UINTPTR
.RuntimeServices UINTPTR
.BootServices UINTPTR
.NumberOfTableEntries UINTN
.ConfigurationTable UINTPTR
}
defn EFI_SYSTEM_TABLE
;; ========================================================================
;; EFI_BOOT_SERVICES
;; ========================================================================
EFI_BOOT_SERVICES_SIGNATURE = 0x56524553544f4f42
EFI_BOOT_SERVICES_REVISION = EFI_SPECIFICATION_VERSION
;; Struct: EFI_BOOT_SERVICES
struc EFI_BOOT_SERVICES
{
.Hdr EFI_TABLE_HEADER
; Task Priority Services
.RaiseTPL UINTPTR
.RestoreTPL UINTPTR
; Memory Services
.AllocatePages UINTPTR
.FreePages UINTPTR
.GetMemoryMap UINTPTR
.AllocatePool UINTPTR
.FreePool UINTPTR
; Event & Timer Services
.CreateEvent UINTPTR
.SetTimer UINTPTR
.WaitForEvent UINTPTR
.SignalEvent UINTPTR
.CloseEvent UINTPTR
.CheckEvent UINTPTR
; Protocol Handler Services
.InstallProtocolInterface UINTPTR
.ReinstallProtocolInterface UINTPTR
.UninstallProtocolInterface UINTPTR
.HandleProtocol UINTPTR
.Reserved UINTPTR
.RegisterProtocolNotify UINTPTR
.LocateHandle UINTPTR
.LocateDevicePath UINTPTR
.InstallConfigurationTable UINTPTR
; Image Services
.LoadImage UINTPTR
.StartImage UINTPTR
.Exit UINTPTR
.UnloadImage UINTPTR
.ExitBootServices UINTPTR
; Misc Services
.GetNextMonotonicCount UINTPTR
.Stall UINTPTR
.SetWatchdogTimer UINTPTR
; DriverSupport Service
.ConnectController UINTPTR
.DisconnectController UINTPTR
; Open and Close Protocol Services
.OpenProtocol UINTPTR
.CloseProtocol UINTPTR
.OpenProtocolInformation UINTPTR
; Library Services
.ProtocolsPerHandle UINTPTR
.LocateHandleBuffer UINTPTR
.LocateProtocol UINTPTR
.InstallMultipleProtocolInterfaces UINTPTR
.UninstallMultipleProtocolInterfaces UINTPTR
; 32bit CRC Services
.CalculateCrc32 UINTPTR
; Misc Services
.CopyMem UINTPTR
.SetMem UINTPTR
.CreateEventEx UINTPTR
}
defn EFI_BOOT_SERVICES
;; ========================================================================
;; EFI_RUNTIMES_SERVICES
;; ========================================================================
EFI_RUNTIMES_SERVICES_SIGNATURE = 0x56524553544e5552
EFI_RUNTIMES_SERVICES_REVISION = EFI_SPECIFICATION_VERSION
;; Struct: EFI_RUNTIMES_SERVICES
struc EFI_RUNTIMES_SERVICES
{
.Hdr EFI_TABLE_HEADER
; Time Services
.GetTime UINTPTR
.SetTime UINTPTR
.GetWakeupTime UINTPTR
.SetWakeupTime UINTPTR
; Virtual Memory Services
.SetVirtualAddressMap UINTPTR
.ConvertPointer UINTPTR
; Variable Services
.GetVariable UINTPTR
.GetNextVariableName UINTPTR
.SetVariable UINTPTR
; Misc Services
}
;; ========================================================================
;; EFI_LOADED_IMAGE_PROTOCOL
;; ========================================================================
EFI_LOADED_IMAGE_PROTOCOL_GUID equ 0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3D
EFI_LOADED_IMAGE_PROTOCOL_REVISION = 0x1000
;; Struct: EFI_LOADED_IMAGE_PROTOCOL
struc EFI_LOADED_IMAGE_PROTOCOL
{
.Revision UINT32
.ParentHandle EFI_HANDLE
.SystemTable UINTPTR
.DeviceHandle EFI_HANDLE
.FilePath UINTPTR
.Reserved UINTPTR
.LoadOptionsSize UINT32
.LoadOptions UINTPTR
.ImageBase UINTPTR
.ImageSize UINT64
.ImageCodeType UINT32
.ImageDataType UINT32
.Unload UINTPTR
}
defn EFI_LOADED_IMAGE_PROTOCOL
;; ========================================================================
;; EFI_DEVICE_PATH_PROTOCOL
;; ========================================================================
EFI_DEVICE_PATH_PROTOCOL_GUID equ 0x09576e91, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0x69, 0x72, 0x3b
struc EFI_DEVICE_PATH_PROTOCOL
{
.Type UINT8
.SubType UINT8
.Length db 2 dup(?)
}
defn EFI_DEVICE_PATH_PROTOCOL
;; ========================================================================
;; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
;; ========================================================================
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID equ 0x387477c2, 0x69c7, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b
struc EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
{
.Reset UINTPTR
.OutputString UINTPTR
.TestString UINTPTR
.QueryMode UINTPTR
.SetMode UINTPTR
.SetAttribute UINTPTR
.ClearScreen UINTPTR
.SetCursorPosition UINTPTR
.EnableCursor UINTPTR
.Mode UINTPTR
}
defn EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
struc SIMPLE_TEXT_OUTPUT_MODE
{
.MaxMode INT32
.Mode INT32
.Attribute INT32
.CursorColumn INT32
.CursorRow INT32
.CursorVisible BOOLEAN
}
EFI_BLACK = 0x00
EFI_BLUE = 0x01
EFI_GREEN = 0x02
EFI_CYAN = 0x03
EFI_RED = 0x04
EFI_MAGENTA = 0x05
EFI_BROWN = 0x06
EFI_LIGHTGRAY = 0x07
EFI_BRIGHT = 0x08
EFI_DARKGRAY = (EFI_BLACK or EFI_BRIGHT)
EFI_LIGHTBLUE = 0x09
EFI_LIGHTGREEN = 0x0A
EFI_LIGHTCYAN = 0x0B
EFI_LIGHTRED = 0x0C
EFI_LIGHTMAGENTA = 0x0D
EFI_YELLOW = 0x0E
EFI_WHITE = 0x0F
EFI_BACKGROUND_BLACK = 0x00
EFI_BACKGROUND_BLUE = 0x10
EFI_BACKGROUND_GREEN = 0x20
EFI_BACKGROUND_CYAN = 0x30
EFI_BACKGROUND_RED = 0x40
EFI_BACKGROUND_MAGENTA = 0x50
EFI_BACKGROUND_BROWN = 0x60
EFI_BACKGROUND_LIGHTGRAY = 0x70
;; ========================================================================
;; EFI_LOAD_FILE_PROTOCOL
;; ========================================================================
EFI_LOAD_FILE_PROTOCOL_GUID equ 0x56ec3091, 0x954c, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b
struc EFI_LOAD_FILE_PROTOCOL
{
.LoadFile UINTPTR
}
defn EFI_LOAD_FILE_PROTOCOL
;; ========================================================================
;; EFI_LOAD_FILE2_PROTOCOL
;; ========================================================================
EFI_LOAD_FILE2_PROTOCOL_GUID equ 0x4006c0c1, 0xfcb3, 0x403e, 0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d
EFI_LOAD_FILE2_PROTOCOL equ EFI_LOAD_FILE_PROTOCOL
;; ========================================================================
;; EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
;; ========================================================================
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID equ 0x0964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION = 0x00010000
struc EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
{
.Revision UINT64
.OpenVolume UINTPTR
}
defn EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
;; ========================================================================
;; EFI_FILE_PROTOCOL
;; ========================================================================
EFI_FILE_PROTOCOL_REVISION = 0x00010000
EFI_FILE_PROTOCOL_REVISION2 = 0x00020000
EFI_FILE_PROTOCOL_LATEST_REVISION = EFI_FILE_PROTOCOL_REVISION2
struc EFI_FILE_PROTOCOL
{
.Revision UINT64
.Open UINTPTR
.Close UINTPTR
.Delete UINTPTR
.Read UINTPTR
.Write UINTPTR
.GetPosition UINTPTR
.SetPosition UINTPTR
.GetInfo UINTPTR
.SetInfo UINTPTR
.Flush UINTPTR
.OpenEx UINTPTR
.ReadEx UINTPTR
.WriteEx UINTPTR
.FlushEx UINTPTR
}
defn EFI_FILE_PROTOCOL
; Open Mode
EFI_FILE_MODE_READ = 0x0000000000000001
EFI_FILE_MODE_WRITE = 0x0000000000000002
EFI_FILE_MODE_CREATE = 0x8000000000000000
; File Attributes
EFI_FILE_READ_ONLY = 0x0000000000000001
EFI_FILE_HIDDEN = 0x0000000000000002
EFI_FILE_SYSTEM = 0x0000000000000004
EFI_FILE_RESERVED = 0x0000000000000008
EFI_FILE_DIRECTORY = 0x0000000000000010
EFI_FILE_ARCHIVE = 0x0000000000000020
EFI_FILE_VALID_ATTR = 0x0000000000000037