Newer
Older
AMI-Aptio-BIOS-Reversed / PurleyPlatPkg / Platform / Pei / EarlyVideoPei / PciRegPollBitSet.c
@Ajax Dong Ajax Dong 2 days ago 922 bytes Full restructure
unsigned int __fastcall PciRegPollBitSet(int *a1, int a2)
{
  int v3; // esi
  int v4; // ecx
  int v5; // ecx
  int v6; // edi
  int v7; // eax
  int v8; // edx
  int v9; // ecx
  int v10; // ecx
  int v11; // esi
  int v12; // eax
  int v13; // edx
  unsigned int v14; // esi

  PciRegWrite(*a1, 510525552, 0);
  v3 = 8 * a2;
  PciRegWrite(v4, 510525552, v3 | 1);
  v6 = 0;
  do
  {
    v7 = PciRegRead(v5, 510525552) & 0x40;
    if ( (unsigned int)++v6 > 0x4C4B40 )
    {
      PciRegWrite(v5, v8, 0);
      return -1;
    }
  }
  while ( !v7 );
  PciRegWrite(v5, v8, 0);
  PciRegWrite(v9, 510525552, v3 | 3);
  v11 = 0;
  while ( 1 )
  {
    v12 = PciRegRead(v10, 510525552) & 0x40;
    if ( (unsigned int)++v11 > 0x4C4B40 )
      break;
    if ( v12 )
    {
      v14 = ((unsigned int)PciRegRead(v10, v13) >> 7) & 1;
      goto LABEL_9;
    }
  }
  v14 = -1;
LABEL_9:
  PciRegWrite(v10, 510525552, 0);
  return v14;
}