]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
f57387d5 HT |
3 | Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r |
4 | This program and the accompanying materials \r | |
3eb9473e | 5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | PeiDebug.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | PEI Debug macros. The work needs to be done in library. The Debug\r | |
19 | macros them selves are standard for all files, including the core.\r | |
20 | \r | |
21 | There needs to be code linked in that produces the following macros:\r | |
22 | \r | |
23 | PeiDebugAssert(file, linenumber, assertion string) - worker function for \r | |
24 | ASSERT. filename and line number of where this ASSERT() is located\r | |
25 | is passed in along with the stringized version of the assertion.\r | |
26 | \r | |
27 | PeiDebugPrint - Worker function for debug print\r | |
28 | \r | |
29 | _DEBUG_SET_MEM(address, length, value) - Set memory at address to value\r | |
30 | for legnth bytes. This macro is used to initialzed uninitialized memory\r | |
31 | or memory that is free'ed, so it will not be used by mistake. \r | |
32 | \r | |
33 | --*/\r | |
34 | \r | |
35 | #ifndef _PEIDEBUG_H_\r | |
36 | #define _PEIDEBUG_H_\r | |
37 | \r | |
38 | #ifdef EFI_DEBUG\r | |
39 | \r | |
40 | VOID\r | |
41 | PeiDebugAssert (\r | |
42 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
43 | IN CHAR8 *FileName,\r | |
44 | IN INTN LineNumber,\r | |
45 | IN CHAR8 *Description\r | |
46 | );\r | |
47 | \r | |
48 | VOID\r | |
49 | PeiDebugPrint (\r | |
50 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
51 | IN UINTN ErrorLevel,\r | |
52 | IN CHAR8 *Format,\r | |
53 | ...\r | |
54 | );\r | |
55 | \r | |
56 | #define _PEI_DEBUG_ASSERT(PeiST, assertion) \\r | |
57 | PeiDebugAssert (PeiST, __FILE__, __LINE__, #assertion)\r | |
58 | \r | |
59 | #define _PEI_DEBUG(PeiST, arg) PeiDebugPrint (PeiST, arg)\r | |
60 | \r | |
61 | //\r | |
62 | // Define ASSERT() macro, if assertion is FALSE trigger the ASSERT\r | |
63 | //\r | |
64 | #define PEI_ASSERT(PeiST, assertion) if(!(assertion)) \\r | |
65 | _PEI_DEBUG_ASSERT(PeiST, assertion)\r | |
66 | \r | |
67 | #define PEI_ASSERT_LOCKED(PeiST, l) if(!(l)->Lock) _PEI_DEBUG_ASSERT(PeiST, l not locked)\r | |
68 | \r | |
69 | //\r | |
70 | // DEBUG((DebugLevel, "format string", ...)) - if DebugLevel is active do \r | |
71 | // the a debug print.\r | |
72 | //\r | |
73 | \r | |
74 | #define PEI_DEBUG(arg) PeiDebugPrint arg\r | |
75 | \r | |
76 | #define PEI_DEBUG_CODE(code) code\r | |
77 | \r | |
78 | #define PEI_CR(Record, TYPE, Field, Signature) \\r | |
79 | _CR(Record, TYPE, Field) \r | |
80 | \r | |
81 | \r | |
82 | #define _PEI_DEBUG_SET_MEM(address, length, data) SetMem(address, length, data)\r | |
83 | \r | |
84 | #else\r | |
85 | #define PEI_ASSERT(PeiST, a) \r | |
86 | #define PEI_ASSERT_LOCKED(PeiST, l) \r | |
87 | #define PEI_DEBUG(arg) \r | |
88 | #define PEI_DEBUG_CODE(code) \r | |
89 | #define PEI_CR(Record, TYPE, Field, Signature) \\r | |
90 | _CR(Record, TYPE, Field) \r | |
91 | #define _PEI_DEBUG_SET_MEM(address, length, data) \r | |
92 | #endif\r | |
93 | \r | |
94 | #define ASSERT_PEI_ERROR(PeiST, status) PEI_ASSERT(PeiST, !EFI_ERROR(status))\r | |
95 | \r | |
96 | #ifdef EFI_DEBUG_CLEAR_MEMORY\r | |
97 | #define PEI_DEBUG_SET_MEMORY(address,length) \\r | |
98 | _PEI_DEBUG_SET_MEM(address, length, EFI_BAD_POINTER_AS_BYTE)\r | |
99 | #else\r | |
100 | #define PEI_DEBUG_SET_MEMORY(address,length)\r | |
101 | #endif\r | |
102 | \r | |
103 | \r | |
104 | #endif\r |