david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[efi] Add EFI headers from the EFI Development Kit (edk2)

The intention is to include near-verbatim copies of the EFI headers
required by gPXE.  This is achieved using the import.pl script in
src/include/gpxe/efi.

Note that import.pl will modify any #include lines in each imported
header to reflect its new location within the gPXE tree.  It will also
tidy up the file by removing carriage return characters and trailing
whitespace.
This commit is contained in:
Michael Brown 2008-10-08 02:30:48 +01:00
parent 13d09e6719
commit ac663cf509
25 changed files with 9013 additions and 0 deletions

305
src/include/gpxe/efi/Base.h Normal file
View File

@ -0,0 +1,305 @@
/** @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 - 2008, 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 <gpxe/efi/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) ((INTN) (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_INVALID_LANGUAGE ENCODE_ERROR (32)
#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,58 @@
/** @file
Terminal Device Path Vendor Guid.
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.
@par Revision Reference:
GUIDs defined in UEFI 2.0 spec.
**/
#ifndef __PC_ANSI_H__
#define __PC_ANSI_H__
#define EFI_PC_ANSI_GUID \
{ \
0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
}
#define EFI_VT_100_GUID \
{ \
0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
}
#define EFI_VT_100_PLUS_GUID \
{ \
0x7baec70b, 0x57e0, 0x4c76, {0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43 } \
}
#define EFI_VT_UTF8_GUID \
{ \
0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } \
}
#define EFI_UART_DEVICE_PATH_GUID \
{ \
0x37499a9d, 0x542f, 0x4c89, {0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 } \
}
#define EFI_SAS_DEVICE_PATH_GUID \
{ \
0xd487ddb4, 0x008b, 0x11d9, {0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \
}
extern EFI_GUID gEfiPcAnsiGuid;
extern EFI_GUID gEfiVT100Guid;
extern EFI_GUID gEfiVT100PlusGuid;
extern EFI_GUID gEfiVTUTF8Guid;
extern EFI_GUID gEfiUartDevicePathGuid;
extern EFI_GUID gEfiSasDevicePathGuid;
#endif

View File

@ -0,0 +1,221 @@
/** @file
Processor or Compiler specific defines and types for Ia32 architecture.
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.
**/
#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 __INTEL_COMPILER
//
// Disable ICC's remark #593: "LocalVariable" was set but never used
// This is legal ANSI C code so we disable the remark that is turned on with -Wall
//
#pragma warning ( disable : 593 )
//
// Disable ICC's remark #869: "Parameter" was never referenced warning.
// This is legal ANSI C code so we disable the remark that is turned on with -Wall
//
#pragma warning ( disable : 869 )
//
// Disable ICC's remark #1418: external function definition with no prior declaration.
// This is legal ANSI C code so we disable the remark that is turned on with /W4
//
#pragma warning ( disable : 1418 )
//
// Disable ICC's remark #1419: external declaration in primary source file
// This is legal ANSI C code so we disable the remark that is turned on with /W4
//
#pragma warning ( disable : 1419 )
#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
#else
#if __GNUC__
#define EFIAPI __attribute__((cdecl,regparm(0)))
#endif
#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
//
// For symbol name in GNU assembly code, an extra "_" is necessary
//
#if __GNUC__
#if defined(linux)
#define ASM_PFX(name) name
#else
#define ASM_PFX(name) _##name
#endif
#endif
#define FUNCTION_ENTRY_POINT(p) (p)
#endif

View File

@ -0,0 +1,40 @@
The EFI headers contained herein are copied from the EFI Development
Kit, available from http://www.tianocore.org and published under the
following licence:
BSD License from Intel
Copyright (c) 2004, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the Intel Corporation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
This licence applies only to files that are part of the EFI
Development Kit. Other files may contain their own licence terms, or
may fall under the standard gPXE GPL licence.

View File

@ -0,0 +1,43 @@
/** @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.
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_BOOT_MODE_H__
#define __PI_BOOT_MODE_H__
#include <gpxe/efi/ProcessorBind.h>
///
/// EFI boot mode
///
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,47 @@
/** @file
Present the dependency expression values in PI.
Copyright (c) 2006 - 2008, 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.
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_DEPENDENCY_H__
#define __PI_DEPENDENCY_H__
///
/// If present, this must be the first and only opcode,
/// EFI_DEP_BEFORE is only used by DXE driver.
///
#define EFI_DEP_BEFORE 0x00
///
/// If present, this must be the first and only opcode,
/// EFI_DEP_AFTER is only used by DXE driver.
///
#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,
/// EFI_DEP_SOR is only used by DXE driver.
///
#define EFI_DEP_SOR 0x09
#endif

View File

@ -0,0 +1,642 @@
/** @file
Include file matches things in PI.
Copyright (c) 2006 - 2008, 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.
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_DXECIS_H__
#define __PI_DXECIS_H__
#include <gpxe/efi/Pi/PiMultiPhase.h>
///
/// Global Coherencey Domain types - Memory type
///
typedef enum {
EfiGcdMemoryTypeNonExistent,
EfiGcdMemoryTypeReserved,
EfiGcdMemoryTypeSystemMemory,
EfiGcdMemoryTypeMemoryMappedIo,
EfiGcdMemoryTypeMaximum
} EFI_GCD_MEMORY_TYPE;
///
/// Global Coherencey Domain types - IO type
///
typedef enum {
EfiGcdIoTypeNonExistent,
EfiGcdIoTypeReserved,
EfiGcdIoTypeIo,
EfiGcdIoTypeMaximum
} EFI_GCD_IO_TYPE;
///
/// The type of allocation to perform.
///
typedef enum {
EfiGcdAllocateAnySearchBottomUp,
EfiGcdAllocateMaxAddressSearchBottomUp,
EfiGcdAllocateAddress,
EfiGcdAllocateAnySearchTopDown,
EfiGcdAllocateMaxAddressSearchTopDown,
EfiGcdMaxAllocateType
} EFI_GCD_ALLOCATE_TYPE;
///
/// EFI_GCD_MEMORY_SPACE_DESCRIPTOR
///
typedef struct {
///
/// The physical address of the first byte in the memory region. Type
/// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function
/// description in the UEFI 2.0 specification
///
EFI_PHYSICAL_ADDRESS BaseAddress;
///
/// The number of bytes in the memory region.
///
UINT64 Length;
///
/// The bit mask of attributes that the memory region is capable of supporting. The bit
/// mask of available attributes is defined in the GetMemoryMap() function description
/// in the UEFI 2.0 specification.
///
UINT64 Capabilities;
///
/// The bit mask of attributes that the memory region is currently using. The bit mask of
/// available attributes is defined in GetMemoryMap().
///
UINT64 Attributes;
///
/// Type of the memory region. Type EFI_GCD_MEMORY_TYPE is defined in the
/// AddMemorySpace() function description
///
EFI_GCD_MEMORY_TYPE GcdMemoryType;
///
/// The image handle of the agent that allocated the memory resource described by
/// PhysicalStart and NumberOfBytes. If this field is NULL, then the memory
/// resource is not currently allocated. Type EFI_HANDLE is defined in
/// InstallProtocolInterface() in the UEFI 2.0 specification.
///
EFI_HANDLE ImageHandle;
///
/// The device handle for which the memory resource has been allocated. If
/// ImageHandle is NULL, then the memory resource is not currently allocated. If this
/// field is NULL, then the memory resource is not associated with a device that is
/// described by a device handle. Type EFI_HANDLE is defined in
/// InstallProtocolInterface() in the UEFI 2.0 specification.
///
EFI_HANDLE DeviceHandle;
} EFI_GCD_MEMORY_SPACE_DESCRIPTOR;
///
/// EFI_GCD_IO_SPACE_DESCRIPTOR
///
typedef struct {
///
/// Physical address of the first byte in the I/O region. Type
/// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function
/// description in the UEFI 2.0 specification.
///
EFI_PHYSICAL_ADDRESS BaseAddress;
///
/// Number of bytes in the I/O region.
///
UINT64 Length;
///
/// Type of the I/O region. Type EFI_GCD_IO_TYPE is defined in the
/// AddIoSpace() function description.
///
EFI_GCD_IO_TYPE GcdIoType;
///
/// The image handle of the agent that allocated the I/O resource described by
/// PhysicalStart and NumberOfBytes. If this field is NULL, then the I/O
/// resource is not currently allocated. Type EFI_HANDLE is defined in
/// InstallProtocolInterface() in the UEFI 2.0 specification.
///
EFI_HANDLE ImageHandle;
///
/// The device handle for which the I/O resource has been allocated. If ImageHandle
/// is NULL, then the I/O resource is not currently allocated. If this field is NULL, then
/// the I/O resource is not associated with a device that is described by a device handle.
/// Type EFI_HANDLE is defined in InstallProtocolInterface() in the UEFI
/// 2.0 specification.
///
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 The type of memory resource being added.
@param BaseAddress The physical address that is the start address
of the memory resource being added.
@param Length The size, in bytes, of the memory resource that
is being added.
@param Capabilities The bit mask of attributes that the memory
resource region supports.
@retval EFI_SUCCESS The memory resource was added to the global
coherency domain of the processor.
@retval EFI_INVALID_PARAMETER GcdMemoryType is invalid.
@retval EFI_INVALID_PARAMETER Length is zero.
@retval EFI_OUT_OF_RESOURCES There are not enough system resources to add
the memory resource to the global coherency
domain of the processor.
@retval EFI_UNSUPPORTED The processor does not support one or more bytes
of the memory resource range specified by
BaseAddress and Length.
@retval EFI_ACCESS_DENIED One or more bytes of the memory resource range
specified by BaseAddress and Length conflicts
with a memory resource range that was previously
added to the global coherency domain of the processor.
@retval EFI_ACCESS_DENIED One or more bytes of the memory resource range
specified by BaseAddress and Length was allocated
in a prior call to AllocateMemorySpace()..
**/
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 allocation to perform.
@param GcdMemoryType The type of memory resource being allocated.
@param Alignment The log base 2 of the boundary that BaseAddress must
be aligned on output. Align with 2^Alignment.
@param Length The size in bytes of the memory resource range that
is being allocated.
@param BaseAddress A pointer to a physical address to allocate.
@param Imagehandle The image handle of the agent that is allocating
the memory resource.
@param DeviceHandle The device handle for which the memory resource
is being allocated.
@retval EFI_INVALID_PARAMETER GcdAllocateType is invalid.
@retval EFI_INVALID_PARAMETER GcdMemoryType is invalid.
@retval EFI_INVALID_PARAMETER Length is zero.
@retval EFI_INVALID_PARAMETER BaseAddress is NULL.
@retval EFI_INVALID_PARAMETER ImageHandle is NULL.
@retval EFI_NOT_FOUND The memory resource request could not be satisfied.
No descriptor contains the desired space.
@retval EFI_OUT_OF_RESOURCES There are not enough system resources to allocate the memory
resource from the global coherency domain of the processor.
@retval EFI_SUCCESS The memory resource was allocated from the global coherency
domain of the processor.
**/
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 The physical address that is the start address of the memory resource being freed.
@param Length The size in bytes of the memory resource range that is being freed.
@retval EFI_SUCCESS The memory resource was freed from the global coherency domain of
the processor.
@retval EFI_INVALID_PARAMETER Length is zero.
@retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
resource range specified by BaseAddress and Length.
@retval EFI_NOT_FOUND The memory resource range specified by BaseAddress and
Length was not allocated with previous calls to AllocateMemorySpace().
@retval EFI_OUT_OF_RESOURCES There are not enough system resources to free the memory resource
from the global coherency domain of the processor.
**/
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 The physical address that is the start address of the memory resource being removed.
@param Length The size in bytes of the memory resource that is being removed.
@retval EFI_SUCCESS The memory resource was removed from the global coherency
domain of the processor.
@retval EFI_INVALID_PARAMETER Length is zero.
@retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
resource range specified by BaseAddress and Length.
@retval EFI_NOT_FOUND One or more bytes of the memory resource range specified by
BaseAddress and Length was not added with previous calls to
AddMemorySpace().
@retval EFI_ACCESS_DEFINED One or more bytes of the memory resource range specified by
BaseAddress and Length has been allocated with AllocateMemorySpace().
@retval EFI_OUT_OF_RESOURCES There are not enough system resources to remove the memory
resource from the global coherency domain of the processor.
**/
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 The physical address that is the start address of a memory region.
@param Descriptor A pointer to a caller allocated descriptor.
@retval EFI_SUCCESS The descriptor for the memory resource region containing
BaseAddress was returned in Descriptor.
@retval EFI_INVALID_PARAMETER Descriptor is NULL.
@retval EFI_NOT_FOUND A memory resource range containing BaseAddress was not found.
**/
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 The physical address that is the start address of a memory region.
@param Length The size in bytes of the memory region.
@param Attributes The bit mask of attributes to set for the memory region.
@retval EFI_SUCCESS The attributes were set for the memory region.
@retval EFI_INVALID_PARAMETER Length is zero.
@retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
resource range specified by BaseAddress and Length.
@retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
range specified by BaseAddress and Length.
@retval EFI_ACCESS_DEFINED The attributes for the memory resource range specified by
BaseAddress and Length cannot be modified.
@retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
the memory resource range.
**/
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 A pointer to number of descriptors returned in the MemorySpaceMap buffer.
@param MemorySpaceMap A pointer to the array of EFI_GCD_MEMORY_SPACE_DESCRIPTORs.
@retval EFI_SUCCESS The memory space map was returned in the MemorySpaceMap
buffer, and the number of descriptors in MemorySpaceMap was
returned in NumberOfDescriptors.
@retval EFI_INVALID_PARAMETER NumberOfDescriptors is NULL.
@retval EFI_INVALID_PARAMETER MemorySpaceMap is NULL.
@retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate MemorySpaceMap.
**/
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 The type of I/O resource being added.
@param BaseAddress The physical address that is the start address of the I/O resource being added.
@param Length The size in bytes of the I/O resource that is being added.
@retval EFI_SUCCESS The I/O resource was added to the global coherency domain of
the processor.
@retval EFI_INVALID_PARAMETER GcdIoType is invalid.
@retval EFI_INVALID_PARAMETER Length is zero.
@retval EFI_OUT_OF_RESOURCES There are not enough system resources to add the I/O resource to
the global coherency domain of the processor.
@retval EFI_UNSUPPORTED The processor does not support one or more bytes of the I/O
resource range specified by BaseAddress and Length.
@retval EFI_ACCESS_DENIED One or more bytes of the I/O resource range specified by
BaseAddress and Length conflicts with an I/O resource
range that was previously added to the global coherency domain
of the processor.
@retval EFI_ACCESS_DENIED One or more bytes of the I/O resource range specified by
BaseAddress and Length was allocated in a prior call to
AllocateIoSpace().
**/
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 allocation to perform.
@param GcdIoType The type of I/O resource being allocated.
@param Alignment The log base 2 of the boundary that BaseAddress must be aligned on output.
@param Length The size in bytes of the I/O resource range that is being allocated.
@param BaseAddress A pointer to a physical address.
@param Imagehandle The image handle of the agent that is allocating the I/O resource.
@param DeviceHandle The device handle for which the I/O resource is being allocated.
@retval EFI_SUCCESS The I/O resource was allocated from the global coherency domain
of the processor.
@retval EFI_INVALID_PARAMETER GcdAllocateType is invalid.
@retval EFI_INVALID_PARAMETER GcdIoType is invalid.
@retval EFI_INVALID_PARAMETER Length is zero.
@retval EFI_INVALID_PARAMETER BaseAddress is NULL.
@retval EFI_INVALID_PARAMETER ImageHandle is NULL.
@retval EFI_OUT_OF_RESOURCES There are not enough system resources to allocate the I/O
resource from the global coherency domain of the processor.
@retval EFI_NOT_FOUND The I/O resource request could not be satisfied.
**/
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 The physical address that is the start address of the I/O resource being freed.
@param Length The size in bytes of the I/O resource range that is being freed.
@retval EFI_SUCCESS The I/O resource was freed from the global coherency domain of the
processor.
@retval EFI_INVALID_PARAMETER Length is zero.
@retval EFI_UNSUPPORTED The processor does not support one or more bytes of the I/O resource
range specified by BaseAddress and Length.
@retval EFI_NOT_FOUND The I/O resource range specified by BaseAddress and Length
was not allocated with previous calls to AllocateIoSpace().
@retval EFI_OUT_OF_RESOURCES There are not enough system resources to free the I/O resource from
the global coherency domain of the processor.
**/
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 A pointer to a physical address that is the start address of the I/O resource being
removed.
@param Length The size in bytes of the I/O resource that is being removed.
@retval EFI_SUCCESS The I/O resource was removed from the global coherency domain
of the processor.
@retval EFI_INVALID_PARAMETER Length is zero.
@retval EFI_UNSUPPORTED The processor does not support one or more bytes of the I/O
resource range specified by BaseAddress and Length.
@retval EFI_NOT_FOUND One or more bytes of the I/O resource range specified by
BaseAddress and Length was not added with previous
calls to AddIoSpace().
@retval EFI_ACCESS_DENIED One or more bytes of the I/O resource range specified by
BaseAddress and Length has been allocated with
AllocateIoSpace().
@retval EFI_OUT_OF_RESOURCES There are not enough system resources to remove the I/O
resource from the global coherency domain of the processor.
**/
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 The physical address that is the start address of an I/O region.
@param Descriptor A pointer to a caller allocated descriptor.
@retval EFI_SUCCESS The descriptor for the I/O resource region containing
BaseAddress was returned in Descriptor.
@retval EFI_INVALID_PARAMETER Descriptor is NULL.
@retval EFI_NOT_FOUND An I/O resource range containing BaseAddress was not found.
**/
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 A pointer to number of descriptors returned in the IoSpaceMap buffer.
@param MemorySpaceMap A pointer to the array of EFI_GCD_IO_SPACE_DESCRIPTORs.
@retval EFI_SUCCESS The I/O space map was returned in the IoSpaceMap buffer, and
the number of descriptors in IoSpaceMap was returned in
NumberOfDescriptors.
@retval EFI_INVALID_PARAMETER NumberOfDescriptors is NULL.
@retval EFI_INVALID_PARAMETER IoSpaceMap is NULL.
@retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate IoSpaceMap.
**/
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.
The Dispatch() function searches for DXE drivers in firmware volumes that have been
installed since the last time the Dispatch() service was called. It then evaluates
the dependency expressions of all the DXE drivers and loads and executes those DXE
drivers whose dependency expression evaluate to TRUE. This service must interact with
the Security Architectural Protocol to authenticate DXE drivers before they are executed.
This process is continued until no more DXE drivers can be executed.
@retval EFI_SUCCESS One or more DXE driver were dispatched.
@retval EFI_NOT_FOUND No DXE drivers were dispatched.
@retval EFI_ALREADY_STARTED An attempt is being made to start the DXE Dispatcher recursively.
Thus no action was taken.
**/
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 FileName A pointer to the name of the file in a firmware volume.
@retval EFI_SUCCESS The DXE driver was found and its SOR bit was cleared.
@retval EFI_NOT_FOUND The DXE driver does not exist, or the DXE driver exists and its SOR
bit is not set.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCHEDULE)(
IN EFI_HANDLE FirmwareVolumeHandle,
IN CONST EFI_GUID *FileName
);
/**
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 of promoting FFS from untrusted to trusted
state.
@retval EFI_NOT_FOUND The file was not found in the untrusted state.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_TRUST)(
IN EFI_HANDLE FirmwareVolumeHandle,
IN CONST EFI_GUID *FileName
);
/**
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.
@retval EFI_SUCCESS The EFI_FIRMWARE_VOLUME_PROTOCOL and
EFI_DEVICE_PATH_PROTOCOL were installed onto
FirmwareVolumeHandle for the firmware volume described
by FirmwareVolumeHeader and Size.
@retval EFI_VOLUME_CORRUPTED The firmware volume described by FirmwareVolumeHeader
and Size is corrupted.
@retval EFI_OUT_OF_RESOURCES There are not enough system resources available to produce the
EFI_FIRMWARE_VOLUME_PROTOCOL and EFI_DEVICE_PATH_PROTOCOL
for the firmware volume described by FirmwareVolumeHeader and Size.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PROCESS_FIRMWARE_VOLUME)(
IN CONST VOID *FirmwareVolumeHeader,
IN UINTN Size,
OUT EFI_HANDLE *FirmwareVolumeHandle
);
//
// DXE Services Table
//
#define DXE_SERVICES_SIGNATURE 0x565245535f455844ULL
#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,242 @@
/** @file
The firmware file related definitions in PI.
Copyright (c) 2006 - 2008, 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.
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_FIRMWARE_FILE_H__
#define __PI_FIRMWARE_FILE_H__
#include <gpxe/efi/ProcessorBind.h>
#pragma pack(1)
///
/// 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;
///
/// File Types Definitions
///
#define EFI_FV_FILETYPE_ALL 0x00
#define EFI_FV_FILETYPE_RAW 0x01
#define EFI_FV_FILETYPE_FREEFORM 0x02
#define EFI_FV_FILETYPE_SECURITY_CORE 0x03
#define EFI_FV_FILETYPE_PEI_CORE 0x04
#define EFI_FV_FILETYPE_DXE_CORE 0x05
#define EFI_FV_FILETYPE_PEIM 0x06
#define EFI_FV_FILETYPE_DRIVER 0x07
#define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08
#define EFI_FV_FILETYPE_APPLICATION 0x09
#define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B
#define EFI_FV_FILETYPE_OEM_MIN 0xc0
#define EFI_FV_FILETYPE_OEM_MAX 0xdf
#define EFI_FV_FILETYPE_DEBUG_MIN 0xe0
#define EFI_FV_FILETYPE_DEBUG_MAX 0xef
#define EFI_FV_FILETYPE_FFS_MIN 0xf0
#define EFI_FV_FILETYPE_FFS_MAX 0xff
#define EFI_FV_FILETYPE_FFS_PAD 0xf0
///
/// 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
///
/// Common section header
///
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;
///
/// Array of unicode string.
///
CHAR16 VersionString[1];
} EFI_VERSION_SECTION;
#define SECTION_SIZE(SectionHeaderPtr) \
((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))
#pragma pack()
#endif

View File

@ -0,0 +1,154 @@
/** @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.
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_FIRMWAREVOLUME_H__
#define __PI_FIRMWAREVOLUME_H__
#include <gpxe/efi/ProcessorBind.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
///
/// type of EFI FVB attribute
///
typedef UINT32 EFI_FVB_ATTRIBUTES_2;
//
// 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_2 Attributes;
UINT16 HeaderLength;
UINT16 Checksum;
UINT16 ExtHeaderOffset;
UINT8 Reserved[1];
UINT8 Revision;
EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];
} EFI_FIRMWARE_VOLUME_HEADER;
#define EFI_FVH_SIGNATURE EFI_SIGNATURE_32 ('_', 'F', 'V', 'H')
///
/// Firmware Volume Header Revision definition
///
#define EFI_FVH_REVISION 0x02
///
/// Extension header pointed by ExtHeaderOffset of volume header.
///
typedef struct {
EFI_GUID FvName;
UINT32 ExtHeaderSize;
} EFI_FIRMWARE_VOLUME_EXT_HEADER;
///
/// Entry struture for describing FV extension header
///
typedef struct {
UINT16 ExtEntrySize;
UINT16 ExtEntryType;
} EFI_FIRMWARE_VOLUME_EXT_ENTRY;
#define EFI_FV_EXT_TYPE_OEM_TYPE 0x01
///
/// This extension header provides a mapping between a GUID and an OEM file type.
///
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

View File

@ -0,0 +1,293 @@
/** @file
HOB related definitions in PI.
Copyright (c) 2006 - 2008, 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.
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_HOB_H__
#define __PI_HOB_H__
#include <gpxe/efi/ProcessorBind.h>
#include <gpxe/efi/Pi/PiBootMode.h>
#include <gpxe/efi/Uefi/UefiBaseType.h>
#include <gpxe/efi/Uefi/UefiMultiPhase.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 {
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_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;
///
/// EFI_HOB_MEMORY_ALLOCATION_HEADER describes the
/// various attributes of the logical memory allocation. The type field will be used for
/// subsequent inclusion in the UEFI memory map.
///
typedef struct {
///
/// A GUID that defines the memory allocation region¡¯s type and purpose, as well as
/// other fields within the memory allocation HOB. This GUID is used to define the
/// additional data within the HOB that may be present for the memory allocation HOB.
/// Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0
/// specification.
///
EFI_GUID Name;
/// The base address of memory allocated by this HOB. Type
/// EFI_PHYSICAL_ADDRESS is defined in AllocatePages() in the UEFI 2.0
/// specification.
EFI_PHYSICAL_ADDRESS MemoryBaseAddress;
///
/// The length in bytes of memory allocated by this HOB.
///
UINT64 MemoryLength;
///
/// Defines the type of memory allocated by this HOB. The memory type definition
/// follows the EFI_MEMORY_TYPE definition. Type EFI_MEMORY_TYPE is defined
/// in AllocatePages() in the UEFI 2.0 specification.
///
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_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_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_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;
///
/// type of Recount type
///
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
///
/// type of recount attribute type
///
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_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_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_GENERIC_HEADER Header;
UINT8 SizeOfMemorySpace;
UINT8 SizeOfIoSpace;
UINT8 Reserved[6];
} EFI_HOB_CPU;
///
/// Describes pool memory allocations.
///
typedef struct {
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_FIRMWARE_VOLUME2 *FirmwareVolume2;
EFI_HOB_CPU *Cpu;
EFI_HOB_MEMORY_POOL *Pool;
UINT8 *Raw;
} EFI_PEI_HOB_POINTERS;
#endif

View File

@ -0,0 +1,104 @@
/** @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.
@par Revision Reference:
Version 1.0.
**/
#ifndef __PI_MULTIPHASE_H__
#define __PI_MULTIPHASE_H__
#include <gpxe/efi/Uefi/UefiMultiPhase.h>
#include <gpxe/efi/Pi/PiFirmwareVolume.h>
#include <gpxe/efi/Pi/PiFirmwareFile.h>
#include <gpxe/efi/Pi/PiBootMode.h>
#include <gpxe/efi/Pi/PiHob.h>
#include <gpxe/efi/Pi/PiDependency.h>
#define EFI_NOT_AVAILABLE_YET EFIERR (32)
///
/// 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;
//
// Bit values for AuthenticationStatus
//
#define EFI_AUTH_STATUS_PLATFORM_OVERRIDE 0x01
#define EFI_AUTH_STATUS_IMAGE_SIGNED 0x02
#define EFI_AUTH_STATUS_NOT_TESTED 0x04
#define EFI_AUTH_STATUS_TEST_FAILED 0x08
#define EFI_AUTH_STATUS_ALL 0x0f
#endif

