ACPI!ACPIBuildProcessDevicePhasePr2函数分析之下一个状态是WORK_DONE_PSC不是WORK_DONE_CRS的原因

ACPI!ACPIBuildProcessDevicePhasePr2函数分析之下一个状态是WORK_DONE_PSC不是WORK_DONE_CRS的原因

ACPI!ACPIBuildProcessDevicePhaseCrs函数函数为什么没有运行?

ACPI!ACPIBuildProcessDevicePhasePr2函数之后应该是ACPI!ACPIBuildProcessDevicePhaseCrs函数对节点进行处理,但是不是。

第一部分:按照+1的原则应该是_PR2后应该是_CRS

NTSTATUS

ACPIBuildProcessDeviceGenericEval(

IN PACPI_BUILD_REQUEST BuildRequest

)

{

BuildRequest->NextWorkDone = BuildRequest->CurrentWorkDone + 1;

1: kd> x acpi!AcpiBuildDevicePowerNameLookup

f7438068 ACPI!AcpiBuildDevicePowerNameLookup = unsigned long [23]

1: kd> dd f7438068

f7438068 00000000 00000000 00000000 00000000

f7438078 00000000 00000000 00000000 00000000

f7438088 00000000 444a455f 00000000 5752505f

f7438098 00000000 3052505f 00000000 3152505f

f74380a8 00000000 3252505f 00000000 5352435f

f74380b8 00000000 4353505f 00000000 f73fb840

f74380c8 00000000 00000000 00000000 f73fb840

f74380d8 00000000 f73fb94c f73fb98a f73fba36

1: kd> db f7438068

f7438068 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................

f7438078 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................

f7438088 00 00 00 00 5f 45 4a 44-00 00 00 00 5f 50 52 57 ...._EJD...._PRW

f7438098 00 00 00 00 5f 50 52 30-00 00 00 00 5f 50 52 31 ...._PR0...._PR1

f74380a8 00 00 00 00 5f 50 52 32-00 00 00 00 5f 43 52 53 ...._PR2...._CRS

f74380b8 00 00 00 00 5f 50 53 43-00 00 00 00 40 b8 3f f7 ...._PSC....@.?.

f74380c8 00 00 00 00 00 00 00 00-00 00 00 00 40 b8 3f f7 ............@.?.

f74380d8 00 00 00 00 4c b9 3f f7-8a b9 3f f7 36 ba 3f f7 ....L.?...?.6.?.

第二部分:

#define WORK_DONE_ADR WORK_DONE_STEP_1

#define WORK_DONE_ADR_OR_HID WORK_DONE_STEP_0

#define WORK_DONE_CID WORK_DONE_STEP_4

#define WORK_DONE_CRS WORK_DONE_STEP_16

#define WORK_DONE_EJD WORK_DONE_STEP_6

#define WORK_DONE_HID WORK_DONE_STEP_2

#define WORK_DONE_PR0 WORK_DONE_STEP_10

#define WORK_DONE_PR1 WORK_DONE_STEP_12

#define WORK_DONE_PR2 WORK_DONE_STEP_14

#define WORK_DONE_PRW WORK_DONE_STEP_8

#define WORK_DONE_PSC WORK_DONE_STEP_18

#define WORK_DONE_STA WORK_DONE_STEP_5

#define WORK_DONE_UID WORK_DONE_STEP_3

#define WORK_DONE_CRS WORK_DONE_STEP_16

#define WORK_DONE_PSC WORK_DONE_STEP_18

NTSTATUS

ACPIBuildProcessDevicePhasePr2(

IN PACPI_BUILD_REQUEST BuildRequest

)

/*++

This routine is called by the interpreter once it has evaluate the _PR2

method. This routine then determines the current power state of the

device

Path: PhasePr2 ---> PhasePsc

|-> PhasePsc+1

NTSTATUS

ACPIBuildProcessDevicePhasePr2(

IN PACPI_BUILD_REQUEST BuildRequest

)

{

ACPIBuildProcessDevicePhasePr2Exit:

//

// If the device is not physically present, then we cannot run the _CRS and

// _PSC. If the device is not present, the we cannot run those two methods,

// but we can fake it..

//

if (deviceExtension->Flags & DEV_TYPE_NOT_PRESENT) {

BuildRequest->CurrentObject = NULL;

BuildRequest->NextWorkDone = (WORK_DONE_PSC + 1);

} else {

//

// The next step is to run the _PSC

//
BuildRequest->NextWorkDone = WORK_DONE_PSC;

}

1: kd> dx -r1 ((ACPI!_ACPI_BUILD_REQUEST *)0x89996ba0)

((ACPI!_ACPI_BUILD_REQUEST *)0x89996ba0) : 0x89996ba0 [Type: _ACPI_BUILD_REQUEST *]

+0x000\] ListEntry \[Type: _LIST_ENTRY

+0x008\] Signature : 0x5f534750 \[Type: unsigned long

+0x00c\] Flags : 0x1 \[Type: unsigned long

+0x00c\] UFlags \[Type: __unnamed

+0x010\] WorkDone : 0x1 \[Type: unsigned long

+0x014\] CurrentWorkDone : 0x12 \[Type: unsigned long

+0x018\] NextWorkDone : 0x15 \[Type: unsigned long\] \[+0x018\] NextWorkDone : 0x15不是0x13!!! \[+0x01c\] BuildContext : 0x899c0380 \[Type: void \*

+0x020\] Status : 0 \[Type: long

+0x024\] CurrentObject : 0x0 \[Type: _NSObj \*

+0x028\] CallBack : 0x0 \[Type: void (\*)(void \*,void \*,long)

+0x02c\] CallBackContext : 0x0 \[Type: void \*

+0x030\] DeviceRequest \[Type: __unnamed

+0x030\] RunRequest \[Type: __unnamed

+0x030\] SynchronizeRequest \[Type: __unnamed

+0x044\] Integer : 0xf \[Type: unsigned long

+0x044\] String : 0xf : Unable to read memory at Address 0xf \[Type: unsigned char \*

+0x044\] TargetListEntry : 0xf \[Type: _LIST_ENTRY \*

1: kd> g

Breakpoint 6 hit

eax=00000000 ebx=00000012 ecx=00000041 edx=00000002 esi=89996ba0 edi=80b019f4

eip=f73fb914 esp=f78aef6c ebp=f78aef84 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!ACPIBuildProcessGenericList+0x50:

f73fb914 85db test ebx,ebx

1: kd> dx -r1 ((ACPI!_ACPI_BUILD_REQUEST *)0x89996ba0)

((ACPI!_ACPI_BUILD_REQUEST *)0x89996ba0) : 0x89996ba0 [Type: _ACPI_BUILD_REQUEST *]

+0x000\] ListEntry \[Type: _LIST_ENTRY

+0x008\] Signature : 0x5f534750 \[Type: unsigned long

+0x00c\] Flags : 0x1 \[Type: unsigned long

+0x00c\] UFlags \[Type: __unnamed

+0x010\] WorkDone : 0x15 \[Type: unsigned long\] 变成了0x15 \[+0x014\] CurrentWorkDone : 0x12 \[Type: unsigned long

+0x018\] NextWorkDone : 0x2 \[Type: unsigned long

+0x01c\] BuildContext : 0x899c0380 \[Type: void \*

+0x020\] Status : 0 \[Type: long

+0x024\] CurrentObject : 0x0 \[Type: _NSObj \*

+0x028\] CallBack : 0x0 \[Type: void (\*)(void \*,void \*,long)

+0x02c\] CallBackContext : 0x0 \[Type: void \*

+0x030\] DeviceRequest \[Type: __unnamed

+0x030\] RunRequest \[Type: __unnamed

+0x030\] SynchronizeRequest \[Type: __unnamed

+0x044\] Integer : 0xf \[Type: unsigned long

+0x044\] String : 0xf : Unable to read memory at Address 0xf \[Type: unsigned char \*

+0x044\] TargetListEntry : 0xf \[Type: _LIST_ENTRY \*

//

// Look at the dispatch table to see if there is a function to

// call

//

buildFunction = DispatchTable[ workDone ];

1: kd> g

Breakpoint 5 hit

eax=00000015 ebx=00000015 ecx=89996bb0 edx=00000001 esi=89996ba0 edi=80b019f4

eip=f73fb911 esp=f78aef68 ebp=f78aef84 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!ACPIBuildProcessGenericList+0x4d:

f73fb911 ff55f4 call dword ptr [ebp-0Ch] ss:0010:f78aef78={ACPI!ACPIBuildProcessDeviceGenericEval (f73faf0a)}

1: kd> t

eax=00000015 ebx=00000015 ecx=89996bb0 edx=00000001 esi=89996ba0 edi=80b019f4

eip=f73faf0a esp=f78aef64 ebp=f78aef84 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!ACPIBuildProcessDeviceGenericEval:

f73faf0a 55 push ebp

1: kd> dv

BuildRequest = 0x89996ba0

status = 0n8

1: kd> dx -r1 ((ACPI!_ACPI_BUILD_REQUEST *)0x89996ba0)

((ACPI!_ACPI_BUILD_REQUEST *)0x89996ba0) : 0x89996ba0 [Type: _ACPI_BUILD_REQUEST *]

+0x000\] ListEntry \[Type: _LIST_ENTRY

+0x008\] Signature : 0x5f534750 \[Type: unsigned long

+0x00c\] Flags : 0x1 \[Type: unsigned long

+0x00c\] UFlags \[Type: __unnamed

+0x010\] WorkDone : 0x1 \[Type: unsigned long

+0x014\] CurrentWorkDone : 0x15 \[Type: unsigned long\] 0x15不是0x13 \[+0x018\] NextWorkDone : 0x2 \[Type: unsigned long

+0x01c\] BuildContext : 0x899c0380 \[Type: void \*

+0x020\] Status : 0 \[Type: long

+0x024\] CurrentObject : 0x0 \[Type: _NSObj \*

+0x028\] CallBack : 0x0 \[Type: void (\*)(void \*,void \*,long)

+0x02c\] CallBackContext : 0x0 \[Type: void \*

+0x030\] DeviceRequest \[Type: __unnamed

+0x030\] RunRequest \[Type: __unnamed

+0x030\] SynchronizeRequest \[Type: __unnamed

+0x044\] Integer : 0xf \[Type: unsigned long

+0x044\] String : 0xf : Unable to read memory at Address 0xf \[Type: unsigned char \*

+0x044\] TargetListEntry : 0xf \[Type: _LIST_ENTRY \*