1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//! Types and constants related to the UEFI spec.
//!
//! This crate is divided into 3 submodules:
//!
//! - `uefi`: types directly lifted from the official UEFI spec
//! - `hyperv`: types specific to the Hyper-V UEFI implementation
//! - `linux`: types specific to UEFI on Linux

#![no_std]

// TODO: find a nice way to create const `Ucs2LeSlice` instances, and use proper
// `const`ants instead of runtime methods...
macro_rules! defn_nvram_var {
    ($varname:ident = ($guid:expr, $name:literal)) => {
        #[allow(non_snake_case)]
        pub fn $varname() -> (Guid, &'static ucs2::Ucs2LeSlice) {
            use ucs2::Ucs2LeSlice;
            use zerocopy::AsBytes;

            (
                $guid,
                Ucs2LeSlice::from_slice_with_nul(wchar::wchz!(u16, $name).as_bytes()).unwrap(),
            )
        }
    };
}

pub mod hyperv;
pub mod linux;
pub mod uefi;