mineswefi.git
efi.h

/* mineswefi - uefi minesweeper
* Copyright (C) 2025 ArcNyxx <olive@arcnyxx.net>
* see LICENCE file for licensing information */
#ifndef EFI_H
#define EFI_H
#include <stdint.h>
typedef void * efi_handle_t;
typedef struct efi_guid {
uint32_t data1;
uint16_t data2;
uint16_t data3;
uint8_t data4[8];
} efi_guid_t;
#include "file.h"
#include "io.h"
typedef struct efi_table_header {
uint64_t sig;
uint32_t rev;
uint32_t len;
uint32_t crc32;
uint32_t reserved;
} efi_table_header_t;
typedef struct efi_boot {
efi_table_header_t head;
void *RaiseTPL;
void *RestoreTPL;
void *AllocatePages;
void *FreePages;
void *GetMemoryMap;
void *AllocatePool;
void *FreePool;
void *CreateEvent;
void *SetTimer;
void *WaitForEvent;
void *SignalEvent;
void *CloseEvent;
void *CheckEvent;
void *InstallProtocolInterface;
void *ReinstallProtocolInterface;
void *UninstallProtocolInterface;
void *HandleProtocol;
void *Reserved;
void *RegisterProtocolNotify;
void *LocateHandle;
void *LocateDevicePath;
void *InstallConfigurationTable;
void *LoadImage;
void *StartImage;
void *Exit;
void *UnloadImage;
void *ExitBootServices;
void *GetNextMonotonicCount;
void *Stall;
void *SetWatchdogTimer;
void *ConnectController;
void *DisconnectController;
uint64_t (*open_proto)(void *handle, efi_guid_t *proto,
void **interface, void *agent, void *controller,
uint32_t attr);
void *CloseProtocol;
void *OpenProtocolInformation;
void *ProtocolsPerHandle;
void *LocateHandleBuffer;
void *LocateProtocol;
void *InstallMultipleProtocolInterfaces;
void *UninstallMultipleProtocolInterfaces;
void *CalculateCrc32;
void *CopyMem;
void *SetMem;
void *CreateEventEx;
} efi_boot_t;
typedef struct efi_runtime {
efi_table_header_t head;
void *GetTime;
void *SetTime;
void *GetWakeupTime;
void *SetWakeupTime;
void *SetVirtualAddressMap;
void *ConvertPointer;
void *GetVariable;
void *GetNextVariableName;
void *SetVariable;
void *GetNextHighMonotonicCount;
void *ResetSystem;
void *UpdateCapsule;
void *QueryCapsuleCapabilities;
void *QueryVariableInfo;
} efi_runtime_t;
typedef struct efi_table {
efi_table_header_t head;
int16_t *vendor;
uint32_t rev;
void *stdin_handle;
efi_text_input_t *stdin;
void *stdout_handle;
efi_text_output_t *stdout;
void *stderr_handle;
efi_text_output_t *stderr;
efi_runtime_t *runtime;
efi_boot_t *boot;
uint64_t len;
struct {
efi_guid_t guid;
void *table;
} config;
} efi_table_t;
#endif /* EFI_H */