Author: sir_richard
Date: Wed Mar 24 01:33:50 2010
New Revision: 46383
URL:
http://svn.reactos.org/svn/reactos?rev=46383&view=rev
Log:
[CMBATT]: Implement _UID and _BTP ACPI method calls.
Modified:
trunk/reactos/drivers/bus/acpi/cmbatt/cmexec.c
Modified: trunk/reactos/drivers/bus/acpi/cmbatt/cmexec.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/cmbatt/cm…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/cmbatt/cmexec.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/acpi/cmbatt/cmexec.c [iso-8859-1] Wed Mar 24 01:33:50 2010
@@ -9,7 +9,6 @@
/* INCLUDES *******************************************************************/
#include "cmbatt.h"
-#include "ntstatus.h"
/* FUNCTIONS ******************************************************************/
@@ -151,8 +150,8 @@
NTSTATUS
NTAPI
-CmBattGetPsrData(PDEVICE_OBJECT DeviceObject,
- PULONG PsrData)
+CmBattGetPsrData(INP DEVICE_OBJECT DeviceObject,
+ OUT PULONG PsrData)
{
NTSTATUS Status;
ACPI_EVAL_OUTPUT_BUFFER OutputBuffer;
@@ -174,9 +173,9 @@
Status = CmBattSendDownStreamIrp(DeviceObject,
IOCTL_ACPI_EVAL_METHOD,
&InputBuffer,
- sizeof(ACPI_EVAL_INPUT_BUFFER),
+ sizeof(InputBuffer),
&OutputBuffer,
- sizeof(ACPI_EVAL_OUTPUT_BUFFER));
+ sizeof(OutputBuffer));
if (NT_SUCCESS(Status))
{
/* Read the result */
@@ -196,33 +195,15 @@
NTSTATUS
NTAPI
-CmBattGetBifData(PCMBATT_DEVICE_EXTENSION DeviceExtension,
- PACPI_BIF_DATA BifData)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-NTSTATUS
-NTAPI
-CmBattGetBstData(PCMBATT_DEVICE_EXTENSION DeviceExtension,
- PACPI_BST_DATA BstData)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-NTSTATUS
-NTAPI
-CmBattGetStaData(PDEVICE_OBJECT DeviceObject,
- PULONG StaData)
+CmBattGetStaData(IN PDEVICE_OBJECT DeviceObject,
+ OUT PULONG StaData)
{
NTSTATUS Status;
ACPI_EVAL_OUTPUT_BUFFER OutputBuffer;
ACPI_EVAL_INPUT_BUFFER InputBuffer;
PAGED_CODE();
if (CmBattDebug & 0x40)
- DbgPrint("CmBattGetPsrData: Entered with Pdo %x Tid %x\n",
+ DbgPrint("CmBattGetStaData: Entered with Pdo %x Tid %x\n",
DeviceObject, KeGetCurrentThread());
/* Initialize to zero */
@@ -237,20 +218,20 @@
Status = CmBattSendDownStreamIrp(DeviceObject,
IOCTL_ACPI_EVAL_METHOD,
&InputBuffer,
- sizeof(ACPI_EVAL_INPUT_BUFFER),
+ sizeof(InputBuffer),
&OutputBuffer,
- sizeof(ACPI_EVAL_OUTPUT_BUFFER));
+ sizeof(OutputBuffer));
if (NT_SUCCESS(Status))
{
/* Read the result */
Status = GetDwordElement(OutputBuffer.Argument, StaData);
if (CmBattDebug & 0x440)
- DbgPrint("CmBattGetPsrData: _STA method returned %x \n",
*StaData);
+ DbgPrint("CmBattGetStaData: _STA method returned %x \n",
*StaData);
}
else if (CmBattDebug & 0x44C)
{
/* Failure */
- DbgPrint("CmBattGetPsrData: Failed _STA method - Status (0x%x)\n",
Status);
+ DbgPrint("CmBattGetStaData: Failed _STA method - Status (0x%x)\n",
Status);
Status = STATUS_NO_SUCH_DEVICE;
}
@@ -260,20 +241,98 @@
NTSTATUS
NTAPI
-CmBattGetUniqueId(PDEVICE_OBJECT DeviceObject,
- PULONG UniqueId)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-NTSTATUS
-NTAPI
-CmBattSetTripPpoint(PCMBATT_DEVICE_EXTENSION DeviceExtension,
- ULONG AlarmValue)
+CmBattGetUniqueId(IN PDEVICE_OBJECT DeviceObject,
+ OUT PULONG UniqueId)
+{
+ NTSTATUS Status;
+ ACPI_EVAL_OUTPUT_BUFFER OutputBuffer;
+ ACPI_EVAL_INPUT_BUFFER InputBuffer;
+ PAGED_CODE();
+ if (CmBattDebug & 0x40)
+ DbgPrint("CmBattGetUniqueId: Entered with Pdo %x Tid %x\n",
+ DeviceObject, KeGetCurrentThread());
+
+ /* Initialize to zero */
+ ASSERT(UniqueId != NULL);
+ *UniqueId = 0;
+
+ /* Request the _PSR method */
+ *(PULONG)InputBuffer.MethodName = 'DIU_';
+ InputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIGNATURE;
+
+ /* Send it to ACPI */
+ Status = CmBattSendDownStreamIrp(DeviceObject,
+ IOCTL_ACPI_EVAL_METHOD,
+ &InputBuffer,
+ sizeof(InputBuffer),
+ &OutputBuffer,
+ sizeof(OutputBuffer));
+ if (NT_SUCCESS(Status))
+ {
+ /* Read the result */
+ Status = GetDwordElement(OutputBuffer.Argument, UniqueId);
+ if (CmBattDebug & 0x440)
+ DbgPrint("CmBattGetUniqueId: _UID method returned %x \n",
*UniqueId);
+ }
+ else if (CmBattDebug & 0x44C)
+ {
+ /* Failure */
+ DbgPrint("CmBattGetUniqueId: Failed _UID method - Status (0x%x)\n",
Status);
+ Status = STATUS_NO_SUCH_DEVICE;
+ }
+
+ /* Return status */
+ return Status;
+}
+
+NTSTATUS
+NTAPI
+CmBattSetTripPpoint(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
+ IN ULONG AlarmValue)
+{
+ NTSTATUS Status;
+ ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER InputBuffer;
+ PAGED_CODE();
+ if (CmBattDebug & 0x440)
+ DbgPrint("CmBattSetTripPpoint: _BTP Alarm Value %x Device %x Tid
%x\n",
+ AlarmValue, DeviceExtension->DeviceId, KeGetCurrentThread);
+
+ /* Request the _BTP method */
+ *(PULONG)InputBuffer.MethodName = 'PTB_';
+ InputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE;
+ InputBuffer.IntegerArgument = AlarmValue;
+
+ /* Send it to ACPI */
+ Status = CmBattSendDownStreamIrp(DeviceExtension->AttachedDevice,
+ IOCTL_ACPI_EVAL_METHOD,
+ &InputBuffer,
+ sizeof(InputBuffer),
+ NULL,
+ 0);
+ if (!(NT_SUCCESS(Status)) && (CmBattDebug & 0x440))
+ DbgPrint("CmBattSetTripPpoint: Failed _BTP method on device %x - Status
(0x%x)\n",
+ DeviceExtension->DeviceId, Status);
+
+ /* Return status */
+ return Status;
+}
+
+NTSTATUS
+NTAPI
+CmBattGetBifData(PCMBATT_DEVICE_EXTENSION DeviceExtension,
+ PACPI_BIF_DATA BifData)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
-
+
+NTSTATUS
+NTAPI
+CmBattGetBstData(PCMBATT_DEVICE_EXTENSION DeviceExtension,
+ PACPI_BST_DATA BstData)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
/* EOF */