- split logoff and shutdown resources
[reactos.git] / reactos / ntoskrnl / io / pnpreport.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/io/pnpreport.c
6 * PURPOSE: Device Changes Reporting functions
7 *
8 * PROGRAMMERS: Filip Navara (xnavara@volny.cz)
9 */
10
11 /* INCLUDES ******************************************************************/
12
13 #define NDEBUG
14 #include <ntoskrnl.h>
15 #include <internal/debug.h>
16
17 /* FUNCTIONS *****************************************************************/
18
19 /*
20 * @implemented
21 */
22 NTSTATUS
23 STDCALL
24 IoReportDetectedDevice(
25 IN PDRIVER_OBJECT DriverObject,
26 IN INTERFACE_TYPE LegacyBusType,
27 IN ULONG BusNumber,
28 IN ULONG SlotNumber,
29 IN PCM_RESOURCE_LIST ResourceList,
30 IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL,
31 IN BOOLEAN ResourceAssigned,
32 IN OUT PDEVICE_OBJECT *DeviceObject)
33 {
34 PDEVICE_NODE DeviceNode;
35 PDEVICE_OBJECT Pdo;
36 NTSTATUS Status = STATUS_SUCCESS;
37
38 DPRINT("IoReportDetectedDevice (DeviceObject %p, *DeviceObject %p)\n",
39 DeviceObject, DeviceObject ? *DeviceObject : NULL);
40
41 /* if *DeviceObject is not NULL, we must use it as a PDO,
42 * and don't create a new one.
43 */
44 if (DeviceObject && *DeviceObject)
45 Pdo = *DeviceObject;
46 else
47 {
48 /* create a new PDO and return it in *DeviceObject */
49 Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode);
50 if (!NT_SUCCESS(Status))
51 {
52 DPRINT("IopCreateDeviceNode() failed (Status 0x%08lx)\n", Status);
53 return Status;
54 }
55 Pdo = DeviceNode->PhysicalDeviceObject;
56 if (DeviceObject)
57 *DeviceObject = Pdo;
58 }
59
60 /* we don't need to call AddDevice and send IRP_MN_START_DEVICE */
61
62 /* FIXME: save this device into the root-enumerated list, so this
63 * device would be detected as a PnP device during next startups.
64 */
65
66 return Status;
67 }
68
69 /*
70 * @unimplemented
71 */
72 NTSTATUS
73 STDCALL
74 IoReportResourceForDetection(
75 IN PDRIVER_OBJECT DriverObject,
76 IN PCM_RESOURCE_LIST DriverList OPTIONAL,
77 IN ULONG DriverListSize OPTIONAL,
78 IN PDEVICE_OBJECT DeviceObject OPTIONAL,
79 IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
80 IN ULONG DeviceListSize OPTIONAL,
81 OUT PBOOLEAN ConflictDetected)
82 {
83 static int warned = 0;
84 if (!warned)
85 {
86 DPRINT1("IoReportResourceForDetection partly implemented\n");
87 warned = 1;
88 }
89
90 *ConflictDetected = FALSE;
91
92 /* FIXME: Manually indicate conflicts with KD Ports */
93 if (DriverList)
94 {
95 if (KdpDetectConflicts(DriverList))
96 {
97 *ConflictDetected = TRUE;
98 return STATUS_CONFLICTING_ADDRESSES;
99 }
100 }
101
102 if (PopSystemPowerDeviceNode != NULL && DriverListSize > 0)
103 {
104 /* We hope legacy devices will be enumerated by ACPI */
105 *ConflictDetected = TRUE;
106 return STATUS_CONFLICTING_ADDRESSES;
107 }
108 return STATUS_SUCCESS;
109 }
110
111 /*
112 * @unimplemented
113 */
114 NTSTATUS
115 STDCALL
116 IoReportTargetDeviceChange(
117 IN PDEVICE_OBJECT PhysicalDeviceObject,
118 IN PVOID NotificationStructure)
119 {
120 DPRINT1("IoReportTargetDeviceChange called (UNIMPLEMENTED)\n");
121 return STATUS_NOT_IMPLEMENTED;
122 }
123
124 /*
125 * @unimplemented
126 */
127 NTSTATUS
128 STDCALL
129 IoReportTargetDeviceChangeAsynchronous(
130 IN PDEVICE_OBJECT PhysicalDeviceObject,
131 IN PVOID NotificationStructure,
132 IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL,
133 IN PVOID Context OPTIONAL)
134 {
135 DPRINT1("IoReportTargetDeviceChangeAsynchronous called (UNIMPLEMENTED)\n");
136 return STATUS_NOT_IMPLEMENTED;
137 }
138
139 /* EOF */