1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7     FxTelemetryUm.hpp
8 
9 Abstract:
10 
11     This is header file for telemetry methods.
12 
13 Author:
14 
15 
16 
17 Environment:
18 
19     User mode only
20 
21 Revision History:
22 
23 Notes:
24 
25 --*/
26 
27 #pragma once
28 
29 #include "fxldrum.h"
30 
31 //
32 // Event name:  UmdfCensusEvtDeviceStart
33 //
34 // Source:      Mode agnostic (UMDF and KMDF)
35 //
36 // Description: Written when a FDO completes start successfully.
37 //
38 // Frequency:   If FX_TELEMETRY_ENABLED, once per driver session. This is tracked using the
39 //              DoOnceFlag in the telemetry context.
40 //
41 #define UMDF_CENSUS_EVT_WRITE_DEVICE_START(TraceHandle , Globals, DriverConfig, SetupClass, BusEnum, HwID, Manafacturer)    \
42             TraceLoggingWrite(TraceHandle,                                                                                  \
43                 "UmdfCensusEvtDeviceStart",                                                                                 \
44                 WDF_TELEMETRY_EVT_KEYWORDS,                                                                                 \
45                 WDF_CENSUS_EVT_DATA_COMMON(Globals),                                                                        \
46                 TraceLoggingString((Globals)->Public.DriverName,    "DriverServiceName"),                                   \
47                 TraceLoggingUmdfDriverConfigInfo(DriverConfig,      "DriverConfigInfo"),                                    \
48                 TraceLoggingWideString(SetupClass,                  "SetupClass"),                                          \
49                 TraceLoggingWideString(BusEnum,                     "BusEnumerator"),                                       \
50                 TraceLoggingWideString(HwID,                        "HardwareId"),                                          \
51                 TraceLoggingWideString(Manafacturer,                "ManufacturerString")                                   \
52             );
53 
54 //
55 // This is part of the data for UmdfCensusEvtDeviceStart event.
56 //
57 #define TraceLoggingUmdfDriverConfigInfo(info, fieldName)   \
58     \
59     TraceLoggingStruct(20, fieldName),  \
60     \
61     TraceLoggingUInt8(info.bitmap.IsFilter,                                 "IsFilter"                              ), \
62     TraceLoggingUInt8(info.bitmap.IsPowerPolicyOwner,                       "IsPowerPolicyOwner"                    ), \
63     TraceLoggingUInt8(info.bitmap.IsS0IdleWakeFromS0Enabled,                "IsS0IdleWakeFromS0Enabled"             ), \
64     TraceLoggingUInt8(info.bitmap.IsS0IdleUsbSSEnabled,                     "IsS0IdleUsbSSEnabled"                  ), \
65     TraceLoggingUInt8(info.bitmap.IsS0IdleSystemManaged,                    "IsS0IdleSystemManaged"                 ), \
66     \
67     TraceLoggingUInt8(info.bitmap.IsSxWakeEnabled,                          "IsSxWakeEnabled"                       ), \
68     TraceLoggingUInt8(info.bitmap.IsUsingLevelTriggeredLineInterrupt,       "IsUsingLevelTriggeredLineInterrupt"    ), \
69     TraceLoggingUInt8(info.bitmap.IsUsingEdgeTriggeredLineInterrupt,        "IsUsingEdgeTriggeredLineInterrupt"     ), \
70     TraceLoggingUInt8(info.bitmap.IsUsingMsiXOrSingleMsi22Interrupt,        "IsUsingMsiXOrSingleMsi22Interrupt"     ), \
71     TraceLoggingUInt8(info.bitmap.IsUsingMsi22MultiMessageInterrupt,        "IsUsingMsi22MultiMessageInterrupt"     ), \
72     \
73     TraceLoggingUInt8(info.bitmap.IsUsingMultipleInterrupt,                 "IsUsingMultipleInterrupt"              ), \
74     TraceLoggingUInt8(info.bitmap.IsDirectHardwareAccessAllowed,            "IsDirectHardwareAccessAllowed"         ), \
75     TraceLoggingUInt8(info.bitmap.IsUsingUserModemappingAccessMode,         "IsUsingUserModemappingAccessMode"      ), \
76     TraceLoggingUInt8(info.bitmap.IsKernelModeClientAllowed,                "IsKernelModeClientAllowed"             ), \
77     TraceLoggingUInt8(info.bitmap.IsNullFileObjectAllowed,                  "IsNullFileObjectAllowed"               ), \
78     \
79     TraceLoggingUInt8(info.bitmap.IsPoolingDisabled,                        "IsPoolingDisabled"                     ), \
80     TraceLoggingUInt8(info.bitmap.IsMethodNeitherActionCopy,                "IsMethodNeitherActionCopy"             ), \
81     TraceLoggingUInt8(info.bitmap.IsUsingDirectIoForReadWrite,              "IsUsingDirectIoForReadWrite"           ), \
82     TraceLoggingUInt8(info.bitmap.IsUsingDirectIoForIoctl,                  "IsUsingDirectIoForIoctl"               ), \
83     TraceLoggingUInt8(info.bitmap.IsUsingDriverWppRecorder,                 "IsUsingDriverWppRecorder"              )  \
84 
85 //
86 // bit-map for driver info stream
87 //
88 // When changing the structure, do update TraceLoggingUmdfDriverConfigInfo
89 // for fields name and TraceLoggingStruct(count) as well. It is good to keep
90 // fields order the same but it is not required.
91 //
92 union UFxTelemetryDriverInfo {
93     struct {
94         DWORD IsFilter                              : 1;
95         DWORD IsPowerPolicyOwner                    : 1;
96         DWORD IsS0IdleWakeFromS0Enabled             : 1;
97         DWORD IsS0IdleUsbSSEnabled                  : 1;
98         DWORD IsS0IdleSystemManaged                 : 1;
99         DWORD IsSxWakeEnabled                       : 1;
100         DWORD IsUsingLevelTriggeredLineInterrupt    : 1;
101         DWORD IsUsingEdgeTriggeredLineInterrupt     : 1;
102         DWORD IsUsingMsiXOrSingleMsi22Interrupt     : 1;
103         DWORD IsUsingMsi22MultiMessageInterrupt     : 1;
104         DWORD IsUsingMultipleInterrupt              : 1;
105         DWORD IsDirectHardwareAccessAllowed         : 1;
106         DWORD IsUsingUserModemappingAccessMode      : 1;
107         DWORD IsKernelModeClientAllowed             : 1;
108         DWORD IsNullFileObjectAllowed               : 1;
109         DWORD IsPoolingDisabled                     : 1;
110         DWORD IsMethodNeitherActionCopy             : 1;
111         DWORD IsUsingDirectIoForReadWrite           : 1;
112         DWORD IsUsingDirectIoForIoctl               : 1;
113         DWORD IsUsingDriverWppRecorder              : 1;
114     } bitmap;
115     DWORD Dword;
116 };
117 
118 typedef struct _UMDF_DRIVER_REGSITRY_INFO {
119     BOOLEAN IsKernelModeClientAllowed;
120     BOOLEAN IsNullFileObjectAllowed;
121     BOOLEAN IsMethodNeitherActionCopy;
122     BOOLEAN IsHostProcessSharingDisabled;
123 } UMDF_DRIVER_REGSITRY_INFO, *PUMDF_DRIVER_REGSITRY_INFO;
124 
125 VOID
126 GetDriverInfo(
127     _In_ FxDevice* Fdo,
128     _In_ PUMDF_DRIVER_REGSITRY_INFO RegInfo,
129     _Out_ UFxTelemetryDriverInfo* DriverInfo
130     );
131