Move to directory "Include"

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2646 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
yshang1 2007-06-08 11:31:52 +00:00
parent 71d44daf07
commit 959ccb23c6
27 changed files with 9390 additions and 0 deletions

303
MdePkg/Include/Base.h Normal file
View File

@ -0,0 +1,303 @@
/** @file
Root include file for Mde Package Base type modules
This is the include file for any module of type base. Base modules only use
types defined via this include file and can be ported easily to any
environment. There are a set of base libraries in the Mde Package that can
be used to implement base modules.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __BASE_H__
#define __BASE_H__
//
// Include processor specific binding
//
#include <ProcessorBind.h>
typedef struct {
UINT32 Data1;
UINT16 Data2;
UINT16 Data3;
UINT8 Data4[8];
} GUID;
typedef UINT64 PHYSICAL_ADDRESS;
//
// LIST_ENTRY definition
//
typedef struct _LIST_ENTRY LIST_ENTRY;
struct _LIST_ENTRY {
LIST_ENTRY *ForwardLink;
LIST_ENTRY *BackLink;
};
//
// Modifiers to absract standard types to aid in debug of problems
//
#define CONST const
#define STATIC static
#define VOID void
//
// Modifiers for Data Types used to self document code.
// This concept is borrowed for UEFI specification.
//
#ifndef IN
//
// Some other envirnments use this construct, so #ifndef to prevent
// mulitple definition.
//
#define IN
#define OUT
#define OPTIONAL
#endif
//
// Constants. They may exist in other build structures, so #ifndef them.
//
#ifndef TRUE
//
// UEFI specification claims 1 and 0. We are concerned about the
// complier portability so we did it this way.
//
#define TRUE ((BOOLEAN)(1==1))
#endif
#ifndef FALSE
#define FALSE ((BOOLEAN)(0==1))
#endif
#ifndef NULL
#define NULL ((VOID *) 0)
#endif
#define BIT0 0x00000001
#define BIT1 0x00000002
#define BIT2 0x00000004
#define BIT3 0x00000008
#define BIT4 0x00000010
#define BIT5 0x00000020
#define BIT6 0x00000040
#define BIT7 0x00000080
#define BIT8 0x00000100
#define BIT9 0x00000200
#define BIT10 0x00000400
#define BIT11 0x00000800
#define BIT12 0x00001000
#define BIT13 0x00002000
#define BIT14 0x00004000
#define BIT15 0x00008000
#define BIT16 0x00010000
#define BIT17 0x00020000
#define BIT18 0x00040000
#define BIT19 0x00080000
#define BIT20 0x00100000
#define BIT21 0x00200000
#define BIT22 0x00400000
#define BIT23 0x00800000
#define BIT24 0x01000000
#define BIT25 0x02000000
#define BIT26 0x04000000
#define BIT27 0x08000000
#define BIT28 0x10000000
#define BIT29 0x20000000
#define BIT30 0x40000000
#define BIT31 0x80000000
#define BIT32 0x0000000100000000UL
#define BIT33 0x0000000200000000UL
#define BIT34 0x0000000400000000UL
#define BIT35 0x0000000800000000UL
#define BIT36 0x0000001000000000UL
#define BIT37 0x0000002000000000UL
#define BIT38 0x0000004000000000UL
#define BIT39 0x0000008000000000UL
#define BIT40 0x0000010000000000UL
#define BIT41 0x0000020000000000UL
#define BIT42 0x0000040000000000UL
#define BIT43 0x0000080000000000UL
#define BIT44 0x0000100000000000UL
#define BIT45 0x0000200000000000UL
#define BIT46 0x0000400000000000UL
#define BIT47 0x0000800000000000UL
#define BIT48 0x0001000000000000UL
#define BIT49 0x0002000000000000UL
#define BIT50 0x0004000000000000UL
#define BIT51 0x0008000000000000UL
#define BIT52 0x0010000000000000UL
#define BIT53 0x0020000000000000UL
#define BIT54 0x0040000000000000UL
#define BIT55 0x0080000000000000UL
#define BIT56 0x0100000000000000UL
#define BIT57 0x0200000000000000UL
#define BIT58 0x0400000000000000UL
#define BIT59 0x0800000000000000UL
#define BIT60 0x1000000000000000UL
#define BIT61 0x2000000000000000UL
#define BIT62 0x4000000000000000UL
#define BIT63 0x8000000000000000UL
//
// Support for variable length argument lists using the ANSI standard.
//
// Since we are using the ANSI standard we used the standard nameing and
// did not folow the coding convention
//
// VA_LIST - typedef for argument list.
// VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use.
// VA_END (VA_LIST Marker) - Clear Marker
// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argumnet from
// the ... list. You must know the size and pass it in this macro.
//
// example:
//
// UINTN
// ExampleVarArg (
// IN UINTN NumberOfArgs,
// ...
// )
// {
// VA_LIST Marker;
// UINTN Index;
// UINTN Result;
//
// //
// // Initialize the Marker
// //
// VA_START (Marker, NumberOfArgs);
// for (Index = 0, Result = 0; Index < NumberOfArgs; Index++) {
// //
// // The ... list is a series of UINTN values, so average them up.
// //
// Result += VA_ARG (Marker, UINTN);
// }
//
// VA_END (Marker);
// return Result
// }
//
#define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
//
// Also support coding convention rules for var arg macros
//
#ifndef VA_START
typedef CHAR8 *VA_LIST;
#define VA_START(ap, v) (ap = (VA_LIST) & (v) + _INT_SIZE_OF (v))
#define VA_ARG(ap, t) (*(t *) ((ap += _INT_SIZE_OF (t)) - _INT_SIZE_OF (t)))
#define VA_END(ap) (ap = (VA_LIST) 0)
#endif
//
// Macro that returns the byte offset of a field in a data structure.
//
#define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
///
/// CONTAINING_RECORD - returns a pointer to the structure
/// from one of it's elements.
///
#define _CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
///
/// ALIGN_POINTER - aligns a pointer to the lowest boundry
///
#define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1))))
///
/// ALIGN_VARIABLE - aligns a variable up to the next natural boundry for int size of a processor
///
#define ALIGN_VARIABLE(Value, Adjustment) \
Adjustment = 0U; \
if ((UINTN) (Value) % sizeof (UINTN)) { \
(Adjustment) = (UINTN)(sizeof (UINTN) - ((UINTN) (Value) % sizeof (UINTN))); \
} \
(Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment))
//
// Return the maximum of two operands.
// This macro returns the maximum of two operand specified by a and b.
// Both a and b must be the same numerical types, signed or unsigned.
//
#define MAX(a, b) \
(((a) > (b)) ? (a) : (b))
//
// Return the minimum of two operands.
// This macro returns the minimal of two operand specified by a and b.
// Both a and b must be the same numerical types, signed or unsigned.
//
#define MIN(a, b) \
(((a) < (b)) ? (a) : (b))
//
// EFI Error Codes common to all execution phases
//
typedef INTN RETURN_STATUS;
///
/// Set the upper bit to indicate EFI Error.
///
#define ENCODE_ERROR(a) (MAX_BIT | (a))
#define ENCODE_WARNING(a) (a)
#define RETURN_ERROR(a) ((a) < 0)
#define RETURN_SUCCESS 0
#define RETURN_LOAD_ERROR ENCODE_ERROR (1)
#define RETURN_INVALID_PARAMETER ENCODE_ERROR (2)
#define RETURN_UNSUPPORTED ENCODE_ERROR (3)
#define RETURN_BAD_BUFFER_SIZE ENCODE_ERROR (4)
#define RETURN_BUFFER_TOO_SMALL ENCODE_ERROR (5)
#define RETURN_NOT_READY ENCODE_ERROR (6)
#define RETURN_DEVICE_ERROR ENCODE_ERROR (7)
#define RETURN_WRITE_PROTECTED ENCODE_ERROR (8)
#define RETURN_OUT_OF_RESOURCES ENCODE_ERROR (9)
#define RETURN_VOLUME_CORRUPTED ENCODE_ERROR (10)
#define RETURN_VOLUME_FULL ENCODE_ERROR (11)
#define RETURN_NO_MEDIA ENCODE_ERROR (12)
#define RETURN_MEDIA_CHANGED ENCODE_ERROR (13)
#define RETURN_NOT_FOUND ENCODE_ERROR (14)
#define RETURN_ACCESS_DENIED ENCODE_ERROR (15)
#define RETURN_NO_RESPONSE ENCODE_ERROR (16)
#define RETURN_NO_MAPPING ENCODE_ERROR (17)
#define RETURN_TIMEOUT ENCODE_ERROR (18)
#define RETURN_NOT_STARTED ENCODE_ERROR (19)
#define RETURN_ALREADY_STARTED ENCODE_ERROR (20)
#define RETURN_ABORTED ENCODE_ERROR (21)
#define RETURN_ICMP_ERROR ENCODE_ERROR (22)
#define RETURN_TFTP_ERROR ENCODE_ERROR (23)
#define RETURN_PROTOCOL_ERROR ENCODE_ERROR (24)
#define RETURN_INCOMPATIBLE_VERSION ENCODE_ERROR (25)
#define RETURN_SECURITY_VIOLATION ENCODE_ERROR (26)
#define RETURN_CRC_ERROR ENCODE_ERROR (27)
#define RETURN_END_OF_MEDIA ENCODE_ERROR (28)
#define RETURN_END_OF_FILE ENCODE_ERROR (31)
#define RETURN_WARN_UNKNOWN_GLYPH ENCODE_WARNING (1)
#define RETURN_WARN_DELETE_FAILURE ENCODE_WARNING (2)
#define RETURN_WARN_WRITE_FAILURE ENCODE_WARNING (3)
#define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4)
#endif

View File

@ -0,0 +1,85 @@
/** @file
Processor or compiler specific defines and types for EBC.
We currently only have one EBC complier so there may be some Intel compiler
specific functions in this file.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: ProcessorBind.h
**/
#ifndef __PROCESSOR_BIND_H__
#define __PROCESSOR_BIND_H__
//
// Define the processor type so other code can make processor based choices
//
#define MDE_CPU_EBC
//
// Native integer types
//
typedef char INT8;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef unsigned char CHAR8;
typedef short INT16;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef int INT32;
typedef unsigned int UINT32;
typedef __int64 INT64;
typedef unsigned __int64 UINT64;
//
// "long" type scales to the processor native size with EBC compiler
//
typedef long INTN;
typedef unsigned long UINTN;
#define UINT8_MAX 0xff
//
// Scalable macro to set the most significant bit in a natural number
//
#define MAX_BIT (1ULL << (sizeof (INTN) * 8 - 1))
#define MAX_2_BITS (3ULL << (sizeof (INTN) * 8 - 2))
//
// Maximum legal EBC address
//
#define MAX_ADDRESS ((UINTN) ~0)
//
// The stack alignment required for EBC
//
#define CPU_STACK_ALIGNMENT sizeof(UINTN)
//
// Modifier to ensure that all protocol member functions and EFI intrinsics
// use the correct C calling convention. All protocol member functions and
// EFI intrinsics are required to modify thier member functions with EFIAPI.
//
#define EFIAPI
//
// The Microsoft* C compiler can removed references to unreferenced data items
// if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension. Currently not supported by the EBC compiler
//
#define GLOBAL_REMOVE_IF_UNREFERENCED
#endif

View File

@ -0,0 +1,182 @@
/** @file
Processor or Compiler specific defines and types for x64.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: ProcessorBind.h
**/
#ifndef __PROCESSOR_BIND_H__
#define __PROCESSOR_BIND_H__
//
// Define the processor type so other code can make processor based choices
//
#define MDE_CPU_IA32
//
// Make sure we are useing the correct packing rules per EFI specification
//
#ifndef __GNUC__
#pragma pack()
#endif
#if _MSC_EXTENSIONS
//
// Disable warning that make it impossible to compile at /W4
// This only works for Microsoft* tools
//
//
// Disabling bitfield type checking warnings.
//
#pragma warning ( disable : 4214 )
//
// Disabling the unreferenced formal parameter warnings.
//
#pragma warning ( disable : 4100 )
//
// Disable slightly different base types warning as CHAR8 * can not be set
// to a constant string.
//
#pragma warning ( disable : 4057 )
//
// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
//
#pragma warning ( disable : 4127 )
//
// This warning is caused by functions defined but not used. For precompiled header only.
//
#pragma warning ( disable : 4505 )
//
// This warning is caused by empty (after preprocessing) souce file. For precompiled header only.
//
#pragma warning ( disable : 4206 )
#endif
#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
//
// No ANSI C 2000 stdint.h integer width declarations, so define equivalents
//
#if _MSC_EXTENSIONS
//
// use Microsoft* C complier dependent interger width types
//
typedef unsigned __int64 UINT64;
typedef __int64 INT64;
typedef unsigned __int32 UINT32;
typedef __int32 INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef char INT8;
#else
//
// Assume standard IA-32 alignment.
// Need to check portability of long long
//
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef char INT8;
#endif
#define UINT8_MAX 0xff
#else
//
// Use ANSI C 2000 stdint.h integer width declarations
//
#include "stdint.h"
typedef uint8_t BOOLEAN;
typedef int8_t INT8;
typedef uint8_t UINT8;
typedef int16_t INT16;
typedef uint16_t UINT16;
typedef int32_t INT32;
typedef uint32_t UINT32;
typedef int64_t INT64;
typedef uint64_t UINT64;
typedef char CHAR8;
typedef uint16_t CHAR16;
#endif
typedef UINT32 UINTN;
typedef INT32 INTN;
//
// Processor specific defines
//
#define MAX_BIT 0x80000000
#define MAX_2_BITS 0xC0000000
//
// Maximum legal IA-32 address
//
#define MAX_ADDRESS 0xFFFFFFFF
//
// The stack alignment required for IA-32
//
#define CPU_STACK_ALIGNMENT sizeof(UINTN)
//
// Modifier to ensure that all protocol member functions and EFI intrinsics
// use the correct C calling convention. All protocol member functions and
// EFI intrinsics are required to modify thier member functions with EFIAPI.
//
#if _MSC_EXTENSIONS
//
// Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.
//
#define EFIAPI __cdecl
#endif
#if __GNUC__
#define EFIAPI __attribute__((cdecl))
#endif
//
// The Microsoft* C compiler can removed references to unreferenced data items
// if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension
//
#if _MSC_EXTENSIONS
#define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
#else
#define GLOBAL_REMOVE_IF_UNREFERENCED
#endif
#endif

View File

