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.
93 Worker function for DEBUG(). If Error Logging hub is loaded log ASSERT
94 information. If Error Logging hub is not loaded do nothing.
96 We use UINT64 buffers due to IPF alignment concerns.
100 ErrorLevel - If error level is set do the debug print.
102 Format - String to use for the print, followed by Print arguments.
112 UINT64 Buffer
[EFI_STATUS_CODE_DATA_MAX_SIZE
];
113 UINTN ImageDebugMask
;
116 // Check driver debug mask value and global mask
118 if (gDebugMaskInterface
!= NULL
) {
119 gDebugMaskInterface
->GetDebugMask (gDebugMaskInterface
, &ImageDebugMask
);
120 if (!(ErrorLevel
& ImageDebugMask
)) {
123 } else if (!(gErrorLevel
& ErrorLevel
)) {
127 EfiDebugVPrintWorker (ErrorLevel
, Format
, Marker
, sizeof (Buffer
), Buffer
);
129 EfiLibReportStatusCode (
131 (EFI_SOFTWARE_DXE_BS_DRIVER
| EFI_DC_UNSPECIFIED
),
134 (EFI_STATUS_CODE_DATA
*) Buffer
150 Wrapper for EfiDebugVPrint ()
154 ErrorLevel - If error level is set do the debug print.
156 Format - String to use for the print, followed by Print arguments.
158 ... - Print arguments.
169 VA_START (Marker
, Format
);
170 EfiDebugVPrint (ErrorLevel
, Format
, Marker
);