@@ -58,17 +58,13 @@ pub const PAGE_SIZE: usize = 4096;
5858///
5959/// * [`open_protocol`]
6060/// * [`get_image_file_system`]
61- /// * [`handle_protocol`]
62- /// * [`locate_protocol`]
6361///
6462/// For protocol definitions, see the [`proto`] module.
6563///
6664/// [`proto`]: crate::proto
6765/// [`open_protocol_exclusive`]: BootServices::open_protocol_exclusive
6866/// [`open_protocol`]: BootServices::open_protocol
6967/// [`get_image_file_system`]: BootServices::get_image_file_system
70- /// [`locate_protocol`]: BootServices::locate_protocol
71- /// [`handle_protocol`]: BootServices::handle_protocol
7268///
7369/// ## Use of [`UnsafeCell`] for protocol references
7470///
@@ -151,6 +147,7 @@ pub struct BootServices {
151147 protocol : & Guid ,
152148 interface : * mut c_void ,
153149 ) -> Status ,
150+ #[ deprecated = "open_protocol and open_protocol_exclusive are better alternatives and available since EFI 1.10 (2002)" ]
154151 handle_protocol :
155152 extern "efiapi" fn ( handle : Handle , proto : & Guid , out_proto : & mut * mut c_void ) -> Status ,
156153 _reserved : usize ,
@@ -250,6 +247,7 @@ pub struct BootServices {
250247 no_handles : & mut usize ,
251248 buf : & mut * mut Handle ,
252249 ) -> Status ,
250+ #[ deprecated = "open_protocol and open_protocol_exclusive are better alternatives and available since EFI 1.10 (2002)" ]
253251 locate_protocol : extern "efiapi" fn (
254252 proto : & Guid ,
255253 registration : * mut c_void ,
@@ -815,50 +813,6 @@ impl BootServices {
815813 ( self . uninstall_protocol_interface ) ( handle, protocol, interface) . into ( )
816814 }
817815
818- /// Query a handle for a certain protocol.
819- ///
820- /// This function attempts to get the protocol implementation of a handle,
821- /// based on the protocol GUID.
822- ///
823- /// It is recommended that all new drivers and applications use
824- /// [`open_protocol_exclusive`] or [`open_protocol`] instead of `handle_protocol`.
825- ///
826- /// UEFI protocols are neither thread-safe nor reentrant, but the firmware
827- /// provides no mechanism to protect against concurrent usage. Such
828- /// protections must be implemented by user-level code, for example via a
829- /// global `HashSet`.
830- ///
831- /// # Safety
832- ///
833- /// This method is unsafe because the handle database is not
834- /// notified that the handle and protocol are in use; there is no
835- /// guarantee that they will remain valid for the duration of their
836- /// use. Use [`open_protocol_exclusive`] if possible, otherwise use
837- /// [`open_protocol`].
838- ///
839- /// [`open_protocol`]: BootServices::open_protocol
840- /// [`open_protocol_exclusive`]: BootServices::open_protocol_exclusive
841- ///
842- /// # Errors
843- ///
844- /// See section `EFI_BOOT_SERVICES.HandleProtocol()` in the UEFI Specification for more details.
845- ///
846- /// * [`uefi::Status::UNSUPPORTED`]
847- /// * [`uefi::Status::INVALID_PARAMETER`]
848- #[ deprecated(
849- note = "it is recommended to use `open_protocol_exclusive` or `open_protocol` instead"
850- ) ]
851- pub unsafe fn handle_protocol < P : ProtocolPointer + ?Sized > (
852- & self ,
853- handle : Handle ,
854- ) -> Result < & UnsafeCell < P > > {
855- let mut ptr = ptr:: null_mut ( ) ;
856- ( self . handle_protocol ) ( handle, & P :: GUID , & mut ptr) . into_with_val ( || {
857- let ptr = P :: mut_ptr_from_ffi ( ptr) as * const UnsafeCell < P > ;
858- & * ptr
859- } )
860- }
861-
862816 /// Registers `event` to be signalled whenever a protocol interface is registered for
863817 /// `protocol` by `install_protocol_interface()` or `reinstall_protocol_interface()`.
864818 ///
@@ -1290,10 +1244,9 @@ impl BootServices {
12901244 /// subset of this functionality.
12911245 ///
12921246 /// This function attempts to get the protocol implementation of a
1293- /// handle, based on the protocol GUID. It is an extended version of
1294- /// [`handle_protocol`]. It is recommended that all
1295- /// new drivers and applications use `open_protocol_exclusive` or
1296- /// `open_protocol` instead of `handle_protocol`.
1247+ /// handle, based on the protocol GUID. It is recommended that all
1248+ /// new drivers and applications use [`open_protocol_exclusive`] or
1249+ /// [`open_protocol`].
12971250 ///
12981251 /// See [`OpenProtocolParams`] and [`OpenProtocolAttributes`] for
12991252 /// details of the input parameters.
@@ -1316,7 +1269,7 @@ impl BootServices {
13161269 /// responsible for ensuring that the handle and protocol remain
13171270 /// valid until the `ScopedProtocol` is dropped.
13181271 ///
1319- /// [`handle_protocol `]: BootServices::handle_protocol
1272+ /// [`open_protocol `]: BootServices::open_protocol
13201273 /// [`open_protocol_exclusive`]: BootServices::open_protocol_exclusive
13211274 ///
13221275 /// # Errors
@@ -1344,7 +1297,6 @@ impl BootServices {
13441297 . into_with_val ( || {
13451298 let interface = P :: mut_ptr_from_ffi ( interface) as * const UnsafeCell < P > ;
13461299
1347- #[ allow( deprecated) ]
13481300 ScopedProtocol {
13491301 interface : & * interface,
13501302 open_params : params,
@@ -1358,8 +1310,6 @@ impl BootServices {
13581310 /// If successful, a [`ScopedProtocol`] is returned that will
13591311 /// automatically close the protocol interface when dropped.
13601312 ///
1361- /// [`handle_protocol`]: BootServices::handle_protocol
1362- ///
13631313 /// # Errors
13641314 ///
13651315 /// See section `EFI_BOOT_SERVICES.OpenProtocol()` in the UEFI Specification for more details.
@@ -1478,39 +1428,6 @@ impl BootServices {
14781428 } )
14791429 }
14801430
1481- /// Returns a protocol implementation, if present on the system.
1482- ///
1483- /// The caveats of `BootServices::handle_protocol()` also apply here.
1484- ///
1485- /// # Safety
1486- ///
1487- /// This method is unsafe because the handle database is not
1488- /// notified that the handle and protocol are in use; there is no
1489- /// guarantee that they will remain valid for the duration of their
1490- /// use. Use [`get_handle_for_protocol`] and either
1491- /// [`open_protocol_exclusive`] or [`open_protocol`] instead.
1492- ///
1493- /// [`get_handle_for_protocol`]: BootServices::get_handle_for_protocol
1494- /// [`open_protocol`]: BootServices::open_protocol
1495- /// [`open_protocol_exclusive`]: BootServices::open_protocol_exclusive
1496- ///
1497- /// # Errors
1498- ///
1499- /// See section `EFI_BOOT_SERVICES.LocateProtocol()` in the UEFI Specification for more details.
1500- ///
1501- /// * [`uefi::Status::INVALID_PARAMETER`]
1502- /// * [`uefi::Status::NOT_FOUND`]
1503- #[ deprecated(
1504- note = "it is recommended to use `open_protocol_exclusive` or `open_protocol` instead"
1505- ) ]
1506- pub unsafe fn locate_protocol < P : ProtocolPointer + ?Sized > ( & self ) -> Result < & UnsafeCell < P > > {
1507- let mut ptr = ptr:: null_mut ( ) ;
1508- ( self . locate_protocol ) ( & P :: GUID , ptr:: null_mut ( ) , & mut ptr) . into_with_val ( || {
1509- let ptr = P :: mut_ptr_from_ffi ( ptr) as * const UnsafeCell < P > ;
1510- & * ptr
1511- } )
1512- }
1513-
15141431 /// Copies memory from source to destination. The buffers can overlap.
15151432 ///
15161433 /// # Safety
@@ -1603,6 +1520,7 @@ impl super::Table for BootServices {
16031520
16041521impl Debug for BootServices {
16051522 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> core:: fmt:: Result {
1523+ #[ allow( deprecated) ]
16061524 f. debug_struct ( "BootServices" )
16071525 . field ( "header" , & self . header )
16081526 . field ( "raise_tpl (fn ptr)" , & ( self . raise_tpl as * const usize ) )
@@ -1870,8 +1788,7 @@ pub struct OpenProtocolParams {
18701788/// protocol and why [`UnsafeCell`] is used.
18711789pub struct ScopedProtocol < ' a , P : Protocol + ?Sized > {
18721790 /// The protocol interface.
1873- #[ deprecated( since = "0.17.0" , note = "use Deref and DerefMut instead" ) ]
1874- pub interface : & ' a UnsafeCell < P > ,
1791+ interface : & ' a UnsafeCell < P > ,
18751792
18761793 open_params : OpenProtocolParams ,
18771794 boot_services : & ' a BootServices ,
@@ -1898,19 +1815,13 @@ impl<'a, P: Protocol + ?Sized> Deref for ScopedProtocol<'a, P> {
18981815 type Target = P ;
18991816
19001817 fn deref ( & self ) -> & Self :: Target {
1901- #[ allow( deprecated) ]
1902- unsafe {
1903- & * self . interface . get ( )
1904- }
1818+ unsafe { & * self . interface . get ( ) }
19051819 }
19061820}
19071821
19081822impl < ' a , P : Protocol + ?Sized > DerefMut for ScopedProtocol < ' a , P > {
19091823 fn deref_mut ( & mut self ) -> & mut Self :: Target {
1910- #[ allow( deprecated) ]
1911- unsafe {
1912- & mut * self . interface . get ( )
1913- }
1824+ unsafe { & mut * self . interface . get ( ) }
19141825 }
19151826}
19161827
0 commit comments