--- /dev/null
+/** @file\r
+\r
+ Root include file for Mde Package Base type modules\r
+\r
+ This is the include file for any module of type base. Base modules only use \r
+ types defined via this include file and can be ported easily to any \r
+ environment. There are a set of base libraries in the Mde Package that can\r
+ be used to implement base modules.\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+**/\r
+\r
+\r
+#ifndef __BASE_H__\r
+#define __BASE_H__\r
+\r
+//\r
+// Include processor specific binding\r
+//\r
+#include <ProcessorBind.h>\r
+\r
+typedef struct {\r
+ UINT32 Data1;\r
+ UINT16 Data2;\r
+ UINT16 Data3;\r
+ UINT8 Data4[8];\r
+} GUID;\r
+\r
+typedef UINT64 PHYSICAL_ADDRESS;\r
+\r
+//\r
+// LIST_ENTRY definition\r
+//\r
+typedef struct _LIST_ENTRY LIST_ENTRY;\r
+\r
+struct _LIST_ENTRY {\r
+ LIST_ENTRY *ForwardLink;\r
+ LIST_ENTRY *BackLink;\r
+};\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
+\r
+//\r
+// Modifiers for Data Types used to self document code.\r
+// This concept is borrowed for UEFI specification.\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
+//\r
+// Constants. They may exist in other build structures, so #ifndef them.\r
+//\r
+#ifndef TRUE\r
+//\r
+// UEFI specification claims 1 and 0. We are concerned about the \r
+// complier portability so we did it this way.\r
+//\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
+#define BIT0 0x00000001\r
+#define BIT1 0x00000002\r
+#define BIT2 0x00000004\r
+#define BIT3 0x00000008\r
+#define BIT4 0x00000010\r
+#define BIT5 0x00000020\r
+#define BIT6 0x00000040\r
+#define BIT7 0x00000080\r
+#define BIT8 0x00000100\r
+#define BIT9 0x00000200\r
+#define BIT10 0x00000400\r
+#define BIT11 0x00000800\r
+#define BIT12 0x00001000\r
+#define BIT13 0x00002000\r
+#define BIT14 0x00004000\r
+#define BIT15 0x00008000\r
+#define BIT16 0x00010000\r
+#define BIT17 0x00020000\r
+#define BIT18 0x00040000\r
+#define BIT19 0x00080000\r
+#define BIT20 0x00100000\r
+#define BIT21 0x00200000\r
+#define BIT22 0x00400000\r
+#define BIT23 0x00800000\r
+#define BIT24 0x01000000\r
+#define BIT25 0x02000000\r
+#define BIT26 0x04000000\r
+#define BIT27 0x08000000\r
+#define BIT28 0x10000000\r
+#define BIT29 0x20000000\r
+#define BIT30 0x40000000\r
+#define BIT31 0x80000000\r
+#define BIT32 0x0000000100000000UL\r
+#define BIT33 0x0000000200000000UL\r
+#define BIT34 0x0000000400000000UL\r
+#define BIT35 0x0000000800000000UL\r
+#define BIT36 0x0000001000000000UL\r
+#define BIT37 0x0000002000000000UL\r
+#define BIT38 0x0000004000000000UL\r
+#define BIT39 0x0000008000000000UL\r
+#define BIT40 0x0000010000000000UL\r
+#define BIT41 0x0000020000000000UL\r
+#define BIT42 0x0000040000000000UL\r
+#define BIT43 0x0000080000000000UL\r
+#define BIT44 0x0000100000000000UL\r
+#define BIT45 0x0000200000000000UL\r
+#define BIT46 0x0000400000000000UL\r
+#define BIT47 0x0000800000000000UL\r
+#define BIT48 0x0001000000000000UL\r
+#define BIT49 0x0002000000000000UL\r
+#define BIT50 0x0004000000000000UL\r
+#define BIT51 0x0008000000000000UL\r
+#define BIT52 0x0010000000000000UL\r
+#define BIT53 0x0020000000000000UL\r
+#define BIT54 0x0040000000000000UL\r
+#define BIT55 0x0080000000000000UL\r
+#define BIT56 0x0100000000000000UL\r
+#define BIT57 0x0200000000000000UL\r
+#define BIT58 0x0400000000000000UL\r
+#define BIT59 0x0800000000000000UL\r
+#define BIT60 0x1000000000000000UL\r
+#define BIT61 0x2000000000000000UL\r
+#define BIT62 0x4000000000000000UL\r
+#define BIT63 0x8000000000000000UL\r
+\r
+//\r
+// Support for variable length argument lists using the ANSI standard.\r
+// \r
+// Since we are using the ANSI standard we used the standard nameing and\r
+// did not folow the coding convention\r
+//\r
+// VA_LIST - typedef for argument list.\r
+// VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use.\r
+// VA_END (VA_LIST Marker) - Clear Marker\r
+// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argumnet from\r
+// the ... list. You must know the size and pass it in this macro.\r
+//\r
+// example:\r
+//\r
+// UINTN\r
+// ExampleVarArg (\r
+// IN UINTN NumberOfArgs,\r
+// ...\r
+// )\r
+// {\r
+// VA_LIST Marker;\r
+// UINTN Index;\r
+// UINTN Result;\r
+//\r
+// //\r
+// // Initialize the Marker\r
+// //\r
+// VA_START (Marker, NumberOfArgs);\r
+// for (Index = 0, Result = 0; Index < NumberOfArgs; Index++) {\r
+// //\r
+// // The ... list is a series of UINTN values, so average them up.\r
+// //\r
+// Result += VA_ARG (Marker, UINTN);\r
+// }\r
+//\r
+// VA_END (Marker);\r
+// return Result\r
+// }\r
+//\r
+\r
+#define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))\r
+\r
+//\r
+// Also support coding convention rules for var arg macros\r
+//\r
+#ifndef VA_START\r
+\r
+typedef CHAR8 *VA_LIST;\r
+#define VA_START(ap, v) (ap = (VA_LIST) & (v) + _INT_SIZE_OF (v))\r
+#define VA_ARG(ap, t) (*(t *) ((ap += _INT_SIZE_OF (t)) - _INT_SIZE_OF (t)))\r
+#define VA_END(ap) (ap = (VA_LIST) 0)\r
+\r
+#endif\r
+\r
+//\r
+// Macro that returns the byte offset of a field in a data structure. \r
+//\r
+#define OFFSET_OF(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
+/// ALIGN_POINTER - aligns a pointer to the lowest boundry\r
+///\r
+#define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1))))\r
+\r
+///\r
+/// ALIGN_VARIABLE - aligns a variable up to the next natural boundry for int size of a processor\r
+///\r
+#define ALIGN_VARIABLE(Value, Adjustment) \\r
+ Adjustment = 0U; \\r
+ if ((UINTN) (Value) % sizeof (UINTN)) { \\r
+ (Adjustment) = (UINTN)(sizeof (UINTN) - ((UINTN) (Value) % sizeof (UINTN))); \\r
+ } \\r
+ (Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment))\r
+\r
+//\r
+// Return the maximum of two operands. \r
+// This macro returns the maximum of two operand specified by a and b. \r
+// Both a and b must be the same numerical types, signed or unsigned.\r
+//\r
+#define MAX(a, b) \\r
+ (((a) > (b)) ? (a) : (b))\r
+\r
+\r
+//\r
+// Return the minimum of two operands. \r
+// This macro returns the minimal of two operand specified by a and b. \r
+// Both a and b must be the same numerical types, signed or unsigned.\r
+//\r
+#define MIN(a, b) \\r
+ (((a) < (b)) ? (a) : (b))\r
+\r
+\r
+//\r
+// EFI Error Codes common to all execution phases\r
+//\r
+\r
+typedef INTN RETURN_STATUS;\r
+\r
+///\r
+/// Set the upper bit to indicate EFI Error.\r
+///\r
+#define ENCODE_ERROR(a) (MAX_BIT | (a))\r
+\r
+#define ENCODE_WARNING(a) (a)\r
+#define RETURN_ERROR(a) ((a) < 0)\r
+\r
+#define RETURN_SUCCESS 0\r
+#define RETURN_LOAD_ERROR ENCODE_ERROR (1)\r
+#define RETURN_INVALID_PARAMETER ENCODE_ERROR (2)\r
+#define RETURN_UNSUPPORTED ENCODE_ERROR (3)\r
+#define RETURN_BAD_BUFFER_SIZE ENCODE_ERROR (4)\r
+#define RETURN_BUFFER_TOO_SMALL ENCODE_ERROR (5)\r
+#define RETURN_NOT_READY ENCODE_ERROR (6)\r
+#define RETURN_DEVICE_ERROR ENCODE_ERROR (7)\r
+#define RETURN_WRITE_PROTECTED ENCODE_ERROR (8)\r
+#define RETURN_OUT_OF_RESOURCES ENCODE_ERROR (9)\r
+#define RETURN_VOLUME_CORRUPTED ENCODE_ERROR (10)\r
+#define RETURN_VOLUME_FULL ENCODE_ERROR (11)\r
+#define RETURN_NO_MEDIA ENCODE_ERROR (12)\r
+#define RETURN_MEDIA_CHANGED ENCODE_ERROR (13)\r
+#define RETURN_NOT_FOUND ENCODE_ERROR (14)\r
+#define RETURN_ACCESS_DENIED ENCODE_ERROR (15)\r
+#define RETURN_NO_RESPONSE ENCODE_ERROR (16)\r
+#define RETURN_NO_MAPPING ENCODE_ERROR (17)\r
+#define RETURN_TIMEOUT ENCODE_ERROR (18)\r
+#define RETURN_NOT_STARTED ENCODE_ERROR (19)\r
+#define RETURN_ALREADY_STARTED ENCODE_ERROR (20)\r
+#define RETURN_ABORTED ENCODE_ERROR (21)\r
+#define RETURN_ICMP_ERROR ENCODE_ERROR (22)\r
+#define RETURN_TFTP_ERROR ENCODE_ERROR (23)\r
+#define RETURN_PROTOCOL_ERROR ENCODE_ERROR (24)\r
+#define RETURN_INCOMPATIBLE_VERSION ENCODE_ERROR (25)\r
+#define RETURN_SECURITY_VIOLATION ENCODE_ERROR (26)\r
+#define RETURN_CRC_ERROR ENCODE_ERROR (27)\r
+#define RETURN_END_OF_MEDIA ENCODE_ERROR (28)\r
+#define RETURN_END_OF_FILE ENCODE_ERROR (31)\r
+\r
+#define RETURN_WARN_UNKNOWN_GLYPH ENCODE_WARNING (1)\r
+#define RETURN_WARN_DELETE_FAILURE ENCODE_WARNING (2)\r
+#define RETURN_WARN_WRITE_FAILURE ENCODE_WARNING (3)\r
+#define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4)\r
+\r
+#endif\r
+\r
--- /dev/null
+/** @file\r
+ Processor or compiler specific defines and types for EBC.\r
+\r
+ We currently only have one EBC complier so there may be some Intel compiler\r
+ specific functions in this file.\r
+\r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. 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: ProcessorBind.h\r
+\r
+**/\r
+\r
+#ifndef __PROCESSOR_BIND_H__\r
+#define __PROCESSOR_BIND_H__\r
+\r
+//\r
+// Define the processor type so other code can make processor based choices\r
+//\r
+#define MDE_CPU_EBC\r
+\r
+//\r
+// Native integer types\r
+//\r
+typedef char INT8;\r
+typedef unsigned char BOOLEAN;\r
+typedef unsigned char UINT8;\r
+typedef unsigned char CHAR8;\r
+\r
+typedef short INT16;\r
+typedef unsigned short UINT16;\r
+typedef unsigned short CHAR16;\r
+\r
+typedef int INT32;\r
+typedef unsigned int UINT32;\r
+\r
+typedef __int64 INT64;\r
+typedef unsigned __int64 UINT64;\r
+\r
+//\r
+// "long" type scales to the processor native size with EBC compiler\r
+//\r
+typedef long INTN;\r
+typedef unsigned long UINTN;\r
+\r
+#define UINT8_MAX 0xff\r
+\r
+//\r
+// Scalable macro to set the most significant bit in a natural number\r
+//\r
+#define MAX_BIT (1ULL << (sizeof (INTN) * 8 - 1)) \r
+#define MAX_2_BITS (3ULL << (sizeof (INTN) * 8 - 2))\r
+\r
+//\r
+// Maximum legal EBC address\r
+//\r
+#define MAX_ADDRESS ((UINTN) ~0)\r
+\r
+//\r
+// The stack alignment required for EBC\r
+//\r
+#define CPU_STACK_ALIGNMENT sizeof(UINTN)\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
+#define EFIAPI \r
+\r
+//\r
+// The Microsoft* C compiler can removed references to unreferenced data items\r
+// if the /OPT:REF linker option is used. We defined a macro as this is a \r
+// a non standard extension. Currently not supported by the EBC compiler\r
+//\r
+#define GLOBAL_REMOVE_IF_UNREFERENCED\r
+\r
+#endif \r
+\r
--- /dev/null
+/** @file\r
+ Processor or Compiler specific defines and types for x64.\r
+\r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. 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: ProcessorBind.h\r
+\r
+**/\r
+\r
+#ifndef __PROCESSOR_BIND_H__\r
+#define __PROCESSOR_BIND_H__\r
+\r
+//\r
+// Define the processor type so other code can make processor based choices\r
+//\r
+#define MDE_CPU_IA32\r
+\r
+//\r
+// Make sure we are useing the correct packing rules per EFI specification\r
+//\r
+#ifndef __GNUC__\r
+#pragma pack()\r
+#endif\r
+\r
+#if _MSC_EXTENSIONS\r
+\r
+//\r
+// Disable warning that make it impossible to compile at /W4\r
+// This only works for Microsoft* tools\r
+//\r
+\r
+//\r
+// Disabling bitfield type checking warnings.\r
+//\r
+#pragma warning ( disable : 4214 )\r
+\r
+//\r
+// Disabling the unreferenced formal parameter warnings.\r
+//\r
+#pragma warning ( disable : 4100 )\r
+\r
+//\r
+// Disable slightly different base types warning as CHAR8 * can not be set\r
+// to a constant string.\r
+//\r
+#pragma warning ( disable : 4057 )\r
+\r
+//\r
+// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning\r
+//\r
+#pragma warning ( disable : 4127 )\r
+\r
+//\r
+// This warning is caused by functions defined but not used. For precompiled header only.\r
+//\r
+#pragma warning ( disable : 4505 )\r
+\r
+//\r
+// This warning is caused by empty (after preprocessing) souce file. For precompiled header only.\r
+//\r
+#pragma warning ( disable : 4206 )\r
+\r
+#endif\r
+\r
+\r
+#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)\r
+ //\r
+ // No ANSI C 2000 stdint.h integer width declarations, so define equivalents\r
+ //\r
+ \r
+ #if _MSC_EXTENSIONS \r
+ \r
+ //\r
+ // use Microsoft* C complier dependent interger width types \r
+ //\r
+ typedef unsigned __int64 UINT64;\r
+ typedef __int64 INT64;\r
+ typedef unsigned __int32 UINT32;\r
+ typedef __int32 INT32;\r
+ typedef unsigned short UINT16;\r
+ typedef unsigned short CHAR16;\r
+ typedef short INT16;\r
+ typedef unsigned char BOOLEAN;\r
+ typedef unsigned char UINT8;\r
+ typedef char CHAR8;\r
+ typedef char INT8;\r
+ #else\r
+\r
+ //\r
+ // Assume standard IA-32 alignment. \r
+ // Need to check portability of long long\r
+ //\r
+ typedef unsigned long long UINT64;\r
+ typedef long long INT64;\r
+ typedef unsigned int UINT32;\r
+ typedef int INT32;\r
+ typedef unsigned short UINT16;\r
+ typedef unsigned short CHAR16;\r
+ typedef short INT16;\r
+ typedef unsigned char BOOLEAN;\r
+ typedef unsigned char UINT8;\r
+ typedef char CHAR8;\r
+ typedef char INT8;\r
+ #endif\r
+\r
+ #define UINT8_MAX 0xff\r
+\r
+#else\r
+ //\r
+ // Use ANSI C 2000 stdint.h integer width declarations\r
+ //\r
+ #include "stdint.h"\r
+ typedef uint8_t BOOLEAN;\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
+\r
+#endif\r
+\r
+typedef UINT32 UINTN;\r
+typedef INT32 INTN;\r
+\r
+\r
+//\r
+// Processor specific defines\r
+//\r
+#define MAX_BIT 0x80000000\r
+#define MAX_2_BITS 0xC0000000\r
+\r
+//\r
+// Maximum legal IA-32 address\r
+//\r
+#define MAX_ADDRESS 0xFFFFFFFF\r
+\r
+//\r
+// The stack alignment required for IA-32\r
+//\r
+#define CPU_STACK_ALIGNMENT sizeof(UINTN)\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
+#if _MSC_EXTENSIONS\r
+ //\r
+ // Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.\r
+ // \r
+ #define EFIAPI __cdecl \r
+#endif\r
+\r
+#if __GNUC__\r
+ #define EFIAPI __attribute__((cdecl)) \r
+#endif\r
+\r
+//\r
+// The Microsoft* C compiler can removed references to unreferenced data items\r
+// if the /OPT:REF linker option is used. We defined a macro as this is a \r
+// a non standard extension\r
+//\r
+#if _MSC_EXTENSIONS\r
+ #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)\r
+#else\r
+ #define GLOBAL_REMOVE_IF_UNREFERENCED\r
+#endif\r
+\r
+#endif\r
+\r
--- /dev/null
+///** @file\r
+// IPF Processor Defines for assembly code\r
+//\r
+// @note\r
+// This file is included by assembly files as well. The assmber can NOT deal\r
+// with /* */ commnets this is why this file is commented not following the\r
+// coding standard\r
+//\r
+//Copyright (c) 2006, Intel Corporation\r
+//All rights reserved. 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: IpfDefines.h\r
+//\r
+//**/\r
+\r
+#ifndef _IPFDEFINES_H\r
+#define _IPFDEFINES_H\r
+\r
+//\r
+// IPI DElivery Methods\r
+//\r
+#define IPI_INT_DELIVERY 0x0\r
+#define IPI_PMI_DELIVERY 0x2\r
+#define IPI_NMI_DELIVERY 0x4\r
+#define IPI_INIT_DELIVERY 0x5\r
+#define IPI_ExtINT_DELIVERY 0x7\r
+\r
+//\r
+// Define Itanium-based system registers.\r
+//\r
+// Define Itanium-based system register bit field offsets.\r
+//\r
+// Processor Status Register (PSR) Bit positions\r
+//\r
+// User / System mask\r
+//\r
+#define PSR_RV0 0\r
+#define PSR_BE 1\r
+#define PSR_UP 2\r
+#define PSR_AC 3\r
+#define PSR_MFL 4\r
+#define PSR_MFH 5\r
+\r
+//\r
+// PSR bits 6-12 reserved (must be zero)\r
+//\r
+#define PSR_MBZ0 6\r
+#define PSR_MBZ0_V 0x1ffUL L\r
+\r
+//\r
+// System only mask\r
+//\r
+#define PSR_IC 13\r
+#define PSR_IC_MASK (1 << 13)\r
+#define PSR_I 14\r
+#define PSR_PK 15\r
+#define PSR_MBZ1 16\r
+#define PSR_MBZ1_V 0x1UL L\r
+#define PSR_DT 17\r
+#define PSR_DFL 18\r
+#define PSR_DFH 19\r
+#define PSR_SP 20\r
+#define PSR_PP 21\r
+#define PSR_DI 22\r
+#define PSR_SI 23\r
+#define PSR_DB 24\r
+#define PSR_LP 25\r
+#define PSR_TB 26\r
+#define PSR_RT 27\r
+\r
+//\r
+// PSR bits 28-31 reserved (must be zero)\r
+//\r
+#define PSR_MBZ2 28\r
+#define PSR_MBZ2_V 0xfUL L\r
+\r
+//\r
+// Neither mask\r
+//\r
+#define PSR_CPL 32\r
+#define PSR_CPL_LEN 2\r
+#define PSR_IS 34\r
+#define PSR_MC 35\r
+#define PSR_IT 36\r
+#define PSR_IT_MASK 0x1000000000\r
+#define PSR_ID 37\r
+#define PSR_DA 38\r
+#define PSR_DD 39\r
+#define PSR_SS 40\r
+#define PSR_RI 41\r
+#define PSR_RI_LEN 2\r
+#define PSR_ED 43\r
+#define PSR_BN 44\r
+\r
+//\r
+// PSR bits 45-63 reserved (must be zero)\r
+//\r
+#define PSR_MBZ3 45\r
+#define PSR_MBZ3_V 0xfffffULL\r
+\r
+//\r
+// Floating Point Status Register (FPSR) Bit positions\r
+//\r
+//\r
+// Traps\r
+//\r
+#define FPSR_VD 0\r
+#define FPSR_DD 1\r
+#define FPSR_ZD 2\r
+#define FPSR_OD 3\r
+#define FPSR_UD 4\r
+#define FPSR_ID 5\r
+\r
+//\r
+// Status Field 0 - Controls\r
+//\r
+#define FPSR0_FTZ0 6\r
+#define FPSR0_WRE0 7\r
+#define FPSR0_PC0 8\r
+#define FPSR0_RC0 10\r
+#define FPSR0_TD0 12\r
+\r
+//\r
+// Status Field 0 - Flags\r
+//\r
+#define FPSR0_V0 13\r
+#define FPSR0_D0 14\r
+#define FPSR0_Z0 15\r
+#define FPSR0_O0 16\r
+#define FPSR0_U0 17\r
+#define FPSR0_I0 18\r
+\r
+//\r
+// Status Field 1 - Controls\r
+//\r
+#define FPSR1_FTZ0 19\r
+#define FPSR1_WRE0 20\r
+#define FPSR1_PC0 21\r
+#define FPSR1_RC0 23\r
+#define FPSR1_TD0 25\r
+\r
+//\r
+// Status Field 1 - Flags\r
+//\r
+#define FPSR1_V0 26\r
+#define FPSR1_D0 27\r
+#define FPSR1_Z0 28\r
+#define FPSR1_O0 29\r
+#define FPSR1_U0 30\r
+#define FPSR1_I0 31\r
+\r
+//\r
+// Status Field 2 - Controls\r
+//\r
+#define FPSR2_FTZ0 32\r
+#define FPSR2_WRE0 33\r
+#define FPSR2_PC0 34\r
+#define FPSR2_RC0 36\r
+#define FPSR2_TD0 38\r
+\r
+//\r
+// Status Field 2 - Flags\r
+//\r
+#define FPSR2_V0 39\r
+#define FPSR2_D0 40\r
+#define FPSR2_Z0 41\r
+#define FPSR2_O0 42\r
+#define FPSR2_U0 43\r
+#define FPSR2_I0 44\r
+\r
+//\r
+// Status Field 3 - Controls\r
+//\r
+#define FPSR3_FTZ0 45\r
+#define FPSR3_WRE0 46\r
+#define FPSR3_PC0 47\r
+#define FPSR3_RC0 49\r
+#define FPSR3_TD0 51\r
+\r
+//\r
+// Status Field 0 - Flags\r
+//\r
+#define FPSR3_V0 52\r
+#define FPSR3_D0 53\r
+#define FPSR3_Z0 54\r
+#define FPSR3_O0 55\r
+#define FPSR3_U0 56\r
+#define FPSR3_I0 57\r
+\r
+//\r
+// FPSR bits 58-63 Reserved -- Must be zero\r
+//\r
+#define FPSR_MBZ0 58\r
+#define FPSR_MBZ0_V 0x3fUL L\r
+\r
+//\r
+// For setting up FPSR on kernel entry\r
+// All traps are disabled.\r
+//\r
+#define FPSR_FOR_KERNEL 0x3f\r
+\r
+#define FP_REG_SIZE 16 // 16 byte spill size\r
+#define HIGHFP_REGS_LENGTH (96 * 16)\r
+\r
+//\r
+// Define hardware Task Priority Register (TPR)\r
+//\r
+//\r
+// TPR bit positions\r
+//\r
+#define TPR_MIC 4 // Bits 0 - 3 ignored\r
+#define TPR_MIC_LEN 4\r
+#define TPR_MMI 16 // Mask Maskable Interrupt\r
+//\r
+// Define hardware Interrupt Status Register (ISR)\r
+//\r
+//\r
+// ISR bit positions\r
+//\r
+#define ISR_CODE 0\r
+#define ISR_CODE_LEN 16\r
+#define ISR_CODE_MASK 0xFFFF\r
+#define ISR_IA_VECTOR 16\r
+#define ISR_IA_VECTOR_LEN 8\r
+#define ISR_MBZ0 24\r
+#define ISR_MBZ0_V 0xff\r
+#define ISR_X 32\r
+#define ISR_W 33\r
+#define ISR_R 34\r
+#define ISR_NA 35\r
+#define ISR_SP 36\r
+#define ISR_RS 37\r
+#define ISR_IR 38\r
+#define ISR_NI 39\r
+#define ISR_MBZ1 40\r
+#define ISR_EI 41\r
+#define ISR_ED 43\r
+#define ISR_MBZ2 44\r
+#define ISR_MBZ2_V 0xfffff\r
+\r
+//\r
+// ISR codes\r
+//\r
+// For General exceptions: ISR{3:0}\r
+//\r
+#define ISR_ILLEGAL_OP 0 // Illegal operation fault\r
+#define ISR_PRIV_OP 1 // Privileged operation fault\r
+#define ISR_PRIV_REG 2 // Privileged register fauls\r
+#define ISR_RESVD_REG 3 // Reserved register/field flt\r
+#define ISR_ILLEGAL_ISA 4 // Disabled instruction set transition fault\r
+//\r
+// Define hardware Default Control Register (DCR)\r
+//\r
+//\r
+// DCR bit positions\r
+//\r
+#define DCR_PP 0\r
+#define DCR_BE 1\r
+#define DCR_LC 2\r
+#define DCR_MBZ0 4\r
+#define DCR_MBZ0_V 0xf\r
+#define DCR_DM 8\r
+#define DCR_DP 9\r
+#define DCR_DK 10\r
+#define DCR_DX 11\r
+#define DCR_DR 12\r
+#define DCR_DA 13\r
+#define DCR_DD 14\r
+#define DCR_DEFER_ALL 0x7f00\r
+#define DCR_MBZ1 2\r
+#define DCR_MBZ1_V 0xffffffffffffUL L\r
+\r
+//\r
+// Define hardware RSE Configuration Register\r
+//\r
+// RS Configuration (RSC) bit field positions\r
+//\r
+#define RSC_MODE 0\r
+#define RSC_PL 2\r
+#define RSC_BE 4\r
+#define RSC_MBZ0 5\r
+#define RSC_MBZ0_V 0x3ff\r
+#define RSC_LOADRS 16\r
+#define RSC_LOADRS_LEN 14\r
+#define RSC_MBZ1 30\r
+#define RSC_MBZ1_V 0x3ffffffffUL L\r
+\r
+//\r
+// RSC modes\r
+//\r
+#define RSC_MODE_LY (0x0) // Lazy\r
+#define RSC_MODE_SI (0x1) // Store intensive\r
+#define RSC_MODE_LI (0x2) // Load intensive\r
+#define RSC_MODE_EA (0x3) // Eager\r
+//\r
+// RSC Endian bit values\r
+//\r
+#define RSC_BE_LITTLE 0\r
+#define RSC_BE_BIG 1\r
+\r
+//\r
+// Define Interruption Function State (IFS) Register\r
+//\r
+// IFS bit field positions\r
+//\r
+#define IFS_IFM 0\r
+#define IFS_IFM_LEN 38\r
+#define IFS_MBZ0 38\r
+#define IFS_MBZ0_V 0x1ffffff\r
+#define IFS_V 63\r
+#define IFS_V_LEN 1\r
+\r
+//\r
+// IFS is valid when IFS_V = IFS_VALID\r
+//\r
+#define IFS_VALID 1\r
+\r
+//\r
+// Define Page Table Address (PTA)\r
+//\r
+#define PTA_VE 0\r
+#define PTA_VF 8\r
+#define PTA_SIZE 2\r
+#define PTA_SIZE_LEN 6\r
+#define PTA_BASE 15\r
+\r
+//\r
+// Define Region Register (RR)\r
+//\r
+//\r
+// RR bit field positions\r
+//\r
+#define RR_VE 0\r
+#define RR_MBZ0 1\r
+#define RR_PS 2\r
+#define RR_PS_LEN 6\r
+#define RR_RID 8\r
+#define RR_RID_LEN 24\r
+#define RR_MBZ1 32\r
+\r
+//\r
+// SAL uses region register 0 and RID of 1000\r
+//\r
+#define SAL_RID 0x1000\r
+#define SAL_RR_REG 0x0\r
+#define SAL_TR 0x0\r
+\r
+//\r
+// Total number of region registers\r
+//\r
+#define RR_SIZE 8\r
+\r
+//\r
+// Define Protection Key Register (PKR)\r
+//\r
+// PKR bit field positions\r
+//\r
+#define PKR_V 0\r
+#define PKR_WD 1\r
+#define PKR_RD 2\r
+#define PKR_XD 3\r
+#define PKR_MBZ0 4\r
+#define PKR_KEY 8\r
+#define PKR_KEY_LEN 24\r
+#define PKR_MBZ1 32\r
+\r
+#define PKR_VALID (1 << PKR_V)\r
+\r
+//\r
+// Number of protection key registers\r
+//\r
+#define PKRNUM 8\r
+\r
+//\r
+// Define Interruption TLB Insertion register (ITIR)\r
+//\r
+//\r
+// Define Translation Insertion Format (TR)\r
+//\r
+// PTE0 bit field positions\r
+//\r
+#define PTE0_P 0\r
+#define PTE0_MBZ0 1\r
+#define PTE0_MA 2\r
+#define PTE0_A 5\r
+#define PTE0_D 6\r
+#define PTE0_PL 7\r
+#define PTE0_AR 9\r
+#define PTE0_PPN 12\r
+#define PTE0_MBZ1 48\r
+#define PTE0_ED 52\r
+#define PTE0_IGN0 53\r
+\r
+//\r
+// ITIR bit field positions\r
+//\r
+#define ITIR_MBZ0 0\r
+#define ITIR_PS 2\r
+#define ITIR_PS_LEN 6\r
+#define ITIR_KEY 8\r
+#define ITIR_KEY_LEN 24\r
+#define ITIR_MBZ1 32\r
+#define ITIR_MBZ1_LEN 16\r
+#define ITIR_PPN 48\r
+#define ITIR_PPN_LEN 15\r
+#define ITIR_MBZ2 63\r
+\r
+#define ATTR_IPAGE 0x661 // Access Rights = RWX (bits 11-9=011), PL 0(8-7=0)\r
+#define ATTR_DEF_BITS 0x661 // Access Rights = RWX (bits 11-9=010), PL 0(8-7=0)\r
+// Dirty (bit 6=1), Accessed (bit 5=1),\r
+// MA WB (bits 4-2=000), Present (bit 0=1)\r
+//\r
+// Memory access rights\r
+//\r
+#define AR_UR_KR 0x0 // user/kernel read\r
+#define AR_URX_KRX 0x1 // user/kernel read and execute\r
+#define AR_URW_KRW 0x2 // user/kernel read & write\r
+#define AR_URWX_KRWX 0x3 // user/kernel read,write&execute\r
+#define AR_UR_KRW 0x4 // user read/kernel read,write\r
+#define AR_URX_KRWX 0x5 // user read/execute, kernel all\r
+#define AR_URWX_KRW 0x6 // user all, kernel read & write\r
+#define AR_UX_KRX 0x7 // user execute only, kernel read and execute\r
+//\r
+// Memory attribute values\r
+//\r
+//\r
+// The next 4 are all cached, non-sequential & speculative, coherent\r
+//\r
+#define MA_WBU 0x0 // Write back, unordered\r
+//\r
+// The next 3 are all non-cached, sequential & non-speculative\r
+//\r
+#define MA_UC 0x4 // Non-coalescing, sequential & non-speculative\r
+#define MA_UCE 0x5 // Non-coalescing, sequential, non-speculative\r
+// & fetchadd exported\r
+//\r
+#define MA_WC 0x6 // Non-cached, Coalescing, non-seq., spec.\r
+#define MA_NAT 0xf // NaT page\r
+//\r
+// Definition of the offset of TRAP/INTERRUPT/FAULT handlers from the\r
+// base of IVA (Interruption Vector Address)\r
+//\r
+#define IVT_SIZE 0x8000\r
+#define EXTRA_ALIGNMENT 0x1000\r
+\r
+#define OFF_VHPTFLT 0x0000 // VHPT Translation fault\r
+#define OFF_ITLBFLT 0x0400 // Instruction TLB fault\r
+#define OFF_DTLBFLT 0x0800 // Data TLB fault\r
+#define OFF_ALTITLBFLT 0x0C00 // Alternate ITLB fault\r
+#define OFF_ALTDTLBFLT 0x1000 // Alternate DTLB fault\r
+#define OFF_NESTEDTLBFLT 0x1400 // Nested TLB fault\r
+#define OFF_IKEYMISSFLT 0x1800 // Inst Key Miss fault\r
+#define OFF_DKEYMISSFLT 0x1C00 // Data Key Miss fault\r
+#define OFF_DIRTYBITFLT 0x2000 // Dirty-Bit fault\r
+#define OFF_IACCESSBITFLT 0x2400 // Inst Access-Bit fault\r
+#define OFF_DACCESSBITFLT 0x2800 // Data Access-Bit fault\r
+#define OFF_BREAKFLT 0x2C00 // Break Inst fault\r
+#define OFF_EXTINT 0x3000 // External Interrupt\r
+//\r
+// Offset 0x3400 to 0x0x4C00 are reserved\r
+//\r
+#define OFF_PAGENOTPFLT 0x5000 // Page Not Present fault\r
+#define OFF_KEYPERMFLT 0x5100 // Key Permission fault\r
+#define OFF_IACCESSRTFLT 0x5200 // Inst Access-Rights flt\r
+#define OFF_DACCESSRTFLT 0x5300 // Data Access-Rights fault\r
+#define OFF_GPFLT 0x5400 // General Exception fault\r
+#define OFF_FPDISFLT 0x5500 // Disable-FP fault\r
+#define OFF_NATFLT 0x5600 // NAT Consumption fault\r
+#define OFF_SPECLNFLT 0x5700 // Speculation fault\r
+#define OFF_DBGFLT 0x5900 // Debug fault\r
+#define OFF_ALIGNFLT 0x5A00 // Unaligned Reference fault\r
+#define OFF_LOCKDREFFLT 0x5B00 // Locked Data Reference fault\r
+#define OFF_FPFLT 0x5C00 // Floating Point fault\r
+#define OFF_FPTRAP 0x5D00 // Floating Point Trap\r
+#define OFF_LOPRIVTRAP 0x5E00 // Lower-Privilege Transfer Trap\r
+#define OFF_TAKENBRTRAP 0x5F00 // Taken Branch Trap\r
+#define OFF_SSTEPTRAP 0x6000 // Single Step Trap\r
+//\r
+// Offset 0x6100 to 0x6800 are reserved\r
+//\r
+#define OFF_IA32EXCEPTN 0x6900 // iA32 Exception\r
+#define OFF_IA32INTERCEPT 0x6A00 // iA32 Intercept\r
+#define OFF_IA32INT 0x6B00 // iA32 Interrupt\r
+#define NUMBER_OF_VECTORS 0x100\r
+//\r
+// Privilege levels\r
+//\r
+#define PL_KERNEL 0\r
+#define PL_USER 3\r
+\r
+//\r
+// Instruction set (IS) bits\r
+//\r
+#define IS_IA64 0\r
+#define IS_IA 1\r
+\r
+//\r
+// RSC while in kernel: enabled, little endian, PL = 0, eager mode\r
+//\r
+#define RSC_KERNEL ((RSC_MODE_EA << RSC_MODE) | (RSC_BE_LITTLE << RSC_BE))\r
+\r
+//\r
+// Lazy RSC in kernel: enabled, little endian, pl = 0, lazy mode\r
+//\r
+#define RSC_KERNEL_LAZ ((RSC_MODE_LY << RSC_MODE) | (RSC_BE_LITTLE << RSC_BE))\r
+\r
+//\r
+// RSE disabled: disabled, PL = 0, little endian, eager mode\r
+//\r
+#define RSC_KERNEL_DISABLED ((RSC_MODE_LY << RSC_MODE) | (RSC_BE_LITTLE << RSC_BE))\r
+\r
+#define NAT_BITS_PER_RNAT_REG 63\r
+\r
+//\r
+// Macros for generating PTE0 and PTE1 value\r
+//\r
+#define PTE0(ed, ppn12_47, ar, pl, d, a, ma, p) \\r
+ ( ( ed << PTE0_ED ) | \\r
+ ( ppn12_47 << PTE0_PPN ) | \\r
+ ( ar << PTE0_AR ) | \\r
+ ( pl << PTE0_PL ) | \\r
+ ( d << PTE0_D ) | \\r
+ ( a << PTE0_A ) | \\r
+ ( ma << PTE0_MA ) | \\r
+ ( p << PTE0_P ) \\r
+ )\r
+\r
+#define ITIR(ppn48_63, key, ps) \\r
+ ( ( ps << ITIR_PS ) | \\r
+ ( key << ITIR_KEY ) | \\r
+ ( ppn48_63 << ITIR_PPN ) \\r
+ )\r
+\r
+//\r
+// Macro to generate mask value from bit position. The result is a\r
+// 64-bit.\r
+//\r
+#define BITMASK(bp, value) (value << bp)\r
+\r
+#define BUNDLE_SIZE 16\r
+#define SPURIOUS_INT 0xF\r
+\r
+#define FAST_DISABLE_INTERRUPTS rsm BITMASK (PSR_I, 1);;\r
+\r
+#define FAST_ENABLE_INTERRUPTS ssm BITMASK (PSR_I, 1);;\r
+\r
+#endif\r
--- /dev/null
+//++\r
+// Copyright (c) 2006, Intel Corporation \r
+// All rights reserved. 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
+// IpfMacro.i\r
+//\r
+// Abstract:\r
+// Contains the macros needed for calling procedures in Itanium-based assembly code.\r
+//\r
+//\r
+// Revision History:\r
+//\r
+//--\r
+\r
+#ifndef __IA64PROC_I__\r
+#define __IA64PROC_I__\r
+\r
+\r
+#define PROCEDURE_ENTRY(name) .##text; \\r
+ .##type name, @function; \\r
+ .##proc name; \\r
+name::\r
+\r
+#define PROCEDURE_EXIT(name) .##endp name\r
+\r
+// Note: use of NESTED_SETUP requires number of locals (l) >= 3\r
+\r
+#define NESTED_SETUP(i,l,o,r) \\r
+ alloc loc1=ar##.##pfs,i,l,o,r ;\\r
+ mov loc0=b0\r
+\r
+#define NESTED_RETURN \\r
+ mov b0=loc0 ;\\r
+ mov ar##.##pfs=loc1 ;;\\r
+ br##.##ret##.##dpnt b0;;\r
+\r
+#define GLOBAL_FUNCTION(Function) \\r
+ .##type Function, @function; \\r
+ .##global Function\r
+\r
+#define INTERRUPT_HANDLER_BEGIN(name) \\r
+PROCEDURE_ENTRY(name##HandlerBegin) \\r
+;; \\r
+PROCEDURE_EXIT(name##HandlerBegin)\r
+\r
+#define INTERRUPT_HANDLER_END(name) \\r
+PROCEDURE_ENTRY(name##HandlerEnd) \\r
+;; \\r
+PROCEDURE_EXIT(name##HandlerEnd) \r
+\r
+\r
+#define INTERRUPT_HANDLER_BLOCK_BEGIN \\r
+INTERRUPT_HANDLER_BEGIN(First)\r
+\r
+#define INTERRUPT_HANDLER_BLOCK_END \\r
+INTERRUPT_HANDLER_END(Last)\r
+\r
+\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Main PAL API's defined in IPF PAL Spec.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation\r
+ All rights reserved. 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: PalApi.h\r
+\r
+**/\r
+\r
+#ifndef __PAL_API_H__\r
+#define __PAL_API_H__\r
+\r
+//\r
+// IPF Specific Functions\r
+//\r
+\r
+typedef struct {\r
+ UINT64 Status;\r
+ UINT64 r9;\r
+ UINT64 r10;\r
+ UINT64 r11;\r
+} PAL_CALL_RETURN;\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Processor or Compiler specific defines and types for Intel Itanium(TM).\r
+\r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. 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: ProcessorBind.h\r
+\r
+**/\r
+\r
+#ifndef __PROCESSOR_BIND_H__\r
+#define __PROCESSOR_BIND_H__\r
+\r
+\r
+//\r
+// Define the processor type so other code can make processor based choices\r
+//\r
+#define MDE_CPU_IPF\r
+\r
+\r
+//\r
+// Make sure we are useing the correct packing rules per EFI specification\r
+//\r
+#pragma pack()\r
+\r
+\r
+#if _MSC_EXTENSIONS \r
+ \r
+//\r
+// Disable warning that make it impossible to compile at /W4\r
+// This only works for Microsoft tools. Copied from the \r
+// IA-32 version of efibind.h\r
+//\r
+\r
+//\r
+// Disabling bitfield type checking warnings.\r
+//\r
+#pragma warning ( disable : 4214 )\r
+\r
+\r
+// Disabling the unreferenced formal parameter warnings.\r
+//\r
+#pragma warning ( disable : 4100 )\r
+\r
+//\r
+// Disable slightly different base types warning as CHAR8 * can not be set\r
+// to a constant string.\r
+//\r
+#pragma warning ( disable : 4057 )\r
+\r
+//\r
+// Disable warning on conversion from function pointer to a data pointer\r
+//\r
+#pragma warning ( disable : 4054 )\r
+\r
+//\r
+// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning\r
+//\r
+#pragma warning ( disable : 4127 )\r
+\r
+//\r
+// Can not cast a function pointer to a data pointer. We need to do this on \r
+// IPF to get access to the PLABEL.\r
+//\r
+#pragma warning ( disable : 4514 )\r
+\r
+//\r
+// This warning is caused by functions defined but not used. For precompiled header only.\r
+//\r
+#pragma warning ( disable : 4505 )\r
+\r
+//\r
+// This warning is caused by empty (after preprocessing) souce file. For precompiled header only.\r
+//\r
+#pragma warning ( disable : 4206 )\r
+\r
+#endif\r
+\r
+\r
+#if (__STDC_VERSION__ < 199901L)\r
+ //\r
+ // No ANSI C 2000 stdint.h integer width declarations, so define equivalents\r
+ //\r
+ \r
+ #if _MSC_EXTENSIONS \r
+ \r
+\r
+ //\r
+ // use Microsoft C complier dependent interger width types \r
+ //\r
+ typedef unsigned __int64 UINT64;\r
+ typedef __int64 INT64;\r
+ typedef unsigned __int32 UINT32;\r
+ typedef __int32 INT32;\r
+ typedef unsigned short UINT16;\r
+ typedef unsigned short CHAR16;\r
+ typedef short INT16;\r
+ typedef unsigned char BOOLEAN;\r
+ typedef unsigned char UINT8;\r
+ typedef char CHAR8;\r
+ typedef char INT8;\r
+ #else\r
+ #ifdef _EFI_P64 \r
+ //\r
+ // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints \r
+ // are 32-bits\r
+ //\r
+ typedef unsigned long long UINT64;\r
+ typedef long long INT64;\r
+ typedef unsigned int UINT32;\r
+ typedef int INT32;\r
+ typedef unsigned short CHAR16;\r
+ typedef unsigned short UINT16;\r
+ typedef short INT16;\r
+ typedef unsigned char BOOLEAN;\r
+ typedef unsigned char UINT8;\r
+ typedef char CHAR8;\r
+ typedef char INT8;\r
+ #else\r
+ //\r
+ // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.\r
+ //\r
+ typedef unsigned long UINT64;\r
+ typedef long INT64;\r
+ typedef unsigned int UINT32;\r
+ typedef int INT32;\r
+ typedef unsigned short UINT16;\r
+ typedef unsigned short CHAR16;\r
+ typedef short INT16;\r
+ typedef unsigned char BOOLEAN;\r
+ typedef unsigned char UINT8;\r
+ typedef char CHAR8;\r
+ typedef char INT8;\r
+ #endif\r
+ #endif\r
+\r
+ #define UINT8_MAX 0xff\r
+\r
+#else\r
+ //\r
+ // Use ANSI C 2000 stdint.h integer width declarations\r
+ //\r
+ #include <stdint.h>\r
+ typedef uint8_t BOOLEAN;\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
+\r
+#endif\r
+\r
+typedef UINT64 UINTN;\r
+typedef INT64 INTN;\r
+\r
+\r
+//\r
+// Processor specific defines\r
+//\r
+#define MAX_BIT 0x8000000000000000ULL\r
+#define MAX_2_BITS 0xC000000000000000ULL\r
+\r
+//\r
+// Maximum legal Itanium-based address\r
+//\r
+#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r
+\r
+//\r
+// Per the Itanium Software Conventions and Runtime Architecture Guide,\r
+// section 3.3.4, IPF stack must always be 16-byte aligned.\r
+//\r
+#define CPU_STACK_ALIGNMENT 16\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
+#if _MSC_EXTENSIONS \r
+ //\r
+ // Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.\r
+ // \r
+ #define EFIAPI __cdecl \r
+#else\r
+ #define EFIAPI \r
+#endif\r
+\r
+//\r
+// The Microsoft* C compiler can removed references to unreferenced data items\r
+// if the /OPT:REF linker option is used. We defined a macro as this is a \r
+// a non standard extension\r
+//\r
+#if _MSC_EXTENSIONS\r
+ #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)\r
+#else\r
+ #define GLOBAL_REMOVE_IF_UNREFERENCED\r
+#endif\r
+\r
+//\r
+// A pointer to a function in IPF points to a plabel.\r
+//\r
+typedef struct {\r
+ UINT64 EntryPoint;\r
+ UINT64 GP;\r
+} EFI_PLABEL;\r
+\r
+#include <IpfDefines.h>\r
+\r
+#endif\r
+\r
--- /dev/null
+/** @file\r
+ Main SAL API's defined in SAL 3.0 specification. \r
+\r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. 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: SalApi.h\r
+\r
+**/\r
+\r
+#ifndef __SAL_API_H__\r
+#define __SAL_API_H__\r
+\r
+//\r
+// FIT Types \r
+// Table 2-2 of Intel Itanium Processor Family System Abstraction Layer Specification December 2003\r
+//\r
+#define EFI_SAL_FIT_FIT_HEADER_TYPE 0x00\r
+#define EFI_SAL_FIT_PAL_B_TYPE 0x01\r
+//\r
+// type from 0x02 to 0x0E is reserved.\r
+//\r
+#define EFI_SAL_FIT_PAL_A_TYPE 0x0F\r
+//\r
+// OEM-defined type range is from 0x10 to 0x7E. Here we defined the PEI_CORE type as 0x10\r
+//\r
+#define EFI_SAL_FIT_PEI_CORE_TYPE 0x10\r
+#define EFI_SAL_FIT_UNUSED_TYPE 0x7F\r
+\r
+//\r
+// EFI_SAL_STATUS \r
+//\r
+typedef UINTN EFI_SAL_STATUS;\r
+\r
+#define EFI_SAL_SUCCESS ((EFI_SAL_STATUS) 0)\r
+#define EFI_SAL_MORE_RECORDS ((EFI_SAL_STATUS) 3)\r
+#define EFI_SAL_NOT_IMPLEMENTED ((EFI_SAL_STATUS) - 1)\r
+#define EFI_SAL_INVALID_ARGUMENT ((EFI_SAL_STATUS) - 2)\r
+#define EFI_SAL_ERROR ((EFI_SAL_STATUS) - 3)\r
+#define EFI_SAL_VIRTUAL_ADDRESS_ERROR ((EFI_SAL_STATUS) - 4)\r
+#define EFI_SAL_NO_INFORMATION ((EFI_SAL_STATUS) - 5)\r
+#define EFI_SAL_NOT_ENOUGH_SCRATCH ((EFI_SAL_STATUS) - 9)\r
+\r
+//\r
+// Return values from SAL\r
+//\r
+typedef struct {\r
+ EFI_SAL_STATUS Status; // register r8\r
+ UINTN r9;\r
+ UINTN r10;\r
+ UINTN r11;\r
+} SAL_RETURN_REGS;\r
+\r
+//\r
+// Delivery Mode of IPF CPU.\r
+//\r
+typedef enum {\r
+ EFI_DELIVERY_MODE_INT,\r
+ EFI_DELIVERY_MODE_MPreserved1,\r
+ EFI_DELIVERY_MODE_PMI,\r
+ EFI_DELIVERY_MODE_MPreserved2,\r
+ EFI_DELIVERY_MODE_NMI,\r
+ EFI_DELIVERY_MODE_INIT,\r
+ EFI_DELIVERY_MODE_MPreserved3,\r
+ EFI_DELIVERY_MODE_ExtINT\r
+} EFI_DELIVERY_MODE;\r
+\r
+typedef SAL_RETURN_REGS (EFIAPI *SAL_PROC)\r
+ (\r
+ IN UINT64 FunctionId,\r
+ IN UINT64 Arg2,\r
+ IN UINT64 Arg3,\r
+ IN UINT64 Arg4,\r
+ IN UINT64 Arg5,\r
+ IN UINT64 Arg6,\r
+ IN UINT64 Arg7,\r
+ IN UINT64 Arg8\r
+ );\r
+\r
+//\r
+// SAL Procedure FunctionId definition\r
+//\r
+#define EFI_SAL_SET_VECTORS 0x01000000\r
+#define EFI_SAL_GET_STATE_INFO 0x01000001\r
+#define EFI_SAL_GET_STATE_INFO_SIZE 0x01000002\r
+#define EFI_SAL_CLEAR_STATE_INFO 0x01000003\r
+#define EFI_SAL_MC_RENDEZ 0x01000004\r
+#define EFI_SAL_MC_SET_PARAMS 0x01000005\r
+#define EFI_SAL_REGISTER_PHYSICAL_ADDR 0x01000006\r
+#define EFI_SAL_CACHE_FLUSH 0x01000008\r
+#define EFI_SAL_CACHE_INIT 0x01000009\r
+#define EFI_SAL_PCI_CONFIG_READ 0x01000010\r
+#define EFI_SAL_PCI_CONFIG_WRITE 0x01000011\r
+#define EFI_SAL_FREQ_BASE 0x01000012\r
+#define EFI_SAL_UPDATE_PAL 0x01000020\r
+\r
+#define EFI_SAL_FUNCTION_ID_MASK 0x0000ffff\r
+#define EFI_SAL_MAX_SAL_FUNCTION_ID 0x00000021\r
+\r
+//\r
+// SAL Procedure parameter definitions\r
+// Not much point in using typedefs or enums because all params\r
+// are UINT64 and the entry point is common\r
+//\r
+// EFI_SAL_SET_VECTORS\r
+//\r
+#define EFI_SAL_SET_MCA_VECTOR 0x0\r
+#define EFI_SAL_SET_INIT_VECTOR 0x1\r
+#define EFI_SAL_SET_BOOT_RENDEZ_VECTOR 0x2\r
+\r
+typedef struct {\r
+ UINT64 Length : 32;\r
+ UINT64 ChecksumValid : 1;\r
+ UINT64 Reserved1 : 7;\r
+ UINT64 ByteChecksum : 8;\r
+ UINT64 Reserved2 : 16;\r
+} SAL_SET_VECTORS_CS_N;\r
+\r
+//\r
+// EFI_SAL_GET_STATE_INFO, EFI_SAL_GET_STATE_INFO_SIZE,\r
+// EFI_SAL_CLEAR_STATE_INFO\r
+//\r
+#define EFI_SAL_MCA_STATE_INFO 0x0\r
+#define EFI_SAL_INIT_STATE_INFO 0x1\r
+#define EFI_SAL_CMC_STATE_INFO 0x2\r
+#define EFI_SAL_CP_STATE_INFO 0x3\r
+\r
+//\r
+// EFI_SAL_MC_SET_PARAMS\r
+//\r
+#define EFI_SAL_MC_SET_RENDEZ_PARAM 0x1\r
+#define EFI_SAL_MC_SET_WAKEUP_PARAM 0x2\r
+#define EFI_SAL_MC_SET_CPE_PARAM 0x3\r
+\r
+#define EFI_SAL_MC_SET_INTR_PARAM 0x1\r
+#define EFI_SAL_MC_SET_MEM_PARAM 0x2\r
+\r
+//\r
+// EFI_SAL_REGISTER_PAL_PHYSICAL_ADDR\r
+//\r
+#define EFI_SAL_REGISTER_PAL_ADDR 0x0\r
+\r
+//\r
+// EFI_SAL_CACHE_FLUSH\r
+//\r
+#define EFI_SAL_FLUSH_I_CACHE 0x01\r
+#define EFI_SAL_FLUSH_D_CACHE 0x02\r
+#define EFI_SAL_FLUSH_BOTH_CACHE 0x03\r
+#define EFI_SAL_FLUSH_MAKE_COHERENT 0x04\r
+\r
+//\r
+// EFI_SAL_PCI_CONFIG_READ, EFI_SAL_PCI_CONFIG_WRITE\r
+//\r
+#define EFI_SAL_PCI_CONFIG_ONE_BYTE 0x1\r
+#define EFI_SAL_PCI_CONFIG_TWO_BYTES 0x2\r
+#define EFI_SAL_PCI_CONFIG_FOUR_BYTES 0x4\r
+\r
+typedef struct {\r
+ UINT64 Register : 8;\r
+ UINT64 Function : 3;\r
+ UINT64 Device : 5;\r
+ UINT64 Bus : 8;\r
+ UINT64 Segment : 8;\r
+ UINT64 Reserved : 32;\r
+} SAL_PCI_ADDRESS;\r
+\r
+//\r
+// EFI_SAL_FREQ_BASE\r
+//\r
+#define EFI_SAL_CPU_INPUT_FREQ_BASE 0x0\r
+#define EFI_SAL_PLATFORM_IT_FREQ_BASE 0x1\r
+#define EFI_SAL_PLATFORM_RTC_FREQ_BASE 0x2\r
+\r
+//\r
+// EFI_SAL_UPDATE_PAL\r
+//\r
+#define EFI_SAL_UPDATE_BAD_PAL_VERSION ((UINT64) -1)\r
+#define EFI_SAL_UPDATE_PAL_AUTH_FAIL ((UINT64) -2)\r
+#define EFI_SAL_UPDATE_PAL_BAD_TYPE ((UINT64) -3)\r
+#define EFI_SAL_UPDATE_PAL_READONLY ((UINT64) -4)\r
+#define EFI_SAL_UPDATE_PAL_WRITE_FAIL ((UINT64) -10)\r
+#define EFI_SAL_UPDATE_PAL_ERASE_FAIL ((UINT64) -11)\r
+#define EFI_SAL_UPDATE_PAL_READ_FAIL ((UINT64) -12)\r
+#define EFI_SAL_UPDATE_PAL_CANT_FIT ((UINT64) -13)\r
+\r
+typedef struct {\r
+ UINT32 Size;\r
+ UINT32 MmddyyyyDate;\r
+ UINT16 Version;\r
+ UINT8 Type;\r
+ UINT8 Reserved[5];\r
+ UINT64 FwVendorId;\r
+} SAL_UPDATE_PAL_DATA_BLOCK;\r
+\r
+typedef struct _SAL_UPDATE_PAL_INFO_BLOCK {\r
+ struct _SAL_UPDATE_PAL_INFO_BLOCK *Next;\r
+ struct SAL_UPDATE_PAL_DATA_BLOCK *DataBlock;\r
+ UINT8 StoreChecksum;\r
+ UINT8 Reserved[15];\r
+} SAL_UPDATE_PAL_INFO_BLOCK;\r
+\r
+//\r
+// SAL System Table Definitions\r
+//\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT32 Signature;\r
+ UINT32 Length;\r
+ UINT16 SalRevision;\r
+ UINT16 EntryCount;\r
+ UINT8 CheckSum;\r
+ UINT8 Reserved[7];\r
+ UINT16 SalAVersion;\r
+ UINT16 SalBVersion;\r
+ UINT8 OemId[32];\r
+ UINT8 ProductId[32];\r
+ UINT8 Reserved2[8];\r
+} SAL_SYSTEM_TABLE_HEADER;\r
+#pragma pack()\r
+\r
+#define EFI_SAL_ST_HEADER_SIGNATURE "SST_"\r
+#define EFI_SAL_REVISION 0x0300\r
+//\r
+// SAL System Types\r
+//\r
+#define EFI_SAL_ST_ENTRY_POINT 0\r
+#define EFI_SAL_ST_MEMORY_DESCRIPTOR 1\r
+#define EFI_SAL_ST_PLATFORM_FEATURES 2\r
+#define EFI_SAL_ST_TR_USAGE 3\r
+#define EFI_SAL_ST_PTC 4\r
+#define EFI_SAL_ST_AP_WAKEUP 5\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT8 Type; // Type == 0\r
+ UINT8 Reserved[7];\r
+ UINT64 PalProcEntry;\r
+ UINT64 SalProcEntry;\r
+ UINT64 SalGlobalDataPointer;\r
+ UINT64 Reserved2[2];\r
+} SAL_ST_ENTRY_POINT_DESCRIPTOR;\r
+\r
+//\r
+// Not needed for Itanium-based OS boot\r
+//\r
+typedef struct {\r
+ UINT8 Type; // Type == 1\r
+ UINT8 NeedVirtualRegistration;\r
+ UINT8 MemoryAttributes;\r
+ UINT8 PageAccessRights;\r
+ UINT8 SupportedAttributes;\r
+ UINT8 Reserved;\r
+ UINT8 MemoryType;\r
+ UINT8 MemoryUsage;\r
+ UINT64 PhysicalMemoryAddress;\r
+ UINT32 Length;\r
+ UINT32 Reserved1;\r
+ UINT64 OemReserved;\r
+} SAL_ST_MEMORY_DESCRIPTOR_ENTRY;\r
+\r
+#pragma pack()\r
+//\r
+// Memory Attributes\r
+//\r
+#define SAL_MDT_ATTRIB_WB 0x00\r
+//\r
+// #define SAL_MDT_ATTRIB_UC 0x02\r
+//\r
+#define SAL_MDT_ATTRIB_UC 0x04\r
+#define SAL_MDT_ATTRIB_UCE 0x05\r
+#define SAL_MDT_ATTRIB_WC 0x06\r
+\r
+//\r
+// Supported memory Attributes\r
+//\r
+#define SAL_MDT_SUPPORT_WB 0x1\r
+#define SAL_MDT_SUPPORT_UC 0x2\r
+#define SAL_MDT_SUPPORT_UCE 0x4\r
+#define SAL_MDT_SUPPORT_WC 0x8\r
+\r
+//\r
+// Virtual address registration\r
+//\r
+#define SAL_MDT_NO_VA 0x00\r
+#define SAL_MDT_NEED_VA 0x01\r
+//\r
+// MemoryType info\r
+//\r
+#define SAL_REGULAR_MEMORY 0x0000\r
+#define SAL_MMIO_MAPPING 0x0001\r
+#define SAL_SAPIC_IPI_BLOCK 0x0002\r
+#define SAL_IO_PORT_MAPPING 0x0003\r
+#define SAL_FIRMWARE_MEMORY 0x0004\r
+#define SAL_BLACK_HOLE 0x000A\r
+//\r
+// Memory Usage info\r
+//\r
+#define SAL_MDT_USAGE_UNSPECIFIED 0x00\r
+#define SAL_PAL_CODE 0x01\r
+#define SAL_BOOTSERVICE_CODE 0x02\r
+#define SAL_BOOTSERVICE_DATA 0x03\r
+#define SAL_RUNTIMESERVICE_CODE 0x04\r
+#define SAL_RUNTIMESERVICE_DATA 0x05\r
+#define SAL_IA32_OPTIONROM 0x06\r
+#define SAL_IA32_SYSTEMROM 0x07\r
+#define SAL_PMI_CODE 0x0a\r
+#define SAL_PMI_DATA 0x0b\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT8 Type; // Type == 2\r
+ UINT8 PlatformFeatures;\r
+ UINT8 Reserved[14];\r
+} SAL_ST_PLATFORM_FEATURES;\r
+#pragma pack()\r
+\r
+#define SAL_PLAT_FEAT_BUS_LOCK 0x01\r
+#define SAL_PLAT_FEAT_PLAT_IPI_HINT 0x02\r
+#define SAL_PLAT_FEAT_PROC_IPI_HINT 0x04\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT8 Type; // Type == 3\r
+ UINT8 TRType;\r
+ UINT8 TRNumber;\r
+ UINT8 Reserved[5];\r
+ UINT64 VirtualAddress;\r
+ UINT64 EncodedPageSize;\r
+ UINT64 Reserved1;\r
+} SAL_ST_TR_DECRIPTOR;\r
+#pragma pack()\r
+\r
+#define EFI_SAL_ST_TR_USAGE_INSTRUCTION 00\r
+#define EFI_SAL_ST_TR_USAGE_DATA 01\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT64 NumberOfProcessors;\r
+ UINT64 LocalIDRegister;\r
+} SAL_COHERENCE_DOMAIN_INFO;\r
+#pragma pack()\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT8 Type; // Type == 4\r
+ UINT8 Reserved[3];\r
+ UINT32 NumberOfDomains;\r
+ SAL_COHERENCE_DOMAIN_INFO *DomainInformation;\r
+} SAL_ST_CACHE_COHERENCE_DECRIPTOR;\r
+#pragma pack()\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT8 Type; // Type == 5\r
+ UINT8 WakeUpType;\r
+ UINT8 Reserved[6];\r
+ UINT64 ExternalInterruptVector;\r
+} SAL_ST_AP_WAKEUP_DECRIPTOR;\r
+#pragma pack()\r
+//\r
+// FIT Entry\r
+//\r
+#define EFI_SAL_FIT_ENTRY_PTR (0x100000000 - 32) // 4GB - 24\r
+#define EFI_SAL_FIT_PALA_ENTRY (0x100000000 - 48) // 4GB - 32\r
+#define EFI_SAL_FIT_PALB_TYPE 01\r
+\r
+typedef struct {\r
+ UINT64 Address;\r
+ UINT8 Size[3];\r
+ UINT8 Reserved;\r
+ UINT16 Revision;\r
+ UINT8 Type : 7;\r
+ UINT8 CheckSumValid : 1;\r
+ UINT8 CheckSum;\r
+} EFI_SAL_FIT_ENTRY;\r
+\r
+//\r
+// SAL Common Record Header\r
+//\r
+typedef struct {\r
+ UINT16 Length;\r
+ UINT8 Data[1024];\r
+} SAL_OEM_DATA;\r
+\r
+typedef struct {\r
+ UINT8 Seconds;\r
+ UINT8 Minutes;\r
+ UINT8 Hours;\r
+ UINT8 Reserved;\r
+ UINT8 Day;\r
+ UINT8 Month;\r
+ UINT8 Year;\r
+ UINT8 Century;\r
+} SAL_TIME_STAMP;\r
+\r
+typedef struct {\r
+ UINT64 RecordId;\r
+ UINT16 Revision;\r
+ UINT8 ErrorSeverity;\r
+ UINT8 ValidationBits;\r
+ UINT32 RecordLength;\r
+ SAL_TIME_STAMP TimeStamp;\r
+ UINT8 OemPlatformId[16];\r
+} SAL_RECORD_HEADER;\r
+\r
+typedef struct {\r
+ GUID Guid;\r
+ UINT16 Revision;\r
+ UINT8 ErrorRecoveryInfo;\r
+ UINT8 Reserved;\r
+ UINT32 SectionLength;\r
+} SAL_SEC_HEADER;\r
+\r
+//\r
+// SAL Processor Record\r
+//\r
+#define SAL_PROCESSOR_ERROR_RECORD_INFO \\r
+ { \\r
+ 0xe429faf1, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \\r
+ }\r
+\r
+#define CHECK_INFO_VALID_BIT_MASK 0x1\r
+#define REQUESTOR_ID_VALID_BIT_MASK 0x2\r
+#define RESPONDER_ID_VALID_BIT_MASK 0x4\r
+#define TARGER_ID_VALID_BIT_MASK 0x8\r
+#define PRECISE_IP_VALID_BIT_MASK 0x10\r
+\r
+typedef struct {\r
+ UINT64 InfoValid : 1;\r
+ UINT64 ReqValid : 1;\r
+ UINT64 RespValid : 1;\r
+ UINT64 TargetValid : 1;\r
+ UINT64 IpValid : 1;\r
+ UINT64 Reserved : 59;\r
+ UINT64 Info;\r
+ UINT64 Req;\r
+ UINT64 Resp;\r
+ UINT64 Target;\r
+ UINT64 Ip;\r
+} MOD_ERROR_INFO;\r
+\r
+typedef struct {\r
+ UINT8 CpuidInfo[40];\r
+ UINT8 Reserved;\r
+} CPUID_INFO;\r
+\r
+typedef struct {\r
+ UINT64 FrLow;\r
+ UINT64 FrHigh;\r
+} FR_STRUCT;\r
+\r
+#define MIN_STATE_VALID_BIT_MASK 0x1\r
+#define BR_VALID_BIT_MASK 0x2\r
+#define CR_VALID_BIT_MASK 0x4\r
+#define AR_VALID_BIT_MASK 0x8\r
+#define RR_VALID_BIT_MASK 0x10\r
+#define FR_VALID_BIT_MASK 0x20\r
+\r
+typedef struct {\r
+ UINT64 ValidFieldBits;\r
+ UINT8 MinStateInfo[1024];\r
+ UINT64 Br[8];\r
+ UINT64 Cr[128];\r
+ UINT64 Ar[128];\r
+ UINT64 Rr[8];\r
+ FR_STRUCT Fr[128];\r
+} PSI_STATIC_STRUCT;\r
+\r
+#define PROC_ERROR_MAP_VALID_BIT_MASK 0x1\r
+#define PROC_STATE_PARAMETER_VALID_BIT_MASK 0x2\r
+#define PROC_CR_LID_VALID_BIT_MASK 0x4\r
+#define PROC_STATIC_STRUCT_VALID_BIT_MASK 0x8\r
+#define CPU_INFO_VALID_BIT_MASK 0x1000000\r
+\r
+typedef struct {\r
+ SAL_SEC_HEADER SectionHeader;\r
+ UINT64 ValidationBits;\r
+ UINT64 ProcErrorMap;\r
+ UINT64 ProcStateParameter;\r
+ UINT64 ProcCrLid;\r
+ MOD_ERROR_INFO CacheError[15];\r
+ MOD_ERROR_INFO TlbError[15];\r
+ MOD_ERROR_INFO BusError[15];\r
+ MOD_ERROR_INFO RegFileCheck[15];\r
+ MOD_ERROR_INFO MsCheck[15];\r
+ CPUID_INFO CpuInfo;\r
+ PSI_STATIC_STRUCT PsiValidData;\r
+} SAL_PROCESSOR_ERROR_RECORD;\r
+\r
+//\r
+// Sal Platform memory Error Record\r
+//\r
+#define SAL_MEMORY_ERROR_RECORD_INFO \\r
+ { \\r
+ 0xe429faf2, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \\r
+ }\r
+\r
+#define MEMORY_ERROR_STATUS_VALID_BIT_MASK 0x1\r
+#define MEMORY_PHYSICAL_ADDRESS_VALID_BIT_MASK 0x2\r
+#define MEMORY_ADDR_BIT_MASK 0x4\r
+#define MEMORY_NODE_VALID_BIT_MASK 0x8\r
+#define MEMORY_CARD_VALID_BIT_MASK 0x10\r
+#define MEMORY_MODULE_VALID_BIT_MASK 0x20\r
+#define MEMORY_BANK_VALID_BIT_MASK 0x40\r
+#define MEMORY_DEVICE_VALID_BIT_MASK 0x80\r
+#define MEMORY_ROW_VALID_BIT_MASK 0x100\r
+#define MEMORY_COLUMN_VALID_BIT_MASK 0x200\r
+#define MEMORY_BIT_POSITION_VALID_BIT_MASK 0x400\r
+#define MEMORY_PLATFORM_REQUESTOR_ID_VALID_BIT_MASK 0x800\r
+#define MEMORY_PLATFORM_RESPONDER_ID_VALID_BIT_MASK 0x1000\r
+#define MEMORY_PLATFORM_TARGET_VALID_BIT_MASK 0x2000\r
+#define MEMORY_PLATFORM_BUS_SPECIFIC_DATA_VALID_BIT_MASK 0x4000\r
+#define MEMORY_PLATFORM_OEM_ID_VALID_BIT_MASK 0x8000\r
+#define MEMORY_PLATFORM_OEM_DATA_STRUCT_VALID_BIT_MASK 0x10000\r
+\r
+typedef struct {\r
+ SAL_SEC_HEADER SectionHeader;\r
+ UINT64 ValidationBits;\r
+ UINT64 MemErrorStatus;\r
+ UINT64 MemPhysicalAddress;\r
+ UINT64 MemPhysicalAddressMask;\r
+ UINT16 MemNode;\r
+ UINT16 MemCard;\r
+ UINT16 MemModule;\r
+ UINT16 MemBank;\r
+ UINT16 MemDevice;\r
+ UINT16 MemRow;\r
+ UINT16 MemColumn;\r
+ UINT16 MemBitPosition;\r
+ UINT64 ModRequestorId;\r
+ UINT64 ModResponderId;\r
+ UINT64 ModTargetId;\r
+ UINT64 BusSpecificData;\r
+ UINT8 MemPlatformOemId[16];\r
+} SAL_MEMORY_ERROR_RECORD;\r
+\r
+//\r
+// PCI BUS Errors\r
+//\r
+#define SAL_PCI_BUS_ERROR_RECORD_INFO \\r
+ { \\r
+ 0xe429faf4, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \\r
+ }\r
+\r
+#define PCI_BUS_ERROR_STATUS_VALID_BIT_MASK 0x1\r
+#define PCI_BUS_ERROR_TYPE_VALID_BIT_MASK 0x2\r
+#define PCI_BUS_ID_VALID_BIT_MASK 0x4\r
+#define PCI_BUS_ADDRESS_VALID_BIT_MASK 0x8\r
+#define PCI_BUS_DATA_VALID_BIT_MASK 0x10\r
+#define PCI_BUS_CMD_VALID_BIT_MASK 0x20\r
+#define PCI_BUS_REQUESTOR_ID_VALID_BIT_MASK 0x40\r
+#define PCI_BUS_RESPONDER_ID_VALID_BIT_MASK 0x80\r
+#define PCI_BUS_TARGET_VALID_BIT_MASK 0x100\r
+#define PCI_BUS_OEM_ID_VALID_BIT_MASK 0x200\r
+#define PCI_BUS_OEM_DATA_STRUCT_VALID_BIT_MASK 0x400\r
+\r
+typedef struct {\r
+ UINT8 BusNumber;\r
+ UINT8 SegmentNumber;\r
+} PCI_BUS_ID;\r
+\r
+typedef struct {\r
+ SAL_SEC_HEADER SectionHeader;\r
+ UINT64 ValidationBits;\r
+ UINT64 PciBusErrorStatus;\r
+ UINT16 PciBusErrorType;\r
+ PCI_BUS_ID PciBusId;\r
+ UINT32 Reserved;\r
+ UINT64 PciBusAddress;\r
+ UINT64 PciBusData;\r
+ UINT64 PciBusCommand;\r
+ UINT64 PciBusRequestorId;\r
+ UINT64 PciBusResponderId;\r
+ UINT64 PciBusTargetId;\r
+ UINT8 PciBusOemId[16];\r
+} SAL_PCI_BUS_ERROR_RECORD;\r
+\r
+//\r
+// PCI Component Errors\r
+//\r
+#define SAL_PCI_COMP_ERROR_RECORD_INFO \\r
+ { \\r
+ 0xe429faf6, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \\r
+ }\r
+\r
+#define PCI_COMP_ERROR_STATUS_VALID_BIT_MASK 0x1\r
+#define PCI_COMP_INFO_VALID_BIT_MASK 0x2\r
+#define PCI_COMP_MEM_NUM_VALID_BIT_MASK 0x4\r
+#define PCI_COMP_IO_NUM_VALID_BIT_MASK 0x8\r
+#define PCI_COMP_REG_DATA_PAIR_VALID_BIT_MASK 0x10\r
+#define PCI_COMP_OEM_DATA_STRUCT_VALID_BIT_MASK 0x20\r
+\r
+typedef struct {\r
+ UINT16 VendorId;\r
+ UINT16 DeviceId;\r
+ UINT8 ClassCode[3];\r
+ UINT8 FunctionNumber;\r
+ UINT8 DeviceNumber;\r
+ UINT8 BusNumber;\r
+ UINT8 SegmentNumber;\r
+ UINT8 Reserved[5];\r
+} PCI_COMP_INFO;\r
+\r
+typedef struct {\r
+ SAL_SEC_HEADER SectionHeader;\r
+ UINT64 ValidationBits;\r
+ UINT64 PciComponentErrorStatus;\r
+ PCI_COMP_INFO PciComponentInfo;\r
+ UINT32 PciComponentMemNum;\r
+ UINT32 PciComponentIoNum;\r
+ UINT8 PciBusOemId[16];\r
+} SAL_PCI_COMPONENT_ERROR_RECORD;\r
+\r
+//\r
+// Sal Device Errors Info.\r
+//\r
+#define SAL_DEVICE_ERROR_RECORD_INFO \\r
+ { \\r
+ 0xe429faf3, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \\r
+ }\r
+\r
+#define SEL_RECORD_ID_VALID_BIT_MASK 0x1;\r
+#define SEL_RECORD_TYPE_VALID_BIT_MASK 0x2;\r
+#define SEL_GENERATOR_ID_VALID_BIT_MASK 0x4;\r
+#define SEL_EVM_REV_VALID_BIT_MASK 0x8;\r
+#define SEL_SENSOR_TYPE_VALID_BIT_MASK 0x10;\r
+#define SEL_SENSOR_NUM_VALID_BIT_MASK 0x20;\r
+#define SEL_EVENT_DIR_TYPE_VALID_BIT_MASK 0x40;\r
+#define SEL_EVENT_DATA1_VALID_BIT_MASK 0x80;\r
+#define SEL_EVENT_DATA2_VALID_BIT_MASK 0x100;\r
+#define SEL_EVENT_DATA3_VALID_BIT_MASK 0x200;\r
+\r
+typedef struct {\r
+ SAL_SEC_HEADER SectionHeader;\r
+ UINT64 ValidationBits;\r
+ UINT16 SelRecordId;\r
+ UINT8 SelRecordType;\r
+ UINT32 TimeStamp;\r
+ UINT16 GeneratorId;\r
+ UINT8 EvmRevision;\r
+ UINT8 SensorType;\r
+ UINT8 SensorNum;\r
+ UINT8 EventDirType;\r
+ UINT8 Data1;\r
+ UINT8 Data2;\r
+ UINT8 Data3;\r
+} SAL_DEVICE_ERROR_RECORD;\r
+\r
+//\r
+// Sal SMBIOS Device Errors Info.\r
+//\r
+#define SAL_SMBIOS_ERROR_RECORD_INFO \\r
+ { \\r
+ 0xe429faf5, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \\r
+ }\r
+\r
+#define SMBIOS_EVENT_TYPE_VALID_BIT_MASK 0x1\r
+#define SMBIOS_LENGTH_VALID_BIT_MASK 0x2\r
+#define SMBIOS_TIME_STAMP_VALID_BIT_MASK 0x4\r
+#define SMBIOS_DATA_VALID_BIT_MASK 0x8\r
+\r
+typedef struct {\r
+ SAL_SEC_HEADER SectionHeader;\r
+ UINT64 ValidationBits;\r
+ UINT8 SmbiosEventType;\r
+ UINT8 SmbiosLength;\r
+ UINT8 SmbiosBcdTimeStamp[6];\r
+} SAL_SMBIOS_DEVICE_ERROR_RECORD;\r
+\r
+//\r
+// Sal Platform Specific Errors Info.\r
+//\r
+#define SAL_PLATFORM_ERROR_RECORD_INFO \\r
+ { \\r
+ 0xe429faf7, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \\r
+ }\r
+\r
+#define PLATFORM_ERROR_STATUS_VALID_BIT_MASK 0x1\r
+#define PLATFORM_REQUESTOR_ID_VALID_BIT_MASK 0x2\r
+#define PLATFORM_RESPONDER_ID_VALID_BIT_MASK 0x4\r
+#define PLATFORM_TARGET_VALID_BIT_MASK 0x8\r
+#define PLATFORM_SPECIFIC_DATA_VALID_BIT_MASK 0x10\r
+#define PLATFORM_OEM_ID_VALID_BIT_MASK 0x20\r
+#define PLATFORM_OEM_DATA_STRUCT_VALID_BIT_MASK 0x40\r
+#define PLATFORM_OEM_DEVICE_PATH_VALID_BIT_MASK 0x80\r
+\r
+typedef struct {\r
+ SAL_SEC_HEADER SectionHeader;\r
+ UINT64 ValidationBits;\r
+ UINT64 PlatformErrorStatus;\r
+ UINT64 PlatformRequestorId;\r
+ UINT64 PlatformResponderId;\r
+ UINT64 PlatformTargetId;\r
+ UINT64 PlatformBusSpecificData;\r
+ UINT8 OemComponentId[16];\r
+} SAL_PLATFORM_SPECIFIC_ERROR_RECORD;\r
+\r
+//\r
+// Union of all the possible Sal Record Types\r
+//\r
+typedef union {\r
+ SAL_RECORD_HEADER *RecordHeader;\r
+ SAL_PROCESSOR_ERROR_RECORD *SalProcessorRecord;\r
+ SAL_PCI_BUS_ERROR_RECORD *SalPciBusRecord;\r
+ SAL_PCI_COMPONENT_ERROR_RECORD *SalPciComponentRecord;\r
+ SAL_DEVICE_ERROR_RECORD *ImpiRecord;\r
+ SAL_SMBIOS_DEVICE_ERROR_RECORD *SmbiosRecord;\r
+ SAL_PLATFORM_SPECIFIC_ERROR_RECORD *PlatformRecord;\r
+ SAL_MEMORY_ERROR_RECORD *MemoryRecord;\r
+ UINT8 *Raw;\r
+} SAL_ERROR_RECORDS_POINTERS;\r
+\r
+#pragma pack()\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Present the boot mode values in PI.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation \r
+ All rights reserved. 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: PiBootMode.h\r
+\r
+ @par Revision Reference:\r
+ Version 1.0.\r
+\r
+**/\r
+\r
+#ifndef __PI_BOOT_MODE_H__\r
+#define __PI_BOOT_MODE_H__\r
+\r
+typedef UINT32 EFI_BOOT_MODE;\r
+\r
+//\r
+// 0x21 - 0xf..f are reserved.\r
+// \r
+#define BOOT_WITH_FULL_CONFIGURATION 0x00\r
+#define BOOT_WITH_MINIMAL_CONFIGURATION 0x01\r
+#define BOOT_ASSUMING_NO_CONFIGURATION_CHANGES 0x02\r
+#define BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS 0x03\r
+#define BOOT_WITH_DEFAULT_SETTINGS 0x04\r
+#define BOOT_ON_S4_RESUME 0x05\r
+#define BOOT_ON_S5_RESUME 0x06\r
+#define BOOT_ON_S2_RESUME 0x10\r
+#define BOOT_ON_S3_RESUME 0x11\r
+#define BOOT_ON_FLASH_UPDATE 0x12\r
+#define BOOT_IN_RECOVERY_MODE 0x20\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Present the dependency expression values in PI.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation \r
+ All rights reserved. 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: PiDependency.h\r
+\r
+ @par Revision Reference:\r
+ Version 1.0.\r
+\r
+**/\r
+#ifndef __PI_DEPENDENCY_H__\r
+#define __PI_DEPENDENCY_H__\r
+\r
+// \r
+// If present, this must be the first and only opcode\r
+// \r
+#define EFI_DEP_BEFORE 0x00\r
+\r
+// \r
+// If present, this must be the first and only opcode\r
+// \r
+#define EFI_DEP_AFTER 0x01\r
+\r
+#define EFI_DEP_PUSH 0x02\r
+#define EFI_DEP_AND 0x03\r
+#define EFI_DEP_OR 0x04\r
+#define EFI_DEP_NOT 0x05\r
+#define EFI_DEP_TRUE 0x06\r
+#define EFI_DEP_FALSE 0x07\r
+#define EFI_DEP_END 0x08\r
+\r
+\r
+// \r
+// If present, this must be the first opcode.\r
+// \r
+#define EFI_DEP_SOR 0x09\r
+\r
+#endif \r
--- /dev/null
+/** @file\r
+ Include file matches things in PI.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation \r
+ All rights reserved. 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: PiDxeCis.h\r
+\r
+ @par Revision Reference:\r
+ Version 1.0.\r
+\r
+**/\r
+\r
+#ifndef __PI_DXECIS_H__\r
+#define __PI_DXECIS_H__\r
+\r
+#include <Pi/PiMultiPhase.h>\r
+\r
+//\r
+// Global Coherencey Domain types\r
+//\r
+typedef enum {\r
+ EfiGcdMemoryTypeNonExistent,\r
+ EfiGcdMemoryTypeReserved,\r
+ EfiGcdMemoryTypeSystemMemory,\r
+ EfiGcdMemoryTypeMemoryMappedIo,\r
+ EfiGcdMemoryTypeMaximum\r
+} EFI_GCD_MEMORY_TYPE;\r
+\r
+\r
+typedef enum {\r
+ EfiGcdIoTypeNonExistent,\r
+ EfiGcdIoTypeReserved,\r
+ EfiGcdIoTypeIo,\r
+ EfiGcdIoTypeMaximum\r
+} EFI_GCD_IO_TYPE;\r
+\r
+\r
+typedef enum {\r
+ EfiGcdAllocateAnySearchBottomUp,\r
+ EfiGcdAllocateMaxAddressSearchBottomUp,\r
+ EfiGcdAllocateAddress,\r
+ EfiGcdAllocateAnySearchTopDown,\r
+ EfiGcdAllocateMaxAddressSearchTopDown,\r
+ EfiGcdMaxAllocateType\r
+} EFI_GCD_ALLOCATE_TYPE;\r
+\r
+\r
+typedef struct {\r
+ EFI_PHYSICAL_ADDRESS BaseAddress;\r
+ UINT64 Length;\r
+ UINT64 Capabilities;\r
+ UINT64 Attributes;\r
+ EFI_GCD_MEMORY_TYPE GcdMemoryType;\r
+ EFI_HANDLE ImageHandle;\r
+ EFI_HANDLE DeviceHandle;\r
+} EFI_GCD_MEMORY_SPACE_DESCRIPTOR;\r
+\r
+\r
+typedef struct {\r
+ EFI_PHYSICAL_ADDRESS BaseAddress;\r
+ UINT64 Length;\r
+ EFI_GCD_IO_TYPE GcdIoType;\r
+ EFI_HANDLE ImageHandle;\r
+ EFI_HANDLE DeviceHandle;\r
+} EFI_GCD_IO_SPACE_DESCRIPTOR;\r
+\r
+\r
+/**\r
+ Adds reserved memory, system memory, or memory-mapped I/O resources to the\r
+ global coherency domain of the processor.\r
+\r
+ @param GcdMemoryType Memory type of the memory space.\r
+ @param BaseAddress Base address of the memory space.\r
+ @param Length Length of the memory space.\r
+ @param Capabilities alterable attributes of the memory space.\r
+\r
+ @retval EFI_SUCCESS Merged this memory space into GCD map.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ADD_MEMORY_SPACE) (\r
+ IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN UINT64 Capabilities\r
+ )\r
+;\r
+\r
+/**\r
+ Allocates nonexistent memory, reserved memory, system memory, or memorymapped\r
+ I/O resources from the global coherency domain of the processor.\r
+\r
+ @param GcdAllocateType The type of allocate operation\r
+ @param GcdMemoryType The desired memory type\r
+ @param Alignment Align with 2^Alignment\r
+ @param Length Length to allocate\r
+ @param BaseAddress Base address to allocate\r
+ @param Imagehandle The image handle consume the allocated space.\r
+ @param DeviceHandle The device handle consume the allocated space.\r
+\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter.\r
+ @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
+ @retval EFI_SUCCESS Memory space successfully allocated.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ALLOCATE_MEMORY_SPACE) (\r
+ IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
+ IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
+ IN UINTN Alignment,\r
+ IN UINT64 Length,\r
+ IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_HANDLE DeviceHandle OPTIONAL\r
+ )\r
+;\r
+\r
+/**\r
+ Frees nonexistent memory, reserved memory, system memory, or memory-mapped\r
+ I/O resources from the global coherency domain of the processor.\r
+\r
+ @param BaseAddress Base address of the segment.\r
+ @param Length Length of the segment.\r
+\r
+ @retval EFI_SUCCESS Space successfully freed.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FREE_MEMORY_SPACE) (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
+ )\r
+;\r
+\r
+/**\r
+ Removes reserved memory, system memory, or memory-mapped I/O resources from\r
+ the global coherency domain of the processor.\r
+\r
+ @param BaseAddress Base address of the memory space.\r
+ @param Length Length of the memory space.\r
+\r
+ @retval EFI_SUCCESS Successfully remove a segment of memory space.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_REMOVE_MEMORY_SPACE) (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
+ )\r
+;\r
+\r
+/**\r
+ Retrieves the descriptor for a memory region containing a specified address.\r
+\r
+ @param BaseAddress Specified start address\r
+ @param Descriptor Specified length\r
+\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter\r
+ @retval EFI_SUCCESS Successfully get memory space descriptor.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_MEMORY_SPACE_DESCRIPTOR) (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor\r
+ )\r
+;\r
+\r
+/**\r
+ Modifies the attributes for a memory region in the global coherency domain of the\r
+ processor.\r
+\r
+ @param BaseAddress Specified start address\r
+ @param Length Specified length\r
+ @param Attributes Specified attributes\r
+\r
+ @retval EFI_SUCCESS Successfully set attribute of a segment of memory space.\r
+\r
+**/\r
+typedef\r
+\r
+EFI_STATUS\r
+(EFIAPI *EFI_SET_MEMORY_SPACE_ATTRIBUTES) (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN UINT64 Attributes\r
+ )\r
+;\r
+\r
+/**\r
+ Returns a map of the memory resources in the global coherency domain of the\r
+ processor.\r
+\r
+ @param NumberOfDescriptors Number of descriptors.\r
+ @param MemorySpaceMap Descriptor array\r
+\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter\r
+ @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
+ @retval EFI_SUCCESS Successfully get memory space map.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_MEMORY_SPACE_MAP) (\r
+ OUT UINTN *NumberOfDescriptors,\r
+ OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap\r
+ )\r
+;\r
+\r
+/**\r
+ Adds reserved I/O or I/O resources to the global coherency domain of the processor.\r
+\r
+ @param GcdIoType IO type of the segment.\r
+ @param BaseAddress Base address of the segment.\r
+ @param Length Length of the segment.\r
+\r
+ @retval EFI_SUCCESS Merged this segment into GCD map.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ADD_IO_SPACE) (\r
+ IN EFI_GCD_IO_TYPE GcdIoType,\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
+ )\r
+;\r
+\r
+/**\r
+ Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
+ domain of the processor.\r
+\r
+ @param GcdAllocateType The type of allocate operation\r
+ @param GcdIoType The desired IO type\r
+ @param Alignment Align with 2^Alignment\r
+ @param Length Length to allocate\r
+ @param BaseAddress Base address to allocate\r
+ @param Imagehandle The image handle consume the allocated space.\r
+ @param DeviceHandle The device handle consume the allocated space.\r
+\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter.\r
+ @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
+ @retval EFI_SUCCESS IO space successfully allocated.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ALLOCATE_IO_SPACE) (\r
+ IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
+ IN EFI_GCD_IO_TYPE GcdIoType,\r
+ IN UINTN Alignment,\r
+ IN UINT64 Length,\r
+ IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_HANDLE DeviceHandle OPTIONAL\r
+ )\r
+;\r
+\r
+/**\r
+ Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
+ domain of the processor.\r
+\r
+ @param BaseAddress Base address of the segment.\r
+ @param Length Length of the segment.\r
+\r
+ @retval EFI_SUCCESS Space successfully freed.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FREE_IO_SPACE) (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
+ )\r
+;\r
+\r
+/**\r
+ Removes reserved I/O or I/O resources from the global coherency domain of the\r
+ processor.\r
+\r
+ @param BaseAddress Base address of the segment.\r
+ @param Length Length of the segment.\r
+\r
+ @retval EFI_SUCCESS Successfully removed a segment of IO space.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_REMOVE_IO_SPACE) (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
+ )\r
+;\r
+\r
+/**\r
+ Retrieves the descriptor for an I/O region containing a specified address.\r
+\r
+ @param BaseAddress Specified start address\r
+ @param Descriptor Specified length\r
+\r
+ @retval EFI_INVALID_PARAMETER Descriptor is NULL.\r
+ @retval EFI_SUCCESS Successfully get the IO space descriptor.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_IO_SPACE_DESCRIPTOR) (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor\r
+ )\r
+;\r
+\r
+/**\r
+ Returns a map of the I/O resources in the global coherency domain of the processor.\r
+\r
+ @param NumberOfDescriptors Number of descriptors.\r
+ @param MemorySpaceMap Descriptor array\r
+\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter\r
+ @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
+ @retval EFI_SUCCESS Successfully get IO space map.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_IO_SPACE_MAP) (\r
+ OUT UINTN *NumberOfDescriptors,\r
+ OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap\r
+ )\r
+;\r
+\r
+\r
+\r
+/**\r
+ Loads and executed DXE drivers from firmware volumes.\r
+\r
+ @return Status code\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DISPATCH) (VOID)\r
+;\r
+\r
+/**\r
+ Clears the Schedule on Request (SOR) flag for a component that is stored in a firmware volume.\r
+\r
+ @param FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.\r
+ @param DriverName A pointer to the name of the file in a firmware volume.\r
+\r
+ @return Status code\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCHEDULE) (\r
+ IN EFI_HANDLE FirmwareVolumeHandle,\r
+ IN EFI_GUID *DriverName\r
+ )\r
+;\r
+\r
+/**\r
+ Promotes a file stored in a firmware volume from the untrusted to the trusted state.\r
+\r
+ @param FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.\r
+ @param DriverName A pointer to the name of the file in a firmware volume.\r
+\r
+ @return Status code\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TRUST) (\r
+ IN EFI_HANDLE FirmwareVolumeHandle,\r
+ IN EFI_GUID *DriverName\r
+ )\r
+;\r
+\r
+/**\r
+ Creates a firmware volume handle for a firmware volume that is present in system memory.\r
+\r
+ @param FirmwareVolumeHeader A pointer to the header of the firmware volume.\r
+ @param Size The size, in bytes, of the firmware volume.\r
+ @param FirmwareVolumeHandle On output, a pointer to the created handle.\r
+\r
+ @return Status code\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PROCESS_FIRMWARE_VOLUME) (\r
+ IN VOID *FvHeader,\r
+ IN UINTN Size,\r
+ OUT EFI_HANDLE *FirmwareVolumeHandle\r
+ )\r
+;\r
+\r
+//\r
+// DXE Services Table\r
+//\r
+#define DXE_SERVICES_SIGNATURE 0x565245535f455844\r
+#define DXE_SERVICES_REVISION ((1<<16) | (00)\r
+\r
+typedef struct {\r
+ EFI_TABLE_HEADER Hdr;\r
+\r
+ //\r
+ // Global Coherency Domain Services\r
+ //\r
+ EFI_ADD_MEMORY_SPACE AddMemorySpace;\r
+ EFI_ALLOCATE_MEMORY_SPACE AllocateMemorySpace;\r
+ EFI_FREE_MEMORY_SPACE FreeMemorySpace;\r
+ EFI_REMOVE_MEMORY_SPACE RemoveMemorySpace;\r
+ EFI_GET_MEMORY_SPACE_DESCRIPTOR GetMemorySpaceDescriptor;\r
+ EFI_SET_MEMORY_SPACE_ATTRIBUTES SetMemorySpaceAttributes;\r
+ EFI_GET_MEMORY_SPACE_MAP GetMemorySpaceMap;\r
+ EFI_ADD_IO_SPACE AddIoSpace;\r
+ EFI_ALLOCATE_IO_SPACE AllocateIoSpace;\r
+ EFI_FREE_IO_SPACE FreeIoSpace;\r
+ EFI_REMOVE_IO_SPACE RemoveIoSpace;\r
+ EFI_GET_IO_SPACE_DESCRIPTOR GetIoSpaceDescriptor;\r
+ EFI_GET_IO_SPACE_MAP GetIoSpaceMap;\r
+\r
+ //\r
+ // Dispatcher Services\r
+ //\r
+ EFI_DISPATCH Dispatch;\r
+ EFI_SCHEDULE Schedule;\r
+ EFI_TRUST Trust;\r
+ //\r
+ // Service to process a single firmware volume found in a capsule\r
+ //\r
+ EFI_PROCESS_FIRMWARE_VOLUME ProcessFirmwareVolume;\r
+} DXE_SERVICES;\r
+\r
+typedef DXE_SERVICES EFI_DXE_SERVICES;\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ The firmware file related definitions in PI.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation \r
+ All rights reserved. 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: PiFirmwareFile.h\r
+\r
+ @par Revision Reference:\r
+ Version 1.0.\r
+\r
+**/\r
+\r
+#ifndef __PI_FIRMWARE_FILE_H__\r
+#define __PI_FIRMWARE_FILE_H__\r
+\r
+//\r
+// Used to verify the integrity of the file.\r
+// \r
+typedef union {\r
+ struct {\r
+ UINT8 Header;\r
+ UINT8 File;\r
+ } Checksum;\r
+ UINT16 Checksum16;\r
+} EFI_FFS_INTEGRITY_CHECK;\r
+\r
+typedef UINT8 EFI_FV_FILETYPE;\r
+typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;\r
+typedef UINT8 EFI_FFS_FILE_STATE;\r
+\r
+// \r
+// FFS File Attributes.\r
+// \r
+#define FFS_ATTRIB_FIXED 0x04\r
+#define FFS_ATTRIB_DATA_ALIGNMENT 0x38\r
+#define FFS_ATTRIB_CHECKSUM 0x40\r
+\r
+// \r
+// FFS File State Bits.\r
+// \r
+#define EFI_FILE_HEADER_CONSTRUCTION 0x01\r
+#define EFI_FILE_HEADER_VALID 0x02\r
+#define EFI_FILE_DATA_VALID 0x04\r
+#define EFI_FILE_MARKED_FOR_UPDATE 0x08\r
+#define EFI_FILE_DELETED 0x10\r
+#define EFI_FILE_HEADER_INVALID 0x20\r
+\r
+\r
+//\r
+// Each file begins with the header that describe the \r
+// contents and state of the files.\r
+// \r
+typedef struct {\r
+ EFI_GUID Name;\r
+ EFI_FFS_INTEGRITY_CHECK IntegrityCheck;\r
+ EFI_FV_FILETYPE Type;\r
+ EFI_FFS_FILE_ATTRIBUTES Attributes;\r
+ UINT8 Size[3];\r
+ EFI_FFS_FILE_STATE State;\r
+} EFI_FFS_FILE_HEADER;\r
+\r
+\r
+typedef UINT8 EFI_SECTION_TYPE;\r
+\r
+//\r
+// Pseudo type. It is\r
+// used as a wild card when retrieving sections. The section\r
+// type EFI_SECTION_ALL matches all section types.\r
+//\r
+#define EFI_SECTION_ALL 0x00\r
+\r
+//\r
+// Encapsulation section Type values\r
+//\r
+#define EFI_SECTION_COMPRESSION 0x01\r
+\r
+#define EFI_SECTION_GUID_DEFINED 0x02\r
+\r
+//\r
+// Leaf section Type values\r
+//\r
+#define EFI_SECTION_PE32 0x10\r
+#define EFI_SECTION_PIC 0x11\r
+#define EFI_SECTION_TE 0x12\r
+#define EFI_SECTION_DXE_DEPEX 0x13\r
+#define EFI_SECTION_VERSION 0x14\r
+#define EFI_SECTION_USER_INTERFACE 0x15\r
+#define EFI_SECTION_COMPATIBILITY16 0x16\r
+#define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17\r
+#define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18\r
+#define EFI_SECTION_RAW 0x19\r
+#define EFI_SECTION_PEI_DEPEX 0x1B\r
+\r
+typedef struct {\r
+ UINT8 Size[3];\r
+ EFI_SECTION_TYPE Type;\r
+} EFI_COMMON_SECTION_HEADER;\r
+\r
+//\r
+// Leaf section type that contains an \r
+// IA-32 16-bit executable image.\r
+// \r
+typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;\r
+\r
+//\r
+// CompressionType of EFI_COMPRESSION_SECTION.\r
+// \r
+#define EFI_NOT_COMPRESSED 0x00\r
+#define EFI_STANDARD_COMPRESSION 0x01\r
+//\r
+// An encapsulation section type in which the \r
+// section data is compressed.\r
+// \r
+typedef struct {\r
+ EFI_COMMON_SECTION_HEADER CommonHeader;\r
+ UINT32 UncompressedLength;\r
+ UINT8 CompressionType;\r
+} EFI_COMPRESSION_SECTION;\r
+\r
+//\r
+// Leaf section which could be used to determine the dispatch order of DXEs.\r
+// \r
+typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;\r
+\r
+//\r
+// Leaf section witch contains a PI FV.\r
+// \r
+typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;\r
+\r
+//\r
+// Leaf section which contains a single GUID.\r
+// \r
+typedef struct {\r
+ EFI_COMMON_SECTION_HEADER CommonHeader;\r
+ EFI_GUID SubTypeGuid;\r
+} EFI_FREEFORM_SUBTYPE_GUID_SECTION;\r
+\r
+//\r
+// Attributes of EFI_GUID_DEFINED_SECTION\r
+// \r
+#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01\r
+#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02\r
+//\r
+// Leaf section which is encapsulation defined by specific GUID\r
+// \r
+typedef struct {\r
+ EFI_COMMON_SECTION_HEADER CommonHeader;\r
+ EFI_GUID SectionDefinitionGuid;\r
+ UINT16 DataOffset;\r
+ UINT16 Attributes;\r
+} EFI_GUID_DEFINED_SECTION;\r
+\r
+//\r
+// Leaf section which contains PE32+ image.\r
+// \r
+typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;\r
+\r
+\r
+//\r
+// Leaf section which used to determine the dispatch order of PEIMs.\r
+// \r
+typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;\r
+\r
+//\r
+// Leaf section which constains the position-independent-code image.\r
+// \r
+typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;\r
+\r
+//\r
+// Leaf section which contains an array of zero or more bytes.\r
+// \r
+typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;\r
+\r
+//\r
+// Leaf section which contains a unicode string that \r
+// is human readable file name.\r
+// \r
+typedef struct {\r
+ EFI_COMMON_SECTION_HEADER CommonHeader;\r
+\r
+ //\r
+ // Array of unicode string.\r
+ // \r
+ CHAR16 FileNameString[1];\r
+} EFI_USER_INTERFACE_SECTION;\r
+\r
+\r
+//\r
+// Leaf section which contains a numeric build number and\r
+// an optional unicode string that represent the file revision. \r
+// \r
+typedef struct {\r
+ EFI_COMMON_SECTION_HEADER CommonHeader;\r
+ UINT16 BuildNumber;\r
+ CHAR16 VersionString[1];\r
+} EFI_VERSION_SECTION;\r
+\r
+#endif\r
+\r
--- /dev/null
+/** @file\r
+ The firmware volume related definitions in PI.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation \r
+ All rights reserved. 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: PiFirmwareVolume.h\r
+\r
+ @par Revision Reference:\r
+ Version 1.0.\r
+\r
+**/\r
+\r
+#ifndef __PI_FIRMWAREVOLUME_H__\r
+#define __PI_FIRMWAREVOLUME_H__\r
+\r
+//\r
+// EFI_FV_FILE_ATTRIBUTES\r
+//\r
+typedef UINT32 EFI_FV_FILE_ATTRIBUTES;\r
+\r
+//\r
+// Value of EFI_FV_FILE_ATTRIBUTES.\r
+// \r
+#define EFI_FV_FILE_ATTRIB_ALIGNMENT 0x0000001F\r
+#define EFI_FV_FILE_ATTRIB_FIXED 0x00000100\r
+#define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED 0x00000200\r
+\r
+typedef UINT32 EFI_FVB_ATTRIBUTES;\r
+\r
+// \r
+// Attributes bit definitions\r
+// \r
+#define EFI_FVB2_READ_DISABLED_CAP 0x00000001\r
+#define EFI_FVB2_READ_ENABLED_CAP 0x00000002\r
+#define EFI_FVB2_READ_STATUS 0x00000004\r
+#define EFI_FVB2_WRITE_DISABLED_CAP 0x00000008\r
+#define EFI_FVB2_WRITE_ENABLED_CAP 0x00000010\r
+#define EFI_FVB2_WRITE_STATUS 0x00000020\r
+#define EFI_FVB2_LOCK_CAP 0x00000040\r
+#define EFI_FVB2_LOCK_STATUS 0x00000080\r
+#define EFI_FVB2_STICKY_WRITE 0x00000200\r
+#define EFI_FVB2_MEMORY_MAPPED 0x00000400\r
+#define EFI_FVB2_ERASE_POLARITY 0x00000800\r
+#define EFI_FVB2_READ_LOCK_CAP 0x00001000\r
+#define EFI_FVB2_READ_LOCK_STATUS 0x00002000\r
+#define EFI_FVB2_WRITE_LOCK_CAP 0x00004000\r
+#define EFI_FVB2_WRITE_LOCK_STATUS 0x00008000\r
+#define EFI_FVB2_ALIGNMENT 0x001F0000\r
+#define EFI_FVB2_ALIGNMENT_1 0x00000000\r
+#define EFI_FVB2_ALIGNMENT_2 0x00010000\r
+#define EFI_FVB2_ALIGNMENT_4 0x00020000\r
+#define EFI_FVB2_ALIGNMENT_8 0x00030000\r
+#define EFI_FVB2_ALIGNMENT_16 0x00040000\r
+#define EFI_FVB2_ALIGNMENT_32 0x00050000\r
+#define EFI_FVB2_ALIGNMENT_64 0x00060000\r
+#define EFI_FVB2_ALIGNMENT_128 0x00070000\r
+#define EFI_FVB2_ALIGNMENT_256 0x00080000\r
+#define EFI_FVB2_ALIGNMENT_512 0x00090000\r
+#define EFI_FVB2_ALIGNMENT_1K 0x000A0000\r
+#define EFI_FVB2_ALIGNMENT_2K 0x000B0000\r
+#define EFI_FVB2_ALIGNMENT_4K 0x000C0000\r
+#define EFI_FVB2_ALIGNMENT_8K 0x000D0000\r
+#define EFI_FVB2_ALIGNMENT_16K 0x000E0000\r
+#define EFI_FVB2_ALIGNMENT_32K 0x000F0000\r
+#define EFI_FVB2_ALIGNMENT_64K 0x00100000\r
+#define EFI_FVB2_ALIGNMENT_128K 0x00110000\r
+#define EFI_FVB2_ALIGNMENT_256K 0x00120000\r
+#define EFI_FVB2_ALIGNMNET_512K 0x00130000\r
+#define EFI_FVB2_ALIGNMENT_1M 0x00140000\r
+#define EFI_FVB2_ALIGNMENT_2M 0x00150000\r
+#define EFI_FVB2_ALIGNMENT_4M 0x00160000\r
+#define EFI_FVB2_ALIGNMENT_8M 0x00170000\r
+#define EFI_FVB2_ALIGNMENT_16M 0x00180000\r
+#define EFI_FVB2_ALIGNMENT_32M 0x00190000\r
+#define EFI_FVB2_ALIGNMENT_64M 0x001A0000\r
+#define EFI_FVB2_ALIGNMENT_128M 0x001B0000\r
+#define EFI_FVB2_ALIGNMENT_256M 0x001C0000\r
+#define EFI_FVB2_ALIGNMENT_512M 0x001D0000\r
+#define EFI_FVB2_ALIGNMENT_1G 0x001E0000\r
+#define EFI_FVB2_ALIGNMENT_2G 0x001F0000\r
+\r
+\r
+typedef struct {\r
+ UINT32 NumBlocks;\r
+ UINT32 Length;\r
+} EFI_FV_BLOCK_MAP_ENTRY;\r
+\r
+//\r
+// Describes the features and layout of the firmware volume.\r
+//\r
+typedef struct {\r
+ UINT8 ZeroVector[16];\r
+ EFI_GUID FileSystemGuid;\r
+ UINT64 FvLength;\r
+ UINT32 Signature;\r
+ EFI_FVB_ATTRIBUTES Attributes;\r
+ UINT16 HeaderLength;\r
+ UINT16 Checksum;\r
+ UINT16 ExtHeaderOffset;\r
+ UINT8 Reserved[1];\r
+ UINT8 Revision;\r
+ EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];\r
+} EFI_FIRMWARE_VOLUME_HEADER;\r
+\r
+\r
+\r
+//\r
+// Extension header pointed by ExtHeaderOffset of volume header.\r
+// \r
+typedef struct {\r
+ EFI_GUID FvName;\r
+ UINT32 ExtHeaderSize;\r
+} EFI_FIRMWARE_VOLUME_EXT_HEADER;\r
+\r
+typedef struct {\r
+ UINT16 ExtEntrySize;\r
+ UINT16 ExtEntryType;\r
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY;\r
+\r
+#define EFI_FV_EXT_TYPE_OEM_TYPE 0x01\r
+typedef struct {\r
+ EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;\r
+ UINT32 TypeMask;\r
+\r
+ //\r
+ // Array of GUIDs. \r
+ // Each GUID represents an OEM file type.\r
+ // \r
+ EFI_GUID Types[1];\r
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;\r
+\r
+\r
+#endif\r
--- /dev/null
+/* @file\r
+ HOB related definitions in PI.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation \r
+ All rights reserved. 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: PiHob.h\r
+\r
+ @par Revision Reference:\r
+ Version 1.0.\r
+\r
+**/\r
+\r
+#ifndef __PI_HOB_H__\r
+#define __PI_HOB_H__\r
+\r
+//\r
+// HobType of EFI_HOB_GENERIC_HEADER.\r
+// \r
+#define EFI_HOB_TYPE_HANDOFF 0x0001\r
+#define EFI_HOB_TYPE_MEMORY_ALLOCATION 0x0002\r
+#define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR 0x0003\r
+#define EFI_HOB_TYPE_GUID_EXTENSION 0x0004\r
+#define EFI_HOB_TYPE_FV 0x0005\r
+#define EFI_HOB_TYPE_CPU 0x0006\r
+#define EFI_HOB_TYPE_MEMORY_POOL 0x0007\r
+#define EFI_HOB_TYPE_FV2 0x0009\r
+#define EFI_HOB_TYPE_LOAD_PEIM 0x000A\r
+#define EFI_HOB_TYPE_UNUSED 0xFFFE\r
+#define EFI_HOB_TYPE_END_OF_HOB_LIST 0xFFFF\r
+\r
+//\r
+// Describes the format and size of the data inside the HOB. \r
+// All HOBs must contain this generic HOB header.\r
+// \r
+typedef struct _EFI_HOB_GENERIC_HEADER {\r
+ UINT16 HobType;\r
+ UINT16 HobLength;\r
+ UINT32 Reserved;\r
+} EFI_HOB_GENERIC_HEADER;\r
+\r
+\r
+//\r
+// Value of version ofinEFI_HOB_HANDOFF_INFO_TABLE.\r
+// \r
+#define EFI_HOB_HANDOFF_TABLE_VERSION 0x0009\r
+//\r
+// Contains general state information used by the HOB producer phase. \r
+// This HOB must be the first one in the HOB list.\r
+// \r
+typedef struct _EFI_HOB_HANDOFF_INFO_TABLE {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+ UINT32 Version;\r
+ EFI_BOOT_MODE BootMode;\r
+ EFI_PHYSICAL_ADDRESS EfiMemoryTop;\r
+ EFI_PHYSICAL_ADDRESS EfiMemoryBottom;\r
+ EFI_PHYSICAL_ADDRESS EfiFreeMemoryTop;\r
+ EFI_PHYSICAL_ADDRESS EfiFreeMemoryBottom;\r
+ EFI_PHYSICAL_ADDRESS EfiEndOfHobList;\r
+} EFI_HOB_HANDOFF_INFO_TABLE;\r
+\r
+\r
+typedef struct _EFI_HOB_MEMORY_ALLOCATION_HEADER {\r
+ EFI_GUID Name;\r
+ EFI_PHYSICAL_ADDRESS MemoryBaseAddress;\r
+ UINT64 MemoryLength;\r
+ EFI_MEMORY_TYPE MemoryType;\r
+\r
+ //\r
+ // Padding for Itanium processor family\r
+ // \r
+ UINT8 Reserved[4];\r
+} EFI_HOB_MEMORY_ALLOCATION_HEADER;\r
+\r
+//\r
+// Describes all memory ranges used during the HOB producer \r
+// phase that exist outside the HOB list. This HOB type \r
+// describes how memory is used, \r
+// not the physical attributes of memory.\r
+// \r
+typedef struct _EFI_HOB_MEMORY_ALLOCATION {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+ EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;\r
+ //\r
+ // Additional data pertaining to the ¡°Name¡± Guid memory\r
+ // may go here.\r
+ //\r
+} EFI_HOB_MEMORY_ALLOCATION;\r
+\r
+\r
+//\r
+// Describes the memory stack that is produced by the HOB producer \r
+// phase and upon which all postmemory-installed executable\r
+// content in the HOB producer phase is executing.\r
+// \r
+typedef struct _EFI_HOB_MEMORY_ALLOCATION_STACK {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+ EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;\r
+} EFI_HOB_MEMORY_ALLOCATION_STACK;\r
+\r
+//\r
+// Defines the location of the boot-strap \r
+// processor (BSP) BSPStore (¡°Backing Store Pointer Store¡±).\r
+// This HOB is valid for the Itanium processor family only \r
+// register overflow store.\r
+// \r
+typedef struct _EFI_HOB_MEMORY_ALLOCATION_BSP_STORE {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+ EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;\r
+} EFI_HOB_MEMORY_ALLOCATION_BSP_STORE;\r
+\r
+//\r
+// Defines the location and entry point of the HOB consumer phase.\r
+// \r
+typedef struct {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+ EFI_HOB_MEMORY_ALLOCATION_HEADER MemoryAllocationHeader;\r
+ EFI_GUID ModuleName;\r
+ EFI_PHYSICAL_ADDRESS EntryPoint;\r
+} EFI_HOB_MEMORY_ALLOCATION_MODULE;\r
+\r
+typedef UINT32 EFI_RESOURCE_TYPE;\r
+\r
+//\r
+// Value of ResourceType in EFI_HOB_RESOURCE_DESCRIPTOR.\r
+// \r
+#define EFI_RESOURCE_SYSTEM_MEMORY 0x00000000\r
+#define EFI_RESOURCE_MEMORY_MAPPED_IO 0x00000001\r
+#define EFI_RESOURCE_IO 0x00000002\r
+#define EFI_RESOURCE_FIRMWARE_DEVICE 0x00000003\r
+#define EFI_RESOURCE_MEMORY_MAPPED_IO_PORT 0x00000004\r
+#define EFI_RESOURCE_MEMORY_RESERVED 0x00000005\r
+#define EFI_RESOURCE_IO_RESERVED 0x00000006\r
+#define EFI_RESOURCE_MAX_MEMORY_TYPE 0x00000007\r
+\r
+\r
+typedef UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE;\r
+\r
+//\r
+// These types can be ORed together as needed.\r
+//\r
+// The first three enumerations describe settings\r
+//\r
+#define EFI_RESOURCE_ATTRIBUTE_PRESENT 0x00000001\r
+#define EFI_RESOURCE_ATTRIBUTE_INITIALIZED 0x00000002\r
+#define EFI_RESOURCE_ATTRIBUTE_TESTED 0x00000004\r
+//\r
+// The rest of the settings describe capabilities\r
+//\r
+#define EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC 0x00000008\r
+#define EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC 0x00000010\r
+#define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_1 0x00000020\r
+#define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_2 0x00000040\r
+#define EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED 0x00000080\r
+#define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED 0x00000100\r
+#define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED 0x00000200\r
+#define EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE 0x00000400\r
+#define EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE 0x00000800\r
+#define EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE 0x00001000\r
+#define EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE 0x00002000\r
+#define EFI_RESOURCE_ATTRIBUTE_16_BIT_IO 0x00004000\r
+#define EFI_RESOURCE_ATTRIBUTE_32_BIT_IO 0x00008000\r
+#define EFI_RESOURCE_ATTRIBUTE_64_BIT_IO 0x00010000\r
+#define EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED 0x00020000\r
+\r
+//\r
+// Describes the resource properties of all fixed, \r
+// nonrelocatable resource ranges found on the processor\r
+// host bus during the HOB producer phase.\r
+// \r
+typedef struct _EFI_HOB_RESOURCE_DESCRIPTOR {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+ EFI_GUID Owner;\r
+ EFI_RESOURCE_TYPE ResourceType;\r
+ EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;\r
+ EFI_PHYSICAL_ADDRESS PhysicalStart;\r
+ UINT64 ResourceLength;\r
+} EFI_HOB_RESOURCE_DESCRIPTOR;\r
+\r
+//\r
+// Allows writers of executable content in the HOB producer phase to \r
+// maintain and manage HOBs with specific GUID.\r
+// \r
+typedef struct _EFI_HOB_GUID_TYPE {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+ EFI_GUID Name;\r
+\r
+ //\r
+ // Guid specific data goes here\r
+ //\r
+} EFI_HOB_GUID_TYPE;\r
+\r
+//\r
+// Details the location of firmware volumes that contain firmware files.\r
+// \r
+typedef struct {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+ EFI_PHYSICAL_ADDRESS BaseAddress;\r
+ UINT64 Length;\r
+} EFI_HOB_FIRMWARE_VOLUME;\r
+\r
+//\r
+// Details the location of a firmware volume which was extracted \r
+// from a file within another firmware volume.\r
+// \r
+typedef struct {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+ EFI_PHYSICAL_ADDRESS BaseAddress;\r
+ UINT64 Length;\r
+ EFI_GUID FvName;\r
+ EFI_GUID FileName;\r
+} EFI_HOB_FIRMWARE_VOLUME2;\r
+\r
+\r
+//\r
+// Describes processor information, such as address space and I/O space capabilities.\r
+// \r
+typedef struct _EFI_HOB_CPU {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+ UINT8 SizeOfMemorySpace;\r
+ UINT8 SizeOfIoSpace;\r
+ UINT8 Reserved[6];\r
+} EFI_HOB_CPU;\r
+\r
+\r
+//\r
+// Describes pool memory allocations.\r
+// \r
+typedef struct _EFI_HOB_MEMORY_POOL {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+} EFI_HOB_MEMORY_POOL;\r
+\r
+//\r
+// Union of all the possible HOB Types\r
+//\r
+typedef union {\r
+ EFI_HOB_GENERIC_HEADER *Header;\r
+ EFI_HOB_HANDOFF_INFO_TABLE *HandoffInformationTable;\r
+ EFI_HOB_MEMORY_ALLOCATION *MemoryAllocation;\r
+ EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *MemoryAllocationBspStore;\r
+ EFI_HOB_MEMORY_ALLOCATION_STACK *MemoryAllocationStack;\r
+ EFI_HOB_MEMORY_ALLOCATION_MODULE *MemoryAllocationModule;\r
+ EFI_HOB_RESOURCE_DESCRIPTOR *ResourceDescriptor;\r
+ EFI_HOB_GUID_TYPE *Guid;\r
+ EFI_HOB_FIRMWARE_VOLUME *FirmwareVolume;\r
+ EFI_HOB_CPU *Cpu;\r
+ EFI_HOB_MEMORY_POOL *Pool;\r
+ UINT8 *Raw;\r
+} EFI_PEI_HOB_POINTERS;\r
+\r
+\r
+#endif \r
--- /dev/null
+/** @file\r
+ Include file matches things in PI for multiple module types.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation \r
+ All rights reserved. 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: PiMultiPhase.h\r
+\r
+ @par Revision Reference:\r
+ Version 1.0.\r
+\r
+**/\r
+\r
+#ifndef __PI_MULTIPHASE_H__\r
+#define __PI_MULTIPHASE_H__\r
+\r
+#include <Uefi/UefiMultiPhase.h>\r
+\r
+#include <Pi/PiFirmwareVolume.h>\r
+#include <Pi/PiFirmwareFile.h>\r
+#include <Pi/PiBootMode.h>\r
+\r
+#include <Pi/PiHob.h>\r
+#include <Pi/PiDependency.h>\r
+\r
+//\r
+// Status Code Type Definition\r
+//\r
+typedef UINT32 EFI_STATUS_CODE_TYPE;\r
+\r
+//\r
+// A Status Code Type is made up of the code type and severity\r
+// All values masked by EFI_STATUS_CODE_RESERVED_MASK are\r
+// reserved for use by this specification.\r
+//\r
+#define EFI_STATUS_CODE_TYPE_MASK 0x000000FF\r
+#define EFI_STATUS_CODE_SEVERITY_MASK 0xFF000000\r
+#define EFI_STATUS_CODE_RESERVED_MASK 0x00FFFF00\r
+\r
+//\r
+// Definition of code types, all other values masked by\r
+// EFI_STATUS_CODE_TYPE_MASK are reserved for use by\r
+// this specification.\r
+//\r
+#define EFI_PROGRESS_CODE 0x00000001\r
+#define EFI_ERROR_CODE 0x00000002\r
+#define EFI_DEBUG_CODE 0x00000003\r
+\r
+//\r
+// Definitions of severities, all other values masked by\r
+// EFI_STATUS_CODE_SEVERITY_MASK are reserved for use by\r
+// this specification.\r
+// Uncontained errors are major errors that could not contained\r
+// to the specific component that is reporting the error\r
+// For example, if a memory error was not detected early enough,\r
+// the bad data could be consumed by other drivers.\r
+//\r
+#define EFI_ERROR_MINOR 0x40000000\r
+#define EFI_ERROR_MAJOR 0x80000000\r
+#define EFI_ERROR_UNRECOVERED 0x90000000\r
+#define EFI_ERROR_UNCONTAINED 0xa0000000\r
+\r
+//\r
+// Status Code Value Definition\r
+//\r
+typedef UINT32 EFI_STATUS_CODE_VALUE;\r
+//\r
+// A Status Code Value is made up of the class, subclass, and\r
+// an operation.\r
+//\r
+#define EFI_STATUS_CODE_CLASS_MASK 0xFF000000\r
+#define EFI_STATUS_CODE_SUBCLASS_MASK 0x00FF0000\r
+#define EFI_STATUS_CODE_OPERATION_MASK 0x0000FFFF\r
+//\r
+// Definition of Status Code extended data header.\r
+// The data will follow HeaderSize bytes from the beginning of\r
+// the structure and is Size bytes long.\r
+//\r
+typedef struct {\r
+ UINT16 HeaderSize;\r
+ UINT16 Size;\r
+ EFI_GUID Type;\r
+} EFI_STATUS_CODE_DATA;\r
+\r
+#endif\r
--- /dev/null
+\r
+/** @file\r
+ PI PEI master include file. This file should match the PI spec.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation \r
+ All rights reserved. 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: PiPeiCis.h\r
+\r
+ @par Revision Reference:\r
+ Version 1.0.\r
+\r
+**/\r
+\r
+#ifndef __PI_PEICIS_H__\r
+#define __PI_PEICIS_H__\r
+\r
+#include <Pi/PiMultiPhase.h>\r
+\r
+#define EFI_NOT_AVAILABLE_YET EFIERR (28)\r
+\r
+//\r
+// Handles of EFI FV/FFS.\r
+// \r
+typedef VOID *EFI_PEI_FV_HANDLE;\r
+typedef VOID *EFI_PEI_FILE_HANDLE;\r
+\r
+//\r
+// Declare forward referenced data structures\r
+//\r
+typedef struct _EFI_PEI_SERVICES EFI_PEI_SERVICES;\r
+typedef struct _EFI_PEI_NOTIFY_DESCRIPTOR EFI_PEI_NOTIFY_DESCRIPTOR;\r
+\r
+\r
+#include <Ppi/CpuIo.h>\r
+#include <Ppi/PciCfg2.h>\r
+\r
+/**\r
+ The PEI Dispatcher will invoke each PEIM one time. During this pass, the PEI \r
+ Dispatcher will pass control to the PEIM at the AddressOfEntryPoint in the PE Header. \r
+\r
+ @param FfsHeader Pointer to the FFS file header.\r
+ @param PeiServices Describes the list of possible PEI Services.\r
+\r
+ @return Status code\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEIM_ENTRY_POINT)(\r
+ IN EFI_FFS_FILE_HEADER *FfsHeader,\r
+ IN EFI_PEI_SERVICES **PeiServices\r
+ );\r
+\r
+/**\r
+ Entry point of the notification callback function itself within the PEIM.\r
+\r
+ @param PeiServices Indirect reference to the PEI Services Table.\r
+ @param NotifyDescriptor Address of the notification descriptor data structure.\r
+ @param Ppi Address of the PPI that was installed.\r
+\r
+ @return Status code\r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEIM_NOTIFY_ENTRY_POINT) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
+ IN VOID *Ppi\r
+ );\r
+\r
+//\r
+// PEI Ppi Services List Descriptors\r
+//\r
+#define EFI_PEI_PPI_DESCRIPTOR_PIC 0x00000001\r
+#define EFI_PEI_PPI_DESCRIPTOR_PPI 0x00000010\r
+#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK 0x00000020\r
+#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH 0x00000040\r
+#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES 0x00000060\r
+#define EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST 0x80000000\r
+\r
+typedef struct {\r
+ UINTN Flags;\r
+ EFI_GUID *Guid;\r
+ VOID *Ppi;\r
+} EFI_PEI_PPI_DESCRIPTOR;\r
+\r
+struct _EFI_PEI_NOTIFY_DESCRIPTOR {\r
+ UINTN Flags;\r
+ EFI_GUID *Guid;\r
+ EFI_PEIM_NOTIFY_ENTRY_POINT Notify;\r
+};\r
+\r
+//\r
+// Describes request of the module to be loaded to \r
+// the permanent memory once it is available. Unlike most of the other HOBs, \r
+// this HOB is produced and consumed during the HOB producer phase.\r
+// \r
+typedef struct _EFI_HOB_LOAD_PEIM {\r
+ EFI_HOB_GENERIC_HEADER Header;\r
+ EFI_PEI_FILE_HANDLE FileHandle;\r
+ EFI_PEIM_ENTRY_POINT EntryPoint;\r
+ EFI_PEIM_ENTRY_POINT InMemEntryPoint;\r
+} EFI_HOB_LOAD_PEIM;\r
+\r
+\r
+/**\r
+ This service is the first one provided by the PEI Foundation. This function \r
+ installs an interface in the PEI PPI database by GUID. The purpose of the \r
+ service is to publish an interface that other parties can use to call \r
+ additional PEIMs.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table\r
+ published by the PEI Foundation.\r
+ @param PpiList A pointer to the list of interfaces that the caller shall install.\r
+\r
+ @retval EFI_SUCCESS The interface was successfully installed.\r
+ @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
+ @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_INSTALL_PPI) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_PEI_PPI_DESCRIPTOR *PpiList\r
+ );\r
+\r
+/**\r
+ This function reinstalls an interface in the PEI PPI database by GUID. \r
+ The purpose of the service is to publish an interface that other parties \r
+ can use to replace a same-named interface in the protocol database \r
+ with a different interface. \r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table\r
+ published by the PEI Foundation.\r
+ @param OldPpi A pointer to the former PPI in the database.\r
+ @param NewPpi A pointer to the new interfaces that the caller shall install.\r
+\r
+ @retval EFI_SUCCESS The interface was successfully installed.\r
+ @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the \r
+ list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
+ @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
+ @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been installed.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_REINSTALL_PPI) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
+ IN EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
+ );\r
+\r
+/**\r
+ This function locates an interface in the PEI PPI database by GUID. \r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES published by the PEI Foundation.\r
+ @param Guid A pointer to the GUID whose corresponding interface needs to be found.\r
+ @param Instance The N-th instance of the interface that is required.\r
+ @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.\r
+ @param Ppi A pointer to the instance of the interface.\r
+\r
+ @retval EFI_SUCCESS The interface was successfully returned.\r
+ @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_LOCATE_PPI) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_GUID *Guid,\r
+ IN UINTN Instance,\r
+ IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r
+ IN OUT VOID **Ppi\r
+ );\r
+\r
+/**\r
+ This function installs a notification service to be called back when a \r
+ given interface is installed or reinstalled. The purpose of the service \r
+ is to publish an interface that other parties can use to call additional PPIs \r
+ that may materialize later.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
+ @param NotifyList A pointer to the list of notification interfaces that the caller shall install.\r
+\r
+ @retval EFI_SUCCESS The interface was successfully installed.\r
+ @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the \r
+ list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
+ @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_NOTIFY_PPI) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
+ );\r
+\r
+/**\r
+ This function returns the present value of the boot mode.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+ @param BootMode A pointer to contain the value of the boot mode.\r
+\r
+ @retval EFI_SUCCESS The boot mode was returned successfully.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_GET_BOOT_MODE) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ OUT EFI_BOOT_MODE *BootMode\r
+ );\r
+\r
+/**\r
+ This function sets the value of the boot mode.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
+ @param BootMode The value of the boot mode to set.\r
+\r
+ @retval EFI_SUCCESS The boot mode was returned successfully.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_SET_BOOT_MODE) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_BOOT_MODE BootMode\r
+ );\r
+\r
+/**\r
+ This function returns the pointer to the list of Hand-Off Blocks (HOBs) in memory. \r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
+ @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize\r
+\r
+ @retval EFI_SUCCESS The list was successfully returned.\r
+ @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_GET_HOB_LIST) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN OUT VOID **HobList\r
+ );\r
+\r
+/**\r
+ This service published by the PEI Foundation abstracts the creation of a Hand-Off Block's (HOB's) headers.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+ @param Type The type of HOB to be installed.\r
+ @param Length The length of the HOB to be added.\r
+ @param Hob The address of a pointer that will contain the HOB header.\r
+\r
+ @retval EFI_SUCCESS The HOB was successfully created.\r
+ @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_CREATE_HOB) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN UINT16 Type,\r
+ IN UINT16 Length,\r
+ IN OUT VOID **Hob\r
+ );\r
+\r
+/**\r
+ The purpose of the service is to abstract the capability of the PEI \r
+ Foundation to discover instances of firmware volumes in the system. \r
+ Given the input file pointer, this service searches for the next \r
+ matching file in the Firmware File System (FFS) volume.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+ @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware Volume (BFV).\r
+ @param FwVolHeader Pointer to the firmware volume header of the volume to return.\r
+\r
+ @retval EFI_SUCCESS The volume was found.\r
+ @retval EFI_NOT_FOUND The volume was not found.\r
+ @retval EFI_INVALID_PARAMETER FwVolHeader is NULL\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_FFS_FIND_NEXT_VOLUME2) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN UINTN Instance,\r
+ IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader\r
+ );\r
+\r
+/**\r
+ The purpose of the service is to abstract the capability of the PEI \r
+ Foundation to discover instances of firmware files in the system. \r
+ Given the input file pointer, this service searches for the next matching \r
+ file in the Firmware File System (FFS) volume.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+ @param SearchType A filter to find files only of this type.\r
+ @param FwVolHeader Pointer to the firmware volume header of the volume to search.This parameter \r
+ must point to a valid FFS volume.\r
+ @param FileHeader Pointer to the current file from which to begin searching.This pointer will be \r
+ updated upon return to reflect the file found.\r
+\r
+ @retval EFI_SUCCESS The file was found.\r
+ @retval EFI_NOT_FOUND The file was not found.\r
+ @retval EFI_NOT_FOUND The header checksum was not zero.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_FFS_FIND_NEXT_FILE2) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_FV_FILETYPE SearchType,\r
+ IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,\r
+ IN OUT EFI_FFS_FILE_HEADER **FileHeader\r
+ );\r
+\r
+/**\r
+ Given the input file pointer, this service searches for the next \r
+ matching file in the Firmware File System (FFS) volume. \r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+ @param SectionType The value of the section type to find.\r
+ @param FfsFileHeader A pointer to the file header that contains the set of sections to be searched.\r
+ @param SectionData A pointer to the discovered section, if successful.\r
+\r
+ @retval EFI_SUCCESS The section was found.\r
+ @retval EFI_NOT_FOUND The section was not found.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA2) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_SECTION_TYPE SectionType,\r
+ IN EFI_FFS_FILE_HEADER *FfsFileHeader,\r
+ IN OUT VOID **SectionData\r
+ );\r
+\r
+/**\r
+ This function registers the found memory configuration with the PEI Foundation.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+ @param MemoryBegin The value of a region of installed memory\r
+ @param MemoryLength The corresponding length of a region of installed memory.\r
+\r
+ @retval EFI_SUCCESS The region was successfully installed in a HOB.\r
+ @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.\r
+ @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_INSTALL_PEI_MEMORY) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
+ IN UINT64 MemoryLength\r
+ );\r
+\r
+/**\r
+ The purpose of the service is to publish an interface that allows \r
+ PEIMs to allocate memory ranges that are managed by the PEI Foundation.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+ @param MemoryType The type of memory to allocate.\r
+ @param Pages The number of contiguous 4 KB pages to allocate.\r
+ @param Memory Pointer to a physical address. On output, the address is set to the base \r
+ of the page range that was allocated.\r
+\r
+ @retval EFI_SUCCESS The memory range was successfully allocated.\r
+ @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
+ @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_ALLOCATE_PAGES) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_MEMORY_TYPE MemoryType,\r
+ IN UINTN Pages,\r
+ IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
+ );\r
+\r
+/**\r
+ The purpose of this service is to publish an interface that \r
+ allows PEIMs to allocate memory ranges that are managed by the PEI Foundation.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+ @param Size The number of bytes to allocate from the pool.\r
+ @param Buffer If the call succeeds, a pointer to a pointer to the allocated buffer; undefined otherwise.\r
+\r
+ @retval EFI_SUCCESS The allocation was successful.\r
+ @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_ALLOCATE_POOL) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN UINTN Size,\r
+ OUT VOID **Buffer\r
+ );\r
+\r
+/**\r
+ This service copies the contents of one buffer to another buffer.\r
+\r
+ @param Destination Pointer to the destination buffer of the memory copy.\r
+ @param Source Pointer to the source buffer of the memory copy\r
+ @param Length Number of bytes to copy from Source to Destination.\r
+\r
+ @return None\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_PEI_COPY_MEM) (\r
+ IN VOID *Destination,\r
+ IN VOID *Source,\r
+ IN UINTN Length\r
+ );\r
+\r
+/**\r
+ The service fills a buffer with a specified value.\r
+\r
+ @param Buffer Pointer to the buffer to fill.\r
+ @param Size Number of bytes in Buffer to fill.\r
+ @param Value Value to fill Buffer with\r
+\r
+ @return None\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_PEI_SET_MEM) (\r
+ IN VOID *Buffer,\r
+ IN UINTN Size,\r
+ IN UINT8 Value\r
+ );\r
+\r
+/**\r
+ This service publishes an interface that allows PEIMs to report status codes.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+ @param Type Indicates the type of status code being reported.\r
+ @param Value Describes the current status of a hardware or\r
+ software entity. This includes information about the class and\r
+ subclass that is used to classify the entity as well as an operation.\r
+ For progress codes, the operation is the current activity.\r
+ For error codes, it is the exception.For debug codes,it is not defined at this time.\r
+ @param Instance The enumeration of a hardware or software entity within\r
+ the system. A system may contain multiple entities that match a class/subclass\r
+ pairing. The instance differentiates between them. An instance of 0 indicates\r
+ that instance information is unavailable, not meaningful, or not relevant.\r
+ Valid instance numbers start with 1.\r
+ @param CallerId This optional parameter may be used to identify the caller.\r
+ This parameter allows the status code driver to apply different rules to\r
+ different callers.\r
+ @param Data This optional parameter may be used to pass additional data.\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_NOT_AVAILABLE_YET No progress code provider has installed an interface in the system.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_REPORT_STATUS_CODE) (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_STATUS_CODE_TYPE Type,\r
+ IN EFI_STATUS_CODE_VALUE Value,\r
+ IN UINT32 Instance,\r
+ IN EFI_GUID *CallerId OPTIONAL,\r
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r
+ );\r
+\r
+/**\r
+ Resets the entire platform.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES\r
+ table published by the PEI Foundation.\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_RESET_SYSTEM) (\r
+ IN EFI_PEI_SERVICES **PeiServices\r
+ );\r
+\r
+/**\r
+ \r
+ This service searches for files with a specific name, within\r
+ either the specified firmware volume or all firmware volumes.\r
+ The service returns a file handle of type EFI_PEI_FILE_HANDLE,\r
+ which must be unique within the system.\r
+\r
+ @param FileName A pointer to the name of the file to\r
+ find within the firmware volume.\r
+\r
+ @param VolumeHandle The firmware volume to search FileHandle\r
+ Upon exit, points to the found file's\r
+ handle or NULL if it could not be found.\r
+\r
+ @retval EFI_SUCCESS File was found.\r
+\r
+ @retval EFI_NOT_FOUND File was not found.\r
+\r
+ @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or\r
+ FileName was NULL.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_FFS_FIND_BY_NAME) (\r
+ IN CONST EFI_GUID *FileName,\r
+ IN CONST EFI_PEI_FV_HANDLE VolumeHandle,\r
+ OUT EFI_PEI_FILE_HANDLE *FileHandle\r
+);\r
+\r
+\r
+/**\r
+ \r
+ @param FileName Name of the file.\r
+\r
+ @param FileType File type. See EFI_FV_FILETYPE, which is\r
+ defined in the Platform Initialization\r
+ Firmware Storage Specification.\r
+\r
+ @param FileAttributes Attributes of the file. Type\r
+ EFI_FV_FILE_ATTRIBUTES is defined in\r
+ the Platform Initialization Firmware\r
+ Storage Specification.\r
+\r
+ @param Buffer Points to the file's data (not the header).\r
+ Not valid if EFI_FV_FILE_ATTRIB_MEMORY_MAPPED\r
+ is zero.\r
+\r
+ @param BufferSize Size of the file's data.\r
+\r
+**/\r
+typedef struct {\r
+ EFI_GUID FileName;\r
+ EFI_FV_FILETYPE FileType;\r
+ EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
+ VOID *Buffer;\r
+ UINT32 BufferSize;\r
+} EFI_FV_FILE_INFO;\r
+\r
+/**\r
+ \r
+ This function returns information about a specific file,\r
+ including its file name, type, attributes, starting address and\r
+ size. If the firmware volume is not memory mapped then the\r
+ Buffer member will be NULL.\r
+\r
+ @param FileHandle Handle of the file.\r
+\r
+ @param FileInfo Upon exit, points to the file¡¯s\r
+ information.\r
+\r
+ @retval EFI_SUCCESS File information returned.\r
+ \r
+ @retval EFI_INVALID_PARAMETER If FileHandle does not\r
+ represent a valid file.\r
+ \r
+ @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_FFS_GET_FILE_INFO) (\r
+ IN CONST EFI_PEI_FILE_HANDLE FileHandle,\r
+ OUT EFI_FV_FILE_INFO *FileInfo\r
+);\r
+\r
+\r
+/**\r
+ \r
+ @param FvAttributes Attributes of the firmware volume. Type\r
+ EFI_FVB_ATTRIBUTES is defined in the\r
+ Platform Initialization Firmware Storage\r
+ Specficiation.\r
+\r
+ @param FvFormat Format of the firmware volume. For PI\r
+ Architecture Firmware Volumes, this can\r
+ be copied from FileSystemGuid in\r
+ EFI_FIRMWARE_VOLUME_HEADER.\r
+\r
+ @param FvName Name of the firmware volume. For PI\r
+ Architecture Firmware Volumes, this can\r
+ be copied from VolumeName in the\r
+ extended header of\r
+ EFI_FIRMWARE_VOLUME_HEADER.\r
+\r
+ @param FvStart Points to the first byte of the firmware\r
+ volume, if bit EFI_FVB_MEMORY_MAPPED is\r
+ set in FvAttributes. FvSize Size of the\r
+ firmware volume.\r
+\r
+**/\r
+typedef struct {\r
+ EFI_FVB_ATTRIBUTES FvAttributes;\r
+ EFI_GUID FvFormat;\r
+ EFI_GUID FvName;\r
+ VOID *FvStart;\r
+ UINT64 FvSize;\r
+} EFI_FV_INFO;\r
+\r
+/**\r
+ \r
+ This function returns information about a specific firmware\r
+ volume, including its name, type, attributes, starting address\r
+ and size.\r
+\r
+ @param VolumeHandle Handle of the volume.\r
+\r
+ @param VolumeInfo Upon exit, points to the volume¡¯s\r
+ information.\r
+\r
+ @retval EFI_SUCCESS File information returned.\r
+ \r
+ @retval EFI_INVALID_PARAMETER If FileHandle does not\r
+ represent a valid file.\r
+ \r
+ @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_FFS_GET_VOLUME_INFO) (\r
+ IN CONST EFI_PEI_FV_HANDLE *VolumeHandle,\r
+ OUT EFI_FV_INFO *VolumeInfo\r
+);\r
+\r
+/**\r
+ \r
+ This service registers a file handle so that after memory is\r
+ available, the PEIM will be re-loaded into permanent memory and\r
+ re-initialized. The PEIM registered this way will always be\r
+ initialized twice. The first time, this function call will\r
+ return EFI_SUCCESS. The second time, this function call will\r
+ return EFI_ALREADY_STARTED. Depending on the order in which\r
+ PEIMs are dispatched, the PEIM making this call may be\r
+ initialized after permanent memory is installed, even the first\r
+ time.\r
+\r
+ @param FileHandle PEIM¡¯s file handle. Must be the currently\r
+ xecuting PEIM.\r
+ \r
+ @retval EFI_SUCCESS The PEIM was successfully registered for\r
+ shadowing.\r
+\r
+ @retval EFI_ALREADY_STARTED The PEIM was previously\r
+ registered for shadowing.\r
+\r
+ @retval EFI_NOT_FOUND The FileHandle does not refer to a\r
+ valid file handle.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_REGISTER_FOR_SHADOW) (\r
+ IN CONST EFI_PEI_FILE_HANDLE FileHandle\r
+);\r
+\r
+\r
+//\r
+// PEI Specification Revision information\r
+//\r
+#define PEI_SPECIFICATION_MAJOR_REVISION 1\r
+#define PEI_SPECIFICATION_MINOR_REVISION 0\r
+\r
+//\r
+// PEI Services Table\r
+//\r
+#define PEI_SERVICES_SIGNATURE 0x5652455320494550\r
+#define PEI_SERVICES_REVISION (PEI_SPECIFICATION_MAJOR_REVISION<<16) | (PEI_SPECIFICATION_MINOR_REVISION)\r
+\r
+struct EFI_PEI_SERVICES {\r
+ EFI_TABLE_HEADER Hdr;\r
+ //\r
+ // PPI Functions\r
+ //\r
+ EFI_PEI_INSTALL_PPI InstallPpi;\r
+ EFI_PEI_REINSTALL_PPI ReInstallPpi;\r
+ EFI_PEI_LOCATE_PPI LocatePpi;\r
+ EFI_PEI_NOTIFY_PPI NotifyPpi;\r
+ //\r
+ // Boot Mode Functions\r
+ //\r
+ EFI_PEI_GET_BOOT_MODE GetBootMode;\r
+ EFI_PEI_SET_BOOT_MODE SetBootMode;\r
+ //\r
+ // HOB Functions\r
+ //\r
+ EFI_PEI_GET_HOB_LIST GetHobList;\r
+ EFI_PEI_CREATE_HOB CreateHob;\r
+ //\r
+ // Firmware Volume Functions\r
+ //\r
+ EFI_PEI_FFS_FIND_NEXT_VOLUME2 FfsFindNextVolume;\r
+ EFI_PEI_FFS_FIND_NEXT_FILE2 FfsFindNextFile;\r
+ EFI_PEI_FFS_FIND_SECTION_DATA2 FfsFindSectionData;\r
+ //\r
+ // PEI Memory Functions\r
+ //\r
+ EFI_PEI_INSTALL_PEI_MEMORY InstallPeiMemory;\r
+ EFI_PEI_ALLOCATE_PAGES AllocatePages;\r
+ EFI_PEI_ALLOCATE_POOL AllocatePool;\r
+ EFI_PEI_COPY_MEM CopyMem;\r
+ EFI_PEI_SET_MEM SetMem;\r
+ //\r
+ // Status Code\r
+ EFI_PEI_REPORT_STATUS_CODE ReportStatusCode;\r
+ //\r
+ // Reset\r
+ //\r
+ EFI_PEI_RESET_SYSTEM ResetSystem;\r
+ //\r
+ // (the following interfaces are installed by publishing PEIM)\r
+ //\r
+ // I/O Abstractions\r
+ //\r
+ EFI_PEI_CPU_IO_PPI *CpuIo;\r
+ EFI_PEI_PCI_CFG2_PPI *PciCfg;\r
+ //\r
+ // Future Installed Services\r
+ EFI_PEI_FFS_FIND_BY_NAME FfsFindFileByName;\r
+ EFI_PEI_FFS_GET_FILE_INFO FfsGetFileInfo;\r
+ EFI_PEI_FFS_GET_VOLUME_INFO FfsGetVolumeInfo;\r
+ EFI_PEI_REGISTER_FOR_SHADOW RegisterForShadow;\r
+} ;\r
+\r
+\r
+typedef struct _EFI_SEC_PEI_HAND_OFF {\r
+ //\r
+ // Size of the data structure.\r
+ // \r
+ UINT16 DataSize;\r
+\r
+ //\r
+ // Points to the first byte of the boot firmware volume, \r
+ // which the PEI Dispatcher should search for \r
+ // PEI modules.\r
+ // \r
+ VOID *BootFirmwareVolumeBase;\r
+\r
+ //\r
+ // Size of the boot firmware volume, in bytes.\r
+ // \r
+ UINTN BootFirmwareVolumeSize;\r
+\r
+ //\r
+ // Points to the first byte of the temporary RAM.\r
+ // \r
+ VOID *TemporaryRamBase;\r
+\r
+ //\r
+ // Size of the temporary RAM, in bytes.\r
+ // \r
+ UINTN TemporaryRamSize;\r
+\r
+ //\r
+ // Points to the first byte of the temporary RAM \r
+ // available for use by the PEI Foundation. The area \r
+ // described by PeiTemporaryRamBase and PeiTemporaryRamSize \r
+ // must not extend outside beyond the area described by\r
+ // TemporaryRamBase & TemporaryRamSize. This area should not\r
+ // overlap with the area reported by StackBase and \r
+ // StackSize.\r
+ //\r
+ VOID *PeiTemporaryRamBase;\r
+\r
+ //\r
+ // Size of the available temporary RAM available for \r
+ // use by the PEI Foundation, in bytes.\r
+ // \r
+ UINTN PeiTemporaryRamSize;\r
+\r
+ //\r
+ // Points to the first byte of the stack. \r
+ // This are may be part of the memory described by \r
+ // TemporaryRamBase and TemporaryRamSize \r
+ // or may be an entirely separate area.\r
+ // \r
+ VOID *StackBase;\r
+\r
+ //\r
+ // Size of the stack, in bytes.\r
+ // \r
+ UINTN StackSize;\r
+} EFI_SEC_PEI_HAND_OFF;\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+\r
+ Root include file for Mde Package DXE_CORE, DXE, SMM, SAL type modules.\r
+\r
+ This is the include file for any module of type base. Base modules only use \r
+ types defined via this include file and can be ported easily to any \r
+ environment. There are a set of base libraries in the Mde Package that can\r
+ be used to implement base modules.\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+**/\r
+\r
+#ifndef __PI_DXE_H__\r
+#define __PI_DXE_H__\r
+\r
+#include <Uefi/UefiBaseType.h>\r
+#include <Uefi/UefiSpec.h>\r
+\r
+#include <Pi/PiDxeCis.h>\r
+\r
+#endif\r
+\r
--- /dev/null
+/** @file\r
+\r
+ Root include file for Mde Package SEC, PEIM, PEI_CORE type modules.\r
+\r
+ This is the include file for any module of type base. Base modules only use \r
+ types defined via this include file and can be ported easily to any \r
+ environment. There are a set of base libraries in the Mde Package that can\r
+ be used to implement base modules.\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+**/\r
+\r
+#ifndef __PI_PEI_H__\r
+#define __PI_PEI_H__\r
+\r
+#include <Uefi/UefiBaseType.h>\r
+#include <Pi/PiPeiCis.h>\r
+#include <Uefi/UefiMultiPhase.h>\r
+\r
+\r
+#endif\r
+\r
--- /dev/null
+/** @file\r
+\r
+ Root include file for Mde Package UEFI, UEFI_APPLICATION type modules.\r
+\r
+ This is the include file for any module of type base. Base modules only use \r
+ types defined via this include file and can be ported easily to any \r
+ environment. There are a set of base libraries in the Mde Package that can\r
+ be used to implement base modules.\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+**/\r
+\r
+#ifndef __PI_UEFI_H__\r
+#define __PI_UEFI_H__\r
+\r
+#include <UefiBaseType.h>\r
+#include <UefiSpec.h>\r
+\r
+#endif\r
+\r
--- /dev/null
+\r
+/* @file\r
+\r
+ Defines data types and constants introduced in UEFI.\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+**/\r
+\r
+#ifndef __UEFI_BASETYPE_H__\r
+#define __UEFI_BASETYPE_H__\r
+\r
+#include "Base.h"\r
+\r
+//\r
+// Basical data type definitions introduced in UEFI.\r
+// \r
+typedef GUID EFI_GUID;\r
+typedef RETURN_STATUS EFI_STATUS;\r
+typedef VOID *EFI_HANDLE;\r
+\r
+typedef VOID *EFI_EVENT;\r
+\r
+typedef UINTN EFI_TPL;\r
+\r
+\r
+typedef UINT64 EFI_LBA;\r
+\r
+\r
+typedef UINT16 EFI_HII_HANDLE;\r
+typedef UINT16 STRING_REF;\r
+\r
+typedef UINT64 EFI_PHYSICAL_ADDRESS;\r
+typedef UINT64 EFI_VIRTUAL_ADDRESS;\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
+// Enumeration of EFI_STATUS.\r
+// \r
+#define EFI_SUCCESS RETURN_SUCCESS \r
+#define EFI_LOAD_ERROR RETURN_LOAD_ERROR \r
+#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER \r
+#define EFI_UNSUPPORTED RETURN_UNSUPPORTED \r
+#define EFI_BAD_BUFFER_SIZE RETURN_BAD_BUFFER_SIZE \r
+#define EFI_BUFFER_TOO_SMALL RETURN_BUFFER_TOO_SMALL \r
+#define EFI_NOT_READY RETURN_NOT_READY \r
+#define EFI_DEVICE_ERROR RETURN_DEVICE_ERROR \r
+#define EFI_WRITE_PROTECTED RETURN_WRITE_PROTECTED \r
+#define EFI_OUT_OF_RESOURCES RETURN_OUT_OF_RESOURCES \r
+#define EFI_VOLUME_CORRUPTED RETURN_VOLUME_CORRUPTED \r
+#define EFI_VOLUME_FULL RETURN_VOLUME_FULL \r
+#define EFI_NO_MEDIA RETURN_NO_MEDIA \r
+#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED \r
+#define EFI_NOT_FOUND RETURN_NOT_FOUND \r
+#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED \r
+#define EFI_NO_RESPONSE RETURN_NO_RESPONSE \r
+#define EFI_NO_MAPPING RETURN_NO_MAPPING \r
+#define EFI_TIMEOUT RETURN_TIMEOUT \r
+#define EFI_NOT_STARTED RETURN_NOT_STARTED \r
+#define EFI_ALREADY_STARTED RETURN_ALREADY_STARTED \r
+#define EFI_ABORTED RETURN_ABORTED \r
+#define EFI_ICMP_ERROR RETURN_ICMP_ERROR \r
+#define EFI_TFTP_ERROR RETURN_TFTP_ERROR \r
+#define EFI_PROTOCOL_ERROR RETURN_PROTOCOL_ERROR \r
+#define EFI_INCOMPATIBLE_VERSION RETURN_INCOMPATIBLE_VERSION \r
+#define EFI_SECURITY_VIOLATION RETURN_SECURITY_VIOLATION \r
+#define EFI_CRC_ERROR RETURN_CRC_ERROR \r
+#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA\r
+#define EFI_END_OF_FILE RETURN_END_OF_FILE\r
+\r
+#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH \r
+#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE \r
+#define EFI_WARN_WRITE_FAILURE RETURN_WARN_WRITE_FAILURE \r
+#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL\r
+\r
+\r
+#define NULL_HANDLE ((VOID *) 0)\r
+\r
+//\r
+// Define macro to encode the status code.\r
+// \r
+#define EFIERR(_a) ENCODE_ERROR(_a)\r
+\r
+#define EFI_ERROR(A) RETURN_ERROR(A)\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
+\r
+//\r
+// 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
+// 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 0x1000\r
+#define EFI_PAGE_MASK 0xFFF\r
+#define EFI_PAGE_SHIFT 12\r
+\r
+\r
+#endif\r
--- /dev/null
+/* @file\r
+ Device Path definitions introduced in UEFI.\r
+\r
+ This include file must only contain things defined in the UEFI 2.0 specification.\r
+ If a code construct is defined in the UEFI 2.0 specification it must be included\r
+ by this include file.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation\r
+ All rights reserved. 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: UefiDevicePath.h\r
+\r
+**/\r
+\r
+#ifndef __UEFI_DEVICE_PATH_H__\r
+#define __UEFI_DEVICE_PATH_H__\r
+\r
+//\r
+// Device Path information\r
+//\r
+\r
+#pragma pack(1)\r
+\r
+//\r
+// Hardware Device Paths\r
+//\r
+#define HARDWARE_DEVICE_PATH 0x01\r
+\r
+#define HW_PCI_DP 0x01\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT8 Function;\r
+ UINT8 Device;\r
+} PCI_DEVICE_PATH;\r
+\r
+#define HW_PCCARD_DP 0x02\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT8 FunctionNumber;\r
+} PCCARD_DEVICE_PATH;\r
+\r
+#define HW_MEMMAP_DP 0x03\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 MemoryType;\r
+ EFI_PHYSICAL_ADDRESS StartingAddress;\r
+ EFI_PHYSICAL_ADDRESS EndingAddress;\r
+} MEMMAP_DEVICE_PATH;\r
+\r
+#define HW_VENDOR_DP 0x04\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ EFI_GUID Guid;\r
+} VENDOR_DEVICE_PATH;\r
+\r
+#define HW_CONTROLLER_DP 0x05\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 ControllerNumber;\r
+} CONTROLLER_DEVICE_PATH;\r
+\r
+//\r
+// ACPI Device Paths\r
+//\r
+#define ACPI_DEVICE_PATH 0x02\r
+\r
+#define ACPI_DP 0x01\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 HID;\r
+ UINT32 UID;\r
+} ACPI_HID_DEVICE_PATH;\r
+\r
+#define ACPI_EXTENDED_DP 0x02\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 HID;\r
+ UINT32 UID;\r
+ UINT32 CID;\r
+ //\r
+ // Optional variable length _HIDSTR\r
+ // Optional variable length _UIDSTR\r
+ //\r
+} ACPI_EXTENDED_HID_DEVICE_PATH;\r
+\r
+//\r
+// EISA ID Macro\r
+// EISA ID Definition 32-bits\r
+// bits[15:0] - three character compressed ASCII EISA ID.\r
+// bits[31:16] - binary number\r
+// Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'\r
+//\r
+#define PNP_EISA_ID_CONST 0x41d0\r
+#define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16))\r
+#define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))\r
+#define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))\r
+\r
+#define PNP_EISA_ID_MASK 0xffff\r
+#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)\r
+\r
+\r
+#define ACPI_ADR_DP 0x03\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 ADR;\r
+} ACPI_ADR_DEVICE_PATH;\r
+\r
+\r
+//\r
+// Messaging Device Paths\r
+//\r
+#define MESSAGING_DEVICE_PATH 0x03\r
+\r
+#define MSG_ATAPI_DP 0x01\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT8 PrimarySecondary;\r
+ UINT8 SlaveMaster;\r
+ UINT16 Lun;\r
+} ATAPI_DEVICE_PATH;\r
+\r
+#define MSG_SCSI_DP 0x02\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT16 Pun;\r
+ UINT16 Lun;\r
+} SCSI_DEVICE_PATH;\r
+\r
+#define MSG_FIBRECHANNEL_DP 0x03\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 Reserved;\r
+ UINT64 WWN;\r
+ UINT64 Lun;\r
+} FIBRECHANNEL_DEVICE_PATH;\r
+\r
+#define MSG_1394_DP 0x04\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 Reserved;\r
+ UINT64 Guid;\r
+} F1394_DEVICE_PATH;\r
+\r
+#define MSG_USB_DP 0x05\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT8 ParentPortNumber;\r
+ UINT8 InterfaceNumber;\r
+} USB_DEVICE_PATH;\r
+\r
+#define MSG_USB_CLASS_DP 0x0f\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT16 VendorId;\r
+ UINT16 ProductId;\r
+ UINT8 DeviceClass;\r
+ UINT8 DeviceSubClass;\r
+ UINT8 DeviceProtocol;\r
+} USB_CLASS_DEVICE_PATH;\r
+\r
+#define MSG_USB_WWID_DP 0x10\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT16 InterfaceNumber;\r
+ UINT16 VendorId;\r
+ UINT16 ProductId;\r
+ // CHAR16 SerialNumber[...];\r
+} USB_WWID_DEVICE_PATH;\r
+\r
+\r
+#define MSG_DEVICE_LOGICAL_UNIT_DP 0x11\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT8 Lun;\r
+} DEVICE_LOGICAL_UNIT_DEVICE_PATH;\r
+\r
+#define MSG_SATA_DP 0x12\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT16 HbaPortNumber;\r
+ UINT16 PortMultiplierPort;\r
+ UINT16 LogicalUnitNumber;\r
+} SATA_DEVICE_PATH;\r
+\r
+#define MSG_I2O_DP 0x06\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 Tid;\r
+} I2O_DEVICE_PATH;\r
+\r
+#define MSG_MAC_ADDR_DP 0x0b\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ EFI_MAC_ADDRESS MacAddress;\r
+ UINT8 IfType;\r
+} MAC_ADDR_DEVICE_PATH;\r
+\r
+#define MSG_IPv4_DP 0x0c\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ EFI_IPv4_ADDRESS LocalIpAddress;\r
+ EFI_IPv4_ADDRESS RemoteIpAddress;\r
+ UINT16 LocalPort;\r
+ UINT16 RemotePort;\r
+ UINT16 Protocol;\r
+ BOOLEAN StaticIpAddress;\r
+} IPv4_DEVICE_PATH;\r
+\r
+#define MSG_IPv6_DP 0x0d\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ EFI_IPv6_ADDRESS LocalIpAddress;\r
+ EFI_IPv6_ADDRESS RemoteIpAddress;\r
+ UINT16 LocalPort;\r
+ UINT16 RemotePort;\r
+ UINT16 Protocol;\r
+ BOOLEAN StaticIpAddress;\r
+} IPv6_DEVICE_PATH;\r
+\r
+#define MSG_INFINIBAND_DP 0x09\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 ResourceFlags;\r
+ UINT8 PortGid[16];\r
+ UINT64 ServiceId;\r
+ UINT64 TargetPortId;\r
+ UINT64 DeviceId;\r
+} INFINIBAND_DEVICE_PATH;\r
+\r
+#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01\r
+#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02\r
+#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04\r
+#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08\r
+#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10\r
+\r
+#define MSG_UART_DP 0x0e\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 Reserved;\r
+ UINT64 BaudRate;\r
+ UINT8 DataBits;\r
+ UINT8 Parity;\r
+ UINT8 StopBits;\r
+} UART_DEVICE_PATH;\r
+\r
+//\r
+// Use VENDOR_DEVICE_PATH struct\r
+//\r
+#define MSG_VENDOR_DP 0x0a\r
+typedef VENDOR_DEVICE_PATH VENDOR_DEFINED_DEVICE_PATH;\r
+\r
+#define DEVICE_PATH_MESSAGING_PC_ANSI EFI_PC_ANSI_GUID\r
+#define DEVICE_PATH_MESSAGING_VT_100 EFI_VT_100_GUID\r
+#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID\r
+#define DEVICE_PATH_MESSAGING_VT_UTF8 EFI_VT_UTF8_GUID\r
+\r
+#define DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL EFI_UART_DEVICE_PATH_GUID\r
+\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ EFI_GUID Guid;\r
+ UINT32 FlowControlMap;\r
+} UART_FLOW_CONTROL_DEVICE_PATH;\r
+\r
+#define DEVICE_PATH_MESSAGING_SAS EFI_SAS_DEVICE_PATH_GUID\r
+\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ EFI_GUID Guid;\r
+ UINT32 Reserved;\r
+ UINT64 SasAddress;\r
+ UINT64 Lun;\r
+ UINT16 DeviceTopology;\r
+ UINT16 RelativeTargetPort;\r
+} SAS_DEVICE_PATH;\r
+\r
+#define MSG_ISCSI_DP 0x13\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT16 NetworkProtocol;\r
+ UINT16 LoginOption;\r
+ UINT16 Reserved;\r
+ UINT16 TargetPortalGroupTag;\r
+ UINT64 LUN;\r
+ // CHAR8 iSCSI Target Name\r
+} ISCSI_DEVICE_PATH;\r
+\r
+#define ISCSI_LOGIN_OPTION_NO_HEADER_DIGEST 0x0000\r
+#define ISCSI_LOGIN_OPTION_HEADER_DIGEST_USING_CRC32C 0x0002\r
+#define ISCSI_LOGIN_OPTION_NO_DATA_DIGEST 0x0000\r
+#define ISCSI_LOGIN_OPTION_DATA_DIGEST_USING_CRC32C 0x0008\r
+#define ISCSI_LOGIN_OPTION_AUTHMETHOD_CHAP 0x0000\r
+#define ISCSI_LOGIN_OPTION_AUTHMETHOD_NON 0x1000\r
+#define ISCSI_LOGIN_OPTION_CHAP_BI 0x0000\r
+#define ISCSI_LOGIN_OPTION_CHAP_UNI 0x2000\r
+\r
+//\r
+// Media Device Path\r
+//\r
+#define MEDIA_DEVICE_PATH 0x04\r
+\r
+#define MEDIA_HARDDRIVE_DP 0x01\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 PartitionNumber;\r
+ UINT64 PartitionStart;\r
+ UINT64 PartitionSize;\r
+ UINT8 Signature[16];\r
+ UINT8 MBRType;\r
+ UINT8 SignatureType;\r
+} HARDDRIVE_DEVICE_PATH;\r
+\r
+#define MBR_TYPE_PCAT 0x01\r
+#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02\r
+\r
+#define SIGNATURE_TYPE_MBR 0x01\r
+#define SIGNATURE_TYPE_GUID 0x02\r
+\r
+#define MEDIA_CDROM_DP 0x02\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT32 BootEntry;\r
+ UINT64 PartitionStart;\r
+ UINT64 PartitionSize;\r
+} CDROM_DEVICE_PATH;\r
+\r
+//\r
+// Use VENDOR_DEVICE_PATH struct\r
+//\r
+#define MEDIA_VENDOR_DP 0x03\r
+\r
+#define MEDIA_FILEPATH_DP 0x04\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ CHAR16 PathName[1];\r
+} FILEPATH_DEVICE_PATH;\r
+\r
+#define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)\r
+\r
+#define MEDIA_PROTOCOL_DP 0x05\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ EFI_GUID Protocol;\r
+} MEDIA_PROTOCOL_DEVICE_PATH;\r
+\r
+\r
+#define MEDIA_PIWG_FW_VOL_DP 0x6\r
+typedef MEDIA_PROTOCOL_DEVICE_PATH MEDIA_FW_VOL_FILEPATH_DEVICE_PATH;\r
+\r
+\r
+#define MEDIA_PIWG_FW_FILE_DP 0x7\r
+typedef MEDIA_PROTOCOL_DEVICE_PATH MEDIA_FW_VOL_DEVICE_PATH;\r
+\r
+//\r
+// BBS Device Path\r
+//\r
+#define BBS_DEVICE_PATH 0x05\r
+#define BBS_BBS_DP 0x01\r
+typedef struct {\r
+ EFI_DEVICE_PATH_PROTOCOL Header;\r
+ UINT16 DeviceType;\r
+ UINT16 StatusFlag;\r
+ CHAR8 String[1];\r
+} BBS_BBS_DEVICE_PATH;\r
+\r
+//\r
+// DeviceType definitions - from BBS specification\r
+//\r
+#define BBS_TYPE_FLOPPY 0x01\r
+#define BBS_TYPE_HARDDRIVE 0x02\r
+#define BBS_TYPE_CDROM 0x03\r
+#define BBS_TYPE_PCMCIA 0x04\r
+#define BBS_TYPE_USB 0x05\r
+#define BBS_TYPE_EMBEDDED_NETWORK 0x06\r
+#define BBS_TYPE_BEV 0x80\r
+#define BBS_TYPE_UNKNOWN 0xFF\r
+\r
+\r
+//\r
+// Union of all possible Device Paths and pointers to Device Paths\r
+//\r
+\r
+typedef union {\r
+ EFI_DEVICE_PATH_PROTOCOL DevPath;\r
+ PCI_DEVICE_PATH Pci;\r
+ PCCARD_DEVICE_PATH PcCard;\r
+ MEMMAP_DEVICE_PATH MemMap;\r
+ VENDOR_DEVICE_PATH Vendor;\r
+\r
+ CONTROLLER_DEVICE_PATH Controller;\r
+ ACPI_HID_DEVICE_PATH Acpi;\r
+\r
+ ATAPI_DEVICE_PATH Atapi;\r
+ SCSI_DEVICE_PATH Scsi;\r
+ FIBRECHANNEL_DEVICE_PATH FibreChannel;\r
+\r
+ F1394_DEVICE_PATH F1394;\r
+ USB_DEVICE_PATH Usb;\r
+ SATA_DEVICE_PATH Sata;\r
+ USB_CLASS_DEVICE_PATH UsbClass;\r
+ I2O_DEVICE_PATH I2O;\r
+ MAC_ADDR_DEVICE_PATH MacAddr;\r
+ IPv4_DEVICE_PATH Ipv4;\r
+ IPv6_DEVICE_PATH Ipv6;\r
+ INFINIBAND_DEVICE_PATH InfiniBand;\r
+ UART_DEVICE_PATH Uart;\r
+\r
+ HARDDRIVE_DEVICE_PATH HardDrive;\r
+ CDROM_DEVICE_PATH CD;\r
+\r
+ FILEPATH_DEVICE_PATH FilePath;\r
+ MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol;\r
+\r
+ BBS_BBS_DEVICE_PATH Bbs;\r
+} EFI_DEV_PATH;\r
+\r
+\r
+\r
+typedef union {\r
+ EFI_DEVICE_PATH_PROTOCOL *DevPath;\r
+ PCI_DEVICE_PATH *Pci;\r
+ PCCARD_DEVICE_PATH *PcCard;\r
+ MEMMAP_DEVICE_PATH *MemMap;\r
+ VENDOR_DEVICE_PATH *Vendor;\r
+\r
+ CONTROLLER_DEVICE_PATH *Controller;\r
+ ACPI_HID_DEVICE_PATH *Acpi;\r
+ ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi;\r
+\r
+ ATAPI_DEVICE_PATH *Atapi;\r
+ SCSI_DEVICE_PATH *Scsi;\r
+ FIBRECHANNEL_DEVICE_PATH *FibreChannel;\r
+\r
+ F1394_DEVICE_PATH *F1394;\r
+ USB_DEVICE_PATH *Usb;\r
+ SATA_DEVICE_PATH *Sata;\r
+ USB_CLASS_DEVICE_PATH *UsbClass;\r
+ I2O_DEVICE_PATH *I2O;\r
+ MAC_ADDR_DEVICE_PATH *MacAddr;\r
+ IPv4_DEVICE_PATH *Ipv4;\r
+ IPv6_DEVICE_PATH *Ipv6;\r
+ INFINIBAND_DEVICE_PATH *InfiniBand;\r
+ UART_DEVICE_PATH *Uart;\r
+\r
+ HARDDRIVE_DEVICE_PATH *HardDrive;\r
+ CDROM_DEVICE_PATH *CD;\r
+\r
+ FILEPATH_DEVICE_PATH *FilePath;\r
+ MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol;\r
+\r
+ BBS_BBS_DEVICE_PATH *Bbs;\r
+ UINT8 *Raw;\r
+} EFI_DEV_PATH_PTR;\r
+\r
+#pragma pack()\r
+\r
+\r
+#endif\r
+ \r
+\r
--- /dev/null
+/* @file\r
+ EFI Guid Partition Table Format Definition.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation\r
+ All rights reserved. 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: UefiGpt.h\r
+\r
+**/\r
+\r
+#ifndef __UEFI_GPT_H__\r
+#define __UEFI_GPT_H__\r
+\r
+#define PRIMARY_PART_HEADER_LBA 1\r
+\r
+//\r
+// EFI Partition Table Signature: "EFI PART"\r
+// \r
+#define EFI_PTAB_HEADER_ID 0x5452415020494645ULL\r
+\r
+#pragma pack(1)\r
+//\r
+// GPT Partition Table Header\r
+//\r
+typedef struct {\r
+ EFI_TABLE_HEADER Header;\r
+ EFI_LBA MyLBA;\r
+ EFI_LBA AlternateLBA;\r
+ EFI_LBA FirstUsableLBA;\r
+ EFI_LBA LastUsableLBA;\r
+ EFI_GUID DiskGUID;\r
+ EFI_LBA PartitionEntryLBA;\r
+ UINT32 NumberOfPartitionEntries;\r
+ UINT32 SizeOfPartitionEntry;\r
+ UINT32 PartitionEntryArrayCRC32;\r
+} EFI_PARTITION_TABLE_HEADER;\r
+\r
+//\r
+// GPT Partition Entry\r
+//\r
+typedef struct {\r
+ EFI_GUID PartitionTypeGUID;\r
+ EFI_GUID UniquePartitionGUID;\r
+ EFI_LBA StartingLBA;\r
+ EFI_LBA EndingLBA;\r
+ UINT64 Attributes;\r
+ CHAR16 PartitionName[36];\r
+} EFI_PARTITION_ENTRY;\r
+\r
+//\r
+// GPT Partition Entry Status\r
+//\r
+typedef struct {\r
+ BOOLEAN OutOfRange;\r
+ BOOLEAN Overlap;\r
+} EFI_PARTITION_ENTRY_STATUS;\r
+\r
+#pragma pack()\r
+#endif\r
+\r
+\r
--- /dev/null
+\r
+/** @file\r
+ This file defines the encoding for the VFR (Visual Form Representation) language.\r
+ IFR is primarily consumed by the EFI presentation engine, and produced by EFI\r
+ internal application and drivers as well as all add-in card option-ROM drivers\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation \r
+ All rights reserved. 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: UefiInternalFormRepresentation.h\r
+\r
+ @par Revision Reference:\r
+ These definitions are from UEFI2.1.\r
+\r
+**/\r
+\r
+#ifndef __UEFI_INTERNAL_FORMREPRESENTATION_H__\r
+#define __UEFI_INTERNAL_FORMREPRESENTATION_H__\r
+\r
+//\r
+// The following types are currently defined:\r
+//\r
+typedef UINT32 RELOFST;\r
+typedef CHAR16 *EFI_STRING;\r
+\r
+//\r
+// IFR Op codes\r
+//\r
+#define EFI_IFR_FORM_OP 0x01\r
+#define EFI_IFR_SUBTITLE_OP 0x02\r
+#define EFI_IFR_TEXT_OP 0x03\r
+#define EFI_IFR_GRAPHIC_OP 0x04\r
+#define EFI_IFR_ONE_OF_OP 0x05\r
+#define EFI_IFR_CHECKBOX_OP 0x06\r
+#define EFI_IFR_NUMERIC_OP 0x07\r
+#define EFI_IFR_PASSWORD_OP 0x08\r
+#define EFI_IFR_ONE_OF_OPTION_OP 0x09 // ONEOF OPTION field\r
+#define EFI_IFR_SUPPRESS_IF_OP 0x0A\r
+#define EFI_IFR_END_FORM_OP 0x0B\r
+#define EFI_IFR_HIDDEN_OP 0x0C\r
+#define EFI_IFR_END_FORM_SET_OP 0x0D\r
+#define EFI_IFR_FORM_SET_OP 0x0E\r
+#define EFI_IFR_REF_OP 0x0F\r
+#define EFI_IFR_END_ONE_OF_OP 0x10\r
+#define EFI_IFR_END_OP EFI_IFR_END_ONE_OF_OP\r
+#define EFI_IFR_INCONSISTENT_IF_OP 0x11\r
+#define EFI_IFR_EQ_ID_VAL_OP 0x12\r
+#define EFI_IFR_EQ_ID_ID_OP 0x13\r
+#define EFI_IFR_EQ_ID_LIST_OP 0x14\r
+#define EFI_IFR_AND_OP 0x15\r
+#define EFI_IFR_OR_OP 0x16\r
+#define EFI_IFR_NOT_OP 0x17\r
+#define EFI_IFR_END_IF_OP 0x18 // for endif of inconsistentif, suppressif, grayoutif\r
+#define EFI_IFR_GRAYOUT_IF_OP 0x19\r
+#define EFI_IFR_DATE_OP 0x1A\r
+#define EFI_IFR_TIME_OP 0x1B\r
+#define EFI_IFR_STRING_OP 0x1C\r
+#define EFI_IFR_LABEL_OP 0x1D\r
+#define EFI_IFR_SAVE_DEFAULTS_OP 0x1E\r
+#define EFI_IFR_RESTORE_DEFAULTS_OP 0x1F\r
+#define EFI_IFR_BANNER_OP 0x20\r
+#define EFI_IFR_INVENTORY_OP 0x21\r
+#define EFI_IFR_EQ_VAR_VAL_OP 0x22\r
+#define EFI_IFR_ORDERED_LIST_OP 0x23\r
+#define EFI_IFR_VARSTORE_OP 0x24\r
+#define EFI_IFR_VARSTORE_SELECT_OP 0x25\r
+#define EFI_IFR_VARSTORE_SELECT_PAIR_OP 0x26\r
+#define EFI_IFR_TRUE_OP 0x27\r
+#define EFI_IFR_FALSE_OP 0x28\r
+#define EFI_IFR_GT_OP 0x29\r
+#define EFI_IFR_GE_OP 0x2A\r
+#define EFI_IFR_OEM_DEFINED_OP 0x2B\r
+#define EFI_IFR_LAST_OPCODE EFI_IFR_OEM_DEFINED_OP\r
+#define EFI_IFR_OEM_OP 0xFE\r
+#define EFI_IFR_NV_ACCESS_COMMAND 0xFF\r
+\r
+//\r
+// Define values for the flags fields in some VFR opcodes. These are\r
+// bitmasks.\r
+//\r
+#define EFI_IFR_FLAG_DEFAULT 0x01\r
+#define EFI_IFR_FLAG_MANUFACTURING 0x02\r
+#define EFI_IFR_FLAG_INTERACTIVE 0x04\r
+#define EFI_IFR_FLAG_NV_ACCESS 0x08\r
+#define EFI_IFR_FLAG_RESET_REQUIRED 0x10\r
+#define EFI_IFR_FLAG_LATE_CHECK 0x20\r
+\r
+#define EFI_NON_DEVICE_CLASS 0x00 // Useful when you do not want something in the Device Manager\r
+#define EFI_DISK_DEVICE_CLASS 0x01\r
+#define EFI_VIDEO_DEVICE_CLASS 0x02\r
+#define EFI_NETWORK_DEVICE_CLASS 0x04\r
+#define EFI_INPUT_DEVICE_CLASS 0x08\r
+#define EFI_ON_BOARD_DEVICE_CLASS 0x10\r
+#define EFI_OTHER_DEVICE_CLASS 0x20\r
+\r
+#define EFI_SETUP_APPLICATION_SUBCLASS 0x00\r
+#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01\r
+#define EFI_FRONT_PAGE_SUBCLASS 0x02\r
+#define EFI_SINGLE_USE_SUBCLASS 0x03 // Used to display a single entity and then exit\r
+\r
+//\r
+// Used to flag dynamically created op-codes. This is meaningful to the IFR Library set\r
+// and the browser since we need to distinguish between compiled NV map data and created data.\r
+// We do not allow new entries to be created in the NV map dynamically however we still need\r
+// to display this information correctly. To dynamically create op-codes and assume that their\r
+// data will be saved, ensure that the NV starting location they refer to is pre-defined in the\r
+// NV map.\r
+//\r
+#define EFI_IFR_FLAG_CREATED 128\r
+\r
+#pragma pack(1)\r
+//\r
+// IFR Structure definitions\r
+//\r
+typedef struct {\r
+ UINT8 OpCode;\r
+ UINT8 Length;\r
+} EFI_IFR_OP_HEADER;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ EFI_GUID Guid;\r
+ STRING_REF FormSetTitle;\r
+ STRING_REF Help;\r
+ EFI_PHYSICAL_ADDRESS CallbackHandle;\r
+ UINT16 Class;\r
+ UINT16 SubClass;\r
+ UINT16 NvDataSize; // set once, size of the NV data as defined in the script\r
+} EFI_IFR_FORM_SET;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 FormId;\r
+ STRING_REF FormTitle;\r
+} EFI_IFR_FORM;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 LabelId;\r
+} EFI_IFR_LABEL;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ STRING_REF SubTitle;\r
+} EFI_IFR_SUBTITLE;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ STRING_REF Help;\r
+ STRING_REF Text;\r
+ STRING_REF TextTwo;\r
+ UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.\r
+ UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
+} EFI_IFR_TEXT;\r
+\r
+//\r
+// goto\r
+//\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 FormId;\r
+ STRING_REF Prompt;\r
+ STRING_REF Help; // The string Token for the context-help\r
+ UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.\r
+ UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
+} EFI_IFR_REF;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+} EFI_IFR_END_FORM;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+} EFI_IFR_END_FORM_SET;\r
+\r
+//\r
+// Also notice that the IFR_ONE_OF and IFR_CHECK_BOX are identical in structure......code assumes this to be true, if this ever\r
+// changes we need to revisit the InitializeTagStructures code\r
+//\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name\r
+ UINT8 Width; // The Size of the Data being saved\r
+ STRING_REF Prompt; // The String Token for the Prompt\r
+ STRING_REF Help; // The string Token for the context-help\r
+} EFI_IFR_ONE_OF;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 QuestionId; // The offset in NV for storage of the data\r
+ UINT8 MaxEntries; // The maximum number of options in the ordered list (=size of NVStore)\r
+ STRING_REF Prompt; // The string token for the prompt\r
+ STRING_REF Help; // The string token for the context-help\r
+} EFI_IFR_ORDERED_LIST;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name\r
+ UINT8 Width; // The Size of the Data being saved\r
+ STRING_REF Prompt; // The String Token for the Prompt\r
+ STRING_REF Help; // The string Token for the context-help\r
+ UINT8 Flags; // For now, if non-zero, means that it is the default option, - further definition likely\r
+ UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
+} EFI_IFR_CHECKBOX, EFI_IFR_CHECK_BOX;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ STRING_REF Option; // The string token describing the option\r
+ UINT16 Value; // The value associated with this option that is stored in the NVRAM if chosen\r
+ UINT8 Flags; // For now, if non-zero, means that it is the default option, - further definition likely above\r
+ UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
+} EFI_IFR_ONE_OF_OPTION;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name\r
+ UINT8 Width; // The Size of the Data being saved\r
+ STRING_REF Prompt; // The String Token for the Prompt\r
+ STRING_REF Help; // The string Token for the context-help\r
+ UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.\r
+ UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
+ UINT16 Minimum;\r
+ UINT16 Maximum;\r
+ UINT16 Step; // If step is 0, then manual input is specified, otherwise, left/right arrow selection is called for\r
+ UINT16 Default;\r
+} EFI_IFR_NUMERIC;\r
+\r
+//\r
+// There is an interesting twist with regards to Time and Date. This is one of the few items which can accept input from\r
+// a user, however may or may not need to use storage in the NVRAM space. The decided method for determining if NVRAM space\r
+// will be used (only for a TimeOp or DateOp) is: If .QuestionId == 0 && .Width == 0 (normally an impossibility) then use system\r
+// resources to store the data away and not NV resources. In other words, the setup engine will call gRT->SetTime, and gRT->SetDate\r
+// for the saving of data, and the values displayed will be from the gRT->GetXXXX series of calls.\r
+//\r
+typedef struct {\r
+ EFI_IFR_NUMERIC Hour;\r
+ EFI_IFR_NUMERIC Minute;\r
+ EFI_IFR_NUMERIC Second;\r
+} EFI_IFR_TIME;\r
+\r
+typedef struct {\r
+ EFI_IFR_NUMERIC Year;\r
+ EFI_IFR_NUMERIC Month;\r
+ EFI_IFR_NUMERIC Day;\r
+} EFI_IFR_DATE;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name\r
+ UINT8 Width; // The Size of the Data being saved -- BUGBUG -- remove someday\r
+ STRING_REF Prompt; // The String Token for the Prompt\r
+ STRING_REF Help; // The string Token for the context-help\r
+ UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.\r
+ UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
+ UINT8 MinSize; // Minimum allowable sized password\r
+ UINT8 MaxSize; // Maximum allowable sized password\r
+ UINT16 Encoding;\r
+} EFI_IFR_PASSWORD;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name\r
+ UINT8 Width; // The Size of the Data being saved -- BUGBUG -- remove someday\r
+ STRING_REF Prompt; // The String Token for the Prompt\r
+ STRING_REF Help; // The string Token for the context-help\r
+ UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.\r
+ UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
+ UINT8 MinSize; // Minimum allowable sized password\r
+ UINT8 MaxSize; // Maximum allowable sized password\r
+} EFI_IFR_STRING;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+} EFI_IFR_END_ONE_OF;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 Value;\r
+ UINT16 Key;\r
+} EFI_IFR_HIDDEN;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT8 Flags;\r
+} EFI_IFR_SUPPRESS;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT8 Flags;\r
+} EFI_IFR_GRAY_OUT;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ STRING_REF Popup;\r
+ UINT8 Flags;\r
+} EFI_IFR_INCONSISTENT;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 QuestionId; // offset into variable storage\r
+ UINT8 Width; // size of variable storage\r
+ UINT16 Value; // value to compare against\r
+} EFI_IFR_EQ_ID_VAL;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 QuestionId; // offset into variable storage\r
+ UINT8 Width; // size of variable storage\r
+ UINT16 ListLength;\r
+ UINT16 ValueList[1];\r
+} EFI_IFR_EQ_ID_LIST;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 QuestionId1; // offset into variable storage for first value to compare\r
+ UINT8 Width; // size of variable storage (must be same for both)\r
+ UINT16 QuestionId2; // offset into variable storage for second value to compare\r
+} EFI_IFR_EQ_ID_ID;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 VariableId; // offset into variable storage\r
+ UINT16 Value; // value to compare against\r
+} EFI_IFR_EQ_VAR_VAL;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+} EFI_IFR_AND;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+} EFI_IFR_OR;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+} EFI_IFR_NOT;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+} EFI_IFR_END_EXPR, EFI_IFR_END_IF;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 FormId;\r
+ STRING_REF Prompt;\r
+ STRING_REF Help;\r
+ UINT8 Flags;\r
+ UINT16 Key;\r
+} EFI_IFR_SAVE_DEFAULTS;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ STRING_REF Help;\r
+ STRING_REF Text;\r
+ STRING_REF TextTwo; // optional text\r
+} EFI_IFR_INVENTORY;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ EFI_GUID Guid; // GUID for the variable\r
+ UINT16 VarId; // variable store ID, as referenced elsewhere in the form\r
+ UINT16 Size; // size of the variable storage\r
+} EFI_IFR_VARSTORE;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 VarId; // variable store ID, as referenced elsewhere in the form\r
+} EFI_IFR_VARSTORE_SELECT;\r
+\r
+//\r
+// Used for the ideqid VFR statement where two variable stores may be referenced in the\r
+// same VFR statement.\r
+// A browser should treat this as an EFI_IFR_VARSTORE_SELECT statement and assume that all following\r
+// IFR opcodes use the VarId as defined here.\r
+//\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 VarId; // variable store ID, as referenced elsewhere in the form\r
+ UINT16 SecondaryVarId; // variable store ID, as referenced elsewhere in the form\r
+} EFI_IFR_VARSTORE_SELECT_PAIR;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+} EFI_IFR_TRUE;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+} EFI_IFR_FALSE;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+} EFI_IFR_GT;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+} EFI_IFR_GE;\r
+\r
+//\r
+// Save defaults and restore defaults have same structure\r
+//\r
+#define EFI_IFR_RESTORE_DEFAULTS EFI_IFR_SAVE_DEFAULTS\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ STRING_REF Title; // The string token for the banner title\r
+ UINT16 LineNumber; // 1-based line number\r
+ UINT8 Alignment; // left, center, or right-aligned\r
+} EFI_IFR_BANNER;\r
+\r
+#define EFI_IFR_BANNER_ALIGN_LEFT 0\r
+#define EFI_IFR_BANNER_ALIGN_CENTER 1\r
+#define EFI_IFR_BANNER_ALIGN_RIGHT 2\r
+#define EFI_IFR_BANNER_TIMEOUT 0xFF\r
+\r
+#pragma pack()\r
+\r
+\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.\r
+\r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. 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: UefiMultiPhase.h\r
+\r
+**/\r
+\r
+#ifndef __UEFI_MULTIPHASE_H__\r
+#define __UEFI_MULTIPHASE_H__\r
+\r
+//\r
+// Enumeration of memory types introduced in UEFI.\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
+ EfiMaxMemoryType\r
+} EFI_MEMORY_TYPE;\r
+\r
+\r
+//\r
+// Data structure that precedes all of the standard EFI table types.\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
+// Attributes of variable.\r
+// \r
+#define EFI_VARIABLE_NON_VOLATILE 0x00000001\r
+#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002\r
+#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004\r
+#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008\r
+\r
+//\r
+// This attribute is identified by the mnemonic 'HR' \r
+// elsewhere in this specification.\r
+// \r
+#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010\r
+\r
+\r
+\r
+//\r
+// _WIN_CERTIFICATE.wCertificateType\r
+// \r
+#define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0\r
+#define WIN_CERT_TYPE_EFI_GUID 0x0EF1\r
+\r
+/**\r
+ \r
+ The WIN_CERTIFICATE structure is part of the PE/COFF\r
+ specification and has the following definition:\r
+\r
+ @param dwLength The length of the entire certificate,\r
+ including the length of the header, in\r
+ bytes.\r
+\r
+ @param wRevision The revision level of the WIN_CERTIFICATE\r
+ structure. The current revision level is\r
+ 0x0200.\r
+\r
+ @param wCertificateType The certificate type. See\r
+ WIN_CERT_TYPE_xxx for the UEFI\r
+ certificate types. The UEFI\r
+ specification reserves the range of\r
+ certificate type values from 0x0EF0\r
+ to 0x0EFF.\r
+\r
+ @param bCertificate The actual certificate. The format of\r
+ the certificate depends on\r
+ wCertificateType. The format of the UEFI\r
+ certificates is defined below.\r
+\r
+\r
+**/\r
+typedef struct _WIN_CERTIFICATE {\r
+ UINT32 dwLength;\r
+ UINT16 wRevision;\r
+ UINT16 wCertificateType;\r
+ //UINT8 bCertificate[ANYSIZE_ARRAY];\r
+} WIN_CERTIFICATE;\r
+\r
+//\r
+// WIN_CERTIFICATE_UEFI_GUID.CertType\r
+// \r
+#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \\r
+ {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }\r
+\r
+//\r
+// WIN_CERTIFICATE_UEFI_GUID.CertData\r
+// \r
+typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {\r
+ UINT32 HashType;\r
+ UINT8 PublicKey[256];\r
+ UINT8 Signature[256];\r
+} EFI_CERT_BLOCK_RSA_2048_SHA256;\r
+\r
+\r
+/**\r
+ \r
+ @param Hdr This is the standard WIN_CERTIFICATE header, where\r
+ wCertificateType is set to\r
+ WIN_CERT_TYPE_UEFI_GUID.\r
+\r
+ @param CertType This is the unique id which determines the\r
+ format of the CertData. In this case, the\r
+ value is EFI_CERT_TYPE_RSA2048_SHA256_GUID.\r
+\r
+ @param CertData This is the certificate data. The format of\r
+ the data is determined by the CertType. In\r
+ this case the value is\r
+ EFI_CERT_BLOCK_RSA_2048_SHA256.\r
+\r
+ @param Information The WIN_CERTIFICATE_UEFI_GUID certificate\r
+ type allows new types of certificates to\r
+ be developed for driver authentication\r
+ without requiring a new certificate type.\r
+ The CertType defines the format of the\r
+ CertData, which length is defined by the\r
+ size of the certificate less the fixed\r
+ size of the WIN_CERTIFICATE_UEFI_GUID\r
+ structure.\r
+\r
+**/\r
+typedef struct _WIN_CERTIFICATE_UEFI_GUID {\r
+ WIN_CERTIFICATE Hdr;\r
+ EFI_GUID CertType;\r
+ // UINT8 CertData[ANYSIZE_ARRAY];\r
+} WIN_CERTIFICATE_UEFI_GUID;\r
+\r
+\r
+\r
+\r
+\r
+\r
+/**\r
+ \r
+ Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital\r
+ signature.\r
+ \r
+ The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from\r
+ WIN_CERTIFICATE and encapsulate the information needed to \r
+ implement the RSASSA-PKCS1-v1_5 digital signature algorithm as \r
+ specified in RFC2437. \r
+ \r
+ @param Hdr This is the standard WIN_CERTIFICATE header, where\r
+ wCertificateType is set to\r
+ WIN_CERT_TYPE_UEFI_PKCS1_15.\r
+ \r
+ @param HashAlgorithm This is the hashing algorithm which was\r
+ performed on the UEFI executable when\r
+ creating the digital signature. It is\r
+ one of the enumerated values pre-defined\r
+ in Section 26.4.1. See\r
+ EFI_HASH_ALGORITHM_x.\r
+ \r
+ @param Signature This is the actual digital signature. The\r
+ size of the signature is the same size as\r
+ the key (1024-bit key is 128 bytes) and can\r
+ be determined by subtracting the length of\r
+ the other parts of this header from the\r
+ total length of the certificate as found in\r
+ Hdr.dwLength.\r
+\r
+**/\r
+typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {\r
+ WIN_CERTIFICATE Hdr;\r
+ EFI_GUID HashAlgorithm;\r
+ // UINT8 Signature[ANYSIZE_ARRAY];\r
+} WIN_CERTIFICATE_EFI_PKCS1_15;\r
+\r
+\r
+/**\r
+ \r
+ AuthInfo is a WIN_CERTIFICATE using the wCertificateType\r
+ WIN_CERTIFICATE_UEFI_GUID and the CertType\r
+ EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies\r
+ authenticated access, then the Data buffer should begin with an\r
+ authentication descriptor prior to the data payload and DataSize\r
+ should reflect the the data.and descriptor size. The caller\r
+ shall digest the Monotonic Count value and the associated data\r
+ for the variable update using the SHA-256 1-way hash algorithm.\r
+ The ensuing the 32-byte digest will be signed using the private\r
+ key associated w/ the public/private 2048-bit RSA key-pair. The\r
+ WIN_CERTIFICATE shall be used to describe the signature of the\r
+ Variable data *Data. In addition, the signature will also\r
+ include the MonotonicCount value to guard against replay attacks\r
+ \r
+ @param MonotonicCount Included in the signature of\r
+ AuthInfo.Used to ensure freshness/no\r
+ replay. Incremented during each\r
+ "Write" access.\r
+ \r
+ @param AuthInfo Provides the authorization for the variable\r
+ access. It is a signature across the\r
+ variable data and the Monotonic Count\r
+ value. Caller uses Private key that is\r
+ associated with a public key that has been\r
+ provisioned via the key exchange.\r
+\r
+**/\r
+typedef struct {\r
+ UINT64 MonotonicCount;\r
+ WIN_CERTIFICATE_UEFI_GUID AuthInfo;\r
+} EFI_VARIABLE_AUTHENTICATION;\r
+\r
+#endif\r
+\r
--- /dev/null
+/** @file\r
+ This header file contains all of the PXE type definitions,\r
+ structure prototypes, global variables and constants that\r
+ are needed for porting PXE to EFI.\r
+ \r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. 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: EfiPxe.h\r
+ \r
+ @par Revision Reference:\r
+ 32/64-bit PXE specification:\r
+ alpha-4, 99-Dec-17\r
+ \r
+**/\r
+\r
+#ifndef __EFI_PXE_H__\r
+#define __EFI_PXE_H__\r
+\r
+#pragma pack(1)\r
+\r
+\r
+\r
+#define PXE_BUSTYPE(a, b, c, d) \\r
+ ( \\r
+ (((PXE_UINT32) (d) & 0xFF) << 24) | (((PXE_UINT32) (c) & 0xFF) << 16) | (((PXE_UINT32) (b) & 0xFF) << 8) | \\r
+ ((PXE_UINT32) (a) & 0xFF) \\r
+ )\r
+\r
+//\r
+// UNDI ROM ID and devive ID signature\r
+//\r
+#define PXE_BUSTYPE_PXE PXE_BUSTYPE ('!', 'P', 'X', 'E')\r
+\r
+//\r
+// BUS ROM ID signatures\r
+//\r
+#define PXE_BUSTYPE_PCI PXE_BUSTYPE ('P', 'C', 'I', 'R')\r
+#define PXE_BUSTYPE_PC_CARD PXE_BUSTYPE ('P', 'C', 'C', 'R')\r
+#define PXE_BUSTYPE_USB PXE_BUSTYPE ('U', 'S', 'B', 'R')\r
+#define PXE_BUSTYPE_1394 PXE_BUSTYPE ('1', '3', '9', '4')\r
+\r
+#define PXE_SWAP_UINT16(n) ((((PXE_UINT16) (n) & 0x00FF) << 8) | (((PXE_UINT16) (n) & 0xFF00) >> 8))\r
+\r
+#define PXE_SWAP_UINT32(n) \\r
+ ((((PXE_UINT32)(n) & 0x000000FF) << 24) | \\r
+ (((PXE_UINT32)(n) & 0x0000FF00) << 8) | \\r
+ (((PXE_UINT32)(n) & 0x00FF0000) >> 8) | \\r
+ (((PXE_UINT32)(n) & 0xFF000000) >> 24))\r
+\r
+#define PXE_SWAP_UINT64(n) \\r
+ ((((PXE_UINT64)(n) & 0x00000000000000FFULL) << 56) | \\r
+ (((PXE_UINT64)(n) & 0x000000000000FF00ULL) << 40) | \\r
+ (((PXE_UINT64)(n) & 0x0000000000FF0000ULL) << 24) | \\r
+ (((PXE_UINT64)(n) & 0x00000000FF000000ULL) << 8) | \\r
+ (((PXE_UINT64)(n) & 0x000000FF00000000ULL) >> 8) | \\r
+ (((PXE_UINT64)(n) & 0x0000FF0000000000ULL) >> 24) | \\r
+ (((PXE_UINT64)(n) & 0x00FF000000000000ULL) >> 40) | \\r
+ (((PXE_UINT64)(n) & 0xFF00000000000000ULL) >> 56))\r
+\r
+\r
+#define PXE_CPBSIZE_NOT_USED 0 // zero\r
+#define PXE_DBSIZE_NOT_USED 0 // zero\r
+#define PXE_CPBADDR_NOT_USED (PXE_UINT64) 0 // zero\r
+#define PXE_DBADDR_NOT_USED (PXE_UINT64) 0 // zero\r
+#define PXE_CONST const\r
+\r
+#define PXE_VOLATILE volatile\r
+\r
+typedef VOID PXE_VOID;\r
+typedef UINT8 PXE_UINT8;\r
+typedef UINT16 PXE_UINT16;\r
+typedef UINT32 PXE_UINT32;\r
+typedef UINTN PXE_UINTN;\r
+ \r
+//\r
+// typedef unsigned long PXE_UINT64;\r
+//\r
+typedef UINT64 PXE_UINT64;\r
+\r
+typedef PXE_UINT8 PXE_BOOL;\r
+#define PXE_FALSE 0 // zero\r
+#define PXE_TRUE (!PXE_FALSE)\r
+\r
+typedef PXE_UINT16 PXE_OPCODE;\r
+\r
+//\r
+// Return UNDI operational state.\r
+//\r
+#define PXE_OPCODE_GET_STATE 0x0000\r
+\r
+//\r
+// Change UNDI operational state from Stopped to Started.\r
+//\r
+#define PXE_OPCODE_START 0x0001\r
+\r
+//\r
+// Change UNDI operational state from Started to Stopped.\r
+//\r
+#define PXE_OPCODE_STOP 0x0002\r
+\r
+//\r
+// Get UNDI initialization information.\r
+//\r
+#define PXE_OPCODE_GET_INIT_INFO 0x0003\r
+\r
+//\r
+// Get NIC configuration information.\r
+//\r
+#define PXE_OPCODE_GET_CONFIG_INFO 0x0004\r
+\r
+//\r
+// Changed UNDI operational state from Started to Initialized.\r
+//\r
+#define PXE_OPCODE_INITIALIZE 0x0005\r
+\r
+//\r
+// Re-initialize the NIC H/W.\r
+//\r
+#define PXE_OPCODE_RESET 0x0006\r
+\r
+//\r
+// Change the UNDI operational state from Initialized to Started.\r
+//\r
+#define PXE_OPCODE_SHUTDOWN 0x0007\r
+\r
+//\r
+// Read & change state of external interrupt enables.\r
+//\r
+#define PXE_OPCODE_INTERRUPT_ENABLES 0x0008\r
+\r
+//\r
+// Read & change state of packet receive filters.\r
+//\r
+#define PXE_OPCODE_RECEIVE_FILTERS 0x0009\r
+\r
+//\r
+// Read & change station MAC address.\r
+//\r
+#define PXE_OPCODE_STATION_ADDRESS 0x000A\r
+\r
+//\r
+// Read traffic statistics.\r
+//\r
+#define PXE_OPCODE_STATISTICS 0x000B\r
+\r
+//\r
+// Convert multicast IP address to multicast MAC address.\r
+//\r
+#define PXE_OPCODE_MCAST_IP_TO_MAC 0x000C\r
+\r
+//\r
+// Read or change non-volatile storage on the NIC.\r
+//\r
+#define PXE_OPCODE_NVDATA 0x000D\r
+\r
+//\r
+// Get & clear interrupt status.\r
+//\r
+#define PXE_OPCODE_GET_STATUS 0x000E\r
+\r
+//\r
+// Fill media header in packet for transmit.\r
+//\r
+#define PXE_OPCODE_FILL_HEADER 0x000F\r
+\r
+//\r
+// Transmit packet(s).\r
+//\r
+#define PXE_OPCODE_TRANSMIT 0x0010\r
+\r
+//\r
+// Receive packet.\r
+//\r
+#define PXE_OPCODE_RECEIVE 0x0011\r
+\r
+//\r
+// Last valid PXE UNDI OpCode number.\r
+//\r
+#define PXE_OPCODE_LAST_VALID 0x0011\r
+\r
+typedef PXE_UINT16 PXE_OPFLAGS;\r
+\r
+#define PXE_OPFLAGS_NOT_USED 0x0000\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Get State\r
+//\r
+// No OpFlags\r
+\r
+////////////////////////////////////////\r
+// UNDI Start\r
+//\r
+// No OpFlags\r
+\r
+////////////////////////////////////////\r
+// UNDI Stop\r
+//\r
+// No OpFlags\r
+\r
+////////////////////////////////////////\r
+// UNDI Get Init Info\r
+//\r
+// No Opflags\r
+\r
+////////////////////////////////////////\r
+// UNDI Get Config Info\r
+//\r
+// No Opflags\r
+\r
+////////////////////////////////////////\r
+// UNDI Initialize\r
+//\r
+#define PXE_OPFLAGS_INITIALIZE_CABLE_DETECT_MASK 0x0001\r
+#define PXE_OPFLAGS_INITIALIZE_DETECT_CABLE 0x0000\r
+#define PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE 0x0001\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Reset\r
+//\r
+#define PXE_OPFLAGS_RESET_DISABLE_INTERRUPTS 0x0001\r
+#define PXE_OPFLAGS_RESET_DISABLE_FILTERS 0x0002\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Shutdown\r
+//\r
+// No OpFlags\r
+\r
+////////////////////////////////////////\r
+// UNDI Interrupt Enables\r
+//\r
+//\r
+// Select whether to enable or disable external interrupt signals.\r
+// Setting both enable and disable will return PXE_STATCODE_INVALID_OPFLAGS.\r
+//\r
+#define PXE_OPFLAGS_INTERRUPT_OPMASK 0xC000\r
+#define PXE_OPFLAGS_INTERRUPT_ENABLE 0x8000\r
+#define PXE_OPFLAGS_INTERRUPT_DISABLE 0x4000\r
+#define PXE_OPFLAGS_INTERRUPT_READ 0x0000\r
+\r
+//\r
+// Enable receive interrupts. An external interrupt will be generated\r
+// after a complete non-error packet has been received.\r
+//\r
+#define PXE_OPFLAGS_INTERRUPT_RECEIVE 0x0001\r
+\r
+//\r
+// Enable transmit interrupts. An external interrupt will be generated\r
+// after a complete non-error packet has been transmitted.\r
+//\r
+#define PXE_OPFLAGS_INTERRUPT_TRANSMIT 0x0002\r
+\r
+//\r
+// Enable command interrupts. An external interrupt will be generated\r
+// when command execution stops.\r
+//\r
+#define PXE_OPFLAGS_INTERRUPT_COMMAND 0x0004\r
+\r
+//\r
+// Generate software interrupt. Setting this bit generates an external\r
+// interrupt, if it is supported by the hardware.\r
+//\r
+#define PXE_OPFLAGS_INTERRUPT_SOFTWARE 0x0008\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Receive Filters\r
+//\r
+//\r
+// Select whether to enable or disable receive filters.\r
+// Setting both enable and disable will return PXE_STATCODE_INVALID_OPCODE.\r
+//\r
+#define PXE_OPFLAGS_RECEIVE_FILTER_OPMASK 0xC000\r
+#define PXE_OPFLAGS_RECEIVE_FILTER_ENABLE 0x8000\r
+#define PXE_OPFLAGS_RECEIVE_FILTER_DISABLE 0x4000\r
+#define PXE_OPFLAGS_RECEIVE_FILTER_READ 0x0000\r
+\r
+//\r
+// To reset the contents of the multicast MAC address filter list,\r
+// set this OpFlag:\r
+//\r
+#define PXE_OPFLAGS_RECEIVE_FILTER_RESET_MCAST_LIST 0x2000\r
+\r
+//\r
+// Enable unicast packet receiving. Packets sent to the current station\r
+// MAC address will be received.\r
+//\r
+#define PXE_OPFLAGS_RECEIVE_FILTER_UNICAST 0x0001\r
+\r
+//\r
+// Enable broadcast packet receiving. Packets sent to the broadcast\r
+// MAC address will be received.\r
+//\r
+#define PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST 0x0002\r
+\r
+//\r
+// Enable filtered multicast packet receiving. Packets sent to any\r
+// of the multicast MAC addresses in the multicast MAC address filter\r
+// list will be received. If the filter list is empty, no multicast\r
+//\r
+#define PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST 0x0004\r
+\r
+//\r
+// Enable promiscuous packet receiving. All packets will be received.\r
+//\r
+#define PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS 0x0008\r
+\r
+//\r
+// Enable promiscuous multicast packet receiving. All multicast\r
+// packets will be received.\r
+//\r
+#define PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST 0x0010\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Station Address\r
+//\r
+#define PXE_OPFLAGS_STATION_ADDRESS_READ 0x0000\r
+#define PXE_OPFLAGS_STATION_ADDRESS_WRITE 0x0000\r
+#define PXE_OPFLAGS_STATION_ADDRESS_RESET 0x0001\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Statistics\r
+//\r
+#define PXE_OPFLAGS_STATISTICS_READ 0x0000\r
+#define PXE_OPFLAGS_STATISTICS_RESET 0x0001\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI MCast IP to MAC\r
+//\r
+//\r
+// Identify the type of IP address in the CPB.\r
+//\r
+#define PXE_OPFLAGS_MCAST_IP_TO_MAC_OPMASK 0x0003\r
+#define PXE_OPFLAGS_MCAST_IPV4_TO_MAC 0x0000\r
+#define PXE_OPFLAGS_MCAST_IPV6_TO_MAC 0x0001\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI NvData\r
+//\r
+//\r
+// Select the type of non-volatile data operation.\r
+//\r
+#define PXE_OPFLAGS_NVDATA_OPMASK 0x0001\r
+#define PXE_OPFLAGS_NVDATA_READ 0x0000\r
+#define PXE_OPFLAGS_NVDATA_WRITE 0x0001\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Get Status\r
+//\r
+//\r
+// Return current interrupt status. This will also clear any interrupts\r
+// that are currently set. This can be used in a polling routine. The\r
+// interrupt flags are still set and cleared even when the interrupts\r
+// are disabled.\r
+//\r
+#define PXE_OPFLAGS_GET_INTERRUPT_STATUS 0x0001\r
+\r
+//\r
+// Return list of transmitted buffers for recycling. Transmit buffers\r
+// must not be changed or unallocated until they have recycled. After\r
+// issuing a transmit command, wait for a transmit complete interrupt.\r
+// When a transmit complete interrupt is received, read the transmitted\r
+// buffers. Do not plan on getting one buffer per interrupt. Some\r
+// NICs and UNDIs may transmit multiple buffers per interrupt.\r
+//\r
+#define PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS 0x0002\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Fill Header\r
+//\r
+#define PXE_OPFLAGS_FILL_HEADER_OPMASK 0x0001\r
+#define PXE_OPFLAGS_FILL_HEADER_FRAGMENTED 0x0001\r
+#define PXE_OPFLAGS_FILL_HEADER_WHOLE 0x0000\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Transmit\r
+//\r
+//\r
+// S/W UNDI only. Return after the packet has been transmitted. A\r
+// transmit complete interrupt will still be generated and the transmit\r
+// buffer will have to be recycled.\r
+//\r
+#define PXE_OPFLAGS_SWUNDI_TRANSMIT_OPMASK 0x0001\r
+#define PXE_OPFLAGS_TRANSMIT_BLOCK 0x0001\r
+#define PXE_OPFLAGS_TRANSMIT_DONT_BLOCK 0x0000\r
+\r
+//\r
+//\r
+//\r
+#define PXE_OPFLAGS_TRANSMIT_OPMASK 0x0002\r
+#define PXE_OPFLAGS_TRANSMIT_FRAGMENTED 0x0002\r
+#define PXE_OPFLAGS_TRANSMIT_WHOLE 0x0000\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Receive\r
+//\r
+// No OpFlags\r
+//\r
+typedef PXE_UINT16 PXE_STATFLAGS;\r
+\r
+#define PXE_STATFLAGS_INITIALIZE 0x0000\r
+\r
+//\r
+// //////////////////////////////////////\r
+// Common StatFlags that can be returned by all commands.\r
+//\r
+//\r
+// The COMMAND_COMPLETE and COMMAND_FAILED status flags must be\r
+// implemented by all UNDIs. COMMAND_QUEUED is only needed by UNDIs\r
+// that support command queuing.\r
+//\r
+#define PXE_STATFLAGS_STATUS_MASK 0xC000\r
+#define PXE_STATFLAGS_COMMAND_COMPLETE 0xC000\r
+#define PXE_STATFLAGS_COMMAND_FAILED 0x8000\r
+#define PXE_STATFLAGS_COMMAND_QUEUED 0x4000\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Get State\r
+//\r
+#define PXE_STATFLAGS_GET_STATE_MASK 0x0003\r
+#define PXE_STATFLAGS_GET_STATE_INITIALIZED 0x0002\r
+#define PXE_STATFLAGS_GET_STATE_STARTED 0x0001\r
+#define PXE_STATFLAGS_GET_STATE_STOPPED 0x0000\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Start\r
+//\r
+// No additional StatFlags\r
+\r
+////////////////////////////////////////\r
+// UNDI Get Init Info\r
+//\r
+#define PXE_STATFLAGS_CABLE_DETECT_MASK 0x0001\r
+#define PXE_STATFLAGS_CABLE_DETECT_NOT_SUPPORTED 0x0000\r
+#define PXE_STATFLAGS_CABLE_DETECT_SUPPORTED 0x0001\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Initialize\r
+//\r
+#define PXE_STATFLAGS_INITIALIZED_NO_MEDIA 0x0001\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Reset\r
+//\r
+#define PXE_STATFLAGS_RESET_NO_MEDIA 0x0001\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Shutdown\r
+//\r
+// No additional StatFlags\r
+\r
+////////////////////////////////////////\r
+// UNDI Interrupt Enables\r
+//\r
+//\r
+// If set, receive interrupts are enabled.\r
+//\r
+#define PXE_STATFLAGS_INTERRUPT_RECEIVE 0x0001\r
+\r
+//\r
+// If set, transmit interrupts are enabled.\r
+//\r
+#define PXE_STATFLAGS_INTERRUPT_TRANSMIT 0x0002\r
+\r
+//\r
+// If set, command interrupts are enabled.\r
+//\r
+#define PXE_STATFLAGS_INTERRUPT_COMMAND 0x0004\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Receive Filters\r
+//\r
+//\r
+// If set, unicast packets will be received.\r
+//\r
+#define PXE_STATFLAGS_RECEIVE_FILTER_UNICAST 0x0001\r
+\r
+//\r
+// If set, broadcast packets will be received.\r
+//\r
+#define PXE_STATFLAGS_RECEIVE_FILTER_BROADCAST 0x0002\r
+\r
+//\r
+// If set, multicast packets that match up with the multicast address\r
+// filter list will be received.\r
+//\r
+#define PXE_STATFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST 0x0004\r
+\r
+//\r
+// If set, all packets will be received.\r
+//\r
+#define PXE_STATFLAGS_RECEIVE_FILTER_PROMISCUOUS 0x0008\r
+\r
+//\r
+// If set, all multicast packets will be received.\r
+//\r
+#define PXE_STATFLAGS_RECEIVE_FILTER_ALL_MULTICAST 0x0010\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Station Address\r
+//\r
+// No additional StatFlags\r
+\r
+////////////////////////////////////////\r
+// UNDI Statistics\r
+//\r
+// No additional StatFlags\r
+\r
+////////////////////////////////////////\r
+// UNDI MCast IP to MAC\r
+//\r
+// No additional StatFlags\r
+\r
+////////////////////////////////////////\r
+// UNDI NvData\r
+//\r
+// No additional StatFlags\r
+\r
+\r
+////////////////////////////////////////\r
+// UNDI Get Status\r
+//\r
+//\r
+// Use to determine if an interrupt has occurred.\r
+//\r
+#define PXE_STATFLAGS_GET_STATUS_INTERRUPT_MASK 0x000F\r
+#define PXE_STATFLAGS_GET_STATUS_NO_INTERRUPTS 0x0000\r
+\r
+//\r
+// If set, at least one receive interrupt occurred.\r
+//\r
+#define PXE_STATFLAGS_GET_STATUS_RECEIVE 0x0001\r
+\r
+//\r
+// If set, at least one transmit interrupt occurred.\r
+//\r
+#define PXE_STATFLAGS_GET_STATUS_TRANSMIT 0x0002\r
+\r
+//\r
+// If set, at least one command interrupt occurred.\r
+//\r
+#define PXE_STATFLAGS_GET_STATUS_COMMAND 0x0004\r
+\r
+//\r
+// If set, at least one software interrupt occurred.\r
+//\r
+#define PXE_STATFLAGS_GET_STATUS_SOFTWARE 0x0008\r
+\r
+//\r
+// This flag is set if the transmitted buffer queue is empty. This flag\r
+// will be set if all transmitted buffer addresses get written into the DB.\r
+//\r
+#define PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY 0x0010\r
+\r
+//\r
+// This flag is set if no transmitted buffer addresses were written\r
+// into the DB. (This could be because DBsize was too small.)\r
+//\r
+#define PXE_STATFLAGS_GET_STATUS_NO_TXBUFS_WRITTEN 0x0020\r
+\r
+//\r
+// //////////////////////////////////////\r
+// UNDI Fill Header\r
+//\r
+// No additional StatFlags\r
+\r
+////////////////////////////////////////\r
+// UNDI Transmit\r
+//\r
+// No additional StatFlags.\r
+\r
+////////////////////////////////////////\r
+// UNDI Receive\r
+//\r
+// No additional StatFlags.\r
+//\r
+typedef PXE_UINT16 PXE_STATCODE;\r
+\r
+#define PXE_STATCODE_INITIALIZE 0x0000\r
+\r
+//\r
+// //////////////////////////////////////\r
+// Common StatCodes returned by all UNDI commands, UNDI protocol functions\r
+// and BC protocol functions.\r
+//\r
+#define PXE_STATCODE_SUCCESS 0x0000\r
+\r
+#define PXE_STATCODE_INVALID_CDB 0x0001\r
+#define PXE_STATCODE_INVALID_CPB 0x0002\r
+#define PXE_STATCODE_BUSY 0x0003\r
+#define PXE_STATCODE_QUEUE_FULL 0x0004\r
+#define PXE_STATCODE_ALREADY_STARTED 0x0005\r
+#define PXE_STATCODE_NOT_STARTED 0x0006\r
+#define PXE_STATCODE_NOT_SHUTDOWN 0x0007\r
+#define PXE_STATCODE_ALREADY_INITIALIZED 0x0008\r
+#define PXE_STATCODE_NOT_INITIALIZED 0x0009\r
+#define PXE_STATCODE_DEVICE_FAILURE 0x000A\r
+#define PXE_STATCODE_NVDATA_FAILURE 0x000B\r
+#define PXE_STATCODE_UNSUPPORTED 0x000C\r
+#define PXE_STATCODE_BUFFER_FULL 0x000D\r
+#define PXE_STATCODE_INVALID_PARAMETER 0x000E\r
+#define PXE_STATCODE_INVALID_UNDI 0x000F\r
+#define PXE_STATCODE_IPV4_NOT_SUPPORTED 0x0010\r
+#define PXE_STATCODE_IPV6_NOT_SUPPORTED 0x0011\r
+#define PXE_STATCODE_NOT_ENOUGH_MEMORY 0x0012\r
+#define PXE_STATCODE_NO_DATA 0x0013\r
+\r
+typedef PXE_UINT16 PXE_IFNUM;\r
+\r
+//\r
+// This interface number must be passed to the S/W UNDI Start command.\r
+//\r
+#define PXE_IFNUM_START 0x0000\r
+\r
+//\r
+// This interface number is returned by the S/W UNDI Get State and\r
+// Start commands if information in the CDB, CPB or DB is invalid.\r
+//\r
+#define PXE_IFNUM_INVALID 0x0000\r
+\r
+typedef PXE_UINT16 PXE_CONTROL;\r
+\r
+//\r
+// Setting this flag directs the UNDI to queue this command for later\r
+// execution if the UNDI is busy and it supports command queuing.\r
+// If queuing is not supported, a PXE_STATCODE_INVALID_CONTROL error\r
+// is returned. If the queue is full, a PXE_STATCODE_CDB_QUEUE_FULL\r
+// error is returned.\r
+//\r
+#define PXE_CONTROL_QUEUE_IF_BUSY 0x0002\r
+\r
+//\r
+// These two bit values are used to determine if there are more UNDI\r
+// CDB structures following this one. If the link bit is set, there\r
+// must be a CDB structure following this one. Execution will start\r
+// on the next CDB structure as soon as this one completes successfully.\r
+// If an error is generated by this command, execution will stop.\r
+//\r
+#define PXE_CONTROL_LINK 0x0001\r
+#define PXE_CONTROL_LAST_CDB_IN_LIST 0x0000\r
+\r
+typedef PXE_UINT8 PXE_FRAME_TYPE;\r
+\r
+#define PXE_FRAME_TYPE_NONE 0x00\r
+#define PXE_FRAME_TYPE_UNICAST 0x01\r
+#define PXE_FRAME_TYPE_BROADCAST 0x02\r
+#define PXE_FRAME_TYPE_FILTERED_MULTICAST 0x03\r
+#define PXE_FRAME_TYPE_PROMISCUOUS 0x04\r
+#define PXE_FRAME_TYPE_PROMISCUOUS_MULTICAST 0x05\r
+\r
+#define PXE_FRAME_TYPE_MULTICAST PXE_FRAME_TYPE_FILTERED_MULTICAST \r
+\r
+typedef PXE_UINT32 PXE_IPV4;\r
+\r
+typedef PXE_UINT32 PXE_IPV6[4];\r
+#define PXE_MAC_LENGTH 32\r
+\r
+typedef PXE_UINT8 PXE_MAC_ADDR[PXE_MAC_LENGTH];\r
+\r
+typedef PXE_UINT8 PXE_IFTYPE;\r
+typedef UINT16 PXE_MEDIA_PROTOCOL;\r
+\r
+//\r
+// This information is from the ARP section of RFC 1700.\r
+//\r
+// 1 Ethernet (10Mb) [JBP]\r
+// 2 Experimental Ethernet (3Mb) [JBP]\r
+// 3 Amateur Radio AX.25 [PXK]\r
+// 4 Proteon ProNET Token Ring [JBP]\r
+// 5 Chaos [GXP]\r
+// 6 IEEE 802 Networks [JBP]\r
+// 7 ARCNET [JBP]\r
+// 8 Hyperchannel [JBP]\r
+// 9 Lanstar [TU]\r
+// 10 Autonet Short Address [MXB1]\r
+// 11 LocalTalk [JKR1]\r
+// 12 LocalNet (IBM* PCNet or SYTEK* LocalNET) [JXM]\r
+// 13 Ultra link [RXD2]\r
+// 14 SMDS [GXC1]\r
+// 15 Frame Relay [AGM]\r
+// 16 Asynchronous Transmission Mode (ATM) [JXB2]\r
+// 17 HDLC [JBP]\r
+// 18 Fibre Channel [Yakov Rekhter]\r
+// 19 Asynchronous Transmission Mode (ATM) [Mark Laubach]\r
+// 20 Serial Line [JBP]\r
+// 21 Asynchronous Transmission Mode (ATM) [MXB1]\r
+//\r
+// * Other names and brands may be claimed as the property of others.\r
+//\r
+#define PXE_IFTYPE_ETHERNET 0x01\r
+#define PXE_IFTYPE_TOKENRING 0x04\r
+#define PXE_IFTYPE_FIBRE_CHANNEL 0x12\r
+\r
+typedef struct s_pxe_hw_undi {\r
+ PXE_UINT32 Signature; // PXE_ROMID_SIGNATURE\r
+ PXE_UINT8 Len; // sizeof(PXE_HW_UNDI)\r
+ PXE_UINT8 Fudge; // makes 8-bit cksum equal zero\r
+ PXE_UINT8 Rev; // PXE_ROMID_REV\r
+ PXE_UINT8 IFcnt; // physical connector count\r
+ PXE_UINT8 MajorVer; // PXE_ROMID_MAJORVER\r
+ PXE_UINT8 MinorVer; // PXE_ROMID_MINORVER\r
+ PXE_UINT16 reserved; // zero, not used\r
+ PXE_UINT32 Implementation; // implementation flags\r
+ // reserved // vendor use\r
+ // UINT32 Status; // status port\r
+ // UINT32 Command; // command port\r
+ // UINT64 CDBaddr; // CDB address port\r
+ //\r
+} PXE_HW_UNDI;\r
+\r
+//\r
+// Status port bit definitions\r
+//\r
+//\r
+// UNDI operation state\r
+//\r
+#define PXE_HWSTAT_STATE_MASK 0xC0000000\r
+#define PXE_HWSTAT_BUSY 0xC0000000\r
+#define PXE_HWSTAT_INITIALIZED 0x80000000\r
+#define PXE_HWSTAT_STARTED 0x40000000\r
+#define PXE_HWSTAT_STOPPED 0x00000000\r
+\r
+//\r
+// If set, last command failed\r
+//\r
+#define PXE_HWSTAT_COMMAND_FAILED 0x20000000\r
+\r
+//\r
+// If set, identifies enabled receive filters\r
+//\r
+#define PXE_HWSTAT_PROMISCUOUS_MULTICAST_RX_ENABLED 0x00001000\r
+#define PXE_HWSTAT_PROMISCUOUS_RX_ENABLED 0x00000800\r
+#define PXE_HWSTAT_BROADCAST_RX_ENABLED 0x00000400\r
+#define PXE_HWSTAT_MULTICAST_RX_ENABLED 0x00000200\r
+#define PXE_HWSTAT_UNICAST_RX_ENABLED 0x00000100\r
+\r
+//\r
+// If set, identifies enabled external interrupts\r
+//\r
+#define PXE_HWSTAT_SOFTWARE_INT_ENABLED 0x00000080\r
+#define PXE_HWSTAT_TX_COMPLETE_INT_ENABLED 0x00000040\r
+#define PXE_HWSTAT_PACKET_RX_INT_ENABLED 0x00000020\r
+#define PXE_HWSTAT_CMD_COMPLETE_INT_ENABLED 0x00000010\r
+\r
+//\r
+// If set, identifies pending interrupts\r
+//\r
+#define PXE_HWSTAT_SOFTWARE_INT_PENDING 0x00000008\r
+#define PXE_HWSTAT_TX_COMPLETE_INT_PENDING 0x00000004\r
+#define PXE_HWSTAT_PACKET_RX_INT_PENDING 0x00000002\r
+#define PXE_HWSTAT_CMD_COMPLETE_INT_PENDING 0x00000001\r
+\r
+//\r
+// Command port definitions\r
+//\r
+//\r
+// If set, CDB identified in CDBaddr port is given to UNDI.\r
+// If not set, other bits in this word will be processed.\r
+//\r
+#define PXE_HWCMD_ISSUE_COMMAND 0x80000000\r
+#define PXE_HWCMD_INTS_AND_FILTS 0x00000000\r
+\r
+//\r
+// Use these to enable/disable receive filters.\r
+//\r
+#define PXE_HWCMD_PROMISCUOUS_MULTICAST_RX_ENABLE 0x00001000\r
+#define PXE_HWCMD_PROMISCUOUS_RX_ENABLE 0x00000800\r
+#define PXE_HWCMD_BROADCAST_RX_ENABLE 0x00000400\r
+#define PXE_HWCMD_MULTICAST_RX_ENABLE 0x00000200\r
+#define PXE_HWCMD_UNICAST_RX_ENABLE 0x00000100\r
+\r
+//\r
+// Use these to enable/disable external interrupts\r
+//\r
+#define PXE_HWCMD_SOFTWARE_INT_ENABLE 0x00000080\r
+#define PXE_HWCMD_TX_COMPLETE_INT_ENABLE 0x00000040\r
+#define PXE_HWCMD_PACKET_RX_INT_ENABLE 0x00000020\r
+#define PXE_HWCMD_CMD_COMPLETE_INT_ENABLE 0x00000010\r
+\r
+//\r
+// Use these to clear pending external interrupts\r
+//\r
+#define PXE_HWCMD_CLEAR_SOFTWARE_INT 0x00000008\r
+#define PXE_HWCMD_CLEAR_TX_COMPLETE_INT 0x00000004\r
+#define PXE_HWCMD_CLEAR_PACKET_RX_INT 0x00000002\r
+#define PXE_HWCMD_CLEAR_CMD_COMPLETE_INT 0x00000001\r
+\r
+typedef struct s_pxe_sw_undi {\r
+ PXE_UINT32 Signature; // PXE_ROMID_SIGNATURE\r
+ PXE_UINT8 Len; // sizeof(PXE_SW_UNDI)\r
+ PXE_UINT8 Fudge; // makes 8-bit cksum zero\r
+ PXE_UINT8 Rev; // PXE_ROMID_REV\r
+ PXE_UINT8 IFcnt; // physical connector count\r
+ PXE_UINT8 MajorVer; // PXE_ROMID_MAJORVER\r
+ PXE_UINT8 MinorVer; // PXE_ROMID_MINORVER\r
+ PXE_UINT16 reserved1; // zero, not used\r
+ PXE_UINT32 Implementation; // Implementation flags\r
+ PXE_UINT64 EntryPoint; // API entry point\r
+ PXE_UINT8 reserved2[3]; // zero, not used\r
+ PXE_UINT8 BusCnt; // number of bustypes supported\r
+ PXE_UINT32 BusType[1]; // list of supported bustypes\r
+} PXE_SW_UNDI;\r
+\r
+typedef union u_pxe_undi {\r
+ PXE_HW_UNDI hw;\r
+ PXE_SW_UNDI sw;\r
+} PXE_UNDI;\r
+\r
+//\r
+// Signature of !PXE structure\r
+//\r
+#define PXE_ROMID_SIGNATURE PXE_BUSTYPE ('!', 'P', 'X', 'E')\r
+\r
+//\r
+// !PXE structure format revision\r
+//\r
+#define PXE_ROMID_REV 0x02\r
+\r
+//\r
+// UNDI command interface revision. These are the values that get sent\r
+// in option 94 (Client Network Interface Identifier) in the DHCP Discover\r
+// and PXE Boot Server Request packets.\r
+//\r
+#define PXE_ROMID_MAJORVER 0x03\r
+#define PXE_ROMID_MINORVER 0x01\r
+\r
+//\r
+// Implementation flags\r
+//\r
+#define PXE_ROMID_IMP_HW_UNDI 0x80000000\r
+#define PXE_ROMID_IMP_SW_VIRT_ADDR 0x40000000\r
+#define PXE_ROMID_IMP_64BIT_DEVICE 0x00010000\r
+#define PXE_ROMID_IMP_FRAG_SUPPORTED 0x00008000\r
+#define PXE_ROMID_IMP_CMD_LINK_SUPPORTED 0x00004000\r
+#define PXE_ROMID_IMP_CMD_QUEUE_SUPPORTED 0x00002000\r
+#define PXE_ROMID_IMP_MULTI_FRAME_SUPPORTED 0x00001000\r
+#define PXE_ROMID_IMP_NVDATA_SUPPORT_MASK 0x00000C00\r
+#define PXE_ROMID_IMP_NVDATA_BULK_WRITABLE 0x00000C00\r
+#define PXE_ROMID_IMP_NVDATA_SPARSE_WRITABLE 0x00000800\r
+#define PXE_ROMID_IMP_NVDATA_READ_ONLY 0x00000400\r
+#define PXE_ROMID_IMP_NVDATA_NOT_AVAILABLE 0x00000000\r
+#define PXE_ROMID_IMP_STATISTICS_SUPPORTED 0x00000200\r
+#define PXE_ROMID_IMP_STATION_ADDR_SETTABLE 0x00000100\r
+#define PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED 0x00000080\r
+#define PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED 0x00000040\r
+#define PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED 0x00000020\r
+#define PXE_ROMID_IMP_FILTERED_MULTICAST_RX_SUPPORTED 0x00000010\r
+#define PXE_ROMID_IMP_SOFTWARE_INT_SUPPORTED 0x00000008\r
+#define PXE_ROMID_IMP_TX_COMPLETE_INT_SUPPORTED 0x00000004\r
+#define PXE_ROMID_IMP_PACKET_RX_INT_SUPPORTED 0x00000002\r
+#define PXE_ROMID_IMP_CMD_COMPLETE_INT_SUPPORTED 0x00000001\r
+\r
+typedef struct s_pxe_cdb {\r
+ PXE_OPCODE OpCode;\r
+ PXE_OPFLAGS OpFlags;\r
+ PXE_UINT16 CPBsize;\r
+ PXE_UINT16 DBsize;\r
+ PXE_UINT64 CPBaddr;\r
+ PXE_UINT64 DBaddr;\r
+ PXE_STATCODE StatCode;\r
+ PXE_STATFLAGS StatFlags;\r
+ PXE_UINT16 IFnum;\r
+ PXE_CONTROL Control;\r
+} PXE_CDB;\r
+\r
+typedef union u_pxe_ip_addr {\r
+ PXE_IPV6 IPv6;\r
+ PXE_IPV4 IPv4;\r
+} PXE_IP_ADDR;\r
+\r
+typedef union pxe_device {\r
+ //\r
+ // PCI and PC Card NICs are both identified using bus, device\r
+ // and function numbers. For PC Card, this may require PC\r
+ // Card services to be loaded in the BIOS or preboot\r
+ // environment.\r
+ //\r
+ struct {\r
+ //\r
+ // See S/W UNDI ROMID structure definition for PCI and\r
+ // PCC BusType definitions.\r
+ //\r
+ PXE_UINT32 BusType;\r
+\r
+ //\r
+ // Bus, device & function numbers that locate this device.\r
+ //\r
+ PXE_UINT16 Bus;\r
+ PXE_UINT8 Device;\r
+ PXE_UINT8 Function;\r
+ }\r
+ PCI, PCC;\r
+\r
+ //\r
+ // %%TBD - More information is needed about enumerating\r
+ // USB and 1394 devices.\r
+ //\r
+ struct {\r
+ PXE_UINT32 BusType;\r
+ PXE_UINT32 tdb;\r
+ }\r
+ USB, _1394;\r
+} PXE_DEVICE;\r
+\r
+//\r
+// cpb and db definitions\r
+//\r
+#define MAX_PCI_CONFIG_LEN 64 // # of dwords\r
+#define MAX_EEPROM_LEN 128 // #of dwords\r
+#define MAX_XMIT_BUFFERS 32 // recycling Q length for xmit_done\r
+#define MAX_MCAST_ADDRESS_CNT 8\r
+\r
+typedef struct s_pxe_cpb_start_30 {\r
+ //\r
+ // PXE_VOID Delay(UINTN microseconds);\r
+ //\r
+ // UNDI will never request a delay smaller than 10 microseconds\r
+ // and will always request delays in increments of 10 microseconds.\r
+ // The Delay() CallBack routine must delay between n and n + 10\r
+ // microseconds before returning control to the UNDI.\r
+ //\r
+ // This field cannot be set to zero.\r
+ //\r
+ UINT64 Delay;\r
+\r
+ //\r
+ // PXE_VOID Block(UINT32 enable);\r
+ //\r
+ // UNDI may need to block multi-threaded/multi-processor access to\r
+ // critical code sections when programming or accessing the network\r
+ // device. To this end, a blocking service is needed by the UNDI.\r
+ // When UNDI needs a block, it will call Block() passing a non-zero\r
+ // value. When UNDI no longer needs a block, it will call Block()\r
+ // with a zero value. When called, if the Block() is already enabled,\r
+ // do not return control to the UNDI until the previous Block() is\r
+ // disabled.\r
+ //\r
+ // This field cannot be set to zero.\r
+ //\r
+ UINT64 Block;\r
+\r
+ //\r
+ // PXE_VOID Virt2Phys(UINT64 virtual, UINT64 physical_ptr);\r
+ //\r
+ // UNDI will pass the virtual address of a buffer and the virtual\r
+ // address of a 64-bit physical buffer. Convert the virtual address\r
+ // to a physical address and write the result to the physical address\r
+ // buffer. If virtual and physical addresses are the same, just\r
+ // copy the virtual address to the physical address buffer.\r
+ //\r
+ // This field can be set to zero if virtual and physical addresses\r
+ // are equal.\r
+ //\r
+ UINT64 Virt2Phys;\r
+ //\r
+ // PXE_VOID Mem_IO(UINT8 read_write, UINT8 len, UINT64 port,\r
+ // UINT64 buf_addr);\r
+ //\r
+ // UNDI will read or write the device io space using this call back\r
+ // function. It passes the number of bytes as the len parameter and it\r
+ // will be either 1,2,4 or 8.\r
+ //\r
+ // This field can not be set to zero.\r
+ //\r
+ UINT64 Mem_IO;\r
+} PXE_CPB_START_30;\r
+\r
+typedef struct s_pxe_cpb_start_31 {\r
+ //\r
+ // PXE_VOID Delay(UINT64 UnqId, UINTN microseconds);\r
+ //\r
+ // UNDI will never request a delay smaller than 10 microseconds\r
+ // and will always request delays in increments of 10 microseconds.\r
+ // The Delay() CallBack routine must delay between n and n + 10\r
+ // microseconds before returning control to the UNDI.\r
+ //\r
+ // This field cannot be set to zero.\r
+ //\r
+ UINT64 Delay;\r
+\r
+ //\r
+ // PXE_VOID Block(UINT64 unq_id, UINT32 enable);\r
+ //\r
+ // UNDI may need to block multi-threaded/multi-processor access to\r
+ // critical code sections when programming or accessing the network\r
+ // device. To this end, a blocking service is needed by the UNDI.\r
+ // When UNDI needs a block, it will call Block() passing a non-zero\r
+ // value. When UNDI no longer needs a block, it will call Block()\r
+ // with a zero value. When called, if the Block() is already enabled,\r
+ // do not return control to the UNDI until the previous Block() is\r
+ // disabled.\r
+ //\r
+ // This field cannot be set to zero.\r
+ //\r
+ UINT64 Block;\r
+\r
+ //\r
+ // PXE_VOID Virt2Phys(UINT64 UnqId, UINT64 virtual, UINT64 physical_ptr);\r
+ //\r
+ // UNDI will pass the virtual address of a buffer and the virtual\r
+ // address of a 64-bit physical buffer. Convert the virtual address\r
+ // to a physical address and write the result to the physical address\r
+ // buffer. If virtual and physical addresses are the same, just\r
+ // copy the virtual address to the physical address buffer.\r
+ //\r
+ // This field can be set to zero if virtual and physical addresses\r
+ // are equal.\r
+ //\r
+ UINT64 Virt2Phys;\r
+ //\r
+ // PXE_VOID Mem_IO(UINT64 UnqId, UINT8 read_write, UINT8 len, UINT64 port,\r
+ // UINT64 buf_addr);\r
+ //\r
+ // UNDI will read or write the device io space using this call back\r
+ // function. It passes the number of bytes as the len parameter and it\r
+ // will be either 1,2,4 or 8.\r
+ //\r
+ // This field can not be set to zero.\r
+ //\r
+ UINT64 Mem_IO;\r
+ //\r
+ // PXE_VOID Map_Mem(UINT64 unq_id, UINT64 virtual_addr, UINT32 size,\r
+ // UINT32 Direction, UINT64 mapped_addr);\r
+ //\r
+ // UNDI will pass the virtual address of a buffer, direction of the data\r
+ // flow from/to the mapped buffer (the constants are defined below)\r
+ // and a place holder (pointer) for the mapped address.\r
+ // This call will Map the given address to a physical DMA address and write\r
+ // the result to the mapped_addr pointer. If there is no need to\r
+ // map the given address to a lower address (i.e. the given address is\r
+ // associated with a physical address that is already compatible to be\r
+ // used with the DMA, it converts the given virtual address to it's\r
+ // physical address and write that in the mapped address pointer.\r
+ //\r
+ // This field can be set to zero if there is no mapping service available\r
+ //\r
+ UINT64 Map_Mem;\r
+\r
+ //\r
+ // PXE_VOID UnMap_Mem(UINT64 unq_id, UINT64 virtual_addr, UINT32 size,\r
+ // UINT32 Direction, UINT64 mapped_addr);\r
+ //\r
+ // UNDI will pass the virtual and mapped addresses of a buffer\r
+ // This call will un map the given address\r
+ //\r
+ // This field can be set to zero if there is no unmapping service available\r
+ //\r
+ UINT64 UnMap_Mem;\r
+\r
+ //\r
+ // PXE_VOID Sync_Mem(UINT64 unq_id, UINT64 virtual,\r
+ // UINT32 size, UINT32 Direction, UINT64 mapped_addr);\r
+ //\r
+ // UNDI will pass the virtual and mapped addresses of a buffer\r
+ // This call will synchronize the contents of both the virtual and mapped\r
+ // buffers for the given Direction.\r
+ //\r
+ // This field can be set to zero if there is no service available\r
+ //\r
+ UINT64 Sync_Mem;\r
+\r
+ //\r
+ // protocol driver can provide anything for this Unique_ID, UNDI remembers\r
+ // that as just a 64bit value assocaited to the interface specified by\r
+ // the ifnum and gives it back as a parameter to all the call-back routines\r
+ // when calling for that interface!\r
+ //\r
+ UINT64 Unique_ID;\r
+ //\r
+} PXE_CPB_START_31;\r
+\r
+#define TO_AND_FROM_DEVICE 0\r
+#define FROM_DEVICE 1\r
+#define TO_DEVICE 2\r
+\r
+#define PXE_DELAY_MILLISECOND 1000\r
+#define PXE_DELAY_SECOND 1000000\r
+#define PXE_IO_READ 0\r
+#define PXE_IO_WRITE 1\r
+#define PXE_MEM_READ 2\r
+#define PXE_MEM_WRITE 4\r
+\r
+typedef struct s_pxe_db_get_init_info {\r
+ //\r
+ // Minimum length of locked memory buffer that must be given to\r
+ // the Initialize command. Giving UNDI more memory will generally\r
+ // give better performance.\r
+ //\r
+ // If MemoryRequired is zero, the UNDI does not need and will not\r
+ // use system memory to receive and transmit packets.\r
+ //\r
+ PXE_UINT32 MemoryRequired;\r
+\r
+ //\r
+ // Maximum frame data length for Tx/Rx excluding the media header.\r
+ //\r
+ PXE_UINT32 FrameDataLen;\r
+\r
+ //\r
+ // Supported link speeds are in units of mega bits. Common ethernet\r
+ // values are 10, 100 and 1000. Unused LinkSpeeds[] entries are zero\r
+ // filled.\r
+ //\r
+ PXE_UINT32 LinkSpeeds[4];\r
+\r
+ //\r
+ // Number of non-volatile storage items.\r
+ //\r
+ PXE_UINT32 NvCount;\r
+\r
+ //\r
+ // Width of non-volatile storage item in bytes. 0, 1, 2 or 4\r
+ //\r
+ PXE_UINT16 NvWidth;\r
+\r
+ //\r
+ // Media header length. This is the typical media header length for\r
+ // this UNDI. This information is needed when allocating receive\r
+ // and transmit buffers.\r
+ //\r
+ PXE_UINT16 MediaHeaderLen;\r
+\r
+ //\r
+ // Number of bytes in the NIC hardware (MAC) address.\r
+ //\r
+ PXE_UINT16 HWaddrLen;\r
+\r
+ //\r
+ // Maximum number of multicast MAC addresses in the multicast\r
+ // MAC address filter list.\r
+ //\r
+ PXE_UINT16 MCastFilterCnt;\r
+\r
+ //\r
+ // Default number and size of transmit and receive buffers that will\r
+ // be allocated by the UNDI. If MemoryRequired is non-zero, this\r
+ // allocation will come out of the memory buffer given to the Initialize\r
+ // command. If MemoryRequired is zero, this allocation will come out of\r
+ // memory on the NIC.\r
+ //\r
+ PXE_UINT16 TxBufCnt;\r
+ PXE_UINT16 TxBufSize;\r
+ PXE_UINT16 RxBufCnt;\r
+ PXE_UINT16 RxBufSize;\r
+\r
+ //\r
+ // Hardware interface types defined in the Assigned Numbers RFC\r
+ // and used in DHCP and ARP packets.\r
+ // See the PXE_IFTYPE typedef and PXE_IFTYPE_xxx macros.\r
+ //\r
+ PXE_UINT8 IFtype;\r
+\r
+ //\r
+ // Supported duplex. See PXE_DUPLEX_xxxxx #defines below.\r
+ //\r
+ PXE_UINT8 SupportedDuplexModes;\r
+\r
+ //\r
+ // Supported loopback options. See PXE_LOOPBACK_xxxxx #defines below.\r
+ //\r
+ PXE_UINT8 SupportedLoopBackModes;\r
+} PXE_DB_GET_INIT_INFO;\r
+\r
+#define PXE_MAX_TXRX_UNIT_ETHER 1500\r
+\r
+#define PXE_HWADDR_LEN_ETHER 0x0006\r
+#define PXE_MAC_HEADER_LEN_ETHER 0x000E\r
+\r
+#define PXE_DUPLEX_ENABLE_FULL_SUPPORTED 1\r
+#define PXE_DUPLEX_FORCE_FULL_SUPPORTED 2\r
+\r
+#define PXE_LOOPBACK_INTERNAL_SUPPORTED 1\r
+#define PXE_LOOPBACK_EXTERNAL_SUPPORTED 2\r
+\r
+typedef struct s_pxe_pci_config_info {\r
+ //\r
+ // This is the flag field for the PXE_DB_GET_CONFIG_INFO union.\r
+ // For PCI bus devices, this field is set to PXE_BUSTYPE_PCI.\r
+ //\r
+ UINT32 BusType;\r
+\r
+ //\r
+ // This identifies the PCI network device that this UNDI interface\r
+ // is bound to.\r
+ //\r
+ UINT16 Bus;\r
+ UINT8 Device;\r
+ UINT8 Function;\r
+\r
+ //\r
+ // This is a copy of the PCI configuration space for this\r
+ // network device.\r
+ //\r
+ union {\r
+ UINT8 Byte[256];\r
+ UINT16 Word[128];\r
+ UINT32 Dword[64];\r
+ } Config;\r
+} PXE_PCI_CONFIG_INFO;\r
+\r
+typedef struct s_pxe_pcc_config_info {\r
+ //\r
+ // This is the flag field for the PXE_DB_GET_CONFIG_INFO union.\r
+ // For PCC bus devices, this field is set to PXE_BUSTYPE_PCC.\r
+ //\r
+ PXE_UINT32 BusType;\r
+\r
+ //\r
+ // This identifies the PCC network device that this UNDI interface\r
+ // is bound to.\r
+ //\r
+ PXE_UINT16 Bus;\r
+ PXE_UINT8 Device;\r
+ PXE_UINT8 Function;\r
+\r
+ //\r
+ // This is a copy of the PCC configuration space for this\r
+ // network device.\r
+ //\r
+ union {\r
+ PXE_UINT8 Byte[256];\r
+ PXE_UINT16 Word[128];\r
+ PXE_UINT32 Dword[64];\r
+ } Config;\r
+} PXE_PCC_CONFIG_INFO;\r
+\r
+typedef union u_pxe_db_get_config_info {\r
+ PXE_PCI_CONFIG_INFO pci;\r
+ PXE_PCC_CONFIG_INFO pcc;\r
+} PXE_DB_GET_CONFIG_INFO;\r
+\r
+typedef struct s_pxe_cpb_initialize {\r
+ //\r
+ // Address of first (lowest) byte of the memory buffer. This buffer must\r
+ // be in contiguous physical memory and cannot be swapped out. The UNDI\r
+ // will be using this for transmit and receive buffering.\r
+ //\r
+ PXE_UINT64 MemoryAddr;\r
+\r
+ //\r
+ // MemoryLength must be greater than or equal to MemoryRequired\r
+ // returned by the Get Init Info command.\r
+ //\r
+ PXE_UINT32 MemoryLength;\r
+\r
+ //\r
+ // Desired link speed in Mbit/sec. Common ethernet values are 10, 100\r
+ // and 1000. Setting a value of zero will auto-detect and/or use the\r
+ // default link speed (operation depends on UNDI/NIC functionality).\r
+ //\r
+ PXE_UINT32 LinkSpeed;\r
+\r
+ //\r
+ // Suggested number and size of receive and transmit buffers to\r
+ // allocate. If MemoryAddr and MemoryLength are non-zero, this\r
+ // allocation comes out of the supplied memory buffer. If MemoryAddr\r
+ // and MemoryLength are zero, this allocation comes out of memory\r
+ // on the NIC.\r
+ //\r
+ // If these fields are set to zero, the UNDI will allocate buffer\r
+ // counts and sizes as it sees fit.\r
+ //\r
+ PXE_UINT16 TxBufCnt;\r
+ PXE_UINT16 TxBufSize;\r
+ PXE_UINT16 RxBufCnt;\r
+ PXE_UINT16 RxBufSize;\r
+\r
+ //\r
+ // The following configuration parameters are optional and must be zero\r
+ // to use the default values.\r
+ //\r
+ PXE_UINT8 DuplexMode;\r
+\r
+ PXE_UINT8 LoopBackMode;\r
+} PXE_CPB_INITIALIZE;\r
+\r
+#define PXE_DUPLEX_DEFAULT 0x00\r
+#define PXE_FORCE_FULL_DUPLEX 0x01\r
+#define PXE_ENABLE_FULL_DUPLEX 0x02\r
+#define PXE_FORCE_HALF_DUPLEX 0x04\r
+#define PXE_DISABLE_FULL_DUPLEX 0x08\r
+\r
+#define LOOPBACK_NORMAL 0\r
+#define LOOPBACK_INTERNAL 1\r
+#define LOOPBACK_EXTERNAL 2\r
+\r
+typedef struct s_pxe_db_initialize {\r
+ //\r
+ // Actual amount of memory used from the supplied memory buffer. This\r
+ // may be less that the amount of memory suppllied and may be zero if\r
+ // the UNDI and network device do not use external memory buffers.\r
+ //\r
+ // Memory used by the UNDI and network device is allocated from the\r
+ // lowest memory buffer address.\r
+ //\r
+ PXE_UINT32 MemoryUsed;\r
+\r
+ //\r
+ // Actual number and size of receive and transmit buffers that were\r
+ // allocated.\r
+ //\r
+ PXE_UINT16 TxBufCnt;\r
+ PXE_UINT16 TxBufSize;\r
+ PXE_UINT16 RxBufCnt;\r
+ PXE_UINT16 RxBufSize;\r
+} PXE_DB_INITIALIZE;\r
+\r
+typedef struct s_pxe_cpb_receive_filters {\r
+ //\r
+ // List of multicast MAC addresses. This list, if present, will\r
+ // replace the existing multicast MAC address filter list.\r
+ //\r
+ PXE_MAC_ADDR MCastList[MAX_MCAST_ADDRESS_CNT];\r
+} PXE_CPB_RECEIVE_FILTERS;\r
+\r
+typedef struct s_pxe_db_receive_filters {\r
+ //\r
+ // Filtered multicast MAC address list.\r
+ //\r
+ PXE_MAC_ADDR MCastList[MAX_MCAST_ADDRESS_CNT];\r
+} PXE_DB_RECEIVE_FILTERS;\r
+\r
+typedef struct s_pxe_cpb_station_address {\r
+ //\r
+ // If supplied and supported, the current station MAC address\r
+ // will be changed.\r
+ //\r
+ PXE_MAC_ADDR StationAddr;\r
+} PXE_CPB_STATION_ADDRESS;\r
+\r
+typedef struct s_pxe_dpb_station_address {\r
+ //\r
+ // Current station MAC address.\r
+ //\r
+ PXE_MAC_ADDR StationAddr;\r
+\r
+ //\r
+ // Station broadcast MAC address.\r
+ //\r
+ PXE_MAC_ADDR BroadcastAddr;\r
+\r
+ //\r
+ // Permanent station MAC address.\r
+ //\r
+ PXE_MAC_ADDR PermanentAddr;\r
+} PXE_DB_STATION_ADDRESS;\r
+\r
+typedef struct s_pxe_db_statistics {\r
+ //\r
+ // Bit field identifying what statistic data is collected by the\r
+ // UNDI/NIC.\r
+ // If bit 0x00 is set, Data[0x00] is collected.\r
+ // If bit 0x01 is set, Data[0x01] is collected.\r
+ // If bit 0x20 is set, Data[0x20] is collected.\r
+ // If bit 0x21 is set, Data[0x21] is collected.\r
+ // Etc.\r
+ //\r
+ PXE_UINT64 Supported;\r
+\r
+ //\r
+ // Statistic data.\r
+ //\r
+ PXE_UINT64 Data[64];\r
+} PXE_DB_STATISTICS;\r
+\r
+//\r
+// Total number of frames received. Includes frames with errors and\r
+// dropped frames.\r
+//\r
+#define PXE_STATISTICS_RX_TOTAL_FRAMES 0x00\r
+\r
+//\r
+// Number of valid frames received and copied into receive buffers.\r
+//\r
+#define PXE_STATISTICS_RX_GOOD_FRAMES 0x01\r
+\r
+//\r
+// Number of frames below the minimum length for the media.\r
+// This would be <64 for ethernet.\r
+//\r
+#define PXE_STATISTICS_RX_UNDERSIZE_FRAMES 0x02\r
+\r
+//\r
+// Number of frames longer than the maxminum length for the\r
+// media. This would be >1500 for ethernet.\r
+//\r
+#define PXE_STATISTICS_RX_OVERSIZE_FRAMES 0x03\r
+\r
+//\r
+// Valid frames that were dropped because receive buffers were full.\r
+//\r
+#define PXE_STATISTICS_RX_DROPPED_FRAMES 0x04\r
+\r
+//\r
+// Number of valid unicast frames received and not dropped.\r
+//\r
+#define PXE_STATISTICS_RX_UNICAST_FRAMES 0x05\r
+\r
+//\r
+// Number of valid broadcast frames received and not dropped.\r
+//\r
+#define PXE_STATISTICS_RX_BROADCAST_FRAMES 0x06\r
+\r
+//\r
+// Number of valid mutlicast frames received and not dropped.\r
+//\r
+#define PXE_STATISTICS_RX_MULTICAST_FRAMES 0x07\r
+\r
+//\r
+// Number of frames w/ CRC or alignment errors.\r
+//\r
+#define PXE_STATISTICS_RX_CRC_ERROR_FRAMES 0x08\r
+\r
+//\r
+// Total number of bytes received. Includes frames with errors\r
+// and dropped frames.\r
+//\r
+#define PXE_STATISTICS_RX_TOTAL_BYTES 0x09\r
+\r
+//\r
+// Transmit statistics.\r
+//\r
+#define PXE_STATISTICS_TX_TOTAL_FRAMES 0x0A\r
+#define PXE_STATISTICS_TX_GOOD_FRAMES 0x0B\r
+#define PXE_STATISTICS_TX_UNDERSIZE_FRAMES 0x0C\r
+#define PXE_STATISTICS_TX_OVERSIZE_FRAMES 0x0D\r
+#define PXE_STATISTICS_TX_DROPPED_FRAMES 0x0E\r
+#define PXE_STATISTICS_TX_UNICAST_FRAMES 0x0F\r
+#define PXE_STATISTICS_TX_BROADCAST_FRAMES 0x10\r
+#define PXE_STATISTICS_TX_MULTICAST_FRAMES 0x11\r
+#define PXE_STATISTICS_TX_CRC_ERROR_FRAMES 0x12\r
+#define PXE_STATISTICS_TX_TOTAL_BYTES 0x13\r
+\r
+//\r
+// Number of collisions detection on this subnet.\r
+//\r
+#define PXE_STATISTICS_COLLISIONS 0x14\r
+\r
+//\r
+// Number of frames destined for unsupported protocol.\r
+//\r
+#define PXE_STATISTICS_UNSUPPORTED_PROTOCOL 0x15\r
+\r
+typedef struct s_pxe_cpb_mcast_ip_to_mac {\r
+ //\r
+ // Multicast IP address to be converted to multicast MAC address.\r
+ //\r
+ PXE_IP_ADDR IP;\r
+} PXE_CPB_MCAST_IP_TO_MAC;\r
+\r
+typedef struct s_pxe_db_mcast_ip_to_mac {\r
+ //\r
+ // Multicast MAC address.\r
+ //\r
+ PXE_MAC_ADDR MAC;\r
+} PXE_DB_MCAST_IP_TO_MAC;\r
+\r
+typedef struct s_pxe_cpb_nvdata_sparse {\r
+ //\r
+ // NvData item list. Only items in this list will be updated.\r
+ //\r
+ struct {\r
+ //\r
+ // Non-volatile storage address to be changed.\r
+ //\r
+ PXE_UINT32 Addr;\r
+\r
+ //\r
+ // Data item to write into above storage address.\r
+ //\r
+ union {\r
+ PXE_UINT8 Byte;\r
+ PXE_UINT16 Word;\r
+ PXE_UINT32 Dword;\r
+ } Data;\r
+ } Item[MAX_EEPROM_LEN];\r
+}\r
+PXE_CPB_NVDATA_SPARSE;\r
+\r
+//\r
+// When using bulk update, the size of the CPB structure must be\r
+// the same size as the non-volatile NIC storage.\r
+//\r
+typedef union u_pxe_cpb_nvdata_bulk {\r
+ //\r
+ // Array of byte-wide data items.\r
+ //\r
+ PXE_UINT8 Byte[MAX_EEPROM_LEN << 2];\r
+\r
+ //\r
+ // Array of word-wide data items.\r
+ //\r
+ PXE_UINT16 Word[MAX_EEPROM_LEN << 1];\r
+\r
+ //\r
+ // Array of dword-wide data items.\r
+ //\r
+ PXE_UINT32 Dword[MAX_EEPROM_LEN];\r
+} PXE_CPB_NVDATA_BULK;\r
+\r
+typedef struct s_pxe_db_nvdata {\r
+ //\r
+ // Arrays of data items from non-volatile storage.\r
+ //\r
+ union {\r
+ //\r
+ // Array of byte-wide data items.\r
+ //\r
+ PXE_UINT8 Byte[MAX_EEPROM_LEN << 2];\r
+\r
+ //\r
+ // Array of word-wide data items.\r
+ //\r
+ PXE_UINT16 Word[MAX_EEPROM_LEN << 1];\r
+\r
+ //\r
+ // Array of dword-wide data items.\r
+ //\r
+ PXE_UINT32 Dword[MAX_EEPROM_LEN];\r
+ } Data;\r
+} PXE_DB_NVDATA;\r
+\r
+typedef struct s_pxe_db_get_status {\r
+ //\r
+ // Length of next receive frame (header + data). If this is zero,\r
+ // there is no next receive frame available.\r
+ //\r
+ PXE_UINT32 RxFrameLen;\r
+\r
+ //\r
+ // Reserved, set to zero.\r
+ //\r
+ PXE_UINT32 reserved;\r
+\r
+ //\r
+ // Addresses of transmitted buffers that need to be recycled.\r
+ //\r
+ PXE_UINT64 TxBuffer[MAX_XMIT_BUFFERS];\r
+} PXE_DB_GET_STATUS;\r
+\r
+typedef struct s_pxe_cpb_fill_header {\r
+ //\r
+ // Source and destination MAC addresses. These will be copied into\r
+ // the media header without doing byte swapping.\r
+ //\r
+ PXE_MAC_ADDR SrcAddr;\r
+ PXE_MAC_ADDR DestAddr;\r
+\r
+ //\r
+ // Address of first byte of media header. The first byte of packet data\r
+ // follows the last byte of the media header.\r
+ //\r
+ PXE_UINT64 MediaHeader;\r
+\r
+ //\r
+ // Length of packet data in bytes (not including the media header).\r
+ //\r
+ PXE_UINT32 PacketLen;\r
+\r
+ //\r
+ // Protocol type. This will be copied into the media header without\r
+ // doing byte swapping. Protocol type numbers can be obtained from\r
+ // the Assigned Numbers RFC 1700.\r
+ //\r
+ PXE_UINT16 Protocol;\r
+\r
+ //\r
+ // Length of the media header in bytes.\r
+ //\r
+ PXE_UINT16 MediaHeaderLen;\r
+} PXE_CPB_FILL_HEADER;\r
+\r
+#define PXE_PROTOCOL_ETHERNET_IP 0x0800\r
+#define PXE_PROTOCOL_ETHERNET_ARP 0x0806\r
+#define MAX_XMIT_FRAGMENTS 16\r
+\r
+typedef struct s_pxe_cpb_fill_header_fragmented {\r
+ //\r
+ // Source and destination MAC addresses. These will be copied into\r
+ // the media header without doing byte swapping.\r
+ //\r
+ PXE_MAC_ADDR SrcAddr;\r
+ PXE_MAC_ADDR DestAddr;\r
+\r
+ //\r
+ // Length of packet data in bytes (not including the media header).\r
+ //\r
+ PXE_UINT32 PacketLen;\r
+\r
+ //\r
+ // Protocol type. This will be copied into the media header without\r
+ // doing byte swapping. Protocol type numbers can be obtained from\r
+ // the Assigned Numbers RFC 1700.\r
+ //\r
+ PXE_MEDIA_PROTOCOL Protocol;\r
+\r
+ //\r
+ // Length of the media header in bytes.\r
+ //\r
+ PXE_UINT16 MediaHeaderLen;\r
+\r
+ //\r
+ // Number of packet fragment descriptors.\r
+ //\r
+ PXE_UINT16 FragCnt;\r
+\r
+ //\r
+ // Reserved, must be set to zero.\r
+ //\r
+ PXE_UINT16 reserved;\r
+\r
+ //\r
+ // Array of packet fragment descriptors. The first byte of the media\r
+ // header is the first byte of the first fragment.\r
+ //\r
+ struct {\r
+ //\r
+ // Address of this packet fragment.\r
+ //\r
+ PXE_UINT64 FragAddr;\r
+\r
+ //\r
+ // Length of this packet fragment.\r
+ //\r
+ PXE_UINT32 FragLen;\r
+\r
+ //\r
+ // Reserved, must be set to zero.\r
+ //\r
+ PXE_UINT32 reserved;\r
+ } FragDesc[MAX_XMIT_FRAGMENTS];\r
+}\r
+PXE_CPB_FILL_HEADER_FRAGMENTED;\r
+\r
+typedef struct s_pxe_cpb_transmit {\r
+ //\r
+ // Address of first byte of frame buffer. This is also the first byte\r
+ // of the media header.\r
+ //\r
+ PXE_UINT64 FrameAddr;\r
+\r
+ //\r
+ // Length of the data portion of the frame buffer in bytes. Do not\r
+ // include the length of the media header.\r
+ //\r
+ PXE_UINT32 DataLen;\r
+\r
+ //\r
+ // Length of the media header in bytes.\r
+ //\r
+ PXE_UINT16 MediaheaderLen;\r
+\r
+ //\r
+ // Reserved, must be zero.\r
+ //\r
+ PXE_UINT16 reserved;\r
+} PXE_CPB_TRANSMIT;\r
+\r
+typedef struct s_pxe_cpb_transmit_fragments {\r
+ //\r
+ // Length of packet data in bytes (not including the media header).\r
+ //\r
+ PXE_UINT32 FrameLen;\r
+\r
+ //\r
+ // Length of the media header in bytes.\r
+ //\r
+ PXE_UINT16 MediaheaderLen;\r
+\r
+ //\r
+ // Number of packet fragment descriptors.\r
+ //\r
+ PXE_UINT16 FragCnt;\r
+\r
+ //\r
+ // Array of frame fragment descriptors. The first byte of the first\r
+ // fragment is also the first byte of the media header.\r
+ //\r
+ struct {\r
+ //\r
+ // Address of this frame fragment.\r
+ //\r
+ PXE_UINT64 FragAddr;\r
+\r
+ //\r
+ // Length of this frame fragment.\r
+ //\r
+ PXE_UINT32 FragLen;\r
+\r
+ //\r
+ // Reserved, must be set to zero.\r
+ //\r
+ PXE_UINT32 reserved;\r
+ } FragDesc[MAX_XMIT_FRAGMENTS];\r
+}\r
+PXE_CPB_TRANSMIT_FRAGMENTS;\r
+\r
+typedef struct s_pxe_cpb_receive {\r
+ //\r
+ // Address of first byte of receive buffer. This is also the first byte\r
+ // of the frame header.\r
+ //\r
+ PXE_UINT64 BufferAddr;\r
+\r
+ //\r
+ // Length of receive buffer. This must be large enough to hold the\r
+ // received frame (media header + data). If the length of smaller than\r
+ // the received frame, data will be lost.\r
+ //\r
+ PXE_UINT32 BufferLen;\r
+\r
+ //\r
+ // Reserved, must be set to zero.\r
+ //\r
+ PXE_UINT32 reserved;\r
+} PXE_CPB_RECEIVE;\r
+\r
+typedef struct s_pxe_db_receive {\r
+ //\r
+ // Source and destination MAC addresses from media header.\r
+ //\r
+ PXE_MAC_ADDR SrcAddr;\r
+ PXE_MAC_ADDR DestAddr;\r
+\r
+ //\r
+ // Length of received frame. May be larger than receive buffer size.\r
+ // The receive buffer will not be overwritten. This is how to tell\r
+ // if data was lost because the receive buffer was too small.\r
+ //\r
+ PXE_UINT32 FrameLen;\r
+\r
+ //\r
+ // Protocol type from media header.\r
+ //\r
+ PXE_MEDIA_PROTOCOL Protocol;\r
+\r
+ //\r
+ // Length of media header in received frame.\r
+ //\r
+ PXE_UINT16 MediaHeaderLen;\r
+\r
+ //\r
+ // Type of receive frame.\r
+ //\r
+ PXE_FRAME_TYPE Type;\r
+\r
+ //\r
+ // Reserved, must be zero.\r
+ //\r
+ PXE_UINT8 reserved[7];\r
+\r
+} PXE_DB_RECEIVE;\r
+\r
+//\r
+// Packet definitions\r
+//\r
+typedef struct {\r
+ UINT8 BootpOpcode;\r
+ UINT8 BootpHwType;\r
+ UINT8 BootpHwAddrLen;\r
+ UINT8 BootpGateHops;\r
+ UINT32 BootpIdent;\r
+ UINT16 BootpSeconds;\r
+ UINT16 BootpFlags;\r
+ UINT8 BootpCiAddr[4];\r
+ UINT8 BootpYiAddr[4];\r
+ UINT8 BootpSiAddr[4];\r
+ UINT8 BootpGiAddr[4];\r
+ UINT8 BootpHwAddr[16];\r
+ UINT8 BootpSrvName[64];\r
+ UINT8 BootpBootFile[128];\r
+ UINT32 DhcpMagik;\r
+ UINT8 DhcpOptions[56];\r
+} EFI_PXE_BASE_CODE_DHCPV4_PACKET;\r
+\r
+typedef union {\r
+ UINT8 Raw[1472];\r
+ EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4;\r
+\r
+ //\r
+ // EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6;\r
+ //\r
+} EFI_PXE_BASE_CODE_PACKET;\r
+\r
+\r
+\r
+#pragma pack()\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Include file that supportes UEFI.\r
+\r
+ This include file must only contain things defined in the UEFI 2.0 specification.\r
+ If a code construct is defined in the UEFI 2.0 specification it must be included\r
+ by this include file.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation\r
+ All rights reserved. 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: UefiSpec.h\r
+\r
+**/\r
+\r
+#ifndef __UEFI_SPEC_H__\r
+#define __UEFI_SPEC_H__\r
+\r
+#include <Uefi/UefiMultiPhase.h>\r
+\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/SimpleTextIn.h>\r
+#include <Protocol/SimpleTextOut.h>\r
+\r
+//\r
+// Networking Definitions\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
+\r
+//\r
+// Enumeration of memory allocation.\r
+// \r
+typedef enum {\r
+ AllocateAnyPages,\r
+ AllocateMaxAddress,\r
+ AllocateAddress,\r
+ MaxAllocateType\r
+} EFI_ALLOCATE_TYPE;\r
+\r
+\r
+//\r
+// possible caching types for the memory range\r
+//\r
+#define EFI_MEMORY_UC 0x0000000000000001ULL\r
+#define EFI_MEMORY_WC 0x0000000000000002ULL\r
+#define EFI_MEMORY_WT 0x0000000000000004ULL\r
+#define EFI_MEMORY_WB 0x0000000000000008ULL\r
+#define EFI_MEMORY_UCE 0x0000000000000010ULL\r
+\r
+//\r
+// physical memory protection on range\r
+//\r
+#define EFI_MEMORY_WP 0x0000000000001000ULL\r
+#define EFI_MEMORY_RP 0x0000000000002000ULL\r
+#define EFI_MEMORY_XP 0x0000000000004000ULL\r
+\r
+//\r
+// range requires a runtime mapping\r
+//\r
+#define EFI_MEMORY_RUNTIME 0x8000000000000000ULL\r
+\r
+#define EFI_MEMORY_DESCRIPTOR_VERSION 1\r
+typedef struct {\r
+ UINT32 Type;\r
+ EFI_PHYSICAL_ADDRESS PhysicalStart;\r
+ EFI_VIRTUAL_ADDRESS VirtualStart;\r
+ UINT64 NumberOfPages;\r
+ UINT64 Attribute;\r
+} EFI_MEMORY_DESCRIPTOR;\r
+\r
+//\r
+// Build macros to find next EFI_MEMORY_DESCRIPTOR.\r
+// \r
+#define NextMemoryDescriptor(_Ptr, _Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))\r
+#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size) NextMemoryDescriptor (_Ptr, _Size)\r
+\r
+//\r
+// Declare forward referenced data structures\r
+//\r
+typedef struct _EFI_SYSTEM_TABLE EFI_SYSTEM_TABLE;\r
+\r
+/**\r
+ Allocates memory pages from the system.\r
+\r
+ @param Type The type of allocation to perform.\r
+ @param MemoryType The type of memory to allocate.\r
+ @param Pages The number of contiguous 4 KB pages to allocate.\r
+ @param Memory Pointer to a physical address. On input, the way in which the address is\r
+ used depends on the value of Type.\r
+\r
+ @retval EFI_SUCCESS The requested pages were allocated.\r
+ @retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or\r
+ AllocateMaxAddress or AllocateAddress.\r
+ 2) MemoryType is in the range\r
+ EfiMaxMemoryType..0x7FFFFFFF.\r
+ @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
+ @retval EFI_NOT_FOUND The requested pages could not be found.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ALLOCATE_PAGES) (\r
+ IN EFI_ALLOCATE_TYPE Type,\r
+ IN EFI_MEMORY_TYPE MemoryType,\r
+ IN UINTN Pages,\r
+ IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
+ );\r
+\r
+/**\r
+ Frees memory pages.\r
+\r
+ @param Memory The base physical address of the pages to be freed.\r
+ @param Pages The number of contiguous 4 KB pages to free.\r
+\r
+ @retval EFI_SUCCESS The requested pages were freed.\r
+ @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.\r
+ @retval EFI_NOT_FOUND The requested memory pages were not allocated with\r
+ AllocatePages().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FREE_PAGES) (\r
+ IN EFI_PHYSICAL_ADDRESS Memory,\r
+ IN UINTN Pages\r
+ );\r
+\r
+/**\r
+ Returns the current memory map.\r
+\r
+ @param MemoryMapSize A pointer to the size, in bytes, of the MemoryMap buffer.\r
+ @param MemoryMap A pointer to the buffer in which firmware places the current memory\r
+ map.\r
+ @param MapKey A pointer to the location in which firmware returns the key for the\r
+ current memory map.\r
+ @param DescriptorSize A pointer to the location in which firmware returns the size, in bytes, of\r
+ an individual EFI_MEMORY_DESCRIPTOR.\r
+ @param DescriptorVersion A pointer to the location in which firmware returns the version number\r
+ associated with the EFI_MEMORY_DESCRIPTOR.\r
+\r
+ @retval EFI_SUCCESS The memory map was returned in the MemoryMap buffer.\r
+ @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current buffer size\r
+ needed to hold the memory map is returned in MemoryMapSize.\r
+ @retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL.\r
+ 2) The MemoryMap buffer is not too small and MemoryMap is\r
+ NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_MEMORY_MAP) (\r
+ IN OUT UINTN *MemoryMapSize,\r
+ IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r
+ OUT UINTN *MapKey,\r
+ OUT UINTN *DescriptorSize,\r
+ OUT UINT32 *DescriptorVersion\r
+ );\r
+\r
+/**\r
+ Allocates pool memory.\r
+\r
+ @param PoolType The type of pool to allocate.\r
+ @param Size The number of bytes to allocate from the pool.\r
+ @param Buffer A pointer to a pointer to the allocated buffer if the call succeeds;\r
+ undefined otherwise.\r
+\r
+ @retval EFI_SUCCESS The requested number of bytes was allocated.\r
+ @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.\r
+ @retval EFI_INVALID_PARAMETER PoolType was invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ALLOCATE_POOL) (\r
+ IN EFI_MEMORY_TYPE PoolType,\r
+ IN UINTN Size,\r
+ OUT VOID **Buffer\r
+ );\r
+\r
+/**\r
+ Returns pool memory to the system.\r
+\r
+ @param Buffer Pointer to the buffer to free.\r
+\r
+ @retval EFI_SUCCESS The memory was returned to the system.\r
+ @retval EFI_INVALID_PARAMETER Buffer was invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FREE_POOL) (\r
+ IN VOID *Buffer\r
+ );\r
+\r
+/**\r
+ Changes the runtime addressing mode of EFI firmware from physical to virtual.\r
+\r
+ @param MemoryMapSize The size in bytes of VirtualMap.\r
+ @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
+ @param DescriptorVersion The version of the structure entries in VirtualMap.\r
+ @param VirtualMap An array of memory descriptors which contain new virtual\r
+ address mapping information for all runtime ranges.\r
+\r
+ @retval EFI_SUCCESS The virtual address map has been applied.\r
+ @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
+ virtual address mapped mode.\r
+ @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid.\r
+ @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
+ map that requires a mapping.\r
+ @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
+ in the memory map.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (\r
+ IN UINTN MemoryMapSize,\r
+ IN UINTN DescriptorSize,\r
+ IN UINT32 DescriptorVersion,\r
+ IN EFI_MEMORY_DESCRIPTOR *VirtualMap\r
+ );\r
+\r
+/**\r
+ Connects one or more drivers to a controller.\r
+\r
+ @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r
+ @param DriverImageHandle A pointer to an ordered list handles that support the\r
+ EFI_DRIVER_BINDING_PROTOCOL.\r
+ @param RemainingDevicePath A pointer to the device path that specifies a child of the\r
+ controller specified by ControllerHandle.\r
+ @param Recursive If TRUE, then ConnectController() is called recursively\r
+ until the entire tree of controllers below the controller specified\r
+ by ControllerHandle have been created. If FALSE, then\r
+ the tree of controllers is only expanded one level.\r
+\r
+ @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r
+ 2) No drivers were connected to ControllerHandle, but\r
+ RemainingDevicePath is not NULL, and it is an End Device\r
+ Path Node.\r
+ @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+ @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
+ present in the system.\r
+ 2) No drivers were connected to ControllerHandle.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CONNECT_CONTROLLER) (\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_HANDLE *DriverImageHandle, OPTIONAL\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath, OPTIONAL\r
+ IN BOOLEAN Recursive\r
+ );\r
+\r
+/**\r
+ Disconnects one or more drivers from a controller.\r
+\r
+ @param ControllerHandle The handle of the controller from which driver(s) are to be disconnected.\r
+ @param DriverImageHandle The driver to disconnect from ControllerHandle.\r
+ @param ChildHandle The handle of the child to destroy.\r
+\r
+ @retval EFI_SUCCESS 1) One or more drivers were disconnected from the controller.\r
+ 2) On entry, no drivers are managing ControllerHandle.\r
+ 3) DriverImageHandle is not NULL, and on entry\r
+ DriverImageHandle is not managing ControllerHandle.\r
+\r
+ @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources available to disconnect any drivers from\r
+ ControllerHandle.\r
+ @retval EFI_DEVICE_ERROR The controller could not be disconnected because of a device error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DISCONNECT_CONTROLLER) (\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_HANDLE DriverImageHandle, OPTIONAL\r
+ IN EFI_HANDLE ChildHandle OPTIONAL\r
+ );\r
+\r
+\r
+\r
+//\r
+// ConvertPointer DebugDisposition type.\r
+//\r
+#define EFI_OPTIONAL_PTR 0x00000001\r
+#define EFI_OPTIONAL_POINTER EFI_OPTIONAL_PTR\r
+\r
+/**\r
+ Determines the new virtual address that is to be used on subsequent memory accesses.\r
+\r
+ @param DebugDisposition Supplies type information for the pointer being converted.\r
+ @param Address A pointer to a pointer that is to be fixed to be the value needed\r
+ for the new virtual address mappings being applied.\r
+\r
+ @retval EFI_SUCCESS The pointer pointed to by Address was modified.\r
+ @retval EFI_INVALID_PARAMETER 1) Address is NULL.\r
+ 2) *Address is NULL and DebugDisposition does\r
+ not have the EFI_OPTIONAL_PTR bit set.\r
+ @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part\r
+ of the current memory map. This is normally fatal.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CONVERT_POINTER) (\r
+ IN UINTN DebugDisposition,\r
+ IN OUT VOID **Address\r
+ );\r
+\r
+\r
+//\r
+// These types can be ¡°ORed¡± together as needed ¨C for example,\r
+// EVT_TIMER might be ¡°Ored¡± with EVT_NOTIFY_WAIT or\r
+// EVT_NOTIFY_SIGNAL.\r
+//\r
+#define EVT_TIMER 0x80000000\r
+#define EVT_RUNTIME 0x40000000\r
+\r
+#define EVT_NOTIFY_WAIT 0x00000100\r
+#define EVT_NOTIFY_SIGNAL 0x00000200\r
+#define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201\r
+#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202\r
+\r
+\r
+//\r
+// The event¡¯s NotifyContext pointer points to a runtime memory\r
+// address. \r
+// The event is deprecated in UEFI2.0 and later specifications.\r
+// \r
+#define EVT_RUNTIME_CONTEXT 0x20000000\r
+\r
+\r
+/**\r
+ Invoke a notification event\r
+\r
+ @param Event Event whose notification function is being invoked.\r
+ @param Context Pointer to the notification function's context,\r
+ which is implementation-dependent.\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_EVENT_NOTIFY) (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ );\r
+\r
+/**\r
+ Creates an event.\r
+\r
+ @param Type The type of event to create and its mode and attributes.\r
+ @param NotifyTpl Pointer to the notification function's context.\r
+ @param NotifyFunction Pointer to the event's notification function, if any.\r
+ @param NotifyContext Pointer to the notification function's context; corresponds to parameter\r
+ Context in the notification function.\r
+ @param Event Pointer to the newly created event if the call succeeds; undefined\r
+ otherwise.\r
+\r
+ @retval EFI_SUCCESS The event structure was created.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_OUT_OF_RESOURCES The event could not be allocated.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CREATE_EVENT) (\r
+ IN UINT32 Type,\r
+ IN EFI_TPL NotifyTpl,\r
+ IN EFI_EVENT_NOTIFY NotifyFunction,\r
+ IN VOID *NotifyContext,\r
+ OUT EFI_EVENT *Event\r
+ );\r
+\r
+/**\r
+ Creates an event in a group.\r
+\r
+ @param Type The type of event to create and its mode and attributes.\r
+ @param NotifyTpl Pointer to the notification function's context.\r
+ @param NotifyFunction Pointer to the event's notification function, if any.\r
+ @param NotifyContext Pointer to the notification function's context; corresponds to parameter\r
+ Context in the notification function.\r
+ @param EventGroup Pointer to the unique identifier of the group to which this event belongs.\r
+ @param Event Pointer to the newly created event if the call succeeds; undefined\r
+ otherwise.\r
+\r
+ @retval EFI_SUCCESS The event structure was created.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_OUT_OF_RESOURCES The event could not be allocated.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CREATE_EVENT_EX) (\r
+ IN UINT32 Type,\r
+ IN EFI_TPL NotifyTpl OPTIONAL,\r
+ IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,\r
+ IN CONST VOID *NotifyContext OPTIONAL,\r
+ IN CONST EFI_GUID *EventGroup OPTIONAL,\r
+ OUT EFI_EVENT *Event\r
+ );\r
+\r
+typedef enum {\r
+ TimerCancel,\r
+ TimerPeriodic,\r
+ TimerRelative\r
+} EFI_TIMER_DELAY;\r
+\r
+/**\r
+ Sets the type of timer and the trigger time for a timer event.\r
+\r
+ @param Event The timer event that is to be signaled at the specified time.\r
+ @param Type The type of time that is specified in TriggerTime.\r
+ @param TriggerTime The number of 100ns units until the timer expires.\r
+\r
+ @retval EFI_SUCCESS The event has been set to be signaled at the requested time.\r
+ @retval EFI_INVALID_PARAMETER Event or Type is not valid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SET_TIMER) (\r
+ IN EFI_EVENT Event,\r
+ IN EFI_TIMER_DELAY Type,\r
+ IN UINT64 TriggerTime\r
+ );\r
+\r
+/**\r
+ Signals an event.\r
+\r
+ @param Event The event to signal.\r
+\r
+ @retval EFI_SUCCESS The event has been signaled.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIGNAL_EVENT) (\r
+ IN EFI_EVENT Event\r
+ );\r
+\r
+/**\r
+ Stops execution until an event is signaled.\r
+\r
+ @param NumberOfEvents The number of events in the Event array.\r
+ @param Event An array of EFI_EVENT.\r
+ @param Index Pointer to the index of the event which satisfied the wait condition.\r
+\r
+ @retval EFI_SUCCESS The event indicated by Index was signaled.\r
+ @retval EFI_INVALID_PARAMETER 1) NumberOfEvents is 0.\r
+ 2) The event indicated by Index is of type\r
+ EVT_NOTIFY_SIGNAL.\r
+ @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_WAIT_FOR_EVENT) (\r
+ IN UINTN NumberOfEvents,\r
+ IN EFI_EVENT *Event,\r
+ OUT UINTN *Index\r
+ );\r
+\r
+/**\r
+ Closes an event.\r
+\r
+ @param Event The event to close.\r
+\r
+ @retval EFI_SUCCESS The event has been closed.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CLOSE_EVENT) (\r
+ IN EFI_EVENT Event\r
+ );\r
+\r
+/**\r
+ Checks whether an event is in the signaled state.\r
+\r
+ @param Event The event to check.\r
+\r
+ @retval EFI_SUCCESS The event is in the signaled state.\r
+ @retval EFI_NOT_READY The event is not in the signaled state.\r
+ @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CHECK_EVENT) (\r
+ IN EFI_EVENT Event\r
+ );\r
+\r
+\r
+//\r
+// Task priority level (name defined in spec).\r
+//\r
+#define TPL_APPLICATION 4\r
+#define TPL_CALLBACK 8\r
+#define TPL_NOTIFY 16\r
+#define TPL_HIGH_LEVEL 31\r
+\r
+\r
+/**\r
+ Raises a task's priority level and returns its previous level.\r
+\r
+ @param NewTpl The new task priority level.\r
+\r
+ @retval Previous task priority level\r
+\r
+**/\r
+typedef\r
+EFI_TPL\r
+(EFIAPI *EFI_RAISE_TPL) (\r
+ IN EFI_TPL NewTpl\r
+ );\r
+\r
+/**\r
+ Restores a task's priority level to its previous value.\r
+\r
+ @param OldTpl The previous task priority level to restore\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_RESTORE_TPL) (\r
+ IN EFI_TPL OldTpl\r
+ );\r
+\r
+/**\r
+ Returns the value of a variable.\r
+\r
+ @param VariableName A Null-terminated Unicode string that is the name of the\r
+ vendor's variable.\r
+ @param VendorGuid A unique identifier for the vendor.\r
+ @param Attributes If not NULL, a pointer to the memory location to return the\r
+ attributes bitmask for the variable.\r
+ @param DataSize On input, the size in bytes of the return Data buffer.\r
+ On output the size of data returned in Data.\r
+ @param Data The buffer to return the contents of the variable.\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_NOT_FOUND The variable was not found.\r
+ @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_VARIABLE) (\r
+ IN CHAR16 *VariableName,\r
+ IN EFI_GUID *VendorGuid,\r
+ OUT UINT32 *Attributes, OPTIONAL\r
+ IN OUT UINTN *DataSize,\r
+ OUT VOID *Data\r
+ );\r
+\r
+/**\r
+ Enumerates the current variable names.\r
+\r
+ @param VariableNameSize The size of the VariableName buffer.\r
+ @param VariableName On input, supplies the last VariableName that was returned\r
+ by GetNextVariableName(). On output, returns the Nullterminated\r
+ Unicode string of the current variable.\r
+ @param VendorGuid On input, supplies the last VendorGuid that was returned by\r
+ GetNextVariableName(). On output, returns the\r
+ VendorGuid of the current variable.\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_NOT_FOUND The next variable was not found.\r
+ @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (\r
+ IN OUT UINTN *VariableNameSize,\r
+ IN OUT CHAR16 *VariableName,\r
+ IN OUT EFI_GUID *VendorGuid\r
+ );\r
+\r
+/**\r
+ Sets the value of a variable.\r
+\r
+ @param VariableName A Null-terminated Unicode string that is the name of the\r
+ vendor's variable.\r
+ @param VendorGuid A unique identifier for the vendor.\r
+ @param Attributes Attributes bitmask to set for the variable.\r
+ @param DataSize The size in bytes of the Data buffer.\r
+ @param Data The contents for the variable.\r
+\r
+ @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as\r
+ defined by the Attributes.\r
+ @retval EFI_WRITE_PROTECTED The variable in question is read-only.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SET_VARIABLE) (\r
+ IN CHAR16 *VariableName,\r
+ IN EFI_GUID *VendorGuid,\r
+ IN UINT32 Attributes,\r
+ IN UINTN DataSize,\r
+ IN VOID *Data\r
+ );\r
+\r
+\r
+// \r
+// This provides the capabilities of the\r
+// real time clock device as exposed through the EFI interfaces.\r
+// \r
+typedef struct {\r
+ UINT32 Resolution;\r
+ UINT32 Accuracy;\r
+ BOOLEAN SetsToZero;\r
+} EFI_TIME_CAPABILITIES;\r
+\r
+/**\r
+ Returns the current time and date information, and the time-keeping capabilities\r
+ of the hardware platform.\r
+\r
+ @param Time A pointer to storage to receive a snapshot of the current time.\r
+ @param Capabilities An optional pointer to a buffer to receive the real time clock\r
+ device's capabilities.\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_INVALID_PARAMETER Time is NULL.\r
+ @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_TIME) (\r
+ OUT EFI_TIME *Time,\r
+ OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL\r
+ );\r
+\r
+/**\r
+ Sets the current local time and date information.\r
+\r
+ @param Time A pointer to the current time.\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_INVALID_PARAMETER A time field is out of range.\r
+ @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SET_TIME) (\r
+ IN EFI_TIME *Time\r
+ );\r
+\r
+/**\r
+ Returns the current wakeup alarm clock setting.\r
+\r
+ @param Enabled Indicates if the alarm is currently enabled or disabled.\r
+ @param Pending Indicates if the alarm signal is pending and requires acknowledgement.\r
+ @param Time The current alarm setting.\r
+\r
+ @retval EFI_SUCCESS The alarm settings were returned.\r
+ @retval EFI_INVALID_PARAMETER Any parameter is NULL.\r
+ @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_WAKEUP_TIME) (\r
+ OUT BOOLEAN *Enabled,\r
+ OUT BOOLEAN *Pending,\r
+ OUT EFI_TIME *Time\r
+ );\r
+\r
+/**\r
+ Sets the system wakeup alarm clock time.\r
+\r
+ @param Enabled Enable or disable the wakeup alarm.\r
+ @param Time If Enable is TRUE, the time to set the wakeup alarm for.\r
+\r
+ @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If\r
+ Enable is FALSE, then the wakeup alarm was disabled.\r
+ @retval EFI_INVALID_PARAMETER A time field is out of range.\r
+ @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.\r
+ @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SET_WAKEUP_TIME) (\r
+ IN BOOLEAN Enable,\r
+ IN EFI_TIME *Time OPTIONAL\r
+ );\r
+\r
+/**\r
+ This is the declaration of an EFI image entry point. This can be the entry point to an application\r
+ written to this specification, an EFI boot service driver, or an EFI runtime driver.\r
+\r
+ @param ImageHandle Handle that identifies the loaded image.\r
+ @param SystemTable System Table for this image.\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IMAGE_ENTRY_POINT) (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Loads an EFI image into memory.\r
+\r
+ @param BootPolicy If TRUE, indicates that the request originates from the boot\r
+ manager, and that the boot manager is attempting to load\r
+ FilePath as a boot selection. Ignored if SourceBuffer is\r
+ not NULL.\r
+ @param ParentImageHandle The caller's image handle.\r
+ @param FilePath The DeviceHandle specific file path from which the image is\r
+ loaded.\r
+ @param SourceBuffer If not NULL, a pointer to the memory location containing a copy\r
+ of the image to be loaded.\r
+ @param SourceSize The size in bytes of SourceBuffer.\r
+ @param ImageHandle Pointer to the returned image handle that is created when the\r
+ image is successfully loaded.\r
+\r
+ @retval EFI_SUCCESS Image was loaded into memory correctly.\r
+ @retval EFI_NOT_FOUND Both SourceBuffer and FilePath are NULL.\r
+ @retval EFI_INVALID_PARAMETER One or more parametes are invalid.\r
+ @retval EFI_UNSUPPORTED The image type is not supported.\r
+ @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient resources.\r
+ @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r
+ understood.\r
+ @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IMAGE_LOAD) (\r
+ IN BOOLEAN BootPolicy,\r
+ IN EFI_HANDLE ParentImageHandle,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
+ IN VOID *SourceBuffer OPTIONAL,\r
+ IN UINTN SourceSize,\r
+ OUT EFI_HANDLE *ImageHandle\r
+ );\r
+\r
+/**\r
+ Transfers control to a loaded image's entry point.\r
+\r
+ @param ImageHandle Handle of image to be started.\r
+ @param ExitDataSize Pointer to the size, in bytes, of ExitData.\r
+ @param ExitData Pointer to a pointer to a data buffer that includes a Null-terminated\r
+ Unicode string, optionally followed by additional binary data.\r
+\r
+ @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image\r
+ has already been initialized with StartImage\r
+ @retval Exit code from image Exit code from image\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IMAGE_START) (\r
+ IN EFI_HANDLE ImageHandle,\r
+ OUT UINTN *ExitDataSize,\r
+ OUT CHAR16 **ExitData OPTIONAL\r
+ );\r
+\r
+/**\r
+ Terminates a loaded EFI image and returns control to boot services.\r
+\r
+ @param ImageHandle Handle that identifies the image.\r
+ @param ExitStatus The image's exit code.\r
+ @param ExitDataSize The size, in bytes, of ExitData.\r
+ @param ExitData Pointer to a data buffer that includes a Null-terminated Unicode string,\r
+ optionally followed by additional binary data.\r
+\r
+ @retval EFI_SUCCESS The image specified by ImageHandle was unloaded.\r
+ @retval EFI_INVALID_PARAMETER The image specified by ImageHandle has been loaded and\r
+ started with LoadImage() and StartImage(), but the\r
+ image is not the currently executing image.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXIT) (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_STATUS ExitStatus,\r
+ IN UINTN ExitDataSize,\r
+ IN CHAR16 *ExitData OPTIONAL\r
+ );\r
+\r
+/**\r
+ Unloads an image.\r
+\r
+ @param ImageHandle Handle that identifies the image to be unloaded.\r
+\r
+ @retval EFI_SUCCESS The image has been unloaded.\r
+ @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.\r
+ @retval EFI_UNSUPPORTED The image has been started, and does not support unload.\r
+ @retval Exit code from the image's unload handler\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IMAGE_UNLOAD) (\r
+ IN EFI_HANDLE ImageHandle\r
+ );\r
+\r
+/**\r
+ Terminates all boot services.\r
+\r
+ @param ImageHandle Handle that identifies the exiting image.\r
+ @param MapKey Key to the latest memory map.\r
+\r
+ @retval EFI_SUCCESS Boot services have been terminated.\r
+ @retval EFI_INVALID_PARAMETER MapKey is incorrect.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXIT_BOOT_SERVICES) (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN UINTN MapKey\r
+ );\r
+\r
+/**\r
+ Induces a fine-grained stall.\r
+\r
+ @param Microseconds The number of microseconds to stall execution.\r
+\r
+ @retval EFI_SUCCESS Execution was stalled at least the requested number of\r
+ Microseconds.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_STALL) (\r
+ IN UINTN Microseconds\r
+ );\r
+\r
+/**\r
+ Sets the system's watchdog timer.\r
+\r
+ @param Timeout The number of seconds to set the watchdog timer to.\r
+ @param WatchdogCode The numeric code to log on a watchdog timer timeout event.\r
+ @param DataSize The size, in bytes, of WatchdogData.\r
+ @param WatchdogData A data buffer that includes a Null-terminated Unicode string, optionally\r
+ followed by additional binary data.\r
+\r
+ @retval EFI_SUCCESS The timeout has been set.\r
+ @retval EFI_INVALID_PARAMETER The supplied WatchdogCode is invalid.\r
+ @retval EFI_UNSUPPORTED The system does not have a watchdog timer.\r
+ @retval EFI_DEVICE_ERROR The watch dog timer could not be programmed due to a hardware\r
+ error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SET_WATCHDOG_TIMER) (\r
+ IN UINTN Timeout,\r
+ IN UINT64 WatchdogCode,\r
+ IN UINTN DataSize,\r
+ IN CHAR16 *WatchdogData OPTIONAL\r
+ );\r
+\r
+//\r
+// Enumeration of reset types.\r
+// \r
+typedef enum {\r
+ EfiResetCold,\r
+ EfiResetWarm,\r
+ EfiResetShutdown,\r
+} EFI_RESET_TYPE;\r
+\r
+/**\r
+ Resets the entire platform.\r
+\r
+ @param ResetType The type of reset to perform.\r
+ @param ResetStatus The status code for the reset.\r
+ @param DataSize The size, in bytes, of WatchdogData.\r
+ @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or\r
+ EfiResetShutdown the data buffer starts with a Null-terminated\r
+ Unicode string, optionally followed by additional binary data.\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_RESET_SYSTEM) (\r
+ IN EFI_RESET_TYPE ResetType,\r
+ IN EFI_STATUS ResetStatus,\r
+ IN UINTN DataSize,\r
+ IN CHAR16 *ResetData OPTIONAL\r
+ );\r
+\r
+/**\r
+ Returns a monotonically increasing count for the platform.\r
+\r
+ @param Count Pointer to returned value.\r
+\r
+ @retval EFI_SUCCESS The next monotonic count was returned.\r
+ @retval EFI_INVALID_PARAMETER Count is NULL.\r
+ @retval EFI_DEVICE_ERROR The device is not functioning properly.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (\r
+ OUT UINT64 *Count\r
+ );\r
+\r
+/**\r
+ Returns the next high 32 bits of the platform's monotonic counter.\r
+\r
+ @param HighCount Pointer to returned value.\r
+\r
+ @retval EFI_SUCCESS The next high monotonic count was returned.\r
+ @retval EFI_INVALID_PARAMETER HighCount is NULL.\r
+ @retval EFI_DEVICE_ERROR The device is not functioning properly.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (\r
+ OUT UINT32 *HighCount\r
+ );\r
+\r
+/**\r
+ Computes and returns a 32-bit CRC for a data buffer.\r
+\r
+ @param Data A pointer to the buffer on which the 32-bit CRC is to be computed.\r
+ @param DataSize The number of bytes in the buffer Data.\r
+ @param Crc32 The 32-bit CRC that was computed for the data buffer specified by Data\r
+ and DataSize.\r
+\r
+ @retval EFI_SUCCESS The 32-bit CRC was computed for the data buffer and returned in\r
+ Crc32.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CALCULATE_CRC32) (\r
+ IN VOID *Data,\r
+ IN UINTN DataSize,\r
+ OUT UINT32 *Crc32\r
+ );\r
+\r
+/**\r
+ Copies the contents of one buffer to another buffer.\r
+\r
+ @param Destination Pointer to the destination buffer of the memory copy.\r
+ @param Source Pointer to the source buffer of the memory copy.\r
+ @param Length Number of bytes to copy from Source to Destination.\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_COPY_MEM) (\r
+ IN VOID *Destination,\r
+ IN VOID *Source,\r
+ IN UINTN Length\r
+ );\r
+\r
+/**\r
+ The SetMem() function fills a buffer with a specified value.\r
+\r
+ @param Buffer Pointer to the buffer to fill.\r
+ @param Size Number of bytes in Buffer to fill.\r
+ @param Value Value to fill Buffer with.\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_SET_MEM) (\r
+ IN VOID *Buffer,\r
+ IN UINTN Size,\r
+ IN UINT8 Value\r
+ );\r
+\r
+\r
+//\r
+// Protocol handler functions\r
+//\r
+typedef enum {\r
+ EFI_NATIVE_INTERFACE\r
+} EFI_INTERFACE_TYPE;\r
+\r
+/**\r
+ Installs a protocol interface on a device handle. If the handle does not exist, it is created and added\r
+ to the list of handles in the system. InstallMultipleProtocolInterfaces() performs\r
+ more error checking than InstallProtocolInterface(), so it is recommended that\r
+ InstallMultipleProtocolInterfaces() be used in place of\r
+ InstallProtocolInterface()\r
+\r
+ @param Handle A pointer to the EFI_HANDLE on which the interface is to be installed.\r
+ @param Protocol The numeric ID of the protocol interface.\r
+ @param InterfaceType Indicates whether Interface is supplied in native form.\r
+ @param Interface A pointer to the protocol interface.\r
+\r
+ @retval EFI_SUCCESS The protocol interface was installed.\r
+ @retval EFI_OUT_OF_RESOURCES Space for a new handle could not be allocated.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (\r
+ IN OUT EFI_HANDLE *Handle,\r
+ IN EFI_GUID *Protocol,\r
+ IN EFI_INTERFACE_TYPE InterfaceType,\r
+ IN VOID *Interface\r
+ );\r
+\r
+/**\r
+ Installs one or more protocol interfaces into the boot services environment.\r
+\r
+ @param Handle The handle to install the new protocol interfaces on, or NULL if a new\r
+ handle is to be allocated.\r
+ @param ... A variable argument list containing pairs of protocol GUIDs and protocol\r
+ interfaces.\r
+\r
+ @retval EFI_SUCCESS All the protocol interface was installed.\r
+ @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
+ @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in\r
+ the handle database.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (\r
+ IN OUT EFI_HANDLE *Handle,\r
+ ...\r
+ );\r
+\r
+/**\r
+ Reinstalls a protocol interface on a device handle.\r
+\r
+ @param Handle Handle on which the interface is to be reinstalled.\r
+ @param Protocol The numeric ID of the interface.\r
+ @param OldInterface A pointer to the old interface. NULL can be used if a structure is not\r
+ associated with Protocol.\r
+ @param NewInterface A pointer to the new interface.\r
+\r
+ @retval EFI_SUCCESS The protocol interface was reinstalled.\r
+ @retval EFI_NOT_FOUND The OldInterface on the handle was not found.\r
+ @retval EFI_ACCESS_DENIED The protocol interface could not be reinstalled,\r
+ because OldInterface is still being used by a\r
+ driver that will not release it.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (\r
+ IN EFI_HANDLE Handle,\r
+ IN EFI_GUID *Protocol,\r
+ IN VOID *OldInterface,\r
+ IN VOID *NewInterface\r
+ );\r
+\r
+/**\r
+ Removes a protocol interface from a device handle. It is recommended that\r
+ UninstallMultipleProtocolInterfaces() be used in place of\r
+ UninstallProtocolInterface().\r
+\r
+ @param Handle The handle on which the interface was installed.\r
+ @param Protocol The numeric ID of the interface.\r
+ @param Interface A pointer to the interface.\r
+\r
+ @retval EFI_SUCCESS The interface was removed.\r
+ @retval EFI_NOT_FOUND The interface was not found.\r
+ @retval EFI_ACCESS_DENIED The interface was not removed because the interface\r
+ is still being used by a driver.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (\r
+ IN EFI_HANDLE Handle,\r
+ IN EFI_GUID *Protocol,\r
+ IN VOID *Interface\r
+ );\r
+\r
+/**\r
+ Removes one or more protocol interfaces into the boot services environment.\r
+\r
+ @param Handle The handle to remove the protocol interfaces from.\r
+ @param ... A variable argument list containing pairs of protocol GUIDs and\r
+ protocol interfaces.\r
+\r
+ @retval EFI_SUCCESS All the protocol interfaces were removed.\r
+ @retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (\r
+ IN EFI_HANDLE Handle,\r
+ ...\r
+ );\r
+\r
+/**\r
+ Queries a handle to determine if it supports a specified protocol.\r
+\r
+ @param Handle The handle being queried.\r
+ @param Protocol The published unique identifier of the protocol.\r
+ @param Interface Supplies the address where a pointer to the corresponding Protocol\r
+ Interface is returned.\r
+ @retval EFI_SUCCESS The interface information for the specified protocol was returned.\r
+ @retval EFI_UNSUPPORTED The device does not support the specified protocol.\r
+ @retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HANDLE_PROTOCOL) (\r
+ IN EFI_HANDLE Handle,\r
+ IN EFI_GUID *Protocol,\r
+ OUT VOID **Interface\r
+ );\r
+\r
+#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001\r
+#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002\r
+#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004\r
+#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008\r
+#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010\r
+#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020\r
+\r
+/**\r
+ Queries a handle to determine if it supports a specified protocol. If the protocol is supported by the\r
+ handle, it opens the protocol on behalf of the calling agent.\r
+\r
+ @param Handle The handle for the protocol interface that is being opened.\r
+ @param Protocol The published unique identifier of the protocol.\r
+ @param Interface Supplies the address where a pointer to the corresponding Protocol\r
+ Interface is returned.\r
+ @param AgentHandle The handle of the agent that is opening the protocol interface\r
+ specified by Protocol and Interface.\r
+ @param ControllerHandle If the agent that is opening a protocol is a driver that follows the\r
+ UEFI Driver Model, then this parameter is the controller handle\r
+ that requires the protocol interface. If the agent does not follow\r
+ the UEFI Driver Model, then this parameter is optional and may\r
+ be NULL.\r
+ @param Attributes The open mode of the protocol interface specified by Handle\r
+ and Protocol.\r
+\r
+ @retval EFI_SUCCESS An item was added to the open list for the protocol interface, and the\r
+ protocol interface was returned in Interface.\r
+ @retval EFI_UNSUPPORTED Handle does not support Protocol.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_ACCESS_DENIED Required attributes can't be supported in current environment.\r
+ @retval EFI_ALREADY_STARTED Item on the open list already has requierd attributes whose agent\r
+ handle is the same as AgentHandle.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_OPEN_PROTOCOL) (\r
+ IN EFI_HANDLE Handle,\r
+ IN EFI_GUID *Protocol,\r
+ OUT VOID **Interface,\r
+ IN EFI_HANDLE AgentHandle,\r
+ IN EFI_HANDLE ControllerHandle, OPTIONAL\r
+ IN UINT32 Attributes\r
+ );\r
+\r
+\r
+/**\r
+ Closes a protocol on a handle that was opened using OpenProtocol().\r
+\r
+ @param Handle The handle for the protocol interface that was previously opened\r
+ with OpenProtocol(), and is now being closed.\r
+ @param Protocol The published unique identifier of the protocol.\r
+ @param Interface Supplies the address where a pointer to the corresponding Protocol\r
+ Interface is returned.\r
+ @param AgentHandle The handle of the agent that is closing the protocol interface.\r
+ @param ControllerHandle If the agent that opened a protocol is a driver that follows the\r
+ UEFI Driver Model, then this parameter is the controller handle\r
+ that required the protocol interface.\r
+\r
+ @retval EFI_SUCCESS The protocol instance was closed.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_NOT_FOUND 1) Handle does not support the protocol specified by Protocol.\r
+ 2) The protocol interface specified by Handle and Protocol is not\r
+ currently open by AgentHandle and ControllerHandle.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CLOSE_PROTOCOL) (\r
+ IN EFI_HANDLE Handle,\r
+ IN EFI_GUID *Protocol,\r
+ IN EFI_HANDLE AgentHandle,\r
+ IN EFI_HANDLE ControllerHandle\r
+ );\r
+\r
+\r
+typedef struct {\r
+ EFI_HANDLE AgentHandle;\r
+ EFI_HANDLE ControllerHandle;\r
+ UINT32 Attributes;\r
+ UINT32 OpenCount;\r
+} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;\r
+\r
+/**\r
+ Retrieves the list of agents that currently have a protocol interface opened.\r
+\r
+ @param Handle The handle for the protocol interface that is being queried.\r
+ @param Protocol The published unique identifier of the protocol.\r
+ @param EntryBuffer A pointer to a buffer of open protocol information in the form of\r
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.\r
+ @param EntryCount A pointer to the number of entries in EntryBuffer.\r
+\r
+ @retval EFI_SUCCESS The open protocol information was returned in EntryBuffer, and the\r
+ number of entries was returned EntryCount.\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate EntryBuffer.\r
+ @retval EFI_NOT_FOUND Handle does not support the protocol specified by Protocol.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (\r
+ IN EFI_HANDLE Handle,\r
+ IN EFI_GUID *Protocol,\r
+ IN EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,\r
+ OUT UINTN *EntryCount\r
+ );\r
+\r
+/**\r
+ Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated\r
+ from pool.\r
+\r
+ @param Handle The handle from which to retrieve the list of protocol interface\r
+ GUIDs.\r
+ @param ProtocolBuffer A pointer to the list of protocol interface GUID pointers that are\r
+ installed on Handle.\r
+ @param ProtocolBufferCount A pointer to the number of GUID pointers present in\r
+ ProtocolBuffer.\r
+\r
+ @retval EFI_SUCCESS The list of protocol interface GUIDs installed on Handle was returned in\r
+ ProtocolBuffer. The number of protocol interface GUIDs was\r
+ returned in ProtocolBufferCount.\r
+ @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the results.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (\r
+ IN EFI_HANDLE Handle,\r
+ OUT EFI_GUID ***ProtocolBuffer,\r
+ OUT UINTN *ProtocolBufferCount\r
+ );\r
+\r
+/**\r
+ Creates an event that is to be signaled whenever an interface is installed for a specified protocol.\r
+\r
+ @param Protocol The numeric ID of the protocol for which the event is to be registered.\r
+ @param Event Event that is to be signaled whenever a protocol interface is registered\r
+ for Protocol.\r
+ @param Registration A pointer to a memory location to receive the registration value.\r
+\r
+ @retval EFI_SUCCESS The notification event has been registered.\r
+ @retval EFI_OUT_OF_RESOURCES Space for the notification event could not be allocated.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (\r
+ IN EFI_GUID *Protocol,\r
+ IN EFI_EVENT Event,\r
+ OUT VOID **Registration\r
+ );\r
+\r
+\r
+typedef enum {\r
+ AllHandles,\r
+ ByRegisterNotify,\r
+ ByProtocol\r
+} EFI_LOCATE_SEARCH_TYPE;\r
+\r
+/**\r
+ Returns an array of handles that support a specified protocol.\r
+\r
+ @param SearchType Specifies which handle(s) are to be returned.\r
+ @param Protocol Specifies the protocol to search by.\r
+ @param SearchKey Specifies the search key.\r
+ @param BufferSize On input, the size in bytes of Buffer. On output, the size in bytes of\r
+ the array returned in Buffer (if the buffer was large enough) or the\r
+ size, in bytes, of the buffer needed to obtain the array (if the buffer was\r
+ not large enough).\r
+ @param Buffer The buffer in which the array is returned.\r
+\r
+ @retval EFI_SUCCESS The array of handles was returned.\r
+ @retval EFI_NOT_FOUND No handles match the search.\r
+ @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small for the result.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LOCATE_HANDLE) (\r
+ IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
+ IN EFI_GUID *Protocol, OPTIONAL\r
+ IN VOID *SearchKey, OPTIONAL\r
+ IN OUT UINTN *BufferSize,\r
+ OUT EFI_HANDLE *Buffer\r
+ );\r
+\r
+/**\r
+ Locates the handle to a device on the device path that supports the specified protocol.\r
+\r
+ @param Protocol Specifies the protocol to search for.\r
+ @param DevicePath On input, a pointer to a pointer to the device path. On output, the device\r
+ path pointer is modified to point to the remaining part of the device\r
+ path.\r
+ @param Device A pointer to the returned device handle.\r
+\r
+ @retval EFI_SUCCESS The resulting handle was returned.\r
+ @retval EFI_NOT_FOUND No handles match the search.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LOCATE_DEVICE_PATH) (\r
+ IN EFI_GUID *Protocol,\r
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r
+ OUT EFI_HANDLE *Device\r
+ );\r
+\r
+/**\r
+ Adds, updates, or removes a configuration table entry from the EFI System Table.\r
+\r
+ @param Guid A pointer to the GUID for the entry to add, update, or remove.\r
+ @param Table A pointer to the configuration table for the entry to add, update, or\r
+ remove. May be NULL.\r
+\r
+ @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.\r
+ @retval EFI_NOT_FOUND An attempt was made to delete a nonexistent entry.\r
+ @retval EFI_INVALID_PARAMETER Guid is not valid.\r
+ @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (\r
+ IN EFI_GUID *Guid,\r
+ IN VOID *Table\r
+ );\r
+\r
+\r
+/**\r
+ Returns an array of handles that support the requested protocol in a buffer allocated from pool.\r
+\r
+ @param SearchType Specifies which handle(s) are to be returned.\r
+ @param Protocol Specifies the protocol to search by.\r
+ @param SearchKey Supplies the search key depending on the SearchType.\r
+ @param NoHandles The number of handles returned in Buffer.\r
+ @param Buffer A pointer to the buffer to return the requested array of handles that\r
+ support Protocol.\r
+\r
+ @retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of\r
+ handles in Buffer was returned in NoHandles.\r
+ @retval EFI_NOT_FOUND No handles match the search.\r
+ @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (\r
+ IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
+ IN EFI_GUID *Protocol, OPTIONAL\r
+ IN VOID *SearchKey, OPTIONAL\r
+ IN OUT UINTN *NoHandles,\r
+ OUT EFI_HANDLE **Buffer\r
+ );\r
+\r
+/**\r
+ Returns the first protocol instance that matches the given protocol.\r
+\r
+ @param Protocol Provides the protocol to search for.\r
+ @param Registration Optional registration key returned from\r
+ RegisterProtocolNotify().\r
+ @param Interface On return, a pointer to the first interface that matches Protocol and\r
+ Registration.\r
+\r
+ @retval EFI_SUCCESS A protocol instance matching Protocol was found and returned in\r
+ Interface.\r
+ @retval EFI_NOT_FOUND No protocol instances were found that match Protocol and\r
+ Registration.\r
+ @retval EFI_INVALID_PARAMETER Interface is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LOCATE_PROTOCOL) (\r
+ IN EFI_GUID *Protocol,\r
+ IN VOID *Registration, OPTIONAL\r
+ OUT VOID **Interface\r
+ );\r
+\r
+typedef struct {\r
+ UINT64 Length;\r
+ union {\r
+ EFI_PHYSICAL_ADDRESS DataBlock;\r
+ EFI_PHYSICAL_ADDRESS ContinuationPointer;\r
+ } Union;\r
+} UEFI_CAPSULE_BLOCK_DESCRIPTOR;\r
+\r
+typedef struct {\r
+ EFI_GUID CapsuleGuid;\r
+ UINT32 HeaderSize;\r
+ UINT32 Flags;\r
+ UINT32 CapsuleImageSize;\r
+} UEFI_CAPSULE_HEADER;\r
+\r
+#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000\r
+#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000\r
+\r
+/**\r
+ Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended\r
+ consumption, the firmware may process the capsule immediately. If the payload should persist\r
+ across a system reset, the reset value returned from EFI_QueryCapsuleCapabilities must\r
+ be passed into ResetSystem() and will cause the capsule to be processed by the firmware as\r
+ part of the reset process.\r
+\r
+ @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
+ being passed into update capsule.\r
+ @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
+ CaspuleHeaderArray.\r
+ @param ScatterGatherList Physical pointer to a set of\r
+ EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the\r
+ location in physical memory of a set of capsules.\r
+\r
+ @retval EFI_SUCCESS Valid capsule was passed. If\r
+ CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the\r
+ capsule has been successfully processed by the firmware.\r
+ @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.\r
+ @retval EFI_INVALID_PARAMETER CapsuleSize is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UPDATE_CAPSULE) (\r
+ IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
+ IN UINTN CapsuleCount,\r
+ IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL\r
+ );\r
+\r
+/**\r
+ Returns if the capsule can be supported via UpdateCapsule().\r
+\r
+ @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
+ being passed into update capsule.\r
+ @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
+ CaspuleHeaderArray.\r
+ @param MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can\r
+ support as an argument to UpdateCapsule() via\r
+ CapsuleHeaderArray and ScatterGatherList.\r
+ @param ResetType Returns the type of reset required for the capsule update.\r
+\r
+ @retval EFI_SUCCESS Valid answer returned.\r
+ @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and\r
+ MaximumCapsuleSize and ResetType are undefined.\r
+ @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES) (\r
+ IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
+ IN UINTN CapsuleCount,\r
+ OUT UINT64 *MaximumCapsuleSize,\r
+ OUT EFI_RESET_TYPE *ResetType\r
+ );\r
+\r
+/**\r
+ Returns information about the EFI variables.\r
+\r
+ @param Attributes Attributes bitmask to specify the type of variables on\r
+ which to return information.\r
+ @param MaximumVariableStorageSize On output the maximum size of the storage space\r
+ available for the EFI variables associated with the\r
+ attributes specified.\r
+ @param RemainingVariableStorageSize Returns the remaining size of the storage space\r
+ available for the EFI variables associated with the\r
+ attributes specified.\r
+ @param MaximumVariableSize Returns the maximum size of the individual EFI\r
+ variables associated with the attributes specified.\r
+\r
+ @retval EFI_SUCCESS Valid answer returned.\r
+ @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied\r
+ @retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the\r
+ MaximumVariableStorageSize,\r
+ RemainingVariableStorageSize, MaximumVariableSize\r
+ are undefined.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_QUERY_VARIABLE_INFO) (\r
+ IN UINT32 Attributes,\r
+ OUT UINT64 *MaximumVariableStorageSize,\r
+ OUT UINT64 *RemainingVariableStorageSize,\r
+ OUT UINT64 *MaximumVariableSize\r
+ );\r
+\r
+\r
+//\r
+// EFI Runtime Services Table\r
+//\r
+#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249\r
+#define EFI_SYSTEM_TABLE_REVISION ((2<<16) | (10))\r
+#define EFI_2_10_SYSTEM_TABLE_REVISION ((2<<16) | (10))\r
+#define EFI_2_00_SYSTEM_TABLE_REVISION ((2<<16) | (00))\r
+#define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | (10))\r
+#define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | (02))\r
+\r
+#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552\r
+#define EFI_RUNTIME_SERVICES_REVISION EFI_2_00_SYSTEM_TABLE_REVISION\r
+\r
+typedef struct {\r
+ EFI_TABLE_HEADER Hdr;\r
+\r
+ //\r
+ // Time Services\r
+ //\r
+ EFI_GET_TIME GetTime;\r
+ EFI_SET_TIME SetTime;\r
+ EFI_GET_WAKEUP_TIME GetWakeupTime;\r
+ EFI_SET_WAKEUP_TIME SetWakeupTime;\r
+\r
+ //\r
+ // Virtual Memory Services\r
+ //\r
+ EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;\r
+ EFI_CONVERT_POINTER ConvertPointer;\r
+\r
+ //\r
+ // Variable Services\r
+ //\r
+ EFI_GET_VARIABLE GetVariable;\r
+ EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;\r
+ EFI_SET_VARIABLE SetVariable;\r
+\r
+ //\r
+ // Miscellaneous Services\r
+ //\r
+ EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;\r
+ EFI_RESET_SYSTEM ResetSystem;\r
+\r
+ //\r
+ // UEFI 2.0 Capsule Services\r
+ //\r
+ EFI_UPDATE_CAPSULE UpdateCapsule;\r
+ EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities;\r
+\r
+ //\r
+ // Miscellaneous UEFI 2.0 Service\r
+ //\r
+ EFI_QUERY_VARIABLE_INFO QueryVariableInfo;\r
+} EFI_RUNTIME_SERVICES;\r
+\r
+\r
+#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42\r
+#define EFI_BOOT_SERVICES_REVISION ((2<<16) | (00))\r
+\r
+typedef struct {\r
+ EFI_TABLE_HEADER Hdr;\r
+ \r
+ //\r
+ // Task Priority Services\r
+ //\r
+ EFI_RAISE_TPL RaiseTPL;\r
+ EFI_RESTORE_TPL RestoreTPL;\r
+\r
+ //\r
+ // Memory Services\r
+ //\r
+ EFI_ALLOCATE_PAGES AllocatePages;\r
+ EFI_FREE_PAGES FreePages;\r
+ EFI_GET_MEMORY_MAP GetMemoryMap;\r
+ EFI_ALLOCATE_POOL AllocatePool;\r
+ EFI_FREE_POOL FreePool;\r
+\r
+ //\r
+ // Event & Timer Services\r
+ //\r
+ EFI_CREATE_EVENT CreateEvent;\r
+ EFI_SET_TIMER SetTimer;\r
+ EFI_WAIT_FOR_EVENT WaitForEvent;\r
+ EFI_SIGNAL_EVENT SignalEvent;\r
+ EFI_CLOSE_EVENT CloseEvent;\r
+ EFI_CHECK_EVENT CheckEvent;\r
+\r
+ //\r
+ // Protocol Handler Services\r
+ //\r
+ EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;\r
+ EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;\r
+ EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;\r
+ EFI_HANDLE_PROTOCOL HandleProtocol;\r
+ VOID *Reserved;\r
+ EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;\r
+ EFI_LOCATE_HANDLE LocateHandle;\r
+ EFI_LOCATE_DEVICE_PATH LocateDevicePath;\r
+ EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;\r
+\r
+ //\r
+ // Image Services\r
+ //\r
+ EFI_IMAGE_LOAD LoadImage;\r
+ EFI_IMAGE_START StartImage;\r
+ EFI_EXIT Exit;\r
+ EFI_IMAGE_UNLOAD UnloadImage;\r
+ EFI_EXIT_BOOT_SERVICES ExitBootServices;\r
+\r
+ //\r
+ // Miscellaneous Services\r
+ //\r
+ EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;\r
+ EFI_STALL Stall;\r
+ EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;\r
+\r
+ //\r
+ // DriverSupport Services\r
+ //\r
+ EFI_CONNECT_CONTROLLER ConnectController;\r
+ EFI_DISCONNECT_CONTROLLER DisconnectController;\r
+\r
+ //\r
+ // Open and Close Protocol Services\r
+ //\r
+ EFI_OPEN_PROTOCOL OpenProtocol;\r
+ EFI_CLOSE_PROTOCOL CloseProtocol;\r
+ EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;\r
+\r
+ //\r
+ // Library Services\r
+ //\r
+ EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;\r
+ EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;\r
+ EFI_LOCATE_PROTOCOL LocateProtocol;\r
+ EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;\r
+ EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;\r
+\r
+ //\r
+ // 32-bit CRC Services\r
+ //\r
+ EFI_CALCULATE_CRC32 CalculateCrc32;\r
+\r
+ //\r
+ // Miscellaneous Services\r
+ //\r
+ EFI_COPY_MEM CopyMem;\r
+ EFI_SET_MEM SetMem;\r
+\r
+ EFI_CREATE_EVENT_EX CreateEventEx;\r
+} EFI_BOOT_SERVICES;\r
+\r
+//\r
+// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the \r
+// EFI System Table.\r
+// \r
+typedef struct{\r
+ EFI_GUID VendorGuid;\r
+ VOID *VendorTable;\r
+} EFI_CONFIGURATION_TABLE;\r
+\r
+struct _EFI_SYSTEM_TABLE {\r
+ EFI_TABLE_HEADER Hdr;\r
+ CHAR16 *FirmwareVendor;\r
+ UINT32 FirmwareRevision;\r
+ EFI_HANDLE ConsoleInHandle;\r
+ EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;\r
+ EFI_HANDLE ConsoleOutHandle;\r
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;\r
+ EFI_HANDLE StandardErrorHandle;\r
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *StdErr;\r
+ EFI_RUNTIME_SERVICES *RuntimeServices;\r
+ EFI_BOOT_SERVICES *BootServices;\r
+ UINTN NumberOfTableEntries;\r
+ EFI_CONFIGURATION_TABLE *ConfigurationTable;\r
+};\r
+\r
+//\r
+// EFI File location to boot from on removable media devices\r
+//\r
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"\r
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"\r
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"\r
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_EBC L"\\EFI\\BOOT\\BOOTEBC.EFI"\r
+\r
+#if defined (MDE_CPU_IA32)\r
+ #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA32\r
+#elif defined (MDE_CPU_IPF)\r
+ #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA64\r
+#elif defined (MDE_CPU_X64)\r
+ #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_X64\r
+#elif defined (MDE_CPU_EBC)\r
+ #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_EBC\r
+#else\r
+ #error Unknown Processor Type\r
+#endif\r
+\r
+#include <Uefi/UefiDevicePath.h>\r
+#include <Uefi/UefiPxe.h>\r
+#include <Uefi/UefiGpt.h>\r
+#include <Uefi/UefiInternalFormRepresentation.h>\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).\r
+\r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. 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: ProcessorBind.h\r
+\r
+**/\r
+\r
+#ifndef __PROCESSOR_BIND_H__\r
+#define __PROCESSOR_BIND_H__\r
+\r
+//\r
+// Define the processor type so other code can make processor based choices\r
+//\r
+#define MDE_CPU_X64\r
+\r
+\r
+//\r
+// Make sure we are useing the correct packing rules per EFI specification\r
+//\r
+#ifndef __GNUC__\r
+#pragma pack()\r
+#endif\r
+\r
+#if _MSC_EXTENSIONS \r
+ \r
+//\r
+// Disable warning that make it impossible to compile at /W4\r
+// This only works for Microsoft* tools\r
+//\r
+\r
+//\r
+// Disabling bitfield type checking warnings.\r
+//\r
+#pragma warning ( disable : 4214 )\r
+\r
+//\r
+// Disabling the unreferenced formal parameter warnings.\r
+//\r
+#pragma warning ( disable : 4100 )\r
+\r
+//\r
+// Disable slightly different base types warning as CHAR8 * can not be set\r
+// to a constant string.\r
+//\r
+#pragma warning ( disable : 4057 )\r
+\r
+//\r
+// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning\r
+//\r
+#pragma warning ( disable : 4127 )\r
+\r
+//\r
+// This warning is caused by functions defined but not used. For precompiled header only.\r
+//\r
+#pragma warning ( disable : 4505 )\r
+\r
+//\r
+// This warning is caused by empty (after preprocessing) souce file. For precompiled header only.\r
+//\r
+#pragma warning ( disable : 4206 )\r
+\r
+#endif\r
+\r
+\r
+#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)\r
+ //\r
+ // No ANSI C 2000 stdint.h integer width declarations, so define equivalents\r
+ //\r
+ \r
+ #if _MSC_EXTENSIONS \r
+ \r
+\r
+ //\r
+ // use Microsoft C complier dependent interger width types \r
+ //\r
+ typedef unsigned __int64 UINT64;\r
+ typedef __int64 INT64;\r
+ typedef unsigned __int32 UINT32;\r
+ typedef __int32 INT32;\r
+ typedef unsigned short UINT16;\r
+ typedef unsigned short CHAR16;\r
+ typedef short INT16;\r
+ typedef unsigned char BOOLEAN;\r
+ typedef unsigned char UINT8;\r
+ typedef char CHAR8;\r
+ typedef char INT8;\r
+ #else\r
+ #ifdef _EFI_P64 \r
+ //\r
+ // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints \r
+ // are 32-bits\r
+ //\r
+ typedef unsigned long long UINT64;\r
+ typedef long long INT64;\r
+ typedef unsigned int UINT32;\r
+ typedef int INT32;\r
+ typedef unsigned short CHAR16;\r
+ typedef unsigned short UINT16;\r
+ typedef short INT16;\r
+ typedef unsigned char BOOLEAN;\r
+ typedef unsigned char UINT8;\r
+ typedef char CHAR8;\r
+ typedef char INT8;\r
+ #else\r
+ //\r
+ // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.\r
+ //\r
+ typedef unsigned long UINT64;\r
+ typedef long INT64;\r
+ typedef unsigned int UINT32;\r
+ typedef int INT32;\r
+ typedef unsigned short UINT16;\r
+ typedef unsigned short CHAR16;\r
+ typedef short INT16;\r
+ typedef unsigned char BOOLEAN;\r
+ typedef unsigned char UINT8;\r
+ typedef char CHAR8;\r
+ typedef char INT8;\r
+ #endif\r
+ #endif\r
+\r
+ #define UINT8_MAX 0xff\r
+\r
+#else\r
+ //\r
+ // Use ANSI C 2000 stdint.h integer width declarations\r
+ //\r
+ #include <stdint.h>\r
+ typedef uint8_t BOOLEAN;\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
+\r
+#endif\r
+\r
+typedef UINT64 UINTN;\r
+typedef INT64 INTN;\r
+\r
+\r
+//\r
+// Processor specific defines\r
+//\r
+#define MAX_BIT 0x8000000000000000ULL\r
+#define MAX_2_BITS 0xC000000000000000ULL\r
+\r
+//\r
+// Maximum legal X64 address\r
+//\r
+#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r
+\r
+//\r
+// The stack alignment required for X64\r
+//\r
+#define CPU_STACK_ALIGNMENT 16\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
+#if _MSC_EXTENSIONS \r
+ ///\r
+ /// Define the standard calling convention reguardless of optimization level.\r
+ /// __cdecl is Microsoft* specific C extension.\r
+ /// \r
+ #define EFIAPI __cdecl \r
+#elif __GNUC__\r
+ ///\r
+ /// Define the standard calling convention reguardless of optimization level.\r
+ /// The GCC support assumes a GCC compiler that supports the EFI ABI. The EFI\r
+ /// ABI is much closer to the x64 Microsoft* ABI than standard x64 (x86-64) \r
+ /// GCC ABI. Thus a standard x64 (x86-64) GCC compiler can not be used for \r
+ /// x64. Warning the assembly code in the MDE x64 does not follow the correct \r
+ /// ABI for the standard x64 (x86-64) GCC.\r
+ ///\r
+ #define EFIAPI \r
+#else\r
+ ///\r
+ /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI\r
+ /// is the standard. \r
+ ///\r
+ #define EFIAPI \r
+#endif\r
+\r
+//\r
+// The Microsoft* C compiler can removed references to unreferenced data items\r
+// if the /OPT:REF linker option is used. We defined a macro as this is a \r
+// a non standard extension\r
+//\r
+#if _MSC_EXTENSIONS\r
+ #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)\r
+#else\r
+ #define GLOBAL_REMOVE_IF_UNREFERENCED\r
+#endif\r
+\r
+#endif\r
+\r