@@ -58,17 +58,13 @@ pub const PAGE_SIZE: usize = 4096;
58
58
///
59
59
/// * [`open_protocol`]
60
60
/// * [`get_image_file_system`]
61
- /// * [`handle_protocol`]
62
- /// * [`locate_protocol`]
63
61
///
64
62
/// For protocol definitions, see the [`proto`] module.
65
63
///
66
64
/// [`proto`]: crate::proto
67
65
/// [`open_protocol_exclusive`]: BootServices::open_protocol_exclusive
68
66
/// [`open_protocol`]: BootServices::open_protocol
69
67
/// [`get_image_file_system`]: BootServices::get_image_file_system
70
- /// [`locate_protocol`]: BootServices::locate_protocol
71
- /// [`handle_protocol`]: BootServices::handle_protocol
72
68
///
73
69
/// ## Use of [`UnsafeCell`] for protocol references
74
70
///
@@ -151,6 +147,7 @@ pub struct BootServices {
151
147
protocol : & Guid ,
152
148
interface : * mut c_void ,
153
149
) -> Status ,
150
+ #[ deprecated = "open_protocol and open_protocol_exclusive are better alternatives and available since EFI 1.10 (2002)" ]
154
151
handle_protocol :
155
152
extern "efiapi" fn ( handle : Handle , proto : & Guid , out_proto : & mut * mut c_void ) -> Status ,
156
153
_reserved : usize ,
@@ -250,6 +247,7 @@ pub struct BootServices {
250
247
no_handles : & mut usize ,
251
248
buf : & mut * mut Handle ,
252
249
) -> Status ,
250
+ #[ deprecated = "open_protocol and open_protocol_exclusive are better alternatives and available since EFI 1.10 (2002)" ]
253
251
locate_protocol : extern "efiapi" fn (
254
252
proto : & Guid ,
255
253
registration : * mut c_void ,
@@ -815,50 +813,6 @@ impl BootServices {
815
813
( self . uninstall_protocol_interface ) ( handle, protocol, interface) . into ( )
816
814
}
817
815
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
-
862
816
/// Registers `event` to be signalled whenever a protocol interface is registered for
863
817
/// `protocol` by `install_protocol_interface()` or `reinstall_protocol_interface()`.
864
818
///
@@ -1290,10 +1244,9 @@ impl BootServices {
1290
1244
/// subset of this functionality.
1291
1245
///
1292
1246
/// 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`].
1297
1250
///
1298
1251
/// See [`OpenProtocolParams`] and [`OpenProtocolAttributes`] for
1299
1252
/// details of the input parameters.
@@ -1316,7 +1269,7 @@ impl BootServices {
1316
1269
/// responsible for ensuring that the handle and protocol remain
1317
1270
/// valid until the `ScopedProtocol` is dropped.
1318
1271
///
1319
- /// [`handle_protocol `]: BootServices::handle_protocol
1272
+ /// [`open_protocol `]: BootServices::open_protocol
1320
1273
/// [`open_protocol_exclusive`]: BootServices::open_protocol_exclusive
1321
1274
///
1322
1275
/// # Errors
@@ -1344,7 +1297,6 @@ impl BootServices {
1344
1297
. into_with_val ( || {
1345
1298
let interface = P :: mut_ptr_from_ffi ( interface) as * const UnsafeCell < P > ;
1346
1299
1347
- #[ allow( deprecated) ]
1348
1300
ScopedProtocol {
1349
1301
interface : & * interface,
1350
1302
open_params : params,
@@ -1358,8 +1310,6 @@ impl BootServices {
1358
1310
/// If successful, a [`ScopedProtocol`] is returned that will
1359
1311
/// automatically close the protocol interface when dropped.
1360
1312
///
1361
- /// [`handle_protocol`]: BootServices::handle_protocol
1362
- ///
1363
1313
/// # Errors
1364
1314
///
1365
1315
/// See section `EFI_BOOT_SERVICES.OpenProtocol()` in the UEFI Specification for more details.
@@ -1478,39 +1428,6 @@ impl BootServices {
1478
1428
} )
1479
1429
}
1480
1430
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
-
1514
1431
/// Copies memory from source to destination. The buffers can overlap.
1515
1432
///
1516
1433
/// # Safety
@@ -1603,6 +1520,7 @@ impl super::Table for BootServices {
1603
1520
1604
1521
impl Debug for BootServices {
1605
1522
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> core:: fmt:: Result {
1523
+ #[ allow( deprecated) ]
1606
1524
f. debug_struct ( "BootServices" )
1607
1525
. field ( "header" , & self . header )
1608
1526
. field ( "raise_tpl (fn ptr)" , & ( self . raise_tpl as * const usize ) )
@@ -1870,8 +1788,7 @@ pub struct OpenProtocolParams {
1870
1788
/// protocol and why [`UnsafeCell`] is used.
1871
1789
pub struct ScopedProtocol < ' a , P : Protocol + ?Sized > {
1872
1790
/// 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 > ,
1875
1792
1876
1793
open_params : OpenProtocolParams ,
1877
1794
boot_services : & ' a BootServices ,
@@ -1898,19 +1815,13 @@ impl<'a, P: Protocol + ?Sized> Deref for ScopedProtocol<'a, P> {
1898
1815
type Target = P ;
1899
1816
1900
1817
fn deref ( & self ) -> & Self :: Target {
1901
- #[ allow( deprecated) ]
1902
- unsafe {
1903
- & * self . interface . get ( )
1904
- }
1818
+ unsafe { & * self . interface . get ( ) }
1905
1819
}
1906
1820
}
1907
1821
1908
1822
impl < ' a , P : Protocol + ?Sized > DerefMut for ScopedProtocol < ' a , P > {
1909
1823
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 ( ) }
1914
1825
}
1915
1826
}
1916
1827
0 commit comments