View File

@ -0,0 +1,25 @@
/** @file
Root include file for Mde Package DXE_CORE, DXE, SMM, SAL type 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 <gpxe/efi/Uefi/UefiBaseType.h>
#include <gpxe/efi/Uefi/UefiSpec.h>
#include <gpxe/efi/Pi/PiDxeCis.h>
#endif

View File

@ -0,0 +1,10 @@
/*
* EFI header files rely on having the CPU architecture directory
* present in the search path in order to pick up ProcessorBind.h. We
* use this header file as a quick indirection layer.
* - mcb30
*/
#if __i386__
#include <gpxe/efi/Ia32/ProcessorBind.h>
#endif

View File

@ -0,0 +1,560 @@
/** @file
The device path protocol as defined in UEFI 2.0.
The device path represents a programatic path to a device. It's the view
from a software point of view. It also must persist from boot to boot, so
it can not contain things like PCI bus numbers that change from boot to boot.
Copyright (c) 2006 - 2008, 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 __EFI_DEVICE_PATH_PROTOCOL_H__
#define __EFI_DEVICE_PATH_PROTOCOL_H__
#include <gpxe/efi/Guid/PcAnsi.h>
///
/// Device Path protocol
///
#define EFI_DEVICE_PATH_PROTOCOL_GUID \
{ \
0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
}
//
// Protocol GUID defined in EFI1.1.
//
///
/// Device Path information
///
#define DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH_PROTOCOL_GUID
#pragma pack(1)
typedef struct {
UINT8 Type;
UINT8 SubType;
UINT8 Length[2];
} EFI_DEVICE_PATH_PROTOCOL;
///
/// For backward-compatible with EFI1.1.
///
typedef EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH;
///
/// 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;
#define ACPI_ADR_DISPLAY_TYPE_OTHER 0
#define ACPI_ADR_DISPLAY_TYPE_VGA 1
#define ACPI_ADR_DISPLAY_TYPE_TV 2
#define ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DIGITAL 3
#define ACPI_ADR_DISPLAY_TYPE_INTERNAL_DIGITAL 4
#define ACPI_DISPLAY_ADR(_DeviceIdScheme, _HeadId, _NonVgaOutput, _BiosCanDetect, _VendorInfo, _Type, _Port, _Index) \
((UINT32)( (((_DeviceIdScheme) & 0x1) << 31) | \
(((_HeadId) & 0x7) << 18) | \
(((_NonVgaOutput) & 0x1) << 17) | \
(((_BiosCanDetect) & 0x1) << 16) | \
(((_VendorInfo) & 0xf) << 12) | \
(((_Type) & 0xf) << 8) | \
(((_Port) & 0xf) << 4) | \
((_Index) & 0xf) ))
///
/// 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 PortMultiplierPortNumber;
UINT16 Lun;
} 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;
UINT64 Lun;
UINT16 TargetPortalGroupTag;
// 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 0x7
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID FvName;
} MEDIA_FW_VOL_DEVICE_PATH;
#define MEDIA_PIWG_FW_FILE_DP 0x6
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID FvFileName;
} MEDIA_FW_VOL_FILEPATH_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;
ISCSI_DEVICE_PATH Iscsi;
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()
#define EFI_DP_TYPE_MASK 0x7F
#define EFI_DP_TYPE_UNPACKED 0x80
#define END_DEVICE_PATH_TYPE 0x7f
#define EFI_END_ENTIRE_DEVICE_PATH 0xff
#define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
#define EFI_END_INSTANCE_DEVICE_PATH 0x01
#define END_ENTIRE_DEVICE_PATH_SUBTYPE EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE
#define END_INSTANCE_DEVICE_PATH_SUBTYPE EFI_END_INSTANCE_DEVICE_PATH
#define EFI_END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL))
#define END_DEVICE_PATH_LENGTH EFI_END_DEVICE_PATH_LENGTH
#define DP_IS_END_TYPE(a)
#define DP_IS_END_SUBTYPE(a) (((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)
#define DevicePathSubType(a) ((a)->SubType)
#define IsDevicePathUnpacked(a) ((a)->Type & EFI_DP_TYPE_UNPACKED)
#define EfiDevicePathNodeLength(a) (((a)->Length[0]) | ((a)->Length[1] << 8))
#define DevicePathNodeLength(a) (EfiDevicePathNodeLength(a))
#define EfiNextDevicePathNode(a) ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a)))
#define NextDevicePathNode(a) (EfiNextDevicePathNode(a))
#define EfiDevicePathType(a) (((a)->Type) & EFI_DP_TYPE_MASK)
#define DevicePathType(a) (EfiDevicePathType(a))
#define EfiIsDevicePathEndType(a) (EfiDevicePathType (a) == END_DEVICE_PATH_TYPE)
#define IsDevicePathEndType(a) (EfiIsDevicePathEndType(a))
#define EfiIsDevicePathEndSubType(a) ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)
#define IsDevicePathEndSubType(a) (EfiIsDevicePathEndSubType(a))
#define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH)
#define EfiIsDevicePathEnd(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a))
#define IsDevicePathEnd(a) (EfiIsDevicePathEnd(a))
#define EfiIsDevicePathEndInstance(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a))
#define SetDevicePathNodeLength(a,l) { \
(a)->Length[0] = (UINT8) (l); \
(a)->Length[1] = (UINT8) ((l) >> 8); \
}
#define SetDevicePathEndNode(a) { \
(a)->Type = END_DEVICE_PATH_TYPE; \
(a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
(a)->Length[0] = sizeof(EFI_DEVICE_PATH_PROTOCOL); \
(a)->Length[1] = 0; \
}
extern EFI_GUID gEfiDevicePathProtocolGuid;
#endif

View File

@ -0,0 +1,145 @@
/** @file
Simple Text In protocol from the UEFI 2.0 specification.
Abstraction of a very simple input device like a keyboard or serial
terminal.
Copyright (c) 2006 - 2008, 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 __SIMPLE_TEXT_IN_PROTOCOL_H__
#define __SIMPLE_TEXT_IN_PROTOCOL_H__
#include <gpxe/efi/ProcessorBind.h>
#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
{ \
0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
}
///
/// Protocol GUID defined in EFI1.1.
///
#define SIMPLE_INPUT_PROTOCOL EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID
typedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
///
/// Backward-compatible with EFI1.1.
///
typedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL SIMPLE_INPUT_INTERFACE;
//
// Data structures
//
typedef struct {
UINT16 ScanCode;
CHAR16 UnicodeChar;
} EFI_INPUT_KEY;
//
// Required unicode control chars
//
#define CHAR_NULL 0x0000
#define CHAR_BACKSPACE 0x0008
#define CHAR_TAB 0x0009
#define CHAR_LINEFEED 0x000A
#define CHAR_CARRIAGE_RETURN 0x000D
//
// EFI Scan codes
//
#define SCAN_NULL 0x0000
#define SCAN_UP 0x0001
#define SCAN_DOWN 0x0002
#define SCAN_RIGHT 0x0003
#define SCAN_LEFT 0x0004
#define SCAN_HOME 0x0005
#define SCAN_END 0x0006
#define SCAN_INSERT 0x0007
#define SCAN_DELETE 0x0008
#define SCAN_PAGE_UP 0x0009
#define SCAN_PAGE_DOWN 0x000A
#define SCAN_F1 0x000B
#define SCAN_F2 0x000C
#define SCAN_F3 0x000D
#define SCAN_F4 0x000E
#define SCAN_F5 0x000F
#define SCAN_F6 0x0010
#define SCAN_F7 0x0011
#define SCAN_F8 0x0012
#define SCAN_F9 0x0013
#define SCAN_F10 0x0014
#define SCAN_F11 0x0015
#define SCAN_F12 0x0016
#define SCAN_ESC 0x0017
/**
Reset the input device and optionaly run diagnostics
@param This Protocol instance pointer.
@param ExtendedVerification Driver may perform diagnostics on reset.
@retval EFI_SUCCESS The device was reset.
@retval EFI_DEVICE_ERROR The device is not functioning properly and could not be reset.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_INPUT_RESET)(
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
/**
Reads the next keystroke from the input device. The WaitForKey Event can
be used to test for existance of a keystroke via WaitForEvent () call.
@param This Protocol instance pointer.
@param Key Driver may perform diagnostics on reset.
@retval EFI_SUCCESS The keystroke information was returned.
@retval EFI_NOT_READY There was no keystroke data availiable.
@retval EFI_DEVICE_ERROR The keydtroke information was not returned due to
hardware errors.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_INPUT_READ_KEY)(
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
OUT EFI_INPUT_KEY *Key
);
/**
@par Protocol Description:
The EFI_SIMPLE_TEXT_INPUT_PROTOCOL is used on the ConsoleIn device.
It is the minimum required protocol for ConsoleIn.
@param Reset
Reset the ConsoleIn device.
@param ReadKeyStroke
Returns the next input character.
@param WaitForKey
Event to use with WaitForEvent() to wait for a key to be available.
**/
struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL {
EFI_INPUT_RESET Reset;
EFI_INPUT_READ_KEY ReadKeyStroke;
EFI_EVENT WaitForKey;
};
extern EFI_GUID gEfiSimpleTextInProtocolGuid;
#endif

