Newer
Older
AMI-Aptio-BIOS-Reversed / PurleySktPkg / SouthClusterLbg / SiInit / Pei / SiInitPreMem / decompiled / ffd8155f.c
@Ajax Dong Ajax Dong 7 days ago 2 KB Recovering names
int PchInitPreMem()
{
  int v0; // eax
  int v1; // esi
  int v2; // eax
  int v3; // eax
  int v4; // esi
  int v5; // eax
  int *v7; // [esp+10h] [ebp-4h] BYREF

  DebugPrint(64, (int)"PchInitPreMem() - Start\
"); /*0xffd8156b*/
  if ( !(unsigned __int8)sub_FFD8BDC8() ) /*0xffd81572*/
  {
    DebugPrint(0x80000000, (int)"PCH SKU is not supported due to no proper PCH LPC found!\
"); /*0xffd8158b*/
    v0 = GetReportStatusCodePpi(); /*0xffd81592*/
    if ( v0 ) /*0xffd81599*/
      (*(void (__cdecl **)(const char *, int, const char *))(v0 + 4))( /*0xffd815a6*/
        "e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInitPreMem.c",
        1948,
        "((BOOLEAN)(0==1))");
  }
  v1 = sub_FFD8CBBA(0, 31, 1); /*0xffd815b8*/
  if ( (*(_DWORD *)(v1 + 16) & 0xFF000000) == 0 ) /*0xffd815c4*/
  {
    DebugPrint(64, (int)"SBREG should be programmed before here\
"); /*0xffd815cd*/
    *(_DWORD *)(v1 + 16) = -50331648; /*0xffd815d2*/
    *(_BYTE *)(v1 + 4) |= 2u; /*0xffd815e0*/
  }
  sub_FFD8C632(0x500u); /*0xffd815e8*/
  sub_FFD8C80A(); /*0xffd815ed*/
  sub_FFD8C99B(); /*0xffd815f2*/
  sub_FFD8C909((unsigned int *)&v7); /*0xffd815fb*/
  DebugPrint(64, (int)"PCH PWRM Base needs to be programmed before here\
"); /*0xffd81607*/
  if ( !v7 ) /*0xffd81613*/
  {
    v2 = GetReportStatusCodePpi(); /*0xffd81615*/
    if ( v2 ) /*0xffd8161c*/
      (*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd81629*/
        "e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInitPreMem.c",
        1993,
        "PchPwrmBase != 0");
  }
  if ( (unsigned __int8)sub_FFD8D59A() )
  {
    DebugPrint(0x80000000, (int)"DWR: DWR detected - install PPI\
");
    if ( InstallPpi(&unk_FFD98084) >= 0 )
      DebugPrint(0x80000000, (int)"DWR: DWR PPI has been installed\
");
    else
      DebugPrint(0x80000000, (int)"ERROR: Can't install DWR PPI\
");
  }
  PchFabricErrorCheck(); /*0xffd81667*/
  PchEarlyInit(v7); /*0xffd81670*/
  v3 = InstallPpi(&unk_FFD980AC); /*0xffd8167a*/
  v4 = v3; /*0xffd8167f*/
  if ( v3 < 0 ) /*0xffd81683*/
  {
    DebugPrint(0x80000000, (int)"\
ASSERT_EFI_ERROR (Status = %r)\
", v3); /*0xffd8168c*/
    v5 = GetReportStatusCodePpi(); /*0xffd81694*/
    if ( v5 ) /*0xffd8169b*/
      (*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffd816a8*/
        "e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInitPreMem.c",
        2007,
        "!EFI_ERROR (Status)");
  }
  DebugPrint(64, (int)"PchInitPreMem() - End\
"); /*0xffd816b5*/
  return v4; /*0xffd816bc*/
}