@ -0,0 +1,553 @@
///** @file
// IPF Processor Defines for assembly code
//
// @note
// This file is included by assembly files as well. The assmber can NOT deal
// with /* */ commnets this is why this file is commented not following the
// coding standard
//
//Copyright (c) 2006, Intel Corporation
//All rights reserved. This program and the accompanying materials
//are licensed and made available under the terms and conditions of the BSD License
//which accompanies this distribution. The full text of the license may be found at
//http://opensource.org/licenses/bsd-license.php
//
//THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
//WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
//Module Name: IpfDefines.h
//
//**/
#ifndef _IPFDEFINES_H
#define _IPFDEFINES_H
//
// IPI DElivery Methods
//
#define IPI_INT_DELIVERY 0x0
#define IPI_PMI_DELIVERY 0x2
#define IPI_NMI_DELIVERY 0x4
#define IPI_INIT_DELIVERY 0x5
#define IPI_ExtINT_DELIVERY 0x7
//
// Define Itanium-based system registers.
//
// Define Itanium-based system register bit field offsets.
//
// Processor Status Register (PSR) Bit positions
//
// User / System mask
//
#define PSR_RV0 0
#define PSR_BE 1
#define PSR_UP 2
#define PSR_AC 3
#define PSR_MFL 4
#define PSR_MFH 5
//
// PSR bits 6-12 reserved (must be zero)
//
#define PSR_MBZ0 6
#define PSR_MBZ0_V 0x1ffUL L
//
// System only mask
//
#define PSR_IC 13
#define PSR_IC_MASK (1 << 13)
#define PSR_I 14
#define PSR_PK 15
#define PSR_MBZ1 16
#define PSR_MBZ1_V 0x1UL L
#define PSR_DT 17
#define PSR_DFL 18
#define PSR_DFH 19
#define PSR_SP 20
#define PSR_PP 21
#define PSR_DI 22
#define PSR_SI 23
#define PSR_DB 24
#define PSR_LP 25
#define PSR_TB 26
#define PSR_RT 27
//
// PSR bits 28-31 reserved (must be zero)
//
#define PSR_MBZ2 28
#define PSR_MBZ2_V 0xfUL L
//
// Neither mask
//
#define PSR_CPL 32
#define PSR_CPL_LEN 2
#define PSR_IS 34
#define PSR_MC 35
#define PSR_IT 36
#define PSR_IT_MASK 0x1000000000
#define PSR_ID 37
#define PSR_DA 38
#define PSR_DD 39
#define PSR_SS 40
#define PSR_RI 41
#define PSR_RI_LEN 2
#define PSR_ED 43
#define PSR_BN 44
//
// PSR bits 45-63 reserved (must be zero)
//
#define PSR_MBZ3 45
#define PSR_MBZ3_V 0xfffffULL
//
// Floating Point Status Register (FPSR) Bit positions
//
//
// Traps
//
#define FPSR_VD 0
#define FPSR_DD 1
#define FPSR_ZD 2
#define FPSR_OD 3
#define FPSR_UD 4
#define FPSR_ID 5
//
// Status Field 0 - Controls
//
#define FPSR0_FTZ0 6
#define FPSR0_WRE0 7
#define FPSR0_PC0 8
#define FPSR0_RC0 10
#define FPSR0_TD0 12
//
// Status Field 0 - Flags
//
#define FPSR0_V0 13
#define FPSR0_D0 14
#define FPSR0_Z0 15
#define FPSR0_O0 16
#define FPSR0_U0 17
#define FPSR0_I0 18
//
// Status Field 1 - Controls
//
#define FPSR1_FTZ0 19
#define FPSR1_WRE0 20
#define FPSR1_PC0 21
#define FPSR1_RC0 23
#define FPSR1_TD0 25
//
// Status Field 1 - Flags
//
#define FPSR1_V0 26
#define FPSR1_D0 27
#define FPSR1_Z0 28
#define FPSR1_O0 29
#define FPSR1_U0 30
#define FPSR1_I0 31
//
// Status Field 2 - Controls
//
#define FPSR2_FTZ0 32
#define FPSR2_WRE0 33
#define FPSR2_PC0 34
#define FPSR2_RC0 36
#define FPSR2_TD0 38
//
// Status Field 2 - Flags
//
#define FPSR2_V0 39
#define FPSR2_D0 40
#define FPSR2_Z0 41
#define FPSR2_O0 42
#define FPSR2_U0 43
#define FPSR2_I0 44
//
// Status Field 3 - Controls
//
#define FPSR3_FTZ0 45
#define FPSR3_WRE0 46
#define FPSR3_PC0 47
#define FPSR3_RC0 49
#define FPSR3_TD0 51
//
// Status Field 0 - Flags
//
#define FPSR3_V0 52
#define FPSR3_D0 53
#define FPSR3_Z0 54
#define FPSR3_O0 55
#define FPSR3_U0 56
#define FPSR3_I0 57
//
// FPSR bits 58-63 Reserved -- Must be zero
//
#define FPSR_MBZ0 58
#define FPSR_MBZ0_V 0x3fUL L
//
// For setting up FPSR on kernel entry
// All traps are disabled.
//
#define FPSR_FOR_KERNEL 0x3f
#define FP_REG_SIZE 16 // 16 byte spill size
#define HIGHFP_REGS_LENGTH (96 * 16)
//
// Define hardware Task Priority Register (TPR)
//
//
// TPR bit positions
//
#define TPR_MIC 4 // Bits 0 - 3 ignored
#define TPR_MIC_LEN 4
#define TPR_MMI 16 // Mask Maskable Interrupt
//
// Define hardware Interrupt Status Register (ISR)
//
//
// ISR bit positions
//
#define ISR_CODE 0
#define ISR_CODE_LEN 16
#define ISR_CODE_MASK 0xFFFF
#define ISR_IA_VECTOR 16
#define ISR_IA_VECTOR_LEN 8
#define ISR_MBZ0 24
#define ISR_MBZ0_V 0xff
#define ISR_X 32
#define ISR_W 33
#define ISR_R 34
#define ISR_NA 35
#define ISR_SP 36
#define ISR_RS 37
#define ISR_IR 38
#define ISR_NI 39
#define ISR_MBZ1 40
#define ISR_EI 41
#define ISR_ED 43
#define ISR_MBZ2 44
#define ISR_MBZ2_V 0xfffff
//
// ISR codes
//
// For General exceptions: ISR{3:0}
//
#define ISR_ILLEGAL_OP 0 // Illegal operation fault
#define ISR_PRIV_OP 1 // Privileged operation fault
#define ISR_PRIV_REG 2 // Privileged register fauls
#define ISR_RESVD_REG 3 // Reserved register/field flt
#define ISR_ILLEGAL_ISA 4 // Disabled instruction set transition fault
//
// Define hardware Default Control Register (DCR)
//
//
// DCR bit positions
//
#define DCR_PP 0
#define DCR_BE 1
#define DCR_LC 2
#define DCR_MBZ0 4
#define DCR_MBZ0_V 0xf
#define DCR_DM 8
#define DCR_DP 9
#define DCR_DK 10
#define DCR_DX 11
#define DCR_DR 12
#define DCR_DA 13
#define DCR_DD 14
#define DCR_DEFER_ALL 0x7f00
#define DCR_MBZ1 2
#define DCR_MBZ1_V 0xffffffffffffUL L
//
// Define hardware RSE Configuration Register
//
// RS Configuration (RSC) bit field positions
//
#define RSC_MODE 0
#define RSC_PL 2
#define RSC_BE 4
#define RSC_MBZ0 5
#define RSC_MBZ0_V 0x3ff
#define RSC_LOADRS 16
#define RSC_LOADRS_LEN 14
#define RSC_MBZ1 30
#define RSC_MBZ1_V 0x3ffffffffUL L
//
// RSC modes
//
#define RSC_MODE_LY (0x0) // Lazy
#define RSC_MODE_SI (0x1) // Store intensive
#define RSC_MODE_LI (0x2) // Load intensive
#define RSC_MODE_EA (0x3) // Eager
//
// RSC Endian bit values
//
#define RSC_BE_LITTLE 0
#define RSC_BE_BIG 1
//
// Define Interruption Function State (IFS) Register
//
// IFS bit field positions
//
#define IFS_IFM 0
#define IFS_IFM_LEN 38
#define IFS_MBZ0 38
#define IFS_MBZ0_V 0x1ffffff
#define IFS_V 63
#define IFS_V_LEN 1
//
// IFS is valid when IFS_V = IFS_VALID
//
#define IFS_VALID 1
//
// Define Page Table Address (PTA)
//
#define PTA_VE 0
#define PTA_VF 8
#define PTA_SIZE 2
#define PTA_SIZE_LEN 6
#define PTA_BASE 15
//
// Define Region Register (RR)
//
//
// RR bit field positions
//
#define RR_VE 0
#define RR_MBZ0 1
#define RR_PS 2
#define RR_PS_LEN 6
#define RR_RID 8
#define RR_RID_LEN 24
#define RR_MBZ1 32
//
// SAL uses region register 0 and RID of 1000
//
#define SAL_RID 0x1000
#define SAL_RR_REG 0x0
#define SAL_TR 0x0
//
// Total number of region registers
//
#define RR_SIZE 8
//
// Define Protection Key Register (PKR)
//
// PKR bit field positions
//
#define PKR_V 0
#define PKR_WD 1
#define PKR_RD 2
#define PKR_XD 3
#define PKR_MBZ0 4
#define PKR_KEY 8
#define PKR_KEY_LEN 24
#define PKR_MBZ1 32
#define PKR_VALID (1 << PKR_V)
//
// Number of protection key registers
//
#define PKRNUM 8
//
// Define Interruption TLB Insertion register (ITIR)
//
//
// Define Translation Insertion Format (TR)
//
// PTE0 bit field positions
//
#define PTE0_P 0
#define PTE0_MBZ0 1
#define PTE0_MA 2
#define PTE0_A 5
#define PTE0_D 6
#define PTE0_PL 7
#define PTE0_AR 9
#define PTE0_PPN 12
#define PTE0_MBZ1 48
#define PTE0_ED 52
#define PTE0_IGN0 53
//
// ITIR bit field positions
//
#define ITIR_MBZ0 0
#define ITIR_PS 2
#define ITIR_PS_LEN 6
#define ITIR_KEY 8
#define ITIR_KEY_LEN 24
#define ITIR_MBZ1 32
#define ITIR_MBZ1_LEN 16
#define ITIR_PPN 48
#define ITIR_PPN_LEN 15
#define ITIR_MBZ2 63
#define ATTR_IPAGE 0x661 // Access Rights = RWX (bits 11-9=011), PL 0(8-7=0)
#define ATTR_DEF_BITS 0x661 // Access Rights = RWX (bits 11-9=010), PL 0(8-7=0)
// Dirty (bit 6=1), Accessed (bit 5=1),
// MA WB (bits 4-2=000), Present (bit 0=1)
//
// Memory access rights
//
#define AR_UR_KR 0x0 // user/kernel read
#define AR_URX_KRX 0x1 // user/kernel read and execute
#define AR_URW_KRW 0x2 // user/kernel read & write
#define AR_URWX_KRWX 0x3 // user/kernel read,write&execute
#define AR_UR_KRW 0x4 // user read/kernel read,write
#define AR_URX_KRWX 0x5 // user read/execute, kernel all
#define AR_URWX_KRW 0x6 // user all, kernel read & write
#define AR_UX_KRX 0x7 // user execute only, kernel read and execute
//
// Memory attribute values
//
//
// The next 4 are all cached, non-sequential & speculative, coherent
//
#define MA_WBU 0x0 // Write back, unordered
//
// The next 3 are all non-cached, sequential & non-speculative
//
#define MA_UC 0x4 // Non-coalescing, sequential & non-speculative
#define MA_UCE 0x5 // Non-coalescing, sequential, non-speculative
// & fetchadd exported
//
#define MA_WC 0x6 // Non-cached, Coalescing, non-seq., spec.
#define MA_NAT 0xf // NaT page
//
// Definition of the offset of TRAP/INTERRUPT/FAULT handlers from the
// base of IVA (Interruption Vector Address)
//
#define IVT_SIZE 0x8000
#define EXTRA_ALIGNMENT 0x1000
#define OFF_VHPTFLT 0x0000 // VHPT Translation fault
#define OFF_ITLBFLT 0x0400 // Instruction TLB fault
#define OFF_DTLBFLT 0x0800 // Data TLB fault
#define OFF_ALTITLBFLT 0x0C00 // Alternate ITLB fault
#define OFF_ALTDTLBFLT 0x1000 // Alternate DTLB fault
#define OFF_NESTEDTLBFLT 0x1400 // Nested TLB fault
#define OFF_IKEYMISSFLT 0x1800 // Inst Key Miss fault
#define OFF_DKEYMISSFLT 0x1C00 // Data Key Miss fault
#define OFF_DIRTYBITFLT 0x2000 // Dirty-Bit fault
#define OFF_IACCESSBITFLT 0x2400 // Inst Access-Bit fault
#define OFF_DACCESSBITFLT 0x2800 // Data Access-Bit fault
#define OFF_BREAKFLT 0x2C00 // Break Inst fault
#define OFF_EXTINT 0x3000 // External Interrupt
//
// Offset 0x3400 to 0x0x4C00 are reserved
//
#define OFF_PAGENOTPFLT 0x5000 // Page Not Present fault
#define OFF_KEYPERMFLT 0x5100 // Key Permission fault
#define OFF_IACCESSRTFLT 0x5200 // Inst Access-Rights flt
#define OFF_DACCESSRTFLT 0x5300 // Data Access-Rights fault
#define OFF_GPFLT 0x5400 // General Exception fault
#define OFF_FPDISFLT 0x5500 // Disable-FP fault
#define OFF_NATFLT 0x5600 // NAT Consumption fault
#define OFF_SPECLNFLT 0x5700 // Speculation fault
#define OFF_DBGFLT 0x5900 // Debug fault
#define OFF_ALIGNFLT 0x5A00 // Unaligned Reference fault
#define OFF_LOCKDREFFLT 0x5B00 // Locked Data Reference fault
#define OFF_FPFLT 0x5C00 // Floating Point fault
#define OFF_FPTRAP 0x5D00 // Floating Point Trap
#define OFF_LOPRIVTRAP 0x5E00 // Lower-Privilege Transfer Trap
#define OFF_TAKENBRTRAP 0x5F00 // Taken Branch Trap
#define OFF_SSTEPTRAP 0x6000 // Single Step Trap
//
// Offset 0x6100 to 0x6800 are reserved
//
#define OFF_IA32EXCEPTN 0x6900 // iA32 Exception
#define OFF_IA32INTERCEPT 0x6A00 // iA32 Intercept
#define OFF_IA32INT 0x6B00 // iA32 Interrupt
#define NUMBER_OF_VECTORS 0x100
//
// Privilege levels
//
#define PL_KERNEL 0
#define PL_USER 3
//
// Instruction set (IS) bits
//
#define IS_IA64 0
#define IS_IA 1
//
// RSC while in kernel: enabled, little endian, PL = 0, eager mode
//
#define RSC_KERNEL ((RSC_MODE_EA << RSC_MODE) | (RSC_BE_LITTLE << RSC_BE))
//
// Lazy RSC in kernel: enabled, little endian, pl = 0, lazy mode
//
#define RSC_KERNEL_LAZ ((RSC_MODE_LY << RSC_MODE) | (RSC_BE_LITTLE << RSC_BE))
//
// RSE disabled: disabled, PL = 0, little endian, eager mode
//
#define RSC_KERNEL_DISABLED ((RSC_MODE_LY << RSC_MODE) | (RSC_BE_LITTLE << RSC_BE))
#define NAT_BITS_PER_RNAT_REG 63
//
// Macros for generating PTE0 and PTE1 value
//
#define PTE0(ed, ppn12_47, ar, pl, d, a, ma, p) \
( ( ed << PTE0_ED ) | \
( ppn12_47 << PTE0_PPN ) | \
( ar << PTE0_AR ) | \
( pl << PTE0_PL ) | \
( d << PTE0_D ) | \
( a << PTE0_A ) | \
( ma << PTE0_MA ) | \
( p << PTE0_P ) \
)
#define ITIR(ppn48_63, key, ps) \
( ( ps << ITIR_PS ) | \
( key << ITIR_KEY ) | \
( ppn48_63 << ITIR_PPN ) \
)
//
// Macro to generate mask value from bit position. The result is a
// 64-bit.
//
#define BITMASK(bp, value) (value << bp)
#define BUNDLE_SIZE 16
#define SPURIOUS_INT 0xF
#define FAST_DISABLE_INTERRUPTS rsm BITMASK (PSR_I, 1);;
#define FAST_ENABLE_INTERRUPTS ssm BITMASK (PSR_I, 1);;
#endif

View File

