+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- EfiTypes.h\r
-\r
-Abstract:\r
-\r
- EFI defined types. Use these types when ever possible!\r
-\r
---*/\r
-\r
-#ifndef _EFI_TYPES_H_\r
-#define _EFI_TYPES_H_\r
-\r
-//\r
-// EFI Data Types based on ANSI C integer types in EfiBind.h\r
-//\r
-typedef uint8_t BOOLEAN;\r
-typedef intn_t INTN;\r
-typedef uintn_t UINTN;\r
-typedef int8_t INT8;\r
-typedef uint8_t UINT8;\r
-typedef int16_t INT16;\r
-typedef uint16_t UINT16;\r
-typedef int32_t INT32;\r
-typedef uint32_t UINT32;\r
-typedef int64_t INT64;\r
-typedef uint64_t UINT64;\r
-typedef char CHAR8;\r
-typedef uint16_t CHAR16;\r
-typedef UINT64 EFI_LBA;\r
-\r
-//\r
-// Modifiers for EFI Data Types used to self document code.\r
-// Please see EFI coding convention for proper usage.\r
-//\r
-#ifndef IN\r
-//\r
-// Some other envirnments use this construct, so #ifndef to prevent\r
-// mulitple definition.\r
-//\r
-#define IN\r
-#define OUT\r
-#define OPTIONAL\r
-#endif\r
-\r
-#ifndef UNALIGNED\r
-#define UNALIGNED\r
-#endif\r
-\r
-//\r
-// Modifiers for EFI Runtime and Boot Services\r
-//\r
-#define EFI_RUNTIMESERVICE\r
-#define EFI_BOOTSERVICE\r
-\r
-//\r
-// Boot Service add in EFI 1.1\r
-//\r
-#define EFI_BOOTSERVICE11\r
-\r
-//\r
-// Modifiers to absract standard types to aid in debug of problems\r
-//\r
-#define CONST const\r
-#define STATIC static\r
-#define VOID void\r
-#define VOLATILE volatile\r
-\r
-//\r
-// Modifier to ensure that all protocol member functions and EFI intrinsics\r
-// use the correct C calling convention. All protocol member functions and\r
-// EFI intrinsics are required to modify thier member functions with EFIAPI.\r
-//\r
-#ifndef EFIAPI\r
- #define EFIAPI _EFIAPI\r
-#endif \r
-\r
-//\r
-// EFI Constants. They may exist in other build structures, so #ifndef them.\r
-//\r
-#ifndef TRUE\r
-#define TRUE ((BOOLEAN) (1 == 1))\r
-#endif\r
-\r
-#ifndef FALSE\r
-#define FALSE ((BOOLEAN) (0 == 1))\r
-#endif\r
-\r
-#ifndef NULL\r
-#define NULL ((VOID *) 0)\r
-#endif\r
-//\r
-// EFI Data Types derived from other EFI data types.\r
-//\r
-typedef UINTN EFI_STATUS;\r
-\r
-typedef VOID *EFI_HANDLE;\r
-#define NULL_HANDLE ((VOID *) 0)\r
-\r
-typedef VOID *EFI_EVENT;\r
-typedef UINTN EFI_TPL;\r
-\r
-typedef struct {\r
- UINT32 Data1;\r
- UINT16 Data2;\r
- UINT16 Data3;\r
- UINT8 Data4[8];\r
-} EFI_GUID;\r
-\r
-typedef union {\r
- EFI_GUID Guid;\r
- UINT8 Raw[16];\r
-} EFI_GUID_UNION;\r
-\r
-//\r
-// EFI Time Abstraction:\r
-// Year: 2000 - 20XX\r
-// Month: 1 - 12\r
-// Day: 1 - 31\r
-// Hour: 0 - 23\r
-// Minute: 0 - 59\r
-// Second: 0 - 59\r
-// Nanosecond: 0 - 999,999,999\r
-// TimeZone: -1440 to 1440 or 2047\r
-//\r
-typedef struct {\r
- UINT16 Year;\r
- UINT8 Month;\r
- UINT8 Day;\r
- UINT8 Hour;\r
- UINT8 Minute;\r
- UINT8 Second;\r
- UINT8 Pad1;\r
- UINT32 Nanosecond;\r
- INT16 TimeZone;\r
- UINT8 Daylight;\r
- UINT8 Pad2;\r
-} EFI_TIME;\r
-\r
-//\r
-// Bit definitions for EFI_TIME.Daylight\r
-//\r
-#define EFI_TIME_ADJUST_DAYLIGHT 0x01\r
-#define EFI_TIME_IN_DAYLIGHT 0x02\r
-\r
-//\r
-// Value definition for EFI_TIME.TimeZone\r
-//\r
-#define EFI_UNSPECIFIED_TIMEZONE 0x07FF\r
-\r
-//\r
-// Networking\r
-//\r
-typedef struct {\r
- UINT8 Addr[4];\r
-} EFI_IPv4_ADDRESS;\r
-\r
-typedef struct {\r
- UINT8 Addr[16];\r
-} EFI_IPv6_ADDRESS;\r
-\r
-typedef struct {\r
- UINT8 Addr[32];\r
-} EFI_MAC_ADDRESS;\r
-\r
-typedef union {\r
- UINT32 Addr[4];\r
- EFI_IPv4_ADDRESS v4;\r
- EFI_IPv6_ADDRESS v6;\r
-} EFI_IP_ADDRESS;\r
-\r
-typedef enum {\r
- EfiReservedMemoryType,\r
- EfiLoaderCode,\r
- EfiLoaderData,\r
- EfiBootServicesCode,\r
- EfiBootServicesData,\r
- EfiRuntimeServicesCode,\r
- EfiRuntimeServicesData,\r
- EfiConventionalMemory,\r
- EfiUnusableMemory,\r
- EfiACPIReclaimMemory,\r
- EfiACPIMemoryNVS,\r
- EfiMemoryMappedIO,\r
- EfiMemoryMappedIOPortSpace,\r
- EfiPalCode,\r
- EfiPersistentMemory,\r
- EfiMaxMemoryType\r
-} EFI_MEMORY_TYPE;\r
-\r
-typedef enum {\r
- AllocateAnyPages,\r
- AllocateMaxAddress,\r
- AllocateAddress,\r
- MaxAllocateType\r
-} EFI_ALLOCATE_TYPE;\r
-\r
-typedef struct {\r
- UINT64 Signature;\r
- UINT32 Revision;\r
- UINT32 HeaderSize;\r
- UINT32 CRC32;\r
- UINT32 Reserved;\r
-} EFI_TABLE_HEADER;\r
-\r
-//\r
-// possible caching types for the memory range\r
-//\r
-#define EFI_MEMORY_UC 0x0000000000000001\r
-#define EFI_MEMORY_WC 0x0000000000000002\r
-#define EFI_MEMORY_WT 0x0000000000000004\r
-#define EFI_MEMORY_WB 0x0000000000000008\r
-#define EFI_MEMORY_UCE 0x0000000000000010\r
-\r
-//\r
-// physical memory protection on range\r
-//\r
-#define EFI_MEMORY_WP 0x0000000000001000\r
-#define EFI_MEMORY_RP 0x0000000000002000\r
-#define EFI_MEMORY_XP 0x0000000000004000\r
-\r
-//\r
-// range requires a runtime mapping\r
-//\r
-#define EFI_MEMORY_RUNTIME 0x8000000000000000ULL\r
-\r
-typedef UINT64 EFI_PHYSICAL_ADDRESS;\r
-typedef UINT64 EFI_VIRTUAL_ADDRESS;\r
-\r
-#define EFI_MEMORY_DESCRIPTOR_VERSION 1\r
-typedef struct {\r
- UINT32 Type;\r
- UINT32 Pad;\r
- EFI_PHYSICAL_ADDRESS PhysicalStart;\r
- EFI_VIRTUAL_ADDRESS VirtualStart;\r
- UINT64 NumberOfPages;\r
- UINT64 Attribute;\r
-} EFI_MEMORY_DESCRIPTOR;\r
-\r
-//\r
-// The EFI memory allocation functions work in units of EFI_PAGEs that are\r
-// 4K. This should in no way be confused with the page size of the processor.\r
-// An EFI_PAGE is just the quanta of memory in EFI.\r
-//\r
-#define EFI_PAGE_SIZE 4096\r
-#define EFI_PAGE_MASK 0xFFF\r
-#define EFI_PAGE_SHIFT 12\r
-\r
-#define EFI_SIZE_TO_PAGES(a) (((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0))\r
-\r
-#define EFI_PAGES_TO_SIZE(a) ( (a) << EFI_PAGE_SHIFT)\r
-\r
-//\r
-// ALIGN_POINTER - aligns a pointer to the lowest boundary\r
-//\r
-#define ALIGN_POINTER(p, s) ((VOID *) (p + ((s - ((UINTN) p)) & (s - 1))))\r
-\r
-//\r
-// ALIGN_VARIABLE - aligns a variable up to the next natural boundary for int size of a processor\r
-//\r
-#define ALIGN_VARIABLE(Value, Adjustment) \\r
- (UINTN) Adjustment = 0; \\r
- if ((UINTN) Value % sizeof (UINTN)) { \\r
- (UINTN) Adjustment = sizeof (UINTN) - ((UINTN) Value % sizeof (UINTN)); \\r
- } \\r
- Value = (UINTN) Value + (UINTN) Adjustment\r
-\r
-//\r
-// EFI_FIELD_OFFSET - returns the byte offset to a field within a structure\r
-//\r
-#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))\r
-\r
-//\r
-// CONTAINING_RECORD - returns a pointer to the structure\r
-// from one of it's elements.\r
-//\r
-#define _CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))\r
-\r
-//\r
-// Define macros to build data structure signatures from characters.\r
-//\r
-#define EFI_SIGNATURE_16(A, B) ((A) | (B << 8))\r
-#define EFI_SIGNATURE_32(A, B, C, D) (EFI_SIGNATURE_16 (A, B) | (EFI_SIGNATURE_16 (C, D) << 16))\r
-#define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H) \\r
- (EFI_SIGNATURE_32 (A, B, C, D) | ((UINT64) (EFI_SIGNATURE_32 (E, F, G, H)) << 32))\r
-\r
-#endif\r