diff --git a/AmiModulePkg/TCG2/Common/AmiTcgPlatformDxe/AmiTcgPlatformDxe/AmiTcgPlatformDxe.c b/AmiModulePkg/TCG2/Common/AmiTcgPlatformDxe/AmiTcgPlatformDxe/AmiTcgPlatformDxe.c index c22a114..a1121bc 100644 --- a/AmiModulePkg/TCG2/Common/AmiTcgPlatformDxe/AmiTcgPlatformDxe/AmiTcgPlatformDxe.c +++ b/AmiModulePkg/TCG2/Common/AmiTcgPlatformDxe/AmiTcgPlatformDxe/AmiTcgPlatformDxe.c @@ -346,21 +346,21 @@ UINT64 Ticks; BOOLEAN TpmPresent; - TpmStatus = sub_410 (); - sub_400 (); + TpmStatus = ReadControlRegister (); + ClearInterruptFlag (); TpmPresent = (TpmStatus & 0x200) != 0; Ticks = sub_6774 (1288) & 0xFFFFFF; - sub_3E0 (); + EnableInterruptFlag (); while (((Ticks + 357 - (UINT32)sub_6774 (1288)) & 0x800000) == 0) { - sub_3D0 (); + CpuPause (); } - sub_3E0 (); + EnableInterruptFlag (); if (TpmPresent) { - sub_3F0 (); + SetInterruptFlag (); } else { - sub_400 (); + ClearInterruptFlag (); } } diff --git a/LenovoServerPkg/Driver/LnvDriverPei/AsciiSPrintFormat.c b/LenovoServerPkg/Driver/LnvDriverPei/AsciiSPrintFormat.c index 0841607..1e662e9 100644 --- a/LenovoServerPkg/Driver/LnvDriverPei/AsciiSPrintFormat.c +++ b/LenovoServerPkg/Driver/LnvDriverPei/AsciiSPrintFormat.c @@ -3,5 +3,5 @@ va_list va; // [esp+10h] [ebp+10h] BYREF va_start(va, %04d_%02d_%02d_%02d:%02d:%02d_:_%a.); - return sub_FFE3C949(0, %04d_%02d_%02d_%02d:%02d:%02d_:_%a., (char *)va); + return AsciiSPrint(0, %04d_%02d_%02d_%02d:%02d:%02d_:_%a., (char *)va); } \ No newline at end of file diff --git a/LenovoServerPkg/Driver/LnvDriverPei/BootInRecoveryModePpiCallback.c b/LenovoServerPkg/Driver/LnvDriverPei/BootInRecoveryModePpiCallback.c new file mode 100644 index 0000000..19837b2 --- /dev/null +++ b/LenovoServerPkg/Driver/LnvDriverPei/BootInRecoveryModePpiCallback.c @@ -0,0 +1 @@ +// BootInRecoveryModePpiCallback - Decompilation failed, showing disassembly diff --git a/LenovoServerPkg/Driver/LnvDriverPei/DebugPrint.c b/LenovoServerPkg/Driver/LnvDriverPei/DebugPrint.c index dd707a3..5948360 100644 --- a/LenovoServerPkg/Driver/LnvDriverPei/DebugPrint.c +++ b/LenovoServerPkg/Driver/LnvDriverPei/DebugPrint.c @@ -9,7 +9,7 @@ v3 = (int (__cdecl **)(int, const char *, char *))result; if ( result ) { - result = sub_FFE3C547(); + result = DebugPrintLevelEnabled(); if ( (result & a1) != 0 ) return (*v3)(a1, a2, (char *)va); } diff --git a/LenovoServerPkg/Driver/LnvDriverPei/EndOfPeiSignalPpiCallback.c b/LenovoServerPkg/Driver/LnvDriverPei/EndOfPeiSignalPpiCallback.c new file mode 100644 index 0000000..60c6d04 --- /dev/null +++ b/LenovoServerPkg/Driver/LnvDriverPei/EndOfPeiSignalPpiCallback.c @@ -0,0 +1 @@ +// EndOfPeiSignalPpiCallback - Decompilation failed, showing disassembly diff --git a/LenovoServerPkg/Driver/LnvDriverPei/GetCmosService.c b/LenovoServerPkg/Driver/LnvDriverPei/GetCmosService.c index 67a361e..a31f3c3 100644 --- a/LenovoServerPkg/Driver/LnvDriverPei/GetCmosService.c +++ b/LenovoServerPkg/Driver/LnvDriverPei/GetCmosService.c @@ -9,7 +9,7 @@ v4[3] = -2118136208; if ( !this ) return -2147483646; - v3 = sub_FFE3C596(); + v3 = PeiServicesGetPointer(); if ( v3 ) return (*(int (__cdecl **)(int, _DWORD *, _DWORD, _DWORD, void *))(*(_DWORD *)v3 + 32))(v3, v4, 0, 0, this); else diff --git a/LenovoServerPkg/Driver/LnvDriverPei/GetDebugService.c b/LenovoServerPkg/Driver/LnvDriverPei/GetDebugService.c index 9ed796a..6458a55 100644 --- a/LenovoServerPkg/Driver/LnvDriverPei/GetDebugService.c +++ b/LenovoServerPkg/Driver/LnvDriverPei/GetDebugService.c @@ -4,7 +4,7 @@ int v2; // [esp+0h] [ebp-8h] BYREF int v3; // [esp+4h] [ebp-4h] BYREF - v0 = sub_FFE3C596(); + v0 = PeiServicesGetPointer(); if ( (*(int (__cdecl **)(int, void *, _DWORD, int *, int *))(*(_DWORD *)v0 + 32))(v0, &unk_FFE3E334, 0, &v2, &v3) >= 0 ) return v3; else diff --git a/LenovoServerPkg/Driver/LnvDriverPei/HobConstructorInternal.c b/LenovoServerPkg/Driver/LnvDriverPei/HobConstructorInternal.c index 4bb482a..7a1349c 100644 --- a/LenovoServerPkg/Driver/LnvDriverPei/HobConstructorInternal.c +++ b/LenovoServerPkg/Driver/LnvDriverPei/HobConstructorInternal.c @@ -3,9 +3,9 @@ __int64 v2; // rax __int64 v3; // rax - v2 = sub_FFE3D60A(&unk_FFE3E314); - sub_FFE3D636(v2, HIDWORD(v2)); - v3 = sub_FFE3D60A(&unk_FFE3E31C); - sub_FFE3D636(v3, HIDWORD(v3)); + v2 = ReadUnaligned64(&unk_FFE3E314); + WriteUnaligned32(v2, HIDWORD(v2)); + v3 = ReadUnaligned64(&unk_FFE3E31C); + WriteUnaligned32(v3, HIDWORD(v3)); return this; } \ No newline at end of file diff --git a/LenovoServerPkg/Driver/LnvDriverPei/InternalBuildGuidHob.c b/LenovoServerPkg/Driver/LnvDriverPei/InternalBuildGuidHob.c index 3c5dbdb..886e838 100644 --- a/LenovoServerPkg/Driver/LnvDriverPei/InternalBuildGuidHob.c +++ b/LenovoServerPkg/Driver/LnvDriverPei/InternalBuildGuidHob.c @@ -17,9 +17,9 @@ v4 = v3; if ( !v3 ) return 0; - sub_FFE3C5C8(v3 + 8); + HobConstructorInternal(v3 + 8); if ( v4 == -24 ) return 0; else - return sub_FFE3C5F9(v4 + 24); + return StrCpySInternal(v4 + 24); } \ No newline at end of file diff --git a/LenovoServerPkg/Driver/LnvDriverPei/InternalHobConstructor.c b/LenovoServerPkg/Driver/LnvDriverPei/InternalHobConstructor.c index b7cce01..966a5e1 100644 --- a/LenovoServerPkg/Driver/LnvDriverPei/InternalHobConstructor.c +++ b/LenovoServerPkg/Driver/LnvDriverPei/InternalHobConstructor.c @@ -4,7 +4,7 @@ int v4; // eax int v6; // [esp+4h] [ebp-4h] BYREF - v3 = sub_FFE3C596(); + v3 = PeiServicesGetPointer(); if ( (*(int (__cdecl **)(int, int, int, int *))(*(_DWORD *)v3 + 52))(v3, 4, n25, &v6) < 0 ) v6 = 0; if ( !v6 ) diff --git a/LenovoServerPkg/Driver/LnvDriverPei/LnvDebugSwitchInit.c b/LenovoServerPkg/Driver/LnvDriverPei/LnvDebugSwitchInit.c index 120bfa4..edaa1e1 100644 --- a/LenovoServerPkg/Driver/LnvDriverPei/LnvDebugSwitchInit.c +++ b/LenovoServerPkg/Driver/LnvDriverPei/LnvDebugSwitchInit.c @@ -39,19 +39,19 @@ if ( v14[2] ) { LOBYTE(v3) = v15; - v9 = sub_FFE3C3DA(33360, v3); + v9 = CmosWriteByte(33360, v3); if ( v9 < 0 ) - sub_FFE3C296(-1, "RDBG CmosWriteByte PEI_DEBUG_SWITCH_BY_NVRAM_OFFSET , %x , Status = %r \n", v15, v9); - sub_FFE3C32E(v10); - sub_FFE3C296(-1, "RDBG BuildGuidDataHob gLnvDebugSwitchHobGuid \n"); + DebugPrint(-1, "RDBG CmosWriteByte PEI_DEBUG_SWITCH_BY_NVRAM_OFFSET , %x , Status = %r \n", v15, v9); + InternalBuildGuidHob(v10); + DebugPrint(-1, "RDBG BuildGuidDataHob gLnvDebugSwitchHobGuid \n"); LOBYTE(v11) = v16; - v12 = sub_FFE3C3DA(33368, v11); + v12 = CmosWriteByte(33368, v11); if ( v12 < 0 ) - sub_FFE3C296(-1, "RDBG CmosWriteByte DXE_DEBUG_SWITCH_BY_NVRAM_OFFSET , %x , Status = %r \n", v16, v12); + DebugPrint(-1, "RDBG CmosWriteByte DXE_DEBUG_SWITCH_BY_NVRAM_OFFSET , %x , Status = %r \n", v16, v12); LOBYTE(v13) = v17; - result = sub_FFE3C3DA(33376, v13); + result = CmosWriteByte(33376, v13); if ( result < 0 ) - return sub_FFE3C296( + return DebugPrint( -1, "RDBG CmosWriteByte SMM_DEBUG_SWITCH_BY_NVRAM_OFFSET , %x , Status = %r \n", v17, @@ -60,19 +60,19 @@ else { LOBYTE(v3) = v20; - v4 = sub_FFE3C3DA(33360, v3); + v4 = CmosWriteByte(33360, v3); if ( v4 < 0 ) - sub_FFE3C296(-1, "RDBG CmosWriteByte PEI_DEBUG_SWITCH_BY_NVRAM_OFFSET , %x , Status = %r \n", v20, v4); - sub_FFE3C32E(v5); - sub_FFE3C296(-1, "RDBG BuildGuidDataHob gLnvDebugSwitchHobGuid \n"); + DebugPrint(-1, "RDBG CmosWriteByte PEI_DEBUG_SWITCH_BY_NVRAM_OFFSET , %x , Status = %r \n", v20, v4); + InternalBuildGuidHob(v5); + DebugPrint(-1, "RDBG BuildGuidDataHob gLnvDebugSwitchHobGuid \n"); LOBYTE(v6) = v20; - v7 = sub_FFE3C3DA(33368, v6); + v7 = CmosWriteByte(33368, v6); if ( v7 < 0 ) - sub_FFE3C296(-1, "RDBG CmosWriteByte DXE_DEBUG_SWITCH_BY_NVRAM_OFFSET , %x , Status = %r \n", v20, v7); + DebugPrint(-1, "RDBG CmosWriteByte DXE_DEBUG_SWITCH_BY_NVRAM_OFFSET , %x , Status = %r \n", v20, v7); LOBYTE(v8) = v20; - result = sub_FFE3C3DA(33376, v8); + result = CmosWriteByte(33376, v8); if ( result < 0 ) - return sub_FFE3C296( + return DebugPrint( -1, "RDBG CmosWriteByte SMM_DEBUG_SWITCH_BY_NVRAM_OFFSET , %x , Status = %r \n", v20, diff --git a/LenovoServerPkg/Driver/LnvDriverPei/LnvDebugSwitchPpiCallback.c b/LenovoServerPkg/Driver/LnvDriverPei/LnvDebugSwitchPpiCallback.c index 0371a16..001c25a 100644 --- a/LenovoServerPkg/Driver/LnvDriverPei/LnvDebugSwitchPpiCallback.c +++ b/LenovoServerPkg/Driver/LnvDriverPei/LnvDebugSwitchPpiCallback.c @@ -19,14 +19,14 @@ v16 = 0; if ( !a1 ) return -2147483646; - v9 = sub_FFE3C949(0, a1, &a2) <= 0xE6u ? v9 : 0; - sub_FFE3C7A4(&v10); + v9 = AsciiSPrint(0, a1, &a2) <= 0xE6u ? v9 : 0; + ReadRtcDateTime(&v10); v6 = 0; LODWORD(v5) = &v8; - n0xFD = sub_FFE3C88B(v7, 254, "%04d/%02d/%02d-%02d:%02d:%02d : %a.", v10, v11, v12, v13, v14, v15, v5); + n0xFD = AsciiSPrintFormat(v7, 254, "%04d/%02d/%02d-%02d:%02d:%02d : %a.", v10, v11, v12, v13, v14, v15, v5); if ( n0xFD > 0xFD ) return -2147483643; - v4 = sub_FFE3C596(); + v4 = PeiServicesGetPointer(); result = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int *))(*(_DWORD *)v4 + 32))(v4, &unk_FFE3E344, 0, 0, &a1); if ( result >= 0 ) return (*(int (__cdecl **)(int, int, _DWORD, int, char *, _DWORD, _DWORD, char *))(a1 + 12))( diff --git a/LenovoServerPkg/Driver/LnvDriverPei/MemoryDiscoveredPpiCallback.c b/LenovoServerPkg/Driver/LnvDriverPei/MemoryDiscoveredPpiCallback.c new file mode 100644 index 0000000..5873740 --- /dev/null +++ b/LenovoServerPkg/Driver/LnvDriverPei/MemoryDiscoveredPpiCallback.c @@ -0,0 +1 @@ +// MemoryDiscoveredPpiCallback - Decompilation failed, showing disassembly diff --git a/LenovoServerPkg/Driver/LnvDriverPei/PeiServicesGetPointer.c b/LenovoServerPkg/Driver/LnvDriverPei/PeiServicesGetPointer.c index 61e67f5..13650d4 100644 --- a/LenovoServerPkg/Driver/LnvDriverPei/PeiServicesGetPointer.c +++ b/LenovoServerPkg/Driver/LnvDriverPei/PeiServicesGetPointer.c @@ -4,7 +4,7 @@ int __return_address; // [esp+0h] [ebp-Ch] int v3; // [esp+6h] [ebp-6h] - sub_FFE3D5C0(__return_address); + X86ReadIdtr(__return_address); v0 = *(_DWORD *)(v3 - 4); if ( !v0 ) PeiServicesGetIdt( diff --git a/LenovoServerPkg/Driver/LnvDriverPei/_ModuleEntryPoint.c b/LenovoServerPkg/Driver/LnvDriverPei/_ModuleEntryPoint.c index 6c51e40..c505f66 100644 --- a/LenovoServerPkg/Driver/LnvDriverPei/_ModuleEntryPoint.c +++ b/LenovoServerPkg/Driver/LnvDriverPei/_ModuleEntryPoint.c @@ -18,8 +18,8 @@ v3 = v2; if ( v2 < 0 ) { - sub_FFE3C296(-1, "PEI - PeiLnvSendIpmiCmdLibConstructor NotifyPpi Status = %r \n", v2); - sub_FFE3C296(-1, "PeiLnvSendIpmiCmdLibConstructor Status = %r \n", v3); + DebugPrint(-1, "PEI - PeiLnvSendIpmiCmdLibConstructor NotifyPpi Status = %r \n", v2); + DebugPrint(-1, "PeiLnvSendIpmiCmdLibConstructor Status = %r \n", v3); } } v4 = (*(int (__cdecl **)(EFI_SYSTEM_TABLE *, void *))(LODWORD(SystemTable->Hdr.Signature) + 36))( @@ -27,7 +27,7 @@ &unk_FFE3E394); v5 = v4; if ( v4 < 0 ) - sub_FFE3C296(-1, "PEI - LnvDriverPEI_Init NotifyPpi Status = %r \n", v4); - sub_FFE3C0FE(SystemTable); + DebugPrint(-1, "PEI - LnvDriverPEI_Init NotifyPpi Status = %r \n", v4); + LnvDebugSwitchInit(SystemTable); return v5; } \ No newline at end of file diff --git a/LenovoServerPkg/Driver/LnvDriverPei/sub_FFE3C0D4.c b/LenovoServerPkg/Driver/LnvDriverPei/sub_FFE3C0D4.c deleted file mode 100644 index 026eb82..0000000 --- a/LenovoServerPkg/Driver/LnvDriverPei/sub_FFE3C0D4.c +++ /dev/null @@ -1 +0,0 @@ -// sub_FFE3C0D4 - Decompilation failed, showing disassembly diff --git a/LenovoServerPkg/Driver/LnvDriverPei/sub_FFE3C0E2.c b/LenovoServerPkg/Driver/LnvDriverPei/sub_FFE3C0E2.c deleted file mode 100644 index 650bd07..0000000 --- a/LenovoServerPkg/Driver/LnvDriverPei/sub_FFE3C0E2.c +++ /dev/null @@ -1 +0,0 @@ -// sub_FFE3C0E2 - Decompilation failed, showing disassembly diff --git a/LenovoServerPkg/Driver/LnvDriverPei/sub_FFE3C0F0.c b/LenovoServerPkg/Driver/LnvDriverPei/sub_FFE3C0F0.c deleted file mode 100644 index b2f41fa..0000000 --- a/LenovoServerPkg/Driver/LnvDriverPei/sub_FFE3C0F0.c +++ /dev/null @@ -1 +0,0 @@ -// sub_FFE3C0F0 - Decompilation failed, showing disassembly diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/AsciiStrCopyS.c b/LenovoServerPkg/SystemInventory/SystemInventory/AsciiStrCopyS.c new file mode 100644 index 0000000..4d9d8ef --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/AsciiStrCopyS.c @@ -0,0 +1,30 @@ +_BYTE *__fastcall AsciiStrCopyS(_BYTE *p_n145_1, _BYTE *a2, unsigned __int64 n62) +{ + unsigned __int64 n62_1; // rdi + _BYTE *p_n145; // rbx + _BYTE *p_n145_2; // rbp + + n62_1 = n62; /*0x8ec*/ + p_n145 = p_n145_1; /*0x8f2*/ + if ( !n62 ) /*0x8f8*/ + return p_n145_1; /*0x8fa*/ + if ( !p_n145_1 ) /*0x915*/ + sub_788("e:\\hs\\MdePkg\\Library\\BaseLib\\String.c", 1033, "Destination != ((void *) 0)"); /*0x926*/ + if ( p_n145 - a2 <= (unsigned __int64)sub_9F0(a2) ) /*0x945*/ + sub_788("e:\\hs\\MdePkg\\Library\\BaseLib\\String.c", 1038, "(UINTN)(Destination - Source) > AsciiStrLen (Source)"); /*0x956*/ + if ( a2 - p_n145 < n62_1 ) /*0x96d*/ + sub_788("e:\\hs\\MdePkg\\Library\\BaseLib\\String.c", 1039, "(UINTN)(Source - Destination) >= Length"); /*0x97e*/ + if ( n62_1 > 0xF4240 ) /*0x999*/ + sub_788( /*0x9aa*/ + "e:\\hs\\MdePkg\\Library\\BaseLib\\String.c", + 1042, + "Length <= _gPcd_FixedAtBuild_PcdMaximumAsciiStringLength"); + p_n145_2 = p_n145; /*0x9af*/ + while ( *a2 && n62_1 ) /*0x9b7*/ + { + *p_n145++ = *a2++; /*0x9b9*/ + --n62_1; /*0x9c1*/ + } + sub_63C(p_n145, n62_1); /*0x9d0*/ + return p_n145_2; /*0x9e7*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/AsciiStrHexToUint64.c b/LenovoServerPkg/SystemInventory/SystemInventory/AsciiStrHexToUint64.c new file mode 100644 index 0000000..9589e09 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/AsciiStrHexToUint64.c @@ -0,0 +1,64 @@ +__int64 __fastcall AsciiStrHexToUint64(char *a1) +{ + unsigned __int64 v1; // rdi + char *v2; // rbx + unsigned __int64 v3; // rax + unsigned __int64 v4; // r9 + unsigned __int64 v5; // rax + __int64 v6; // rdx + __int64 v7; // r8 + unsigned int v8; // r9d + unsigned __int64 v9; // rcx + char n88; // al + __int64 v11; // r9 + __int64 v12; // rax + __int64 v14; // [rsp+30h] [rbp+8h] + + v1 = 0; /*0xabc*/ + v2 = a1; /*0xabe*/ + if ( !a1 ) /*0xac8*/ + { + sub_788("e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c", 2561, "(String != ((void *) 0))"); /*0xadd*/ + return v14; /*0xbc0*/ + } + v3 = sub_D0C(a1, 1000001); /*0xb08*/ + if ( v3 > v4 ) /*0xb10*/ + { + sub_788( /*0xb25*/ + "e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c", + 2568, + "(AsciiStrnLenS (String, (_gPcd_FixedAtBuild_PcdMaximumAsciiStringLength) + 1) <= (_gPcd_FixedAtBuild_PcdMaximumAsc" + "iiStringLength))"); + LODWORD(v4) = 1000000; /*0xb2a*/ + } + v5 = sub_D0C(v2, (int)v4 + 1); /*0xb38*/ + v9 = v8; /*0xb3d*/ + if ( v5 > v8 ) /*0xb43*/ + return v14; /*0xb43*/ + while ( *v2 == 32 || *v2 == 9 ) /*0xb4d*/ + ++v2; /*0xb4f*/ + LOBYTE(v7) = 48; /*0xb54*/ + while ( *v2 == 48 ) /*0xb5f*/ + ++v2; /*0xb59*/ + n88 = *v2; /*0xb67*/ + if ( (unsigned __int8)(*v2 - 97) <= 0x19u ) /*0xb6a*/ + n88 -= 32; /*0xb6c*/ + if ( n88 == 88 ) /*0xb71*/ + { + if ( *(v2 - 1) != 48 ) /*0xb77*/ + return v1; /*0xb77*/ + ++v2; /*0xb79*/ + } + v11 = -1; /*0xb7c*/ + while ( (unsigned __int8)(*v2 - v7) <= 9u || (unsigned __int8)(*v2 - 65) <= 5u || (unsigned __int8)(*v2 - 97) <= 5u ) /*0xb97*/ + { + LOBYTE(v9) = *v2; /*0xb99*/ + v12 = sub_A7C(v9, v6, v7, v11); /*0xb9b*/ + v9 = (unsigned __int64)(v11 - v12) >> 4; /*0xba6*/ + if ( v1 > v9 ) /*0xbad*/ + return v11; /*0xbbe*/ + v1 = v12 + 16 * v1; /*0xbb3*/ + ++v2; /*0xbb6*/ + } + return v1; /*0xbcd*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/BasePrintLibInternalFormat.c b/LenovoServerPkg/SystemInventory/SystemInventory/BasePrintLibInternalFormat.c new file mode 100644 index 0000000..37cc1b6 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/BasePrintLibInternalFormat.c @@ -0,0 +1,852 @@ +unsigned __int64 __fastcall BasePrintLibInternalFormat( + unsigned __int64 a1, + unsigned __int64 n0xF4240, + __int64 a3, + unsigned __int8 *a4, + unsigned __int16 **a5) +{ + unsigned __int8 *v5; // rsi + __int64 v6; // r12 + unsigned __int64 v8; // r13 + __int64 v9; // rdi + __int64 v11; // r8 + int n1000000; // r9d + __int64 n2_1; // r15 + unsigned __int64 n1000000_2; // rax + unsigned int n1000000_1; // r9d + unsigned __int64 v16; // rax + unsigned int v17; // r9d + unsigned __int64 v18; // rdi + unsigned __int64 v19; // r10 + __int64 v20; // rax + __int64 v21; // rcx + unsigned __int8 *v22; // rdx + unsigned __int8 *v23; // r8 + unsigned __int64 v24; // r9 + char v25; // r11 + unsigned __int64 v26; // rdi + const char *_r_n_1; // rbx + unsigned __int16 **v28; // r10 + unsigned __int8 *v29; // rdx + int v30; // eax + unsigned __int64 n13_1; // rcx + unsigned __int16 *v32; // rax + int v33; // eax + unsigned __int8 *v34; // rdx + unsigned __int64 v35; // rcx + unsigned __int64 v36; // rcx + unsigned __int64 v37; // rcx + unsigned __int64 v38; // rcx + unsigned __int64 v39; // rcx + unsigned __int64 v40; // rcx + __int64 v41; // r15 + int v42; // eax + int v43; // eax + unsigned __int8 *v44; // rdi + int v45; // r15d + int v46; // r14d + unsigned __int16 v47; // ax + unsigned __int64 v48; // rcx + unsigned __int64 v49; // rcx + unsigned __int64 v50; // rcx + unsigned __int64 v51; // rcx + unsigned __int64 n3; // rcx + unsigned __int16 *n5; // rcx + __int64 v54; // rbx + char n43; // r14 + bool v56; // r15 + __int64 n16; // r8 + unsigned __int64 v58; // rdx + int v59; // eax + const char *i; // r8 + __int64 n512; // r14 + int v62; // edx + __int64 v63; // rax + __int64 v64; // rcx + int v65; // r10d + __int64 j; // rcx + __int64 n2_3; // r11 + int v68; // r8d + __int64 v69; // rdi + unsigned __int64 v70; // r8 + unsigned __int64 v71; // rdx + __int64 v72; // r14 + unsigned __int64 v73; // rsi + __int16 v74; // cx + unsigned __int64 v75; // rax + __int64 m; // r8 + __int64 n; // rax + __int64 v78; // rax + int v79; // r8d + __int64 v80; // rcx + __int64 v81; // rax + __int64 k; // rcx + int v83; // eax + unsigned __int64 n10; // rcx + _BYTE *v85; // rax + __int64 ii; // rdx + __int64 v87; // [rsp+80h] [rbp-80h] + __int64 v88; // [rsp+80h] [rbp-80h] + unsigned __int64 v89; // [rsp+88h] [rbp-78h] + unsigned int n2; // [rsp+90h] [rbp-70h] + unsigned __int64 v91; // [rsp+98h] [rbp-68h] + char n43_1; // [rsp+A0h] [rbp-60h] + __int64 v93; // [rsp+B0h] [rbp-50h] + unsigned __int64 v94; // [rsp+B0h] [rbp-50h] + unsigned __int64 n13; // [rsp+B8h] [rbp-48h] BYREF + unsigned __int16 *v96; // [rsp+C0h] [rbp-40h] + __int64 n0xFFFF; // [rsp+C8h] [rbp-38h] + unsigned __int64 v98; // [rsp+D0h] [rbp-30h] + __int64 v99; // [rsp+D8h] [rbp-28h] BYREF + __int64 n2_2; // [rsp+E0h] [rbp-20h] + unsigned __int64 v101; // [rsp+E8h] [rbp-18h] + _BYTE _r_n[40]; // [rsp+F0h] [rbp-10h] BYREF + __int64 n512_1; // [rsp+118h] [rbp+18h] + __int64 v104; // [rsp+168h] [rbp+68h] + __int16 v105; // [rsp+170h] [rbp+70h] + unsigned __int8 *v106; // [rsp+178h] [rbp+78h] + bool v107; // [rsp+188h] [rbp+88h] + + v106 = a4; /*0xe19*/ + v5 = a4; /*0xe43*/ + LOWORD(v6) = a3; /*0xe46*/ + v8 = a1; /*0xe4c*/ + if ( n0xF4240 ) /*0xe55*/ + { + v9 = a3 & 0x2000; /*0xe57*/ + if ( (a3 & 0x2000) == 0 && !a1 ) /*0xe6b*/ + { + sub_788("e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", 578, "(Buffer != ((void *) 0))"); /*0xe7c*/ + if ( !v8 ) /*0xe84*/ + return 0; /*0xe84*/ + } + } + else + { + v9 = a3 & 0x2000; /*0xe8d*/ + if ( (a3 & 0x2000) == 0 ) /*0xe93*/ + goto LABEL_9; /*0xe93*/ + } + if ( !v5 ) /*0xea1*/ + { + sub_788("e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", 586, "(Format != ((void *) 0))"); /*0xeb2*/ + return 0; /*0xe88*/ + } +LABEL_9: + if ( (v6 & 0x40) != 0 ) /*0xec0*/ + { + if ( n0xF4240 > 0xF4240 ) /*0xed8*/ + { + sub_788( /*0xee9*/ + "e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", + 595, + "(BufferSize <= (_gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength))"); + return 0; /*0xef9*/ + } + n2 = 2; /*0xf02*/ + } + else + { + if ( n0xF4240 > 0xF4240 ) /*0xf23*/ + { + sub_788( /*0xf34*/ + "e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", + 600, + "(BufferSize <= (_gPcd_FixedAtBuild_PcdMaximumAsciiStringLength))"); + return 0; /*0xf46*/ + } + n2 = 1; /*0xf52*/ + } + if ( (v6 & 0x100) != 0 ) /*0xf5e*/ + { + if ( (unsigned __int64)sub_C9C(v5, 1000001, a3, 1000000) > 0xF4240 ) /*0xf80*/ + sub_788( /*0xf91*/ + "e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", + 611, + "(StrnLenS ((CHAR16 *)Format, (_gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength) + 1) <= (_gPcd_FixedAtBuild_PcdM" + "aximumUnicodeStringLength))"); + if ( (unsigned __int64)sub_C9C(v5, 1000001, v11, n1000000) > 0xF4240 ) /*0xfaf*/ + return 0; /*0xfaf*/ + n2_1 = 2; /*0xfba*/ + n0xFFFF = 0xFFFF; /*0xfc0*/ + } + else + { + n1000000_2 = sub_D0C(v5, 1000001); /*0xfdb*/ + if ( n1000000_2 > n1000000_1 ) /*0xfe6*/ + { + sub_788( /*0xff7*/ + "e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", + 617, + "(AsciiStrnLenS (Format, (_gPcd_FixedAtBuild_PcdMaximumAsciiStringLength) + 1) <= (_gPcd_FixedAtBuild_PcdMaximumA" + "sciiStringLength))"); + n1000000_1 = 1000000; /*0xffc*/ + } + v16 = sub_D0C(v5, n1000000_1 + 1); /*0x100a*/ + if ( v16 > v17 ) /*0x1015*/ + return 0; /*0x1015*/ + n2_1 = 1; /*0x101b*/ + n0xFFFF = 255; /*0x1021*/ + } + n2_2 = n2_1; /*0x1029*/ + if ( v9 ) /*0x1030*/ + { + v8 &= -(__int64)(n0xF4240 != 0); /*0x103b*/ + } + else if ( !n0xF4240 ) /*0x1043*/ + { + return 0; /*0x1043*/ + } + v18 = 0; /*0x1049*/ + v19 = 0; /*0x104b*/ + v101 = 0; /*0x104e*/ + v87 = 0; /*0x1052*/ + v89 = 0; /*0x1056*/ + if ( v8 ) /*0x105d*/ + { + v101 = v8; /*0x106a*/ + v18 = v8 + n2 * (n0xF4240 - 1); /*0x106e*/ + v89 = v18; /*0x1071*/ + } + if ( n2_1 == 1 ) /*0x1079*/ + LODWORD(v20) = 0; /*0x107b*/ + else + LODWORD(v20) = (char)v5[1] << 8; /*0x1083*/ + v21 = *v5; /*0x1086*/ + v20 = (int)v20; /*0x1089*/ +LABEL_243: + n10 = n0xFFFF & (v20 | v21); /*0x1c30*/ + n13 = n10; /*0x1c3a*/ + if ( n10 ) + { + v22 = v5; /*0x1090*/ + v23 = v5; /*0x1093*/ + if ( !v8 || v8 < v18 ) + { + v96 = 0; /*0x10a4*/ + v24 = 0; /*0x10a9*/ + v98 = 0; /*0x10ac*/ + v6 &= 0x2140u; /*0x10b2*/ + n43_1 = 0; /*0x10b9*/ + v25 = 0; /*0x10bc*/ + v105 = v6; /*0x10bf*/ + v107 = 0; /*0x10c3*/ + v26 = 1; /*0x10c9*/ + v93 = 1; /*0x10ce*/ + v91 = 0; /*0x10d6*/ + if ( n10 == 10 ) /*0x10de*/ + { + v5 += n2_1; /*0x189b*/ + _r_n_1 = "\r\n"; /*0x189e*/ + if ( n2_1 == 1 ) /*0x18a8*/ + v59 = 0; /*0x18aa*/ + else + v59 = (char)v5[1] << 8; /*0x18b2*/ + n13 = n0xFFFF & (*v5 | (unsigned __int64)v59); /*0x18c6*/ + if ( n13 != 13 ) /*0x18ca*/ + v5 = v22; /*0x18ca*/ + v106 = v5; /*0x18ce*/ + goto LABEL_91; /*0x18d2*/ + } + if ( n10 == 13 ) /*0x10e8*/ + { + v5 += n2_1; /*0x1869*/ + v106 = v5; /*0x186c*/ + if ( n2_1 == 1 ) /*0x1873*/ + v42 = 0; /*0x1875*/ + else + v42 = (char)v5[1] << 8; /*0x1880*/ +LABEL_97: + n13 = n0xFFFF & (*v5 | (unsigned __int64)v42); /*0x13b5*/ + if ( n13 == 10 ) /*0x13c9*/ + { + _r_n_1 = "\r\n"; /*0x13cf*/ + } + else + { + _r_n_1 = "\r"; /*0x1888*/ + v106 = v23; /*0x188f*/ + v5 = v23; /*0x1893*/ + } + goto LABEL_91; /*0x13d6*/ + } + if ( n10 != 37 ) /*0x10f2*/ + { + LOWORD(v6) = v6 | 0x400; /*0x10f4*/ + _r_n_1 = (const char *)&n13; /*0x10f9*/ + v105 = v6; /*0x10fd*/ + goto LABEL_91; /*0x1101*/ + } + v28 = a5; /*0x1106*/ + while ( 1 ) + { + while ( 1 ) + { + v29 = v5; /*0x1113*/ + v5 += n2_1; /*0x1116*/ + v106 = v5; /*0x1119*/ + v30 = n2_1 == 1 ? 0 : (char)v5[1] << 8; + n13_1 = n0xFFFF & (v30 | (unsigned __int64)*v5); /*0x1136*/ + n13 = n13_1; /*0x1139*/ + if ( n13_1 > 0x2D ) /*0x1141*/ + break; /*0x1141*/ + switch ( n13_1 ) + { + case 0x2DuLL: + v6 |= 1uLL; /*0x11f4*/ + goto LABEL_76; /*0x11f8*/ + case 0uLL: + v26 = 0; /*0x12b6*/ + v106 = v29; /*0x12b8*/ + v93 = 0; /*0x12bc*/ + v5 = v29; /*0x12c0*/ +LABEL_78: + v34 = v5; /*0x12c3*/ + v23 = v5; /*0x12c6*/ + if ( n13_1 > 0x67 ) /*0x12cd*/ + { + v48 = n13_1 - 112; /*0x1500*/ + if ( v48 ) /*0x1504*/ + { + v49 = v48 - 2; /*0x150a*/ + if ( v49 ) /*0x150e*/ + { + v50 = v49 - 1; /*0x1514*/ + if ( !v50 ) /*0x1518*/ + { +LABEL_119: + LOWORD(v6) = v6 | 0x400; /*0x15cc*/ + v105 = v6; /*0x15d1*/ +LABEL_120: + _r_n_1 = (const char *)*v28; /*0x15da*/ + a5 = v28 + 1; /*0x15e1*/ + if ( !*v28 ) /*0x15da*/ + { + LOWORD(v6) = v6 & 0xFBFF; /*0x15fa*/ + _r_n_1 = ""; /*0x15ff*/ + v105 = v6; /*0x1606*/ + } + v26 &= -(__int64)((v6 & 0x800) != 0); /*0x1618*/ + goto LABEL_90; /*0x161b*/ + } + v51 = v50 - 1; /*0x151e*/ + if ( v51 ) /*0x1522*/ + { + n3 = v51 - 1; /*0x1524*/ + if ( n3 ) /*0x1528*/ + { + if ( n3 != 3 ) /*0x1532*/ + goto LABEL_114; /*0x1532*/ + goto LABEL_132; /*0x1532*/ + } + goto LABEL_133; /*0x1528*/ + } + a5 = v28 + 1; /*0x154d*/ + if ( !*v28 ) /*0x1546*/ + { + v24 = v91; /*0x1566*/ + _r_n_1 = ""; /*0x156a*/ + goto LABEL_90; /*0x1571*/ + } + sub_1CD0( /*0x15b6*/ + _r_n, + 38, + 0, + "%02d/%02d/%04d %02d:%02d", + *((unsigned __int8 *)*v28 + 2), + *((unsigned __int8 *)*v28 + 3), + **v28, + *((unsigned __int8 *)*v28 + 4), + *((unsigned __int8 *)*v28 + 5)); + _r_n_1 = _r_n; /*0x15bb*/ +LABEL_118: + v24 = v91; /*0x15bf*/ + v25 = 0; /*0x15c3*/ + goto LABEL_90; /*0x15c7*/ + } + n5 = *v28; /*0x1625*/ + a5 = v28 + 1; /*0x162c*/ + _r_n_1 = _r_n; /*0x1640*/ + if ( (__int64)*v28 >= 0 ) /*0x1647*/ + { + if ( (unsigned __int64)n5 <= 5 ) /*0x1675*/ + { + _r_n_1 = off_8C70[(_QWORD)n5];// "Success" /*0x167e*/ + goto LABEL_128; /*0x167e*/ + } + } + else if ( ((unsigned __int64)n5 & 0x7FFFFFFFFFFFFFFFLL) - 1 <= 0x20 ) /*0x1661*/ + { + _r_n_1 = off_8C70[(_QWORD)n5 + 5];// "Success" /*0x166a*/ +LABEL_128: + if ( _r_n_1 != _r_n ) /*0x1689*/ + goto LABEL_90; /*0x1689*/ + } + sub_1CD0(_r_n, 38, 0, "%08X", (_DWORD)n5); /*0x16a6*/ + goto LABEL_118; /*0x16ab*/ + } + LOWORD(v6) = v6 & 0xFFC9 | 0x10; /*0x16b4*/ +LABEL_131: + LOWORD(v6) = v6 | 0x20; /*0x16b8*/ +LABEL_132: + LOWORD(v6) = v6 | 0x80; /*0x16bc*/ +LABEL_133: + if ( (v6 & 0x80u) == 0LL ) /*0x16c4*/ + LOWORD(v6) = v6 & 0xBFFD | 0x4000; /*0x16ca*/ +LABEL_135: + if ( (v6 & 0x10) != 0 ) /*0x16d5*/ + v54 = (__int64)*v28; /*0x16fa*/ + else + v54 = *(int *)v28; /*0x16dc*/ + a5 = v28 + 1; /*0x16e3*/ + n43 = (8 * v6) & 0x20; /*0x171d*/ + if ( (v6 & 2) != 0 ) /*0x172a*/ + n43 = 43; /*0x172a*/ + n43_1 = n43; /*0x1734*/ + v56 = (v6 & 8) != 0; /*0x1738*/ + v107 = v56; /*0x173c*/ + if ( (v6 & 0x80u) != 0LL ) /*0x1746*/ + { + v56 = 0; /*0x1789*/ + n16 = 16; /*0x178c*/ + v107 = 0; /*0x1792*/ + if ( (v6 & 0x10) != 0 || v54 >= 0 ) /*0x17a1*/ + goto LABEL_151; /*0x17a1*/ + } + else + { + n16 = 10; /*0x1748*/ + if ( (v6 & 8) != 0 ) /*0x1751*/ + { + LOWORD(v6) = v6 & 0xFFDF; /*0x1753*/ + v26 = 1; /*0x1757*/ + } + if ( v54 < 0 && (v6 & 0x4000) == 0 ) /*0x1765*/ + { + LOWORD(v6) = v6 | 2; /*0x1767*/ + n43 = 45; /*0x176b*/ + n43_1 = 45; /*0x176e*/ + v54 = -v54; /*0x1772*/ +LABEL_151: + v24 = sub_D94(_r_n, v54, n16) - (_QWORD)_r_n; /*0x17a5*/ + v91 = v24; /*0x17bb*/ + if ( !v54 ) /*0x17c2*/ + { + v24 &= -(__int64)(v26 != 0); /*0x17cd*/ + v91 = v24; /*0x17d0*/ + } + _r_n_1 = &_r_n[v24]; /*0x17e2*/ + v58 = 3 - v24 % 3; /*0x17fd*/ + if ( !(v24 % 3) ) /*0x17fa*/ + v58 = 0; /*0x1803*/ + v98 = v58; /*0x1807*/ + if ( v56 && v24 ) /*0x1813*/ + { + v24 += (v24 - 1) / 3; /*0x1822*/ + v58 = v98; /*0x1825*/ + v91 = v24; /*0x1829*/ + } + if ( n43 ) /*0x1830*/ + { + v91 = ++v24; /*0x1835*/ + ++v26; /*0x1839*/ + } + LOWORD(v6) = v6 | 0x1000; /*0x183c*/ + v25 = 1; /*0x1841*/ + v105 = v6; /*0x1847*/ + if ( (v6 & 0xA21) == 0x220 ) /*0x1856*/ + { + v26 = (unsigned __int64)v96; /*0x185c*/ + v98 = v58; /*0x1860*/ + } + goto LABEL_90; /*0x1864*/ + } + if ( (v6 & 0x4010) != 0x4000 ) /*0x1785*/ + goto LABEL_151; /*0x1785*/ + } + v54 = (unsigned int)v54; /*0x17a3*/ + goto LABEL_151; /*0x17a3*/ + } + if ( n13_1 == 103 ) /*0x12d3*/ + { + v44 = (unsigned __int8 *)*v28; /*0x142a*/ + a5 = v28 + 1; /*0x1431*/ + if ( *v28 ) /*0x142a*/ + { + v45 = sub_2B6C(v44, v5, v5); /*0x1466*/ + v46 = (unsigned __int16)sub_2B34(v44 + 4); /*0x1472*/ + v47 = sub_2B34(v44 + 6); /*0x1476*/ + sub_1CD0( /*0x14e6*/ + _r_n, + 38, + 0, + "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + v45, + v46, + v47, + v44[8], + v44[9], + v44[10], + v44[11], + v44[12], + v44[13], + v44[14], + v44[15]); + v24 = v91; /*0x14eb*/ + _r_n_1 = _r_n; /*0x14ef*/ + v25 = 0; /*0x14f3*/ + v5 = v106; /*0x14f7*/ + } + else + { + _r_n_1 = ""; /*0x144a*/ + } + v26 = v93; /*0x1451*/ + goto LABEL_90; /*0x1455*/ + } + v35 = n13_1 - 10; /*0x12d9*/ + if ( !v35 ) /*0x12dd*/ + { + v5 += n2_1; /*0x13db*/ + _r_n_1 = "\r\n"; /*0x13de*/ + v106 = v5; /*0x13e5*/ + if ( n2_1 == 1 ) /*0x13ed*/ + v43 = 0; /*0x13ef*/ + else + v43 = (char)v5[1] << 8; /*0x13f7*/ + v19 = v87; /*0x13fa*/ + n13 = n0xFFFF & (*v5 | (unsigned __int64)v43); /*0x140b*/ + if ( n13 != 13 ) /*0x1413*/ + { + v5 = v34; /*0x1419*/ + v106 = v34; /*0x141c*/ + } + goto LABEL_91; /*0x1420*/ + } + v36 = v35 - 3; /*0x12e3*/ + if ( !v36 ) /*0x12e7*/ + { + v5 += n2_1; /*0x1399*/ + v106 = v5; /*0x139c*/ + if ( n2_1 == 1 ) /*0x13a4*/ + v42 = 0; /*0x13a6*/ + else + v42 = (char)v5[1] << 8; /*0x13ae*/ + v19 = v87; /*0x13b1*/ + goto LABEL_97; /*0x13b1*/ + } + v37 = v36 - 70; /*0x12ed*/ + if ( !v37 ) /*0x12f1*/ + goto LABEL_119; /*0x12f1*/ + v38 = v37 - 5; /*0x12f7*/ + if ( !v38 ) /*0x12fb*/ + goto LABEL_131; /*0x12fb*/ + v39 = v38 - 9; /*0x1301*/ + if ( !v39 ) /*0x1305*/ + goto LABEL_120; /*0x1305*/ + v40 = v39 - 2; /*0x130b*/ + if ( !v40 ) /*0x130f*/ + { + a5 = v28 + 1; /*0x132d*/ + v99 = *(unsigned __int16 *)v28; /*0x1342*/ + _r_n_1 = (const char *)&v99; /*0x1346*/ + goto LABEL_89; /*0x1346*/ + } + if ( v40 == 1 ) /*0x1315*/ + goto LABEL_135; /*0x1315*/ +LABEL_114: + _r_n_1 = (const char *)&n13; /*0x1538*/ +LABEL_89: + LOWORD(v6) = v6 | 0x400; /*0x134a*/ + v105 = v6; /*0x134f*/ +LABEL_90: + v19 = v87; /*0x1353*/ +LABEL_91: + v41 = (v6 & 0x400) != 0 ? 0xFFFFLL : 255LL; + if ( (v6 & 0x1000) != 0 ) /*0x1387*/ + { + v104 = ((unsigned __int128)-(__int128)(v6 & 0x400) >> 64) - 1; /*0x1390*/ + } + else + { + v24 = 0; /*0x18d7*/ + for ( i = _r_n_1; ; i += 1 - ((unsigned __int128)-(__int128)(v6 & 0x400) >> 64) ) /*0x18da*/ + { + if ( v24 >= v26 ) /*0x18e0*/ + { + v104 = 1 - ((unsigned __int128)-(__int128)(v6 & 0x400) >> 64); /*0x18e2*/ + if ( (v6 & 0x800) != 0 ) /*0x18eb*/ + break; /*0x18eb*/ + } + v104 = 1 - ((unsigned __int128)-(__int128)(v6 & 0x400) >> 64); /*0x18ff*/ + if ( ((*(unsigned __int8 *)i | (unsigned __int64)(i[1] << 8)) & v41) == 0 ) /*0x1906*/ + break; /*0x1906*/ + ++v24; /*0x1908*/ + } + v91 = v24; /*0x1910*/ + } + if ( v26 < v24 ) /*0x191a*/ + v26 = v24; /*0x191a*/ + n512 = v6 & 0x201; /*0x191e*/ + v94 = v26; /*0x1925*/ + n512_1 = n512; /*0x1929*/ + if ( n512 != 512 || (v87 = n2 * ((_QWORD)v96 - v26) + v19, (v6 & 0x2000) != 0) ) /*0x1953*/ + { + v62 = v89; /*0x197a*/ + } + else + { + v62 = v89; /*0x1955*/ + if ( v8 ) /*0x195c*/ + { + v63 = sub_D60(v8, v89, (int)v96 - (int)v26, 32, n2); /*0x196c*/ + v24 = v91; /*0x1971*/ + v8 = v63; /*0x1975*/ + } + } + v64 = v87; /*0x197e*/ + if ( v25 ) /*0x1985*/ + { + if ( !n43_1 || (v64 = n2 + v87, v88 = v64, (v6 & 0x2000) != 0) ) /*0x19a1*/ + { + v65 = v89; /*0x19de*/ + } + else + { + v65 = v89; /*0x19a3*/ + if ( v8 ) /*0x19aa*/ + { + for ( j = 0; j < 1; ++j ) /*0x19b0*/ + { + if ( v8 >= v89 ) /*0x19b5*/ + break; /*0x19b5*/ + *(_BYTE *)v8 = n43_1; /*0x19b7*/ + if ( n2 != 1 ) /*0x19bf*/ + *(_BYTE *)(v8 + 1) = 0; /*0x19c8*/ + v8 += n2; /*0x19cc*/ + } + v64 = v88; /*0x19d8*/ + } + } + n2_3 = n2; /*0x19e2*/ + v68 = v26 - v24; /*0x19e9*/ + v87 = n2 * (v26 - v24) + v64; /*0x19f9*/ + v69 = v6 & 0x2000; /*0x19fd*/ + if ( (v6 & 0x2000) == 0 && v8 ) /*0x1a08*/ + v8 = sub_D60(v8, v65, v68, (int)v69 + 48, n2); /*0x1a1e*/ + goto LABEL_199; /*0x1a1e*/ + } + n2_3 = n2; /*0x1b6a*/ + v79 = v26 - v24; /*0x1b71*/ + v80 = n2 * (v26 - v24) + v87; /*0x1b7e*/ + v87 = v80; /*0x1b81*/ + v69 = v6 & 0x2000; /*0x1b85*/ + if ( (v6 & 0x2000) == 0 && v8 ) /*0x1b90*/ + { + v81 = sub_D60(v8, v62, v79, (int)v69 + 32, n2); /*0x1b9e*/ + v80 = v87; /*0x1ba3*/ + v8 = v81; /*0x1ba7*/ + } + if ( !n43_1 || (v87 = n2_3 + v80, (v6 & 0x2000) != 0) ) /*0x1bbf*/ + { +LABEL_199: + v70 = v89; /*0x1a21*/ + } + else + { + v70 = v89; /*0x1bc5*/ + if ( v8 ) /*0x1bcc*/ + { + for ( k = 0; k < 1; ++k ) /*0x1bd5*/ + { + if ( v8 >= v89 ) /*0x1bda*/ + break; /*0x1bda*/ + *(_BYTE *)v8 = n43_1; /*0x1be0*/ + if ( n2_3 != 1 ) /*0x1be8*/ + *(_BYTE *)(v8 + 1) = 0; /*0x1bf1*/ + v8 += n2_3; /*0x1bf5*/ + } + } + } + v71 = n43_1 != 0; /*0x1a30*/ + if ( v71 < v91 ) /*0x1a36*/ + { + v72 = v87; /*0x1a40*/ + v73 = v98; /*0x1a44*/ + do /*0x1af2*/ + { + v72 += n2_3; /*0x1a53*/ + v74 = v41 & *(_WORD *)_r_n_1; /*0x1a60*/ + if ( !v69 && v8 ) /*0x1a6b*/ + { + v75 = v89; /*0x1a6d*/ + for ( m = 0; m < 1; ++m ) /*0x1a71*/ + { + if ( v8 >= v75 ) /*0x1a77*/ + break; /*0x1a77*/ + *(_BYTE *)v8 = v74; /*0x1a79*/ + if ( n2_3 != 1 ) /*0x1a81*/ + { + *(_BYTE *)(v8 + 1) = HIBYTE(v74); /*0x1a8a*/ + v75 = v89; /*0x1a8e*/ + } + v8 += n2_3; /*0x1a92*/ + } + v70 = v89; /*0x1a9e*/ + } + _r_n_1 += v104; /*0x1aa2*/ + ++v71; /*0x1aa5*/ + if ( v107 && ++v73 == 3 ) /*0x1ab4*/ + { + v73 = 0; /*0x1ab6*/ + if ( ++v71 >= v91 ) /*0x1abe*/ + break; /*0x1abe*/ + v72 += n2_3; /*0x1ac0*/ + if ( !v69 && v8 ) /*0x1acb*/ + { + for ( n = 0; n < 1; ++n ) /*0x1acd*/ + { + if ( v8 >= v70 ) /*0x1ad2*/ + break; /*0x1ad2*/ + *(_BYTE *)v8 = 44; /*0x1ad4*/ + if ( n2_3 != 1 ) /*0x1add*/ + *(_BYTE *)(v8 + 1) = 0; /*0x1adf*/ + v8 += n2_3; /*0x1ae3*/ + } + } + } + } + while ( v71 < v91 ); /*0x1af2*/ + LOWORD(v6) = v105; /*0x1af8*/ + v5 = v106; /*0x1afc*/ + v87 = v72; /*0x1b00*/ + n512 = n512_1; /*0x1b04*/ + } + v19 = v87; /*0x1b08*/ + if ( n512 != 513 || (v19 = n2_3 * ((_QWORD)v96 - v94) + v87, v87 = v19, v69) ) /*0x1b32*/ + { + v18 = v89; /*0x1c06*/ + } + else + { + v18 = v89; /*0x1b38*/ + if ( v8 ) /*0x1b3f*/ + { + v78 = sub_D60(v8, v89, (int)v96 - (int)v94, 32, n2_3); /*0x1b59*/ + v19 = v87; /*0x1b5e*/ + v8 = v78; /*0x1b62*/ + } + } + n2_1 = n2_2; /*0x1c0a*/ + v5 += n2_2; /*0x1c0e*/ + v106 = v5; /*0x1c11*/ + if ( n2_2 == 1 ) /*0x1c19*/ + v83 = 0; /*0x1c1b*/ + else + v83 = (char)v5[1] << 8; /*0x1c23*/ + v21 = v83; /*0x1c2a*/ + v20 = *v5; /*0x1c2d*/ + goto LABEL_243; /*0x1c2d*/ + case 0x20uLL: + v6 |= 4uLL; /*0x11eb*/ + goto LABEL_76; /*0x11ef*/ + } + if ( n13_1 != 42 ) /*0x1167*/ + { + if ( n13_1 == 43 ) /*0x116d*/ + { + v6 |= 2uLL; /*0x1182*/ + } + else + { + if ( n13_1 != 44 ) /*0x1173*/ + goto LABEL_78; /*0x1173*/ + v6 |= 8uLL; /*0x1179*/ + } + goto LABEL_76; /*0x117d*/ + } + if ( (v6 & 0x800) != 0 ) /*0x118e*/ + { + v26 = (unsigned __int64)*v28++; /*0x11c7*/ + a5 = v28; /*0x11ce*/ + v93 = v26; /*0x11e2*/ + } + else + { + v6 |= 0x200uLL; /*0x1190*/ + v105 = v6; /*0x1195*/ + v32 = *v28++; /*0x119e*/ + a5 = v28; /*0x11a5*/ + v96 = v32; /*0x11b9*/ + } + } + if ( n13_1 == 46 ) /*0x1201*/ + { + v6 |= 0x800uLL; /*0x12aa*/ + goto LABEL_76; /*0x12aa*/ + } + if ( n13_1 == 48 ) /*0x120b*/ + break; /*0x120b*/ + if ( n13_1 <= 0x30 ) /*0x120d*/ + goto LABEL_78; /*0x120d*/ + if ( n13_1 <= 0x39 ) + { +LABEL_66: + v24 = 0; /*0x123c*/ + do + { + if ( n13_1 > 0x39 ) /*0x124d*/ + break; /*0x124d*/ + v5 += n2_1; /*0x1253*/ + v24 = n13_1 + 2 * (5 * v24 - 24); /*0x125a*/ + v33 = n2_1 == 1 ? 0 : (char)v5[1] << 8; + n13_1 = n0xFFFF & (v33 | (unsigned __int64)*v5); /*0x1277*/ + } + while ( n13_1 >= 0x30 ); + v91 = v24; /*0x1280*/ + v5 -= n2_1; /*0x1284*/ + if ( (v6 & 0x800) != 0 ) /*0x128a*/ + { + v26 = v24; /*0x129e*/ + v93 = v24; /*0x12a1*/ + } + else + { + v6 |= 0x200uLL; /*0x128c*/ + v96 = (unsigned __int16 *)v24; /*0x1291*/ + v105 = v6; /*0x1295*/ + } + } + else + { + if ( ((n13_1 - 76) & 0xFFFFFFFFFFFFFFDFuLL) != 0 ) /*0x1223*/ + goto LABEL_78; /*0x1223*/ + v6 |= 0x10uLL; /*0x1229*/ +LABEL_76: + v105 = v6; /*0x12ad*/ + } + } + if ( (v6 & 0x800) == 0 ) /*0x1232*/ + { + v6 |= 0x20uLL; /*0x1234*/ + v105 = v6; /*0x1238*/ + } + goto LABEL_66; /*0x1238*/ + } + } + if ( (v6 & 0x2000) != 0 ) /*0x1c49*/ + return v19 / n2; /*0x1c53*/ + if ( !v8 ) /*0x1c64*/ + sub_788("e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", 1216, "Buffer != ((void *) 0)"); /*0x1c79*/ + v85 = (_BYTE *)v8; /*0x1c81*/ + for ( ii = 0; ii < 1; ++ii ) /*0x1c84*/ + { + if ( (unsigned __int64)v85 >= n2 + v18 ) /*0x1c8d*/ + break; /*0x1c8d*/ + *v85 = 0; /*0x1c8f*/ + if ( n2 != 1 ) /*0x1c96*/ + v85[1] = 0; /*0x1c98*/ + v85 += n2; /*0x1c9c*/ + } + return (__int64)(v8 - v101) / n2; /*0x1cbc*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/CallSystemInventoryProtocolMethod.c b/LenovoServerPkg/SystemInventory/SystemInventory/CallSystemInventoryProtocolMethod.c new file mode 100644 index 0000000..e101cea --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/CallSystemInventoryProtocolMethod.c @@ -0,0 +1,35 @@ +__int64 __fastcall CallSystemInventoryProtocolMethod(char a1, __int64 a2, __int64 a3, __int64 a4, int a5, __int64 a6, _DWORD *a7, _BYTE *a8) +{ + __int64 v8; // r10 + __int64 v9; // rdi + char v10; // si + char v11; // bp + __int64 result; // rax + + v8 = qword_96F8; /*0x2569*/ + v9 = a4; /*0x2570*/ + v10 = a3; /*0x2573*/ + v11 = a2; /*0x2576*/ + if ( !qword_96F8 ) /*0x257f*/ + { + (*(void (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_93D0, 0, &qword_96F8); /*0x2598*/ + v8 = qword_96F8; /*0x259e*/ + if ( !qword_96F8 ) /*0x25a8*/ + return 0x8000000000000018uLL; /*0x25aa*/ + } + LOBYTE(a4) = v10; /*0x25bb*/ + LOBYTE(a3) = v11; /*0x25c6*/ + LOBYTE(a2) = a1; /*0x25ce*/ + result = (*(__int64 (__fastcall **)(__int64, __int64, __int64, __int64, __int64, int, __int64, _DWORD *))(v8 + 16))( /*0x25e6*/ + v8, + a2, + a3, + a4, + v9, + a5, + a6, + a7); + if ( a8 && (!result || result == 0x8000000000000007uLL && *a7 == 1) ) /*0x2611*/ + *a8 = *(_BYTE *)qword_96F8; /*0x261c*/ + return result; /*0x2636*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/CheckDeviceVpd.c b/LenovoServerPkg/SystemInventory/SystemInventory/CheckDeviceVpd.c new file mode 100644 index 0000000..f167f1e --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/CheckDeviceVpd.c @@ -0,0 +1,238 @@ +unsigned __int64 __fastcall CheckDeviceVpd(__int64 a1, char a2, __int64 a3, _WORD *a4) +{ + __int64 p_n145_2; // r13 + __int64 v7; // rdx + __int64 v8; // rcx + __int64 v9; // rsi + __int64 v10; // r8 + __int64 v11; // r9 + int v12; // r14d + unsigned __int64 v13; // rbp + unsigned int v14; // r14d + __int64 v15; // rdx + __int64 v16; // rcx + __int64 v17; // rsi + __int64 v18; // r8 + __int64 v19; // r9 + unsigned __int64 n0x40; // rax + int v21; // r9d + unsigned __int16 v22; // r15 + __int64 v23; // rdx + __int64 v24; // rcx + __int64 v25; // rdi + __int64 v26; // r8 + __int64 v27; // r9 + unsigned __int16 n4_3; // di + __int16 n3; // ax + unsigned __int16 n4_1; // si + __int16 v31; // bp + int n2; // ebp + unsigned __int16 v33; // r12 + int n145_1; // r15d + __int64 v35; // rcx + __int64 v36; // rcx + __int64 n4_2; // rdi + __int64 p_n145; // rax + __int64 v39; // rdx + __int64 v40; // rcx + __int64 v41; // r8 + __int64 v42; // r9 + __int64 p_n145_1; // rax + int n2_1; // r8d + unsigned __int64 v45; // [rsp+60h] [rbp-F8h] + __int64 v46; // [rsp+68h] [rbp-F0h] BYREF + _BYTE v47[16]; // [rsp+70h] [rbp-E8h] BYREF + unsigned __int8 n145; // [rsp+80h] [rbp-D8h] BYREF + unsigned __int16 n4; // [rsp+81h] [rbp-D7h] + __int16 v50; // [rsp+160h] [rbp+8h] + + v45 = 0x8000000000000003uLL; /*0x2ed9*/ + p_n145_2 = 0; /*0x2ede*/ + if ( (*(_BYTE *)(a1 + 38) & 0x7F) != 0 || (*(_BYTE *)(a1 + 30) & 0x10) == 0 ) /*0x2eef*/ + return 0x8000000000000003uLL; /*0x2ee6*/ + v9 = (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *, _QWORD, _QWORD, int))(qword_96A8 + 280))( /*0x2f21*/ + *(_QWORD *)(a1 + 16), + &unk_9400, + &v46, + 0, + 0, + 2); + if ( v9 < 0 ) + { + if ( (unsigned __int8)sub_7F8(v8, v7, v10, v11) ) + { + if ( (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: OpenProtocol failed. %r\n", v9); + } + return 0x8000000000000003uLL; /*0x2f52*/ + } + v12 = *(unsigned __int8 *)(a1 + 76); /*0x2f54*/ + v13 = 0; /*0x2f59*/ + while ( 1 ) + { + v14 = v12 & 0xFFFFFFFC; /*0x2f66*/ + v17 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, _BYTE *))(v46 + 48))(v46, 2, v14, 2, v47); /*0x2f83*/ + if ( v17 < 0 ) + { + if ( (unsigned __int8)sub_7F8(v16, v15, v18, v19) && (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: Error reading capabilities - CapabilitiesPtr = %x, code=%r\n", v14, v17); + return v17; /*0x3470*/ + } + if ( v47[0] == 3 ) /*0x2f94*/ + break; /*0x2f94*/ + v12 = v47[1]; /*0x2f96*/ + n0x40 = v13++; /*0x2f9c*/ + if ( n0x40 > 0x40 ) + { + if ( (unsigned __int8)sub_7F8(v16, v15, v18, v19) && (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: Impossible number of capabilities. CapabilitiesPtr = %x%d\n", v12, v21); + v12 = 0; /*0x2fce*/ + } + if ( !v12 ) /*0x2fd4*/ + return v45; /*0x2fd4*/ + } + if ( !v14 ) /*0x2fdf*/ + return v45; /*0x2fdf*/ + if ( (unsigned __int8)sub_7F8(v16, v15, v18, v19) && (unsigned __int8)sub_804(64) ) + sub_740( + 64, + "CheckDeviceVpd: Found capabilities %4.4x %4.4x bus=%d,dev=%d,fun=%d,cl=%d.%d.%d, VpdReg=%x\n", + *(unsigned __int16 *)(a1 + 24), + *(unsigned __int16 *)(a1 + 26), + *(_QWORD *)(a1 + 96), + *(_QWORD *)(a1 + 104), + *(_QWORD *)(a1 + 112), + *(unsigned __int8 *)(a1 + 35), + *(unsigned __int8 *)(a1 + 34), + *(unsigned __int8 *)(a1 + 33), + v14); + v50 = 0; /*0x3055*/ + v45 = 0x8000000000000003uLL; /*0x305e*/ + v22 = 0; /*0x3063*/ + while ( 1 ) + { + v25 = sub_5A7C((unsigned int)&n145, v22, 4, v46, v14); /*0x308a*/ + if ( v25 < 0 ) + { + if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: Error reading PciVpd - code = %r\n", v25); + return v45; /*0x343a*/ + } + LOBYTE(v24) = n145; /*0x3096*/ + switch ( n145 ) + { + case 0x78u: + if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: Normal end tag found\n"); + return v45; /*0x3416*/ + case 0xFF: + if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: Bad ID 0xff found. Done.\n"); + return v45; /*0x33f0*/ + case 0u: + if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: Bad ID 0x00 found. Done.\n"); + return v45; /*0x33d2*/ + } + n4_3 = n4; /*0x30b7*/ + if ( (n145 & 0x80u) == 0 ) /*0x30bf*/ + break; /*0x30bf*/ + if ( n4 < 4u ) + { + if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) + { + n2_1 = n4_3; /*0x3378*/ +LABEL_72: + sub_740(64, "CheckDeviceVpd: Invalid length of %hd found. Done.\n", n2_1); + return v45; /*0x338b*/ + } + return v45; /*0x3372*/ + } + n3 = 3; /*0x30ca*/ + n4_1 = n4; /*0x30cf*/ + v31 = n4 + 3; /*0x30d2*/ +LABEL_32: + v33 = v22 + n3; /*0x30f7*/ + n145_1 = n145; /*0x30fe*/ + v35 = (unsigned int)n145 - 130; /*0x3105*/ + if ( n145 != 130 ) + { + v36 = (unsigned int)n145 - 144; /*0x3111*/ + if ( n145 == 144 ) + { + if ( (unsigned __int8)sub_7F8(v36, v23, v26, v27) && (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: Processing R/O region\n"); + } + else if ( n145 != 145 ) + { + if ( (unsigned __int8)sub_7F8(v36, v23, v26, v27) && (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: type 0x%x resource found\n", n145_1); + goto LABEL_61; /*0x314a*/ + } + if ( (unsigned __int8)sub_7F8(v36, v23, v26, v27) && (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: Large Resource Tag type %2.2x found, length = %d\n", n145_1, n4_3); + v35 = 1; /*0x31a5*/ + if ( (unsigned __int8)(a2 + 112) <= 1u && n4_1 > 0x10u ) + { + n4_2 = n4_1; /*0x31be*/ + p_n145 = sub_1D24(n4_1); /*0x31c3*/ + p_n145_2 = p_n145; /*0x31c8*/ + if ( !p_n145 ) + { + if ( (unsigned __int8)sub_7F8(v40, v39, v41, v42) && (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: Unable to allocate memory for resource Done.\n"); + goto LABEL_63; /*0x31fc*/ + } + if ( sub_5A7C(p_n145, v33, n4_1, v46, v14) >= 0 ) + { + if ( (unsigned __int8)sub_7F8(v35, v23, v26, v27) && (unsigned __int8)sub_804(2) ) + sub_740(2, "CheckDeviceVpd: type 0x90/91 - %a\n", p_n145_2); + goto LABEL_60; /*0x324c*/ + } + } +LABEL_61: + if ( p_n145_2 ) /*0x32f4*/ + sub_1D54(p_n145_2); /*0x32f9*/ + goto LABEL_63; /*0x32f9*/ + } + if ( a2 != -126 ) /*0x3256*/ + goto LABEL_61; /*0x3256*/ + n4_2 = n4_1; /*0x325c*/ + p_n145_1 = sub_1D2C(n4_1 + 1LL); /*0x3263*/ + p_n145_2 = p_n145_1; /*0x3268*/ + if ( p_n145_1 ) + { + if ( sub_5A7C(p_n145_1, v33, n4_1, v46, v14) >= 0 ) + { + if ( (unsigned __int8)sub_7F8(v35, v23, v26, v27) && (unsigned __int8)sub_804(2) ) + sub_740(2, "CheckDeviceVpd: type 0x82 - %a\n", p_n145_2); +LABEL_60: + (*(void (__fastcall **)(__int64, __int64, __int64))(qword_96D8 + 352))(a3, p_n145_2, n4_2 + 1); /*0x32c2*/ + v45 = 0; /*0x32e9*/ + *a4 = n4_1 + 1; /*0x32ee*/ + } + goto LABEL_61; /*0x32ee*/ + } +LABEL_63: + if ( (unsigned __int8)sub_7F8(v35, v23, v26, v27) && (unsigned __int8)sub_804(64) ) + sub_740(64, "CheckDeviceVpd: Done Processing VPD Section\n"); + v22 = v31 + v50; /*0x332b*/ + v50 += v31; /*0x332f*/ + if ( !v31 || v45 != 0x8000000000000003uLL ) /*0x3350*/ + return v45; /*0x3350*/ + } + n2 = n145 & 7; /*0x30db*/ + if ( (unsigned __int16)n2 >= 2u ) /*0x30e6*/ + { + n3 = 1; /*0x30ec*/ + n4_1 = n145 & 7; /*0x30f1*/ + v31 = n2 + 1; /*0x30f4*/ + goto LABEL_32; /*0x30f4*/ + } + if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) /*0x33a0*/ + { + n2_1 = n2; /*0x33ad*/ + goto LABEL_72; /*0x33b0*/ + } + return v45; /*0x3473*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/CheckVpdAndUpdateToBmc.c b/LenovoServerPkg/SystemInventory/SystemInventory/CheckVpdAndUpdateToBmc.c new file mode 100644 index 0000000..452d12e --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/CheckVpdAndUpdateToBmc.c @@ -0,0 +1,357 @@ +__int64 __fastcall CheckVpdAndUpdateToBmc(__int64 a1, __int64 a2, __int64 a3, char a4) +{ + double v4; // xmm3_8 + __int64 v5; // rdi + __int64 v6; // r14 + __int64 v7; // r15 + char v8; // r12 + unsigned __int64 v9; // r13 + __int64 v10; // rbx + __int64 i_1; // rax + __int64 i_4; // rbx + __int64 v13; // rbx + __int64 v14; // rbx + __int64 i_5; // rbx + __int64 v16; // rdx + unsigned __int16 n0xFF_1; // bx + char v18; // al + unsigned __int16 n0xFF; // r14 + _BYTE *v20; // rdi + char n0xFF_2; // cl + __int64 v22; // r9 + __int64 v23; // rdx + __int64 v24; // rdx + char v25; // al + unsigned __int16 n0xFF_3; // di + unsigned __int16 i_7; // cx + int i_2; // r15d + int i_8; // edi + unsigned __int8 v30; // r12 + __int64 v31; // rbx + __int64 v32; // r14 + unsigned __int16 v33; // bx + __int64 v34; // rdx + __int64 v35; // r9 + unsigned __int16 i; // cx + int i_3; // r14d + unsigned __int8 v38; // r15 + __int64 v39; // rbx + __int64 v40; // rdi + unsigned __int16 v41; // bx + __int64 v42; // rdx + __int64 v43; // r9 + int v44; // [rsp+28h] [rbp-D8h] + _WORD v45[2]; // [rsp+44h] [rbp-BCh] BYREF + int i_6; // [rsp+48h] [rbp-B8h] + __int64 v47; // [rsp+50h] [rbp-B0h] BYREF + __int64 v48; // [rsp+58h] [rbp-A8h] BYREF + unsigned __int64 v49; // [rsp+60h] [rbp-A0h] BYREF + _BYTE v50[16]; // [rsp+70h] [rbp-90h] BYREF + __int64 v51; // [rsp+80h] [rbp-80h] + _BYTE v52[64]; // [rsp+88h] [rbp-78h] BYREF + _BYTE v53[8]; // [rsp+C8h] [rbp-38h] BYREF + __int64 v54; // [rsp+D0h] [rbp-30h] BYREF + __int64 v55; // [rsp+D8h] [rbp-28h] BYREF + _QWORD v56[3]; // [rsp+E0h] [rbp-20h] BYREF + char v57; // [rsp+FBh] [rbp-5h] + _BYTE v58[65600]; // [rsp+100h] [rbp+0h] BYREF + + v5 = a3; /*0x34b5*/ + v6 = a2; /*0x34b8*/ + v7 = a1; /*0x34bb*/ + v8 = a4; /*0x34ca*/ + sub_65B0(v58, 0, 0x10000); /*0x34cd*/ + v9 = 0; /*0x34ef*/ + v10 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x34f2*/ + if ( v10 >= 0 ) + { + i_1 = (*(__int64 (__fastcall **)(__int64, void *, _QWORD, unsigned __int64 *, __int64 *))(qword_96A8 + 312))( /*0x3554*/ + 2, + &unk_9400, + 0, + &v49, + &v47); + i_4 = i_1; /*0x355a*/ + if ( i_1 >= 0 ) + { + if ( v49 ) + { + do + { + sub_63C(v50, 140); /*0x35aa*/ + v57 = 1; /*0x35c7*/ + v13 = (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *, _QWORD, _QWORD, int))(qword_96A8 + 280))( /*0x35e5*/ + *(_QWORD *)(v47 + 8 * v9), + &unk_9400, + &v48, + 0, + 0, + 2); + if ( v13 >= 0 ) + { + v14 = (*(__int64 (__fastcall **)(__int64, _QWORD, _QWORD, __int64, _BYTE *))(v48 + 48))(v48, 0, 0, 64, v52); /*0x3668*/ + if ( v14 >= 0 ) + { + v51 = *(_QWORD *)(v47 + 8 * v9); /*0x36bf*/ + i_1 = (*(__int64 (__fastcall **)(__int64, _BYTE *, __int64 *, __int64 *, _QWORD *))(v48 + 112))( /*0x36c6*/ + v48, + v53, + &v54, + &v55, + v56); + i_5 = i_1; /*0x36c9*/ + if ( i_1 >= 0 ) + { + if ( v54 == v7 && v55 == v6 && v56[0] == v5 ) + { + (*(void (__fastcall **)(_BYTE *, __int64, _QWORD))(qword_96D8 + 360))(v58, 0x10000, 0); /*0x3728*/ + LOBYTE(v16) = -126; /*0x3733*/ + n0xFF_1 = 0; /*0x3743*/ + if ( sub_2EA4(v50, v16, v58, v45) >= 0 ) + { + v18 = sub_7F8(); /*0x374e*/ + n0xFF = v45[0]; /*0x3753*/ + if ( v18 && (unsigned __int8)sub_804(2) ) + sub_740(2, "CheckVpdAndUpdateToBmc: RDBG VPD type 0x82 , Data Length = %x\n", n0xFF); + if ( n0xFF ) /*0x3783*/ + { + do /*0x37be*/ + { + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3795*/ + sub_740(0x80000000LL, "%x ", (unsigned __int8)v58[n0xFF_1]); /*0x37b1*/ + ++n0xFF_1; /*0x37b6*/ + } + while ( n0xFF_1 < n0xFF ); /*0x37be*/ + v8 = a4; /*0x37c0*/ + } + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x37d3*/ + sub_740(0x80000000LL, "\n"); /*0x37e6*/ + v20 = (_BYTE *)sub_1D2C((unsigned __int8)(n0xFF + 5)); /*0x37f7*/ + n0xFF_2 = n0xFF; /*0x37fa*/ + *v20 = 11; /*0x3806*/ + v20[1] = v8; /*0x3809*/ + v20[3] = -126; /*0x380d*/ + if ( n0xFF > 0xFFu ) /*0x381a*/ + n0xFF_2 = -1; /*0x381a*/ + v20[4] = n0xFF_2; /*0x381d*/ + (*(void (__fastcall **)(_BYTE *, _BYTE *, _QWORD))(qword_96D8 + 352))(v20 + 5, v58, n0xFF); /*0x382b*/ + LOBYTE(v22) = 87; /*0x3837*/ + byte_9699 = 1; /*0x383a*/ + LOBYTE(v23) = 46; /*0x384a*/ + LOBYTE(v44) = n0xFF + 5; /*0x3864*/ + (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, _BYTE *, int, void *, char *))(qword_9690 + 16))( /*0x3870*/ + qword_9690, + v23, + 0, + v22, + v20, + v44, + &unk_9720, + &byte_9699); + (*(void (__fastcall **)(_BYTE *))(qword_96D8 + 72))(v20); /*0x387d*/ + n0xFF_1 = 0; /*0x3880*/ + } + (*(void (__fastcall **)(_BYTE *, __int64, _QWORD))(qword_96D8 + 360))(v58, 0x10000, 0); /*0x3895*/ + LOBYTE(v24) = -112; /*0x38a0*/ + i_1 = sub_2EA4(v50, v24, v58, v45); /*0x38ab*/ + if ( i_1 >= 0 ) + { + v25 = sub_7F8(); /*0x38b9*/ + n0xFF_3 = v45[0]; /*0x38be*/ + if ( v25 && (unsigned __int8)sub_804(2) ) + sub_740(2, "CheckVpdAndUpdateToBmc: RDBG VPD type 0x90/0x91 , Data Length = %x\n", n0xFF_3); + if ( n0xFF_3 ) /*0x38f3*/ + { + do /*0x392d*/ + { + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3905*/ + sub_740(0x80000000LL, "%x ", (unsigned __int8)v58[n0xFF_1]); /*0x3921*/ + ++n0xFF_1; /*0x3926*/ + } + while ( n0xFF_1 < n0xFF_3 ); /*0x392d*/ + v8 = a4; /*0x392f*/ + } + i_1 = sub_7F8(); /*0x3936*/ + if ( (_BYTE)i_1 ) /*0x393f*/ + { + i_1 = sub_804(0x80000000LL); /*0x3944*/ + if ( (_BYTE)i_1 ) /*0x394b*/ + i_1 = sub_740(0x80000000LL, "\n"); /*0x3957*/ + } + i_7 = 0; /*0x3960*/ + i_2 = n0xFF_3 - 1; /*0x3963*/ + i_6 = i_2; /*0x396b*/ + if ( i_2 > 0 ) + { + while ( v58[i_7] != 80 || v58[i_7 + 1] != 78 ) /*0x3988*/ + { + i_1 = ++i_7; /*0x398d*/ + if ( i_7 >= i_2 ) /*0x3993*/ + goto LABEL_74; /*0x3993*/ + } + i_8 = i_7; /*0x399b*/ + v30 = v58[i_7 + 2] + 5; /*0x39a6*/ + v31 = (unsigned int)i_7 + 2; /*0x39aa*/ + v32 = sub_1D2C(v30); /*0x39b5*/ + *(_BYTE *)v32 = 11; /*0x39bb*/ + *(_BYTE *)(v32 + 1) = a4; /*0x39c4*/ + *(_WORD *)(v32 + 2) = 20048; /*0x39cc*/ + *(_BYTE *)(v32 + 4) = v58[v31]; /*0x39da*/ + (*(void (__fastcall **)(__int64, _BYTE *, _QWORD))(qword_96D8 + 352))( /*0x39ef*/ + v32 + 5, + &v58[i_8 + 3], + (unsigned __int8)v58[v31]); + v33 = 0; /*0x39fb*/ + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(2) ) + sub_740(2, "CheckVpdAndUpdateToBmc: RDBG VPD PN Size = %x, IpmiVpdData= %a , \n", v30, v4); + if ( v30 ) /*0x3a2d*/ + { + do /*0x3a66*/ + { + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3a3f*/ + sub_740(0x80000000LL, "%x ", *(unsigned __int8 *)(v33 + v32)); /*0x3a5a*/ + ++v33; /*0x3a5f*/ + } + while ( v33 < v30 ); /*0x3a66*/ + i_2 = i_6; /*0x3a68*/ + } + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3a7b*/ + sub_740(0x80000000LL, "\n"); /*0x3a8e*/ + LOBYTE(v35) = 87; /*0x3a98*/ + byte_9699 = 1; /*0x3a9b*/ + LOBYTE(v34) = 46; /*0x3aab*/ + LOBYTE(v44) = v30; /*0x3ac5*/ + (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, __int64, int, void *, char *))(qword_9690 + 16))( /*0x3ad2*/ + qword_9690, + v34, + 0, + v35, + v32, + v44, + &unk_9720, + &byte_9699); + i_1 = (*(__int64 (__fastcall **)(__int64))(qword_96D8 + 72))(v32); /*0x3adf*/ + v8 = a4; /*0x3ae2*/ + } +LABEL_74: + for ( i = 0; i < i_2; i_1 = ++i ) /*0x3af4*/ + { + i_1 = i; /*0x3af6*/ + if ( v58[i] == 83 && v58[i + 1] == 78 ) /*0x3b05*/ + break; /*0x3b05*/ + } + i_3 = i; /*0x3b12*/ + if ( i != i_2 ) + { + v38 = v58[i + 2] + 5; /*0x3b28*/ + v39 = (unsigned int)i + 2; /*0x3b2c*/ + v40 = sub_1D2C(v38); /*0x3b3c*/ + *(_BYTE *)v40 = 11; /*0x3b43*/ + *(_BYTE *)(v40 + 1) = v8; /*0x3b46*/ + *(_WORD *)(v40 + 2) = 20051; /*0x3b4a*/ + *(_BYTE *)(v40 + 4) = v58[v39]; /*0x3b54*/ + (*(void (__fastcall **)(__int64, _BYTE *, _QWORD))(qword_96D8 + 352))( /*0x3b6f*/ + v40 + 5, + &v58[i_3 + 3], + (unsigned __int8)v58[v39]); + v41 = 0; /*0x3b7b*/ + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(2) ) + sub_740(2, "CheckVpdAndUpdateToBmc: RDBG VPD SN Size = %x, IpmiVpdData= %a , \n", v38, v4); + if ( v38 ) /*0x3bb1*/ + { + do /*0x3bee*/ + { + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3bc6*/ + sub_740(0x80000000LL, "%x ", *(unsigned __int8 *)(v41 + v40)); /*0x3be1*/ + ++v41; /*0x3be6*/ + } + while ( v41 < v38 ); /*0x3bee*/ + v8 = a4; /*0x3bf5*/ + } + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3c0a*/ + sub_740(0x80000000LL, "\n"); /*0x3c1d*/ + LOBYTE(v43) = 87; /*0x3c27*/ + byte_9699 = 1; /*0x3c2a*/ + LOBYTE(v42) = 46; /*0x3c3a*/ + LOBYTE(v44) = v38; /*0x3c54*/ + (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, __int64, int, void *, char *))(qword_9690 + 16))( /*0x3c61*/ + qword_9690, + v42, + 0, + v43, + v40, + v44, + &unk_9720, + &byte_9699); + i_1 = (*(__int64 (__fastcall **)(__int64))(qword_96D8 + 72))(v40); /*0x3c6e*/ + } + v7 = a1; /*0x3c71*/ + } + } + } + else + { + i_1 = sub_7F8(); /*0x36d1*/ + if ( (_BYTE)i_1 ) + { + i_1 = sub_804(0x80000000LL); /*0x36e1*/ + if ( (_BYTE)i_1 ) + i_1 = sub_740(0x80000000LL, "CheckVpdAndUpdateToBmc: error reading Pci Locattion = %r\n", i_5); + } + } + } + else + { + i_1 = sub_7F8(); /*0x3670*/ + if ( (_BYTE)i_1 ) + { + i_1 = sub_804(0x80000000LL); /*0x367c*/ + if ( (_BYTE)i_1 ) + i_1 = sub_740(0x80000000LL, "CheckVpdAndUpdateToBmc: error reading Pci Config space. Code=%r\n", v14); + } + } + } + else + { + i_1 = sub_7F8(); /*0x35ed*/ + if ( (_BYTE)i_1 ) + { + i_1 = sub_804(0x80000000LL); /*0x35f9*/ + if ( (_BYTE)i_1 ) + i_1 = sub_740( + 0x80000000LL, + "CheckVpdAndUpdateToBmc: Error openning handle index %d. Code=%r\n", + v9, + v13); + } + } + v5 = a3; /*0x3619*/ + ++v9; /*0x3620*/ + v6 = a2; /*0x3623*/ + } + while ( v9 < v49 ); + } + } + else + { + i_1 = sub_7F8(); /*0x3562*/ + if ( (_BYTE)i_1 ) + { + i_1 = sub_804(0x80000000LL); /*0x3576*/ + if ( (_BYTE)i_1 ) + return sub_740(0x80000000LL, "CheckVpdAndUpdateToBmc: unable to find any PCI devices. Code=%r\n", i_4); + } + } + } + else + { + i_1 = sub_7F8(); /*0x34fa*/ + if ( (_BYTE)i_1 ) /*0x3501*/ + { + i_1 = sub_804(64); /*0x350d*/ + if ( (_BYTE)i_1 ) /*0x3514*/ + return sub_740(64, "CheckVpdAndUpdateToBmc Locating IPMI Dxe Protocol Status - %r\n", v10); /*0x3526*/ + } + } + return i_1; /*0x3635*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/CreateLegacyBootEventEx.c b/LenovoServerPkg/SystemInventory/SystemInventory/CreateLegacyBootEventEx.c new file mode 100644 index 0000000..3740ef6 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/CreateLegacyBootEventEx.c @@ -0,0 +1,30 @@ +__int64 __fastcall CreateLegacyBootEventEx( + __int64 n16, + __int64 (__fastcall *Callback)(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable), + __int64 a3, + __int64 a4) +{ + __int64 (__fastcall *nullsub_2)(EFI_HANDLE, EFI_SYSTEM_TABLE *); // r8 + + if ( !a4 ) /*0x21f8*/ + sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiNotTiano.c", 86, "LegacyBootEvent != ((void *) 0)"); /*0x220c*/ + if ( SystemTable->Hdr.Revision >= 0x20000 ) /*0x2226*/ + { + nullsub_2 = nullsub_1; /*0x228e*/ + if ( Callback ) /*0x22a5*/ + nullsub_2 = Callback; /*0x22a5*/ + return (*(__int64 (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(EFI_HANDLE, EFI_SYSTEM_TABLE *), __int64, void *, __int64))(qword_96A8 + 368))( /*0x22ae*/ + 512, + n16, + nullsub_2, + a3, + &unk_9390, + a4); + } + else + { + sub_740(0x80000000LL, "EFI1.1 can't support LegacyBootEvent!"); /*0x2247*/ + sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiNotTiano.c", 90, "((BOOLEAN)(0==1))"); /*0x226c*/ + return 0x8000000000000003uLL; /*0x2271*/ + } +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/CreateReadyToBootEventEx.c b/LenovoServerPkg/SystemInventory/SystemInventory/CreateReadyToBootEventEx.c new file mode 100644 index 0000000..e4653dd --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/CreateReadyToBootEventEx.c @@ -0,0 +1,30 @@ +__int64 __fastcall CreateReadyToBootEventEx( + __int64 n8, + __int64 (__fastcall *nullsub)(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable), + __int64 a3, + __int64 a4) +{ + __int64 (__fastcall *nullsub_2)(EFI_HANDLE, EFI_SYSTEM_TABLE *); // r8 + + if ( !a4 ) /*0x22fc*/ + sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiNotTiano.c", 181, "ReadyToBootEvent != ((void *) 0)"); /*0x2311*/ + if ( SystemTable->Hdr.Revision >= 0x20000 ) /*0x232b*/ + { + nullsub_2 = nullsub_1; /*0x2393*/ + if ( nullsub ) /*0x23aa*/ + nullsub_2 = nullsub; /*0x23aa*/ + return (*(__int64 (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(EFI_HANDLE, EFI_SYSTEM_TABLE *), __int64, void *, __int64))(qword_96A8 + 368))( /*0x23b3*/ + 512, + n8, + nullsub_2, + a3, + &unk_9380, + a4); + } + else + { + sub_740(0x80000000LL, "EFI1.1 can't support ReadyToBootEvent!"); /*0x234c*/ + sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiNotTiano.c", 185, "((BOOLEAN)(0==1))"); /*0x2371*/ + return 0x8000000000000003uLL; /*0x2376*/ + } +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/GetBmcVirtualCdDeviceNumber.c b/LenovoServerPkg/SystemInventory/SystemInventory/GetBmcVirtualCdDeviceNumber.c new file mode 100644 index 0000000..02d1879 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/GetBmcVirtualCdDeviceNumber.c @@ -0,0 +1,46 @@ +unsigned __int8 GetBmcVirtualCdDeviceNumber() +{ + __int64 v0; // rbx + __int64 v1; // rdx + __int64 v2; // rcx + __int64 v3; // r8 + __int64 v4; // r9 + __int64 v5; // rdx + __int64 v6; // r9 + unsigned __int8 result; // al + __int64 v8; // rbx + __int64 v9; // rdx + __int64 v10; // rcx + __int64 v11; // r8 + __int64 v12; // r9 + char v13; // [rsp+28h] [rbp-30h] + unsigned __int8 v14; // [rsp+60h] [rbp+8h] BYREF + char v15; // [rsp+68h] [rbp+10h] BYREF + char n4; // [rsp+70h] [rbp+18h] BYREF + + v0 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x3f25*/ + if ( (unsigned __int8)sub_7F8(v2, v1, v3, v4) && (unsigned __int8)sub_804(64) ) /*0x3f3a*/ + sub_740(64, "[System Inventory] Locating IPMI Dxe Protocol Status - %r\n", v0); /*0x3f4f*/ + if ( v0 < 0 ) /*0x3f57*/ + return 0; /*0x3f59*/ + n4 = 4; /*0x3f62*/ + LOBYTE(v6) = -54; /*0x3f6c*/ + v15 = 1; /*0x3f74*/ + v13 = 1; /*0x3f86*/ + LOBYTE(v5) = 50; /*0x3f90*/ + v8 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, char *, char, unsigned __int8 *, char *))(qword_9690 + 16))( /*0x3f9f*/ + qword_9690, + v5, + 0, + v6, + &n4, + v13, + &v14, + &v15); + if ( (unsigned __int8)sub_7F8(v10, v9, v11, v12) && (unsigned __int8)sub_804(64) ) /*0x3fae*/ + sub_740(64, "Get the BMC virtual CD Device Number Status = %r, Number = %x \n", v8, v14); /*0x3fca*/ + result = v14; /*0x3fcf*/ + if ( v8 < 0 ) /*0x3fd7*/ + return 0; /*0x3fd7*/ + return result; /*0x3fda*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/GetSystemConfigurationTableByGuid.c b/LenovoServerPkg/SystemInventory/SystemInventory/GetSystemConfigurationTableByGuid.c new file mode 100644 index 0000000..1a75c35 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/GetSystemConfigurationTableByGuid.c @@ -0,0 +1,23 @@ +unsigned __int64 __fastcall GetSystemConfigurationTableByGuid(__int64 a1, void **a2) +{ + EFI_SYSTEM_TABLE *SystemTable; // rdi + __int64 v5; // rbx + __int64 i; // r14 + + if ( !a1 ) /*0x1f7c*/ + sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 97, "TableGuid != ((void *) 0)"); /*0x1f8f*/ + if ( !a2 ) /*0x1fa1*/ + sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 98, "Table != ((void *) 0)"); /*0x1fb4*/ + SystemTable = SystemTable; /*0x1fb9*/ + v5 = 0; /*0x1fc0*/ + *a2 = 0; /*0x1fc2*/ + if ( !SystemTable->NumberOfTableEntries ) /*0x1fc6*/ + return 0x800000000000000EuLL; /*0x1fef*/ + for ( i = 0; !(unsigned __int8)sub_2ACC(a1, &SystemTable->ConfigurationTable[i]); ++i ) /*0x1fcc*/ + { + if ( ++v5 >= SystemTable->NumberOfTableEntries ) /*0x1fed*/ + return 0x800000000000000EuLL; /*0x1fed*/ + } + *a2 = SystemTable->ConfigurationTable[v5].VendorTable; /*0x2023*/ + return 0; /*0x200d*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/InitializeCpuInfo.c b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeCpuInfo.c new file mode 100644 index 0000000..67a1397 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeCpuInfo.c @@ -0,0 +1,127 @@ +__int64 __fastcall InitializeCpuInfo(__int64 a1, __int64 a2, __int64 a3, __int64 a4) +{ + double v4; // xmm3_8 + __int64 v5; // rdx + __int64 v6; // rcx + __int64 v7; // rbx + __int64 v8; // r8 + __int64 v9; // r9 + __int64 result; // rax + unsigned __int8 v11; // si + __int64 v12; // rdi + unsigned __int8 n2; // bp + __int64 v14; // rdx + __int64 v15; // rcx + __int64 v16; // r8 + __int64 v17; // r9 + __int64 v18; // rbx + unsigned __int8 v19; // dl + __int64 v20; // rdx + __int64 v21; // rcx + __int64 v22; // r8 + __int64 v23; // r9 + __int64 v24; // rdx + __int64 v25; // rcx + __int64 v26; // r8 + __int64 v27; // r9 + __int64 v28; // rdx + __int64 v29; // rcx + __int64 v30; // r8 + __int64 v31; // r9 + __int64 v32; // rdx + __int64 v33; // rcx + __int64 v34; // r8 + __int64 v35; // r9 + __int64 v36; // rdx + __int64 v37; // rcx + __int64 v38; // r8 + __int64 v39; // r9 + __int64 v40; // rdx + __int64 v41; // rcx + __int64 v42; // r8 + __int64 v43; // r9 + _QWORD v44[9]; // [rsp+30h] [rbp-48h] BYREF + char v45; // [rsp+80h] [rbp+8h] BYREF + int v46; // [rsp+88h] [rbp+10h] BYREF + int v47; // [rsp+90h] [rbp+18h] BYREF + char v48; // [rsp+98h] [rbp+20h] BYREF + + if ( (unsigned __int8)sub_7F8(a1, a2, a3, a4) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4873*/ + sub_740(0x80000000LL, "Enter InitializeCpuData ... \n"); /*0x4886*/ + *(_BYTE *)(qword_9680 + 86LL) = 2; /*0x4892*/ + if ( qword_9670 /*0x48c3*/ + || (v7 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96D8 + 320))(&unk_93F0, 0, &qword_9670), + v7 >= 0) ) + { + v11 = 0; /*0x48f9*/ + v12 = 0; /*0x4903*/ + do /*0x4bec*/ + { + n2 = v11 + 1; /*0x490c*/ + LOBYTE(v5) = v11 + 1; /*0x4917*/ + LOBYTE(v6) = 4; /*0x491f*/ + *(_BYTE *)(v12 + qword_9680 + 87) = v11 + 1; /*0x4921*/ + if ( (*(__int64 (__fastcall **)(__int64, __int64, _QWORD *, char *))(qword_9670 + 64))(v6, v5, v44, &v45) >= 0 ) /*0x4933*/ + { + v18 = v44[0]; /*0x4939*/ + *(_BYTE *)(v12 + qword_9680 + 88) = *(_BYTE *)(v44[0] + 35LL); /*0x4954*/ + *(_BYTE *)(v12 + qword_9680 + 89) = *(_BYTE *)(v18 + 37); /*0x4962*/ + sub_D38(v12 + qword_9680 + 90LL, 13, "Intel"); /*0x4974*/ + *(_DWORD *)(v12 + qword_9680 + 166) = *(unsigned __int16 *)(v18 + 20); /*0x49a2*/ + ParsePciDevicePathLocation(*(_DWORD *)(v18 + 8), (unsigned int)&v48, (unsigned int)&v46, (unsigned int)&v47, 0); /*0x49ac*/ + v19 = 0; /*0x49b6*/ + while ( *((_WORD *)&unk_9518 + 5 * v19) != *(unsigned __int8 *)(v18 + 6) /*0x49d0*/ + && *((_WORD *)&unk_9518 + 5 * v19) != 255 ) + { + if ( ++v19 >= 3u ) /*0x49d7*/ + goto LABEL_17; /*0x49d7*/ + } + sub_D38(v12 + qword_9680 + 103LL, 30, *(const char **)((char *)&unk_9518 + 10 * v19 + 2)); /*0x49fa*/ +LABEL_17: + sub_D38(v12 + qword_9680 + 133LL, 30, "%2Xh Model", v46); /*0x49ff*/ + sub_D38(v12 + qword_9680 + 163LL, 3, "%X", v47); /*0x4a4e*/ + } + if ( (unsigned __int8)sub_7F8(v15, v14, v16, v17) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4a5f*/ + sub_740( /*0x4a83*/ + 0x80000000LL, + "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.CoreCount = %x \n", + v11, + *(unsigned __int8 *)(v12 + qword_9680 + 88)); + if ( (unsigned __int8)sub_7F8(v21, v20, v22, v23) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4a94*/ + sub_740( /*0x4ab8*/ + 0x80000000LL, + "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.ThreadCount = %x \n", + v11, + *(unsigned __int8 *)(v12 + qword_9680 + 89)); + if ( (unsigned __int8)sub_7F8(v25, v24, v26, v27) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4ac9*/ + sub_740(0x80000000LL, "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.CpuVendor = %a \n", v11, v4); /*0x4aee*/ + if ( (unsigned __int8)sub_7F8(v29, v28, v30, v31) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4aff*/ + sub_740(0x80000000LL, "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.CpuFamilyName = %a \n", v11, v4); /*0x4b24*/ + if ( (unsigned __int8)sub_7F8(v33, v32, v34, v35) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4b35*/ + sub_740(0x80000000LL, "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.CpuModelIdName = %a \n", v11, v4); /*0x4b5d*/ + if ( (unsigned __int8)sub_7F8(v37, v36, v38, v39) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4b6e*/ + sub_740(0x80000000LL, "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.Stepping = %a \n", v11, v4); /*0x4b96*/ + if ( (unsigned __int8)sub_7F8(v41, v40, v42, v43) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4ba7*/ + sub_740( /*0x4bcd*/ + 0x80000000LL, + "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.MaxFrequency = %x \n", + v11, + *(_DWORD *)(v12 + qword_9680 + 166)); + result = (*(__int64 (__fastcall **)(_QWORD))(qword_96D8 + 72))(v44[0]); /*0x4bde*/ + v12 += 85; /*0x4be1*/ + ++v11; /*0x4be5*/ + } + while ( n2 < 2u ); /*0x4bec*/ + } + else + { + result = sub_7F8(v6, v5, v8, v9); /*0x48c5*/ + if ( (_BYTE)result ) /*0x48cc*/ + { + result = sub_804(0x80000000LL); /*0x48d5*/ + if ( (_BYTE)result ) /*0x48dc*/ + return sub_740(0x80000000LL, "LocateProtocol gAmiSmbiosProtocolGuid Status = %r ... \n", v7); /*0x48ef*/ + } + } + return result; /*0x4bf2*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/InitializeDimmInfo.c b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeDimmInfo.c new file mode 100644 index 0000000..dca7ab5 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeDimmInfo.c @@ -0,0 +1,201 @@ +__int64 __fastcall InitializeDimmInfo(__int64 a1, __int64 a2, __int64 a3, double a4) +{ + __int64 result; // rax + unsigned __int8 v5; // r14 + __int64 i; // rbx + unsigned __int8 n0x18; // r12 + void *v8; // rdx + __int64 v9; // rcx + __int64 v10; // r8 + __int64 v11; // r9 + __int64 v12; // rsi + __int16 v13; // cx + unsigned __int8 v14; // di + __int64 v15; // rcx + __int64 v16; // rcx + const char *_1.2V; // r8 + __int64 v18; // rdx + __int64 v19; // rdx + __int64 v20; // rdx + unsigned __int8 n4; // di + __int64 i_1; // r15 + unsigned __int64 v23; // rax + char v24; // cl + __int64 v25; // rdx + __int64 v26; // rcx + __int64 v27; // r8 + __int64 v28; // r9 + __int64 v29; // rdx + __int64 v30; // rcx + __int64 v31; // r8 + __int64 v32; // r9 + __int64 v33; // rdx + __int64 v34; // rcx + __int64 v35; // r8 + __int64 v36; // r9 + __int64 v37; // rdx + __int64 v38; // rcx + __int64 v39; // r8 + __int64 v40; // r9 + __int64 v41; // rdx + __int64 v42; // rcx + __int64 v43; // r8 + __int64 v44; // r9 + __int64 v45; // rdx + __int64 v46; // rcx + __int64 v47; // r8 + __int64 v48; // r9 + __int64 v49; // rdx + __int64 v50; // rcx + __int64 v51; // r8 + __int64 v52; // r9 + __int64 v53; // rdx + __int64 v54; // rcx + __int64 v55; // r8 + __int64 v56; // r9 + __int64 v57; // rdx + __int64 v58; // rcx + __int64 v59; // r8 + __int64 v60; // r9 + char v61; // [rsp+60h] [rbp+40h] BYREF + __int64 v62; // [rsp+68h] [rbp+48h] BYREF + __int64 v63; // [rsp+70h] [rbp+50h] BYREF + + v63 = 0; /*0x4c12*/ + v62 = 0; /*0x4c17*/ + *(_BYTE *)(qword_9680 + 257) = 24; /*0x4c23*/ + if ( qword_9678 /*0x4c54*/ + || (result = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96D8 + 320))(&unk_93F0, 0, &qword_9678), + result >= 0) ) + { + v5 = 0; /*0x4c5a*/ + for ( i = 0; ; i += 84 ) /*0x4c63*/ + { + n0x18 = v5 + 1; /*0x4c6c*/ + LOBYTE(a2) = v5 + 1; /*0x4c74*/ + LOBYTE(a1) = 17; /*0x4c7b*/ + *(_BYTE *)(i + qword_9680 + 258) = v5 + 1; /*0x4c7d*/ + if ( (*(__int64 (__fastcall **)(__int64, __int64, __int64 *, char *))(qword_9678 + 64))(a1, a2, &v63, &v61) >= 0 ) /*0x4c92*/ + break; /*0x4c92*/ +LABEL_33: + if ( (unsigned __int8)sub_7F8(v9, v8, v10, v11) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4eb6*/ + sub_740( /*0x4edd*/ + 0x80000000LL, + "gSystemInventoryProtocol->DimmInfo[%d].DimmSlotIndex = %x \n", + v5, + *(unsigned __int8 *)(i + qword_9680 + 258)); + if ( (unsigned __int8)sub_7F8(v26, v25, v27, v28) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4eee*/ + sub_740( /*0x4f15*/ + 0x80000000LL, + "gSystemInventoryProtocol->DimmInfo[%d].NodeNumber = %x \n", + v5, + *(unsigned __int8 *)(i + qword_9680 + 259)); + if ( (unsigned __int8)sub_7F8(v30, v29, v31, v32) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4f26*/ + sub_740( /*0x4f4d*/ + 0x80000000LL, + "gSystemInventoryProtocol->DimmInfo[%d].ChannelNumber = %x \n", + v5, + *(unsigned __int8 *)(i + qword_9680 + 260)); + if ( (unsigned __int8)sub_7F8(v34, v33, v35, v36) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4f5e*/ + sub_740(0x80000000LL, "gSystemInventoryProtocol->DimmInfo[%d].DimmType = %a \n", v5, a4); /*0x4f86*/ + if ( (unsigned __int8)sub_7F8(v38, v37, v39, v40) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4f97*/ + sub_740(0x80000000LL, "gSystemInventoryProtocol->DimmInfo[%d].DdrVoltage = %a \n", v5, a4); /*0x4fbf*/ + if ( (unsigned __int8)sub_7F8(v42, v41, v43, v44) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4fd0*/ + sub_740( /*0x4ff7*/ + 0x80000000LL, + "gSystemInventoryProtocol->DimmInfo[%d].DimmFreq = %d \n", + v5, + *(unsigned __int16 *)(i + qword_9680 + 281)); + if ( (unsigned __int8)sub_7F8(v46, v45, v47, v48) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x5008*/ + sub_740( /*0x502f*/ + 0x80000000LL, + "gSystemInventoryProtocol->DimmInfo[%d].DimmSize = %d \n", + v5, + *(unsigned __int16 *)(i + qword_9680 + 283)); + if ( (unsigned __int8)sub_7F8(v50, v49, v51, v52) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x5040*/ + sub_740(0x80000000LL, "gSystemInventoryProtocol->DimmInfo[%d].ManufacturerIdName = %a \n", v5, a4); /*0x5068*/ + if ( (unsigned __int8)sub_7F8(v54, v53, v55, v56) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x5079*/ + sub_740(0x80000000LL, "gSystemInventoryProtocol->DimmInfo[%d].SerialNumber = %a \n", v5, a4); /*0x50a1*/ + if ( (unsigned __int8)sub_7F8(v58, v57, v59, v60) ) /*0x50a6*/ + { + if ( (unsigned __int8)sub_804(0x80000000LL) ) /*0x50b2*/ + sub_740(0x80000000LL, "gSystemInventoryProtocol->DimmInfo[%d].PartNumber = %a \n", v5, a4); /*0x50da*/ + } + (*(void (__fastcall **)(__int64))(qword_96D8 + 72))(v63); /*0x50ea*/ + ++v5; /*0x50f1*/ + if ( n0x18 >= 0x18u ) /*0x50f8*/ + return 0; /*0x50fe*/ + } + v12 = v63; /*0x4ca2*/ + *(_BYTE *)(i + qword_9680 + 260) = (v5 >> 1) + 65; /*0x4cab*/ + if ( *(_WORD *)(v12 + 12) == 0x7FFF ) /*0x4cbb*/ + v13 = *(_WORD *)(v12 + 28); /*0x4cbd*/ + else + v13 = *(_WORD *)(v12 + 12); /*0x4cc3*/ + v14 = 0; /*0x4cce*/ + *(_WORD *)(i + qword_9680 + 283) = v13; /*0x4cd1*/ + v15 = *(unsigned __int16 *)(v12 + 21); /*0x4ce0*/ + *(_WORD *)(i + qword_9680 + 281) = v15; /*0x4ce4*/ + while ( 1 ) /*0x4cec*/ + { + if ( (unsigned __int8)sub_7F8(v15, v8, v10, v11) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4cf8*/ + sub_740( /*0x4d24*/ + 0x80000000LL, + "gSmbiosDimmTypeNameMapping[j].Value = %x, Type17->MemoryType = %x\n", + *((unsigned __int16 *)&unk_9540 + 5 * v14), + *(unsigned __int8 *)(v12 + 18)); + v8 = &unk_9540; /*0x4d2d*/ + v15 = 5LL * v14; /*0x4d34*/ + if ( *((_WORD *)&unk_9540 + 5 * v14) == *(unsigned __int8 *)(v12 + 18) ) /*0x4d40*/ + break; /*0x4d40*/ + if ( ++v14 >= 0x1Eu ) /*0x4d49*/ + goto LABEL_16; /*0x4d49*/ + } + sub_D38(i + qword_9680 + 261, 10, *(_QWORD *)((char *)&unk_9540 + 10 * v14 + 2)); /*0x4d77*/ +LABEL_16: + switch ( *(_WORD *)(v12 + 38) ) /*0x4d89*/ + { + case 0x4B0: /*0x4d89*/ + _1.2V = "1.2V"; /*0x4dc8*/ + break; + case 0x4E2: /*0x4d89*/ + _1.2V = "1.25V"; /*0x4dbf*/ + break; + case 0x546: /*0x4d89*/ + _1.2V = "1.35V"; /*0x4db6*/ + break; + default: + v16 = qword_9680; /*0x4d9b*/ + if ( *(_WORD *)(v12 + 38) == 1500 ) /*0x4da2*/ + _1.2V = "1.5V"; /*0x4dad*/ + else + _1.2V = "N/A"; /*0x4da4*/ + goto LABEL_26; /*0x4dab*/ + } + v16 = qword_9680; /*0x4dcf*/ +LABEL_26: + sub_D38(i + v16 + 271, 10, _1.2V); /*0x4dd6*/ + LOBYTE(v18) = *(_BYTE *)(v12 + 23); /*0x4de5*/ + if ( !sub_27B8(v63, v18, &v62) ) /*0x4df0*/ + (*(void (__fastcall **)(__int64, __int64, __int64))(qword_96D8 + 352))(i + qword_9680 + 285, v62, 30); /*0x4e1a*/ + LOBYTE(v19) = *(_BYTE *)(v12 + 24); /*0x4e20*/ + if ( !sub_27B8(v63, v19, &v62) ) /*0x4e2b*/ + { + n4 = 0; /*0x4e35*/ + i_1 = i; /*0x4e38*/ + do /*0x4e67*/ + { + v23 = AsciiStrHexToUint64(v62); /*0x4e3f*/ + v24 = n4++; /*0x4e44*/ + *(_BYTE *)(i_1 + qword_9680 + 315) = v23 >> (8 * v24); /*0x4e58*/ + ++i_1; /*0x4e60*/ + } + while ( n4 < 4u ); /*0x4e67*/ + } + LOBYTE(v20) = *(_BYTE *)(v12 + 26); /*0x4e6f*/ + if ( !sub_27B8(v63, v20, &v62) ) /*0x4e7a*/ + (*(void (__fastcall **)(__int64, __int64, __int64))(qword_96D8 + 352))(i + qword_9680 + 319, v62, 21); /*0x4ea4*/ + goto LABEL_33; /*0x4ea4*/ + } + return result; /*0x5100*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/InitializePciInventory.c b/LenovoServerPkg/SystemInventory/SystemInventory/InitializePciInventory.c new file mode 100644 index 0000000..0af78c0 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/InitializePciInventory.c @@ -0,0 +1,244 @@ +__int64 InitializePciInventory() +{ + unsigned __int8 v0; // r13 + __int64 result; // rax + unsigned __int64 i; // r15 + __int64 v3; // rdx + __int64 v4; // rcx + __int64 v5; // r8 + __int64 v6; // r9 + __int64 v7; // rdi + unsigned __int8 v8; // r14 + __int64 v9; // rbx + unsigned __int8 v10; // bl + char v11; // r9 + __int64 v12; // rsi + __int64 v13; // rdx + __int64 v14; // rcx + __int64 v15; // rdx + __int64 v16; // rcx + __int64 v17; // rdx + __int64 v18; // rcx + __int64 v19; // rcx + __int64 v20; // rcx + __int64 v21; // rbx + unsigned __int16 v22; // ax + const char *[System_Inventory]_Pci_Device_is_found_in_Pcie_Slot_is_of_Riser; // rdx + __int64 v24; // [rsp+20h] [rbp-A9h] + __int64 v25; // [rsp+28h] [rbp-A1h] + _DWORD v26[2]; // [rsp+30h] [rbp-99h] + char v27; // [rsp+38h] [rbp-91h] + _DWORD v28[3]; // [rsp+40h] [rbp-89h] + __int16 v29; // [rsp+4Ch] [rbp-7Dh] + char v30; // [rsp+4Eh] [rbp-7Bh] + _DWORD v31[6]; // [rsp+50h] [rbp-79h] + __int16 v32; // [rsp+68h] [rbp-61h] + char v33; // [rsp+6Ah] [rbp-5Fh] + __int64 v34; // [rsp+70h] [rbp-59h] BYREF + __int64 v35; // [rsp+78h] [rbp-51h] BYREF + unsigned __int64 i_1; // [rsp+80h] [rbp-49h] BYREF + __int64 v37; // [rsp+88h] [rbp-41h] BYREF + _BYTE v38[144]; // [rsp+90h] [rbp-39h] BYREF + unsigned __int8 v39; // [rsp+130h] [rbp+67h] BYREF + __int128 v40; // [rsp+138h] [rbp+6Fh] BYREF + __int64 v41; // [rsp+148h] [rbp+7Fh] BYREF + + v29 = -1; /*0x5129*/ + v32 = -1; /*0x5133*/ + v28[0] = 536937216; /*0x5156*/ + v0 = 0; /*0x515e*/ + v28[1] = 54526211; /*0x5161*/ + v28[2] = 16998401; /*0x516e*/ + v30 = -1; /*0x5179*/ + v31[0] = 65792; /*0x517d*/ + v31[1] = 20972033; /*0x5184*/ + v31[2] = 33636353; /*0x518b*/ + v31[3] = 1610809664; /*0x5192*/ + v31[4] = 23068929; /*0x5199*/ + v31[5] = 50421762; /*0x51a0*/ + v33 = -1; /*0x51a7*/ + v26[0] = 536936736; /*0x51ab*/ + v26[1] = -65023; /*0x51b3*/ + v27 = -1; /*0x51bb*/ + v37 = 0; /*0x51c0*/ + result = (*(__int64 (__fastcall **)(__int64, void *, _QWORD, unsigned __int64 *, __int64 *))(qword_96A8 + 312))( /*0x51c4*/ + 2, + &unk_9400, + 0, + &i_1, + &v35); + if ( result >= 0 ) /*0x51cd*/ + { + for ( i = 0; i < i_1; ++i ) /*0x51da*/ + { + if ( (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *))(qword_96A8 + 152))( /*0x5203*/ + *(_QWORD *)(v35 + 8 * i), + &unk_9400, + &v34) >= 0 ) + { + (*(void (__fastcall **)(__int64, __int64, _QWORD))(v34 + 48))(v34, 2, 0); /*0x5226*/ + if ( (v38[30] & 0x7F) == 1 ) /*0x5230*/ + { + (*(void (__fastcall **)(__int64, _BYTE *, __int128 *, char *, __int64 *))(v34 + 112))( /*0x5252*/ + v34, + v38, + &v40, + (char *)&v40 + 8, + &v41); + if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(64) ) /*0x5261*/ + sub_740( /*0x5285*/ + 64, + "[System Inventory] Pci Device found in root bridge Bus = %x Dev = %x Fun = %x\n", + (_DWORD)v40, + DWORD2(v40), + v41); + LOBYTE(v5) = v41; /*0x528a*/ + LOBYTE(v6) = 16; /*0x528e*/ + LOBYTE(v3) = BYTE8(v40); /*0x5291*/ + LOBYTE(v4) = v40; /*0x5294*/ + v7 = sub_28CC(v4, v3, v5, v6); /*0x529c*/ + if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(64) ) /*0x52ab*/ + sub_740(64, "[System Inventory] PciExpReg %x\n", v7); /*0x52c1*/ + if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(64) ) /*0x52d2*/ + sub_740(64, "PciExpReg->SlotStatus.Bits.PresenceDetect = %x\n", (*(unsigned __int16 *)(v7 + 26) >> 6) & 1); /*0x52f2*/ + if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(64) ) /*0x5303*/ + sub_740(64, "PciExpReg->SlotCapability.Bits.PhysicalSlotNumber = %x\n", *(_DWORD *)(v7 + 20) >> 19); /*0x531e*/ + if ( (*(_BYTE *)(v7 + 26) & 0x40) != 0 ) /*0x5327*/ + { + (*(void (__fastcall **)(__int64, _QWORD, __int64, __int64, unsigned __int8 *))(v34 + 48))( /*0x5347*/ + v34, + 0, + 26, + 1, + &v39); + v8 = v39; /*0x5360*/ + v9 = (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *))(qword_96A8 + 152))( /*0x536e*/ + *(_QWORD *)(v35 + 8 * i), + &unk_9470, + &v37); + if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(64) ) /*0x537d*/ + sub_740(64, "Locate DevicePathProtocol Status - %r\n", v9); /*0x5393*/ + if ( (unsigned __int8)sub_7EC() && v9 < 0 ) /*0x53a4*/ + { + if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x53b4*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0x53cc*/ + sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1231, "!EFI_ERROR (Status)"); /*0x53e4*/ + } + if ( (*(_DWORD *)(v7 + 20) & 0xFFF80000) != 0 ) /*0x53f0*/ + { + v10 = 0; /*0x53f6*/ + while ( (unsigned __int16)sub_2500(((32LL * v8) | v10 & 0x1F) << 15) == 0xFFFF ) /*0x541e*/ + { + if ( ++v10 > 0x1Fu ) /*0x5425*/ + goto LABEL_48; /*0x5425*/ + } + v11 = *(_DWORD *)(v7 + 20) >> 19; /*0x543e*/ + v12 = 19LL * v0; /*0x5441*/ + *(_BYTE *)(v12 + qword_9680 + 2275) = v11; /*0x544f*/ + CheckVpdAndUpdateToBmc(v8, v10, 0, v11); /*0x545a*/ + v13 = 0; /*0x546a*/ + v14 = 0; /*0x5471*/ + do /*0x54a5*/ + { + if ( __PAIR128__(*((unsigned __int8 *)v28 + v14 + 1), *((unsigned __int8 *)v28 + v14)) == v40 /*0x5493*/ + && *((unsigned __int8 *)v28 + v14 + 2) == v41 ) + { + if ( (unsigned __int8)sub_7F8(v14, v13, v41, *((_QWORD *)&v40 + 1)) && (unsigned __int8)sub_804(64) ) /*0x56f0*/ + { + [System_Inventory]_Pci_Device_is_found_in_Pcie_Slot_is_of_Riser = "[System Inventory] Pci Device is f" /*0x56f9*/ + "ound in Pcie Slot is of Riser Type" + " - %d, Location Bus = %x Dev = %x Fun = %x\n"; +LABEL_53: + LODWORD(v25) = 0; /*0x5700*/ + LODWORD(v24) = v10; /*0x5712*/ + sub_740(64, [System_Inventory]_Pci_Device_is_found_in_Pcie_Slot_is_of_Riser, 0, v8, v24, v25); /*0x5716*/ + } + goto LABEL_54; /*0x5716*/ + } + ++v13; /*0x5499*/ + v14 = 3 * v13; /*0x549c*/ + } + while ( *((_BYTE *)v28 + 3 * v13 + 2) != 0xFF ); /*0x54a5*/ + v15 = 0; /*0x54a7*/ + v16 = 0; /*0x54aa*/ + while ( __PAIR128__(*((unsigned __int8 *)v31 + v16 + 1), *((unsigned __int8 *)v31 + v16)) != v40 /*0x54c9*/ + || *((unsigned __int8 *)v31 + v16 + 2) != v41 ) + { + ++v15; /*0x54cf*/ + v16 = 3 * v15; /*0x54d2*/ + if ( *((_BYTE *)v31 + 3 * v15 + 2) == 0xFF ) /*0x54db*/ + { + v17 = 0; /*0x54dd*/ + v18 = 0; /*0x54e0*/ + while ( __PAIR128__(*((unsigned __int8 *)v26 + v18 + 1), *((unsigned __int8 *)v26 + v18)) != v40 /*0x54ff*/ + || *((unsigned __int8 *)v26 + v18 + 2) != v41 ) + { + ++v17; /*0x5505*/ + v18 = 3 * v17; /*0x5508*/ + if ( *((_BYTE *)v26 + 3 * v17 + 2) == 0xFF ) /*0x5511*/ + { + if ( (unsigned __int8)sub_7F8(v18, v17, v41, *((_QWORD *)&v40 + 1)) ) /*0x5513*/ + { + if ( (unsigned __int8)sub_804(64) ) /*0x5523*/ + sub_740( /*0x5542*/ + 64, + "[System Inventory] Pci Device found is in Onboard Slot, Location Bus = %x Dev = %x Fun = %x\n", + v8, + v10, + 0); + } + goto LABEL_47; /*0x5542*/ + } + } + if ( (unsigned __int8)sub_7F8(v18, v17, v41, *((_QWORD *)&v40 + 1)) && (unsigned __int8)sub_804(64) ) /*0x5761*/ + sub_740( /*0x5780*/ + 64, + "[System Inventory] Pci Device found is a MEZZ card, Location Bus = %x Dev = %x Fun = %x\n", + v8, + v10, + 0); + *(_BYTE *)(v12 + qword_9680 + 2276) = 9; /*0x578c*/ + goto LABEL_47; /*0x5794*/ + } + } + if ( (unsigned __int8)sub_7F8(v16, v15, v41, *((_QWORD *)&v40 + 1)) && (unsigned __int8)sub_804(64) ) /*0x573f*/ + { + [System_Inventory]_Pci_Device_is_found_in_Pcie_Slot_is_of_Riser = "[System Inventory] Pci Device is found" /*0x5748*/ + " in NVME Slot is of Riser Type - %d, L" + "ocation Bus = %x Dev = %x Fun = %x\n"; + goto LABEL_53; /*0x574f*/ + } +LABEL_54: + *(_BYTE *)(v12 + qword_9680 + 2276) = 0; /*0x571b*/ +LABEL_47: + *(_BYTE *)(v12 + qword_9680 + 2277) = v8; /*0x5547*/ + v19 = qword_9680; /*0x5558*/ + *(_BYTE *)(v12 + qword_9680 + 2278) &= 7u; /*0x5562*/ + *(_BYTE *)(v12 + v19 + 2278) |= 8 * v10; /*0x556a*/ + *(_BYTE *)(v12 + qword_9680 + 2278) &= 0xF8u; /*0x557e*/ + v20 = ((32 * v8) | v10 & 0x1Fu) << 15; /*0x558f*/ + v21 = (unsigned int)v20; /*0x5592*/ + *(_WORD *)(v12 + qword_9680 + 2279) = sub_2500(v20); /*0x55a0*/ + *(_WORD *)(v12 + qword_9680 + 2281) = sub_2500((unsigned int)v21 | 2LL); /*0x55ba*/ + *(_WORD *)(v12 + qword_9680 + 2283) = sub_2500((unsigned int)v21 | 0x2CLL); /*0x55d4*/ + *(_WORD *)(v12 + qword_9680 + 2285) = sub_2500((unsigned int)v21 | 0x2ELL); /*0x55ee*/ + *(_BYTE *)(v12 + qword_9680 + 2287) = sub_24F0((unsigned int)v21 | 9LL); /*0x560e*/ + *(_BYTE *)(v12 + qword_9680 + 2288) = sub_24F0((unsigned int)v21 | 0xALL); /*0x5628*/ + *(_BYTE *)(v12 + qword_9680 + 2289) = sub_24F0(v21 | 0xB); /*0x563b*/ + v22 = sub_2500(((v41 & 7 | (8 * (BYTE8(v40) & 0x1F | (32LL * (unsigned __int8)v40)))) << 12) | 0xA2); /*0x566d*/ + ++v0; /*0x5684*/ + *(_BYTE *)(v12 + qword_9680 + 2290) = v22 & 0xF; /*0x5687*/ + *(_BYTE *)(v12 + qword_9680 + 2291) = (v22 >> 4) & 0x3F; /*0x5695*/ + } + } + } + } +LABEL_48: + ; /*0x56a1*/ + } + *(_BYTE *)(qword_9680 + 2274) = 4; /*0x56b5*/ + (*(void (__fastcall **)(__int64))(qword_96A8 + 72))(v35); /*0x56c7*/ + return 0; /*0x56ca*/ + } + return result; /*0x56cc*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/InitializeStorageInventory.c b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeStorageInventory.c new file mode 100644 index 0000000..15915d9 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeStorageInventory.c @@ -0,0 +1,260 @@ +__int64 InitializeStorageInventory() +{ + unsigned __int8 v0; // r13 + __int64 result; // rax + unsigned __int64 i_1; // rsi + __int64 v3; // rbx + __int64 j_1; // rbx + __int64 v5; // rdi + __int64 v6; // rdi + __int64 j; // rcx + char n17; // al + __int64 v9; // rbx + _WORD *v10; // r15 + __int64 v11; // rbx + unsigned __int8 v12; // cl + __int64 v13; // rdx + __int64 v14; // rbx + int v15; // r12d + int v16; // edi + __int64 v17; // rsi + unsigned __int16 *v18; // rdi + __int64 n16; // rbx + __int64 n3; // r14 + __int64 v21; // rax + __int64 v22; // rax + int v23; // eax + __int64 v24; // rbx + char v25; // cl + unsigned __int64 n0x40; // rax + _WORD *v27; // rdx + __int64 v28; // rcx + __int64 v29; // [rsp+30h] [rbp-59h] BYREF + _BYTE v30[8]; // [rsp+38h] [rbp-51h] BYREF + __int64 v31; // [rsp+40h] [rbp-49h] BYREF + __int64 v32; // [rsp+48h] [rbp-41h] BYREF + __int64 v33; // [rsp+50h] [rbp-39h] BYREF + __int64 v34; // [rsp+58h] [rbp-31h] BYREF + __int64 v35; // [rsp+60h] [rbp-29h] BYREF + __int64 j_3; // [rsp+68h] [rbp-21h] BYREF + __int64 j_2; // [rsp+70h] [rbp-19h] + unsigned __int64 i; // [rsp+78h] [rbp-11h] + unsigned __int64 i_2; // [rsp+80h] [rbp-9h] BYREF + __int64 v40; // [rsp+88h] [rbp-1h] BYREF + _BYTE v41[8]; // [rsp+90h] [rbp+7h] BYREF + _BYTE v42[72]; // [rsp+98h] [rbp+Fh] BYREF + unsigned __int16 v43; // [rsp+F0h] [rbp+67h] BYREF + unsigned int v44; // [rsp+F8h] [rbp+6Fh] + int v45; // [rsp+100h] [rbp+77h] BYREF + int n512; // [rsp+108h] [rbp+7Fh] BYREF + + v44 = 0; /*0x401e*/ + v31 = 0; /*0x4026*/ + v0 = 0; /*0x402a*/ + v43 = 0; /*0x402d*/ + result = (*(__int64 (__fastcall **)(__int64, void *, _QWORD, unsigned __int64 *, __int64 *))(qword_96A8 + 312))( /*0x4032*/ + 2, + &unk_93E0, + 0, + &i_2, + &v35); + if ( result >= 0 ) /*0x403b*/ + { + result = (*(__int64 (__fastcall **)(void *, _QWORD, _BYTE *))(qword_96A8 + 320))(&unk_9410, 0, v41); /*0x4055*/ + if ( result >= 0 ) /*0x405e*/ + { + i_1 = 0; /*0x4064*/ + for ( i = 0; i_1 < i_2; i = i_1 ) /*0x406f*/ + { + v3 = (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *))(qword_96A8 + 152))( /*0x409f*/ + *(_QWORD *)(v35 + 8 * i_1), + &unk_9470, + &j_3); + if ( (unsigned __int8)sub_7EC() && v3 < 0 ) /*0x40ae*/ + { + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x40bc*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v3); /*0x40d2*/ + sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1393, "!EFI_ERROR (Status)"); /*0x40ea*/ + } + j_1 = j_3; /*0x40fa*/ + if ( (*(__int64 (__fastcall **)(void *, __int64 *, __int64 *))(qword_96A8 + 184))(&unk_9400, &j_3, &v40) >= 0 ) /*0x4112*/ + { + v5 = (*(__int64 (__fastcall **)(__int64, void *, __int64 *))(qword_96A8 + 152))(v40, &unk_9400, &v31); /*0x4134*/ + if ( (unsigned __int8)sub_7EC() && v5 < 0 ) /*0x4143*/ + { + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4151*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0x4167*/ + sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1404, "!EFI_ERROR (Status)"); /*0x417f*/ + } + v6 = (*(__int64 (__fastcall **)(__int64, _BYTE *, __int64 *, __int64 *, __int64 *))(v31 + 112))( /*0x41a3*/ + v31, + v42, + &v29, + &v34, + &v33); + if ( (unsigned __int8)sub_7EC() && v6 < 0 ) /*0x41b2*/ + { + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x41c0*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v6); /*0x41d6*/ + sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1407, "!EFI_ERROR (Status)"); /*0x41ee*/ + } + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x41ff*/ + sub_740(0x80000000LL, "Bus = %x, Dev = %x, Func = %x\n", v29, v34, v33); /*0x4223*/ + (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, unsigned __int16 *))(v31 + 48))(v31, 1, 0, 1, &v43); /*0x4241*/ + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4250*/ + sub_740(0x80000000LL, "VendorID = %x\n", v43); /*0x4268*/ + for ( j = j_1; !(unsigned __int8)sub_1EF0(j); j = j_1 ) /*0x426d*/ + { + if ( (unsigned __int8)sub_1DB8(j_1) == 1 && (unsigned __int8)sub_1DF0(j_1) == 1 ) /*0x4291*/ + { + j_2 = j_1; /*0x42a3*/ + goto LABEL_36; /*0x42a7*/ + } + j_1 = sub_1E6C(j_1); /*0x429b*/ + } + j_1 = j_2; /*0x42a9*/ +LABEL_36: + if ( j_1 ) /*0x42b0*/ + { + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x42c2*/ + sub_740( /*0x42df*/ + 0x80000000LL, + "PciDevicePath->Device = %x, PciDevicePath->Function = %x.\n", + *(unsigned __int8 *)(j_1 + 5), + *(unsigned __int8 *)(j_1 + 4)); + if ( (n17 = *(_BYTE *)(j_1 + 5), n17 == 17) && *(_BYTE *)(j_1 + 4) == 5 || n17 == 23 && !*(_BYTE *)(j_1 + 4) ) /*0x42f9*/ + { + v9 = (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *))(qword_96D8 + 152))( /*0x4323*/ + *(_QWORD *)(v35 + 8 * i_1), + &unk_93E0, + &v32); + if ( (unsigned __int8)sub_7EC() && v9 < 0 ) /*0x4332*/ + { + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4340*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0x4356*/ + sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1437, "!EFI_ERROR (Status)"); /*0x436e*/ + } + if ( (*(__int64 (__fastcall **)(__int64, int *, _BYTE *))(v32 + 40))(v32, &v45, v30) >= 0 ) /*0x4388*/ + { + n512 = 512; /*0x4395*/ + v10 = (_WORD *)sub_1D2C(512); /*0x43ab*/ + v11 = (*(__int64 (__fastcall **)(__int64, _WORD *, int *))(v32 + 24))(v32, v10, &n512); /*0x43b2*/ + if ( (unsigned __int8)sub_7EC() && v11 < 0 ) /*0x43c1*/ + { + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x43cf*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v11); /*0x43e5*/ + sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1456, "!EFI_ERROR (Status)"); /*0x43fd*/ + } + (*(void (__fastcall **)(__int64, int *, _BYTE *))(v32 + 40))(v32, &v45, v30); /*0x4411*/ + v12 = 0; /*0x4423*/ + while ( 1 ) /*0x4429*/ + { + v13 = 3LL * v12; /*0x4429*/ + if ( v29 == byte_94C0[6 * v12] /*0x4453*/ + && v34 == byte_94C0[6 * v12 + 1] + && v33 == byte_94C0[6 * v12 + 2] + && v45 == byte_94C0[6 * v12 + 3] ) + { + break; /*0x4453*/ + } + if ( ++v12 >= 0xEu ) /*0x445a*/ + goto LABEL_65; /*0x445a*/ + } + v44 = byte_94C0[6 * v12 + 4]; /*0x446a*/ +LABEL_65: + if ( (__int16)*v10 >= 0 ) /*0x4471*/ + { + v14 = (unsigned int)sub_2518(((v33 & 7 | (8 * (v34 & 0x1F | (32LL * (unsigned __int8)v29)))) << 12) | 0x24); /*0x44b2*/ + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x44c0*/ + sub_740( /*0x44e8*/ + 0x80000000LL, + "RDBG Inventory Bus %x, Dev %x, Func %x , SidpbaorAhciBaseAddr = %x\n", + v29, + v34, + v33, + v14); + v15 = (*(_DWORD *)((unsigned int)((v45 + 2) << 7) + v14 + 40) >> 4) & 0xF; /*0x4504*/ + if ( (v10[83] & 0x400) != 0 ) /*0x4510*/ + { + v17 = (unsigned __int16)v10[100]; /*0x454d*/ + v18 = v10 + 101; /*0x4555*/ + n16 = 16; /*0x455c*/ + n3 = 3; /*0x4561*/ + do /*0x457f*/ + { + v17 |= sub_BD4(*v18++, n16); /*0x4570*/ + n16 += 16; /*0x4577*/ + --n3; /*0x457b*/ + } + while ( n3 ); /*0x457f*/ + v21 = sub_C28(v17, 1000, 0); /*0x458e*/ + v22 = sub_C20(v21, 512); /*0x459b*/ + v23 = sub_C28(v22, 1000, 0); /*0x45a8*/ + i_1 = i; /*0x45ad*/ + v16 = v23; /*0x45b1*/ + } + else + { + v16 = ((((unsigned __int16)v10[60] + ((unsigned __int16)v10[61] << 16)) / 1000) << 9) / 1000; /*0x4548*/ + } + v24 = 75LL * v0; /*0x45bc*/ + if ( v10[217] == 1 ) /*0x45cf*/ + { + *(_BYTE *)(v24 + qword_9680 + 2421) = 1; /*0x45d1*/ + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(64) ) /*0x45e6*/ + sub_740( /*0x45f6*/ + 64, + "[System Inventory] Hard Disk %d is found in slot %d is of type SSD\n", + (unsigned int)v0 + 1, + v44); + } + else + { + *(_BYTE *)(v24 + qword_9680 + 2421) = 0; /*0x45f8*/ + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(64) ) /*0x460e*/ + sub_740( /*0x462e*/ + 64, + "[System Inventory] Hard Disk %d is found in slot %d is of type HDD\n", + (unsigned int)v0 + 1, + v44); + } + v25 = v44; /*0x463a*/ + *(_BYTE *)(v24 + qword_9680 + 2352) = v0; /*0x463d*/ + *(_DWORD *)(v24 + qword_9680 + 2417) = v16; /*0x464c*/ + *(_BYTE *)(v24 + qword_9680 + 2422) = 3; /*0x465e*/ + *(_BYTE *)(v24 + qword_9680 + 2424) = v15; /*0x466d*/ + *(_BYTE *)(v24 + qword_9680 + 2425) = v25; /*0x467c*/ + n0x40 = sub_9F0(v10 + 27); /*0x4686*/ + v27 = v10 + 27; /*0x4692*/ + v28 = v24 + qword_9680 + 2353; /*0x469c*/ + if ( n0x40 <= 0x40 ) /*0x46a3*/ + sub_814(v28, v27); /*0x46b2*/ + else + AsciiStrCopyS(v28, v27, 62); /*0x46ab*/ + sub_2720(v24 + qword_9680 + 2353, 64); /*0x46cf*/ + sub_275C(v24 + qword_9680 + 2353, 64); /*0x46e7*/ + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(64) ) /*0x46f7*/ + sub_740(64, "[System Inventory] Drive Size = %d MB\n", *(_DWORD *)(v24 + qword_9680 + 2417)); /*0x4718*/ + if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(64) ) /*0x4729*/ + sub_740(64, "[System Inventory] Link Speed = %d\n", *(unsigned __int8 *)(v24 + qword_9680 + 2424)); /*0x474c*/ + (*(void (__fastcall **)(_WORD *))(qword_96A8 + 72))(v10); /*0x475b*/ + ++v0; /*0x476a*/ + } + else + { + (*(void (__fastcall **)(_WORD *, __int64, __int64, __int64))(qword_96A8 + 72))(v10, v13, v33, v34); /*0x447d*/ + } + } + } + } + } + ++i_1; /*0x476d*/ + } + result = qword_9680; /*0x477e*/ + *(_BYTE *)(qword_9680 + 2351) = v0; /*0x4785*/ + if ( v35 ) /*0x4793*/ + return (*(__int64 (**)(void))(qword_96A8 + 72))(); /*0x479c*/ + } + } + return result; /*0x479f*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/InitializeSystemInventory.c b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeSystemInventory.c new file mode 100644 index 0000000..15a790b --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeSystemInventory.c @@ -0,0 +1,100 @@ +__int64 __fastcall InitializeSystemInventory(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +{ + __int64 v4; // rbx + __int64 v5; // rdx + __int64 v6; // rcx + __int64 v7; // r8 + __int64 v8; // r9 + __int64 v9; // rbx + __int64 v10; // rdx + __int64 v11; // rcx + __int64 v12; // r8 + __int64 v13; // r9 + __int64 v14; // rbx + __int64 v15; // rdx + __int64 v16; // rcx + __int64 v17; // r8 + __int64 v18; // r9 + __int64 v19; // rbx + __int64 v20; // rdx + __int64 v21; // rcx + __int64 v22; // r8 + __int64 v23; // r9 + __int64 v24; // rbx + __int64 v25; // rdx + __int64 v26; // rcx + __int64 v27; // r8 + __int64 v28; // r9 + __int64 v29; // rbx + __int64 result; // rax + __int64 v31; // rdx + __int64 v32; // rcx + __int64 v33; // r8 + __int64 v34; // r9 + + v4 = sub_4B8(); /*0x2c94*/ + if ( (unsigned __int8)sub_7EC() && v4 < 0 ) /*0x2cbd*/ + { + if ( (unsigned __int8)sub_7F8(v6, v5, v7, v8) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x2cca*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v4); /*0x2cdb*/ + sub_788( /*0x2ceb*/ + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", + 306, + "!EFI_ERROR (Status)"); + } + v9 = sub_554(ImageHandle, SystemTable); /*0x2cfb*/ + if ( (unsigned __int8)sub_7EC() && v9 < 0 ) /*0x2d0a*/ + { + if ( (unsigned __int8)sub_7F8(v11, v10, v12, v13) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x2d18*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0x2d2a*/ + sub_788( /*0x2d3a*/ + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", + 309, + "!EFI_ERROR (Status)"); + } + v14 = sub_1F4C(ImageHandle, SystemTable); /*0x2d4a*/ + if ( (unsigned __int8)sub_7EC() && v14 < 0 ) /*0x2d59*/ + { + if ( (unsigned __int8)sub_7F8(v16, v15, v17, v18) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x2d67*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v14); /*0x2d79*/ + sub_788( /*0x2d89*/ + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", + 312, + "!EFI_ERROR (Status)"); + } + v19 = sub_247C(ImageHandle, SystemTable); /*0x2d99*/ + if ( (unsigned __int8)sub_7EC() && v19 < 0 ) /*0x2da8*/ + { + if ( (unsigned __int8)sub_7F8(v21, v20, v22, v23) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x2db6*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v19); /*0x2dc8*/ + sub_788( /*0x2dd8*/ + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", + 315, + "!EFI_ERROR (Status)"); + } + v24 = sub_248C(ImageHandle, SystemTable); /*0x2de8*/ + if ( (unsigned __int8)sub_7EC() && v24 < 0 ) /*0x2df7*/ + { + if ( (unsigned __int8)sub_7F8(v26, v25, v27, v28) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x2e05*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v24); /*0x2e17*/ + sub_788( /*0x2e27*/ + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", + 318, + "!EFI_ERROR (Status)"); + } + v29 = sub_26D8(ImageHandle, SystemTable); /*0x2e37*/ + result = sub_7EC(); /*0x2e3a*/ + if ( (_BYTE)result && v29 < 0 ) /*0x2e46*/ + { + if ( (unsigned __int8)sub_7F8(v32, v31, v33, v34) ) /*0x2e48*/ + { + if ( (unsigned __int8)sub_804(0x80000000LL) ) /*0x2e54*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v29); /*0x2e66*/ + } + return sub_788( /*0x2e76*/ + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", + 321, + "!EFI_ERROR (Status)"); + } + return result; /*0x2e8f*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/OnBmcUsbProtocolNotify.c b/LenovoServerPkg/SystemInventory/SystemInventory/OnBmcUsbProtocolNotify.c new file mode 100644 index 0000000..ab96068 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/OnBmcUsbProtocolNotify.c @@ -0,0 +1,96 @@ +__int64 __fastcall OnBmcUsbProtocolNotify(__int64 a1, __int64 a2, __int64 a3, __int64 a4) +{ + __int64 v4; // rax + __int64 v5; // rcx + __int64 v6; // rdi + __int64 v7; // r8 + __int64 result; // rax + __int64 v9; // rdx + __int64 v10; // rcx + __int64 v11; // rdi + __int64 v12; // r8 + __int64 v13; // r9 + __int64 v14; // rdi + __int64 v15; // rdx + __int64 v16; // rcx + __int64 v17; // r8 + __int64 v18; // r9 + __int64 v19; // rdx + __int64 v20; // rcx + __int64 v21; // r8 + __int64 v22; // r9 + int v23; // [rsp+28h] [rbp-30h] + _DWORD v24[6]; // [rsp+40h] [rbp-18h] BYREF + unsigned __int8 v25; // [rsp+70h] [rbp+18h] BYREF + char v26; // [rsp+78h] [rbp+20h] BYREF + + LOBYTE(v24[0]) = 0; /*0x3c8c*/ + v25 = 0; /*0x3c90*/ + v26 = 1; /*0x3c94*/ + v4 = qword_9690; /*0x3c98*/ + if ( !qword_9690 ) /*0x3ca2*/ + { + v6 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x3cc1*/ + if ( v6 < 0 ) /*0x3cc7*/ + { + result = sub_7F8(v5, a2, v7, a4); /*0x3cc9*/ + if ( (_BYTE)result ) /*0x3cd0*/ + { + result = sub_804(64); /*0x3cdd*/ + if ( (_BYTE)result ) /*0x3ce4*/ + return sub_740(64, "[System Inventory] Locate gIpmiTransport Protocol fail. Status - %r\n", v6); /*0x3cf7*/ + } + return result; /*0x3cf7*/ + } + v4 = qword_9690; /*0x3d01*/ + } + LOBYTE(a4) = -85; /*0x3d0d*/ + LOBYTE(a2) = 50; /*0x3d1d*/ + v11 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, _QWORD, _BYTE, unsigned __int8 *, char *, _DWORD))(v4 + 16))( /*0x3d35*/ + v4, + a2, + 0, + a4, + 0, + 0, + &v25, + &v26, + v24[0]); + if ( v11 < 0 || v25 == 1 ) /*0x3d42*/ + { + if ( (unsigned __int8)sub_7F8(v10, v9, v12, v13) && (unsigned __int8)sub_804(64) ) /*0x3dcb*/ + sub_740(64, "[System Inventory] send gIpmiTransport Protocol Status - %r\n", v11); /*0x3de0*/ + result = sub_7F8(v20, v19, v21, v22); /*0x3de5*/ + if ( (_BYTE)result ) /*0x3dec*/ + { + result = sub_804(64); /*0x3df1*/ + if ( (_BYTE)result ) /*0x3df8*/ + return sub_740(64, "[System Inventory] Check Current BMC virtual USB status - %x\n", v25); /*0x3e0a*/ + } + } + else + { + LOBYTE(v24[0]) = 1; /*0x3d49*/ + LOBYTE(v13) = -86; /*0x3d53*/ + LOBYTE(v9) = 50; /*0x3d63*/ + LOBYTE(v23) = 1; /*0x3d6a*/ + v14 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, _DWORD *, int, unsigned __int8 *, char *))(qword_9690 + 16))( /*0x3d8d*/ + qword_9690, + v9, + 0, + v13, + v24, + v23, + &v25, + &v26); + (*(void (__fastcall **)(__int64))(qword_96A8 + 248))(3000000); /*0x3d90*/ + result = sub_7F8(v16, v15, v17, v18); /*0x3d96*/ + if ( (_BYTE)result ) /*0x3d9d*/ + { + result = sub_804(64); /*0x3da6*/ + if ( (_BYTE)result ) /*0x3dad*/ + return sub_740(64, "[System Inventory] Disabling BMC USB Interface Status - %r\n", v14); /*0x3db6*/ + } + } + return result; /*0x3e14*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/OnBmcVirtualCdProtocolNotify.c b/LenovoServerPkg/SystemInventory/SystemInventory/OnBmcVirtualCdProtocolNotify.c new file mode 100644 index 0000000..660efaf --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/OnBmcVirtualCdProtocolNotify.c @@ -0,0 +1,53 @@ +__int64 __fastcall OnBmcVirtualCdProtocolNotify() +{ + __int64 v0; // rbx + __int64 v1; // rdx + __int64 v2; // rcx + __int64 v3; // r8 + __int64 v4; // r9 + __int64 result; // rax + __int64 v6; // rdx + __int64 v7; // r9 + __int64 v8; // rdx + __int64 v9; // rcx + __int64 v10; // r8 + __int64 v11; // r9 + char n2; // [rsp+28h] [rbp-30h] + __int16 v13[12]; // [rsp+40h] [rbp-18h] BYREF + char v14; // [rsp+70h] [rbp+18h] BYREF + char v15; // [rsp+78h] [rbp+20h] BYREF + + v0 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x3e43*/ + result = sub_7F8(v2, v1, v3, v4); /*0x3e46*/ + if ( (_BYTE)result ) /*0x3e52*/ + { + result = sub_804(64); /*0x3e56*/ + if ( (_BYTE)result ) /*0x3e5d*/ + result = sub_740(64, "[System Inventory] Locating IPMI Dxe Protocol Status - %r\n", v0); /*0x3e6b*/ + } + if ( v0 >= 0 ) /*0x3e73*/ + { + v13[0] = 4; /*0x3e7a*/ + LOBYTE(v7) = -53; /*0x3e86*/ + v14 = 1; /*0x3e8e*/ + n2 = 2; /*0x3ea0*/ + LOBYTE(v6) = 50; /*0x3eaa*/ + (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, __int16 *, char, char *, char *))(qword_9690 + 16))( /*0x3eb6*/ + qword_9690, + v6, + 0, + v7, + v13, + n2, + &v15, + &v14); + result = sub_7F8(v9, v8, v10, v11); /*0x3eb9*/ + if ( (_BYTE)result ) /*0x3ec0*/ + { + result = sub_804(64); /*0x3ec5*/ + if ( (_BYTE)result ) /*0x3ecc*/ + return sub_740(64, "Set the BMC virtual CD number to 0. \n"); /*0x3ed8*/ + } + } + return result; /*0x3ee2*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/OnIpmiDxeProtocolNotify.c b/LenovoServerPkg/SystemInventory/SystemInventory/OnIpmiDxeProtocolNotify.c new file mode 100644 index 0000000..57ca11c --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/OnIpmiDxeProtocolNotify.c @@ -0,0 +1,180 @@ +__int64 __fastcall OnIpmiDxeProtocolNotify(__int64 a1) +{ + __int64 v2; // rbx + __int64 v3; // rdx + __int64 v4; // rcx + __int64 v5; // r8 + __int64 v6; // r9 + __int64 v7; // rbx + __int64 v8; // rdx + __int64 v9; // rcx + __int64 v10; // r8 + __int64 v11; // r9 + __int64 v12; // rdx + unsigned __int8 v13; // di + __int64 v14; // r9 + __int64 v15; // rdx + __int64 v16; // rcx + __int64 v17; // r8 + __int64 v18; // r9 + __int64 v19; // rdx + __int64 v20; // r9 + __int64 v21; // rdx + __int64 v22; // rcx + __int64 v23; // r8 + __int64 v24; // r9 + __int64 v25; // rdx + __int64 v26; // rcx + __int64 v27; // rbx + __int64 v28; // r8 + __int64 v29; // r9 + __int64 v30; // rdx + __int64 v31; // rcx + __int64 v32; // r8 + __int64 v33; // r9 + __int64 v34; // rdx + __int64 v35; // rcx + __int64 v36; // r8 + __int64 v37; // r9 + __int64 v38; // rdx + __int64 v39; // rcx + __int64 v40; // r8 + __int64 v41; // r9 + __int64 v42; // rdx + __int64 v43; // rcx + __int64 v44; // rbx + __int64 v45; // r8 + __int64 v46; // r9 + __int64 v47; // rdx + __int64 v48; // rcx + __int64 v49; // r8 + __int64 v50; // r9 + __int64 v51; // rdx + __int64 v52; // rcx + __int64 v53; // r8 + __int64 v54; // r9 + __int64 v55; // rdx + __int64 v56; // rcx + __int64 v57; // r8 + __int64 v58; // r9 + int v60; // [rsp+28h] [rbp-40h] + unsigned __int8 v61; // [rsp+80h] [rbp+18h] BYREF + + v2 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD *))(qword_96A8 + 64))(4, 3402, &p_n145); /*0x6064*/ + if ( (unsigned __int8)sub_7EC() && v2 < 0 ) /*0x6086*/ + { + if ( (unsigned __int8)sub_7F8(v4, v3, v5, v6) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x6093*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v2); /*0x60a8*/ + sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1972, "!EFI_ERROR (Status)"); /*0x60b8*/ + } + sub_63C(p_n145, 3402); /*0x60c7*/ + v7 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x60e9*/ + if ( (unsigned __int8)sub_7F8(v9, v8, v10, v11) && (unsigned __int8)sub_804(64) ) /*0x60fe*/ + sub_740(64, "[System Inventory] Locating IPMI Dxe Protocol Status - %r\n", v7); /*0x6114*/ + if ( v7 >= 0 ) + { + v13 = GetBmcVirtualCdDeviceNumber(); /*0x6127*/ + if ( !v13 ) /*0x612c*/ + SetBmcVirtualCdDeviceNumber(2); /*0x6130*/ + byte_9699 = 1; /*0x613d*/ + LOBYTE(v14) = -85; /*0x614b*/ + LOBYTE(v12) = 50; /*0x615b*/ + qword_94B0 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, _QWORD, _BYTE, unsigned __int8 *, char *))(qword_9690 + 16))( /*0x6175*/ + qword_9690, + v12, + 0, + v14, + 0, + 0, + &v61, + &byte_9699); + v7 = qword_94B0; /*0x617c*/ + if ( qword_94B0 >= 0 ) /*0x6182*/ + { + if ( (unsigned __int8)sub_7F8(v16, v15, v17, v18) && (unsigned __int8)sub_804(64) ) /*0x61bd*/ + sub_740(64, "Get the virtual USB Status = %x \n", v61); /*0x61d9*/ + if ( v61 != 1 ) /*0x61e6*/ + goto LABEL_42; /*0x61e6*/ + } + else if ( (unsigned __int8)sub_7F8(v16, v15, v17, v18) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x6190*/ + { + sub_740(0x80000000LL, "Get virtual USB status failed! Status = %r\n", qword_94B0); /*0x61aa*/ + } + LOBYTE(v20) = -86; /*0x61fe*/ + LOBYTE(v60) = 1; /*0x6208*/ + LOBYTE(v19) = 50; /*0x621c*/ + qword_94B0 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, void *, int, unsigned __int8 *, char *))(qword_9690 + 16))( /*0x6224*/ + qword_9690, + v19, + 0, + v20, + &unk_9698, + v60, + &v61, + &byte_9699); + if ( (unsigned __int8)sub_7F8(v22, v21, v23, v24) && (unsigned __int8)sub_804(64) ) /*0x6237*/ + sub_740(64, "[System Inventory] Enabling BMC USB Interface by disabling Power saving in BMC - %r\n", qword_94B0); /*0x6251*/ + v27 = (*(__int64 (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(__int64, __int64, __int64, __int64)))(qword_96A8 + 80))( /*0x6282*/ + 513, + 16, + sub_3C80); + if ( v27 < 0 ) + { + if ( (unsigned __int8)sub_7F8(v26, v25, v28, v29) && (unsigned __int8)sub_804(0x80000000LL) ) + sub_740(0x80000000LL, "Create DisableBmcUsbInterface Event with exit_boot_service fail, Status: %r\n", v27); + if ( (unsigned __int8)sub_7EC() ) /*0x62b1*/ + { + if ( (unsigned __int8)sub_7F8(v31, v30, v32, v33) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x62c6*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v27); /*0x62dc*/ + sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 2064, "!EFI_ERROR (Status)"); /*0x62ec*/ + } + } + v7 = CreateLegacyBootEventEx(16, (__int64 (__fastcall *)(EFI_HANDLE, EFI_SYSTEM_TABLE *))OnBmcUsbProtocolNotify, 0, (__int64)&qword_9718); /*0x630a*/ + if ( v7 < 0 ) + { + if ( (unsigned __int8)sub_7F8(v35, v34, v36, v37) && (unsigned __int8)sub_804(0x80000000LL) ) + sub_740(0x80000000LL, "Create DisableBmcUsbInterface Event with legacy boot fail, Status: %r\n", v7); + if ( (unsigned __int8)sub_7EC() ) /*0x6339*/ + { + if ( (unsigned __int8)sub_7F8(v39, v38, v40, v41) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x634e*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v7); /*0x6364*/ + sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 2075, "!EFI_ERROR (Status)"); /*0x6374*/ + } + } +LABEL_42: + if ( !v13 ) + { + v44 = (*(__int64 (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(), _QWORD, void *))(qword_96A8 + 80))( /*0x63b2*/ + 513, + 16, + sub_3E1C, + 0, + &unk_9710); + if ( v44 < 0 ) + { + if ( (unsigned __int8)sub_7F8(v43, v42, v45, v46) && (unsigned __int8)sub_804(0x80000000LL) ) + sub_740(0x80000000LL, "Create DisableBmcVirtualCD Event with exit_boot_service fail, Status: %r\n", v44); + if ( (unsigned __int8)sub_7EC() ) /*0x63e1*/ + { + if ( (unsigned __int8)sub_7F8(v48, v47, v49, v50) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x63f6*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v44); /*0x640c*/ + sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 2091, "!EFI_ERROR (Status)"); /*0x641c*/ + } + } + v7 = CreateLegacyBootEventEx(16, (__int64 (__fastcall *)(EFI_HANDLE, EFI_SYSTEM_TABLE *))OnBmcVirtualCdProtocolNotify, 0, (__int64)&qword_9718); /*0x643a*/ + if ( v7 < 0 ) + { + if ( (unsigned __int8)sub_7F8(v52, v51, v53, v54) && (unsigned __int8)sub_804(0x80000000LL) ) + sub_740(0x80000000LL, "Create DisableBmcVirtualCD Event with legacy boot fail, Status: %r\n", v7); + if ( (unsigned __int8)sub_7EC() ) /*0x6469*/ + { + if ( (unsigned __int8)sub_7F8(v56, v55, v57, v58) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x647e*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v7); /*0x6494*/ + sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 2102, "!EFI_ERROR (Status)"); /*0x64a4*/ + } + } + } + (*(void (__fastcall **)(__int64))(qword_96A8 + 112))(a1); /*0x64b3*/ + } + return v7; /*0x64ca*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/OnReadyToBoot.c b/LenovoServerPkg/SystemInventory/SystemInventory/OnReadyToBoot.c new file mode 100644 index 0000000..49048e8 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/OnReadyToBoot.c @@ -0,0 +1,123 @@ +__int64 __fastcall OnReadyToBoot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable, __int64 a3, __int64 a4) +{ + double v4; // xmm3_8 + __int64 v6; // rdx + __int64 v7; // rcx + __int64 v8; // r8 + __int64 v9; // r9 + __int64 v10; // rdx + __int64 v11; // rcx + __int64 v12; // r8 + __int64 v13; // rdx + __int64 v14; // rcx + __int64 v15; // r8 + __int64 v16; // r9 + __int64 v17; // rdx + __int64 v18; // r8 + __int64 v19; // r9 + __int64 p_n145_1; // rcx + int v21; // edi + __int64 v22; // rbx + __int64 result; // rax + __int64 v24; // rdx + __int64 v25; // rcx + __int64 v26; // r8 + __int64 v27; // r9 + char v28; // si + unsigned int v29; // edi + __int64 v30; // rdx + __int64 v31; // rcx + __int64 v32; // r8 + __int64 v33; // r9 + __int64 v34; // rbx + __int64 v35; // rdx + __int64 v36; // rcx + __int64 v37; // r8 + __int64 v38; // r9 + __int64 v39; // rdx + __int64 v40; // rcx + __int64 v41; // r8 + __int64 v42; // r9 + unsigned __int64 v43; // rbx + __int64 v44; // rdx + __int64 v45; // rcx + __int64 v46; // r8 + __int64 v47; // r9 + __int64 v48; // [rsp+40h] [rbp-10h] BYREF + __int64 p_n145; // [rsp+48h] [rbp-8h] BYREF + __int64 v50; // [rsp+90h] [rbp+40h] BYREF + __int64 v51; // [rsp+98h] [rbp+48h] BYREF + + LODWORD(v48) = 0; /*0x57af*/ + p_n145 = 0; /*0x57b6*/ + if ( (unsigned __int8)sub_7F8(ImageHandle, SystemTable, a3, a4) && (unsigned __int8)sub_804(64) ) /*0x57cd*/ + sub_740(64, "[System Inventory] OnReadyToBoot \n"); /*0x57e0*/ + InitializeCpuInfo(v7, v6, v8, v9); /*0x57e5*/ + InitializeDimmInfo(v11, v10, v12, v4); /*0x57ea*/ + sub_47B4(); /*0x57ef*/ + InitializePciInventory(); /*0x57f4*/ + InitializeStorageInventory(); /*0x57f9*/ + (*(void (__fastcall **)(void *, void *, _QWORD, _QWORD))(qword_96A8 + 328))(&unk_9688, &unk_93B0, ::p_n145, 0); /*0x581d*/ + *(_BYTE *)::p_n145 = -64; /*0x582a*/ + if ( (unsigned __int8)sub_7F8(v14, v13, v15, v16) && (unsigned __int8)sub_804(64) ) /*0x5839*/ + sub_740(64, "[System Inventory] Version info size - %d \n", 85); /*0x5852*/ + *(_BYTE *)(::p_n145 + 85LL) = -63; /*0x585e*/ + p_n145_1 = ::p_n145; /*0x5862*/ + v21 = 19 * *(unsigned __int8 *)(::p_n145 + 2274LL) + 2191; /*0x5873*/ + if ( *(_BYTE *)(::p_n145 + 2351LL) ) /*0x5879*/ + { + v22 = (*(__int64 (__fastcall **)(__int64, __int64, __int64 *))(qword_96A8 + 64))(4, 3317, &p_n145); /*0x589e*/ + result = sub_7EC(); /*0x58a1*/ + if ( (_BYTE)result ) /*0x58a8*/ + { + if ( v22 >= 0 ) /*0x58ad*/ + { +LABEL_15: + v28 = 1; /*0x58fa*/ + sub_63C(p_n145, 3317); /*0x5908*/ + v29 = v21 - 1; /*0x5914*/ + sub_590(p_n145, ::p_n145 + 85LL, v29); /*0x5923*/ + sub_590(v29 + p_n145, ::p_n145 + 2351LL, 75LL * *(unsigned __int8 *)(::p_n145 + 2351LL) + 1); /*0x5947*/ + p_n145_1 = *(unsigned __int8 *)(::p_n145 + 2351LL); /*0x5953*/ + v21 = 75 * p_n145_1 + 1 + v29; /*0x595f*/ + goto LABEL_17; /*0x5961*/ + } + if ( (unsigned __int8)sub_7F8(v25, v24, v26, v27) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x58bf*/ + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v22); /*0x58d4*/ + result = sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1641, "!EFI_ERROR (Status)"); /*0x58ec*/ + } + if ( v22 < 0 ) /*0x58f4*/ + return result; /*0x58f4*/ + goto LABEL_15; /*0x58f4*/ + } + v28 = 0; /*0x5967*/ + p_n145 = ::p_n145 + 85LL; /*0x596a*/ +LABEL_17: + if ( (unsigned __int8)sub_7F8(p_n145_1, v17, v18, v19) && (unsigned __int8)sub_804(64) ) /*0x597a*/ + sub_740(64, "[System Inventory] Device Info command size - %d\n", v21); /*0x5990*/ + if ( qword_94B0 ) /*0x599d*/ + { + if ( (unsigned __int8)sub_7F8(v31, v30, v32, v33) && (unsigned __int8)sub_804(64) ) /*0x59fe*/ + sub_740( /*0x5a18*/ + 64, + "[System Inventory] OnReadyToBoot No Sending BMC Device Info Command by USB IPMI Status - %r\n", + qword_94B0); + } + else + { + LOBYTE(v32) = 88; /*0x59ac*/ + LOBYTE(v31) = 6; /*0x59ba*/ + v34 = sub_2640(v31, 0, v32, p_n145, v21, (__int64)&v51, (__int64)&v48, (__int64)&v50); /*0x59ce*/ + if ( (unsigned __int8)sub_7F8(v36, v35, v37, v38) && (unsigned __int8)sub_804(64) ) /*0x59dd*/ + sub_740(64, "[System Inventory] OnReadyToBoot Sending BMC Device Info Command Status - %r\n", v34); /*0x59f0*/ + } + if ( v28 ) /*0x5a20*/ + sub_1D54(p_n145); /*0x5a26*/ + v43 = SaveSmbiosDataToBmc(v40, v39, v41, v42); /*0x5a30*/ + if ( (unsigned __int8)sub_7F8(v45, v44, v46, v47) ) /*0x5a33*/ + { + if ( (unsigned __int8)sub_804(64) ) /*0x5a3f*/ + sub_740(64, "[System Inventory] OnReadyToBoot SaveSmbiosDataToBmc Status - %r\n", v43); /*0x5a55*/ + } + return (*(__int64 (__fastcall **)(EFI_HANDLE))(qword_96A8 + 112))(ImageHandle); /*0x5a6f*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/ParsePciDevicePathLocation.c b/LenovoServerPkg/SystemInventory/SystemInventory/ParsePciDevicePathLocation.c new file mode 100644 index 0000000..debc820 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/ParsePciDevicePathLocation.c @@ -0,0 +1,34 @@ +__int64 __fastcall ParsePciDevicePathLocation(__int64 a1, _DWORD *a2, _DWORD *a3, _DWORD *a4, _DWORD *a5) +{ + unsigned int v8; // edi + __int64 n15; // rax + int n6; // ebx + + v8 = a1; /*0x281f*/ + if ( a5 ) /*0x2824*/ + *a5 = sub_2BDC(a1, 12, 13); /*0x2834*/ + if ( a4 ) /*0x283a*/ + *a4 = sub_2BDC(v8, 0, 3); /*0x2849*/ + n15 = sub_2BDC(v8, 8, 11); /*0x2856*/ + n6 = n15; /*0x285b*/ + if ( a2 ) /*0x2860*/ + { + *a2 = n15; /*0x2862*/ + if ( (_DWORD)n15 == 15 ) /*0x2868*/ + { + n15 = sub_2BDC(v8, 20, 27); /*0x2873*/ + *a2 += n15; /*0x2878*/ + } + } + if ( a3 ) /*0x287e*/ + { + n15 = sub_2BDC(v8, 4, 7); /*0x288b*/ + *a3 = n15; /*0x2890*/ + if ( n6 == 6 || n6 == 15 ) /*0x289a*/ + { + n15 = 16 * (unsigned int)sub_2BDC(v8, 16, 19); /*0x28ac*/ + *a3 += n15; /*0x28af*/ + } + } + return n15; /*0x28c5*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/PciConfigReadVpd.c b/LenovoServerPkg/SystemInventory/SystemInventory/PciConfigReadVpd.c new file mode 100644 index 0000000..05e414d --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/PciConfigReadVpd.c @@ -0,0 +1,93 @@ +__int64 __fastcall PciConfigReadVpd(_BYTE *p_n145, __int16 a2, unsigned __int16 n4, __int64 a4, unsigned int a5) +{ + unsigned __int64 n4_4; // rbx + unsigned int v8; // r15d + __int16 v9; // r14 + unsigned __int16 n4_3; // bp + __int64 v11; // rsi + __int64 v12; // rdx + __int64 v13; // rcx + __int64 v14; // rdi + __int64 v15; // r8 + __int64 v16; // r9 + unsigned int v17; // esi + __int64 v18; // rdx + __int64 v19; // r8 + __int64 v20; // r9 + unsigned __int16 n4_2; // si + __int64 v23; // r8 + __int16 v24; // [rsp+72h] [rbp+Ah] BYREF + _BYTE v25[4]; // [rsp+74h] [rbp+Ch] BYREF + unsigned int v26; // [rsp+78h] [rbp+10h] + unsigned __int16 n4_1; // [rsp+80h] [rbp+18h] + + n4_1 = n4; /*0x5a81*/ + n4_4 = a2 & 3; /*0x5aaa*/ + v8 = a5 + 2; /*0x5aad*/ + v26 = a5 + 4; /*0x5ab4*/ + v9 = a2 & 0xFFFC; /*0x5abd*/ + n4_3 = 0; /*0x5ac3*/ + if ( !n4 ) /*0x5aca*/ + return 0; /*0x5bd5*/ +LABEL_2: + v24 = v9 & 0x7FFF; /*0x5ad3*/ + v11 = 0; /*0x5afb*/ + v14 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, __int16 *))(a4 + 56))(a4, 1, v8, 1, &v24); /*0x5afd*/ + if ( v14 >= 0 ) + { + while ( 1 ) + { + (*(void (__fastcall **)(__int64))(qword_96A8 + 248))(100); /*0x5b15*/ + v14 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, __int16 *))(a4 + 48))(a4, 1, v8, 1, &v24); /*0x5b39*/ + if ( v14 < 0 ) /*0x5b3f*/ + break; /*0x5b3f*/ + if ( v24 >= 0 && (unsigned __int64)++v11 < 0x57E40 ) /*0x5b5e*/ + continue; /*0x5b5e*/ + if ( (v24 & 0x8000) == 0 ) + { + if ( (unsigned __int8)sub_7F8( + "Create DisableBmcVirtualCD Event with legacy boot fail, Status: %r\n", + v12, + v15, + v16) + && (unsigned __int8)sub_804(64) ) + { + sub_740(64, "PciConfigReadVpd: Unable to see F bit go TRUE\n"); + } + return 0x8000000000000007uLL; /*0x5c3e*/ + } + v17 = v26; /*0x5b6e*/ + v14 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, _BYTE *))(a4 + 48))(a4, 2, v26, 1, v25); /*0x5b8f*/ + if ( v14 < 0 ) /*0x5b95*/ + { + if ( (unsigned __int8)sub_7F8(0, v18, v19, v20) && (unsigned __int8)sub_804(64) ) /*0x5bff*/ + { + v23 = v17; /*0x5c08*/ + goto LABEL_23; /*0x5c0b*/ + } + return v14; /*0x5c06*/ + } + n4_2 = n4_1; /*0x5b97*/ + do /*0x5bc3*/ + { + if ( n4_3 >= n4_2 ) /*0x5ba8*/ + break; /*0x5ba8*/ + ++n4_3; /*0x5bae*/ + *p_n145++ = v25[n4_4++]; /*0x5bb1*/ + } + while ( n4_4 < 4 ); /*0x5bc3*/ + v9 += 4; /*0x5bc5*/ + n4_4 = 0; /*0x5bc9*/ + if ( n4_3 < n4_2 ) /*0x5bcf*/ + goto LABEL_2; /*0x5bcf*/ + return 0; /*0x5bcf*/ + } + } + if ( (unsigned __int8)sub_7F8(v13, v12, v15, v16) && (unsigned __int8)sub_804(64) ) + { + v23 = v8; /*0x5c59*/ +LABEL_23: + sub_740(64, "PciConfigReadVpd: Error reading PciIo space at offset %x - code = %r\n", v23, v14); + } + return v14; /*0x5bdf*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/RegisterProtocolNotifyEx.c b/LenovoServerPkg/SystemInventory/SystemInventory/RegisterProtocolNotifyEx.c new file mode 100644 index 0000000..89af876 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/RegisterProtocolNotifyEx.c @@ -0,0 +1,33 @@ +__int64 __fastcall RegisterProtocolNotifyEx(__int64 a1, __int64 n8, __int64 (__fastcall *NotifyFunction)(__int64 a1), __int64 a4, __int64 a5) +{ + __int64 v9; // rax + __int64 v10; // rdx + __int64 v11; // r8 + _QWORD v13[3]; // [rsp+30h] [rbp-18h] BYREF + + if ( !a1 ) /*0x2061*/ + sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 152, "ProtocolGuid != ((void *) 0)"); /*0x2072*/ + if ( !NotifyFunction ) /*0x2084*/ + sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 153, "NotifyFunction != ((void *) 0)"); /*0x2095*/ + if ( !a5 ) /*0x20aa*/ + sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 154, "Registration != ((void *) 0)"); /*0x20bb*/ + if ( (*(__int64 (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(__int64), __int64, _QWORD *))(qword_96A8 + 80))( /*0x20f7*/ + 512, + n8, + NotifyFunction, + a4, + v13) < 0 ) + { + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n"); /*0x2113*/ + sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 167, "!EFI_ERROR (Status)"); /*0x2127*/ + } + v9 = (*(__int64 (__fastcall **)(__int64, _QWORD, __int64))(qword_96A8 + 168))(a1, v13[0], a5); /*0x2140*/ + LOBYTE(v11) = 15; /*0x2146*/ + if ( v9 < 0 ) /*0x2156*/ + { + sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9, 1); /*0x217c*/ + sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 179, "!EFI_ERROR (Status)"); /*0x2190*/ + } + (*(void (__fastcall **)(_QWORD, __int64, __int64))(qword_96A8 + 104))(v13[0], v10, v11); /*0x21a1*/ + return v13[0]; /*0x21bd*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/RegisterReadyToBootHandler.c b/LenovoServerPkg/SystemInventory/SystemInventory/RegisterReadyToBootHandler.c new file mode 100644 index 0000000..a088b69 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/RegisterReadyToBootHandler.c @@ -0,0 +1,41 @@ +__int64 __fastcall RegisterReadyToBootHandler(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +{ + __int64 v2; // rbx + __int64 v3; // rdx + __int64 v4; // rcx + __int64 v5; // r8 + __int64 v6; // r9 + __int64 result; // rax + __int64 v8; // rbx + __int64 v9; // [rsp+60h] [rbp+18h] BYREF + + v2 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_93C0, 0, &v9); /*0x64fd*/ + if ( (unsigned __int8)sub_7F8(v4, v3, v5, v6) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x6510*/ + sub_740(0x80000000LL, "[System Inventory] SystemInventoryEntryPoint EfiCreateEventReadyToBootEx - %r\n", v2); /*0x6525*/ + result = sub_C8C(97); /*0x6532*/ + if ( v2 >= 0 ) /*0x653a*/ + { + v8 = (*(__int64 (__fastcall **)(__int64, __int64 (__fastcall *)(), _QWORD, _QWORD, _QWORD, _QWORD, _QWORD))(v9 + 16))( /*0x6566*/ + v9, + sub_3EE8, + 0, + 0, + 0, + 0, + 0); + result = sub_7EC(); /*0x6569*/ + if ( (_BYTE)result ) /*0x6570*/ + { + if ( v8 ) /*0x6575*/ + { + result = 0x8000000000000013uLL; /*0x6577*/ + if ( v8 != 0x8000000000000013uLL ) /*0x6584*/ + return sub_788( /*0x6599*/ + "e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", + 2160, + "MpStatus == 0 || MpStatus == ((RETURN_STATUS)(0x8000000000000000ULL | (19)))"); + } + } + } + return result; /*0x65a3*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/RegisterSystemInventoryCallbacks.c b/LenovoServerPkg/SystemInventory/SystemInventory/RegisterSystemInventoryCallbacks.c new file mode 100644 index 0000000..4d0953f --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/RegisterSystemInventoryCallbacks.c @@ -0,0 +1,23 @@ +__int64 RegisterSystemInventoryCallbacks() +{ + __int64 v0; // rbx + __int64 v1; // rdx + __int64 v2; // rcx + __int64 v3; // r8 + __int64 v4; // r9 + _BYTE v6[24]; // [rsp+30h] [rbp-18h] BYREF + __int64 v7; // [rsp+60h] [rbp+18h] BYREF + __int64 v8; // [rsp+68h] [rbp+20h] BYREF + + v7 = 0; /*0x5f62*/ + sub_2528(); /*0x5f68*/ + if ( (*(__int64 (__fastcall **)(void *, _QWORD, _BYTE *))(qword_96A8 + 320))(&unk_9420, 0, v6) >= 0 ) /*0x5f90*/ + OnIpmiDxeProtocolNotify(0); /*0x5fba*/ + else + RegisterProtocolNotifyEx((__int64)&unk_9420, 8, (__int64)OnIpmiDxeProtocolNotify, 0, (__int64)&v7); /*0x5faf*/ + v0 = CreateReadyToBootEventEx(8, OnReadyToBoot, 0, (__int64)&v8); /*0x5fd6*/ + if ( (unsigned __int8)sub_7F8(v2, v1, v3, v4) && (unsigned __int8)sub_804(64) ) /*0x5fe7*/ + sub_740(64, "[System Inventory] SystemInventoryEntryPoint EfiCreateEventReadyToBootEx - %r\n", v0); /*0x5fff*/ + CreateReadyToBootEventEx(8, RegisterReadyToBootHandler, 0, (__int64)&v8); /*0x6016*/ + return 0; /*0x6022*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SaveSmbiosDataToBmc.c b/LenovoServerPkg/SystemInventory/SystemInventory/SaveSmbiosDataToBmc.c new file mode 100644 index 0000000..de2ecb8 --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/SaveSmbiosDataToBmc.c @@ -0,0 +1,90 @@ +unsigned __int64 __fastcall SaveSmbiosDataToBmc(__int64 a1, __int64 a2, __int64 a3, __int64 a4) +{ + __int64 v4; // rdx + __int64 v5; // rcx + __int64 v6; // rbx + __int64 v7; // r8 + __int64 v8; // r9 + __int64 v10; // rbx + __int64 v11; // r14 + __int64 n24; // rdi + __int64 v13; // rsi + int v14; // r8d + char *v15; // rcx + __int64 v16; // rdx + __int64 v17; // rcx + __int64 v18; // r8 + __int64 v19; // r9 + __int64 v20; // [rsp+40h] [rbp-18h] BYREF + __int64 v21; // [rsp+48h] [rbp-10h] BYREF + unsigned __int8 v22; // [rsp+90h] [rbp+38h] BYREF + char v23; // [rsp+98h] [rbp+40h] BYREF + int v24; // [rsp+A0h] [rbp+48h] BYREF + _BYTE *p_n145; // [rsp+A8h] [rbp+50h] + + v21 = 0; /*0x5c88*/ + v20 = 0; /*0x5c8d*/ + p_n145 = 0; /*0x5c92*/ + v24 = 0; /*0x5c97*/ + if ( (unsigned __int8)sub_7F8(a1, a2, a3, a4) && (unsigned __int8)sub_804(64) ) + sub_740(64, "SaveSmbiosDataToBmc: Enter \n"); + v6 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x5ce2*/ + if ( v6 < 0 ) /*0x5ce8*/ + { + if ( (unsigned __int8)sub_7F8(v5, v4, v7, v8) ) /*0x5cea*/ + { + if ( (unsigned __int8)sub_804(64) ) /*0x5cf6*/ + sub_740(64, "Locating IPMI Dxe Protocol Status - %r\n", v6); /*0x5d0c*/ + } + return v6; /*0x5d14*/ + } + if ( GetSystemConfigurationTableByGuid(&unk_94A0, &v20) >= 0 ) + { + v10 = v20; /*0x5d2e*/ + if ( v20 ) + { + v11 = *(_QWORD *)(v20 + 16); /*0x5d37*/ + n24 = 24; /*0x5d3b*/ + v13 = *(unsigned int *)(v20 + 12); /*0x5d40*/ +LABEL_15: + p_n145 = (_BYTE *)sub_1D2C(v13 + n24 + 1); /*0x5d78*/ + *p_n145 = 1; /*0x5d8e*/ + (*(void (__fastcall **)(_BYTE *, __int64, __int64))(qword_96A8 + 352))(p_n145 + 1, v10, n24); /*0x5d9f*/ + (*(void (__fastcall **)(_BYTE *, __int64, __int64))(qword_96A8 + 352))(&p_n145[n24 + 1], v11, v13); /*0x5dbc*/ + v6 = (*(__int64 (__fastcall **)(const __int16 *, void *, __int64))(qword_96E0 + 88))(L"RDBG_SMBIOS", &unk_9480, 2); /*0x5df5*/ + if ( !qword_94B0 ) + { + LOBYTE(v14) = 71; /*0x5e19*/ + v15 = &v23; /*0x5e1c*/ + LOBYTE(v15) = 46; /*0x5e27*/ + v6 = sub_2640( /*0x5e32*/ + (_DWORD)v15, + 0, + v14, + (_DWORD)p_n145, + (int)n24 + (int)v13 + 1, + (__int64)&v23, + (__int64)&v24, + (__int64)&v22); + if ( (unsigned __int8)sub_7F8(v17, v16, v18, v19) ) + { + if ( (unsigned __int8)sub_804(64) ) + sub_740(64, "SaveSmbiosDataToBmc: SendOemIpmiCommand Status = %r , CompletionCode = %x \n", v6, v22); + } + } + return v6; /*0x5e69*/ + } + } + if ( GetSystemConfigurationTableByGuid(&unk_9490, &v21) >= 0 ) /*0x5d58*/ + { + v10 = v21; /*0x5d5e*/ + if ( v21 ) /*0x5d65*/ + { + v11 = *(unsigned int *)(v21 + 24); /*0x5d6b*/ + n24 = 31; /*0x5d6f*/ + v13 = *(unsigned __int16 *)(v21 + 22); /*0x5d74*/ + goto LABEL_15; /*0x5d74*/ + } + } + return 0x800000000000000EuLL; /*0x5e78*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SetBmcVirtualCdDeviceNumber.c b/LenovoServerPkg/SystemInventory/SystemInventory/SetBmcVirtualCdDeviceNumber.c new file mode 100644 index 0000000..061109b --- /dev/null +++ b/LenovoServerPkg/SystemInventory/SystemInventory/SetBmcVirtualCdDeviceNumber.c @@ -0,0 +1,55 @@ +__int64 __fastcall SetBmcVirtualCdDeviceNumber(char n2) +{ + __int64 v2; // rbx + __int64 v3; // rdx + __int64 v4; // rcx + __int64 v5; // r8 + __int64 v6; // r9 + __int64 result; // rax + __int64 v8; // rdx + __int64 v9; // r9 + __int64 v10; // rdx + __int64 v11; // rcx + __int64 v12; // r8 + __int64 v13; // r9 + char n2_2; // [rsp+28h] [rbp-30h] + char v15; // [rsp+68h] [rbp+10h] BYREF + char v16; // [rsp+70h] [rbp+18h] BYREF + char n4; // [rsp+78h] [rbp+20h] BYREF + char n2_1; // [rsp+79h] [rbp+21h] + + v2 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x5eb0*/ + result = sub_7F8(v4, v3, v5, v6); /*0x5eb3*/ + if ( (_BYTE)result ) /*0x5ebf*/ + { + result = sub_804(64); /*0x5ec3*/ + if ( (_BYTE)result ) /*0x5eca*/ + result = sub_740(64, "[System Inventory] Locating IPMI Dxe Protocol Status - %r\n", v2); /*0x5ed8*/ + } + if ( v2 >= 0 ) /*0x5ee0*/ + { + n4 = 4; /*0x5ee7*/ + LOBYTE(v9) = -53; /*0x5ef1*/ + n2_1 = n2; /*0x5ef9*/ + n2_2 = 2; /*0x5f0b*/ + LOBYTE(v8) = 50; /*0x5f15*/ + v15 = 1; /*0x5f21*/ + (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, char *, char, char *, char *))(qword_9690 + 16))( /*0x5f26*/ + qword_9690, + v8, + 0, + v9, + &n4, + n2_2, + &v16, + &v15); + result = sub_7F8(v11, v10, v12, v13); /*0x5f29*/ + if ( (_BYTE)result ) /*0x5f30*/ + { + result = sub_804(64); /*0x5f35*/ + if ( (_BYTE)result ) /*0x5f3c*/ + return sub_740(64, "Set CD Device Number to 2 for USB Data transferring.\n"); /*0x5f48*/ + } + } + return result; /*0x5f4d*/ +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory.c index 0d0344e..2975086 100644 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory.c +++ b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory.c @@ -19,7 +19,7 @@ { signed __int64 v4; - sub_2C6C((__int64)ImageHandle, (__int64)SystemTable); + InitializeSystemInventory(ImageHandle, SystemTable); v4 = sub_2E9C(ImageHandle, SystemTable); if ( v4 < 0 ) nullsub_1(ImageHandle, SystemTable); diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_ModuleEntryPoint.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_ModuleEntryPoint.c index 8790523..1db46c5 100644 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_ModuleEntryPoint.c +++ b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_ModuleEntryPoint.c @@ -2,9 +2,9 @@ { signed __int64 v4; // rsi - sub_2C6C((__int64)ImageHandle, (__int64)SystemTable); /*0x3fb*/ + InitializeSystemInventory(ImageHandle, SystemTable); /*0x3fb*/ v4 = sub_2E9C(ImageHandle, SystemTable); /*0x48f*/ if ( v4 < 0 ) /*0x495*/ nullsub_1(ImageHandle, SystemTable); /*0x49d*/ return v4; /*0x4af*/ -} \ No newline at end of file +} diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_1F50.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_1F50.c deleted file mode 100644 index a2b5ee6..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_1F50.c +++ /dev/null @@ -1,23 +0,0 @@ -unsigned __int64 __fastcall sub_1F50(__int64 a1, void **a2) -{ - EFI_SYSTEM_TABLE *SystemTable; // rdi - __int64 v5; // rbx - __int64 i; // r14 - - if ( !a1 ) /*0x1f7c*/ - sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 97, "TableGuid != ((void *) 0)"); /*0x1f8f*/ - if ( !a2 ) /*0x1fa1*/ - sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 98, "Table != ((void *) 0)"); /*0x1fb4*/ - SystemTable = SystemTable; /*0x1fb9*/ - v5 = 0; /*0x1fc0*/ - *a2 = 0; /*0x1fc2*/ - if ( !SystemTable->NumberOfTableEntries ) /*0x1fc6*/ - return 0x800000000000000EuLL; /*0x1fef*/ - for ( i = 0; !(unsigned __int8)sub_2ACC(a1, &SystemTable->ConfigurationTable[i]); ++i ) /*0x1fcc*/ - { - if ( ++v5 >= SystemTable->NumberOfTableEntries ) /*0x1fed*/ - return 0x800000000000000EuLL; /*0x1fed*/ - } - *a2 = SystemTable->ConfigurationTable[v5].VendorTable; /*0x2023*/ - return 0; /*0x200d*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2028.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2028.c deleted file mode 100644 index dd2a566..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2028.c +++ /dev/null @@ -1,33 +0,0 @@ -__int64 __fastcall sub_2028(__int64 a1, __int64 n8, __int64 (__fastcall *sub_6028)(__int64 a1), __int64 a4, __int64 a5) -{ - __int64 v9; // rax - __int64 v10; // rdx - __int64 v11; // r8 - _QWORD v13[3]; // [rsp+30h] [rbp-18h] BYREF - - if ( !a1 ) /*0x2061*/ - sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 152, "ProtocolGuid != ((void *) 0)"); /*0x2072*/ - if ( !sub_6028 ) /*0x2084*/ - sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 153, "NotifyFunction != ((void *) 0)"); /*0x2095*/ - if ( !a5 ) /*0x20aa*/ - sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 154, "Registration != ((void *) 0)"); /*0x20bb*/ - if ( (*(__int64 (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(__int64), __int64, _QWORD *))(qword_96A8 + 80))( /*0x20f7*/ - 512, - n8, - sub_6028, - a4, - v13) < 0 ) - { - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n"); /*0x2113*/ - sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 167, "!EFI_ERROR (Status)"); /*0x2127*/ - } - v9 = (*(__int64 (__fastcall **)(__int64, _QWORD, __int64))(qword_96A8 + 168))(a1, v13[0], a5); /*0x2140*/ - LOBYTE(v11) = 15; /*0x2146*/ - if ( v9 < 0 ) /*0x2156*/ - { - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9, 1); /*0x217c*/ - sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 179, "!EFI_ERROR (Status)"); /*0x2190*/ - } - (*(void (__fastcall **)(_QWORD, __int64, __int64))(qword_96A8 + 104))(v13[0], v10, v11); /*0x21a1*/ - return v13[0]; /*0x21bd*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_21C8.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_21C8.c deleted file mode 100644 index 47c51cf..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_21C8.c +++ /dev/null @@ -1,30 +0,0 @@ -__int64 __fastcall sub_21C8( - __int64 n16, - __int64 (__fastcall *sub_3C80)(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable), - __int64 a3, - __int64 a4) -{ - __int64 (__fastcall *nullsub_2)(EFI_HANDLE, EFI_SYSTEM_TABLE *); // r8 - - if ( !a4 ) /*0x21f8*/ - sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiNotTiano.c", 86, "LegacyBootEvent != ((void *) 0)"); /*0x220c*/ - if ( SystemTable->Hdr.Revision >= 0x20000 ) /*0x2226*/ - { - nullsub_2 = nullsub_1; /*0x228e*/ - if ( sub_3C80 ) /*0x22a5*/ - nullsub_2 = sub_3C80; /*0x22a5*/ - return (*(__int64 (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(EFI_HANDLE, EFI_SYSTEM_TABLE *), __int64, void *, __int64))(qword_96A8 + 368))( /*0x22ae*/ - 512, - n16, - nullsub_2, - a3, - &unk_9390, - a4); - } - else - { - sub_740(0x80000000LL, "EFI1.1 can't support LegacyBootEvent!"); /*0x2247*/ - sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiNotTiano.c", 90, "((BOOLEAN)(0==1))"); /*0x226c*/ - return 0x8000000000000003uLL; /*0x2271*/ - } -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_22CC.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_22CC.c deleted file mode 100644 index a76bedf..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_22CC.c +++ /dev/null @@ -1,30 +0,0 @@ -__int64 __fastcall sub_22CC( - __int64 n8, - __int64 (__fastcall *nullsub)(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable), - __int64 a3, - __int64 a4) -{ - __int64 (__fastcall *nullsub_2)(EFI_HANDLE, EFI_SYSTEM_TABLE *); // r8 - - if ( !a4 ) /*0x22fc*/ - sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiNotTiano.c", 181, "ReadyToBootEvent != ((void *) 0)"); /*0x2311*/ - if ( SystemTable->Hdr.Revision >= 0x20000 ) /*0x232b*/ - { - nullsub_2 = nullsub_1; /*0x2393*/ - if ( nullsub ) /*0x23aa*/ - nullsub_2 = nullsub; /*0x23aa*/ - return (*(__int64 (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(EFI_HANDLE, EFI_SYSTEM_TABLE *), __int64, void *, __int64))(qword_96A8 + 368))( /*0x23b3*/ - 512, - n8, - nullsub_2, - a3, - &unk_9380, - a4); - } - else - { - sub_740(0x80000000LL, "EFI1.1 can't support ReadyToBootEvent!"); /*0x234c*/ - sub_788("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiNotTiano.c", 185, "((BOOLEAN)(0==1))"); /*0x2371*/ - return 0x8000000000000003uLL; /*0x2376*/ - } -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2550.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2550.c deleted file mode 100644 index a448709..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2550.c +++ /dev/null @@ -1,35 +0,0 @@ -__int64 __fastcall sub_2550(char a1, __int64 a2, __int64 a3, __int64 a4, int a5, __int64 a6, _DWORD *a7, _BYTE *a8) -{ - __int64 v8; // r10 - __int64 v9; // rdi - char v10; // si - char v11; // bp - __int64 result; // rax - - v8 = qword_96F8; /*0x2569*/ - v9 = a4; /*0x2570*/ - v10 = a3; /*0x2573*/ - v11 = a2; /*0x2576*/ - if ( !qword_96F8 ) /*0x257f*/ - { - (*(void (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_93D0, 0, &qword_96F8); /*0x2598*/ - v8 = qword_96F8; /*0x259e*/ - if ( !qword_96F8 ) /*0x25a8*/ - return 0x8000000000000018uLL; /*0x25aa*/ - } - LOBYTE(a4) = v10; /*0x25bb*/ - LOBYTE(a3) = v11; /*0x25c6*/ - LOBYTE(a2) = a1; /*0x25ce*/ - result = (*(__int64 (__fastcall **)(__int64, __int64, __int64, __int64, __int64, int, __int64, _DWORD *))(v8 + 16))( /*0x25e6*/ - v8, - a2, - a3, - a4, - v9, - a5, - a6, - a7); - if ( a8 && (!result || result == 0x8000000000000007uLL && *a7 == 1) ) /*0x2611*/ - *a8 = *(_BYTE *)qword_96F8; /*0x261c*/ - return result; /*0x2636*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_27F8.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_27F8.c deleted file mode 100644 index e8a8419..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_27F8.c +++ /dev/null @@ -1,34 +0,0 @@ -__int64 __fastcall sub_27F8(__int64 a1, _DWORD *a2, _DWORD *a3, _DWORD *a4, _DWORD *a5) -{ - unsigned int v8; // edi - __int64 n15; // rax - int n6; // ebx - - v8 = a1; /*0x281f*/ - if ( a5 ) /*0x2824*/ - *a5 = sub_2BDC(a1, 12, 13); /*0x2834*/ - if ( a4 ) /*0x283a*/ - *a4 = sub_2BDC(v8, 0, 3); /*0x2849*/ - n15 = sub_2BDC(v8, 8, 11); /*0x2856*/ - n6 = n15; /*0x285b*/ - if ( a2 ) /*0x2860*/ - { - *a2 = n15; /*0x2862*/ - if ( (_DWORD)n15 == 15 ) /*0x2868*/ - { - n15 = sub_2BDC(v8, 20, 27); /*0x2873*/ - *a2 += n15; /*0x2878*/ - } - } - if ( a3 ) /*0x287e*/ - { - n15 = sub_2BDC(v8, 4, 7); /*0x288b*/ - *a3 = n15; /*0x2890*/ - if ( n6 == 6 || n6 == 15 ) /*0x289a*/ - { - n15 = 16 * (unsigned int)sub_2BDC(v8, 16, 19); /*0x28ac*/ - *a3 += n15; /*0x28af*/ - } - } - return n15; /*0x28c5*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2C6C.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2C6C.c deleted file mode 100644 index 5c401b3..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2C6C.c +++ /dev/null @@ -1,100 +0,0 @@ -__int64 __fastcall sub_2C6C(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) -{ - __int64 v4; // rbx - __int64 v5; // rdx - __int64 v6; // rcx - __int64 v7; // r8 - __int64 v8; // r9 - __int64 v9; // rbx - __int64 v10; // rdx - __int64 v11; // rcx - __int64 v12; // r8 - __int64 v13; // r9 - __int64 v14; // rbx - __int64 v15; // rdx - __int64 v16; // rcx - __int64 v17; // r8 - __int64 v18; // r9 - __int64 v19; // rbx - __int64 v20; // rdx - __int64 v21; // rcx - __int64 v22; // r8 - __int64 v23; // r9 - __int64 v24; // rbx - __int64 v25; // rdx - __int64 v26; // rcx - __int64 v27; // r8 - __int64 v28; // r9 - __int64 v29; // rbx - __int64 result; // rax - __int64 v31; // rdx - __int64 v32; // rcx - __int64 v33; // r8 - __int64 v34; // r9 - - v4 = sub_4B8(); /*0x2c94*/ - if ( (unsigned __int8)sub_7EC() && v4 < 0 ) /*0x2cbd*/ - { - if ( (unsigned __int8)sub_7F8(v6, v5, v7, v8) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x2cca*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v4); /*0x2cdb*/ - sub_788( /*0x2ceb*/ - "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", - 306, - "!EFI_ERROR (Status)"); - } - v9 = sub_554(ImageHandle, SystemTable); /*0x2cfb*/ - if ( (unsigned __int8)sub_7EC() && v9 < 0 ) /*0x2d0a*/ - { - if ( (unsigned __int8)sub_7F8(v11, v10, v12, v13) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x2d18*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0x2d2a*/ - sub_788( /*0x2d3a*/ - "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", - 309, - "!EFI_ERROR (Status)"); - } - v14 = sub_1F4C(ImageHandle, SystemTable); /*0x2d4a*/ - if ( (unsigned __int8)sub_7EC() && v14 < 0 ) /*0x2d59*/ - { - if ( (unsigned __int8)sub_7F8(v16, v15, v17, v18) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x2d67*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v14); /*0x2d79*/ - sub_788( /*0x2d89*/ - "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", - 312, - "!EFI_ERROR (Status)"); - } - v19 = sub_247C(ImageHandle, SystemTable); /*0x2d99*/ - if ( (unsigned __int8)sub_7EC() && v19 < 0 ) /*0x2da8*/ - { - if ( (unsigned __int8)sub_7F8(v21, v20, v22, v23) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x2db6*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v19); /*0x2dc8*/ - sub_788( /*0x2dd8*/ - "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", - 315, - "!EFI_ERROR (Status)"); - } - v24 = sub_248C(ImageHandle, SystemTable); /*0x2de8*/ - if ( (unsigned __int8)sub_7EC() && v24 < 0 ) /*0x2df7*/ - { - if ( (unsigned __int8)sub_7F8(v26, v25, v27, v28) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x2e05*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v24); /*0x2e17*/ - sub_788( /*0x2e27*/ - "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", - 318, - "!EFI_ERROR (Status)"); - } - v29 = sub_26D8(ImageHandle, SystemTable); /*0x2e37*/ - result = sub_7EC(); /*0x2e3a*/ - if ( (_BYTE)result && v29 < 0 ) /*0x2e46*/ - { - if ( (unsigned __int8)sub_7F8(v32, v31, v33, v34) ) /*0x2e48*/ - { - if ( (unsigned __int8)sub_804(0x80000000LL) ) /*0x2e54*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v29); /*0x2e66*/ - } - return sub_788( /*0x2e76*/ - "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", - 321, - "!EFI_ERROR (Status)"); - } - return result; /*0x2e8f*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2EA4.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2EA4.c deleted file mode 100644 index 60cc5a1..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_2EA4.c +++ /dev/null @@ -1,238 +0,0 @@ -unsigned __int64 __fastcall sub_2EA4(__int64 a1, char a2, __int64 a3, _WORD *a4) -{ - __int64 p_n145_2; // r13 - __int64 v7; // rdx - __int64 v8; // rcx - __int64 v9; // rsi - __int64 v10; // r8 - __int64 v11; // r9 - int v12; // r14d - unsigned __int64 v13; // rbp - unsigned int v14; // r14d - __int64 v15; // rdx - __int64 v16; // rcx - __int64 v17; // rsi - __int64 v18; // r8 - __int64 v19; // r9 - unsigned __int64 n0x40; // rax - int v21; // r9d - unsigned __int16 v22; // r15 - __int64 v23; // rdx - __int64 v24; // rcx - __int64 v25; // rdi - __int64 v26; // r8 - __int64 v27; // r9 - unsigned __int16 n4_3; // di - __int16 n3; // ax - unsigned __int16 n4_1; // si - __int16 v31; // bp - int n2; // ebp - unsigned __int16 v33; // r12 - int n145_1; // r15d - __int64 v35; // rcx - __int64 v36; // rcx - __int64 n4_2; // rdi - __int64 p_n145; // rax - __int64 v39; // rdx - __int64 v40; // rcx - __int64 v41; // r8 - __int64 v42; // r9 - __int64 p_n145_1; // rax - int n2_1; // r8d - unsigned __int64 v45; // [rsp+60h] [rbp-F8h] - __int64 v46; // [rsp+68h] [rbp-F0h] BYREF - _BYTE v47[16]; // [rsp+70h] [rbp-E8h] BYREF - unsigned __int8 n145; // [rsp+80h] [rbp-D8h] BYREF - unsigned __int16 n4; // [rsp+81h] [rbp-D7h] - __int16 v50; // [rsp+160h] [rbp+8h] - - v45 = 0x8000000000000003uLL; /*0x2ed9*/ - p_n145_2 = 0; /*0x2ede*/ - if ( (*(_BYTE *)(a1 + 38) & 0x7F) != 0 || (*(_BYTE *)(a1 + 30) & 0x10) == 0 ) /*0x2eef*/ - return 0x8000000000000003uLL; /*0x2ee6*/ - v9 = (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *, _QWORD, _QWORD, int))(qword_96A8 + 280))( /*0x2f21*/ - *(_QWORD *)(a1 + 16), - &unk_9400, - &v46, - 0, - 0, - 2); - if ( v9 < 0 ) - { - if ( (unsigned __int8)sub_7F8(v8, v7, v10, v11) ) - { - if ( (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: OpenProtocol failed. %r\n", v9); - } - return 0x8000000000000003uLL; /*0x2f52*/ - } - v12 = *(unsigned __int8 *)(a1 + 76); /*0x2f54*/ - v13 = 0; /*0x2f59*/ - while ( 1 ) - { - v14 = v12 & 0xFFFFFFFC; /*0x2f66*/ - v17 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, _BYTE *))(v46 + 48))(v46, 2, v14, 2, v47); /*0x2f83*/ - if ( v17 < 0 ) - { - if ( (unsigned __int8)sub_7F8(v16, v15, v18, v19) && (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: Error reading capabilities - CapabilitiesPtr = %x, code=%r\n", v14, v17); - return v17; /*0x3470*/ - } - if ( v47[0] == 3 ) /*0x2f94*/ - break; /*0x2f94*/ - v12 = v47[1]; /*0x2f96*/ - n0x40 = v13++; /*0x2f9c*/ - if ( n0x40 > 0x40 ) - { - if ( (unsigned __int8)sub_7F8(v16, v15, v18, v19) && (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: Impossible number of capabilities. CapabilitiesPtr = %x%d\n", v12, v21); - v12 = 0; /*0x2fce*/ - } - if ( !v12 ) /*0x2fd4*/ - return v45; /*0x2fd4*/ - } - if ( !v14 ) /*0x2fdf*/ - return v45; /*0x2fdf*/ - if ( (unsigned __int8)sub_7F8(v16, v15, v18, v19) && (unsigned __int8)sub_804(64) ) - sub_740( - 64, - "CheckDeviceVpd: Found capabilities %4.4x %4.4x bus=%d,dev=%d,fun=%d,cl=%d.%d.%d, VpdReg=%x\n", - *(unsigned __int16 *)(a1 + 24), - *(unsigned __int16 *)(a1 + 26), - *(_QWORD *)(a1 + 96), - *(_QWORD *)(a1 + 104), - *(_QWORD *)(a1 + 112), - *(unsigned __int8 *)(a1 + 35), - *(unsigned __int8 *)(a1 + 34), - *(unsigned __int8 *)(a1 + 33), - v14); - v50 = 0; /*0x3055*/ - v45 = 0x8000000000000003uLL; /*0x305e*/ - v22 = 0; /*0x3063*/ - while ( 1 ) - { - v25 = sub_5A7C((unsigned int)&n145, v22, 4, v46, v14); /*0x308a*/ - if ( v25 < 0 ) - { - if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: Error reading PciVpd - code = %r\n", v25); - return v45; /*0x343a*/ - } - LOBYTE(v24) = n145; /*0x3096*/ - switch ( n145 ) - { - case 0x78u: - if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: Normal end tag found\n"); - return v45; /*0x3416*/ - case 0xFF: - if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: Bad ID 0xff found. Done.\n"); - return v45; /*0x33f0*/ - case 0u: - if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: Bad ID 0x00 found. Done.\n"); - return v45; /*0x33d2*/ - } - n4_3 = n4; /*0x30b7*/ - if ( (n145 & 0x80u) == 0 ) /*0x30bf*/ - break; /*0x30bf*/ - if ( n4 < 4u ) - { - if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) - { - n2_1 = n4_3; /*0x3378*/ -LABEL_72: - sub_740(64, "CheckDeviceVpd: Invalid length of %hd found. Done.\n", n2_1); - return v45; /*0x338b*/ - } - return v45; /*0x3372*/ - } - n3 = 3; /*0x30ca*/ - n4_1 = n4; /*0x30cf*/ - v31 = n4 + 3; /*0x30d2*/ -LABEL_32: - v33 = v22 + n3; /*0x30f7*/ - n145_1 = n145; /*0x30fe*/ - v35 = (unsigned int)n145 - 130; /*0x3105*/ - if ( n145 != 130 ) - { - v36 = (unsigned int)n145 - 144; /*0x3111*/ - if ( n145 == 144 ) - { - if ( (unsigned __int8)sub_7F8(v36, v23, v26, v27) && (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: Processing R/O region\n"); - } - else if ( n145 != 145 ) - { - if ( (unsigned __int8)sub_7F8(v36, v23, v26, v27) && (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: type 0x%x resource found\n", n145_1); - goto LABEL_61; /*0x314a*/ - } - if ( (unsigned __int8)sub_7F8(v36, v23, v26, v27) && (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: Large Resource Tag type %2.2x found, length = %d\n", n145_1, n4_3); - v35 = 1; /*0x31a5*/ - if ( (unsigned __int8)(a2 + 112) <= 1u && n4_1 > 0x10u ) - { - n4_2 = n4_1; /*0x31be*/ - p_n145 = sub_1D24(n4_1); /*0x31c3*/ - p_n145_2 = p_n145; /*0x31c8*/ - if ( !p_n145 ) - { - if ( (unsigned __int8)sub_7F8(v40, v39, v41, v42) && (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: Unable to allocate memory for resource Done.\n"); - goto LABEL_63; /*0x31fc*/ - } - if ( sub_5A7C(p_n145, v33, n4_1, v46, v14) >= 0 ) - { - if ( (unsigned __int8)sub_7F8(v35, v23, v26, v27) && (unsigned __int8)sub_804(2) ) - sub_740(2, "CheckDeviceVpd: type 0x90/91 - %a\n", p_n145_2); - goto LABEL_60; /*0x324c*/ - } - } -LABEL_61: - if ( p_n145_2 ) /*0x32f4*/ - sub_1D54(p_n145_2); /*0x32f9*/ - goto LABEL_63; /*0x32f9*/ - } - if ( a2 != -126 ) /*0x3256*/ - goto LABEL_61; /*0x3256*/ - n4_2 = n4_1; /*0x325c*/ - p_n145_1 = sub_1D2C(n4_1 + 1LL); /*0x3263*/ - p_n145_2 = p_n145_1; /*0x3268*/ - if ( p_n145_1 ) - { - if ( sub_5A7C(p_n145_1, v33, n4_1, v46, v14) >= 0 ) - { - if ( (unsigned __int8)sub_7F8(v35, v23, v26, v27) && (unsigned __int8)sub_804(2) ) - sub_740(2, "CheckDeviceVpd: type 0x82 - %a\n", p_n145_2); -LABEL_60: - (*(void (__fastcall **)(__int64, __int64, __int64))(qword_96D8 + 352))(a3, p_n145_2, n4_2 + 1); /*0x32c2*/ - v45 = 0; /*0x32e9*/ - *a4 = n4_1 + 1; /*0x32ee*/ - } - goto LABEL_61; /*0x32ee*/ - } -LABEL_63: - if ( (unsigned __int8)sub_7F8(v35, v23, v26, v27) && (unsigned __int8)sub_804(64) ) - sub_740(64, "CheckDeviceVpd: Done Processing VPD Section\n"); - v22 = v31 + v50; /*0x332b*/ - v50 += v31; /*0x332f*/ - if ( !v31 || v45 != 0x8000000000000003uLL ) /*0x3350*/ - return v45; /*0x3350*/ - } - n2 = n145 & 7; /*0x30db*/ - if ( (unsigned __int16)n2 >= 2u ) /*0x30e6*/ - { - n3 = 1; /*0x30ec*/ - n4_1 = n145 & 7; /*0x30f1*/ - v31 = n2 + 1; /*0x30f4*/ - goto LABEL_32; /*0x30f4*/ - } - if ( (unsigned __int8)sub_7F8(v24, v23, v26, v27) && (unsigned __int8)sub_804(64) ) /*0x33a0*/ - { - n2_1 = n2; /*0x33ad*/ - goto LABEL_72; /*0x33b0*/ - } - return v45; /*0x3473*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3488.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3488.c deleted file mode 100644 index 20fb690..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3488.c +++ /dev/null @@ -1,357 +0,0 @@ -__int64 __fastcall sub_3488(__int64 a1, __int64 a2, __int64 a3, char a4) -{ - double v4; // xmm3_8 - __int64 v5; // rdi - __int64 v6; // r14 - __int64 v7; // r15 - char v8; // r12 - unsigned __int64 v9; // r13 - __int64 v10; // rbx - __int64 i_1; // rax - __int64 i_4; // rbx - __int64 v13; // rbx - __int64 v14; // rbx - __int64 i_5; // rbx - __int64 v16; // rdx - unsigned __int16 n0xFF_1; // bx - char v18; // al - unsigned __int16 n0xFF; // r14 - _BYTE *v20; // rdi - char n0xFF_2; // cl - __int64 v22; // r9 - __int64 v23; // rdx - __int64 v24; // rdx - char v25; // al - unsigned __int16 n0xFF_3; // di - unsigned __int16 i_7; // cx - int i_2; // r15d - int i_8; // edi - unsigned __int8 v30; // r12 - __int64 v31; // rbx - __int64 v32; // r14 - unsigned __int16 v33; // bx - __int64 v34; // rdx - __int64 v35; // r9 - unsigned __int16 i; // cx - int i_3; // r14d - unsigned __int8 v38; // r15 - __int64 v39; // rbx - __int64 v40; // rdi - unsigned __int16 v41; // bx - __int64 v42; // rdx - __int64 v43; // r9 - int v44; // [rsp+28h] [rbp-D8h] - _WORD v45[2]; // [rsp+44h] [rbp-BCh] BYREF - int i_6; // [rsp+48h] [rbp-B8h] - __int64 v47; // [rsp+50h] [rbp-B0h] BYREF - __int64 v48; // [rsp+58h] [rbp-A8h] BYREF - unsigned __int64 v49; // [rsp+60h] [rbp-A0h] BYREF - _BYTE v50[16]; // [rsp+70h] [rbp-90h] BYREF - __int64 v51; // [rsp+80h] [rbp-80h] - _BYTE v52[64]; // [rsp+88h] [rbp-78h] BYREF - _BYTE v53[8]; // [rsp+C8h] [rbp-38h] BYREF - __int64 v54; // [rsp+D0h] [rbp-30h] BYREF - __int64 v55; // [rsp+D8h] [rbp-28h] BYREF - _QWORD v56[3]; // [rsp+E0h] [rbp-20h] BYREF - char v57; // [rsp+FBh] [rbp-5h] - _BYTE v58[65600]; // [rsp+100h] [rbp+0h] BYREF - - v5 = a3; /*0x34b5*/ - v6 = a2; /*0x34b8*/ - v7 = a1; /*0x34bb*/ - v8 = a4; /*0x34ca*/ - sub_65B0(v58, 0, 0x10000); /*0x34cd*/ - v9 = 0; /*0x34ef*/ - v10 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x34f2*/ - if ( v10 >= 0 ) - { - i_1 = (*(__int64 (__fastcall **)(__int64, void *, _QWORD, unsigned __int64 *, __int64 *))(qword_96A8 + 312))( /*0x3554*/ - 2, - &unk_9400, - 0, - &v49, - &v47); - i_4 = i_1; /*0x355a*/ - if ( i_1 >= 0 ) - { - if ( v49 ) - { - do - { - sub_63C(v50, 140); /*0x35aa*/ - v57 = 1; /*0x35c7*/ - v13 = (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *, _QWORD, _QWORD, int))(qword_96A8 + 280))( /*0x35e5*/ - *(_QWORD *)(v47 + 8 * v9), - &unk_9400, - &v48, - 0, - 0, - 2); - if ( v13 >= 0 ) - { - v14 = (*(__int64 (__fastcall **)(__int64, _QWORD, _QWORD, __int64, _BYTE *))(v48 + 48))(v48, 0, 0, 64, v52); /*0x3668*/ - if ( v14 >= 0 ) - { - v51 = *(_QWORD *)(v47 + 8 * v9); /*0x36bf*/ - i_1 = (*(__int64 (__fastcall **)(__int64, _BYTE *, __int64 *, __int64 *, _QWORD *))(v48 + 112))( /*0x36c6*/ - v48, - v53, - &v54, - &v55, - v56); - i_5 = i_1; /*0x36c9*/ - if ( i_1 >= 0 ) - { - if ( v54 == v7 && v55 == v6 && v56[0] == v5 ) - { - (*(void (__fastcall **)(_BYTE *, __int64, _QWORD))(qword_96D8 + 360))(v58, 0x10000, 0); /*0x3728*/ - LOBYTE(v16) = -126; /*0x3733*/ - n0xFF_1 = 0; /*0x3743*/ - if ( sub_2EA4(v50, v16, v58, v45) >= 0 ) - { - v18 = sub_7F8(); /*0x374e*/ - n0xFF = v45[0]; /*0x3753*/ - if ( v18 && (unsigned __int8)sub_804(2) ) - sub_740(2, "CheckVpdAndUpdateToBmc: RDBG VPD type 0x82 , Data Length = %x\n", n0xFF); - if ( n0xFF ) /*0x3783*/ - { - do /*0x37be*/ - { - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3795*/ - sub_740(0x80000000LL, "%x ", (unsigned __int8)v58[n0xFF_1]); /*0x37b1*/ - ++n0xFF_1; /*0x37b6*/ - } - while ( n0xFF_1 < n0xFF ); /*0x37be*/ - v8 = a4; /*0x37c0*/ - } - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x37d3*/ - sub_740(0x80000000LL, "\n"); /*0x37e6*/ - v20 = (_BYTE *)sub_1D2C((unsigned __int8)(n0xFF + 5)); /*0x37f7*/ - n0xFF_2 = n0xFF; /*0x37fa*/ - *v20 = 11; /*0x3806*/ - v20[1] = v8; /*0x3809*/ - v20[3] = -126; /*0x380d*/ - if ( n0xFF > 0xFFu ) /*0x381a*/ - n0xFF_2 = -1; /*0x381a*/ - v20[4] = n0xFF_2; /*0x381d*/ - (*(void (__fastcall **)(_BYTE *, _BYTE *, _QWORD))(qword_96D8 + 352))(v20 + 5, v58, n0xFF); /*0x382b*/ - LOBYTE(v22) = 87; /*0x3837*/ - byte_9699 = 1; /*0x383a*/ - LOBYTE(v23) = 46; /*0x384a*/ - LOBYTE(v44) = n0xFF + 5; /*0x3864*/ - (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, _BYTE *, int, void *, char *))(qword_9690 + 16))( /*0x3870*/ - qword_9690, - v23, - 0, - v22, - v20, - v44, - &unk_9720, - &byte_9699); - (*(void (__fastcall **)(_BYTE *))(qword_96D8 + 72))(v20); /*0x387d*/ - n0xFF_1 = 0; /*0x3880*/ - } - (*(void (__fastcall **)(_BYTE *, __int64, _QWORD))(qword_96D8 + 360))(v58, 0x10000, 0); /*0x3895*/ - LOBYTE(v24) = -112; /*0x38a0*/ - i_1 = sub_2EA4(v50, v24, v58, v45); /*0x38ab*/ - if ( i_1 >= 0 ) - { - v25 = sub_7F8(); /*0x38b9*/ - n0xFF_3 = v45[0]; /*0x38be*/ - if ( v25 && (unsigned __int8)sub_804(2) ) - sub_740(2, "CheckVpdAndUpdateToBmc: RDBG VPD type 0x90/0x91 , Data Length = %x\n", n0xFF_3); - if ( n0xFF_3 ) /*0x38f3*/ - { - do /*0x392d*/ - { - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3905*/ - sub_740(0x80000000LL, "%x ", (unsigned __int8)v58[n0xFF_1]); /*0x3921*/ - ++n0xFF_1; /*0x3926*/ - } - while ( n0xFF_1 < n0xFF_3 ); /*0x392d*/ - v8 = a4; /*0x392f*/ - } - i_1 = sub_7F8(); /*0x3936*/ - if ( (_BYTE)i_1 ) /*0x393f*/ - { - i_1 = sub_804(0x80000000LL); /*0x3944*/ - if ( (_BYTE)i_1 ) /*0x394b*/ - i_1 = sub_740(0x80000000LL, "\n"); /*0x3957*/ - } - i_7 = 0; /*0x3960*/ - i_2 = n0xFF_3 - 1; /*0x3963*/ - i_6 = i_2; /*0x396b*/ - if ( i_2 > 0 ) - { - while ( v58[i_7] != 80 || v58[i_7 + 1] != 78 ) /*0x3988*/ - { - i_1 = ++i_7; /*0x398d*/ - if ( i_7 >= i_2 ) /*0x3993*/ - goto LABEL_74; /*0x3993*/ - } - i_8 = i_7; /*0x399b*/ - v30 = v58[i_7 + 2] + 5; /*0x39a6*/ - v31 = (unsigned int)i_7 + 2; /*0x39aa*/ - v32 = sub_1D2C(v30); /*0x39b5*/ - *(_BYTE *)v32 = 11; /*0x39bb*/ - *(_BYTE *)(v32 + 1) = a4; /*0x39c4*/ - *(_WORD *)(v32 + 2) = 20048; /*0x39cc*/ - *(_BYTE *)(v32 + 4) = v58[v31]; /*0x39da*/ - (*(void (__fastcall **)(__int64, _BYTE *, _QWORD))(qword_96D8 + 352))( /*0x39ef*/ - v32 + 5, - &v58[i_8 + 3], - (unsigned __int8)v58[v31]); - v33 = 0; /*0x39fb*/ - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(2) ) - sub_740(2, "CheckVpdAndUpdateToBmc: RDBG VPD PN Size = %x, IpmiVpdData= %a , \n", v30, v4); - if ( v30 ) /*0x3a2d*/ - { - do /*0x3a66*/ - { - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3a3f*/ - sub_740(0x80000000LL, "%x ", *(unsigned __int8 *)(v33 + v32)); /*0x3a5a*/ - ++v33; /*0x3a5f*/ - } - while ( v33 < v30 ); /*0x3a66*/ - i_2 = i_6; /*0x3a68*/ - } - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3a7b*/ - sub_740(0x80000000LL, "\n"); /*0x3a8e*/ - LOBYTE(v35) = 87; /*0x3a98*/ - byte_9699 = 1; /*0x3a9b*/ - LOBYTE(v34) = 46; /*0x3aab*/ - LOBYTE(v44) = v30; /*0x3ac5*/ - (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, __int64, int, void *, char *))(qword_9690 + 16))( /*0x3ad2*/ - qword_9690, - v34, - 0, - v35, - v32, - v44, - &unk_9720, - &byte_9699); - i_1 = (*(__int64 (__fastcall **)(__int64))(qword_96D8 + 72))(v32); /*0x3adf*/ - v8 = a4; /*0x3ae2*/ - } -LABEL_74: - for ( i = 0; i < i_2; i_1 = ++i ) /*0x3af4*/ - { - i_1 = i; /*0x3af6*/ - if ( v58[i] == 83 && v58[i + 1] == 78 ) /*0x3b05*/ - break; /*0x3b05*/ - } - i_3 = i; /*0x3b12*/ - if ( i != i_2 ) - { - v38 = v58[i + 2] + 5; /*0x3b28*/ - v39 = (unsigned int)i + 2; /*0x3b2c*/ - v40 = sub_1D2C(v38); /*0x3b3c*/ - *(_BYTE *)v40 = 11; /*0x3b43*/ - *(_BYTE *)(v40 + 1) = v8; /*0x3b46*/ - *(_WORD *)(v40 + 2) = 20051; /*0x3b4a*/ - *(_BYTE *)(v40 + 4) = v58[v39]; /*0x3b54*/ - (*(void (__fastcall **)(__int64, _BYTE *, _QWORD))(qword_96D8 + 352))( /*0x3b6f*/ - v40 + 5, - &v58[i_3 + 3], - (unsigned __int8)v58[v39]); - v41 = 0; /*0x3b7b*/ - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(2) ) - sub_740(2, "CheckVpdAndUpdateToBmc: RDBG VPD SN Size = %x, IpmiVpdData= %a , \n", v38, v4); - if ( v38 ) /*0x3bb1*/ - { - do /*0x3bee*/ - { - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3bc6*/ - sub_740(0x80000000LL, "%x ", *(unsigned __int8 *)(v41 + v40)); /*0x3be1*/ - ++v41; /*0x3be6*/ - } - while ( v41 < v38 ); /*0x3bee*/ - v8 = a4; /*0x3bf5*/ - } - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x3c0a*/ - sub_740(0x80000000LL, "\n"); /*0x3c1d*/ - LOBYTE(v43) = 87; /*0x3c27*/ - byte_9699 = 1; /*0x3c2a*/ - LOBYTE(v42) = 46; /*0x3c3a*/ - LOBYTE(v44) = v38; /*0x3c54*/ - (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, __int64, int, void *, char *))(qword_9690 + 16))( /*0x3c61*/ - qword_9690, - v42, - 0, - v43, - v40, - v44, - &unk_9720, - &byte_9699); - i_1 = (*(__int64 (__fastcall **)(__int64))(qword_96D8 + 72))(v40); /*0x3c6e*/ - } - v7 = a1; /*0x3c71*/ - } - } - } - else - { - i_1 = sub_7F8(); /*0x36d1*/ - if ( (_BYTE)i_1 ) - { - i_1 = sub_804(0x80000000LL); /*0x36e1*/ - if ( (_BYTE)i_1 ) - i_1 = sub_740(0x80000000LL, "CheckVpdAndUpdateToBmc: error reading Pci Locattion = %r\n", i_5); - } - } - } - else - { - i_1 = sub_7F8(); /*0x3670*/ - if ( (_BYTE)i_1 ) - { - i_1 = sub_804(0x80000000LL); /*0x367c*/ - if ( (_BYTE)i_1 ) - i_1 = sub_740(0x80000000LL, "CheckVpdAndUpdateToBmc: error reading Pci Config space. Code=%r\n", v14); - } - } - } - else - { - i_1 = sub_7F8(); /*0x35ed*/ - if ( (_BYTE)i_1 ) - { - i_1 = sub_804(0x80000000LL); /*0x35f9*/ - if ( (_BYTE)i_1 ) - i_1 = sub_740( - 0x80000000LL, - "CheckVpdAndUpdateToBmc: Error openning handle index %d. Code=%r\n", - v9, - v13); - } - } - v5 = a3; /*0x3619*/ - ++v9; /*0x3620*/ - v6 = a2; /*0x3623*/ - } - while ( v9 < v49 ); - } - } - else - { - i_1 = sub_7F8(); /*0x3562*/ - if ( (_BYTE)i_1 ) - { - i_1 = sub_804(0x80000000LL); /*0x3576*/ - if ( (_BYTE)i_1 ) - return sub_740(0x80000000LL, "CheckVpdAndUpdateToBmc: unable to find any PCI devices. Code=%r\n", i_4); - } - } - } - else - { - i_1 = sub_7F8(); /*0x34fa*/ - if ( (_BYTE)i_1 ) /*0x3501*/ - { - i_1 = sub_804(64); /*0x350d*/ - if ( (_BYTE)i_1 ) /*0x3514*/ - return sub_740(64, "CheckVpdAndUpdateToBmc Locating IPMI Dxe Protocol Status - %r\n", v10); /*0x3526*/ - } - } - return i_1; /*0x3635*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3C80.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3C80.c deleted file mode 100644 index a57c273..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3C80.c +++ /dev/null @@ -1,96 +0,0 @@ -__int64 __fastcall sub_3C80(__int64 a1, __int64 a2, __int64 a3, __int64 a4) -{ - __int64 v4; // rax - __int64 v5; // rcx - __int64 v6; // rdi - __int64 v7; // r8 - __int64 result; // rax - __int64 v9; // rdx - __int64 v10; // rcx - __int64 v11; // rdi - __int64 v12; // r8 - __int64 v13; // r9 - __int64 v14; // rdi - __int64 v15; // rdx - __int64 v16; // rcx - __int64 v17; // r8 - __int64 v18; // r9 - __int64 v19; // rdx - __int64 v20; // rcx - __int64 v21; // r8 - __int64 v22; // r9 - int v23; // [rsp+28h] [rbp-30h] - _DWORD v24[6]; // [rsp+40h] [rbp-18h] BYREF - unsigned __int8 v25; // [rsp+70h] [rbp+18h] BYREF - char v26; // [rsp+78h] [rbp+20h] BYREF - - LOBYTE(v24[0]) = 0; /*0x3c8c*/ - v25 = 0; /*0x3c90*/ - v26 = 1; /*0x3c94*/ - v4 = qword_9690; /*0x3c98*/ - if ( !qword_9690 ) /*0x3ca2*/ - { - v6 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x3cc1*/ - if ( v6 < 0 ) /*0x3cc7*/ - { - result = sub_7F8(v5, a2, v7, a4); /*0x3cc9*/ - if ( (_BYTE)result ) /*0x3cd0*/ - { - result = sub_804(64); /*0x3cdd*/ - if ( (_BYTE)result ) /*0x3ce4*/ - return sub_740(64, "[System Inventory] Locate gIpmiTransport Protocol fail. Status - %r\n", v6); /*0x3cf7*/ - } - return result; /*0x3cf7*/ - } - v4 = qword_9690; /*0x3d01*/ - } - LOBYTE(a4) = -85; /*0x3d0d*/ - LOBYTE(a2) = 50; /*0x3d1d*/ - v11 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, _QWORD, _BYTE, unsigned __int8 *, char *, _DWORD))(v4 + 16))( /*0x3d35*/ - v4, - a2, - 0, - a4, - 0, - 0, - &v25, - &v26, - v24[0]); - if ( v11 < 0 || v25 == 1 ) /*0x3d42*/ - { - if ( (unsigned __int8)sub_7F8(v10, v9, v12, v13) && (unsigned __int8)sub_804(64) ) /*0x3dcb*/ - sub_740(64, "[System Inventory] send gIpmiTransport Protocol Status - %r\n", v11); /*0x3de0*/ - result = sub_7F8(v20, v19, v21, v22); /*0x3de5*/ - if ( (_BYTE)result ) /*0x3dec*/ - { - result = sub_804(64); /*0x3df1*/ - if ( (_BYTE)result ) /*0x3df8*/ - return sub_740(64, "[System Inventory] Check Current BMC virtual USB status - %x\n", v25); /*0x3e0a*/ - } - } - else - { - LOBYTE(v24[0]) = 1; /*0x3d49*/ - LOBYTE(v13) = -86; /*0x3d53*/ - LOBYTE(v9) = 50; /*0x3d63*/ - LOBYTE(v23) = 1; /*0x3d6a*/ - v14 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, _DWORD *, int, unsigned __int8 *, char *))(qword_9690 + 16))( /*0x3d8d*/ - qword_9690, - v9, - 0, - v13, - v24, - v23, - &v25, - &v26); - (*(void (__fastcall **)(__int64))(qword_96A8 + 248))(3000000); /*0x3d90*/ - result = sub_7F8(v16, v15, v17, v18); /*0x3d96*/ - if ( (_BYTE)result ) /*0x3d9d*/ - { - result = sub_804(64); /*0x3da6*/ - if ( (_BYTE)result ) /*0x3dad*/ - return sub_740(64, "[System Inventory] Disabling BMC USB Interface Status - %r\n", v14); /*0x3db6*/ - } - } - return result; /*0x3e14*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3E1C.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3E1C.c deleted file mode 100644 index a3cba8a..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3E1C.c +++ /dev/null @@ -1,53 +0,0 @@ -__int64 __fastcall sub_3E1C() -{ - __int64 v0; // rbx - __int64 v1; // rdx - __int64 v2; // rcx - __int64 v3; // r8 - __int64 v4; // r9 - __int64 result; // rax - __int64 v6; // rdx - __int64 v7; // r9 - __int64 v8; // rdx - __int64 v9; // rcx - __int64 v10; // r8 - __int64 v11; // r9 - char n2; // [rsp+28h] [rbp-30h] - __int16 v13[12]; // [rsp+40h] [rbp-18h] BYREF - char v14; // [rsp+70h] [rbp+18h] BYREF - char v15; // [rsp+78h] [rbp+20h] BYREF - - v0 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x3e43*/ - result = sub_7F8(v2, v1, v3, v4); /*0x3e46*/ - if ( (_BYTE)result ) /*0x3e52*/ - { - result = sub_804(64); /*0x3e56*/ - if ( (_BYTE)result ) /*0x3e5d*/ - result = sub_740(64, "[System Inventory] Locating IPMI Dxe Protocol Status - %r\n", v0); /*0x3e6b*/ - } - if ( v0 >= 0 ) /*0x3e73*/ - { - v13[0] = 4; /*0x3e7a*/ - LOBYTE(v7) = -53; /*0x3e86*/ - v14 = 1; /*0x3e8e*/ - n2 = 2; /*0x3ea0*/ - LOBYTE(v6) = 50; /*0x3eaa*/ - (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, __int16 *, char, char *, char *))(qword_9690 + 16))( /*0x3eb6*/ - qword_9690, - v6, - 0, - v7, - v13, - n2, - &v15, - &v14); - result = sub_7F8(v9, v8, v10, v11); /*0x3eb9*/ - if ( (_BYTE)result ) /*0x3ec0*/ - { - result = sub_804(64); /*0x3ec5*/ - if ( (_BYTE)result ) /*0x3ecc*/ - return sub_740(64, "Set the BMC virtual CD number to 0. \n"); /*0x3ed8*/ - } - } - return result; /*0x3ee2*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3F00.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3F00.c deleted file mode 100644 index 41f9b76..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3F00.c +++ /dev/null @@ -1,46 +0,0 @@ -unsigned __int8 sub_3F00() -{ - __int64 v0; // rbx - __int64 v1; // rdx - __int64 v2; // rcx - __int64 v3; // r8 - __int64 v4; // r9 - __int64 v5; // rdx - __int64 v6; // r9 - unsigned __int8 result; // al - __int64 v8; // rbx - __int64 v9; // rdx - __int64 v10; // rcx - __int64 v11; // r8 - __int64 v12; // r9 - char v13; // [rsp+28h] [rbp-30h] - unsigned __int8 v14; // [rsp+60h] [rbp+8h] BYREF - char v15; // [rsp+68h] [rbp+10h] BYREF - char n4; // [rsp+70h] [rbp+18h] BYREF - - v0 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x3f25*/ - if ( (unsigned __int8)sub_7F8(v2, v1, v3, v4) && (unsigned __int8)sub_804(64) ) /*0x3f3a*/ - sub_740(64, "[System Inventory] Locating IPMI Dxe Protocol Status - %r\n", v0); /*0x3f4f*/ - if ( v0 < 0 ) /*0x3f57*/ - return 0; /*0x3f59*/ - n4 = 4; /*0x3f62*/ - LOBYTE(v6) = -54; /*0x3f6c*/ - v15 = 1; /*0x3f74*/ - v13 = 1; /*0x3f86*/ - LOBYTE(v5) = 50; /*0x3f90*/ - v8 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, char *, char, unsigned __int8 *, char *))(qword_9690 + 16))( /*0x3f9f*/ - qword_9690, - v5, - 0, - v6, - &n4, - v13, - &v14, - &v15); - if ( (unsigned __int8)sub_7F8(v10, v9, v11, v12) && (unsigned __int8)sub_804(64) ) /*0x3fae*/ - sub_740(64, "Get the BMC virtual CD Device Number Status = %r, Number = %x \n", v8, v14); /*0x3fca*/ - result = v14; /*0x3fcf*/ - if ( v8 < 0 ) /*0x3fd7*/ - return 0; /*0x3fd7*/ - return result; /*0x3fda*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3FE4.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3FE4.c deleted file mode 100644 index 1f49ccb..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_3FE4.c +++ /dev/null @@ -1,260 +0,0 @@ -__int64 sub_3FE4() -{ - unsigned __int8 v0; // r13 - __int64 result; // rax - unsigned __int64 i_1; // rsi - __int64 v3; // rbx - __int64 j_1; // rbx - __int64 v5; // rdi - __int64 v6; // rdi - __int64 j; // rcx - char n17; // al - __int64 v9; // rbx - _WORD *v10; // r15 - __int64 v11; // rbx - unsigned __int8 v12; // cl - __int64 v13; // rdx - __int64 v14; // rbx - int v15; // r12d - int v16; // edi - __int64 v17; // rsi - unsigned __int16 *v18; // rdi - __int64 n16; // rbx - __int64 n3; // r14 - __int64 v21; // rax - __int64 v22; // rax - int v23; // eax - __int64 v24; // rbx - char v25; // cl - unsigned __int64 n0x40; // rax - _WORD *v27; // rdx - __int64 v28; // rcx - __int64 v29; // [rsp+30h] [rbp-59h] BYREF - _BYTE v30[8]; // [rsp+38h] [rbp-51h] BYREF - __int64 v31; // [rsp+40h] [rbp-49h] BYREF - __int64 v32; // [rsp+48h] [rbp-41h] BYREF - __int64 v33; // [rsp+50h] [rbp-39h] BYREF - __int64 v34; // [rsp+58h] [rbp-31h] BYREF - __int64 v35; // [rsp+60h] [rbp-29h] BYREF - __int64 j_3; // [rsp+68h] [rbp-21h] BYREF - __int64 j_2; // [rsp+70h] [rbp-19h] - unsigned __int64 i; // [rsp+78h] [rbp-11h] - unsigned __int64 i_2; // [rsp+80h] [rbp-9h] BYREF - __int64 v40; // [rsp+88h] [rbp-1h] BYREF - _BYTE v41[8]; // [rsp+90h] [rbp+7h] BYREF - _BYTE v42[72]; // [rsp+98h] [rbp+Fh] BYREF - unsigned __int16 v43; // [rsp+F0h] [rbp+67h] BYREF - unsigned int v44; // [rsp+F8h] [rbp+6Fh] - int v45; // [rsp+100h] [rbp+77h] BYREF - int n512; // [rsp+108h] [rbp+7Fh] BYREF - - v44 = 0; /*0x401e*/ - v31 = 0; /*0x4026*/ - v0 = 0; /*0x402a*/ - v43 = 0; /*0x402d*/ - result = (*(__int64 (__fastcall **)(__int64, void *, _QWORD, unsigned __int64 *, __int64 *))(qword_96A8 + 312))( /*0x4032*/ - 2, - &unk_93E0, - 0, - &i_2, - &v35); - if ( result >= 0 ) /*0x403b*/ - { - result = (*(__int64 (__fastcall **)(void *, _QWORD, _BYTE *))(qword_96A8 + 320))(&unk_9410, 0, v41); /*0x4055*/ - if ( result >= 0 ) /*0x405e*/ - { - i_1 = 0; /*0x4064*/ - for ( i = 0; i_1 < i_2; i = i_1 ) /*0x406f*/ - { - v3 = (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *))(qword_96A8 + 152))( /*0x409f*/ - *(_QWORD *)(v35 + 8 * i_1), - &unk_9470, - &j_3); - if ( (unsigned __int8)sub_7EC() && v3 < 0 ) /*0x40ae*/ - { - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x40bc*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v3); /*0x40d2*/ - sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1393, "!EFI_ERROR (Status)"); /*0x40ea*/ - } - j_1 = j_3; /*0x40fa*/ - if ( (*(__int64 (__fastcall **)(void *, __int64 *, __int64 *))(qword_96A8 + 184))(&unk_9400, &j_3, &v40) >= 0 ) /*0x4112*/ - { - v5 = (*(__int64 (__fastcall **)(__int64, void *, __int64 *))(qword_96A8 + 152))(v40, &unk_9400, &v31); /*0x4134*/ - if ( (unsigned __int8)sub_7EC() && v5 < 0 ) /*0x4143*/ - { - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4151*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0x4167*/ - sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1404, "!EFI_ERROR (Status)"); /*0x417f*/ - } - v6 = (*(__int64 (__fastcall **)(__int64, _BYTE *, __int64 *, __int64 *, __int64 *))(v31 + 112))( /*0x41a3*/ - v31, - v42, - &v29, - &v34, - &v33); - if ( (unsigned __int8)sub_7EC() && v6 < 0 ) /*0x41b2*/ - { - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x41c0*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v6); /*0x41d6*/ - sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1407, "!EFI_ERROR (Status)"); /*0x41ee*/ - } - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x41ff*/ - sub_740(0x80000000LL, "Bus = %x, Dev = %x, Func = %x\n", v29, v34, v33); /*0x4223*/ - (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, unsigned __int16 *))(v31 + 48))(v31, 1, 0, 1, &v43); /*0x4241*/ - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4250*/ - sub_740(0x80000000LL, "VendorID = %x\n", v43); /*0x4268*/ - for ( j = j_1; !(unsigned __int8)sub_1EF0(j); j = j_1 ) /*0x426d*/ - { - if ( (unsigned __int8)sub_1DB8(j_1) == 1 && (unsigned __int8)sub_1DF0(j_1) == 1 ) /*0x4291*/ - { - j_2 = j_1; /*0x42a3*/ - goto LABEL_36; /*0x42a7*/ - } - j_1 = sub_1E6C(j_1); /*0x429b*/ - } - j_1 = j_2; /*0x42a9*/ -LABEL_36: - if ( j_1 ) /*0x42b0*/ - { - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x42c2*/ - sub_740( /*0x42df*/ - 0x80000000LL, - "PciDevicePath->Device = %x, PciDevicePath->Function = %x.\n", - *(unsigned __int8 *)(j_1 + 5), - *(unsigned __int8 *)(j_1 + 4)); - if ( (n17 = *(_BYTE *)(j_1 + 5), n17 == 17) && *(_BYTE *)(j_1 + 4) == 5 || n17 == 23 && !*(_BYTE *)(j_1 + 4) ) /*0x42f9*/ - { - v9 = (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *))(qword_96D8 + 152))( /*0x4323*/ - *(_QWORD *)(v35 + 8 * i_1), - &unk_93E0, - &v32); - if ( (unsigned __int8)sub_7EC() && v9 < 0 ) /*0x4332*/ - { - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4340*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0x4356*/ - sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1437, "!EFI_ERROR (Status)"); /*0x436e*/ - } - if ( (*(__int64 (__fastcall **)(__int64, int *, _BYTE *))(v32 + 40))(v32, &v45, v30) >= 0 ) /*0x4388*/ - { - n512 = 512; /*0x4395*/ - v10 = (_WORD *)sub_1D2C(512); /*0x43ab*/ - v11 = (*(__int64 (__fastcall **)(__int64, _WORD *, int *))(v32 + 24))(v32, v10, &n512); /*0x43b2*/ - if ( (unsigned __int8)sub_7EC() && v11 < 0 ) /*0x43c1*/ - { - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x43cf*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v11); /*0x43e5*/ - sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1456, "!EFI_ERROR (Status)"); /*0x43fd*/ - } - (*(void (__fastcall **)(__int64, int *, _BYTE *))(v32 + 40))(v32, &v45, v30); /*0x4411*/ - v12 = 0; /*0x4423*/ - while ( 1 ) /*0x4429*/ - { - v13 = 3LL * v12; /*0x4429*/ - if ( v29 == byte_94C0[6 * v12] /*0x4453*/ - && v34 == byte_94C0[6 * v12 + 1] - && v33 == byte_94C0[6 * v12 + 2] - && v45 == byte_94C0[6 * v12 + 3] ) - { - break; /*0x4453*/ - } - if ( ++v12 >= 0xEu ) /*0x445a*/ - goto LABEL_65; /*0x445a*/ - } - v44 = byte_94C0[6 * v12 + 4]; /*0x446a*/ -LABEL_65: - if ( (__int16)*v10 >= 0 ) /*0x4471*/ - { - v14 = (unsigned int)sub_2518(((v33 & 7 | (8 * (v34 & 0x1F | (32LL * (unsigned __int8)v29)))) << 12) | 0x24); /*0x44b2*/ - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x44c0*/ - sub_740( /*0x44e8*/ - 0x80000000LL, - "RDBG Inventory Bus %x, Dev %x, Func %x , SidpbaorAhciBaseAddr = %x\n", - v29, - v34, - v33, - v14); - v15 = (*(_DWORD *)((unsigned int)((v45 + 2) << 7) + v14 + 40) >> 4) & 0xF; /*0x4504*/ - if ( (v10[83] & 0x400) != 0 ) /*0x4510*/ - { - v17 = (unsigned __int16)v10[100]; /*0x454d*/ - v18 = v10 + 101; /*0x4555*/ - n16 = 16; /*0x455c*/ - n3 = 3; /*0x4561*/ - do /*0x457f*/ - { - v17 |= sub_BD4(*v18++, n16); /*0x4570*/ - n16 += 16; /*0x4577*/ - --n3; /*0x457b*/ - } - while ( n3 ); /*0x457f*/ - v21 = sub_C28(v17, 1000, 0); /*0x458e*/ - v22 = sub_C20(v21, 512); /*0x459b*/ - v23 = sub_C28(v22, 1000, 0); /*0x45a8*/ - i_1 = i; /*0x45ad*/ - v16 = v23; /*0x45b1*/ - } - else - { - v16 = ((((unsigned __int16)v10[60] + ((unsigned __int16)v10[61] << 16)) / 1000) << 9) / 1000; /*0x4548*/ - } - v24 = 75LL * v0; /*0x45bc*/ - if ( v10[217] == 1 ) /*0x45cf*/ - { - *(_BYTE *)(v24 + qword_9680 + 2421) = 1; /*0x45d1*/ - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(64) ) /*0x45e6*/ - sub_740( /*0x45f6*/ - 64, - "[System Inventory] Hard Disk %d is found in slot %d is of type SSD\n", - (unsigned int)v0 + 1, - v44); - } - else - { - *(_BYTE *)(v24 + qword_9680 + 2421) = 0; /*0x45f8*/ - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(64) ) /*0x460e*/ - sub_740( /*0x462e*/ - 64, - "[System Inventory] Hard Disk %d is found in slot %d is of type HDD\n", - (unsigned int)v0 + 1, - v44); - } - v25 = v44; /*0x463a*/ - *(_BYTE *)(v24 + qword_9680 + 2352) = v0; /*0x463d*/ - *(_DWORD *)(v24 + qword_9680 + 2417) = v16; /*0x464c*/ - *(_BYTE *)(v24 + qword_9680 + 2422) = 3; /*0x465e*/ - *(_BYTE *)(v24 + qword_9680 + 2424) = v15; /*0x466d*/ - *(_BYTE *)(v24 + qword_9680 + 2425) = v25; /*0x467c*/ - n0x40 = sub_9F0(v10 + 27); /*0x4686*/ - v27 = v10 + 27; /*0x4692*/ - v28 = v24 + qword_9680 + 2353; /*0x469c*/ - if ( n0x40 <= 0x40 ) /*0x46a3*/ - sub_814(v28, v27); /*0x46b2*/ - else - sub_8D8(v28, v27, 62); /*0x46ab*/ - sub_2720(v24 + qword_9680 + 2353, 64); /*0x46cf*/ - sub_275C(v24 + qword_9680 + 2353, 64); /*0x46e7*/ - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(64) ) /*0x46f7*/ - sub_740(64, "[System Inventory] Drive Size = %d MB\n", *(_DWORD *)(v24 + qword_9680 + 2417)); /*0x4718*/ - if ( (unsigned __int8)sub_7F8() && (unsigned __int8)sub_804(64) ) /*0x4729*/ - sub_740(64, "[System Inventory] Link Speed = %d\n", *(unsigned __int8 *)(v24 + qword_9680 + 2424)); /*0x474c*/ - (*(void (__fastcall **)(_WORD *))(qword_96A8 + 72))(v10); /*0x475b*/ - ++v0; /*0x476a*/ - } - else - { - (*(void (__fastcall **)(_WORD *, __int64, __int64, __int64))(qword_96A8 + 72))(v10, v13, v33, v34); /*0x447d*/ - } - } - } - } - } - ++i_1; /*0x476d*/ - } - result = qword_9680; /*0x477e*/ - *(_BYTE *)(qword_9680 + 2351) = v0; /*0x4785*/ - if ( v35 ) /*0x4793*/ - return (*(__int64 (**)(void))(qword_96A8 + 72))(); /*0x479c*/ - } - } - return result; /*0x479f*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_4854.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_4854.c deleted file mode 100644 index 3c73a96..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_4854.c +++ /dev/null @@ -1,127 +0,0 @@ -__int64 __fastcall sub_4854(__int64 a1, __int64 a2, __int64 a3, __int64 a4) -{ - double v4; // xmm3_8 - __int64 v5; // rdx - __int64 v6; // rcx - __int64 v7; // rbx - __int64 v8; // r8 - __int64 v9; // r9 - __int64 result; // rax - unsigned __int8 v11; // si - __int64 v12; // rdi - unsigned __int8 n2; // bp - __int64 v14; // rdx - __int64 v15; // rcx - __int64 v16; // r8 - __int64 v17; // r9 - __int64 v18; // rbx - unsigned __int8 v19; // dl - __int64 v20; // rdx - __int64 v21; // rcx - __int64 v22; // r8 - __int64 v23; // r9 - __int64 v24; // rdx - __int64 v25; // rcx - __int64 v26; // r8 - __int64 v27; // r9 - __int64 v28; // rdx - __int64 v29; // rcx - __int64 v30; // r8 - __int64 v31; // r9 - __int64 v32; // rdx - __int64 v33; // rcx - __int64 v34; // r8 - __int64 v35; // r9 - __int64 v36; // rdx - __int64 v37; // rcx - __int64 v38; // r8 - __int64 v39; // r9 - __int64 v40; // rdx - __int64 v41; // rcx - __int64 v42; // r8 - __int64 v43; // r9 - _QWORD v44[9]; // [rsp+30h] [rbp-48h] BYREF - char v45; // [rsp+80h] [rbp+8h] BYREF - int v46; // [rsp+88h] [rbp+10h] BYREF - int v47; // [rsp+90h] [rbp+18h] BYREF - char v48; // [rsp+98h] [rbp+20h] BYREF - - if ( (unsigned __int8)sub_7F8(a1, a2, a3, a4) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4873*/ - sub_740(0x80000000LL, "Enter InitializeCpuData ... \n"); /*0x4886*/ - *(_BYTE *)(qword_9680 + 86LL) = 2; /*0x4892*/ - if ( qword_9670 /*0x48c3*/ - || (v7 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96D8 + 320))(&unk_93F0, 0, &qword_9670), - v7 >= 0) ) - { - v11 = 0; /*0x48f9*/ - v12 = 0; /*0x4903*/ - do /*0x4bec*/ - { - n2 = v11 + 1; /*0x490c*/ - LOBYTE(v5) = v11 + 1; /*0x4917*/ - LOBYTE(v6) = 4; /*0x491f*/ - *(_BYTE *)(v12 + qword_9680 + 87) = v11 + 1; /*0x4921*/ - if ( (*(__int64 (__fastcall **)(__int64, __int64, _QWORD *, char *))(qword_9670 + 64))(v6, v5, v44, &v45) >= 0 ) /*0x4933*/ - { - v18 = v44[0]; /*0x4939*/ - *(_BYTE *)(v12 + qword_9680 + 88) = *(_BYTE *)(v44[0] + 35LL); /*0x4954*/ - *(_BYTE *)(v12 + qword_9680 + 89) = *(_BYTE *)(v18 + 37); /*0x4962*/ - sub_D38(v12 + qword_9680 + 90LL, 13, "Intel"); /*0x4974*/ - *(_DWORD *)(v12 + qword_9680 + 166) = *(unsigned __int16 *)(v18 + 20); /*0x49a2*/ - sub_27F8(*(_DWORD *)(v18 + 8), (unsigned int)&v48, (unsigned int)&v46, (unsigned int)&v47, 0); /*0x49ac*/ - v19 = 0; /*0x49b6*/ - while ( *((_WORD *)&unk_9518 + 5 * v19) != *(unsigned __int8 *)(v18 + 6) /*0x49d0*/ - && *((_WORD *)&unk_9518 + 5 * v19) != 255 ) - { - if ( ++v19 >= 3u ) /*0x49d7*/ - goto LABEL_17; /*0x49d7*/ - } - sub_D38(v12 + qword_9680 + 103LL, 30, *(const char **)((char *)&unk_9518 + 10 * v19 + 2)); /*0x49fa*/ -LABEL_17: - sub_D38(v12 + qword_9680 + 133LL, 30, "%2Xh Model", v46); /*0x49ff*/ - sub_D38(v12 + qword_9680 + 163LL, 3, "%X", v47); /*0x4a4e*/ - } - if ( (unsigned __int8)sub_7F8(v15, v14, v16, v17) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4a5f*/ - sub_740( /*0x4a83*/ - 0x80000000LL, - "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.CoreCount = %x \n", - v11, - *(unsigned __int8 *)(v12 + qword_9680 + 88)); - if ( (unsigned __int8)sub_7F8(v21, v20, v22, v23) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4a94*/ - sub_740( /*0x4ab8*/ - 0x80000000LL, - "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.ThreadCount = %x \n", - v11, - *(unsigned __int8 *)(v12 + qword_9680 + 89)); - if ( (unsigned __int8)sub_7F8(v25, v24, v26, v27) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4ac9*/ - sub_740(0x80000000LL, "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.CpuVendor = %a \n", v11, v4); /*0x4aee*/ - if ( (unsigned __int8)sub_7F8(v29, v28, v30, v31) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4aff*/ - sub_740(0x80000000LL, "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.CpuFamilyName = %a \n", v11, v4); /*0x4b24*/ - if ( (unsigned __int8)sub_7F8(v33, v32, v34, v35) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4b35*/ - sub_740(0x80000000LL, "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.CpuModelIdName = %a \n", v11, v4); /*0x4b5d*/ - if ( (unsigned __int8)sub_7F8(v37, v36, v38, v39) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4b6e*/ - sub_740(0x80000000LL, "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.Stepping = %a \n", v11, v4); /*0x4b96*/ - if ( (unsigned __int8)sub_7F8(v41, v40, v42, v43) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4ba7*/ - sub_740( /*0x4bcd*/ - 0x80000000LL, - "gSystemInventoryProtocol->CpuInfo[%d].SingleCpuInfo.MaxFrequency = %x \n", - v11, - *(_DWORD *)(v12 + qword_9680 + 166)); - result = (*(__int64 (__fastcall **)(_QWORD))(qword_96D8 + 72))(v44[0]); /*0x4bde*/ - v12 += 85; /*0x4be1*/ - ++v11; /*0x4be5*/ - } - while ( n2 < 2u ); /*0x4bec*/ - } - else - { - result = sub_7F8(v6, v5, v8, v9); /*0x48c5*/ - if ( (_BYTE)result ) /*0x48cc*/ - { - result = sub_804(0x80000000LL); /*0x48d5*/ - if ( (_BYTE)result ) /*0x48dc*/ - return sub_740(0x80000000LL, "LocateProtocol gAmiSmbiosProtocolGuid Status = %r ... \n", v7); /*0x48ef*/ - } - } - return result; /*0x4bf2*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_4C00.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_4C00.c deleted file mode 100644 index 77f92ae..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_4C00.c +++ /dev/null @@ -1,201 +0,0 @@ -__int64 __fastcall sub_4C00(__int64 a1, __int64 a2, __int64 a3, double a4) -{ - __int64 result; // rax - unsigned __int8 v5; // r14 - __int64 i; // rbx - unsigned __int8 n0x18; // r12 - void *v8; // rdx - __int64 v9; // rcx - __int64 v10; // r8 - __int64 v11; // r9 - __int64 v12; // rsi - __int16 v13; // cx - unsigned __int8 v14; // di - __int64 v15; // rcx - __int64 v16; // rcx - const char *_1.2V; // r8 - __int64 v18; // rdx - __int64 v19; // rdx - __int64 v20; // rdx - unsigned __int8 n4; // di - __int64 i_1; // r15 - unsigned __int64 v23; // rax - char v24; // cl - __int64 v25; // rdx - __int64 v26; // rcx - __int64 v27; // r8 - __int64 v28; // r9 - __int64 v29; // rdx - __int64 v30; // rcx - __int64 v31; // r8 - __int64 v32; // r9 - __int64 v33; // rdx - __int64 v34; // rcx - __int64 v35; // r8 - __int64 v36; // r9 - __int64 v37; // rdx - __int64 v38; // rcx - __int64 v39; // r8 - __int64 v40; // r9 - __int64 v41; // rdx - __int64 v42; // rcx - __int64 v43; // r8 - __int64 v44; // r9 - __int64 v45; // rdx - __int64 v46; // rcx - __int64 v47; // r8 - __int64 v48; // r9 - __int64 v49; // rdx - __int64 v50; // rcx - __int64 v51; // r8 - __int64 v52; // r9 - __int64 v53; // rdx - __int64 v54; // rcx - __int64 v55; // r8 - __int64 v56; // r9 - __int64 v57; // rdx - __int64 v58; // rcx - __int64 v59; // r8 - __int64 v60; // r9 - char v61; // [rsp+60h] [rbp+40h] BYREF - __int64 v62; // [rsp+68h] [rbp+48h] BYREF - __int64 v63; // [rsp+70h] [rbp+50h] BYREF - - v63 = 0; /*0x4c12*/ - v62 = 0; /*0x4c17*/ - *(_BYTE *)(qword_9680 + 257) = 24; /*0x4c23*/ - if ( qword_9678 /*0x4c54*/ - || (result = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96D8 + 320))(&unk_93F0, 0, &qword_9678), - result >= 0) ) - { - v5 = 0; /*0x4c5a*/ - for ( i = 0; ; i += 84 ) /*0x4c63*/ - { - n0x18 = v5 + 1; /*0x4c6c*/ - LOBYTE(a2) = v5 + 1; /*0x4c74*/ - LOBYTE(a1) = 17; /*0x4c7b*/ - *(_BYTE *)(i + qword_9680 + 258) = v5 + 1; /*0x4c7d*/ - if ( (*(__int64 (__fastcall **)(__int64, __int64, __int64 *, char *))(qword_9678 + 64))(a1, a2, &v63, &v61) >= 0 ) /*0x4c92*/ - break; /*0x4c92*/ -LABEL_33: - if ( (unsigned __int8)sub_7F8(v9, v8, v10, v11) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4eb6*/ - sub_740( /*0x4edd*/ - 0x80000000LL, - "gSystemInventoryProtocol->DimmInfo[%d].DimmSlotIndex = %x \n", - v5, - *(unsigned __int8 *)(i + qword_9680 + 258)); - if ( (unsigned __int8)sub_7F8(v26, v25, v27, v28) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4eee*/ - sub_740( /*0x4f15*/ - 0x80000000LL, - "gSystemInventoryProtocol->DimmInfo[%d].NodeNumber = %x \n", - v5, - *(unsigned __int8 *)(i + qword_9680 + 259)); - if ( (unsigned __int8)sub_7F8(v30, v29, v31, v32) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4f26*/ - sub_740( /*0x4f4d*/ - 0x80000000LL, - "gSystemInventoryProtocol->DimmInfo[%d].ChannelNumber = %x \n", - v5, - *(unsigned __int8 *)(i + qword_9680 + 260)); - if ( (unsigned __int8)sub_7F8(v34, v33, v35, v36) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4f5e*/ - sub_740(0x80000000LL, "gSystemInventoryProtocol->DimmInfo[%d].DimmType = %a \n", v5, a4); /*0x4f86*/ - if ( (unsigned __int8)sub_7F8(v38, v37, v39, v40) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4f97*/ - sub_740(0x80000000LL, "gSystemInventoryProtocol->DimmInfo[%d].DdrVoltage = %a \n", v5, a4); /*0x4fbf*/ - if ( (unsigned __int8)sub_7F8(v42, v41, v43, v44) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4fd0*/ - sub_740( /*0x4ff7*/ - 0x80000000LL, - "gSystemInventoryProtocol->DimmInfo[%d].DimmFreq = %d \n", - v5, - *(unsigned __int16 *)(i + qword_9680 + 281)); - if ( (unsigned __int8)sub_7F8(v46, v45, v47, v48) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x5008*/ - sub_740( /*0x502f*/ - 0x80000000LL, - "gSystemInventoryProtocol->DimmInfo[%d].DimmSize = %d \n", - v5, - *(unsigned __int16 *)(i + qword_9680 + 283)); - if ( (unsigned __int8)sub_7F8(v50, v49, v51, v52) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x5040*/ - sub_740(0x80000000LL, "gSystemInventoryProtocol->DimmInfo[%d].ManufacturerIdName = %a \n", v5, a4); /*0x5068*/ - if ( (unsigned __int8)sub_7F8(v54, v53, v55, v56) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x5079*/ - sub_740(0x80000000LL, "gSystemInventoryProtocol->DimmInfo[%d].SerialNumber = %a \n", v5, a4); /*0x50a1*/ - if ( (unsigned __int8)sub_7F8(v58, v57, v59, v60) ) /*0x50a6*/ - { - if ( (unsigned __int8)sub_804(0x80000000LL) ) /*0x50b2*/ - sub_740(0x80000000LL, "gSystemInventoryProtocol->DimmInfo[%d].PartNumber = %a \n", v5, a4); /*0x50da*/ - } - (*(void (__fastcall **)(__int64))(qword_96D8 + 72))(v63); /*0x50ea*/ - ++v5; /*0x50f1*/ - if ( n0x18 >= 0x18u ) /*0x50f8*/ - return 0; /*0x50fe*/ - } - v12 = v63; /*0x4ca2*/ - *(_BYTE *)(i + qword_9680 + 260) = (v5 >> 1) + 65; /*0x4cab*/ - if ( *(_WORD *)(v12 + 12) == 0x7FFF ) /*0x4cbb*/ - v13 = *(_WORD *)(v12 + 28); /*0x4cbd*/ - else - v13 = *(_WORD *)(v12 + 12); /*0x4cc3*/ - v14 = 0; /*0x4cce*/ - *(_WORD *)(i + qword_9680 + 283) = v13; /*0x4cd1*/ - v15 = *(unsigned __int16 *)(v12 + 21); /*0x4ce0*/ - *(_WORD *)(i + qword_9680 + 281) = v15; /*0x4ce4*/ - while ( 1 ) /*0x4cec*/ - { - if ( (unsigned __int8)sub_7F8(v15, v8, v10, v11) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x4cf8*/ - sub_740( /*0x4d24*/ - 0x80000000LL, - "gSmbiosDimmTypeNameMapping[j].Value = %x, Type17->MemoryType = %x\n", - *((unsigned __int16 *)&unk_9540 + 5 * v14), - *(unsigned __int8 *)(v12 + 18)); - v8 = &unk_9540; /*0x4d2d*/ - v15 = 5LL * v14; /*0x4d34*/ - if ( *((_WORD *)&unk_9540 + 5 * v14) == *(unsigned __int8 *)(v12 + 18) ) /*0x4d40*/ - break; /*0x4d40*/ - if ( ++v14 >= 0x1Eu ) /*0x4d49*/ - goto LABEL_16; /*0x4d49*/ - } - sub_D38(i + qword_9680 + 261, 10, *(_QWORD *)((char *)&unk_9540 + 10 * v14 + 2)); /*0x4d77*/ -LABEL_16: - switch ( *(_WORD *)(v12 + 38) ) /*0x4d89*/ - { - case 0x4B0: /*0x4d89*/ - _1.2V = "1.2V"; /*0x4dc8*/ - break; - case 0x4E2: /*0x4d89*/ - _1.2V = "1.25V"; /*0x4dbf*/ - break; - case 0x546: /*0x4d89*/ - _1.2V = "1.35V"; /*0x4db6*/ - break; - default: - v16 = qword_9680; /*0x4d9b*/ - if ( *(_WORD *)(v12 + 38) == 1500 ) /*0x4da2*/ - _1.2V = "1.5V"; /*0x4dad*/ - else - _1.2V = "N/A"; /*0x4da4*/ - goto LABEL_26; /*0x4dab*/ - } - v16 = qword_9680; /*0x4dcf*/ -LABEL_26: - sub_D38(i + v16 + 271, 10, _1.2V); /*0x4dd6*/ - LOBYTE(v18) = *(_BYTE *)(v12 + 23); /*0x4de5*/ - if ( !sub_27B8(v63, v18, &v62) ) /*0x4df0*/ - (*(void (__fastcall **)(__int64, __int64, __int64))(qword_96D8 + 352))(i + qword_9680 + 285, v62, 30); /*0x4e1a*/ - LOBYTE(v19) = *(_BYTE *)(v12 + 24); /*0x4e20*/ - if ( !sub_27B8(v63, v19, &v62) ) /*0x4e2b*/ - { - n4 = 0; /*0x4e35*/ - i_1 = i; /*0x4e38*/ - do /*0x4e67*/ - { - v23 = sub_AAC(v62); /*0x4e3f*/ - v24 = n4++; /*0x4e44*/ - *(_BYTE *)(i_1 + qword_9680 + 315) = v23 >> (8 * v24); /*0x4e58*/ - ++i_1; /*0x4e60*/ - } - while ( n4 < 4u ); /*0x4e67*/ - } - LOBYTE(v20) = *(_BYTE *)(v12 + 26); /*0x4e6f*/ - if ( !sub_27B8(v63, v20, &v62) ) /*0x4e7a*/ - (*(void (__fastcall **)(__int64, __int64, __int64))(qword_96D8 + 352))(i + qword_9680 + 319, v62, 21); /*0x4ea4*/ - goto LABEL_33; /*0x4ea4*/ - } - return result; /*0x5100*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5110.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5110.c deleted file mode 100644 index 07e6289..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5110.c +++ /dev/null @@ -1,244 +0,0 @@ -__int64 sub_5110() -{ - unsigned __int8 v0; // r13 - __int64 result; // rax - unsigned __int64 i; // r15 - __int64 v3; // rdx - __int64 v4; // rcx - __int64 v5; // r8 - __int64 v6; // r9 - __int64 v7; // rdi - unsigned __int8 v8; // r14 - __int64 v9; // rbx - unsigned __int8 v10; // bl - char v11; // r9 - __int64 v12; // rsi - __int64 v13; // rdx - __int64 v14; // rcx - __int64 v15; // rdx - __int64 v16; // rcx - __int64 v17; // rdx - __int64 v18; // rcx - __int64 v19; // rcx - __int64 v20; // rcx - __int64 v21; // rbx - unsigned __int16 v22; // ax - const char *[System_Inventory]_Pci_Device_is_found_in_Pcie_Slot_is_of_Riser; // rdx - __int64 v24; // [rsp+20h] [rbp-A9h] - __int64 v25; // [rsp+28h] [rbp-A1h] - _DWORD v26[2]; // [rsp+30h] [rbp-99h] - char v27; // [rsp+38h] [rbp-91h] - _DWORD v28[3]; // [rsp+40h] [rbp-89h] - __int16 v29; // [rsp+4Ch] [rbp-7Dh] - char v30; // [rsp+4Eh] [rbp-7Bh] - _DWORD v31[6]; // [rsp+50h] [rbp-79h] - __int16 v32; // [rsp+68h] [rbp-61h] - char v33; // [rsp+6Ah] [rbp-5Fh] - __int64 v34; // [rsp+70h] [rbp-59h] BYREF - __int64 v35; // [rsp+78h] [rbp-51h] BYREF - unsigned __int64 i_1; // [rsp+80h] [rbp-49h] BYREF - __int64 v37; // [rsp+88h] [rbp-41h] BYREF - _BYTE v38[144]; // [rsp+90h] [rbp-39h] BYREF - unsigned __int8 v39; // [rsp+130h] [rbp+67h] BYREF - __int128 v40; // [rsp+138h] [rbp+6Fh] BYREF - __int64 v41; // [rsp+148h] [rbp+7Fh] BYREF - - v29 = -1; /*0x5129*/ - v32 = -1; /*0x5133*/ - v28[0] = 536937216; /*0x5156*/ - v0 = 0; /*0x515e*/ - v28[1] = 54526211; /*0x5161*/ - v28[2] = 16998401; /*0x516e*/ - v30 = -1; /*0x5179*/ - v31[0] = 65792; /*0x517d*/ - v31[1] = 20972033; /*0x5184*/ - v31[2] = 33636353; /*0x518b*/ - v31[3] = 1610809664; /*0x5192*/ - v31[4] = 23068929; /*0x5199*/ - v31[5] = 50421762; /*0x51a0*/ - v33 = -1; /*0x51a7*/ - v26[0] = 536936736; /*0x51ab*/ - v26[1] = -65023; /*0x51b3*/ - v27 = -1; /*0x51bb*/ - v37 = 0; /*0x51c0*/ - result = (*(__int64 (__fastcall **)(__int64, void *, _QWORD, unsigned __int64 *, __int64 *))(qword_96A8 + 312))( /*0x51c4*/ - 2, - &unk_9400, - 0, - &i_1, - &v35); - if ( result >= 0 ) /*0x51cd*/ - { - for ( i = 0; i < i_1; ++i ) /*0x51da*/ - { - if ( (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *))(qword_96A8 + 152))( /*0x5203*/ - *(_QWORD *)(v35 + 8 * i), - &unk_9400, - &v34) >= 0 ) - { - (*(void (__fastcall **)(__int64, __int64, _QWORD))(v34 + 48))(v34, 2, 0); /*0x5226*/ - if ( (v38[30] & 0x7F) == 1 ) /*0x5230*/ - { - (*(void (__fastcall **)(__int64, _BYTE *, __int128 *, char *, __int64 *))(v34 + 112))( /*0x5252*/ - v34, - v38, - &v40, - (char *)&v40 + 8, - &v41); - if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(64) ) /*0x5261*/ - sub_740( /*0x5285*/ - 64, - "[System Inventory] Pci Device found in root bridge Bus = %x Dev = %x Fun = %x\n", - (_DWORD)v40, - DWORD2(v40), - v41); - LOBYTE(v5) = v41; /*0x528a*/ - LOBYTE(v6) = 16; /*0x528e*/ - LOBYTE(v3) = BYTE8(v40); /*0x5291*/ - LOBYTE(v4) = v40; /*0x5294*/ - v7 = sub_28CC(v4, v3, v5, v6); /*0x529c*/ - if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(64) ) /*0x52ab*/ - sub_740(64, "[System Inventory] PciExpReg %x\n", v7); /*0x52c1*/ - if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(64) ) /*0x52d2*/ - sub_740(64, "PciExpReg->SlotStatus.Bits.PresenceDetect = %x\n", (*(unsigned __int16 *)(v7 + 26) >> 6) & 1); /*0x52f2*/ - if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(64) ) /*0x5303*/ - sub_740(64, "PciExpReg->SlotCapability.Bits.PhysicalSlotNumber = %x\n", *(_DWORD *)(v7 + 20) >> 19); /*0x531e*/ - if ( (*(_BYTE *)(v7 + 26) & 0x40) != 0 ) /*0x5327*/ - { - (*(void (__fastcall **)(__int64, _QWORD, __int64, __int64, unsigned __int8 *))(v34 + 48))( /*0x5347*/ - v34, - 0, - 26, - 1, - &v39); - v8 = v39; /*0x5360*/ - v9 = (*(__int64 (__fastcall **)(_QWORD, void *, __int64 *))(qword_96A8 + 152))( /*0x536e*/ - *(_QWORD *)(v35 + 8 * i), - &unk_9470, - &v37); - if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(64) ) /*0x537d*/ - sub_740(64, "Locate DevicePathProtocol Status - %r\n", v9); /*0x5393*/ - if ( (unsigned __int8)sub_7EC() && v9 < 0 ) /*0x53a4*/ - { - if ( (unsigned __int8)((__int64 (*)(void))sub_7F8)() && (unsigned __int8)sub_804(0x80000000LL) ) /*0x53b4*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0x53cc*/ - sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1231, "!EFI_ERROR (Status)"); /*0x53e4*/ - } - if ( (*(_DWORD *)(v7 + 20) & 0xFFF80000) != 0 ) /*0x53f0*/ - { - v10 = 0; /*0x53f6*/ - while ( (unsigned __int16)sub_2500(((32LL * v8) | v10 & 0x1F) << 15) == 0xFFFF ) /*0x541e*/ - { - if ( ++v10 > 0x1Fu ) /*0x5425*/ - goto LABEL_48; /*0x5425*/ - } - v11 = *(_DWORD *)(v7 + 20) >> 19; /*0x543e*/ - v12 = 19LL * v0; /*0x5441*/ - *(_BYTE *)(v12 + qword_9680 + 2275) = v11; /*0x544f*/ - sub_3488(v8, v10, 0, v11); /*0x545a*/ - v13 = 0; /*0x546a*/ - v14 = 0; /*0x5471*/ - do /*0x54a5*/ - { - if ( __PAIR128__(*((unsigned __int8 *)v28 + v14 + 1), *((unsigned __int8 *)v28 + v14)) == v40 /*0x5493*/ - && *((unsigned __int8 *)v28 + v14 + 2) == v41 ) - { - if ( (unsigned __int8)sub_7F8(v14, v13, v41, *((_QWORD *)&v40 + 1)) && (unsigned __int8)sub_804(64) ) /*0x56f0*/ - { - [System_Inventory]_Pci_Device_is_found_in_Pcie_Slot_is_of_Riser = "[System Inventory] Pci Device is f" /*0x56f9*/ - "ound in Pcie Slot is of Riser Type" - " - %d, Location Bus = %x Dev = %x Fun = %x\n"; -LABEL_53: - LODWORD(v25) = 0; /*0x5700*/ - LODWORD(v24) = v10; /*0x5712*/ - sub_740(64, [System_Inventory]_Pci_Device_is_found_in_Pcie_Slot_is_of_Riser, 0, v8, v24, v25); /*0x5716*/ - } - goto LABEL_54; /*0x5716*/ - } - ++v13; /*0x5499*/ - v14 = 3 * v13; /*0x549c*/ - } - while ( *((_BYTE *)v28 + 3 * v13 + 2) != 0xFF ); /*0x54a5*/ - v15 = 0; /*0x54a7*/ - v16 = 0; /*0x54aa*/ - while ( __PAIR128__(*((unsigned __int8 *)v31 + v16 + 1), *((unsigned __int8 *)v31 + v16)) != v40 /*0x54c9*/ - || *((unsigned __int8 *)v31 + v16 + 2) != v41 ) - { - ++v15; /*0x54cf*/ - v16 = 3 * v15; /*0x54d2*/ - if ( *((_BYTE *)v31 + 3 * v15 + 2) == 0xFF ) /*0x54db*/ - { - v17 = 0; /*0x54dd*/ - v18 = 0; /*0x54e0*/ - while ( __PAIR128__(*((unsigned __int8 *)v26 + v18 + 1), *((unsigned __int8 *)v26 + v18)) != v40 /*0x54ff*/ - || *((unsigned __int8 *)v26 + v18 + 2) != v41 ) - { - ++v17; /*0x5505*/ - v18 = 3 * v17; /*0x5508*/ - if ( *((_BYTE *)v26 + 3 * v17 + 2) == 0xFF ) /*0x5511*/ - { - if ( (unsigned __int8)sub_7F8(v18, v17, v41, *((_QWORD *)&v40 + 1)) ) /*0x5513*/ - { - if ( (unsigned __int8)sub_804(64) ) /*0x5523*/ - sub_740( /*0x5542*/ - 64, - "[System Inventory] Pci Device found is in Onboard Slot, Location Bus = %x Dev = %x Fun = %x\n", - v8, - v10, - 0); - } - goto LABEL_47; /*0x5542*/ - } - } - if ( (unsigned __int8)sub_7F8(v18, v17, v41, *((_QWORD *)&v40 + 1)) && (unsigned __int8)sub_804(64) ) /*0x5761*/ - sub_740( /*0x5780*/ - 64, - "[System Inventory] Pci Device found is a MEZZ card, Location Bus = %x Dev = %x Fun = %x\n", - v8, - v10, - 0); - *(_BYTE *)(v12 + qword_9680 + 2276) = 9; /*0x578c*/ - goto LABEL_47; /*0x5794*/ - } - } - if ( (unsigned __int8)sub_7F8(v16, v15, v41, *((_QWORD *)&v40 + 1)) && (unsigned __int8)sub_804(64) ) /*0x573f*/ - { - [System_Inventory]_Pci_Device_is_found_in_Pcie_Slot_is_of_Riser = "[System Inventory] Pci Device is found" /*0x5748*/ - " in NVME Slot is of Riser Type - %d, L" - "ocation Bus = %x Dev = %x Fun = %x\n"; - goto LABEL_53; /*0x574f*/ - } -LABEL_54: - *(_BYTE *)(v12 + qword_9680 + 2276) = 0; /*0x571b*/ -LABEL_47: - *(_BYTE *)(v12 + qword_9680 + 2277) = v8; /*0x5547*/ - v19 = qword_9680; /*0x5558*/ - *(_BYTE *)(v12 + qword_9680 + 2278) &= 7u; /*0x5562*/ - *(_BYTE *)(v12 + v19 + 2278) |= 8 * v10; /*0x556a*/ - *(_BYTE *)(v12 + qword_9680 + 2278) &= 0xF8u; /*0x557e*/ - v20 = ((32 * v8) | v10 & 0x1Fu) << 15; /*0x558f*/ - v21 = (unsigned int)v20; /*0x5592*/ - *(_WORD *)(v12 + qword_9680 + 2279) = sub_2500(v20); /*0x55a0*/ - *(_WORD *)(v12 + qword_9680 + 2281) = sub_2500((unsigned int)v21 | 2LL); /*0x55ba*/ - *(_WORD *)(v12 + qword_9680 + 2283) = sub_2500((unsigned int)v21 | 0x2CLL); /*0x55d4*/ - *(_WORD *)(v12 + qword_9680 + 2285) = sub_2500((unsigned int)v21 | 0x2ELL); /*0x55ee*/ - *(_BYTE *)(v12 + qword_9680 + 2287) = sub_24F0((unsigned int)v21 | 9LL); /*0x560e*/ - *(_BYTE *)(v12 + qword_9680 + 2288) = sub_24F0((unsigned int)v21 | 0xALL); /*0x5628*/ - *(_BYTE *)(v12 + qword_9680 + 2289) = sub_24F0(v21 | 0xB); /*0x563b*/ - v22 = sub_2500(((v41 & 7 | (8 * (BYTE8(v40) & 0x1F | (32LL * (unsigned __int8)v40)))) << 12) | 0xA2); /*0x566d*/ - ++v0; /*0x5684*/ - *(_BYTE *)(v12 + qword_9680 + 2290) = v22 & 0xF; /*0x5687*/ - *(_BYTE *)(v12 + qword_9680 + 2291) = (v22 >> 4) & 0x3F; /*0x5695*/ - } - } - } - } -LABEL_48: - ; /*0x56a1*/ - } - *(_BYTE *)(qword_9680 + 2274) = 4; /*0x56b5*/ - (*(void (__fastcall **)(__int64))(qword_96A8 + 72))(v35); /*0x56c7*/ - return 0; /*0x56ca*/ - } - return result; /*0x56cc*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_579C.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_579C.c deleted file mode 100644 index 61cfb41..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_579C.c +++ /dev/null @@ -1,123 +0,0 @@ -__int64 __fastcall nullsub(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable, __int64 a3, __int64 a4) -{ - double v4; // xmm3_8 - __int64 v6; // rdx - __int64 v7; // rcx - __int64 v8; // r8 - __int64 v9; // r9 - __int64 v10; // rdx - __int64 v11; // rcx - __int64 v12; // r8 - __int64 v13; // rdx - __int64 v14; // rcx - __int64 v15; // r8 - __int64 v16; // r9 - __int64 v17; // rdx - __int64 v18; // r8 - __int64 v19; // r9 - __int64 p_n145_1; // rcx - int v21; // edi - __int64 v22; // rbx - __int64 result; // rax - __int64 v24; // rdx - __int64 v25; // rcx - __int64 v26; // r8 - __int64 v27; // r9 - char v28; // si - unsigned int v29; // edi - __int64 v30; // rdx - __int64 v31; // rcx - __int64 v32; // r8 - __int64 v33; // r9 - __int64 v34; // rbx - __int64 v35; // rdx - __int64 v36; // rcx - __int64 v37; // r8 - __int64 v38; // r9 - __int64 v39; // rdx - __int64 v40; // rcx - __int64 v41; // r8 - __int64 v42; // r9 - unsigned __int64 v43; // rbx - __int64 v44; // rdx - __int64 v45; // rcx - __int64 v46; // r8 - __int64 v47; // r9 - __int64 v48; // [rsp+40h] [rbp-10h] BYREF - __int64 p_n145; // [rsp+48h] [rbp-8h] BYREF - __int64 v50; // [rsp+90h] [rbp+40h] BYREF - __int64 v51; // [rsp+98h] [rbp+48h] BYREF - - LODWORD(v48) = 0; /*0x57af*/ - p_n145 = 0; /*0x57b6*/ - if ( (unsigned __int8)sub_7F8(ImageHandle, SystemTable, a3, a4) && (unsigned __int8)sub_804(64) ) /*0x57cd*/ - sub_740(64, "[System Inventory] OnReadyToBoot \n"); /*0x57e0*/ - sub_4854(v7, v6, v8, v9); /*0x57e5*/ - sub_4C00(v11, v10, v12, v4); /*0x57ea*/ - sub_47B4(); /*0x57ef*/ - sub_5110(); /*0x57f4*/ - sub_3FE4(); /*0x57f9*/ - (*(void (__fastcall **)(void *, void *, _QWORD, _QWORD))(qword_96A8 + 328))(&unk_9688, &unk_93B0, ::p_n145, 0); /*0x581d*/ - *(_BYTE *)::p_n145 = -64; /*0x582a*/ - if ( (unsigned __int8)sub_7F8(v14, v13, v15, v16) && (unsigned __int8)sub_804(64) ) /*0x5839*/ - sub_740(64, "[System Inventory] Version info size - %d \n", 85); /*0x5852*/ - *(_BYTE *)(::p_n145 + 85LL) = -63; /*0x585e*/ - p_n145_1 = ::p_n145; /*0x5862*/ - v21 = 19 * *(unsigned __int8 *)(::p_n145 + 2274LL) + 2191; /*0x5873*/ - if ( *(_BYTE *)(::p_n145 + 2351LL) ) /*0x5879*/ - { - v22 = (*(__int64 (__fastcall **)(__int64, __int64, __int64 *))(qword_96A8 + 64))(4, 3317, &p_n145); /*0x589e*/ - result = sub_7EC(); /*0x58a1*/ - if ( (_BYTE)result ) /*0x58a8*/ - { - if ( v22 >= 0 ) /*0x58ad*/ - { -LABEL_15: - v28 = 1; /*0x58fa*/ - sub_63C(p_n145, 3317); /*0x5908*/ - v29 = v21 - 1; /*0x5914*/ - sub_590(p_n145, ::p_n145 + 85LL, v29); /*0x5923*/ - sub_590(v29 + p_n145, ::p_n145 + 2351LL, 75LL * *(unsigned __int8 *)(::p_n145 + 2351LL) + 1); /*0x5947*/ - p_n145_1 = *(unsigned __int8 *)(::p_n145 + 2351LL); /*0x5953*/ - v21 = 75 * p_n145_1 + 1 + v29; /*0x595f*/ - goto LABEL_17; /*0x5961*/ - } - if ( (unsigned __int8)sub_7F8(v25, v24, v26, v27) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x58bf*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v22); /*0x58d4*/ - result = sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1641, "!EFI_ERROR (Status)"); /*0x58ec*/ - } - if ( v22 < 0 ) /*0x58f4*/ - return result; /*0x58f4*/ - goto LABEL_15; /*0x58f4*/ - } - v28 = 0; /*0x5967*/ - p_n145 = ::p_n145 + 85LL; /*0x596a*/ -LABEL_17: - if ( (unsigned __int8)sub_7F8(p_n145_1, v17, v18, v19) && (unsigned __int8)sub_804(64) ) /*0x597a*/ - sub_740(64, "[System Inventory] Device Info command size - %d\n", v21); /*0x5990*/ - if ( qword_94B0 ) /*0x599d*/ - { - if ( (unsigned __int8)sub_7F8(v31, v30, v32, v33) && (unsigned __int8)sub_804(64) ) /*0x59fe*/ - sub_740( /*0x5a18*/ - 64, - "[System Inventory] OnReadyToBoot No Sending BMC Device Info Command by USB IPMI Status - %r\n", - qword_94B0); - } - else - { - LOBYTE(v32) = 88; /*0x59ac*/ - LOBYTE(v31) = 6; /*0x59ba*/ - v34 = sub_2640(v31, 0, v32, p_n145, v21, (__int64)&v51, (__int64)&v48, (__int64)&v50); /*0x59ce*/ - if ( (unsigned __int8)sub_7F8(v36, v35, v37, v38) && (unsigned __int8)sub_804(64) ) /*0x59dd*/ - sub_740(64, "[System Inventory] OnReadyToBoot Sending BMC Device Info Command Status - %r\n", v34); /*0x59f0*/ - } - if ( v28 ) /*0x5a20*/ - sub_1D54(p_n145); /*0x5a26*/ - v43 = sub_5C78(v40, v39, v41, v42); /*0x5a30*/ - if ( (unsigned __int8)sub_7F8(v45, v44, v46, v47) ) /*0x5a33*/ - { - if ( (unsigned __int8)sub_804(64) ) /*0x5a3f*/ - sub_740(64, "[System Inventory] OnReadyToBoot SaveSmbiosDataToBmc Status - %r\n", v43); /*0x5a55*/ - } - return (*(__int64 (__fastcall **)(EFI_HANDLE))(qword_96A8 + 112))(ImageHandle); /*0x5a6f*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5A7C.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5A7C.c deleted file mode 100644 index 6c48a30..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5A7C.c +++ /dev/null @@ -1,93 +0,0 @@ -__int64 __fastcall sub_5A7C(_BYTE *p_n145, __int16 a2, unsigned __int16 n4, __int64 a4, unsigned int a5) -{ - unsigned __int64 n4_4; // rbx - unsigned int v8; // r15d - __int16 v9; // r14 - unsigned __int16 n4_3; // bp - __int64 v11; // rsi - __int64 v12; // rdx - __int64 v13; // rcx - __int64 v14; // rdi - __int64 v15; // r8 - __int64 v16; // r9 - unsigned int v17; // esi - __int64 v18; // rdx - __int64 v19; // r8 - __int64 v20; // r9 - unsigned __int16 n4_2; // si - __int64 v23; // r8 - __int16 v24; // [rsp+72h] [rbp+Ah] BYREF - _BYTE v25[4]; // [rsp+74h] [rbp+Ch] BYREF - unsigned int v26; // [rsp+78h] [rbp+10h] - unsigned __int16 n4_1; // [rsp+80h] [rbp+18h] - - n4_1 = n4; /*0x5a81*/ - n4_4 = a2 & 3; /*0x5aaa*/ - v8 = a5 + 2; /*0x5aad*/ - v26 = a5 + 4; /*0x5ab4*/ - v9 = a2 & 0xFFFC; /*0x5abd*/ - n4_3 = 0; /*0x5ac3*/ - if ( !n4 ) /*0x5aca*/ - return 0; /*0x5bd5*/ -LABEL_2: - v24 = v9 & 0x7FFF; /*0x5ad3*/ - v11 = 0; /*0x5afb*/ - v14 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, __int16 *))(a4 + 56))(a4, 1, v8, 1, &v24); /*0x5afd*/ - if ( v14 >= 0 ) - { - while ( 1 ) - { - (*(void (__fastcall **)(__int64))(qword_96A8 + 248))(100); /*0x5b15*/ - v14 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, __int16 *))(a4 + 48))(a4, 1, v8, 1, &v24); /*0x5b39*/ - if ( v14 < 0 ) /*0x5b3f*/ - break; /*0x5b3f*/ - if ( v24 >= 0 && (unsigned __int64)++v11 < 0x57E40 ) /*0x5b5e*/ - continue; /*0x5b5e*/ - if ( (v24 & 0x8000) == 0 ) - { - if ( (unsigned __int8)sub_7F8( - "Create DisableBmcVirtualCD Event with legacy boot fail, Status: %r\n", - v12, - v15, - v16) - && (unsigned __int8)sub_804(64) ) - { - sub_740(64, "PciConfigReadVpd: Unable to see F bit go TRUE\n"); - } - return 0x8000000000000007uLL; /*0x5c3e*/ - } - v17 = v26; /*0x5b6e*/ - v14 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, _BYTE *))(a4 + 48))(a4, 2, v26, 1, v25); /*0x5b8f*/ - if ( v14 < 0 ) /*0x5b95*/ - { - if ( (unsigned __int8)sub_7F8(0, v18, v19, v20) && (unsigned __int8)sub_804(64) ) /*0x5bff*/ - { - v23 = v17; /*0x5c08*/ - goto LABEL_23; /*0x5c0b*/ - } - return v14; /*0x5c06*/ - } - n4_2 = n4_1; /*0x5b97*/ - do /*0x5bc3*/ - { - if ( n4_3 >= n4_2 ) /*0x5ba8*/ - break; /*0x5ba8*/ - ++n4_3; /*0x5bae*/ - *p_n145++ = v25[n4_4++]; /*0x5bb1*/ - } - while ( n4_4 < 4 ); /*0x5bc3*/ - v9 += 4; /*0x5bc5*/ - n4_4 = 0; /*0x5bc9*/ - if ( n4_3 < n4_2 ) /*0x5bcf*/ - goto LABEL_2; /*0x5bcf*/ - return 0; /*0x5bcf*/ - } - } - if ( (unsigned __int8)sub_7F8(v13, v12, v15, v16) && (unsigned __int8)sub_804(64) ) - { - v23 = v8; /*0x5c59*/ -LABEL_23: - sub_740(64, "PciConfigReadVpd: Error reading PciIo space at offset %x - code = %r\n", v23, v14); - } - return v14; /*0x5bdf*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5C78.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5C78.c deleted file mode 100644 index de68921..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5C78.c +++ /dev/null @@ -1,90 +0,0 @@ -unsigned __int64 __fastcall sub_5C78(__int64 a1, __int64 a2, __int64 a3, __int64 a4) -{ - __int64 v4; // rdx - __int64 v5; // rcx - __int64 v6; // rbx - __int64 v7; // r8 - __int64 v8; // r9 - __int64 v10; // rbx - __int64 v11; // r14 - __int64 n24; // rdi - __int64 v13; // rsi - int v14; // r8d - char *v15; // rcx - __int64 v16; // rdx - __int64 v17; // rcx - __int64 v18; // r8 - __int64 v19; // r9 - __int64 v20; // [rsp+40h] [rbp-18h] BYREF - __int64 v21; // [rsp+48h] [rbp-10h] BYREF - unsigned __int8 v22; // [rsp+90h] [rbp+38h] BYREF - char v23; // [rsp+98h] [rbp+40h] BYREF - int v24; // [rsp+A0h] [rbp+48h] BYREF - _BYTE *p_n145; // [rsp+A8h] [rbp+50h] - - v21 = 0; /*0x5c88*/ - v20 = 0; /*0x5c8d*/ - p_n145 = 0; /*0x5c92*/ - v24 = 0; /*0x5c97*/ - if ( (unsigned __int8)sub_7F8(a1, a2, a3, a4) && (unsigned __int8)sub_804(64) ) - sub_740(64, "SaveSmbiosDataToBmc: Enter \n"); - v6 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x5ce2*/ - if ( v6 < 0 ) /*0x5ce8*/ - { - if ( (unsigned __int8)sub_7F8(v5, v4, v7, v8) ) /*0x5cea*/ - { - if ( (unsigned __int8)sub_804(64) ) /*0x5cf6*/ - sub_740(64, "Locating IPMI Dxe Protocol Status - %r\n", v6); /*0x5d0c*/ - } - return v6; /*0x5d14*/ - } - if ( sub_1F50(&unk_94A0, &v20) >= 0 ) - { - v10 = v20; /*0x5d2e*/ - if ( v20 ) - { - v11 = *(_QWORD *)(v20 + 16); /*0x5d37*/ - n24 = 24; /*0x5d3b*/ - v13 = *(unsigned int *)(v20 + 12); /*0x5d40*/ -LABEL_15: - p_n145 = (_BYTE *)sub_1D2C(v13 + n24 + 1); /*0x5d78*/ - *p_n145 = 1; /*0x5d8e*/ - (*(void (__fastcall **)(_BYTE *, __int64, __int64))(qword_96A8 + 352))(p_n145 + 1, v10, n24); /*0x5d9f*/ - (*(void (__fastcall **)(_BYTE *, __int64, __int64))(qword_96A8 + 352))(&p_n145[n24 + 1], v11, v13); /*0x5dbc*/ - v6 = (*(__int64 (__fastcall **)(const __int16 *, void *, __int64))(qword_96E0 + 88))(L"RDBG_SMBIOS", &unk_9480, 2); /*0x5df5*/ - if ( !qword_94B0 ) - { - LOBYTE(v14) = 71; /*0x5e19*/ - v15 = &v23; /*0x5e1c*/ - LOBYTE(v15) = 46; /*0x5e27*/ - v6 = sub_2640( /*0x5e32*/ - (_DWORD)v15, - 0, - v14, - (_DWORD)p_n145, - (int)n24 + (int)v13 + 1, - (__int64)&v23, - (__int64)&v24, - (__int64)&v22); - if ( (unsigned __int8)sub_7F8(v17, v16, v18, v19) ) - { - if ( (unsigned __int8)sub_804(64) ) - sub_740(64, "SaveSmbiosDataToBmc: SendOemIpmiCommand Status = %r , CompletionCode = %x \n", v6, v22); - } - } - return v6; /*0x5e69*/ - } - } - if ( sub_1F50(&unk_9490, &v21) >= 0 ) /*0x5d58*/ - { - v10 = v21; /*0x5d5e*/ - if ( v21 ) /*0x5d65*/ - { - v11 = *(unsigned int *)(v21 + 24); /*0x5d6b*/ - n24 = 31; /*0x5d6f*/ - v13 = *(unsigned __int16 *)(v21 + 22); /*0x5d74*/ - goto LABEL_15; /*0x5d74*/ - } - } - return 0x800000000000000EuLL; /*0x5e78*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5E88.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5E88.c deleted file mode 100644 index ff403df..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5E88.c +++ /dev/null @@ -1,55 +0,0 @@ -__int64 __fastcall sub_5E88(char n2) -{ - __int64 v2; // rbx - __int64 v3; // rdx - __int64 v4; // rcx - __int64 v5; // r8 - __int64 v6; // r9 - __int64 result; // rax - __int64 v8; // rdx - __int64 v9; // r9 - __int64 v10; // rdx - __int64 v11; // rcx - __int64 v12; // r8 - __int64 v13; // r9 - char n2_2; // [rsp+28h] [rbp-30h] - char v15; // [rsp+68h] [rbp+10h] BYREF - char v16; // [rsp+70h] [rbp+18h] BYREF - char n4; // [rsp+78h] [rbp+20h] BYREF - char n2_1; // [rsp+79h] [rbp+21h] - - v2 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x5eb0*/ - result = sub_7F8(v4, v3, v5, v6); /*0x5eb3*/ - if ( (_BYTE)result ) /*0x5ebf*/ - { - result = sub_804(64); /*0x5ec3*/ - if ( (_BYTE)result ) /*0x5eca*/ - result = sub_740(64, "[System Inventory] Locating IPMI Dxe Protocol Status - %r\n", v2); /*0x5ed8*/ - } - if ( v2 >= 0 ) /*0x5ee0*/ - { - n4 = 4; /*0x5ee7*/ - LOBYTE(v9) = -53; /*0x5ef1*/ - n2_1 = n2; /*0x5ef9*/ - n2_2 = 2; /*0x5f0b*/ - LOBYTE(v8) = 50; /*0x5f15*/ - v15 = 1; /*0x5f21*/ - (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, char *, char, char *, char *))(qword_9690 + 16))( /*0x5f26*/ - qword_9690, - v8, - 0, - v9, - &n4, - n2_2, - &v16, - &v15); - result = sub_7F8(v11, v10, v12, v13); /*0x5f29*/ - if ( (_BYTE)result ) /*0x5f30*/ - { - result = sub_804(64); /*0x5f35*/ - if ( (_BYTE)result ) /*0x5f3c*/ - return sub_740(64, "Set CD Device Number to 2 for USB Data transferring.\n"); /*0x5f48*/ - } - } - return result; /*0x5f4d*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5F58.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5F58.c deleted file mode 100644 index 4f37746..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_5F58.c +++ /dev/null @@ -1,23 +0,0 @@ -__int64 sub_5F58() -{ - __int64 v0; // rbx - __int64 v1; // rdx - __int64 v2; // rcx - __int64 v3; // r8 - __int64 v4; // r9 - _BYTE v6[24]; // [rsp+30h] [rbp-18h] BYREF - __int64 v7; // [rsp+60h] [rbp+18h] BYREF - __int64 v8; // [rsp+68h] [rbp+20h] BYREF - - v7 = 0; /*0x5f62*/ - sub_2528(); /*0x5f68*/ - if ( (*(__int64 (__fastcall **)(void *, _QWORD, _BYTE *))(qword_96A8 + 320))(&unk_9420, 0, v6) >= 0 ) /*0x5f90*/ - sub_6028(0); /*0x5fba*/ - else - sub_2028((__int64)&unk_9420, 8, (__int64)sub_6028, 0, (__int64)&v7); /*0x5faf*/ - v0 = sub_22CC(8, nullsub, 0, (__int64)&v8); /*0x5fd6*/ - if ( (unsigned __int8)sub_7F8(v2, v1, v3, v4) && (unsigned __int8)sub_804(64) ) /*0x5fe7*/ - sub_740(64, "[System Inventory] SystemInventoryEntryPoint EfiCreateEventReadyToBootEx - %r\n", v0); /*0x5fff*/ - sub_22CC(8, sub_64D8, 0, (__int64)&v8); /*0x6016*/ - return 0; /*0x6022*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_6028.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_6028.c deleted file mode 100644 index 94d8093..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_6028.c +++ /dev/null @@ -1,180 +0,0 @@ -__int64 __fastcall sub_6028(__int64 a1) -{ - __int64 v2; // rbx - __int64 v3; // rdx - __int64 v4; // rcx - __int64 v5; // r8 - __int64 v6; // r9 - __int64 v7; // rbx - __int64 v8; // rdx - __int64 v9; // rcx - __int64 v10; // r8 - __int64 v11; // r9 - __int64 v12; // rdx - unsigned __int8 v13; // di - __int64 v14; // r9 - __int64 v15; // rdx - __int64 v16; // rcx - __int64 v17; // r8 - __int64 v18; // r9 - __int64 v19; // rdx - __int64 v20; // r9 - __int64 v21; // rdx - __int64 v22; // rcx - __int64 v23; // r8 - __int64 v24; // r9 - __int64 v25; // rdx - __int64 v26; // rcx - __int64 v27; // rbx - __int64 v28; // r8 - __int64 v29; // r9 - __int64 v30; // rdx - __int64 v31; // rcx - __int64 v32; // r8 - __int64 v33; // r9 - __int64 v34; // rdx - __int64 v35; // rcx - __int64 v36; // r8 - __int64 v37; // r9 - __int64 v38; // rdx - __int64 v39; // rcx - __int64 v40; // r8 - __int64 v41; // r9 - __int64 v42; // rdx - __int64 v43; // rcx - __int64 v44; // rbx - __int64 v45; // r8 - __int64 v46; // r9 - __int64 v47; // rdx - __int64 v48; // rcx - __int64 v49; // r8 - __int64 v50; // r9 - __int64 v51; // rdx - __int64 v52; // rcx - __int64 v53; // r8 - __int64 v54; // r9 - __int64 v55; // rdx - __int64 v56; // rcx - __int64 v57; // r8 - __int64 v58; // r9 - int v60; // [rsp+28h] [rbp-40h] - unsigned __int8 v61; // [rsp+80h] [rbp+18h] BYREF - - v2 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD *))(qword_96A8 + 64))(4, 3402, &p_n145); /*0x6064*/ - if ( (unsigned __int8)sub_7EC() && v2 < 0 ) /*0x6086*/ - { - if ( (unsigned __int8)sub_7F8(v4, v3, v5, v6) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x6093*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v2); /*0x60a8*/ - sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1972, "!EFI_ERROR (Status)"); /*0x60b8*/ - } - sub_63C(p_n145, 3402); /*0x60c7*/ - v7 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_9460, 0, &qword_9690); /*0x60e9*/ - if ( (unsigned __int8)sub_7F8(v9, v8, v10, v11) && (unsigned __int8)sub_804(64) ) /*0x60fe*/ - sub_740(64, "[System Inventory] Locating IPMI Dxe Protocol Status - %r\n", v7); /*0x6114*/ - if ( v7 >= 0 ) - { - v13 = sub_3F00(); /*0x6127*/ - if ( !v13 ) /*0x612c*/ - sub_5E88(2); /*0x6130*/ - byte_9699 = 1; /*0x613d*/ - LOBYTE(v14) = -85; /*0x614b*/ - LOBYTE(v12) = 50; /*0x615b*/ - qword_94B0 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, _QWORD, _BYTE, unsigned __int8 *, char *))(qword_9690 + 16))( /*0x6175*/ - qword_9690, - v12, - 0, - v14, - 0, - 0, - &v61, - &byte_9699); - v7 = qword_94B0; /*0x617c*/ - if ( qword_94B0 >= 0 ) /*0x6182*/ - { - if ( (unsigned __int8)sub_7F8(v16, v15, v17, v18) && (unsigned __int8)sub_804(64) ) /*0x61bd*/ - sub_740(64, "Get the virtual USB Status = %x \n", v61); /*0x61d9*/ - if ( v61 != 1 ) /*0x61e6*/ - goto LABEL_42; /*0x61e6*/ - } - else if ( (unsigned __int8)sub_7F8(v16, v15, v17, v18) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x6190*/ - { - sub_740(0x80000000LL, "Get virtual USB status failed! Status = %r\n", qword_94B0); /*0x61aa*/ - } - LOBYTE(v20) = -86; /*0x61fe*/ - LOBYTE(v60) = 1; /*0x6208*/ - LOBYTE(v19) = 50; /*0x621c*/ - qword_94B0 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, void *, int, unsigned __int8 *, char *))(qword_9690 + 16))( /*0x6224*/ - qword_9690, - v19, - 0, - v20, - &unk_9698, - v60, - &v61, - &byte_9699); - if ( (unsigned __int8)sub_7F8(v22, v21, v23, v24) && (unsigned __int8)sub_804(64) ) /*0x6237*/ - sub_740(64, "[System Inventory] Enabling BMC USB Interface by disabling Power saving in BMC - %r\n", qword_94B0); /*0x6251*/ - v27 = (*(__int64 (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(__int64, __int64, __int64, __int64)))(qword_96A8 + 80))( /*0x6282*/ - 513, - 16, - sub_3C80); - if ( v27 < 0 ) - { - if ( (unsigned __int8)sub_7F8(v26, v25, v28, v29) && (unsigned __int8)sub_804(0x80000000LL) ) - sub_740(0x80000000LL, "Create DisableBmcUsbInterface Event with exit_boot_service fail, Status: %r\n", v27); - if ( (unsigned __int8)sub_7EC() ) /*0x62b1*/ - { - if ( (unsigned __int8)sub_7F8(v31, v30, v32, v33) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x62c6*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v27); /*0x62dc*/ - sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 2064, "!EFI_ERROR (Status)"); /*0x62ec*/ - } - } - v7 = sub_21C8(16, (__int64 (__fastcall *)(EFI_HANDLE, EFI_SYSTEM_TABLE *))sub_3C80, 0, (__int64)&qword_9718); /*0x630a*/ - if ( v7 < 0 ) - { - if ( (unsigned __int8)sub_7F8(v35, v34, v36, v37) && (unsigned __int8)sub_804(0x80000000LL) ) - sub_740(0x80000000LL, "Create DisableBmcUsbInterface Event with legacy boot fail, Status: %r\n", v7); - if ( (unsigned __int8)sub_7EC() ) /*0x6339*/ - { - if ( (unsigned __int8)sub_7F8(v39, v38, v40, v41) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x634e*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v7); /*0x6364*/ - sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 2075, "!EFI_ERROR (Status)"); /*0x6374*/ - } - } -LABEL_42: - if ( !v13 ) - { - v44 = (*(__int64 (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(), _QWORD, void *))(qword_96A8 + 80))( /*0x63b2*/ - 513, - 16, - sub_3E1C, - 0, - &unk_9710); - if ( v44 < 0 ) - { - if ( (unsigned __int8)sub_7F8(v43, v42, v45, v46) && (unsigned __int8)sub_804(0x80000000LL) ) - sub_740(0x80000000LL, "Create DisableBmcVirtualCD Event with exit_boot_service fail, Status: %r\n", v44); - if ( (unsigned __int8)sub_7EC() ) /*0x63e1*/ - { - if ( (unsigned __int8)sub_7F8(v48, v47, v49, v50) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x63f6*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v44); /*0x640c*/ - sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 2091, "!EFI_ERROR (Status)"); /*0x641c*/ - } - } - v7 = sub_21C8(16, (__int64 (__fastcall *)(EFI_HANDLE, EFI_SYSTEM_TABLE *))sub_3E1C, 0, (__int64)&qword_9718); /*0x643a*/ - if ( v7 < 0 ) - { - if ( (unsigned __int8)sub_7F8(v52, v51, v53, v54) && (unsigned __int8)sub_804(0x80000000LL) ) - sub_740(0x80000000LL, "Create DisableBmcVirtualCD Event with legacy boot fail, Status: %r\n", v7); - if ( (unsigned __int8)sub_7EC() ) /*0x6469*/ - { - if ( (unsigned __int8)sub_7F8(v56, v55, v57, v58) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x647e*/ - sub_740(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v7); /*0x6494*/ - sub_788("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 2102, "!EFI_ERROR (Status)"); /*0x64a4*/ - } - } - } - (*(void (__fastcall **)(__int64))(qword_96A8 + 112))(a1); /*0x64b3*/ - } - return v7; /*0x64ca*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_64D8.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_64D8.c deleted file mode 100644 index 7bf273a..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_64D8.c +++ /dev/null @@ -1,41 +0,0 @@ -__int64 __fastcall sub_64D8(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) -{ - __int64 v2; // rbx - __int64 v3; // rdx - __int64 v4; // rcx - __int64 v5; // r8 - __int64 v6; // r9 - __int64 result; // rax - __int64 v8; // rbx - __int64 v9; // [rsp+60h] [rbp+18h] BYREF - - v2 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_96A8 + 320))(&unk_93C0, 0, &v9); /*0x64fd*/ - if ( (unsigned __int8)sub_7F8(v4, v3, v5, v6) && (unsigned __int8)sub_804(0x80000000LL) ) /*0x6510*/ - sub_740(0x80000000LL, "[System Inventory] SystemInventoryEntryPoint EfiCreateEventReadyToBootEx - %r\n", v2); /*0x6525*/ - result = sub_C8C(97); /*0x6532*/ - if ( v2 >= 0 ) /*0x653a*/ - { - v8 = (*(__int64 (__fastcall **)(__int64, __int64 (__fastcall *)(), _QWORD, _QWORD, _QWORD, _QWORD, _QWORD))(v9 + 16))( /*0x6566*/ - v9, - sub_3EE8, - 0, - 0, - 0, - 0, - 0); - result = sub_7EC(); /*0x6569*/ - if ( (_BYTE)result ) /*0x6570*/ - { - if ( v8 ) /*0x6575*/ - { - result = 0x8000000000000013uLL; /*0x6577*/ - if ( v8 != 0x8000000000000013uLL ) /*0x6584*/ - return sub_788( /*0x6599*/ - "e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", - 2160, - "MpStatus == 0 || MpStatus == ((RETURN_STATUS)(0x8000000000000000ULL | (19)))"); - } - } - } - return result; /*0x65a3*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_8D8.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_8D8.c deleted file mode 100644 index 92e390a..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_8D8.c +++ /dev/null @@ -1,30 +0,0 @@ -_BYTE *__fastcall sub_8D8(_BYTE *p_n145_1, _BYTE *a2, unsigned __int64 n62) -{ - unsigned __int64 n62_1; // rdi - _BYTE *p_n145; // rbx - _BYTE *p_n145_2; // rbp - - n62_1 = n62; /*0x8ec*/ - p_n145 = p_n145_1; /*0x8f2*/ - if ( !n62 ) /*0x8f8*/ - return p_n145_1; /*0x8fa*/ - if ( !p_n145_1 ) /*0x915*/ - sub_788("e:\\hs\\MdePkg\\Library\\BaseLib\\String.c", 1033, "Destination != ((void *) 0)"); /*0x926*/ - if ( p_n145 - a2 <= (unsigned __int64)sub_9F0(a2) ) /*0x945*/ - sub_788("e:\\hs\\MdePkg\\Library\\BaseLib\\String.c", 1038, "(UINTN)(Destination - Source) > AsciiStrLen (Source)"); /*0x956*/ - if ( a2 - p_n145 < n62_1 ) /*0x96d*/ - sub_788("e:\\hs\\MdePkg\\Library\\BaseLib\\String.c", 1039, "(UINTN)(Source - Destination) >= Length"); /*0x97e*/ - if ( n62_1 > 0xF4240 ) /*0x999*/ - sub_788( /*0x9aa*/ - "e:\\hs\\MdePkg\\Library\\BaseLib\\String.c", - 1042, - "Length <= _gPcd_FixedAtBuild_PcdMaximumAsciiStringLength"); - p_n145_2 = p_n145; /*0x9af*/ - while ( *a2 && n62_1 ) /*0x9b7*/ - { - *p_n145++ = *a2++; /*0x9b9*/ - --n62_1; /*0x9c1*/ - } - sub_63C(p_n145, n62_1); /*0x9d0*/ - return p_n145_2; /*0x9e7*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_AAC.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_AAC.c deleted file mode 100644 index c147790..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_AAC.c +++ /dev/null @@ -1,64 +0,0 @@ -__int64 __fastcall sub_AAC(char *a1) -{ - unsigned __int64 v1; // rdi - char *v2; // rbx - unsigned __int64 v3; // rax - unsigned __int64 v4; // r9 - unsigned __int64 v5; // rax - __int64 v6; // rdx - __int64 v7; // r8 - unsigned int v8; // r9d - unsigned __int64 v9; // rcx - char n88; // al - __int64 v11; // r9 - __int64 v12; // rax - __int64 v14; // [rsp+30h] [rbp+8h] - - v1 = 0; /*0xabc*/ - v2 = a1; /*0xabe*/ - if ( !a1 ) /*0xac8*/ - { - sub_788("e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c", 2561, "(String != ((void *) 0))"); /*0xadd*/ - return v14; /*0xbc0*/ - } - v3 = sub_D0C(a1, 1000001); /*0xb08*/ - if ( v3 > v4 ) /*0xb10*/ - { - sub_788( /*0xb25*/ - "e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c", - 2568, - "(AsciiStrnLenS (String, (_gPcd_FixedAtBuild_PcdMaximumAsciiStringLength) + 1) <= (_gPcd_FixedAtBuild_PcdMaximumAsc" - "iiStringLength))"); - LODWORD(v4) = 1000000; /*0xb2a*/ - } - v5 = sub_D0C(v2, (int)v4 + 1); /*0xb38*/ - v9 = v8; /*0xb3d*/ - if ( v5 > v8 ) /*0xb43*/ - return v14; /*0xb43*/ - while ( *v2 == 32 || *v2 == 9 ) /*0xb4d*/ - ++v2; /*0xb4f*/ - LOBYTE(v7) = 48; /*0xb54*/ - while ( *v2 == 48 ) /*0xb5f*/ - ++v2; /*0xb59*/ - n88 = *v2; /*0xb67*/ - if ( (unsigned __int8)(*v2 - 97) <= 0x19u ) /*0xb6a*/ - n88 -= 32; /*0xb6c*/ - if ( n88 == 88 ) /*0xb71*/ - { - if ( *(v2 - 1) != 48 ) /*0xb77*/ - return v1; /*0xb77*/ - ++v2; /*0xb79*/ - } - v11 = -1; /*0xb7c*/ - while ( (unsigned __int8)(*v2 - v7) <= 9u || (unsigned __int8)(*v2 - 65) <= 5u || (unsigned __int8)(*v2 - 97) <= 5u ) /*0xb97*/ - { - LOBYTE(v9) = *v2; /*0xb99*/ - v12 = sub_A7C(v9, v6, v7, v11); /*0xb9b*/ - v9 = (unsigned __int64)(v11 - v12) >> 4; /*0xba6*/ - if ( v1 > v9 ) /*0xbad*/ - return v11; /*0xbbe*/ - v1 = v12 + 16 * v1; /*0xbb3*/ - ++v2; /*0xbb6*/ - } - return v1; /*0xbcd*/ -} \ No newline at end of file diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_E14.c b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_E14.c deleted file mode 100644 index d116b0c..0000000 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory_sub_E14.c +++ /dev/null @@ -1,852 +0,0 @@ -unsigned __int64 __fastcall sub_E14( - unsigned __int64 a1, - unsigned __int64 n0xF4240, - __int64 a3, - unsigned __int8 *a4, - unsigned __int16 **a5) -{ - unsigned __int8 *v5; // rsi - __int64 v6; // r12 - unsigned __int64 v8; // r13 - __int64 v9; // rdi - __int64 v11; // r8 - int n1000000; // r9d - __int64 n2_1; // r15 - unsigned __int64 n1000000_2; // rax - unsigned int n1000000_1; // r9d - unsigned __int64 v16; // rax - unsigned int v17; // r9d - unsigned __int64 v18; // rdi - unsigned __int64 v19; // r10 - __int64 v20; // rax - __int64 v21; // rcx - unsigned __int8 *v22; // rdx - unsigned __int8 *v23; // r8 - unsigned __int64 v24; // r9 - char v25; // r11 - unsigned __int64 v26; // rdi - const char *_r_n_1; // rbx - unsigned __int16 **v28; // r10 - unsigned __int8 *v29; // rdx - int v30; // eax - unsigned __int64 n13_1; // rcx - unsigned __int16 *v32; // rax - int v33; // eax - unsigned __int8 *v34; // rdx - unsigned __int64 v35; // rcx - unsigned __int64 v36; // rcx - unsigned __int64 v37; // rcx - unsigned __int64 v38; // rcx - unsigned __int64 v39; // rcx - unsigned __int64 v40; // rcx - __int64 v41; // r15 - int v42; // eax - int v43; // eax - unsigned __int8 *v44; // rdi - int v45; // r15d - int v46; // r14d - unsigned __int16 v47; // ax - unsigned __int64 v48; // rcx - unsigned __int64 v49; // rcx - unsigned __int64 v50; // rcx - unsigned __int64 v51; // rcx - unsigned __int64 n3; // rcx - unsigned __int16 *n5; // rcx - __int64 v54; // rbx - char n43; // r14 - bool v56; // r15 - __int64 n16; // r8 - unsigned __int64 v58; // rdx - int v59; // eax - const char *i; // r8 - __int64 n512; // r14 - int v62; // edx - __int64 v63; // rax - __int64 v64; // rcx - int v65; // r10d - __int64 j; // rcx - __int64 n2_3; // r11 - int v68; // r8d - __int64 v69; // rdi - unsigned __int64 v70; // r8 - unsigned __int64 v71; // rdx - __int64 v72; // r14 - unsigned __int64 v73; // rsi - __int16 v74; // cx - unsigned __int64 v75; // rax - __int64 m; // r8 - __int64 n; // rax - __int64 v78; // rax - int v79; // r8d - __int64 v80; // rcx - __int64 v81; // rax - __int64 k; // rcx - int v83; // eax - unsigned __int64 n10; // rcx - _BYTE *v85; // rax - __int64 ii; // rdx - __int64 v87; // [rsp+80h] [rbp-80h] - __int64 v88; // [rsp+80h] [rbp-80h] - unsigned __int64 v89; // [rsp+88h] [rbp-78h] - unsigned int n2; // [rsp+90h] [rbp-70h] - unsigned __int64 v91; // [rsp+98h] [rbp-68h] - char n43_1; // [rsp+A0h] [rbp-60h] - __int64 v93; // [rsp+B0h] [rbp-50h] - unsigned __int64 v94; // [rsp+B0h] [rbp-50h] - unsigned __int64 n13; // [rsp+B8h] [rbp-48h] BYREF - unsigned __int16 *v96; // [rsp+C0h] [rbp-40h] - __int64 n0xFFFF; // [rsp+C8h] [rbp-38h] - unsigned __int64 v98; // [rsp+D0h] [rbp-30h] - __int64 v99; // [rsp+D8h] [rbp-28h] BYREF - __int64 n2_2; // [rsp+E0h] [rbp-20h] - unsigned __int64 v101; // [rsp+E8h] [rbp-18h] - _BYTE _r_n[40]; // [rsp+F0h] [rbp-10h] BYREF - __int64 n512_1; // [rsp+118h] [rbp+18h] - __int64 v104; // [rsp+168h] [rbp+68h] - __int16 v105; // [rsp+170h] [rbp+70h] - unsigned __int8 *v106; // [rsp+178h] [rbp+78h] - bool v107; // [rsp+188h] [rbp+88h] - - v106 = a4; /*0xe19*/ - v5 = a4; /*0xe43*/ - LOWORD(v6) = a3; /*0xe46*/ - v8 = a1; /*0xe4c*/ - if ( n0xF4240 ) /*0xe55*/ - { - v9 = a3 & 0x2000; /*0xe57*/ - if ( (a3 & 0x2000) == 0 && !a1 ) /*0xe6b*/ - { - sub_788("e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", 578, "(Buffer != ((void *) 0))"); /*0xe7c*/ - if ( !v8 ) /*0xe84*/ - return 0; /*0xe84*/ - } - } - else - { - v9 = a3 & 0x2000; /*0xe8d*/ - if ( (a3 & 0x2000) == 0 ) /*0xe93*/ - goto LABEL_9; /*0xe93*/ - } - if ( !v5 ) /*0xea1*/ - { - sub_788("e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", 586, "(Format != ((void *) 0))"); /*0xeb2*/ - return 0; /*0xe88*/ - } -LABEL_9: - if ( (v6 & 0x40) != 0 ) /*0xec0*/ - { - if ( n0xF4240 > 0xF4240 ) /*0xed8*/ - { - sub_788( /*0xee9*/ - "e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", - 595, - "(BufferSize <= (_gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength))"); - return 0; /*0xef9*/ - } - n2 = 2; /*0xf02*/ - } - else - { - if ( n0xF4240 > 0xF4240 ) /*0xf23*/ - { - sub_788( /*0xf34*/ - "e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", - 600, - "(BufferSize <= (_gPcd_FixedAtBuild_PcdMaximumAsciiStringLength))"); - return 0; /*0xf46*/ - } - n2 = 1; /*0xf52*/ - } - if ( (v6 & 0x100) != 0 ) /*0xf5e*/ - { - if ( (unsigned __int64)sub_C9C(v5, 1000001, a3, 1000000) > 0xF4240 ) /*0xf80*/ - sub_788( /*0xf91*/ - "e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", - 611, - "(StrnLenS ((CHAR16 *)Format, (_gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength) + 1) <= (_gPcd_FixedAtBuild_PcdM" - "aximumUnicodeStringLength))"); - if ( (unsigned __int64)sub_C9C(v5, 1000001, v11, n1000000) > 0xF4240 ) /*0xfaf*/ - return 0; /*0xfaf*/ - n2_1 = 2; /*0xfba*/ - n0xFFFF = 0xFFFF; /*0xfc0*/ - } - else - { - n1000000_2 = sub_D0C(v5, 1000001); /*0xfdb*/ - if ( n1000000_2 > n1000000_1 ) /*0xfe6*/ - { - sub_788( /*0xff7*/ - "e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", - 617, - "(AsciiStrnLenS (Format, (_gPcd_FixedAtBuild_PcdMaximumAsciiStringLength) + 1) <= (_gPcd_FixedAtBuild_PcdMaximumA" - "sciiStringLength))"); - n1000000_1 = 1000000; /*0xffc*/ - } - v16 = sub_D0C(v5, n1000000_1 + 1); /*0x100a*/ - if ( v16 > v17 ) /*0x1015*/ - return 0; /*0x1015*/ - n2_1 = 1; /*0x101b*/ - n0xFFFF = 255; /*0x1021*/ - } - n2_2 = n2_1; /*0x1029*/ - if ( v9 ) /*0x1030*/ - { - v8 &= -(__int64)(n0xF4240 != 0); /*0x103b*/ - } - else if ( !n0xF4240 ) /*0x1043*/ - { - return 0; /*0x1043*/ - } - v18 = 0; /*0x1049*/ - v19 = 0; /*0x104b*/ - v101 = 0; /*0x104e*/ - v87 = 0; /*0x1052*/ - v89 = 0; /*0x1056*/ - if ( v8 ) /*0x105d*/ - { - v101 = v8; /*0x106a*/ - v18 = v8 + n2 * (n0xF4240 - 1); /*0x106e*/ - v89 = v18; /*0x1071*/ - } - if ( n2_1 == 1 ) /*0x1079*/ - LODWORD(v20) = 0; /*0x107b*/ - else - LODWORD(v20) = (char)v5[1] << 8; /*0x1083*/ - v21 = *v5; /*0x1086*/ - v20 = (int)v20; /*0x1089*/ -LABEL_243: - n10 = n0xFFFF & (v20 | v21); /*0x1c30*/ - n13 = n10; /*0x1c3a*/ - if ( n10 ) - { - v22 = v5; /*0x1090*/ - v23 = v5; /*0x1093*/ - if ( !v8 || v8 < v18 ) - { - v96 = 0; /*0x10a4*/ - v24 = 0; /*0x10a9*/ - v98 = 0; /*0x10ac*/ - v6 &= 0x2140u; /*0x10b2*/ - n43_1 = 0; /*0x10b9*/ - v25 = 0; /*0x10bc*/ - v105 = v6; /*0x10bf*/ - v107 = 0; /*0x10c3*/ - v26 = 1; /*0x10c9*/ - v93 = 1; /*0x10ce*/ - v91 = 0; /*0x10d6*/ - if ( n10 == 10 ) /*0x10de*/ - { - v5 += n2_1; /*0x189b*/ - _r_n_1 = "\r\n"; /*0x189e*/ - if ( n2_1 == 1 ) /*0x18a8*/ - v59 = 0; /*0x18aa*/ - else - v59 = (char)v5[1] << 8; /*0x18b2*/ - n13 = n0xFFFF & (*v5 | (unsigned __int64)v59); /*0x18c6*/ - if ( n13 != 13 ) /*0x18ca*/ - v5 = v22; /*0x18ca*/ - v106 = v5; /*0x18ce*/ - goto LABEL_91; /*0x18d2*/ - } - if ( n10 == 13 ) /*0x10e8*/ - { - v5 += n2_1; /*0x1869*/ - v106 = v5; /*0x186c*/ - if ( n2_1 == 1 ) /*0x1873*/ - v42 = 0; /*0x1875*/ - else - v42 = (char)v5[1] << 8; /*0x1880*/ -LABEL_97: - n13 = n0xFFFF & (*v5 | (unsigned __int64)v42); /*0x13b5*/ - if ( n13 == 10 ) /*0x13c9*/ - { - _r_n_1 = "\r\n"; /*0x13cf*/ - } - else - { - _r_n_1 = "\r"; /*0x1888*/ - v106 = v23; /*0x188f*/ - v5 = v23; /*0x1893*/ - } - goto LABEL_91; /*0x13d6*/ - } - if ( n10 != 37 ) /*0x10f2*/ - { - LOWORD(v6) = v6 | 0x400; /*0x10f4*/ - _r_n_1 = (const char *)&n13; /*0x10f9*/ - v105 = v6; /*0x10fd*/ - goto LABEL_91; /*0x1101*/ - } - v28 = a5; /*0x1106*/ - while ( 1 ) - { - while ( 1 ) - { - v29 = v5; /*0x1113*/ - v5 += n2_1; /*0x1116*/ - v106 = v5; /*0x1119*/ - v30 = n2_1 == 1 ? 0 : (char)v5[1] << 8; - n13_1 = n0xFFFF & (v30 | (unsigned __int64)*v5); /*0x1136*/ - n13 = n13_1; /*0x1139*/ - if ( n13_1 > 0x2D ) /*0x1141*/ - break; /*0x1141*/ - switch ( n13_1 ) - { - case 0x2DuLL: - v6 |= 1uLL; /*0x11f4*/ - goto LABEL_76; /*0x11f8*/ - case 0uLL: - v26 = 0; /*0x12b6*/ - v106 = v29; /*0x12b8*/ - v93 = 0; /*0x12bc*/ - v5 = v29; /*0x12c0*/ -LABEL_78: - v34 = v5; /*0x12c3*/ - v23 = v5; /*0x12c6*/ - if ( n13_1 > 0x67 ) /*0x12cd*/ - { - v48 = n13_1 - 112; /*0x1500*/ - if ( v48 ) /*0x1504*/ - { - v49 = v48 - 2; /*0x150a*/ - if ( v49 ) /*0x150e*/ - { - v50 = v49 - 1; /*0x1514*/ - if ( !v50 ) /*0x1518*/ - { -LABEL_119: - LOWORD(v6) = v6 | 0x400; /*0x15cc*/ - v105 = v6; /*0x15d1*/ -LABEL_120: - _r_n_1 = (const char *)*v28; /*0x15da*/ - a5 = v28 + 1; /*0x15e1*/ - if ( !*v28 ) /*0x15da*/ - { - LOWORD(v6) = v6 & 0xFBFF; /*0x15fa*/ - _r_n_1 = ""; /*0x15ff*/ - v105 = v6; /*0x1606*/ - } - v26 &= -(__int64)((v6 & 0x800) != 0); /*0x1618*/ - goto LABEL_90; /*0x161b*/ - } - v51 = v50 - 1; /*0x151e*/ - if ( v51 ) /*0x1522*/ - { - n3 = v51 - 1; /*0x1524*/ - if ( n3 ) /*0x1528*/ - { - if ( n3 != 3 ) /*0x1532*/ - goto LABEL_114; /*0x1532*/ - goto LABEL_132; /*0x1532*/ - } - goto LABEL_133; /*0x1528*/ - } - a5 = v28 + 1; /*0x154d*/ - if ( !*v28 ) /*0x1546*/ - { - v24 = v91; /*0x1566*/ - _r_n_1 = ""; /*0x156a*/ - goto LABEL_90; /*0x1571*/ - } - sub_1CD0( /*0x15b6*/ - _r_n, - 38, - 0, - "%02d/%02d/%04d %02d:%02d", - *((unsigned __int8 *)*v28 + 2), - *((unsigned __int8 *)*v28 + 3), - **v28, - *((unsigned __int8 *)*v28 + 4), - *((unsigned __int8 *)*v28 + 5)); - _r_n_1 = _r_n; /*0x15bb*/ -LABEL_118: - v24 = v91; /*0x15bf*/ - v25 = 0; /*0x15c3*/ - goto LABEL_90; /*0x15c7*/ - } - n5 = *v28; /*0x1625*/ - a5 = v28 + 1; /*0x162c*/ - _r_n_1 = _r_n; /*0x1640*/ - if ( (__int64)*v28 >= 0 ) /*0x1647*/ - { - if ( (unsigned __int64)n5 <= 5 ) /*0x1675*/ - { - _r_n_1 = off_8C70[(_QWORD)n5];// "Success" /*0x167e*/ - goto LABEL_128; /*0x167e*/ - } - } - else if ( ((unsigned __int64)n5 & 0x7FFFFFFFFFFFFFFFLL) - 1 <= 0x20 ) /*0x1661*/ - { - _r_n_1 = off_8C70[(_QWORD)n5 + 5];// "Success" /*0x166a*/ -LABEL_128: - if ( _r_n_1 != _r_n ) /*0x1689*/ - goto LABEL_90; /*0x1689*/ - } - sub_1CD0(_r_n, 38, 0, "%08X", (_DWORD)n5); /*0x16a6*/ - goto LABEL_118; /*0x16ab*/ - } - LOWORD(v6) = v6 & 0xFFC9 | 0x10; /*0x16b4*/ -LABEL_131: - LOWORD(v6) = v6 | 0x20; /*0x16b8*/ -LABEL_132: - LOWORD(v6) = v6 | 0x80; /*0x16bc*/ -LABEL_133: - if ( (v6 & 0x80u) == 0LL ) /*0x16c4*/ - LOWORD(v6) = v6 & 0xBFFD | 0x4000; /*0x16ca*/ -LABEL_135: - if ( (v6 & 0x10) != 0 ) /*0x16d5*/ - v54 = (__int64)*v28; /*0x16fa*/ - else - v54 = *(int *)v28; /*0x16dc*/ - a5 = v28 + 1; /*0x16e3*/ - n43 = (8 * v6) & 0x20; /*0x171d*/ - if ( (v6 & 2) != 0 ) /*0x172a*/ - n43 = 43; /*0x172a*/ - n43_1 = n43; /*0x1734*/ - v56 = (v6 & 8) != 0; /*0x1738*/ - v107 = v56; /*0x173c*/ - if ( (v6 & 0x80u) != 0LL ) /*0x1746*/ - { - v56 = 0; /*0x1789*/ - n16 = 16; /*0x178c*/ - v107 = 0; /*0x1792*/ - if ( (v6 & 0x10) != 0 || v54 >= 0 ) /*0x17a1*/ - goto LABEL_151; /*0x17a1*/ - } - else - { - n16 = 10; /*0x1748*/ - if ( (v6 & 8) != 0 ) /*0x1751*/ - { - LOWORD(v6) = v6 & 0xFFDF; /*0x1753*/ - v26 = 1; /*0x1757*/ - } - if ( v54 < 0 && (v6 & 0x4000) == 0 ) /*0x1765*/ - { - LOWORD(v6) = v6 | 2; /*0x1767*/ - n43 = 45; /*0x176b*/ - n43_1 = 45; /*0x176e*/ - v54 = -v54; /*0x1772*/ -LABEL_151: - v24 = sub_D94(_r_n, v54, n16) - (_QWORD)_r_n; /*0x17a5*/ - v91 = v24; /*0x17bb*/ - if ( !v54 ) /*0x17c2*/ - { - v24 &= -(__int64)(v26 != 0); /*0x17cd*/ - v91 = v24; /*0x17d0*/ - } - _r_n_1 = &_r_n[v24]; /*0x17e2*/ - v58 = 3 - v24 % 3; /*0x17fd*/ - if ( !(v24 % 3) ) /*0x17fa*/ - v58 = 0; /*0x1803*/ - v98 = v58; /*0x1807*/ - if ( v56 && v24 ) /*0x1813*/ - { - v24 += (v24 - 1) / 3; /*0x1822*/ - v58 = v98; /*0x1825*/ - v91 = v24; /*0x1829*/ - } - if ( n43 ) /*0x1830*/ - { - v91 = ++v24; /*0x1835*/ - ++v26; /*0x1839*/ - } - LOWORD(v6) = v6 | 0x1000; /*0x183c*/ - v25 = 1; /*0x1841*/ - v105 = v6; /*0x1847*/ - if ( (v6 & 0xA21) == 0x220 ) /*0x1856*/ - { - v26 = (unsigned __int64)v96; /*0x185c*/ - v98 = v58; /*0x1860*/ - } - goto LABEL_90; /*0x1864*/ - } - if ( (v6 & 0x4010) != 0x4000 ) /*0x1785*/ - goto LABEL_151; /*0x1785*/ - } - v54 = (unsigned int)v54; /*0x17a3*/ - goto LABEL_151; /*0x17a3*/ - } - if ( n13_1 == 103 ) /*0x12d3*/ - { - v44 = (unsigned __int8 *)*v28; /*0x142a*/ - a5 = v28 + 1; /*0x1431*/ - if ( *v28 ) /*0x142a*/ - { - v45 = sub_2B6C(v44, v5, v5); /*0x1466*/ - v46 = (unsigned __int16)sub_2B34(v44 + 4); /*0x1472*/ - v47 = sub_2B34(v44 + 6); /*0x1476*/ - sub_1CD0( /*0x14e6*/ - _r_n, - 38, - 0, - "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - v45, - v46, - v47, - v44[8], - v44[9], - v44[10], - v44[11], - v44[12], - v44[13], - v44[14], - v44[15]); - v24 = v91; /*0x14eb*/ - _r_n_1 = _r_n; /*0x14ef*/ - v25 = 0; /*0x14f3*/ - v5 = v106; /*0x14f7*/ - } - else - { - _r_n_1 = ""; /*0x144a*/ - } - v26 = v93; /*0x1451*/ - goto LABEL_90; /*0x1455*/ - } - v35 = n13_1 - 10; /*0x12d9*/ - if ( !v35 ) /*0x12dd*/ - { - v5 += n2_1; /*0x13db*/ - _r_n_1 = "\r\n"; /*0x13de*/ - v106 = v5; /*0x13e5*/ - if ( n2_1 == 1 ) /*0x13ed*/ - v43 = 0; /*0x13ef*/ - else - v43 = (char)v5[1] << 8; /*0x13f7*/ - v19 = v87; /*0x13fa*/ - n13 = n0xFFFF & (*v5 | (unsigned __int64)v43); /*0x140b*/ - if ( n13 != 13 ) /*0x1413*/ - { - v5 = v34; /*0x1419*/ - v106 = v34; /*0x141c*/ - } - goto LABEL_91; /*0x1420*/ - } - v36 = v35 - 3; /*0x12e3*/ - if ( !v36 ) /*0x12e7*/ - { - v5 += n2_1; /*0x1399*/ - v106 = v5; /*0x139c*/ - if ( n2_1 == 1 ) /*0x13a4*/ - v42 = 0; /*0x13a6*/ - else - v42 = (char)v5[1] << 8; /*0x13ae*/ - v19 = v87; /*0x13b1*/ - goto LABEL_97; /*0x13b1*/ - } - v37 = v36 - 70; /*0x12ed*/ - if ( !v37 ) /*0x12f1*/ - goto LABEL_119; /*0x12f1*/ - v38 = v37 - 5; /*0x12f7*/ - if ( !v38 ) /*0x12fb*/ - goto LABEL_131; /*0x12fb*/ - v39 = v38 - 9; /*0x1301*/ - if ( !v39 ) /*0x1305*/ - goto LABEL_120; /*0x1305*/ - v40 = v39 - 2; /*0x130b*/ - if ( !v40 ) /*0x130f*/ - { - a5 = v28 + 1; /*0x132d*/ - v99 = *(unsigned __int16 *)v28; /*0x1342*/ - _r_n_1 = (const char *)&v99; /*0x1346*/ - goto LABEL_89; /*0x1346*/ - } - if ( v40 == 1 ) /*0x1315*/ - goto LABEL_135; /*0x1315*/ -LABEL_114: - _r_n_1 = (const char *)&n13; /*0x1538*/ -LABEL_89: - LOWORD(v6) = v6 | 0x400; /*0x134a*/ - v105 = v6; /*0x134f*/ -LABEL_90: - v19 = v87; /*0x1353*/ -LABEL_91: - v41 = (v6 & 0x400) != 0 ? 0xFFFFLL : 255LL; - if ( (v6 & 0x1000) != 0 ) /*0x1387*/ - { - v104 = ((unsigned __int128)-(__int128)(v6 & 0x400) >> 64) - 1; /*0x1390*/ - } - else - { - v24 = 0; /*0x18d7*/ - for ( i = _r_n_1; ; i += 1 - ((unsigned __int128)-(__int128)(v6 & 0x400) >> 64) ) /*0x18da*/ - { - if ( v24 >= v26 ) /*0x18e0*/ - { - v104 = 1 - ((unsigned __int128)-(__int128)(v6 & 0x400) >> 64); /*0x18e2*/ - if ( (v6 & 0x800) != 0 ) /*0x18eb*/ - break; /*0x18eb*/ - } - v104 = 1 - ((unsigned __int128)-(__int128)(v6 & 0x400) >> 64); /*0x18ff*/ - if ( ((*(unsigned __int8 *)i | (unsigned __int64)(i[1] << 8)) & v41) == 0 ) /*0x1906*/ - break; /*0x1906*/ - ++v24; /*0x1908*/ - } - v91 = v24; /*0x1910*/ - } - if ( v26 < v24 ) /*0x191a*/ - v26 = v24; /*0x191a*/ - n512 = v6 & 0x201; /*0x191e*/ - v94 = v26; /*0x1925*/ - n512_1 = n512; /*0x1929*/ - if ( n512 != 512 || (v87 = n2 * ((_QWORD)v96 - v26) + v19, (v6 & 0x2000) != 0) ) /*0x1953*/ - { - v62 = v89; /*0x197a*/ - } - else - { - v62 = v89; /*0x1955*/ - if ( v8 ) /*0x195c*/ - { - v63 = sub_D60(v8, v89, (int)v96 - (int)v26, 32, n2); /*0x196c*/ - v24 = v91; /*0x1971*/ - v8 = v63; /*0x1975*/ - } - } - v64 = v87; /*0x197e*/ - if ( v25 ) /*0x1985*/ - { - if ( !n43_1 || (v64 = n2 + v87, v88 = v64, (v6 & 0x2000) != 0) ) /*0x19a1*/ - { - v65 = v89; /*0x19de*/ - } - else - { - v65 = v89; /*0x19a3*/ - if ( v8 ) /*0x19aa*/ - { - for ( j = 0; j < 1; ++j ) /*0x19b0*/ - { - if ( v8 >= v89 ) /*0x19b5*/ - break; /*0x19b5*/ - *(_BYTE *)v8 = n43_1; /*0x19b7*/ - if ( n2 != 1 ) /*0x19bf*/ - *(_BYTE *)(v8 + 1) = 0; /*0x19c8*/ - v8 += n2; /*0x19cc*/ - } - v64 = v88; /*0x19d8*/ - } - } - n2_3 = n2; /*0x19e2*/ - v68 = v26 - v24; /*0x19e9*/ - v87 = n2 * (v26 - v24) + v64; /*0x19f9*/ - v69 = v6 & 0x2000; /*0x19fd*/ - if ( (v6 & 0x2000) == 0 && v8 ) /*0x1a08*/ - v8 = sub_D60(v8, v65, v68, (int)v69 + 48, n2); /*0x1a1e*/ - goto LABEL_199; /*0x1a1e*/ - } - n2_3 = n2; /*0x1b6a*/ - v79 = v26 - v24; /*0x1b71*/ - v80 = n2 * (v26 - v24) + v87; /*0x1b7e*/ - v87 = v80; /*0x1b81*/ - v69 = v6 & 0x2000; /*0x1b85*/ - if ( (v6 & 0x2000) == 0 && v8 ) /*0x1b90*/ - { - v81 = sub_D60(v8, v62, v79, (int)v69 + 32, n2); /*0x1b9e*/ - v80 = v87; /*0x1ba3*/ - v8 = v81; /*0x1ba7*/ - } - if ( !n43_1 || (v87 = n2_3 + v80, (v6 & 0x2000) != 0) ) /*0x1bbf*/ - { -LABEL_199: - v70 = v89; /*0x1a21*/ - } - else - { - v70 = v89; /*0x1bc5*/ - if ( v8 ) /*0x1bcc*/ - { - for ( k = 0; k < 1; ++k ) /*0x1bd5*/ - { - if ( v8 >= v89 ) /*0x1bda*/ - break; /*0x1bda*/ - *(_BYTE *)v8 = n43_1; /*0x1be0*/ - if ( n2_3 != 1 ) /*0x1be8*/ - *(_BYTE *)(v8 + 1) = 0; /*0x1bf1*/ - v8 += n2_3; /*0x1bf5*/ - } - } - } - v71 = n43_1 != 0; /*0x1a30*/ - if ( v71 < v91 ) /*0x1a36*/ - { - v72 = v87; /*0x1a40*/ - v73 = v98; /*0x1a44*/ - do /*0x1af2*/ - { - v72 += n2_3; /*0x1a53*/ - v74 = v41 & *(_WORD *)_r_n_1; /*0x1a60*/ - if ( !v69 && v8 ) /*0x1a6b*/ - { - v75 = v89; /*0x1a6d*/ - for ( m = 0; m < 1; ++m ) /*0x1a71*/ - { - if ( v8 >= v75 ) /*0x1a77*/ - break; /*0x1a77*/ - *(_BYTE *)v8 = v74; /*0x1a79*/ - if ( n2_3 != 1 ) /*0x1a81*/ - { - *(_BYTE *)(v8 + 1) = HIBYTE(v74); /*0x1a8a*/ - v75 = v89; /*0x1a8e*/ - } - v8 += n2_3; /*0x1a92*/ - } - v70 = v89; /*0x1a9e*/ - } - _r_n_1 += v104; /*0x1aa2*/ - ++v71; /*0x1aa5*/ - if ( v107 && ++v73 == 3 ) /*0x1ab4*/ - { - v73 = 0; /*0x1ab6*/ - if ( ++v71 >= v91 ) /*0x1abe*/ - break; /*0x1abe*/ - v72 += n2_3; /*0x1ac0*/ - if ( !v69 && v8 ) /*0x1acb*/ - { - for ( n = 0; n < 1; ++n ) /*0x1acd*/ - { - if ( v8 >= v70 ) /*0x1ad2*/ - break; /*0x1ad2*/ - *(_BYTE *)v8 = 44; /*0x1ad4*/ - if ( n2_3 != 1 ) /*0x1add*/ - *(_BYTE *)(v8 + 1) = 0; /*0x1adf*/ - v8 += n2_3; /*0x1ae3*/ - } - } - } - } - while ( v71 < v91 ); /*0x1af2*/ - LOWORD(v6) = v105; /*0x1af8*/ - v5 = v106; /*0x1afc*/ - v87 = v72; /*0x1b00*/ - n512 = n512_1; /*0x1b04*/ - } - v19 = v87; /*0x1b08*/ - if ( n512 != 513 || (v19 = n2_3 * ((_QWORD)v96 - v94) + v87, v87 = v19, v69) ) /*0x1b32*/ - { - v18 = v89; /*0x1c06*/ - } - else - { - v18 = v89; /*0x1b38*/ - if ( v8 ) /*0x1b3f*/ - { - v78 = sub_D60(v8, v89, (int)v96 - (int)v94, 32, n2_3); /*0x1b59*/ - v19 = v87; /*0x1b5e*/ - v8 = v78; /*0x1b62*/ - } - } - n2_1 = n2_2; /*0x1c0a*/ - v5 += n2_2; /*0x1c0e*/ - v106 = v5; /*0x1c11*/ - if ( n2_2 == 1 ) /*0x1c19*/ - v83 = 0; /*0x1c1b*/ - else - v83 = (char)v5[1] << 8; /*0x1c23*/ - v21 = v83; /*0x1c2a*/ - v20 = *v5; /*0x1c2d*/ - goto LABEL_243; /*0x1c2d*/ - case 0x20uLL: - v6 |= 4uLL; /*0x11eb*/ - goto LABEL_76; /*0x11ef*/ - } - if ( n13_1 != 42 ) /*0x1167*/ - { - if ( n13_1 == 43 ) /*0x116d*/ - { - v6 |= 2uLL; /*0x1182*/ - } - else - { - if ( n13_1 != 44 ) /*0x1173*/ - goto LABEL_78; /*0x1173*/ - v6 |= 8uLL; /*0x1179*/ - } - goto LABEL_76; /*0x117d*/ - } - if ( (v6 & 0x800) != 0 ) /*0x118e*/ - { - v26 = (unsigned __int64)*v28++; /*0x11c7*/ - a5 = v28; /*0x11ce*/ - v93 = v26; /*0x11e2*/ - } - else - { - v6 |= 0x200uLL; /*0x1190*/ - v105 = v6; /*0x1195*/ - v32 = *v28++; /*0x119e*/ - a5 = v28; /*0x11a5*/ - v96 = v32; /*0x11b9*/ - } - } - if ( n13_1 == 46 ) /*0x1201*/ - { - v6 |= 0x800uLL; /*0x12aa*/ - goto LABEL_76; /*0x12aa*/ - } - if ( n13_1 == 48 ) /*0x120b*/ - break; /*0x120b*/ - if ( n13_1 <= 0x30 ) /*0x120d*/ - goto LABEL_78; /*0x120d*/ - if ( n13_1 <= 0x39 ) - { -LABEL_66: - v24 = 0; /*0x123c*/ - do - { - if ( n13_1 > 0x39 ) /*0x124d*/ - break; /*0x124d*/ - v5 += n2_1; /*0x1253*/ - v24 = n13_1 + 2 * (5 * v24 - 24); /*0x125a*/ - v33 = n2_1 == 1 ? 0 : (char)v5[1] << 8; - n13_1 = n0xFFFF & (v33 | (unsigned __int64)*v5); /*0x1277*/ - } - while ( n13_1 >= 0x30 ); - v91 = v24; /*0x1280*/ - v5 -= n2_1; /*0x1284*/ - if ( (v6 & 0x800) != 0 ) /*0x128a*/ - { - v26 = v24; /*0x129e*/ - v93 = v24; /*0x12a1*/ - } - else - { - v6 |= 0x200uLL; /*0x128c*/ - v96 = (unsigned __int16 *)v24; /*0x1291*/ - v105 = v6; /*0x1295*/ - } - } - else - { - if ( ((n13_1 - 76) & 0xFFFFFFFFFFFFFFDFuLL) != 0 ) /*0x1223*/ - goto LABEL_78; /*0x1223*/ - v6 |= 0x10uLL; /*0x1229*/ -LABEL_76: - v105 = v6; /*0x12ad*/ - } - } - if ( (v6 & 0x800) == 0 ) /*0x1232*/ - { - v6 |= 0x20uLL; /*0x1234*/ - v105 = v6; /*0x1238*/ - } - goto LABEL_66; /*0x1238*/ - } - } - if ( (v6 & 0x2000) != 0 ) /*0x1c49*/ - return v19 / n2; /*0x1c53*/ - if ( !v8 ) /*0x1c64*/ - sub_788("e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", 1216, "Buffer != ((void *) 0)"); /*0x1c79*/ - v85 = (_BYTE *)v8; /*0x1c81*/ - for ( ii = 0; ii < 1; ++ii ) /*0x1c84*/ - { - if ( (unsigned __int64)v85 >= n2 + v18 ) /*0x1c8d*/ - break; /*0x1c8d*/ - *v85 = 0; /*0x1c8f*/ - if ( n2 != 1 ) /*0x1c96*/ - v85[1] = 0; /*0x1c98*/ - v85 += n2; /*0x1c9c*/ - } - return (__int64)(v8 - v101) / n2; /*0x1cbc*/ -} \ No newline at end of file diff --git a/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.c b/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.c index b596ff2..a1398d5 100644 --- a/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.c +++ b/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.c @@ -591,9 +591,9 @@ // // Check if context (unk_23560) has setjmp/longjmp already set up. - // The context helper performs a setjmp(context) - returns 0 on success. + // SetupAcpiSmmJumpRecovery performs a setjmp(context) - returns 0 on success. // - if (!sub_2C0(&unk_23560)) { + if (!SetupAcpiSmmJumpRecovery(&unk_23560)) { // // Context was not initialized, so this is first entry. // Call the full driver entry.