@@ -10,7 +10,7 @@ use crate::mem::memory_map::*;
1010use crate :: proto:: device_path:: DevicePath ;
1111use crate :: proto:: loaded_image:: LoadedImage ;
1212use crate :: proto:: media:: fs:: SimpleFileSystem ;
13- use crate :: proto:: { Protocol , ProtocolPointer } ;
13+ use crate :: proto:: { BootPolicy , Protocol , ProtocolPointer } ;
1414use crate :: util:: opt_nonnull_to_ptr;
1515use crate :: { Char16 , Error , Event , Guid , Handle , Result , Status , StatusExt } ;
1616#[ cfg( feature = "alloc" ) ]
@@ -848,17 +848,17 @@ impl BootServices {
848848 match source {
849849 LoadImageSource :: FromBuffer { buffer, file_path } => {
850850 // Boot policy is ignored when loading from source buffer.
851- boot_policy = 0 ;
851+ boot_policy = BootPolicy :: ExactMatch ;
852852
853853 device_path = file_path. map ( |p| p. as_ffi_ptr ( ) ) . unwrap_or ( ptr:: null ( ) ) ;
854854 source_buffer = buffer. as_ptr ( ) ;
855855 source_size = buffer. len ( ) ;
856856 }
857857 LoadImageSource :: FromDevicePath {
858858 device_path : file_path,
859- from_boot_manager ,
859+ boot_policy : new_boot_policy ,
860860 } => {
861- boot_policy = u8 :: from ( from_boot_manager ) ;
861+ boot_policy = new_boot_policy ;
862862 device_path = file_path. as_ffi_ptr ( ) ;
863863 source_buffer = ptr:: null ( ) ;
864864 source_size = 0 ;
@@ -868,7 +868,7 @@ impl BootServices {
868868 let mut image_handle = ptr:: null_mut ( ) ;
869869 unsafe {
870870 ( self . 0 . load_image ) (
871- boot_policy,
871+ boot_policy. into ( ) ,
872872 parent_image_handle. as_ptr ( ) ,
873873 device_path. cast ( ) ,
874874 source_buffer,
@@ -1403,9 +1403,10 @@ pub enum LoadImageSource<'a> {
14031403
14041404 /// Load an image via the [`SimpleFileSystem`] protocol. If there is
14051405 /// 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::BootSelection`],
1407+ /// attempt to load via the `LoadFile` protocol. If
1408+ /// [`BootPolicy::ExactMatch`], attempt to load via the `LoadFile2`
1409+ /// protocol, then fall back to `LoadFile`.
14091410 FromDevicePath {
14101411 /// The full device path from which to load the image.
14111412 ///
@@ -1416,12 +1417,8 @@ pub enum LoadImageSource<'a> {
14161417 /// and not just `\\EFI\\BOOT\\BOOTX64.EFI`.
14171418 device_path : & ' a DevicePath ,
14181419
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 ,
1420+ /// The [`BootPolicy`] to use.
1421+ boot_policy : BootPolicy ,
14251422 } ,
14261423}
14271424
0 commit comments