ReactOS 0.4.15-dev-8096-ga0eec98
fxwatchdog.hpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft. All rights reserved.
4
5Module Name:
6
7 FxWatchDog.hpp
8
9Abstract:
10
11 This module implements the watchdog utility class for the power and power
12 policy state machines
13
14Author:
15
16
17
18Environment:
19
20 Both kernel and user mode
21
22Revision History:
23
24--*/
25
26#ifndef __FX_WATCHDOG__
27#define __FX_WATCHDOG__
28
29struct FxWatchdog {
31 __in FxPkgPnp* PkgPnp
32 )
33 {
34 m_PkgPnp = PkgPnp;
35 }
36
37 VOID
40 )
41 {
44
45 if (State & WdfDevStateNP) {
46 //
47 // This is a non-pageable state. So we set the timer watchdog.
48 // If it fires, it means that the driver stalled, probably due
49 // to a page fault, which means that the whole machine is wedged.
50 // We will then attempt to put the failure in the trace log
51 // and bring the machine down, hopefully getting the reason we
52 // stopped responding into the crashdump. (This will probably only work
53 // if the machine is hibernating.)
54 //
55 // If the state function returns, then we'll cancel the timer
56 // and no love will be lost.
57 //
59
60 //
61 // This code is not used in UM. Hence we can assert and assume that
62 // timer start will always be successful.
63 //
65
67
69
71 //
72 // 24 hours:
73 // 60 = to minutes
74 // 60 = to hours
75 // 24 = number of hours
76 //
77 time.QuadPart = WDF_REL_TIMEOUT_IN_SEC(60 * 60 * 24);
78 }
79 else {
80 //
81 // 10 minutes from now (same as the Vista timeout)
82 //
83 time.QuadPart = WDF_REL_TIMEOUT_IN_SEC(60 * 10);
84 }
85
87 }
88 }
89
90 VOID
93 )
94 {
95 if (State & WdfDevStateNP) {
96 //
97 // The state was successfully handled without the timer expiring.
98 // We don't care about the return code in this case.
99 //
100 (void) m_Timer.Stop();
101 }
102 }
103
104 static
107
109
111
113};
114
115#endif // __FX_WATCHDOG__
116
LONG NTSTATUS
Definition: precomp.h:26
SharedPowerData m_SharedPower
Definition: fxpkgpnp.hpp:4161
_Must_inspect_result_ __inline BOOLEAN Stop(VOID)
Definition: mxtimerkm.h:273
__inline VOID Start(__in LARGE_INTEGER DueTime, __in ULONG TolerableDelay=0)
Definition: mxtimerkm.h:251
CHECK_RETURN_IF_USER_MODE __inline NTSTATUS Initialize(__in_opt PVOID TimerContext, __in MdDeferredRoutine TimerCallback, __in LONG Period)
Definition: mxtimerkm.h:119
static __inline MxThread MxGetCurrentThread()
Definition: mxgeneralkm.h:61
#define __in
Definition: dbghelp.h:35
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define WDF_VERIFY_KM_ONLY_CODE()
Definition: fxmacros.hpp:298
#define FX_ASSERT_AND_ASSUME_FOR_PREFAST(b)
Definition: fxmacros.hpp:284
__u16 time
Definition: mkdosfs.c:8
KDEFERRED_ROUTINE MdDeferredRoutineType
Definition: mxkm.h:35
FxPkgPnp * m_PkgPnp
Definition: fxwatchdog.hpp:110
static MdDeferredRoutineType _WatchdogDpc
Definition: fxwatchdog.hpp:106
FxWatchdog(__in FxPkgPnp *PkgPnp)
Definition: fxwatchdog.hpp:30
MxTimer m_Timer
Definition: fxwatchdog.hpp:108
VOID StartTimer(__in ULONG State)
Definition: fxwatchdog.hpp:38
MxThread m_CallingThread
Definition: fxwatchdog.hpp:112
VOID CancelTimer(__in ULONG State)
Definition: fxwatchdog.hpp:91
BOOLEAN m_ExtendWatchDogTimer
Definition: fxpkgpnp.hpp:196
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59
FORCEINLINE LONGLONG WDF_REL_TIMEOUT_IN_SEC(_In_ ULONGLONG Time)
Definition: wdfcore.h:62
@ WdfDevStateNP
Definition: wdfdevice.h:56