# SecVariableControl

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **SecVariableControlDriverEntry** |  |
|  | **SaveDramFailDataToVariable** |  |
|  | **DebugProtocolInit** |  |
|  | **ReadUnaligned64** |  |
|  | **CompareGuid** |  |
|  | **GetDebugLevel** |  |
|  | **DebugBspPrint** |  |
|  | **DebugPrint** |  |
|  | **DebugAssert** |  |
|  | **GetDxeServicesTable** |  |
|  | **EntryDriverInit** |  |
|  | **ModuleEntryPoint** |  |
| Global | **variables (in .data section)** |  |
| EFI_SYSTEM_TABLE | ***gSystemTable       = NULL;** |  |
| Function | **prototypes** |  |
| EFI_STATUS | **EFIAPI** |  |
| SMM | **path: use pre-located SMM protocol handle** |  |
| DXE | **path** |  |
| Read | **CMOS offset 0x4B with NMI bit preserved** |  |
| IoWrite8 | **(0x70, (IoRead8 (0x70) & 0x80) | 0x4B);** |  |
| Sanitize | **format string: %s -> 'a', %g -> 'g'** |  |
| FormatCopy | **= (CHAR8 *)Format;** |  |
| 5 | **DIMMs x 42 x 3 x 8 bytes** |  |
| Zero | **out all slot data buffers** |  |
| ZeroMem | **(&StepResultHeader, sizeof(StepResultHeader));** |  |
| Get | **HOB list and locate the DRAM fail data HOB** |  |
| HobList | **= GetHobList ();** |  |
| Walk | **HOBs to find the matching GUID** |  |
| do | **{** |  |
| HOB | **data starts at offset 24 (EFI_HOB_GUID_TYPE header is 24 bytes)** |  |
| Each | **entry is 18 bytes** |  |
| HobData | **= (UINT8 *)GuidHob + sizeof(EFI_HOB_GUID_TYPE);** |  |
| Parse | **up to MAX_DRAM_FAIL_ENTRIES entries, distribute across up to 5 DIMMs** |  |
| EntryIndex | **= 0;** |  |
| Extract | **full DRAM address from HOB entry** |  |
| Log | **the failure** |  |
| DebugBspPrint | **(** |  |
| Log | **PPR result** |  |
| if | **(EntryFlags[EntryCount] == 1) {** |  |
| Advance | **entry counters** |  |
| Process | **bitmap pattern data (second pass)** |  |
| for | **(BitPosition = 0; BitPosition < 2; BitPosition++) {** |  |
| Bit | **test logic** |  |
| Write | **STEP_RESULT variable (184 bytes header)** |  |
| Write | **STEP_RESULT_NUM00 through NUM04** |  |
| Save | **UEFI handles and service table pointers** |  |
| gImageHandle | **= ImageHandle;** |  |
| Initialize | **HOB list pointer and DXE Services Table** |  |
| GetHobList | **();** |  |
| Locate | **DXE Services Table** |  |
| Status | **= GetDxeServicesTable (&gDxeServicesTable);** |  |

---
*Generated by HR650X BIOS Decompilation Project*