@ -0,0 +1,67 @@
//++
// Copyright (c) 2006, Intel Corporation
// All rights reserved. This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
// http://opensource.org/licenses/bsd-license.php
//
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
// Module Name:
// IpfMacro.i
//
// Abstract:
// Contains the macros needed for calling procedures in Itanium-based assembly code.
//
//
// Revision History:
//
//--
#ifndef __IA64PROC_I__
#define __IA64PROC_I__
#define PROCEDURE_ENTRY(name) .##text; \
.##type name, @function; \
.##proc name; \
name::
#define PROCEDURE_EXIT(name) .##endp name
// Note: use of NESTED_SETUP requires number of locals (l) >= 3
#define NESTED_SETUP(i,l,o,r) \
alloc loc1=ar##.##pfs,i,l,o,r ;\
mov loc0=b0
#define NESTED_RETURN \
mov b0=loc0 ;\
mov ar##.##pfs=loc1 ;;\
br##.##ret##.##dpnt b0;;
#define GLOBAL_FUNCTION(Function) \
.##type Function, @function; \
.##global Function
#define INTERRUPT_HANDLER_BEGIN(name) \
PROCEDURE_ENTRY(name##HandlerBegin) \
;; \
PROCEDURE_EXIT(name##HandlerBegin)
#define INTERRUPT_HANDLER_END(name) \
PROCEDURE_ENTRY(name##HandlerEnd) \
;; \
PROCEDURE_EXIT(name##HandlerEnd)
#define INTERRUPT_HANDLER_BLOCK_BEGIN \
INTERRUPT_HANDLER_BEGIN(First)
#define INTERRUPT_HANDLER_BLOCK_END \
INTERRUPT_HANDLER_END(Last)
#endif

View File

@ -0,0 +1,31 @@
/** @file
Main PAL API's defined in IPF PAL Spec.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PalApi.h
**/
#ifndef __PAL_API_H__
#define __PAL_API_H__
//
// IPF Specific Functions
//
typedef struct {
UINT64 Status;
UINT64 r9;
UINT64 r10;
UINT64 r11;
} PAL_CALL_RETURN;
#endif

View File

@ -0,0 +1,221 @@
/** @file
Processor or Compiler specific defines and types for Intel Itanium(TM).
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: ProcessorBind.h
**/
#ifndef __PROCESSOR_BIND_H__
#define __PROCESSOR_BIND_H__
//
// Define the processor type so other code can make processor based choices
//
#define MDE_CPU_IPF
//
// Make sure we are useing the correct packing rules per EFI specification
//
#pragma pack()
#if _MSC_EXTENSIONS
//
// Disable warning that make it impossible to compile at /W4
// This only works for Microsoft tools. Copied from the
// IA-32 version of efibind.h
//
//
// Disabling bitfield type checking warnings.
//
#pragma warning ( disable : 4214 )
// Disabling the unreferenced formal parameter warnings.
//
#pragma warning ( disable : 4100 )
//
// Disable slightly different base types warning as CHAR8 * can not be set
// to a constant string.
//
#pragma warning ( disable : 4057 )
//
// Disable warning on conversion from function pointer to a data pointer
//
#pragma warning ( disable : 4054 )
//
// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
//
#pragma warning ( disable : 4127 )
//
// Can not cast a function pointer to a data pointer. We need to do this on
// IPF to get access to the PLABEL.
//
#pragma warning ( disable : 4514 )
//
// This warning is caused by functions defined but not used. For precompiled header only.
//
#pragma warning ( disable : 4505 )
//
// This warning is caused by empty (after preprocessing) souce file. For precompiled header only.
//
#pragma warning ( disable : 4206 )
#endif
#if (__STDC_VERSION__ < 199901L)
//
// No ANSI C 2000 stdint.h integer width declarations, so define equivalents
//
#if _MSC_EXTENSIONS
//
// use Microsoft C complier dependent interger width types
//
typedef unsigned __int64 UINT64;
typedef __int64 INT64;
typedef unsigned __int32 UINT32;
typedef __int32 INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef char INT8;
#else
#ifdef _EFI_P64
//
// P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
// are 32-bits
//
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short CHAR16;
typedef unsigned short UINT16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef char INT8;
#else
//
// Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
//
typedef unsigned long UINT64;
typedef long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef char INT8;
#endif
#endif
#define UINT8_MAX 0xff
#else
//
// Use ANSI C 2000 stdint.h integer width declarations
//
#include <stdint.h>
typedef uint8_t BOOLEAN;
typedef int8_t INT8;
typedef uint8_t UINT8;
typedef int16_t INT16;
typedef uint16_t UINT16;
typedef int32_t INT32;
typedef uint32_t UINT32;
typedef int64_t INT64;
typedef uint64_t UINT64;
typedef char CHAR8;
typedef uint16_t CHAR16;
#endif
typedef UINT64 UINTN;
typedef INT64 INTN;
//
// Processor specific defines
//
#define MAX_BIT 0x8000000000000000ULL
#define MAX_2_BITS 0xC000000000000000ULL
//
// Maximum legal Itanium-based address
//
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
//
// Per the Itanium Software Conventions and Runtime Architecture Guide,
// section 3.3.4, IPF stack must always be 16-byte aligned.
//
#define CPU_STACK_ALIGNMENT 16
//
// Modifier to ensure that all protocol member functions and EFI intrinsics
// use the correct C calling convention. All protocol member functions and
// EFI intrinsics are required to modify thier member functions with EFIAPI.
//
#if _MSC_EXTENSIONS
//
// Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.
//
#define EFIAPI __cdecl
#else
#define EFIAPI
#endif
//
// The Microsoft* C compiler can removed references to unreferenced data items
// if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension
//
#if _MSC_EXTENSIONS
#define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
#else
#define GLOBAL_REMOVE_IF_UNREFERENCED
#endif
//
// A pointer to a function in IPF points to a plabel.
//
typedef struct {
UINT64 EntryPoint;
UINT64 GP;
} EFI_PLABEL;
#include <IpfDefines.h>
#endif

721
MdePkg/Include/Ipf/SalApi.h Normal file
View File

@ -0,0 +1,721 @@
/** @file
Main SAL API's defined in SAL 3.0 specification.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: SalApi.h
**/
#ifndef __SAL_API_H__
#define __SAL_API_H__
//
// FIT Types
// Table 2-2 of Intel Itanium Processor Family System Abstraction Layer Specification December 2003
//
#define EFI_SAL_FIT_FIT_HEADER_TYPE 0x00
#define EFI_SAL_FIT_PAL_B_TYPE 0x01
//
// type from 0x02 to 0x0E is reserved.
//
#define EFI_SAL_FIT_PAL_A_TYPE 0x0F
//
// OEM-defined type range is from 0x10 to 0x7E. Here we defined the PEI_CORE type as 0x10
//
#define EFI_SAL_FIT_PEI_CORE_TYPE 0x10
#define EFI_SAL_FIT_UNUSED_TYPE 0x7F
//
// EFI_SAL_STATUS
//
typedef UINTN EFI_SAL_STATUS;
#define EFI_SAL_SUCCESS ((EFI_SAL_STATUS) 0)
#define EFI_SAL_MORE_RECORDS ((EFI_SAL_STATUS) 3)
#define EFI_SAL_NOT_IMPLEMENTED ((EFI_SAL_STATUS) - 1)
#define EFI_SAL_INVALID_ARGUMENT ((EFI_SAL_STATUS) - 2)
#define EFI_SAL_ERROR ((EFI_SAL_STATUS) - 3)
#define EFI_SAL_VIRTUAL_ADDRESS_ERROR ((EFI_SAL_STATUS) - 4)
#define EFI_SAL_NO_INFORMATION ((EFI_SAL_STATUS) - 5)
#define EFI_SAL_NOT_ENOUGH_SCRATCH ((EFI_SAL_STATUS) - 9)
//
// Return values from SAL
//
typedef struct {
EFI_SAL_STATUS Status; // register r8
UINTN r9;
UINTN r10;
UINTN r11;
} SAL_RETURN_REGS;
//
// Delivery Mode of IPF CPU.
//
typedef enum {
EFI_DELIVERY_MODE_INT,
EFI_DELIVERY_MODE_MPreserved1,
EFI_DELIVERY_MODE_PMI,
EFI_DELIVERY_MODE_MPreserved2,
EFI_DELIVERY_MODE_NMI,
EFI_DELIVERY_MODE_INIT,
EFI_DELIVERY_MODE_MPreserved3,
EFI_DELIVERY_MODE_ExtINT
} EFI_DELIVERY_MODE;
typedef SAL_RETURN_REGS (EFIAPI *SAL_PROC)
(
IN UINT64 FunctionId,
IN UINT64 Arg2,
IN UINT64 Arg3,
IN UINT64 Arg4,
IN UINT64 Arg5,
IN UINT64 Arg6,
IN UINT64 Arg7,
IN UINT64 Arg8
);
//
// SAL Procedure FunctionId definition
//
#define EFI_SAL_SET_VECTORS 0x01000000
#define EFI_SAL_GET_STATE_INFO 0x01000001
#define EFI_SAL_GET_STATE_INFO_SIZE 0x01000002
#define EFI_SAL_CLEAR_STATE_INFO 0x01000003
#define EFI_SAL_MC_RENDEZ 0x01000004
#define EFI_SAL_MC_SET_PARAMS 0x01000005
#define EFI_SAL_REGISTER_PHYSICAL_ADDR 0x01000006
#define EFI_SAL_CACHE_FLUSH 0x01000008
#define EFI_SAL_CACHE_INIT 0x01000009
#define EFI_SAL_PCI_CONFIG_READ 0x01000010
#define EFI_SAL_PCI_CONFIG_WRITE 0x01000011
#define EFI_SAL_FREQ_BASE 0x01000012
#define EFI_SAL_UPDATE_PAL 0x01000020
#define EFI_SAL_FUNCTION_ID_MASK 0x0000ffff
#define EFI_SAL_MAX_SAL_FUNCTION_ID 0x00000021
//
// SAL Procedure parameter definitions
// Not much point in using typedefs or enums because all params
// are UINT64 and the entry point is common
//
// EFI_SAL_SET_VECTORS
//
#define EFI_SAL_SET_MCA_VECTOR 0x0
#define EFI_SAL_SET_INIT_VECTOR 0x1
#define EFI_SAL_SET_BOOT_RENDEZ_VECTOR 0x2
typedef struct {
UINT64 Length : 32;
UINT64 ChecksumValid : 1;
UINT64 Reserved1 : 7;
UINT64 ByteChecksum : 8;
UINT64 Reserved2 : 16;
} SAL_SET_VECTORS_CS_N;
//
// EFI_SAL_GET_STATE_INFO, EFI_SAL_GET_STATE_INFO_SIZE,
// EFI_SAL_CLEAR_STATE_INFO
//
#define EFI_SAL_MCA_STATE_INFO 0x0
#define EFI_SAL_INIT_STATE_INFO 0x1
#define EFI_SAL_CMC_STATE_INFO 0x2
#define EFI_SAL_CP_STATE_INFO 0x3
//
// EFI_SAL_MC_SET_PARAMS
//
#define EFI_SAL_MC_SET_RENDEZ_PARAM 0x1
#define EFI_SAL_MC_SET_WAKEUP_PARAM 0x2
#define EFI_SAL_MC_SET_CPE_PARAM 0x3
#define EFI_SAL_MC_SET_INTR_PARAM 0x1
#define EFI_SAL_MC_SET_MEM_PARAM 0x2
//
// EFI_SAL_REGISTER_PAL_PHYSICAL_ADDR
//
#define EFI_SAL_REGISTER_PAL_ADDR 0x0
//
// EFI_SAL_CACHE_FLUSH
//
#define EFI_SAL_FLUSH_I_CACHE 0x01
#define EFI_SAL_FLUSH_D_CACHE 0x02
#define EFI_SAL_FLUSH_BOTH_CACHE 0x03
#define EFI_SAL_FLUSH_MAKE_COHERENT 0x04
//
// EFI_SAL_PCI_CONFIG_READ, EFI_SAL_PCI_CONFIG_WRITE
//
#define EFI_SAL_PCI_CONFIG_ONE_BYTE 0x1
#define EFI_SAL_PCI_CONFIG_TWO_BYTES 0x2
#define EFI_SAL_PCI_CONFIG_FOUR_BYTES 0x4
typedef struct {
UINT64 Register : 8;
UINT64 Function : 3;
UINT64 Device : 5;
UINT64 Bus : 8;
UINT64 Segment : 8;
UINT64 Reserved : 32;
} SAL_PCI_ADDRESS;
//
// EFI_SAL_FREQ_BASE
//
#define EFI_SAL_CPU_INPUT_FREQ_BASE 0x0
#define EFI_SAL_PLATFORM_IT_FREQ_BASE 0x1
#define EFI_SAL_PLATFORM_RTC_FREQ_BASE 0x2
//
// EFI_SAL_UPDATE_PAL
//
#define EFI_SAL_UPDATE_BAD_PAL_VERSION ((UINT64) -1)
#define EFI_SAL_UPDATE_PAL_AUTH_FAIL ((UINT64) -2)
#define EFI_SAL_UPDATE_PAL_BAD_TYPE ((UINT64) -3)
#define EFI_SAL_UPDATE_PAL_READONLY ((UINT64) -4)
#define EFI_SAL_UPDATE_PAL_WRITE_FAIL ((UINT64) -10)
#define EFI_SAL_UPDATE_PAL_ERASE_FAIL ((UINT64) -11)
#define EFI_SAL_UPDATE_PAL_READ_FAIL ((UINT64) -12)
#define EFI_SAL_UPDATE_PAL_CANT_FIT ((UINT64) -13)
typedef struct {
UINT32 Size;
UINT32 MmddyyyyDate;
UINT16 Version;
UINT8 Type;
UINT8 Reserved[5];
UINT64 FwVendorId;
} SAL_UPDATE_PAL_DATA_BLOCK;
typedef struct _SAL_UPDATE_PAL_INFO_BLOCK {
struct _SAL_UPDATE_PAL_INFO_BLOCK *Next;
struct SAL_UPDATE_PAL_DATA_BLOCK *DataBlock;
UINT8 StoreChecksum;
UINT8 Reserved[15];
} SAL_UPDATE_PAL_INFO_BLOCK;
//
// SAL System Table Definitions
//
#pragma pack(1)
typedef struct {
UINT32 Signature;
UINT32 Length;
UINT16 SalRevision;
UINT16 EntryCount;
UINT8 CheckSum;
UINT8 Reserved[7];
UINT16 SalAVersion;
UINT16 SalBVersion;
UINT8 OemId[32];
UINT8 ProductId[32];
UINT8 Reserved2[8];
} SAL_SYSTEM_TABLE_HEADER;
#pragma pack()
#define EFI_SAL_ST_HEADER_SIGNATURE "SST_"
#define EFI_SAL_REVISION 0x0300
//
// SAL System Types
//
#define EFI_SAL_ST_ENTRY_POINT 0
#define EFI_SAL_ST_MEMORY_DESCRIPTOR 1
#define EFI_SAL_ST_PLATFORM_FEATURES 2
#define EFI_SAL_ST_TR_USAGE 3
#define EFI_SAL_ST_PTC 4
#define EFI_SAL_ST_AP_WAKEUP 5
#pragma pack(1)
typedef struct {
UINT8 Type; // Type == 0
UINT8 Reserved[7];
UINT64 PalProcEntry;
UINT64 SalProcEntry;
UINT64 SalGlobalDataPointer;
UINT64 Reserved2[2];
} SAL_ST_ENTRY_POINT_DESCRIPTOR;
//
// Not needed for Itanium-based OS boot
//
typedef struct {
UINT8 Type; // Type == 1
UINT8 NeedVirtualRegistration;
UINT8 MemoryAttributes;
UINT8 PageAccessRights;
UINT8 SupportedAttributes;
UINT8 Reserved;
UINT8 MemoryType;
UINT8 MemoryUsage;
UINT64 PhysicalMemoryAddress;
UINT32 Length;
UINT32 Reserved1;
UINT64 OemReserved;
} SAL_ST_MEMORY_DESCRIPTOR_ENTRY;
#pragma pack()
//
// Memory Attributes
//
#define SAL_MDT_ATTRIB_WB 0x00
//
// #define SAL_MDT_ATTRIB_UC 0x02
//
#define SAL_MDT_ATTRIB_UC 0x04
#define SAL_MDT_ATTRIB_UCE 0x05
#define SAL_MDT_ATTRIB_WC 0x06
//
// Supported memory Attributes
//
#define SAL_MDT_SUPPORT_WB 0x1
#define SAL_MDT_SUPPORT_UC 0x2
#define SAL_MDT_SUPPORT_UCE 0x4
#define SAL_MDT_SUPPORT_WC 0x8
//
// Virtual address registration
//
#define SAL_MDT_NO_VA 0x00
#define SAL_MDT_NEED_VA 0x01
//
// MemoryType info
//
#define SAL_REGULAR_MEMORY 0x0000
#define SAL_MMIO_MAPPING 0x0001
#define SAL_SAPIC_IPI_BLOCK 0x0002
#define SAL_IO_PORT_MAPPING 0x0003
#define SAL_FIRMWARE_MEMORY 0x0004
#define SAL_BLACK_HOLE 0x000A
//
// Memory Usage info
//
#define SAL_MDT_USAGE_UNSPECIFIED 0x00
#define SAL_PAL_CODE 0x01
#define SAL_BOOTSERVICE_CODE 0x02
#define SAL_BOOTSERVICE_DATA 0x03
#define SAL_RUNTIMESERVICE_CODE 0x04
#define SAL_RUNTIMESERVICE_DATA 0x05
#define SAL_IA32_OPTIONROM 0x06
#define SAL_IA32_SYSTEMROM 0x07
#define SAL_PMI_CODE 0x0a
#define SAL_PMI_DATA 0x0b
#pragma pack(1)
typedef struct {
UINT8 Type; // Type == 2
UINT8 PlatformFeatures;
UINT8 Reserved[14];
} SAL_ST_PLATFORM_FEATURES;
#pragma pack()
#define SAL_PLAT_FEAT_BUS_LOCK 0x01
#define SAL_PLAT_FEAT_PLAT_IPI_HINT 0x02
#define SAL_PLAT_FEAT_PROC_IPI_HINT 0x04
#pragma pack(1)
typedef struct {
UINT8 Type; // Type == 3
UINT8 TRType;
UINT8 TRNumber;
UINT8 Reserved[5];
UINT64 VirtualAddress;
UINT64 EncodedPageSize;
UINT64 Reserved1;
} SAL_ST_TR_DECRIPTOR;
#pragma pack()
#define EFI_SAL_ST_TR_USAGE_INSTRUCTION 00
#define EFI_SAL_ST_TR_USAGE_DATA 01
#pragma pack(1)
typedef struct {
UINT64 NumberOfProcessors;
UINT64 LocalIDRegister;
} SAL_COHERENCE_DOMAIN_INFO;
#pragma pack()
#pragma pack(1)
typedef struct {
UINT8 Type; // Type == 4
UINT8 Reserved[3];
UINT32 NumberOfDomains;
SAL_COHERENCE_DOMAIN_INFO *DomainInformation;
} SAL_ST_CACHE_COHERENCE_DECRIPTOR;
#pragma pack()
#pragma pack(1)
typedef struct {
UINT8 Type; // Type == 5
UINT8 WakeUpType;
UINT8 Reserved[6];
UINT64 ExternalInterruptVector;
} SAL_ST_AP_WAKEUP_DECRIPTOR;
#pragma pack()
//
// FIT Entry
//
#define EFI_SAL_FIT_ENTRY_PTR (0x100000000 - 32) // 4GB - 24
#define EFI_SAL_FIT_PALA_ENTRY (0x100000000 - 48) // 4GB - 32
#define EFI_SAL_FIT_PALB_TYPE 01
typedef struct {
UINT64 Address;
UINT8 Size[3];
UINT8 Reserved;
UINT16 Revision;
UINT8 Type : 7;
UINT8 CheckSumValid : 1;
UINT8 CheckSum;
} EFI_SAL_FIT_ENTRY;
//
// SAL Common Record Header
//
typedef struct {
UINT16 Length;
UINT8 Data[1024];
} SAL_OEM_DATA;
typedef struct {
UINT8 Seconds;
UINT8 Minutes;
UINT8 Hours;
UINT8 Reserved;
UINT8 Day;
UINT8 Month;
UINT8 Year;
UINT8 Century;
} SAL_TIME_STAMP;
typedef struct {
UINT64 RecordId;
UINT16 Revision;
UINT8 ErrorSeverity;
UINT8 ValidationBits;
UINT32 RecordLength;
SAL_TIME_STAMP TimeStamp;
UINT8 OemPlatformId[16];
} SAL_RECORD_HEADER;
typedef struct {
GUID Guid;
UINT16 Revision;
UINT8 ErrorRecoveryInfo;
UINT8 Reserved;
UINT32 SectionLength;
} SAL_SEC_HEADER;
//
// SAL Processor Record
//
#define SAL_PROCESSOR_ERROR_RECORD_INFO \
{ \
0xe429faf1, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
}
#define CHECK_INFO_VALID_BIT_MASK 0x1
#define REQUESTOR_ID_VALID_BIT_MASK 0x2
#define RESPONDER_ID_VALID_BIT_MASK 0x4
#define TARGER_ID_VALID_BIT_MASK 0x8
#define PRECISE_IP_VALID_BIT_MASK 0x10
typedef struct {
UINT64 InfoValid : 1;
UINT64 ReqValid : 1;
UINT64 RespValid : 1;
UINT64 TargetValid : 1;
UINT64 IpValid : 1;
UINT64 Reserved : 59;
UINT64 Info;
UINT64 Req;
UINT64 Resp;
UINT64 Target;
UINT64 Ip;
} MOD_ERROR_INFO;
typedef struct {
UINT8 CpuidInfo[40];
UINT8 Reserved;
} CPUID_INFO;
typedef struct {
UINT64 FrLow;
UINT64 FrHigh;
} FR_STRUCT;
#define MIN_STATE_VALID_BIT_MASK 0x1
#define BR_VALID_BIT_MASK 0x2
#define CR_VALID_BIT_MASK 0x4
#define AR_VALID_BIT_MASK 0x8
#define RR_VALID_BIT_MASK 0x10
#define FR_VALID_BIT_MASK 0x20
typedef struct {
UINT64 ValidFieldBits;
UINT8 MinStateInfo[1024];
UINT64 Br[8];
UINT64 Cr[128];
UINT64 Ar[128];
UINT64 Rr[8];
FR_STRUCT Fr[128];
} PSI_STATIC_STRUCT;
#define PROC_ERROR_MAP_VALID_BIT_MASK 0x1
#define PROC_STATE_PARAMETER_VALID_BIT_MASK 0x2
#define PROC_CR_LID_VALID_BIT_MASK 0x4
#define PROC_STATIC_STRUCT_VALID_BIT_MASK 0x8
#define CPU_INFO_VALID_BIT_MASK 0x1000000
typedef struct {
SAL_SEC_HEADER SectionHeader;
UINT64 ValidationBits;
UINT64 ProcErrorMap;
UINT64 ProcStateParameter;
UINT64 ProcCrLid;
MOD_ERROR_INFO CacheError[15];
MOD_ERROR_INFO TlbError[15];
MOD_ERROR_INFO BusError[15];
MOD_ERROR_INFO RegFileCheck[15];
MOD_ERROR_INFO MsCheck[15];
CPUID_INFO CpuInfo;
PSI_STATIC_STRUCT PsiValidData;
} SAL_PROCESSOR_ERROR_RECORD;
//
// Sal Platform memory Error Record
//
#define SAL_MEMORY_ERROR_RECORD_INFO \
{ \
0xe429faf2, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
}
#define MEMORY_ERROR_STATUS_VALID_BIT_MASK 0x1
#define MEMORY_PHYSICAL_ADDRESS_VALID_BIT_MASK 0x2
#define MEMORY_ADDR_BIT_MASK 0x4
#define MEMORY_NODE_VALID_BIT_MASK 0x8
#define MEMORY_CARD_VALID_BIT_MASK 0x10
#define MEMORY_MODULE_VALID_BIT_MASK 0x20
#define MEMORY_BANK_VALID_BIT_MASK 0x40
#define MEMORY_DEVICE_VALID_BIT_MASK 0x80
#define MEMORY_ROW_VALID_BIT_MASK 0x100
#define MEMORY_COLUMN_VALID_BIT_MASK 0x200
#define MEMORY_BIT_POSITION_VALID_BIT_MASK 0x400
#define MEMORY_PLATFORM_REQUESTOR_ID_VALID_BIT_MASK 0x800
#define MEMORY_PLATFORM_RESPONDER_ID_VALID_BIT_MASK 0x1000
#define MEMORY_PLATFORM_TARGET_VALID_BIT_MASK 0x2000
#define MEMORY_PLATFORM_BUS_SPECIFIC_DATA_VALID_BIT_MASK 0x4000
#define MEMORY_PLATFORM_OEM_ID_VALID_BIT_MASK 0x8000
#define MEMORY_PLATFORM_OEM_DATA_STRUCT_VALID_BIT_MASK 0x10000
typedef struct {
SAL_SEC_HEADER SectionHeader;
UINT64 ValidationBits;
UINT64 MemErrorStatus;
UINT64 MemPhysicalAddress;
UINT64 MemPhysicalAddressMask;
UINT16 MemNode;
UINT16 MemCard;
UINT16 MemModule;
UINT16 MemBank;
UINT16 MemDevice;
UINT16 MemRow;
UINT16 MemColumn;
UINT16 MemBitPosition;
UINT64 ModRequestorId;
UINT64 ModResponderId;
UINT64 ModTargetId;
UINT64 BusSpecificData;
UINT8 MemPlatformOemId[16];
} SAL_MEMORY_ERROR_RECORD;
//
// PCI BUS Errors
//
#define SAL_PCI_BUS_ERROR_RECORD_INFO \
{ \
0xe429faf4, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
}
#define PCI_BUS_ERROR_STATUS_VALID_BIT_MASK 0x1
#define PCI_BUS_ERROR_TYPE_VALID_BIT_MASK 0x2
#define PCI_BUS_ID_VALID_BIT_MASK 0x4
#define PCI_BUS_ADDRESS_VALID_BIT_MASK 0x8
#define PCI_BUS_DATA_VALID_BIT_MASK 0x10
#define PCI_BUS_CMD_VALID_BIT_MASK 0x20
#define PCI_BUS_REQUESTOR_ID_VALID_BIT_MASK 0x40
#define PCI_BUS_RESPONDER_ID_VALID_BIT_MASK 0x80
#define PCI_BUS_TARGET_VALID_BIT_MASK 0x100
#define PCI_BUS_OEM_ID_VALID_BIT_MASK 0x200
#define PCI_BUS_OEM_DATA_STRUCT_VALID_BIT_MASK 0x400
typedef struct {
UINT8 BusNumber;
UINT8 SegmentNumber;
} PCI_BUS_ID;
typedef struct {
SAL_SEC_HEADER SectionHeader;
UINT64 ValidationBits;
UINT64 PciBusErrorStatus;
UINT16 PciBusErrorType;
PCI_BUS_ID PciBusId;
UINT32 Reserved;
UINT64 PciBusAddress;
UINT64 PciBusData;
UINT64 PciBusCommand;
UINT64 PciBusRequestorId;
UINT64 PciBusResponderId;
UINT64 PciBusTargetId;
UINT8 PciBusOemId[16];
} SAL_PCI_BUS_ERROR_RECORD;
//
// PCI Component Errors
//
#define SAL_PCI_COMP_ERROR_RECORD_INFO \
{ \
0xe429faf6, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
}
#define PCI_COMP_ERROR_STATUS_VALID_BIT_MASK 0x1
#define PCI_COMP_INFO_VALID_BIT_MASK 0x2
#define PCI_COMP_MEM_NUM_VALID_BIT_MASK 0x4
#define PCI_COMP_IO_NUM_VALID_BIT_MASK 0x8
#define PCI_COMP_REG_DATA_PAIR_VALID_BIT_MASK 0x10
#define PCI_COMP_OEM_DATA_STRUCT_VALID_BIT_MASK 0x20
typedef struct {
UINT16 VendorId;
UINT16 DeviceId;
UINT8 ClassCode[3];
UINT8 FunctionNumber;
UINT8 DeviceNumber;
UINT8 BusNumber;
UINT8 SegmentNumber;
UINT8 Reserved[5];
} PCI_COMP_INFO;
typedef struct {
SAL_SEC_HEADER SectionHeader;
UINT64 ValidationBits;
UINT64 PciComponentErrorStatus;
PCI_COMP_INFO PciComponentInfo;
UINT32 PciComponentMemNum;
UINT32 PciComponentIoNum;
UINT8 PciBusOemId[16];
} SAL_PCI_COMPONENT_ERROR_RECORD;
//
// Sal Device Errors Info.
//
#define SAL_DEVICE_ERROR_RECORD_INFO \
{ \
0xe429faf3, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
}
#define SEL_RECORD_ID_VALID_BIT_MASK 0x1;
#define SEL_RECORD_TYPE_VALID_BIT_MASK 0x2;
#define SEL_GENERATOR_ID_VALID_BIT_MASK 0x4;
#define SEL_EVM_REV_VALID_BIT_MASK 0x8;
#define SEL_SENSOR_TYPE_VALID_BIT_MASK 0x10;
#define SEL_SENSOR_NUM_VALID_BIT_MASK 0x20;
#define SEL_EVENT_DIR_TYPE_VALID_BIT_MASK 0x40;
#define SEL_EVENT_DATA1_VALID_BIT_MASK 0x80;
#define SEL_EVENT_DATA2_VALID_BIT_MASK 0x100;
#define SEL_EVENT_DATA3_VALID_BIT_MASK 0x200;
typedef struct {
SAL_SEC_HEADER SectionHeader;
UINT64 ValidationBits;
UINT16 SelRecordId;
UINT8 SelRecordType;
UINT32 TimeStamp;
UINT16 GeneratorId;
UINT8 EvmRevision;
UINT8 SensorType;
UINT8 SensorNum;
UINT8 EventDirType;
UINT8 Data1;
UINT8 Data2;
UINT8 Data3;
} SAL_DEVICE_ERROR_RECORD;
//
// Sal SMBIOS Device Errors Info.
//
#define SAL_SMBIOS_ERROR_RECORD_INFO \
{ \
0xe429faf5, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
}
#define SMBIOS_EVENT_TYPE_VALID_BIT_MASK 0x1
#define SMBIOS_LENGTH_VALID_BIT_MASK 0x2
#define SMBIOS_TIME_STAMP_VALID_BIT_MASK 0x4
#define SMBIOS_DATA_VALID_BIT_MASK 0x8
typedef struct {
SAL_SEC_HEADER SectionHeader;
UINT64 ValidationBits;
UINT8 SmbiosEventType;
UINT8 SmbiosLength;
UINT8 SmbiosBcdTimeStamp[6];
} SAL_SMBIOS_DEVICE_ERROR_RECORD;
//
// Sal Platform Specific Errors Info.
//
#define SAL_PLATFORM_ERROR_RECORD_INFO \
{ \
0xe429faf7, 0x3cb7, 0x11d4, {0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
}
#define PLATFORM_ERROR_STATUS_VALID_BIT_MASK 0x1
#define PLATFORM_REQUESTOR_ID_VALID_BIT_MASK 0x2
#define PLATFORM_RESPONDER_ID_VALID_BIT_MASK 0x4
#define PLATFORM_TARGET_VALID_BIT_MASK 0x8
#define PLATFORM_SPECIFIC_DATA_VALID_BIT_MASK 0x10
#define PLATFORM_OEM_ID_VALID_BIT_MASK 0x20
#define PLATFORM_OEM_DATA_STRUCT_VALID_BIT_MASK 0x40
#define PLATFORM_OEM_DEVICE_PATH_VALID_BIT_MASK 0x80
typedef struct {
SAL_SEC_HEADER SectionHeader;
UINT64 ValidationBits;
UINT64 PlatformErrorStatus;
UINT64 PlatformRequestorId;
UINT64 PlatformResponderId;
UINT64 PlatformTargetId;
UINT64 PlatformBusSpecificData;
UINT8 OemComponentId[16];
} SAL_PLATFORM_SPECIFIC_ERROR_RECORD;
//
// Union of all the possible Sal Record Types
//
typedef union {
SAL_RECORD_HEADER *RecordHeader;
SAL_PROCESSOR_ERROR_RECORD *SalProcessorRecord;
SAL_PCI_BUS_ERROR_RECORD *SalPciBusRecord;
SAL_PCI_COMPONENT_ERROR_RECORD *SalPciComponentRecord;
SAL_DEVICE_ERROR_RECORD *ImpiRecord;
SAL_SMBIOS_DEVICE_ERROR_RECORD *SmbiosRecord;
SAL_PLATFORM_SPECIFIC_ERROR_RECORD *PlatformRecord;
SAL_MEMORY_ERROR_RECORD *MemoryRecord;
UINT8 *Raw;
} SAL_ERROR_RECORDS_POINTERS;
#pragma pack()
#endif

View File

@ -0,0 +1,40 @@
/** @file
Present the boot mode values in PI.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PiBootMode.h
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_BOOT_MODE_H__
#define __PI_BOOT_MODE_H__
typedef UINT32 EFI_BOOT_MODE;
//
// 0x21 - 0xf..f are reserved.
//
#define BOOT_WITH_FULL_CONFIGURATION 0x00
#define BOOT_WITH_MINIMAL_CONFIGURATION 0x01
#define BOOT_ASSUMING_NO_CONFIGURATION_CHANGES 0x02
#define BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS 0x03
#define BOOT_WITH_DEFAULT_SETTINGS 0x04
#define BOOT_ON_S4_RESUME 0x05
#define BOOT_ON_S5_RESUME 0x06
#define BOOT_ON_S2_RESUME 0x10
#define BOOT_ON_S3_RESUME 0x11
#define BOOT_ON_FLASH_UPDATE 0x12
#define BOOT_IN_RECOVERY_MODE 0x20
#endif

View File

@ -0,0 +1,46 @@
/** @file
Present the dependency expression values in PI.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PiDependency.h
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_DEPENDENCY_H__
#define __PI_DEPENDENCY_H__
//
// If present, this must be the first and only opcode
//
#define EFI_DEP_BEFORE 0x00
//
// If present, this must be the first and only opcode
//
#define EFI_DEP_AFTER 0x01
#define EFI_DEP_PUSH 0x02
#define EFI_DEP_AND 0x03
#define EFI_DEP_OR 0x04
#define EFI_DEP_NOT 0x05
#define EFI_DEP_TRUE 0x06
#define EFI_DEP_FALSE 0x07
#define EFI_DEP_END 0x08
//
// If present, this must be the first opcode.
//
#define EFI_DEP_SOR 0x09
#endif

View File

@ -0,0 +1,450 @@
/** @file
Include file matches things in PI.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PiDxeCis.h
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_DXECIS_H__
#define __PI_DXECIS_H__
#include <Pi/PiMultiPhase.h>
//
// Global Coherencey Domain types
//
typedef enum {
EfiGcdMemoryTypeNonExistent,
EfiGcdMemoryTypeReserved,
EfiGcdMemoryTypeSystemMemory,
EfiGcdMemoryTypeMemoryMappedIo,
EfiGcdMemoryTypeMaximum
} EFI_GCD_MEMORY_TYPE;
typedef enum {
EfiGcdIoTypeNonExistent,
EfiGcdIoTypeReserved,
EfiGcdIoTypeIo,
EfiGcdIoTypeMaximum
} EFI_GCD_IO_TYPE;
typedef enum {
EfiGcdAllocateAnySearchBottomUp,
EfiGcdAllocateMaxAddressSearchBottomUp,
EfiGcdAllocateAddress,
EfiGcdAllocateAnySearchTopDown,
EfiGcdAllocateMaxAddressSearchTopDown,
EfiGcdMaxAllocateType
} EFI_GCD_ALLOCATE_TYPE;
typedef struct {
EFI_PHYSICAL_ADDRESS BaseAddress;
UINT64 Length;
UINT64 Capabilities;
UINT64 Attributes;
EFI_GCD_MEMORY_TYPE GcdMemoryType;
EFI_HANDLE ImageHandle;
EFI_HANDLE DeviceHandle;
} EFI_GCD_MEMORY_SPACE_DESCRIPTOR;
typedef struct {
EFI_PHYSICAL_ADDRESS BaseAddress;
UINT64 Length;
EFI_GCD_IO_TYPE GcdIoType;
EFI_HANDLE ImageHandle;
EFI_HANDLE DeviceHandle;
} EFI_GCD_IO_SPACE_DESCRIPTOR;
/**
Adds reserved memory, system memory, or memory-mapped I/O resources to the
global coherency domain of the processor.
@param GcdMemoryType Memory type of the memory space.
@param BaseAddress Base address of the memory space.
@param Length Length of the memory space.
@param Capabilities alterable attributes of the memory space.
@retval EFI_SUCCESS Merged this memory space into GCD map.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ADD_MEMORY_SPACE) (
IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length,
IN UINT64 Capabilities
)
;
/**
Allocates nonexistent memory, reserved memory, system memory, or memorymapped
I/O resources from the global coherency domain of the processor.
@param GcdAllocateType The type of allocate operation
@param GcdMemoryType The desired memory type
@param Alignment Align with 2^Alignment
@param Length Length to allocate
@param BaseAddress Base address to allocate
@param Imagehandle The image handle consume the allocated space.
@param DeviceHandle The device handle consume the allocated space.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_NOT_FOUND No descriptor contains the desired space.
@retval EFI_SUCCESS Memory space successfully allocated.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ALLOCATE_MEMORY_SPACE) (
IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
IN UINTN Alignment,
IN UINT64 Length,
IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
IN EFI_HANDLE ImageHandle,
IN EFI_HANDLE DeviceHandle OPTIONAL
)
;
/**
Frees nonexistent memory, reserved memory, system memory, or memory-mapped
I/O resources from the global coherency domain of the processor.
@param BaseAddress Base address of the segment.
@param Length Length of the segment.
@retval EFI_SUCCESS Space successfully freed.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_FREE_MEMORY_SPACE) (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
;
/**
Removes reserved memory, system memory, or memory-mapped I/O resources from
the global coherency domain of the processor.
@param BaseAddress Base address of the memory space.
@param Length Length of the memory space.
@retval EFI_SUCCESS Successfully remove a segment of memory space.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_REMOVE_MEMORY_SPACE) (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
;
/**
Retrieves the descriptor for a memory region containing a specified address.
@param BaseAddress Specified start address
@param Descriptor Specified length
@retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_SUCCESS Successfully get memory space descriptor.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_GET_MEMORY_SPACE_DESCRIPTOR) (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor
)
;
/**
Modifies the attributes for a memory region in the global coherency domain of the
processor.
@param BaseAddress Specified start address
@param Length Specified length
@param Attributes Specified attributes
@retval EFI_SUCCESS Successfully set attribute of a segment of memory space.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SET_MEMORY_SPACE_ATTRIBUTES) (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length,
IN UINT64 Attributes
)
;
/**
Returns a map of the memory resources in the global coherency domain of the
processor.
@param NumberOfDescriptors Number of descriptors.
@param MemorySpaceMap Descriptor array
@retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
@retval EFI_SUCCESS Successfully get memory space map.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_GET_MEMORY_SPACE_MAP) (
OUT UINTN *NumberOfDescriptors,
OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap
)
;
/**
Adds reserved I/O or I/O resources to the global coherency domain of the processor.
@param GcdIoType IO type of the segment.
@param BaseAddress Base address of the segment.
@param Length Length of the segment.
@retval EFI_SUCCESS Merged this segment into GCD map.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ADD_IO_SPACE) (
IN EFI_GCD_IO_TYPE GcdIoType,
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
;
/**
Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
domain of the processor.
@param GcdAllocateType The type of allocate operation
@param GcdIoType The desired IO type
@param Alignment Align with 2^Alignment
@param Length Length to allocate
@param BaseAddress Base address to allocate
@param Imagehandle The image handle consume the allocated space.
@param DeviceHandle The device handle consume the allocated space.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_NOT_FOUND No descriptor contains the desired space.
@retval EFI_SUCCESS IO space successfully allocated.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_ALLOCATE_IO_SPACE) (
IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
IN EFI_GCD_IO_TYPE GcdIoType,
IN UINTN Alignment,
IN UINT64 Length,
IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
IN EFI_HANDLE ImageHandle,
IN EFI_HANDLE DeviceHandle OPTIONAL
)
;
/**
Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
domain of the processor.
@param BaseAddress Base address of the segment.
@param Length Length of the segment.
@retval EFI_SUCCESS Space successfully freed.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_FREE_IO_SPACE) (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
;
/**
Removes reserved I/O or I/O resources from the global coherency domain of the
processor.
@param BaseAddress Base address of the segment.
@param Length Length of the segment.
@retval EFI_SUCCESS Successfully removed a segment of IO space.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_REMOVE_IO_SPACE) (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
;
/**
Retrieves the descriptor for an I/O region containing a specified address.
@param BaseAddress Specified start address
@param Descriptor Specified length
@retval EFI_INVALID_PARAMETER Descriptor is NULL.
@retval EFI_SUCCESS Successfully get the IO space descriptor.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_GET_IO_SPACE_DESCRIPTOR) (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor
)
;
/**
Returns a map of the I/O resources in the global coherency domain of the processor.
@param NumberOfDescriptors Number of descriptors.
@param MemorySpaceMap Descriptor array
@retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
@retval EFI_SUCCESS Successfully get IO space map.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_GET_IO_SPACE_MAP) (
OUT UINTN *NumberOfDescriptors,
OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap
)
;
/**
Loads and executed DXE drivers from firmware volumes.
@return Status code
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DISPATCH) (VOID)
;
/**
Clears the Schedule on Request (SOR) flag for a component that is stored in a firmware volume.
@param FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.
@param DriverName A pointer to the name of the file in a firmware volume.
@return Status code
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCHEDULE) (
IN EFI_HANDLE FirmwareVolumeHandle,
IN EFI_GUID *DriverName
)
;
/**
Promotes a file stored in a firmware volume from the untrusted to the trusted state.
@param FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.
@param DriverName A pointer to the name of the file in a firmware volume.
@return Status code
**/
typedef
EFI_STATUS
(EFIAPI *EFI_TRUST) (
IN EFI_HANDLE FirmwareVolumeHandle,
IN EFI_GUID *DriverName
)
;
/**
Creates a firmware volume handle for a firmware volume that is present in system memory.
@param FirmwareVolumeHeader A pointer to the header of the firmware volume.
@param Size The size, in bytes, of the firmware volume.
@param FirmwareVolumeHandle On output, a pointer to the created handle.
@return Status code
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PROCESS_FIRMWARE_VOLUME) (
IN VOID *FvHeader,
IN UINTN Size,
OUT EFI_HANDLE *FirmwareVolumeHandle
)
;
//
// DXE Services Table
//
#define DXE_SERVICES_SIGNATURE 0x565245535f455844
#define DXE_SERVICES_REVISION ((1<<16) | (00)
typedef struct {
EFI_TABLE_HEADER Hdr;
//
// Global Coherency Domain Services
//
EFI_ADD_MEMORY_SPACE AddMemorySpace;
EFI_ALLOCATE_MEMORY_SPACE AllocateMemorySpace;
EFI_FREE_MEMORY_SPACE FreeMemorySpace;
EFI_REMOVE_MEMORY_SPACE RemoveMemorySpace;
EFI_GET_MEMORY_SPACE_DESCRIPTOR GetMemorySpaceDescriptor;
EFI_SET_MEMORY_SPACE_ATTRIBUTES SetMemorySpaceAttributes;
EFI_GET_MEMORY_SPACE_MAP GetMemorySpaceMap;
EFI_ADD_IO_SPACE AddIoSpace;
EFI_ALLOCATE_IO_SPACE AllocateIoSpace;
EFI_FREE_IO_SPACE FreeIoSpace;
EFI_REMOVE_IO_SPACE RemoveIoSpace;
EFI_GET_IO_SPACE_DESCRIPTOR GetIoSpaceDescriptor;
EFI_GET_IO_SPACE_MAP GetIoSpaceMap;
//
// Dispatcher Services
//
EFI_DISPATCH Dispatch;
EFI_SCHEDULE Schedule;
EFI_TRUST Trust;
//
// Service to process a single firmware volume found in a capsule
//
EFI_PROCESS_FIRMWARE_VOLUME ProcessFirmwareVolume;
} DXE_SERVICES;
typedef DXE_SERVICES EFI_DXE_SERVICES;
#endif

View File

@ -0,0 +1,206 @@
/** @file
The firmware file related definitions in PI.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PiFirmwareFile.h
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_FIRMWARE_FILE_H__
#define __PI_FIRMWARE_FILE_H__
//
// Used to verify the integrity of the file.
//
typedef union {
struct {
UINT8 Header;
UINT8 File;
} Checksum;
UINT16 Checksum16;
} EFI_FFS_INTEGRITY_CHECK;
typedef UINT8 EFI_FV_FILETYPE;
typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;
typedef UINT8 EFI_FFS_FILE_STATE;
//
// FFS File Attributes.
//
#define FFS_ATTRIB_FIXED 0x04
#define FFS_ATTRIB_DATA_ALIGNMENT 0x38
#define FFS_ATTRIB_CHECKSUM 0x40
//
// FFS File State Bits.
//
#define EFI_FILE_HEADER_CONSTRUCTION 0x01
#define EFI_FILE_HEADER_VALID 0x02
#define EFI_FILE_DATA_VALID 0x04
#define EFI_FILE_MARKED_FOR_UPDATE 0x08
#define EFI_FILE_DELETED 0x10
#define EFI_FILE_HEADER_INVALID 0x20
//
// Each file begins with the header that describe the
// contents and state of the files.
//
typedef struct {
EFI_GUID Name;
EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
EFI_FV_FILETYPE Type;
EFI_FFS_FILE_ATTRIBUTES Attributes;
UINT8 Size[3];
EFI_FFS_FILE_STATE State;
} EFI_FFS_FILE_HEADER;
typedef UINT8 EFI_SECTION_TYPE;
//
// Pseudo type. It is
// used as a wild card when retrieving sections. The section
// type EFI_SECTION_ALL matches all section types.
//
#define EFI_SECTION_ALL 0x00
//
// Encapsulation section Type values
//
#define EFI_SECTION_COMPRESSION 0x01
#define EFI_SECTION_GUID_DEFINED 0x02
//
// Leaf section Type values
//
#define EFI_SECTION_PE32 0x10
#define EFI_SECTION_PIC 0x11
#define EFI_SECTION_TE 0x12
#define EFI_SECTION_DXE_DEPEX 0x13
#define EFI_SECTION_VERSION 0x14
#define EFI_SECTION_USER_INTERFACE 0x15
#define EFI_SECTION_COMPATIBILITY16 0x16
#define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17
#define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18
#define EFI_SECTION_RAW 0x19
#define EFI_SECTION_PEI_DEPEX 0x1B
typedef struct {
UINT8 Size[3];
EFI_SECTION_TYPE Type;
} EFI_COMMON_SECTION_HEADER;
//
// Leaf section type that contains an
// IA-32 16-bit executable image.
//
typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
//
// CompressionType of EFI_COMPRESSION_SECTION.
//
#define EFI_NOT_COMPRESSED 0x00
#define EFI_STANDARD_COMPRESSION 0x01
//
// An encapsulation section type in which the
// section data is compressed.
//
typedef struct {
EFI_COMMON_SECTION_HEADER CommonHeader;
UINT32 UncompressedLength;
UINT8 CompressionType;
} EFI_COMPRESSION_SECTION;
//
// Leaf section which could be used to determine the dispatch order of DXEs.
//
typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;
//
// Leaf section witch contains a PI FV.
//
typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
//
// Leaf section which contains a single GUID.
//
typedef struct {
EFI_COMMON_SECTION_HEADER CommonHeader;
EFI_GUID SubTypeGuid;
} EFI_FREEFORM_SUBTYPE_GUID_SECTION;
//
// Attributes of EFI_GUID_DEFINED_SECTION
//
#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01
#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02
//
// Leaf section which is encapsulation defined by specific GUID
//
typedef struct {
EFI_COMMON_SECTION_HEADER CommonHeader;
EFI_GUID SectionDefinitionGuid;
UINT16 DataOffset;
UINT16 Attributes;
} EFI_GUID_DEFINED_SECTION;
//
// Leaf section which contains PE32+ image.
//
typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;
//
// Leaf section which used to determine the dispatch order of PEIMs.
//
typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;
//
// Leaf section which constains the position-independent-code image.
//
typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;
//
// Leaf section which contains an array of zero or more bytes.
//
typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;
//
// Leaf section which contains a unicode string that
// is human readable file name.
//
typedef struct {
EFI_COMMON_SECTION_HEADER CommonHeader;
//
// Array of unicode string.
//
CHAR16 FileNameString[1];
} EFI_USER_INTERFACE_SECTION;
//
// Leaf section which contains a numeric build number and
// an optional unicode string that represent the file revision.
//
typedef struct {
EFI_COMMON_SECTION_HEADER CommonHeader;
UINT16 BuildNumber;
CHAR16 VersionString[1];
} EFI_VERSION_SECTION;
#endif

View File

@ -0,0 +1,140 @@
/** @file
The firmware volume related definitions in PI.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PiFirmwareVolume.h
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_FIRMWAREVOLUME_H__
#define __PI_FIRMWAREVOLUME_H__
//
// EFI_FV_FILE_ATTRIBUTES
//
typedef UINT32 EFI_FV_FILE_ATTRIBUTES;
//
// Value of EFI_FV_FILE_ATTRIBUTES.
//
#define EFI_FV_FILE_ATTRIB_ALIGNMENT 0x0000001F
#define EFI_FV_FILE_ATTRIB_FIXED 0x00000100
#define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED 0x00000200
typedef UINT32 EFI_FVB_ATTRIBUTES;
//
// Attributes bit definitions
//
#define EFI_FVB2_READ_DISABLED_CAP 0x00000001
#define EFI_FVB2_READ_ENABLED_CAP 0x00000002
#define EFI_FVB2_READ_STATUS 0x00000004
#define EFI_FVB2_WRITE_DISABLED_CAP 0x00000008
#define EFI_FVB2_WRITE_ENABLED_CAP 0x00000010
#define EFI_FVB2_WRITE_STATUS 0x00000020
#define EFI_FVB2_LOCK_CAP 0x00000040
#define EFI_FVB2_LOCK_STATUS 0x00000080
#define EFI_FVB2_STICKY_WRITE 0x00000200
#define EFI_FVB2_MEMORY_MAPPED 0x00000400
#define EFI_FVB2_ERASE_POLARITY 0x00000800
#define EFI_FVB2_READ_LOCK_CAP 0x00001000
#define EFI_FVB2_READ_LOCK_STATUS 0x00002000
#define EFI_FVB2_WRITE_LOCK_CAP 0x00004000
#define EFI_FVB2_WRITE_LOCK_STATUS 0x00008000
#define EFI_FVB2_ALIGNMENT 0x001F0000
#define EFI_FVB2_ALIGNMENT_1 0x00000000
#define EFI_FVB2_ALIGNMENT_2 0x00010000
#define EFI_FVB2_ALIGNMENT_4 0x00020000
#define EFI_FVB2_ALIGNMENT_8 0x00030000
#define EFI_FVB2_ALIGNMENT_16 0x00040000
#define EFI_FVB2_ALIGNMENT_32 0x00050000
#define EFI_FVB2_ALIGNMENT_64 0x00060000
#define EFI_FVB2_ALIGNMENT_128 0x00070000
#define EFI_FVB2_ALIGNMENT_256 0x00080000
#define EFI_FVB2_ALIGNMENT_512 0x00090000
#define EFI_FVB2_ALIGNMENT_1K 0x000A0000
#define EFI_FVB2_ALIGNMENT_2K 0x000B0000
#define EFI_FVB2_ALIGNMENT_4K 0x000C0000
#define EFI_FVB2_ALIGNMENT_8K 0x000D0000
#define EFI_FVB2_ALIGNMENT_16K 0x000E0000
#define EFI_FVB2_ALIGNMENT_32K 0x000F0000
#define EFI_FVB2_ALIGNMENT_64K 0x00100000
#define EFI_FVB2_ALIGNMENT_128K 0x00110000
#define EFI_FVB2_ALIGNMENT_256K 0x00120000
#define EFI_FVB2_ALIGNMNET_512K 0x00130000
#define EFI_FVB2_ALIGNMENT_1M 0x00140000
#define EFI_FVB2_ALIGNMENT_2M 0x00150000
#define EFI_FVB2_ALIGNMENT_4M 0x00160000
#define EFI_FVB2_ALIGNMENT_8M 0x00170000
#define EFI_FVB2_ALIGNMENT_16M 0x00180000
#define EFI_FVB2_ALIGNMENT_32M 0x00190000
#define EFI_FVB2_ALIGNMENT_64M 0x001A0000
#define EFI_FVB2_ALIGNMENT_128M 0x001B0000
#define EFI_FVB2_ALIGNMENT_256M 0x001C0000
#define EFI_FVB2_ALIGNMENT_512M 0x001D0000
#define EFI_FVB2_ALIGNMENT_1G 0x001E0000
#define EFI_FVB2_ALIGNMENT_2G 0x001F0000
typedef struct {
UINT32 NumBlocks;
UINT32 Length;
} EFI_FV_BLOCK_MAP_ENTRY;
//
// Describes the features and layout of the firmware volume.
//
typedef struct {
UINT8 ZeroVector[16];
EFI_GUID FileSystemGuid;
UINT64 FvLength;
UINT32 Signature;
EFI_FVB_ATTRIBUTES Attributes;
UINT16 HeaderLength;
UINT16 Checksum;
UINT16 ExtHeaderOffset;
UINT8 Reserved[1];
UINT8 Revision;
EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];
} EFI_FIRMWARE_VOLUME_HEADER;
//
// Extension header pointed by ExtHeaderOffset of volume header.
//
typedef struct {
EFI_GUID FvName;
UINT32 ExtHeaderSize;
} EFI_FIRMWARE_VOLUME_EXT_HEADER;
typedef struct {
UINT16 ExtEntrySize;
UINT16 ExtEntryType;
} EFI_FIRMWARE_VOLUME_EXT_ENTRY;
#define EFI_FV_EXT_TYPE_OEM_TYPE 0x01
typedef struct {
EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
UINT32 TypeMask;
//
// Array of GUIDs.
// Each GUID represents an OEM file type.
//
EFI_GUID Types[1];
} EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;
#endif

258
MdePkg/Include/Pi/PiHob.h Normal file
View File

@ -0,0 +1,258 @@
/* @file
HOB related definitions in PI.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PiHob.h
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_HOB_H__
#define __PI_HOB_H__
//
// HobType of EFI_HOB_GENERIC_HEADER.
//
#define EFI_HOB_TYPE_HANDOFF 0x0001
#define EFI_HOB_TYPE_MEMORY_ALLOCATION 0x0002
#define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR 0x0003
#define EFI_HOB_TYPE_GUID_EXTENSION 0x0004
#define EFI_HOB_TYPE_FV 0x0005
#define EFI_HOB_TYPE_CPU 0x0006
#define EFI_HOB_TYPE_MEMORY_POOL 0x0007
#define EFI_HOB_TYPE_FV2 0x0009
#define EFI_HOB_TYPE_LOAD_PEIM 0x000A
#define EFI_HOB_TYPE_UNUSED 0xFFFE
#define EFI_HOB_TYPE_END_OF_HOB_LIST 0xFFFF
//
// Describes the format and size of the data inside the HOB.
// All HOBs must contain this generic HOB header.
//
typedef struct _EFI_HOB_GENERIC_HEADER {
UINT16 HobType;
UINT16 HobLength;
UINT32 Reserved;
} EFI_HOB_GENERIC_HEADER;
//
// Value of version ofinEFI_HOB_HANDOFF_INFO_TABLE.
//
#define EFI_HOB_HANDOFF_TABLE_VERSION 0x0009
//
// Contains general state information used by the HOB producer phase.
// This HOB must be the first one in the HOB list.
//
typedef struct _EFI_HOB_HANDOFF_INFO_TABLE {
EFI_HOB_GENERIC_HEADER Header;
UINT32 Version;
EFI_BOOT_MODE BootMode;
EFI_PHYSICAL_ADDRESS EfiMemoryTop;
EFI_PHYSICAL_ADDRESS EfiMemoryBottom;
EFI_PHYSICAL_ADDRESS EfiFreeMemoryTop;
EFI_PHYSICAL_ADDRESS EfiFreeMemoryBottom;
EFI_PHYSICAL_ADDRESS EfiEndOfHobList;
} EFI_HOB_HANDOFF_INFO_TABLE;
typedef struct _EFI_HOB_MEMORY_ALLOCATION_HEADER {
EFI_GUID Name;
EFI_PHYSICAL_ADDRESS MemoryBaseAddress;
UINT64 MemoryLength;
EFI_MEMORY_TYPE MemoryType;
//
// Padding for Itanium processor family
//
UINT8 Reserved[4];
} EFI_HOB_MEMORY_ALLOCATION_HEADER;
//
// Describes all memory ranges used during the HOB producer
// phase that exist outside the HOB list. This HOB type
// describes how memory is used,
// not the physical attributes of memory.
//
typedef struct _EFI_HOB_MEMORY_ALLOCATION {
EFI_HOB_GENERIC_HEADER Header;
EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;
//
// Additional data pertaining to the ¡°Name¡± Guid memory
// may go here.
//
} EFI_HOB_MEMORY_ALLOCATION;
//
// Describes the memory stack that is produced by the HOB producer
// phase and upon which all postmemory-installed executable
// content in the HOB producer phase is executing.
//
typedef struct _EFI_HOB_MEMORY_ALLOCATION_STACK {
EFI_HOB_GENERIC_HEADER Header;
EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;
} EFI_HOB_MEMORY_ALLOCATION_STACK;
//
// Defines the location of the boot-strap
// processor (BSP) BSPStore (¡°Backing Store Pointer Store¡±).
// This HOB is valid for the Itanium processor family only
// register overflow store.
//
typedef struct _EFI_HOB_MEMORY_ALLOCATION_BSP_STORE {
EFI_HOB_GENERIC_HEADER Header;
EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;
} EFI_HOB_MEMORY_ALLOCATION_BSP_STORE;
//
// Defines the location and entry point of the HOB consumer phase.
//
typedef struct {
EFI_HOB_GENERIC_HEADER Header;
EFI_HOB_MEMORY_ALLOCATION_HEADER MemoryAllocationHeader;
EFI_GUID ModuleName;
EFI_PHYSICAL_ADDRESS EntryPoint;
} EFI_HOB_MEMORY_ALLOCATION_MODULE;
typedef UINT32 EFI_RESOURCE_TYPE;
//
// Value of ResourceType in EFI_HOB_RESOURCE_DESCRIPTOR.
//
#define EFI_RESOURCE_SYSTEM_MEMORY 0x00000000
#define EFI_RESOURCE_MEMORY_MAPPED_IO 0x00000001
#define EFI_RESOURCE_IO 0x00000002
#define EFI_RESOURCE_FIRMWARE_DEVICE 0x00000003
#define EFI_RESOURCE_MEMORY_MAPPED_IO_PORT 0x00000004
#define EFI_RESOURCE_MEMORY_RESERVED 0x00000005
#define EFI_RESOURCE_IO_RESERVED 0x00000006
#define EFI_RESOURCE_MAX_MEMORY_TYPE 0x00000007
typedef UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE;
//
// These types can be ORed together as needed.
//
// The first three enumerations describe settings
//
#define EFI_RESOURCE_ATTRIBUTE_PRESENT 0x00000001
#define EFI_RESOURCE_ATTRIBUTE_INITIALIZED 0x00000002
#define EFI_RESOURCE_ATTRIBUTE_TESTED 0x00000004
//
// The rest of the settings describe capabilities
//
#define EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC 0x00000008
#define EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC 0x00000010
#define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_1 0x00000020
#define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_2 0x00000040
#define EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED 0x00000080
#define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED 0x00000100
#define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED 0x00000200
#define EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE 0x00000400
#define EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE 0x00000800
#define EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE 0x00001000
#define EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE 0x00002000
#define EFI_RESOURCE_ATTRIBUTE_16_BIT_IO 0x00004000
#define EFI_RESOURCE_ATTRIBUTE_32_BIT_IO 0x00008000
#define EFI_RESOURCE_ATTRIBUTE_64_BIT_IO 0x00010000
#define EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED 0x00020000
//
// Describes the resource properties of all fixed,
// nonrelocatable resource ranges found on the processor
// host bus during the HOB producer phase.
//
typedef struct _EFI_HOB_RESOURCE_DESCRIPTOR {
EFI_HOB_GENERIC_HEADER Header;
EFI_GUID Owner;
EFI_RESOURCE_TYPE ResourceType;
EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
EFI_PHYSICAL_ADDRESS PhysicalStart;
UINT64 ResourceLength;
} EFI_HOB_RESOURCE_DESCRIPTOR;
//
// Allows writers of executable content in the HOB producer phase to
// maintain and manage HOBs with specific GUID.
//
typedef struct _EFI_HOB_GUID_TYPE {
EFI_HOB_GENERIC_HEADER Header;
EFI_GUID Name;
//
// Guid specific data goes here
//
} EFI_HOB_GUID_TYPE;
//
// Details the location of firmware volumes that contain firmware files.
//
typedef struct {
EFI_HOB_GENERIC_HEADER Header;
EFI_PHYSICAL_ADDRESS BaseAddress;
UINT64 Length;
} EFI_HOB_FIRMWARE_VOLUME;
//
// Details the location of a firmware volume which was extracted
// from a file within another firmware volume.
//
typedef struct {
EFI_HOB_GENERIC_HEADER Header;
EFI_PHYSICAL_ADDRESS BaseAddress;
UINT64 Length;
EFI_GUID FvName;
EFI_GUID FileName;
} EFI_HOB_FIRMWARE_VOLUME2;
//
// Describes processor information, such as address space and I/O space capabilities.
//
typedef struct _EFI_HOB_CPU {
EFI_HOB_GENERIC_HEADER Header;
UINT8 SizeOfMemorySpace;
UINT8 SizeOfIoSpace;
UINT8 Reserved[6];
} EFI_HOB_CPU;
//
// Describes pool memory allocations.
//
typedef struct _EFI_HOB_MEMORY_POOL {
EFI_HOB_GENERIC_HEADER Header;
} EFI_HOB_MEMORY_POOL;
//
// Union of all the possible HOB Types
//
typedef union {
EFI_HOB_GENERIC_HEADER *Header;
EFI_HOB_HANDOFF_INFO_TABLE *HandoffInformationTable;
EFI_HOB_MEMORY_ALLOCATION *MemoryAllocation;
EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *MemoryAllocationBspStore;
EFI_HOB_MEMORY_ALLOCATION_STACK *MemoryAllocationStack;
EFI_HOB_MEMORY_ALLOCATION_MODULE *MemoryAllocationModule;
EFI_HOB_RESOURCE_DESCRIPTOR *ResourceDescriptor;
EFI_HOB_GUID_TYPE *Guid;
EFI_HOB_FIRMWARE_VOLUME *FirmwareVolume;
EFI_HOB_CPU *Cpu;
EFI_HOB_MEMORY_POOL *Pool;
UINT8 *Raw;
} EFI_PEI_HOB_POINTERS;
#endif

View File

@ -0,0 +1,91 @@
/** @file
Include file matches things in PI for multiple module types.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PiMultiPhase.h
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_MULTIPHASE_H__
#define __PI_MULTIPHASE_H__
#include <Uefi/UefiMultiPhase.h>
#include <Pi/PiFirmwareVolume.h>
#include <Pi/PiFirmwareFile.h>
#include <Pi/PiBootMode.h>
#include <Pi/PiHob.h>
#include <Pi/PiDependency.h>
//
// Status Code Type Definition
//
typedef UINT32 EFI_STATUS_CODE_TYPE;
//
// A Status Code Type is made up of the code type and severity
// All values masked by EFI_STATUS_CODE_RESERVED_MASK are
// reserved for use by this specification.
//
#define EFI_STATUS_CODE_TYPE_MASK 0x000000FF
#define EFI_STATUS_CODE_SEVERITY_MASK 0xFF000000
#define EFI_STATUS_CODE_RESERVED_MASK 0x00FFFF00
//
// Definition of code types, all other values masked by
// EFI_STATUS_CODE_TYPE_MASK are reserved for use by
// this specification.
//
#define EFI_PROGRESS_CODE 0x00000001
#define EFI_ERROR_CODE 0x00000002
#define EFI_DEBUG_CODE 0x00000003
//
// Definitions of severities, all other values masked by
// EFI_STATUS_CODE_SEVERITY_MASK are reserved for use by
// this specification.
// Uncontained errors are major errors that could not contained
// to the specific component that is reporting the error
// For example, if a memory error was not detected early enough,
// the bad data could be consumed by other drivers.
//
#define EFI_ERROR_MINOR 0x40000000
#define EFI_ERROR_MAJOR 0x80000000
#define EFI_ERROR_UNRECOVERED 0x90000000
#define EFI_ERROR_UNCONTAINED 0xa0000000
//
// Status Code Value Definition
//
typedef UINT32 EFI_STATUS_CODE_VALUE;
//
// A Status Code Value is made up of the class, subclass, and
// an operation.
//
#define EFI_STATUS_CODE_CLASS_MASK 0xFF000000
#define EFI_STATUS_CODE_SUBCLASS_MASK 0x00FF0000
#define EFI_STATUS_CODE_OPERATION_MASK 0x0000FFFF
//
// Definition of Status Code extended data header.
// The data will follow HeaderSize bytes from the beginning of
// the structure and is Size bytes long.
//
typedef struct {
UINT16 HeaderSize;
UINT16 Size;
EFI_GUID Type;
} EFI_STATUS_CODE_DATA;
#endif

View File

@ -0,0 +1,805 @@
/** @file
PI PEI master include file. This file should match the PI spec.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: PiPeiCis.h
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_PEICIS_H__
#define __PI_PEICIS_H__
#include <Pi/PiMultiPhase.h>
#define EFI_NOT_AVAILABLE_YET EFIERR (28)
//
// Handles of EFI FV/FFS.
//
typedef VOID *EFI_PEI_FV_HANDLE;
typedef VOID *EFI_PEI_FILE_HANDLE;
//
// Declare forward referenced data structures
//
typedef struct _EFI_PEI_SERVICES EFI_PEI_SERVICES;
typedef struct _EFI_PEI_NOTIFY_DESCRIPTOR EFI_PEI_NOTIFY_DESCRIPTOR;
#include <Ppi/CpuIo.h>
#include <Ppi/PciCfg2.h>
/**
The PEI Dispatcher will invoke each PEIM one time. During this pass, the PEI
Dispatcher will pass control to the PEIM at the AddressOfEntryPoint in the PE Header.
@param FfsHeader Pointer to the FFS file header.
@param PeiServices Describes the list of possible PEI Services.
@return Status code
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEIM_ENTRY_POINT)(
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
);
/**
Entry point of the notification callback function itself within the PEIM.
@param PeiServices Indirect reference to the PEI Services Table.
@param NotifyDescriptor Address of the notification descriptor data structure.
@param Ppi Address of the PPI that was installed.
@return Status code
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEIM_NOTIFY_ENTRY_POINT) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
IN VOID *Ppi
);
//
// PEI Ppi Services List Descriptors
//
#define EFI_PEI_PPI_DESCRIPTOR_PIC 0x00000001
#define EFI_PEI_PPI_DESCRIPTOR_PPI 0x00000010
#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK 0x00000020
#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH 0x00000040
#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES 0x00000060
#define EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST 0x80000000
typedef struct {
UINTN Flags;
EFI_GUID *Guid;
VOID *Ppi;
} EFI_PEI_PPI_DESCRIPTOR;
struct _EFI_PEI_NOTIFY_DESCRIPTOR {
UINTN Flags;
EFI_GUID *Guid;
EFI_PEIM_NOTIFY_ENTRY_POINT Notify;
};
//
// Describes request of the module to be loaded to
// the permanent memory once it is available. Unlike most of the other HOBs,
// this HOB is produced and consumed during the HOB producer phase.
//
typedef struct _EFI_HOB_LOAD_PEIM {
EFI_HOB_GENERIC_HEADER Header;
EFI_PEI_FILE_HANDLE FileHandle;
EFI_PEIM_ENTRY_POINT EntryPoint;
EFI_PEIM_ENTRY_POINT InMemEntryPoint;
} EFI_HOB_LOAD_PEIM;
/**
This service is the first one provided by the PEI Foundation. This function
installs an interface in the PEI PPI database by GUID. The purpose of the
service is to publish an interface that other parties can use to call
additional PEIMs.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table
published by the PEI Foundation.
@param PpiList A pointer to the list of interfaces that the caller shall install.
@retval EFI_SUCCESS The interface was successfully installed.
@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.
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_INSTALL_PPI) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PPI_DESCRIPTOR *PpiList
);
/**
This function reinstalls an interface in the PEI PPI database by GUID.
The purpose of the service is to publish an interface that other parties
can use to replace a same-named interface in the protocol database
with a different interface.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table
published by the PEI Foundation.
@param OldPpi A pointer to the former PPI in the database.
@param NewPpi A pointer to the new interfaces that the caller shall install.
@retval EFI_SUCCESS The interface was successfully installed.
@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.
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
@retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been installed.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_REINSTALL_PPI) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,
IN EFI_PEI_PPI_DESCRIPTOR *NewPpi
);
/**
This function locates an interface in the PEI PPI database by GUID.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES published by the PEI Foundation.
@param Guid A pointer to the GUID whose corresponding interface needs to be found.
@param Instance The N-th instance of the interface that is required.
@param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
@param Ppi A pointer to the instance of the interface.
@retval EFI_SUCCESS The interface was successfully returned.
@retval EFI_NOT_FOUND The PPI descriptor is not found in the database.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_LOCATE_PPI) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_GUID *Guid,
IN UINTN Instance,
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
IN OUT VOID **Ppi
);
/**
This function installs a notification service to be called back when a
given interface is installed or reinstalled. The purpose of the service
is to publish an interface that other parties can use to call additional PPIs
that may materialize later.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
@param NotifyList A pointer to the list of notification interfaces that the caller shall install.
@retval EFI_SUCCESS The interface was successfully installed.
@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.
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_NOTIFY_PPI) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
);
/**
This function returns the present value of the boot mode.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param BootMode A pointer to contain the value of the boot mode.
@retval EFI_SUCCESS The boot mode was returned successfully.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_GET_BOOT_MODE) (
IN EFI_PEI_SERVICES **PeiServices,
OUT EFI_BOOT_MODE *BootMode
);
/**
This function sets the value of the boot mode.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
@param BootMode The value of the boot mode to set.
@retval EFI_SUCCESS The boot mode was returned successfully.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_SET_BOOT_MODE) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_BOOT_MODE BootMode
);
/**
This function returns the pointer to the list of Hand-Off Blocks (HOBs) in memory.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
@param HobList A pointer to the list of HOBs that the PEI Foundation will initialize
@retval EFI_SUCCESS The list was successfully returned.
@retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_GET_HOB_LIST) (
IN EFI_PEI_SERVICES **PeiServices,
IN OUT VOID **HobList
);
/**
This service published by the PEI Foundation abstracts the creation of a Hand-Off Block's (HOB's) headers.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param Type The type of HOB to be installed.
@param Length The length of the HOB to be added.
@param Hob The address of a pointer that will contain the HOB header.
@retval EFI_SUCCESS The HOB was successfully created.
@retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_CREATE_HOB) (
IN EFI_PEI_SERVICES **PeiServices,
IN UINT16 Type,
IN UINT16 Length,
IN OUT VOID **Hob
);
/**
The purpose of the service is to abstract the capability of the PEI
Foundation to discover instances of firmware volumes in the system.
Given the input file pointer, this service searches for the next
matching file in the Firmware File System (FFS) volume.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware Volume (BFV).
@param FwVolHeader Pointer to the firmware volume header of the volume to return.
@retval EFI_SUCCESS The volume was found.
@retval EFI_NOT_FOUND The volume was not found.
@retval EFI_INVALID_PARAMETER FwVolHeader is NULL
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_NEXT_VOLUME2) (
IN EFI_PEI_SERVICES **PeiServices,
IN UINTN Instance,
IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
);
/**
The purpose of the service is to abstract the capability of the PEI
Foundation to discover instances of firmware files in the system.
Given the input file pointer, this service searches for the next matching
file in the Firmware File System (FFS) volume.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param SearchType A filter to find files only of this type.
@param FwVolHeader Pointer to the firmware volume header of the volume to search.This parameter
must point to a valid FFS volume.
@param FileHeader Pointer to the current file from which to begin searching.This pointer will be
updated upon return to reflect the file found.
@retval EFI_SUCCESS The file was found.
@retval EFI_NOT_FOUND The file was not found.
@retval EFI_NOT_FOUND The header checksum was not zero.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_NEXT_FILE2) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_FV_FILETYPE SearchType,
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
IN OUT EFI_FFS_FILE_HEADER **FileHeader
);
/**
Given the input file pointer, this service searches for the next
matching file in the Firmware File System (FFS) volume.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param SectionType The value of the section type to find.
@param FfsFileHeader A pointer to the file header that contains the set of sections to be searched.
@param SectionData A pointer to the discovered section, if successful.
@retval EFI_SUCCESS The section was found.
@retval EFI_NOT_FOUND The section was not found.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA2) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_SECTION_TYPE SectionType,
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
IN OUT VOID **SectionData
);
/**
This function registers the found memory configuration with the PEI Foundation.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param MemoryBegin The value of a region of installed memory
@param MemoryLength The corresponding length of a region of installed memory.
@retval EFI_SUCCESS The region was successfully installed in a HOB.
@retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
@retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_INSTALL_PEI_MEMORY) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
IN UINT64 MemoryLength
);
/**
The purpose of the service is to publish an interface that allows
PEIMs to allocate memory ranges that are managed by the PEI Foundation.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param MemoryType The type of memory to allocate.
@param Pages The number of contiguous 4 KB pages to allocate.
@param Memory Pointer to a physical address. On output, the address is set to the base
of the page range that was allocated.
@retval EFI_SUCCESS The memory range was successfully allocated.
@retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
@retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_ALLOCATE_PAGES) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
IN OUT EFI_PHYSICAL_ADDRESS *Memory
);
/**
The purpose of this service is to publish an interface that
allows PEIMs to allocate memory ranges that are managed by the PEI Foundation.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param Size The number of bytes to allocate from the pool.
@param Buffer If the call succeeds, a pointer to a pointer to the allocated buffer; undefined otherwise.
@retval EFI_SUCCESS The allocation was successful.
@retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_ALLOCATE_POOL) (
IN EFI_PEI_SERVICES **PeiServices,
IN UINTN Size,
OUT VOID **Buffer
);
/**
This service copies the contents of one buffer to another buffer.
@param Destination Pointer to the destination buffer of the memory copy.
@param Source Pointer to the source buffer of the memory copy
@param Length Number of bytes to copy from Source to Destination.
@return None
**/
typedef
VOID
(EFIAPI *EFI_PEI_COPY_MEM) (
IN VOID *Destination,
IN VOID *Source,
IN UINTN Length
);
/**
The service fills a buffer with a specified value.
@param Buffer Pointer to the buffer to fill.
@param Size Number of bytes in Buffer to fill.
@param Value Value to fill Buffer with
@return None
**/
typedef
VOID
(EFIAPI *EFI_PEI_SET_MEM) (
IN VOID *Buffer,
IN UINTN Size,
IN UINT8 Value
);
/**
This service publishes an interface that allows PEIMs to report status codes.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param Type Indicates the type of status code being reported.
@param Value Describes the current status of a hardware or
software entity. This includes information about the class and
subclass that is used to classify the entity as well as an operation.
For progress codes, the operation is the current activity.
For error codes, it is the exception.For debug codes,it is not defined at this time.
@param Instance The enumeration of a hardware or software entity within
the system. A system may contain multiple entities that match a class/subclass
pairing. The instance differentiates between them. An instance of 0 indicates
that instance information is unavailable, not meaningful, or not relevant.
Valid instance numbers start with 1.
@param CallerId This optional parameter may be used to identify the caller.
This parameter allows the status code driver to apply different rules to
different callers.
@param Data This optional parameter may be used to pass additional data.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_NOT_AVAILABLE_YET No progress code provider has installed an interface in the system.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_REPORT_STATUS_CODE) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId OPTIONAL,
IN EFI_STATUS_CODE_DATA *Data OPTIONAL
);
/**
Resets the entire platform.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES
table published by the PEI Foundation.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_RESET_SYSTEM) (
IN EFI_PEI_SERVICES **PeiServices
);
/**
This service searches for files with a specific name, within
either the specified firmware volume or all firmware volumes.
The service returns a file handle of type EFI_PEI_FILE_HANDLE,
which must be unique within the system.
@param FileName A pointer to the name of the file to
find within the firmware volume.
@param VolumeHandle The firmware volume to search FileHandle
Upon exit, points to the found file's
handle or NULL if it could not be found.
@retval EFI_SUCCESS File was found.
@retval EFI_NOT_FOUND File was not found.
@retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or
FileName was NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_BY_NAME) (
IN CONST EFI_GUID *FileName,
IN CONST EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_PEI_FILE_HANDLE *FileHandle
);
/**
@param FileName Name of the file.
@param FileType File type. See EFI_FV_FILETYPE, which is
defined in the Platform Initialization
Firmware Storage Specification.
@param FileAttributes Attributes of the file. Type
EFI_FV_FILE_ATTRIBUTES is defined in
the Platform Initialization Firmware
Storage Specification.
@param Buffer Points to the file's data (not the header).
Not valid if EFI_FV_FILE_ATTRIB_MEMORY_MAPPED
is zero.
@param BufferSize Size of the file's data.
**/
typedef struct {
EFI_GUID FileName;
EFI_FV_FILETYPE FileType;
EFI_FV_FILE_ATTRIBUTES FileAttributes;
VOID *Buffer;
UINT32 BufferSize;
} EFI_FV_FILE_INFO;
/**
This function returns information about a specific file,
including its file name, type, attributes, starting address and
size. If the firmware volume is not memory mapped then the
Buffer member will be NULL.
@param FileHandle Handle of the file.
@param FileInfo Upon exit, points to the file¡¯s
information.
@retval EFI_SUCCESS File information returned.
@retval EFI_INVALID_PARAMETER If FileHandle does not
represent a valid file.
@retval EFI_INVALID_PARAMETER If FileInfo is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_GET_FILE_INFO) (
IN CONST EFI_PEI_FILE_HANDLE FileHandle,
OUT EFI_FV_FILE_INFO *FileInfo
);
/**
@param FvAttributes Attributes of the firmware volume. Type
EFI_FVB_ATTRIBUTES is defined in the
Platform Initialization Firmware Storage
Specficiation.
@param FvFormat Format of the firmware volume. For PI
Architecture Firmware Volumes, this can
be copied from FileSystemGuid in
EFI_FIRMWARE_VOLUME_HEADER.
@param FvName Name of the firmware volume. For PI
Architecture Firmware Volumes, this can
be copied from VolumeName in the
extended header of
EFI_FIRMWARE_VOLUME_HEADER.
@param FvStart Points to the first byte of the firmware
volume, if bit EFI_FVB_MEMORY_MAPPED is
set in FvAttributes. FvSize Size of the
firmware volume.
**/
typedef struct {
EFI_FVB_ATTRIBUTES FvAttributes;
EFI_GUID FvFormat;
EFI_GUID FvName;
VOID *FvStart;
UINT64 FvSize;
} EFI_FV_INFO;
/**
This function returns information about a specific firmware
volume, including its name, type, attributes, starting address
and size.
@param VolumeHandle Handle of the volume.
@param VolumeInfo Upon exit, points to the volume¡¯s
information.
@retval EFI_SUCCESS File information returned.
@retval EFI_INVALID_PARAMETER If FileHandle does not
represent a valid file.
@retval EFI_INVALID_PARAMETER If FileInfo is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_GET_VOLUME_INFO) (
IN CONST EFI_PEI_FV_HANDLE *VolumeHandle,
OUT EFI_FV_INFO *VolumeInfo
);
/**
This service registers a file handle so that after memory is
available, the PEIM will be re-loaded into permanent memory and
re-initialized. The PEIM registered this way will always be
initialized twice. The first time, this function call will
return EFI_SUCCESS. The second time, this function call will
return EFI_ALREADY_STARTED. Depending on the order in which
PEIMs are dispatched, the PEIM making this call may be
initialized after permanent memory is installed, even the first
time.
@param FileHandle PEIM¡¯s file handle. Must be the currently
xecuting PEIM.
@retval EFI_SUCCESS The PEIM was successfully registered for
shadowing.
@retval EFI_ALREADY_STARTED The PEIM was previously
registered for shadowing.
@retval EFI_NOT_FOUND The FileHandle does not refer to a
valid file handle.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_REGISTER_FOR_SHADOW) (
IN CONST EFI_PEI_FILE_HANDLE FileHandle
);
//
// PEI Specification Revision information
//
#define PEI_SPECIFICATION_MAJOR_REVISION 1
#define PEI_SPECIFICATION_MINOR_REVISION 0
//
// PEI Services Table
//
#define PEI_SERVICES_SIGNATURE 0x5652455320494550
#define PEI_SERVICES_REVISION (PEI_SPECIFICATION_MAJOR_REVISION<<16) | (PEI_SPECIFICATION_MINOR_REVISION)
struct EFI_PEI_SERVICES {
EFI_TABLE_HEADER Hdr;
//
// PPI Functions
//
EFI_PEI_INSTALL_PPI InstallPpi;
EFI_PEI_REINSTALL_PPI ReInstallPpi;
EFI_PEI_LOCATE_PPI LocatePpi;
EFI_PEI_NOTIFY_PPI NotifyPpi;
//
// Boot Mode Functions
//
EFI_PEI_GET_BOOT_MODE GetBootMode;
EFI_PEI_SET_BOOT_MODE SetBootMode;
//
// HOB Functions
//
EFI_PEI_GET_HOB_LIST GetHobList;
EFI_PEI_CREATE_HOB CreateHob;
//
// Firmware Volume Functions
//
EFI_PEI_FFS_FIND_NEXT_VOLUME2 FfsFindNextVolume;
EFI_PEI_FFS_FIND_NEXT_FILE2 FfsFindNextFile;
EFI_PEI_FFS_FIND_SECTION_DATA2 FfsFindSectionData;
//
// PEI Memory Functions
//
EFI_PEI_INSTALL_PEI_MEMORY InstallPeiMemory;
EFI_PEI_ALLOCATE_PAGES AllocatePages;
EFI_PEI_ALLOCATE_POOL AllocatePool;
EFI_PEI_COPY_MEM CopyMem;
EFI_PEI_SET_MEM SetMem;
//
// Status Code
EFI_PEI_REPORT_STATUS_CODE ReportStatusCode;
//
// Reset
//
EFI_PEI_RESET_SYSTEM ResetSystem;
//
// (the following interfaces are installed by publishing PEIM)
//
// I/O Abstractions
//
EFI_PEI_CPU_IO_PPI *CpuIo;
EFI_PEI_PCI_CFG2_PPI *PciCfg;
//
// Future Installed Services
EFI_PEI_FFS_FIND_BY_NAME FfsFindFileByName;
EFI_PEI_FFS_GET_FILE_INFO FfsGetFileInfo;
EFI_PEI_FFS_GET_VOLUME_INFO FfsGetVolumeInfo;
EFI_PEI_REGISTER_FOR_SHADOW RegisterForShadow;
} ;
typedef struct _EFI_SEC_PEI_HAND_OFF {
//
// Size of the data structure.
//
UINT16 DataSize;
//
// Points to the first byte of the boot firmware volume,
// which the PEI Dispatcher should search for
// PEI modules.
//
VOID *BootFirmwareVolumeBase;
//
// Size of the boot firmware volume, in bytes.
//
UINTN BootFirmwareVolumeSize;
//
// Points to the first byte of the temporary RAM.
//
VOID *TemporaryRamBase;
//
// Size of the temporary RAM, in bytes.
//
UINTN TemporaryRamSize;
//
// Points to the first byte of the temporary RAM
// available for use by the PEI Foundation. The area
// described by PeiTemporaryRamBase and PeiTemporaryRamSize
// must not extend outside beyond the area described by
// TemporaryRamBase & TemporaryRamSize. This area should not
// overlap with the area reported by StackBase and
// StackSize.
//
VOID *PeiTemporaryRamBase;
//
// Size of the available temporary RAM available for
// use by the PEI Foundation, in bytes.
//
UINTN PeiTemporaryRamSize;
//
// Points to the first byte of the stack.
// This are may be part of the memory described by
// TemporaryRamBase and TemporaryRamSize
// or may be an entirely separate area.
//
VOID *StackBase;
//
// Size of the stack, in bytes.
//
UINTN StackSize;
} EFI_SEC_PEI_HAND_OFF;
#endif

30
MdePkg/Include/PiDxe.h Normal file
View File

@ -0,0 +1,30 @@
/** @file
Root include file for Mde Package DXE_CORE, DXE, SMM, SAL type modules.
This is the include file for any module of type base. Base modules only use
types defined via this include file and can be ported easily to any
environment. There are a set of base libraries in the Mde Package that can
be used to implement base modules.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __PI_DXE_H__
#define __PI_DXE_H__
#include <Uefi/UefiBaseType.h>
#include <Uefi/UefiSpec.h>
#include <Pi/PiDxeCis.h>
#endif

30
MdePkg/Include/PiPei.h Normal file
View File

@ -0,0 +1,30 @@
/** @file
Root include file for Mde Package SEC, PEIM, PEI_CORE type modules.
This is the include file for any module of type base. Base modules only use
types defined via this include file and can be ported easily to any
environment. There are a set of base libraries in the Mde Package that can
be used to implement base modules.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __PI_PEI_H__
#define __PI_PEI_H__
#include <Uefi/UefiBaseType.h>
#include <Pi/PiPeiCis.h>
#include <Uefi/UefiMultiPhase.h>
#endif

28
MdePkg/Include/Uefi.h Normal file
View File

@ -0,0 +1,28 @@
/** @file
Root include file for Mde Package UEFI, UEFI_APPLICATION type modules.
This is the include file for any module of type base. Base modules only use
types defined via this include file and can be ported easily to any
environment. There are a set of base libraries in the Mde Package that can
be used to implement base modules.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __PI_UEFI_H__
#define __PI_UEFI_H__
#include <UefiBaseType.h>
#include <UefiSpec.h>
#endif

View File

@ -0,0 +1,141 @@
/* @file
Defines data types and constants introduced in UEFI.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __UEFI_BASETYPE_H__
#define __UEFI_BASETYPE_H__
#include "Base.h"
//
// Basical data type definitions introduced in UEFI.
//
typedef GUID EFI_GUID;
typedef RETURN_STATUS EFI_STATUS;
typedef VOID *EFI_HANDLE;
typedef VOID *EFI_EVENT;
typedef UINTN EFI_TPL;
typedef UINT64 EFI_LBA;
typedef UINT16 EFI_HII_HANDLE;
typedef UINT16 STRING_REF;
typedef UINT64 EFI_PHYSICAL_ADDRESS;
typedef UINT64 EFI_VIRTUAL_ADDRESS;
//
// EFI Time Abstraction:
// Year: 2000 - 20XX
// Month: 1 - 12
// Day: 1 - 31
// Hour: 0 - 23
// Minute: 0 - 59
// Second: 0 - 59
// Nanosecond: 0 - 999,999,999
// TimeZone: -1440 to 1440 or 2047
//
typedef struct {
UINT16 Year;
UINT8 Month;
UINT8 Day;
UINT8 Hour;
UINT8 Minute;
UINT8 Second;
UINT8 Pad1;
UINT32 Nanosecond;
INT16 TimeZone;
UINT8 Daylight;
UINT8 Pad2;
} EFI_TIME;
//
// Enumeration of EFI_STATUS.
//
#define EFI_SUCCESS RETURN_SUCCESS
#define EFI_LOAD_ERROR RETURN_LOAD_ERROR
#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER
#define EFI_UNSUPPORTED RETURN_UNSUPPORTED
#define EFI_BAD_BUFFER_SIZE RETURN_BAD_BUFFER_SIZE
#define EFI_BUFFER_TOO_SMALL RETURN_BUFFER_TOO_SMALL
#define EFI_NOT_READY RETURN_NOT_READY
#define EFI_DEVICE_ERROR RETURN_DEVICE_ERROR
#define EFI_WRITE_PROTECTED RETURN_WRITE_PROTECTED
#define EFI_OUT_OF_RESOURCES RETURN_OUT_OF_RESOURCES
#define EFI_VOLUME_CORRUPTED RETURN_VOLUME_CORRUPTED
#define EFI_VOLUME_FULL RETURN_VOLUME_FULL
#define EFI_NO_MEDIA RETURN_NO_MEDIA
#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED
#define EFI_NOT_FOUND RETURN_NOT_FOUND
#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED
#define EFI_NO_RESPONSE RETURN_NO_RESPONSE
#define EFI_NO_MAPPING RETURN_NO_MAPPING
#define EFI_TIMEOUT RETURN_TIMEOUT
#define EFI_NOT_STARTED RETURN_NOT_STARTED
#define EFI_ALREADY_STARTED RETURN_ALREADY_STARTED
#define EFI_ABORTED RETURN_ABORTED
#define EFI_ICMP_ERROR RETURN_ICMP_ERROR
#define EFI_TFTP_ERROR RETURN_TFTP_ERROR
#define EFI_PROTOCOL_ERROR RETURN_PROTOCOL_ERROR
#define EFI_INCOMPATIBLE_VERSION RETURN_INCOMPATIBLE_VERSION
#define EFI_SECURITY_VIOLATION RETURN_SECURITY_VIOLATION
#define EFI_CRC_ERROR RETURN_CRC_ERROR
#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA
#define EFI_END_OF_FILE RETURN_END_OF_FILE
#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH
#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE
#define EFI_WARN_WRITE_FAILURE RETURN_WARN_WRITE_FAILURE
#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
#define NULL_HANDLE ((VOID *) 0)
//
// Define macro to encode the status code.
//
#define EFIERR(_a) ENCODE_ERROR(_a)
#define EFI_ERROR(A) RETURN_ERROR(A)
//
// Define macros to build data structure signatures from characters.
//
#define EFI_SIGNATURE_16(A, B) ((A) | (B << 8))
#define EFI_SIGNATURE_32(A, B, C, D) (EFI_SIGNATURE_16 (A, B) | (EFI_SIGNATURE_16 (C, D) << 16))
#define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H) \
(EFI_SIGNATURE_32 (A, B, C, D) | ((UINT64) (EFI_SIGNATURE_32 (E, F, G, H)) << 32))
//
// Returns the byte offset to a field within a structure
//
#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))
//
// The EFI memory allocation functions work in units of EFI_PAGEs that are
// 4K. This should in no way be confused with the page size of the processor.
// An EFI_PAGE is just the quanta of memory in EFI.
//
#define EFI_PAGE_SIZE 0x1000
#define EFI_PAGE_MASK 0xFFF
#define EFI_PAGE_SHIFT 12
#endif

View File

@ -0,0 +1,466 @@
/* @file
Device Path definitions introduced in UEFI.
This include file must only contain things defined in the UEFI 2.0 specification.
If a code construct is defined in the UEFI 2.0 specification it must be included
by this include file.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: UefiDevicePath.h
**/
#ifndef __UEFI_DEVICE_PATH_H__
#define __UEFI_DEVICE_PATH_H__
//
// Device Path information
//
#pragma pack(1)
//
// Hardware Device Paths
//
#define HARDWARE_DEVICE_PATH 0x01
#define HW_PCI_DP 0x01
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT8 Function;
UINT8 Device;
} PCI_DEVICE_PATH;
#define HW_PCCARD_DP 0x02
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT8 FunctionNumber;
} PCCARD_DEVICE_PATH;
#define HW_MEMMAP_DP 0x03
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 MemoryType;
EFI_PHYSICAL_ADDRESS StartingAddress;
EFI_PHYSICAL_ADDRESS EndingAddress;
} MEMMAP_DEVICE_PATH;
#define HW_VENDOR_DP 0x04
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
} VENDOR_DEVICE_PATH;
#define HW_CONTROLLER_DP 0x05
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 ControllerNumber;
} CONTROLLER_DEVICE_PATH;
//
// ACPI Device Paths
//
#define ACPI_DEVICE_PATH 0x02
#define ACPI_DP 0x01
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 HID;
UINT32 UID;
} ACPI_HID_DEVICE_PATH;
#define ACPI_EXTENDED_DP 0x02
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 HID;
UINT32 UID;
UINT32 CID;
//
// Optional variable length _HIDSTR
// Optional variable length _UIDSTR
//
} ACPI_EXTENDED_HID_DEVICE_PATH;
//
// EISA ID Macro
// EISA ID Definition 32-bits
// bits[15:0] - three character compressed ASCII EISA ID.
// bits[31:16] - binary number
// Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
//
#define PNP_EISA_ID_CONST 0x41d0
#define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16))
#define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
#define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
#define PNP_EISA_ID_MASK 0xffff
#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
#define ACPI_ADR_DP 0x03
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 ADR;
} ACPI_ADR_DEVICE_PATH;
//
// Messaging Device Paths
//
#define MESSAGING_DEVICE_PATH 0x03
#define MSG_ATAPI_DP 0x01
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT8 PrimarySecondary;
UINT8 SlaveMaster;
UINT16 Lun;
} ATAPI_DEVICE_PATH;
#define MSG_SCSI_DP 0x02
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 Pun;
UINT16 Lun;
} SCSI_DEVICE_PATH;
#define MSG_FIBRECHANNEL_DP 0x03
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 Reserved;
UINT64 WWN;
UINT64 Lun;
} FIBRECHANNEL_DEVICE_PATH;
#define MSG_1394_DP 0x04
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 Reserved;
UINT64 Guid;
} F1394_DEVICE_PATH;
#define MSG_USB_DP 0x05
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT8 ParentPortNumber;
UINT8 InterfaceNumber;
} USB_DEVICE_PATH;
#define MSG_USB_CLASS_DP 0x0f
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 VendorId;
UINT16 ProductId;
UINT8 DeviceClass;
UINT8 DeviceSubClass;
UINT8 DeviceProtocol;
} USB_CLASS_DEVICE_PATH;
#define MSG_USB_WWID_DP 0x10
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 InterfaceNumber;
UINT16 VendorId;
UINT16 ProductId;
// CHAR16 SerialNumber[...];
} USB_WWID_DEVICE_PATH;
#define MSG_DEVICE_LOGICAL_UNIT_DP 0x11
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT8 Lun;
} DEVICE_LOGICAL_UNIT_DEVICE_PATH;
#define MSG_SATA_DP 0x12
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 HbaPortNumber;
UINT16 PortMultiplierPort;
UINT16 LogicalUnitNumber;
} SATA_DEVICE_PATH;
#define MSG_I2O_DP 0x06
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 Tid;
} I2O_DEVICE_PATH;
#define MSG_MAC_ADDR_DP 0x0b
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_MAC_ADDRESS MacAddress;
UINT8 IfType;
} MAC_ADDR_DEVICE_PATH;
#define MSG_IPv4_DP 0x0c
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_IPv4_ADDRESS LocalIpAddress;
EFI_IPv4_ADDRESS RemoteIpAddress;
UINT16 LocalPort;
UINT16 RemotePort;
UINT16 Protocol;
BOOLEAN StaticIpAddress;
} IPv4_DEVICE_PATH;
#define MSG_IPv6_DP 0x0d
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_IPv6_ADDRESS LocalIpAddress;
EFI_IPv6_ADDRESS RemoteIpAddress;
UINT16 LocalPort;
UINT16 RemotePort;
UINT16 Protocol;
BOOLEAN StaticIpAddress;
} IPv6_DEVICE_PATH;
#define MSG_INFINIBAND_DP 0x09
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 ResourceFlags;
UINT8 PortGid[16];
UINT64 ServiceId;
UINT64 TargetPortId;
UINT64 DeviceId;
} INFINIBAND_DEVICE_PATH;
#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01
#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02
#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04
#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08
#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10
#define MSG_UART_DP 0x0e
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 Reserved;
UINT64 BaudRate;
UINT8 DataBits;
UINT8 Parity;
UINT8 StopBits;
} UART_DEVICE_PATH;
//
// Use VENDOR_DEVICE_PATH struct
//
#define MSG_VENDOR_DP 0x0a
typedef VENDOR_DEVICE_PATH VENDOR_DEFINED_DEVICE_PATH;
#define DEVICE_PATH_MESSAGING_PC_ANSI EFI_PC_ANSI_GUID
#define DEVICE_PATH_MESSAGING_VT_100 EFI_VT_100_GUID
#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID
#define DEVICE_PATH_MESSAGING_VT_UTF8 EFI_VT_UTF8_GUID
#define DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL EFI_UART_DEVICE_PATH_GUID
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT32 FlowControlMap;
} UART_FLOW_CONTROL_DEVICE_PATH;
#define DEVICE_PATH_MESSAGING_SAS EFI_SAS_DEVICE_PATH_GUID
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT32 Reserved;
UINT64 SasAddress;
UINT64 Lun;
UINT16 DeviceTopology;
UINT16 RelativeTargetPort;
} SAS_DEVICE_PATH;
#define MSG_ISCSI_DP 0x13
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 NetworkProtocol;
UINT16 LoginOption;
UINT16 Reserved;
UINT16 TargetPortalGroupTag;
UINT64 LUN;
// CHAR8 iSCSI Target Name
} ISCSI_DEVICE_PATH;
#define ISCSI_LOGIN_OPTION_NO_HEADER_DIGEST 0x0000
#define ISCSI_LOGIN_OPTION_HEADER_DIGEST_USING_CRC32C 0x0002
#define ISCSI_LOGIN_OPTION_NO_DATA_DIGEST 0x0000
#define ISCSI_LOGIN_OPTION_DATA_DIGEST_USING_CRC32C 0x0008
#define ISCSI_LOGIN_OPTION_AUTHMETHOD_CHAP 0x0000
#define ISCSI_LOGIN_OPTION_AUTHMETHOD_NON 0x1000
#define ISCSI_LOGIN_OPTION_CHAP_BI 0x0000
#define ISCSI_LOGIN_OPTION_CHAP_UNI 0x2000
//
// Media Device Path
//
#define MEDIA_DEVICE_PATH 0x04
#define MEDIA_HARDDRIVE_DP 0x01
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 PartitionNumber;
UINT64 PartitionStart;
UINT64 PartitionSize;
UINT8 Signature[16];
UINT8 MBRType;
UINT8 SignatureType;
} HARDDRIVE_DEVICE_PATH;
#define MBR_TYPE_PCAT 0x01
#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
#define SIGNATURE_TYPE_MBR 0x01
#define SIGNATURE_TYPE_GUID 0x02
#define MEDIA_CDROM_DP 0x02
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 BootEntry;
UINT64 PartitionStart;
UINT64 PartitionSize;
} CDROM_DEVICE_PATH;
//
// Use VENDOR_DEVICE_PATH struct
//
#define MEDIA_VENDOR_DP 0x03
#define MEDIA_FILEPATH_DP 0x04
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
CHAR16 PathName[1];
} FILEPATH_DEVICE_PATH;
#define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)
#define MEDIA_PROTOCOL_DP 0x05
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Protocol;
} MEDIA_PROTOCOL_DEVICE_PATH;
#define MEDIA_PIWG_FW_VOL_DP 0x6
typedef MEDIA_PROTOCOL_DEVICE_PATH MEDIA_FW_VOL_FILEPATH_DEVICE_PATH;
#define MEDIA_PIWG_FW_FILE_DP 0x7
typedef MEDIA_PROTOCOL_DEVICE_PATH MEDIA_FW_VOL_DEVICE_PATH;
//
// BBS Device Path
//
#define BBS_DEVICE_PATH 0x05
#define BBS_BBS_DP 0x01
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 DeviceType;
UINT16 StatusFlag;
CHAR8 String[1];
} BBS_BBS_DEVICE_PATH;
//
// DeviceType definitions - from BBS specification
//
#define BBS_TYPE_FLOPPY 0x01
#define BBS_TYPE_HARDDRIVE 0x02
#define BBS_TYPE_CDROM 0x03
#define BBS_TYPE_PCMCIA 0x04
#define BBS_TYPE_USB 0x05
#define BBS_TYPE_EMBEDDED_NETWORK 0x06
#define BBS_TYPE_BEV 0x80
#define BBS_TYPE_UNKNOWN 0xFF
//
// Union of all possible Device Paths and pointers to Device Paths
//
typedef union {
EFI_DEVICE_PATH_PROTOCOL DevPath;
PCI_DEVICE_PATH Pci;
PCCARD_DEVICE_PATH PcCard;
MEMMAP_DEVICE_PATH MemMap;
VENDOR_DEVICE_PATH Vendor;
CONTROLLER_DEVICE_PATH Controller;
ACPI_HID_DEVICE_PATH Acpi;
ATAPI_DEVICE_PATH Atapi;
SCSI_DEVICE_PATH Scsi;
FIBRECHANNEL_DEVICE_PATH FibreChannel;
F1394_DEVICE_PATH F1394;
USB_DEVICE_PATH Usb;
SATA_DEVICE_PATH Sata;
USB_CLASS_DEVICE_PATH UsbClass;
I2O_DEVICE_PATH I2O;
MAC_ADDR_DEVICE_PATH MacAddr;
IPv4_DEVICE_PATH Ipv4;
IPv6_DEVICE_PATH Ipv6;
INFINIBAND_DEVICE_PATH InfiniBand;
UART_DEVICE_PATH Uart;
HARDDRIVE_DEVICE_PATH HardDrive;
CDROM_DEVICE_PATH CD;
FILEPATH_DEVICE_PATH FilePath;
MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol;
BBS_BBS_DEVICE_PATH Bbs;
} EFI_DEV_PATH;
typedef union {
EFI_DEVICE_PATH_PROTOCOL *DevPath;
PCI_DEVICE_PATH *Pci;
PCCARD_DEVICE_PATH *PcCard;
MEMMAP_DEVICE_PATH *MemMap;
VENDOR_DEVICE_PATH *Vendor;
CONTROLLER_DEVICE_PATH *Controller;
ACPI_HID_DEVICE_PATH *Acpi;
ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi;
ATAPI_DEVICE_PATH *Atapi;
SCSI_DEVICE_PATH *Scsi;
FIBRECHANNEL_DEVICE_PATH *FibreChannel;
F1394_DEVICE_PATH *F1394;
USB_DEVICE_PATH *Usb;
SATA_DEVICE_PATH *Sata;
USB_CLASS_DEVICE_PATH *UsbClass;
I2O_DEVICE_PATH *I2O;
MAC_ADDR_DEVICE_PATH *MacAddr;
IPv4_DEVICE_PATH *Ipv4;
IPv6_DEVICE_PATH *Ipv6;
INFINIBAND_DEVICE_PATH *InfiniBand;
UART_DEVICE_PATH *Uart;
HARDDRIVE_DEVICE_PATH *HardDrive;
CDROM_DEVICE_PATH *CD;
FILEPATH_DEVICE_PATH *FilePath;
MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol;
BBS_BBS_DEVICE_PATH *Bbs;
UINT8 *Raw;
} EFI_DEV_PATH_PTR;
#pragma pack()
#endif

