]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Debug.c
Maintainers.txt: Remove EdkCompatibilityPkg information
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / RuntimeDxe / EfiRuntimeLib / Debug.c
CommitLineData
3eb9473e 1/*++\r
2\r
4ac4deb7 3Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
4ea9375a 4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 Debug.c\r
15\r
16Abstract:\r
17\r
18 Support for Debug primatives. \r
19\r
20--*/\r
21\r
22#include "Tiano.h"\r
23#include "EfiRuntimeLib.h"\r
24#include EFI_GUID_DEFINITION (StatusCodeCallerId)\r
25#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)\r
26\r
27#define EFI_STATUS_CODE_DATA_MAX_SIZE64 (EFI_STATUS_CODE_DATA_MAX_SIZE / 8)\r
28\r
29VOID\r
30EfiDebugAssert (\r
31 IN CHAR8 *FileName,\r
32 IN INTN LineNumber,\r
33 IN CHAR8 *Description\r
34 )\r
35/*++\r
36\r
37Routine Description:\r
38\r
39 Worker function for ASSERT (). If Error Logging hub is loaded log ASSERT\r
40 information. If Error Logging hub is not loaded BREAKPOINT ().\r
41 \r
42Arguments:\r
43\r
44 FileName - File name of failing routine.\r
45\r
46 LineNumber - Line number of failing ASSERT ().\r
47\r
48 Description - Description, usually the assertion,\r
49 \r
50Returns:\r
51 \r
52 None\r
53\r
54--*/\r
55{\r
56 UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE64];\r
57\r
58 EfiDebugAssertWorker (FileName, LineNumber, Description, sizeof (Buffer), Buffer);\r
59\r
60 EfiReportStatusCode (\r
61 (EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED),\r
62 (EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE),\r
63 0,\r
64 &gEfiCallerIdGuid,\r
65 (EFI_STATUS_CODE_DATA *) Buffer\r
66 );\r
67\r
68 //\r
4ac4deb7 69 // Put dead loop in module that contained the error.\r
3eb9473e 70 //\r
4ac4deb7 71 EFI_DEADLOOP ();\r
3eb9473e 72}\r
73\r
74VOID\r
75EfiDebugVPrint (\r
76 IN UINTN ErrorLevel,\r
77 IN CHAR8 *Format,\r
78 IN VA_LIST Marker\r
79 )\r
80/*++\r
81\r
82Routine Description:\r
83\r
84 Worker function for DEBUG (). If Error Logging hub is loaded log ASSERT\r
85 information. If Error Logging hub is not loaded do nothing.\r
86 \r
87Arguments:\r
88\r
89 ErrorLevel - If error level is set do the debug print.\r
90\r
91 Format - String to use for the print, followed by Print arguments.\r
92\r
93 Marker - VarArgs\r
94 \r
95Returns:\r
96 \r
97 None\r
98\r
99--*/\r
100{\r
101 UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE64];\r
102\r
103 if (!(gRtErrorLevel & ErrorLevel)) {\r
104 return ;\r
105 }\r
106\r
107 EfiDebugVPrintWorker (ErrorLevel, Format, Marker, sizeof (Buffer), Buffer);\r
108\r
109 EfiReportStatusCode (\r
110 EFI_DEBUG_CODE,\r
111 (EFI_SOFTWARE_DXE_RT_DRIVER | EFI_DC_UNSPECIFIED),\r
112 (UINT32) ErrorLevel,\r
113 &gEfiCallerIdGuid,\r
114 (EFI_STATUS_CODE_DATA *) Buffer\r
115 );\r
116\r
117 return ;\r
118}\r
119\r
120VOID\r
121EfiDebugPrint (\r
122 IN UINTN ErrorLevel,\r
123 IN CHAR8 *Format,\r
124 ...\r
125 )\r
126/*++\r
127\r
128Routine Description:\r
129\r
130 Worker function for DEBUG (). If Error Logging hub is loaded log ASSERT\r
131 information. If Error Logging hub is not loaded do nothing.\r
132\r
133 We use UINT64 buffers due to IPF alignment concerns.\r
134\r
135Arguments:\r
136\r
137 ErrorLevel - If error level is set do the debug print.\r
138\r
139 Format - String to use for the print, followed by Print arguments.\r
140\r
141 ... - VAR args for Format\r
142 \r
143Returns:\r
144 \r
145 None\r
146\r
147--*/\r
148{\r
149 VA_LIST Marker;\r
150\r
151 VA_START (Marker, Format);\r
152 EfiDebugVPrint (ErrorLevel, Format, Marker);\r
153 VA_END (Marker);\r
154}\r