Module uefi::proto::device_path
source · Expand description
Device Path protocol
A UEFI device path is a very flexible structure for encoding a programmatic path such as a hard drive or console.
A device path is made up of a packed list of variable-length nodes of
various types. The entire device path is terminated with an
END_ENTIRE
node. A device path may contain multiple device-path
instances separated by END_INSTANCE
nodes, but typical paths contain
only a single instance (in which case no END_INSTANCE
node is needed).
Example of what a device path containing two instances (each comprised of three nodes) might look like:
┌──────┬─────┬──────────────╥───────┬──────────┬────────────┐
│ ACPI │ PCI │ END_INSTANCE ║ CDROM │ FILEPATH │ END_ENTIRE │
└──────┴─────┴──────────────╨───────┴──────────┴────────────┘
↑ ↑ ↑
├─── DevicePathInstance ────╨────── DevicePathInstance ─────┤
│ │
└─────────────────── Entire DevicePath ─────────────────────┘
§Types
To represent device paths, this module provides several types:
-
DevicePath
is the root type that represents a full device path, containing one or more device path instance. It ends with anEND_ENTIRE
node. It implementsProtocol
(corresponding toEFI_DEVICE_PATH_PROTOCOL
). -
DevicePathInstance
represents a single path instance within a device path. It ends with either anEND_INSTANCE
orEND_ENTIRE
node. -
DevicePathNode
represents a single node within a path. The node’sdevice_type
andsub_type
must be examined to determine what type of data it contains.Specific node types have their own structures in these submodules:
-
DevicePathNodeEnum
contains variants for references to each type of node. CallDevicePathNode::as_enum
to convert from aDevicePathNode
reference to aDevicePathNodeEnum
. -
DevicePathHeader
is a header present at the start of every node. It describes the type of node as well as the node’s size. -
FfiDevicePath
is an opaque type used whenever a device path pointer is passed to or from external UEFI interfaces (i.e. where the UEFI spec usesconst* EFI_DEVICE_PATH_PROTOCOL
,*const FfiDevicePath
should be used in the Rust definition). Many of the other types in this module are DSTs, so pointers to the type are “fat” and not suitable for FFI.
All of these types use a packed layout and may appear on any byte boundary.
Note: the API provided by this module is currently mostly limited to reading existing device paths rather than constructing new ones.
Modules§
- Device path nodes for
DeviceType::ACPI
. - Device path nodes for
DeviceType::BIOS_BOOT_SPEC
. - Utilities for creating new
DevicePaths
. - Device path nodes for
DeviceType::END
. - Device path nodes for
DeviceType::HARDWARE
. - Device path nodes for
DeviceType::MEDIA
. - Device path nodes for
DeviceType::MESSAGING
. DevicePathToText
andDevicePathFromText
Protocol
Structs§
- Device path protocol.
- Header that appears at the start of every
DevicePathNode
. - A single device path instance that ends with either an
END_INSTANCE
orEND_ENTIRE
node. UseDevicePath::instance_iter
to get the path instances in aDevicePath
. - Iterator over the
DevicePathInstance
s in aDevicePath
. - A single node within a
DevicePath
. - Iterator over
DevicePathNode
s. - Sub-type identifier for a DevicePath
- Type identifier for a DevicePath
- Opaque type that should be used to represent a pointer to a
DevicePath
orDevicePathNode
in foreign function interfaces. This type produces a thin pointer, unlikeDevicePath
andDevicePathNode
. - Protocol for accessing the device path that was passed in to
load_image
when loading a PE/COFF image.
Enums§
- Enum of references to all the different device path node types. Return type of
DevicePathNode::as_enum
. - Errors that may happen when a device path is transformed to a string representation using:
- Error returned when converting from a
DevicePathNode
to a more specific node type.