efidebug.h revision 77943
1147191Sjkoshy/* $FreeBSD: head/sys/boot/efi/include/efidebug.h 77943 2001-06-09 16:49:51Z dfr $ */
2147191Sjkoshy#ifndef _EFI_DEBUG_H
3147191Sjkoshy#define _EFI_DEBUG_H
4147191Sjkoshy
5147191Sjkoshy/*++
6147191Sjkoshy
7147191SjkoshyCopyright (c) 1998  Intel Corporation
8147191Sjkoshy
9147191SjkoshyModule Name:
10147191Sjkoshy
11147191Sjkoshy    efidebug.h
12147191Sjkoshy
13147191SjkoshyAbstract:
14147191Sjkoshy
15147191Sjkoshy    EFI library debug functions
16147191Sjkoshy
17147191Sjkoshy
18147191Sjkoshy
19147191SjkoshyRevision History
20147191Sjkoshy
21147191Sjkoshy--*/
22147191Sjkoshy
23147191Sjkoshyextern UINTN     EFIDebug;
24147191Sjkoshy
25147191Sjkoshy#if EFI_DEBUG
26147191Sjkoshy
27147191Sjkoshy    #define DBGASSERT(a)        DbgAssert(__FILE__, __LINE__, #a)
28147191Sjkoshy    #define DEBUG(a)            DbgPrint a
29147191Sjkoshy
30147191Sjkoshy#else
31147191Sjkoshy
32147191Sjkoshy    #define DBGASSERT(a)
33147191Sjkoshy    #define DEBUG(a)
34147191Sjkoshy
35147191Sjkoshy#endif
36147191Sjkoshy
37147191Sjkoshy#if EFI_DEBUG_CLEAR_MEMORY
38147191Sjkoshy
39147191Sjkoshy    #define DBGSETMEM(a,l)      SetMem(a,l,(CHAR8)BAD_POINTER)
40147191Sjkoshy
41147191Sjkoshy#else
42147191Sjkoshy
43147191Sjkoshy    #define DBGSETMEM(a,l)
44147191Sjkoshy
45147191Sjkoshy#endif
46147191Sjkoshy
47147191Sjkoshy#define D_INIT        0x00000001          // Initialization style messages
48147191Sjkoshy#define D_WARN        0x00000002          // Warnings
49147191Sjkoshy#define D_LOAD        0x00000004          // Load events
50147191Sjkoshy#define D_FS          0x00000008          // EFI File system
51147191Sjkoshy#define D_POOL        0x00000010          // Alloc & Free's
52147191Sjkoshy#define D_PAGE        0x00000020          // Alloc & Free's
53147191Sjkoshy#define D_INFO        0x00000040          // Verbose
54147191Sjkoshy#define D_VAR         0x00000100          // Variable
55147191Sjkoshy#define D_PARSE       0x00000200          // Command parsing
56147191Sjkoshy#define D_BM          0x00000400          // Boot manager
57147191Sjkoshy#define D_BLKIO       0x00001000          // BlkIo Driver
58147191Sjkoshy#define D_BLKIO_ULTRA 0x00002000          // BlkIo Driver
59147191Sjkoshy#define D_NET         0x00004000          // SNI Driver
60147191Sjkoshy#define D_NET_ULTRA   0x00008000          // SNI Driver
61147191Sjkoshy#define D_TXTIN       0x00010000          // Simple Input Driver
62147191Sjkoshy#define D_TXTOUT      0x00020000          // Simple Text Output Driver
63147191Sjkoshy#define D_ERROR_ATA	  0x00040000		  		// ATA error messages
64147191Sjkoshy#define D_ERROR       0x80000000          // Error
65147191Sjkoshy
66147191Sjkoshy#define D_RESERVED    0x7fffC880          // Bits not reserved above
67147191Sjkoshy
68147191Sjkoshy//
69147191Sjkoshy// Current Debug level of the system, value of EFIDebug
70147191Sjkoshy//
71147191Sjkoshy//#define EFI_DBUG_MASK   (D_ERROR | D_WARN | D_LOAD | D_BLKIO | D_INIT)
72147191Sjkoshy#define EFI_DBUG_MASK   (D_ERROR)
73147191Sjkoshy
74147191Sjkoshy//
75147191Sjkoshy//
76147191Sjkoshy//
77147191Sjkoshy
78147191Sjkoshy#if EFI_DEBUG
79147191Sjkoshy
80147191Sjkoshy    #define ASSERT(a)               if(!(a))       DBGASSERT(a)
81147191Sjkoshy    #define ASSERT_LOCKED(l)        if(!(l)->Lock) DBGASSERT(l not locked)
82147191Sjkoshy    #define ASSERT_STRUCT(p,t)      DBGASSERT(t not structure), p
83147191Sjkoshy
84147191Sjkoshy#else
85147191Sjkoshy
86147191Sjkoshy    #define ASSERT(a)
87147191Sjkoshy    #define ASSERT_LOCKED(l)
88147191Sjkoshy    #define ASSERT_STRUCT(p,t)
89147191Sjkoshy
90147191Sjkoshy#endif
91147191Sjkoshy
92147191Sjkoshy//
93147191Sjkoshy// Prototypes
94147191Sjkoshy//
95147191Sjkoshy
96147191SjkoshyINTN
97147191SjkoshyDbgAssert (
98147191Sjkoshy    CHAR8   *file,
99147191Sjkoshy    INTN    lineno,
100147191Sjkoshy    CHAR8   *string
101147191Sjkoshy    );
102147191Sjkoshy
103147191SjkoshyINTN
104147191SjkoshyDbgPrint (
105147191Sjkoshy    INTN    mask,
106147191Sjkoshy    CHAR8   *format,
107147191Sjkoshy    ...
108147191Sjkoshy    );
109147191Sjkoshy
110147191Sjkoshy#endif
111147191Sjkoshy