|
4 | 4 | //! |
5 | 5 | //! These functions will panic if called after exiting boot services. |
6 | 6 | //! |
7 | | -//! # Accessing protocols |
| 7 | +//! # Accessing Protocols |
8 | 8 | //! |
9 | | -//! Protocols can be opened using several functions in this module. Most |
10 | | -//! commonly, [`open_protocol_exclusive`] should be used. This ensures that |
11 | | -//! nothing else can use the protocol until it is closed, and returns a |
12 | | -//! [`ScopedProtocol`] that takes care of closing the protocol when it is |
13 | | -//! dropped. |
| 9 | +//! Protocols in this module can be opened through multiple functions. In most |
| 10 | +//! cases, [`open_protocol_exclusive`] is the recommended choice. It opens the |
| 11 | +//! protocol with exclusive access, preventing concurrent use until it is |
| 12 | +//! closed, and returns a [`ScopedProtocol`] that automatically releases the |
| 13 | +//! protocol when dropped. Note that this approach has certain caveats; refer to |
| 14 | +//! the documentation of the respective function for details. |
14 | 15 | //! |
15 | 16 | //! Other methods for opening protocols: |
16 | 17 | //! |
|
19 | 20 | //! |
20 | 21 | //! For protocol definitions, see the [`proto`] module. |
21 | 22 | //! |
| 23 | +//! # Accessing Handles |
| 24 | +//! |
| 25 | +//! To access handles supporting a certain protocol, we recommend using |
| 26 | +//! [`find_handles`], [`locate_handle`], and [`locate_handle_buffer`]. |
| 27 | +//! |
22 | 28 | //! [`proto`]: crate::proto |
23 | 29 |
|
24 | 30 | pub use uefi_raw::table::boot::{ |
@@ -893,7 +899,12 @@ pub fn locate_device_path<P: ProtocolPointer + ?Sized>( |
893 | 899 | } |
894 | 900 | } |
895 | 901 |
|
896 | | -/// Enumerates all handles installed on the system which match a certain query. |
| 902 | +/// Enumerates all [`Handle`]s installed on the system which match a certain |
| 903 | +/// query. |
| 904 | +/// |
| 905 | +/// If you use the `alloc` feature, it might be more convenient to use |
| 906 | +/// [`find_handles`] instead. Another alternative might be |
| 907 | +/// [`locate_handle_buffer`]. |
897 | 908 | /// |
898 | 909 | /// # Errors |
899 | 910 | /// |
@@ -939,6 +950,10 @@ pub fn locate_handle<'buf>( |
939 | 950 | /// |
940 | 951 | /// See [`SearchType`] for details of the available search operations. |
941 | 952 | /// |
| 953 | +/// Unlike [`find_handles`], this doesn't need the `alloc` feature and operates |
| 954 | +/// on the UEFI heap directly. Further, it allows a more fine-grained search |
| 955 | +/// via the provided [`SearchType`]. |
| 956 | +/// |
942 | 957 | /// # Errors |
943 | 958 | /// |
944 | 959 | /// * [`Status::NOT_FOUND`]: no matching handles. |
@@ -1112,6 +1127,11 @@ pub unsafe fn open_protocol<P: ProtocolPointer + ?Sized>( |
1112 | 1127 | /// If successful, a [`ScopedProtocol`] is returned that will automatically |
1113 | 1128 | /// close the protocol interface when dropped. |
1114 | 1129 | /// |
| 1130 | +/// Note that if any other drivers currently have the protocol interface opened |
| 1131 | +/// with the [`OpenProtocolAttributes::ByDriver`] attribute, they will be |
| 1132 | +/// disconnected via [`disconnect_controller`]. For example, opening the |
| 1133 | +/// SERIAL_IO_PROTOCOL exclusively will disconnect the console driver from it. |
| 1134 | +/// |
1115 | 1135 | /// # Errors |
1116 | 1136 | /// |
1117 | 1137 | /// * [`Status::UNSUPPORTED`]: the handle does not support the protocol. |
@@ -1548,8 +1568,8 @@ impl Deref for ProtocolsPerHandle { |
1548 | 1568 | } |
1549 | 1569 | } |
1550 | 1570 |
|
1551 | | -/// A buffer returned by [`locate_handle_buffer`] that contains an array of |
1552 | | -/// [`Handle`]s that support the requested [`Protocol`]. |
| 1571 | +/// A buffer on the UEFI heap returned by [`locate_handle_buffer`] that contains |
| 1572 | +/// an array of [`Handle`]s that support the requested [`Protocol`]. |
1553 | 1573 | #[derive(Debug, Eq, PartialEq)] |
1554 | 1574 | pub struct HandleBuffer { |
1555 | 1575 | count: usize, |
|
0 commit comments