Skip to content

Commit 5f70575

Browse files
committed
uefi: streamline documentation of Protocol structs
Now each struct's documentation begins with "$ProtocolName [`Protocol`]". This way, readers quickly can figure out what Protocols are in general.
1 parent 00b91d5 commit 5f70575

File tree

28 files changed

+131
-36
lines changed

28 files changed

+131
-36
lines changed

uefi/src/proto/console/gop.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ use uefi_raw::protocol::console::{
6565

6666
pub use uefi_raw::protocol::console::PixelBitmask;
6767

68-
/// Provides access to the video hardware's frame buffer.
68+
/// Graphics Output [`Protocol`] (GOP). Provides access to the video hardware's
69+
/// frame buffer.
6970
///
70-
/// The GOP can be used to set the properties of the frame buffer,
71-
/// and also allows the app to access the in-memory buffer.
71+
/// The GOP can be used to set the properties of the framebuffer, and also
72+
/// allows the app to access the in-memory buffer.
73+
///
74+
/// [`Protocol`]: uefi::proto::Protocol
7275
#[derive(Debug)]
7376
#[repr(transparent)]
7477
#[unsafe_protocol(GraphicsOutputProtocol::GUID)]

uefi/src/proto/console/pointer/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ use crate::proto::unsafe_protocol;
66
use crate::{Event, Result, Status, StatusExt};
77
use uefi_raw::protocol::console::SimplePointerProtocol;
88

9-
/// Provides information about a pointer device.
9+
/// Simple Pointer [`Protocol`]. Provides information about a pointer device.
10+
///
11+
/// Pointer devices are mouses, touchpads, and touchscreens.
12+
///
13+
/// [`Protocol`]: uefi::proto::Protocol
1014
#[derive(Debug)]
1115
#[repr(transparent)]
1216
#[unsafe_protocol(SimplePointerProtocol::GUID)]

uefi/src/proto/console/serial.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ pub use uefi_raw::protocol::console::serial::{
1111
ControlBits, Parity, SerialIoMode as IoMode, StopBits,
1212
};
1313

14-
/// Provides access to a serial I/O device.
14+
/// Serial IO [`Protocol`]. Provides access to a serial I/O device.
1515
///
1616
/// This can include standard UART devices, serial ports over a USB interface,
1717
/// or any other character-based communication device.
1818
///
1919
/// Since UEFI drivers are implemented through polling, if you fail to regularly
2020
/// check for input/output, some data might be lost.
21+
///
22+
/// [`Protocol`]: uefi::proto::Protocol
2123
#[derive(Debug)]
2224
#[repr(transparent)]
2325
#[unsafe_protocol(SerialIoProtocol::GUID)]

uefi/src/proto/console/text/input.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ use crate::{Char16, Event, Result, Status, StatusExt};
55
use core::mem::MaybeUninit;
66
use uefi_raw::protocol::console::{InputKey, SimpleTextInputProtocol};
77

8-
/// Interface for text-based input devices.
8+
/// Simple Text Input [`Protocol`]. Interface for text-based input devices.
9+
///
10+
/// [`Protocol`]: uefi::proto::Protocol
911
#[derive(Debug)]
1012
#[repr(transparent)]
1113
#[unsafe_protocol(SimpleTextInputProtocol::GUID)]

uefi/src/proto/console/text/output.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{CStr16, Result, ResultExt, Status, StatusExt};
55
use core::fmt;
66
use uefi_raw::protocol::console::{SimpleTextOutputMode, SimpleTextOutputProtocol};
77

8-
/// Interface for text-based output devices.
8+
/// Simple Text Output [`Protocol`]. Interface for text-based output devices.
99
///
1010
/// It implements the fmt::Write trait, so you can use it to print text with
1111
/// standard Rust constructs like the `write!()` and `writeln!()` macros.
@@ -22,6 +22,7 @@ use uefi_raw::protocol::console::{SimpleTextOutputMode, SimpleTextOutputProtocol
2222
/// [`system::stdout`]: crate::system::with_stdout
2323
/// [`system::stderr`]: crate::system::with_stderr
2424
/// [`boot`]: crate::boot#accessing-protocols
25+
/// [`Protocol`]: uefi::proto::Protocol
2526
#[derive(Debug)]
2627
#[repr(transparent)]
2728
#[unsafe_protocol(SimpleTextOutputProtocol::GUID)]

uefi/src/proto/debug/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ pub use exception::ExceptionType;
2323
mod context;
2424
mod exception;
2525

26+
/// Debug support [`Protocol`].
27+
///
2628
/// The debugging support protocol allows debuggers to connect to a UEFI machine.
2729
/// It is expected that there will typically be two instances of the EFI Debug Support protocol in the system.
2830
/// One associated with the native processor instruction set (IA-32, x64, ARM, RISC-V, or Itanium processor
@@ -31,6 +33,8 @@ mod exception;
3133
/// one for any given instruction set.
3234
///
3335
/// NOTE: OVMF only implements this protocol interface for the virtual EBC processor
36+
///
37+
/// [`Protocol`]: uefi::proto::Protocol
3438
#[derive(Debug)]
3539
#[repr(C)]
3640
#[unsafe_protocol("2755590c-6f3c-42fa-9ea4-a3ba543cda25")]
@@ -178,8 +182,12 @@ pub enum ProcessorArch: u32 => {
178182
RISCV_128 = 0x5128,
179183
}}
180184

185+
/// Debug Port [`Protocol`].
186+
///
181187
/// The debug port protocol abstracts the underlying debug port
182188
/// hardware, whether it is a regular Serial port or something else.
189+
///
190+
/// [`Protocol`]: uefi::proto::Protocol
183191
#[derive(Debug)]
184192
#[repr(C)]
185193
#[unsafe_protocol("eba4e8d2-3858-41ec-a281-2647ba9660d0")]

uefi/src/proto/device_path/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// SPDX-License-Identifier: MIT OR Apache-2.0
22

3-
//! Device Path protocol
3+
//! Helpers to work with UEFI Device Paths and the Device Path Protocol.
44
//!
5-
//! A UEFI device path is a very flexible structure for encoding a
6-
//! programmatic path such as a hard drive or console.
5+
//! The main export of this module is [`DevicePath`].
76
//!
87
//! A device path is made up of a packed list of variable-length nodes of
98
//! various types. The entire device path is terminated with an
@@ -373,7 +372,7 @@ impl ToOwned for DevicePathInstance {
373372
}
374373
}
375374