View File

@ -0,0 +1,67 @@
/* @file
EFI Guid Partition Table Format Definition.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: UefiGpt.h
**/
#ifndef __UEFI_GPT_H__
#define __UEFI_GPT_H__
#define PRIMARY_PART_HEADER_LBA 1
//
// EFI Partition Table Signature: "EFI PART"
//
#define EFI_PTAB_HEADER_ID 0x5452415020494645ULL
#pragma pack(1)
//
// GPT Partition Table Header
//
typedef struct {
EFI_TABLE_HEADER Header;
EFI_LBA MyLBA;
EFI_LBA AlternateLBA;
EFI_LBA FirstUsableLBA;
EFI_LBA LastUsableLBA;
EFI_GUID DiskGUID;
EFI_LBA PartitionEntryLBA;
UINT32 NumberOfPartitionEntries;
UINT32 SizeOfPartitionEntry;
UINT32 PartitionEntryArrayCRC32;
} EFI_PARTITION_TABLE_HEADER;
//
// GPT Partition Entry
//
typedef struct {
EFI_GUID PartitionTypeGUID;
EFI_GUID UniquePartitionGUID;
EFI_LBA StartingLBA;
EFI_LBA EndingLBA;
UINT64 Attributes;
CHAR16 PartitionName[36];
} EFI_PARTITION_ENTRY;
//
// GPT Partition Entry Status
//
typedef struct {
BOOLEAN OutOfRange;
BOOLEAN Overlap;
} EFI_PARTITION_ENTRY_STATUS;
#pragma pack()
#endif

