#include "SiInit.h"
//
// SiInit - UEFI Module
// Total functions: 181
//
// Function: MmioSetMem @ 0xffd6cfb4 (0x15 bytes)
void *__cdecl MmioSetMem(void *buf, unsigned int count, char value)
{
memset(buf, value, count); /*0xffd6cfc1*/
return buf; /*0xffd6cfc7*/
}
// Function: MmioZeroMem @ 0xffd6cfd4 (0x20 bytes)
void *__cdecl MmioZeroMem(void *buf, unsigned int count)
{
memset(buf, 0, count); /*0xffd6cfeb*/
return buf; /*0xffd6cff2*/
}
// Function: MmioMemmove @ 0xffd6cff4 (0x3f bytes)
char *__cdecl MmioMemmove(char *dst, char *src, unsigned int count)
{
unsigned int count_1; // edx
char *dst_1; // edi
char *src_1; // esi
count_1 = count; /*0xffd6cffe*/
if ( src < dst && &src[count - 1] >= dst ) /*0xffd6d00c*/
{
src_1 = &src[count - 1]; /*0xffd6d020*/
dst_1 = &dst[count - 1]; /*0xffd6d022*/
}
else
{
count_1 = count & 3; /*0xffd6d010*/
qmemcpy(dst, src, 4 * (count >> 2)); /*0xffd6d019*/
src_1 = &src[4 * (count >> 2)]; /*0xffd6d019*/
dst_1 = &dst[4 * (count >> 2)]; /*0xffd6d019*/
}
qmemcpy(dst_1, src_1, count_1); /*0xffd6d029*/
return dst; /*0xffd6d030*/
}
// Function: MmioFillPairs @ 0xffd6d034 (0x1f bytes)
int __cdecl MmioFillPairs(int a1, int a2, int a3, int a4)
{
do /*0xffd6d04d*/
{
*(_DWORD *)(a1 + 8 * a2 - 8) = a3; /*0xffd6d045*/
*(_DWORD *)(a1 + 8 * a2-- - 4) = a4; /*0xffd6d049*/
}
while ( a2 ); /*0xffd6d04d*/
return a1; /*0xffd6d051*/
}
// Function: MmioSetMem32 @ 0xffd6d054 (0x15 bytes)
void *__cdecl MmioSetMem32(void *buf, unsigned int count, int value)
{
memset32(buf, value, count); /*0xffd6d061*/
return buf; /*0xffd6d067*/
}
// Function: _ModuleEntryPoint @ 0xffd6d0f0 (0x71 bytes)
EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
int v2; // eax
int BootMode; // eax
int v4; // eax
EFI_STATUS v5; // esi
int v6; // eax
if ( PciGetInfo(0xFA044u) >= 0 ) /*0xffd6d0ff*/
{
PciExpressSetFlag(); /*0xffd6d101*/
v2 = sub_FFD74F0F(); /*0xffd6d106*/
*(_BYTE *)(v2 + 1024068) |= 0x80u; /*0xffd6d111*/
}
BootMode = PeiServicesGetBootMode(); /*0xffd6d114*/
v4 = (*(int (__cdecl **)(int, void *))(*(_DWORD *)BootMode + 36))(BootMode, &unk_FFD7AEC4); /*0xffd6d121*/
v5 = v4; /*0xffd6d124*/
if ( v4 < 0 ) /*0xffd6d12a*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v4); /*0xffd6d137*/
v6 = DebugAssert(); /*0xffd6d13f*/
if ( v6 ) /*0xffd6d146*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffd6d157*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\SiInit\\Pei\\SiInit.c",
207,
"!EFI_ERROR (Status)");
}
return v5; /*0xffd6d15f*/
}
// Function: SiInitDispatchEndOfPei @ 0xffd6d161 (0x23 bytes)
int __usercall SiInitOnEndOfPei_0@<eax>(int a1@<ebp>, int a2@<esi>)
{
DebugPrintAssert(64, "SiInitOnEndOfPei - Start\n"); /*0xffd6d168*/
PchOnEndOfPei(a1, a2); /*0xffd6d16d*/
DebugPrintAssert(64, "SiInitOnEndOfPei - End\n"); /*0xffd6d179*/
return 0; /*0xffd6d183*/
}
// Function: SiInit_Entry @ 0xffd6d184 (0xbc bytes)
int __thiscall SiInit_Entry(void *this)
{
int v1; // eax
int v2; // eax
int v4; // eax
int v5; // eax
int v6; // eax
int v7; // [esp+0h] [ebp-4h]
DebugPrintAssert(64, "SiInit () - Start\n", this); /*0xffd6d18f*/
v1 = PeiServicesGetBootMode(); /*0xffd6d194*/
if ( (*(int (__stdcall **)(int))(*(_DWORD *)v1 + 32))(v1) ) /*0xffd6d1a9*/
{
v2 = DebugAssert(); /*0xffd6d1b3*/
if ( v2 ) /*0xffd6d1ba*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd6d1cb*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\SiInit\\Pei\\SiInit.c",
157,
"((BOOLEAN)(0==1))");
return -2147483645; /*0xffd6d1d1*/
}
else
{
PchInit(v7); /*0xffd6d1db*/
PchHsioSync(); /*0xffd6d1e0*/
v4 = PeiServicesGetBootMode(); /*0xffd6d1e5*/
v5 = (*(int (__cdecl **)(int, void *))(*(_DWORD *)v4 + 36))(v4, &unk_FFD7AED0); /*0xffd6d1f2*/
if ( v5 < 0 ) /*0xffd6d1f9*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0xffd6d206*/
v6 = DebugAssert(); /*0xffd6d20e*/
if ( v6 ) /*0xffd6d215*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffd6d226*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\SiInit\\Pei\\SiInit.c",
180,
"!EFI_ERROR (Status)");
}
DebugPrintAssert(64, "SiInit () - End\n"); /*0xffd6d233*/
return 0; /*0xffd6d23a*/
}
}
// Function: DebugClear @ 0xffd6d240 (0x13 bytes)
int DebugClear()
{
int BootMode; // eax
BootMode = PeiServicesGetBootMode(); /*0xffd6d240*/
return (*(int (__cdecl **)(int, void *))(*(_DWORD *)BootMode + 24))(BootMode, &unk_FFD7EC5C); /*0xffd6d252*/
}
// Function: DebugPrint @ 0xffd6d253 (0x23 bytes)
int __fastcall DebugPrint(int a1, int a2, int a3, int a4)
{
int BootMode; // eax
BootMode = PeiServicesGetBootMode(); /*0xffd6d25a*/
return (*(int (__cdecl **)(int, int, int, int, int))(*(_DWORD *)BootMode + 32))(BootMode, a1, a2, a3, a4); /*0xffd6d272*/
}
// Function: SiCreateHob @ 0xffd6d276 (0x1f bytes)
int __fastcall SiCreateHob(int n3, int n48, int *p_n3)
{
int BootMode; // eax
BootMode = PeiServicesGetBootMode(); /*0xffd6d27d*/
return (*(int (__cdecl **)(int, int, int, int *))(*(_DWORD *)BootMode + 52))(BootMode, n3, n48, p_n3); /*0xffd6d291*/
}
// Function: SiFreePages @ 0xffd6d295 (0x1f bytes)
int __cdecl SiFreePages(int a1, int a2)
{
int v2; // ecx
int v3; // esi
int BootMode; // eax
v3 = v2; /*0xffd6d296*/
BootMode = PeiServicesGetBootMode(); /*0xffd6d298*/
return (*(int (__cdecl **)(int, int, int, int))(*(_DWORD *)BootMode + 132))(BootMode, a1, a2, v3); /*0xffd6d2b2*/
}
// Function: DebugAssert @ 0xffd6d2b4 (0x31 bytes)
int DebugAssert()
{
int BootMode; // eax
int v2; // [esp+0h] [ebp-8h] BYREF
int v3; // [esp+4h] [ebp-4h] BYREF
BootMode = PeiServicesGetBootMode(); /*0xffd6d2b9*/
if ( (*(int (__cdecl **)(int, void *, _DWORD, int *, int *))(*(_DWORD *)BootMode + 32))( /*0xffd6d2d8*/
BootMode,
&unk_FFD7AD24,
0,
&v2,
&v3) >= 0 )
return v3; /*0xffd6d2de*/
else
return 0; /*0xffd6d2da*/
}
// Function: DebugPrintAssert @ 0xffd6d2e5 (0x2a bytes)
int DebugPrintAssert(int a1, const char *a2, ...)
{
int result; // eax
int (__cdecl **v3)(int, const char *, char *); // esi
va_list va; // [esp+10h] [ebp+Ch] BYREF
va_start(va, a2);
result = DebugAssert(); /*0xffd6d2e6*/
v3 = (int (__cdecl **)(int, const char *, char *))result; /*0xffd6d2eb*/
if ( result ) /*0xffd6d2ef*/
{
result = PchWdtEndOfPei(); /*0xffd6d2f1*/
if ( (result & a1) != 0 ) /*0xffd6d2fc*/
return (*v3)(a1, a2, (char *)va); /*0xffd6d308*/
}
return result; /*0xffd6d30d*/
}
// Function: SiAssert @ 0xffd6d30f (0x1e bytes)
int __fastcall SiAssert(
int e:__hs__MdePkg__Library__BaseLib__X86ReadIdtr.c,
int n37,
const char *PeiServices____((void__)_0))
{
int result; // eax
result = DebugAssert(); /*0xffd6d315*/
if ( result ) /*0xffd6d31c*/
return (*(int (__cdecl **)(int, int, const char *))(result + 4))( /*0xffd6d324*/
e:__hs__MdePkg__Library__BaseLib__X86ReadIdtr.c,
n37,
PeiServices____((void__)_0));
return result; /*0xffd6d32a*/
}
// Function: SiDelayLoop @ 0xffd6d32d (0x4f bytes)
unsigned int __fastcall SiDelayLoop(unsigned int a1)
{
unsigned int v1; // esi
unsigned int n0x400000; // edi
unsigned __int32 v3; // ebx
unsigned int result; // eax
v1 = a1 >> 22; /*0xffd6d33a*/
n0x400000 = a1 & 0x3FFFFF; /*0xffd6d33d*/
do /*0xffd6d375*/
{
v3 = n0x400000 + (GpioCheckPadOwnership(0x508u) & 0xFFFFFF); /*0xffd6d352*/
n0x400000 = 0x400000; /*0xffd6d354*/
while ( ((v3 - GpioCheckPadOwnership(0x508u)) & 0x800000) == 0 ) /*0xffd6d36e*/
_mm_pause(); /*0xffd6d35b*/
result = v1--; /*0xffd6d370*/
}
while ( result ); /*0xffd6d375*/
return result; /*0xffd6d377*/
}
// Function: SiMicroSecondDelay @ 0xffd6d37c (0x47 bytes)
unsigned int __fastcall SiMicroSecondDelay(unsigned int a1)
{
unsigned __int64 v2; // rtt
LODWORD(v2) = 3579545 * a1; /*0xffd6d3b2*/
HIDWORD(v2) = ((3579545 * (unsigned __int64)a1) >> 32) % 0xF4240; /*0xffd6d3b2*/
SiDelayLoop(v2 / 0xF4240); /*0xffd6d3b7*/
return a1; /*0xffd6d3be*/
}
// Function: PchInit_AfterMem @ 0xffd6d3c3 (0x215 bytes)
// positive sp value has been detected, the output may be wrong!
int __thiscall PchInit_AfterMem(int this)
{
int n231936; // ebx
unsigned __int16 n16464; // dx
int PadConfig; // ebp
unsigned __int16 *v5; // esi
int v6; // esi
_BYTE *v7; // ebx
unsigned __int8 n0x10; // cl
_DWORD *v9; // eax
if ( PchGpioInit() == 2 ) /*0xffd6d3de*/
{
n231936 = 231936; /*0xffd6d3e0*/
PchInterruptConfigEntry(186, 0x4060u, 4, 231936); /*0xffd6d3ed*/
n16464 = 16464; /*0xffd6d3f2*/
}
else
{
n231936 = 232192; /*0xffd6d3f9*/
PchInterruptConfigEntry(186, 0x406Cu, 4, 232192); /*0xffd6d406*/
n16464 = 16468; /*0xffd6d40b*/
}
PchInterruptConfigEntry(186, n16464, 4, 3); /*0xffd6d416*/
PchInterruptConfigEntry(188, 0x4064u, 4, n231936); /*0xffd6d42d*/
PchInterruptConfigEntry(188, 0x4058u, 4, 3); /*0xffd6d43d*/
AssertEfiError(196, 0x3300u, -1, 27); /*0xffd6d44e*/
PadConfig = GpioGetPadConfig(0, 31, 1); /*0xffd6d45f*/
v5 = (unsigned __int16 *)(PadConfig + 100); /*0xffd6d464*/
if ( *(_BYTE *)(this + 2724) != (unsigned __int8)GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 100)) ) /*0xffd6d474*/
{
GpioClearBits(v5, 65279); /*0xffd6d47d*/
GpioModifyBits(v5, 65280, *(unsigned __int8 *)(this + 2724)); /*0xffd6d491*/
}
GpioSetBits(v5, 256); /*0xffd6d49e*/
GpioGetGroupFromPad(v5); /*0xffd6d4a5*/
v6 = *(unsigned __int8 *)v5 << 12; /*0xffd6d4af*/
v7 = (_BYTE *)(v6 | 0xFEC00000); /*0xffd6d4b6*/
*(_BYTE *)(v6 | 0xFEC00000) = 0; /*0xffd6d4c1*/
n0x10 = *(_BYTE *)(this + 2723); /*0xffd6d4c6*/
if ( n0x10 != HIBYTE(*(_DWORD *)(v6 | 0xFEC00010)) && n0x10 < 0x10u ) /*0xffd6d4d6*/
{
*v7 = 0; /*0xffd6d4d8*/
*(_DWORD *)(v6 | 0xFEC00010) = *(unsigned __int8 *)(this + 2723) << 24; /*0xffd6d4ec*/
}
if ( (*(_DWORD *)(this + 2719) & 0x1000000) != 0 ) /*0xffd6d502*/
{
DebugLogPrint_21(196, 12796, 65023, 0); /*0xffd6d52c*/
*v7 = 1; /*0xffd6d533*/
*(_DWORD *)(v6 | 0xFEC00010) = 7798816; /*0xffd6d53b*/
}
else
{
DebugLogPrint_21(196, 12796, 0xFFFF, 512); /*0xffd6d50e*/
*v7 = 1; /*0xffd6d515*/
*(_DWORD *)(v6 | 0xFEC00010) = 1507360; /*0xffd6d51d*/
}
if ( (*(_DWORD *)(this + 2719) & 1) != 0 ) /*0xffd6d54c*/
GpioGetGroupIndexFromPad( /*0xffd6d574*/
(_WORD *)(PadConfig + 108),
(*(_DWORD *)(this + 2719) >> 21) & 7
| (8 * ((32 * *(unsigned __int8 *)(this + 2720)) | HIWORD(*(_DWORD *)(this + 2719)) & 0x1F)));
v9 = (_DWORD *)HobConfig_2(3, 48); /*0xffd6d57f*/
if ( v9 ) /*0xffd6d586*/
{
v9[9] = 0; /*0xffd6d588*/
v9[11] = 0; /*0xffd6d58e*/
v9[8] = v6 | 0xFEC00000; /*0xffd6d598*/
v9[6] = 1; /*0xffd6d5a1*/
v9[7] = 1027; /*0xffd6d5a8*/
v9[10] = 4096; /*0xffd6d5af*/
MemConfig_0((int)(v9 + 2), 0x10u); /*0xffd6d5b6*/
}
HobConfig(v6 | 0xFEC00000, 0); /*0xffd6d5c6*/
return 0; /*0xffd6d5d0*/
}
// Function: SiInitOnEndOfPei @ 0xffd6d5d8 (0xa1 bytes)
int SiInitOnEndOfPei()
{
int BootMode; // esi
int result; // eax
int v2; // esi
int v3; // eax
_BYTE v4[7]; // [esp+4h] [ebp-24h] BYREF
int n251928832; // [esp+Bh] [ebp-1Dh]
int n28671; // [esp+Fh] [ebp-19h]
char v7; // [esp+13h] [ebp-15h]
int v8; // [esp+14h] [ebp-14h] BYREF
int v9; // [esp+20h] [ebp-8h] BYREF
char v10; // [esp+27h] [ebp-1h] BYREF
BootMode = PeiServicesGetBootMode(); /*0xffd6d5eb*/
result = GpioGetPadConfig(0, 31, 2); /*0xffd6d5ed*/
if ( (*(_BYTE *)(result + 164) & 4) != 0 ) /*0xffd6d5fc*/
{
DebugPrintAssert(64, "CMOS Battery bad\n"); /*0xffd6d606*/
v2 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int *))(*(_DWORD *)BootMode + 32))( /*0xffd6d61e*/
BootMode,
&unk_FFD7AD74,
0,
0,
&v9);
result = DebugPrintAssert(64, "Locate IPMIPpi Status %r\n", v2); /*0xffd6d628*/
if ( v2 >= 0 ) /*0xffd6d632*/
{
v4[2] = -48; /*0xffd6d637*/
n251928832 = 251928832; /*0xffd6d63f*/
n28671 = 28671; /*0xffd6d64c*/
v7 = 0; /*0xffd6d65d*/
v3 = (*(int (__cdecl **)(int, int, _DWORD, int, _BYTE *, int, int *, char *))(v9 + 12))( /*0xffd6d660*/
v9,
10,
0,
68,
v4,
16,
&v8,
&v10);
return DebugPrintAssert(64, "SendIpmiCommand Status %r\n", v3); /*0xffd6d66b*/
}
}
return result; /*0xffd6d674*/
}
// Function: PchOnEndOfPei @ 0xffd6d679 (0x1a9 bytes)
int PchOnEndOfPei()
{
int v0; // ebx
int v1; // edi
int BootMode; // eax
int result; // eax
int PadConfig; // eax
void *v5; // ecx
int v6; // esi
int v7; // eax
int v8; // eax
int v9; // eax
int v10; // eax
unsigned __int8 *v11; // [esp+8h] [ebp-8h] BYREF
int n17; // [esp+Ch] [ebp-4h] BYREF
DebugPrintAssert(64, "PchOnEndOfPei after memory PEI module - Start\n"); /*0xffd6d684*/
v0 = PchGpioInit(); /*0xffd6d68e*/
v1 = GpioLockGpios(); /*0xffd6d695*/
BootMode = PeiServicesGetBootMode(); /*0xffd6d697*/
if ( (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, unsigned __int8 **))(*(_DWORD *)BootMode + 32))( /*0xffd6d6ad*/
BootMode,
&unk_FFD7AD64,
0,
0,
&v11) )
{
result = DebugAssert(); /*0xffd6d6b7*/
if ( result ) /*0xffd6d6be*/
return (*(int (__cdecl **)(const char *, int, const char *))(result + 4))( /*0xffd6d6d3*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInit.c",
649,
"((BOOLEAN)(0==1))");
return result; /*0xffd6d6d9*/
}
SiInitOnEndOfPei(); /*0xffd6d6e0*/
PadConfig = GpioGetPadConfig(0, 31, 2); /*0xffd6d6ec*/
*(_BYTE *)(PadConfig + 164) &= 0xF9u; /*0xffd6d6fa*/
DetectAndInitializeCodec(v11); /*0xffd6d704*/
ConfigureHdAudio((int)v11); /*0xffd6d70d*/
DisableHdAudio((int)v11); /*0xffd6d716*/
PchThermalInit(v5); /*0xffd6d71b*/
v6 = GpioGetPadConfig(0, 31, 1); /*0xffd6d730*/
PchInitEndOfPeiCallback((int)v11); /*0xffd6d732*/
v7 = GpioGetPadConfig(0, 31, 2); /*0xffd6d73e*/
*(_DWORD *)(v7 + 172) |= 0x1000000u; /*0xffd6d74f*/
v8 = PeiServicesGetBootMode(); /*0xffd6d755*/
v9 = (*(int (__cdecl **)(int, int *))(*(_DWORD *)v8 + 40))(v8, &n17); /*0xffd6d762*/
if ( v9 < 0 ) /*0xffd6d76f*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0xffd6d778*/
v10 = DebugAssert(); /*0xffd6d780*/
if ( v10 ) /*0xffd6d787*/
(*(void (__cdecl **)(const char *, int, const char *))(v10 + 4))( /*0xffd6d798*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInit.c",
706,
"!EFI_ERROR (Status)");
}
if ( n17 != 17 ) /*0xffd6d7a3*/
goto LABEL_15; /*0xffd6d7a3*/
if ( (v11[2899] & 0x20) != 0 && ConfigureXhci() )
DebugPrintAssert(0x80000000, "PchOnEndOfPei: GpioLockGpios() failed!\n");
if ( v0 != 1 || v1 ) /*0xffd6d7cf*/
{
PchPcrRead(v11 + 3500); /*0xffd6d7eb*/
LABEL_15:
*(_BYTE *)(v6 + 225) = 1; /*0xffd6d7f0*/
goto LABEL_16; /*0xffd6d7f0*/
}
DebugPrintAssert(64, "PchOnEndOfPei skips hiding P2sb controller for PCH H A0\n"); /*0xffd6d7d8*/
LABEL_16:
if ( n17 == 17 ) /*0xffd6d7fe*/
PchPcrWrite(v11 + 3500); /*0xffd6d80a*/
return DebugPrintAssert(64, "PchOnEndOfPei after memory PEI module - End\n"); /*0xffd6d81d*/
}
// Function: PchInit @ 0xffd6d822 (0x3d2 bytes)
// positive sp value has been detected, the output may be wrong!
int __thiscall PchInit(int this)
{
int n2; // ebx
int v3; // eax
int v4; // eax
int BootMode; // eax
int v6; // esi
char *v7; // eax
int v8; // eax
int v9; // eax
int v10; // eax
int v11; // eax
int v12; // esi
int PadConfig; // eax
int v14; // eax
int v15; // eax
int v16; // eax
int v17; // eax
int v18; // eax
int v19; // esi
char v20; // cl
int v21; // eax
char *v23; // [esp+8h] [ebp-10h] BYREF
unsigned int v24; // [esp+14h] [ebp-4h] BYREF
DebugPrintAssert(64, "PchInit - Start\n"); /*0xffd6d837*/
n2 = PchGpioInit(); /*0xffd6d843*/
v3 = DebugClear(); /*0xffd6d845*/
if ( v3 < 0 ) /*0xffd6d84c*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v3); /*0xffd6d859*/
v4 = DebugAssert(); /*0xffd6d861*/
if ( v4 ) /*0xffd6d868*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd6d876*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchSmmControlLib\\PeiPchSmmControlLib.c",
47,
"!EFI_ERROR (Status)");
}
BootMode = PeiServicesGetBootMode(); /*0xffd6d87c*/
if ( !(*(int (__cdecl **)(int, void *, _DWORD, _DWORD, char **))(*(_DWORD *)BootMode + 32))( /*0xffd6d892*/
BootMode,
&unk_FFD7AE54,
0,
0,
&v23) )
{
v6 = 0; /*0xffd6d8a0*/
if ( *((_WORD *)v23 + 1) ) /*0xffd6d8a2*/
{
v7 = v23 + 2; /*0xffd6d8a8*/
do /*0xffd6d8af*/
{
v7 += 24; /*0xffd6d8ab*/
++v6; /*0xffd6d8ae*/
}
while ( *(_WORD *)v7 ); /*0xffd6d8af*/
}
DebugPrintAssert(64, "PCH Installing PcieDeviceTable HOB (%d entries)\n", v6); /*0xffd6d8bc*/
if ( !SataConfig((int)&unk_FFD7AD04, v23, 24 * v6) ) /*0xffd6d8ce*/
{
v8 = DebugAssert(); /*0xffd6d8da*/
if ( v8 ) /*0xffd6d8e1*/
(*(void (__cdecl **)(const char *, int, const char *))(v8 + 4))( /*0xffd6d8f2*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInit.c",
807,
"HobPtr != 0");
}
}
if ( !SataConfig((int)&unk_FFD7ADF4, (char *)this, 0x1B24u) ) /*0xffd6d904*/
{
v9 = DebugAssert(); /*0xffd6d90e*/
if ( v9 ) /*0xffd6d915*/
(*(void (__cdecl **)(const char *, int, const char *))(v9 + 4))( /*0xffd6d926*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInit.c",
811,
"HobPtr != 0");
}
v10 = PchSetLinkWidth(); /*0xffd6d92c*/
if ( v10 < 0 ) /*0xffd6d933*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v10); /*0xffd6d940*/
v11 = DebugAssert(); /*0xffd6d948*/
if ( v11 ) /*0xffd6d94f*/
(*(void (__cdecl **)(const char *, int, const char *))(v11 + 4))( /*0xffd6d960*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInit.c",
817,
"!EFI_ERROR (Status)");
}
v12 = PchGpioInit(); /*0xffd6d96d*/
SendCodecCommand((unsigned __int8 *)this); /*0xffd6d96f*/
GetCodecCurrentBclkFrequency(); /*0xffd6d974*/
PchInterruptCheck(0x2234u, 255, 31); /*0xffd6d985*/
PchInterruptCheck(0x223Eu, 243, 96); /*0xffd6d996*/
if ( v12 == 1 ) /*0xffd6d9a1*/
ConfigureLinkFrequency(this); /*0xffd6d9a5*/
else
AssertEfiError(239, 0x2618u, -1, 0x2000000); /*0xffd6d9bd*/
PadConfig = GpioGetPadConfig(0, 31, 1); /*0xffd6d9cb*/
*(_BYTE *)(PadConfig + 226) |= 1u; /*0xffd6d9da*/
*(_DWORD *)(PadConfig + 228) &= 0xFFFFFFDE; /*0xffd6d9e9*/
v14 = PchInit_AfterMem(this); /*0xffd6d9f1*/
if ( v14 < 0 ) /*0xffd6d9f8*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v14); /*0xffd6da05*/
v15 = DebugAssert(); /*0xffd6da0d*/
if ( v15 ) /*0xffd6da14*/
(*(void (__cdecl **)(const char *, int, const char *))(v15 + 4))( /*0xffd6da25*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInit.c",
888,
"!EFI_ERROR (Status)");
}
v16 = PchTraceHubOnEndOfPei((_BYTE *)this); /*0xffd6da2d*/
if ( v16 < 0 ) /*0xffd6da34*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v16); /*0xffd6da41*/
v17 = DebugAssert(); /*0xffd6da49*/
if ( v17 ) /*0xffd6da50*/
(*(void (__cdecl **)(const char *, int, const char *))(v17 + 4))( /*0xffd6da61*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInit.c",
893,
"!EFI_ERROR (Status)");
}
PchRootPortsInit(this); /*0xffd6da69*/
PchTraceHubSetMemoryAsUncached(this); /*0xffd6da70*/
MEMORY[0xFDAF0010] |= 3u; /*0xffd6da8c*/
MEMORY[0xFDAE0010] |= 3u; /*0xffd6da9c*/
MEMORY[0xFDAD0010] |= 3u; /*0xffd6daaa*/
MEMORY[0xFDAC0010] |= 3u; /*0xffd6daba*/
AssertEfiError(195, 0x3418u, -1, 3); /*0xffd6dabf*/
AssertEfiError(195, 0x3F00u, -1, 256); /*0xffd6dad2*/
PchInterruptConfigEntry(195, 0x3F04u, 4, 196608); /*0xffd6dae5*/
v18 = GpioGetPadConfig(0, 31, 4); /*0xffd6daf1*/
*(_DWORD *)(v18 + 128) = ~(*(_DWORD *)(this + 2763) << 16) & 0x40000 | 0x20 | *(_DWORD *)(v18 + 128) & 0xFFFEAAFF; /*0xffd6db1b*/
AssertEfiError(198, 0x10u, -34, 0); /*0xffd6db27*/
PchInterruptAssign(this); /*0xffd6db31*/
if ( (*(_BYTE *)(this + 3020) & 1) != 0 ) /*0xffd6db3d*/
{
v19 = GpioGetPadConfig(0, 31, 0); /*0xffd6db51*/
GpioGetPadConfig(0, 31, 2); /*0xffd6db53*/
v20 = *(_BYTE *)(v19 + 100) & 0x7C; /*0xffd6db63*/
if ( *(_DWORD *)(this + 3028) == 1 ) /*0xffd6db69*/
{
v20 |= 1u; /*0xffd6db75*/
}
else if ( *(_DWORD *)(this + 3028) == 2 ) /*0xffd6db6e*/
{
v20 |= 2u; /*0xffd6db70*/
}
*(_BYTE *)(v19 + 100) = v20 | 0xC0; /*0xffd6db7b*/
if ( !*(_DWORD *)(this + 3024) ) /*0xffd6db7e*/
*(_BYTE *)(v19 + 100) &= ~0x40u; /*0xffd6db8b*/
}
if ( (*(_BYTE *)(this + 3534) & 1) == 0 ) /*0xffd6db95*/
{
v21 = GpioGetPadConfig(0, 31, 5); /*0xffd6db9e*/
*(_BYTE *)(v21 + 221) = *(_BYTE *)(v21 + 221) & 0xFC | 2; /*0xffd6dbb0*/
}
if ( n2 != 2 ) /*0xffd6dbb9*/
{
ConfigureAudioPll(&v24); /*0xffd6dbbf*/
GpioLockGpios(); /*0xffd6dbc4*/
*(_DWORD *)(v24 + 796) |= 0x1000u; /*0xffd6dbd8*/
}
return DebugPrintAssert(64, "PchInit - End\n"); /*0xffd6dbec*/
}
// Function: AssertCpuDeadLoop_3 @ 0xffd6dbf4 (0x8f bytes)
int __cdecl sub_FFD6DBF4(int a1, int a2)
{
int v2; // ecx
int v3; // edi
int BootMode; // eax
int v5; // esi
int v6; // eax
int v7; // eax
int (__cdecl **v9)(int, _DWORD, int, int, int, _DWORD, _DWORD); // [esp+Ch] [ebp-4h] BYREF
v3 = v2; /*0xffd6dbfb*/
BootMode = PeiServicesGetBootMode(); /*0xffd6dbfd*/
v5 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int (__cdecl ***)(int, _DWORD, int, int, int, _DWORD, _DWORD)))(*(_DWORD *)BootMode + 32))( /*0xffd6dc15*/
BootMode,
&unk_FFD7AE64,
0,
0,
&v9);
if ( v5 ) /*0xffd6dc1c*/
{
DebugPrintAssert(64, "PchTraceHubSetMemoryAsUncached() PeiServicesLocatePpi failed\n"); /*0xffd6dc41*/
if ( v5 < 0 ) /*0xffd6dc4a*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0xffd6dc57*/
v7 = DebugAssert(); /*0xffd6dc5f*/
if ( v7 ) /*0xffd6dc66*/
(*(void (__cdecl **)(const char *, int, const char *))(v7 + 4))( /*0xffd6dc74*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchTraceHub.c",
72,
"!EFI_ERROR (Status)");
}
}
else
{
v6 = PeiServicesGetBootMode(); /*0xffd6dc1e*/
return (*v9)(v6, v9, a1, a2, v3, 0, 0); /*0xffd6dc36*/
}
return v5; /*0xffd6dc7a*/
}
// Function: PchInitEndOfPeiCallback @ 0xffd6dc83 (0x289 bytes)
int __thiscall PchInitEndOfPeiCallback(int this)
{
int PadConfig; // esi
int BootMode; // eax
int v5; // ebx
int v6; // esi
unsigned int v7; // eax
unsigned int v8; // ecx
unsigned int n0x1000; // esi
bool v10; // cc
unsigned int v11; // eax
unsigned int v12; // ebp
int v13; // eax
int v14; // eax
int n17; // [esp+14h] [ebp-4h] BYREF
DebugPrintAssert(64, "PchTraceHubOnEndOfPei() Start\n"); /*0xffd6dc98*/
PadConfig = GpioGetPadConfig(0, 31, 7); /*0xffd6dcac*/
if ( (unsigned __int16)GpioGetGroupFromPad((unsigned __int16 *)PadConfig) == 0xFFFF ) /*0xffd6dcbd*/
{
DebugPrintAssert(64, "PchTraceHubOnEndOfPei() TraceHub Device not present\n"); /*0xffd6dcc6*/
return 0; /*0xffd6dccf*/
}
BootMode = PeiServicesGetBootMode(); /*0xffd6dcd4*/
v5 = (*(int (__cdecl **)(int, int *))(*(_DWORD *)BootMode + 40))(BootMode, &n17); /*0xffd6dce9*/
if ( n17 == 17 || (*(_DWORD *)(PadConfig + 4) & 2) == 0 ) /*0xffd6dcf4*/
return 0; /*0xffd6dcf4*/
v6 = MEMORY[0xFE1000E0]; /*0xffd6dcfb*/
DebugPrintAssert(64, "PchTraceHubOnEndOfPei() - R_PCH_TRACE_HUB_CSR_MTB_SCRATCHPAD0 = 0x%08x\n", MEMORY[0xFE1000E0]); /*0xffd6dd05*/
if ( (v6 & 0x1000000) != 0 || (*(_BYTE *)(this + 3308) & 3) != 0 ) /*0xffd6dd1c*/
DebugPrintAssert(64, "PchTraceHubOnEndOfPei()- Trace Hub configured to Host Debugger or SCRATCHPAD0_BIT24 set\n"); /*0xffd6dd25*/
if ( n17 == 5 ) /*0xffd6dd36*/
{
if ( !MEMORY[0xFE1A010C] ) /*0xffd6dd4a*/
goto LABEL_32; /*0xffd6dd4a*/
}
else if ( (MEMORY[0xFE1A0100] & 1) != 0 ) /*0xffd6dd3f*/
{
goto LABEL_32; /*0xffd6dd3f*/
}
v7 = *(_DWORD *)(this + 3316); /*0xffd6dd50*/
v8 = *(_DWORD *)(this + 3312); /*0xffd6dd56*/
n0x1000 = v8 + v7; /*0xffd6dd5c*/
if ( !(v8 + v7) ) /*0xffd6dd61*/
goto LABEL_32; /*0xffd6dd61*/
v10 = v7 <= v8; /*0xffd6dd67*/
if ( v7 < v8 ) /*0xffd6dd69*/
{
if ( v7 ) /*0xffd6dd6d*/
n0x1000 = 2 * v8; /*0xffd6dd6f*/
v10 = v7 <= v8; /*0xffd6dd72*/
}
if ( !v10 && v8 ) /*0xffd6dd78*/
n0x1000 = 2 * v7; /*0xffd6dd7a*/
v11 = PchUsbInit((n0x1000 >> 12) + ((n0x1000 & 0xFFF) != 0), n0x1000); /*0xffd6dd93*/
v12 = v11; /*0xffd6dd99*/
if ( v11 ) /*0xffd6dda0*/
{
v5 = AssertCpuDeadLoop_3(v11, 0); /*0xffd6dde2*/
if ( v5 < 0 ) /*0xffd6dde8*/
{
DebugPrintAssert(64, "PchTraceHubOnEndOfPei() Setting memory UNCACHEABLE failed!\n"); /*0xffd6ddf1*/
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0xffd6de01*/
v14 = DebugAssert(); /*0xffd6de09*/
if ( v14 ) /*0xffd6de10*/
(*(void (__cdecl **)(const char *, int, const char *))(v14 + 4))( /*0xffd6de25*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchTraceHub.c",
161,
"!EFI_ERROR (Status)");
return v5; /*0xffd6de2b*/
}
if ( *(_DWORD *)(this + 3312) ) /*0xffd6de30*/
{
MEMORY[0xFE1A0108] = v12 >> 12; /*0xffd6de3e*/
DebugPrintAssert(64, "PchTraceHubOnEndOfPei() MTB_MSC0BAR = 0x%08x\n", v12 >> 12); /*0xffd6de52*/
MEMORY[0xFE1A010C] = *(_DWORD *)(this + 3312) >> 12; /*0xffd6de63*/
DebugPrintAssert(64, "PchTraceHubOnEndOfPei() MTB_MSC0SIZE = 0x%08x\n", MEMORY[0xFE1A010C]); /*0xffd6de77*/
}
if ( *(_DWORD *)(this + 3316) ) /*0xffd6de7f*/
{
MEMORY[0xFE1A0208] = (v12 + *(_DWORD *)(this + 3312)) >> 12; /*0xffd6de93*/
DebugPrintAssert(64, "PchTraceHubOnEndOfPei() MTB_MSC1BAR = 0x%08x\n", MEMORY[0xFE1A0208]); /*0xffd6dea7*/
MEMORY[0xFE1A020C] = *(_DWORD *)(this + 3316) >> 12; /*0xffd6deb8*/
DebugPrintAssert(64, "PchTraceHubOnEndOfPei() MTB_MSC1SIZE = 0x%08x\n", MEMORY[0xFE1A020C]); /*0xffd6decc*/
}
LABEL_32:
DebugPrintAssert(64, "PchTraceHubOnEndOfPei() TraceHub Config Disable\n"); /*0xffd6ded4*/
AssertEfiError(188, 0x938u, -2, 1); /*0xffd6deee*/
DebugPrintAssert(64, "PchTraceHubOnEndOfPei() End\n"); /*0xffd6defa*/
return v5; /*0xffd6df02*/
}
DebugPrintAssert(64, "PchTraceHubOnEndOfPei() Memory allocation failed!\n"); /*0xffd6dda9*/
v13 = DebugAssert(); /*0xffd6ddb0*/
if ( v13 ) /*0xffd6ddb7*/
(*(void (__cdecl **)(const char *, int, const char *))(v13 + 4))( /*0xffd6ddc8*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchTraceHub.c",
155,
"((BOOLEAN)(0==1))");
return -2147483639; /*0xffd6df04*/
}
// Function: HdaCodecWaitNotBusy @ 0xffd6df0c (0x43 bytes)
int __fastcall HdaCodecWaitNotBusy(_DWORD *a1, int a2, int a3)
{
unsigned int i; // esi
for ( i = 0; i < 0xC8; ++i ) /*0xffd6df1a*/
{
if ( (a2 & *a1) == a3 ) /*0xffd6df23*/
break; /*0xffd6df23*/
SiMicroSecondDelay(5u); /*0xffd6df28*/
}
return i < 0xC8 ? 0 : -2147483630;
}
// Function: Assert_25 @ 0xffd6df4f (0x8b bytes)
int __fastcall Assert_25(_DWORD *a1, unsigned int *p_p_n5, char a3)
{
unsigned __int16 *v5; // esi
int v7; // ebp
v5 = (unsigned __int16 *)(a1 + 26); /*0xffd6df5c*/
if ( HdaCodecWaitNotBusy(a1 + 26, 1, 0) < 0 ) /*0xffd6df69*/
{
DebugPrintAssert(0x80000000, "ICB bit is not zero before SendCodecCommand! \n"); /*0xffd6df75*/
return -2147483641; /*0xffd6df81*/
}
a1[24] = *p_p_n5; /*0xffd6df8a*/
GpioSetBits(v5, 3); /*0xffd6df8d*/
v7 = HdaCodecWaitNotBusy(v5, 1, 0); /*0xffd6df9e*/
if ( v7 >= 0 )
{
if ( a3 == 1 )
{
if ( (GpioGetGroupFromPad(v5) & 2) == 0 )
{
DebugPrintAssert(0x80000000, "SendCodecCommand: ReadBack fail! \n");
return -2147483641; /*0xffd6dfd8*/
}
*p_p_n5 = a1[25]; /*0xffd6dfca*/
}
return 0; /*0xffd6dfcc*/
}
else
{
GpioClearBits(v5, 65534); /*0xffd6dfac*/
return v7; /*0xffd6dfb1*/
}
}
// Function: Assert_29 @ 0xffd6dfda (0xaa bytes)
int __fastcall Assert_29(_DWORD *a1, unsigned __int8 n2, int *p_n5)
{
int n2_1; // esi
int *p_n5_1; // edi
int *p_n5_2; // ebx
n2_1 = n2; /*0xffd6dfe1*/
p_n5_1 = p_n5; /*0xffd6dfe5*/
*p_n5 = 0; /*0xffd6dff7*/
p_n5 = (int *)((n2 << 28) | 0xF0016); /*0xffd6dffd*/
if ( Assert_25(a1, (unsigned int *)&p_n5, 1) >= 0 )
{
p_n5_2 = p_n5; /*0xffd6e020*/
DebugPrintAssert(64, "SDI:%d Verb F00h ParamtererId = 16h response = 0x%08x\n", n2_1, p_n5); /*0xffd6e02c*/
if ( p_n5_2 && (n2 > 1u || ((unsigned __int8)p_n5_2 & 4) != 0) && (n2 != 2 || ((unsigned __int8)p_n5_2 & 0x10) != 0) )
{
*p_n5_1 = (unsigned __int8)p_n5_2 & 0x1F; /*0xffd6e05c*/
DebugPrintAssert(
64,
"HDA: Codec Static Frequency Switching supported - FrequencySupportMask = 0x%08x\n",
(unsigned __int8)p_n5_2 & 0x1F);
return 0; /*0xffd6e066*/
}
else
{
DebugPrintAssert(64, "HDA: Codec Static Frequency Switching not supported!\n");
return -2147483645; /*0xffd6e076*/
}
}
else
{
DebugPrintAssert(0x80000000, "Error: Reading the Codec BCLK Frequency Switching support fail!\n");
return -2147483632; /*0xffd6e019*/
}
}
// Function: Assert_8 @ 0xffd6e084 (0x9d bytes)
int __fastcall Assert_8(_DWORD *a1, unsigned __int8 n3, unsigned int p_n5)
{
int *p_n5_1; // ebx
int n3_1; // edi
int v6; // esi
int v7; // ecx
p_n5_1 = (int *)p_n5; /*0xffd6e088*/
n3_1 = n3; /*0xffd6e08d*/
*(_DWORD *)p_n5 = 5; /*0xffd6e095*/
p_n5 = (n3 << 28) | 0xF3700; /*0xffd6e0a5*/
if ( Assert_25(a1, &p_n5, 1) >= 0 )
{
DebugPrintAssert(64, "SDI:%d Verb F37h (GET_CCF) response = 0x%08x\n", n3_1, p_n5); /*0xffd6e0d5*/
v6 = -2147483634; /*0xffd6e0dd*/
v7 = 0; /*0xffd6e0e2*/
while ( ((p_n5 >> v7) & 1) == 0 ) /*0xffd6e0eb*/
{
if ( (unsigned int)++v7 >= 5 ) /*0xffd6e0f1*/
goto LABEL_8; /*0xffd6e0f1*/
}
*p_n5_1 = v7; /*0xffd6e0fe*/
DebugPrintAssert(64, "SDI:%d Codec BCLK frequency = %d\n", n3_1, v7); /*0xffd6e100*/
v6 = 0; /*0xffd6e108*/
LABEL_8:
DebugPrintAssert(64, "GetCodecCurrentBclkFrequency() Status = %r\n", v6); /*0xffd6e10a*/
return v6; /*0xffd6e11a*/
}
else
{
DebugPrintAssert(0x80000000, "Error: Reading the Codec current BCLK Frequency fail!\n");
return -2147483632; /*0xffd6e0c3*/
}
}
// Function: Assert_28 @ 0xffd6e121 (0x14b bytes)
int __usercall Assert_28@<eax>(int a1@<edx>, int a2, int n3)
{
unsigned int *v4; // ebp
int v5; // eax
__int16 n28; // dx
unsigned __int16 GroupFromPad; // ax
unsigned __int16 v9; // ax
int v10; // eax
__int16 n13; // [esp-4h] [ebp-14h]
v4 = (unsigned int *)(a1 + 3140); /*0xffd6e12e*/
*(_DWORD *)(a1 + 3140) &= ~0x10000u; /*0xffd6e13e*/
v5 = HdaCodecWaitNotBusy((_DWORD *)(a1 + 3140), 0x800000, 0); /*0xffd6e141*/
if ( v5 >= 0 )
{
DebugPrintAssert(64, "HDA: HDA-Link Static BCLK Frequency Switch ID = %d - ", n3);
if ( n3 ) /*0xffd6e184*/
{
if ( n3 == 1 ) /*0xffd6e189*/
{
DebugPrintAssert(64, "12MHz\n"); /*0xffd6e1b1*/
n28 = 28; /*0xffd6e1ba*/
n13 = 13; /*0xffd6e1bb*/
}
else
{
if ( n3 == 2 ) /*0xffd6e18e*/
DebugPrintAssert(64, "24MHz\n"); /*0xffd6e1a9*/
else
DebugPrintAssert(64, "Default 24MHz\n"); /*0xffd6e196*/
n28 = 60; /*0xffd6e19f*/
n13 = 28; /*0xffd6e1a0*/
}
}
else
{
DebugPrintAssert(64, "6MHz\n"); /*0xffd6e1c5*/
n28 = 13; /*0xffd6e1ce*/
n13 = 5; /*0xffd6e1cf*/
}
GpioGetGroupIndexFromPad((_WORD *)(a1 + 4), n28); /*0xffd6e1d5*/
GpioGetGroupIndexFromPad((_WORD *)(a1 + 6), n13); /*0xffd6e1df*/
GroupFromPad = GpioGetGroupFromPad((unsigned __int16 *)(a1 + 4)); /*0xffd6e1e7*/
DebugPrintAssert(64, "HDA: OUTPAY (Output Payload Capability) = 0x%04x\n", GroupFromPad);
v9 = GpioGetGroupFromPad((unsigned __int16 *)(a1 + 6)); /*0xffd6e1ff*/
DebugPrintAssert(64, "HDA: INPAY (Input Payload Capability) = 0x%04x\n", v9);
*v4 = n3 | *v4 & 0xFFFFFFF0; /*0xffd6e21e*/
DebugPrintAssert(64, "HDA: LCTLx (Link %d Control) = 0x%08x\n", 0, *v4);
*v4 |= 0x10000u; /*0xffd6e243*/
v10 = HdaCodecWaitNotBusy((_DWORD *)(a1 + 3140), 0x800000, 0x800000); /*0xffd6e246*/
if ( v10 < 0 )
DebugPrintAssert(0x80000000, "HDA: Turn on the link (SPA = 1) failed! CPA polling Status = %r\n", v10);
return 0; /*0xffd6e265*/
}
else
{
DebugPrintAssert(0x80000000, "HDA: Turn off the link (SPA = 0) failed! CPA polling Status = %r\n", v5);
return -2147483642; /*0xffd6e15e*/
}
}
// Function: DebugLogPrint_24 @ 0xffd6e26c (0x16f bytes)
int __thiscall DebugLogPrint_24(unsigned __int16 *this, int a2, int n3)
{
unsigned __int8 n3_1; // bl
int n3_2; // esi
int v6; // eax
int result; // eax
int n3_3; // esi
int v9; // [esp-8h] [ebp-1Ch]
int v10; // [esp-8h] [ebp-1Ch]
int p_n5; // [esp+10h] [ebp-4h] BYREF
n3_1 = n3; /*0xffd6e26e*/
n3_2 = (unsigned __int8)n3; /*0xffd6e275*/
DebugPrintAssert(64, "ConfigureLinkFrequency() Start [SDI:%d]\n", (unsigned __int8)n3); /*0xffd6e282*/
if ( n3_1 <= 1u )
{
DebugPrintAssert(64, "HDA: HDAudio-Link frequency configuration\n");
n3_3 = (*(_DWORD *)this >> 8) & 0xF; /*0xffd6e2f6*/
GpioGetGroupIndexFromPad((_WORD *)(a2 + 6), 28); /*0xffd6e2fa*/
result = Assert_29((_DWORD *)a2, n3_1, &p_n5); /*0xffd6e308*/
if ( result < 0 ) /*0xffd6e312*/
return result; /*0xffd6e312*/
result = Assert_8((_DWORD *)a2, n3_1, (unsigned int)&n3); /*0xffd6e321*/
if ( result < 0 ) /*0xffd6e329*/
return result; /*0xffd6e329*/
if ( n3 == n3_3 )
{
DebugPrintAssert(64, "HDA: Requested BCLK clock frequency matches current frequency (ID = %d) - Exit\n", n3);
return 0; /*0xffd6e34a*/
}
if ( (((unsigned int)p_n5 >> n3_3) & 1) != 0 )
{
DebugPrintAssert(64, "HDA: Requested Frequency ID = %d - Supported!\n", n3_3);
if ( Assert_28(a2, v9, n3_3) < 0 ) /*0xffd6e378*/
return -2147483641; /*0xffd6e37f*/
SiMicroSecondDelay(*(this + 8)); /*0xffd6e385*/
if ( Assert_8((_DWORD *)a2, n3_1, (unsigned int)&n3) == -2147483634 || n3 != n3_3 )
{
DebugPrintAssert(0x80000000, "HDA: Frequency switching failed - return to default!\n");
Assert_28(a2, v10, 2); /*0xffd6e3bb*/
return -2147483641; /*0xffd6e3c3*/
}
}
DebugPrintAssert(64, "ConfigureLinkFrequency() End\n"); /*0xffd6e3cc*/
return 0; /*0xffd6e3d1*/
}
if ( n3_1 == 2 )
{
DebugPrintAssert(0x80000000, "HDA: Invalid SDI number %d\n", n3_2);
v6 = DebugAssert(); /*0xffd6e2a8*/
if ( v6 ) /*0xffd6e2af*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffd6e2c0*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchHda.c",
380,
"((BOOLEAN)(0==1))");
}
DebugPrintAssert(0x80000000, "HDA: Invalid SDI number for frequency configuration!\n");
return -2147483646; /*0xffd6e3d5*/
}
// Function: DebugLogPrint_26 @ 0xffd6e3db (0x8c bytes)
unsigned __int16 *__fastcall DebugLogPrint_26(int a1, char a2, char n3)
{
int v4; // eax
int v5; // esi
int v6; // ebx
char v7; // al
char n3_1; // al
unsigned __int16 *v10; // [esp+Ch] [ebp-8h] BYREF
char v11; // [esp+13h] [ebp-1h]
v11 = a2; /*0xffd6e3e5*/
if ( !a1 ) /*0xffd6e3ea*/
{
v4 = DebugAssert(); /*0xffd6e3ec*/
if ( v4 ) /*0xffd6e3f3*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd6e404*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchHda.c",
445,
"VendorDeviceId != 0");
}
v5 = 0; /*0xffd6e40a*/
do /*0xffd6e45c*/
{
v10 = 0; /*0xffd6e40c*/
v6 = DebugPrint((int)&unk_FFD7AD54, v5, 0, (int)&v10); /*0xffd6e425*/
if ( !v6 ) /*0xffd6e42b*/
{
if ( v10 ) /*0xffd6e42f*/
{
if ( (v10[1] | (*v10 << 16)) == a1 ) /*0xffd6e43f*/
{
v7 = *((_BYTE *)v10 + 4); /*0xffd6e441*/
if ( v7 == -1 || v7 == v11 ) /*0xffd6e44b*/
{
n3_1 = *((_BYTE *)v10 + 5); /*0xffd6e44d*/
if ( n3_1 == -1 || n3_1 == n3 ) /*0xffd6e457*/
break; /*0xffd6e457*/
}
}
}
}
++v5; /*0xffd6e459*/
}
while ( !v6 ); /*0xffd6e45c*/
return v10; /*0xffd6e45e*/
}
// Function: DebugLogPrint @ 0xffd6e467 (0x34f bytes)
int __fastcall DebugLogPrint(unsigned __int16 *a1, unsigned __int16 *n3, int a3)
{
int v3; // ebx
_DWORD *v4; // edi
__int16 GroupFromPad; // ax
int v6; // esi
unsigned __int16 *v7; // ecx
int v8; // esi
char v9; // al
unsigned __int8 v10; // cl
unsigned __int16 *v11; // edx
unsigned __int8 n3a_1; // al
int v13; // edi
char v14; // bl
int v15; // eax
unsigned __int16 *v16; // eax
unsigned __int16 *v17; // esi
unsigned int *v18; // edx
unsigned int p_n5_2; // eax
int v20; // eax
unsigned int n3_2; // eax
const char *SDI%d_has_no_HD_Audio_device._n; // [esp-8h] [ebp-30h]
int n3a_2; // [esp-4h] [ebp-2Ch]
unsigned __int8 v25; // [esp+Eh] [ebp-1Ah]
char v26; // [esp+Fh] [ebp-19h]
unsigned int p_p_n5; // [esp+10h] [ebp-18h] BYREF
int n3a; // [esp+14h] [ebp-14h]
unsigned __int16 *v29; // [esp+18h] [ebp-10h]
unsigned int p_n5; // [esp+1Ch] [ebp-Ch] BYREF
unsigned __int16 *n3_1; // [esp+24h] [ebp-4h]
unsigned int p_n5_1; // [esp+28h] [ebp+0h] BYREF
char *retaddr; // [esp+2Ch] [ebp+4h]
n3_1 = n3; /*0xffd6e47a*/
v29 = a1; /*0xffd6e47e*/
DebugPrintAssert(64, "DetectAndInitializeCodec() Start\n"); /*0xffd6e482*/
v3 = a3; /*0xffd6e487*/
v4 = (_DWORD *)(a3 + 8); /*0xffd6e490*/
*(_DWORD *)(a3 + 8) |= 1u; /*0xffd6e499*/
HdaCodecWaitNotBusy((_DWORD *)(a3 + 8), 1, 1); /*0xffd6e49b*/
GroupFromPad = GpioGetGroupFromPad((unsigned __int16 *)a3); /*0xffd6e4a5*/
GpioGetGroupIndexFromPad((_WORD *)a3, GroupFromPad); /*0xffd6e4af*/
*(_BYTE *)(a3 + 14) |= 7u; /*0xffd6e4bd*/
*(_DWORD *)(a3 + 8) &= ~1u; /*0xffd6e4c7*/
v6 = HdaCodecWaitNotBusy((_DWORD *)(a3 + 8), 1, 0); /*0xffd6e4ce*/
if ( v6 >= 0 )
{
v7 = v29; /*0xffd6e4e1*/
*v4 |= 1u; /*0xffd6e4e8*/
SiMicroSecondDelay(v7[8]); /*0xffd6e4ee*/
v6 = HdaCodecWaitNotBusy(v4, 1, 1); /*0xffd6e4ff*/
if ( v6 < 0 ) /*0xffd6e504*/
{
DebugPrintAssert(0x80000000, "UnReset High Definition Audio (CRST = 1) Time Out - 2!\n"); /*0xffd6e50b*/
goto LABEL_38; /*0xffd6e50b*/
}
v8 = 0; /*0xffd6e510*/
v9 = 0; /*0xffd6e512*/
while ( 1 ) /*0xffd6e517*/
{
v10 = *(_BYTE *)(a3 + 14) & 7; /*0xffd6e517*/
v25 = v10; /*0xffd6e51a*/
if ( v10 ) /*0xffd6e51e*/
{
if ( v10 == v9 ) /*0xffd6e522*/
break; /*0xffd6e522*/
}
v26 = *(_BYTE *)(a3 + 14) & 7; /*0xffd6e524*/
SiMicroSecondDelay(5u); /*0xffd6e52b*/
v9 = v26; /*0xffd6e530*/
if ( (unsigned int)++v8 >= 0xC8 ) /*0xffd6e53b*/
{
v10 = v25; /*0xffd6e53d*/
break; /*0xffd6e53d*/
}
}
if ( !v10 ) /*0xffd6e543*/
{
DebugPrintAssert(0x80000000, "HD-Audio Codec not detected (SDIN not connected to a codec)\n"); /*0xffd6e54f*/
v6 = -2147483641; /*0xffd6e556*/
*v4 &= ~1u; /*0xffd6e55e*/
goto LABEL_38; /*0xffd6e560*/
}
v11 = v29; /*0xffd6e565*/
if ( (*(_BYTE *)v29 & 8) != 0 ) /*0xffd6e56c*/
*((_DWORD *)n3_1 + 21) |= 0x100u; /*0xffd6e57a*/
n3a_1 = 0; /*0xffd6e57d*/
LOBYTE(n3a) = 0; /*0xffd6e57f*/
while ( 1 )
{
if ( (v10 & 1) != 0 )
{
if ( (*(_BYTE *)v11 & 8) != 0 ) /*0xffd6e5a6*/
{
GpioSetBits((unsigned __int16 *)(v3 + 12), 1 << n3a_1); /*0xffd6e5b3*/
n3a_1 = n3a; /*0xffd6e5b8*/
}
n3_1 = (unsigned __int16 *)n3a_1; /*0xffd6e5c5*/
v13 = n3a_1 << 28; /*0xffd6e5c9*/
p_p_n5 = v13 | 0xF0000; /*0xffd6e5d7*/
v6 = Assert_25((_DWORD *)v3, &p_p_n5, 1); /*0xffd6e5e0*/
if ( v6 < 0 )
{
DebugPrintAssert(0x80000000, "Error: Reading the Codec Vendor ID/Device ID fail!\n");
goto LABEL_38; /*0xffd6e796*/
}
p_n5 = v13 | 0xF0002; /*0xffd6e5fa*/
v6 = Assert_25((_DWORD *)v3, &p_n5, 1); /*0xffd6e603*/
if ( v6 < 0 )
{
DebugPrintAssert(0x80000000, "Error: Reading the Codec Revision ID fail!\n");
goto LABEL_38; /*0xffd6e78a*/
}
v14 = BYTE1(p_n5); /*0xffd6e615*/
DebugPrintAssert(64, "SDI:%d Detected HD-Audio Codec 0x%08X rev 0x%02X\n", n3_1, p_p_n5, BYTE1(p_n5)); /*0xffd6e628*/
v15 = DebugLogPrint_24(v29, a3, n3a); /*0xffd6e63b*/
DebugPrintAssert(64, "ConfigureLinkFrequency() Exit, Status = %r\n", v15); /*0xffd6e648*/
v16 = DebugLogPrint_26((int)v29, v14, p_n5); /*0xffd6e65a*/
v17 = v16; /*0xffd6e65f*/
if ( !v16 )
{
DebugPrintAssert(0x80000000, "Error: No matching HD-Audio codec verb table found for codec (0x%08X).\n", v29);
LABEL_24:
v3 = a3; /*0xffd6e67c*/
goto LABEL_25; /*0xffd6e67c*/
}
DebugPrintAssert(
64,
"Found verb table for vendor 0x%04X devId 0x%04X rev 0x%02X (SDI:%X, size: %d dwords)\n",
*v16,
v16[1],
*((unsigned __int8 *)v16 + 4),
*((unsigned __int8 *)v16 + 5),
v16[3]);
DebugPrintAssert(0x400000, "HDA: Sending verbs to codec:\n");
n3_1 = 0; /*0xffd6e6dc*/
if ( !v17[3] ) /*0xffd6e6e9*/
goto LABEL_24; /*0xffd6e6e9*/
v3 = a3; /*0xffd6e6eb*/
v18 = (unsigned int *)(v17 + 4); /*0xffd6e6ee*/
retaddr = (char *)(v17 + 4); /*0xffd6e6f1*/
while ( 1 ) /*0xffd6e6f5*/
{
p_n5_2 = *v18; /*0xffd6e6f5*/
p_n5_1 = p_n5_2; /*0xffd6e6f7*/
if ( (p_n5_2 & 0xF0000000) != 0 ) /*0xffd6e700*/
{
v20 = DebugAssert(); /*0xffd6e702*/
if ( v20 ) /*0xffd6e709*/
(*(void (__cdecl **)(const char *, int, const char *))(v20 + 4))( /*0xffd6e71a*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchHda.c",
682,
"(CodecCmdData >> 28) == 0");
p_n5_2 = p_n5_1; /*0xffd6e720*/
}
p_n5_1 = v13 | p_n5_2; /*0xffd6e72e*/
if ( Assert_25((_DWORD *)a3, &p_n5_1, 0) < 0 ) /*0xffd6e73a*/
break; /*0xffd6e73a*/
DebugPrintAssert(0x400000, "[%03d] 0x%08X\n", n3_1, p_n5_1); /*0xffd6e74e*/
n3_2 = v17[3]; /*0xffd6e75f*/
v18 = (unsigned int *)(retaddr + 4); /*0xffd6e763*/
n3_1 = (unsigned __int16 *)((char *)n3_1 + 1); /*0xffd6e766*/
retaddr += 4; /*0xffd6e76a*/
if ( (unsigned int)n3_1 >= n3_2 ) /*0xffd6e770*/
goto LABEL_25; /*0xffd6e770*/
}
}
else
{
n3a_2 = n3a_1; /*0xffd6e58b*/
SDI%d_has_no_HD_Audio_device._n = "SDI%d has no HD-Audio device.\n"; /*0xffd6e58c*/
}
DebugPrintAssert(0x80000000, SDI%d_has_no_HD_Audio_device._n, n3a_2); /*0xffd6e596*/
LABEL_25:
n3a_1 = n3a + 1; /*0xffd6e67f*/
v11 = v29; /*0xffd6e689*/
v10 = v25 >> 1; /*0xffd6e68d*/
LOBYTE(n3a) = n3a_1; /*0xffd6e68f*/
v25 >>= 1; /*0xffd6e693*/
if ( n3a_1 >= 3u ) /*0xffd6e699*/
{
v6 = 0; /*0xffd6e69f*/
goto LABEL_38; /*0xffd6e6a1*/
}
}
}
DebugPrintAssert(0x80000000, "Reset High Definition Audio (CRST = 0) Time Out - 1!\n"); /*0xffd6e4da*/
LABEL_38:
DebugPrintAssert(64, "DetectAndInitializeCodec() Exit, Status = %r\n", v6); /*0xffd6e79d*/
return v6; /*0xffd6e7af*/
}
// Function: Assert_13 @ 0xffd6e841 (0x6a bytes)
int Assert_13()
{
int v0; // esi
DebugPrintAssert(64, "ConfigureAudioPll() Start\n"); /*0xffd6e849*/
AssertEfiError(215, 1552, 58785791, -65142784); /*0xffd6e864*/
AssertEfiError(215, 1556, -16129, 16128); /*0xffd6e87a*/
v0 = AssertEfiError(215, 1560, -3872, 285); /*0xffd6e895*/
DebugPrintAssert(64, "ConfigureAudioPll() End - Status = %r\n", v0); /*0xffd6e89f*/
return v0; /*0xffd6e8a9*/
}
// Function: Assert_0 @ 0xffd6e8ab (0x274 bytes)
int __fastcall Assert_0(char *a1, int PadConfig, int a3)
{
int n4; // ebp
int v6; // ebx
char *v7; // eax
int p_n5; // [esp+14h] [ebp-4h] BYREF
DebugPrintAssert(64, "ConfigureHdAudio() Start\n"); /*0xffd6e8c0*/
p_n5 = 5; /*0xffd6e8cc*/
n4 = 0; /*0xffd6e8d4*/
*(_DWORD *)(PadConfig + 16) = a3; /*0xffd6e8d8*/
*(_DWORD *)(PadConfig + 20) = 0; /*0xffd6e8dc*/
GpioSetBits((unsigned __int16 *)(PadConfig + 4), 2); /*0xffd6e8df*/
DebugPrintAssert(64, "HdaPciBase = 0x%X, HdaBar = 0x%X\n", PadConfig, a3); /*0xffd6e8ed*/
if ( (*a1 & 4) != 0 )
{
if ( (*(_DWORD *)a1 & 0x20000) != 0 )
{
DebugPrintAssert(64, "HDA: Audio DSP Enabled, UAA mode - set Programming Interface to 0x%02x\n", 128);
*(_BYTE *)(PadConfig + 9) = 0x80; /*0xffd6e927*/
}
else
{
DebugPrintAssert(64, "HDA: Audio DSP Enabled, SST mode - set Sub Class Code to 0x%02x\n", 1);
*(_BYTE *)(PadConfig + 10) = 1; /*0xffd6e910*/
}
DebugPrintAssert(64, "HDA: Set PPCTL.GPROCEN = 1 (Global Processing Enable - to enable ADSP for operation)\n");
*(_DWORD *)(a3 + 2052) |= 0x40000000u; /*0xffd6e947*/
}
else
{
DebugPrintAssert(64, "HDA: Audio DSP Disabled\n");
n4 = 4; /*0xffd6e95f*/
}
GpioModifyBits((unsigned __int16 *)(PadConfig + 82), 2047, 49152); /*0xffd6e96d*/
Assert_13(); /*0xffd6e972*/
*(_DWORD *)(PadConfig + 72) &= ~0x40000u; /*0xffd6e983*/
*(_DWORD *)(PadConfig + 192) |= 0x1000600u; /*0xffd6e991*/
*(_DWORD *)(PadConfig + 196) = *(_DWORD *)(PadConfig + 196) & 0xF3FFFFFF | 0x4000000; /*0xffd6e9a7*/
*(_DWORD *)(PadConfig + 200) = *(_DWORD *)(PadConfig + 200) & 0xFFCFFFFF | 0x200000; /*0xffd6e9bd*/
*(_DWORD *)(PadConfig + 208) |= 0x300000u; /*0xffd6e9cf*/
v6 = DebugLogPrint((unsigned __int16 *)a1, (unsigned __int16 *)PadConfig, a3); /*0xffd6e9da*/
v7 = a1; /*0xffd6e9dc*/
if ( (*a1 & 0x40) != 0 )
{
DebugPrintAssert(64, "HDA: I/O buffers operate in 1.8V mode drive strenght attribute\n");
AssertEfiError(215, 0x61Cu, -1, 2); /*0xffd6ea01*/
v7 = a1; /*0xffd6ea06*/
}
if ( *v7 < 0 )
{
DebugPrintAssert(64, "HDA: Isonchronous Support on VC1\n");
*(_DWORD *)(PadConfig + 196) |= 0x1000000u; /*0xffd6ea35*/
AssertEfiError(215, 0xE4u, -1, 2); /*0xffd6ea3b*/
}
*(_BYTE *)(a3 + 4168) = *(_BYTE *)(a3 + 4168) & 0x80 | 0x29; /*0xffd6ea4d*/
*(_BYTE *)(a3 + 4171) = *(_BYTE *)(a3 + 4171) & 0xD0 | 0x28; /*0xffd6ea64*/
DebugPrintAssert(64, "HDA: Clock Gating enabled\n");
DebugPrintAssert(64, "HDA: Configuration Lockdown\n");
AssertEfiError(215, 0x530u, -11, n4 | 0x14); /*0xffd6ea8b*/
Assert_8((_DWORD *)a3, 0, (unsigned int)&p_n5); /*0xffd6ea99*/
if ( !p_n5 )
{
DebugPrintAssert(64, "HDA: 6MHz link frequency - assert RESET# and put controller to D3\n");
*(_DWORD *)(a3 + 8) &= ~1u; /*0xffd6eac1*/
v6 = HdaCodecWaitNotBusy((_DWORD *)(a3 + 8), 1, 0); /*0xffd6eac8*/
if ( v6 < 0 ) /*0xffd6eacf*/
DebugPrintAssert(0x80000000, "Reset High Definition Audio (CRST = 0) Time Out - 3!\n"); /*0xffd6eadb*/
*(_DWORD *)(PadConfig + 84) |= 3u; /*0xffd6eae8*/
}
GpioClearBits((unsigned __int16 *)(PadConfig + 4), 65533); /*0xffd6eaf3*/
*(_DWORD *)(PadConfig + 16) = 0; /*0xffd6eafe*/
*(_DWORD *)(PadConfig + 20) = 0; /*0xffd6eb07*/
DebugPrintAssert(64, "ConfigureHdAudio() End - Status = %r\n", v6); /*0xffd6eb0e*/
return v6; /*0xffd6eb18*/
}
// Function: PchTraceHubSetMemoryAsUncached @ 0xffd6eb1f (0x7e bytes)
int __thiscall PchTraceHubSetMemoryAsUncached(int this)
{
_BYTE *v2; // esi
unsigned __int16 *PadConfig; // ebx
int result; // eax
v2 = (_BYTE *)(this + 2735); /*0xffd6eb2b*/
PadConfig = (unsigned __int16 *)GpioGetPadConfig(0, 31, 3); /*0xffd6eb37*/
if ( (unsigned __int16)GpioGetGroupFromPad(PadConfig) == 0xFFFF )
{
DebugPrintAssert(2, "HDA: PCI Device not found!\n");
return -2147483634; /*0xffd6eb58*/
}
if ( (*v2 & 3) == 0 ) /*0xffd6eb64*/
LABEL_7:
JUMPOUT(0xFFD6E7B6); /*0xffd6e7b6*/
result = Assert_0((char *)(this + 2735), (int)PadConfig, *(_DWORD *)(this + 3510)); /*0xffd6eb70*/
if ( result < 0 && (*(_DWORD *)v2 & 3) == 2 )
{
DebugPrintAssert(0x80000000, "HDA: Codec detection/initialization error in Auto mode - Disable!\n");
goto LABEL_7; /*0xffd6eb8e*/
}
return result; /*0xffd6eb5d*/
}
// Function: AssertCpuDeadLoop_4 @ 0xffd6eb9d (0x88 bytes)
int __fastcall sub_FFD6EB9D(unsigned __int8 a1)
{
int v1; // eax
int v2; // eax
int v4; // [esp+8h] [ebp-8h] BYREF
char v5; // [esp+Fh] [ebp-1h] BYREF
v4 = a1; /*0xffd6ebb0*/
v1 = PchSbiExec(156, 7, 0, 0xB3u, &v4, &v5, 7); /*0xffd6ebc3*/
if ( v1 < 0 ) /*0xffd6ebcd*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v1); /*0xffd6ebda*/
v2 = DebugAssert(); /*0xffd6ebe2*/
if ( v2 ) /*0xffd6ebe9*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd6ebfa*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInterruptAssign.c",
251,
"!EFI_ERROR (Status)");
}
v4 = 0; /*0xffd6ec07*/
return PchSbiExec(156, 6, 0, 0xB3u, &v4, &v5, 6); /*0xffd6ec1f*/
}
// Function: PchGpioWritePadByte61 @ 0xffd6ec25 (0x19 bytes)
int __fastcall PchGpioWritePadByte61(char n20, char n3, char a3)
{
*(_BYTE *)(GpioGetPadConfig(0, n20, n3) + 61) = a3; /*0xffd6ec38*/
return 0; /*0xffd6ec3d*/
}
// Function: Assert_11 @ 0xffd6ec3e (0x84 bytes)
int __fastcall Assert_11(char a1)
{
int v1; // eax
int n2_1; // esi
int PadConfig; // eax
int n2; // [esp-4h] [ebp-8h]
switch ( a1 ) /*0xffd6ec45*/
{
case 9: /*0xffd6ec45*/
n2_1 = 0; /*0xffd6eca4*/
goto LABEL_19; /*0xffd6eca4*/
case 10: /*0xffd6ec45*/
n2_1 = 1; /*0xffd6eca1*/
goto LABEL_19; /*0xffd6eca2*/
case 11: /*0xffd6ec45*/
n2 = 2; /*0xffd6ec9a*/
goto LABEL_16; /*0xffd6ec9a*/
case 20: /*0xffd6ec45*/
n2 = 4; /*0xffd6ec96*/
goto LABEL_16; /*0xffd6ec98*/
case 21: /*0xffd6ec45*/
n2 = 5; /*0xffd6ec92*/
goto LABEL_16; /*0xffd6ec94*/
case 22: /*0xffd6ec45*/
n2 = 6; /*0xffd6ec8e*/
goto LABEL_16; /*0xffd6ec90*/
case 23: /*0xffd6ec45*/
n2 = 7; /*0xffd6ec8a*/
LABEL_16:
n2_1 = n2; /*0xffd6ec9c*/
LABEL_19:
PadConfig = GpioGetPadConfig(0, 31, 2); /*0xffd6eca6*/
*(_DWORD *)(PadConfig + 68) = n2_1 | *(_DWORD *)(PadConfig + 68) & 0xFFFFFFF8; /*0xffd6ecbb*/
return 0; /*0xffd6ecbe*/
}
v1 = DebugAssert(); /*0xffd6ec65*/
if ( v1 ) /*0xffd6ec6c*/
(*(void (__cdecl **)(char *, int, char *))(v1 + 4))((char *)-2656940, 492, (char *)-2661352); /*0xffd6ec7d*/
return -2147483646; /*0xffd6ec88*/
}
// Function: Assert_10 @ 0xffd6ecc2 (0x89 bytes)
int __fastcall Assert_10(char n10, char a2)
{
int v2; // eax
int n2_1; // eax
int n2; // [esp-8h] [ebp-8h]
if ( n10 == 9 ) /*0xffd6ecc9*/
{
n2_1 = 0; /*0xffd6ed28*/
}
else if ( n10 == 10 ) /*0xffd6ecce*/
{
n2_1 = 1; /*0xffd6ed25*/
}
else
{
switch ( n10 ) /*0xffd6ecd3*/
{
case 11: /*0xffd6ecd3*/
n2 = 2; /*0xffd6ed1e*/
break;
case 20: /*0xffd6ecd3*/
n2 = 4; /*0xffd6ed1a*/
break;
case 21: /*0xffd6ecd3*/
n2 = 5; /*0xffd6ed16*/
break;
case 22: /*0xffd6ecd3*/
n2 = 6; /*0xffd6ed12*/
break;
case 23: /*0xffd6ecd3*/
n2 = 7; /*0xffd6ed0e*/
break;
default:
v2 = DebugAssert(); /*0xffd6ece9*/
if ( v2 ) /*0xffd6ecf0*/
(*(void (__cdecl **)(char *, int, char *))(v2 + 4))((char *)-2656940, 544, (char *)-2661352); /*0xffd6ed01*/
return -2147483646; /*0xffd6ed0d*/
}
n2_1 = n2; /*0xffd6ed20*/
}
if ( a2 ) /*0xffd6ed2c*/
n2_1 |= 0x80u; /*0xffd6ed2e*/
AssertEfiError(198, 0, -136, n2_1); /*0xffd6ed40*/
return 0; /*0xffd6ed0d*/
}
// Function: PchInterruptConfig @ 0xffd6ed4b (0xaf bytes)
int __fastcall PchInterruptConfig(int a1, unsigned __int8 a2)
{
int v2; // eax
int v3; // ebp
unsigned __int16 *p_n160; // edi
unsigned __int16 n12816; // cx
char n20_1; // dl
_BYTE *v7; // esi
int v8; // ebx
char n20; // al
__int16 n12816_1; // [esp+18h] [ebp-Ch]
int n9; // [esp+1Ch] [ebp-8h]
v2 = a1; /*0xffd6ed51*/
v3 = a2; /*0xffd6ed53*/
p_n160 = (unsigned __int16 *)-2641690; /*0xffd6ed5b*/
n9 = 9; /*0xffd6ed60*/
do /*0xffd6edea*/
{
n12816 = 12816; /*0xffd6ed6a*/
n12816_1 = 12816; /*0xffd6ed6f*/
if ( (_WORD)v3 ) /*0xffd6ed76*/
{
n20_1 = *((_BYTE *)p_n160 - 2); /*0xffd6ed78*/
v7 = (_BYTE *)(v2 + 2); /*0xffd6ed7b*/
v8 = v3; /*0xffd6ed7e*/
do /*0xffd6edc7*/
{
n20 = *(v7 - 2); /*0xffd6ed80*/
if ( n20 == n20_1 && (n20 != 20 || *(v7 - 1) != 1) ) /*0xffd6ed8f*/
{
n12816 = n12816_1 & ~(15 << (4 * *v7 - 4)) | (((unsigned __int8)v7[1] - 16) << (4 * *v7 - 4)); /*0xffd6edb7*/
n20_1 = *((_BYTE *)p_n160 - 2); /*0xffd6edba*/
n12816_1 = n12816; /*0xffd6edbd*/
}
v7 += 4; /*0xffd6edc1*/
--v8; /*0xffd6edc4*/
}
while ( v8 ); /*0xffd6edc7*/
}
PchInterruptConfigEntry(196, *p_n160, 2, n12816); /*0xffd6edd7*/
v2 = a1; /*0xffd6eddc*/
p_n160 += 2; /*0xffd6ede0*/
--n9; /*0xffd6ede3*/
}
while ( n9 ); /*0xffd6edea*/
return 0; /*0xffd6edf0*/
}
// Function: PchInterruptInit @ 0xffd6edfa (0x80c bytes)
int __fastcall PchInterruptInit(int a1, unsigned __int8 i)
{
unsigned __int8 v4; // cl
unsigned __int8 n0x10; // bh
unsigned __int8 i_1; // ah
unsigned __int8 j; // ch
unsigned __int8 i_2; // cl
int v9; // eax
unsigned __int8 n0x10_1; // al
char n2; // al
unsigned __int8 m; // ch
int v13; // ebp
unsigned __int8 p_n4_1; // al
int v15; // eax
int v16; // eax
int v18; // eax
int v19; // eax
int v20; // eax
int v21; // eax
unsigned __int8 i_3; // cl
int v23; // ebp
int v24; // ebp
unsigned __int8 n; // bh
int v26; // eax
unsigned __int8 ii; // cl
unsigned __int8 p_n4_2; // al
char v29; // al
int v30; // eax
unsigned __int8 jj; // bh
unsigned int v32; // esi
unsigned __int8 i_4; // al
int i_5; // ecx
int v35; // eax
unsigned __int8 v36; // bh
char n28; // al
int v38; // ebp
unsigned __int8 v39; // bh
int v40; // esi
unsigned __int8 v41; // cl
int v42; // eax
int v43; // eax
int v44; // eax
int v45; // eax
unsign... [17778 chars total]
// Function: PeiInit @ 0xffd6f606 (0xb3 bytes)
int __thiscall PeiInit(unsigned __int8 *this)
{
bool v2; // cf
int v3; // eax
unsigned int n4; // ecx
int v5; // edi
unsigned __int8 *v6; // esi
unsigned int v7; // edx
unsigned int i; // esi
int buf[4]; // [esp+8h] [ebp-10h] BYREF
MemConfig_0((int)buf, 0x10u); /*0xffd6f616*/
v2 = *(this + 268) < 0x80u; /*0xffd6f61b*/
buf[0] = 16711680; /*0xffd6f622*/
if ( !v2 ) /*0xffd6f629*/
{
v3 = DebugAssert(); /*0xffd6f62b*/
if ( v3 ) /*0xffd6f632*/
(*(void (__cdecl **)(const char *, int, const char *))(v3 + 4))( /*0xffd6f643*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInterruptAssign.c",
1132,
"PchInterruptConfig->GpioIrqRoute < 128");
}
n4 = *(this + 268) >> 5; /*0xffd6f652*/
if ( n4 < 4 ) /*0xffd6f658*/
buf[n4] |= 1 << (*(this + 268) & 0x1F); /*0xffd6f664*/
v5 = *this; /*0xffd6f668*/
if ( *this ) /*0xffd6f668*/
{
v6 = this + 7; /*0xffd6f66f*/
do /*0xffd6f68e*/
{
v7 = *v6; /*0xffd6f672*/
v6 += 4; /*0xffd6f675*/
buf[v7 >> 5] |= 1 << (v7 & 0x1F); /*0xffd6f687*/
--v5; /*0xffd6f68b*/
}
while ( v5 ); /*0xffd6f68e*/
}
for ( i = 0; i < 4; ++i ) /*0xffd6f690*/
PchInterruptConfigEntry(196, 4 * i + 12800, 4, buf[i]); /*0xffd6f6a4*/
return 0; /*0xffd6f6b1*/
}
// Function: PchTraceHubOnEndOfPei @ 0xffd6f6b9 (0x237 bytes)
// positive sp value has been detected, the output may be wrong!
int __thiscall PchTraceHubOnEndOfPei(_BYTE *this)
{
unsigned __int8 *v2; // edi
int v3; // ebx
unsigned __int8 *v4; // ebp
unsigned __int8 n2; // al
int v6; // eax
char n0x1A; // cl
char n3; // ch
__int16 v9; // bx
char v10; // al
unsigned __int8 v11; // bl
int PadConfig; // eax
int v13; // edx
char v14; // al
char n3_1; // dl
unsigned __int8 n8; // [esp+13h] [ebp-5h]
int v18; // [esp+14h] [ebp-4h]
v2 = this + 3036; /*0xffd6f6cd*/
PchInterruptInit((int)(this + 3040), *(this + 3036)); /*0xffd6f6d7*/
v3 = 0; /*0xffd6f6dc*/
v4 = this + 3296; /*0xffd6f6de*/
do /*0xffd6f74b*/
{
n2 = *v4; /*0xffd6f6ec*/
if ( *v4 >= 0x10u || n2 <= 2u || n2 == 8 || n2 == 13 ) /*0xffd6f6fd*/
{
v6 = DebugAssert(); /*0xffd6f6ff*/
if ( v6 ) /*0xffd6f706*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffd6f717*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchInterruptAssign.c",
628,
"PxRcConfig[Index] < 16 && PxRcConfig[Index] > 2 && PxRcConfig[Index] != 8 && PxRcConfig[Index] != 13");
}
PchInterruptConfigEntry(196, 0x3100u, 1, *v4++); /*0xffd6f736*/
++n8; /*0xffd6f742*/
}
while ( n8 < 8u ); /*0xffd6f74b*/
if ( *v2 < 0x40u ) /*0xffd6f752*/
PchInterruptConfig((int)(this + 3040), *v2); /*0xffd6f75a*/
PeiInit(v2); /*0xffd6f761*/
if ( *v2 ) /*0xffd6f766*/
{
do /*0xffd6f771*/
{
n0x1A = *(this + 4 * (unsigned __int8)v3 + 3040); /*0xffd6f771*/
if ( (unsigned __int8)n0x1A >= 0x10u ) /*0xffd6f77b*/
{
if ( n0x1A == 20 ) /*0xffd6f785*/
{
n3 = *(this + 4 * (unsigned __int8)v3 + 3041); /*0xffd6f85d*/
if ( n3 != 1 ) /*0xffd6f867*/
{
LABEL_26:
v14 = *(this + 4 * (unsigned __int8)v3 + 3042); /*0xffd6f8a0*/
n3_1 = n3; /*0xffd6f8a8*/
goto LABEL_27; /*0xffd6f8a8*/
}
AssertEfiError( /*0xffd6f898*/
229,
0x200u,
-268435203,
((unsigned __int8)*(this + 4 * (unsigned __int8)v3 + 3042)
| (16
* ((unsigned __int8)*(this + 4 * (unsigned __int8)v3 + 3043)
| ((unsigned __int8)*(this + 4 * (unsigned __int8)v3 + 3043) << 8)))) << 8);
}
else if ( n0x1A == 22 ) /*0xffd6f78d*/
{
n3 = *(this + 4 * (unsigned __int8)v3 + 3041); /*0xffd6f843*/
if ( n3 != 3 ) /*0xffd6f84d*/
goto LABEL_26; /*0xffd6f84d*/
AssertCpuDeadLoop_4(*(this + 4 * (unsigned __int8)v3 + 3042)); /*0xffd6f856*/
}
else
{
if ( (unsigned __int8)n0x1A <= 0x1Au ) /*0xffd6f795*/
goto LABEL_21; /*0xffd6f795*/
if ( (unsigned __int8)n0x1A <= 0x1Du ) /*0xffd6f79d*/
{
v10 = *(this + 4 * (unsigned __int8)v3 + 3041); /*0xffd6f7fa*/
v11 = *(this + 4 * (unsigned __int8)v3 + 3042); /*0xffd6f802*/
PadConfig = GpioGetPadConfig(0, n0x1A, v10); /*0xffd6f80f*/
v13 = v11; /*0xffd6f819*/
v3 = v18; /*0xffd6f81c*/
*(_DWORD *)(PadConfig + 252) = *(_DWORD *)(PadConfig + 252) & 0xF0FFFFFF | (v13 << 24); /*0xffd6f82e*/
}
else
{
if ( n0x1A != 31 ) /*0xffd6f7a1*/
{
LABEL_21:
v14 = *(this + 4 * (unsigned __int8)v3 + 3042); /*0xffd6f832*/
n3_1 = *(this + 4 * (unsigned __int8)v3 + 3041); /*0xffd6f83a*/
LABEL_27:
PchGpioWritePadByte61(n0x1A, n3_1, v14); /*0xffd6f8aa*/
goto LABEL_28; /*0xffd6f8ab*/
}
n3 = *(this + 4 * (unsigned __int8)v3 + 3041); /*0xffd6f7a7*/
if ( n3 != 3 ) /*0xffd6f7b1*/
goto LABEL_26; /*0xffd6f7b1*/
v9 = *((_WORD *)this + 2 * (unsigned __int8)v3 + 1521); /*0xffd6f7c0*/
*(_BYTE *)(GpioGetPadConfig(0, 31, 3) + 61) = v9; /*0xffd6f7dc*/
AssertEfiError(215, 0x500u, -65281, HIBYTE(v9) << 8); /*0xffd6f7eb*/
v3 = v18; /*0xffd6f7f0*/
}
}
}
LABEL_28:
LOBYTE(v3) = v3 + 1; /*0xffd6f8b1*/
v18 = v3; /*0xffd6f8b3*/
}
while ( (unsigned __int8)v3 < *v2 ); /*0xffd6f771*/
}
GpioGetInfo(*(this + 3304)); /*0xffd6f8bf*/
Assert_10(*(this + 3306), *(this + 3307)); /*0xffd6f8d6*/
Assert_11(*(this + 3305)); /*0xffd6f8e1*/
return 0; /*0xffd6f8e6*/
}
// Function: SendCodecCommand @ 0xffd6f8f0 (0x86 bytes)
// positive sp value has been detected, the output may be wrong!
int __thiscall SendCodecCommand(unsigned __int8 *this)
{
int n2; // edi
n2 = PchGpioInit(); /*0xffd6f90d*/
PchInterruptConfigEntry(239, 0x2088u, 4, 1085440); /*0xffd6f90f*/
AssertEfiError(239, 0x20ACu, -1, (*(this + 2991) << 31) | 0x40000000); /*0xffd6f92e*/
if ( (*(this + 2992) & 1) != 0 ) /*0xffd6f93d*/
AssertEfiError(239, 0x2300u, -1, 1); /*0xffd6f94a*/
if ( n2 == 2 ) /*0xffd6f956*/
return AssertEfiError(239, 0x2300u, -1, 2); /*0xffd6f960*/
else
return AssertEfiError(239, 0x2348u, -16, 0); /*0xffd6f96b*/
}
// Function: GetCodecCurrentBclkFrequency @ 0xffd6f976 (0x1da bytes)
// positive sp value has been detected, the output may be wrong!
int GetCodecCurrentBclkFrequency()
{
int n2; // esi
n2 = PchGpioInit(); /*0xffd6f97f*/
GpioLockGpios(); /*0xffd6f981*/
AssertEfiError(239, 0x2320u, -97, 16); /*0xffd6f998*/
if ( n2 == 2 ) /*0xffd6f9a5*/
{
AssertEfiError(239, 0x232Cu, -1, 1); /*0xffd6f9af*/
PchInterruptConfigEntry(239, 0x260Cu, 2, 20); /*0xffd6f9be*/
}
else if ( n2 == 1 ) /*0xffd6f9c8*/
{
AssertEfiError(239, 0x232Cu, -1, 0x100000); /*0xffd6f9d7*/
AssertEfiError(239, 0x2320u, -1, 2); /*0xffd6f9e3*/
}
AssertEfiError(239, 0x2618u, -1, 0x8000000); /*0xffd6f9f8*/
AssertEfiError(239, 0x2614u, -1, 1024); /*0xffd6fa0c*/
AssertEfiError(239, 0x2614u, -14614529, 2116027648); /*0xffd6fa1f*/
AssertEfiError(239, 0x2600u, -1, 8); /*0xffd6fa2c*/
if ( n2 == 1 ) /*0xffd6fa3c*/
{
AssertEfiError(239, 0x2304u, -262145, -1073545216); /*0xffd6fa51*/
AssertEfiError(239, 0x2478u, 0xFFFFFF, 671088640); /*0xffd6fa69*/
AssertEfiError(239, 0x2344u, 0xFFFF, 336855040); /*0xffd6fa7d*/
AssertEfiError(239, 0x21A4u, -258049, 147456); /*0xffd6fa93*/
AssertEfiError(239, 0x2340u, -16711936, 5963821); /*0xffd6faa7*/
AssertEfiError(239, 0x2478u, -256, 44); /*0xffd6fab7*/
AssertEfiError(239, 0x21A8u, -1, 32); /*0xffd6fac6*/
AssertEfiError(239, 0x2310u, -1, 1207959552); /*0xffd6fad8*/
AssertEfiError(239, 0x2314u, -12582913, 2097184); /*0xffd6faef*/
AssertEfiError(239, 0x2310u, -2097153, 0); /*0xffd6faff*/
AssertEfiError(239, 0x2238u, -1537, 2305); /*0xffd6fb15*/
AssertEfiError(239, 0x2334u, -1, 257); /*0xffd6fb24*/
}
AssertEfiError(239, 0x2334u, -1, 2); /*0xffd6fb33*/
return AssertEfiError(239, 0x234Cu, -8, 32); /*0xffd6fb4b*/
}
// Function: ConfigureLinkFrequency @ 0xffd6fb50 (0xc7 bytes)
int __thiscall ConfigureLinkFrequency(int this)
{
int v1; // esi
int result; // eax
int n2_1; // esi
__int16 n2; // di
int v5; // [esp+8h] [ebp-4h] BYREF
v1 = *(_DWORD *)(this + 2987) & 1; /*0xffd6fb6e*/
DebugLogPrint_14(0xEFu, 0x2234u, 4, &v5); /*0xffd6fb71*/
result = AssertEfiError(239, 0x2310u, (v5 & 0x80000) != 0 ? -4194305 : -1, (v5 & 0x80000) != 0 ? 0 : 0x400000);
n2_1 = 2 * v1; /*0xffd6fba9*/
if ( n2_1 ) /*0xffd6fbab*/
{
n2 = 0; /*0xffd6fbae*/
AssertEfiError(239, 0x2304u, -1025, 0); /*0xffd6fbbd*/
AssertEfiError(239, 0x21A4u, -1, 3072); /*0xffd6fbd0*/
if ( n2_1 == 2 ) /*0xffd6fbdb*/
n2 = 2; /*0xffd6fbde*/
DebugLogPrint_21(239, 8616, (n2_1 != 2) - 2, n2); /*0xffd6fbf5*/
return AssertEfiError(239, 0x2304u, -1, 1024); /*0xffd6fc08*/
}
return result; /*0xffd6fc11*/
}
// Function: Assert_4 @ 0xffd6fc17 (0xec bytes)
bool __fastcall sub_FFD6FC17(int PadConfig, unsigned __int8 a2, unsigned __int16 *a3)
{
char v5; // bl
int v7; // ebp
unsigned __int8 v8; // al
unsigned __int16 *v9; // ecx
_WORD *v11; // [esp+1Ch] [ebp+4h]
v5 = 0; /*0xffd6fc2c*/
*(_DWORD *)(a3 + 1) = 0xFFFF; /*0xffd6fc2e*/
*a3 = -1; /*0xffd6fc35*/
if ( (GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 90)) & 0x40) == 0 ) /*0xffd6fc42*/
return 0; /*0xffd6fc44*/
*(_DWORD *)(PadConfig + 24) = *(_DWORD *)(PadConfig + 24) & 0xFF0000FF | ((a2 | (a2 << 8)) << 8); /*0xffd6fc68*/
v11 = (_WORD *)GpioGetPadConfig(a2, 0, 0); /*0xffd6fc77*/
GpioGetGroupIndexFromPad(v11, 0); /*0xffd6fc7b*/
v7 = *(_DWORD *)v11; /*0xffd6fc80*/
*(_DWORD *)a3 = *(_DWORD *)v11; /*0xffd6fc88*/
if ( v7 != -1 ) /*0xffd6fc92*/
{
v8 = DebugLogPrint_17(a2); /*0xffd6fc9a*/
if ( v8 ) /*0xffd6fca3*/
{
v9 = (_WORD *)((char *)v11 + v8 + 12); /*0xffd6fcaf*/
v5 = *(_BYTE *)v9 & 0xF; /*0xffd6fcb3*/
*((_BYTE *)a3 + 5) = ((unsigned __int16)GpioGetGroupFromPad(v9) >> 4) & 0x3F; /*0xffd6fcc1*/
}
*((_BYTE *)a3 + 4) = v5; /*0xffd6fcc4*/
}
*(_DWORD *)(PadConfig + 24) &= 0xFF0000FF; /*0xffd6fccf*/
DebugPrintAssert(
64,
"VID: %04X DID: %04X MLS: %d MLW: %d\n",
*a3,
a3[1],
*((unsigned __int8 *)a3 + 4),
*((unsigned __int8 *)a3 + 5));
return v7 != -1; /*0xffd6fcfc*/
}
// Function: PeiInit_0 @ 0xffd6fd03 (0x33 bytes)
unsigned __int8 __thiscall PeiInit_0(unsigned __int16 *PadConfig)
{
unsigned __int8 n4; // al
int v2; // eax
n4 = ((unsigned __int16)GpioGetGroupFromPad(PadConfig + 41) >> 4) & 0x3F; /*0xffd6fd0f*/
if ( n4 > 4u ) /*0xffd6fd13*/
{
v2 = DebugAssert(); /*0xffd6fd15*/
if ( v2 ) /*0xffd6fd1c*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd6fd2d*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchRootPorts.c",
1653,
"LinkWidth <= 4");
return 4; /*0xffd6fd33*/
}
return n4; /*0xffd6fd35*/
}
// Function: PeiInit_1 @ 0xffd6fd36 (0x2d bytes)
unsigned __int8 __thiscall PeiInit_1(_DWORD *PadConfig)
{
unsigned __int8 n4; // al
int v2; // eax
n4 = (*(PadConfig + 19) >> 4) & 0x3F; /*0xffd6fd3c*/
if ( n4 > 4u ) /*0xffd6fd40*/
{
v2 = DebugAssert(); /*0xffd6fd42*/
if ( v2 ) /*0xffd6fd49*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd6fd5a*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchRootPorts.c",
1672,
"LinkWidth <= 4");
return 4; /*0xffd6fd60*/
}
return n4; /*0xffd6fd62*/
}
// Function: DetectAndInitializeCodec @ 0xffd6fd63 (0x206 bytes)
int __thiscall DetectAndInitializeCodec(unsigned __int8 *this)
{
unsigned __int8 v2; // al
unsigned __int8 v3; // bl
unsigned int v4; // esi
int v5; // ebp
int PadConfig; // esi
unsigned __int8 inited; // al
unsigned __int8 v8; // bl
int v9; // edi
int n94; // eax
int v11; // edi
char v12; // bl
int v13; // edi
bool v14; // al
unsigned __int8 v16; // [esp+10h] [ebp-18h]
bool v17; // [esp+11h] [ebp-17h]
char v18; // [esp+12h] [ebp-16h]
char v19; // [esp+13h] [ebp-15h]
unsigned int v20; // [esp+14h] [ebp-14h] BYREF
int v21; // [esp+18h] [ebp-10h] BYREF
unsigned int v22; // [esp+1Ch] [ebp-Ch]
unsigned __int16 v23[2]; // [esp+20h] [ebp-8h] BYREF
unsigned __int8 v24; // [esp+25h] [ebp-3h]
v18 = 0; /*0xffd6fd71*/
v19 = 0; /*0xffd6fd79*/
if ( !SmmGetInfo() )
{
v2 = PchPcieRootPortCount(); /*0xffd6fd99*/
v3 = *(this + 3508); /*0xffd6fd9e*/
v16 = v3; /*0xffd6fda4*/
if ( !v2 ) /*0xffd6fdaa*/
return 0; /*0xffd6fdaa*/
v4 = 0; /*0xffd6fdb0*/
v5 = v2; /*0xffd6fdb2*/
while ( 1 )
{
v22 = v4 + 1; /*0xffd6fdc0*/
DebugPrintAssert(64, "PchSetLinkWidth (%d) \n", v4 + 1); /*0xffd6fdc4*/
DebugLogPrint_16(v4, &v21, &v20); /*0xffd6fdd7*/
PadConfig = GpioGetPadConfig(0, v21, v20); /*0xffd6fdec*/
v17 = Assert_4(PadConfig, v3, v23); /*0xffd6fdfd*/
if ( v17 )
{
inited = PeiInit_1((_DWORD *)PadConfig); /*0xffd6fe0c*/
v8 = v24; /*0xffd6fe11*/
if ( v24 >= inited ) /*0xffd6fe17*/
v8 = PeiInit_1((_DWORD *)PadConfig); /*0xffd6fe20*/
if ( v8 != PeiInit_0((unsigned __int16 *)PadConfig) && (v23[0] != 6562 || v23[1] != 288) )
{
DebugPrintAssert(64, "WARNING! Applying LBG Si WA for low Rx off state impedance...\n"); /*0xffd6fe54*/
DebugPrintAssert(64, "Disabling the link...\n"); /*0xffd6fe60*/
GpioSetBits((unsigned __int16 *)(PadConfig + 80), 16); /*0xffd6fe70*/
v9 = 0; /*0xffd6fe75*/
while ( 1 ) /*0xffd6fe7d*/
{
n94 = HIBYTE(*(_DWORD *)(PadConfig + 808)); /*0xffd6fe7d*/
if ( n94 == 94 || n94 == 96 ) /*0xffd6fe88*/
break; /*0xffd6fe88*/
SiMicroSecondDelay(0xAu); /*0xffd6fe8d*/
if ( (unsigned int)++v9 >= 0x64 ) /*0xffd6fe96*/
goto LABEL_17; /*0xffd6fe96*/
}
v18 = 1; /*0xffd6fe9a*/
LABEL_17:
*(_BYTE *)(PadConfig + 80) &= ~0x10u; /*0xffd6fe9f*/
if ( v18 == 1 ) /*0xffd6feaa*/
{
v11 = 0; /*0xffd6feac*/
while ( (*(_DWORD *)(PadConfig + 808) & 0xFF000000) != 0x1000000 ) /*0xffd6febe*/
{
SiMicroSecondDelay(0xAu); /*0xffd6fec3*/
if ( (unsigned int)++v11 >= 0x64 ) /*0xffd6fecc*/
{
v12 = v19; /*0xffd6fece*/
goto LABEL_23; /*0xffd6fed2*/
}
}
v12 = 1; /*0xffd6fed4*/
v19 = 1; /*0xffd6fed6*/
LABEL_23:
if ( v12 == 1 ) /*0xffd6fedd*/
{
v13 = 0; /*0xffd6fedf*/
while ( (GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 90)) & 0x40) == 0 ) /*0xffd6feed*/
{
SiMicroSecondDelay(0x32u); /*0xffd6fef2*/
if ( (unsigned int)++v13 >= 0x3E8 ) /*0xffd6fefe*/
goto LABEL_31; /*0xffd6fefe*/
}
v3 = v16; /*0xffd6ff02*/
v14 = Assert_4(PadConfig, v16, v23); /*0xffd6ff0f*/
goto LABEL_32; /*0xffd6ff15*/
}
DebugPrintAssert(0x80000000, "The link's LTSSM can't enter DETECT state! The WA can't be applied\n"); /*0xffd6ff1c*/
}
else
{
DebugPrintAssert(0x80000000, "The link could not be disabled! The WA can't be applied\n"); /*0xffd6ff28*/
}
LABEL_31:
v14 = v17; /*0xffd6ff2f*/
v3 = v16; /*0xffd6ff33*/
LABEL_32:
if ( !v14 )
DebugPrintAssert(
0x80000000,
"ERROR: During applying the Si WA after re-enbling the link the slot can't go into Presence Detect!\n");
goto LABEL_35; /*0xffd6ff4c*/
}
v3 = v16; /*0xffd6ff4e*/
}
LABEL_35:
v4 = v22; /*0xffd6ff52*/
if ( !--v5 ) /*0xffd6ff59*/
return 0; /*0xffd6ff59*/
}
}
DebugPrintAssert(64, "DWR: PchSetLinkWidth() End\n");
return 0; /*0xffd6ff5f*/
}
// Function: DxeInit @ 0xffd6ff69 (0x343 bytes)
int __thiscall DxeInit(int this)
{
int PadConfig; // esi
unsigned int v2; // edi
int v3; // ebp
unsigned int n57; // ebx
char v5; // di
__int16 GroupFromPad; // ax
__int16 n2; // dx
__int16 v8; // cx
unsigned int n57_1; // eax
char n12_2; // al
int v11; // ebx
int v12; // esi
int this_1; // eax
_BYTE *v14; // ebp
unsigned int v15; // edx
unsigned int n57_2; // edi
__int16 v17; // ax
__int16 n2_1; // dx
__int16 v19; // cx
unsigned int n57_3; // eax
int n160_1; // ecx
int n12_4; // eax
bool v23; // cf
char n12_1; // [esp+11h] [ebp-1Fh]
char n12_3; // [esp+12h] [ebp-1Eh]
unsigned __int8 v26; // [esp+13h] [ebp-1Dh]
int PadConfig_1; // [esp+14h] [ebp-1Ch]
int v28; // [esp+14h] [ebp-1Ch]
int v30; // [esp+1Ch] [ebp-14h]
unsigned int v31; // [esp+20h] [ebp-10h]
int n12; // [esp+24h] [ebp-Ch]
int n160; // [esp+28h] [ebp-8h]
__int16 v34; // [esp+2Ch] [ebp-4h]
__int16 v35; // [esp+2Ch] [ebp-4h]
PadConfig = GpioGetPadConfig(0, 23, 0); /*0xffd6ff86*/
PadConfig_1 = PadConfig; /*0xffd6ff89*/
v30 = PchGpioInit(); /*0xffd6ff92*/
v26 = 0; /*0xffd6ffa6*/
n160 = 160; /*0xffd6ffae*/
v2 = ((unsigned int)(unsigned __int8)PchGetNumUsbPorts() + 1) >> 1; /*0xffd6ffb2*/
v31 = v2; /*0xffd6ffb4*/
n12 = 12; /*0xffd6ffb8*/
if ( v2 ) /*0xffd6ffbc*/
{
v3 = 0; /*0xffd6ffc2*/
n12_3 = -96; /*0xffd6ffc4*/
n12_1 = 12; /*0xffd6ffc8*/
do /*0xffd7012b*/
{
n57 = 0; /*0xffd6ffd0*/
if ( (*(_DWORD *)(this + 2919) & 0x400000) != 0 ) /*0xffd6ffde*/
{
v5 = 2 * v3; /*0xffd6ffe9*/
if ( v30 == 1 ) /*0xffd6fff0*/
{
v34 = (1 << v5) & GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 150)); /*0xffd70011*/
GroupFromPad = GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 150)); /*0xffd70015*/
n2 = 2; /*0xffd7001c*/
}
else
{
v34 = (256 << v5) & GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 146)); /*0xffd70040*/
GroupFromPad = GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 146)); /*0xffd70044*/
n2 = 512; /*0xffd70049*/
}
v8 = (n2 << v5) & GroupFromPad; /*0xffd7005a*/
if ( v34 ) /*0xffd70062*/
{
n57 = 57; /*0xffd7006a*/
if ( (*(_BYTE *)(this + 16 * v3 + 2143) & 0x20) != 0 ) /*0xffd70073*/
n57 = 3897; /*0xffd70075*/
}
PadConfig = PadConfig_1; /*0xffd7007a*/
n57_1 = n57; /*0xffd7007e*/
v2 = v31; /*0xffd70080*/
if ( v8 ) /*0xffd70087*/
{
n57 |= 0x390000u; /*0xffd7008b*/
if ( (*(_BYTE *)(this + 16 * v3 + 2151) & 0x20) != 0 ) /*0xffd70099*/
n57 = n57_1 | 0xF390000; /*0xffd7009d*/
}
}
else
{
n57 = *(_DWORD *)(this + 2919) & 0x3F /*0xffd700ef*/
| ((*(_DWORD *)(this + 2919) & 0x40000 | (*(_DWORD *)(this + 2919) >> 3) & 0x6000u) >> 3)
| (4
* (*(_DWORD *)(this + 2919) & 0xC0
| (32
* (*(_DWORD *)(this + 2919) & 0x180000
| (2 * (*(_DWORD *)(this + 2919) & 0x3F00 | (4 * (*(_DWORD *)(this + 2919) & 0xFFE0C000))))))));
}
n12_2 = n12_1; /*0xffd700f6*/
if ( v30 != 1 ) /*0xffd700fa*/
n12_2 = n12_3; /*0xffd700fc*/
n12_1 += 16; /*0xffd70100*/
n12_3 += 4; /*0xffd70105*/
*(_BYTE *)(PadConfig + 160) = n12_2; /*0xffd7010a*/
*(_DWORD *)(PadConfig + 164) = n57; /*0xffd7011c*/
v3 = ++v26; /*0xffd70122*/
}
while ( v26 < v2 ); /*0xffd7012b*/
}
v11 = GpioGetPadConfig(0, 17, 5); /*0xffd7013d*/
v12 = 0; /*0xffd7013f*/
this_1 = this; /*0xffd70141*/
v28 = 0; /*0xffd70146*/
v14 = (_BYTE *)(this + 3384); /*0xffd7014a*/
do /*0xffd7029e*/
{
v15 = *(_DWORD *)(this_1 + 2923); /*0xffd70150*/
n57_2 = 0; /*0xffd70156*/
if ( (v15 & 0x400000) != 0 ) /*0xffd7015e*/
{
if ( v30 == 1 ) /*0xffd70169*/
{
v35 = (1 << v28) & GpioGetGroupFromPad((unsigned __int16 *)(v11 + 150)); /*0xffd7018a*/
v17 = GpioGetGroupFromPad((unsigned __int16 *)(v11 + 150)); /*0xffd7018e*/
n2_1 = 2; /*0xffd70195*/
}
else
{
v35 = (256 << v28) & GpioGetGroupFromPad((unsigned __int16 *)(v11 + 146)); /*0xffd701b9*/
v17 = GpioGetGroupFromPad((unsigned __int16 *)(v11 + 146)); /*0xffd701bd*/
n2_1 = 512; /*0xffd701c2*/
}
v12 = v28; /*0xffd701c7*/
v19 = (n2_1 << v28) & v17; /*0xffd701d3*/
if ( v35 ) /*0xffd701db*/
{
n57_2 = 57; /*0xffd701e3*/
if ( (*(v14 - 8) & 0x20) != 0 ) /*0xffd701e4*/
n57_2 = 3897; /*0xffd701e6*/
}
n57_3 = n57_2; /*0xffd701eb*/
if ( v19 ) /*0xffd701f0*/
{
n57_2 |= 0x390000u; /*0xffd701f2*/
if ( (*v14 & 0x20) != 0 ) /*0xffd701fc*/
n57_2 = n57_3 | 0xF390000; /*0xffd70200*/
}
}
else
{
n57_2 = v15 & 0x3F /*0xffd70252*/
| ((v15 & 0x40000 | (v15 >> 3) & 0x6000) >> 3)
| (4 * (v15 & 0xC0 | (32 * (v15 & 0x180000 | (2 * (v15 & 0x3F00 | (4 * (v15 & 0xFFE0C000))))))));
}
n160_1 = n160; /*0xffd70259*/
if ( v30 == 1 ) /*0xffd7025d*/
*(_BYTE *)(v11 + 160) = n12; /*0xffd70263*/
else
*(_BYTE *)(v11 + 160) = n160; /*0xffd7026b*/
v12 += 2; /*0xffd70277*/
n12_4 = n12; /*0xffd7027a*/
LOBYTE(n160_1) = n160 + 4; /*0xffd7027e*/
LOBYTE(n12_4) = n12 + 16; /*0xffd70281*/
*(_DWORD *)(v11 + 164) = n57_2; /*0xffd70283*/
v14 += 16; /*0xffd70289*/
n12 = n12_4; /*0xffd7028c*/
v23 = (unsigned __int8)n12_4 < 0x3Cu; /*0xffd70290*/
v28 = v12; /*0xffd70292*/
this_1 = this; /*0xffd70296*/
n160 = n160_1; /*0xffd7029a*/
}
while ( v23 ); /*0xffd7029e*/
return this_1; /*0xffd702a4*/
}
// Function: ConfigureHdAudio @ 0xffd702ac (0x34d bytes)
int __thiscall ConfigureHdAudio(int this)
{
int PadConfig; // edi
int n2; // ebp
int v4; // esi
unsigned __int16 n0x200; // ax
unsigned int v6; // eax
unsigned __int64 v7; // rax
unsigned int v8; // edx
int v9; // eax
unsigned int v10; // eax
int v11; // edx
int n2305; // eax
unsigned int v14; // [esp+18h] [ebp-8h] BYREF
unsigned int v15; // [esp+1Ch] [ebp-4h] BYREF
DebugPrintAssert(64, "PchThermalInit () Start\n"); /*0xffd702bc*/
PadConfig = GpioGetPadConfig(0, 20, 2); /*0xffd702d0*/
n2 = PchGpioInit(); /*0xffd702dd*/
v4 = -33308672; /*0xffd702e2*/
if ( (*(_DWORD *)(this + 2903) & 3) != 2 ) /*0xffd702ea*/
v4 = *(_DWORD *)(this + 3510); /*0xffd702ec*/
ConfigureAudioPll(&v15); /*0xffd702f6*/
*(_BYTE *)(PadConfig + 4) &= ~2u; /*0xffd70300*/
*(_DWORD *)(PadConfig + 16) = v4; /*0xffd70303*/
*(_DWORD *)(PadConfig + 20) = 0; /*0xffd70306*/
*(_BYTE *)(PadConfig + 4) |= 2u; /*0xffd70312*/
if ( (*(_BYTE *)(this + 2903) & 3) != 0 ) /*0xffd7031c*/
{
GpioGetGroupIndexFromPad((_WORD *)(v4 + 16), 312); /*0xffd7034f*/
*(_BYTE *)(v4 + 6) = -1; /*0xffd70363*/
*(_BYTE *)(v4 + 128) = -1; /*0xffd70367*/
*(_BYTE *)(v4 + 10) = 1; /*0xffd7036e*/
if ( DebugLogPrint_9(unk_FFD79798, &v14) >= 0 && v14 == unk_FFD7979C ) /*0xffd70387*/
{
n0x200 = *(_WORD *)(this + 2939); /*0xffd70389*/
if ( n0x200 < 0x200u ) /*0xffd70398*/
GpioGetGroupIndexFromPad((_WORD *)(v4 + 96), n0x200 | 0x8000); /*0xffd703a5*/
}
v6 = *(_DWORD *)(this + 2907); /*0xffd703aa*/
if ( (v6 & 0x40000000) != 0 ) /*0xffd703b5*/
{
if ( n2 == 2 && v6 >= 0x80000000 ) /*0xffd703c7*/
{
v7 = __readmsr(0x1A2u); /*0xffd703ce*/
if ( (v7 & 0x7F) != 0 ) /*0xffd703d2*/
v8 = BYTE2(v7); /*0xffd703d7*/
else
v8 = BYTE2(v7) - (BYTE3(v7) & 0x3F); /*0xffd703ea*/
*(_DWORD *)(v4 + 64) = (2 * v8 + 100) | ((v8 + 60) << 21) | ((v8 + 55) << 11); /*0xffd70408*/
*(_DWORD *)(v4 + 64) |= 0xA0000000; /*0xffd70416*/
GpioSetBits((unsigned __int16 *)(v4 + 80), 0x4000); /*0xffd70419*/
*(_DWORD *)(v15 + 196) = *(_DWORD *)(v15 + 196) & 0xF8FFFFFF | 0x5000000; /*0xffd70432*/
}
else
{
*(_DWORD *)(v4 + 64) = 344262972; /*0xffd7043a*/
*(_DWORD *)(v4 + 64) |= 0x20000000u; /*0xffd70449*/
*(_DWORD *)(v4 + 64) |= 0x80000000; /*0xffd70451*/
}
}
GpioGetGroupIndexFromPad((_WORD *)(v4 + 28), 19144); /*0xffd7045c*/
*(_BYTE *)(v4 + 192) |= 1u; /*0xffd70469*/
*(_DWORD *)(v4 + 196) = *(_DWORD *)(v4 + 196) & 0xFFFFE03F | 0x7C0; /*0xffd7047f*/
if ( n2 == 1 ) /*0xffd70488*/
*(_DWORD *)(v4 + 200) = (unsigned __int16)*(_DWORD *)(v4 + 200) | 0x100000; /*0xffd70498*/
v9 = *(_DWORD *)(v4 + 208); /*0xffd7049e*/
if ( n2 == 2 ) /*0xffd704a7*/
v10 = v9 & 0xFC1FFFFF | 0xA00000; /*0xffd704ae*/
else
v10 = v9 & 0xFC1FFFFF | 0x1000000; /*0xffd704ba*/
*(_DWORD *)(v4 + 208) = v10; /*0xffd704bf*/
*(_DWORD *)(v4 + 228) = *(_DWORD *)(v4 + 228) & 0xE0FFF0E1 | 0x19000810; /*0xffd704db*/
*(_DWORD *)(v4 + 232) = *(_DWORD *)(v4 + 232) & 0xFFFF00FF | 0x8000; /*0xffd704f1*/
if ( !(unsigned __int16)GpioGetGroupFromPad((unsigned __int16 *)(v4 + 204)) ) /*0xffd704f7*/
*(_DWORD *)(v4 + 224) = -2147482946; /*0xffd70501*/
GpioSetBits((unsigned __int16 *)(v4 + 164), 7); /*0xffd70514*/
*(_BYTE *)(v4 + 8) |= 1u; /*0xffd7051e*/
if ( n2 == 1 ) /*0xffd70524*/
{
if ( (*(_DWORD *)(this + 2915) & 2) != 0 ) /*0xffd7052f*/
{
v11 = -1777; /*0xffd70531*/
n2305 = 2305; /*0xffd70536*/
}
else
{
v11 = -4082; /*0xffd7053f*/
n2305 = *(_DWORD *)(this + 2915) & 1 | (*(_DWORD *)(this + 2915) >> 4) & 0xFF0; /*0xffd7054f*/
}
AssertEfiError(239, 0x2238u, v11, n2305); /*0xffd7055d*/
}
DxeInit(this); /*0xffd70566*/
*(_BYTE *)(v4 + 4) |= 0x81u; /*0xffd70570*/
if ( (*(_BYTE *)(this + 2903) & 4) != 0 ) /*0xffd7057a*/
*(_BYTE *)(v4 + 12) |= 0x80u; /*0xffd70581*/
*(_BYTE *)(v4 + 98) |= 1u; /*0xffd70593*/
GpioSetBits((unsigned __int16 *)(v4 + 80), 0x8000); /*0xffd70596*/
*(_BYTE *)(v4 + 8) |= 0x80u; /*0xffd705a5*/
GpioSetBits((unsigned __int16 *)(v4 + 28), 0x8000); /*0xffd705a8*/
}
else
{
*(_BYTE *)(v4 + 240) |= 1u; /*0xffd70335*/
AssertEfiError(187, 0x11Cu, -1, 256); /*0xffd7033b*/
}
if ( (*(_DWORD *)(this + 2903) & 3) == 2 ) /*0xffd705b7*/
{
AssertEfiError(187, 0x138u, -1, 1); /*0xffd705c5*/
}
else
{
*(_BYTE *)(PadConfig + 4) &= 0xF9u; /*0xffd705d3*/
*(_DWORD *)(PadConfig + 16) = 0; /*0xffd705d8*/
*(_DWORD *)(PadConfig + 20) = 0; /*0xffd705db*/
*(_BYTE *)(PadConfig + 4) = 0; /*0xffd705de*/
}
DebugPrintAssert(64, "PchThermalInit () End\n"); /*0xffd705e8*/
return 0; /*0xffd705ef*/
}
// Function: DisableHdAudio @ 0xffd705f9 (0xd7 bytes)
void __thiscall DisableHdAudio(int this)
{
int v2; // edx
int v3; // edx
int n0x4000; // edi
int v5; // eax
int v6; // eax
_DWORD *v7; // [esp+4h] [ebp-4h] BYREF
if ( (*(_BYTE *)(this + 2927) & 1) != 0 ) /*0xffd70604*/
{
ConfigureAudioPll((unsigned int *)&v7); /*0xffd7060e*/
v2 = (*(_DWORD *)(this + 2931) & 4) << 8; /*0xffd7061c*/
if ( (*(_BYTE *)(this + 2935) & 4) != 0 ) /*0xffd70626*/
v2 |= 0x800u; /*0xffd70628*/
v7[50] = v2 | v7[50] & 0xFFFFF3FF; /*0xffd70647*/
v3 = (*(_DWORD *)(this + 2931) & 2) << 13; /*0xffd70656*/
if ( (*(_BYTE *)(this + 2935) & 2) != 0 ) /*0xffd70660*/
v3 |= 0x8000u; /*0xffd70662*/
n0x4000 = 0; /*0xffd7066d*/
v7[61] = v3 | v7[61] & 0xFFFF3FFF; /*0xffd70679*/
v5 = *(_DWORD *)(this + 2931); /*0xffd7067f*/
if ( (v5 & 1) != 0 ) /*0xffd70687*/
{
n0x4000 = 0x4000; /*0xffd7068b*/
DebugLogPrint_23((v5 & 4) != 0); /*0xffd70695*/
}
v6 = *(_DWORD *)(this + 2935); /*0xffd7069a*/
if ( (v6 & 1) != 0 ) /*0xffd706a2*/
{
n0x4000 |= 0x8000u; /*0xffd706a4*/
if ( (v6 & 4) != 0 ) /*0xffd706a8*/
DebugLogPrint_23(2); /*0xffd706b1*/
else
DebugLogPrint_23(3); /*0xffd706ac*/
}
v7[53] = n0x4000 | v7[53] & 0xFFFF3FFF; /*0xffd706c6*/
}
}
// Function: HdaConfigureStream @ 0xffd706d0 (0x82 bytes)
int __thiscall HdaConfigureStream(int this)
{
int n2; // ecx
int n0x8000; // esi
int n3; // edx
unsigned int v5; // eax
unsigned int v7; // [esp+4h] [ebp-4h] BYREF
ConfigureAudioPll(&v7); /*0xffd706da*/
switch ( *(_DWORD *)(this + 2955) ) /*0xffd706e8*/
{
case 1: /*0xffd706e8*/
n0x8000 = 0x8000; /*0xffd70736*/
goto LABEL_16; /*0xffd70736*/
case 2: /*0xffd706e8*/
n0x8000 = 49152; /*0xffd7072f*/
LABEL_16:
n2 = 0; /*0xffd7073b*/
goto LABEL_17; /*0xffd7073b*/
case 3: /*0xffd706e8*/
n3 = 0; /*0xffd70725*/
n2 = 2; /*0xffd70727*/
goto LABEL_13; /*0xffd70727*/
}
if ( *(_DWORD *)(this + 2955) != 4 ) /*0xffd706f7*/
{
if ( *(_DWORD *)(this + 2955) != 5 ) /*0xffd706fc*/
{
if ( *(_DWORD *)(this + 2955) != 6 ) /*0xffd70701*/
{
n2 = 0; /*0xffd70703*/
n0x8000 = 0; /*0xffd70705*/
LABEL_17:
n3 = 0; /*0xffd7073d*/
goto LABEL_18; /*0xffd7073d*/
}
n3 = 3; /*0xffd7070b*/
n2 = 3; /*0xffd7070c*/
goto LABEL_11; /*0xffd7070e*/
}
n3 = 2; /*0xffd70712*/
n2 = 2; /*0xffd70713*/
LABEL_13:
n0x8000 = 0x8000; /*0xffd70728*/
goto LABEL_18; /*0xffd7072d*/
}
n3 = 0; /*0xffd70719*/
n2 = 3; /*0xffd7071b*/
LABEL_11:
n0x8000 = 49152; /*0xffd7071c*/
LABEL_18:
v5 = v7; /*0xffd7073f*/
*(_DWORD *)(v7 + 40) = n3; /*0xffd70742*/
*(_DWORD *)(v5 + 44) = n2; /*0xffd70745*/
*(_DWORD *)(v5 + 48) = n0x8000; /*0xffd70748*/
return 0; /*0xffd7074d*/
}
// Function: Assert @ 0xffd70752 (0x30f bytes)
int __thiscall Assert(int this)
{
_DWORD *PadConfig; // ebx
int v3; // ecx
int v4; // edx
int v5; // eax
_DWORD *v6; // edx
int v7; // eax
int v8; // ecx
unsigned int v9; // eax
unsigned int v10; // eax
unsigned int v11; // eax
int v12; // edx
unsigned int v13; // eax
unsigned int v14; // ecx
unsigned int v15; // ecx
int v16; // edx
unsigned int v17; // eax
int n2; // edx
int v19; // edx
int v20; // edx
int v21; // edx
unsigned int v22; // eax
unsigned int v23; // eax
_DWORD *v24; // ebp
unsigned int v25; // esi
int v26; // eax
int v27; // eax
_DWORD *v28; // ecx
_DWORD *v29; // ecx
int v30; // eax
unsigned int v31; // eax
int v32; // eax
unsigned int v33; // eax
_DWORD *v34; // eax
_DWORD *v36; // [esp+Ch] [ebp-4h] BYREF
PadConfig = (_DWORD *)GpioGetPadConfig(0, 31, 2); /*0xffd7076b*/
ConfigureAudioPll((unsigned int *)&v36); /*0xffd7076d*/
GpioLockGpios(); /*0xffd70772*/
PchGpioInit(); /*0xffd70777*/
v3 = *(_DWORD *)(this + 2947); /*0xffd7077c*/
v4 = v3 & 1; /*0xffd70784*/
if ( (v3 & 2) != 0 ) /*0xffd7078a*/
v4 |= 2u; /*0xffd7078c*/
if ( (v3 & 4) != 0 ) /*0xffd70791*/
v4 |= 4u; /*0xffd70793*/
if ( (v3 & 8) != 0 ) /*0xffd70799*/
v4 |= 8u; /*0xffd7079b*/
if ( (v3 & 0x10) != 0 ) /*0xffd707a1*/
v4 |= 0x20u; /*0xffd707a3*/
v5 = v4 | v36[4]; /*0xffd707ad*/
v6 = v36; /*0xffd707af*/
v36[4] = v5; /*0xffd707b3*/
v7 = v6[13]; /*0xffd707b6*/
v8 = *(_DWORD *)(this + 2951); /*0xffd707b9*/
if ( (v8 & 0x40) != 0 ) /*0xffd707c2*/
v9 = v7 | 1; /*0xffd707c4*/
else
v9 = v7 & 0xFFFFFFFE; /*0xffd707c9*/
if ( *(char *)(this + 2975) >= 0 ) /*0xffd707d3*/
v10 = v9 & 0xFFFFFFFD; /*0xffd707d9*/
else
v10 = v9 | 2; /*0xffd707d5*/
if ( (v8 & 8) != 0 ) /*0xffd707df*/
v11 = v10 | 4; /*0xffd707e1*/
else
v11 = v10 & 0xFFFFFFFB; /*0xffd707e6*/
v6[13] = v11; /*0xffd707e9*/
v12 = *(_DWORD *)(this + 2951); /*0xffd707fe*/
v13 = PadConfig[41] & 0xFFFF1DFD; /*0xffd70804*/
if ( (v12 & 1) != 0 ) /*0xffd7080c*/
v13 |= 0x8000u; /*0xffd7080e*/
if ( (v12 & 2) != 0 ) /*0xffd70816*/
{
v14 = PadConfig[40] & 0x87FAFFFF | 0x18000000; /*0xffd7081e*/
v13 |= 0x2000u; /*0xffd70824*/
}
else
{
v14 = PadConfig[40] & 0x87FAFFFF | 0x60000000; /*0xffd70831*/
}
if ( (*(_BYTE *)(this + 2975) & 4) != 0 ) /*0xffd7083e*/
v15 = v14 | 0x40000000; /*0xffd70840*/
else
v15 = v14 & 0xBFFFFFFF; /*0xffd70848*/
v16 = *(_DWORD *)(this + 2959); /*0xffd7084e*/
v17 = v13 & 0xFFFFF3CF; /*0xffd70854*/
if ( v16 ) /*0xffd7085c*/
{
n2 = v16 - 1; /*0xffd7085e*/
if ( n2 ) /*0xffd70861*/
{
if ( n2 == 2 ) /*0xffd70865*/
v17 |= 0xC00u; /*0xffd7086e*/
else
v17 |= 0x800u; /*0xffd70867*/
}
else
{
v17 |= 0x400u; /*0xffd70875*/
}
}
v19 = *(_DWORD *)(this + 2963); /*0xffd7087a*/
if ( v19 ) /*0xffd70883*/
{
v20 = v19 - 1; /*0xffd70885*/
if ( v20 ) /*0xffd70888*/
{
v21 = v20 - 1; /*0xffd7088a*/
if ( v21 ) /*0xffd7088d*/
{
if ( v21 == 1 ) /*0xffd70892*/
v22 = v17 | 0x18; /*0xffd70899*/
else
v22 = v17 | 8; /*0xffd70894*/
}
else
{
v22 = v17 | 0x28; /*0xffd7089e*/
}
}
else
{
v22 = v17 | 0x38; /*0xffd708a3*/
}
}
else
{
v22 = v17 & 0xFFFFFFF7; /*0xffd708a8*/
}
if ( (*(_BYTE *)(this + 2975) & 2) != 0 ) /*0xffd708b2*/
v23 = v22 & 0xFFFFEFFF; /*0xffd708bb*/
else
v23 = v22 | 0x1000; /*0xffd708b4*/
v24 = v36; /*0xffd708c1*/
PadConfig[40] = v15; /*0xffd708c5*/
PadConfig[41] = v23; /*0xffd708cd*/
v25 = v24[6] & 0xFFF0FCF7 | 8; /*0xffd708e2*/
if ( *(_DWORD *)(this + 2967) ) /*0xffd708e5*/
{
if ( *(_DWORD *)(this + 2967) == 1 ) /*0xffd708ec*/
{
v25 = v24[6] & 0xFFF0FCF7 | 0x40008; /*0xffd70903*/
}
else if ( *(_DWORD *)(this + 2967) == 2 ) /*0xffd708f1*/
{
v25 = v24[6] & 0xFFF0FCF7 | 0x80008; /*0xffd708fb*/
}
else
{
v25 = v24[6] & 0xFFF0FCF7 | 0xC0008; /*0xffd708f3*/
}
}
v26 = *(_DWORD *)(this + 2971); /*0xffd70909*/
if ( v26 ) /*0xffd70911*/
{
v27 = v26 - 1; /*0xffd70913*/
if ( v27 ) /*0xffd70916*/
{
if ( v27 == 1 ) /*0xffd7091b*/
v25 |= 0x20000u; /*0xffd70925*/
else
v25 |= 0x30000u; /*0xffd7091d*/
}
else
{
v25 |= 0x10000u; /*0xffd7092d*/
}
}
if ( *(_BYTE *)(this + 2983) ) /*0xffd70933*/
{
switch ( *(_BYTE *)(this + 2983) ) /*0xffd70941*/
{
case 1: /*0xffd70941*/
v25 |= 0x300u; /*0xffd70975*/
break;
case 2: /*0xffd70941*/
v25 |= 0x200u; /*0xffd7096d*/
break;
case 3: /*0xffd70941*/
v25 |= 0x100u; /*0xffd70965*/
break;
default:
if ( *(_BYTE *)(this + 2983) != 4 ) /*0xffd70950*/
DebugPrintAssert(0x80000000, "Invalid value for PchPwrCycDur. Using 4Sec as the default value.\n"); /*0xffd7095c*/
break;
}
}
v24[6] = v25 | 3; /*0xffd7097e*/
if ( (*(_BYTE *)(this + 2951) & 0x10) != 0 ) /*0xffd70989*/
{
v28 = v36; /*0xffd7098b*/
v36[56] |= 0x20000u; /*0xffd7099a*/
if ( (*(_BYTE *)(this + 2951) & 0x20) != 0 ) /*0xffd709a7*/
v28[56] |= 0x10000u; /*0xffd709b4*/
}
if ( (*(_DWORD *)(this + 2975) & 0x1000) != 0 ) /*0xffd709c4*/
{
GpioReadGroupCached(); /*0xffd709ca*/
v29 = v36; /*0xffd709cf*/
v36[67] = *(_DWORD *)(this + 2979); /*0xffd709de*/
v30 = PadConfig[43]; /*0xffd709e4*/
if ( (*(_DWORD *)(this + 2975) & 0x10000) != 0 ) /*0xffd709f0*/
v31 = v30 | 0x20000; /*0xffd709f2*/
else
v31 = v30 & 0xFFFDFFFF; /*0xffd709f9*/
PadConfig[43] = v31; /*0xffd709fe*/
v32 = PadConfig[43]; /*0xffd70a0e*/
if ( (*(_DWORD *)(this + 2975) & 0x20000) != 0 ) /*0xffd70a14*/
v33 = v32 | 0x10000; /*0xffd70a16*/
else
v33 = v32 & 0xFFFEFFFF; /*0xffd70a1a*/
PadConfig[43] = v33; /*0xffd70a1f*/
v29[67] |= 1u; /*0xffd70a2e*/
if ( (*(_DWORD *)(this + 2975) & 0x2000) != 0 ) /*0xffd70a3e*/
{
v34 = (_DWORD *)SpiReadRegister(); /*0xffd70a43*/
if ( *v34 != -1 ) /*0xffd70a50*/
*v34 |= 0x2000000u; /*0xffd70a58*/
}
}
return 0; /*0xffd70a5a*/
}
// Function: Assert_5 @ 0xffd70a61 (0xd9 bytes)
int sub_FFD70A61()
{
int result; // eax
AssertEfiError(186, 0x4000, -1, 16); /*0xffd70a79*/
AssertEfiError(187, 0x4000, -1, 16); /*0xffd70a89*/
AssertEfiError(188, 0x4000, -1, 16); /*0xffd70a97*/
AssertEfiError(189, 0x4000, -1, 16); /*0xffd70aa6*/
AssertEfiError(143, 0x4000, -1, 16); /*0xffd70ab7*/
AssertEfiError(186, 0x4000, -9, 0); /*0xffd70ac6*/
AssertEfiError(187, 0x4000, -9, 0); /*0xffd70ad2*/
AssertEfiError(188, 0x4000, -9, 0); /*0xffd70ae0*/
AssertEfiError(41, 0x4000, -9, 0); /*0xffd70aef*/
AssertEfiError(33, 0x4000, -9, 0); /*0xffd70afb*/
result = (unsigned __int16)GpioReadGroupCached(); /*0xffd70b08*/
if ( (_WORD)result == 0xA243 || (_WORD)result == 0xA1C6 || (_WORD)result == 0xA1CA ) /*0xffd70b25*/
return AssertEfiError(54, 0x4000, -9, 0); /*0xffd70b2e*/
return result; /*0xffd70b35*/
}
// Function: PchInterruptAssign @ 0xffd70b3a (0x42f bytes)
int __thiscall PchInterruptAssign(int this)
{
int PadConfig; // edi
int n2_2; // eax
char v4; // bh
int n2; // ebp
unsigned int v6; // ecx
unsigned int v7; // edx
_DWORD *v8; // ecx
_DWORD *v9; // edi
unsigned __int8 i; // bl
int n167772160; // edx
int n2_1; // ebx
_DWORD *v13; // edx
int v14; // ecx
int v15; // eax
_DWORD *v16; // ecx
unsigned __int16 *v17; // ecx
unsigned __int8 n5; // [esp+0h] [ebp-10h]
char v20; // [esp+1h] [ebp-Fh]
char v21[2]; // [esp+2h] [ebp-Eh] BYREF
_DWORD *v22; // [esp+4h] [ebp-Ch] BYREF
int v23; // [esp+8h] [ebp-8h] BYREF
int n2_3; // [esp+Ch] [ebp-4h]
PadConfig = GpioGetPadConfig(0, 31, 2); /*0xffd70b54*/
ConfigureAudioPll((unsigned int *)&v22); /*0xffd70b56*/
GpioLockGpios(); /*0xffd70b5b*/
n2_2 = PchGpioInit(); /*0xffd70b60*/
v4 = *(_BYTE *)(this + 3504); /*0xffd70b65*/
n2 = n2_2; /*0xffd70b6b*/
v23 = 0; /*0xffd70b6d*/
n2_3 = n2_2; /*0xffd70b75*/
v20 = v4 & 1; /*0xffd70b79*/
if ( (v4 & 1) == 0 && (*(_BYTE *)(this + 3504) & 2) != 0 ) /*0xffd70b86*/
{
DebugLogPrint_14(0xB8u, 4u, 4, &v23); /*0xffd70b96*/
v20 = (v23 & 0x600) != 0; /*0xffd70ba8*/
}
*(_DWORD *)(PadConfig + 160) = *(_DWORD *)(PadConfig + 160) & 0xFFFACF1F | 0x30E0; /*0xffd70bbc*/
v6 = (unsigned int)v22; /*0xffd70bc8*/
*(_DWORD *)(PadConfig + 168) |= 0x4600u; /*0xffd70bd1*/
*(_DWORD *)(v6 + 20) |= 0x1052FFFu; /*0xffd70bdf*/
v7 = ((*(_DWORD *)(this + 2975) & 0xFFFFFFF8) << 26) | 0xC00000; /*0xffd70bf0*/
if ( (*(_DWORD *)(this + 2975) & 0x400) != 0 ) /*0xffd70bfb*/
v7 = ((*(_DWORD *)(this + 2975) & 0xFFFFFFF8) << 26) | 0x10C00000; /*0xffd70bfd*/
v22[15] |= v7; /*0xffd70c16*/
v8 = v22; /*0xffd70c1e*/
v22[18] = 34463489; /*0xffd70c22*/
v8[19] = 65537; /*0xffd70c25*/
v8[20] = 34463489; /*0xffd70c28*/
v8[21] = 65537; /*0xffd70c30*/
v8[22] = 114688; /*0xffd70c38*/
v8[26] = 67378176; /*0xffd70c3b*/
v8[32] = -1618617599; /*0xffd70c42*/
v8[33] = 25282529; /*0xffd70c48*/
v8[34] = -1618617599; /*0xffd70c4e*/
v8[35] = 25282529; /*0xffd70c59*/
v8[38] = 114688; /*0xffd70c64*/
v8[42] = 1577728; /*0xffd70c6a*/
v8[43] = 33579009; /*0xffd70c70*/
v8[44] = 1577728; /*0xffd70c76*/
v8[45] = 33579009; /*0xffd70c7c*/
v8[48] = 395776; /*0xffd70c82*/
v8[52] = 2099264; /*0xffd70c8c*/
v9 = v22; /*0xffd70c9c*/
v8[53] |= 0x26u; /*0xffd70ca3*/
v9[56] = 262145; /*0xffd70ca9*/
v9[61] = v9[61]; /*0xffd70cb9*/
if ( n2 == 2 ) /*0xffd70cc2*/
{
n5 = 5; /*0xffd70cc8*/
v22[128] |= 0xFFFF0000; /*0xffd70cd8*/
}
else
{
n5 = 9; /*0xffd70ce0*/
}
for ( i = 0; i <= n5; ++i ) /*0xffd70ce9*/
{
if ( !DebugLogPrint_20(i, &v21[1], v21) && v21[0] == 1 ) /*0xffd70d08*/
v22[128] &= ~(1 << i); /*0xffd70d17*/
}
n167772160 = 0; /*0xffd70d27*/
if ( !v20 ) /*0xffd70d2b*/
n167772160 = 167772160; /*0xffd70d2d*/
n2_1 = n2_3; /*0xffd70d36*/
v22[129] = n167772160 | v22[129] & 0xC0FFFFFF; /*0xffd70d47*/
v22[58] = v22[58] & 0xFFFFFE00 | 0x18; /*0xffd70d5f*/
v22[195] |= 0x44u; /*0xffd70d72*/
v22[201] = v22[201] & 0xBFFFFE00 | 0x40000006; /*0xffd70d8c*/
v22[208] = v22[208] & 0xBFFFFE00 | 0x40000008; /*0xffd70da6*/
v13 = v22; /*0xffd70db6*/
v22[234] = v22[234] & 0xBFFFFE00 | 0x40000029; /*0xffd70dc4*/
v13[197] = 503989782; /*0xffd70dcf*/
v14 = n2_1 != 2 ? 734019594 : 734003210;
if ( (*(_DWORD *)(this + 2975) & 0x800) != 0 ) /*0xffd70df3*/
v14 |= 0x8000u; /*0xffd70df5*/
v13[199] = v14 | v13[199] & 0xFFFF5E00; /*0xffd70e08*/
v15 = ((*(_DWORD *)(this + 2975) & 0xC000) << 10) | v9[56]; /*0xffd70e23*/
v23 = -1073741824; /*0xffd70e25*/
v16 = v22; /*0xffd70e2d*/
v9[56] = v15; /*0xffd70e31*/
v16[200] = 383744; /*0xffd70e37*/
if ( n2_1 == 1 ) /*0xffd70e44*/
v23 = -1071644672; /*0xffd70e46*/
v16[211] |= v23; /*0xffd70e5d*/
v22[64] |= 8u; /*0xffd70e70*/
v22[250] = v22[250] & 0xFF8FFFF8 | 0x200001; /*0xffd70e8a*/
v22[384] = v22[384] & 0x1FFFF83F | 0xE0000080; /*0xffd70ea1*/
v22[385] = v22[385] & 0xFFFFF83F | 0x80; /*0xffd70eb8*/
v22[244] = v22[244] & 0x7FC0F3FF | 0x800A0000; /*0xffd70ed2*/
v22[248] = v22[248] & 0x9FFFFE00 | 0x60000069; /*0xffd70eec*/
Assert(this); /*0xffd70ef4*/
HdaConfigureStream(this); /*0xffd70efb*/
Assert_5(); /*0xffd70f00*/
AssertEfiError(238, 0xC004u, -1, 536871965); /*0xffd70f18*/
AssertEfiError(238, 0xC008u, -8, 0); /*0xffd70f28*/
v17 = (unsigned __int16 *)(GpioGetPadConfig(0, 31, 0) + 224); /*0xffd70f43*/
if ( (*(_BYTE *)(this + 2975) & 1) != 0 ) /*0xffd70f4d*/
GpioSetBits(v17, 1); /*0xffd70f5e*/
else
GpioClearBits(v17, 65534); /*0xffd70f54*/
return 0; /*0xffd70f65*/
}
// Function: PchSetLinkWidth @ 0xffd70f69 (0x2eb bytes)
int PchSetLinkWidth()
{
int BootMode; // eax
int v1; // eax
int v2; // eax
int n51; // eax
char *p_src; // ebx
int v5; // eax
int v6; // eax
_WORD *v7; // eax
int v8; // ebp
bool v9; // zf
int v10; // eax
int v11; // eax
_DWORD *v13; // edi
__int16 src; // si
_WORD *v15; // eax
int v16; // eax
int v17; // esi
int v18; // eax
int v19; // [esp-4h] [ebp-2Ch]
_WORD *v20; // [esp+14h] [ebp-14h] BYREF
int p_n2988; // [esp+18h] [ebp-10h] BYREF
int v22; // [esp+1Ch] [ebp-Ch] BYREF
int v23; // [esp+20h] [ebp-8h] BYREF
int n17; // [esp+24h] [ebp-4h] BYREF
BootMode = PeiServicesGetBootMode(); /*0xffd70f76*/
(*(void (__cdecl **)(int, int *))(*(_DWORD *)BootMode + 40))(BootMode, &n17); /*0xffd70f83*/
if ( n17 == 17 ) /*0xffd70f8d*/
return 0; /*0xffd70f8d*/
v1 = PeiServicesGetBootMode(); /*0xffd70f93*/
v2 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int *))(*(_DWORD *)v1 + 32))(v1, &unk_FFD7ADB4, 0, 0, &v22); /*0xffd70fa9*/
if ( v2 >= 0 )
{
if ( (*(_DWORD *)(v22 + 8) & 0x2000000) == 0 ) /*0xffd71010*/
{
DebugPrintAssert(64, "PeiMePolicyPpi->HsioMessaging = 0, do not perform HSIO sync. \n"); /*0xffd71019*/
return 0; /*0xffd7124a*/
}
}
else
{
DebugPrintAssert(0x80000000, "[ME] ERROR: MePolicyPpi not located! Error: %r\n", v2);
v22 = 0; /*0xffd70fc7*/
}
n51 = GpioLockGpios(); /*0xffd70fcb*/
if ( n51 == 48 ) /*0xffd70fd3*/
{
p_src = (char *)&unk_FFD7BC2C; /*0xffd71087*/
p_n2988 = 2988; /*0xffd7108c*/
}
else
{
if ( n51 > 48 ) /*0xffd70fd9*/
{
if ( n51 <= 51 ) /*0xffd70fde*/
{
p_n2988 = 0; /*0xffd71029*/
DebugLogPrint_4(&p_n2988); /*0xffd7102d*/
p_src = (char *)&unk_FFD7B10C; /*0xffd71037*/
if ( p_n2988 != 4 ) /*0xffd7103c*/
p_src = (char *)&unk_FFD7D2FC; /*0xffd7103e*/
goto LABEL_14; /*0xffd7103e*/
}
if ( n51 <= 53 ) /*0xffd70fe3*/
{
p_n2988 = 0; /*0xffd70fe9*/
DebugLogPrint_4(&p_n2988); /*0xffd70fed*/
p_src = &src; /*0xffd70ff7*/
if ( p_n2988 != 4 ) /*0xffd70ffc*/
p_src = (char *)&unk_FFD7DE1C; /*0xffd70ffe*/
LABEL_14:
p_n2988 = 2844; /*0xffd71043*/
goto LABEL_18; /*0xffd7104b*/
}
}
p_src = 0; /*0xffd7104d*/
p_n2988 = 0; /*0xffd7104f*/
v5 = GpioLockGpios(); /*0xffd71053*/
DebugPrintAssert(0x80000000, "Cannot find HSIO configuration table for PCH stepping %d\n", v5); /*0xffd7105f*/
v6 = DebugAssert(); /*0xffd71067*/
if ( v6 ) /*0xffd7106e*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffd7107f*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchHsio.c",
171,
"((BOOLEAN)(0==1))");
}
LABEL_18:
v7 = AssertCpuDeadLoop_9((char *)dword_FFD7ACF4); /*0xffd71094*/
v20 = v7; /*0xffd7109e*/
if ( !v7 )
{
v23 = 0; /*0xffd710b1*/
DebugPrintAssert(64, "(Hsio) ChipsetInitHob not found\n"); /*0xffd710b5*/
v8 = AssertCpuDeadLoop_2(v19, &v23); /*0xffd710c5*/
v9 = v8 == 0; /*0xffd710c7*/
if ( v8 >= 0 ) /*0xffd710c9*/
{
DebugPrintAssert(64, "(Hsio) Creating HOB to adjust Hsio settings in PchInit, if required\n"); /*0xffd710d6*/
v10 = PeiServicesGetBootMode(); /*0xffd710db*/
v8 = (*(int (__cdecl **)(int, int, int, _WORD **))(*(_DWORD *)v10 + 52))(v10, 4, 28, &v20); /*0xffd710ef*/
if ( v8 < 0 ) /*0xffd710f6*/
{
DebugPrintAssert(0x80000000, "(Hsio) ChipsetInitHob could not be created\n"); /*0xffd710fe*/
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v8); /*0xffd7110a*/
v11 = DebugAssert(); /*0xffd71112*/
if ( v11 ) /*0xffd71119*/
(*(void (__cdecl **)(const char *, int, const char *))(v11 + 4))( /*0xffd7112a*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchHsio.c",
197,
"!EFI_ERROR (Status)");
return -2147483627; /*0xffd71135*/
}
v9 = v8 == 0; /*0xffd71148*/
v20[12] = v23; /*0xffd7114a*/
v13 = v20 + 4; /*0xffd71152*/
*((_DWORD *)v20 + 2) = dword_FFD7ACF4[0]; /*0xffd71155*/
*++v13 = dword_FFD7ACF4[1]; /*0xffd71156*/
*++v13 = dword_FFD7ACF4[2]; /*0xffd71157*/
v13[1] = dword_FFD7ACF4[3]; /*0xffd71158*/
}
if ( !v9 )
{
DebugPrintAssert(64, "(Hsio) Syncing ChipsetInit with ME failed! Error: %r\n", v8);
return 0; /*0xffd71168*/
}
v7 = v20; /*0xffd7116d*/
}
DebugPrintAssert(64, "(Hsio) ME Reported CRC=0x%04X\n", (unsigned __int16)v7[12]); /*0xffd7117d*/
if ( !p_src ) /*0xffd71187*/
return 0; /*0xffd71187*/
src = *(_WORD *)p_src; /*0xffd7118d*/
DebugPrintAssert(64, "(Hsio) BIOS Hsio CRC=0x%04X\n", *(unsigned __int16 *)p_src); /*0xffd71198*/
if ( PchIsType4() ) /*0xffd711a0*/
{
DebugPrintAssert(64, "(Hsio) Skip HSIO config update when running on Simics\n"); /*0xffd711b0*/
v15 = v20; /*0xffd711b5*/
src = v20[12]; /*0xffd711bb*/
}
else
{
v15 = v20; /*0xffd711c1*/
}
if ( v15[12] == src ) /*0xffd711c9*/
return 0; /*0xffd711c9*/
DebugPrintAssert(64, "(Hsio) Sending HSIO as MKHI message\n"); /*0xffd711d2*/
v16 = AssertCpuDeadLoop(p_src, p_n2988); /*0xffd711df*/
v17 = v16; /*0xffd711e4*/
if ( v16 >= 0 ) /*0xffd711e8*/
return 0; /*0xffd711e8*/
DebugPrintAssert(0x80000000, "ChipsetInit Sync Error: %r\n", v16);
if ( v17 == -2147483645 || v17 == -2147483641 ) /*0xffd71208*/
{
DebugPrintAssert( /*0xffd71242*/
0x80000000,
"Current Me Bios boot path doesn't support Chipset Init Sync message, continue to boot.\n",
v17);
return 0; /*0xffd71242*/
}
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v17); /*0xffd71211*/
v18 = DebugAssert(); /*0xffd71219*/
if ( v18 ) /*0xffd71220*/
(*(void (__cdecl **)(const char *, int, const char *))(v18 + 4))( /*0xffd71231*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchHsio.c",
230,
"!EFI_ERROR (Status)");
return -2147483645; /*0xffd7124c*/
}
// Function: PchThermalInit @ 0xffd71254 (0xbb bytes)
int __thiscall PchThermalInit(void *this)
{
int BootMode; // eax
int v2; // eax
int v3; // eax
_WORD *v4; // eax
_WORD *v5; // esi
int n17; // [esp+0h] [ebp-4h]
DebugPrintAssert(64, "(WDT) EndOfPeiCallback\n", this); /*0xffd7125f*/
BootMode = PeiServicesGetBootMode(); /*0xffd71264*/
v2 = (*(int (__stdcall **)(int))(*(_DWORD *)BootMode + 40))(BootMode); /*0xffd71270*/
if ( v2 < 0 ) /*0xffd71278*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v2); /*0xffd71285*/
v3 = DebugAssert(); /*0xffd7128d*/
if ( v3 ) /*0xffd71294*/
(*(void (__cdecl **)(const char *, int, const char *))(v3 + 4))( /*0xffd712a5*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\Wdt.c",
241,
"!EFI_ERROR (Status)");
}
v4 = AssertCpuDeadLoop_9(byte_FFD7ADE4); /*0xffd712b1*/
v5 = v4; /*0xffd712b6*/
if ( !v4 ) /*0xffd712ba*/
return -2147483634; /*0xffd712bc*/
DebugPrintAssert( /*0xffd712d7*/
64,
"(WDT) BootMode %d, Hob, active %d, ToV %d\n",
n17,
*((unsigned __int8 *)v4 + 26),
(unsigned __int16)v4[12]);
if ( n17 == 17 ) /*0xffd712e3*/
{
if ( *((_BYTE *)v5 + 26) == 1 ) /*0xffd712e9*/
{
if ( v5[12] >= 0xAu ) /*0xffd712f5*/
Assert_9((unsigned __int16)v5[12]); /*0xffd712fb*/
else
Assert_9(0xAu); /*0xffd712f8*/
}
else
{
Assert_21(); /*0xffd71303*/
}
}
return 0; /*0xffd7130d*/
}
// Function: PchRootPortsInit @ 0xffd7130f (0x75 bytes)
int __thiscall PchRootPortsInit(int this)
{
int v2; // ebx
int PadConfig; // edi
DebugPrintAssert(64, "ConfigureXhci () - Start\n"); /*0xffd7131b*/
v2 = *(_DWORD *)(this + 3510); /*0xffd71320*/
PchGpioInit(); /*0xffd71326*/
PadConfig = GpioGetPadConfig(0, 20, 0); /*0xffd71337*/
*(_DWORD *)(PadConfig + 16) = v2; /*0xffd7133f*/
GpioSetBits((unsigned __int16 *)(PadConfig + 4), 6); /*0xffd71344*/
DebugLogPrint_2(v2); /*0xffd7134b*/
GpioClearBits((_WORD *)(PadConfig + 4), 65529); /*0xffd71357*/
*(_DWORD *)(PadConfig + 16) = 0; /*0xffd71361*/
GpioSetBits((unsigned __int16 *)(PadConfig + 4), 320); /*0xffd7136a*/
DebugPrintAssert(64, "ConfigureXhci () - End\n"); /*0xffd71376*/
return 0; /*0xffd71380*/
}
// Function: DebugLogPrint_2 @ 0xffd71384 (0x174 bytes)
char __thiscall DebugLogPrint_2(_DWORD *this)
{
unsigned int v2; // ebx
int n1344; // edi
int v4; // eax
unsigned int v5; // ebp
int v6; // eax
int v7; // eax
int *v8; // esi
int n10; // eax
int v10; // eax
unsigned int v11; // eax
int n1344_1; // ecx
unsigned int i; // esi
char result; // al
unsigned int v15; // ecx
_DWORD *v16; // edx
char v17; // al
unsigned int *v18; // ecx
char v19; // [esp+13h] [ebp-Dh]
int v20; // [esp+14h] [ebp-Ch]
int v21; // [esp+14h] [ebp-Ch]
int v22; // [esp+18h] [ebp-8h]
v2 = 0; /*0xffd71392*/
n1344 = 0; /*0xffd71399*/
v4 = PchGpioInit(); /*0xffd7139b*/
v5 = (unsigned __int8)BYTE1(*(this + 8202)); /*0xffd713a9*/
v6 = v4 - 1; /*0xffd713ac*/
if ( v6 ) /*0xffd713af*/
{
if ( v6 == 1 ) /*0xffd713b4*/
{
n1344 = 1344; /*0xffd713d6*/
}
else
{
v7 = DebugAssert(); /*0xffd713b6*/
if ( v7 ) /*0xffd713bd*/
(*(void (__cdecl **)(const char *, int, const char *))(v7 + 4))( /*0xffd713ce*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiPchInitLib\\PchUsb.c",
1105,
"((BOOLEAN)(0==1))");
}
}
else
{
n1344 = 1408; /*0xffd713dd*/
}
v22 = -1; /*0xffd713e5*/
v19 = 0; /*0xffd713ed*/
v8 = this + HIWORD(*(this + 4)); /*0xffd713f1*/
v20 = *v8; /*0xffd71401*/
DebugPrintAssert(0x80000000, "PchUsbPei XHCI Capability Pointer = 0x%x\n", v8); /*0xffd71405*/
LOWORD(n10) = v20; /*0xffd7140a*/
while ( (_BYTE)n10 != 10 ) /*0xffd71424*/
{
v10 = BYTE1(n10); /*0xffd71416*/
if ( !v10 ) /*0xffd7141b*/
goto LABEL_18; /*0xffd7141b*/
v8 += v10; /*0xffd7141d*/
n10 = *v8; /*0xffd71420*/
}
if ( (v8[8] & 1) != 0 ) /*0xffd7142b*/
{
v11 = 0; /*0xffd71430*/
v19 = 1; /*0xffd71435*/
if ( v5 ) /*0xffd7143c*/
{
n1344_1 = n1344; /*0xffd71441*/
while ( 16 * (HIBYTE(v8[9]) + 71) != n1344_1 ) /*0xffd71448*/
{
++v11; /*0xffd7144a*/
n1344_1 += 16; /*0xffd7144b*/
if ( v11 >= v5 ) /*0xffd71450*/
goto LABEL_18; /*0xffd71450*/
}
v22 = v11; /*0xffd7145f*/
DebugPrintAssert(0x80000000, "PchUsbCommon DebugPortSsIndex = ?%d\n", v11); /*0xffd71463*/
}
}
LABEL_18:
for ( i = 0; ; ++i ) /*0xffd7146b*/
{
result = 0; /*0xffd7146d*/
v15 = 0; /*0xffd7146f*/
v21 = 0; /*0xffd71471*/
if ( v5 ) /*0xffd71477*/
{
v16 = (_DWORD *)((char *)this + n1344); /*0xffd71481*/
v17 = v19; /*0xffd71484*/
do /*0xffd714a0*/
{
if ( !v17 || v15 != v22 ) /*0xffd7148e*/
{
v21 |= *v16; /*0xffd71492*/
v17 = v19; /*0xffd71496*/
}
++v15; /*0xffd7149a*/
v16 += 4; /*0xffd7149b*/
}
while ( v15 < v5 ); /*0xffd714a0*/
result = v21; /*0xffd714a2*/
v2 = 0; /*0xffd714a6*/
}
if ( (result & 0x10) == 0 || i > 0x2EE0 ) /*0xffd714b2*/
break; /*0xffd714b2*/
SiMicroSecondDelay(0xAu); /*0xffd714b7*/
}
if ( v5 ) /*0xffd714c1*/
{
v18 = (_DWORD *)((char *)this + n1344); /*0xffd714c7*/
result = v19; /*0xffd714ca*/
do /*0xffd714ee*/
{
if ( !result || v2 != v22 ) /*0xffd714d6*/
{
*v18 = *v18 & 0xFF01FFFD | 0xFE0000; /*0xffd714e2*/
result = v19; /*0xffd714e4*/
}
++v2; /*0xffd714e8*/
v18 += 4; /*0xffd714e9*/
}
while ( v2 < v5 ); /*0xffd714ee*/
}
return result; /*0xffd714f0*/
}
// Function: PchHsioInit @ 0xffd714f8 (0x124 bytes)
int __thiscall PchHsioInit(int this)
{
int v2; // eax
if ( this )
{
DebugPrintAssert(64, "[ME] Disabling ME functions:"); /*0xffd7152b*/
if ( SmmGetInfo() )
{
DebugPrintAssert(64, " DWR: Exit\n");
}
else
{
if ( (*(_DWORD *)(this + 8) & 0xC000) == 0 ) /*0xffd71554*/
DebugPrintAssert(64, " 0 (HECI-1)"); /*0xffd7155c*/
if ( (*(_DWORD *)(this + 8) & 0x30000) == 0 ) /*0xffd7156a*/
DebugPrintAssert(64, " 1 (HECI-2)"); /*0xffd71572*/
if ( (*(_DWORD *)(this + 8) & 0xC0000) == 0 ) /*0xffd71580*/
DebugPrintAssert(64, " 4 (HECI-3)"); /*0xffd71588*/
if ( (*(_DWORD *)(this + 8) & 0x300000) == 0 ) /*0xffd71596*/
DebugPrintAssert(64, " 2 (IDE-R)"); /*0xffd7159e*/
if ( (*(_DWORD *)(this + 8) & 0xC00000) == 0 ) /*0xffd715ac*/
DebugPrintAssert(64, " 3 (KT)"); /*0xffd715b4*/
DebugPrintAssert(64, asc_FFD77B04); /*0xffd715c1*/
Assert_2(0, (unsigned __int8)HIBYTE(*(_WORD *)(this + 8)) >> 6); /*0xffd715d5*/
Assert_2(1, *(_WORD *)(this + 10) & 3); /*0xffd715e3*/
Assert_2(4, (*(_DWORD *)(this + 8) >> 18) & 3); /*0xffd715f3*/
Assert_2(2, (*(_DWORD *)(this + 8) >> 20) & 3); /*0xffd71603*/
Assert_2(3, (*(_DWORD *)(this + 8) >> 22) & 3); /*0xffd71612*/
}
return 0; /*0xffd71618*/
}
else
{
v2 = DebugAssert(); /*0xffd714ff*/
if ( v2 ) /*0xffd71506*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd71514*/
"e:\\hs\\PurleyPlatPkg\\Me\\Library\\MeLibPei\\MeLibPei.c",
49,
"pPolicy != ((void *) 0)");
return -2147483646; /*0xffd7151a*/
}
}
// Function: PchHsioSync @ 0xffd7161c (0xd1 bytes)
int PchHsioSync()
{
int v0; // eax
int v1; // eax
int v2; // eax
int v3; // eax
int v4; // eax
int v5; // eax
int v6; // esi
int v8; // [esp+10h] [ebp-4h] BYREF
v0 = PeiServicesGetBootMode(); /*0xffd71621*/
v1 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int *))(*(_DWORD *)v0 + 32))(v0, &unk_FFD7ADC4, 0, 0, &v8); /*0xffd71637*/
if ( v1 < 0 ) /*0xffd7164e*/
{
v8 = 0; /*0xffd71657*/
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v1); /*0xffd7165b*/
v2 = DebugAssert(); /*0xffd71663*/
if ( v2 ) /*0xffd7166a*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd71670*/
"e:\\hs\\PurleySktPkg\\Me\\Policy\\Library\\MeSpsPolicyAccessPeiLib\\MeSpsPolicyAccessPeiLib.c",
62,
"!EFI_ERROR (Status)");
}
if ( v8 ) /*0xffd7167c*/
MePolicyPrint(); /*0xffd7167e*/
v3 = PeiServicesGetBootMode(); /*0xffd71683*/
v4 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int *))(*(_DWORD *)v3 + 32))(v3, &unk_FFD7ADB4, 0, 0, &v8); /*0xffd71697*/
if ( v4 < 0 ) /*0xffd7169f*/
{
v8 = 0; /*0xffd716a8*/
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v4); /*0xffd716ac*/
v5 = DebugAssert(); /*0xffd716b4*/
if ( v5 ) /*0xffd716bb*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffd716c1*/
"e:\\hs\\PurleySktPkg\\Me\\Policy\\Library\\MeSpsPolicyAccessPeiLib\\MeSpsPolicyAccessPeiLib.c",
94,
"!EFI_ERROR (Status)");
}
v6 = v8; /*0xffd716c7*/
if ( v8 ) /*0xffd716cd*/
PeiMePolicyUpdate(v8); /*0xffd716d1*/
MeSpsPolicyPrint(); /*0xffd716d6*/
PeiAmtInitPostMem(); /*0xffd716db*/
return PchHsioInit(v6); /*0xffd716e7*/
}
// Function: PchWdtEndOfPei @ 0xffd716ed (0x4f bytes)
int PchWdtEndOfPei()
{
unsigned __int8 v0; // al
char n3; // al
char n3_1; // cl
v0 = __inbyte(0x70u); /*0xffd716f3*/
__outbyte(0x70u, v0 & 0x80 | 0x4A); /*0xffd716f8*/
n3 = __inbyte(0x71u); /*0xffd716ff*/
n3_1 = n3; /*0xffd71700*/
if ( (unsigned __int8)n3 <= 3u ) /*0xffd71705*/
{
LABEL_4:
if ( !n3_1 ) /*0xffd71720*/
return 0; /*0xffd71720*/
goto LABEL_5; /*0xffd71720*/
}
n3_1 = n3_0; /*0xffd71707*/
if ( !n3_0 ) /*0xffd7170f*/
{
n3_1 = MEMORY[0xFDAF0490] & 2 | 1; /*0xffd7171b*/
goto LABEL_4; /*0xffd7171b*/
}
LABEL_5:
if ( n3_1 != -1 )
return n3_1 != 1 ? -2147483578 : -2147483644;
return 0; /*0xffd71738*/
}
// Function: PeiServicesGetBootMode @ 0xffd7173c (0x32 bytes)
int PeiServicesGetBootMode()
{
int v0; // esi
_BYTE v2[8]; // [esp+4h] [ebp-8h] BYREF
GpioGetGpiomuxConfig(v2); /*0xffd71745*/
v0 = *(_DWORD *)(*(_DWORD *)&v2[2] - 4); /*0xffd7174d*/
if ( !v0 ) /*0xffd71752*/
SiAssert( /*0xffd71761*/
(int)"e:\\hs\\MdePkg\\Library\\PeiServicesTablePointerLibIdt\\PeiServicesTablePointer.c",
48,
"PeiServices != ((void *) 0)");
return v0; /*0xffd71769*/
}
// Function: PchUsbInit @ 0xffd7176e (0x180 bytes)
unsigned int __usercall PchUsbInit@<eax>(unsigned int a1@<edx>, unsigned int n0x1000)
{
int v3; // ebx
int v4; // eax
unsigned int v6; // esi
int v7; // eax
int BootMode; // eax
int v9; // ebp
unsigned int v10; // ebx
int v11; // eax
int v12; // eax
int v13; // eax
int v14; // eax
int v15; // eax
unsigned int v16; // [esp+10h] [ebp-8h] BYREF
int v17; // [esp+14h] [ebp-4h]
v3 = n0x1000 - 1; /*0xffd7177f*/
if ( ((n0x1000 - 1) & n0x1000) != 0 ) /*0xffd71784*/
{
v4 = DebugAssert(); /*0xffd71786*/
if ( v4 ) /*0xffd7178d*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd7179a*/
"e:\\hs\\MdePkg\\Library\\PeiMemoryAllocationLib\\MemoryAllocationLib.c",
194,
"(Alignment & (Alignment - 1)) == 0");
}
if ( !a1 ) /*0xffd717a2*/
return 0; /*0xffd717a2*/
if ( n0x1000 > 0x1000 ) /*0xffd717b1*/
{
v6 = a1 + ((n0x1000 & 0xFFF) != 0) + (n0x1000 >> 12); /*0xffd717c9*/
if ( v6 <= a1 ) /*0xffd717cd*/
{
v7 = DebugAssert(); /*0xffd717cf*/
if ( v7 ) /*0xffd717d6*/
(*(void (__cdecl **)(const char *, int, const char *))(v7 + 4))( /*0xffd717e3*/
"e:\\hs\\MdePkg\\Library\\PeiMemoryAllocationLib\\MemoryAllocationLib.c",
208,
"RealPages > Pages");
}
BootMode = PeiServicesGetBootMode(); /*0xffd717e9*/
if ( (*(int (__cdecl **)(int, _DWORD, unsigned int, unsigned int *))(*(_DWORD *)BootMode + 72))( /*0xffd71801*/
BootMode,
0,
v6,
&v16) >= 0 )
{
v9 = ~v3 & (v16 + v3); /*0xffd7180c*/
v10 = ((v9 - v16) >> 12) /*0xffd71823*/
+ (((((unsigned __int16)~(_WORD)v3 & (unsigned __int16)(v16 + v3)) - (_WORD)v16) & 0xFFF) != 0);
if ( v10 ) /*0xffd71825*/
{
v11 = SiFreePages(v16, v17); /*0xffd7182e*/
if ( v11 < 0 ) /*0xffd71837*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v11); /*0xffd71844*/
v12 = DebugAssert(); /*0xffd7184c*/
if ( v12 ) /*0xffd71853*/
(*(void (__cdecl **)(const char *, int, const char *))(v12 + 4))( /*0xffd71864*/
"e:\\hs\\MdePkg\\Library\\PeiMemoryAllocationLib\\MemoryAllocationLib.c",
221,
"!EFI_ERROR (Status)");
}
}
v17 = 0; /*0xffd7186a*/
v16 = v9 + (a1 << 12); /*0xffd71878*/
if ( ((n0x1000 & 0xFFF) != 0) + (n0x1000 >> 12) != v10 ) /*0xffd7187c*/
{
v13 = SiFreePages(v9 + (a1 << 12), 0); /*0xffd71885*/
if ( v13 < 0 ) /*0xffd7188e*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v13); /*0xffd7189b*/
v14 = DebugAssert(); /*0xffd718a3*/
if ( v14 ) /*0xffd718aa*/
(*(void (__cdecl **)(const char *, int, const char *))(v14 + 4))( /*0xffd718bb*/
"e:\\hs\\MdePkg\\Library\\PeiMemoryAllocationLib\\MemoryAllocationLib.c",
230,
"!EFI_ERROR (Status)");
}
}
return v9; /*0xffd718c1*/
}
return 0; /*0xffd717a6*/
}
v15 = PeiServicesGetBootMode(); /*0xffd718c3*/
if ( (*(int (__cdecl **)(int, _DWORD, unsigned int, unsigned int *))(*(_DWORD *)v15 + 72))(v15, 0, a1, &v16) < 0 ) /*0xffd718db*/
return 0; /*0xffd718db*/
return v16; /*0xffd718e7*/
}
// Function: PeiGetInfo @ 0xffd718ee (0x2a bytes)
int __thiscall PeiGetInfo(void *this)
{
int BootMode; // eax
int v4; // [esp+4h] [ebp-4h] BYREF
BootMode = PeiServicesGetBootMode(); /*0xffd718f5*/
if ( (*(int (__cdecl **)(int, void *, int *))(*(_DWORD *)BootMode + 76))(BootMode, this, &v4) >= 0 ) /*0xffd7190b*/
return v4; /*0xffd71911*/
else
return 0; /*0xffd7190d*/
}
// Function: PeiGetInfoAlloc @ 0xffd71918 (0x1c bytes)
void *__thiscall PeiGetInfoAlloc(void *this)
{
void *buf; // eax
buf = (void *)PeiGetInfo(this); /*0xffd7191b*/
if ( buf ) /*0xffd71922*/
{
if ( this ) /*0xffd71926*/
return MemConfig_0((int)buf, (unsigned int)this); /*0xffd7192d*/
}
return buf; /*0xffd71932*/
}
// Function: AssertCpuDeadLoop_5 @ 0xffd71934 (0x6e bytes)
int sub_FFD71934()
{
int BootMode; // eax
int v1; // eax
int v2; // eax
int v3; // eax
int v5; // [esp+4h] [ebp-4h] BYREF
BootMode = PeiServicesGetBootMode(); /*0xffd71939*/
v1 = (*(int (__cdecl **)(int, int *))(*(_DWORD *)BootMode + 48))(BootMode, &v5); /*0xffd71945*/
if ( v1 < 0 ) /*0xffd71951*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v1); /*0xffd7195e*/
v2 = DebugAssert(); /*0xffd71966*/
if ( v2 ) /*0xffd7196d*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd71977*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
50,
"!EFI_ERROR (Status)");
}
if ( !v5 ) /*0xffd71981*/
{
v3 = DebugAssert(); /*0xffd71983*/
if ( v3 ) /*0xffd7198a*/
(*(void (__cdecl **)(const char *, int, const char *))(v3 + 4))( /*0xffd71994*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
51,
"HobList != ((void *) 0)");
}
return v5; /*0xffd7199d*/
}
// Function: HobConfig_1 @ 0xffd719a2 (0x45 bytes)
_WORD *__fastcall HobConfig_1(int a1, _WORD *i)
{
_WORD *i_1; // esi
int v3; // eax
i_1 = i; /*0xffd719a3*/
if ( !i ) /*0xffd719a7*/
{
v3 = DebugAssert(); /*0xffd719a9*/
if ( v3 ) /*0xffd719b0*/
(*(void (__cdecl **)(const char *, int, const char *))(v3 + 4))( /*0xffd719be*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
82,
"HobStart != ((void *) 0)");
}
while ( 1 ) /*0xffd719d7*/
{
if ( *i_1 == 0xFFFF ) /*0xffd719dd*/
return 0; /*0xffd719e2*/
if ( *i_1 == 4 ) /*0xffd719cf*/
break; /*0xffd719cf*/
i_1 = (_WORD *)((char *)i_1 + (unsigned __int16)i_1[1]); /*0xffd719d5*/
}
return i_1; /*0xffd719e1*/
}
// Function: AssertCpuDeadLoop_9 @ 0xffd719e7 (0x3a bytes)
_WORD *__thiscall sub_FFD719E7(char *this)
{
_WORD *i; // edx
int v3; // ecx
_WORD *v4; // eax
_WORD *v5; // esi
for ( i = (_WORD *)AssertCpuDeadLoop_5(); ; i = (_WORD *)((char *)v5 + (unsigned __int16)v5[1]) ) /*0xffd719f6*/
{
v4 = HobConfig_1(v3, i); /*0xffd71a0e*/
v5 = v4; /*0xffd71a13*/
if ( !v4 || Assert_26(this, (int)(v4 + 4)) ) /*0xffd719ff*/
break; /*0xffd719ff*/
}
return v5; /*0xffd71a19*/
}
// Function: HobConfig_2 @ 0xffd71a21 (0x41 bytes)
int __fastcall HobConfig_2(int n3, int n48)
{
int v2; // eax
int p_n3; // [esp+0h] [ebp-4h] BYREF
p_n3 = n3; /*0xffd71a24*/
if ( SiCreateHob(n3, n48, &p_n3) < 0 ) /*0xffd71a31*/
p_n3 = 0; /*0xffd71a33*/
if ( !p_n3 ) /*0xffd71a3b*/
{
v2 = DebugAssert(); /*0xffd71a3d*/
if ( v2 ) /*0xffd71a44*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd71a55*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
250,
"Hob != ((void *) 0)");
}
return p_n3; /*0xffd71a60*/
}
// Function: HobConfig_0 @ 0xffd71a62 (0x6e bytes)
int __fastcall sub_FFD71A62(int a1, unsigned int n6948)
{
int v4; // eax
int v5; // eax
int result; // eax
int v7; // esi
if ( !a1 ) /*0xffd71a70*/
{
v4 = DebugAssert(); /*0xffd71a72*/
if ( v4 ) /*0xffd71a79*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd71a86*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
416,
"Guid != ((void *) 0)");
}
if ( n6948 > 0xFFE0 ) /*0xffd71a92*/
{
v5 = DebugAssert(); /*0xffd71a94*/
if ( v5 ) /*0xffd71a9b*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffd71aa8*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
421,
"DataLength <= (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE))");
}
result = HobConfig_2(4, n6948 + 24); /*0xffd71ab4*/
v7 = result; /*0xffd71ab9*/
if ( result ) /*0xffd71abd*/
{
Assert_27(result + 8, a1); /*0xffd71ac4*/
return v7 + 24; /*0xffd71ac9*/
}
return result; /*0xffd71acc*/
}
// Function: SataConfig @ 0xffd71ad0 (0x4e bytes)
char *__fastcall SataConfig(int a1, char *this, unsigned int n6948)
{
int v5; // eax
char *dst; // eax
if ( !this ) /*0xffd71ad8*/
{
if ( n6948 ) /*0xffd71ade*/
{
v5 = DebugAssert(); /*0xffd71ae0*/
if ( v5 ) /*0xffd71ae7*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffd71af8*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
466,
"Data != ((void *) 0) || DataLength == 0");
}
}
dst = (char *)HobConfig_0(a1, n6948); /*0xffd71b04*/
if ( dst ) /*0xffd71b0b*/
return MemConfig(dst, this, n6948); /*0xffd71b15*/
return dst; /*0xffd71b1b*/
}
// Function: HobConfig @ 0xffd71b1e (0x78 bytes)
_DWORD *__cdecl sub_FFD71B1E(int a1, int a2)
{
int v2; // eax
_DWORD *result; // eax
_DWORD *v4; // esi
if ( (a1 & 0xFFF) != 0 ) /*0xffd71b2e*/
{
v2 = DebugAssert(); /*0xffd71b30*/
if ( v2 ) /*0xffd71b37*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd71b48*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
843,
"((BaseAddress & (0x00001000 - 1)) == 0) && ((Length & (0x00001000 - 1)) == 0)");
}
result = (_DWORD *)HobConfig_2(2, 48); /*0xffd71b54*/
v4 = result; /*0xffd71b59*/
if ( result ) /*0xffd71b5d*/
{
MemConfig_0((int)(result + 2), 0x10u); /*0xffd71b65*/
v4[9] = 0; /*0xffd71b71*/
v4[6] = a1; /*0xffd71b78*/
v4[7] = a2; /*0xffd71b7c*/
v4[8] = 4096; /*0xffd71b7f*/
v4[10] = 11; /*0xffd71b86*/
return MemConfig_0((int)(v4 + 11), 4u); /*0xffd71b8e*/
}
return result; /*0xffd71b8d*/
}
// Function: PchSbiExecWrite @ 0xffd71b96 (0x1f bytes)
int __cdecl PchSbiExecWrite(unsigned __int64 a1, int a2, _DWORD *a3, _BYTE *a4)
{
int n156; // ecx
return PchSbiExec(n156, 19, a1, 0, a3, a4, 19); /*0xffd71bb4*/
}
// Function: PchSbiExec @ 0xffd71bb5 (0x15a bytes)
int __fastcall PchSbiExec(
int n156,
int n5,
unsigned __int64 a3,
unsigned __int8 n0xB3,
_DWORD *a5,
_BYTE *a6,
int n7)
{
int v8; // ebx
int PadConfig; // esi
int n0xFFFFFFF; // ebp
int n0xFFFFFFF_1; // ebp
unsigned __int8 GroupFromPad; // al
char v13; // al
if ( n7 > 7 && n7 != 19 ) /*0xffd71bd0*/
return -2147483646; /*0xffd71bd2*/
v8 = 0; /*0xffd71be0*/
LOBYTE(n7) = 0; /*0xffd71be5*/
PadConfig = GpioGetPadConfig(0, 31, 1); /*0xffd71bef*/
GpioIsPadValid(PadConfig, (bool *)&n7); /*0xffd71bf7*/
n0xFFFFFFF = 0xFFFFFFF; /*0xffd71bfc*/
do /*0xffd71c13*/
{
if ( (GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 216)) & 1) == 0 ) /*0xffd71c0e*/
break; /*0xffd71c0e*/
--n0xFFFFFFF; /*0xffd71c10*/
}
while ( n0xFFFFFFF ); /*0xffd71c13*/
if ( !n0xFFFFFFF ) /*0xffd71c1b*/
goto LABEL_21; /*0xffd71c1b*/
*a6 = 4; /*0xffd71c31*/
*(_DWORD *)(PadConfig + 208) = (unsigned __int16)a3 | (n156 << 24); /*0xffd71c3d*/
*(_DWORD *)(PadConfig + 220) = RShift64_16(a3); /*0xffd71c48*/
GpioModifyBits((unsigned __int16 *)(PadConfig + 216), 127, (_WORD)n5 << 8); /*0xffd71c5f*/
GpioGetGroupIndexFromPad((_WORD *)(PadConfig + 218), n0xB3 | 0xF000); /*0xffd71c78*/
if ( n5 == 5 || n5 == 7 || n5 == 19 ) /*0xffd71c8d*/
*(_DWORD *)(PadConfig + 212) = *a5; /*0xffd71c9d*/
else
*(_DWORD *)(PadConfig + 212) = 0; /*0xffd71c8f*/
GpioSetBits((unsigned __int16 *)(PadConfig + 216), 1); /*0xffd71ca8*/
n0xFFFFFFF_1 = 0xFFFFFFF; /*0xffd71cad*/
do /*0xffd71cc7*/
{
GroupFromPad = GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 216)); /*0xffd71cb8*/
if ( (GroupFromPad & 1) == 0 ) /*0xffd71cc2*/
break; /*0xffd71cc2*/
--n0xFFFFFFF_1; /*0xffd71cc4*/
}
while ( n0xFFFFFFF_1 ); /*0xffd71cc7*/
if ( n0xFFFFFFF_1 && (v13 = (GroupFromPad >> 1) & 3, (*a6 = v13) == 0) ) /*0xffd71cd7*/
{
if ( n5 == 4 || n5 == 6 ) /*0xffd71ce2*/
*a5 = *(_DWORD *)(PadConfig + 212); /*0xffd71cee*/
}
else
{
LABEL_21:
v8 = -2147483641; /*0xffd71cf2*/
}
if ( !(_BYTE)n7 ) /*0xffd71cfc*/
*(_BYTE *)(PadConfig + 225) = 1; /*0xffd71cfe*/
return v8; /*0xffd71d07*/
}
// Function: Assert_27 @ 0xffd71d0f (0x30 bytes)
int __fastcall sub_FFD71D0F(int a1, int a2)
{
__int64 v4; // rax
__int64 v5; // rax
v4 = Assert_22(a2); /*0xffd71d17*/
Assert_19(a1, v4, HIDWORD(v4)); /*0xffd71d20*/
v5 = Assert_22(a2 + 8); /*0xffd71d28*/
Assert_19(a1 + 8, v5, HIDWORD(v5)); /*0xffd71d32*/
return a1; /*0xffd71d3c*/
}
// Function: Assert_26 @ 0xffd71d3f (0x5f bytes)
bool __fastcall sub_FFD71D3F(char *this, int a2)
{
__int64 v4; // rax
int v5; // ebp
__int64 v6; // rax
int v7; // edi
__int64 v8; // kr00_8
__int64 v9; // rax
int v11; // [esp+10h] [ebp-Ch]
int v12; // [esp+14h] [ebp-8h]
v4 = Assert_22(this); /*0xffd71d4a*/
v12 = HIDWORD(v4); /*0xffd71d51*/
v5 = v4; /*0xffd71d55*/
v6 = Assert_22(a2); /*0xffd71d57*/
v11 = HIDWORD(v6); /*0xffd71d5f*/
v7 = v6; /*0xffd71d63*/
v8 = Assert_22(this + 8); /*0xffd71d71*/
v9 = Assert_22(a2 + 8); /*0xffd71d73*/
return v5 == v7 && v12 == v11 && v8 == v9; /*0xffd71d96*/
}
// Function: MemConfig_0 @ 0xffd71d9e (0x53 bytes)
void *__fastcall sub_FFD71D9E(int buf, unsigned int count)
{
int v4; // eax
int v5; // eax
if ( !buf ) /*0xffd71dac*/
{
v4 = DebugAssert(); /*0xffd71dae*/
if ( v4 ) /*0xffd71db5*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd71dbf*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\ZeroMemWrapper.c",
53,
"Buffer != ((void *) 0)");
}
if ( count > -buf ) /*0xffd71dcb*/
{
v5 = DebugAssert(); /*0xffd71dcd*/
if ( v5 ) /*0xffd71dd4*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffd71dde*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\ZeroMemWrapper.c",
54,
"Length <= (0xFFFFFFFF - (UINTN)Buffer + 1)");
}
return MmioZeroMem((void *)buf, count); /*0xffd71ded*/
}
// Function: MemConfig @ 0xffd71df1 (0x71 bytes)
char *__fastcall MemConfig(char *dst, char *src, unsigned int n6948)
{
char *dst_1; // eax
int v6; // eax
int v7; // eax
dst_1 = dst; /*0xffd71df9*/
if ( n6948 ) /*0xffd71e00*/
{
if ( n6948 - 1 > ~(unsigned int)dst ) /*0xffd71e0a*/
{
v6 = DebugAssert(); /*0xffd71e0c*/
if ( v6 ) /*0xffd71e13*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffd71e21*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c",
56,
"(Length - 1) <= (0xFFFFFFFF - (UINTN)DestinationBuffer)");
}
if ( n6948 - 1 > ~(unsigned int)src ) /*0xffd71e2e*/
{
v7 = DebugAssert(); /*0xffd71e30*/
if ( v7 ) /*0xffd71e37*/
(*(void (__cdecl **)(const char *, int, const char *))(v7 + 4))( /*0xffd71e45*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c",
57,
"(Length - 1) <= (0xFFFFFFFF - (UINTN)SourceBuffer)");
}
if ( dst == src ) /*0xffd71e4d*/
return dst; /*0xffd71e4f*/
else
return MmioMemmove(dst, src, n6948); /*0xffd71e56*/
}
return dst_1; /*0xffd71e5e*/
}
// Function: DebugLogPrint_10 @ 0xffd71e62 (0xc9 bytes)
int __cdecl DebugLogPrint_10(int n139264, int a2, unsigned int *p_n4)
{
int v3; // ecx
int v4; // ebx
unsigned int v5; // esi
unsigned int v6; // edi
_DWORD *v8; // ebp
unsigned int v9; // [esp+10h] [ebp-8h] BYREF
unsigned int v10; // [esp+14h] [ebp-4h] BYREF
v4 = v3; /*0xffd71e65*/
v5 = BYTE2(v3); /*0xffd71e6f*/
v6 = (unsigned __int16)v3; /*0xffd71e72*/
if ( !DxeInit_1(v3) )
{
DebugPrintAssert(
0x80000000,
"GPIO ERROR: Incorrect GpioPad define used on this chipset (Group=%d, Pad=%d)!\n",
v5,
v6);
return -2147483645; /*0xffd71e97*/
}
v8 = DebugLogPrint_22(&v9); /*0xffd71ea5*/
if ( v5 >= v9 )
{
DebugPrintAssert(0x80000000, "GPIO ERROR: Group argument (%d) exceeds GPIO group range\n", v5);
return -2147483646; /*0xffd71ec5*/
}
v9 = 60 * v5; /*0xffd71eca*/
if ( v6 >= v8[15 * v5 + 14] )
{
DebugPrintAssert(0x80000000, "GPIO ERROR: Pin number (%d) exceeds possible range for this group\n", v6);
return -2147483646; /*0xffd71eda*/
}
DebugLogPrint_11(v4, &v10); /*0xffd71ee2*/
if ( v10 )
{
DebugPrintAssert(0x80000000, "GPIO ERROR: Accessing pad not owned by host (Group=%d, Pad=%d)!\n", v5, v6);
return -2147483645; /*0xffd71ef5*/
}
*p_n4 = *(_DWORD *)((unsigned __int16)(v8[v9 / 4 + 13] + 8 * v6 + 4) | ((LOBYTE(v8[v9 / 4]) | 0xFFFFFD00) << 16)) /*0xffd71f20*/
& 0x7F;
return 0; /*0xffd71f24*/
}
// Function: DebugLogPrint_25 @ 0xffd71f2b (0xf0 bytes)
int __fastcall DebugLogPrint_25(int n4, void *this, unsigned int a3, int a4, int a5, int a6, _DWORD *a7)
{
int v8; // edi
unsigned __int8 this_1; // bl
_DWORD *v10; // ebp
int v12; // esi
int v13; // esi
int v14; // esi
int v15; // esi
int v16; // eax
unsigned int this_2; // [esp+14h] [ebp-4h] BYREF
LOWORD(v8) = 0; /*0xffd71f39*/
this_1 = (unsigned __int8)this; /*0xffd71f40*/
v10 = DebugLogPrint_22(&this_2); /*0xffd71f43*/
if ( this_1 >= this_2 )
{
DebugPrintAssert(0x80000000, "GPIO ERROR: Group argument (%d) exceeds GPIO group range\n", this_1);
return -2147483646; /*0xffd71f63*/
}
if ( n4 ) /*0xffd71f6a*/
{
v12 = n4 - 1; /*0xffd71f6c*/
if ( v12 ) /*0xffd71f6f*/
{
v13 = v12 - 1; /*0xffd71f71*/
if ( v13 ) /*0xffd71f74*/
{
v14 = v13 - 1; /*0xffd71f76*/
if ( v14 ) /*0xffd71f79*/
{
v15 = v14 - 1; /*0xffd71f7b*/
if ( v15 ) /*0xffd71f7e*/
{
if ( v15 != 1 ) /*0xffd71f83*/
{
v16 = DebugAssert(); /*0xffd71f85*/
if ( v16 ) /*0xffd71f8c*/
(*(void (__cdecl **)(const char *, int, const char *))(v16 + 4))( /*0xffd71f9d*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
218,
"((BOOLEAN)(0==1))");
goto LABEL_19; /*0xffd71fa3*/
}
v8 = v10[15 * this_1 + 12]; /*0xffd71fa8*/
}
else
{
v8 = v10[15 * this_1 + 11]; /*0xffd71fb1*/
}
}
else
{
v8 = v10[15 * this_1 + 10]; /*0xffd71fba*/
}
}
else
{
v8 = v10[15 * this_1 + 8]; /*0xffd71fc3*/
}
}
else
{
v8 = v10[15 * this_1 + 6]; /*0xffd71fcc*/
}
}
else
{
v8 = v10[15 * this_1 + 2]; /*0xffd71fd5*/
}
if ( v8 == -1 ) /*0xffd71fdc*/
return -2147483646; /*0xffd71fdc*/
LABEL_19:
if ( a3 > (unsigned int)(v10[15 * this_1 + 14] - 1) >> 5 ) /*0xffd71fef*/
return -2147483646; /*0xffd71fef*/
*a7 = *(_DWORD *)((unsigned __int16)(v8 + 4 * a3) | ((LOBYTE(v10[15 * this_1]) | 0xFFFFFD00) << 16)); /*0xffd72010*/
return 0; /*0xffd72014*/
}
// Function: AssertCpuDeadLoop_1 @ 0xffd7201b (0x140 bytes)
int __thiscall sub_FFD7201B(char *n4, unsigned __int8 a2, int a3, int a4)
{
unsigned int v5; // ebx
int v6; // edx
int v8; // eax
char *v9; // esi
int v10; // eax
int v11; // ecx
int v12; // eax
int v13; // esi
int v14; // eax
int v15; // [esp-4h] [ebp-24h]
char v16; // [esp+13h] [ebp-Dh] BYREF
int v17; // [esp+14h] [ebp-Ch] BYREF
_DWORD v18[2]; // [esp+18h] [ebp-8h] BYREF
v5 = 0; /*0xffd72028*/
v17 = 0; /*0xffd7202a*/
v6 = DebugLogPrint_22(v18); /*0xffd7203b*/
v18[1] = v6; /*0xffd72040*/
if ( (unsigned int)a2 >= v18[0] )
{
DebugPrintAssert(0x80000000, "GPIO ERROR: Group argument (%d) exceeds GPIO group range\n", a2);
return -2147483646; /*0xffd72062*/
}
if ( n4 == (char *)4 ) /*0xffd7206c*/
{
v5 = *(_DWORD *)(60 * a2 + v6 + 44); /*0xffd720ca*/
}
else
{
if ( n4 != (char *)5 ) /*0xffd72071*/
{
v8 = DebugAssert(); /*0xffd72073*/
if ( v8 ) /*0xffd7207a*/
(*(void (__cdecl **)(const char *, int, const char *))(v8 + 4))( /*0xffd7208b*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
364,
"((BOOLEAN)(0==1))");
goto LABEL_8; /*0xffd7208b*/
}
v5 = *(_DWORD *)(60 * a2 + v6 + 48); /*0xffd720c1*/
}
if ( v5 == -1 ) /*0xffd720d1*/
return -2147483646; /*0xffd720d1*/
LABEL_8:
v9 = n4 - 4; /*0xffd72094*/
if ( v9 ) /*0xffd72097*/
{
if ( v9 != (char *)1 ) /*0xffd7209c*/
{
v10 = DebugAssert(); /*0xffd7209e*/
if ( v10 ) /*0xffd720a5*/
(*(void (__cdecl **)(const char *, int, const char *))(v10 + 4))( /*0xffd720b6*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
442,
"((BOOLEAN)(0==1))");
goto LABEL_19; /*0xffd720bc*/
}
AssertCpuDeadLoop_8(&v17); /*0xffd720dc*/
}
else
{
AssertCpuDeadLoop_7(&v17); /*0xffd720ea*/
}
v11 = v15; /*0xffd720ef*/
LABEL_19:
v18[0] = a4 | v17; /*0xffd720f0*/
v12 = PchSbiExecWrite(v5, v11, v18, &v16); /*0xffd72113*/
v13 = v12; /*0xffd72118*/
if ( v12 < 0 ) /*0xffd7211f*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v12); /*0xffd7212c*/
v14 = DebugAssert(); /*0xffd72134*/
if ( v14 ) /*0xffd7213b*/
(*(void (__cdecl **)(const char *, int, const char *))(v14 + 4))( /*0xffd7214c*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
460,
"!EFI_ERROR (Status)");
}
return v13; /*0xffd72154*/
}
// Function: DebugLogPrint_0 @ 0xffd7215b (0x221 bytes)
int __fastcall DebugLogPrint_0(unsigned int a1, unsigned int *a2)
{
char *v3; // edi
int v4; // eax
int v6; // esi
unsigned __int16 v7; // dx
unsigned int v8; // ebp
int v9; // edi
unsigned int v10; // edx
int v11; // edx
unsigned int v12; // esi
int v13; // eax
char *v14; // [esp+14h] [ebp-18h]
unsigned int v16; // [esp+1Ch] [ebp-10h] BYREF
unsigned int v17; // [esp+20h] [ebp-Ch]
unsigned int v18; // [esp+24h] [ebp-8h]
int v19; // [esp+28h] [ebp-4h] BYREF
v18 = a1; /*0xffd7216c*/
v3 = (char *)DebugLogPrint_22(&v19); /*0xffd72175*/
v14 = v3; /*0xffd7217c*/
v17 = HIWORD(a1); /*0xffd72185*/
if ( !DxeInit_1(a1) )
{
DebugPrintAssert(
0x80000000,
"GPIO ERROR: Incorrect GpioPad define used on this chipset (Group=%d, Pad=%d)!\n",
BYTE2(a1),
(unsigned __int16)a1);
v4 = DebugAssert(); /*0xffd721a9*/
if ( v4 ) /*0xffd721b0*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd721c1*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
501,
"((BOOLEAN)(0==1))");
return -2147483645; /*0xffd721c1*/
}
DebugLogPrint_11(a1, &v16); /*0xffd721d7*/
if ( v16 )
{
DebugPrintAssert(
0x80000000,
"GPIO ERROR: Accessing pad not owned by host (Group=%d, Pad=%d)!\n",
BYTE2(a1),
(unsigned __int16)a1);
return -2147483645; /*0xffd721cc*/
}
if ( v17 - 256 > 0xC )
{
DebugPrintAssert(0x80000000, "GPIO ERROR: Group argument (%d) exceeds GPIO group range\n", BYTE2(a1));
}
else
{
v6 = 60 * BYTE2(a1); /*0xffd7220b*/
v17 = v6; /*0xffd7220e*/
if ( (unsigned int)(unsigned __int16)a1 < *(_DWORD *)&v3[v6 + 56] ) /*0xffd72216*/
{
v7 = *(_DWORD *)&v3[v6 + 52] + 8 * a1; /*0xffd7222b*/
v8 = *(_DWORD *)(v7 | (((unsigned __int8)v3[v6] | 0xFFFFFD00) << 16)); /*0xffd72243*/
v9 = *(_DWORD *)((unsigned __int16)(v7 + 4) | (((unsigned __int8)v3[v6] | 0xFFFFFD00) << 16)); /*0xffd72254*/
v10 = v9 & 0xFF0890A9 | ((v8 & 1 | (16 * (v9 & 0x3C00))) << 6); /*0xffd722dc*/
LOBYTE(v9) = v18; /*0xffd722de*/
v11 = (*(_DWORD *)(*(unsigned __int16 *)&v14[v6 + 8] | (((unsigned __int8)v14[v6] | 0xFFFFFD00) << 16)) >> v18) /*0xffd722ea*/
& 1
| (2 * v10);
v12 = v17; /*0xffd722ec*/
*a2 = (32 * v11) /*0xffd722f5*/
| ((v8 & 0x300
| ((v8 & 0x1E0000
| ((v8 & 0x6000000 | ((v8 & 0xE42A51FF | ((v8 & 0x1C00 | (v8 >> 4) & 0x80000) >> 1)) >> 2)) >> 3)) >> 2)
| 0x844854A3) >> 1);
v13 = *(unsigned __int16 *)&v14[v12 + 48]; /*0xffd72331*/
a2[1] = a2[1] & 0xFFFFFFE9 /*0xffd72336*/
| ((v8 & 0x10000000 | 0x9000000) >> 24)
| (2
* ((*(_DWORD *)(*(unsigned __int16 *)&v14[v12 + 44] | (((unsigned __int8)v14[v12] | 0xFFFFFD00) << 16)) >> v9)
& 1));
a2[1] |= (4 * ((*(_DWORD *)(v13 | (((unsigned __int8)v14[v12] | 0xFFFFFD00) << 16)) >> v9) & 1)) | 1; /*0xffd72355*/
return 0; /*0xffd7235a*/
}
DebugPrintAssert(
0x80000000,
"GPIO ERROR: Pin number (%d) exceeds possible range for this group\n",
(unsigned __int16)a1);
}
return -2147483646; /*0xffd72374*/
}
// Function: DebugLogPrint_11 @ 0xffd7237c (0xc8 bytes)
int __fastcall sub_FFD7237C(int a1, unsigned int *a2)
{
unsigned int v3; // esi
unsigned int v4; // edi
int v5; // eax
int v6; // eax
int v8; // eax
unsigned int v9; // edx
unsigned int v10; // [esp+10h] [ebp-4h] BYREF
v3 = (unsigned __int16)a1; /*0xffd72387*/
v4 = BYTE2(a1); /*0xffd7238f*/
v5 = DebugLogPrint_22(&v10); /*0xffd72392*/
if ( v4 >= v10 )
{
DebugPrintAssert(0x80000000, "GPIO ERROR: Group argument (%d) exceeds GPIO group range\n", v4);
v6 = DebugAssert(); /*0xffd723b2*/
if ( v6 ) /*0xffd723b9*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffd723ca*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
1389,
"((BOOLEAN)(0==1))");
return -2147483646; /*0xffd723d5*/
}
if ( v3 >= *(_DWORD *)(60 * v4 + v5 + 56) )
{
DebugPrintAssert(0x80000000, "GPIO ERROR: Pin number (%d) exceeds possible range for this group\n", v3);
v8 = DebugAssert(); /*0xffd723f3*/
if ( v8 ) /*0xffd723fa*/
(*(void (__cdecl **)(const char *, int, const char *))(v8 + 4))( /*0xffd72406*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
1398,
"((BOOLEAN)(0==1))");
return -2147483646; /*0xffd72406*/
}
v9 = (*(_DWORD *)((unsigned __int16)(*(_DWORD *)(60 * v4 + v5 + 4) + 4 * (v3 >> 3)) /*0xffd72437*/
| ((*(unsigned __int8 *)(60 * v4 + v5) | 0xFFFFFD00) << 16))
& (unsigned int)(3 << (4 * (v3 & 7)))) >> (4 * (v3 & 7));
*a2 = v9; /*0xffd7243b*/
return 0; /*0xffd7243e*/
}
// Function: AssertCpuDeadLoop_7 @ 0xffd72444 (0x53 bytes)
int __fastcall AssertCpuDeadLoop_7(void *this, unsigned int a2, _DWORD *a3)
{
int v3; // eax
int v4; // esi
int v5; // eax
int v7; // [esp-10h] [ebp-18h]
int v8; // [esp-Ch] [ebp-14h]
int v9; // [esp-8h] [ebp-10h]
v3 = DebugLogPrint_25(4, this, a2, v7, v8, v9, a3); /*0xffd72453*/
v4 = v3; /*0xffd72458*/
if ( v3 < 0 ) /*0xffd7245f*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v3); /*0xffd7246c*/
v5 = DebugAssert(); /*0xffd72474*/
if ( v5 ) /*0xffd7247b*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffd7248c*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
1451,
"!EFI_ERROR (Status)");
}
return v4; /*0xffd72494*/
}
// Function: AssertCpuDeadLoop_8 @ 0xffd72497 (0x53 bytes)
int __fastcall AssertCpuDeadLoop_8(void *this, unsigned int a2, _DWORD *a3)
{
int v3; // eax
int v4; // esi
int v5; // eax
int v7; // [esp-10h] [ebp-18h]
int v8; // [esp-Ch] [ebp-14h]
int v9; // [esp-8h] [ebp-10h]
v3 = DebugLogPrint_25(5, this, a2, v7, v8, v9, a3); /*0xffd724a6*/
v4 = v3; /*0xffd724ab*/
if ( v3 < 0 ) /*0xffd724b2*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v3); /*0xffd724bf*/
v5 = DebugAssert(); /*0xffd724c7*/
if ( v5 ) /*0xffd724ce*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffd724df*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
1517,
"!EFI_ERROR (Status)");
}
return v4; /*0xffd724e7*/
}
// Function: GpioTableBitRead @ 0xffd724ea (0x34 bytes)
int __fastcall GpioTableBitRead(int a1, char a2)
{
int v4; // eax
int v6; // [esp+8h] [ebp-4h] BYREF
v4 = DebugLogPrint_22(&v6); /*0xffd724f5*/
return (*(_DWORD *)(*(unsigned __int16 *)(60 * a1 + v4 + 44) /*0xffd72513*/
| ((*(unsigned __int8 *)(60 * a1 + v4) | 0xFFFFFD00) << 16)) >> a2)
& 1;
}
// Function: AssertCpuDeadLoop_0 @ 0xffd7251e (0x1ba bytes)
int __fastcall AssertCpuDeadLoop_0(unsigned int a1, int a2)
{
int v3; // esi
unsigned int v4; // ebp
int v5; // ecx
unsigned __int8 v6; // bl
unsigned int n0xD; // ecx
unsigned int n0x100; // eax
unsigned int v9; // edx
int v10; // eax
int v11; // edx
int v12; // eax
int v13; // eax
int v14; // eax
int v15; // eax
int v16; // eax
int v17; // eax
unsigned int v19; // [esp+10h] [ebp-80h] BYREF
int v20; // [esp+14h] [ebp-7Ch]
unsigned int n0xD_1; // [esp+18h] [ebp-78h]
unsigned int v22; // [esp+1Ch] [ebp-74h]
int n13; // [esp+20h] [ebp-70h]
_DWORD *v24; // [esp+24h] [ebp-6Ch] BYREF
_BYTE buf[52]; // [esp+28h] [ebp-68h] BYREF
_BYTE buf_1[52]; // [esp+5Ch] [ebp-34h] BYREF
v22 = a1; /*0xffd7252a*/
PchGpioInit(); /*0xffd7252e*/
v3 = 0; /*0xffd72535*/
v19 = 0; /*0xffd7253c*/
MemConfig_0((int)buf, 0x34u); /*0xffd72540*/
MemConfig_0((int)buf_1, 0x34u); /*0xffd7254c*/
v4 = 0; /*0xffd7255a*/
v24 = DebugLogPrint_22(&v24); /*0xffd7255c*/
v6 = 0; /*0xffd72560*/
n13 = 13; /*0xffd72565*/
if ( v22 ) /*0xffd72571*/
{
while ( 1 ) /*0xffd7257b*/
{
n0xD = *(unsigned __int8 *)(a2 + 2); /*0xffd7257b*/
n0x100 = HIWORD(*(_DWORD *)a2); /*0xffd7257f*/
v9 = (unsigned __int16)*(_DWORD *)a2; /*0xffd72582*/
n0xD_1 = n0xD; /*0xffd72585*/
v20 = v9; /*0xffd72589*/
if ( n0xD < 0xD ) /*0xffd72590*/
{
if ( n0x100 < 0x100 || n0x100 >= 0x10D || v9 >= v24[15 * n0xD + 14] ) /*0xffd725d0*/
return -2147483646; /*0xffd726d1*/
DebugLogPrint_11(*(_DWORD *)a2, &v19); /*0xffd725dc*/
if ( !v19 ) /*0xffd725e5*/
{
v11 = (*(_DWORD *)(a2 + 8) >> 2) & 1; /*0xffd725fa*/
*(_DWORD *)&buf[4 * n0xD_1] |= ((*(_DWORD *)(a2 + 8) >> 1) & 1) << v20; /*0xffd72601*/
v5 = v20; /*0xffd72609*/
*(_DWORD *)&buf_1[4 * n0xD_1] |= v11 << v20; /*0xffd7260f*/
}
}
else
{
v10 = DebugAssert(); /*0xffd72592*/
if ( v10 ) /*0xffd72599*/
(*(void (__cdecl **)(const char *, int, const char *))(v10 + 4))( /*0xffd725aa*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
2642,
"((BOOLEAN)(0==1))");
}
++v4; /*0xffd72613*/
a2 += 16; /*0xffd72614*/
if ( v4 >= v22 ) /*0xffd7261b*/
goto LABEL_11; /*0xffd7261b*/
}
}
do /*0xffd726be*/
{
LABEL_11:
v12 = *(_DWORD *)&buf[v3]; /*0xffd7262b*/
if ( v12 ) /*0xffd72631*/
{
v13 = AssertCpuDeadLoop_1((char *)4, v6, v5, v12); /*0xffd7263b*/
if ( v13 < 0 ) /*0xffd72645*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v13); /*0xffd7264e*/
v14 = DebugAssert(); /*0xffd72656*/
if ( v14 ) /*0xffd7265d*/
(*(void (__cdecl **)(const char *, int, const char *))(v14 + 4))( /*0xffd7266a*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
1648,
"!EFI_ERROR (Status)");
}
}
v15 = *(_DWORD *)&buf_1[v3]; /*0xffd72670*/
if ( v15 ) /*0xffd72676*/
{
v16 = AssertCpuDeadLoop_1((char *)5, v6, v5, v15); /*0xffd72680*/
if ( v16 < 0 ) /*0xffd7268a*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v16); /*0xffd72693*/
v17 = DebugAssert(); /*0xffd7269b*/
if ( v17 ) /*0xffd726a2*/
(*(void (__cdecl **)(const char *, int, const char *))(v17 + 4))( /*0xffd726af*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
1776,
"!EFI_ERROR (Status)");
}
}
v3 += 4; /*0xffd726b5*/
++v6; /*0xffd726b8*/
--n13; /*0xffd726b9*/
}
while ( n13 ); /*0xffd726be*/
return 0; /*0xffd726c6*/
}
// Function: ConfigureXhci @ 0xffd726d8 (0x59 bytes)
int ConfigureXhci()
{
_WORD *v0; // eax
_WORD *v1; // esi
int v3; // eax
v0 = AssertCpuDeadLoop_9(byte_FFD7ACE4); /*0xffd726de*/
v1 = v0; /*0xffd726e3*/
if ( !v0 ) /*0xffd726e7*/
return -2147483634; /*0xffd726e9*/
if ( ((*((_BYTE *)v0 + 2) - 8) & 0xF) != 0 ) /*0xffd726f7*/
{
v3 = DebugAssert(); /*0xffd726f9*/
if ( v3 ) /*0xffd72700*/
(*(void (**)(const char *, int, const char *, ...))(v3 + 4))( /*0xffd72711*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioLib.c",
2720,
"(UINT16)(((*(EFI_HOB_GENERIC_HEADER **)&(GpioConfigHob))->HobLength) - sizeof (EFI_HOB_GUID_TYPE)) % sizeof (Gpi"
"oConfig[0]) == 0");
}
AssertCpuDeadLoop_0((unsigned __int16)(v1[1] - 24) >> 4, (int)(v1 + 12)); /*0xffd72728*/
return 0; /*0xffd726ee*/
}
// Function: DebugLogPrint_5 @ 0xffd72731 (0x103 bytes)
int __fastcall sub_FFD72731(int a1, char a2)
{
int v4; // eax
_DWORD *v6; // edx
unsigned int v7; // [esp+10h] [ebp-Ch] BYREF
int v8; // [esp+14h] [ebp-8h]
int v9; // [esp+18h] [ebp-4h] BYREF
v8 = DebugLogPrint_22(&v9); /*0xffd72745*/
if ( !(unsigned __int8)DxeInit_1(a1) )
{
DebugPrintAssert(
0x80000000,
"GPIO ERROR: Incorrect GpioPad define used on this chipset (Group=%d, Pad=%d)!\n",
BYTE2(a1),
(unsigned __int16)a1);
v4 = DebugAssert(); /*0xffd72773*/
if ( v4 ) /*0xffd7277a*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd72788*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioNativeLib.c",
67,
"((BOOLEAN)(0==1))");
return -2147483645; /*0xffd72788*/
}
DebugLogPrint_11(a1, &v7); /*0xffd7279e*/
if ( v7 )
{
DebugPrintAssert(
0x80000000,
"GPIO ERROR: Accessing pad not owned by host (Group=%d, Pad=%d)!\n",
BYTE2(a1),
(unsigned __int16)a1);
return -2147483645; /*0xffd72793*/
}
if ( (unsigned __int8)GpioTableBitRead(BYTE2(a1), a1) )
{
DebugPrintAssert(0x80000000, "GPIO ERROR: Pad is locked (Group=%d, Pad=%d)!\n", BYTE2(a1), (unsigned __int16)a1);
return -2147483640; /*0xffd727e1*/
}
else
{
v6 = (_DWORD *)(((*(unsigned __int8 *)(60 * BYTE2(a1) + v8) | 0xFFFFFD00) << 16) /*0xffd72808*/
| (unsigned __int16)(*(_WORD *)(60 * BYTE2(a1) + v8 + 52) + 8 * a1));
*v6 = ((a2 & 0xE) << 9) | *v6 & ~((a2 & 0xF) != 0 ? 0x1C00 : 0);
return 0; /*0xffd7282a*/
}
}
// Function: DebugLogPrint_9 @ 0xffd72834 (0xcc bytes)
int __fastcall sub_FFD72834(int a1, unsigned int *a2)
{
int v3; // ebp
int v4; // eax
unsigned int v6; // [esp+10h] [ebp-Ch] BYREF
unsigned int *v7; // [esp+14h] [ebp-8h]
int v8; // [esp+18h] [ebp-4h] BYREF
v7 = a2; /*0xffd7283c*/
v3 = DebugLogPrint_22(&v8); /*0xffd7284a*/
if ( !(unsigned __int8)DxeInit_1(a1) )
{
DebugPrintAssert(
0x80000000,
"GPIO ERROR: Incorrect GpioPad define used on this chipset (Group=%d, Pad=%d)!\n",
BYTE2(a1),
(unsigned __int16)a1);
v4 = DebugAssert(); /*0xffd72876*/
if ( v4 ) /*0xffd7287d*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd7288e*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmGpioLib\\GpioNativeLib.c",
132,
"((BOOLEAN)(0==1))");
return -2147483645; /*0xffd7288e*/
}
DebugLogPrint_11(a1, &v6); /*0xffd728a1*/
if ( v6 )
{
DebugPrintAssert(
0x80000000,
"GPIO ERROR: Accessing pad not owned by host (Group=%d, Pad=%d)!\n",
BYTE2(a1),
(unsigned __int16)a1);
return -2147483645; /*0xffd72899*/
}
*v7 = (*(_DWORD *)(((*(unsigned __int8 *)(60 * BYTE2(a1) + v3) | 0xFFFFFD00) << 16) /*0xffd728f4*/
| (unsigned __int16)(*(_WORD *)(60 * BYTE2(a1) + v3 + 52) + 8 * a1))
& 0x1C00
| 0x200u) >> 9;
return 0; /*0xffd728f8*/
}
// Function: DebugLogPrint_22 @ 0xffd72900 (0x21 bytes)
void *__thiscall sub_FFD72900(_DWORD *this)
{
if ( DebugLogPrint_13() == 1 ) /*0xffd7290b*/
{
*this = 13; /*0xffd7290d*/
return &unk_FFD7E944; /*0xffd72913*/
}
else
{
*this = 0; /*0xffd7291a*/
return 0; /*0xffd7291d*/
}
}
// Function: DxeInit_1 @ 0xffd72921 (0x36 bytes)
bool __fastcall DxeInit_1(int a1)
{
int n2; // eax
n2 = PchGpioInit(); /*0xffd72924*/
if ( n2 == 1 ) /*0xffd7292c*/
return (a1 & 0xFF000000) == 0x1000000; /*0xffd72934*/
if ( n2 != 2 ) /*0xffd72943*/
return 0; /*0xffd72943*/
return (a1 & 0xFF000000) == 0x2000000; /*0xffd7293e*/
}
// Function: PchIsType4 @ 0xffd72957 (0x10 bytes)
bool PchIsType4()
{
return PciGetInfo(0xFCu) == 4; /*0xffd72966*/
}
// Function: GpioIsPadValid @ 0xffd72967 (0x2b bytes)
int __fastcall GpioIsPadValid(int PadConfig, bool *p_n7)
{
bool v4; // al
v4 = (unsigned __int16)GpioGetGroupFromPad((unsigned __int16 *)PadConfig) != 0xFFFF; /*0xffd7297a*/
if ( p_n7 ) /*0xffd7297f*/
*p_n7 = v4; /*0xffd72981*/
if ( !v4 ) /*0xffd72985*/
*(_BYTE *)(PadConfig + 225) = 0; /*0xffd72987*/
return 0; /*0xffd7298d*/
}
// Function: DebugLogPrint_14 @ 0xffd72992 (0xa2 bytes)
int __fastcall sub_FFD72992(unsigned __int8 a1, unsigned __int16 a2, int a3, _BYTE *a4)
{
int v4; // eax
if ( ((a3 - 1) & a2) != 0 )
{
DebugPrintAssert(0x80000000, "PchPcrRead error. Invalid Offset: %x Size: %x", a2, a3);
v4 = DebugAssert(); /*0xffd729b5*/
if ( v4 ) /*0xffd729bc*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd729ca*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchPcrLib\\PchPcrLib.c",
57,
"((BOOLEAN)(0==1))");
return -2147483646; /*0xffd729d0*/
}
else
{
switch ( a3 ) /*0xffd729da*/
{
case 1: /*0xffd729da*/
*a4 = *(_BYTE *)(a2 | ((a1 | 0xFFFFFD00) << 16)); /*0xffd72a2e*/
break;
case 2: /*0xffd729da*/
*(_WORD *)a4 = GpioGetGroupFromPad((unsigned __int16 *)(a2 | ((a1 | 0xFFFFFD00) << 16))); /*0xffd72a16*/
break;
case 4: /*0xffd729da*/
*(_DWORD *)a4 = *(_DWORD *)(a2 | ((a1 | 0xFFFFFD00) << 16)); /*0xffd729fb*/
break;
}
return 0; /*0xffd72a30*/
}
}
// Function: DxeInit_0 @ 0xffd72a34 (0x155 bytes)
char __fastcall DxeInit_0(int n144, __int16 n160)
{
int n2; // eax
bool v5; // zf
bool v7; // zf
n2 = PchGpioInit(); /*0xffd72a3c*/
if ( n144 != 175 ) /*0xffd72a4a*/
{
switch ( n144 ) /*0xffd72aa2*/
{
case 174: /*0xffd72aa2*/
if ( n2 == 2 && (n160 == 160 || n160 == 164 || n160 == 168 || n160 == 172 || n160 == 176 || n160 == 180) ) /*0xffd72ad7*/
return 0; /*0xffd72ad7*/
if ( n2 != 1 ) /*0xffd72adb*/
return 1; /*0xffd72adb*/
if ( n160 == 96 || n160 == 100 || n160 == 104 || n160 == 108 || n160 == 112 ) /*0xffd72afd*/
return 0; /*0xffd72afd*/
v5 = n160 == 116; /*0xffd72aff*/
return !v5; /*0xffd72b03*/
case 173: /*0xffd72aa2*/
if ( n2 == 2 ) /*0xffd72b10*/
{
if ( n160 == 160 ) /*0xffd72b18*/
return 0; /*0xffd72b18*/
v7 = n160 == 164; /*0xffd72b21*/
goto LABEL_33; /*0xffd72b21*/
}
break;
case 172: /*0xffd72aa2*/
if ( n2 == 2 ) /*0xffd72b4d*/
{
if ( n160 == 160 || n160 == 164 || n160 == 168 ) /*0xffd72b6d*/
return 0; /*0xffd72b6d*/
v7 = n160 == 172; /*0xffd72b73*/
LABEL_33:
if ( v7 ) /*0xffd72b24*/
return 0; /*0xffd72b24*/
}
break;
default:
v5 = n144 == 144; /*0xffd72b78*/
return !v5; /*0xffd72b7e*/
}
if ( n2 != 1 ) /*0xffd72b2c*/
return 1; /*0xffd72b2c*/
if ( n160 == 96 ) /*0xffd72b32*/
return 0; /*0xffd72b32*/
v5 = n160 == 100; /*0xffd72b38*/
return !v5; /*0xffd72b3c*/
}
if ( n2 == 2 && (n160 == 160 || n160 == 164 || n160 == 168 || n160 == 172) ) /*0xffd72a6f*/
return 0; /*0xffd72a6f*/
if ( n2 != 1 ) /*0xffd72a73*/
return 1; /*0xffd72a73*/
if ( n160 == 96 || n160 == 100 || n160 == 104 ) /*0xffd72a89*/
return 0; /*0xffd72a89*/
v5 = n160 == 108; /*0xffd72a8b*/
return !v5; /*0xffd72a8f*/
}
// Function: PchInterruptConfigEntry @ 0xffd72b89 (0xe1 bytes)
int __fastcall PchInterruptConfigEntry(int n144, __int16 n160, int a3, int a4)
{
int n160_1; // edi
int v6; // eax
int v8; // eax
n160_1 = (unsigned __int16)n160; /*0xffd72b92*/
if ( ((a3 - 1) & (unsigned __int16)n160) != 0 )
{
DebugPrintAssert(0x80000000, "PchPcrWrite error. Invalid Offset: %x Size: %x", (unsigned __int16)n160, a3);
v6 = DebugAssert(); /*0xffd72bb0*/
if ( v6 ) /*0xffd72bb7*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffd72bc8*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchPcrLib\\PchPcrLib.c",
267,
"((BOOLEAN)(0==1))");
return -2147483646; /*0xffd72bd3*/
}
if ( !DxeInit_0(n144, n160) )
{
DebugPrintAssert(
0x80000000,
"PchPcrWrite error. Pid: %x Offset: %x should access through SBI interface",
n144,
n160_1);
v8 = DebugAssert(); /*0xffd72bf5*/
if ( v8 ) /*0xffd72bfc*/
(*(void (__cdecl **)(const char *, int, const char *))(v8 + 4))( /*0xffd72c08*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchPcrLib\\PchPcrLib.c",
273,
"((BOOLEAN)(0==1))");
return -2147483646; /*0xffd72c08*/
}
switch ( a3 ) /*0xffd72c0d*/
{
case 1: /*0xffd72c0d*/
*(_BYTE *)(n160_1 | (((unsigned __int8)n144 | 0xFFFFFD00) << 16)) = a4; /*0xffd72c5b*/
break;
case 2: /*0xffd72c0d*/
GpioGetGroupIndexFromPad((_WORD *)(n160_1 | (((unsigned __int8)n144 | 0xFFFFFD00) << 16)), a4); /*0xffd72c42*/
break;
case 4: /*0xffd72c0d*/
*(_DWORD *)(n160_1 | (((unsigned __int8)n144 | 0xFFFFFD00) << 16)) = a4; /*0xffd72c2c*/
break;
}
return 0; /*0xffd72c66*/
}
// Function: AssertEfiError @ 0xffd72c6a (0x3d bytes)
int __fastcall AssertEfiError(int n144, unsigned __int16 n160, int a3, int a4)
{
int result; // eax
int v7; // [esp+Ch] [ebp-4h] BYREF
v7 = 0; /*0xffd72c6f*/
result = DebugLogPrint_14(n144, n160, 4, &v7); /*0xffd72c7f*/
if ( result >= 0 ) /*0xffd72c88*/
return PchInterruptConfigEntry(n144, n160, 4, a4 | a3 & v7); /*0xffd72c9a*/
return result; /*0xffd72ca1*/
}
// Function: DebugLogPrint_21 @ 0xffd72ca7 (0x40 bytes)
int __fastcall sub_FFD72CA7(int n196, __int16 n12796, __int16 n65023, __int16 n512)
{
int result; // eax
int v7; // [esp+Ch] [ebp-4h] BYREF
v7 = 0; /*0xffd72cac*/
result = DebugLogPrint_14(n196, n12796, 2, &v7); /*0xffd72cbc*/
if ( result >= 0 ) /*0xffd72cc5*/
return PchInterruptConfigEntry(n196, n12796, 2, (unsigned __int16)(n512 | n65023 & v7)); /*0xffd72cda*/
return result; /*0xffd72ce1*/
}
// Function: PchInterruptCheck @ 0xffd72ce7 (0x3f bytes)
int __usercall PchInterruptCheck@<eax>(unsigned __int16 n8756@<dx>, char n255, char n31)
{
int result; // eax
char v5; // [esp+7h] [ebp-1h] BYREF
result = DebugLogPrint_14(0xEFu, n8756, 1, &v5); /*0xffd72cf9*/
if ( result >= 0 ) /*0xffd72d02*/
return PchInterruptConfigEntry(239, n8756, 1, (unsigned __int8)(n31 | n255 & v5)); /*0xffd72d1a*/
return result; /*0xffd72d21*/
}
// Function: GpioLockGpios @ 0xffd72d26 (0x28e bytes)
int GpioLockGpios()
{
int n35; // eax
int PadConfig; // eax
char n9; // bl
unsigned __int16 GroupFromPad; // cx
int v4; // eax
double v5; // [esp-4h] [ebp-10h]
int n35_1; // [esp-4h] [ebp-10h]
n35 = n35; /*0xffd72d26*/
if ( n35 == 54 ) /*0xffd72d33*/
{
PadConfig = GpioGetPadConfig(0, 31, 0); /*0xffd72d41*/
n9 = *(_BYTE *)(PadConfig + 8); /*0xffd72d47*/
GroupFromPad = GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 2)); /*0xffd72d52*/
if ( GroupFromPad != 0xA142 /*0xffd72e15*/
&& GroupFromPad != 0xA143
&& GroupFromPad != 0xA144
&& GroupFromPad != 0xA145
&& GroupFromPad != 0xA146
&& GroupFromPad != 0xA147
&& GroupFromPad != 0xA148
&& GroupFromPad != 0xA140
&& GroupFromPad != 0xA141
&& GroupFromPad != 0xA14D
&& GroupFromPad != 0xA14E
&& GroupFromPad != 0xA14F
&& GroupFromPad != 0xA149
&& GroupFromPad != 0xA14A
&& GroupFromPad != 0xA150
&& GroupFromPad != 0xA14B )
{
if ( GroupFromPad != 0x9D40 /*0xffd72e5f*/
&& GroupFromPad != 0x9D41
&& GroupFromPad != 0x9D42
&& GroupFromPad != 0x9D43
&& GroupFromPad != 0x9D46
&& GroupFromPad != 0x9D48 )
{
if ( (GroupFromPad < 0xA1C0u || GroupFromPad > 0xA1CFu) /*0xffd72ea5*/
&& GroupFromPad != 0xA243
&& (GroupFromPad < 0xA240u || GroupFromPad > 0xA24Fu) )
{
return 54; /*0xffd72ea5*/
}
if ( PchIsType4() && !n9 || !n9 ) /*0xffd72ec5*/
return 48; /*0xffd72eb8*/
switch ( n9 ) /*0xffd72ecb*/
{
case 2: /*0xffd72ecb*/
return 49; /*0xffd72f29*/
case 3: /*0xffd72ecb*/
return 50; /*0xffd72f25*/
case 4: /*0xffd72ecb*/
return 51; /*0xffd72f21*/
case 8: /*0xffd72ecb*/
return 52; /*0xffd72f1d*/
}
if ( n9 != 9 ) /*0xffd72edf*/
{
DebugPrintAssert( /*0xffd72ef0*/
0x80000000,
"Unsupported PCH Stepping. Supporting PCH stepping starting from %s and above\n",
"LbgA0");
v4 = DebugAssert(); /*0xffd72ef8*/
if ( v4 ) /*0xffd72eff*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd72f14*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchInfoLib\\PchInfoLib.c",
167,
"((BOOLEAN)(0==1))");
return 54; /*0xffd72f17*/
}
return 53; /*0xffd72ebb*/
}
switch ( n9 ) /*0xffd72f33*/
{
case 16: /*0xffd72f33*/
n35_1 = 35; /*0xffd72f57*/
break;
case 17: /*0xffd72f33*/
n35_1 = 36; /*0xffd72f53*/
break;
case 32: /*0xffd72f33*/
n35_1 = 37; /*0xffd72f4f*/
break;
case 33: /*0xffd72f33*/
n35_1 = 38; /*0xffd72f4b*/
break;
default:
LODWORD(v5) = "PchLpB0"; /*0xffd72f44*/
LABEL_61:
DebugPrintAssert( /*0xffd72f7b*/
0x80000000,
"Unsupported PCH Stepping. Supporting PCH stepping starting from %a and above\n",
v5);
return 54; /*0xffd72f8f*/
}
goto LABEL_66; /*0xffd72f4d*/
}
if ( n9 ) /*0xffd72f60*/
{
switch ( n9 ) /*0xffd72f65*/
{
case 16: /*0xffd72f65*/
n35 = 1; /*0xffd72fa0*/
goto LABEL_68; /*0xffd72fa0*/
case 32: /*0xffd72f65*/
n35_1 = 2; /*0xffd72f99*/
break;
case 48: /*0xffd72f65*/
n35_1 = 3; /*0xffd72f95*/
break;
case 49: /*0xffd72f65*/
n35_1 = 4; /*0xffd72f91*/
break;
default:
LODWORD(v5) = "PchHA0"; /*0xffd72f76*/
goto LABEL_61; /*0xffd72f76*/
}
LABEL_66:
n35 = n35_1; /*0xffd72f9b*/
LABEL_68:
n35 = n35; /*0xffd72fa1*/
return n35; /*0xffd72fa6*/
}
n35 = 0; /*0xffd72fa8*/
return 0; /*0xffd72fae*/
}
return n35; /*0xffd72fb0*/
}
// Function: PchGpioInit @ 0xffd72fb4 (0xec bytes)
int PchGpioInit()
{
int n3; // eax
int n3_1; // esi
int PadConfig; // eax
unsigned __int16 GroupFromPad; // ax
int v4; // eax
n3 = n3; /*0xffd72fb4*/
n3_1 = 3; /*0xffd72fbc*/
if ( n3 == 3 )
{
PadConfig = GpioGetPadConfig(0, 31, 0); /*0xffd72fcc*/
GroupFromPad = GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 2)); /*0xffd72fda*/
if ( GroupFromPad >= 0xA1C0u && GroupFromPad <= 0xA1CFu
|| GroupFromPad == 0xA243
|| GroupFromPad >= 0xA240u && GroupFromPad <= 0xA24Fu )
{
n3_1 = 1; /*0xffd73095*/
}
else if ( GroupFromPad == 0x9D40
|| GroupFromPad == 0x9D41
|| GroupFromPad == 0x9D42
|| GroupFromPad == 0x9D43
|| GroupFromPad == 0x9D46
|| GroupFromPad == 0x9D48 )
{
n3_1 = 2; /*0xffd73090*/
}
else
{
DebugPrintAssert(0x80000000, "Unsupported PCH SKU, LpcDeviceId: 0x%04x!\n", GroupFromPad);
v4 = DebugAssert(); /*0xffd7306e*/
if ( v4 ) /*0xffd73075*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd73086*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchInfoLib\\PchInfoLib.c",
252,
"((BOOLEAN)(0==1))");
}
n3 = n3_1; /*0xffd73096*/
return n3_1; /*0xffd7309c*/
}
return n3; /*0xffd7309e*/
}
// Function: DebugLogPrint_13 @ 0xffd730a0 (0xa9 bytes)
int DebugLogPrint_13()
{
int n2; // eax
int n2_1; // esi
int PadConfig; // eax
unsigned __int16 GroupFromPad; // ax
int v4; // eax
n2 = n2; /*0xffd730a0*/
n2_1 = 2; /*0xffd730a8*/
if ( n2 == 2 )
{
PadConfig = GpioGetPadConfig(0, 31, 0); /*0xffd730b8*/
GroupFromPad = GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 2)); /*0xffd730c6*/
if ( GroupFromPad >= 0xA1C0u && GroupFromPad <= 0xA1CFu
|| GroupFromPad == 0xA243
|| GroupFromPad >= 0xA240u && GroupFromPad <= 0xA24Fu )
{
n2_1 = 1; /*0xffd7313e*/
}
else
{
DebugPrintAssert(0x80000000, "Unsupported PCH SKU, LpcDeviceId: 0x%04x!\n", GroupFromPad);
v4 = DebugAssert(); /*0xffd7311c*/
if ( v4 ) /*0xffd73123*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd73134*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchInfoLib\\PchInfoLib.c",
290,
"((BOOLEAN)(0==1))");
}
n2 = n2_1; /*0xffd7313f*/
return n2_1; /*0xffd73145*/
}
return n2; /*0xffd73147*/
}
// Function: PchPcieRootPortCount @ 0xffd73149 (0x1c bytes)
char PchPcieRootPortCount()
{
int v0; // eax
v0 = PchGpioInit() - 1; /*0xffd7314f*/
if ( !v0 ) /*0xffd73152*/
return 20; /*0xffd73161*/
if ( v0 == 1 ) /*0xffd73157*/
return 12; /*0xffd7315d*/
return 0; /*0xffd7315c*/
}
// Function: PchGetNumUsbPorts @ 0xffd73165 (0x1c bytes)
char PchGetNumUsbPorts()
{
int v0; // eax
v0 = PchGpioInit() - 1; /*0xffd7316b*/
if ( !v0 ) /*0xffd7316e*/
return 8; /*0xffd7317d*/
if ( v0 == 1 ) /*0xffd73173*/
return 3; /*0xffd73179*/
return 0; /*0xffd73178*/
}
// Function: GpioReadGroupCached @ 0xffd73181 (0x2d bytes)
int GpioReadGroupCached()
{
int n3; // eax
int PadConfig; // eax
n3 = n3; /*0xffd73181*/
if ( n3 == 3 ) /*0xffd73189*/
{
PadConfig = ::PadConfig; /*0xffd7318b*/
if ( !::PadConfig ) /*0xffd73192*/
{
PadConfig = GpioGetPadConfig(0, 31, 0); /*0xffd7319a*/
::PadConfig = PadConfig; /*0xffd731a0*/
}
return GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 2)); /*0xffd731a8*/
}
return n3; /*0xffd731ad*/
}
// Function: DebugLogPrint_15 @ 0xffd731ae (0x9b bytes)
int __thiscall sub_FFD731AE(_WORD *this)
{
int v2; // eax
unsigned __int16 *PadConfig; // edi
int v5; // eax
if ( this ) /*0xffd731b3*/
{
PadConfig = (unsigned __int16 *)GpioGetPadConfig(0, 31, 2); /*0xffd731f9*/
if ( (unsigned __int16)GpioGetGroupFromPad(PadConfig) == 0xFFFF ) /*0xffd7320a*/
{
v5 = DebugAssert(); /*0xffd7320c*/
if ( v5 ) /*0xffd73213*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffd73224*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchCycleDecodingLib\\PchCycleDecodingLib.c",
164,
"((BOOLEAN)(0==1))");
return -2147483645; /*0xffd7322a*/
}
else
{
*this = GpioGetGroupFromPad(PadConfig + 32) & 0xFFFC; /*0xffd73241*/
return 0; /*0xffd73244*/
}
}
else
{
DebugPrintAssert(0x80000000, "PchAcpiBaseGet Error. Invalid pointer.\n"); /*0xffd731bf*/
v2 = DebugAssert(); /*0xffd731c6*/
if ( v2 ) /*0xffd731cd*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd731de*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchCycleDecodingLib\\PchCycleDecodingLib.c",
154,
"((BOOLEAN)(0==1))");
return -2147483646; /*0xffd731e4*/
}
}
// Function: ConfigureAudioPll @ 0xffd73249 (0x92 bytes)
int __thiscall ConfigureAudioPll(unsigned int *this)
{
int v2; // eax
int v4; // edi
int v5; // eax
if ( this ) /*0xffd7324f*/
{
v4 = GpioGetPadConfig(0, 31, 2); /*0xffd73294*/
if ( (unsigned __int16)GpioGetGroupFromPad((unsigned __int16 *)v4) == 0xFFFF ) /*0xffd732a5*/
{
v5 = DebugAssert(); /*0xffd732a7*/
if ( v5 ) /*0xffd732ae*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffd732bf*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchCycleDecodingLib\\PchCycleDecodingLib.c",
303,
"((BOOLEAN)(0==1))");
return -2147483645; /*0xffd732c5*/
}
else
{
*this = *(_DWORD *)(v4 + 72) & 0xFFFF0000; /*0xffd732d4*/
return 0; /*0xffd732d6*/
}
}
else
{
DebugPrintAssert(0x80000000, "PchPwrmBaseGet Error. Invalid pointer.\n"); /*0xffd7325b*/
v2 = DebugAssert(); /*0xffd73262*/
if ( v2 ) /*0xffd73269*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd7327a*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchCycleDecodingLib\\PchCycleDecodingLib.c",
293,
"((BOOLEAN)(0==1))");
return -2147483646; /*0xffd73280*/
}
}
// Function: GpioGetPadConfig @ 0xffd732db (0x56 bytes)
int __fastcall GpioGetPadConfig(unsigned __int8 a1, char a2, char a3)
{
int v4; // [esp+4h] [ebp-14h] BYREF
_DWORD v5[4]; // [esp+8h] [ebp-10h] BYREF
v5[2] = 512; /*0xffd732f5*/
v5[3] = 0; /*0xffd73311*/
v5[1] = 0; /*0xffd73318*/
v5[0] = (a3 & 7 | (8 * (a2 & 0x1F | (32 * a1)))) << 12; /*0xffd7331c*/
SpiCalcAddress(0, 0, v5, &v4); /*0xffd73320*/
return v4; /*0xffd7332c*/
}
// Function: SpiReadRegister @ 0xffd73331 (0x3f bytes)
int SpiReadRegister()
{
int v1; // [esp+4h] [ebp-14h] BYREF
_DWORD v2[4]; // [esp+8h] [ebp-10h] BYREF
v2[2] = 512; /*0xffd7333e*/
v2[0] = 270524; /*0xffd73349*/
v2[3] = 0; /*0xffd73355*/
v2[1] = 0; /*0xffd7335c*/
SpiCalcAddress(0, 0, v2, &v1); /*0xffd73360*/
return v1; /*0xffd7336c*/
}
// Function: GpioSetBits @ 0xffd73370 (0x1b bytes)
__int16 __fastcall GpioSetBits(unsigned __int16 *a1, __int16 a2)
{
__int16 GroupFromPad; // ax
GroupFromPad = GpioGetGroupFromPad(a1); /*0xffd73377*/
return GpioGetGroupIndexFromPad(a1, a2 | GroupFromPad); /*0xffd73381*/
}
// Function: GpioClearBits @ 0xffd7338b (0x1b bytes)
__int16 __fastcall GpioClearBits(unsigned __int16 *a1, __int16 n65279)
{
__int16 GroupFromPad; // ax
GroupFromPad = GpioGetGroupFromPad(a1); /*0xffd73392*/
return GpioGetGroupIndexFromPad(a1, n65279 & GroupFromPad); /*0xffd7339c*/
}
// Function: GpioModifyBits @ 0xffd733a6 (0x20 bytes)
__int16 __fastcall GpioModifyBits(unsigned __int16 *a1, __int16 n127, __int16 n49152)
{
__int16 GroupFromPad; // ax
GroupFromPad = GpioGetGroupFromPad(a1); /*0xffd733ad*/
return GpioGetGroupIndexFromPad(a1, n49152 | n127 & GroupFromPad); /*0xffd733bf*/
}
// Function: GpioGetGroupFromPad @ 0xffd733c6 (0x2e bytes)
int __fastcall GpioGetGroupFromPad(unsigned __int16 *a1)
{
int v2; // eax
if ( ((unsigned __int8)a1 & 1) != 0 ) /*0xffd733cc*/
{
v2 = DebugAssert(); /*0xffd733ce*/
if ( v2 ) /*0xffd733d5*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd733e6*/
"e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLib.c",
151,
"(Address & 1) == 0");
}
return *a1; /*0xffd733f2*/
}
// Function: GpioGetGroupIndexFromPad @ 0xffd733f4 (0x33 bytes)
__int16 __fastcall GpioGetGroupIndexFromPad(_WORD *a1, __int16 a2)
{
int v4; // eax
if ( ((unsigned __int8)a1 & 1) != 0 ) /*0xffd733fe*/
{
v4 = DebugAssert(); /*0xffd73400*/
if ( v4 ) /*0xffd73407*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd73418*/
"e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLib.c",
183,
"(Address & 1) == 0");
}
*a1 = a2; /*0xffd7341e*/
return a2; /*0xffd73424*/
}
// Function: Assert_18 @ 0xffd73427 (0x35 bytes)
unsigned __int16 __fastcall sub_FFD73427(unsigned __int16 a1, unsigned __int16 n2048)
{
int v4; // eax
if ( (a1 & 1) != 0 ) /*0xffd73431*/
{
v4 = DebugAssert(); /*0xffd73433*/
if ( v4 ) /*0xffd7343a*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd7344b*/
"e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLibMsc.c",
163,
"(Port & 1) == 0");
}
__outword(a1, n2048); /*0xffd73457*/
return n2048; /*0xffd73459*/
}
// Function: GpioCheckPadOwnership @ 0xffd7345c (0x2c bytes)
unsigned __int32 __fastcall GpioCheckPadOwnership(unsigned __int16 a1)
{
int v2; // eax
if ( (a1 & 3) != 0 ) /*0xffd73462*/
{
v2 = DebugAssert(); /*0xffd73464*/
if ( v2 ) /*0xffd7346b*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd7347c*/
"e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLibMsc.c",
193,
"(Port & 3) == 0");
}
return __indword(a1); /*0xffd73486*/
}
// Function: Assert_20 @ 0xffd73488 (0x32 bytes)
unsigned int __fastcall sub_FFD73488(unsigned __int16 a1, unsigned int a2)
{
int v4; // eax
if ( (a1 & 3) != 0 ) /*0xffd73491*/
{
v4 = DebugAssert(); /*0xffd73493*/
if ( v4 ) /*0xffd7349a*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd734ab*/
"e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLibMsc.c",
223,
"(Port & 3) == 0");
}
__outdword(a1, a2); /*0xffd734b6*/
return a2; /*0xffd734b7*/
}
// Function: RShift64_16 @ 0xffd734ba (0x27 bytes)
unsigned __int64 __cdecl RShift64_16(unsigned __int64 a1)
{
return a1 >> 16; /*0xffd734dd*/
}
// Function: GpioGetGpiomuxConfig @ 0xffd734e1 (0x23 bytes)
void *__thiscall GpioGetGpiomuxConfig(void *this)
{
void *this_1; // eax
if ( !this ) /*0xffd734e7*/
SiAssert((int)"e:\\hs\\MdePkg\\Library\\BaseLib\\X86ReadIdtr.c", 37, "Idtr != ((void *) 0)"); /*0xffd734f6*/
this_1 = this; /*0xffd734fc*/
__sidt(this); /*0xffd734ff*/
return this_1; /*0xffd73503*/
}
// Function: Assert_24 @ 0xffd73504 (0x27 bytes)
__int16 __thiscall sub_FFD73504(void *this)
{
int v2; // eax
if ( !this ) /*0xffd73509*/
{
v2 = DebugAssert(); /*0xffd7350b*/
if ( v2 ) /*0xffd73512*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd73520*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c",
38,
"Buffer != ((void *) 0)");
}
return *(_WORD *)this; /*0xffd73529*/
}
// Function: Assert_23 @ 0xffd7352b (0x29 bytes)
int __thiscall sub_FFD7352B(void *this)
{
int v2; // eax
if ( !this ) /*0xffd73530*/
{
v2 = DebugAssert(); /*0xffd73532*/
if ( v2 ) /*0xffd73539*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd7354a*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c",
141,
"Buffer != ((void *) 0)");
}
return *(_DWORD *)this; /*0xffd73552*/
}
// Function: Assert_22 @ 0xffd73554 (0x2c bytes)
__int64 __thiscall sub_FFD73554(void *this)
{
int v2; // eax
if ( !this ) /*0xffd73559*/
{
v2 = DebugAssert(); /*0xffd7355b*/
if ( v2 ) /*0xffd73562*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd73573*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c",
192,
"Buffer != ((void *) 0)");
}
return *(_QWORD *)this; /*0xffd7357e*/
}
// Function: Assert_19 @ 0xffd73580 (0x34 bytes)
int __cdecl sub_FFD73580(int a1, int a2)
{
_DWORD *v2; // ecx
_DWORD *v3; // esi
int v4; // eax
v3 = v2; /*0xffd73581*/
if ( !v2 ) /*0xffd73585*/
{
v4 = DebugAssert(); /*0xffd73587*/
if ( v4 ) /*0xffd7358e*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd7359f*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c",
219,
"Buffer != ((void *) 0)");
}
*v3 = a1; /*0xffd735ad*/
v3[1] = a2; /*0xffd735af*/
return a1; /*0xffd735b2*/
}
// Function: Assert_17 @ 0xffd735b4 (0x4e bytes)
unsigned int __fastcall Assert_17(_WORD *__)
{
int v2; // eax
unsigned int n0xF4240; // eax
if ( ((unsigned __int8)__ & 1) != 0 ) /*0xffd735ba*/
{
v2 = DebugAssert(); /*0xffd735bc*/
if ( v2 ) /*0xffd735c3*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd735d4*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c",
128,
"((UINTN) String & 0x00000001) == 0");
}
if ( !__ ) /*0xffd735dc*/
return 0; /*0xffd735fe*/
n0xF4240 = 0; /*0xffd735e0*/
if ( *__ ) /*0xffd735e2*/
{
while ( n0xF4240 < 0xF4240 ) /*0xffd735ec*/
{
if ( !__[++n0xF4240] ) /*0xffd735ef*/
return n0xF4240; /*0xffd735f3*/
}
return 1000001; /*0xffd735f7*/
}
return n0xF4240; /*0xffd735f5*/
}
// Function: StrnlenSafe @ 0xffd73602 (0x1f bytes)
unsigned int __thiscall StrnlenSafe(_BYTE *this)
{
unsigned int n0xF4240; // eax
n0xF4240 = 0; /*0xffd73602*/
if ( this && *this ) /*0xffd73608*/
{
while ( n0xF4240 < 0xF4240 ) /*0xffd73611*/
{
if ( !*(this + ++n0xF4240) ) /*0xffd73614*/
return n0xF4240; /*0xffd73618*/
}
return 1000001; /*0xffd7361b*/
}
return n0xF4240; /*0xffd7361a*/
}
// Function: SmmGetInfo @ 0xffd7363e (0x4d bytes)
bool sub_FFD7363E()
{
int v0; // eax
unsigned int v2; // [esp+4h] [ebp-4h] BYREF
v2 = 0; /*0xffd73643*/
ConfigureAudioPll(&v2); /*0xffd7364a*/
if ( !v2 ) /*0xffd73654*/
{
v0 = DebugAssert(); /*0xffd73656*/
if ( v0 ) /*0xffd7365d*/
(*(void (__cdecl **)(const char *, int, const char *))(v0 + 4))( /*0xffd7366e*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchPmcLib\\PchPmcLib.c",
162,
"PchPwrmBase != 0");
return 0; /*0xffd7366e*/
}
return (*(_DWORD *)(v2 + 300) & 0x8000) != 0; /*0xffd73685*/
}
// Function: DebugLogPrint_18 @ 0xffd7368b (0x6a bytes)
int __thiscall DebugLogPrint_18(void *this)
{
int this_1; // esi
_WORD *v3; // eax
int v4; // eax
this_1 = -1; /*0xffd73690*/
v3 = AssertCpuDeadLoop_9((char *)dword_FFD7ADD4); /*0xffd73698*/
if ( !v3 ) /*0xffd7369f*/
goto LABEL_7; /*0xffd7369f*/
if ( *((_DWORD *)v3 + 7) )
{
v4 = DebugAssert(); /*0xffd736ac*/
if ( !v4 )
{
LABEL_7:
DebugPrintAssert(0x80000000, "HECI: GetMeFs1FromHob() Can't read correctly MeFwHob info\n");
this_1 = (int)this; /*0xffd736dd*/
goto LABEL_8; /*0xffd736dd*/
}
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd736c1*/
"e:\\hs\\PurleySktPkg\\Me\\Heci\\Library\\MeTypeLib\\MeTypeLib.c",
67,
"MeFwHob->Group[0].FunNumber == HECI1_DEVICE");
}
else
{
this_1 = *((_DWORD *)v3 + 8); /*0xffd736a7*/
}
if ( this_1 == -1 ) /*0xffd736ca*/
goto LABEL_7; /*0xffd736ca*/
LABEL_8:
DebugPrintAssert(64, "HECI: GetMeFs1FromHob() returns MEFS1 = %d\n", this_1);
return this_1; /*0xffd736f1*/
}
// Function: DebugLogPrint_8 @ 0xffd736f5 (0xe3 bytes)
int DebugLogPrint_8()
{
int v0; // edi
unsigned int v2; // esi
unsigned int n2; // ebx
int PadConfig; // eax
v0 = 0; /*0xffd736fa*/
if ( SmmGetInfo() )
{
DebugPrintAssert(64, "HECI: GetOnBoardMeType() for DWR flow return Dfx type\n");
return 15; /*0xffd73716*/
}
v2 = *(_DWORD *)(GpioGetPadConfig(0, 22, 0) + 64); /*0xffd7372a*/
if ( v2 == -1 )
{
v2 = DebugLogPrint_18((void *)0xFFFFFFFF); /*0xffd73736*/
DebugPrintAssert(64, "HECI: GetOnBoardMeType() reads Hfs info from HOB = %d\n", v2);
}
if ( (v2 & 0xF) != 0xF )
{
if ( (v2 & 0xF) == 4 ) /*0xffd7375a*/
return 255; /*0xffd73761*/
n2 = HIWORD(v2) & 0xF; /*0xffd73768*/
DebugPrintAssert(64, "HECI: MeOperationMode = %d\n", n2);
if ( n2 > 1 )
{
if ( n2 == 2 ) /*0xffd73782*/
return 255; /*0xffd73782*/
if ( n2 > 5 )
{
if ( n2 != 7 )
{
if ( n2 == 15 ) /*0xffd73792*/
return 1; /*0xffd73796*/
DebugPrintAssert(0x80000000, "HECI: ME type not recognized (MEFS1: 0x%08X)\n", v2);
PadConfig = GpioGetPadConfig(0, 22, 0); /*0xffd737b3*/
DebugPrintAssert(0x80000000, " (MEFS2: 0x%08X)\n", *(_DWORD *)(PadConfig + 72));
return v0; /*0xffd73797*/
}
return 255; /*0xffd7378e*/
}
}
return 2; /*0xffd737cf*/
}
return 15; /*0xffd737d2*/
}
// Function: MeConfigIsType255 @ 0xffd737d8 (0x12 bytes)
BOOL MeConfigIsType255()
{
return DebugLogPrint_8() == 255; /*0xffd737e9*/
}
// Function: SmBusIsV2Controller @ 0xffd737f8 (0x27 bytes)
bool SmBusIsV2Controller()
{
char v0; // bl
v0 = 0; /*0xffd737f9*/
if ( (unsigned __int8)sub_FFD737EA() ) /*0xffd737fb*/
return (*(_DWORD *)(GpioGetPadConfig(0, 22, 0) + 64) & 0xF) == 2; /*0xffd73819*/
return v0; /*0xffd7381d*/
}
// Function: DebugLogPrint_16 @ 0xffd7381f (0x95 bytes)
int __fastcall sub_FFD7381F(unsigned int a1, _DWORD *a2, unsigned int *a3)
{
int v5; // eax
unsigned int v7; // ecx
char v8; // si
int v9; // eax
unsigned int v10; // [esp+8h] [ebp-4h] BYREF
if ( a1 < (unsigned __int8)PchPcieRootPortCount() ) /*0xffd73833*/
{
v7 = 3 * (a1 >> 2); /*0xffd73871*/
v8 = a1 - byte_FFD78E76[v7]; /*0xffd7387b*/
v9 = (unsigned __int8)byte_FFD78E74[v7]; /*0xffd7387d*/
LOBYTE(v7) = byte_FFD78E75[v7]; /*0xffd73884*/
*a2 = v9; /*0xffd7388b*/
DebugLogPrint_14(v7, 0, 4, &v10); /*0xffd73893*/
*a3 = (v10 >> (4 * v8)) & 7; /*0xffd738aa*/
return 0; /*0xffd738ac*/
}
else
{
DebugPrintAssert(0x80000000, "GetPchPcieRpDevFun invalid RpNumber %x", a1); /*0xffd73840*/
v5 = DebugAssert(); /*0xffd73848*/
if ( v5 ) /*0xffd7384f*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffd7385d*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchPcieRpLib\\PchPcieRpLib.c",
91,
"((BOOLEAN)(0==1))");
return -2147483646; /*0xffd73863*/
}
}
// Function: DebugLogPrint_3 @ 0xffd738b4 (0x15e bytes)
char __fastcall DebugLogPrint_3(unsigned int n2)
{
unsigned int n2_1; // esi
int n3_1; // eax
int n3; // edi
int PadConfig; // ebx
int v5; // eax
int v6; // ecx
int n5000; // esi
int n5000_1; // edi
char v12; // [esp+17h] [ebp-Dh]
unsigned int v14; // [esp+1Ch] [ebp-8h]
n2_1 = n2; /*0xffd738ba*/
n3_1 = n2 + 1; /*0xffd738c3*/
n3 = 3; /*0xffd738c6*/
if ( n2 >= 2 ) /*0xffd738ca*/
n3_1 = 3; /*0xffd738cc*/
DebugPrintAssert(64, "[HECI%d] Clearing D0I3 bit\n", n3_1); /*0xffd738d6*/
PadConfig = GpioGetPadConfig(0, 22, n2_1); /*0xffd738e9*/
if ( (unsigned __int16)GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 2)) == 0xFFFF ) /*0xffd738fc*/
{
if ( n2_1 < 2 ) /*0xffd73901*/
n3 = n2_1 + 1; /*0xffd73903*/
LOBYTE(v5) = DebugPrintAssert(0x80000000, "[HECI%d] Function is disabled, cannot clear D0I3 bit!\n", n3); /*0xffd73911*/
}
else
{
v14 = *(_DWORD *)(PadConfig + 16) & 0xFFFFFFF0; /*0xffd73929*/
if ( (*(_DWORD *)(PadConfig + 16) & 6) == 4 ) /*0xffd73934*/
v5 = *(_DWORD *)(PadConfig + 20); /*0xffd73936*/
else
v5 = 0; /*0xffd7393f*/
if ( (v14 || v5) && (v14 != -16 || v5 != -1) ) /*0xffd7395c*/
{
v12 = *(_BYTE *)(PadConfig + 4); /*0xffd73965*/
if ( (v12 & 2) == 0 ) /*0xffd7396b*/
*(_BYTE *)(PadConfig + 4) |= 6u; /*0xffd73972*/
v6 = *(_DWORD *)(v14 + 2048); /*0xffd73979*/
if ( (v6 & 4) != 0 ) /*0xffd73982*/
{
if ( (v6 & 1) != 0 ) /*0xffd73987*/
{
n5000 = 5000; /*0xffd73989*/
do /*0xffd739a8*/
{
if ( !n5000-- ) /*0xffd7398e*/
break; /*0xffd73993*/
SiMicroSecondDelay(0x3E8u); /*0xffd7399a*/
v6 = *(_DWORD *)(v14 + 2048); /*0xffd7399f*/
}
while ( (v6 & 1) != 0 ); /*0xffd739a8*/
n2_1 = n2; /*0xffd739aa*/
}
*(_DWORD *)(v14 + 2048) = v6 & 0xFFFFFFFB; /*0xffd739b1*/
if ( (*(_DWORD *)(v14 + 2048) & 1) != 0 ) /*0xffd739bf*/
{
n5000_1 = 5000; /*0xffd739c1*/
do /*0xffd739df*/
{
if ( !n5000_1-- ) /*0xffd739c6*/
break; /*0xffd739cb*/
SiMicroSecondDelay(0x3E8u); /*0xffd739d2*/
}
while ( (*(_DWORD *)(v14 + 2048) & 1) != 0 ); /*0xffd739df*/
n3 = 3; /*0xffd739e3*/
}
}
if ( n2_1 < 2 ) /*0xffd739e7*/
n3 = n2_1 + 1; /*0xffd739e9*/
DebugPrintAssert(64, "[HECI%d] D0I3C register = %08X\n", n3, *(_DWORD *)(v14 + 2048)); /*0xffd739fb*/
*(_BYTE *)(PadConfig + 4) = v12; /*0xffd73a07*/
LOBYTE(v5) = v12; /*0xffd73a00*/
}
}
return v5; /*0xffd73a0a*/
}
// Function: DebugLogPrint_6 @ 0xffd73a12 (0xfc bytes)
char __fastcall DebugLogPrint_6(unsigned int n2)
{
int n3; // edi
int n3_1; // eax
int PadConfig; // ebx
char result; // al
unsigned int v6; // [esp+10h] [ebp-8h]
int v7; // [esp+14h] [ebp-4h]
n3 = 3; /*0xffd73a1a*/
n3_1 = n2 + 1; /*0xffd73a20*/
if ( n2 >= 2 ) /*0xffd73a25*/
n3_1 = 3; /*0xffd73a27*/
DebugPrintAssert(64, "[HECI%d] Setting D0I3 bit\n", n3_1); /*0xffd73a31*/
PadConfig = GpioGetPadConfig(0, 22, n2); /*0xffd73a41*/
if ( (unsigned __int16)GpioGetGroupFromPad((unsigned __int16 *)(PadConfig + 2)) == 0xFFFF ) /*0xffd73a56*/
{
if ( n2 < 2 ) /*0xffd73a5a*/
n3 = n2 + 1; /*0xffd73a5c*/
return DebugPrintAssert(0x80000000, "[HECI%d] Function is disabled, can't set D0I3 bit!\n", n3); /*0xffd73a6a*/
}
else if ( (*(_BYTE *)(PadConfig + 160) & 0xFB) != 0 ) /*0xffd73a7f*/
{
if ( n2 < 2 ) /*0xffd73a83*/
n3 = n2 + 1; /*0xffd73a85*/
return DebugPrintAssert(2, "[HECI%d] HIDM is not legacy/MSI, do not set DOI3 bit!\n", n3); /*0xffd73a8f*/
}
else
{
v7 = 0; /*0xffd73a94*/
v6 = *(_DWORD *)(PadConfig + 16) & 0xFFFFFFF0; /*0xffd73a9c*/
if ( (*(_DWORD *)(PadConfig + 16) & 6) == 4 ) /*0xffd73aa7*/
v7 = *(_DWORD *)(PadConfig + 20); /*0xffd73aac*/
*(_BYTE *)(PadConfig + 4) |= 6u; /*0xffd73ab9*/
if ( (v6 || v7) && (v6 != -16 || v7 != -1) ) /*0xffd73ad0*/
{
*(_DWORD *)(v6 + 2048) |= 4u; /*0xffd73adb*/
if ( n2 < 2 ) /*0xffd73ae3*/
n3 = n2 + 1; /*0xffd73ae5*/
DebugPrintAssert(64, "[HECI%d] D0I3C register = %08X\n", n3, *(_DWORD *)(v6 + 2048)); /*0xffd73af7*/
}
result = *(_BYTE *)(PadConfig + 4) & 0xF9; /*0xffd73b02*/
*(_BYTE *)(PadConfig + 4) = result; /*0xffd73b04*/
}
return result; /*0xffd73b07*/
}
// Function: Assert_2 @ 0xffd73b0e (0x143 bytes)
char __fastcall Assert_2(int n4, int a2)
{
int PadConfig_1; // ebp
int v5; // eax
unsigned int v6; // eax
__int16 n1024; // si
int PadConfig; // eax
unsigned int v10; // [esp+14h] [ebp-4h] BYREF
PadConfig_1 = 0; /*0xffd73b1b*/
ConfigureAudioPll(&v10); /*0xffd73b24*/
if ( n4 < 0 ) /*0xffd73b2b*/
goto LABEL_27; /*0xffd73b2b*/
if ( n4 > 4 )
{
if ( n4 == 5 ) /*0xffd73b39*/
{
v5 = *(_DWORD *)(v10 + 1568); /*0xffd73b43*/
if ( a2 ) /*0xffd73b4b*/
v6 = v5 | 0x80000000; /*0xffd73b4d*/
else
v6 = v5 & 0x7FFFFFFF; /*0xffd73b54*/
*(_DWORD *)(v10 + 1568) = v6; /*0xffd73b59*/
return v6; /*0xffd73b5f*/
}
LABEL_27:
LOBYTE(v6) = DebugPrintAssert(0x80000000, "[ME] ERROR: Unknown device %d operation (%d)\n", (unsigned __int8)n4, a2);
return v6; /*0xffd73c41*/
}
if ( n4 ) /*0xffd73b66*/
{
if ( n4 == 1 ) /*0xffd73b72*/
{
n1024 = 1024; /*0xffd73b74*/
}
else if ( n4 == 4 ) /*0xffd73b7e*/
{
n1024 = 768; /*0xffd73b80*/
}
else
{
if ( n4 == 2 ) /*0xffd73b8a*/
{
n1024 = 2048; /*0xffd73b8c*/
PadConfig = GpioGetPadConfig(0, 22, 2); /*0xffd73b92*/
}
else
{
n1024 = 1792; /*0xffd73b9d*/
PadConfig = GpioGetPadConfig(0, 22, 3); /*0xffd73ba8*/
}
PadConfig_1 = PadConfig; /*0xffd73bad*/
}
}
else
{
n1024 = 1536; /*0xffd73b68*/
}
if ( a2 == 1 ) /*0xffd73bb3*/
{
AssertEfiError(186, n1024 + 28, -257, 0); /*0xffd73bc4*/
LOBYTE(v6) = DebugPrintAssert(64, "[ME] Enabling device 0:22:%d\n", (unsigned __int8)n4); /*0xffd73bd4*/
if ( !n4 ) /*0xffd73bde*/
LOBYTE(v6) = DebugLogPrint_3(0); /*0xffd73be2*/
}
else
{
DebugPrintAssert(64, "[ME] Disabling device 0:22:%d\n", (unsigned __int8)n4); /*0xffd73bf4*/
if ( n4 ) /*0xffd73bfe*/
{
if ( n4 == 2 || n4 == 3 ) /*0xffd73c11*/
*(_DWORD *)(PadConfig_1 + 84) = 3; /*0xffd73c13*/
}
else
{
DebugLogPrint_6(0); /*0xffd73c02*/
}
LOBYTE(v6) = AssertEfiError(186, n1024 + 28, -1, 256); /*0xffd73c29*/
}
return v6; /*0xffd73c49*/
}
// Function: DebugLogPrint_12 @ 0xffd73c51 (0xb9 bytes)
int DebugLogPrint_12()
{
int n16_1; // esi
int BootMode; // eax
const char *External; // eax
int n16; // [esp-4h] [ebp-14h]
int v5; // [esp+8h] [ebp-8h] BYREF
int n2; // [esp+Ch] [ebp-4h] BYREF
n16_1 = 0; /*0xffd73c58*/
BootMode = PeiServicesGetBootMode(); /*0xffd73c5a*/
if ( (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int *))(*(_DWORD *)BootMode + 32))( /*0xffd73c8e*/
BootMode,
&unk_FFD7AD34,
0,
0,
&v5) < 0
|| (*(int (__cdecl **)(int, int, int, int *))(v5 + 36))(v5, 500, 4, &n2) < 0 )
{
goto LABEL_6; /*0xffd73c8e*/
}
DebugPrintAssert(64, "(Hsio) GetClockingMode() SPI SoftStrap read = 0x%x", n2); /*0xffd73c9a*/
n2 &= 3u; /*0xffd73ca8*/
DebugPrintAssert(64, " (0x%x)\n", n2); /*0xffd73cb3*/
if ( !n2 ) /*0xffd73cc0*/
{
if ( GpioLockGpios() == 48 ) /*0xffd73cfe*/
goto LABEL_6; /*0xffd73cfe*/
n16 = 16; /*0xffd73d00*/
LABEL_11:
n16_1 = n16; /*0xffd73d02*/
External = "External"; /*0xffd73d03*/
goto LABEL_7; /*0xffd73d08*/
}
if ( n2 == 2 ) /*0xffd73cc6*/
{
n16 = 2; /*0xffd73cf2*/
goto LABEL_11; /*0xffd73cf4*/
}
DebugPrintAssert(2, "(Hsio) GetClockingMode() Warning: unsupported clocking mode choice, assuming internal\n");
LABEL_6:
External = "InternalStandard"; /*0xffd73cd6*/
LABEL_7:
DebugPrintAssert(64, "(Hsio) GetClockingMode() returns %s", External); /*0xffd73cdb*/
return n16_1; /*0xffd73ced*/
}
// Function: DebugLogPrint_4 @ 0xffd73d0a (0x11e bytes)
int __thiscall sub_FFD73D0A(int *p_n2988)
{
int v2; // esi
int BootMode; // ebx
unsigned __int8 v4; // al
int v5; // ecx
int v6; // eax
int v7; // eax
int v8; // eax
int v9; // eax
int v11; // [esp+10h] [ebp-34h] BYREF
unsigned __int8 v12; // [esp+27h] [ebp-1Dh]
v2 = -2147483646; /*0xffd73d13*/
BootMode = PeiServicesGetBootMode(); /*0xffd73d26*/
DebugPrintAssert(64, "[ME] PeiGetCurrenClockingMode\n"); /*0xffd73d28*/
if ( p_n2988 )
{
(*(void (__cdecl **)(int *, int, _DWORD))(*(_DWORD *)BootMode + 84))(&v11, 48, 0); /*0xffd73d43*/
if ( !(unsigned __int8)sub_FFD737EA() || (unsigned __int8)SmBusIsV2Controller() )
{
DebugPrintAssert(64, "[ME] PeiGetCurrenClockingMode: Non SPS ME detected\n");
v2 = -2147483642; /*0xffd73d82*/
}
else
{
DebugPrintAssert(64, "[ME] PeiGetCurrenClockingMode: For SPS ME use Heci message\n");
v2 = DebugLogPrint_7(); /*0xffd73d71*/
}
if ( v2 == -2147483642 )
{
DebugPrintAssert(64, "[ME] PeiGetCurrenClockingMode: Read clock mode from SoftStraps\n");
v2 = 0; /*0xffd73d9c*/
v4 = DebugLogPrint_12(); /*0xffd73d9e*/
v12 = v4; /*0xffd73da3*/
}
else
{
v4 = v12; /*0xffd73da9*/
}
if ( v2 >= 0 )
{
v5 = v4; /*0xffd73db1*/
if ( !v4 ) /*0xffd73db8*/
{
*p_n2988 = 0; /*0xffd73e0d*/
goto LABEL_22; /*0xffd73e0d*/
}
v6 = v4 - 1; /*0xffd73dba*/
if ( !v6 ) /*0xffd73dbd*/
{
*p_n2988 = 2; /*0xffd73e05*/
goto LABEL_22; /*0xffd73e0b*/
}
v7 = v6 - 1; /*0xffd73dbf*/
if ( !v7 ) /*0xffd73dc2*/
goto LABEL_19; /*0xffd73dc2*/
v8 = v7 - 14; /*0xffd73dc4*/
if ( !v8 ) /*0xffd73dc7*/
{
*p_n2988 = 1; /*0xffd73df5*/
goto LABEL_22; /*0xffd73dfb*/
}
v9 = v8 - 1; /*0xffd73dc9*/
if ( !v9 ) /*0xffd73dcc*/
{
*p_n2988 = 3; /*0xffd73ded*/
goto LABEL_22; /*0xffd73df3*/
}
if ( v9 == 1 ) /*0xffd73dd1*/
{
LABEL_19:
*p_n2988 = 4; /*0xffd73dfd*/
goto LABEL_22; /*0xffd73e03*/
}
DebugPrintAssert(0x80000000, "(ME) PeiGetCurrenClockingMode: Unknown Clocking Mode = 0x%x\n", v5);
v2 = -2147483645; /*0xffd73de6*/
}
}
LABEL_22:
DebugPrintAssert(64, "[ME] PeiGetCurrenClockingMode exit status = %r \n", v2); /*0xffd73e0f*/
return v2; /*0xffd73e20*/
}
// Function: DebugLogPrint_7 @ 0xffd73e28 (0xe5 bytes)
int __fastcall DebugLogPrint_7(int a1, int a2)
{
int v3; // edi
int BootMode; // eax
int (__cdecl **v5)(_DWORD, int, int, int *, _DWORD, int); // eax
int (__cdecl **v7)(_DWORD, int, int, int *, _DWORD, int); // [esp+10h] [ebp-8h] BYREF
int n48; // [esp+14h] [ebp-4h] BYREF
v3 = -2147483646; /*0xffd73e3a*/
DebugPrintAssert(64, "[ICC] SpsSetGetCurrenClockingMode\n"); /*0xffd73e3f*/
if ( !(unsigned __int8)sub_FFD737EA() || SmBusIsV2Controller() )
{
v3 = -2147483645; /*0xffd73eef*/
}
else if ( a2 )
{
v3 = -2147483641; /*0xffd73e68*/
BootMode = PeiServicesGetBootMode(); /*0xffd73e6b*/
if ( (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int (__cdecl ***)(_DWORD, int, int, int *, _DWORD, int)))(*(_DWORD *)BootMode + 32))(
BootMode,
&unk_FFD7AEA4,
0,
0,
&v7) >= 0 )
{
n48 = 48; /*0xffd73e93*/
v5 = v7; /*0xffd73e97*/
*(_DWORD *)a2 = 0x40000; /*0xffd73e9d*/
*(_DWORD *)(a2 + 4) = 26; /*0xffd73ea3*/
*(_DWORD *)(a2 + 8) = 0; /*0xffd73eaa*/
*(_DWORD *)(a2 + 12) = 28; /*0xffd73ead*/
*(_DWORD *)(a2 + 16) = 0; /*0xffd73eb4*/
*(_WORD *)(a2 + 20) = 1; /*0xffd73eb7*/
v3 = (*v5)(0, a2, 48, &n48, 0, 8); /*0xffd73ebf*/
if ( v3 >= 0 && (*(_DWORD *)(a2 + 4) != 26 || *(_DWORD *)(a2 + 8)) )
{
DebugPrintAssert(
0x80000000,
"(ICC) SpsSetGetCurrenClockingMode: Wrong response! IccHeader.IccResponse = 0x%x\n",
*(_DWORD *)(a2 + 8));
v3 = -2147483641; /*0xffd73ee8*/
}
}
}
DebugPrintAssert(64, "[ICC] SpsSetGetCurrenClockingMode exit status = %r \n", v3); /*0xffd73efc*/
return v3; /*0xffd73f06*/
}
// Function: DebugLogPrint_20 @ 0xffd73f0d (0x17e bytes)
int __fastcall sub_FFD73F0D(unsigned int n0x19, _BYTE *a2, _BYTE *a3)
{
unsigned int v3; // ebx
int v6; // eax
unsigned int v7; // eax
unsigned int v8; // ecx
unsigned int v9; // edx
unsigned int v10; // ecx
char v11; // dl
int result; // eax
unsigned int v13; // [esp+Ch] [ebp-1Ch] BYREF
unsigned int v14; // [esp+10h] [ebp-18h] BYREF
unsigned int v15; // [esp+14h] [ebp-14h] BYREF
unsigned int v16; // [esp+18h] [ebp-10h] BYREF
unsigned int v17; // [esp+1Ch] [ebp-Ch]
unsigned int v18; // [esp+20h] [ebp-8h]
unsigned int v19; // [esp+24h] [ebp-4h]
v3 = 0; /*0xffd73f14*/
v16 = 0; /*0xffd73f18*/
v18 = 0; /*0xffd73f1e*/
v15 = 0; /*0xffd73f23*/
v17 = 0; /*0xffd73f29*/
v14 = 0; /*0xffd73f2c*/
v19 = 0; /*0xffd73f2f*/
v13 = 0; /*0xffd73f32*/
v6 = PchGpioInit(); /*0xffd73f35*/
if ( n0x19 > 0x19 && v6 == 1 ) /*0xffd73f42*/
return -2147483646; /*0xffd7407f*/
if ( n0x19 < 8 ) /*0xffd73f4b*/
{
DebugLogPrint_14(0x13u, 0x250u, 4, &v16); /*0xffd73f5b*/
v3 = v16; /*0xffd73f60*/
v7 = v19; /*0xffd73f63*/
LABEL_10:
v8 = v18; /*0xffd73fc5*/
goto LABEL_11; /*0xffd73fc7*/
}
if ( n0x19 >= 0x10 ) /*0xffd73f6b*/
{
if ( n0x19 < 0x18 ) /*0xffd73f8d*/
{
DebugLogPrint_14(0x13u, 0x258u, 4, &v14); /*0xffd73f9d*/
v9 = v14; /*0xffd73fa2*/
v7 = v19; /*0xffd73fa5*/
v8 = v18; /*0xffd73faa*/
goto LABEL_12; /*0xffd73fad*/
}
DebugLogPrint_14(0x13u, 0x25Cu, 4, &v13); /*0xffd73fbd*/
v7 = v13; /*0xffd73fc2*/
goto LABEL_10; /*0xffd73fc2*/
}
DebugLogPrint_14(0x13u, 0x254u, 4, &v15); /*0xffd73f7b*/
v7 = v19; /*0xffd73f80*/
v8 = v15; /*0xffd73f85*/
LABEL_11:
v9 = v17; /*0xffd73fca*/
LABEL_12:
switch ( n0x19 ) /*0xffd73fd6*/
{
case 0u: /*0xffd73fd6*/
goto LABEL_13;
case 1u: /*0xffd73fd6*/
v3 >>= 4; /*0xffd73fed*/
goto LABEL_13; /*0xffd73ff0*/
case 2u: /*0xffd73fd6*/
v3 >>= 8; /*0xffd73ff2*/
goto LABEL_13; /*0xffd73ff5*/
case 3u: /*0xffd73fd6*/
v3 >>= 12; /*0xffd73ff7*/
goto LABEL_13; /*0xffd73ffa*/
case 4u: /*0xffd73fd6*/
v3 >>= 16; /*0xffd73ffc*/
goto LABEL_13; /*0xffd73fff*/
case 5u: /*0xffd73fd6*/
v3 >>= 20; /*0xffd74001*/
goto LABEL_13; /*0xffd74004*/
case 6u: /*0xffd73fd6*/
v3 >>= 24; /*0xffd74006*/
goto LABEL_13; /*0xffd74009*/
case 7u: /*0xffd73fd6*/
v3 >>= 28; /*0xffd7400b*/
LABEL_13:
*a3 = v3 & 0xF; /*0xffd73fdd*/
goto LABEL_14; /*0xffd73fe3*/
case 8u: /*0xffd73fd6*/
goto LABEL_23;
case 9u: /*0xffd73fd6*/
v8 >>= 4; /*0xffd74010*/
LABEL_23:
*a3 = v8 & 0xF; /*0xffd74013*/
LABEL_14:
*a2 = -23; /*0xffd73fe5*/
goto LABEL_43; /*0xffd73fe8*/
case 0xAu: /*0xffd73fd6*/
v10 = v8 >> 8; /*0xffd7401d*/
goto LABEL_25; /*0xffd7401d*/
case 0xBu: /*0xffd73fd6*/
v10 = v8 >> 12; /*0xffd7402a*/
goto LABEL_25; /*0xffd7402d*/
case 0xCu: /*0xffd73fd6*/
v10 = HIWORD(v8); /*0xffd7402f*/
goto LABEL_25; /*0xffd74032*/
case 0xDu: /*0xffd73fd6*/
v10 = v8 >> 20; /*0xffd74034*/
goto LABEL_25; /*0xffd74037*/
case 0xEu: /*0xffd73fd6*/
v10 = HIBYTE(v8); /*0xffd74039*/
goto LABEL_25; /*0xffd7403c*/
case 0xFu: /*0xffd73fd6*/
v10 = v8 >> 28; /*0xffd7403e*/
LABEL_25:
*a3 = v10 & 0xF; /*0xffd74020*/
goto LABEL_42; /*0xffd74028*/
case 0x10u: /*0xffd73fd6*/
goto LABEL_32;
case 0x11u: /*0xffd73fd6*/
v9 >>= 4; /*0xffd74043*/
goto LABEL_32; /*0xffd74043*/
case 0x12u: /*0xffd73fd6*/
v9 >>= 8; /*0xffd7404b*/
goto LABEL_32; /*0xffd7404e*/
case 0x13u: /*0xffd73fd6*/
v9 >>= 12; /*0xffd74050*/
goto LABEL_32; /*0xffd74053*/
case 0x14u: /*0xffd73fd6*/
v9 >>= 16; /*0xffd74055*/
goto LABEL_32; /*0xffd74058*/
case 0x15u: /*0xffd73fd6*/
v9 >>= 20; /*0xffd7405a*/
goto LABEL_32; /*0xffd7405d*/
case 0x16u: /*0xffd73fd6*/
v9 >>= 24; /*0xffd7405f*/
goto LABEL_32; /*0xffd74062*/
case 0x17u: /*0xffd73fd6*/
v9 >>= 28; /*0xffd74064*/
LABEL_32:
v11 = v9 & 0xF; /*0xffd74046*/
goto LABEL_41; /*0xffd74049*/
case 0x18u: /*0xffd73fd6*/
goto LABEL_40;
case 0x19u: /*0xffd73fd6*/
v7 >>= 4; /*0xffd74069*/
LABEL_40:
LOBYTE(v7) = v7 & 0xF; /*0xffd7406c*/
v19 = v7; /*0xffd7406e*/
v11 = v7; /*0xffd74071*/
LABEL_41:
*a3 = v11; /*0xffd74073*/
LABEL_42:
*a2 = -87; /*0xffd74078*/
LABEL_43:
result = 0; /*0xffd7407b*/
break; /*0xffd7407d*/
default:
return -2147483646;
}
return result; /*0xffd74084*/
}
// Function: WdtGetRegisterBase @ 0xffd740f5 (0x17 bytes)
int __fastcall WdtGetRegisterBase(int a1)
{
int v2; // [esp+0h] [ebp-4h] BYREF
v2 = a1; /*0xffd740f8*/
DebugLogPrint_15(&v2); /*0xffd740fc*/
return (unsigned __int16)v2 + 84; /*0xffd7410a*/
}
// Function: Assert_9 @ 0xffd7410c (0x93 bytes)
int __cdecl sub_FFD7410C(unsigned int n10)
{
unsigned __int16 v1; // ax
unsigned __int32 v2; // eax
int v3; // esi
unsigned int v4; // esi
unsigned __int16 v5; // ax
unsigned __int16 v6; // ax
DebugPrintAssert(64, "\n(Wdt) ReloadAndStartTimer(%d)\n", n10); /*0xffd7411a*/
if ( n10 > 0x3FF || !n10 ) /*0xffd7412d*/
return -2147483646; /*0xffd74197*/
v1 = WdtGetRegisterBase(); /*0xffd74130*/
v2 = GpioCheckPadOwnership(v1); /*0xffd74137*/
v3 = v2 | 0xE000; /*0xffd7413e*/
if ( !byte_FFD7ED58 ) /*0xffd7414b*/
v3 = v2 | 0x40E000; /*0xffd7414d*/
DebugPrintAssert(64, "(Wdt) Wdt disabled in Debug BIOS\n"); /*0xffd74160*/
v4 = (v3 & 0xFFBF3FFF ^ (n10 - 1)) & 0x3FF ^ v3 & 0xFFBF3FFF; /*0xffd7416e*/
v5 = WdtGetRegisterBase(); /*0xffd74170*/
Assert_20(v5, v4); /*0xffd74179*/
v6 = WdtGetRegisterBase(); /*0xffd74184*/
Assert_20(v6, v4 | 0x80000000); /*0xffd7418d*/
return 0; /*0xffd7419c*/
}
// Function: Assert_21 @ 0xffd7419f (0x32 bytes)
unsigned int sub_FFD7419F()
{
unsigned __int16 v0; // ax
unsigned int v1; // esi
unsigned __int16 v2; // ax
DebugPrintAssert(64, "(Wdt) DisableTimer\n"); /*0xffd741a7*/
v0 = WdtGetRegisterBase(); /*0xffd741ae*/
v1 = GpioCheckPadOwnership(v0) & 0xFFBF3FFF; /*0xffd741bc*/
v2 = WdtGetRegisterBase(); /*0xffd741c2*/
return Assert_20(v2, v1); /*0xffd741cb*/
}
// Function: PchPcrRead @ 0xffd741d1 (0x50 bytes)
int __thiscall PchPcrRead(_BYTE *this)
{
int result; // eax
int PadConfig; // esi
bool v4; // zf
bool p_n7; // [esp+7h] [ebp-1h] BYREF
GpioLockGpios(); /*0xffd741d8*/
result = PchGpioInit(); /*0xffd741dd*/
if ( (*this & 1) == 0 ) /*0xffd741e5*/
{
PadConfig = GpioGetPadConfig(0, 31, 1); /*0xffd741f4*/
result = GpioIsPadValid(PadConfig, &p_n7); /*0xffd741fb*/
v4 = !p_n7; /*0xffd74209*/
*(_BYTE *)(PadConfig + 227) |= 0x80u; /*0xffd7420d*/
if ( v4 ) /*0xffd74213*/
*(_BYTE *)(PadConfig + 225) = 1; /*0xffd74215*/
}
return result; /*0xffd7421c*/
}
// Function: PchPcrWrite @ 0xffd74221 (0x91 bytes)
char __thiscall PchPcrWrite(_BYTE *this)
{
char result; // al
int PadConfig; // esi
unsigned int i; // edi
unsigned int v5; // ecx
bool v6; // zf
_DWORD v7[2]; // [esp+4h] [ebp-10h]
__int16 n13857; // [esp+Ch] [ebp-8h]
bool p_n7; // [esp+13h] [ebp-1h] BYREF
v7[0] = -1111704646; /*0xffd74231*/
v7[1] = 687960207; /*0xffd74238*/
n13857 = 13857; /*0xffd7423f*/
result = DebugPrintAssert(64, "RemovePsfAccess\n"); /*0xffd74245*/
if ( (*this & 2) == 0 ) /*0xffd7424f*/
{
PadConfig = GpioGetPadConfig(0, 31, 1); /*0xffd7425f*/
GpioIsPadValid(PadConfig, &p_n7); /*0xffd74266*/
for ( i = 0; i < 0xA; ++i ) /*0xffd7426b*/
{
v5 = *((unsigned __int8 *)v7 + i); /*0xffd74272*/
*(_DWORD *)(PadConfig + 4 * (v5 >> 5) + 544) |= 1 << (v5 & 0x1F); /*0xffd74285*/
}
result = *(_BYTE *)(PadConfig + 226) | 2; /*0xffd74297*/
v6 = !p_n7; /*0xffd74299*/
*(_BYTE *)(PadConfig + 226) = result; /*0xffd7429d*/
if ( v6 ) /*0xffd742a4*/
*(_BYTE *)(PadConfig + 225) = 1; /*0xffd742a6*/
}
return result; /*0xffd742ad*/
}
// Function: Assert_16 @ 0xffd742b2 (0x4f bytes)
int __fastcall sub_FFD742B2(unsigned __int8 a1)
{
int v2; // edi
unsigned int v3; // esi
unsigned __int16 v5; // [esp+Ch] [ebp-4h] BYREF
DebugLogPrint_15(&v5); /*0xffd742be*/
v2 = v5 + 48; /*0xffd742c7*/
v3 = GpioCheckPadOwnership(v5 + 48) | 0x21; /*0xffd742d3*/
DebugPrintAssert(64, "The SMI Control Port at address %x will be written to %x.\n", v2, v3); /*0xffd742df*/
Assert_20(v2, v3); /*0xffd742eb*/
__outbyte(0xB2u, a1); /*0xffd742f7*/
return 0; /*0xffd742f8*/
}
// Function: Assert_7 @ 0xffd74301 (0x9e bytes)
int sub_FFD74301()
{
int v0; // edi
unsigned int v1; // esi
unsigned __int16 v3; // [esp+8h] [ebp-4h] BYREF
DebugLogPrint_15(&v3); /*0xffd7430a*/
v0 = v3; /*0xffd7430f*/
DebugPrintAssert(64, "The PM1 Status Port at address %x will be written to %x.\n", v3, 2048); /*0xffd74321*/
Assert_18(v0, 0x800u); /*0xffd7432a*/
DebugPrintAssert(64, "The SMI Status Port at address %x will be written to %x.\n", v0 + 52, 32); /*0xffd7433c*/
Assert_20(v0 + 52, 0x20u); /*0xffd74346*/
v0 += 48; /*0xffd7434b*/
v1 = GpioCheckPadOwnership(v0) | 2; /*0xffd74357*/
DebugPrintAssert(64, "The SMI Control Port at address %x will be written to %x.\n", v0, v1); /*0xffd74363*/
Assert_20(v0, v1); /*0xffd7436f*/
if ( (GpioCheckPadOwnership(v0) & 2) != 0 ) /*0xffd7437f*/
return 0; /*0xffd74399*/
DebugPrintAssert(0x80000000, "Bugger, EOS did not get set!\n"); /*0xffd7438b*/
return -2147483641; /*0xffd7439b*/
}
// Function: Assert_15 @ 0xffd7439f (0x50 bytes)
int __cdecl sub_FFD7439F(int a1, int a2, unsigned __int8 *a3, _DWORD *a4, char a5)
{
int result; // eax
unsigned __int8 v6; // bl
if ( a5 ) /*0xffd743a4*/
{
DebugPrintAssert(2, "Invalid parameter\n"); /*0xffd743ad*/
return -2147483646; /*0xffd743b9*/
}
if ( a3 ) /*0xffd743c1*/
{
if ( !a4 || *a4 != 1 ) /*0xffd743d3*/
return -2147483646; /*0xffd743e8*/
v6 = *a3; /*0xffd743d5*/
}
else
{
v6 = -1; /*0xffd743c3*/
}
result = Assert_7(); /*0xffd743d7*/
if ( result >= 0 ) /*0xffd743de*/
return Assert_16(v6); /*0xffd743e3*/
return result; /*0xffd743b9*/
}
// Function: SiConditionalAssert @ 0xffd743ef (0x12 bytes)
int __cdecl SiConditionalAssert(int a1, int a2, char a3)
{
if ( a3 ) /*0xffd743f4*/
return -2147483646; /*0xffd743f6*/
else
return Assert_7(); /*0xffd743fc*/
}
// Function: AssertCpuDeadLoop_2 @ 0xffd74401 (0xda bytes)
int __fastcall AssertCpuDeadLoop_2(int a1, _WORD *a2)
{
int BootMode; // eax
int v5; // eax
int v6; // eax
int v7; // esi
int n498; // [esp+8h] [ebp-10h] BYREF
__int16 v9; // [esp+Ch] [ebp-Ch]
int (__cdecl **v10)(_DWORD, int *, int, int *, _DWORD, int); // [esp+10h] [ebp-8h] BYREF
int n8; // [esp+14h] [ebp-4h] BYREF
if ( MeConfigIsType255() ) /*0xffd7440b*/
return -2147483645; /*0xffd74414*/
BootMode = PeiServicesGetBootMode(); /*0xffd7441e*/
v5 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int (__cdecl ***)(_DWORD, int *, int, int *, _DWORD, int)))(*(_DWORD *)BootMode + 32))( /*0xffd74433*/
BootMode,
&unk_FFD7AEA4,
0,
0,
&v10);
if ( v5 >= 0 ) /*0xffd7443b*/
{
n498 = 498; /*0xffd7447b*/
n8 = 8; /*0xffd74488*/
v7 = (*v10)(0, &n498, 4, &n8, 0, 7); /*0xffd74496*/
if ( v7 < 0 || (_BYTE)n498 != 0xF2 || (n498 & 0x7F00) != 0x100 || (n498 & 0x8000) == 0 || (n498 & 0xFF000000) != 0 ) /*0xffd744c5*/
v7 = -2147483641; /*0xffd744c7*/
*a2 = v9; /*0xffd744d0*/
return v7; /*0xffd744d3*/
}
else
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0xffd74448*/
v6 = DebugAssert(); /*0xffd74450*/
if ( v6 ) /*0xffd74457*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffd74468*/
"e:\\hs\\PurleySktPkg\\Me\\Heci\\Library\\HeciMsgPeiLib\\HeciMsgPeiLib.c",
303,
"!EFI_ERROR (Status)");
return -2147483634; /*0xffd7446e*/
}
}
// Function: AssertCpuDeadLoop @ 0xffd744db (0x24e bytes)
int __fastcall AssertCpuDeadLoop(char *src, unsigned int n2988)
{
int v4; // eax
int BootMode; // eax
int v7; // eax
int v8; // eax
int v9; // eax
int v10; // eax
int v11; // edi
int v12; // eax
char *v13; // eax
char *v14; // ebx
int v15; // eax
int v16; // edi
int v17; // [esp+10h] [ebp-Ch] BYREF
void (__cdecl **v18)(_DWORD, _DWORD); // [esp+14h] [ebp-8h] BYREF
int (__cdecl **v19)(_DWORD, void *, int, int *, _DWORD, int); // [esp+18h] [ebp-4h] BYREF
DebugPrintAssert(64, "PeiHeciChipsetInitSyncMsg(0x%08X, %d): Start\n", src, n2988);
if ( n2988 > 0x1000 ) /*0xffd744fd*/
{
v4 = DebugAssert(); /*0xffd744ff*/
if ( v4 ) /*0xffd74506*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd74517*/
"e:\\hs\\PurleySktPkg\\Me\\Heci\\Library\\HeciMsgPeiLib\\HeciMsgPeiLib.c",
440,
"ChipsetInitTableLen <= 4096");
return -2147483641; /*0xffd74522*/
}
if ( MeConfigIsType255() )
{
DebugPrintAssert(2, "(HSIO) WARNING: ME disabled - HSIO update is not sent.\n");
return -2147483645; /*0xffd7471a*/
}
if ( (unsigned __int8)SmBusIsV2Controller()
|| DebugLogPrint_8() == 2 && (*(_DWORD *)(GpioGetPadConfig(0, 22, 0) + 64) & 0xF0000) == 0x40000 )
{
DebugPrintAssert(2, "(HSIO) WARNING: ME in recovery mode does not support HSIO sync\n");
return -2147483645; /*0xffd74715*/
}
BootMode = PeiServicesGetBootMode(); /*0xffd74572*/
v7 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int (__cdecl ***)(_DWORD, void *, int, int *, _DWORD, int)))(*(_DWORD *)BootMode + 32))( /*0xffd74586*/
BootMode,
&unk_FFD7AEA4,
0,
0,
&v19);
if ( v7 >= 0 )
{
v9 = PeiServicesGetBootMode(); /*0xffd745cb*/
v10 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, void (__cdecl ***)(_DWORD, _DWORD)))(*(_DWORD *)v9 + 32))( /*0xffd745df*/
v9,
&unk_FFD7AE74,
0,
0,
&v18);
v11 = v10; /*0xffd745e2*/
if ( v10 >= 0 )
{
v17 = n2988 + 24; /*0xffd74640*/
v13 = (char *)PeiGetInfoAlloc((void *)(n2988 + 24)); /*0xffd74644*/
v14 = v13; /*0xffd74649*/
if ( v13 )
{
*(_DWORD *)v13 = 0x40000; /*0xffd74668*/
*((_DWORD *)v13 + 1) = 25; /*0xffd74671*/
*((_DWORD *)v13 + 3) = v17 - 20; /*0xffd74682*/
MemConfig(v13 + 24, src, n2988); /*0xffd74685*/
v15 = (*v19)(0, v14, v17, &v17, 0, 8); /*0xffd7469f*/
v16 = v15; /*0xffd746a1*/
if ( v15 >= 0 )
{
if ( *((_DWORD *)v14 + 2) || *((_DWORD *)v14 + 1) != 25 )
{
DebugPrintAssert(
0x80000000,
"(HSIO) ERROR: Write HSIO Settings failed!: FW Response=0x%x\n",
*((_DWORD *)v14 + 2));
v16 = -2147483641; /*0xffd746d6*/
}
}
else
{
DebugPrintAssert(0x80000000, "(HSIO) ERROR: Write HSIO Settings Message failed! EFI_STATUS = %r\n", v15);
}
if ( v16 >= 0 && v18 )
{
DebugPrintAssert(0x80000000, "PeiHeciChipsetInitSyncMsg(): Reset required for ChipsetInit Settings synch\n");
(*v18)(v18, 0); /*0xffd746f9*/
}
DebugPrintAssert(64, "PeiHeciChipsetInitSyncMsg(): End\n");
return v16; /*0xffd7470a*/
}
else
{
DebugPrintAssert(0x80000000, "(HSIO) PeiHeciChipsetInitSyncMsg: Could not allocate Memory\n");
return -2147483627; /*0xffd7465e*/
}
}
else
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v10); /*0xffd745f7*/
v12 = DebugAssert(); /*0xffd745ff*/
if ( v12 ) /*0xffd74606*/
(*(void (__cdecl **)(const char *, int, const char *))(v12 + 4))( /*0xffd74617*/
"e:\\hs\\PurleySktPkg\\Me\\Heci\\Library\\HeciMsgPeiLib\\HeciMsgPeiLib.c",
473,
"!EFI_ERROR (Status)");
DebugPrintAssert(0x80000000, "(HSIO) ERROR: \n");
DebugPrintAssert(0x80000000, "PchResetPpi not found.\n"); /*0xffd7462e*/
return v11; /*0xffd74636*/
}
}
else
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v7); /*0xffd7459b*/
v8 = DebugAssert(); /*0xffd745a3*/
if ( v8 ) /*0xffd745aa*/
(*(void (__cdecl **)(const char *, int, const char *))(v8 + 4))( /*0xffd745bb*/
"e:\\hs\\PurleySktPkg\\Me\\Heci\\Library\\HeciMsgPeiLib\\HeciMsgPeiLib.c",
462,
"!EFI_ERROR (Status)");
return -2147483634; /*0xffd745c1*/
}
}
// Function: GpioGetInfo @ 0xffd74729 (0x7b bytes)
int __fastcall sub_FFD74729(unsigned __int8 a1)
{
int v1; // ecx
int v3; // eax
if ( (unsigned __int8)(a1 - 14) > 1u ) /*0xffd7472e*/
{
v3 = DebugAssert(); /*0xffd74780*/
if ( v3 ) /*0xffd74787*/
(*(void (__cdecl **)(const char *, int, const char *))(v3 + 4))( /*0xffd74798*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiDxeSmmGpioPrivateLib\\GpioPrivateLib.c",
244,
"((BOOLEAN)(0==1))");
return -2147483646; /*0xffd7479e*/
}
else
{
v1 = 8 * a1 - 112; /*0xffd74736*/
MEMORY[0xFDAF0010] = v1 | MEMORY[0xFDAF0010] & 0xFFFFFFF7; /*0xffd74748*/
MEMORY[0xFDAE0010] = v1 | MEMORY[0xFDAE0010] & 0xFFFFFFF7; /*0xffd74758*/
MEMORY[0xFDAD0010] = v1 | MEMORY[0xFDAD0010] & 0xFFFFFFF7; /*0xffd74768*/
MEMORY[0xFDAC0010] = v1 | MEMORY[0xFDAC0010] & 0xFFFFFFF7; /*0xffd74778*/
return 0; /*0xffd7477d*/
}
}
// Function: DebugLogPrint_23 @ 0xffd747a4 (0x20 bytes)
int __fastcall sub_FFD747A4(int n2)
{
if ( DebugLogPrint_5(*(_DWORD *)(8 * n2 - 2626448), *(_DWORD *)(8 * n2 - 2626444)) >= 0 ) /*0xffd747b9*/
return 0; /*0xffd747c1*/
else
return -2147483645; /*0xffd747bb*/
}
// Function: DebugLogPrint_17 @ 0xffd747c4 (0x84 bytes)
unsigned __int8 __fastcall DebugLogPrint_17(unsigned __int8 a1)
{
int v1; // esi
char n16; // bl
int PadConfig; // edi
char i; // al
unsigned __int8 n0x3F; // al
int v6; // eax
v1 = a1; /*0xffd747c6*/
n16 = 0; /*0xffd747c9*/
PadConfig = GpioGetPadConfig(a1, 0, 0); /*0xffd747e2*/
DebugPrintAssert(64, "PcieFindCapId () BDF %0x: %0x :%0x, CapId = %0x \n", v1, 0, 0, 16);
if ( (*(_BYTE *)(PadConfig + 6) & 0x10) != 0 )
{
for ( i = *(_BYTE *)(((*(_BYTE *)(PadConfig + 14) & 0x7F) == 2 ? 0 : 0x20) + PadConfig + 20);
;
i = *(_BYTE *)(n0x3F + PadConfig + 1) )
{
n0x3F = i & 0xFC; /*0xffd7481d*/
if ( !n0x3F || n16 == -1 ) /*0xffd7480c*/
break; /*0xffd7480c*/
n16 = *(_BYTE *)(n0x3F + PadConfig); /*0xffd74811*/
if ( n16 == 16 ) /*0xffd74817*/
{
if ( n0x3F > 0x3Fu ) /*0xffd74825*/
return n0x3F; /*0xffd74825*/
v6 = DebugAssert(); /*0xffd74827*/
if ( v6 ) /*0xffd7482e*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffd7483c*/
"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\LibraryPrivate\\PeiDxeSmmPchPciExpressHelpersLib\\PchPciExpressHelpersLibrary.c",
97,
"(((BOOLEAN)(0==1)))");
return 0; /*0xffd7483c*/
}
}
}
return 0; /*0xffd74844*/
}
// Function: PeiMePolicyUpdate @ 0xffd74848 (0x15d bytes)
int __thiscall PeiMePolicyUpdate(_DWORD *this)
{
int Info; // eax
int Info_1; // esi
int n2; // edx
int v6; // eax
int n2_1; // edx
int v8; // eax
int n2_2; // edx
int v10; // eax
int n2_3; // edx
int v12; // eax
int n2_4; // edx
bool v14; // al
int v15; // ecx
unsigned int v16; // edx
int v17; // eax
int v18; // ecx
int v19; // [esp+8h] [ebp-68h] BYREF
char v20; // [esp+10h] [ebp-60h]
unsigned __int8 v21; // [esp+11h] [ebp-5Fh]
char v22; // [esp+12h] [ebp-5Eh]
char v23; // [esp+13h] [ebp-5Dh]
unsigned __int8 n2_5; // [esp+14h] [ebp-5Ch]
unsigned __int8 n2_6; // [esp+15h] [ebp-5Bh]
unsigned __int8 n2_7; // [esp+16h] [ebp-5Ah]
unsigned __int8 n2_8; // [esp+17h] [ebp-59h]
unsigned __int8 n2_9; // [esp+18h] [ebp-58h]
char v29; // [esp+19h] [ebp-57h]
char v30; // [esp+1Ah] [ebp-56h]
char v31; // [esp+1Bh] [ebp-55h]
unsigned __int8 v32; // [esp+1Ch] [ebp-54h]
char v33; // [esp+1Dh] [ebp-53h]
char v34; // [esp+1Eh] [ebp-52h]
Info = NetGetInfo(this, (int)&v19); /*0xffd74858*/
Info_1 = Info; /*0xffd7485d*/
if ( Info >= 0 )
{
n2 = n2_5; /*0xffd7488c*/
*(this + 2) = ((v20 & 1) << 10) | *(this + 2) & 0xFFFFFA01 | (2 * v21) & 0xFBFF; /*0xffd748a8*/
v6 = Assert_3(0, n2); /*0xffd748ae*/
n2_1 = n2_6; /*0xffd748b3*/
*(this + 2) ^= (*(this + 2) ^ (v6 << 14)) & 0xC000; /*0xffd748c5*/
v8 = Assert_3(1, n2_1); /*0xffd748c8*/
n2_2 = n2_7; /*0xffd748cd*/
*(this + 2) ^= (*(this + 2) ^ (v8 << 16)) & 0x30000; /*0xffd748dd*/
v10 = Assert_3(4, n2_2); /*0xffd748e3*/
n2_3 = n2_8; /*0xffd748e8*/
*(this + 2) ^= (*(this + 2) ^ (v10 << 18)) & 0xC0000; /*0xffd748f8*/
v12 = Assert_3(2, n2_3); /*0xffd748fe*/
n2_4 = n2_9; /*0xffd74903*/
*(this + 2) ^= (*(this + 2) ^ (v12 << 20)) & 0x300000; /*0xffd74913*/
v14 = Assert_3(3, n2_4); /*0xffd74919*/
v15 = v32 << 29; /*0xffd7493e*/
v16 = *(this + 2) & 0xFC3FFFFF | ((v14 & 3 | (4 * (v30 & 1 | (2 * (v22 & 1))))) << 22); /*0xffd7494c*/
v17 = v29 & 1; /*0xffd74953*/
*(this + 2) = v16; /*0xffd74955*/
v18 = *(this + 3) & 0x7FFFFFF8 | v23 & 3 | (4 * (v17 | v15)); /*0xffd7496f*/
LOBYTE(v17) = v34; /*0xffd74971*/
*(this + 3) = v18; /*0xffd74976*/
*(this + 4) = *(this + 4) & 0xFFFFFFEC | v33 & 1 | (2 * (v17 & 1 | (8 * (v31 & 1)))); /*0xffd7499c*/
return 0; /*0xffd7499a*/
}
else
{
DebugPrintAssert(0x80000000, "[ME] ERROR: Cannot find ME RC Variable, policy update failed (%r)\n", Info);
return Info_1; /*0xffd74876*/
}
}
// Function: Assert_1 @ 0xffd749a5 (0x1aa bytes)
int __fastcall sub_FFD749A5(int a1, int a2)
{
DebugPrintAssert(64, "SPS Config Revision : %d\n", *(_DWORD *)a2);
DebugPrintAssert(64, " SpsAltitude : 0x%x\n", *(unsigned __int16 *)(a2 + 4));
DebugPrintAssert(64, " SpsMctpBusOwner : 0x%x\n", *(unsigned __int16 *)(a2 + 6));
DebugPrintAssert(64, " PreDidMeResetEnabled : 0x%x\n", *(_DWORD *)(a2 + 8) & 1);
DebugPrintAssert(64, " Heci1HideInMe : %d\n", (*(_DWORD *)(a2 + 8) >> 1) & 3);
DebugPrintAssert(64, " Heci2HideInMe : %d\n", (*(_DWORD *)(a2 + 8) >> 3) & 3);
DebugPrintAssert(64, " Heci3HideInMe : %d\n", (*(_DWORD *)(a2 + 8) >> 5) & 3);
DebugPrintAssert(64, " NmPwrOptBoot : %d\n", *(_DWORD *)(a2 + 12) & 1);
DebugPrintAssert(64, " NmCores2Disable : %d\n", (*(_DWORD *)(a2 + 12) >> 1) & 0x7F);
DebugPrintAssert(64, " MeHmrfpoEnableEnabled : %d\n", (*(_DWORD *)(a2 + 16) >> 9) & 1);
DebugPrintAssert(64, " MeHmrfpoLockEnabled : %d\n", (*(_DWORD *)(a2 + 16) >> 8) & 1);
DebugPrintAssert(64, " NmPwrOptBootOverride : %d\n", (*(_DWORD *)(a2 + 16) >> 15) & 1);
DebugPrintAssert(64, " NmCores2DisableOverride : %d\n", *(_WORD *)(a2 + 18) & 1);
DebugPrintAssert(64, " NmPowerMsmtOverride : %d\n", (*(_DWORD *)(a2 + 16) >> 17) & 1);
DebugPrintAssert(64, " NmPowerMsmtSupport : %d\n", (*(_DWORD *)(a2 + 16) >> 18) & 1);
DebugPrintAssert(64, " NmHwChangeOverride : %d\n", (*(_DWORD *)(a2 + 16) >> 19) & 1);
DebugPrintAssert(64, " NmHwChangeStatus : %d\n", (*(_DWORD *)(a2 + 16) >> 20) & 1);
DebugPrintAssert(64, " NmPtuLoadOverride : %d\n", (*(_DWORD *)(a2 + 16) >> 21) & 1);
DebugPrintAssert(64, " MeGrLockEnabled : %d\n", (*(_DWORD *)(a2 + 16) >> 10) & 1);
DebugPrintAssert(64, " MeGrPromotionEnabled : %d\n", (*(_DWORD *)(a2 + 16) >> 11) & 1);
return DebugPrintAssert(64, " BreakRtcEnabled : %d\n", (*(_DWORD *)(a2 + 16) >> 12) & 1);
}
// Function: MeSpsPolicyPrint @ 0xffd74b4f (0xc8 bytes)
int MeSpsPolicyPrint()
{
int BootMode; // eax
int v1; // eax
int v2; // eax
int v3; // eax
int v4; // ecx
_DWORD *v6; // [esp+Ch] [ebp-4h] BYREF
DebugPrintAssert(64, "\n---------------------- MePolicyPpi Dump Begin -----------------\n"); /*0xffd74b5f*/
BootMode = PeiServicesGetBootMode(); /*0xffd74b64*/
v1 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, _DWORD **))(*(_DWORD *)BootMode + 32))( /*0xffd74b79*/
BootMode,
&unk_FFD7ADB4,
0,
0,
&v6);
if ( v1 >= 0 )
DebugLogPrint_19(v6); /*0xffd74b9c*/
else
DebugPrintAssert(0x80000000, "[SPS] ERROR: ME Policy PPI not found (%r)\n", v1);
DebugPrintAssert(64, "\n---------------------- MePolicyPpi Dump End -------------------\n"); /*0xffd74ba7*/
DebugPrintAssert(64, "\n---------------------- SpsPolicyPpi Dump Begin ----------------\n"); /*0xffd74bb2*/
v2 = PeiServicesGetBootMode(); /*0xffd74bb7*/
v3 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, _DWORD **))(*(_DWORD *)v2 + 32))(v2, &unk_FFD7ADC4, 0, 0, &v6); /*0xffd74bca*/
if ( v3 >= 0 )
{
DebugPrintAssert(64, "SPS Policy PPI Revision : %d\n", *v6);
Assert_1(v4, (int)(v6 + 1)); /*0xffd74bfe*/
}
else
{
DebugPrintAssert(0x80000000, "[SPS] ERROR: SPS policy PPI not found (%r)\n", v3);
}
return DebugPrintAssert(64, "\n---------------------- SpsPolicyPpi Dump End ------------------\n"); /*0xffd74c10*/
}
// Function: MePolicyPrint @ 0xffd74c17 (0x108 bytes)
int __thiscall MePolicyPrint(int this)
{
int v2; // eax
int v3; // edx
int v5; // eax
char v6; // cl
_DWORD v7[7]; // [esp+4h] [ebp-68h] BYREF
unsigned __int8 v8; // [esp+20h] [ebp-4Ch]
char v9; // [esp+26h] [ebp-46h]
char v10; // [esp+27h] [ebp-45h]
char v11; // [esp+28h] [ebp-44h]
char v12; // [esp+29h] [ebp-43h]
char v13; // [esp+2Ah] [ebp-42h]
char v14; // [esp+2Bh] [ebp-41h]
char v15; // [esp+2Ch] [ebp-40h]
char v16; // [esp+2Dh] [ebp-3Fh]
char v17; // [esp+2Eh] [ebp-3Eh]
char v18; // [esp+2Fh] [ebp-3Dh]
char v19; // [esp+30h] [ebp-3Ch]
char v20; // [esp+31h] [ebp-3Bh]
char v21; // [esp+32h] [ebp-3Ah]
char v22; // [esp+33h] [ebp-39h]
char v23; // [esp+34h] [ebp-38h]
char v24; // [esp+35h] [ebp-37h]
char v25; // [esp+36h] [ebp-36h]
v2 = NetGetInfo((_DWORD *)this, v7); /*0xffd74c23*/
v3 = v2; /*0xffd74c28*/
if ( v2 >= 0 )
{
v5 = (*(_DWORD *)(this + 12) ^ v8) & 1; /*0xffd74c71*/
*(_DWORD *)(this + 16) = *(_DWORD *)(this + 16) & 0xFFFFFF00 | v9 & 1 | (2 * (v10 & 0x7F)); /*0xffd74c73*/
*(_DWORD *)(this + 12) ^= v5; /*0xffd74c76*/
v6 = v25; /*0xffd74c7c*/
*(_BYTE *)(this + 20) = v11; /*0xffd74c80*/
*(_DWORD *)(this + 20) = *(_DWORD *)(this + 20) & 0xFFC000FF /*0xffd74d16*/
| ((v12 & 1
| (2
* (v13 & 1
| (2
* (v14 & 1
| (2
* (v15 & 1
| (2
* (v16 & 1
| (2
* (v17 & 1
| (2
* (v18 & 1
| (2
* (v19 & 1
| (2
* (v20 & 1
| (2
* (v21 & 1
| (2 * (v22 & 1 | (2 * (v23 & 1 | (2 * (v24 & 1 | (2 * (v6 & 1))))))))))))))))))))))))))) << 8);
return v3; /*0xffd74d14*/
}
else
{
DebugPrintAssert(0x80000000, "[SPS Policy] ERROR: ME Variable not found (%r)\n", v2);
return -2147483634; /*0xffd74c41*/
}
}
// Function: PeiAmtInitPostMem @ 0xffd74d1f (0x15c bytes)
int PeiAmtInitPostMem()
{
int result; // eax
int BootMode; // eax
int v2; // eax
unsigned __int8 *v3; // edi
int v4; // esi
int *v5; // edi
int v6; // ebx
_DWORD *v7; // ebp
int n6; // esi
_DWORD *v9; // eax
int v10; // esi
int v11; // ecx
bool v12; // zf
unsigned __int8 *v13; // [esp+14h] [ebp-Ch] BYREF
int v14; // [esp+18h] [ebp-8h]
int n3; // [esp+1Ch] [ebp-4h]
if ( SmmGetInfo() )
return DebugPrintAssert(64, "DWR detected : ME FW HOB not installed\n");
v13 = (unsigned __int8 *)AssertCpuDeadLoop_9((char *)dword_FFD7ADD4); /*0xffd74d54*/
n3 = 3; /*0xffd74d5b*/
if ( !v13 ) /*0xffd74d61*/
{
BootMode = PeiServicesGetBootMode(); /*0xffd74d67*/
v2 = (*(int (__cdecl **)(int, int, int, unsigned __int8 **))(*(_DWORD *)BootMode + 52))(BootMode, 4, 168, &v13); /*0xffd74d7b*/
if ( v2 < 0 ) /*0xffd74d83*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v2); /*0xffd74d90*/
result = DebugAssert(); /*0xffd74d98*/
if ( result ) /*0xffd74d9f*/
return (*(int (__cdecl **)(const char *, int, const char *))(result + 4))( /*0xffd74db1*/
"e:\\hs\\PurleySktPkg\\Me\\AMT\\Library\\AmtLibPei\\MeInitPostMem.c",
84,
"!EFI_ERROR (Status)");
return result; /*0xffd74db7*/
}
DebugPrintAssert(64, "ME FW HOB installed\n"); /*0xffd74dc3*/
MemConfig_0((int)(v13 + 24), 0x90u); /*0xffd74dd6*/
v3 = v13 + 8; /*0xffd74ddf*/
*((_DWORD *)v13 + 2) = dword_FFD7ADD4[0]; /*0xffd74de2*/
v3 += 4; /*0xffd74de2*/
*(_DWORD *)v3 = dword_FFD7ADD4[1]; /*0xffd74de3*/
v3 += 4; /*0xffd74de3*/
*(_DWORD *)v3 = dword_FFD7ADD4[2]; /*0xffd74de4*/
*((_DWORD *)v3 + 1) = dword_FFD7ADD4[3]; /*0xffd74de5*/
v13[24] = 1; /*0xffd74dea*/
v13[25] = 3; /*0xffd74df2*/
}
DebugPrintAssert(64, "ME FW HOB data updated\n"); /*0xffd74dfc*/
v4 = 0; /*0xffd74e02*/
v5 = (int *)&unk_FFD79DC8; /*0xffd74e04*/
v14 = 0; /*0xffd74e0a*/
do /*0xffd74e5a*/
{
v6 = v4 + 32; /*0xffd74e10*/
v7 = &unk_FFD79DD4; /*0xffd74e13*/
n6 = 6; /*0xffd74e18*/
do /*0xffd74e3b*/
{
v9 = (_DWORD *)(*v7++ + GpioGetPadConfig(0, 22, *v5)); /*0xffd74e25*/
*(_DWORD *)&v13[v6] = *v9; /*0xffd74e32*/
v6 += 4; /*0xffd74e35*/
--n6; /*0xffd74e38*/
}
while ( n6 ); /*0xffd74e3b*/
v10 = v14; /*0xffd74e3d*/
v11 = *v5++; /*0xffd74e45*/
*(_DWORD *)&v13[v14 + 28] = v11; /*0xffd74e4a*/
v4 = v10 + 28; /*0xffd74e4e*/
v12 = n3-- == 1; /*0xffd74e51*/
v14 = v4; /*0xffd74e56*/
}
while ( !v12 ); /*0xffd74e5a*/
DebugPrintAssert(64, "Current ME FW HOB data printed - \n"); /*0xffd74e63*/
return Assert_6(v13); /*0xffd74e73*/
}
// Function: SpiCalcAddress @ 0xffd74e7b (0x1e bytes)
int *__cdecl SpiCalcAddress(int a1, int a2, _DWORD *a3, int *a4)
{
int v4; // ecx
v4 = SpiGetBaseAddr((int)a3) + (*a3 & 0xFFFFFFF); /*0xffd74e8f*/
*a4 = v4; /*0xffd74e96*/
return a4; /*0xffd74e95*/
}
// Function: AssertCpuDeadLoop_6 @ 0xffd74e99 (0x58 bytes)
void *__thiscall AssertCpuDeadLoop_6(void *this)
{
int BootMode; // eax
int v2; // eax
int v3; // eax
void *this_1; // [esp+0h] [ebp-4h]
this_1 = this; /*0xffd74e9c*/
BootMode = PeiServicesGetBootMode(); /*0xffd74e9d*/
v2 = (*(int (__stdcall **)(int))(*(_DWORD *)BootMode + 32))(BootMode); /*0xffd74eb2*/
if ( v2 < 0 ) /*0xffd74eba*/
{
DebugPrintAssert(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v2); /*0xffd74ec7*/
v3 = DebugAssert(); /*0xffd74ecf*/
if ( v3 ) /*0xffd74ed6*/
(*(void (__cdecl **)(const char *, int, const char *))(v3 + 4))( /*0xffd74ee4*/
"e:\\hs\\MdePkg\\Library\\PeiPcdLib\\PeiPcdLib.c",
49,
"!EFI_ERROR (Status)");
}
return this_1; /*0xffd74eef*/
}
// Function: PciGetInfo @ 0xffd74f1b (0x30 bytes)
char __thiscall sub_FFD74F1B(unsigned int n1024068)
{
int v2; // eax
if ( (n1024068 & 0xF0000000) != 0 ) /*0xffd74f24*/
{
v2 = DebugAssert(); /*0xffd74f26*/
if ( v2 ) /*0xffd74f2d*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd74f3b*/
"e:\\hs\\MdePkg\\Library\\BasePciExpressLib\\PciExpressLib.c",
109,
"((Address) & ~0xfffffff) == 0");
}
return *(_BYTE *)(sub_FFD74F0F() + n1024068); /*0xffd74f49*/
}
// Function: PciExpressSetFlag @ 0xffd74f4b (0x16 bytes)
int PciExpressSetFlag()
{
int v0; // eax
v0 = sub_FFD74F0F(); /*0xffd74f4b*/
return GpioGetGroupIndexFromPad(v0 + 1024064, 1280);
}
// Function: DebugLogPrint_19 @ 0xffd74f61 (0x58 bytes)
int __thiscall sub_FFD74F61(_DWORD *this)
{
int v2; // eax
DebugPrintAssert(64, "\n---------------------- ME Policy PPI Begin ----------------------\n"); /*0xffd74f6b*/
DebugPrintAssert(64, "ME Policy PPI Revision : %d\n", *this);
if ( *this != 1 ) /*0xffd74f84*/
{
v2 = DebugAssert(); /*0xffd74f86*/
if ( v2 ) /*0xffd74f8d*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd74f9b*/
"e:\\hs\\PurleyPlatPkg\\Me\\Policy\\AMT\\Library\\PeiMePolicyLib\\MePrintPolicy.c",
44,
"MePolicyPpi->Revision == 1");
}
DebugLogPrint_1(this + 1); /*0xffd74fa4*/
return DebugPrintAssert(64, "\n---------------------- ME Policy PPI End ------------------------\n"); /*0xffd74fb7*/
}
// Function: DebugLogPrint_1 @ 0xffd74fb9 (0x1cf bytes)
int __thiscall sub_FFD74FB9(_DWORD *this)
{
int v2; // eax
DebugPrintAssert(64, "ME Config Revision : %d\n", *this);
if ( *this != 1 ) /*0xffd74fd7*/
{
v2 = DebugAssert(); /*0xffd74fd9*/
if ( v2 ) /*0xffd74fe0*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffd74fee*/
"e:\\hs\\PurleyPlatPkg\\Me\\Policy\\Library\\MeConfigLib\\MeConfigLib.c",
121,
"pMeConfig->Revision == 1");
}
DebugPrintAssert(64, " HeciTimeouts : %d\n", *(this + 1) & 1);
DebugPrintAssert(64, " DidInitStat : 0x%X\n", (unsigned __int8)(*(this + 1) >> 1));
DebugPrintAssert(64, " DisableCpuReplacedPolling: %d\n", (*(this + 1) >> 9) & 1);
DebugPrintAssert(64, " DisableHeciRetry : %d\n", (*(this + 1) >> 11) & 1);
DebugPrintAssert(64, " DisableMessageCheck : %d\n", (*(this + 1) >> 12) & 1);
DebugPrintAssert(64, " SkipMbpHob : %d\n", (*(this + 1) >> 13) & 1);
DebugPrintAssert(64, " HeciCommunication1 : %d\n", (unsigned __int8)HIBYTE(*((_WORD *)this + 2)) >> 6);
DebugPrintAssert(64, " HeciCommunication2 : %d\n", *((_WORD *)this + 3) & 3);
DebugPrintAssert(64, " HeciCommunication3 : %d\n", (*(this + 1) >> 18) & 3);
DebugPrintAssert(64, " KtDeviceEnable : %d\n", (*(this + 1) >> 22) & 3);
DebugPrintAssert(64, " IderDeviceEnable : %d\n", (*(this + 1) >> 20) & 3);
DebugPrintAssert(64, " HostResetNotification : %d\n", *((_BYTE *)this + 7) & 1);
DebugPrintAssert(64, " HsioMessaging : %d\n", (*(this + 1) >> 25) & 1);
DebugPrintAssert(64, " EndOfPostMessage : %d\n", *(this + 2) & 3);
DebugPrintAssert(64, " DisableD0I3SettingForHeci: %d\n", (*(this + 2) >> 2) & 1);
DebugPrintAssert(64, " MeFwDownGrade : %d\n", *(this + 2) >> 31);
DebugPrintAssert(64, " MeLocalFwUpdEnabled : %d\n", *(this + 3) & 1);
DebugPrintAssert(64, " OsPtpAware : %d\n", (*(this + 3) >> 1) & 1);
DebugPrintAssert(64, " HidePttFromOS : %d\n", (*(this + 3) >> 2) & 1);
return DebugPrintAssert(64, " MeJhiSupport : %d\n", (*(this + 3) >> 3) & 1);
}
// Function: Assert_3 @ 0xffd75188 (0xfc bytes)
BOOL __fastcall Assert_3(int n3, int n2)
{
int n2_1; // edi
int v5; // [esp-4h] [ebp-Ch]
n2_1 = n2; /*0xffd7518a*/
if ( n2 != 2 ) /*0xffd75191*/
{
DebugPrintAssert(64, "[ME Policy] Not Auto-configuration (%d) passed for device %d\n", n2, n3); /*0xffd7519c*/
return n2_1; /*0xffd751a6*/
}
if ( DebugLogPrint_8() == 15 ) /*0xffd751b0*/
return 1; /*0xffd751b0*/
if ( n3 )
{
n2_1 = 1; /*0xffd751c1*/
if ( n3 == 1 ) /*0xffd751c4*/
{
if ( (unsigned __int8)sub_FFD737EA() ) /*0xffd7521c*/
{
if ( DebugLogPrint_8() == 1 && *(_DWORD *)(GpioGetPadConfig(0, 22, 1) + 64) >= 0x80000000 ) /*0xffd75242*/
return n2_1; /*0xffd75242*/
return 0; /*0xffd75242*/
}
goto LABEL_12; /*0xffd75223*/
}
if ( n3 > 1 )
{
if ( n3 <= 3 )
{
if ( !(unsigned __int8)sub_FFD737EA() )
{
LABEL_12:
if ( !MeConfigIsType255() )
{
v5 = *(_DWORD *)(GpioGetPadConfig(0, 22, 0) + 64); /*0xffd751f4*/
DebugPrintAssert(2, "[ME Policy] WARNING: Unexpected ME type (MEFS1: %08X)\n", v5);
}
}
return 0; /*0xffd75208*/
}
if ( n3 == 4 ) /*0xffd751d0*/
{
if ( (unsigned __int8)sub_FFD737EA() ) /*0xffd751d2*/
return n2_1; /*0xffd751d9*/
goto LABEL_12; /*0xffd751d9*/
}
}
DebugPrintAssert(2, "[ME Policy] WARNING: Auto-configuration passed for unrecognised device %d\n", n3);
return 0; /*0xffd7521a*/
}
if ( (unsigned __int8)sub_FFD737EA() ) /*0xffd75249*/
return 1; /*0xffd751b5*/
if ( !MeConfigIsType255() ) /*0xffd7525d*/
goto LABEL_12; /*0xffd7525d*/
return (*(_DWORD *)(GpioGetPadConfig(0, 22, 0) + 64) & 0xF0000) == 458752; /*0xffd75206*/
}
// Function: Assert_30 @ 0xffd75284 (0x4e bytes)
int sub_FFD75284()
{
int v0; // esi
char **v1; // eax
v0 = 0; /*0xffd7528c*/
if ( off_FFD7EC94 ) /*0xffd75294*/
{
v1 = (char **)&off_FFD7EC94; /*0xffd75296*/
do /*0xffd752b5*/
{
if ( Assert_26(*v1, (int)&unk_FFD7ACD4) ) /*0xffd752a2*/
break; /*0xffd752a9*/
++v0; /*0xffd752ab*/
v1 = (char **)(&off_FFD7EC94 + 3 * v0); /*0xffd752af*/
}
while ( *v1 ); /*0xffd752b5*/
}
if ( *(&off_FFD7EC94 + 3 * v0) ) /*0xffd752bd*/
return v0; /*0xffd752cb*/
else
return -1; /*0xffd752c6*/
}
// Function: NetGetInfo @ 0xffd752d2 (0x66 bytes)
int __fastcall sub_FFD752D2(_DWORD *this, int a2)
{
int v3; // edi
int BootMode; // eax
int (__cdecl **v6)(_DWORD, __int16 *, _DWORD, _DWORD, char *, int); // [esp+8h] [ebp-4h] BYREF
if ( !a2 ) /*0xffd752dc*/
return -2147483646; /*0xffd7532d*/
v3 = Assert_30(); /*0xffd752e3*/
if ( v3 == -1 ) /*0xffd752e8*/
return -2147483634; /*0xffd752ea*/
BootMode = PeiServicesGetBootMode(); /*0xffd752f1*/
(*(void (__cdecl **)(int, void *, _DWORD, _DWORD, int (__cdecl ***)(_DWORD, __int16 *, _DWORD, _DWORD, char *, int)))(*(_DWORD *)BootMode + 32))( /*0xffd75306*/
BootMode,
&unk_FFD7AD14,
0,
0,
&v6);
// "SocketIioConfig"
return (*v6)(v6, (&off_FFD7EC98)[3 * v3], *(&off_FFD7EC94 + 3 * v3), 0, (char *)&unk_FFD7EC9C + 12 * v3, a2); /*0xffd75332*/
}
// Function: Assert_6 @ 0xffd75338 (0xb6 bytes)
int __thiscall Assert_6(unsigned __int8 *this)
{
int n168; // ebx
int v3; // esi
unsigned int n7; // eax
int n47; // edi
int result; // eax
char buf[48]; // [esp+14h] [ebp-68h] BYREF
_DWORD v8[14]; // [esp+44h] [ebp-38h] BYREF
n168 = 168; /*0xffd75341*/
v3 = 0; /*0xffd7534d*/
MemConfig_0((int)buf, 0x66u); /*0xffd7534f*/
do
{
--n168; /*0xffd75356*/
n7 = v3 & 0xF; /*0xffd75357*/
n47 = 3 * n7; /*0xffd7535a*/
if ( n7 > 7 ) /*0xffd75360*/
n47 += 2; /*0xffd75362*/
if ( n7 == 8 ) /*0xffd75368*/
Assert_14(v8, 6u, L"- "); /*0xffd75376*/
result = Assert_14(&buf[2 * n47], 8u, L"%02x ", *(this + v3)); /*0xffd75392*/
if ( n47 == 47 )
result = DebugPrintAssert(0x80000000, "%02x: %s\n", v3 & 0xF0, buf);
++v3; /*0xffd753be*/
}
while ( n168 );
if ( n47 != 47 )
return DebugPrintAssert(0x80000000, "%02x: %s\n", v3 & 0xF0, buf);
return result; /*0xffd753e6*/
}
// Function: Assert_14 @ 0xffd753ee (0x63 bytes)
unsigned int sub_FFD753EE(_BYTE *a1, unsigned int n6, __int16 *__, ...)
{
int v3; // eax
int v4; // eax
va_list va; // [esp+18h] [ebp+14h] BYREF
va_start(va, __);
if ( ((unsigned __int8)a1 & 1) != 0 ) /*0xffd753fb*/
{
v3 = DebugAssert(); /*0xffd753fd*/
if ( v3 ) /*0xffd75404*/
(*(void (__cdecl **)(const char *, int, const char *))(v3 + 4))( /*0xffd7540e*/
"e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLib.c",
77,
"(((UINTN) (StartOfBuffer)) & 0x01) == 0");
}
if ( ((unsigned __int8)__ & 1) != 0 ) /*0xffd75418*/
{
v4 = DebugAssert(); /*0xffd7541a*/
if ( v4 ) /*0xffd75421*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffd7542b*/
"e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLib.c",
78,
"(((UINTN) (FormatString)) & 0x01) == 0");
}
return PrintFormatStringWorker(a1, n6 >> 1, 320, (unsigned __int8 *)__, (int)va); /*0xffd7544e*/
}
// Function: MemFillPattern16 @ 0xffd75451 (0x34 bytes)
_BYTE *__fastcall MemFillPattern16(_BYTE *a1, unsigned int a2, int i, __int16 a4, int a5)
{
int j; // esi
for ( j = 0; j < i; ++j ) /*0xffd7545d*/
{
if ( (unsigned int)a1 >= a2 ) /*0xffd75464*/
break; /*0xffd75464*/
*a1 = a4; /*0xffd7546a*/
if ( a5 != 1 ) /*0xffd7546c*/
a1[1] = HIBYTE(a4); /*0xffd75473*/
a1 += a5; /*0xffd75476*/
}
return a1; /*0xffd7547f*/
}
// Function: Assert_12 @ 0xffd75485 (0x6d bytes)
_BYTE *__fastcall Assert_12(_BYTE *_r_n, unsigned int n16, int a3, unsigned int a4)
{
_BYTE *_r_n_1; // esi
int v6; // eax
int v7; // eax
int v8; // edx
unsigned __int64 v9; // rtt
unsigned int v11; // [esp-4h] [ebp-1Ch]
int v12; // [esp+Ch] [ebp-Ch] BYREF
int *v13; // [esp+10h] [ebp-8h]
unsigned int n16_1; // [esp+14h] [ebp-4h]
_r_n_1 = _r_n; /*0xffd7548c*/
v13 = &v12; /*0xffd75494*/
n16_1 = n16; /*0xffd75497*/
*_r_n = 0; /*0xffd7549a*/
do /*0xffd754db*/
{
if ( !n16 ) /*0xffd7549f*/
{
v6 = DebugAssert(); /*0xffd754a1*/
if ( v6 ) /*0xffd754a8*/
(*(void (__cdecl **)(char *, int, const char *))(v6 + 4))( /*0xffd754b6*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\DivU64x32Remainder.c",
47,
"Divisor != 0");
}
v11 = a4 / n16_1; /*0xffd754c6*/
LODWORD(v9) = a3; /*0xffd754ca*/
HIDWORD(v9) = a4 % n16_1; /*0xffd754ca*/
v7 = v9 / n16_1; /*0xffd754ca*/
v8 = v9 % n16_1; /*0xffd754ca*/
if ( v13 ) /*0xffd754cf*/
*v13 = v8; /*0xffd754d1*/
++_r_n_1; /*0xffd754d7*/
a3 = v7; /*0xffd754d8*/
a4 = v11; /*0xffd754dd*/
*_r_n_1 = byte_FFD7AB14[v12]; /*0xffd754e6*/
}
while ( v11 | v7 ); /*0xffd754db*/
return _r_n_1; /*0xffd754ea*/
}
// Function: PrintFormatStringWorker @ 0xffd754f2 (0xc61 bytes)
unsigned int __fastcall PrintFormatStringWorker(_BYTE *_r_n, unsigned int n0xF4240, __int16 n320, unsigned __int8 *__, int va)
{
int v5; // ebx
int v7; // edi
int v8; // eax
unsigned __int8 *___1; // edx
int v11; // eax
int v12; // eax
int v13; // eax
int v14; // eax
unsigned __int8 *___2; // edx
unsigned __int8 *___3; // edx
int v17; // eax
_BYTE *_r_n_2; // esi
unsigned int v19; // edi
int v20; // ecx
int n10; // eax
unsigned __int8 *___5; // edi
unsigned int v23; // ecx
const char *_r_n_5; // esi
int n2_2; // eax
unsigned __int8 *___9; // edi
int v27; // esi
unsigned int n13_1; // ecx
int v29; // ebx
int v30; // esi
unsigned __int8 *___10; // edi
unsigned int v32; // ecx
unsigned int v33; // ecx
unsigned int v34; // ecx
unsigned int v35; // ecx
unsigned int v36; // ecx
unsigned int v37; // ecx
unsigned __int8 *___12; // edx
int v39; // ecx
unsigned __int8 *___8; // ecx
unsigned __int8 *___11; // edx
int v42; // ecx
int v... [28443 chars total]
// Function: PrintFormatTimeDate @ 0xffd76153 (0x1f bytes)
unsigned int PrintFormatTimeDate(_BYTE *_r_n, unsigned int n38, __int16 n320, char *%02d_%02d_%04d__%02d:%02d, ...)
{
va_list va; // [esp+18h] [ebp+18h] BYREF
va_start(va, %02d_%02d_%04d__%02d:%02d);
return PrintFormatStringWorker(_r_n, n38, n320, (unsigned __int8 *)%02d_%02d_%04d__%02d:%02d, (int)va); /*0xffd76170*/
}
// Function: SetupBufferDescriptor @ 0xffd76172 (0x9b bytes)
int __cdecl SetupBufferDescriptor(_DWORD *a1, int n8)
{
int v3; // [esp+Ch] [ebp-4h]
v3 = sub_FFD74F00((void *)6); /*0xffd761a2*/
a1[1] = 16 * n8 + 16; /*0xffd761ab*/
if ( !a1[4] && !a1[5] ) /*0xffd761c7*/
{
*(_DWORD *)(v3 + 16) = sub_FFD74EF1((void *)5); /*0xffd761ec*/
*(_DWORD *)(v3 + 20) = 0; /*0xffd76203*/
}
return 0; /*0xffd76209*/
}
// Function: SpiGetBaseAddr @ 0xffd7620d (0x17e bytes)
int __cdecl SpiGetBaseAddr(int a1)
{
int v2; // [esp+Ch] [ebp-Ch]
int v3; // [esp+10h] [ebp-8h]
int v4; // [esp+14h] [ebp-4h]
if ( *(_DWORD *)(a1 + 12) ) /*0xffd76222*/
{
v3 = *(_DWORD *)(*(_DWORD *)(a1 + 12) + 4 * (unsigned __int16)*(_DWORD *)(a1 + 4) + 255544); /*0xffd76318*/
v4 = *(_DWORD *)(*(_DWORD *)(a1 + 12) + 4 * (unsigned __int16)*(_DWORD *)(a1 + 4) + 255560); /*0xffd76334*/
}
else
{
v2 = sub_FFD74F00((void *)6); /*0xffd76235*/
if ( *(_DWORD *)(v2 + 4) ) /*0xffd7623b*/
{
v3 = *(_DWORD *)(v2 + 16 * (unsigned __int16)*(_DWORD *)(a1 + 4) + 20); /*0xffd76256*/
v4 = *(_DWORD *)(v2 + 16 * (unsigned __int16)*(_DWORD *)(a1 + 4) + 16); /*0xffd7626e*/
}
else
{
SetupBufferDescriptor(dword_FFD7ED18, 8); /*0xffd76281*/
v3 = *(_DWORD *)(16 * (unsigned __int16)*(_DWORD *)(a1 + 4) - 2626260); /*0xffd7629c*/
v4 = *(_DWORD *)(16 * (unsigned __int16)*(_DWORD *)(a1 + 4) - 2626264); /*0xffd762b3*/
if ( !v4 && !v3 ) /*0xffd762c0*/
{
v4 = sub_FFD74EF1((void *)5); /*0xffd762ed*/
v3 = 0; /*0xffd762fa*/
}
}
}
if ( !v4 && !v3 ) /*0xffd76341*/
return sub_FFD74EF1((void *)5); /*0xffd7636e*/
return v4; /*0xffd76387*/
}