diff --git a/uefi-raw/src/table/boot.rs b/uefi-raw/src/table/boot.rs new file mode 100644 index 000000000..e3a10ff6b --- /dev/null +++ b/uefi-raw/src/table/boot.rs @@ -0,0 +1,26 @@ +//! UEFI services available during boot. + +newtype_enum! { +/// Task priority level. +/// +/// Although the UEFI specification repeatedly states that only the variants +/// specified below should be used in application-provided input, as the other +/// are reserved for internal firmware use, it might still happen that the +/// firmware accidentally discloses one of these internal TPLs to us. +/// +/// Since feeding an unexpected variant to a Rust enum is UB, this means that +/// this C enum must be interfaced via the newtype pattern. +pub enum Tpl: usize => { + /// Normal task execution level. + APPLICATION = 4, + /// Async interrupt-style callbacks run at this TPL. + CALLBACK = 8, + /// Notifications are masked at this level. + /// + /// This is used in critical sections of code. + NOTIFY = 16, + /// Highest priority level. + /// + /// Even processor interrupts are disable at this level. + HIGH_LEVEL = 31, +}} diff --git a/uefi-raw/src/table/mod.rs b/uefi-raw/src/table/mod.rs index 1c58ea4ed..5c4b2b429 100644 --- a/uefi-raw/src/table/mod.rs +++ b/uefi-raw/src/table/mod.rs @@ -2,4 +2,6 @@ mod revision; +pub mod boot; + pub use revision::Revision; diff --git a/uefi/src/table/boot.rs b/uefi/src/table/boot.rs index cea80db6c..d3efa7b0a 100644 --- a/uefi/src/table/boot.rs +++ b/uefi/src/table/boot.rs @@ -20,6 +20,8 @@ use { ::alloc::vec::Vec, }; +pub use uefi_raw::table::boot::Tpl; + // TODO: this similar to `SyncUnsafeCell`. Once that is stabilized we // can use it instead. struct GlobalImageHandle { @@ -1673,31 +1675,6 @@ pub enum LoadImageSource<'a> { }, } -newtype_enum! { -/// Task priority level. -/// -/// Although the UEFI specification repeatedly states that only the variants -/// specified below should be used in application-provided input, as the other -/// are reserved for internal firmware use, it might still happen that the -/// firmware accidentally discloses one of these internal TPLs to us. -/// -/// Since feeding an unexpected variant to a Rust enum is UB, this means that -/// this C enum must be interfaced via the newtype pattern. -pub enum Tpl: usize => { - /// Normal task execution level. - APPLICATION = 4, - /// Async interrupt-style callbacks run at this TPL. - CALLBACK = 8, - /// Notifications are masked at this level. - /// - /// This is used in critical sections of code. - NOTIFY = 16, - /// Highest priority level. - /// - /// Even processor interrupts are disable at this level. - HIGH_LEVEL = 31, -}} - /// RAII guard for task priority level changes /// /// Will automatically restore the former task priority level when dropped.