# LnvDriverDxe

- **Module:** 0086
- **File:** LnvDriverDxe.efi
- **Size:** 16288 bytes (0x3FA0)
- **Phase:** DXE (Driver Execution Environment)
- **MD5:** 46b59da810d2a20676c5355f77381c78
- **SHA256:** 67475b45ed48c5b3d20257696d55483b9b60727e15402b795dff2557483ff06d
- **Source package:** LenovoServerPkg

## Overview

Lenovo Server DXE driver implementing IPMI-based platform management. It provides boot-time initialization, ReadyToBoot and ExitBootServices event handling, periodic platform configuration via the LnvSetup UEFI variable, boot current tracking, and IPMI transport protocol management. The driver registers timer callbacks that read LnvSetup configuration bytes and send corresponding IPMI commands (netfn 0x80, cmd 0x8258) for fan control and other platform settings.

## Key Functions

| Function | Description |
|---|---|
| `_ModuleEntryPoint` | UEFI driver entry point; initializes globals then calls main init |
| `LnvDriverDxeInitGlobals` | Stores ImageHandle/SystemTable/BootServices/RuntimeServices; locates or registers for IPMI transport protocol |
| `LnvDriverDxeInit` | Creates ReadyToBoot and ExitBootServices notification events; creates two 1-second periodic timer events for LnvSetup config callbacks |
| `OnReadyToBoot` | ReadyToBoot callback; reads LnvSetup offset 5, sends IPMI command 0x8258 for fan control config |
| `OnExitBootServices` | ExitBootServices callback; applies final configuration via LnvSetupConfigCallback1 and closes the event |
| `LnvSetupConfigCallback0` | Periodic timer callback; reads LnvSetup offset 6, sends IPMI command |
| `LnvSetupConfigCallback1` | Periodic timer callback; reads LnvSetup offset 7, sends IPMI command |
| `IpmiSendCommand` | Sends IPMI command via the transport protocol |
| `GetProtocolInterface` | Locates and caches the debug protocol interface |
| `DebugPrint` | Debug print via protocol interface with level filtering |
| `DebugAssert` | Low-level assertion handler via debug protocol |
| `GetHobList` | Retrieves HOB list pointer from system table |
| `GetDebugLevel` | Reads current debug level from CMOS index 0x4B |

## Protocols/Dependencies

- **UefiBootServicesTableLib** - Boot services table access
- **UefiRuntimeServicesTableLib** - Runtime services table access
- **LnvIpmiLib** - Lenovo IPMI command library
- **HobLib** - HOB list retrieval
- **DebugLib** - Debug output support
- IPMI Transport Protocol (gLnvIpmiTransportProtocolGuid) - IPMI command transport
- LnvDriverDxe Protocol (gLnvDriverDxeProtocolGuid) - Self-published protocol interface
- LnvSetup UEFI variable (NV format) - Platform configuration storage

## Platform

Lenovo ThinkSystem HR650X (Purley platform, Intel Xeon Scalable)