View File

@ -0,0 +1,437 @@
/** @file
Simple Text Out protocol from the UEFI 2.0 specification.
Abstraction of a very simple text based output device like VGA text mode or
a serial terminal. The Simple Text Out protocol instance can represent
a single hardware device or a virtual device that is an agregation
of multiple physical devices.
Copyright (c) 2006 - 2008, 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 __SIMPLE_TEXT_OUT_H__
#define __SIMPLE_TEXT_OUT_H__
#include <gpxe/efi/PiDxe.h>
#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
{ \
0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
}
///
/// Protocol GUID defined in EFI1.1.
///
#define SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID
typedef struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
///
/// Backward-compatible with EFI1.1.
///
typedef EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SIMPLE_TEXT_OUTPUT_INTERFACE;
//
// Define's for required EFI Unicode Box Draw characters
//
#define BOXDRAW_HORIZONTAL 0x2500
#define BOXDRAW_VERTICAL 0x2502
#define BOXDRAW_DOWN_RIGHT 0x250c
#define BOXDRAW_DOWN_LEFT 0x2510
#define BOXDRAW_UP_RIGHT 0x2514
#define BOXDRAW_UP_LEFT 0x2518
#define BOXDRAW_VERTICAL_RIGHT 0x251c
#define BOXDRAW_VERTICAL_LEFT 0x2524
#define BOXDRAW_DOWN_HORIZONTAL 0x252c
#define BOXDRAW_UP_HORIZONTAL 0x2534
#define BOXDRAW_VERTICAL_HORIZONTAL 0x253c
#define BOXDRAW_DOUBLE_HORIZONTAL 0x2550
#define BOXDRAW_DOUBLE_VERTICAL 0x2551
#define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552
#define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553
#define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554
#define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555
#define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556
#define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557
#define BOXDRAW_UP_RIGHT_DOUBLE 0x2558
#define BOXDRAW_UP_DOUBLE_RIGHT 0x2559
#define BOXDRAW_DOUBLE_UP_RIGHT 0x255a
#define BOXDRAW_UP_LEFT_DOUBLE 0x255b
#define BOXDRAW_UP_DOUBLE_LEFT 0x255c
#define BOXDRAW_DOUBLE_UP_LEFT 0x255d
#define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e
#define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f
#define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560
#define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561
#define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562
#define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563
#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564
#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565
#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566
#define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567
#define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568
#define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569
#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a
#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b
#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c
//
// EFI Required Block Elements Code Chart
//
#define BLOCKELEMENT_FULL_BLOCK 0x2588
#define BLOCKELEMENT_LIGHT_SHADE 0x2591
//
// EFI Required Geometric Shapes Code Chart
//
#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2
#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba
#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc
#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4
//
// EFI Required Arrow shapes
//
#define ARROW_LEFT 0x2190
#define ARROW_UP 0x2191
#define ARROW_RIGHT 0x2192
#define ARROW_DOWN 0x2193
//
// EFI Console Colours
//
#define EFI_BLACK 0x00
#define EFI_BLUE 0x01
#define EFI_GREEN 0x02
#define EFI_CYAN (EFI_BLUE | EFI_GREEN)
#define EFI_RED 0x04
#define EFI_MAGENTA (EFI_BLUE | EFI_RED)
#define EFI_BROWN (EFI_GREEN | EFI_RED)
#define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED)
#define EFI_BRIGHT 0x08
#define EFI_DARKGRAY (EFI_BRIGHT)
#define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT)
#define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT)
#define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT)
#define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT)
#define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT)
#define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT)
#define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)
#define EFI_TEXT_ATTR(f, b) ((f) | ((b) << 4))
#define EFI_BACKGROUND_BLACK 0x00
#define EFI_BACKGROUND_BLUE 0x10
#define EFI_BACKGROUND_GREEN 0x20
#define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)
#define EFI_BACKGROUND_RED 0x40
#define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)
#define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
#define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
//
// We currently define attributes from 0 - 7F for color manipulations
// To internally handle the local display characteristics for a particular character, we are defining
// Bit 7 to signify the local glyph representation for a character. If turned on, glyphs will be
// pulled from the wide glyph database and will display locally as a wide character (16 X 19 versus 8 X 19)
// If bit 7 is off, the narrow glyph database will be used. This does NOT affect information that is sent to
// non-local displays (e.g. serial or LAN consoles).
//
#define EFI_WIDE_ATTRIBUTE 0x80
/**
Reset the text output device hardware and optionaly run diagnostics
@param This Protocol instance pointer.
@param ExtendedVerification Driver may perform more exhaustive verfication
operation of the device during reset.
@retval EFI_SUCCESS The text output device was reset.
@retval EFI_DEVICE_ERROR The text output device is not functioning correctly and
could not be reset.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_RESET)(
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
/**
Write a Unicode string to the output device.
@param This Protocol instance pointer.
@param String The NULL-terminated Unicode string to be displayed on the output
device(s). All output devices must also support the Unicode
drawing defined in this file.
@retval EFI_SUCCESS The string was output to the device.
@retval EFI_DEVICE_ERROR The device reported an error while attempting to output
the text.
@retval EFI_UNSUPPORTED The output device's mode is not currently in a
defined text mode.
@retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the
characters in the Unicode string could not be
rendered and were skipped.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_STRING)(
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN CHAR16 *String
);
/**
Verifies that all characters in a Unicode string can be output to the
target device.
@param This Protocol instance pointer.
@param String The NULL-terminated Unicode string to be examined for the output
device(s).
@retval EFI_SUCCESS The device(s) are capable of rendering the output string.
@retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be
rendered by one or more of the output devices mapped
by the EFI handle.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_TEST_STRING)(
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN CHAR16 *String
);
/**
Returns information for an available text mode that the output device(s)
supports.
@param This Protocol instance pointer.
@param ModeNumber The mode number to return information on.
@param Columns Returns the geometry of the text output device for the
requested ModeNumber.
@param Rows Returns the geometry of the text output device for the
requested ModeNumber.
@retval EFI_SUCCESS The requested mode information was returned.
@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
@retval EFI_UNSUPPORTED The mode number was not valid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_QUERY_MODE)(
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN ModeNumber,
OUT UINTN *Columns,
OUT UINTN *Rows
);
/**
Sets the output device(s) to a specified mode.
@param This Protocol instance pointer.
@param ModeNumber The mode number to set.
@retval EFI_SUCCESS The requested text mode was set.
@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
@retval EFI_UNSUPPORTED The mode number was not valid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_SET_MODE)(
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN ModeNumber
);
/**
Sets the background and foreground colors for the OutputString () and
ClearScreen () functions.
@param This Protocol instance pointer.
@param Attribute The attribute to set. Bits 0..3 are the foreground color, and
bits 4..6 are the background color. All other bits are undefined
and must be zero. The valid Attributes are defined in this file.
@retval EFI_SUCCESS The attribute was set.
@retval EFI_DEVICE_ ERROR The device had an error and could not complete the request.
@retval EFI_UNSUPPORTED The attribute requested is not defined.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_SET_ATTRIBUTE)(
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN Attribute
);
/**
Clears the output device(s) display to the currently selected background
color.
@param This Protocol instance pointer.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
@retval EFI_UNSUPPORTED The output device is not in a valid text mode.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_CLEAR_SCREEN)(
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
);
/**
Sets the current coordinates of the cursor position
@param This Protocol instance pointer.
@param Column The position to set the cursor to. Must be greater than or
equal to zero and less than the number of columns and rows
by QueryMode ().
@param Row The position to set the cursor to. Must be greater than or
equal to zero and less than the number of columns and rows
by QueryMode ().
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
@retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the
cursor position is invalid for the current mode.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION)(
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN Column,
IN UINTN Row
);
/**
Makes the cursor visible or invisible
@param This Protocol instance pointer.
@param Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is
set to be invisible.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_DEVICE_ERROR The device had an error and could not complete the
request, or the device does not support changing
the cursor mode.
@retval EFI_UNSUPPORTED The output device is not in a valid text mode.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_ENABLE_CURSOR)(
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN BOOLEAN Visible
);
/**
@par Data Structure Description:
Mode Structure pointed to by Simple Text Out protocol.
@param MaxMode
The number of modes supported by QueryMode () and SetMode ().
@param Mode
The text mode of the output device(s).
@param Attribute
The current character output attribute
@param CursorColumn
The cursor's column.
@param CursorRow
The cursor's row.
@param CursorVisible
The cursor is currently visbile or not.
**/
typedef struct {
INT32 MaxMode;
//
// current settings
//
INT32 Mode;
INT32 Attribute;
INT32 CursorColumn;
INT32 CursorRow;
BOOLEAN CursorVisible;
} EFI_SIMPLE_TEXT_OUTPUT_MODE;
/**
@par Protocol Description:
The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.
It is the minimum required protocol for any handle supplied as the ConsoleOut
or StandardError device. In addition, the minimum supported text mode of such
devices is at least 80 x 25 characters.
@param Reset
Reset the ConsoleOut device.
@param OutputString
Displays the Unicode string on the device at the current cursor location.
@param TestString
Tests to see if the ConsoleOut device supports this Unicode string.
@param QueryMode
Queries information concerning the output device's supported text mode.
@param SetMode
Sets the current mode of the output device.
@param SetAttribute
Sets the foreground and background color of the text that is output.
@param ClearScreen
Clears the screen with the currently set background color.
@param SetCursorPosition
Sets the current cursor position.
@param EnableCursor
Turns the visibility of the cursor on/off.
@param Mode
Pointer to SIMPLE_TEXT_OUTPUT_MODE data.
**/
struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
EFI_TEXT_RESET Reset;
EFI_TEXT_STRING OutputString;
EFI_TEXT_TEST_STRING TestString;
EFI_TEXT_QUERY_MODE QueryMode;
EFI_TEXT_SET_MODE SetMode;
EFI_TEXT_SET_ATTRIBUTE SetAttribute;
EFI_TEXT_CLEAR_SCREEN ClearScreen;
EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;
EFI_TEXT_ENABLE_CURSOR EnableCursor;
//
// Current mode
//
EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
};
extern EFI_GUID gEfiSimpleTextOutProtocolGuid;
#endif

