+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- EfiDebug.h\r
-\r
-Abstract:\r
-\r
- EFI Debug macros. The work needs tobe done in library. The Debug\r
- macros them selves are standard for all files, including the core.\r
- \r
- There needs to be code linked in that produces the following macros:\r
- \r
- EfiDebugAssert(file, linenumber, assertion string) - worker function for \r
- ASSERT. filename and line number of where this ASSERT() is located\r
- is passed in along with the stringized version of the assertion.\r
- \r
- EfiDebugPrint - Worker function for debug print\r
-\r
- _DEBUG_SET_MEM(address, length, value) - Set memory at address to value\r
- for legnth bytes. This macro is used to initialzed uninitialized memory\r
- or memory that is free'ed, so it will not be used by mistake. \r
-\r
---*/\r
-\r
-#ifndef _EFI_DEBUG_H_\r
-#define _EFI_DEBUG_H_\r
-\r
-#ifdef EFI_DEBUG\r
-\r
- VOID\r
- EfiDebugAssert (\r
- IN CHAR8 *FileName,\r
- IN INTN LineNumber,\r
- IN CHAR8 *Description\r
- );\r
-\r
- VOID\r
- EfiDebugPrint (\r
- IN UINTN ErrorLevel,\r
- IN CHAR8 *Format,\r
- ...\r
- );\r
-\r
- VOID\r
- EfiDebugVPrint (\r
- IN UINTN ErrorLevel,\r
- IN CHAR8 *Format,\r
- IN VA_LIST Marker\r
- );\r
-\r
- //\r
- // Define macros for the above functions so we can make them go away\r
- // in non-debug builds.\r
- //\r
- #define EFI_DEBUG_VPRINT(ErrorLevel, Format, Marker) \\r
- EfiDebugVPrint(ErrorLevel, Format, Marker) \r
-\r
- #define EFI_DEBUG_ASSERT(FileName, LineNumber, Description) \\r
- EfiDebugAssert (FileName, LineNumber, Description)\r
-\r
- #define _DEBUG_ASSERT(assertion) \\r
- EfiDebugAssert (__FILE__, __LINE__, #assertion)\r
-\r
- #define _DEBUG(arg) DebugPrint arg\r
-\r
- //\r
- // Define ASSERT() macro, if assertion is FALSE trigger the ASSERT\r
- //\r
- #define ASSERT(assertion) if(!(assertion)) \\r
- _DEBUG_ASSERT(assertion)\r
- \r
- #define ASSERT_LOCKED(l) if(!(l)->Lock) _DEBUG_ASSERT(l not locked)\r
-\r
- //\r
- // DEBUG((DebugLevel, "format string", ...)) - if DebugLevel is active do \r
- // the a debug print.\r
- //\r
- #define DEBUG(arg) EfiDebugPrint arg\r
-\r
- #define DEBUG_CODE(code) code\r
-\r
- #define CR(record, TYPE, field, signature) \\r
- _CR(record, TYPE, field)->Signature != signature ? \\r
- (TYPE *) (_DEBUG_ASSERT("CR has Bad Signature"), record) : \\r
- _CR(record, TYPE, field)\r
-\r
- #define _DEBUG_SET_MEM(address, length, data) EfiCommonLibSetMem(address, length, data)\r
-\r
- //\r
- // Generate an ASSERT if the protocol specified by GUID is already installed on Handle.\r
- // If Handle is NULL, then an ASSERT is generated if the protocol specified by GUID \r
- // is present anywhere in the handle database\r
- //\r
- #define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \\r
- DEBUG_CODE ( { \\r
- VOID *Instance; \\r
- if (Handle == NULL) { \\r
- ASSERT(EFI_ERROR(gBS->LocateProtocol (Guid, NULL, &Instance))); \\r
- } else { \\r
- ASSERT(EFI_ERROR(gBS->HandleProtocol (Handle, Guid, &Instance))); \\r
- } } ) \r
-\r
-#else\r
- #define ASSERT(a) \r
- #define ASSERT_LOCKED(l) \r
- #define DEBUG(arg) \r
- #define DEBUG_CODE(code) \r
- #define CR(Record, TYPE, Field, Signature) \\r
- _CR(Record, TYPE, Field) \r
- #define _DEBUG_SET_MEM(address, length, data) \r
- #define EFI_DEBUG_VPRINT(ErrorLevel, Format, Marker) \r
- #define EFI_DEBUG_ASSERT(FileName, LineNumber, Description) \r
- #define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid)\r
-#endif\r
-\r
-//\r
-// Generate an ASSERT if Status is an error code\r
-//\r
-//#define ASSERT_EFI_ERROR(status) ASSERT(!EFI_ERROR(status))\r
-#define ASSERT_EFI_ERROR(status) if (EFI_ERROR(status)) \\r
- DEBUG_CODE ( { \\r
- DEBUG((EFI_D_ERROR, "\nASSERT!Status = 0x%x Info :",status)); \\r
- ASSERT(!EFI_ERROR(status)); \\r
- } ) \r
- \r
-#ifdef EFI_DEBUG_CLEAR_MEMORY\r
- #define DEBUG_SET_MEMORY(address,length) \\r
- _DEBUG_SET_MEM(address, length, EFI_BAD_POINTER_AS_BYTE)\r
-#else\r
- #define DEBUG_SET_MEMORY(address,length)\r
-#endif\r
-\r
-#define EFI_D_INIT 0x00000001 // Initialization style messages\r
-#define EFI_D_WARN 0x00000002 // Warnings\r
-#define EFI_D_LOAD 0x00000004 // Load events\r
-#define EFI_D_FS 0x00000008 // EFI File system\r
-#define EFI_D_POOL 0x00000010 // Alloc & Free's\r
-#define EFI_D_PAGE 0x00000020 // Alloc & Free's\r
-#define EFI_D_INFO 0x00000040 // Informational debug messages\r
-#define EFI_D_VARIABLE 0x00000100 // Variable\r
-#define EFI_D_BM 0x00000400 // Boot Manager (BDS)\r
-#define EFI_D_BLKIO 0x00001000 // BlkIo Driver\r
-#define EFI_D_NET 0x00004000 // SNI Driver\r
-#define EFI_D_UNDI 0x00010000 // UNDI Driver\r
-#define EFI_D_LOADFILE 0x00020000 // UNDI Driver\r
-#define EFI_D_EVENT 0x00080000 // Event messages\r
-#define EFI_D_VERBOSE 0x00400000 // Detailed debug messages that may significantly impact boot performance\r
-#define EFI_D_ERROR 0x80000000 // Error\r
-\r
-#define EFI_D_GENERIC (EFI_D_ERROR | EFI_D_INIT | EFI_D_WARN | EFI_D_INFO | \\r
- EFI_D_BLKIO | EFI_D_NET | EFI_D_UNDI | EFI_D_VERBOSE) \r
-\r
-#define EFI_D_INTRINSIC ( EFI_D_EVENT | EFI_D_POOL | EFI_D_PAGE | \\r
- EFI_D_BM | EFI_D_LOAD | EFI_D_VARIABLE ) \r
-\r
-#define EFI_D_RESERVED (EFI_D_GENERIC | EFI_D_INTRINSIC) \r
-\r
-#define EFI_DBUG_MASK (EFI_D_ERROR | EFI_D_INFO | EFI_D_WARN)\r
-\r
-#endif\r