Newer
Older
AMI-Aptio-BIOS-Reversed / PurleyPlatPkg / Platform / Pei / EarlyVideoPei / PciRegSetBit.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Full restructure
int __thiscall PciRegSetBit(int *this)
{
  int *this_1; // ebp
  int v2; // ecx
  unsigned int n255; // ebx
  int v4; // ecx
  unsigned int i; // esi
  int v6; // ecx
  unsigned int n0x20; // eax
  unsigned int j; // ebp
  unsigned int i_1; // edi
  int v12; // [esp+14h] [ebp-14h]
  unsigned int n0xA; // [esp+18h] [ebp-10h]
  unsigned int n0x20_1; // [esp+1Ch] [ebp-Ch]
  unsigned int i_2; // [esp+20h] [ebp-8h]
  int v16; // [esp+24h] [ebp-4h]

  this_1 = this;
  v2 = *this;
  v12 = v2;
  do
  {
    n0xA = 0;
    n255 = 255;
    i_2 = 0;
    PciRegWrite(v2, 510525556, 0x3FFF);
    for ( i = 0; i < 0x64; ++i )
    {
      PciRegWrite(v4, 510525544, i | ((i | ((i | (i << 8)) << 8)) << 8));
      v6 = *this_1;
      n0x20 = 0;
      v16 = *this_1;
      n0x20_1 = 0;
      while ( 1 )
      {
        PciRegWrite(v6, 510525564, *(int *)((char *)&dword_FFE76FCC + n0x20));
        for ( j = 0; j < 5; ++j )
        {
          if ( PciRegPollBitClear(this) )
            break;
        }
        i_1 = i_2;
        if ( j == 5 )
          break;
        v6 = v16;
        n0x20 = n0x20_1 + 4;
        n0x20_1 = n0x20;
        if ( n0x20 >= 0x20 )
        {
          if ( n255 > i )
            n255 = i;
          if ( i_2 < i )
          {
            i_1 = i;
            i_2 = i;
          }
          ++n0xA;
          goto LABEL_15;
        }
      }
      if ( n0xA >= 0xA )
        break;
LABEL_15:
      this_1 = this;
      v4 = v12;
    }
    this_1 = this;
    v2 = v12;
  }
  while ( !i_1 || i_1 - n255 < 0xA );
  return PciRegWrite(
           v12,
           510525544,
           (n255 + ((7 * (i_1 - n255)) >> 4))
         | (((n255 + ((7 * (i_1 - n255)) >> 4))
           | (((n255 + ((7 * (i_1 - n255)) >> 4)) | ((n255 + ((7 * (i_1 - n255)) >> 4)) << 8)) << 8)) << 8));
}