View File

@ -0,0 +1,27 @@
/** @file
Root include file for Mde Package UEFI, UEFI_APPLICATION type modules.
This is the include file for any module of type UEFI and UEFI_APPLICATION. Uefi modules only use
types defined via this include file and can be ported easily to any
environment.
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 <gpxe/efi/Uefi/UefiBaseType.h>
#include <gpxe/efi/Uefi/UefiSpec.h>
#endif

View File

@ -0,0 +1,174 @@
/** @file
Defines data types and constants introduced in UEFI.
Copyright (c) 2006 - 2008, 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 <gpxe/efi/Base.h>
///
/// Basical data type definitions introduced in UEFI.
///
typedef GUID EFI_GUID;
///
/// Function return status for EFI API
///
typedef RETURN_STATUS EFI_STATUS;
typedef VOID *EFI_HANDLE;
typedef VOID *EFI_EVENT;
typedef UINTN EFI_TPL;
typedef UINT64 EFI_LBA;
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;
//
// Networking Definitions
//
typedef struct {
UINT8 Addr[4];
} EFI_IPv4_ADDRESS;
typedef struct {
UINT8 Addr[16];
} EFI_IPv6_ADDRESS;
typedef struct {
UINT8 Addr[32];
} EFI_MAC_ADDRESS;
typedef union {
UINT32 Addr[4];
EFI_IPv4_ADDRESS v4;
EFI_IPv6_ADDRESS v6;
} EFI_IP_ADDRESS;
//
// 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_INVALID_LANGUAGE RETURN_INVALID_LANGUAGE
#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
#define EFI_SIZE_TO_PAGES(a) (((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0))
#define EFI_PAGES_TO_SIZE(a) ( (a) << EFI_PAGE_SHIFT)
#define EFI_MAX_BIT MAX_BIT
#define EFI_MAX_ADDRESS MAX_ADDRESS
#endif

View File

@ -0,0 +1,66 @@
/** @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.
**/
#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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,218 @@
/** @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.
**/
#ifndef __UEFI_MULTIPHASE_H__
#define __UEFI_MULTIPHASE_H__
#include <gpxe/efi/ProcessorBind.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.
**/
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,37 @@
#ifndef _EFI_H
#define _EFI_H
/** @file
*
* EFI API
*
* The intention is to include near-verbatim copies of the EFI headers
* required by gPXE. This is achieved using the import.pl script in
* this directory. Run the import script to update the local copies
* of the headers:
*
* ./import.pl /path/to/edk2/edk2
*
* where /path/to/edk2/edk2 is the path to your local checkout of the
* EFI Development Kit.
*
* Note that import.pl will modify any #include lines in each imported
* header to reflect its new location within the gPXE tree. It will
* also tidy up the file by removing carriage return characters and
* trailing whitespace.
*
*
* At the time of writing, there are a few other modifications to
* these headers that are present in my personal edk2 tree, that are
* not yet committed back to the main edk2 repository. These
* modifications are fixes for compilation on case-dependent
* filesystems, compilation under -mrtd and -mregparm=3, etc.
*/
/* Include the top-level EFI header file */
#include <gpxe/efi/Uefi.h>
/* Reset any trailing #pragma pack directives */
#pragma pack()
#endif /* _EFI_H */

