I have a few questions about what you think you’re going to accomplish.
From what I understand of your undertaking, you’re going to fail.
First, let’s examine the notion that you can turn the device on simply by
running an ACPI control method. Do you control the BIOS? Is the device
sitting on a bus where some of the power management controls are outside of
ACPI? Do you know that the BIOS has independent control for this device?
Is it modeled with a _PS0 method or is it a power resource, where the power
will be turned off again the next time any device dependent on that power
resource get re-evaluated?
Second, ask yourself what state the device will be in even if you can manage
to run a control method that re-enables power to the device. What is its
state coming out of reset?
Third, ask yourself what the device driver will do when the device driver
thinks that the device is in D3 and you suddenly put it in D0. It won’t
receive any interrupts from the device, as it will have disabled them on the
way into D3. It won’t initiate any I/O to the device, as it thinks it is
turned off. From the point of view of the device driver stack, it will
appear to be turned off, even though you’ve turned it on.
Fourth, ask yourself what happens when you change state of a device (in any
dimension) when the device driver has put it into some other state. In my
experience, every device driver is written to assume that devices state in
the state that the driver put them into. A very few device drivers are good
at dealing with the case where the device is surprise-removed or where the
device fails at run time. Essentially none of them do anything other than
reset the device in response to detected state changes.
Jake Oshins
Windows Kernel Team
This message offers no warranties and confers no rights.
wrote in message news:xxxxx@ntdev…
Doron,
I have written a filter driver that sits directly on top of the miniport
driver for which I want to monitor the power. I build an IRP for
IOCTL_ACPI_EVAL_METHOD and use that irp and the miniport’s device object for
IoCallDriver. I fail with a 0xC0000001. I step through the disassembly and
find that I am failing in MmLockPageableSectionByHandle. The handle is
shifted right 20 bits and the two LSB’s are set to 0. Then, the result is
compared with 0x81 and 0x01. (I am conveying this last part from memory as I
am at home, so I might have a number wrong) Then the call returns to some
code that is not identified (no symbolic info) and the result ends up with
the 0xC0000001 going to the eax register. I did notice that since the two
LSB’s would be zeroed, the two comparisons would always be negative.
I searched a couple of days ago and found a couple of threads. Peter
suggested WDF and I will probably go that route. I would still like to
figure out why my WDM method didn’t work.
I am monitoring a wifi card to make sure it is always powered on. If it is
not, I am to send an ACPI IOCTL to turn the power back on. I was brought in
to make sure the power stays on barring main power loss. This code is a
second level of redundancy. It will probably not be asserted, but it is
there just in case. The PC is in an inconvenient location and mostly
unmanned.