3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. 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
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.
18 Produce EfiDebugAssertProtocol to enable EfiUtilityLib to function.
19 The EfiUtilityLib is used by the EFI shell!
23 #include "StatusCode.h"
27 StatusCodeDebugAssert (
28 IN EFI_DEBUG_ASSERT_PROTOCOL
*This
,
36 StatusCodeDebugPrint (
37 IN EFI_DEBUG_ASSERT_PROTOCOL
*This
,
46 IN EFI_DEBUG_ASSERT_PROTOCOL
* This
,
48 IN CHAR8
*PostCodeString OPTIONAL
53 StatusCodeGetErrorLevel (
54 IN EFI_DEBUG_ASSERT_PROTOCOL
*This
,
60 StatusCodeSetErrorLevel (
61 IN EFI_DEBUG_ASSERT_PROTOCOL
*This
,
66 // Protocol instance, there can be only one.
68 EFI_HANDLE mHandle
= NULL
;
69 EFI_DEBUG_ASSERT_PROTOCOL mDebugAssertProtocol
= {
70 StatusCodeDebugAssert
,
73 StatusCodeGetErrorLevel
,
74 StatusCodeSetErrorLevel
78 // Function implementations
82 StatusCodeDebugAssert (
83 IN EFI_DEBUG_ASSERT_PROTOCOL
*This
,
92 Worker function for ASSERT (). If Error Logging hub is loaded log ASSERT
93 information. If Error Logging hub is not loaded CpuBreakpoint ().
97 This - Protocol instance.
98 FileName - File name of failing routine.
99 LineNumber - Line number of failing ASSERT().
100 Description - Description, usually the assertion,
104 EFI_SUCCESS The function always completes successfully.
108 DebugAssert (FileName
, LineNumber
, Description
);
115 StatusCodeDebugPrint (
116 IN EFI_DEBUG_ASSERT_PROTOCOL
*This
,
125 Worker function for DEBUG (). If Error Logging hub is loaded log ASSERT
126 information. If Error Logging hub is not loaded do nothing.
130 This - Protocol Instance.
131 ErrorLevel - If error level is set do the debug print.
132 Format - String to use for the print, followed by Print arguments.
136 EFI_SUCCESS The function always completes successfully.
140 CHAR8 Buffer
[EFI_STATUS_CODE_DATA_MAX_SIZE
];
142 AsciiVSPrint (Buffer
, EFI_STATUS_CODE_DATA_MAX_SIZE
, Format
, Marker
);
143 DebugPrint (ErrorLevel
, Buffer
);
150 StatusCodeGetErrorLevel (
151 IN EFI_DEBUG_ASSERT_PROTOCOL
*This
,
155 *ErrorLevel
= PcdGet32(PcdDebugPrintErrorLevel
);
161 StatusCodeSetErrorLevel (
162 IN EFI_DEBUG_ASSERT_PROTOCOL
*This
,
166 return EFI_UNSUPPORTED
;
172 IN EFI_DEBUG_ASSERT_PROTOCOL
* This
,
174 IN CHAR8
*PostCodeString OPTIONAL
180 Write the code to IO ports 80 and 81.
184 This - Protocol Instance.
185 PostCode - Code to write
186 PostCodeString - String, currently ignored.
190 EFI_SUCCESS The function always completes successfully.
194 IoWrite8 (0x80, (UINT8
) (PostCode
& 0xff));
195 IoWrite8 (0x81, (UINT8
) (PostCode
>> 8));
201 InstallStatusCodeDebugAssert (
208 Install the status code debug assert protocol
216 Results of call to InstallProtocolInterface.
222 gBS
->InstallProtocolInterface (
224 &gEfiDebugAssertProtocolGuid
,
225 EFI_NATIVE_INTERFACE
,
226 &mDebugAssertProtocol