HalpPowerInitFwPerformanceTableMappings

INT64 __fastcall HalpPowerInitFwPerformanceTableMappings(){
  unsigned int v0; 
  _DWORD *Table; 
  _DWORD *v2; 
  _DWORD *v3; 
  LARGE_INTEGER v4; 
  unsigned int v5; 
  _DWORD *v6; 
  unsigned int v7; 
  __int64 v8; 
  LARGE_INTEGER v10; 
  unsigned int v11; 
  _DWORD *v12; 
  unsigned int v13; 
  __int64 v14; 
  MEMORY_CACHING_TYPE CacheType; 
  v0 = 0;
  CacheType = MmNonCached;
  Table = (_DWORD *)HalpAcpiGetTable(0i64);
  v2 = Table;
  if( !Table || *Table != 1413763142 )
    return(unsigned int)-1073741275;
  v3 = Table + 9;
  if( Table + 9 < (_DWORD *)((char *)Table + (unsigned int)Table[1]) )
  {
    do
    {
      if( *(_WORD *)v3 )
      {
        if( *(_WORD *)v3 != 1 )
          return(unsigned int)-1073741822;
        v10 = *(LARGE_INTEGER *)(v3 + 2);
        HalGetMemoryCachingRequirements(v10, 8ui64, &CacheType);
        v11 = 4;
        if( CacheType != MmCached )
          v11 = 516;
        MmMapIoSpaceEx(v10, 8ui64, v11);
        if( !v12 )
          return(unsigned int)-1073741670;
        v13 = v12[1];
        MmUnmapIoSpace(v12, 8ui64);
        MmMapIoSpaceEx(v10, v13, v11);
        if( !v14 )
          return(unsigned int)-1073741670;
        HalpFwS3PerformanceTable = v14;
        HalpFwS3PerformanceTableMaximumLength = (((v14 & 0xFFF) + v13 + 4095) & 0xFFFFF000) - (v14 & 0xFFF);
      }
      else
      {
        v4 = *(LARGE_INTEGER *)(v3 + 2);
        HalGetMemoryCachingRequirements(v4, 8ui64, &CacheType);
        v5 = 4;
        if( CacheType != MmCached )
          v5 = 516;
        MmMapIoSpaceEx(v4, 8ui64, v5);
        if( !v6 )
          return(unsigned int)-1073741670;
        v7 = v6[1];
        MmUnmapIoSpace(v6, 8ui64);
        MmMapIoSpaceEx(v4, v7, v5);
        if( !v8 )
          return(unsigned int)-1073741670;
        HalpFwBootPerformanceTable = v8;
        HalpFwBootPerformanceTableMaximumLength = v7;
      }
      v3 = (_DWORD *)((char *)v3 + *((unsigned __int8 *)v3 + 2));
    }
    while( v3 < (_DWORD *)((char *)v2 + (unsigned int)v2[1]) );
  }
  return v0;
}

Referenced by:

HalpPowerInitSystem