#pragma once

#include "../types.h"

typedef void EfiVoid;

typedef u8   EfiUint8;
typedef u16  EfiUint16;
typedef u32  EfiUint32;
typedef u64  EfiUint64;
typedef uptr EfiUintN;

typedef c16  EfiChar16;

typedef EfiVoid* EfiHandle;

#define EFI_SIZEOF_GUID 16
typedef struct _EfiGuid {
	u32 data1;
	u16 data2;
	u16 data3;
	u8  data4[8];
} EfiGuid;

/// Generic EFI table header
struct EfiTableHeader {
	EfiUint64 Signature;
	EfiUint32 Revision;
	EfiUint32 HeaderSize;
	EfiUint32 CRC32;
	EfiUint32 Reserved;
};

/// EFI System Table
struct EfiSystemTable {
	struct EfiTableHeader         Hdr;
	EfiChar16                    *FirmwareVendor;
	EfiUint32                     FirmwareRevision;
	EfiHandle                     ConsoleInHandle;
	EfiVoid                      *ConIn;
	EfiHandle                     ConsoleOutHandle;
	EfiVoid                      *ConOut;
	EfiHandle                     StandardErrorHandle;
	EfiVoid                      *StdErr;
	struct EfiRuntimeServices    *RuntimeServices;
	struct EfiBootServices       *BootServices;
	EfiUintN                      NumberOfTableEntries;
	struct EfiConfigurationTable *ConfigurationTable;
};

/// EFI Configuration Table
struct EfiConfigurationTable {
	EfiGuid  VendorGuid;
	EfiVoid *VendorTable;
};