Skip to content

Commit aee9bf1

Browse files
uefi: Add warnings to OpenProtocolParams::Exclusive/ByDriverExclusive
1 parent 9b8322d commit aee9bf1

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

uefi/src/boot.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,12 +1740,37 @@ pub enum OpenProtocolAttributes {
17401740
/// interface. If any drivers have the protocol opened with an
17411741
/// attribute of `ByDriver`, then an attempt will be made to remove
17421742
/// them by calling the driver's `Stop` function.
1743+
///
1744+
/// # Warning
1745+
///
1746+
/// Opening an interface in exclusive mode can have surprising side
1747+
/// effects. For example:
1748+
///
1749+
/// * Opening a serial protocol in exclusive mode may disconnect it from
1750+
/// other output protocols, and that connection will not be automatically
1751+
/// restored when the exclusive access is ended. ([`connect_controller`]
1752+
/// can sometimes be used to manually restore such connections.)
1753+
///
1754+
/// * Stopping drivers that have the protocol open may be very slow. On some
1755+
/// firmware, opening any of the disk protocols in exclusive mode can take
1756+
/// nearly one second to complete.
1757+
///
1758+
/// In many cases it is better to use [`GetProtocol`], even though it
1759+
/// requires the use of `unsafe`.
1760+
///
1761+
/// [`GetProtocol`]: Self::GetProtocol
17431762
Exclusive = 0x20,
17441763

17451764
/// Used by a driver to gain exclusive access to a protocol
17461765
/// interface. If any other drivers have the protocol interface
17471766
/// opened with an attribute of `ByDriver`, then an attempt will be
17481767
/// made to remove them with `DisconnectController`.
1768+
///
1769+
/// # Warning
1770+
///
1771+
/// See warning section of [`Exclusive`].
1772+
///
1773+
/// [`Exclusive`]: Self::Exclusive
17491774
ByDriverExclusive = 0x30,
17501775
}
17511776

0 commit comments

Comments
 (0)