1 /*++
2
3 Copyright (c) Microsoft Corporation
4
5 Module Name:
6
7 FxDeviceInitKm.cpp
8
9 Abstract:
10 Internals for WDFDEVICE_INIT
11
12 Author:
13
14
15
16
17 Environment:
18
19 Kernel mode only
20
21 Revision History:
22
23 --*/
24
25 #include "coreprivshared.hpp"
26
27 extern "C" {
28 // #include "FxDeviceInitKm.tmh"
29 }
30
31 VOID
SetPdo(__in FxDevice * Parent)32 WDFDEVICE_INIT::SetPdo(
33 __in FxDevice* Parent
34 )
35 {
36 InitType = FxDeviceInitTypePdo;
37
38 //
39 // Remember the parent so we can store it later in WdfDeviceCreate
40 //
41 Pdo.Parent = Parent;
42
43 //
44 // PDOs *must* have a name. By setting this flag, the driver writer
45 // does not need to know this
46 //
47 Characteristics |= FILE_AUTOGENERATED_DEVICE_NAME;
48
49 //
50 // By default, PDOs are not power pageable b/c they do not know how the
51 // stack above them will work. For a "closed" system where the bus driver
52 // knows the stack be loaded on its PDO, this may not be true and it
53 // can use WdfDeviceInitSetPowerPageable to set it back.
54 //
55 // In all current shipping OS's, if the parent is power pageable, the
56 // child must be power pagable as well.
57 //
58 if (Parent->IsPowerPageableCapable() == FALSE) {
59 PowerPageable = FALSE;
60 }
61 }
62
63 VOID
AssignIoType(_In_ PWDF_IO_TYPE_CONFIG IoTypeConfig)64 WDFDEVICE_INIT::AssignIoType(
65 _In_ PWDF_IO_TYPE_CONFIG IoTypeConfig
66 )
67 {
68 NTSTATUS status;
69
70 if (IoTypeConfig->ReadWriteIoType == WdfDeviceIoUndefined ||
71 IoTypeConfig->ReadWriteIoType > WdfDeviceIoDirect) {
72 status= STATUS_INVALID_PARAMETER;
73 DoTraceLevelMessage(
74 DriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
75 "Out of range Read/Write IoType %d, %!status!",
76 IoTypeConfig->ReadWriteIoType, status);
77 FxVerifierDbgBreakPoint(DriverGlobals);
78 return;
79 }
80
81 ReadWriteIoType = IoTypeConfig->ReadWriteIoType;
82
83 return;
84 }
85
86