Skip to content

Commit 8b21b16

Browse files
phip1611nicholasbishop
authored andcommitted
load_image: LoadImageSource::FromFilePath => FromDevicePath
1 parent 30d7792 commit 8b21b16

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- `DevicePathNode::data`
99

1010
### Changed
11+
- Renamed `LoadImageSource::FromFilePath` to `LoadImageSource::FromDevicePath`
1112

1213
### Removed
1314

@@ -44,7 +45,6 @@
4445
`BUFFER_TOO_SMALL` error can only occur when reading a directory, not a file.
4546
- `RegularFile::read` now reads in 1 MiB chunks to avoid a bug in some
4647
firmware. This fix also applies to `fs::FileSystem::read`.
47-
4848
## uefi-services - 0.19.0 (2023-06-01)
4949

5050
### Changed

uefi-test-runner/src/bin/shell_launcher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ fn efi_main(image: Handle, mut st: SystemTable<Boot>) -> Status {
5757
let shell_image_handle = boot_services
5858
.load_image(
5959
image,
60-
LoadImageSource::FromFilePath {
61-
file_path: shell_image_path,
60+
LoadImageSource::FromDevicePath {
61+
device_path: shell_image_path,
6262
from_boot_manager: false,
6363
},
6464
)

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

0 commit comments

Comments
 (0)