Skip to content

Commit ca751ff

Browse files
committed
uefi-raw: serial: type revision as newtype
1 parent cb474db commit ca751ff

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

uefi-raw/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
- Added `HiiStringProtocol`.
1010
- Added `HiiPopupProtocol`.
1111
- Added `FormBrowser2Protocol`.
12+
- Added new type `SerialIoProtocolRevision`
1213

1314
## Changed
1415
- Switched `*const Self` to `*mut Self` in `SerialIoProtocol::set_attributes()`
16+
- Switched field `revision` in `SerialIoProtocol` from `u32` to new type
17+
`SerialIoProtocolRevision`
1518

1619

1720
# uefi-raw - v0.13.0 (2025-11-05)

uefi-raw/src/protocol/console/serial.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,22 @@ pub struct SerialIoMode {
7777
pub stop_bits: StopBits,
7878
}
7979

80+
newtype_enum! {
81+
/// The revision of the [`SerialIoProtocol`].
82+
#[derive(Default)]
83+
pub enum SerialIoProtocolRevision: u32 => {
84+
/// Initial version 1.0.
85+
REVISION_1_0 = 0x00010000,
86+
/// Version 1.1.
87+
REVISION_1_1 = 0x00010001,
88+
}
89+
}
90+
91+
/// Serial I/O protocol (revision 1.0).
8092
#[derive(Debug)]
8193
#[repr(C)]
8294
pub struct SerialIoProtocol {
83-
pub revision: u32,
95+
pub revision: SerialIoProtocolRevision,
8496
pub reset: unsafe extern "efiapi" fn(*mut Self) -> Status,
8597
pub set_attributes: unsafe extern "efiapi" fn(
8698
*mut Self,
@@ -100,8 +112,6 @@ pub struct SerialIoProtocol {
100112

101113
impl SerialIoProtocol {
102114
pub const GUID: Guid = guid!("bb25cf6f-f1d4-11d2-9a0c-0090273fc1fd");
103-
pub const REVISION: u32 = 0x00010000;
104-
pub const REVISION1P1: u32 = 0x00010001;
105115
}
106116

107117
newtype_enum! {

0 commit comments

Comments
 (0)