xref: /netbsd-src/sys/external/bsd/gnu-efi/dist/inc/efidebug.h (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1 /*	$NetBSD: efidebug.h,v 1.1.1.1 2014/04/01 16:16:07 jakllsch Exp $	*/
2 
3 #ifndef _EFI_DEBUG_H
4 #define _EFI_DEBUG_H
5 
6 /*++
7 
8 Copyright (c) 1998  Intel Corporation
9 
10 Module Name:
11 
12     efidebug.h
13 
14 Abstract:
15 
16     EFI library debug functions
17 
18 
19 
20 Revision History
21 
22 --*/
23 
24 extern UINTN     EFIDebug;
25 
26 #if EFI_DEBUG
27 
28     #define DBGASSERT(a)        DbgAssert(__FILE__, __LINE__, #a)
29     #define DEBUG(a)            DbgPrint a
30 
31 #else
32 
33     #define DBGASSERT(a)
34     #define DEBUG(a)
35 
36 #endif
37 
38 #if EFI_DEBUG_CLEAR_MEMORY
39 
40     #define DBGSETMEM(a,l)      SetMem(a,l,(CHAR8)BAD_POINTER)
41 
42 #else
43 
44     #define DBGSETMEM(a,l)
45 
46 #endif
47 
48 #define D_INIT        0x00000001          // Initialization style messages
49 #define D_WARN        0x00000002          // Warnings
50 #define D_LOAD        0x00000004          // Load events
51 #define D_FS          0x00000008          // EFI File system
52 #define D_POOL        0x00000010          // Alloc & Free's
53 #define D_PAGE        0x00000020          // Alloc & Free's
54 #define D_INFO        0x00000040          // Verbose
55 #define D_VAR         0x00000100          // Variable
56 #define D_PARSE       0x00000200          // Command parsing
57 #define D_BM          0x00000400          // Boot manager
58 #define D_BLKIO       0x00001000          // BlkIo Driver
59 #define D_BLKIO_ULTRA 0x00002000          // BlkIo Driver
60 #define D_NET         0x00004000          // SNI Driver
61 #define D_NET_ULTRA   0x00008000          // SNI Driver
62 #define D_TXTIN       0x00010000          // Simple Input Driver
63 #define D_TXTOUT      0x00020000          // Simple Text Output Driver
64 #define D_ERROR_ATA	  0x00040000		  		// ATA error messages
65 #define D_ERROR       0x80000000          // Error
66 
67 #define D_RESERVED    0x7fffC880          // Bits not reserved above
68 
69 //
70 // Current Debug level of the system, value of EFIDebug
71 //
72 //#define EFI_DBUG_MASK   (D_ERROR | D_WARN | D_LOAD | D_BLKIO | D_INIT)
73 #define EFI_DBUG_MASK   (D_ERROR)
74 
75 //
76 //
77 //
78 
79 #if EFI_DEBUG
80 
81     #define ASSERT(a)               if(!(a))       DBGASSERT(a)
82     #define ASSERT_LOCKED(l)        if(!(l)->Lock) DBGASSERT(l not locked)
83     #define ASSERT_STRUCT(p,t)      DBGASSERT(t not structure), p
84 
85 #else
86 
87     #define ASSERT(a)
88     #define ASSERT_LOCKED(l)
89     #define ASSERT_STRUCT(p,t)
90 
91 #endif
92 
93 //
94 // Prototypes
95 //
96 
97 INTN
98 DbgAssert (
99     CHAR8   *file,
100     INTN    lineno,
101     CHAR8   *string
102     );
103 
104 INTN
105 DbgPrint (
106     INTN    mask,
107     CHAR8   *format,
108     ...
109     );
110 
111 #endif
112 
113