Skip to main content

uefi_specs/
lib.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Types and constants related to the UEFI spec.
5//!
6//! This crate is divided into 3 submodules:
7//!
8//! - `uefi`: types directly lifted from the official UEFI spec
9//! - `hyperv`: types specific to the Hyper-V UEFI implementation
10//! - `linux`: types specific to UEFI on Linux
11
12#![expect(missing_docs)]
13#![forbid(unsafe_code)]
14#![no_std]
15
16// TODO: find a nice way to create const `Ucs2LeSlice` instances, and use proper
17// `const`ants instead of runtime methods...
18macro_rules! defn_nvram_var {
19    ($varname:ident = ($guid:expr, $name:literal)) => {
20        #[expect(clippy::allow_attributes)]
21        #[allow(non_snake_case)]
22        pub fn $varname() -> (Guid, &'static ucs2::Ucs2LeSlice) {
23            use ucs2::Ucs2LeSlice;
24            use zerocopy::IntoBytes;
25
26            (
27                $guid,
28                Ucs2LeSlice::from_slice_with_nul(wchar::wchz!(u16, $name).as_bytes()).unwrap(),
29            )
30        }
31    };
32}
33
34pub mod hyperv;
35pub mod linux;
36pub mod uefi;