75
src/include/gpxe/efi/import.pl Executable file
View File

@ -0,0 +1,75 @@
#!/usr/bin/perl -w
use File::Spec::Functions qw ( :ALL );
use File::Find;
use File::Path;
use FindBin;
use strict;
use warnings;
sub try_import_file {
my $gpxedir = shift;
my $edkdirs = shift;
my $filename = shift;
# Skip everything except headers
return unless $filename =~ /\.h$/;
print "$filename...";
my $outfile = catfile ( $gpxedir, $filename );
foreach my $edkdir ( @$edkdirs ) {
my $infile = catfile ( $edkdir, $filename );
if ( -e $infile ) {
# We have found a matching source file - import it
print "$infile\n";
open my $infh, "<$infile" or die "Could not open $infile: $!\n";
( undef, my $outdir, undef ) = splitpath ( $outfile );
mkpath ( $outdir );
open my $outfh, ">$outfile" or die "Could not open $outfile: $!\n";
my @dependencies = ();
while ( <$infh> ) {
# Strip CR and trailing whitespace
s/\r//g;
s/\s*$//g;
chomp;
# Update include lines, and record included files
if ( s/^\#include\s+[<\"](\S+)[>\"]/\#include <gpxe\/efi\/$1>/ ) {
push @dependencies, $1;
}
print $outfh "$_\n";
}
close $outfh;
close $infh;
# Recurse to handle any included files that we don't already have
foreach my $dependency ( @dependencies ) {
if ( ! -e catfile ( $gpxedir, $dependency ) ) {
print "...following dependency on $dependency\n";
try_import_file ( $gpxedir, $edkdirs, $dependency );
}
}
return;
}
}
print "no equivalent found\n";
}
# Identify edk import directories
die "Syntax $0 /path/to/edk2/edk2\n" unless @ARGV == 1;
my $edktop = shift;
die "Directory \"$edktop\" does not appear to contain the EFI EDK2\n"
unless -e catfile ( $edktop, "MdePkg" );
my $edkdirs = [ catfile ( $edktop, "MdePkg/Include" ),
catfile ( $edktop, "IntelFrameworkPkg/Include" ) ];
# Identify gPXE EFI includes directory
my $gpxedir = $FindBin::Bin;
die "Directory \"$gpxedir\" does not appear to contain the gPXE EFI includes\n"
unless -e catfile ( $gpxedir, "../../../include/gpxe/efi" );
print "Importing EFI headers into $gpxedir\nfrom ";
print join ( "\n and ", @$edkdirs )."\n";
# Import headers
find ( { wanted => sub {
try_import_file ( $gpxedir, $edkdirs, abs2rel ( $_, $gpxedir ) );
}, no_chdir => 1 }, $gpxedir );