svn will drive me nuts, part 1/x
[reactos.git] / drivers / bus / acpi / compbatt / compbatt.c
1 /*
2 * PROJECT: ReactOS Composite Battery Driver
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: boot/drivers/bus/acpi/compbatt/compbatt.c
5 * PURPOSE: Main Initialization Code and IRP Handling
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9 /* INCLUDES *******************************************************************/
10
11 #include "compbatt.h"
12
13 /* GLOBALS ********************************************************************/
14
15 ULONG CompBattDebug;
16
17 /* FUNCTIONS ******************************************************************/
18
19 NTSTATUS
20 NTAPI
21 CompBattOpenClose(IN PDEVICE_OBJECT DeviceObject,
22 IN PIRP Irp)
23 {
24 PAGED_CODE();
25 if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING OpenClose\n");
26
27 /* Complete the IRP with success */
28 Irp->IoStatus.Status = STATUS_SUCCESS;
29 Irp->IoStatus.Information = 0;
30 IofCompleteRequest(Irp, IO_NO_INCREMENT);
31
32 /* Return success */
33 if (CompBattDebug & 0x100) DbgPrint("CompBatt: Exiting OpenClose\n");
34 return STATUS_SUCCESS;
35 }
36
37 NTSTATUS
38 NTAPI
39 CompBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
40 IN PIRP Irp)
41 {
42 PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
43 NTSTATUS Status;
44 PAGED_CODE();
45 if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING System Control\n");
46
47 /* Are we attached yet? */
48 if (DeviceExtension->AttachedDevice)
49 {
50 /* Send it up the stack */
51 IoSkipCurrentIrpStackLocation(Irp);
52 Status = IoCallDriver(DeviceExtension->AttachedDevice, Irp);
53 }
54 else
55 {
56 /* We don't support WMI */
57 Status = STATUS_NOT_SUPPORTED;
58 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
59 IofCompleteRequest(Irp, IO_NO_INCREMENT);
60 }
61
62 /* Return status */
63 return Status;
64 }
65
66 NTSTATUS
67 NTAPI
68 CompBattMonitorIrpComplete(IN PDEVICE_OBJECT DeviceObject,
69 IN PIRP Irp,
70 IN PKEVENT Event)
71 {
72 UNIMPLEMENTED;
73 return STATUS_NOT_IMPLEMENTED;
74 }
75
76 NTSTATUS
77 NTAPI
78 CompBattMonitorIrpCompleteWorker(IN PCOMPBATT_BATTERY_ENTRY BatteryData)
79 {
80 UNIMPLEMENTED;
81 return STATUS_NOT_IMPLEMENTED;
82 }
83
84 NTSTATUS
85 NTAPI
86 CompBattRecalculateTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
87 {
88 UNIMPLEMENTED;
89 return STATUS_NOT_IMPLEMENTED;
90 }
91
92 NTSTATUS
93 NTAPI
94 CompBattIoctl(IN PDEVICE_OBJECT DeviceObject,
95 IN PIRP Irp)
96 {
97 PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
98 NTSTATUS Status;
99 if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING Ioctl\n");
100
101 /* Let the class driver handle it */
102 Status = BatteryClassIoctl(DeviceExtension->ClassData, Irp);
103 if (Status == STATUS_NOT_SUPPORTED)
104 {
105 /* It failed, try the next driver up the stack */
106 Irp->IoStatus.Status = Status;
107 IoSkipCurrentIrpStackLocation(Irp);
108 Status = IoCallDriver(DeviceExtension->AttachedDevice, Irp);
109 }
110
111 /* Return status */
112 if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING Ioctl\n");
113 return Status;
114 }
115
116 NTSTATUS
117 NTAPI
118 CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
119 OUT PULONG Tag)
120 {
121 UNIMPLEMENTED;
122 return STATUS_NOT_IMPLEMENTED;
123 }
124
125 NTSTATUS
126 NTAPI
127 CompBattDisableStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
128 {
129 UNIMPLEMENTED;
130 return STATUS_NOT_IMPLEMENTED;
131 }
132
133 NTSTATUS
134 NTAPI
135 CompBattSetStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
136 IN ULONG BatteryTag,
137 IN PBATTERY_NOTIFY BatteryNotify)
138 {
139 UNIMPLEMENTED;
140 return STATUS_NOT_IMPLEMENTED;
141 }
142
143 NTSTATUS
144 NTAPI
145 CompBattGetBatteryStatus(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
146 IN ULONG Tag)
147 {
148 UNIMPLEMENTED;
149 return STATUS_NOT_IMPLEMENTED;
150 }
151
152 NTSTATUS
153 NTAPI
154 CompBattQueryStatus(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
155 IN ULONG Tag,
156 IN PBATTERY_STATUS BatteryStatus)
157 {
158 UNIMPLEMENTED;
159 return STATUS_NOT_IMPLEMENTED;
160 }
161
162 NTSTATUS
163 NTAPI
164 CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInformation,
165 IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
166 {
167 UNIMPLEMENTED;
168 return STATUS_NOT_IMPLEMENTED;
169 }
170
171 NTSTATUS
172 NTAPI
173 CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
174 IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
175 {
176 UNIMPLEMENTED;
177 return STATUS_NOT_IMPLEMENTED;
178 }
179
180 NTSTATUS
181 NTAPI
182 CompBattGetEstimatedTime(OUT PULONG Time,
183 IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
184 {
185 UNIMPLEMENTED;
186 return STATUS_NOT_IMPLEMENTED;
187 }
188
189 NTSTATUS
190 NTAPI
191 CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION FdoExtension,
192 IN ULONG Tag,
193 IN BATTERY_QUERY_INFORMATION_LEVEL InfoLevel,
194 IN OPTIONAL LONG AtRate,
195 IN PVOID Buffer,
196 IN ULONG BufferLength,
197 OUT PULONG ReturnedLength)
198 {
199 UNIMPLEMENTED;
200 return STATUS_NOT_IMPLEMENTED;
201 }
202
203 NTSTATUS
204 NTAPI
205 DriverEntry(IN PDRIVER_OBJECT DriverObject,
206 IN PUNICODE_STRING RegistryPath)
207 {
208 /* Register add device routine */
209 DriverObject->DriverExtension->AddDevice = CompBattAddDevice;
210
211 /* Register other handlers */
212 DriverObject->MajorFunction[0] = CompBattOpenClose;
213 DriverObject->MajorFunction[2] = CompBattOpenClose;
214 DriverObject->MajorFunction[14] = CompBattIoctl;
215 DriverObject->MajorFunction[22] = CompBattPowerDispatch;
216 DriverObject->MajorFunction[23] = CompBattSystemControl;
217 DriverObject->MajorFunction[27] = CompBattPnpDispatch;
218
219 return STATUS_SUCCESS;
220 }
221
222 /* EOF */