# LnvDriverDxe

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **GetDebugLevel** |  |
|  | **_ModuleEntryPoint** |  |
|  | **LnvDriverDxeInitGlobals** |  |
|  | **LnvDriverDxeInit** |  |
|  | **OnReadyToBoot** |  |
|  | **LnvSetupConfigCallback0** |  |
|  | **LnvSetupConfigCallback1** |  |
|  | **OnExitBootServices** |  |
|  | **DebugPrint** |  |
|  | **DebugAssert** |  |
|  | **InstallProtocolInterface** |  |
|  | **UnicodeSPrint** |  |
|  | **UnicodeVSPrint** |  |
|  | **DsBootCurrentName** |  |
|  | **DebugLogPrint** |  |
|  | **IpmiTransportInit** |  |
|  | **IpmiTransportLocate** |  |
|  | **IpmiSendCommand** |  |
|  | **IpmiTransportSendCommand** |  |
|  | **StrLen** |  |
|  | **ReadUnaligned16** |  |
|  | **ReadUnaligned64** |  |
|  | **StrnLenS** |  |
|  | **AsciiStrLen** |  |
|  | **CompareGuid** |  |
|  | **AsciiSPrintWithTimestamp** |  |
|  | **AsciiVSPrint** |  |
|  | **AsciiSPrint** |  |
| Global | **data** |  |
| STATIC | **EFI_HANDLE  gImageHandle = NULL;** |  |
| Global | **variables for protocol interfaces** |  |
| STATIC | **VOID   *gProtocolInterface = NULL;     // qword_3C60** |  |
| qword_3C68 | **STATIC UINT64  gBootServicesPtr = 0;          // qword_3C70** |  |
| qword_3C78 | **STATIC UINT64  gSystemTablePtr = 0;           // qword_3C80** |  |
| qword_3C88 | **STATIC VOID   *gIpmiTransportProtocol = NULL;  // qword_3C90** |  |
| byte_3C98 | **//** |  |
| GUID | **definitions (from .rdata section)** |  |
| EFI_GUID | **gLnvDriverDxeProtocolGuid = { 0x9894A3A0, 0x440C, 0x4A8C, { 0x8F, 0x55, 0x35, 0x6E, 0x5F, 0x2E, 0xCE, 0x71 } };** |  |
| Forward | **declarations of local helper functions** |  |
| STATIC | **UINTN** |  |
| _ModuleEntryPoint | **// ============================================================================** |  |
| LnvDriverDxeInitGlobals | **(sub_3AC)** |  |
| Get | **the HOB list** |  |
| GetHobList | **();** |  |
| Locate | **or install the IPMI transport protocol** |  |
| Status | **= gBS->LocateProtocol (** |  |
| Protocol | **not found; register callback for when it becomes available** |  |
| EfiEventGroupSignal | **(&gLnvDriverDxeProtocolGuid);** |  |
| LnvDriverDxeInit | **(sub_64C)** |  |
| Create | **ReadyToBoot event** |  |
| Status | **= gBS->CreateEventEx (** |  |
| Create | **ExitBootServices event** |  |
| Create | **periodic timer event for configuration callback (index 0)** |  |
| Status | **= gBS->CreateEvent (** |  |
| Create | **periodic timer event for configuration callback (index 1)** |  |
| Apply | **initial LnvSetup configuration** |  |
| VariableSize | **= 0;** |  |
| OnReadyToBoot | **(sub_4AC)** |  |
| LnvSetupConfigCallback0 | **(sub_518)** |  |
| LnvSetupConfigCallback1 | **(sub_584)** |  |
| OnExitBootServices | **(sub_60C)** |  |
| Apply | **final configuration** |  |
| LnvSetupConfigCallback1 | **(Event, Context);** |  |
| GetProtocolInterface | **(sub_810)** |  |
| Allocate | **a small page to test memory availability** |  |
| Pages | **= EFI_SIZE_TO_PAGES (31);** |  |
| DebugPrint | **(sub_890)** |  |
| Check | **if the debug level is enabled** |  |
| Status | **= GetDebugLevel ();** |  |
| Call | **the protocol's debug print function (at offset +16)** |  |
| VA_END | **(VaListMarker);** |  |
| DebugAssert | **(sub_8D8)** |  |
| Call | **the protocol's assert function (at offset +8)** |  |
| GetHobList | **(sub_918)** |  |
| Get | **the number of configuration table entries** |  |
| Count | **= gST->NumberOfTableEntries;** |  |
| Search | **for the HOB list GUID in the configuration table** |  |
| for | **(Index = 0; Index < Count; Index++) {** |  |
| Verify | **the HOB list was found** |  |
| if | **(gHobList == 0) {** |  |
| InstallProtocolInterface | **(sub_9F0)** |  |
| IntToString | **(sub_A48)** |  |
| Lowercase | **hex** |  |
| StrToInt32 | **(sub_ABC)** |  |
| Skip | **leading whitespace (space = 0x20, tab = 0x09)** |  |
| while | **(*Str == 0x20 || *Str == 0x09) {** |  |
| Check | **for sign** |  |
| if | **(*Str == '-') {** |  |
| Parse | **digits** |  |
| while | **(TRUE) {** |  |
| StatusToString | **(sub_B94)** |  |
| if | **(Index >= 3) {** |  |
| if | **(Index > 2) {** |  |
| Standard | **EFI errors** |  |
| if | **(Index > 0x1E) {** |  |
| Warning | **codes** |  |
| if | **((Status & 0x2000000000000000ULL) == 0) {** |  |
| UnicodeSPrint | **(sub_C5C)** |  |
| UnicodeVSPrint | **(sub_C84)** |  |
| Implementation | **follows the standard UEFI VSPrint pattern.** |  |
| See | **MdePkg/Library/BasePrintLib/PrintLibInternal.c for reference.** |  |
| Process | **format string character by character** |  |
| FormatStr | **= Format;** |  |
| Regular | **character, copy to output** |  |
| Escaped | **percent** |  |
| Parse | **format specifier** |  |
| UINTN | **Width = 0;** |  |
| Parse | **numeric width** |  |
| CONST | **CHAR16 *ParseEnd;** |  |
| Handle | **format type** |  |
| switch | **(*FormatStr) {** |  |
| GUID | **format: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x** |  |
| EFI_GUID | ***Guid;** |  |
| Uppercase | **the hex letters** |  |
| for | **(UINTN i = 0; GuidStr[i] != L'\0'; i++) {** |  |
| EFI | **Status code** |  |
| EFI_STATUS | **Status;** |  |
| Long | **prefix** |  |
| Fall | **through to handle d/i/x/X/p** |  |
| Convert | **to string** |  |
| CHAR8 | **DigitBuf[32];** |  |
| Generate | **digits in reverse** |  |
| do | **{** |  |
| Apply | **padding** |  |
| while | **(DigitCount < Width) {** |  |
| Copy | **digits in correct order** |  |
| DsBootCurrentName | **(sub_111C)** |  |
| Initialize | **the boot string buffer** |  |
| SetMem | **(BootString, 0, sizeof (BootString));** |  |
| Get | **the current boot option index** |  |
| BootCurrentSize | **= sizeof (BootCurrent);** |  |
| Build | **the BootXXXX variable name** |  |
| UnicodeSPrint | **(BootOptionName, sizeof (BootOptionName) / sizeof (CHAR16), L"Boot%04X", BootCurrent);** |  |
| Get | **the boot option variable data** |  |
| Variable | **exists; allocate buffer and read it** |  |
| The | **boot option description string starts at offset 6 in the** |  |
| EFI_LOAD_OPTION | **structure** |  |
| StringLen | **= StrLen ((CONST CHAR16 *)((UINTN)VariableData + 6));** |  |
| DebugLogPrint | **(sub_1348)** |  |
| Format | **the message into buffer** |  |
| VA_START | **(VaListMarker, Format);** |  |
| Truncate | **if too long** |  |
| if | **(Length > 230) {** |  |
| Get | **current time** |  |
| Build | **packet with timestamp** |  |
| PacketLength | **= AsciiSPrintWithTimestamp (** |  |
| Send | **packet via IPMI transport protocol** |  |
| ProtocolInterface | **= GetProtocolInterface ();** |  |
| Try | **to locate the protocol** |  |
| IpmiTransportInit | **(sub_1498)** |  |
| IpmiTransportLocate | **(sub_14F8)** |  |
| IpmiSendCommand | **(sub_1580)** |  |
| IpmiTransportSendCommand | **(sub_1580 helper)** |  |
| Call | **the protocol's SendCommand function at offset +16** |  |
| return | **EFI_SUCCESS;** |  |
| GetDebugLevel | **(sub_15B8)** |  |
| Read | **CMOS register 0x4B** |  |
| IoWrite8 | **(0x70, (IoRead8 (0x70) & 0x80) | 0x4B);** |  |
| Read | **platform-specific debug register** |  |
| DebugValue | **= (MmioRead8 (0xFDAF0490) & 2) | 1;** |  |
| 0x80000004 | **}** |  |
| StrLen | **(sub_1608)** |  |
| ReadUnaligned16 | **(sub_169C)** |  |
| ReadUnaligned64 | **(sub_16CC)** |  |
| StrnLenS | **(sub_16FC)** |  |
| AsciiStrLen | **(sub_1754)** |  |
| CompareGuid | **(sub_1778)** |  |
| AsciiSPrintWithTimestamp | **(sub_17E8)** |  |
| SetMem16 | **(sub_1810)** |  |
| UInt64ToStringReverse | **(sub_1844)** |  |
| AsciiVSPrint | **(sub_18BC)** |  |
| This | **function is the main VSPrint implementation.** |  |
| For | **the full decompiled source, see the IDA output.** |  |
| The | **implementation handles:** |  |
| return | **0;** |  |
| AsciiSPrint | **(sub_26C4)** |  |
| SetMem | **(sub_2740)** |  |
| Handle | **misaligned bytes** |  |
| UINTN | **AlignmentOffset;** |  |
| Write | **aligned 32-bit values** |  |
| AlignedCount | **= Length >> 2;** |  |
| Write | **remaining bytes** |  |
| while | **(Length > 0) {** |  |
| CopyMem | **(sub_27A0)** |  |
| Determine | **copy direction based on overlap** |  |
| BOOLEAN | **Reverse = FALSE;** |  |
| Src | **+= Length;** |  |
| Use | **accelerated copy for aligned buffers >= 8 bytes** |  |
| if | **(Length < 8 || ((UINTN)Src & 7) != ((UINTN)Dst & 7)) {** |  |
| Handle | **misaligned start** |  |
| if | **(Reverse) {** |  |
| Copy | **8-byte aligned blocks** |  |
| Count | **= Length >> 3;** |  |
| Count | **= Length & 7;** |  |

---
*Generated by HR650X BIOS Decompilation Project*