xref: /freebsd/stand/efi/include/efidebug.h (revision 2a63c3be158216222d89a073dcbd6a72ee4aab5a)
1 #ifndef _EFI_DEBUG_H
2 #define _EFI_DEBUG_H
3 
4 /*++
5 
6 Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved
7 This software and associated documentation (if any) is furnished
8 under a license and may only be used or copied in accordance
9 with the terms of the license. Except as permitted by such
10 license, no part of this software or documentation may be
11 reproduced, stored in a retrieval system, or transmitted in any
12 form or by any means without the express written consent of
13 Intel Corporation.
14 
15 Module Name:
16 
17     efidebug.h
18 
19 Abstract:
20 
21     EFI library debug functions
22 
23 
24 
25 Revision History
26 
27 --*/
28 
29 extern UINTN     EFIDebug;
30 
31 #if EFI_DEBUG
32 
33     #define DBGASSERT(a)        DbgAssert(__FILE__, __LINE__, #a)
34     #define DEBUG(a)            DbgPrint a
35 
36 #else
37 
38     #define DBGASSERT(a)
39     #define DEBUG(a)
40 
41 #endif
42 
43 #if EFI_DEBUG_CLEAR_MEMORY
44 
45     #define DBGSETMEM(a,l)      SetMem(a,l,(CHAR8)BAD_POINTER)
46 
47 #else
48 
49     #define DBGSETMEM(a,l)
50 
51 #endif
52 
53 #define D_INIT        0x00000001          // Initialization style messages
54 #define D_WARN        0x00000002          // Warnings
55 #define D_LOAD        0x00000004          // Load events
56 #define D_FS          0x00000008          // EFI File system
57 #define D_POOL        0x00000010          // Alloc & Free's
58 #define D_PAGE        0x00000020          // Alloc & Free's
59 #define D_INFO        0x00000040          // Verbose
60 #define D_VARIABLE    0x00000100          // Variable
61 #define D_VAR         0x00000100          // Variable
62 #define D_BM          0x00000400          // Boot Manager
63 #define D_BLKIO       0x00001000          // BlkIo Driver
64 #define D_BLKIO_ULTRA 0x00002000          // BlkIo Driver
65 #define D_NET         0x00004000          // SNI Driver
66 #define D_NET_ULTRA   0x00008000          // SNI Driver
67 #define D_UNDI        0x00010000          // UNDI Driver
68 #define D_LOADFILE    0x00020000          // UNDI Driver
69 #define D_EVENT       0x00080000          // Event messages
70 
71 #define D_ERROR       0x80000000          // Error
72 
73 #define D_RESERVED    0x7ff40A80          // Bits not reserved above
74 
75 //
76 // Current Debug level of the system, value of EFIDebug
77 //
78 //#define EFI_DBUG_MASK   (D_ERROR | D_WARN | D_LOAD | D_BLKIO | D_INIT)
79 #define EFI_DBUG_MASK   (D_ERROR)
80 
81 //
82 //
83 //
84 
85 #if EFI_DEBUG
86 
87     #define ASSERT(a)               if(!(a))       DBGASSERT(a)
88     #define ASSERT_LOCKED(l)        if(!(l)->Lock) DBGASSERT(l not locked)
89     #define ASSERT_STRUCT(p,t)      DBGASSERT(t not structure), p
90 
91 #else
92 
93     #define ASSERT(a)
94     #define ASSERT_LOCKED(l)
95     #define ASSERT_STRUCT(p,t)
96 
97 #endif
98 
99 //
100 // Prototypes
101 //
102 
103 INTN
104 DbgAssert (
105     CHAR8   *file,
106     INTN    lineno,
107     CHAR8   *string
108     );
109 
110 INTN
111 DbgPrint (
112     INTN    mask,
113     CHAR8   *format,
114     ...
115     );
116 
117 #endif
118