nt!PipProcessStartPhase3函数中的nt!PiProcessQueryDeviceState对节点_SB的处理
NTSTATUS
PipProcessStartPhase3(
IN PDEVICE_NODE DeviceNode
)
{
IopQueryAndSaveDeviceNodeCapabilities(DeviceNode);
status = PiProcessQueryDeviceState(deviceObject);
//
// The device has been started, attempt to enumerate the device.
//
PpSetPlugPlayEvent( &GUID_DEVICE_ARRIVAL,
DeviceNode->PhysicalDeviceObject);
0: kd> p
Breakpoint 81 hit
eax=0000001b ebx=00000000 ecx=89981f38 edx=899bf5b0 esi=899bf5b0 edi=89981b98
eip=f7403f70 esp=f789a290 ebp=f789a2a8 iopl=0 nv up ei ng nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000286
ACPI!ACPIDispatchIrp:
f7403f70 55 push ebp
0: kd> kc
#
00 ACPI!ACPIDispatchIrp
01 nt!IofCallDriver
02 nt!IopSynchronousCall
03 nt!IopQueryDeviceState
04 nt!PiProcessQueryDeviceState
05 nt!PipProcessStartPhase3
06 nt!PipProcessDevNodeTree
07 nt!PipDeviceActionWorker
08 nt!PipRequestDeviceAction
09 nt!IopInitializeBootDrivers
0a nt!IoInitSystem
0b nt!Phase1Initialization
0c nt!PspSystemThreadStartup
0d nt!KiThreadStartup
0: kd> dv
DeviceObject = 0x89981b98 Device for "\Driver\ACPI"
Irp = 0x899bf5b0
removeEvent = struct _KEVENT
dispatchTable = 0xf743826c
deviceExtension = 0x89981a18
0: kd> !Irp 0x899bf5b0
Irp is active with 2 stacks 2 is current (= 0x899bf644)
No Mdl: No System Buffer: Thread 899a1020: Irp stack trace.
cmd flg cl Device File Completion-Context
[N/A(0), N/A(0)]
0 0 00000000 00000000 00000000-00000000
Args: 00000000 00000000 00000000 00000000
>[IRP_MJ_PNP(1b), IRP_MN_QUERY_PNP_DEVICE_STATE(14)]
0 0 89981b98 00000000 00000000-00000000
\Driver\ACPI
Args: 00000000 00000000 00000000 00000000
case IRP_MJ_PNP:
if (minorFunction == IRP_MN_START_DEVICE) {
//
// Dispatch to start device handler
//
dispatch = dispatchTable->PnpStartDevice;
} else if (minorFunction < (ACPIDispatchPnpTableSize-1)) {
//
// Dispatch based on minor function. Not that we don't store
// IRP_MN_START_DEVICE (0x0) in this table, so we have to
// sub one from the minor code
//
dispatch = dispatchTable->Pnp[minorFunction];
}
0: kd> dds f745b000
f745b000 00000000
f745b004 f744f1f4 ACPI!ACPIRootIrpQueryRemoveOrStopDevice [d:\srv03rtm\base\busdrv\acpi\driver\nt\root.c @ 923]
f745b008 f740f616 ACPI!ACPIRootIrpRemoveDevice [d:\srv03rtm\base\busdrv\acpi\driver\nt\root.c @ 992]
f745b00c f744e76c ACPI!ACPIRootIrpCancelRemoveOrStopDevice [d:\srv03rtm\base\busdrv\acpi\driver\nt\root.c @ 63]
f745b010 f744f636 ACPI!ACPIRootIrpStopDevice [d:\srv03rtm\base\busdrv\acpi\driver\nt\root.c @ 1413]
f745b014 f744f1f4 ACPI!ACPIRootIrpQueryRemoveOrStopDevice [d:\srv03rtm\base\busdrv\acpi\driver\nt\root.c @ 923] 5
f745b018 f744e76c ACPI!ACPIRootIrpCancelRemoveOrStopDevice [d:\srv03rtm\base\busdrv\acpi\driver\nt\root.c @ 63]
f745b01c f744edca ACPI!ACPIRootIrpQueryDeviceRelations [d:\srv03rtm\base\busdrv\acpi\driver\nt\root.c @ 485]
f745b020 f744f032 ACPI!ACPIRootIrpQueryInterface [d:\srv03rtm\base\busdrv\acpi\driver\nt\root.c @ 670]
f745b024 f744eb42 ACPI!ACPIRootIrpQueryCapabilities [d:\srv03rtm\base\busdrv\acpi\driver\nt\root.c @ 312]
f745b028 f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380] 10
f745b02c f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380]
f745b030 f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380]
f745b034 f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380]
f745b038 f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380]
f745b03c f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380] 15
f745b040 f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380]
f745b044 f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380]
f745b048 f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380]
f745b04c f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380]
f745b050 f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380] 20
f745b054 f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380]
f745b058 f74414e2 ACPI!ACPIFilterIrpDeviceUsageNotification [d:\srv03rtm\base\busdrv\acpi\driver\nt\filter.c @ 130]
f745b05c f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380]
f745b060 f7403358 ACPI!ACPIDispatchForwardIrp [d:\srv03rtm\base\busdrv\acpi\driver\nt\dispatch.c @ 380]
f745b064 00000000 25
f745b068 00000000
f745b06c f743de12 ACPI!ACPIBusIrpQueryRemoveOrStopDevice [d:\srv03rtm\base\busdrv\acpi\driver\nt\bus.c @ 2074]
f745b070 f73fdfc6 ACPI!ACPIBusIrpRemoveDevice [d:\srv03rtm\base\busdrv\acpi\driver\nt\bus.c @ 2849]
f745b074 f743d332 ACPI!ACPIBusIrpCancelRemoveOrStopDevice [d:\srv03rtm\base\busdrv\acpi\driver\nt\bus.c @ 901]
f745b078 f743ec84 ACPI!ACPIBusIrpStopDevice [d:\srv03rtm\base\busdrv\acpi\driver\nt\bus.c @ 3615] 30
f745b07c f743de12 ACPI!ACPIBusIrpQueryRemoveOrStopDevice [d:\srv03rtm\base\busdrv\acpi\driver\nt\bus.c @ 2074]
0: kd> dv
//
// Reference the device
//
InterlockedIncrement(&deviceExtension->OutstandingIrpCount);
//
// Dispatch to handler, then remove our reference
//
status = dispatch (DeviceObject, Irp);
0: kd> kc
#
00 ACPI!ACPIDispatchForwardIrp
01 ACPI!ACPIDispatchIrp
02 nt!IofCallDriver
03 nt!IopSynchronousCall
04 nt!IopQueryDeviceState
05 nt!PiProcessQueryDeviceState
06 nt!PipProcessStartPhase3
07 nt!PipProcessDevNodeTree
08 nt!PipDeviceActionWorker
09 nt!PipRequestDeviceAction
0a nt!IopInitializeBootDrivers
0b nt!IoInitSystem
0c nt!Phase1Initialization
0d nt!PspSystemThreadStartup
0e nt!KiThreadStartup
0: kd> dv
DeviceObject = 0x89981b98 Device for "\Driver\ACPI"
Irp = 0x899bf5b0
0: kd> dx -r1 ((ACPI!_DEVICE_OBJECT *)0x89981b98)
((ACPI!_DEVICE_OBJECT *)0x89981b98) : 0x89981b98 : Device for "\Driver\ACPI" [Type: _DEVICE_OBJECT *]
[<Raw View>] [Type: _DEVICE_OBJECT]
Flags : None Set
UpperDevices : None
LowerDevices
Driver : 0x89981f38 : Driver "\Driver\ACPI" [Type: _DRIVER_OBJECT *]
0: kd> dx -r1 -nv (*((ACPI!_DEVICE_OBJECT *)0x89981b98))
(*((ACPI!_DEVICE_OBJECT *)0x89981b98)) : Device for "\Driver\ACPI" [Type: _DEVICE_OBJECT]
[+0x000] Type : 3 [Type: short]
[+0x002] Size : 0xb8 [Type: unsigned short]
[+0x004] ReferenceCount : 0 [Type: long]
[+0x008] DriverObject : 0x89981f38 : Driver "\Driver\ACPI" [Type: _DRIVER_OBJECT *]
[+0x00c] NextDevice : 0x0 [Type: _DEVICE_OBJECT *]
[+0x010] AttachedDevice : 0x0 [Type: _DEVICE_OBJECT *]
[+0x014] CurrentIrp : 0x0 [Type: _IRP *]
[+0x018] Timer : 0x0 [Type: _IO_TIMER *]
[+0x01c] Flags : 0x0 [Type: unsigned long]
[+0x020] Characteristics : 0x0 [Type: unsigned long]
[+0x024] Vpb : 0x0 [Type: _VPB *]
[+0x028] DeviceExtension : 0x89981a18 [Type: void *]
[+0x02c] DeviceType : 0x32 [Type: unsigned long]
[+0x030] StackSize : 2 [Type: char]
[+0x034] Queue [Type: __unnamed]
[+0x05c] AlignmentRequirement : 0x0 [Type: unsigned long]
[+0x060] DeviceQueue [Type: _KDEVICE_QUEUE]
[+0x074] Dpc [Type: _KDPC]
[+0x094] ActiveThreadCount : 0x0 [Type: unsigned long]
[+0x098] SecurityDescriptor : 0x0 [Type: void *]
[+0x09c] DeviceLock [Type: _KEVENT]
[+0x0ac] SectorSize : 0x0 [Type: unsigned short]
[+0x0ae] Spare1 : 0x0 [Type: unsigned short]
[+0x0b0] DeviceObjectExtension : 0x89981c50 [Type: _DEVOBJ_EXTENSION *]
[+0x0b4] Reserved : 0x0 [Type: void *]
0: kd> dt acpi!_Device_Extension 0x89981a18
+0x000 Flags : 0x4461e000`00200010
+0x000 UFlags : __unnamed
+0x008 Signature : 0x5f534750
+0x00c DebugFlags : 0
+0x010 DispatchTable : 0xf743826c IRP_DISPATCH_TABLE
+0x014 WorkContext : WORK_QUEUE_CONTEXT
+0x014 Fdo : _FDO_DEVICE_EXTENSION
+0x014 Filter : _FILTER_DEVICE_EXTENSION
+0x014 Pdo : _PDO_DEVICE_EXTENSION
+0x058 WorkQueue : EXTENSION_WORKER
+0x058 Button : BUTTON_EXTENSION
+0x058 Thermal : THERMAL_EXTENSION
+0x058 LinkNode : LINK_NODE_EXTENSION
+0x058 Dock : DOCK_EXTENSION
+0x058 Processor : _PROCESSOR_DEVICE_EXTENSION
+0x088 DeviceState : 2 ( Started )
+0x08c PreviousState : 0 ( Stopped )
+0x090 PowerInfo : _ACPI_POWER_INFO
+0x10c DeviceID : 0x899bfed0 "ACPI\PNP0C08"
+0x10c Address : 0x899bfed0
+0x110 InstanceID : 0x899bfeb8 "0x5F534750"
+0x114 ResourceList : 0x899874d0 _CM_RESOURCE_LIST
+0x118 PnpResourceList : (null)
+0x11c OutstandingIrpCount : 0n2
+0x120 ReferenceCount : 0n12
+0x124 HibernatePathCount : 0n0
+0x128 RemoveEvent : (null)
+0x12c AcpiObject : 0x899af0f0 _NSObj
+0x130 DeviceObject : 0x89981b98 _DEVICE_OBJECT
+0x134 TargetDeviceObject : 0x899c1de0 _DEVICE_OBJECT
+0x138 PhysicalDeviceObject : 0x899c1de0 _DEVICE_OBJECT
+0x13c ParentExtension : (null)
+0x140 ChildDeviceList : _LIST_ENTRY [ 0x899c0ea0 - 0x89906fe8 ]
+0x148 SiblingDeviceList : _LIST_ENTRY [ 0x89981b60 - 0x89981b60 ]
+0x150 EjectDeviceHead : _LIST_ENTRY [ 0x89981b68 - 0x89981b68 ]
+0x158 EjectDeviceList : _LIST_ENTRY [ 0x89981b70 - 0x89981b70 ]
0: kd> dx -id 0,0,899a2278 -r1 ((ACPI!_DEVICE_OBJECT *)0x899c1de0)
((ACPI!_DEVICE_OBJECT *)0x899c1de0) : 0x899c1de0 : Device for "\Driver\ACPI_HAL" [Type: _DEVICE_OBJECT *]
[<Raw View>] [Type: _DEVICE_OBJECT]
Flags : 0x1040
UpperDevices : Immediately above is Device for "\Driver\ACPI" [at 0x89981b98]
LowerDevices
Driver : 0x899833a8 : Driver "\Driver\ACPI_HAL" [Type: _DRIVER_OBJECT *]
0: kd> dx -id 0,0,899a2278 -r1 -nv (*((ACPI!_DEVICE_OBJECT *)0x899c1de0))
(*((ACPI!_DEVICE_OBJECT *)0x899c1de0)) : Device for "\Driver\ACPI_HAL" [Type: _DEVICE_OBJECT]
[+0x000] Type : 3 [Type: short]
[+0x002] Size : 0xd0 [Type: unsigned short]
[+0x004] ReferenceCount : 0 [Type: long]
[+0x008] DriverObject : 0x899833a8 : Driver "\Driver\ACPI_HAL" [Type: _DRIVER_OBJECT *]
[+0x00c] NextDevice : 0x899c1f00 : Device for "\Driver\ACPI_HAL" [Type: _DEVICE_OBJECT *]
[+0x010] AttachedDevice : 0x89981b98 : Device for "\Driver\ACPI" [Type: _DEVICE_OBJECT *]
[+0x014] CurrentIrp : 0x0 [Type: _IRP *]
[+0x018] Timer : 0x0 [Type: _IO_TIMER *]
[+0x01c] Flags : 0x1040 [Type: unsigned long]
[+0x020] Characteristics : 0x80 [Type: unsigned long]
[+0x024] Vpb : 0x0 [Type: _VPB *]
[+0x028] DeviceExtension : 0x899c1e98 [Type: void *]
[+0x02c] DeviceType : 0x2a [Type: unsigned long]
[+0x030] StackSize : 1 [Type: char]
[+0x034] Queue [Type: __unnamed]
[+0x05c] AlignmentRequirement : 0x0 [Type: unsigned long]
[+0x060] DeviceQueue [Type: _KDEVICE_QUEUE]
[+0x074] Dpc [Type: _KDPC]
[+0x094] ActiveThreadCount : 0x0 [Type: unsigned long]
[+0x098] SecurityDescriptor : 0xe1297680 [Type: void *]
[+0x09c] DeviceLock [Type: _KEVENT]
[+0x0ac] SectorSize : 0x0 [Type: unsigned short]
[+0x0ae] Spare1 : 0x1 [Type: unsigned short]
[+0x0b0] DeviceObjectExtension : 0x899c1eb0 [Type: _DEVOBJ_EXTENSION *]
[+0x0b4] Reserved : 0x0 [Type: void *]
0: kd> !drvobj 0x899833a8
Driver object (899833a8) is for:
\Driver\ACPI_HAL
Driver Extension List: (id , addr)
Device Object list:
899c1de0 899c1f00
deviceExtension = ACPIInternalGetDeviceExtension(DeviceObject);
if (deviceExtension->TargetDeviceObject) {
//
// Forward to target device
//
IoSkipCurrentIrpStackLocation (Irp);
status = IoCallDriver (deviceExtension->TargetDeviceObject, Irp);
}
0: kd> p
eax=0000001b ebx=00000000 ecx=899833a8 edx=899bf5b0 esi=899bf5b0 edi=899c1de0
eip=80a26758 esp=f789a238 ebp=f789a24c iopl=0 nv up ei ng nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000286
nt!IofCallDriver+0x5e:
80a26758 ff548138 call dword ptr [ecx+eax*4+38h] ds:0023:8998344c={hal!HalpDispatchPnp (8050bc44)}
0: kd> kc
#
00 hal!HalpDispatchPnp
01 nt!IofCallDriver
02 ACPI!ACPIDispatchForwardIrp
03 ACPI!ACPIDispatchIrp
04 nt!IofCallDriver
05 nt!IopSynchronousCall
06 nt!IopQueryDeviceState
07 nt!PiProcessQueryDeviceState
08 nt!PipProcessStartPhase3
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
DeviceObject = 0x899c1de0 Device for "\Driver\ACPI_HAL"
Irp = 0x899bf5b0
default:
HalPrint(("HAL: (%s) Unsupported Irp (%d) received\n",
objectTypeString,
irpSp->MinorFunction));
status = STATUS_NOT_SUPPORTED ;
break;
}
#define STATUS_NOT_SUPPORTED ((NTSTATUS)0xC00000BBL)
eax=c00000bb
0: kd> p
eax=c00000bb ebx=00000000 ecx=00000000 edx=00000000 esi=899bf5b0 edi=899c1de0
eip=8050c078 esp=f789a230 ebp=f789a230 iopl=0 nv up ei pl zr na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000246
hal!HalpDispatchPnp+0x434:
8050c078 5d pop ebp
0: kd> gu
eax=c00000bb ebx=00000000 ecx=00000000 edx=00000000 esi=899bf5b0 edi=899c1de0
eip=80a2675c esp=f789a240 ebp=f789a24c iopl=0 nv up ei pl zr na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000246
nt!IofCallDriver+0x62:
80a2675c 5f pop edi
0: kd> gu
eax=c00000bb ebx=899bf514 ecx=00000000 edx=00000000 esi=f7403358 edi=00000000
eip=f7403380 esp=f789a254 ebp=f789a258 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!ACPIDispatchForwardIrp+0x28:
f7403380 8bf8 mov edi,eax
0: kd> gu
eax=c00000bb ebx=899bf514 ecx=00000000 edx=00000000 esi=f7403358 edi=00000000
eip=f740410e esp=f789a268 ebp=f789a28c 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!ACPIDispatchIrp+0x19e:
f740410e ff75fc push dword ptr [ebp-4] ss:0010:f789a288=89981a18
//
// Reference the device
//
InterlockedIncrement(&deviceExtension->OutstandingIrpCount);
//
// Dispatch to handler, then remove our reference
//
status = dispatch (DeviceObject, Irp); 返回到这里:
//
// Remove our reference, if the count goes to zero then signal
// for remove complete
//
ACPIInternalDecrementIrpReferenceCount( deviceExtension );
break;
0: kd> kc
#
00 nt!PiProcessQueryDeviceState
01 nt!PipProcessStartPhase3
02 nt!PipProcessDevNodeTree
03 nt!PipDeviceActionWorker
04 nt!PipRequestDeviceAction
05 nt!IopInitializeBootDrivers
06 nt!IoInitSystem
07 nt!Phase1Initialization
08 nt!PspSystemThreadStartup
09 nt!KiThreadStartup
NTSTATUS
PiProcessQueryDeviceState(
IN PDEVICE_OBJECT DeviceObject
)
{
//
// If the device was removed or surprised removed while the work
// item was queued then ignore it.
//
status = IopQueryDeviceState(DeviceObject, &deviceState); 返回到这里:
//
// Now perform the appropriate action based on the returned state
//
if (!NT_SUCCESS(status)) {
return STATUS_SUCCESS; 返回了。
}