diff options
Diffstat (limited to 'EDK/Foundation/Include/Pei')
-rw-r--r-- | EDK/Foundation/Include/Pei/Pei.h | 58 | ||||
-rw-r--r-- | EDK/Foundation/Include/Pei/PeiBind.h | 162 | ||||
-rw-r--r-- | EDK/Foundation/Include/Pei/PeiDebug.h | 111 |
3 files changed, 331 insertions, 0 deletions
diff --git a/EDK/Foundation/Include/Pei/Pei.h b/EDK/Foundation/Include/Pei/Pei.h new file mode 100644 index 0000000..f40668d --- /dev/null +++ b/EDK/Foundation/Include/Pei/Pei.h @@ -0,0 +1,58 @@ +/*++ + +Copyright (c) 2004 - 2005, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +Module Name: + + Pei.h + +Abstract: + + Framework PEI master include file. + + This is the main include file for Framework PEI components. There should be + no defines or macros added to this file, other than the EFI version + information already in this file. + + Don't add include files to the list for convenience, only add things + that are architectural. Don't add Protocols or GUID include files here + +--*/ + +#ifndef _PEI_H_ +#define _PEI_H_ + +// +// PEI Specification Revision information +// +#include "TianoCommon.h" + +#include "PeiBind.h" +#include "PeiApi.h" +#include "EfiDebug.h" +#include "PeiDebug.h" + +// +// Enable code sharing with DXE by removing ASSERT and DEBUG +// +// #define ASSERT(a) +// #define DEBUG (a) +// + +#ifdef EFI_PEI_REPORT_STATUS_CODE_ON +#define PEI_REPORT_STATUS_CODE_CODE(Code) Code +#define PEI_REPORT_STATUS_CODE(PeiServices, CodeType, Value, Instance, CallerId, Data) \ + (*PeiServices)->PeiReportStatusCode (PeiServices, CodeType, Value, Instance, CallerId, Data) +#else +#define PEI_REPORT_STATUS_CODE_CODE(Code) +#define PEI_REPORT_STATUS_CODE(PeiServices, CodeType, Value, Instance, CallerId, Data) +#endif + +#endif diff --git a/EDK/Foundation/Include/Pei/PeiBind.h b/EDK/Foundation/Include/Pei/PeiBind.h new file mode 100644 index 0000000..5452865 --- /dev/null +++ b/EDK/Foundation/Include/Pei/PeiBind.h @@ -0,0 +1,162 @@ +/*++ + +Copyright (c) 2004 - 2006, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +Module Name: + + PeiBind.h + +Abstract: + + Tiano PEI core and PEIM binding macros + +--*/ + +#ifndef _PEI_BIND_H_ +#define _PEI_BIND_H_ + +#ifdef EFI_DEBUG + +#ifdef EFI_NT_EMULATOR + +//;;## ...AMI_OVERRIDE... Support PI1.x +#if (PI_SPECIFICATION_VERSION < 0x00010000) + +#define EFI_PEI_CORE_ENTRY_POINT(InitFunction) \ + UINTN \ + __stdcall \ + _DllMainCRTStartup ( \ + UINTN Inst, \ + UINTN reason_for_call, \ + VOID *rserved \ + ) \ + { \ + return 1; \ + } \ + \ + EFI_STATUS \ + __declspec( dllexport ) \ + __cdecl \ + InitializeDriver ( \ + IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartup \ + ) \ + { \ + return InitFunction(PeiStartup); \ + } + +#else +#define EFI_PEI_CORE_ENTRY_POINT(InitFunction) \ + UINTN \ + __stdcall \ + _DllMainCRTStartup ( \ + UINTN Inst, \ + UINTN reason_for_call, \ + VOID *rserved \ + ) \ + { \ + return 1; \ + } \ + \ + EFI_STATUS \ + __declspec( dllexport ) \ + __cdecl \ + InitializeDriver ( \ + IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, \ + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList \ + ) \ + { \ + return InitFunction(SecCoreData, PpiList); \ + } + +#endif + +#define EFI_PEIM_ENTRY_POINT(InitFunction) \ + UINTN \ + __stdcall \ + _DllMainCRTStartup ( \ + UINTN Inst, \ + UINTN reason_for_call, \ + VOID *rserved \ + ) \ + { \ + return 1; \ + } \ + \ + EFI_STATUS \ + __declspec( dllexport ) \ + __cdecl \ + InitializeDriver ( \ + IN EFI_FFS_FILE_HEADER *FfsHeader, \ + IN EFI_PEI_SERVICES **PeiServices \ + ) \ + { \ + return InitFunction(FfsHeader, PeiServices); \ + } + +#else + +#define EFI_PEI_CORE_ENTRY_POINT(InitFunction) +#define EFI_PEIM_ENTRY_POINT(InitFunction) + +#endif + +#else + +#ifdef EFI_NT_EMULATOR + +//;;## ...AMI_OVERRIDE... Support PI1.x +#if (PI_SPECIFICATION_VERSION < 0x00010000) + +#define EFI_PEI_CORE_ENTRY_POINT(InitFunction) \ + EFI_STATUS \ + __declspec( dllexport ) \ + __cdecl \ + InitializeDriver ( \ + IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartup \ + ) \ + { \ + return InitFunction(PeiStartup); \ + } + +#else +#define EFI_PEI_CORE_ENTRY_POINT(InitFunction) \ + EFI_STATUS \ + __declspec( dllexport ) \ + __cdecl \ + InitializeDriver ( \ + IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, \ + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList \ + ) \ + { \ + return InitFunction(SecCoreData, PpiList); \ + } + +#endif + + +#define EFI_PEIM_ENTRY_POINT(InitFunction) \ + EFI_STATUS \ + __declspec( dllexport ) \ + __cdecl \ + InitializeDriver ( \ + IN EFI_FFS_FILE_HEADER *FfsHeader, \ + IN EFI_PEI_SERVICES **PeiServices \ + ) \ + { \ + return InitFunction(FfsHeader, PeiServices); \ + } +#else + +#define EFI_PEI_CORE_ENTRY_POINT(InitFunction) +#define EFI_PEIM_ENTRY_POINT(InitFunction) + +#endif +#endif +#endif diff --git a/EDK/Foundation/Include/Pei/PeiDebug.h b/EDK/Foundation/Include/Pei/PeiDebug.h new file mode 100644 index 0000000..dad6a6c --- /dev/null +++ b/EDK/Foundation/Include/Pei/PeiDebug.h @@ -0,0 +1,111 @@ +/*++ + +Copyright (c) 2004, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +Module Name: + + PeiDebug.h + +Abstract: + + PEI Debug macros. The work needs to be done in library. The Debug + macros them selves are standard for all files, including the core. + + There needs to be code linked in that produces the following macros: + + PeiDebugAssert(file, linenumber, assertion string) - worker function for + ASSERT. filename and line number of where this ASSERT() is located + is passed in along with the stringized version of the assertion. + + PeiDebugPrint - Worker function for debug print + + _DEBUG_SET_MEM(address, length, value) - Set memory at address to value + for legnth bytes. This macro is used to initialzed uninitialized memory + or memory that is free'ed, so it will not be used by mistake. + +--*/ + +#ifndef _PEIDEBUG_H_ +#define _PEIDEBUG_H_ + +#ifdef EFI_DEBUG + + VOID + PeiDebugAssert ( + IN EFI_PEI_SERVICES **PeiServices, + IN CHAR8 *FileName, + IN INTN LineNumber, + IN CHAR8 *Description + ); + + VOID + PeiDebugPrint ( + IN EFI_PEI_SERVICES **PeiServices, + IN UINTN ErrorLevel, + IN CHAR8 *Format, + ... + ); + + #define _PEI_DEBUG_ASSERT(PeiST, assertion) \ + PeiDebugAssert (PeiST, __FILE__, __LINE__, #assertion) + + #define _PEI_DEBUG(PeiST, arg) PeiDebugPrint (PeiST, arg) + + // + // Define ASSERT() macro, if assertion is FALSE trigger the ASSERT + // + #define PEI_ASSERT(PeiST, assertion) if(!(assertion)) \ + _PEI_DEBUG_ASSERT(PeiST, assertion) + + #define PEI_ASSERT_LOCKED(PeiST, l) if(!(l)->Lock) _PEI_DEBUG_ASSERT(PeiST, l not locked) + + // + // DEBUG((DebugLevel, "format string", ...)) - if DebugLevel is active do + // the a debug print. + // + + #define PEI_DEBUG(arg) PeiDebugPrint arg + + #define PEI_DEBUG_CODE(code) code + + #define PEI_CR(Record, TYPE, Field, Signature) \ + _CR(Record, TYPE, Field) + + + #define _PEI_DEBUG_SET_MEM(address, length, data) SetMem(address, length, data) + +#else + #define PEI_ASSERT(PeiST, a) + #define PEI_ASSERT_LOCKED(PeiST, l) + #define PEI_DEBUG(arg) + #define PEI_DEBUG_CODE(code) + #define PEI_CR(Record, TYPE, Field, Signature) \ + _CR(Record, TYPE, Field) + #define _PEI_DEBUG_SET_MEM(address, length, data) +#endif + +#define ASSERT_PEI_ERROR(PeiServices, Status) \ + PEI_DEBUG_CODE ( \ + if (EFI_ERROR (Status)) { \ + PEI_DEBUG ((PeiServices, EFI_D_ERROR, "\nASSERT_PEI_ERROR, Status = %r (0x%08X)\n", \ + Status, Status)); \ + PEI_ASSERT (PeiServices, !EFI_ERROR (Status)); \ + } \ + ) + +#ifdef EFI_DEBUG_CLEAR_MEMORY + #define PEI_DEBUG_SET_MEMORY(address,length) \ + _PEI_DEBUG_SET_MEM(address, length, EFI_BAD_POINTER_AS_BYTE) +#else + #define PEI_DEBUG_SET_MEMORY(address,length) +#endif + + +#endif |