Newer
Older
AMI-Aptio-BIOS-Reversed / InventoryApp / InventoryApp.md
@Ajax Dong Ajax Dong 2 days ago 6 KB Init

InventoryApp

Function Table

Address Name Description
_ModuleEntryPoint
AsciiStrHexToUint64
StrLen
StrSize
SPrintf
DebugAssert
DebugPrint
HexCharToUint
Image size: 0x51a0 bytes
This module is a UEFI Shell-based System Inventory Diagnostic Tool.
It locates the gSystemInventoryProtocol (or gBmcSystemInventoryProtocol)
and dumps inventory data for CPU, DIMM, PCIe, and HDD subsystems.
File paths: e:\hs\MdePkg\Library...
Global variables
0x4EF0 EFI_SYSTEM_TABLE *gST; // 0x4EE8
0x4EF8 EFI_RUNTIME_SERVICES *gRT; // 0x4F00
0x4F28 (secondary copy)
0x4F38 (argument count)
0x4F40 (argument vector pointer)
0x4F10 (HOB list pointer)
0x4EE0 (debug output flag)
0x4F60 (output buffer)
System Inventory Protocol GUIDs
unk_49F0 = gSystemInventoryProtocolGuid
unk_4A00 = gSystemInventoryProtocol (protocol instance)
unk_4A10 = gSystemInventoryProtocol + 0 (HOB GUID data)
unk_4A18 = gSystemInventoryProtocol + 8
SYSTEM_INVENTORY_PROTOCOL Layout (size = 3402 = 0xD4A bytes)
Offset Size Field
0 85 BiosAndMEVersionInfo (BIOS/ME version info)
85 1 BmcDeviceInfoParamaterSelector
86 1 CpuCount
87 170 CpuInfo[] (85 bytes per CPU, max 2 CPUs)
257 1 DimmCount
258 2016 DimmInfo[] (84 bytes per DIMM, max 24 DIMMs)
2274 1 PciCount
2275 76 PciInfo[] (19 bytes per slot, max 4 slots)
2351 1 HddCount
2352 1050 HddInfo[] (75 bytes per HDD, max 14 HDDs)
SINGLE_CPU_INFO (85 bytes)
0 1 CoreCount
1 1 ThreadCount
2 13 CpuVendor (string)
15 30 CpuFamilyName (string)
45 30 CpuModelIdName (string)
75 10 Stepping (string)
4 MaxFrequency (UINT32, value in MHz)
DIMM_INFO (84 bytes)
0 1 DimmSlotIndex
1 1 NodeNumber
2 1 ChannelNumber
3 10 DimmType (string)
13 10 DdrVoltage (string)
23 4 DimmFreq (UINT32, value in MHz)
27 4 DimmSize (UINT32, value in MB)
29 2 (DWORD checksum/active field checked for non-zero)
31 4 (unused padding?)
35 10 ManufacturerIdName (string)
45 4 SerialNumber (4 bytes)
49 35 PartNumber (string)
PCI_INFO (19 bytes)
0 1 SlotIndex
1 1 PciType
2 1 BusNumber
3 1 DevFun
4 2 VendorId
6 2 DeviceId
8 2 SubSystemVendorId
10 2 SubSystemId
12 1 InterfaceType
13 1 SubClassCode
14 1 BaseClassCode
15 1 LinkSpeed
16 1 LinkWidth
17 2 (unused/checksum, checked for non-zero)
HDD_INFO (75 bytes)
0 1 DriveIndex
1 68 VendorId (string)
69 4 DriveSize (UINT32, in MB)
73 1 MediaType
75 1 Formfactor
77 1 SlotNumber
78 1 DeviceState
4 (UINT32 checksum at offset 65, checked for non-zero)
inventory protocol, and dumps inventory data for the requested
subsystem (cpu/dimm/pci/hdd).
Behavior modes (based on Argc/Argv):
Save global protocol pointers
Initialize HOB list
Initialize cached system table copies
Try alternate protocol
argc OffsetsTable = *Argv; // argv
Show struct layout info only
Check for "debug" keyword show full struct layout
determined by category below
Offset to CpuCount
Offset to DimmCount
Offset to PciCount
Offset to HddCount
same for CPU with indexed (argc==3) path...
Check debug flag
Library function: AsciiStrHexToUint64 (sub_2434)
Standard EDK2 implementation
Skips leading whitespace and '0x' prefix
Checks alignment, validates range, converts hex digits
Library function: StrLen (sub_256C)
PcdMaximumUnicodeStringLength if (!String[++Length])
overflow sentinel
Library function: StrSize (sub_22D0)
Null check, alignment check, length cap at 0xF4240
Library function: StrCmp (sub_2364)
Uses StrSize for validation, then character-by-character comparison
Library function: SPrintf / UnicodeBSPrint (sub_29E0)
Complex format string parser supporting:
Library function: StatusCodeToString (sub_28F0)
Returns string names for:
Library function: GetHobList (sub_26CC)
Reads HOB list from gST->HobList.Raw
Falls back to searching SystemTable configuration table
ASSERT on failure
Library function: DebugAssert (sub_268C)
Calls through to EFI_DEBUGGER_PROTOCOL assertion handler
Helper function: GetDebugProtocol (sub_25C4)
Uses gBS->AllocatePool, gBS->LocateProtocol to find the debug protocol
Cached in qword_4F08
Helper function: DebugPrint (sub_2644)
Checks error level against platform configuration (CMOS-based)
Library function: HexCharToUint (sub_2404)
uppercase return Char - 55; // 'A' - 10
Library function: Uint64ToString (sub_27A4)
Library function: AsciiStrHexToUintn (sub_2818)
Library function: UnicodeValueToString (sub_29B8)
Library function: UnicodeSPrint (sub_2E58)
Platform function: GetPlatformErrorLevel (sub_2E78)
Uses CMOS port 0x70/0x71 to read debug level from CMOS index 0x4B.
Also reads hardware register 0xFDAF0490 on certain CMOS values.
Library function: ReadUnaligned64 (sub_2F38)
Library function: HobGuidMatch (sub_2EC8)

Generated by HR650X BIOS Decompilation Project