📄 power.cod
字号:
; 689 : PSERIAL_DEVICE_EXTENSION pDevExt = PDevObj->DeviceExtension;
00076 8b 45 08 mov eax, DWORD PTR _PDevObj$[ebp]
00079 56 push esi
0007a 57 push edi
; 690 : PIO_STACK_LOCATION pIrpStack = IoGetCurrentIrpStackLocation(PIrp);
0007b 8b 7d 0c mov edi, DWORD PTR _PIrp$[ebp]
0007e 8b 70 28 mov esi, DWORD PTR [eax+40]
00081 8b 47 60 mov eax, DWORD PTR [edi+96]
00084 89 45 0c mov DWORD PTR _pIrpStack$[ebp], eax
; 691 :
; 692 : PAGED_CODE();
00087 ff 15 00 00 00
00 call DWORD PTR __imp__KeGetCurrentIrql@0
0008d 3c 01 cmp al, 1
0008f 76 2d jbe SHORT $L15377
00091 ff 15 00 00 00
00 call DWORD PTR __imp__KeGetCurrentIrql@0
00097 0f b6 c0 movzx eax, al
0009a 50 push eax
0009b 68 00 00 00 00 push OFFSET FLAT:$SG15372
000a0 e8 00 00 00 00 call _DbgPrint
000a5 59 pop ecx
000a6 59 pop ecx
000a7 6a 00 push 0
000a9 68 b4 02 00 00 push 692 ; 000002b4H
000ae 68 00 00 00 00 push OFFSET FLAT:$SG15375
000b3 68 00 00 00 00 push OFFSET FLAT:$SG15376
000b8 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L15377:
; 693 :
; 694 : SerialDump(SERDIAG3, ("SERIAL: In SerialSetPowerD3\n"));
000be f6 05 00 00 00
00 04 test BYTE PTR _SerialDebugLevel, 4
000c5 74 0b je SHORT $L15378
000c7 68 00 00 00 00 push OFFSET FLAT:$SG15383
000cc e8 00 00 00 00 call _DbgPrint
000d1 59 pop ecx
$L15378:
; 695 :
; 696 : //
; 697 : // Send the wait wake now, just in time
; 698 : //
; 699 :
; 700 :
; 701 : if (pDevExt->SendWaitWake) {
000d2 80 be 84 05 00
00 00 cmp BYTE PTR [esi+1412], 0
000d9 74 06 je SHORT $L15390
; 702 : SerialSendWaitWake(pDevExt);
000db 56 push esi
000dc e8 00 00 00 00 call _SerialSendWaitWake@4
$L15390:
; 703 : }
; 704 : //
; 705 : // Before we power down, call PoSetPowerState
; 706 : //
; 707 :
; 708 : PoSetPowerState(PDevObj, pIrpStack->Parameters.Power.Type,
; 709 : pIrpStack->Parameters.Power.State);
000e1 8b 45 0c mov eax, DWORD PTR _pIrpStack$[ebp]
000e4 ff 70 0c push DWORD PTR [eax+12]
000e7 ff 70 08 push DWORD PTR [eax+8]
000ea ff 75 08 push DWORD PTR _PDevObj$[ebp]
000ed ff 15 00 00 00
00 call DWORD PTR __imp__PoSetPowerState@12
; 710 :
; 711 : //
; 712 : // If the device is not closed, disable interrupts and allow the fifo's
; 713 : // to flush.
; 714 : //
; 715 :
; 716 : if (pDevExt->DeviceIsOpened == TRUE) {
000f3 8d 86 9d 01 00
00 lea eax, DWORD PTR [esi+413]
000f9 80 38 01 cmp BYTE PTR [eax], 1
000fc 75 33 jne SHORT $L15391
; 717 : LARGE_INTEGER charTime;
; 718 :
; 719 : pDevExt->DeviceIsOpened = FALSE;
000fe 80 20 00 and BYTE PTR [eax], 0
; 720 : pDevExt->DeviceState.Reopen = TRUE;
; 721 :
; 722 : charTime.QuadPart = -SerialGetCharTime(pDevExt).QuadPart;
00101 56 push esi
00102 c6 86 fc 04 00
00 01 mov BYTE PTR [esi+1276], 1
00109 e8 00 00 00 00 call _SerialGetCharTime@4
0010e f7 d8 neg eax
00110 83 d2 00 adc edx, 0
; 723 :
; 724 : //
; 725 : // Shut down the chip
; 726 : //
; 727 :
; 728 : SerialDisableUART(pDevExt);
00113 56 push esi
00114 f7 da neg edx
00116 89 45 f8 mov DWORD PTR _charTime$15392[ebp], eax
00119 89 55 fc mov DWORD PTR _charTime$15392[ebp+4], edx
0011c e8 00 00 00 00 call _SerialDisableUART@4
; 729 :
; 730 : //
; 731 : // Drain the device
; 732 : //
; 733 :
; 734 : SerialDrainUART(pDevExt, &charTime);
00121 8d 45 f8 lea eax, DWORD PTR _charTime$15392[ebp]
00124 50 push eax
00125 56 push esi
00126 e8 00 00 00 00 call _SerialDrainUART@8
; 735 :
; 736 : //
; 737 : // Save the device state
; 738 : //
; 739 :
; 740 : SerialSaveDeviceState(pDevExt);
0012b 56 push esi
0012c e8 00 00 00 00 call _SerialSaveDeviceState@4
$L15391:
; 741 : }
; 742 :
; 743 : //
; 744 : // If the device is not open, we don't need to save the state;
; 745 : // we can just reset the device on power-up
; 746 : //
; 747 :
; 748 :
; 749 : PIrp->IoStatus.Status = STATUS_SUCCESS;
; 750 :
; 751 : pDevExt->PowerState = PowerDeviceD3;
00131 c7 86 a4 04 00
00 04 00 00 00 mov DWORD PTR [esi+1188], 4
; 752 :
; 753 : //
; 754 : // For what we are doing, we don't need a completion routine
; 755 : // since we don't race on the power requests.
; 756 : //
; 757 :
; 758 : PIrp->IoStatus.Status = STATUS_SUCCESS;
0013b 83 67 18 00 and DWORD PTR [edi+24], 0
; 759 :
; 760 : PoStartNextPowerIrp(PIrp);
0013f 57 push edi
00140 ff 15 00 00 00
00 call DWORD PTR __imp__PoStartNextPowerIrp@4
; 761 : IoSkipCurrentIrpStackLocation(PIrp);
00146 fe 47 23 inc BYTE PTR [edi+35]
00149 83 47 60 24 add DWORD PTR [edi+96], 36 ; 00000024H
; 762 :
; 763 : return SerialPoCallDriver(pDevExt, pDevExt->LowerDeviceObject, PIrp);
0014d 57 push edi
0014e ff b6 a0 04 00
00 push DWORD PTR [esi+1184]
00154 56 push esi
00155 e8 00 00 00 00 call _SerialPoCallDriver@12
0015a 5f pop edi
0015b 5e pop esi
; 764 : }
0015c c9 leave
0015d c2 08 00 ret 8
_SerialSetPowerD3@8 ENDP
PAGESRP0 ENDS
PUBLIC _SerialWakeCompletion@20
EXTRN __imp_@InterlockedIncrement@4:NEAR
; COMDAT _SerialSendWaitWake@4
PAGESRP0 SEGMENT
$SG15402 DB 'EX: Pageable code called at IRQL %d', 0aH, 00H
ORG $+3
$SG15405 DB 'f:\w2ddk\src\kernel\serial\power.c', 00H
ORG $+1
$SG15406 DB 'FALSE', 00H
; Function compile flags: /Ogs
_PDevExt$ = 8
_pIrp$ = -4
_SerialSendWaitWake@4 PROC NEAR ; COMDAT
; 786 : {
00052 55 push ebp
00053 8b ec mov ebp, esp
00055 51 push ecx
00056 56 push esi
; 787 : NTSTATUS status;
; 788 : PIRP pIrp;
; 789 : POWER_STATE powerState;
; 790 :
; 791 : PAGED_CODE();
00057 8b 35 00 00 00
00 mov esi, DWORD PTR __imp__KeGetCurrentIrql@0
0005d ff d6 call esi
0005f 3c 01 cmp al, 1
00061 76 29 jbe SHORT $L15403
00063 ff d6 call esi
00065 0f b6 c0 movzx eax, al
00068 50 push eax
00069 68 00 00 00 00 push OFFSET FLAT:$SG15402
0006e e8 00 00 00 00 call _DbgPrint
00073 59 pop ecx
00074 59 pop ecx
00075 6a 00 push 0
00077 68 17 03 00 00 push 791 ; 00000317H
0007c 68 00 00 00 00 push OFFSET FLAT:$SG15405
00081 68 00 00 00 00 push OFFSET FLAT:$SG15406
00086 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L15403:
; 792 :
; 793 : //
; 794 : // Make sure one isn't pending already -- serial will only handle one at
; 795 : // a time.
; 796 : //
; 797 :
; 798 : if (PDevExt->PendingWakeIrp != NULL) {
0008c 8b 75 08 mov esi, DWORD PTR _PDevExt$[ebp]
0008f 83 be 88 05 00
00 00 cmp DWORD PTR [esi+1416], 0
; 799 : return STATUS_INVALID_DEVICE_STATE;
00096 75 12 jne SHORT $L15546
; 800 : }
; 801 :
; 802 : //
; 803 : // Make sure we are capable of waking the machine
; 804 : //
; 805 :
; 806 : if (PDevExt->SystemWake <= PowerSystemWorking) {
00098 83 be 78 05 00
00 01 cmp DWORD PTR [esi+1400], 1
; 807 : return STATUS_INVALID_DEVICE_STATE;
0009f 7e 09 jle SHORT $L15546
; 808 : }
; 809 :
; 810 : if (PDevExt->DeviceWake == PowerDeviceUnspecified) {
000a1 83 be 7c 05 00
00 00 cmp DWORD PTR [esi+1404], 0
000a8 75 07 jne SHORT $L15412
$L15546:
; 811 : return STATUS_INVALID_DEVICE_STATE;
000aa b8 84 01 00 c0 mov eax, -1073741436 ; c0000184H
000af eb 50 jmp SHORT $L15397
$L15412:
000b1 57 push edi
; 812 : }
; 813 :
; 814 : //
; 815 : // Send IRP to request wait wake and add a pending irp flag
; 816 : //
; 817 : //
; 818 :
; 819 : InterlockedIncrement(&PDevExt->PendingIRPCnt);
000b2 8d 8e c8 04 00
00 lea ecx, DWORD PTR [esi+1224]
000b8 ff 15 00 00 00
00 call DWORD PTR __imp_@InterlockedIncrement@4
; 820 :
; 821 : powerState.SystemState = PDevExt->SystemWake;
000be 8b 86 78 05 00
00 mov eax, DWORD PTR [esi+1400]
; 822 :
; 823 : status = PoRequestPowerIrp(PDevExt->Pdo, IRP_MN_WAIT_WAKE,
; 824 : powerState, SerialWakeCompletion, PDevExt, &pIrp);
000c4 8d 4d fc lea ecx, DWORD PTR _pIrp$[ebp]
000c7 51 push ecx
000c8 56 push esi
000c9 68 00 00 00 00 push OFFSET FLAT:_SerialWakeCompletion@20
000ce 50 push eax
000cf 6a 00 push 0
000d1 ff b6 80 05 00
00 push DWORD PTR [esi+1408]
000d7 ff 15 00 00 00
00 call DWORD PTR __imp__PoRequestPowerIrp@24
000dd 8b f8 mov edi, eax
; 825 :
; 826 : if (status == STATUS_PENDING) {
000df 81 ff 03 01 00
00 cmp edi, 259 ; 00000103H
000e5 75 0d jne SHORT $L15415
; 827 : status = STATUS_SUCCESS;
; 828 : PDevExt->PendingWakeIrp = pIrp;
000e7 8b 45 fc mov eax, DWORD PTR _pIrp$[ebp]
000ea 33 ff xor edi, edi
000ec 89 86 88 05 00
00 mov DWORD PTR [esi+1416], eax
; 829 : } else if (!NT_SUCCESS(status)) {
000f2 eb 0a jmp SHORT $L15419
$L15415:
000f4 85 ff test edi, edi
000f6 7d 06 jge SHORT $L15419
; 830 : SerialIRPEpilogue(PDevExt);
000f8 56 push esi
000f9 e8 00 00 00 00 call _SerialIRPEpilogue@4
$L15419:
; 831 : }
; 832 :
; 833 : return status;
000fe 8b c7 mov eax, edi
00100 5f pop edi
$L15397:
00101 5e pop esi
; 834 : }
00102 c9 leave
00103 c2 04 00 ret 4
_SerialSendWaitWake@4 ENDP
; Function compile flags: /Ogs
PAGESRP0 ENDS
; COMDAT _SerialWakeCompletion@20
_TEXT SEGMENT
_Context$ = 20
_IoStatus$ = 24
_SerialWakeCompletion@20 PROC NEAR ; COMDAT
; 865 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
; 866 : NTSTATUS status;
; 867 : PSERIAL_DEVICE_EXTENSION pDevExt = (PSERIAL_DEVICE_EXTENSION)Context;
; 868 : POWER_STATE powerState;
; 869 :
; 870 : status = IoStatus->Status;
00003 8b 45 18 mov eax, DWORD PTR _IoStatus$[ebp]
00006 56 push esi
; 871 :
; 872 : if (NT_SUCCESS(status)) {
00007 8b 75 14 mov esi, DWORD PTR _Context$[ebp]
0000a 57 push edi
0000b 8b 38 mov edi, DWORD PTR [eax]
0000d 85 ff test edi, edi
0000f 7c 18 jl SHORT $L15436
; 873 : //
; 874 : // A wakeup has occurred -- powerup our stack
; 875 : //
; 876 :
; 877 : powerState.DeviceState = PowerDeviceD0;
00011 33 c0 xor eax, eax
; 878 :
; 879 : PoRequestPowerIrp(pDevExt->Pdo, IRP_MN_SET_POWER, powerState, NULL,
; 880 : NULL, NULL);
00013 6a 00 push 0
00015 40 inc eax
00016 6a 00 push 0
00018 6a 00 push 0
0001a 50 push eax
0001b 6a 02 push 2
0001d ff b6 80 05 00
00 push DWORD PTR [esi+1408]
00023 ff 15 00 00 00
00 call DWORD PTR __imp__PoRequestPowerIrp@24
$L15436:
; 881 :
; 882 : }
; 883 :
; 884 : pDevExt->PendingWakeIrp = NULL;
00029 83 a6 88 05 00
00 00 and DWORD PTR [esi+1416], 0
; 885 : SerialIRPEpilogue(pDevExt);
00030 56 push esi
00031 e8 00 00 00 00 call _SerialIRPEpilogue@4
; 886 :
; 887 : return status;
00036 8b c7 mov eax, edi
00038 5f pop edi
00039 5e pop esi
; 888 : }
0003a 5d pop ebp
0003b c2 14 00 ret 20 ; 00000014H
_SerialWakeCompletion@20 ENDP
_TEXT ENDS
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -