Skip to content

Commit 8df663b

Browse files
committed
load_image: LoadImageSource::FromFilePath => FromDevicePath
1 parent a96a03f commit 8df663b

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
upper-case names.
1616
- `PointerMode` and `PointerState` now contain arrays rather than tuples, as
1717
tuples are not FFI safe.
18+
- Renamed `LoadImageSource::FromFilePath` to `LoadImageSource::FromDevicePath`
1819

1920
## uefi-macros - [Unreleased]
2021

uefi-test-runner/src/boot/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ fn test_load_image(bt: &BootServices) {
9191

9292
log::debug!("load_image with FromBuffer strategy works");
9393
}
94-
// Variant B: FromFilePath
94+
// Variant B: FromDevicePath
9595
{
96-
let load_source = LoadImageSource::FromFilePath {
97-
file_path: image_device_path,
96+
let load_source = LoadImageSource::FromDevicePath {
97+
device_path: image_device_path,
9898
from_boot_manager: false,
9999
};
100100
let _ = bt

uefi/src/table/boot.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,8 +1027,8 @@ impl BootServices {
10271027
source_buffer = buffer.as_ptr();
10281028
source_size = buffer.len();
10291029
}
1030-
LoadImageSource::FromFilePath {
1031-
file_path,
1030+
LoadImageSource::FromDevicePath {
1031+
device_path: file_path,
10321032
from_boot_manager,
10331033
} => {
10341034
boot_policy = u8::from(from_boot_manager);
@@ -1698,11 +1698,21 @@ pub enum LoadImageSource<'a> {
16981698
/// behavior depends on `from_boot_manager`. If `true`, attempt to
16991699
/// load via the `LoadFile` protocol. If `false`, attempt to load
17001700
/// via the `LoadFile2` protocol, then fall back to `LoadFile`.
1701-
FromFilePath {
1702-
/// Device path from which to load the image.
1703-
file_path: &'a DevicePath,
1704-
1705-
/// Whether the request originates from the boot manager.
1701+
FromDevicePath {
1702+
/// The full device path from which to load the image.
1703+
///
1704+
/// The provided path should be a full device path and not just the
1705+
/// file path portion of it. So for example, it must be (the binary
1706+
/// representation)
1707+
/// `PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0xFFFF,0x0)/HD(1,MBR,0xBE1AFDFA,0x3F,0xFBFC1)/\\EFI\\BOOT\\BOOTX64.EFI`
1708+
/// and not just `\\EFI\\BOOT\\BOOTX64.EFI`.
1709+
device_path: &'a DevicePath,
1710+
1711+
/// If there is no instance of [`SimpleFileSystem`] protocol associated
1712+
/// with the given device path, then this function will attempt to use
1713+
/// `LoadFileProtocol` (`from_boot_manager` is `true`) or
1714+
/// `LoadFile2Protocol`, and then `LoadFileProtocol`
1715+
/// (`from_boot_manager` is `false`).
17061716
from_boot_manager: bool,
17071717
},
17081718
}

0 commit comments

Comments
 (0)