View File

@ -0,0 +1,425 @@
/** @file
This file defines the encoding for the VFR (Visual Form Representation) language.
IFR is primarily consumed by the EFI presentation engine, and produced by EFI
internal application and drivers as well as all add-in card option-ROM drivers
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: UefiInternalFormRepresentation.h
@par Revision Reference:
These definitions are from UEFI2.1.
**/
#ifndef __UEFI_INTERNAL_FORMREPRESENTATION_H__
#define __UEFI_INTERNAL_FORMREPRESENTATION_H__
//
// The following types are currently defined:
//
typedef UINT32 RELOFST;
typedef CHAR16 *EFI_STRING;
//
// IFR Op codes
//
#define EFI_IFR_FORM_OP 0x01
#define EFI_IFR_SUBTITLE_OP 0x02
#define EFI_IFR_TEXT_OP 0x03
#define EFI_IFR_GRAPHIC_OP 0x04
#define EFI_IFR_ONE_OF_OP 0x05
#define EFI_IFR_CHECKBOX_OP 0x06
#define EFI_IFR_NUMERIC_OP 0x07
#define EFI_IFR_PASSWORD_OP 0x08
#define EFI_IFR_ONE_OF_OPTION_OP 0x09 // ONEOF OPTION field
#define EFI_IFR_SUPPRESS_IF_OP 0x0A
#define EFI_IFR_END_FORM_OP 0x0B
#define EFI_IFR_HIDDEN_OP 0x0C
#define EFI_IFR_END_FORM_SET_OP 0x0D
#define EFI_IFR_FORM_SET_OP 0x0E
#define EFI_IFR_REF_OP 0x0F
#define EFI_IFR_END_ONE_OF_OP 0x10
#define EFI_IFR_END_OP EFI_IFR_END_ONE_OF_OP
#define EFI_IFR_INCONSISTENT_IF_OP 0x11
#define EFI_IFR_EQ_ID_VAL_OP 0x12
#define EFI_IFR_EQ_ID_ID_OP 0x13
#define EFI_IFR_EQ_ID_LIST_OP 0x14
#define EFI_IFR_AND_OP 0x15
#define EFI_IFR_OR_OP 0x16
#define EFI_IFR_NOT_OP 0x17
#define EFI_IFR_END_IF_OP 0x18 // for endif of inconsistentif, suppressif, grayoutif
#define EFI_IFR_GRAYOUT_IF_OP 0x19
#define EFI_IFR_DATE_OP 0x1A
#define EFI_IFR_TIME_OP 0x1B
#define EFI_IFR_STRING_OP 0x1C
#define EFI_IFR_LABEL_OP 0x1D
#define EFI_IFR_SAVE_DEFAULTS_OP 0x1E
#define EFI_IFR_RESTORE_DEFAULTS_OP 0x1F
#define EFI_IFR_BANNER_OP 0x20
#define EFI_IFR_INVENTORY_OP 0x21
#define EFI_IFR_EQ_VAR_VAL_OP 0x22
#define EFI_IFR_ORDERED_LIST_OP 0x23
#define EFI_IFR_VARSTORE_OP 0x24
#define EFI_IFR_VARSTORE_SELECT_OP 0x25
#define EFI_IFR_VARSTORE_SELECT_PAIR_OP 0x26
#define EFI_IFR_TRUE_OP 0x27
#define EFI_IFR_FALSE_OP 0x28
#define EFI_IFR_GT_OP 0x29
#define EFI_IFR_GE_OP 0x2A
#define EFI_IFR_OEM_DEFINED_OP 0x2B
#define EFI_IFR_LAST_OPCODE EFI_IFR_OEM_DEFINED_OP
#define EFI_IFR_OEM_OP 0xFE
#define EFI_IFR_NV_ACCESS_COMMAND 0xFF
//
// Define values for the flags fields in some VFR opcodes. These are
// bitmasks.
//
#define EFI_IFR_FLAG_DEFAULT 0x01
#define EFI_IFR_FLAG_MANUFACTURING 0x02
#define EFI_IFR_FLAG_INTERACTIVE 0x04
#define EFI_IFR_FLAG_NV_ACCESS 0x08
#define EFI_IFR_FLAG_RESET_REQUIRED 0x10
#define EFI_IFR_FLAG_LATE_CHECK 0x20
#define EFI_NON_DEVICE_CLASS 0x00 // Useful when you do not want something in the Device Manager
#define EFI_DISK_DEVICE_CLASS 0x01
#define EFI_VIDEO_DEVICE_CLASS 0x02
#define EFI_NETWORK_DEVICE_CLASS 0x04
#define EFI_INPUT_DEVICE_CLASS 0x08
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
#define EFI_OTHER_DEVICE_CLASS 0x20
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
#define EFI_FRONT_PAGE_SUBCLASS 0x02
#define EFI_SINGLE_USE_SUBCLASS 0x03 // Used to display a single entity and then exit
//
// Used to flag dynamically created op-codes. This is meaningful to the IFR Library set
// and the browser since we need to distinguish between compiled NV map data and created data.
// We do not allow new entries to be created in the NV map dynamically however we still need
// to display this information correctly. To dynamically create op-codes and assume that their
// data will be saved, ensure that the NV starting location they refer to is pre-defined in the
// NV map.
//
#define EFI_IFR_FLAG_CREATED 128
#pragma pack(1)
//
// IFR Structure definitions
//
typedef struct {
UINT8 OpCode;
UINT8 Length;
} EFI_IFR_OP_HEADER;
typedef struct {
EFI_IFR_OP_HEADER Header;
EFI_GUID Guid;
STRING_REF FormSetTitle;
STRING_REF Help;
EFI_PHYSICAL_ADDRESS CallbackHandle;
UINT16 Class;
UINT16 SubClass;
UINT16 NvDataSize; // set once, size of the NV data as defined in the script
} EFI_IFR_FORM_SET;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 FormId;
STRING_REF FormTitle;
} EFI_IFR_FORM;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 LabelId;
} EFI_IFR_LABEL;
typedef struct {
EFI_IFR_OP_HEADER Header;
STRING_REF SubTitle;
} EFI_IFR_SUBTITLE;
typedef struct {
EFI_IFR_OP_HEADER Header;
STRING_REF Help;
STRING_REF Text;
STRING_REF TextTwo;
UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
UINT16 Key; // Value to be passed to caller to identify this particular op-code
} EFI_IFR_TEXT;
//
// goto
//
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 FormId;
STRING_REF Prompt;
STRING_REF Help; // The string Token for the context-help
UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
UINT16 Key; // Value to be passed to caller to identify this particular op-code
} EFI_IFR_REF;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_END_FORM;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_END_FORM_SET;
//
// Also notice that the IFR_ONE_OF and IFR_CHECK_BOX are identical in structure......code assumes this to be true, if this ever
// changes we need to revisit the InitializeTagStructures code
//
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
UINT8 Width; // The Size of the Data being saved
STRING_REF Prompt; // The String Token for the Prompt
STRING_REF Help; // The string Token for the context-help
} EFI_IFR_ONE_OF;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId; // The offset in NV for storage of the data
UINT8 MaxEntries; // The maximum number of options in the ordered list (=size of NVStore)
STRING_REF Prompt; // The string token for the prompt
STRING_REF Help; // The string token for the context-help
} EFI_IFR_ORDERED_LIST;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
UINT8 Width; // The Size of the Data being saved
STRING_REF Prompt; // The String Token for the Prompt
STRING_REF Help; // The string Token for the context-help
UINT8 Flags; // For now, if non-zero, means that it is the default option, - further definition likely
UINT16 Key; // Value to be passed to caller to identify this particular op-code
} EFI_IFR_CHECKBOX, EFI_IFR_CHECK_BOX;
typedef struct {
EFI_IFR_OP_HEADER Header;
STRING_REF Option; // The string token describing the option
UINT16 Value; // The value associated with this option that is stored in the NVRAM if chosen
UINT8 Flags; // For now, if non-zero, means that it is the default option, - further definition likely above
UINT16 Key; // Value to be passed to caller to identify this particular op-code
} EFI_IFR_ONE_OF_OPTION;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
UINT8 Width; // The Size of the Data being saved
STRING_REF Prompt; // The String Token for the Prompt
STRING_REF Help; // The string Token for the context-help
UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
UINT16 Key; // Value to be passed to caller to identify this particular op-code
UINT16 Minimum;
UINT16 Maximum;
UINT16 Step; // If step is 0, then manual input is specified, otherwise, left/right arrow selection is called for
UINT16 Default;
} EFI_IFR_NUMERIC;
//
// There is an interesting twist with regards to Time and Date. This is one of the few items which can accept input from
// a user, however may or may not need to use storage in the NVRAM space. The decided method for determining if NVRAM space
// will be used (only for a TimeOp or DateOp) is: If .QuestionId == 0 && .Width == 0 (normally an impossibility) then use system
// resources to store the data away and not NV resources. In other words, the setup engine will call gRT->SetTime, and gRT->SetDate
// for the saving of data, and the values displayed will be from the gRT->GetXXXX series of calls.
//
typedef struct {
EFI_IFR_NUMERIC Hour;
EFI_IFR_NUMERIC Minute;
EFI_IFR_NUMERIC Second;
} EFI_IFR_TIME;
typedef struct {
EFI_IFR_NUMERIC Year;
EFI_IFR_NUMERIC Month;
EFI_IFR_NUMERIC Day;
} EFI_IFR_DATE;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
UINT8 Width; // The Size of the Data being saved -- BUGBUG -- remove someday
STRING_REF Prompt; // The String Token for the Prompt
STRING_REF Help; // The string Token for the context-help
UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
UINT16 Key; // Value to be passed to caller to identify this particular op-code
UINT8 MinSize; // Minimum allowable sized password
UINT8 MaxSize; // Maximum allowable sized password
UINT16 Encoding;
} EFI_IFR_PASSWORD;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
UINT8 Width; // The Size of the Data being saved -- BUGBUG -- remove someday
STRING_REF Prompt; // The String Token for the Prompt
STRING_REF Help; // The string Token for the context-help
UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
UINT16 Key; // Value to be passed to caller to identify this particular op-code
UINT8 MinSize; // Minimum allowable sized password
UINT8 MaxSize; // Maximum allowable sized password
} EFI_IFR_STRING;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_END_ONE_OF;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 Value;
UINT16 Key;
} EFI_IFR_HIDDEN;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT8 Flags;
} EFI_IFR_SUPPRESS;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT8 Flags;
} EFI_IFR_GRAY_OUT;
typedef struct {
EFI_IFR_OP_HEADER Header;
STRING_REF Popup;
UINT8 Flags;
} EFI_IFR_INCONSISTENT;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId; // offset into variable storage
UINT8 Width; // size of variable storage
UINT16 Value; // value to compare against
} EFI_IFR_EQ_ID_VAL;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId; // offset into variable storage
UINT8 Width; // size of variable storage
UINT16 ListLength;
UINT16 ValueList[1];
} EFI_IFR_EQ_ID_LIST;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId1; // offset into variable storage for first value to compare
UINT8 Width; // size of variable storage (must be same for both)
UINT16 QuestionId2; // offset into variable storage for second value to compare
} EFI_IFR_EQ_ID_ID;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 VariableId; // offset into variable storage
UINT16 Value; // value to compare against
} EFI_IFR_EQ_VAR_VAL;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_AND;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_OR;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_NOT;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_END_EXPR, EFI_IFR_END_IF;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 FormId;
STRING_REF Prompt;
STRING_REF Help;
UINT8 Flags;
UINT16 Key;
} EFI_IFR_SAVE_DEFAULTS;
typedef struct {
EFI_IFR_OP_HEADER Header;
STRING_REF Help;
STRING_REF Text;
STRING_REF TextTwo; // optional text
} EFI_IFR_INVENTORY;
typedef struct {
EFI_IFR_OP_HEADER Header;
EFI_GUID Guid; // GUID for the variable
UINT16 VarId; // variable store ID, as referenced elsewhere in the form
UINT16 Size; // size of the variable storage
} EFI_IFR_VARSTORE;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 VarId; // variable store ID, as referenced elsewhere in the form
} EFI_IFR_VARSTORE_SELECT;
//
// Used for the ideqid VFR statement where two variable stores may be referenced in the
// same VFR statement.
// A browser should treat this as an EFI_IFR_VARSTORE_SELECT statement and assume that all following
// IFR opcodes use the VarId as defined here.
//
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 VarId; // variable store ID, as referenced elsewhere in the form
UINT16 SecondaryVarId; // variable store ID, as referenced elsewhere in the form
} EFI_IFR_VARSTORE_SELECT_PAIR;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_TRUE;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_FALSE;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_GT;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_GE;
//
// Save defaults and restore defaults have same structure
//
#define EFI_IFR_RESTORE_DEFAULTS EFI_IFR_SAVE_DEFAULTS
typedef struct {
EFI_IFR_OP_HEADER Header;
STRING_REF Title; // The string token for the banner title
UINT16 LineNumber; // 1-based line number
UINT8 Alignment; // left, center, or right-aligned
} EFI_IFR_BANNER;
#define EFI_IFR_BANNER_ALIGN_LEFT 0
#define EFI_IFR_BANNER_ALIGN_CENTER 1
#define EFI_IFR_BANNER_ALIGN_RIGHT 2
#define EFI_IFR_BANNER_TIMEOUT 0xFF
#pragma pack()
#endif

