ACPI!ACPIDetectPdoDevices函数对Device (ACAD)的处理
0: kd> g
Breakpoint 8 hit
eax=00000000 ebx=f743b620 ecx=f789a22c edx=00406000 esi=899aec70 edi=899aed90
eip=f74076b8 esp=f789a1f8 ebp=f789a250 iopl=0 nv up ei pl zr na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000246
ACPI!ACPIGet:
f74076b8 55 push ebp
0: kd> kc
#
00 ACPI!ACPIGet
01 ACPI!ACPIDetectPdoDevices
02 ACPI!ACPIRootIrpQueryBusRelations
03 ACPI!ACPIRootIrpQueryDeviceRelations
04 ACPI!ACPIDispatchIrp
05 nt!IofCallDriver
06 nt!IopSynchronousCall
07 nt!IopQueryDeviceRelations
08 nt!PipEnumerateDevice
09 nt!PipProcessDevNodeTree
0a nt!PipDeviceActionWorker
0b nt!PipRequestDeviceAction
0c nt!IopInitializeBootDrivers
0d nt!IoInitSystem
0e nt!Phase1Initialization
0f nt!PspSystemThreadStartup
10 nt!KiThreadStartup
0: kd> dv
Target = 0x899aec70
ObjectID = 0x4154535f
Flags = 0x20040802
SimpleArgument = 0x00000000
SimpleArgumentSize = 0
CallBackRoutine = 0x00000000
CallBackContext = 0x00000000
Buffer = 0xf789a22c
BufferSize = 0x00000000
0: kd> gu
Breakpoint 21 hit
eax=00000000 ebx=f743b938 ecx=00000000 edx=00002700 esi=899ae278 edi=899ae280
eip=f7407922 esp=f789a1a8 ebp=f789a1f4 iopl=0 nv up ei pl zr na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000246
ACPI!ACPIGet+0x26a:
f7407922 83c410 add esp,10h
0: kd> dt ACPI_GET_REQUEST 899ae278
+0x000 Flags : 0x20040802
+0x000 UFlags : __unnamed
+0x004 ObjectID : 0x4154535f
+0x008 ListEntry : _LIST_ENTRY [ 0xf743b940 - 0xf743b940 ]
+0x010 DeviceExtension : 0x899aec70 _DEVICE_EXTENSION
+0x014 AcpiObject : 0x899b4a70 _NSObj
+0x018 CallBackRoutine : (null)
+0x01c CallBackContext : (null)
+0x020 Buffer : 0xf789a22c -> (null)
+0x024 BufferSize : (null)
+0x028 Status : 0n0
+0x02c ResultData : _ObjData
0: kd> dx -id 0,0,899a2278 -r1 ((ACPI!_DEVICE_EXTENSION *)0x899aec70)
((ACPI!_DEVICE_EXTENSION *)0x899aec70) : 0x899aec70 [Type: _DEVICE_EXTENSION *]
[+0x000] Flags : 0x40600000000108 [Type: unsigned __int64]
[+0x000] UFlags [Type: __unnamed]
[+0x008] Signature : 0x5f534750 [Type: unsigned long]
[+0x00c] DebugFlags : 0x0 [Type: unsigned long]
[+0x010] DispatchTable : 0x0 [Type: IRP_DISPATCH_TABLE *]
[+0x014] WorkContext [Type: WORK_QUEUE_CONTEXT]
[+0x014] Fdo [Type: _FDO_DEVICE_EXTENSION]
[+0x014] Filter [Type: _FILTER_DEVICE_EXTENSION]
[+0x014] Pdo [Type: _PDO_DEVICE_EXTENSION]
[+0x058] WorkQueue [Type: EXTENSION_WORKER]
[+0x058] Button [Type: BUTTON_EXTENSION]
[+0x058] Thermal [Type: THERMAL_EXTENSION]
[+0x058] LinkNode [Type: LINK_NODE_EXTENSION]
[+0x058] Dock [Type: DOCK_EXTENSION]
[+0x058] Processor [Type: _PROCESSOR_DEVICE_EXTENSION]
[+0x088] DeviceState : Stopped (0) [Type: _ACPI_DEVICE_STATE]
[+0x08c] PreviousState : Stopped (0) [Type: _ACPI_DEVICE_STATE]
[+0x090] PowerInfo [Type: _ACPI_POWER_INFO]
[+0x10c] DeviceID : 0x897a3b50 : 0x41 [Type: unsigned char *]
[+0x10c] Address : 0x897a3b50 [Type: unsigned long]
[+0x110] InstanceID : 0x899c5508 : 0x31 [Type: unsigned char *]
[+0x114] ResourceList : 0x0 [Type: _CM_RESOURCE_LIST *]
[+0x118] PnpResourceList : 0x0 [Type: _ObjData *]
[+0x11c] OutstandingIrpCount : 1 [Type: long]
[+0x120] ReferenceCount : 4 [Type: long]
[+0x124] HibernatePathCount : 0 [Type: long]
[+0x128] RemoveEvent : 0x0 [Type: _KEVENT *]
[+0x12c] AcpiObject : 0x899b4a70 [Type: _NSObj *]
[+0x130] DeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x134] TargetDeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x138] PhysicalDeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x13c] ParentExtension : 0x89981a18 [Type: _DEVICE_EXTENSION *]
[+0x140] ChildDeviceList [Type: _LIST_ENTRY]
[+0x148] SiblingDeviceList [Type: _LIST_ENTRY]
[+0x150] EjectDeviceHead [Type: _LIST_ENTRY]
[+0x158] EjectDeviceList [Type: _LIST_ENTRY]
0: kd> db 0x899b4a70
899b4a70 04 48 9b 89 64 4c 9b 89-f0 f0 9a 89 b4 4a 9b 89 .H..dL.......J..
899b4a80 41 43 41 44 30 f3 9a 89-08 4a 9b 89 00 00 06 00 ACAD0....J......
899b4a90 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
899b4aa0 70 ec 9a 89 00 00 00 00-48 4e 53 4f 44 00 00 00 p.......HNSOD...
899b4ab0 00 f0 9a 89 fc 4b 9b 89-f8 4a 9b 89 70 4a 9b 89 .....K...J..pJ..
899b4ac0 00 00 00 00 5f 48 49 44-30 f3 9a 89 70 4a 9b 89 ...._HID0...pJ..
899b4ad0 00 00 02 00 00 00 00 00-00 00 00 00 09 00 00 00 ................
899b4ae0 f0 3c 9b 89 00 00 00 00-00 00 00 00 48 4e 53 4f .<..........HNSO
0: kd> dx -id 0,0,899a2278 -r1 (*((ACPI!_ObjData *)0x899ae2a4))
(*((ACPI!_ObjData *)0x899ae2a4)) [Type: _ObjData]
[+0x000] dwfData : 0x0 [Type: unsigned short]
[+0x002] dwDataType : 0x1 [Type: unsigned short]
[+0x004] dwRefCount : 0x0 [Type: unsigned long]
[+0x004] pdataBase : 0x0 [Type: _ObjData *]
[+0x008]dwDataValue : 0xf[Type: unsigned long]
[+0x008] uipDataValue : 0xf [Type: unsigned long]
[+0x008] pnsAlias : 0xf [Type: _NSObj *]
[+0x008] pdataAlias : 0xf [Type: _ObjData *]
[+0x008] powner : 0xf [Type: void *]
[+0x00c] dwDataLen : 0x0 [Type: unsigned long]
[+0x010] pbDataBuff : 0x0 [Type: unsigned char *]
Device (ACAD)
{
Name (_HID, "ACPI0003") // _HID: Hardware ID
Name (_UID, 0x01) // _UID: Unique ID
Name (_PCL, Package (0x01) // _PCL: Power Consumer List
{
\_SB
})
Method (_STA, 0, NotSerialized) // _STA: Status
{
Return (0x0F)
}
Method (_PSR, 0, NotSerialized) // _PSR: Power Source
{
Return (VMAP ())
}
}
参考:
DevNode 0x89a76008 for PDO 0x89df9568
InstancePath is "ACPI\ACPI0003\1"
ServiceName is "CmBatt"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
参考:
Windows 电源管理器定期从电池请求状态信息,包括剩余充电容量和当前消耗速率。
此请求源自电源管理器、更高级别的用户界面组件或应用程序。 电源管理器将请求转换为电池设备的 I/O 请求数据包 (IRP)。
当电池通过 ACPI 控制方法接口公开时,控制方法电池驱动程序 (cmbatt.sys) 将执行相应的 ACPI 控制方法。 对于状态信息,将执行 _BST(电池状态)方法。
参考:
Device (BAT2)
{
Name (_HID, EisaId ("PNP0C0A")) // _HID: Hardware ID
Name (_UID, 0x02) // _UID: Unique ID
Name (_PCL, Package (0x01) // _PCL: Power Consumer List
{
\_SB
})
Method (_STA, 0, NotSerialized) // _STA: Status
{
Return (VMPS (0x02))
}
Method (_BIF, 0, NotSerialized) // _BIF: Battery Information
{
Return (VMBB (0x02))
}
Method (_BST, 0, NotSerialized) // _BST: Battery Status
{
Return (VMBS (0x02))
}
}
参考: