Newer
Older
AMI-Aptio-BIOS-Reversed / Platform / SetupConfigRoute.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Init
// SetupConfigRoute - decompiled from Platform.efi
unsigned __int64 __fastcall SetupConfigRoute(_DWORD *a1)
{
  __int64 v2; // rax
  __int64 v3; // rdi
  __int64 v5; // rax
  _DWORD v6[4]; // [rsp+30h] [rbp-10h] BYREF
  int v7; // [rsp+68h] [rbp+28h] BYREF
  int n13; // [rsp+70h] [rbp+30h] BYREF
  __int64 v9; // [rsp+78h] [rbp+38h] BYREF

  DebugPrint(0x40u, "[ME] HeciGetFwFeatureStateMsg.\n"); /*0xb2fa*/
  v2 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(BootServices + 320))(&unk_F9B0, 0, &v9); /*0xb313*/
  v3 = v2; /*0xb319*/
  if ( v2 < 0 ) /*0xb31f*/
  {
    DebugPrint(0x80000000, "[ME] Unable to Locate Heci Protocol.- %r\n", v2); /*0xb330*/
    return v3; /*0xb338*/
  }
  if ( (*(__int64 (__fastcall **)(int *))(v9 + 64))(&v7) < 0 || v7 ) /*0xb355*/
    return 0x8000000000000003uLL; /*0xb3fe*/
  v6[0] = 515; /*0xb372*/
  v6[1] = 32; /*0xb37b*/
  n13 = 13; /*0xb382*/
  v5 = (*(__int64 (__fastcall **)(_QWORD, _DWORD *, __int64, int *, _BYTE, char))v9)(0, v6, 8, &n13, 0, 7); /*0xb38e*/
  v3 = v5; /*0xb390*/
  if ( v5 < 0 )
    DebugPrint(0x80000000, "[ME] HeciGetFwFeatureStateMsg: message failed! - %r\n", v5);
  if ( (v6[0] & 0x7F00) == 0x200 && LOBYTE(v6[0]) == 3 && (v6[0] & 0x8000) != 0 && (v6[0] & 0xFF000000) == 0 ) /*0xb3d7*/
  {
    *a1 = *(_DWORD *)((char *)&v6[2] + 1); /*0xb3dc*/
    return v3; /*0xb3de*/
  }
  DebugPrint(0x80000000, "[ME] ERROR: Invalid response received for FWCAPS_GET_RULE (MKHI: %08X)\n", v6[0]);
  return 0x8000000000000007uLL; /*0xb40d*/
}