View File

@ -0,0 +1,234 @@
/** @file
This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: UefiMultiPhase.h
**/
#ifndef __UEFI_MULTIPHASE_H__
#define __UEFI_MULTIPHASE_H__
//
// Enumeration of memory types introduced in UEFI.
//
typedef enum {
EfiReservedMemoryType,
EfiLoaderCode,
EfiLoaderData,
EfiBootServicesCode,
EfiBootServicesData,
EfiRuntimeServicesCode,
EfiRuntimeServicesData,
EfiConventionalMemory,
EfiUnusableMemory,
EfiACPIReclaimMemory,
EfiACPIMemoryNVS,
EfiMemoryMappedIO,
EfiMemoryMappedIOPortSpace,
EfiPalCode,
EfiMaxMemoryType
} EFI_MEMORY_TYPE;
//
// Data structure that precedes all of the standard EFI table types.
//
typedef struct {
UINT64 Signature;
UINT32 Revision;
UINT32 HeaderSize;
UINT32 CRC32;
UINT32 Reserved;
} EFI_TABLE_HEADER;
//
// Attributes of variable.
//
#define EFI_VARIABLE_NON_VOLATILE 0x00000001
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008
//
// This attribute is identified by the mnemonic 'HR'
// elsewhere in this specification.
//
#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010
//
// _WIN_CERTIFICATE.wCertificateType
//
#define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0
#define WIN_CERT_TYPE_EFI_GUID 0x0EF1
/**
The WIN_CERTIFICATE structure is part of the PE/COFF
specification and has the following definition:
@param dwLength The length of the entire certificate,
including the length of the header, in
bytes.
@param wRevision The revision level of the WIN_CERTIFICATE
structure. The current revision level is
0x0200.
@param wCertificateType The certificate type. See
WIN_CERT_TYPE_xxx for the UEFI
certificate types. The UEFI
specification reserves the range of
certificate type values from 0x0EF0
to 0x0EFF.
@param bCertificate The actual certificate. The format of
the certificate depends on
wCertificateType. The format of the UEFI
certificates is defined below.
**/
typedef struct _WIN_CERTIFICATE {
UINT32 dwLength;
UINT16 wRevision;
UINT16 wCertificateType;
//UINT8 bCertificate[ANYSIZE_ARRAY];
} WIN_CERTIFICATE;
//
// WIN_CERTIFICATE_UEFI_GUID.CertType
//
#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
{0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }
//
// WIN_CERTIFICATE_UEFI_GUID.CertData
//
typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
UINT32 HashType;
UINT8 PublicKey[256];
UINT8 Signature[256];
} EFI_CERT_BLOCK_RSA_2048_SHA256;
/**
@param Hdr This is the standard WIN_CERTIFICATE header, where
wCertificateType is set to
WIN_CERT_TYPE_UEFI_GUID.
@param CertType This is the unique id which determines the
format of the CertData. In this case, the
value is EFI_CERT_TYPE_RSA2048_SHA256_GUID.
@param CertData This is the certificate data. The format of
the data is determined by the CertType. In
this case the value is
EFI_CERT_BLOCK_RSA_2048_SHA256.
@param Information The WIN_CERTIFICATE_UEFI_GUID certificate
type allows new types of certificates to
be developed for driver authentication
without requiring a new certificate type.
The CertType defines the format of the
CertData, which length is defined by the
size of the certificate less the fixed
size of the WIN_CERTIFICATE_UEFI_GUID
structure.
**/
typedef struct _WIN_CERTIFICATE_UEFI_GUID {
WIN_CERTIFICATE Hdr;
EFI_GUID CertType;
// UINT8 CertData[ANYSIZE_ARRAY];
} WIN_CERTIFICATE_UEFI_GUID;
/**
Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital
signature.
The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from
WIN_CERTIFICATE and encapsulate the information needed to
implement the RSASSA-PKCS1-v1_5 digital signature algorithm as
specified in RFC2437.
@param Hdr This is the standard WIN_CERTIFICATE header, where
wCertificateType is set to
WIN_CERT_TYPE_UEFI_PKCS1_15.
@param HashAlgorithm This is the hashing algorithm which was
performed on the UEFI executable when
creating the digital signature. It is
one of the enumerated values pre-defined
in Section 26.4.1. See
EFI_HASH_ALGORITHM_x.
@param Signature This is the actual digital signature. The
size of the signature is the same size as
the key (1024-bit key is 128 bytes) and can
be determined by subtracting the length of
the other parts of this header from the
total length of the certificate as found in
Hdr.dwLength.
**/
typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {
WIN_CERTIFICATE Hdr;
EFI_GUID HashAlgorithm;
// UINT8 Signature[ANYSIZE_ARRAY];
} WIN_CERTIFICATE_EFI_PKCS1_15;
/**
AuthInfo is a WIN_CERTIFICATE using the wCertificateType
WIN_CERTIFICATE_UEFI_GUID and the CertType
EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies
authenticated access, then the Data buffer should begin with an
authentication descriptor prior to the data payload and DataSize
should reflect the the data.and descriptor size. The caller
shall digest the Monotonic Count value and the associated data
for the variable update using the SHA-256 1-way hash algorithm.
The ensuing the 32-byte digest will be signed using the private
key associated w/ the public/private 2048-bit RSA key-pair. The
WIN_CERTIFICATE shall be used to describe the signature of the
Variable data *Data. In addition, the signature will also
include the MonotonicCount value to guard against replay attacks
@param MonotonicCount Included in the signature of
AuthInfo.Used to ensure freshness/no
replay. Incremented during each
"Write" access.
@param AuthInfo Provides the authorization for the variable
access. It is a signature across the
variable data and the Monotonic Count
value. Caller uses Private key that is
associated with a public key that has been
provisioned via the key exchange.
**/
typedef struct {
UINT64 MonotonicCount;
WIN_CERTIFICATE_UEFI_GUID AuthInfo;
} EFI_VARIABLE_AUTHENTICATION;
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,213 @@
/** @file
Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: ProcessorBind.h
**/
#ifndef __PROCESSOR_BIND_H__
#define __PROCESSOR_BIND_H__
//
// Define the processor type so other code can make processor based choices
//
#define MDE_CPU_X64
//
// Make sure we are useing the correct packing rules per EFI specification
//
#ifndef __GNUC__
#pragma pack()
#endif
#if _MSC_EXTENSIONS
//
// Disable warning that make it impossible to compile at /W4
// This only works for Microsoft* tools
//
//
// Disabling bitfield type checking warnings.
//
#pragma warning ( disable : 4214 )
//
// Disabling the unreferenced formal parameter warnings.
//
#pragma warning ( disable : 4100 )
//
// Disable slightly different base types warning as CHAR8 * can not be set
// to a constant string.
//
#pragma warning ( disable : 4057 )
//
// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
//
#pragma warning ( disable : 4127 )
//
// This warning is caused by functions defined but not used. For precompiled header only.
//
#pragma warning ( disable : 4505 )
//
// This warning is caused by empty (after preprocessing) souce file. For precompiled header only.
//
#pragma warning ( disable : 4206 )
#endif
#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
//
// No ANSI C 2000 stdint.h integer width declarations, so define equivalents
//
#if _MSC_EXTENSIONS
//
// use Microsoft C complier dependent interger width types
//
typedef unsigned __int64 UINT64;
typedef __int64 INT64;
typedef unsigned __int32 UINT32;
typedef __int32 INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef char INT8;
#else
#ifdef _EFI_P64
//
// P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
// are 32-bits
//
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short CHAR16;
typedef unsigned short UINT16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef char INT8;
#else
//
// Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
//
typedef unsigned long UINT64;
typedef long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef char INT8;
#endif
#endif
#define UINT8_MAX 0xff
#else
//
// Use ANSI C 2000 stdint.h integer width declarations
//
#include <stdint.h>
typedef uint8_t BOOLEAN;
typedef int8_t INT8;
typedef uint8_t UINT8;
typedef int16_t INT16;
typedef uint16_t UINT16;
typedef int32_t INT32;
typedef uint32_t UINT32;
typedef int64_t INT64;
typedef uint64_t UINT64;
typedef char CHAR8;
typedef uint16_t CHAR16;
#endif
typedef UINT64 UINTN;
typedef INT64 INTN;
//
// Processor specific defines
//
#define MAX_BIT 0x8000000000000000ULL
#define MAX_2_BITS 0xC000000000000000ULL
//
// Maximum legal X64 address
//
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
//
// The stack alignment required for X64
//
#define CPU_STACK_ALIGNMENT 16
//
// Modifier to ensure that all protocol member functions and EFI intrinsics
// use the correct C calling convention. All protocol member functions and
// EFI intrinsics are required to modify thier member functions with EFIAPI.
//
#if _MSC_EXTENSIONS
///
/// Define the standard calling convention reguardless of optimization level.
/// __cdecl is Microsoft* specific C extension.
///
#define EFIAPI __cdecl
#elif __GNUC__
///
/// Define the standard calling convention reguardless of optimization level.
/// The GCC support assumes a GCC compiler that supports the EFI ABI. The EFI
/// ABI is much closer to the x64 Microsoft* ABI than standard x64 (x86-64)
/// GCC ABI. Thus a standard x64 (x86-64) GCC compiler can not be used for
/// x64. Warning the assembly code in the MDE x64 does not follow the correct
/// ABI for the standard x64 (x86-64) GCC.
///
#define EFIAPI
#else
///
/// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
/// is the standard.
///
#define EFIAPI
#endif
//
// The Microsoft* C compiler can removed references to unreferenced data items
// if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension
//
#if _MSC_EXTENSIONS
#define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
#else
#define GLOBAL_REMOVE_IF_UNREFERENCED
#endif
#endif