]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/Debug.c
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / Dxe / EfiDriverLib / Debug.c
CommitLineData
3eb9473e 1/*++\r
2\r
4ea9375a
HT
3Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>\r
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 "EfiDriverLib.h"\r
24#include "EfiPrintLib.h"\r
25#include "EfiStatusCode.h"\r
26#include EFI_GUID_DEFINITION (StatusCodeCallerId)\r
27#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)\r
0dbeedde 28#include EFI_PROTOCOL_DEFINITION (DebugMask)\r
3eb9473e 29\r
30//\r
31// You would think you should divid by sizeof (UINT64), but EBC does not like\r
32// that!\r
33//\r
34#define EFI_STATUS_CODE_DATA_MAX_SIZE64 (EFI_STATUS_CODE_DATA_MAX_SIZE / 8)\r
35\r
36VOID\r
37EfiDebugAssert (\r
38 IN CHAR8 *FileName,\r
39 IN INTN LineNumber,\r
40 IN CHAR8 *Description\r
41 )\r
42/*++\r
43\r
44Routine Description:\r
45\r
46 Worker function for ASSERT(). If Error Logging hub is loaded log ASSERT\r
47 information. If Error Logging hub is not loaded BREAKPOINT().\r
48\r
49 We use UINT64 buffers due to IPF alignment concerns.\r
50\r
51Arguments:\r
52\r
53 FileName - File name of failing routine.\r
54\r
55 LineNumber - Line number of failing ASSERT().\r
56\r
57 Description - Descritption, usally the assertion,\r
58 \r
59Returns:\r
60 \r
61 None\r
62\r
63--*/\r
64{\r
65 UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];\r
66\r
67 EfiDebugAssertWorker (FileName, LineNumber, Description, sizeof (Buffer), Buffer);\r
68\r
69 EfiLibReportStatusCode (\r
70 (EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED),\r
71 (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE),\r
72 0,\r
73 &gEfiCallerIdGuid,\r
74 (EFI_STATUS_CODE_DATA *) Buffer\r
75 );\r
76\r
77 //\r
78 // Put break point in module that contained the error.\r
79 //\r
57d40fe2 80 EFI_DEADLOOP ();\r
3eb9473e 81}\r
82\r
83VOID\r
84EfiDebugVPrint (\r
85 IN UINTN ErrorLevel,\r
86 IN CHAR8 *Format,\r
87 IN VA_LIST Marker\r
88 )\r
89/*++\r
90\r
91Routine Description:\r
92\r
93 Worker function for DEBUG(). If Error Logging hub is loaded log ASSERT\r
94 information. If Error Logging hub is not loaded do nothing.\r
95\r
96 We use UINT64 buffers due to IPF alignment concerns.\r
97\r
98Arguments:\r
99\r
100 ErrorLevel - If error level is set do the debug print.\r
101\r
102 Format - String to use for the print, followed by Print arguments.\r
103\r
104 Marker - VarArgs\r
105 \r
106Returns:\r
107 \r
108 None\r
109\r
110--*/\r
111{\r
112 UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];\r
113 UINTN ImageDebugMask;\r
114\r
115 //\r
116 // Check driver debug mask value and global mask\r
117 //\r
118 if (gDebugMaskInterface != NULL) {\r
119 gDebugMaskInterface->GetDebugMask (gDebugMaskInterface, &ImageDebugMask);\r
120 if (!(ErrorLevel & ImageDebugMask)) {\r
121 return ;\r
122 }\r
123 } else if (!(gErrorLevel & ErrorLevel)) {\r
124 return ;\r
125 }\r
126\r
127 EfiDebugVPrintWorker (ErrorLevel, Format, Marker, sizeof (Buffer), Buffer);\r
128\r
129 EfiLibReportStatusCode (\r
130 EFI_DEBUG_CODE,\r
131 (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_DC_UNSPECIFIED),\r
132 (UINT32) ErrorLevel,\r
133 &gEfiCallerIdGuid,\r
134 (EFI_STATUS_CODE_DATA *) Buffer\r
135 );\r
136\r
137 return ;\r
138}\r
139\r
140VOID\r
141EfiDebugPrint (\r
142 IN UINTN ErrorLevel,\r
143 IN CHAR8 *Format,\r
144 ...\r
145 )\r
146/*++\r
147\r
148Routine Description:\r
149\r
150 Wrapper for EfiDebugVPrint ()\r
151 \r
152Arguments:\r
153\r
154 ErrorLevel - If error level is set do the debug print.\r
155\r
156 Format - String to use for the print, followed by Print arguments.\r
157\r
158 ... - Print arguments.\r
159\r
160 \r
161Returns:\r
162 \r
163 None\r
164\r
165--*/\r
166{\r
167 VA_LIST Marker;\r
168\r
169 VA_START (Marker, Format);\r
170 EfiDebugVPrint (ErrorLevel, Format, Marker);\r
171 VA_END (Marker);\r
172}\r