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

  PciRegWrite(*a1, 510525552, 0);
  PciRegWrite(v3, 510525552, (8 * a2) | 0x41);
  v5 = 0;
  while ( 1 )
  {
    v6 = PciRegRead(v4, 510525552) & 0x1000;
    if ( (unsigned int)++v5 > 0x4C4B40 )
      break;
    if ( v6 )
    {
      v8 = PciRegRead(v4, 510525560);
      PciRegWrite(v9, 510525552, 0);
      return (unsigned __int16)v8 | HIWORD(v8);
    }
  }
  PciRegWrite(v4, v7, 0);
  return -1;
}