1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7     FxIFR.h
8 
9 Abstract:
10 
11     This module contains the private IFR tracing definitions
12     The structures are common to the In-Flight Recorder (IFR)
13     and the IFR-related debug commands in wdfkd.dll.
14 
15 Environment:
16 
17     kernel mode and debug extensions
18 
19 Revision History:
20 
21 
22 --*/
23 
24 #ifndef _FXIFR_H
25 #define _FXIFR_H
26 
27 //
28 // This is maximum number of arguments a single message can capture.
29 // It reflects WPP_MAX_MOF_FIELDS value of 8 found in WPP trace support.
30 //
31 #define WDF_MAX_LOG_FIELDS              (8)
32 
33 //
34 // This is the longest allowable message retained in the IFR log.
35 //
36 #define WDF_MAX_IFR_MESSAGE_SIZE        (256)
37 
38 
39 //
40 // This is the maximum name length for the driver.
41 //
42 #define WDF_IFR_HEADER_NAME_LEN         (32)
43 
44 //
45 // Access macro for trace GUID BITs.
46 //
47 #define TRACE_BIT(a)   WPP_BIT_ ## a
48 
49 //
50 // Various GUIDs needed.
51 //
52 
53 //
54 // (Keep synch-ed with "KmdfTraceGuid" in fxtrace.h)
55 //
56 DEFINE_GUID (WdfTraceGuid,
57   0x544d4c9d, 0x942c, 0x46d5, 0xbf, 0x50, 0xdf, 0x5c, 0xd9, 0x52, 0x4a, 0x50);
58 
59 //
60 // GUID used to tag IFR log in crash dump.
61 //
62 DEFINE_GUID (WdfDumpGuid,
63   0x54c84888, 0x01d1, 0x4c1e, 0xbe, 0xd6, 0x28, 0x2c, 0x98, 0x24, 0x13, 0x03);
64 
65 //
66 // GUID used to tag drivers info in crash dump.
67 //
68 // {F87E4A4C-C5A1-4d2f-BFF0-D5DE63A5E4C3}
69 DEFINE_GUID(WdfDumpGuid2,
70 0xf87e4a4c, 0xc5a1, 0x4d2f, 0xbf, 0xf0, 0xd5, 0xde, 0x63, 0xa5, 0xe4, 0xc3);
71 
72 //
73 // This structure hold the current and previous 16-bit offsets into
74 // the IFR log.  These variable must be access together as a LONG
75 // via the InterlockedCompareExchange().
76 //
77 typedef struct _WDF_IFR_OFFSET {
78     union {
79         struct {
80             USHORT Current;
81             USHORT Previous;
82         } s;
83         LONG  AsLONG;
84     } u;
85 } WDF_IFR_OFFSET, *PWDF_IFR_OFFSET;
86 
87 
88 #define WDF_IFR_LOG_TAG 'gLxF'     // 'FxLg'
89 
90 //
91 // This is the IFR log header structure.  It is immediately followed
92 // by the log area itself.
93 //
94 typedef struct _WDF_IFR_HEADER {
95 
96     GUID            Guid;                   // WDF's GUID (WDF_TRACE_GUID)
97     PUCHAR          Base;                   // log data area base (not header)
98     ULONG           Size;                   // size of the log (1 page by default)
99     WDF_IFR_OFFSET  Offset;                 // current/previous offsets
100     LONG            Sequence;               // local sequence number
101 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
102     PLONG           SequenceNumberPointer;  // Global IFR Sequence Number
103 #endif
104     CHAR            DriverName[WDF_IFR_HEADER_NAME_LEN];
105 
106 } WDF_IFR_HEADER, *PWDF_IFR_HEADER;
107 
108 
109 #define WDF_IFR_RECORD_SIGNATURE 'RL'  // 'LR'
110 
111 typedef struct _WDF_IFR_RECORD {
112 
113     USHORT      Signature;        // 'LR'  Log Record signature
114     USHORT      Length;
115     LONG        Sequence;
116     USHORT      PrevOffset;       // offset to previous record
117     USHORT      MessageNumber;    // message number   see <GUID>.tmf
118     GUID        MessageGuid;      // message GUID     see <GUID>.tmf
119 
120 } WDF_IFR_RECORD, *PWDF_IFR_RECORD;
121 
122 
123 #endif // _FXIFR_H
124