ACPI methods from KM

  • Thread starter Thread starter Archimedes.Syracuse
  • Start date Start date
A

Archimedes.Syracuse

Guest
Hello. I'm having trouble with calling ACPI methods from a KM driver. Always getting err 0xc0000034 (Object Name not found)

For testing purposes, I am just using root ACPI methods. Here is one under \ and takes 0 args.


DefinitionBlock ("DSDT.AML", "DSDT", 0x02, "aaaaaa", "8724 ", 0x00000000){
...
Method(GTOS, 0, Serialized){ ... }
...
}


I call this in the driver by creating a device object and attaching to the ACPI device stack via:

RtlInitUnicodeString(&TargetDeviceName, L"\\DosDevices\\ACPI_ROOT_OBJECT");
IoGetDeviceObjectPointer(&TargetDeviceName, FILE_READ_DATA, &pFileObject, &pTargetPdo);
pTargetStack = IoAttachDeviceToDeviceStack(pOurFdo, pTargetPdo);
acpiInBuf.Signature = ACPI_EVAL_INPUT_BUFFER_SIGNATURE;
acpiInBuf.MethodNameAsUlong = (ULONG)('GTOS');
pIrp = IoBuildDeviceIoControlRequest(IOCTL_ACPI_EVAL_METHOD,
pTargetStack,
&acpiInBuf,
sizeof(ACPI_EVAL_INPUT_BUFFER),
&acpiOutBuf,
sizeof(ACPI_EVAL_OUTPUT_BUFFER),
FALSE,
&kEvent,
&ioStatus);
status = IoCallDriver(pTargetStack, pIrp);

And I'm definitely attached to the ACPI stack:

1: kd> !devstack @@(pOurFdo)
!DevObj !DrvObj !DevExt ObjectName
> ffff9a840c0f9040 \Driver\BootDrv 00000000
ffff9a8409bfdc40 \Driver\ACPI ffff9a8409bfd840
ffff9a8408fd2bf0 \Driver\ACPI_HAL ffff9a8408fd2d40 00000011
// Where pTargetStack = 0xffff9a84`09bfdc40 Device for "\Driver\ACPI"

But IoCallDriver() always returns 0xc0000034 - Object Name not found.

I've also manually edited the pTargetStack as a test and set it directly to lowest PDO - ACPI_HAL and that also fails, but with a different error 0xc0000010 (The specified request is not a valid operation for the target device). But I assume this is not the correct way.

Any help? Is my attaching to that ACPI device correct? What does that error even mean?

Continue reading...
 
Back
Top