3 Copyright (c) 2004 - 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 Support for Debug primatives.
23 #include "EfiDriverLib.h"
24 #include "EfiPrintLib.h"
25 #include "EfiStatusCode.h"
26 #include EFI_GUID_DEFINITION (StatusCodeCallerId)
27 #include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
28 #include EFI_PROTOCOL_DEFINITION (DEBUGMASK)
31 // You would think you should divid by sizeof (UINT64), but EBC does not like
34 #define EFI_STATUS_CODE_DATA_MAX_SIZE64 (EFI_STATUS_CODE_DATA_MAX_SIZE / 8)
46 Worker function for ASSERT(). If Error Logging hub is loaded log ASSERT
47 information. If Error Logging hub is not loaded BREAKPOINT().
49 We use UINT64 buffers due to IPF alignment concerns.
53 FileName - File name of failing routine.
55 LineNumber - Line number of failing ASSERT().
57 Description - Descritption, usally the assertion,
65 UINT64 Buffer
[EFI_STATUS_CODE_DATA_MAX_SIZE
];
67 EfiDebugAssertWorker (FileName
, LineNumber
, Description
, sizeof (Buffer
), Buffer
);
69 EfiLibReportStatusCode (
70 (EFI_ERROR_CODE
| EFI_ERROR_UNRECOVERED
),
71 (EFI_SOFTWARE_DXE_BS_DRIVER
| EFI_SW_EC_ILLEGAL_SOFTWARE_STATE
),
74 (EFI_STATUS_CODE_DATA
*) Buffer
78 // Put break point in module that contained the error.
84 // Bugbug: Need to fix a GNC style cpu break point
100 Worker function for DEBUG(). If Error Logging hub is loaded log ASSERT
101 information. If Error Logging hub is not loaded do nothing.
103 We use UINT64 buffers due to IPF alignment concerns.
107 ErrorLevel - If error level is set do the debug print.
109 Format - String to use for the print, followed by Print arguments.
119 UINT64 Buffer
[EFI_STATUS_CODE_DATA_MAX_SIZE
];
120 UINTN ImageDebugMask
;
123 // Check driver debug mask value and global mask
125 if (gDebugMaskInterface
!= NULL
) {
126 gDebugMaskInterface
->GetDebugMask (gDebugMaskInterface
, &ImageDebugMask
);
127 if (!(ErrorLevel
& ImageDebugMask
)) {
130 } else if (!(gErrorLevel
& ErrorLevel
)) {
134 EfiDebugVPrintWorker (ErrorLevel
, Format
, Marker
, sizeof (Buffer
), Buffer
);
136 EfiLibReportStatusCode (
138 (EFI_SOFTWARE_DXE_BS_DRIVER
| EFI_DC_UNSPECIFIED
),
141 (EFI_STATUS_CODE_DATA
*) Buffer
157 Wrapper for EfiDebugVPrint ()
161 ErrorLevel - If error level is set do the debug print.
163 Format - String to use for the print, followed by Print arguments.
165 ... - Print arguments.
176 VA_START (Marker
, Format
);
177 EfiDebugVPrint (ErrorLevel
, Format
, Marker
);