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