PoFxActivateComponent

VOID __stdcall PoFxActivateComponent(POHANDLE *Handle, UINT64 Component, UINT64 Flags){
  char v3; 
  int v5; 
  __int64 v6; 
  char v7; 
  PEP_WORK_INFORMATION *v8; 
  int v9; 
  _ETHREAD *v10; 
  _ETHREAD *CurrentThread; 
  unsigned __int64 v13; 
  char v14[88]; 

  v3 = Flags;
  v5 = Flags & 1;
  if( (Flags & 1) != 0 && KeGetCurrentIrql() >= 2u )
    PopFxBugCheck(0x614u, (ULONG_PTR)Handle, Component, 0);
  if( (Flags & 3) == 3 )
    PopFxBugCheck(0x614u, (ULONG_PTR)Handle, Component, 1u);
  if( (unsigned int)Component >= *((_DWORD *)Handle + 207) )
    PopFxBugCheck(0x614u, (ULONG_PTR)Handle, Component, 2u);
  v6 = *((_QWORD *)Handle[104] + (unsigned int)Component);
  memset(v14, 0i64, 0x40u);
  if( ((_DWORD)Handle[103] & 1) == 0 )
  {
    if( (v3 & 6) == 4 )
    {
      CurrentThread = (_ETHREAD *)KeGetCurrentThread();
      v7 = 1;
      --CurrentThread->Tcb.SpecialApcDisable;
    }
    else
    {
      v7 = 0;
    }
    v8 = (PEP_WORK_INFORMATION *)v14;
    if( (v3 & 2) != 0 )
      v8 = 0i64;
    v9 = _InterlockedIncrement((volatile signed __int32 *)(v6 + 88));
    if( v9 == 1 )
    {
      _InterlockedIncrement((volatile signed __int32 *)(v6 + 88));
      PopFxActivateComponentWorker((POP_FX_DEVICE *)Handle, (POP_FX_COMPONENT *)v6, 0, v8);
    }
    else
    {
      if( v9 < 0 )
      {
LABEL_12:
        if( v7 )
        {
          v10 = (_ETHREAD *)KeGetCurrentThread();
          if( v10->Tcb.SpecialApcDisable++ == -1
            && ($F25F8C4BA33AF922A5F1AF68CD89DDDF *)v10->Tcb.ApcState.ApcListHead[0].Flink != &v10->Tcb.152 )
          {
            KiCheckForKernelApcDelivery();
          }
        }
        return;
      }
      if( (v9 & 0x40000000) != 0 )
      {
        v13 = (unsigned __int8)KeAcquireSpinLockRaiseToDpc((UINT64 *)(v6 + 128));
        KxReleaseSpinLock((UINT64 *)(v6 + 128));
        __writecr8(v13);
      }
    }
    if( v5 )
      KeWaitForSingleObject(v6 + 104, 0, 0, 0, 0i64);
    goto LABEL_12;
  }
}

Referenced by:

HalpDmaInitPowerManagement
HalpInterruptInitPowerManagement
HalpTimerInitPowerManagement
PoFxRegisterDebugger
PoFxStartDevicePowerManagement
PopFxActivateDevice
PopFxUnregisterDevice