376-
/// Device path protocol.
375+
/// Device Path [`Protocol`].
377376
///
378377
/// Can be used on any device handle to obtain generic path/location information
379378
/// concerning the physical device or logical device. If the handle does not
@@ -386,6 +385,7 @@ impl ToOwned for DevicePathInstance {
386385
///
387386
/// [module-level documentation]: crate::proto::device_path
388387
/// [`END_ENTIRE`]: DeviceSubType::END_ENTIRE
388+
/// [`Protocol`]: uefi::proto::Protocol
389389
#[repr(C, packed)]
390390
#[unsafe_protocol(uefi_raw::protocol::device_path::DevicePathProtocol::GUID)]
391391
#[derive(Eq, Pointee)]
@@ -702,12 +702,15 @@ pub enum NodeConversionError {
702702
UnsupportedType,
703703
}
704704

705+
/// Loaded Image Device Path [`Protocol`].
706+
///
705707
/// Protocol for accessing the device path that was passed in to [`load_image`]
706708
/// when loading a PE/COFF image.
707709
///
708710
/// The layout of this type is the same as a [`DevicePath`].
709711
///
710712
/// [`load_image`]: crate::boot::load_image
713+
/// [`Protocol`]: uefi::proto::Protocol
711714
#[repr(transparent)]
712715
#[unsafe_protocol("bc62157e-3e33-4fec-9920-2d3b36d750df")]
713716
#[derive(Debug, Pointee)]

uefi/src/proto/device_path/text.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ impl Deref for PoolString {
7272
}
7373
}
7474

75+
/// Device Path to Text [`Protocol`].
76+
///
7577
/// Protocol for converting a [`DevicePath`] or `DevicePathNode`] to a string.
78+
///
79+
/// [`Protocol`]: uefi::proto::Protocol
7680
#[derive(Debug)]
7781
#[repr(transparent)]
7882
#[unsafe_protocol(DevicePathToTextProtocol::GUID)]
@@ -124,7 +128,11 @@ impl DevicePathToText {
124128
}
125129
}
126130

131+
/// Device Path from Text [`Protocol`].
132+
///
127133
/// Protocol for converting a string to a [`DevicePath`] or `DevicePathNode`].
134+
///
135+
/// [`Protocol`]: uefi::proto::Protocol
128136
#[derive(Debug)]
129137
#[repr(transparent)]
130138
#[unsafe_protocol("05c99a21-c70f-4ad2-8a5f-35df3343f51e")]

uefi/src/proto/driver/component_name.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ use core::fmt::{self, Debug, Display, Formatter};
1313
use core::{ptr, slice};
1414
use uefi_raw::protocol::driver::ComponentName2Protocol;
1515

16+
/// Component Name1 [`Protocol`].
17+
///
1618
/// Protocol that provides human-readable names for a driver and for each of the
1719
/// controllers that the driver is managing.
1820
///
@@ -27,6 +29,7 @@ use uefi_raw::protocol::driver::ComponentName2Protocol;
2729
///
2830
/// [ISO 639-2]: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
2931
/// [RFC 4646]: https://www.rfc-editor.org/rfc/rfc4646
32+
/// [`Protocol`]: uefi::proto::Protocol
3033
#[deprecated = "deprecated in UEFI 2.1; use ComponentName2 where possible"]
3134
#[unsafe_protocol(ComponentName2Protocol::DEPRECATED_COMPONENT_NAME_GUID)]
3235
#[derive(Debug)]
@@ -85,6 +88,8 @@ impl ComponentName1 {
8588
}
8689
}
8790

91+
/// Component Name2 [`Protocol`].
92+
///
8893
/// Protocol that provides human-readable names for a driver and for each of the
8994
/// controllers that the driver is managing.
9095
///
@@ -99,6 +104,7 @@ impl ComponentName1 {
99104
///
100105
/// [ISO 639-2]: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
101106
/// [RFC 4646]: https://www.rfc-editor.org/rfc/rfc4646
107+
/// [`Protocol`]: uefi::proto::Protocol
102108
#[unsafe_protocol(ComponentName2Protocol::GUID)]
103109
#[derive(Debug)]
104110
#[repr(transparent)]

uefi/src/proto/loaded_image.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ use core::ffi::c_void;
1212
use core::{mem, slice};
1313
use uefi_raw::protocol::loaded_image::LoadedImageProtocol;
1414

15-
/// The LoadedImage protocol. This can be opened on any image handle using the `HandleProtocol` boot service.
15+
/// The Loaded Image [`Protocol`].
16+
///
17+
/// This can be opened on any image handle using [`boot::open_protocol`],
18+
/// for example.
19+
///
20+
/// [`Protocol`]: uefi::proto::Protocol
21+
/// [`boot::open_protocol`]: uefi::boot::open_protocol
1622
#[derive(Debug)]
1723
#[repr(transparent)]
1824
#[unsafe_protocol(LoadedImageProtocol::GUID)]

0 commit comments

Comments
 (0)