@@ -10,7 +10,7 @@ use crate::mem::memory_map::*;
10
10
use crate :: proto:: device_path:: DevicePath ;
11
11
use crate :: proto:: loaded_image:: LoadedImage ;
12
12
use crate :: proto:: media:: fs:: SimpleFileSystem ;
13
- use crate :: proto:: { Protocol , ProtocolPointer } ;
13
+ use crate :: proto:: { BootPolicy , Protocol , ProtocolPointer } ;
14
14
use crate :: util:: opt_nonnull_to_ptr;
15
15
use crate :: { Char16 , Error , Event , Guid , Handle , Result , Status , StatusExt } ;
16
16
#[ cfg( feature = "alloc" ) ]
@@ -848,17 +848,17 @@ impl BootServices {
848
848
match source {
849
849
LoadImageSource :: FromBuffer { buffer, file_path } => {
850
850
// Boot policy is ignored when loading from source buffer.
851
- boot_policy = 0 ;
851
+ boot_policy = BootPolicy :: FALSE ;
852
852
853
853
device_path = file_path. map ( |p| p. as_ffi_ptr ( ) ) . unwrap_or ( ptr:: null ( ) ) ;
854
854
source_buffer = buffer. as_ptr ( ) ;
855
855
source_size = buffer. len ( ) ;
856
856
}
857
857
LoadImageSource :: FromDevicePath {
858
858
device_path : file_path,
859
- from_boot_manager ,
859
+ bool_policy ,
860
860
} => {
861
- boot_policy = u8 :: from ( from_boot_manager ) ;
861
+ boot_policy = bool_policy ;
862
862
device_path = file_path. as_ffi_ptr ( ) ;
863
863
source_buffer = ptr:: null ( ) ;
864
864
source_size = 0 ;
@@ -868,7 +868,7 @@ impl BootServices {
868
868
let mut image_handle = ptr:: null_mut ( ) ;
869
869
unsafe {
870
870
( self . 0 . load_image ) (
871
- boot_policy,
871
+ boot_policy. into ( ) ,
872
872
parent_image_handle. as_ptr ( ) ,
873
873
device_path. cast ( ) ,
874
874
source_buffer,
@@ -1403,9 +1403,12 @@ pub enum LoadImageSource<'a> {
1403
1403
1404
1404
/// Load an image via the [`SimpleFileSystem`] protocol. If there is
1405
1405
/// no instance of that protocol associated with the path then the
1406
- /// behavior depends on `from_boot_manager`. If `true`, attempt to
1407
- /// load via the `LoadFile` protocol. If `false`, attempt to load
1408
- /// via the `LoadFile2` protocol, then fall back to `LoadFile`.
1406
+ /// behavior depends on [`BootPolicy`]. If [`BootPolicy::TRUE`], attempt to
1407
+ /// load via the [`LoadFile`] protocol. If [`BootPolicy::FALSE`], attempt to
1408
+ /// load via the [`LoadFile2`] protocol, then fall back to [`LoadFile`].
1409
+ ///
1410
+ /// [`LoadFile`]: crate::proto::media::load_file::LoadFile
1411
+ /// [`LoadFile2`]: crate::proto::media::load_file::LoadFile2
1409
1412
FromDevicePath {
1410
1413
/// The full device path from which to load the image.
1411
1414
///
@@ -1416,12 +1419,8 @@ pub enum LoadImageSource<'a> {
1416
1419
/// and not just `\\EFI\\BOOT\\BOOTX64.EFI`.
1417
1420
device_path : & ' a DevicePath ,
1418
1421
1419
- /// If there is no instance of [`SimpleFileSystem`] protocol associated
1420
- /// with the given device path, then this function will attempt to use
1421
- /// `LoadFileProtocol` (`from_boot_manager` is `true`) or
1422
- /// `LoadFile2Protocol`, and then `LoadFileProtocol`
1423
- /// (`from_boot_manager` is `false`).
1424
- from_boot_manager : bool ,
1422
+ /// The [`BootPolicy`] to use.
1423
+ bool_policy : BootPolicy ,
1425
1424
} ,
1426
1425
}
1427
1426
0 commit comments