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

DevicePathDxe

Function Table

Address Name Description
GetDevicePathType
GetDevicePathSubType
GetDevicePathNodeLength
IsDevicePathEnd
IsDevicePathEndInstance
SetDevicePathNodeLength
DevicePathValid
DevicePathNodeLength
DevicePathType
DevicePathSubType
DevicePathStrSize
IsDevicePathMultiInstance
DevicePathNodeInstanceContain
CatDevicePathToTextStr
DevicePathDxeEntryPoint
SECTION 1: Device Path Node Access (DevicePathUtilities)
GetDevicePathType - Read Type byte from device path node
Equivalent to EDK2: DevicePathType(Node)
UINT8 GetDevicePathType(
GetDevicePathSubType - Read SubType byte from device path node
Equivalent to EDK2: DevicePathSubType(Node)
UINT8 GetDevicePathSubType(
GetDevicePathNodeLength - Read Length field from device path node
Equivalent to EDK2: DevicePathNodeLength(Node)
UINTN GetDevicePathNodeLength(
NextDevicePathNode - Advance to next device path node
EFI_DEVICE_PATH_PROTOCOL *
IsDevicePathEnd - Check if node type is END (0x7F)
BOOLEAN IsDevicePathEnd(
IsDevicePathEndInstance - Check for END + END_ENTIRE (0xFF)
BOOLEAN IsDevicePathEndInstance(
SetDevicePathNodeLength - Write Length field
UINT16 SetDevicePathNodeLength(
SetDevicePathEndInstance - Mark node as END of entire path
DevicePathValid - Validate entire device path mult-instance
Verifies each node length >= 4, no length overflow, ends with END
BOOLEAN DevicePathValid(
DevicePathNodeLength - Wrapper for GetDevicePathNodeLength with ASSERT
UINTN DevicePathNodeLength(
DevicePathType - Wrapper for GetDevicePathType with ASSERT
UINT8 DevicePathType(
DevicePathSubType - Wrapper for GetDevicePathSubType with ASSERT
UINT8 DevicePathSubType(
SECTION 2: Device Path Node Construction Helpers
CreateDevicePathNode - Allocate and initialize a device path node
SECTION 3: Device Path Manipulation (concatenate, append, etc.)
DevicePathStrSize - Return total size of device path in bytes
UINTN DevicePathStrSize(
Walk to END node
DuplicateDevicePath - Duplicate a device path
AppendDevicePath - Concatenate two device paths
AppendDevicePathNode - Append a single node to a device path
AppendDevicePathInstance - Append a second multi-instance path
with the END_INSTANCE separator
Overwrite the final END_ENTIRE with END_INSTANCE
SetDevicePathEndInstance ((EFI_DEVICE_PATH_PROTOCOL )Buffer - 1); / actually set subtype */
ExtractDevicePathInstanceFromText - Split a multi-instance path
Returns buffer of one instance and its size
Locate the END node for this instance
Save and override END subType for size calculation
Restore and advance past END node
No more instances
IsDevicePathMultiInstance - Check if path has multiple instances
BOOLEAN IsDevicePathMultiInstance(
DevicePathNodeInstanceContain - Check if path contains END_INSTANCE
BOOLEAN DevicePathNodeInstanceContain(
SECTION 4: Device Path To Text (DevicePathToText)
DevicePathToTextStr - Convert a single device path node to text string
Lookup in dispatch table based on Type/SubType
Default conversion for unknown node types
String = DefaultDevicePathToTextStr (DeviceNode, DisplayOnly, AllowShortcuts);
DevicePathToText - Convert entire device path to text
This is the main protocol function
Convert each node via the type table, joining with L"/"
String = DevicePathToTextStr (Node, DisplayOnly, AllowShortcuts);
DefaultDevicePathToTextStr - Fallback conversion for unregistered types
CatDevicePathToTextStr - Append formatted text to dynamic string
VOID CatDevicePathToTextStr(
Calculate needed size via SPrint
VA_END (Args);
SECTION 5: Device Path From Text (DevicePathFromText)
DevicePathFromText - Convert text representation to device path
Duplicate the input string so we can tokenize it
WorkingStr = StrAllocCopy (TextDevicePath);
Tokenize by L'/' separator, convert each token
while (*RemainingStr != L'\0') {
Find next node descriptor
NodeStr = RemainingStr;
Convert each token
RemainingStr = WorkingStr;
Convert the text token to a device path node
Node = ConvertTextToDevicePathNode (NodeStr);
ConvertTextToDevicePathNode - Dispatch text-to-node conversion
Based on the text prefix (e.g., "Pci", "Acpi", "Usb", etc.)
Uses a dispatch table matching known path type names.
Linear search through conversion table
for (i = 0; mFromTextTable[i].Function != NULL; i++) {
DevPathFromText - Various node-from-text converter functions
Each handles a specific device path node format string.
SECTION 6: Protocol Dispatch Tables
Device Path Type table for DevicePathToText conversion
Maps (Type, SubType) -> conversion function
TEXT_DEVICE_PATH_NODE_TABLE mToTextTable[] = {
HARWARE DEVICE PATHS (Type 1)
ACPI DEVICE PATHS (Type 2)
ACPI extended HID
ACPI extended CID
MESSAGING DEVICE PATHS (Type 3)
MEDIA DEVICE PATHS (Type 4)
BBS DEVICE PATHS (Type 5)
Device Path From Text dispatch table
Maps text prefix string -> conversion function pointer
TEXT_DEVICE_PATH_FROM_TEXT mFromTextTable[] = {
VENDOR table for VEN device path nodes
Compares against known Vendor GUIDs for named text output
VENDOR_TABLE_ENTRY mVendorTable[] = {
SECTION 7: Module Entry Point & Protocol Installation
Global variables
EFI_HANDLE mImageHandle = NULL;
Initialize the HOB list pointer (for DXE drivers)
Status = GetHobList ();
Install the three Device Path protocols
Status = gBootServices->InstallMultipleProtocolInterfaces (

Generated by HR650X BIOS Decompilation Project