Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

993
vendor/r-efi/src/base.rs vendored Normal file
View File

@@ -0,0 +1,993 @@
//! UEFI Base Environment
//!
//! This module defines the base environment for UEFI development. It provides types and macros as
//! declared in the UEFI specification, as well as de-facto standard additions provided by the
//! reference implementation by Intel.
//!
//! # Target Configuration
//!
//! Wherever possible, native rust types are used to represent their UEFI counter-parts. However,
//! this means the ABI depends on the implementation of said rust types. Hence, native rust types
//! are only used where rust supports a stable ABI of said types, and their ABI matches the ABI
//! defined by the UEFI specification.
//!
//! Nevertheless, even if the ABI of a specific type is marked stable, this does not imply that it
//! is the same across architectures. For instance, rust's `u64` type has the same binary
//! representation as the `UINT64` type in UEFI. But this does not imply that it has the same
//! binary representation on `x86_64` and on `ppc64be`. As a result of this, the compilation of
//! this module is tied to the target-configuration you passed to the rust compiler. Wherever
//! possible and reasonable, any architecture differences are abstracted, though. This means that
//! in most cases you can use this module even though your target-configuration might not match
//! the native UEFI target-configuration.
//!
//! The recommend way to compile your code, is to use the native target-configuration for UEFI.
//! These configurations are not necessarily included in the upstream rust compiler. Hence, you
//! might have to craft one yourself. For all systems that we can test on, we make sure to push
//! the target configuration into upstream rust-lang.
//!
//! However, there are situations where you want to access UEFI data from a non-native host. For
//! instance, a UEFI boot loader might store data in boot variables, formatted according to types
//! declared in the UEFI specification. An OS booted thereafter might want to access these
//! variables, but it might be compiled with a different target-configuration than the UEFI
//! environment that it was booted from. A similar situation occurs when you call UEFI runtime
//! functions from your OS. In all those cases, you should very likely be able to use this module
//! to interact with UEFI as well. This is, because most bits of the target-configuration of UEFI
//! and your OS very likely match. In fact, to figure out whether this is safe, you need to make
//! sure that the rust ABI would match in both target-configurations. If it is, all other details
//! are handled within this module just fine.
//!
//! In case of doubt, contact us!
//!
//! # Core Primitives
//!
//! Several of the UEFI primitives are represented by native Rust. These have no type aliases or
//! other definitions here, but you are recommended to use native rust directly. These include:
//!
//! * `NULL`, `void *`: Void pointers have a native rust implementation in
//! [`c_void`](core::ffi::c_void). `NULL` is represented through
//! [`null`](core::ptr::null) and [`is_null()`](core::ptr) for
//! all pointer types.
//! * `uint8_t`..`uint64_t`,
//! `int8_t`..`int64_t`: Fixed-size integers are represented by their native rust equivalents
//! (`u8`..`u64`, `i8`..`i64`).
//!
//! * `UINTN`, `INTN`: Native-sized (or instruction-width sized) integers are represented by
//! their native rust equivalents (`usize`, `isize`).
//!
//! # UEFI Details
//!
//! The UEFI Specification describes its target environments in detail. Each supported
//! architecture has a separate section with details on calling conventions, CPU setup, and more.
//! You are highly recommended to conduct the UEFI Specification for details on the programming
//! environment. Following a summary of key parts relevant to rust developers:
//!
//! * Similar to rust, integers are either fixed-size, or native size. This maps nicely to the
//! native rust types. The common `long`, `int`, `short` types known from ISO-C are not used.
//! Whenever you refer to memory (either pointing to it, or remember the size of a memory
//! block), the native size integers should be your tool of choice.
//!
//! * Even though the CPU might run in any endianness, all stored data is little-endian. That
//! means, if you encounter integers split into byte-arrays (e.g.,
//! `CEfiDevicePathProtocol.length`), you must assume it is little-endian encoded. But if you
//! encounter native integers, you must assume they are encoded in native endianness.
//! For now the UEFI specification only defines little-endian architectures, hence this did not
//! pop up as actual issue. Future extensions might change this, though.
//!
//! * The Microsoft calling-convention is used. That is, all external calls to UEFI functions
//! follow a calling convention that is very similar to that used on Microsoft Windows. All
//! such ABI functions must be marked with the right calling-convention. The UEFI Specification
//! defines some additional common rules for all its APIs, though. You will most likely not see
//! any of these mentioned in the individual API documentions. So here is a short reminder:
//!
//! * Pointers must reference physical-memory locations (no I/O mappings, no
//! virtual addresses, etc.). Once ExitBootServices() was called, and the
//! virtual address mapping was set, you must provide virtual-memory
//! locations instead.
//! * Pointers must be correctly aligned.
//! * NULL is disallowed, unless explicitly mentioned otherwise.
//! * Data referenced by pointers is undefined on error-return from a
//! function.
//! * You must not pass data larger than native-size (sizeof(CEfiUSize)) on
//! the stack. You must pass them by reference.
//!
//! * Stack size is at least 128KiB and 16-byte aligned. All stack space might be marked
//! non-executable! Once ExitBootServices() was called, you must guarantee at least 4KiB of
//! stack space, 16-byte aligned for all runtime services you call.
//! Details might differ depending on architectures. But the numbers here should serve as
//! ball-park figures.
// Target Architecture
//
// The UEFI Specification explicitly lists all supported target architectures. While external
// implementors are free to port UEFI to other targets, we need information on the target
// architecture to successfully compile for it. This includes calling-conventions, register
// layouts, endianness, and more. Most of these details are hidden in the rust-target-declaration.
// However, some details are still left to the actual rust code.
//
// This initial check just makes sure the compilation is halted with a suitable error message if
// the target architecture is not supported.
//
// We try to minimize conditional compilations as much as possible. A simple search for
// `target_arch` should reveal all uses throughout the code-base. If you add your target to this
// error-check, you must adjust all other uses as well.
//
// Similarly, UEFI only defines configurations for little-endian architectures so far. Several
// bits of the specification are thus unclear how they would be applied on big-endian systems. We
// therefore mark it as unsupported. If you override this, you are on your own.
#[cfg(not(any(
target_arch = "arm",
target_arch = "aarch64",
target_arch = "riscv64",
target_arch = "x86",
target_arch = "x86_64"
)))]
compile_error!("The target architecture is not supported.");
#[cfg(not(target_endian = "little"))]
compile_error!("The target endianness is not supported.");
// eficall_abi!()
//
// This macro is the architecture-dependent implementation of eficall!(). See the documentation of
// the eficall!() macro for a description. Nowadays, this simply maps to `extern "efiapi"`, since
// this has been stabilized with rust-1.68.
#[macro_export]
#[doc(hidden)]
macro_rules! eficall_abi {
(($($prefix:tt)*),($($suffix:tt)*)) => { $($prefix)* extern "efiapi" $($suffix)* };
}
/// Annotate function with UEFI calling convention
///
/// Since rust-1.68 you can use `extern "efiapi"` as calling-convention to achieve the same
/// behavior as this macro. This macro is kept for backwards-compatibility only, but will nowadays
/// map to `extern "efiapi"`.
///
/// This macro takes a function-declaration as argument and produces the same function-declaration
/// but annotated with the correct calling convention. Since the default `extern "C"` annotation
/// depends on your compiler defaults, we cannot use it. Instead, this macro selects the default
/// for your target platform.
///
/// Ideally, the macro would expand to `extern "<abi>"` so you would be able to write:
///
/// ```ignore
/// // THIS DOES NOT WORK!
/// pub fn eficall!{} foobar() {
/// // ...
/// }
/// ```
///
/// However, macros are evaluated too late for this to work. Instead, the entire construct must be
/// wrapped in a macro, which then expands to the same construct but with `extern "<abi>"`
/// inserted at the correct place:
///
/// ```
/// use r_efi::{eficall, eficall_abi};
///
/// eficall!{pub fn foobar() {
/// // ...
/// }}
///
/// type FooBar = eficall!{fn(u8) -> (u8)};
/// ```
///
/// The `eficall!{}` macro takes either a function-type or function-definition as argument. It
/// inserts `extern "<abi>"` after the function qualifiers, but before the `fn` keyword.
///
/// # Internals
///
/// The `eficall!{}` macro tries to parse the function header so it can insert `extern "<abi>"` at
/// the right place. If, for whatever reason, this does not work with a particular syntax, you can
/// use the internal `eficall_abi!{}` macro. This macro takes two token-streams as input and
/// evaluates to the concatenation of both token-streams, but separated by the selected ABI.
///
/// For instance, the following 3 type definitions are equivalent, assuming the selected ABI
/// is "C":
///
/// ```
/// use r_efi::{eficall, eficall_abi};
///
/// type FooBar1 = unsafe extern "C" fn(u8) -> (u8);
/// type FooBar2 = eficall!{unsafe fn(u8) -> (u8)};
/// type FooBar3 = eficall_abi!{(unsafe), (fn(u8) -> (u8))};
/// ```
///
/// # Calling Conventions
///
/// The UEFI specification defines the calling convention for each platform individually. It
/// usually refers to other standards for details, but adds some restrictions on top. As of this
/// writing, it mentions:
///
/// * aarch32 / arm: The `aapcs` calling-convention is used. It is native to aarch32 and described
/// in a document called
/// "Procedure Call Standard for the ARM Architecture". It is openly distributed
/// by ARM and widely known under the keyword `aapcs`.
/// * aarch64: The `aapcs64` calling-convention is used. It is native to aarch64 and described in
/// a document called
/// "Procedure Call Standard for the ARM 64-bit Architecture (AArch64)". It is openly
/// distributed by ARM and widely known under the keyword `aapcs64`.
/// * ia-64: The "P64 C Calling Convention" as described in the
/// "Itanium Software Conventions and Runtime Architecture Guide". It is also
/// standardized in the "Intel Itanium SAL Specification".
/// * RISC-V: The "Standard RISC-V C Calling Convention" is used. The UEFI specification
/// describes it in detail, but also refers to the official RISC-V resources for
/// detailed information.
/// * x86 / ia-32: The `cdecl` C calling convention is used. Originated in the C Language and
/// originally tightly coupled to C specifics. Unclear whether a formal
/// specification exists (does anyone know?). Most compilers support it under the
/// `cdecl` keyword, and in nearly all situations it is the default on x86.
/// * x86_64 / amd64 / x64: The `win64` calling-convention is used. It is similar to the `sysv64`
/// convention that is used on most non-windows x86_64 systems, but not
/// exactly the same. Microsoft provides open documentation on it. See
/// MSDN "x64 Software Conventions -> Calling Conventions".
/// The UEFI Specification does not directly refer to `win64`, but
/// contains a full specification of the calling convention itself.
///
/// Note that in most cases the UEFI Specification adds several more restrictions on top of the
/// common calling-conventions. These restrictions usually do not affect how the compiler will lay
/// out the function calls. Instead, it usually only restricts the set of APIs that are allowed in
/// UEFI. Therefore, most compilers already support the calling conventions used on UEFI.
///
/// # Variadics
///
/// For some reason, the rust compiler allows variadics only in combination with the `"C"` calling
/// convention, even if the selected calling-convention matches what `"C"` would select on the
/// target platform. Hence, you will very likely be unable to use variadics with this macro.
/// Luckily, all of the UEFI functions that use variadics are wrappers around more low-level
/// accessors, so they are not necessarily required.
#[macro_export]
macro_rules! eficall {
// Muncher
//
// The `@munch()` rules are internal and should not be invoked directly. We walk through the
// input, moving one token after the other from the suffix into the prefix until we find the
// position where to insert `extern "<abi>"`. This muncher never drops any tokens, hence we
// can safely match invalid statements just fine, as the compiler will later print proper
// diagnostics when parsing the macro output.
// Once done, we invoke the `eficall_abi!{}` macro, which simply inserts the correct ABI.
(@munch(($($prefix:tt)*),(pub $($suffix:tt)*))) => { eficall!{@munch(($($prefix)* pub),($($suffix)*))} };
(@munch(($($prefix:tt)*),(unsafe $($suffix:tt)*))) => { eficall!{@munch(($($prefix)* unsafe),($($suffix)*))} };
(@munch(($($prefix:tt)*),($($suffix:tt)*))) => { eficall_abi!{($($prefix)*),($($suffix)*)} };
// Entry Point
//
// This captures the entire argument and invokes its own TT-muncher, but splits the input into
// prefix and suffix, so the TT-muncher can walk through it. Note that initially everything is
// in the suffix and the prefix is empty.
($($arg:tt)*) => { eficall!{@munch((),($($arg)*))} };
}
/// Boolean Type
///
/// This boolean type works very similar to the rust primitive type of [`bool`]. However, the rust
/// primitive type has no stable ABI, hence we provide this type to represent booleans on the FFI
/// interface.
///
/// UEFI defines booleans to be 1-byte integers, which can only have the values of `0` or `1`.
/// However, in practice anything non-zero is considered `true` by nearly all UEFI systems. Hence,
/// this type implements a boolean over `u8` and maps `0` to `false`, everything else to `true`.
///
/// The binary representation of this type is ABI. That is, you are allowed to transmute from and
/// to `u8`. Furthermore, this type never modifies its binary representation. If it was
/// initialized as, or transmuted from, a specific integer value, this value will be retained.
/// However, on the rust side you will never see the integer value. It instead behaves truly as a
/// boolean. If you need access to the integer value, you have to transmute it back to `u8`.
#[repr(C)]
#[derive(Clone, Copy, Debug)]
// Manual impls for: Default, Eq, Hash, Ord, PartialEq, PartialOrd
pub struct Boolean(u8);
/// Single-byte Character Type
///
/// The `Char8` type represents single-byte characters. UEFI defines them to be ASCII compatible,
/// using the ISO-Latin-1 character set.
pub type Char8 = u8;
/// Dual-byte Character Type
///
/// The `Char16` type represents dual-byte characters. UEFI defines them to be UCS-2 encoded.
pub type Char16 = u16;
/// Status Codes
///
/// UEFI uses the `Status` type to represent all kinds of status codes. This includes return codes
/// from functions, but also complex state of different devices and drivers. It is a simple
/// `usize`, but wrapped in a rust-type to allow us to implement helpers on this type. Depending
/// on the context, different state is stored in it. Note that it is always binary compatible to a
/// usize!
#[repr(C)]
#[derive(Clone, Copy, Debug, Default)]
#[derive(Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Status(usize);
/// Object Handles
///
/// Handles represent access to an opaque object. Handles are untyped by default, but get a
/// meaning when you combine them with an interface. Internally, they are simple void pointers. It
/// is the UEFI driver model that applies meaning to them.
pub type Handle = *mut core::ffi::c_void;
/// Event Objects
///
/// Event objects represent hooks into the main-loop of a UEFI environment. They allow to register
/// callbacks, to be invoked when a specific event happens. In most cases you use events to
/// register timer-based callbacks, as well as chaining events together. Internally, they are
/// simple void pointers. It is the UEFI task management that applies meaning to them.
pub type Event = *mut core::ffi::c_void;
/// Logical Block Addresses
///
/// The LBA type is used to denote logical block addresses of block devices. It is a simple 64-bit
/// integer, that is used to denote addresses when working with block devices.
pub type Lba = u64;
/// Thread Priority Levels
///
/// The process model of UEFI systems is highly simplified. Priority levels are used to order
/// execution of pending tasks. The TPL type denotes a priority level of a specific task. The
/// higher the number, the higher the priority. It is a simple integer type, but its range is
/// usually highly restricted. The UEFI task management provides constants and accessors for TPLs.
pub type Tpl = usize;
/// Physical Memory Address
///
/// A simple 64bit integer containing a physical memory address.
pub type PhysicalAddress = u64;
/// Virtual Memory Address
///
/// A simple 64bit integer containing a virtual memory address.
pub type VirtualAddress = u64;
/// Application Entry Point
///
/// This type defines the entry-point of UEFI applications. It is ABI and cannot be changed.
/// Whenever you load UEFI images, the entry-point is called with this signature.
///
/// In most cases the UEFI image (or application) is unloaded when control returns from the entry
/// point. In case of UEFI drivers, they can request to stay loaded until an explicit unload.
///
/// The system table is provided as mutable pointer. This is, because there is no guarantee that
/// timer interrupts do not modify the table. Furthermore, exiting boot services causes several
/// modifications on that table. And lastly, the system table lives longer than the function
/// invocation, if invoked as an UEFI driver.
/// In most cases it is perfectly fine to cast the pointer to a real rust reference. However, this
/// should be an explicit decision by the caller.
pub type ImageEntryPoint = eficall! {fn(Handle, *mut crate::system::SystemTable) -> Status};
/// Globally Unique Identifiers
///
/// The `Guid` type represents globally unique identifiers as defined by RFC-4122 (i.e., only the
/// `10x` variant is used), with the caveat that LE is used instead of BE.
///
/// Note that only the binary representation of Guids is stable. You are highly recommended to
/// interpret Guids as 128bit integers.
///
/// The UEFI specification requires the type to be 64-bit aligned, yet EDK2 uses a mere 32-bit
/// alignment. Hence, for compatibility, a 32-bit alignment is used.
///
/// UEFI uses the Microsoft-style Guid format. Hence, a lot of documentation and code refers to
/// these Guids. If you thusly cannot treat Guids as 128-bit integers, this Guid type allows you
/// to access the individual fields of the Microsoft-style Guid. A reminder of the Guid encoding:
///
/// ```text
/// 0 1 2 3
/// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// | time_low |
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// | time_mid | time_hi_and_version |
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// |clk_seq_hi_res | clk_seq_low | node (0-1) |
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// | node (2-5) |
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// ```
///
/// The individual fields are encoded as little-endian. Accessors are provided for the Guid
/// structure allowing access to these fields in native endian byte order.
#[repr(C, align(4))]
#[derive(Clone, Copy, Debug)]
#[derive(Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Guid {
time_low: [u8; 4],
time_mid: [u8; 2],
time_hi_and_version: [u8; 2],
clk_seq_hi_res: u8,
clk_seq_low: u8,
node: [u8; 6],
}
/// Network MAC Address
///
/// This type encapsulates a single networking media access control address
/// (MAC). It is a simple 32 bytes buffer with no special alignment. Note that
/// no comparison function are defined by default, since trailing bytes of the
/// address might be random.
///
/// The interpretation of the content differs depending on the protocol it is
/// used with. See each documentation for details. In most cases this contains
/// an Ethernet address.
#[repr(C)]
#[derive(Clone, Copy, Debug)]
#[derive(Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct MacAddress {
pub addr: [u8; 32],
}
/// IPv4 Address
///
/// Binary representation of an IPv4 address. It is encoded in network byte
/// order (i.e., big endian). Note that no special alignment restrictions are
/// defined by the standard specification.
#[repr(C)]
#[derive(Clone, Copy, Debug, Default)]
#[derive(Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Ipv4Address {
pub addr: [u8; 4],
}
/// IPv6 Address
///
/// Binary representation of an IPv6 address, encoded in network byte order
/// (i.e., big endian). Similar to the IPv4 address, no special alignment
/// restrictions are defined by the standard specification.
#[repr(C)]
#[derive(Clone, Copy, Debug)]
#[derive(Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Ipv6Address {
pub addr: [u8; 16],
}
/// IP Address
///
/// A union type over the different IP addresses available. Alignment is always
/// fixed to 4-bytes. Note that trailing bytes might be random, so no
/// comparison functions are derived.
#[repr(C, align(4))]
#[derive(Clone, Copy)]
pub union IpAddress {
pub addr: [u32; 4],
pub v4: Ipv4Address,
pub v6: Ipv6Address,
}
impl Boolean {
/// Literal False
///
/// This constant represents the `false` value of the `Boolean` type.
pub const FALSE: Boolean = Boolean(0u8);
/// Literal True
///
/// This constant represents the `true` value of the `Boolean` type.
pub const TRUE: Boolean = Boolean(1u8);
}
impl From<u8> for Boolean {
fn from(v: u8) -> Self {
Boolean(v)
}
}
impl From<bool> for Boolean {
fn from(v: bool) -> Self {
match v {
false => Boolean::FALSE,
true => Boolean::TRUE,
}
}
}
impl Default for Boolean {
fn default() -> Self {
Self::FALSE
}
}
impl From<Boolean> for u8 {
fn from(v: Boolean) -> Self {
match v.0 {
0 => 0,
_ => 1,
}
}
}
impl From<Boolean> for bool {
fn from(v: Boolean) -> Self {
match v.0 {
0 => false,
_ => true,
}
}
}
impl Eq for Boolean {}
impl core::hash::Hash for Boolean {
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
bool::from(*self).hash(state)
}
}
impl Ord for Boolean {
fn cmp(&self, other: &Boolean) -> core::cmp::Ordering {
bool::from(*self).cmp(&(*other).into())
}
}
impl PartialEq for Boolean {
fn eq(&self, other: &Boolean) -> bool {
bool::from(*self).eq(&(*other).into())
}
}
impl PartialEq<bool> for Boolean {
fn eq(&self, other: &bool) -> bool {
bool::from(*self).eq(other)
}
}
impl PartialOrd for Boolean {
fn partial_cmp(&self, other: &Boolean) -> Option<core::cmp::Ordering> {
bool::from(*self).partial_cmp(&(*other).into())
}
}
impl PartialOrd<bool> for Boolean {
fn partial_cmp(&self, other: &bool) -> Option<core::cmp::Ordering> {
bool::from(*self).partial_cmp(other)
}
}
impl Status {
const WIDTH: usize = 8usize * core::mem::size_of::<Status>();
const MASK: usize = 0xc0 << (Status::WIDTH - 8);
const ERROR_MASK: usize = 0x80 << (Status::WIDTH - 8);
const WARNING_MASK: usize = 0x00 << (Status::WIDTH - 8);
/// Success Code
///
/// This code represents a successfull function invocation. Its value is guaranteed to be 0.
/// However, note that warnings are considered success as well, so this is not the only code
/// that can be returned by UEFI functions on success. However, in nearly all situations
/// warnings are not allowed, so the effective result will be SUCCESS.
pub const SUCCESS: Status = Status::from_usize(0);
// List of predefined error codes
pub const LOAD_ERROR: Status = Status::from_usize(1 | Status::ERROR_MASK);
pub const INVALID_PARAMETER: Status = Status::from_usize(2 | Status::ERROR_MASK);
pub const UNSUPPORTED: Status = Status::from_usize(3 | Status::ERROR_MASK);
pub const BAD_BUFFER_SIZE: Status = Status::from_usize(4 | Status::ERROR_MASK);
pub const BUFFER_TOO_SMALL: Status = Status::from_usize(5 | Status::ERROR_MASK);
pub const NOT_READY: Status = Status::from_usize(6 | Status::ERROR_MASK);
pub const DEVICE_ERROR: Status = Status::from_usize(7 | Status::ERROR_MASK);
pub const WRITE_PROTECTED: Status = Status::from_usize(8 | Status::ERROR_MASK);
pub const OUT_OF_RESOURCES: Status = Status::from_usize(9 | Status::ERROR_MASK);
pub const VOLUME_CORRUPTED: Status = Status::from_usize(10 | Status::ERROR_MASK);
pub const VOLUME_FULL: Status = Status::from_usize(11 | Status::ERROR_MASK);
pub const NO_MEDIA: Status = Status::from_usize(12 | Status::ERROR_MASK);
pub const MEDIA_CHANGED: Status = Status::from_usize(13 | Status::ERROR_MASK);
pub const NOT_FOUND: Status = Status::from_usize(14 | Status::ERROR_MASK);
pub const ACCESS_DENIED: Status = Status::from_usize(15 | Status::ERROR_MASK);
pub const NO_RESPONSE: Status = Status::from_usize(16 | Status::ERROR_MASK);
pub const NO_MAPPING: Status = Status::from_usize(17 | Status::ERROR_MASK);
pub const TIMEOUT: Status = Status::from_usize(18 | Status::ERROR_MASK);
pub const NOT_STARTED: Status = Status::from_usize(19 | Status::ERROR_MASK);
pub const ALREADY_STARTED: Status = Status::from_usize(20 | Status::ERROR_MASK);
pub const ABORTED: Status = Status::from_usize(21 | Status::ERROR_MASK);
pub const ICMP_ERROR: Status = Status::from_usize(22 | Status::ERROR_MASK);
pub const TFTP_ERROR: Status = Status::from_usize(23 | Status::ERROR_MASK);
pub const PROTOCOL_ERROR: Status = Status::from_usize(24 | Status::ERROR_MASK);
pub const INCOMPATIBLE_VERSION: Status = Status::from_usize(25 | Status::ERROR_MASK);
pub const SECURITY_VIOLATION: Status = Status::from_usize(26 | Status::ERROR_MASK);
pub const CRC_ERROR: Status = Status::from_usize(27 | Status::ERROR_MASK);
pub const END_OF_MEDIA: Status = Status::from_usize(28 | Status::ERROR_MASK);
pub const END_OF_FILE: Status = Status::from_usize(31 | Status::ERROR_MASK);
pub const INVALID_LANGUAGE: Status = Status::from_usize(32 | Status::ERROR_MASK);
pub const COMPROMISED_DATA: Status = Status::from_usize(33 | Status::ERROR_MASK);
pub const IP_ADDRESS_CONFLICT: Status = Status::from_usize(34 | Status::ERROR_MASK);
pub const HTTP_ERROR: Status = Status::from_usize(35 | Status::ERROR_MASK);
// List of error codes from protocols
// UDP4
pub const NETWORK_UNREACHABLE: Status = Status::from_usize(100 | Status::ERROR_MASK);
pub const HOST_UNREACHABLE: Status = Status::from_usize(101 | Status::ERROR_MASK);
pub const PROTOCOL_UNREACHABLE: Status = Status::from_usize(102 | Status::ERROR_MASK);
pub const PORT_UNREACHABLE: Status = Status::from_usize(103 | Status::ERROR_MASK);
// TCP4
pub const CONNECTION_FIN: Status = Status::from_usize(104 | Status::ERROR_MASK);
pub const CONNECTION_RESET: Status = Status::from_usize(105 | Status::ERROR_MASK);
pub const CONNECTION_REFUSED: Status = Status::from_usize(106 | Status::ERROR_MASK);
// List of predefined warning codes
pub const WARN_UNKNOWN_GLYPH: Status = Status::from_usize(1 | Status::WARNING_MASK);
pub const WARN_DELETE_FAILURE: Status = Status::from_usize(2 | Status::WARNING_MASK);
pub const WARN_WRITE_FAILURE: Status = Status::from_usize(3 | Status::WARNING_MASK);
pub const WARN_BUFFER_TOO_SMALL: Status = Status::from_usize(4 | Status::WARNING_MASK);
pub const WARN_STALE_DATA: Status = Status::from_usize(5 | Status::WARNING_MASK);
pub const WARN_FILE_SYSTEM: Status = Status::from_usize(6 | Status::WARNING_MASK);
pub const WARN_RESET_REQUIRED: Status = Status::from_usize(7 | Status::WARNING_MASK);
/// Create Status Code from Integer
///
/// This takes the literal value of a status code and turns it into a `Status` object. Note
/// that we want it as `const fn` so we cannot use `core::convert::From`.
pub const fn from_usize(v: usize) -> Status {
Status(v)
}
/// Return Underlying Integer Representation
///
/// This takes the `Status` object and returns the underlying integer representation as
/// defined by the UEFI specification.
pub const fn as_usize(&self) -> usize {
self.0
}
fn value(&self) -> usize {
self.0
}
fn mask(&self) -> usize {
self.value() & Status::MASK
}
/// Check whether this is an error
///
/// This returns true if the given status code is considered an error. Errors mean the
/// operation did not succeed, nor produce any valuable output. Output parameters must be
/// considered invalid if an error was returned. That is, its content is not well defined.
pub fn is_error(&self) -> bool {
self.mask() == Status::ERROR_MASK
}
/// Check whether this is a warning
///
/// This returns true if the given status code is considered a warning. Warnings are to be
/// treated as success, but might indicate data loss or other device errors. However, if an
/// operation returns with a warning code, it must be considered successfull, and the output
/// parameters are valid.
pub fn is_warning(&self) -> bool {
self.value() != 0 && self.mask() == Status::WARNING_MASK
}
}
impl From<Status> for Result<Status, Status> {
fn from(status: Status) -> Self {
if status.is_error() {
Err(status)
} else {
Ok(status)
}
}
}
impl Guid {
const fn u32_to_bytes_le(num: u32) -> [u8; 4] {
[
num as u8,
(num >> 8) as u8,
(num >> 16) as u8,
(num >> 24) as u8,
]
}
const fn u32_from_bytes_le(bytes: &[u8; 4]) -> u32 {
(bytes[0] as u32)
| ((bytes[1] as u32) << 8)
| ((bytes[2] as u32) << 16)
| ((bytes[3] as u32) << 24)
}
const fn u16_to_bytes_le(num: u16) -> [u8; 2] {
[num as u8, (num >> 8) as u8]
}
const fn u16_from_bytes_le(bytes: &[u8; 2]) -> u16 {
(bytes[0] as u16) | ((bytes[1] as u16) << 8)
}
/// Initialize a Guid from its individual fields
///
/// This function initializes a Guid object given the individual fields as specified in the
/// UEFI specification. That is, if you simply copy the literals from the specification into
/// your code, this function will correctly initialize the Guid object.
///
/// In other words, this takes the individual fields in native endian and converts them to the
/// correct endianness for a UEFI Guid.
///
/// Due to the fact that UEFI Guids use variant 2 of the UUID specification in a little-endian
/// (or even mixed-endian) format, the following transformation is likely applied from text
/// representation to binary representation:
///
/// 00112233-4455-6677-8899-aabbccddeeff
/// =>
/// 33 22 11 00 55 44 77 66 88 99 aa bb cc dd ee ff
///
/// (Note that UEFI protocols often use `88-99` instead of `8899`)
/// The first 3 parts use little-endian notation, the last 2 use big-endian.
pub const fn from_fields(
time_low: u32,
time_mid: u16,
time_hi_and_version: u16,
clk_seq_hi_res: u8,
clk_seq_low: u8,
node: &[u8; 6],
) -> Guid {
Guid {
time_low: Self::u32_to_bytes_le(time_low),
time_mid: Self::u16_to_bytes_le(time_mid),
time_hi_and_version: Self::u16_to_bytes_le(time_hi_and_version),
clk_seq_hi_res: clk_seq_hi_res,
clk_seq_low: clk_seq_low,
node: *node,
}
}
/// Access a Guid as individual fields
///
/// This decomposes a Guid back into the individual fields as given in the specification. The
/// individual fields are returned in native-endianness.
pub const fn as_fields(&self) -> (u32, u16, u16, u8, u8, &[u8; 6]) {
(
Self::u32_from_bytes_le(&self.time_low),
Self::u16_from_bytes_le(&self.time_mid),
Self::u16_from_bytes_le(&self.time_hi_and_version),
self.clk_seq_hi_res,
self.clk_seq_low,
&self.node,
)
}
/// Initialize a Guid from its byte representation
///
/// Create a new Guid object from its byte representation. This
/// reinterprets the bytes as a Guid and copies them into a new Guid
/// instance. Note that you can safely transmute instead.
///
/// See `as_bytes()` for the inverse operation.
pub const fn from_bytes(bytes: &[u8; 16]) -> Self {
unsafe { core::mem::transmute::<[u8; 16], Guid>(*bytes) }
}
/// Access a Guid as raw byte array
///
/// This provides access to a Guid through a byte array. It is a simple re-interpretation of
/// the Guid value as a 128-bit byte array. No conversion is performed. This is a simple cast.
pub const fn as_bytes(&self) -> &[u8; 16] {
unsafe { core::mem::transmute::<&Guid, &[u8; 16]>(self) }
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::mem::{align_of, size_of};
// Helper to compute a hash of an object.
fn hash<T: core::hash::Hash>(v: &T) -> u64 {
let mut h = std::hash::DefaultHasher::new();
v.hash(&mut h);
core::hash::Hasher::finish(&h)
}
// Verify Type Size and Alignemnt
//
// Since UEFI defines explicitly the ABI of their types, we can verify that our implementation
// is correct by checking the size and alignment of the ABI types matches what the spec
// mandates.
#[test]
fn type_size_and_alignment() {
//
// Booleans
//
assert_eq!(size_of::<Boolean>(), 1);
assert_eq!(align_of::<Boolean>(), 1);
//
// Char8 / Char16
//
assert_eq!(size_of::<Char8>(), 1);
assert_eq!(align_of::<Char8>(), 1);
assert_eq!(size_of::<Char16>(), 2);
assert_eq!(align_of::<Char16>(), 2);
assert_eq!(size_of::<Char8>(), size_of::<u8>());
assert_eq!(align_of::<Char8>(), align_of::<u8>());
assert_eq!(size_of::<Char16>(), size_of::<u16>());
assert_eq!(align_of::<Char16>(), align_of::<u16>());
//
// Status
//
assert_eq!(size_of::<Status>(), size_of::<usize>());
assert_eq!(align_of::<Status>(), align_of::<usize>());
//
// Handles / Events
//
assert_eq!(size_of::<Handle>(), size_of::<usize>());
assert_eq!(align_of::<Handle>(), align_of::<usize>());
assert_eq!(size_of::<Event>(), size_of::<usize>());
assert_eq!(align_of::<Event>(), align_of::<usize>());
assert_eq!(size_of::<Handle>(), size_of::<*mut ()>());
assert_eq!(align_of::<Handle>(), align_of::<*mut ()>());
assert_eq!(size_of::<Event>(), size_of::<*mut ()>());
assert_eq!(align_of::<Event>(), align_of::<*mut ()>());
//
// Lba / Tpl
//
assert_eq!(size_of::<Lba>(), size_of::<u64>());
assert_eq!(align_of::<Lba>(), align_of::<u64>());
assert_eq!(size_of::<Tpl>(), size_of::<usize>());
assert_eq!(align_of::<Tpl>(), align_of::<usize>());
//
// PhysicalAddress / VirtualAddress
//
assert_eq!(size_of::<PhysicalAddress>(), size_of::<u64>());
assert_eq!(align_of::<PhysicalAddress>(), align_of::<u64>());
assert_eq!(size_of::<VirtualAddress>(), size_of::<u64>());
assert_eq!(align_of::<VirtualAddress>(), align_of::<u64>());
//
// ImageEntryPoint
//
assert_eq!(size_of::<ImageEntryPoint>(), size_of::<fn()>());
assert_eq!(align_of::<ImageEntryPoint>(), align_of::<fn()>());
//
// Guid
//
assert_eq!(size_of::<Guid>(), 16);
assert_eq!(align_of::<Guid>(), 4);
//
// Networking Types
//
assert_eq!(size_of::<MacAddress>(), 32);
assert_eq!(align_of::<MacAddress>(), 1);
assert_eq!(size_of::<Ipv4Address>(), 4);
assert_eq!(align_of::<Ipv4Address>(), 1);
assert_eq!(size_of::<Ipv6Address>(), 16);
assert_eq!(align_of::<Ipv6Address>(), 1);
assert_eq!(size_of::<IpAddress>(), 16);
assert_eq!(align_of::<IpAddress>(), 4);
}
#[test]
fn eficall() {
//
// Make sure the eficall!{} macro can deal with all kinds of function callbacks.
//
let _: eficall! {fn()};
let _: eficall! {unsafe fn()};
let _: eficall! {fn(i32)};
let _: eficall! {fn(i32) -> i32};
let _: eficall! {fn(i32, i32) -> (i32, i32)};
eficall! {fn _unused00() {}}
eficall! {unsafe fn _unused01() {}}
eficall! {pub unsafe fn _unused02() {}}
}
// Verify Boolean ABI
//
// Even though booleans are strictly 1-bit, and thus 0 or 1, in practice all UEFI systems
// treat it more like C does, and a boolean formatted as `u8` now allows any value other than
// 0 to represent `true`. Make sure we support the same.
#[test]
fn booleans() {
// Verify PartialEq works.
assert_ne!(Boolean::FALSE, Boolean::TRUE);
// Verify Boolean<->bool conversion and comparison works.
assert_eq!(Boolean::FALSE, false);
assert_eq!(Boolean::TRUE, true);
// Iterate all possible values for `u8` and verify 0 behaves as `false`, and everything
// else behaves as `true`. We verify both, the natural constructor through `From`, as well
// as a transmute.
for i in 0u8..=255u8 {
let v1: Boolean = i.into();
let v2: Boolean = unsafe { std::mem::transmute::<u8, Boolean>(i) };
assert_eq!(v1, v2);
assert_eq!(v1, v1);
assert_eq!(v2, v2);
match i {
0 => {
assert_eq!(v1, Boolean::FALSE);
assert_eq!(v1, false);
assert_eq!(v2, Boolean::FALSE);
assert_eq!(v2, false);
assert_ne!(v1, Boolean::TRUE);
assert_ne!(v1, true);
assert_ne!(v2, Boolean::TRUE);
assert_ne!(v2, true);
assert!(v1 < Boolean::TRUE);
assert!(v1 < true);
assert!(v1 >= Boolean::FALSE);
assert!(v1 >= false);
assert!(v1 <= Boolean::FALSE);
assert!(v1 <= false);
assert_eq!(v1.cmp(&true.into()), core::cmp::Ordering::Less);
assert_eq!(v1.cmp(&false.into()), core::cmp::Ordering::Equal);
assert_eq!(hash(&v1), hash(&false));
}
_ => {
assert_eq!(v1, Boolean::TRUE);
assert_eq!(v1, true);
assert_eq!(v2, Boolean::TRUE);
assert_eq!(v2, true);
assert_ne!(v1, Boolean::FALSE);
assert_ne!(v1, false);
assert_ne!(v2, Boolean::FALSE);
assert_ne!(v2, false);
assert!(v1 <= Boolean::TRUE);
assert!(v1 <= true);
assert!(v1 >= Boolean::TRUE);
assert!(v1 >= true);
assert!(v1 > Boolean::FALSE);
assert!(v1 > false);
assert_eq!(v1.cmp(&true.into()), core::cmp::Ordering::Equal);
assert_eq!(v1.cmp(&false.into()), core::cmp::Ordering::Greater);
assert_eq!(hash(&v1), hash(&true));
}
}
}
}
// Verify Guid Manipulations
//
// Test that creation of Guids from fields and bytes yields the expected
// values, and conversions work as expected.
#[test]
fn guid() {
let fields = (
0x550e8400,
0xe29b,
0x41d4,
0xa7,
0x16,
&[0x44, 0x66, 0x55, 0x44, 0x00, 0x00],
);
#[rustfmt::skip]
let bytes = [
0x00, 0x84, 0x0e, 0x55,
0x9b, 0xe2,
0xd4, 0x41,
0xa7,
0x16,
0x44, 0x66, 0x55, 0x44, 0x00, 0x00,
];
let (f0, f1, f2, f3, f4, f5) = fields;
let g_fields = Guid::from_fields(f0, f1, f2, f3, f4, f5);
let g_bytes = Guid::from_bytes(&bytes);
assert_eq!(g_fields, g_bytes);
assert_eq!(g_fields.as_bytes(), &bytes);
assert_eq!(g_bytes.as_fields(), fields);
}
}

1300
vendor/r-efi/src/hii.rs vendored Normal file

File diff suppressed because it is too large Load Diff

182
vendor/r-efi/src/lib.rs vendored Normal file
View File

@@ -0,0 +1,182 @@
//! UEFI Reference Specification Protocol Constants and Definitions
//!
//! This project provides protocol constants and definitions as defined in the UEFI Reference
//! Specification. The aim is to provide all these constants as C-ABI compatible imports to rust.
//! Safe rust abstractions over the UEFI API are out of scope of this project. That is, the
//! purpose is really just to extract all the bits and pieces from the specification and provide
//! them as rust types and constants.
//!
//! While we strongly recommend using safe abstractions to interact with UEFI systems, this
//! project serves both as base to write those abstractions, but also as last resort if you have
//! to deal with quirks and peculiarities of UEFI systems directly. Therefore, several examples
//! are included, which show how to interact with UEFI systems from rust. These serve both as
//! documentation for anyone interested in how the system works, but also as base for anyone
//! implementing safe abstractions on top.
//!
//! # Target Configuration
//!
//! Rust code can be compiled natively for UEFI systems. However, you are quite unlikely to have a
//! rust compiler running in an UEFI environment. Therefore, you will most likely want to cross
//! compile your rust code for UEFI systems. To do this, you need a target-configuration for UEFI
//! systems. As of rust-1.61, upstream rust includes the following UEFI targets:
//!
//! * `aarch64-unknown-uefi`: A native UEFI target for aarch64 systems (64bit ARM).
//! * `i686-unknown-uefi`: A native UEFI target for i686 systems (32bit Intel x86).
//! * `x86_64-unknown-uefi`: A native UEFI target for x86-64 systems (64bit Intel x86).
//!
//! If none of these targets match your architecture, you have to create the target specification
//! yourself. Feel free to contact the `r-efi` project for help.
//!
//! # Transpose Guidelines
//!
//! The UEFI specification provides C language symbols and definitions of all
//! its protocols and features. Those are integral parts of the specification
//! and UEFI programming is often tightly coupled with the C language. For
//! better compatibility to existing UEFI documentation, all the rust symbols
//! are transposed from C following strict rules, aiming for close similarity
//! to specification. This section gives a rationale on some of the less
//! obvious choices and tries to describe as many of those rules as possible.
//!
//! * `no enums`: Rust enums do not allow random discriminant values. However,
//! many UEFI enumerations use reserved ranges for vendor defined values.
//! These cannot be represented with rust enums in an efficient manner.
//! Hence, any enumerations are turned into rust constants with an
//! accompanying type alias.
//!
//! A detailed discussion can be found in:
//!
//! ```gitlog
//! commit 401a91901e860a5c0cd0f92b75dda0a72cf65322
//! Author: David Rheinsberg <david.rheinsberg@gmail.com>
//! Date: Wed Apr 21 12:07:07 2021 +0200
//!
//! r-efi: convert enums to constants
//! ```
//!
//! * `no incomplete types`: Several structures use incomplete structure types
//! by using an unbound array as last member. While rust can easily
//! represent those within its type-system, such structures become DSTs,
//! hence even raw pointers to them become fat-pointers, and would thus
//! violate the UEFI ABI.
//!
//! Instead, we use const-generics to allow compile-time adjustment of the
//! variable-sized structures, with a default value of 0. This allows
//! computing different sizes of the structures without any runtime overhead.
//!
//! * `nullable callbacks as Option`: Rust has no raw function pointers, but
//! just normal Rust function pointers. Those, however, have no valid null
//! value. The Rust ABI guarantees that `Option<fn ...>` is an C-ABI
//! compatible replacement for nullable function pointers, with `None` being
//! mapped to `NULL`. Hence, whenever UEFI APIs require nullable function
//! pointers, we use `Option<fn ...>`.
//!
//! * `prefer *mut over *const`: Whenever we transpose pointers from the
//! specification into Rust, we prefer `*mut` in almost all cases. `*const`
//! should only be used if the underlying value is known not to be accessible
//! via any other mutable pointer type. Since this is rarely the case in
//! UEFI, we avoid it.
//!
//! The reasoning is that Rust allows coercing immutable types into `*const`
//! pointers, without any explicit casting required. However, immutable Rust
//! references require that no other mutable reference exists simultaneously.
//! This is not a guarantee of `const`-pointers in C / UEFI, hence this
//! coercion is usually ill-advised or even wrong.
//!
//! Lastly, note that `*mut` and `*const` and be `as`-casted in both
//! directions without violating any Rust guarantees. Any UB concerns always
//! stem from the safety guarantees of the surrounding code, not of the
//! raw-pointer handling.
//!
//! # Specification Details
//!
//! This section lists errata of, and general comments on, the UEFI
//! specification relevant to the development of `r-efi`:
//!
//! * The `Unload` function-pointer of the LoadedImageProtocol can be `NULL`,
//! despite the protocol documentation lacking any mention of this. Other
//! parts of the specification refer to images lacking an unload function,
//! but there is no explicit documentation how this manifests in the
//! protocol structure. EDK2 assumes `NULL` indicates a lack of unload
//! function, and an errata has been submitted to the UEFI forum.
//!
//! * The specification mandates an 8-byte alignment for the `GUID` structure
//! However, all widespread implementations (including EDK2) use a 4-byte
//! alignment. An errata has been reported to EDK2 (still pending).
//!
//! # Examples
//!
//! To write free-standing UEFI applications, you need to disable the entry-point provided by rust
//! and instead provide your own. Most target-configurations look for a function called `efi_main`
//! during linking and set it as entry point. If you use the target-configurations provided with
//! upstream rust, they will pick the function called `efi_main` as entry-point.
//!
//! The following example shows a minimal UEFI application, which simply returns success upon
//! invocation. Note that you must provide your own panic-handler when running without `libstd`.
//! In our case, we use a trivial implementation that simply loops forever.
//!
//! ```ignore
//! #![no_main]
//! #![no_std]
//!
//! use r_efi::efi;
//!
//! #[panic_handler]
//! fn panic_handler(_info: &core::panic::PanicInfo) -> ! {
//! loop {}
//! }
//!
//! #[export_name = "efi_main"]
//! pub extern fn main(_h: efi::Handle, _st: *mut efi::SystemTable) -> efi::Status {
//! efi::Status::SUCCESS
//! }
//! ```
// Mark this crate as `no_std`. We have no std::* dependencies (and we better don't have them),
// so no reason to require it. This does not mean that you cannot use std::* with UEFI. You have
// to port it to UEFI first, though.
//
// In case of unit-test compilation, we pull in `std` and drop the `no_std` marker. This allows
// basic unit-tests on the compilation host. For integration tests, we have separate compilation
// units, so they will be unaffected by this.
#![cfg_attr(not(test), no_std)]
// Import the different core modules. We separate them into different modules to make it easier to
// work on them and describe what each part implements. This is different to the reference
// implementation, which uses a flat namespace due to its origins in the C language. For
// compatibility, we provide this flat namespace as well. See the `efi` submodule.
#[macro_use]
pub mod base;
#[macro_use]
pub mod hii;
#[macro_use]
pub mod system;
// Import the protocols. Each protocol is separated into its own module, readily imported by the
// meta `protocols` module. Note that this puts all symbols into their respective protocol
// namespace, thus clearly separating them (unlike the UEFI Specification, which more often than
// not violates its own namespacing).
pub mod protocols;
// Import vendor protocols. They are just like protocols in `protocols`, but
// separated for better namespacing.
pub mod vendor;
/// Flat EFI Namespace
///
/// The EFI namespace re-exports all symbols in a single, flat namespace. This allows mirroring
/// the entire EFI namespace as given in the specification and makes it easier to refer to them
/// with the same names as the reference C implementation.
///
/// Note that the individual protocols are put into submodules. The specification does this in
/// most parts as well (by prefixing all symbols). This is not true in all cases, as the
/// specification suffers from lack of namespaces in the reference C language. However, we decided
/// to namespace the remaining bits as well, for better consistency throughout the API. This
/// should be self-explanatory in nearly all cases.
pub mod efi {
pub use crate::base::*;
pub use crate::system::*;
pub use crate::hii;
pub use crate::protocols;
pub use crate::vendor;
}

54
vendor/r-efi/src/protocols.rs vendored Normal file
View File

@@ -0,0 +1,54 @@
//! UEFI Protocols
//!
//! The UEFI Specification splits most of its non-core parts into separate protocols. They can
//! refer to each other, but their documentation and implementation is split apart. We provide
//! each protocol as a separate module, so it is clearly defined where a symbol belongs to.
pub mod absolute_pointer;
pub mod block_io;
pub mod bus_specific_driver_override;
pub mod debug_support;
pub mod debugport;
pub mod decompress;
pub mod device_path;
pub mod device_path_from_text;
pub mod device_path_to_text;
pub mod device_path_utilities;
pub mod disk_io;
pub mod disk_io2;
pub mod driver_binding;
pub mod driver_diagnostics2;
pub mod driver_family_override;
pub mod file;
pub mod graphics_output;
pub mod hii_database;
pub mod hii_font;
pub mod hii_font_ex;
pub mod hii_package_list;
pub mod hii_string;
pub mod ip4;
pub mod ip6;
pub mod load_file;
pub mod load_file2;
pub mod loaded_image;
pub mod loaded_image_device_path;
pub mod managed_network;
pub mod memory_attribute;
pub mod mp_services;
pub mod pci_io;
pub mod platform_driver_override;
pub mod rng;
pub mod service_binding;
pub mod shell;
pub mod shell_dynamic_command;
pub mod shell_parameters;
pub mod simple_file_system;
pub mod simple_network;
pub mod simple_text_input;
pub mod simple_text_input_ex;
pub mod simple_text_output;
pub mod tcp4;
pub mod tcp6;
pub mod timestamp;
pub mod udp4;
pub mod udp6;

View File

@@ -0,0 +1,69 @@
//! Absolute Pointer Protocol
//!
//! Provides a simple method for accessing absolute pointer devices. This
//! includes devices such as touch screens and digitizers. The Absolute Pointer
//! Protocol allows information about a pointer device to be retrieved. The
//! protocol is attached to the device handle of an absolute pointer device,
//! and can be used for input from the user in the preboot environment.
//!
//! Supported devices may return 1, 2, or 3 axis of information. The Z axis may
//! optionally be used to return pressure data measurements derived from user
//! pen force.
//!
//! All supported devices must support a touch-active status. Supported devices
//! may optionally support a second input button, for example a pen
//! side-button.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x8d59d32b,
0xc655,
0x4ae9,
0x9b,
0x15,
&[0xf2, 0x59, 0x04, 0x99, 0x2a, 0x43],
);
pub const SUPPORTS_ALT_ACTIVE: u32 = 0x00000001;
pub const SUPPORTS_PRESSURE_AS_Z: u32 = 0x00000002;
#[derive(Clone, Copy, Debug, Default)]
#[repr(C)]
pub struct Mode {
pub absolute_min_x: u64,
pub absolute_min_y: u64,
pub absolute_min_z: u64,
pub absolute_max_x: u64,
pub absolute_max_y: u64,
pub absolute_max_z: u64,
pub attributes: u32,
}
pub const TOUCH_ACTIVE: u32 = 0x00000001;
pub const ALT_ACTIVE: u32 = 0x00000002;
#[derive(Clone, Copy, Debug, Default)]
#[repr(C)]
pub struct State {
pub current_x: u64,
pub current_y: u64,
pub current_z: u64,
pub active_buttons: u32,
}
pub type Reset = eficall! {fn(
this: *mut Protocol,
extended_verification: bool,
) -> crate::base::Status};
pub type GetState = eficall! {fn(
this: *mut Protocol,
state: *mut State,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub reset: Reset,
pub get_state: GetState,
pub wait_for_input: crate::efi::Event,
pub mode: *mut Mode,
}

70
vendor/r-efi/src/protocols/block_io.rs vendored Normal file
View File

@@ -0,0 +1,70 @@
//! Block I/O Protocol
//!
//! Used to abstract mass storage devices to allow code running in the EFI boot services environment
//! to access the storage devices without specific knowledge of the type of device or controller that
//! manages the device.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x964e5b21,
0x6459,
0x11d2,
0x8e,
0x39,
&[0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
);
pub const REVISION: u64 = 0x0000000000010000u64;
pub const REVISION2: u64 = 0x0000000000020001u64;
pub const REVISION3: u64 = 0x000000000002001fu64;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Media {
pub media_id: u32,
pub removable_media: bool,
pub media_present: bool,
pub logical_partition: bool,
pub read_only: bool,
pub write_caching: bool,
pub block_size: u32,
pub io_align: u32,
pub last_block: crate::base::Lba,
pub lowest_aligned_lba: crate::base::Lba,
pub logical_blocks_per_physical_block: u32,
pub optimal_transfer_length_granularity: u32,
}
pub type ProtocolReset = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
) -> crate::base::Status};
pub type ProtocolReadBlocks = eficall! {fn(
*mut Protocol,
u32,
crate::base::Lba,
usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolWriteBlocks = eficall! {fn(
*mut Protocol,
u32,
crate::base::Lba,
usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolFlushBlocks = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub revision: u64,
pub media: *const Media,
pub reset: ProtocolReset,
pub read_blocks: ProtocolReadBlocks,
pub write_blocks: ProtocolWriteBlocks,
pub flush_blocks: ProtocolFlushBlocks,
}

View File

@@ -0,0 +1,32 @@
//! Bus Specific Driver Override Protocol
//!
//! This protocol matches one or more drivers to a controller. This protocol is
//! produced by a bus driver, and it is installed on the child handles of buses
//! that require a bus specific algorithm for matching drivers to controllers.
//! This protocol is used by the `EFI_BOOT_SERVICES.ConnectController()` boot
//! service to select the best driver for a controller. All of the drivers
//! returned by this protocol have a higher precedence than drivers found in
//! the general EFI Driver Binding search algorithm, but a lower precedence
//! than those drivers returned by the EFI Platform Driver Override Protocol.
//! If more than one driver image handle is returned by this protocol, then the
//! drivers image handles are returned in order from highest precedence to
//! lowest precedence.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x3bc1b285,
0x8a15,
0x4a82,
0xaa,
0xbf,
&[0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65],
);
pub type ProtocolGetDriver = eficall! {fn(
*mut Protocol,
*mut crate::base::Handle,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_driver: ProtocolGetDriver,
}

View File

@@ -0,0 +1,835 @@
//! Debug Support Protocol
//!
//! It provides the services to allow the debug agent to register callback functions that are
//! called either periodically or when specific processor exceptions occur.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x2755590c,
0x6f3c,
0x42fa,
0x9e,
0xa4,
&[0xa3, 0xba, 0x54, 0x3c, 0xda, 0x25],
);
pub type InstructionSetArchitecture = u32;
pub const ISA_IA32: InstructionSetArchitecture = 0x014c;
pub const ISA_X64: InstructionSetArchitecture = 0x8664;
pub const ISA_IPF: InstructionSetArchitecture = 0x0200;
pub const ISA_EBC: InstructionSetArchitecture = 0x0ebc;
pub const ISA_ARM: InstructionSetArchitecture = 0x1c2;
pub const ISA_AARCH64: InstructionSetArchitecture = 0xaa64;
pub const ISA_RISCV32: InstructionSetArchitecture = 0x5032;
pub const ISA_RISCV64: InstructionSetArchitecture = 0x5064;
pub const ISA_RISCV128: InstructionSetArchitecture = 0x5128;
#[repr(C)]
#[derive(Clone, Copy)]
pub union SystemContext {
pub system_context_ebc: *mut SystemContextEbc,
pub system_context_ia32: *mut SystemContextIa32,
pub system_context_x64: *mut SystemContextX64,
pub system_context_ipf: *mut SystemContextIpf,
pub system_context_arm: *mut SystemContextArm,
pub system_context_aarch64: *mut SystemContextAArch64,
pub system_context_riscv32: *mut SystemContextRiscV32,
pub system_context_riscv64: *mut SystemContextRiscV64,
pub system_context_riscv128: *mut SystemContextRiscV128,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct SystemContextEbc {
pub r0: u64,
pub r1: u64,
pub r2: u64,
pub r3: u64,
pub r4: u64,
pub r5: u64,
pub r6: u64,
pub r7: u64,
pub flags: u64,
pub control_flags: u64,
pub ip: u64,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct SystemContextRiscV32 {
// Integer registers
pub zero: u32,
pub ra: u32,
pub sp: u32,
pub gp: u32,
pub tp: u32,
pub t0: u32,
pub t1: u32,
pub t2: u32,
pub s0fp: u32,
pub s1: u32,
pub a0: u32,
pub a1: u32,
pub a2: u32,
pub a3: u32,
pub a4: u32,
pub a5: u32,
pub a6: u32,
pub a7: u32,
pub s2: u32,
pub s3: u32,
pub s4: u32,
pub s5: u32,
pub s6: u32,
pub s7: u32,
pub s8: u32,
pub s9: u32,
pub s10: u32,
pub s11: u32,
pub t3: u32,
pub t4: u32,
pub t5: u32,
pub t6: u32,
// Floating registers for F, D and Q Standard Extensions
pub ft0: u128,
pub ft1: u128,
pub ft2: u128,
pub ft3: u128,
pub ft4: u128,
pub ft5: u128,
pub ft6: u128,
pub ft7: u128,
pub fs0: u128,
pub fs1: u128,
pub fa0: u128,
pub fa1: u128,
pub fa2: u128,
pub fa3: u128,
pub fa4: u128,
pub fa5: u128,
pub fa6: u128,
pub fa7: u128,
pub fs2: u128,
pub fs3: u128,
pub fs4: u128,
pub fs5: u128,
pub fs6: u128,
pub fs7: u128,
pub fs8: u128,
pub fs9: u128,
pub fs10: u128,
pub fs11: u128,
pub ft8: u128,
pub ft9: u128,
pub ft10: u128,
pub ft11: u128,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct SystemContextRiscV64 {
// Integer registers
pub zero: u64,
pub ra: u64,
pub sp: u64,
pub gp: u64,
pub tp: u64,
pub t0: u64,
pub t1: u64,
pub t2: u64,
pub s0fp: u64,
pub s1: u64,
pub a0: u64,
pub a1: u64,
pub a2: u64,
pub a3: u64,
pub a4: u64,
pub a5: u64,
pub a6: u64,
pub a7: u64,
pub s2: u64,
pub s3: u64,
pub s4: u64,
pub s5: u64,
pub s6: u64,
pub s7: u64,
pub s8: u64,
pub s9: u64,
pub s10: u64,
pub s11: u64,
pub t3: u64,
pub t4: u64,
pub t5: u64,
pub t6: u64,
// Floating registers for F, D and Q Standard Extensions
pub ft0: u128,
pub ft1: u128,
pub ft2: u128,
pub ft3: u128,
pub ft4: u128,
pub ft5: u128,
pub ft6: u128,
pub ft7: u128,
pub fs0: u128,
pub fs1: u128,
pub fa0: u128,
pub fa1: u128,
pub fa2: u128,
pub fa3: u128,
pub fa4: u128,
pub fa5: u128,
pub fa6: u128,
pub fa7: u128,
pub fs2: u128,
pub fs3: u128,
pub fs4: u128,
pub fs5: u128,
pub fs6: u128,
pub fs7: u128,
pub fs8: u128,
pub fs9: u128,
pub fs10: u128,
pub fs11: u128,
pub ft8: u128,
pub ft9: u128,
pub ft10: u128,
pub ft11: u128,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct SystemContextRiscV128 {
// Integer registers
pub zero: u128,
pub ra: u128,
pub sp: u128,
pub gp: u128,
pub tp: u128,
pub t0: u128,
pub t1: u128,
pub t2: u128,
pub s0fp: u128,
pub s1: u128,
pub a0: u128,
pub a1: u128,
pub a2: u128,
pub a3: u128,
pub a4: u128,
pub a5: u128,
pub a6: u128,
pub a7: u128,
pub s2: u128,
pub s3: u128,
pub s4: u128,
pub s5: u128,
pub s6: u128,
pub s7: u128,
pub s8: u128,
pub s9: u128,
pub s10: u128,
pub s11: u128,
pub t3: u128,
pub t4: u128,
pub t5: u128,
pub t6: u128,
// Floating registers for F, D and Q Standard Extensions
pub ft0: u128,
pub ft1: u128,
pub ft2: u128,
pub ft3: u128,
pub ft4: u128,
pub ft5: u128,
pub ft6: u128,
pub ft7: u128,
pub fs0: u128,
pub fs1: u128,
pub fa0: u128,
pub fa1: u128,
pub fa2: u128,
pub fa3: u128,
pub fa4: u128,
pub fa5: u128,
pub fa6: u128,
pub fa7: u128,
pub fs2: u128,
pub fs3: u128,
pub fs4: u128,
pub fs5: u128,
pub fs6: u128,
pub fs7: u128,
pub fs8: u128,
pub fs9: u128,
pub fs10: u128,
pub fs11: u128,
pub ft8: u128,
pub ft9: u128,
pub ft10: u128,
pub ft11: u128,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct SystemContextIa32 {
// ExceptionData is additional data pushed on the stack by some types of IA-32 exceptions
pub exception_data: u32,
pub fx_save_state: FxSaveStateIA32,
pub dr0: u32,
pub dr1: u32,
pub dr2: u32,
pub dr3: u32,
pub dr6: u32,
pub dr7: u32,
pub cr0: u32,
// Reserved
pub cr1: u32,
pub cr2: u32,
pub cr3: u32,
pub cr4: u32,
pub eflags: u32,
pub ldtr: u32,
pub tr: u32,
pub gdtr: [u32; 2],
pub idtr: [u32; 2],
pub eip: u32,
pub gs: u32,
pub fs: u32,
pub es: u32,
pub ds: u32,
pub cs: u32,
pub ss: u32,
pub edi: u32,
pub esi: u32,
pub ebp: u32,
pub esp: u32,
pub ebx: u32,
pub edx: u32,
pub ecx: u32,
pub eax: u32,
}
// FXSAVE_STATE - FP / MMX / XMM registers
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct FxSaveStateIA32 {
pub fcw: u16,
pub fsw: u16,
pub ftw: u16,
pub opcode: u16,
pub eip: u32,
pub cs: u16,
pub reserved_1: u16,
pub data_offset: u32,
pub ds: u16,
pub reserved_2: [u8; 10],
pub st0mm0: [u8; 10],
pub reserved_3: [u8; 6],
pub st1mm1: [u8; 10],
pub reserved_4: [u8; 6],
pub st2mm2: [u8; 10],
pub reserved_5: [u8; 6],
pub st3mm3: [u8; 10],
pub reserved_6: [u8; 6],
pub st4mm4: [u8; 10],
pub reserved_7: [u8; 6],
pub st5mm5: [u8; 10],
pub reserved_8: [u8; 6],
pub st6mm6: [u8; 10],
pub reserved_9: [u8; 6],
pub st7mm7: [u8; 10],
pub reserved_10: [u8; 6],
pub xmm0: [u8; 16],
pub xmm1: [u8; 16],
pub xmm2: [u8; 16],
pub xmm3: [u8; 16],
pub xmm4: [u8; 16],
pub xmm5: [u8; 16],
pub xmm6: [u8; 16],
pub xmm7: [u8; 16],
pub reserved_11: [u8; 14 * 16],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct SystemContextX64 {
// ExceptionData is additional data pushed on the stack by some types of x64 64-bit mode exceptions
pub exception_data: u64,
pub fx_save_state: FxSaveStateX64,
pub dr0: u64,
pub dr1: u64,
pub dr2: u64,
pub dr3: u64,
pub dr6: u64,
pub dr7: u64,
pub cr0: u64,
// Reserved
pub cr1: u64,
pub cr2: u64,
pub cr3: u64,
pub cr4: u64,
pub cr8: u64,
pub rflags: u64,
pub ldtr: u64,
pub tr: u64,
pub gdtr: [u64; 2],
pub idtr: [u64; 2],
pub rip: u64,
pub gs: u64,
pub fs: u64,
pub es: u64,
pub ds: u64,
pub cs: u64,
pub ss: u64,
pub rdi: u64,
pub rsi: u64,
pub rbp: u64,
pub rsp: u64,
pub rbx: u64,
pub rdx: u64,
pub rcx: u64,
pub rax: u64,
pub r8: u64,
pub r9: u64,
pub r10: u64,
pub r11: u64,
pub r12: u64,
pub r13: u64,
pub r14: u64,
pub r15: u64,
}
// FXSAVE_STATE FP / MMX / XMM registers
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct FxSaveStateX64 {
pub fcw: u16,
pub fsw: u16,
pub ftw: u16,
pub opcode: u16,
pub rip: u64,
pub data_offset: u64,
pub reserved_1: [u8; 8],
pub st0mm0: [u8; 10],
pub reserved_2: [u8; 6],
pub st1mm1: [u8; 10],
pub reserved_3: [u8; 6],
pub st2mm2: [u8; 10],
pub reserved_4: [u8; 6],
pub st3mm3: [u8; 10],
pub reserved_5: [u8; 6],
pub st4mm4: [u8; 10],
pub reserved_6: [u8; 6],
pub st5mm5: [u8; 10],
pub reserved_7: [u8; 6],
pub st6mm6: [u8; 10],
pub reserved_8: [u8; 6],
pub st7mm7: [u8; 10],
pub reserved_9: [u8; 6],
pub xmm0: [u8; 16],
pub xmm1: [u8; 16],
pub xmm2: [u8; 16],
pub xmm3: [u8; 16],
pub xmm4: [u8; 16],
pub xmm5: [u8; 16],
pub xmm6: [u8; 16],
pub xmm7: [u8; 16],
pub reserved_11: [u8; 14 * 16],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct SystemContextIpf {
pub reserved: u64,
pub r1: u64,
pub r2: u64,
pub r3: u64,
pub r4: u64,
pub r5: u64,
pub r6: u64,
pub r7: u64,
pub r8: u64,
pub r9: u64,
pub r10: u64,
pub r11: u64,
pub r12: u64,
pub r13: u64,
pub r14: u64,
pub r15: u64,
pub r16: u64,
pub r17: u64,
pub r18: u64,
pub r19: u64,
pub r20: u64,
pub r21: u64,
pub r22: u64,
pub r23: u64,
pub r24: u64,
pub r25: u64,
pub r26: u64,
pub r27: u64,
pub r28: u64,
pub r29: u64,
pub r30: u64,
pub r31: u64,
pub f2: [u64; 2],
pub f3: [u64; 2],
pub f4: [u64; 2],
pub f5: [u64; 2],
pub f6: [u64; 2],
pub f7: [u64; 2],
pub f8: [u64; 2],
pub f9: [u64; 2],
pub f10: [u64; 2],
pub f11: [u64; 2],
pub f12: [u64; 2],
pub f13: [u64; 2],
pub f14: [u64; 2],
pub f15: [u64; 2],
pub f16: [u64; 2],
pub f17: [u64; 2],
pub f18: [u64; 2],
pub f19: [u64; 2],
pub f20: [u64; 2],
pub f21: [u64; 2],
pub f22: [u64; 2],
pub f23: [u64; 2],
pub f24: [u64; 2],
pub f25: [u64; 2],
pub f26: [u64; 2],
pub f27: [u64; 2],
pub f28: [u64; 2],
pub f29: [u64; 2],
pub f30: [u64; 2],
pub f31: [u64; 2],
pub pr: u64,
pub b0: u64,
pub b1: u64,
pub b2: u64,
pub b3: u64,
pub b4: u64,
pub b5: u64,
pub b6: u64,
pub b7: u64,
// application registers
pub ar_rsc: u64,
pub ar_bsp: u64,
pub ar_bspstore: u64,
pub ar_rnat: u64,
pub ar_fcr: u64,
pub ar_eflag: u64,
pub ar_csd: u64,
pub ar_ssd: u64,
pub ar_cflg: u64,
pub ar_fsr: u64,
pub ar_fir: u64,
pub ar_fdr: u64,
pub ar_ccv: u64,
pub ar_unat: u64,
pub ar_fpsr: u64,
pub ar_pfs: u64,
pub ar_lc: u64,
pub ar_ec: u64,
// control registers
pub cr_dcr: u64,
pub cr_itm: u64,
pub cr_iva: u64,
pub cr_pta: u64,
pub cr_ipsr: u64,
pub cr_isr: u64,
pub cr_iip: u64,
pub cr_ifa: u64,
pub cr_itir: u64,
pub cr_iipa: u64,
pub cr_ifs: u64,
pub cr_iim: u64,
pub cr_iha: u64,
// debug registers
pub dbr0: u64,
pub dbr1: u64,
pub dbr2: u64,
pub dbr3: u64,
pub dbr4: u64,
pub dbr5: u64,
pub dbr6: u64,
pub dbr7: u64,
pub ibr0: u64,
pub ibr1: u64,
pub ibr2: u64,
pub ibr3: u64,
pub ibr4: u64,
pub ibr5: u64,
pub ibr6: u64,
pub ibr7: u64,
// virtual Registers
pub int_nat: u64, // nat bits for r1-r31
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct SystemContextArm {
pub r0: u32,
pub r1: u32,
pub r2: u32,
pub r3: u32,
pub r4: u32,
pub r5: u32,
pub r6: u32,
pub r7: u32,
pub r8: u32,
pub r9: u32,
pub r10: u32,
pub r11: u32,
pub r12: u32,
pub sp: u32,
pub lr: u32,
pub pc: u32,
pub cpsr: u32,
pub dfsr: u32,
pub dfar: u32,
pub ifsr: u32,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct SystemContextAArch64 {
// General Purpose Registers
pub x0: u64,
pub x1: u64,
pub x2: u64,
pub x3: u64,
pub x4: u64,
pub x5: u64,
pub x6: u64,
pub x7: u64,
pub x8: u64,
pub x9: u64,
pub x10: u64,
pub x11: u64,
pub x12: u64,
pub x13: u64,
pub x14: u64,
pub x15: u64,
pub x16: u64,
pub x17: u64,
pub x18: u64,
pub x19: u64,
pub x20: u64,
pub x21: u64,
pub x22: u64,
pub x23: u64,
pub x24: u64,
pub x25: u64,
pub x26: u64,
pub x27: u64,
pub x28: u64,
pub fp: u64, // x29 - Frame Pointer
pub lr: u64, // x30 - Link Register
pub sp: u64, // x31 - Stack Pointer
// FP/SIMD Registers
pub v0: [u64; 2],
pub v1: [u64; 2],
pub v2: [u64; 2],
pub v3: [u64; 2],
pub v4: [u64; 2],
pub v5: [u64; 2],
pub v6: [u64; 2],
pub v7: [u64; 2],
pub v8: [u64; 2],
pub v9: [u64; 2],
pub v10: [u64; 2],
pub v11: [u64; 2],
pub v12: [u64; 2],
pub v13: [u64; 2],
pub v14: [u64; 2],
pub v15: [u64; 2],
pub v16: [u64; 2],
pub v17: [u64; 2],
pub v18: [u64; 2],
pub v19: [u64; 2],
pub v20: [u64; 2],
pub v21: [u64; 2],
pub v22: [u64; 2],
pub v23: [u64; 2],
pub v24: [u64; 2],
pub v25: [u64; 2],
pub v26: [u64; 2],
pub v27: [u64; 2],
pub v28: [u64; 2],
pub v29: [u64; 2],
pub v30: [u64; 2],
pub v31: [u64; 2],
pub elr: u64, // Exception Link Register
pub spsr: u64, // Saved Processor Status Register
pub fpsr: u64, // Floating Point Status Register
pub esr: u64, // Exception Syndrome Register
pub far: u64, // Fault Address Register
}
pub type ExceptionType = isize;
// EBC Exception types
pub const EXCEPT_EBC_UNDEFINED: ExceptionType = 0;
pub const EXCEPT_EBC_DIVIDE_ERROR: ExceptionType = 1;
pub const EXCEPT_EBC_DEBUG: ExceptionType = 2;
pub const EXCEPT_EBC_BREAKPOINT: ExceptionType = 3;
pub const EXCEPT_EBC_OVERFLOW: ExceptionType = 4;
pub const EXCEPT_EBC_INVALID_OPCODE: ExceptionType = 5;
pub const EXCEPT_EBC_STACK_FAULT: ExceptionType = 6;
pub const EXCEPT_EBC_ALIGNMENT_CHECK: ExceptionType = 7;
pub const EXCEPT_EBC_INSTRUCTION_ENCODING: ExceptionType = 8;
pub const EXCEPT_EBC_BAD_BREAK: ExceptionType = 9;
pub const EXCEPT_EBC_SINGLE_STEP: ExceptionType = 10;
// IA-32 Exception types
pub const EXCEPT_IA32_DIVIDE_ERROR: ExceptionType = 0;
pub const EXCEPT_IA32_DEBUG: ExceptionType = 1;
pub const EXCEPT_IA32_NMI: ExceptionType = 2;
pub const EXCEPT_IA32_BREAKPOINT: ExceptionType = 3;
pub const EXCEPT_IA32_OVERFLOW: ExceptionType = 4;
pub const EXCEPT_IA32_BOUND: ExceptionType = 5;
pub const EXCEPT_IA32_INVALID_OPCODE: ExceptionType = 6;
pub const EXCEPT_IA32_DOUBLE_FAULT: ExceptionType = 8;
pub const EXCEPT_IA32_INVALID_TSS: ExceptionType = 10;
pub const EXCEPT_IA32_SEG_NOT_PRESENT: ExceptionType = 11;
pub const EXCEPT_IA32_STACK_FAULT: ExceptionType = 12;
pub const EXCEPT_IA32_GP_FAULT: ExceptionType = 13;
pub const EXCEPT_IA32_PAGE_FAULT: ExceptionType = 14;
pub const EXCEPT_IA32_FP_ERROR: ExceptionType = 16;
pub const EXCEPT_IA32_ALIGNMENT_CHECK: ExceptionType = 17;
pub const EXCEPT_IA32_MACHINE_CHECK: ExceptionType = 18;
pub const EXCEPT_IA32_SIMD: ExceptionType = 19;
// X64 Exception types
pub const EXCEPT_X64_DIVIDE_ERROR: ExceptionType = 0;
pub const EXCEPT_X64_DEBUG: ExceptionType = 1;
pub const EXCEPT_X64_NMI: ExceptionType = 2;
pub const EXCEPT_X64_BREAKPOINT: ExceptionType = 3;
pub const EXCEPT_X64_OVERFLOW: ExceptionType = 4;
pub const EXCEPT_X64_BOUND: ExceptionType = 5;
pub const EXCEPT_X64_INVALID_OPCODE: ExceptionType = 6;
pub const EXCEPT_X64_DOUBLE_FAULT: ExceptionType = 8;
pub const EXCEPT_X64_INVALID_TSS: ExceptionType = 10;
pub const EXCEPT_X64_SEG_NOT_PRESENT: ExceptionType = 11;
pub const EXCEPT_X64_STACK_FAULT: ExceptionType = 12;
pub const EXCEPT_X64_GP_FAULT: ExceptionType = 13;
pub const EXCEPT_X64_PAGE_FAULT: ExceptionType = 14;
pub const EXCEPT_X64_FP_ERROR: ExceptionType = 16;
pub const EXCEPT_X64_ALIGNMENT_CHECK: ExceptionType = 17;
pub const EXCEPT_X64_MACHINE_CHECK: ExceptionType = 18;
pub const EXCEPT_X64_SIMD: ExceptionType = 19;
// Itanium Processor Family Exception types
pub const EXCEPT_IPF_VHTP_TRANSLATION: ExceptionType = 0;
pub const EXCEPT_IPF_INSTRUCTION_TLB: ExceptionType = 1;
pub const EXCEPT_IPF_DATA_TLB: ExceptionType = 2;
pub const EXCEPT_IPF_ALT_INSTRUCTION_TLB: ExceptionType = 3;
pub const EXCEPT_IPF_ALT_DATA_TLB: ExceptionType = 4;
pub const EXCEPT_IPF_DATA_NESTED_TLB: ExceptionType = 5;
pub const EXCEPT_IPF_INSTRUCTION_KEY_MISSED: ExceptionType = 6;
pub const EXCEPT_IPF_DATA_KEY_MISSED: ExceptionType = 7;
pub const EXCEPT_IPF_DIRTY_BIT: ExceptionType = 8;
pub const EXCEPT_IPF_INSTRUCTION_ACCESS_BIT: ExceptionType = 9;
pub const EXCEPT_IPF_DATA_ACCESS_BIT: ExceptionType = 10;
pub const EXCEPT_IPF_BREAKPOINT: ExceptionType = 11;
pub const EXCEPT_IPF_EXTERNAL_INTERRUPT: ExceptionType = 12;
// 13 - 19 reserved
pub const EXCEPT_IPF_PAGE_NOT_PRESENT: ExceptionType = 20;
pub const EXCEPT_IPF_KEY_PERMISSION: ExceptionType = 21;
pub const EXCEPT_IPF_INSTRUCTION_ACCESS_RIGHTS: ExceptionType = 22;
pub const EXCEPT_IPF_DATA_ACCESS_RIGHTS: ExceptionType = 23;
pub const EXCEPT_IPF_GENERAL_EXCEPTION: ExceptionType = 24;
pub const EXCEPT_IPF_DISABLED_FP_REGISTER: ExceptionType = 25;
pub const EXCEPT_IPF_NAT_CONSUMPTION: ExceptionType = 26;
pub const EXCEPT_IPF_SPECULATION: ExceptionType = 27;
// 28 reserved
pub const EXCEPT_IPF_DEBUG: ExceptionType = 29;
pub const EXCEPT_IPF_UNALIGNED_REFERENCE: ExceptionType = 30;
pub const EXCEPT_IPF_UNSUPPORTED_DATA_REFERENCE: ExceptionType = 31;
pub const EXCEPT_IPF_FP_FAULT: ExceptionType = 32;
pub const EXCEPT_IPF_FP_TRAP: ExceptionType = 33;
pub const EXCEPT_IPF_LOWER_PRIVILEGE_TRANSFER_TRAP: ExceptionType = 34;
pub const EXCEPT_IPF_TAKEN_BRANCH: ExceptionType = 35;
pub const EXCEPT_IPF_SINGLE_STEP: ExceptionType = 36;
// 37 - 44 reserved
pub const EXCEPT_IPF_IA32_EXCEPTION: ExceptionType = 45;
pub const EXCEPT_IPF_IA32_INTERCEPT: ExceptionType = 46;
pub const EXCEPT_IPF_IA32_INTERRUPT: ExceptionType = 47;
// ARM processor exception types
pub const EXCEPT_ARM_RESET: ExceptionType = 0;
pub const EXCEPT_ARM_UNDEFINED_INSTRUCTION: ExceptionType = 1;
pub const EXCEPT_ARM_SOFTWARE_INTERRUPT: ExceptionType = 2;
pub const EXCEPT_ARM_PREFETCH_ABORT: ExceptionType = 3;
pub const EXCEPT_ARM_DATA_ABORT: ExceptionType = 4;
pub const EXCEPT_ARM_RESERVED: ExceptionType = 5;
pub const EXCEPT_ARM_IRQ: ExceptionType = 6;
pub const EXCEPT_ARM_FIQ: ExceptionType = 7;
pub const MAX_ARM_EXCEPTION: ExceptionType = EXCEPT_ARM_FIQ;
// AARCH64 processor exception types.
pub const EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS: ExceptionType = 0;
pub const EXCEPT_AARCH64_IRQ: ExceptionType = 1;
pub const EXCEPT_AARCH64_FIQ: ExceptionType = 2;
pub const EXCEPT_AARCH64_SERROR: ExceptionType = 3;
pub const MAX_AARCH64_EXCEPTION: ExceptionType = EXCEPT_AARCH64_SERROR;
// RISC-V processor exception types.
pub const EXCEPT_RISCV_INST_MISALIGNED: ExceptionType = 0;
pub const EXCEPT_RISCV_INST_ACCESS_FAULT: ExceptionType = 1;
pub const EXCEPT_RISCV_ILLEGAL_INST: ExceptionType = 2;
pub const EXCEPT_RISCV_BREAKPOINT: ExceptionType = 3;
pub const EXCEPT_RISCV_LOAD_ADDRESS_MISALIGNED: ExceptionType = 4;
pub const EXCEPT_RISCV_LOAD_ACCESS_FAULT: ExceptionType = 5;
pub const EXCEPT_RISCV_STORE_AMO_ADDRESS_MISALIGNED: ExceptionType = 6;
pub const EXCEPT_RISCV_STORE_AMO_ACCESS_FAULT: ExceptionType = 7;
pub const EXCEPT_RISCV_ENV_CALL_FROM_UMODE: ExceptionType = 8;
pub const EXCEPT_RISCV_ENV_CALL_FROM_SMODE: ExceptionType = 9;
pub const EXCEPT_RISCV_ENV_CALL_FROM_MMODE: ExceptionType = 11;
pub const EXCEPT_RISCV_INST_PAGE_FAULT: ExceptionType = 12;
pub const EXCEPT_RISCV_LOAD_PAGE_FAULT: ExceptionType = 13;
pub const EXCEPT_RISCV_STORE_AMO_PAGE_FAULT: ExceptionType = 15;
// RISC-V processor interrupt types.
pub const EXCEPT_RISCV_SUPERVISOR_SOFTWARE_INT: ExceptionType = 1;
pub const EXCEPT_RISCV_MACHINE_SOFTWARE_INT: ExceptionType = 3;
pub const EXCEPT_RISCV_SUPERVISOR_TIMER_INT: ExceptionType = 5;
pub const EXCEPT_RISCV_MACHINE_TIMER_INT: ExceptionType = 7;
pub const EXCEPT_RISCV_SUPERVISOR_EXTERNAL_INT: ExceptionType = 9;
pub const EXCEPT_RISCV_MACHINE_EXTERNAL_INT: ExceptionType = 11;
pub type GetMaximumProcessorIndex = eficall! {fn(
*mut Protocol,
*mut usize,
) -> crate::base::Status};
pub type PeriodicCallback = eficall! {fn(SystemContext)};
pub type RegisterPeriodicCallback = eficall! {fn(
*mut Protocol,
usize,
Option<PeriodicCallback>,
) -> crate::base::Status};
pub type ExceptionCallback = eficall! {fn(ExceptionType, SystemContext)};
pub type RegisterExceptionCallback = eficall! {fn(
*mut Protocol,
usize,
Option<ExceptionCallback>,
ExceptionType,
) -> crate::base::Status};
pub type InvalidateInstructionCache = eficall! {fn(
*mut Protocol,
usize,
*mut core::ffi::c_void,
u64,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub isa: InstructionSetArchitecture,
pub get_maximum_processor_index: GetMaximumProcessorIndex,
pub register_periodic_callback: RegisterPeriodicCallback,
pub register_exception_callback: RegisterExceptionCallback,
pub invalidate_instruction_cache: InvalidateInstructionCache,
}

42
vendor/r-efi/src/protocols/debugport.rs vendored Normal file
View File

@@ -0,0 +1,42 @@
//! Debug Port Protocol
//!
//! It provides the communication link between the debug agent and the remote host.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xeba4e8d2,
0x3858,
0x41ec,
0xa2,
0x81,
&[0x26, 0x47, 0xba, 0x96, 0x60, 0xd0],
);
pub type Reset = eficall! {fn(
*mut Protocol,
) -> *mut crate::base::Status};
pub type Write = eficall! {fn(
*mut Protocol,
u32,
*mut usize,
*mut core::ffi::c_void
) -> *mut crate::base::Status};
pub type Read = eficall! {fn(
*mut Protocol,
u32,
*mut usize,
*mut core::ffi::c_void
) -> *mut crate::base::Status};
pub type Poll = eficall! {fn(
*mut Protocol,
) -> *mut crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub reset: Reset,
pub write: Write,
pub read: Read,
pub poll: Poll,
}

View File

@@ -0,0 +1,37 @@
//! Decompress Protocol
//!
//! The decompress protocol provides a decompression service that allows a compressed source
//! buffer in memory to be decompressed into a destination buffer in memory.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xd8117cfe,
0x94a6,
0x11d4,
0x9a,
0x3a,
&[0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d],
);
pub type ProtocolGetInfo = eficall! {fn(
*mut Protocol,
*mut core::ffi::c_void,
u32,
*mut u32,
*mut u32,
) -> crate::base::Status};
pub type ProtocolDecompress = eficall! {fn(
*mut Protocol,
*mut core::ffi::c_void,
u32,
*mut core::ffi::c_void,
u32,
*mut core::ffi::c_void,
u32,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_info: ProtocolGetInfo,
pub decompress: ProtocolDecompress,
}

View File

@@ -0,0 +1,82 @@
//! Device Path Protocol
//!
//! The device path protocol defines how to obtain generic path/location information
//! concerning the phisycal or logical device.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x09576e91,
0x6d3f,
0x11d2,
0x8e,
0x39,
&[0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
);
pub const TYPE_HARDWARE: u8 = 0x01;
pub const TYPE_ACPI: u8 = 0x02;
pub const TYPE_MESSAGING: u8 = 0x03;
pub const TYPE_MEDIA: u8 = 0x04;
pub const TYPE_BIOS: u8 = 0x05;
pub const TYPE_END: u8 = 0x7f;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Protocol {
pub r#type: u8,
pub sub_type: u8,
pub length: [u8; 2],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct End {
pub header: Protocol,
}
impl End {
pub const SUBTYPE_INSTANCE: u8 = 0x01;
pub const SUBTYPE_ENTIRE: u8 = 0xff;
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Hardware {
pub header: Protocol,
}
impl Hardware {
pub const SUBTYPE_PCI: u8 = 0x01;
pub const SUBTYPE_PCCARD: u8 = 0x02;
pub const SUBTYPE_MMAP: u8 = 0x03;
pub const SUBTYPE_VENDOR: u8 = 0x04;
pub const SUBTYPE_CONTROLLER: u8 = 0x05;
pub const SUBTYPE_BMC: u8 = 0x06;
}
#[repr(C, packed)]
#[derive(Clone, Copy, Debug)]
pub struct HardDriveMedia {
pub header: Protocol,
pub partition_number: u32,
pub partition_start: u64,
pub partition_size: u64,
pub partition_signature: [u8; 16],
pub partition_format: u8,
pub signature_type: u8,
}
pub struct Media {
pub header: Protocol,
}
impl Media {
pub const SUBTYPE_HARDDRIVE: u8 = 0x01;
pub const SUBTYPE_CDROM: u8 = 0x02;
pub const SUBTYPE_VENDOR: u8 = 0x03;
pub const SUBTYPE_FILE_PATH: u8 = 0x04;
pub const SUBTYPE_MEDIA_PROTOCOL: u8 = 0x05;
pub const SUBTYPE_PIWG_FIRMWARE_FILE: u8 = 0x06;
pub const SUBTYPE_PIWG_FIRMWARE_VOLUME: u8 = 0x07;
pub const SUBTYPE_RELATIVE_OFFSET_RANGE: u8 = 0x08;
pub const SUBTYPE_RAM_DISK: u8 = 0x09;
}

View File

@@ -0,0 +1,26 @@
//! Device Path From Text Protocol
//!
//! Convert text to device paths and device nodes.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x5c99a21,
0xc70f,
0x4ad2,
0x8a,
0x5f,
&[0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e],
);
pub type DevicePathFromTextNode = eficall! {fn(
*const crate::base::Char16,
) -> *mut crate::protocols::device_path::Protocol};
pub type DevicePathFromTextPath = eficall! {fn(
*const crate::base::Char16,
) -> *mut crate::protocols::device_path::Protocol};
#[repr(C)]
pub struct Protocol {
pub convert_text_to_device_node: DevicePathFromTextNode,
pub convert_text_to_device_path: DevicePathFromTextPath,
}

View File

@@ -0,0 +1,30 @@
//! Device Path to Text Protocol
//!
//! Convert device nodes and paths to text.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x8b843e20,
0x8132,
0x4852,
0x90,
0xcc,
&[0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c],
);
pub type DevicePathToTextNode = eficall! {fn(
*mut crate::protocols::device_path::Protocol,
crate::base::Boolean,
crate::base::Boolean,
) -> *mut crate::base::Char16};
pub type DevicePathToTextPath = eficall! {fn(
*mut crate::protocols::device_path::Protocol,
crate::base::Boolean,
crate::base::Boolean,
) -> *mut crate::base::Char16};
#[repr(C)]
pub struct Protocol {
pub convert_device_node_to_text: DevicePathToTextNode,
pub convert_device_path_to_text: DevicePathToTextPath,
}

View File

@@ -0,0 +1,63 @@
//! Device Path Utilities Protocol
//!
//! The device-path utilities protocol provides common utilities for creating and manipulating
//! device paths and device nodes.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x379be4e,
0xd706,
0x437d,
0xb0,
0x37,
&[0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4],
);
pub type ProtocolGetDevicePathSize = eficall! {fn(
*const crate::protocols::device_path::Protocol,
) -> usize};
pub type ProtocolDuplicateDevicePath = eficall! {fn(
*const crate::protocols::device_path::Protocol,
) -> *mut crate::protocols::device_path::Protocol};
pub type ProtocolAppendDevicePath = eficall! {fn(
*const crate::protocols::device_path::Protocol,
*const crate::protocols::device_path::Protocol,
) -> *mut crate::protocols::device_path::Protocol};
pub type ProtocolAppendDeviceNode = eficall! {fn(
*const crate::protocols::device_path::Protocol,
*const crate::protocols::device_path::Protocol,
) -> *mut crate::protocols::device_path::Protocol};
pub type ProtocolAppendDevicePathInstance = eficall! {fn(
*const crate::protocols::device_path::Protocol,
*const crate::protocols::device_path::Protocol,
) -> *mut crate::protocols::device_path::Protocol};
pub type ProtocolGetNextDevicePathInstance = eficall! {fn(
*mut *mut crate::protocols::device_path::Protocol,
*mut usize,
) -> *mut crate::protocols::device_path::Protocol};
pub type ProtocolIsDevicePathMultiInstance = eficall! {fn(
*const crate::protocols::device_path::Protocol,
) -> crate::base::Boolean};
pub type ProtocolCreateDeviceNode = eficall! {fn(
u8,
u8,
u16,
) -> *mut crate::protocols::device_path::Protocol};
#[repr(C)]
pub struct Protocol {
pub get_device_path_size: ProtocolGetDevicePathSize,
pub duplicate_device_path: ProtocolDuplicateDevicePath,
pub append_device_path: ProtocolAppendDevicePath,
pub append_device_node: ProtocolAppendDeviceNode,
pub append_device_path_instance: ProtocolAppendDevicePathInstance,
pub get_next_device_path_instance: ProtocolGetNextDevicePathInstance,
pub is_device_path_multi_instance: ProtocolIsDevicePathMultiInstance,
pub create_device_node: ProtocolCreateDeviceNode,
}

40
vendor/r-efi/src/protocols/disk_io.rs vendored Normal file
View File

@@ -0,0 +1,40 @@
//! Disk I/O Protocol
//!
//! Abstracts block accesses of the Block I/O protocol to a more general offset-length protocol.
//! Firmware is responsible for adding this protocol to any Block I/O interface that appears
//! in the system that does not already have a Disk I/O protocol. File systems and other disk
//! access code utilize the Disk I/O protocol.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xce345171,
0xba0b,
0x11d2,
0x8e,
0x4f,
&[0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
);
pub const REVISION: u64 = 0x0000000000010000u64;
pub type ProtocolReadDisk = eficall! {fn(
*mut Protocol,
u32,
u64,
usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolWriteDisk = eficall! {fn(
*mut Protocol,
u32,
u64,
usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub revision: u64,
pub read_disk: ProtocolReadDisk,
pub write_disk: ProtocolWriteDisk,
}

58
vendor/r-efi/src/protocols/disk_io2.rs vendored Normal file
View File

@@ -0,0 +1,58 @@
//! Disk I/O 2 Protocol
//!
//! Extends the Disk I/O protocol interface to enable non-blocking /
//! asynchronous byte-oriented disk operation.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x151c8eae,
0x7f2c,
0x472c,
0x9e,
0x54,
&[0x98, 0x28, 0x19, 0x4f, 0x6a, 0x88],
);
pub const REVISION: u64 = 0x0000000000020000u64;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Token {
event: crate::base::Event,
transaction_status: crate::base::Status,
}
pub type ProtocolCancel = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
pub type ProtocolReadDiskEx = eficall! {fn(
*mut Protocol,
u32,
u64,
*mut Token,
usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolWriteDiskEx = eficall! {fn(
*mut Protocol,
u32,
u64,
*mut Token,
usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolFlushDiskEx = eficall! {fn(
*mut Protocol,
*mut Token,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub revision: u64,
pub cancel: ProtocolCancel,
pub read_disk_ex: ProtocolReadDiskEx,
pub write_disk_ex: ProtocolWriteDiskEx,
pub flush_disk_ex: ProtocolFlushDiskEx,
}

View File

@@ -0,0 +1,42 @@
//! Driver Binding Protocol
//!
//! Provides the services required to determine if a driver supports a given controller. If
//! a controller is supported, then it also provides routines to start and stop the controller.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x18a031ab,
0xb443,
0x4d1a,
0xa5,
0xc0,
&[0x0c, 0x09, 0x26, 0x1e, 0x9f, 0x71],
);
pub type ProtocolSupported = eficall! {fn(
*mut Protocol,
crate::base::Handle,
*mut crate::protocols::device_path::Protocol,
) -> crate::base::Status};
pub type ProtocolStart = eficall! {fn(
*mut Protocol,
crate::base::Handle,
*mut crate::protocols::device_path::Protocol,
) -> crate::base::Status};
pub type ProtocolStop = eficall! {fn(
*mut Protocol,
crate::base::Handle,
usize,
*mut crate::base::Handle,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub supported: ProtocolSupported,
pub start: ProtocolStart,
pub stop: ProtocolStop,
pub version: u32,
pub image_handle: crate::base::Handle,
pub driver_binding_handle: crate::base::Handle,
}

View File

@@ -0,0 +1,38 @@
//! Driver Diagnostics Protocol
//!
//! Defined in UEFI Specification, Section 11.4
//! Used to perform diagnostics on a controller that a UEFI driver is managing.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x4d330321,
0x025f,
0x4aac,
0x90,
0xd8,
&[0x5e, 0xd9, 0x00, 0x17, 0x3b, 0x63],
);
pub type Type = u32;
pub const TYPE_STANDARD: Type = 0;
pub const TYPE_EXTENDED: Type = 1;
pub const TYPE_MANUFACTURING: Type = 2;
pub const TYPE_CANCEL: Type = 3;
pub const TYPE_MAXIMUM: Type = 4;
pub type RunDiagnostics = eficall! {fn(
*mut Protocol,
crate::base::Handle,
crate::base::Handle,
Type,
*mut crate::base::Char8,
*mut *mut crate::base::Guid,
*mut usize,
*mut *mut crate::base::Char16,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub run_diagnostics: RunDiagnostics,
pub supported_languages: *mut crate::base::Char8,
}

View File

@@ -0,0 +1,23 @@
//! Driver Family Override Protocol
//!
//! When installed, the Driver Family Override Protocol informs the UEFI Boot
//! Service `ConnectController()` that this driver is higher priority than the
//! list of drivers returned by the Bus Specific Driver Override Protocol.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xb1ee129e,
0xda36,
0x4181,
0x91,
0xf8,
&[0x04, 0xa4, 0x92, 0x37, 0x66, 0xa7],
);
pub type ProtocolGetVersion = eficall! {fn(
*mut Protocol,
) -> u32};
#[repr(C)]
pub struct Protocol {
pub get_version: ProtocolGetVersion,
}

183
vendor/r-efi/src/protocols/file.rs vendored Normal file
View File

@@ -0,0 +1,183 @@
//! File Protocol
//!
//! Provides an interface to interact with both files and directories. This protocol is typically
//! obtained via an EFI_SIMPLE_FILE_SYSTEM protocol or via another EFI_FILE_PROTOCOL.
pub const REVISION: u64 = 0x0000_0000_0001_0000u64;
pub const REVISION2: u64 = 0x0000_0000_0002_0000u64;
pub const LATEST_REVISION: u64 = REVISION2;
pub const MODE_READ: u64 = 0x0000000000000001u64;
pub const MODE_WRITE: u64 = 0x0000000000000002u64;
pub const MODE_CREATE: u64 = 0x8000000000000000u64;
pub const READ_ONLY: u64 = 0x0000000000000001u64;
pub const HIDDEN: u64 = 0x0000000000000002u64;
pub const SYSTEM: u64 = 0x0000000000000004u64;
pub const RESERVED: u64 = 0x0000000000000008u64;
pub const DIRECTORY: u64 = 0x0000000000000010u64;
pub const ARCHIVE: u64 = 0x0000000000000020u64;
pub const VALID_ATTR: u64 = 0x0000000000000037u64;
pub const INFO_ID: crate::base::Guid = crate::base::Guid::from_fields(
0x09576e92,
0x6d3f,
0x11d2,
0x8e,
0x39,
&[0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
);
pub const SYSTEM_INFO_ID: crate::base::Guid = crate::base::Guid::from_fields(
0x09576e93,
0x6d3f,
0x11d2,
0x8e,
0x39,
&[0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
);
pub const SYSTEM_VOLUME_LABEL_ID: crate::base::Guid = crate::base::Guid::from_fields(
0xdb47d7d3,
0xfe81,
0x11d3,
0x9a,
0x35,
&[0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d],
);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct IoToken {
pub event: crate::base::Event,
pub status: crate::base::Status,
pub buffer_size: usize,
pub buffer: *mut core::ffi::c_void,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Info<const N: usize = 0> {
pub size: u64,
pub file_size: u64,
pub physical_size: u64,
pub create_time: crate::system::Time,
pub last_access_time: crate::system::Time,
pub modification_time: crate::system::Time,
pub attribute: u64,
pub file_name: [crate::base::Char16; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct SystemInfo<const N: usize = 0> {
pub size: u64,
pub read_only: crate::base::Boolean,
pub volume_size: u64,
pub free_space: u64,
pub block_size: u32,
pub volume_label: [crate::base::Char16; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct SystemVolumeLabel<const N: usize = 0> {
pub volume_label: [crate::base::Char16; N],
}
pub type ProtocolOpen = eficall! {fn(
*mut Protocol,
*mut *mut Protocol,
*mut crate::base::Char16,
u64,
u64,
) -> crate::base::Status};
pub type ProtocolClose = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
pub type ProtocolDelete = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
pub type ProtocolRead = eficall! {fn(
*mut Protocol,
*mut usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolWrite = eficall! {fn(
*mut Protocol,
*mut usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolGetPosition = eficall! {fn(
*mut Protocol,
*mut u64,
) -> crate::base::Status};
pub type ProtocolSetPosition = eficall! {fn(
*mut Protocol,
u64,
) -> crate::base::Status};
pub type ProtocolGetInfo = eficall! {fn(
*mut Protocol,
*mut crate::base::Guid,
*mut usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolSetInfo = eficall! {fn(
*mut Protocol,
*mut crate::base::Guid,
usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolFlush = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
pub type ProtocolOpenEx = eficall! {fn(
*mut Protocol,
*mut *mut Protocol,
*mut crate::base::Char16,
u64,
u64,
*mut IoToken,
) -> crate::base::Status};
pub type ProtocolReadEx = eficall! {fn(
*mut Protocol,
*mut IoToken,
) -> crate::base::Status};
pub type ProtocolWriteEx = eficall! {fn(
*mut Protocol,
*mut IoToken,
) -> crate::base::Status};
pub type ProtocolFlushEx = eficall! {fn(
*mut Protocol,
*mut IoToken,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub revision: u64,
pub open: ProtocolOpen,
pub close: ProtocolClose,
pub delete: ProtocolDelete,
pub read: ProtocolRead,
pub write: ProtocolWrite,
pub get_position: ProtocolGetPosition,
pub set_position: ProtocolSetPosition,
pub get_info: ProtocolGetInfo,
pub set_info: ProtocolSetInfo,
pub flush: ProtocolFlush,
pub open_ex: ProtocolOpenEx,
pub read_ex: ProtocolReadEx,
pub write_ex: ProtocolWriteEx,
pub flush_ex: ProtocolFlushEx,
}

View File

@@ -0,0 +1,103 @@
//! Graphics Output Protocol
//!
//! Provides means to configure graphics hardware and get access to
//! framebuffers. Replaces the old UGA interface from EFI with a
//! VGA-independent API.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x9042a9de,
0x23dc,
0x4a38,
0x96,
0xfb,
&[0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a],
);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct PixelBitmask {
pub red_mask: u32,
pub green_mask: u32,
pub blue_mask: u32,
pub reserved_mask: u32,
}
pub type GraphicsPixelFormat = u32;
pub const PIXEL_RED_GREEN_BLUE_RESERVED_8_BIT_PER_COLOR: GraphicsPixelFormat = 0x00000000;
pub const PIXEL_BLUE_GREEN_RED_RESERVED_8_BIT_PER_COLOR: GraphicsPixelFormat = 0x00000001;
pub const PIXEL_BIT_MASK: GraphicsPixelFormat = 0x00000002;
pub const PIXEL_BLT_ONLY: GraphicsPixelFormat = 0x00000003;
pub const PIXEL_FORMAT_MAX: GraphicsPixelFormat = 0x00000004;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ModeInformation {
pub version: u32,
pub horizontal_resolution: u32,
pub vertical_resolution: u32,
pub pixel_format: GraphicsPixelFormat,
pub pixel_information: PixelBitmask,
pub pixels_per_scan_line: u32,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Mode {
pub max_mode: u32,
pub mode: u32,
pub info: *mut ModeInformation,
pub size_of_info: usize,
pub frame_buffer_base: crate::base::PhysicalAddress,
pub frame_buffer_size: usize,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct BltPixel {
pub blue: u8,
pub green: u8,
pub red: u8,
pub reserved: u8,
}
pub type BltOperation = u32;
pub const BLT_VIDEO_FILL: BltOperation = 0x00000000;
pub const BLT_VIDEO_TO_BLT_BUFFER: BltOperation = 0x00000001;
pub const BLT_BUFFER_TO_VIDEO: BltOperation = 0x00000002;
pub const BLT_VIDEO_TO_VIDEO: BltOperation = 0x00000003;
pub const BLT_OPERATION_MAX: BltOperation = 0x00000004;
pub type ProtocolQueryMode = eficall! {fn(
*mut Protocol,
u32,
*mut usize,
*mut *mut ModeInformation,
) -> crate::base::Status};
pub type ProtocolSetMode = eficall! {fn(
*mut Protocol,
u32,
) -> crate::base::Status};
pub type ProtocolBlt = eficall! {fn(
*mut Protocol,
*mut BltPixel,
BltOperation,
usize,
usize,
usize,
usize,
usize,
usize,
usize,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub query_mode: ProtocolQueryMode,
pub set_mode: ProtocolSetMode,
pub blt: ProtocolBlt,
pub mode: *mut Mode,
}

View File

@@ -0,0 +1,299 @@
//! Human Interface Infrastructure (HII) Protocol
//!
//! Database manager for HII-related data structures.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xef9fc172,
0xa1b2,
0x4693,
0xb3,
0x27,
&[0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42],
);
pub const SET_KEYBOARD_LAYOUT_EVENT_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x14982a4f,
0xb0ed,
0x45b8,
0xa8,
0x11,
&[0x5a, 0x7a, 0x9b, 0xc2, 0x32, 0xdf],
);
pub type ProtocolNewPackageList = eficall! {fn(
*const Protocol,
*const crate::hii::PackageListHeader,
crate::base::Handle,
*mut crate::hii::Handle,
) -> crate::base::Status};
pub type ProtocolRemovePackageList = eficall! {fn(
*const Protocol,
crate::hii::Handle,
) -> crate::base::Status};
pub type ProtocolUpdatePackageList = eficall! {fn(
*const Protocol,
crate::hii::Handle,
*const crate::hii::PackageListHeader,
) -> crate::base::Status};
pub type ProtocolListPackageLists = eficall! {fn(
*const Protocol,
u8,
*const crate::base::Guid,
*mut usize,
*mut crate::hii::Handle,
) -> crate::base::Status};
pub type ProtocolExportPackageLists = eficall! {fn(
*const Protocol,
crate::hii::Handle,
*mut usize,
*mut crate::hii::PackageListHeader,
) -> crate::base::Status};
pub type ProtocolRegisterPackageNotify = eficall! {fn(
*const Protocol,
u8,
*const crate::base::Guid,
Notify,
NotifyType,
*mut crate::base::Handle,
) -> crate::base::Status};
pub type ProtocolUnregisterPackageNotify = eficall! {fn(
*const Protocol,
crate::base::Handle,
) -> crate::base::Status};
pub type ProtocolFindKeyboardLayouts = eficall! {fn(
*const Protocol,
*mut u16,
*mut crate::base::Guid,
) -> crate::base::Status};
pub type ProtocolGetKeyboardLayout = eficall! {fn(
*const Protocol,
*const crate::base::Guid,
*mut u16,
*mut KeyboardLayout,
) -> crate::base::Status};
pub type ProtocolSetKeyboardLayout = eficall! {fn(
*const Protocol,
*mut crate::base::Guid,
) -> crate::base::Status};
pub type ProtocolGetPackageListHandle = eficall! {fn(
*const Protocol,
crate::hii::Handle,
*mut crate::base::Handle,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub new_package_list: ProtocolNewPackageList,
pub remove_package_list: ProtocolRemovePackageList,
pub update_package_list: ProtocolUpdatePackageList,
pub list_package_lists: ProtocolListPackageLists,
pub export_package_lists: ProtocolExportPackageLists,
pub register_package_notify: ProtocolRegisterPackageNotify,
pub unregister_package_notify: ProtocolUnregisterPackageNotify,
pub find_keyboard_layouts: ProtocolFindKeyboardLayouts,
pub get_keyboard_layout: ProtocolGetKeyboardLayout,
pub set_keyboard_layout: ProtocolSetKeyboardLayout,
pub get_package_list_handle: ProtocolGetPackageListHandle,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct KeyboardLayout<const N: usize = 0> {
pub layout_length: u16,
pub guid: crate::base::Guid,
pub layout_descriptor_string_offset: u32,
pub descriptor_count: u8,
pub descriptors: [KeyDescriptor; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct KeyDescriptor {
pub key: Key,
pub unicode: crate::base::Char16,
pub shifted_unicode: crate::base::Char16,
pub alt_gr_unicode: crate::base::Char16,
pub shifted_alt_gr_unicode: crate::base::Char16,
pub modifier: u16,
pub affected_attribute: u16,
}
pub const AFFECTED_BY_STANDARD_SHIFT: u16 = 0x0001;
pub const AFFECTED_BY_CAPS_LOCK: u16 = 0x0002;
pub const AFFECTED_BY_NUM_LOCK: u16 = 0x0004;
pub type Key = u32;
pub const EFI_KEY_LCTRL: Key = 0x00000000;
pub const EFI_KEY_A0: Key = 0x00000001;
pub const EFI_KEY_LALT: Key = 0x00000002;
pub const EFI_KEY_SPACE_BAR: Key = 0x00000003;
pub const EFI_KEY_A2: Key = 0x00000004;
pub const EFI_KEY_A3: Key = 0x00000005;
pub const EFI_KEY_A4: Key = 0x00000006;
pub const EFI_KEY_RCTRL: Key = 0x00000007;
pub const EFI_KEY_LEFT_ARROW: Key = 0x00000008;
pub const EFI_KEY_DOWN_ARROW: Key = 0x00000009;
pub const EFI_KEY_RIGHT_ARROW: Key = 0x0000000a;
pub const EFI_KEY_ZERO: Key = 0x0000000b;
pub const EFI_KEY_PERIOD: Key = 0x0000000c;
pub const EFI_KEY_ENTER: Key = 0x0000000d;
pub const EFI_KEY_LSHIFT: Key = 0x0000000e;
pub const EFI_KEY_B0: Key = 0x0000000f;
pub const EFI_KEY_B1: Key = 0x00000010;
pub const EFI_KEY_B2: Key = 0x00000011;
pub const EFI_KEY_B3: Key = 0x00000012;
pub const EFI_KEY_B4: Key = 0x00000013;
pub const EFI_KEY_B5: Key = 0x00000014;
pub const EFI_KEY_B6: Key = 0x00000015;
pub const EFI_KEY_B7: Key = 0x00000016;
pub const EFI_KEY_B8: Key = 0x00000017;
pub const EFI_KEY_B9: Key = 0x00000018;
pub const EFI_KEY_B10: Key = 0x00000019;
pub const EFI_KEY_RSHIFT: Key = 0x0000001a;
pub const EFI_KEY_UP_ARROW: Key = 0x0000001b;
pub const EFI_KEY_ONE: Key = 0x0000001c;
pub const EFI_KEY_TWO: Key = 0x0000001d;
pub const EFI_KEY_THREE: Key = 0x0000001e;
pub const EFI_KEY_CAPS_LOCK: Key = 0x0000001f;
pub const EFI_KEY_C1: Key = 0x00000020;
pub const EFI_KEY_C2: Key = 0x00000021;
pub const EFI_KEY_C3: Key = 0x00000022;
pub const EFI_KEY_C4: Key = 0x00000023;
pub const EFI_KEY_C5: Key = 0x00000024;
pub const EFI_KEY_C6: Key = 0x00000025;
pub const EFI_KEY_C7: Key = 0x00000026;
pub const EFI_KEY_C8: Key = 0x00000027;
pub const EFI_KEY_C9: Key = 0x00000028;
pub const EFI_KEY_C10: Key = 0x00000029;
pub const EFI_KEY_C11: Key = 0x0000002a;
pub const EFI_KEY_C12: Key = 0x0000002b;
pub const EFI_KEY_FOUR: Key = 0x0000002c;
pub const EFI_KEY_FIVE: Key = 0x0000002d;
pub const EFI_KEY_SIX: Key = 0x0000002e;
pub const EFI_KEY_PLUS: Key = 0x0000002f;
pub const EFI_KEY_TAB: Key = 0x00000030;
pub const EFI_KEY_D1: Key = 0x00000031;
pub const EFI_KEY_D2: Key = 0x00000032;
pub const EFI_KEY_D3: Key = 0x00000033;
pub const EFI_KEY_D4: Key = 0x00000034;
pub const EFI_KEY_D5: Key = 0x00000035;
pub const EFI_KEY_D6: Key = 0x00000036;
pub const EFI_KEY_D7: Key = 0x00000037;
pub const EFI_KEY_D8: Key = 0x00000038;
pub const EFI_KEY_D9: Key = 0x00000039;
pub const EFI_KEY_D10: Key = 0x0000003a;
pub const EFI_KEY_D11: Key = 0x0000003b;
pub const EFI_KEY_D12: Key = 0x0000003c;
pub const EFI_KEY_D13: Key = 0x0000003d;
pub const EFI_KEY_DEL: Key = 0x0000003e;
pub const EFI_KEY_END: Key = 0x0000003f;
pub const EFI_KEY_PGDN: Key = 0x00000040;
pub const EFI_KEY_SEVEN: Key = 0x00000041;
pub const EFI_KEY_EIGHT: Key = 0x00000042;
pub const EFI_KEY_NINE: Key = 0x00000043;
pub const EFI_KEY_E0: Key = 0x00000044;
pub const EFI_KEY_E1: Key = 0x00000045;
pub const EFI_KEY_E2: Key = 0x00000046;
pub const EFI_KEY_E3: Key = 0x00000047;
pub const EFI_KEY_E4: Key = 0x00000048;
pub const EFI_KEY_E5: Key = 0x00000049;
pub const EFI_KEY_E6: Key = 0x0000004a;
pub const EFI_KEY_E7: Key = 0x0000004b;
pub const EFI_KEY_E8: Key = 0x0000004c;
pub const EFI_KEY_E9: Key = 0x0000004d;
pub const EFI_KEY_E10: Key = 0x0000004e;
pub const EFI_KEY_E11: Key = 0x0000004f;
pub const EFI_KEY_E12: Key = 0x00000050;
pub const EFI_KEY_BACK_SPACE: Key = 0x00000051;
pub const EFI_KEY_INS: Key = 0x00000052;
pub const EFI_KEY_HOME: Key = 0x00000053;
pub const EFI_KEY_PGUP: Key = 0x00000054;
pub const EFI_KEY_NLCK: Key = 0x00000055;
pub const EFI_KEY_SLASH: Key = 0x00000056;
pub const EFI_KEY_ASTERISK: Key = 0x00000057;
pub const EFI_KEY_MINUS: Key = 0x00000058;
pub const EFI_KEY_ESC: Key = 0x00000059;
pub const EFI_KEY_F1: Key = 0x0000005a;
pub const EFI_KEY_F2: Key = 0x0000005b;
pub const EFI_KEY_F3: Key = 0x0000005c;
pub const EFI_KEY_F4: Key = 0x0000005d;
pub const EFI_KEY_F5: Key = 0x0000005e;
pub const EFI_KEY_F6: Key = 0x0000005f;
pub const EFI_KEY_F7: Key = 0x00000060;
pub const EFI_KEY_F8: Key = 0x00000061;
pub const EFI_KEY_F9: Key = 0x00000062;
pub const EFI_KEY_F10: Key = 0x00000063;
pub const EFI_KEY_F11: Key = 0x00000064;
pub const EFI_KEY_F12: Key = 0x00000065;
pub const EFI_KEY_PRINT: Key = 0x00000066;
pub const EFI_KEY_SLCK: Key = 0x00000067;
pub const EFI_KEY_PAUSE: Key = 0x00000068;
pub const NULL_MODIFIER: u16 = 0x0000;
pub const LEFT_CONTROL_MODIFIER: u16 = 0x0001;
pub const RIGHT_CONTROL_MODIFIER: u16 = 0x0002;
pub const LEFT_ALT_MODIFIER: u16 = 0x0003;
pub const RIGHT_ALT_MODIFIER: u16 = 0x0004;
pub const ALT_GR_MODIFIER: u16 = 0x0005;
pub const INSERT_MODIFIER: u16 = 0x0006;
pub const DELETE_MODIFIER: u16 = 0x0007;
pub const PAGE_DOWN_MODIFIER: u16 = 0x0008;
pub const PAGE_UP_MODIFIER: u16 = 0x0009;
pub const HOME_MODIFIER: u16 = 0x000A;
pub const END_MODIFIER: u16 = 0x000B;
pub const LEFT_SHIFT_MODIFIER: u16 = 0x000C;
pub const RIGHT_SHIFT_MODIFIER: u16 = 0x000D;
pub const CAPS_LOCK_MODIFIER: u16 = 0x000E;
pub const NUM_LOCK_MODIFIER: u16 = 0x000F;
pub const LEFT_ARROW_MODIFIER: u16 = 0x0010;
pub const RIGHT_ARROW_MODIFIER: u16 = 0x0011;
pub const DOWN_ARROW_MODIFIER: u16 = 0x0012;
pub const UP_ARROW_MODIFIER: u16 = 0x0013;
pub const NS_KEY_MODIFIER: u16 = 0x0014;
pub const NS_KEY_DEPENDENCY_MODIFIER: u16 = 0x0015;
pub const FUNCTION_KEY_ONE_MODIFIER: u16 = 0x0016;
pub const FUNCTION_KEY_TWO_MODIFIER: u16 = 0x0017;
pub const FUNCTION_KEY_THREE_MODIFIER: u16 = 0x0018;
pub const FUNCTION_KEY_FOUR_MODIFIER: u16 = 0x0019;
pub const FUNCTION_KEY_FIVE_MODIFIER: u16 = 0x001A;
pub const FUNCTION_KEY_SIX_MODIFIER: u16 = 0x001B;
pub const FUNCTION_KEY_SEVEN_MODIFIER: u16 = 0x001C;
pub const FUNCTION_KEY_EIGHT_MODIFIER: u16 = 0x001D;
pub const FUNCTION_KEY_NINE_MODIFIER: u16 = 0x001E;
pub const FUNCTION_KEY_TEN_MODIFIER: u16 = 0x001F;
pub const FUNCTION_KEY_ELEVEN_MODIFIER: u16 = 0x0020;
pub const FUNCTION_KEY_TWELVE_MODIFIER: u16 = 0x0021;
pub const PRINT_MODIFIER: u16 = 0x0022;
pub const SYS_REQUEST_MODIFIER: u16 = 0x0023;
pub const SCROLL_LOCK_MODIFIER: u16 = 0x0024;
pub const PAUSE_MODIFIER: u16 = 0x0025;
pub const BREAK_MODIFIER: u16 = 0x0026;
pub const LEFT_LOGO_MODIFIER: u16 = 0x0027;
pub const RIGHT_LOGO_MODIFIER: u16 = 0x0028;
pub const MENU_MODIFIER: u16 = 0x0029;
pub type Notify = eficall! {fn(
u8,
*const crate::base::Guid,
*const crate::hii::PackageHeader,
crate::hii::Handle,
NotifyType,
) -> crate::base::Status};
pub type NotifyType = usize;
pub const NOTIFY_NEW_PACK: NotifyType = 0x00000001;
pub const NOTIFY_REMOVE_PACK: NotifyType = 0x00000002;
pub const NOTIFY_EXPORT_PACK: NotifyType = 0x00000004;
pub const NOTIFY_ADD_PACK: NotifyType = 0x00000008;

87
vendor/r-efi/src/protocols/hii_font.rs vendored Normal file
View File

@@ -0,0 +1,87 @@
//! HII Font Protocol
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xe9ca4775,
0x8657,
0x47fc,
0x97,
0xe7,
&[0x7e, 0xd6, 0x5a, 0x08, 0x43, 0x24],
);
pub type ProtocolStringToImage = eficall! {fn(
*const Protocol,
OutFlags,
String,
*const super::hii_font_ex::DisplayInfo,
*mut *mut super::hii_font_ex::ImageOutput,
usize,
usize,
*mut *mut RowInfo,
*mut usize,
*mut usize,
) -> crate::base::Status};
pub type ProtocolStringIdToImage = eficall! {fn(
*const Protocol,
OutFlags,
crate::hii::Handle,
crate::hii::StringId,
*const crate::base::Char8,
*const super::hii_font_ex::DisplayInfo,
*mut *mut super::hii_font_ex::ImageOutput,
usize,
usize,
*mut *mut RowInfo,
*mut usize,
*mut usize,
) -> crate::base::Status};
pub type ProtocolGetGlyph = eficall! {fn(
*const Protocol,
crate::base::Char16,
*const super::hii_font_ex::DisplayInfo,
*mut *mut super::hii_font_ex::ImageOutput,
*mut usize,
) -> crate::base::Status};
pub type ProtocolGetFontInfo = eficall! {fn(
*const Protocol,
*mut Handle,
*const super::hii_font_ex::DisplayInfo,
*mut *mut super::hii_font_ex::DisplayInfo,
String,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub string_to_image: ProtocolStringToImage,
pub string_id_to_image: ProtocolStringIdToImage,
pub get_glyph: ProtocolGetGlyph,
pub get_font_info: ProtocolGetFontInfo,
}
pub type OutFlags = u32;
pub const OUT_FLAG_CLIP: OutFlags = 0x00000001;
pub const OUT_FLAG_WRAP: OutFlags = 0x00000002;
pub const OUT_FLAG_CLIP_CLEAN_Y: OutFlags = 0x00000004;
pub const OUT_FLAG_CLIP_CLEAN_X: OutFlags = 0x00000008;
pub const OUT_FLAG_TRANSPARENT: OutFlags = 0x00000010;
pub const IGNORE_IF_NO_GLYPH: OutFlags = 0x00000020;
pub const IGNORE_LINE_BREAK: OutFlags = 0x00000040;
pub const DIRECT_TO_SCREEN: OutFlags = 0x00000080;
pub type String = *mut crate::base::Char16;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct RowInfo {
pub start_index: usize,
pub end_index: usize,
pub line_height: usize,
pub line_width: usize,
pub baseline_offset: usize,
}
pub type Handle = *mut core::ffi::c_void;

View File

@@ -0,0 +1,107 @@
//! HII Font Ex Protocol
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x849e6875,
0xdb35,
0x4df8,
0xb4,
0x1e,
&[0xc8, 0xf3, 0x37, 0x18, 0x07, 0x3f],
);
pub type ProtocolStringToImageEx = eficall! {fn(
*const Protocol,
super::hii_font::OutFlags,
super::hii_font::String,
*const DisplayInfo,
*mut *mut ImageOutput,
usize,
usize,
*mut *mut super::hii_font::RowInfo,
*mut usize,
*mut usize,
) -> crate::base::Status};
pub type ProtocolStringIdToImageEx = eficall! {fn(
*const Protocol,
super::hii_font::OutFlags,
crate::hii::Handle,
crate::hii::StringId,
*const crate::base::Char8,
*const DisplayInfo,
*mut *mut ImageOutput,
usize,
usize,
*mut *mut super::hii_font::RowInfo,
*mut usize,
*mut usize,
) -> crate::base::Status};
pub type ProtocolGetGlyphEx = eficall! {fn(
*const Protocol,
crate::base::Char16,
*const DisplayInfo,
*mut *mut ImageOutput,
usize,
) -> crate::base::Status};
pub type ProtocolGetFontInfoEx = eficall! {fn(
*const Protocol,
*mut super::hii_font::Handle,
*const DisplayInfo,
*mut *mut DisplayInfo,
super::hii_font::String,
) -> crate::base::Status};
pub type ProtocolGetGlyphInfo = eficall! {fn(
*const Protocol,
crate::base::Char16,
*const DisplayInfo,
*mut crate::hii::GlyphInfo,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub string_to_image_ex: ProtocolStringToImageEx,
pub string_id_to_image_ex: ProtocolStringIdToImageEx,
pub get_glyph_ex: ProtocolGetGlyphEx,
pub get_font_info_ex: ProtocolGetFontInfoEx,
pub get_glyph_info: ProtocolGetGlyphInfo,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct DisplayInfo {
pub foreground_color: super::graphics_output::BltPixel,
pub background_color: super::graphics_output::BltPixel,
pub font_info_mask: InfoMask,
pub font_info: super::hii_string::Info,
}
pub type InfoMask = u32;
pub const INFO_SYS_FONT: InfoMask = 0x00000001;
pub const INFO_SYS_SIZE: InfoMask = 0x00000002;
pub const INFO_SYS_STYLE: InfoMask = 0x00000004;
pub const INFO_SYS_FORE_COLOR: InfoMask = 0x00000010;
pub const INFO_SYS_BACK_COLOR: InfoMask = 0x00000020;
pub const INFO_RESIZE: InfoMask = 0x00001000;
pub const INFO_RESTYLE: InfoMask = 0x00002000;
pub const INFO_ANY_FONT: InfoMask = 0x00010000;
pub const INFO_ANY_SIZE: InfoMask = 0x00020000;
pub const INFO_ANY_STYLE: InfoMask = 0x00040000;
#[repr(C)]
#[derive(Clone, Copy)]
pub union ImageOutputImage {
pub bitmap: *mut super::graphics_output::BltPixel,
pub screen: *mut super::graphics_output::Protocol,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct ImageOutput {
pub width: u16,
pub height: u16,
pub image: ImageOutputImage,
}

View File

@@ -0,0 +1,14 @@
//! Human Interface Infrastructure (HII) Package List Protocol
//!
//! Installed onto an image handle during load if the image contains a custom PE/COFF
//! resource with type 'HII'. The protocol's interface pointer points to the HII package
//! list which is contained in the resource's data.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x6a1ee763,
0xd47a,
0x43b4,
0xaa,
0xbe,
&[0xef, 0x1d, 0xe2, 0xab, 0x56, 0xfc],
);

View File

@@ -0,0 +1,71 @@
//! HII String Protocol
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xfd96974,
0x23aa,
0x4cdc,
0xb9,
0xcb,
&[0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a],
);
pub type ProtocolNewString = eficall! {fn(
*const Protocol,
crate::hii::Handle,
*mut crate::hii::StringId,
*const crate::base::Char8,
*const crate::base::Char16,
super::hii_font::String,
*const Info,
) -> crate::base::Status};
pub type ProtocolGetString = eficall! {fn(
*const Protocol,
*const crate::base::Char8,
crate::hii::Handle,
crate::hii::StringId,
super::hii_font::String,
*mut usize,
*mut *mut Info,
) -> crate::base::Status};
pub type ProtocolSetString = eficall! {fn(
*const Protocol,
crate::hii::Handle,
crate::hii::StringId,
*const crate::base::Char8,
super::hii_font::String,
*const Info,
) -> crate::base::Status};
pub type ProtocolGetLanguages = eficall! {fn(
*const Protocol,
crate::hii::Handle,
*mut crate::base::Char8,
*mut usize,
) -> crate::base::Status};
pub type ProtocolGetSecondaryLanguages = eficall! {fn(
*const Protocol,
crate::hii::Handle,
*const crate::base::Char8,
*mut crate::base::Char8,
*mut usize,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub new_string: ProtocolNewString,
pub get_string: ProtocolGetString,
pub set_string: ProtocolSetString,
pub get_languages: ProtocolGetLanguages,
pub get_secondary_languages: ProtocolGetSecondaryLanguages,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Info<const N: usize = 0> {
pub font_style: crate::hii::FontStyle,
pub font_size: u16,
pub font_name: [crate::base::Char16; N],
}

202
vendor/r-efi/src/protocols/ip4.rs vendored Normal file
View File

@@ -0,0 +1,202 @@
//! IPv4 Protocol
//!
//! It implements a simple packet-oriented interface that can be used by
//! drivers, daemons, and applications to transmit and receive network packets.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x41d94cd2,
0x35b6,
0x455a,
0x82,
0x58,
&[0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd],
);
pub const SERVICE_BINDING_PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xc51711e7,
0xb4bf,
0x404a,
0xbf,
0xb8,
&[0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4],
);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ConfigData {
pub default_protocol: u8,
pub accept_any_protocol: crate::base::Boolean,
pub accept_icmp_errors: crate::base::Boolean,
pub accept_broadcast: crate::base::Boolean,
pub accept_promiscuous: crate::base::Boolean,
pub use_default_address: crate::base::Boolean,
pub station_address: crate::base::Ipv4Address,
pub subnet_mask: crate::base::Ipv4Address,
pub type_of_service: u8,
pub time_to_live: u8,
pub do_not_fragment: crate::base::Boolean,
pub raw_data: crate::base::Boolean,
pub receive_timeout: u32,
pub transmit_timeout: u32,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct RouteTable {
pub subnet_address: crate::base::Ipv4Address,
pub subnet_mask: crate::base::Ipv4Address,
pub gateway_address: crate::base::Ipv4Address,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct IcmpType {
pub r#type: u8,
pub code: u8,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ModeData {
pub is_started: crate::base::Boolean,
pub max_packet_size: u32,
pub config_data: ConfigData,
pub is_configured: crate::base::Boolean,
pub group_count: u32,
pub group_table: *mut crate::base::Ipv4Address,
pub route_count: u32,
pub route_table: *mut RouteTable,
pub icmp_type_count: u32,
pub icmp_type_list: *mut IcmpType,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CompletionToken {
pub event: crate::base::Event,
pub status: crate::base::Status,
pub packet: CompletionTokenPacket,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union CompletionTokenPacket {
pub rx_data: *mut ReceiveData,
pub tx_data: *mut TransmitData,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ReceiveData<const N: usize = 0> {
pub time_stamp: crate::system::Time,
pub recycle_signal: crate::base::Event,
pub header_length: u32,
pub header: *mut Header,
pub options_length: u32,
pub options: *mut core::ffi::c_void,
pub data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct TransmitData<const N: usize = 0> {
pub destination_address: crate::base::Ipv4Address,
pub override_data: *mut OverrideData,
pub options_length: u32,
pub options_buffer: *mut core::ffi::c_void,
pub total_data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Header {
pub header_length_and_version: u8,
pub type_of_service: u8,
pub total_length: u16,
pub identification: u16,
pub fragmentation: u16,
pub time_to_live: u8,
pub protocol: u8,
pub checksum: u16,
pub source_address: crate::base::Ipv4Address,
pub destination_address: crate::base::Ipv4Address,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct FragmentData {
pub fragment_length: u32,
pub fragment_buffer: *mut core::ffi::c_void,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct OverrideData {
pub source_address: crate::base::Ipv4Address,
pub gateway_address: crate::base::Ipv4Address,
pub protocol: u8,
pub type_of_service: u8,
pub time_to_live: u8,
pub do_not_fragment: crate::base::Boolean,
}
pub type ProtocolGetModeData = eficall! {fn(
*mut Protocol,
*mut ModeData,
*mut crate::protocols::managed_network::ConfigData,
*mut crate::protocols::simple_network::Mode,
) -> crate::base::Status};
pub type ProtocolConfigure = eficall! {fn(
*mut Protocol,
*mut ConfigData,
) -> crate::base::Status};
pub type ProtocolGroups = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::Ipv4Address,
) -> crate::base::Status};
pub type ProtocolRoutes = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::Ipv4Address,
*mut crate::base::Ipv4Address,
*mut crate::base::Ipv4Address,
) -> crate::base::Status};
pub type ProtocolTransmit = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolReceive = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolCancel = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolPoll = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_mode_data: ProtocolGetModeData,
pub configure: ProtocolConfigure,
pub groups: ProtocolGroups,
pub routes: ProtocolRoutes,
pub transmit: ProtocolTransmit,
pub receive: ProtocolReceive,
pub cancel: ProtocolCancel,
pub poll: ProtocolPoll,
}

264
vendor/r-efi/src/protocols/ip6.rs vendored Normal file
View File

@@ -0,0 +1,264 @@
//! IPv6 Protocol
//!
//! It implements a simple packet-oriented interface that can be used by
//! drivers, daemons, and applications to transmit and receive network packets.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x2c8759d5,
0x5c2d,
0x66ef,
0x92,
0x5f,
&[0xb6, 0x6c, 0x10, 0x19, 0x57, 0xe2],
);
pub const SERVICE_BINDING_PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xec835dd3,
0xfe0f,
0x617b,
0xa6,
0x21,
&[0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88],
);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ModeData {
pub is_started: crate::base::Boolean,
pub max_packet_size: u32,
pub config_data: ConfigData,
pub is_configured: crate::base::Boolean,
pub address_count: u32,
pub address_list: *mut AddressInfo,
pub group_count: u32,
pub group_table: *mut crate::base::Ipv6Address,
pub route_count: u32,
pub route_table: *mut RouteTable,
pub neighbor_count: u32,
pub neighbor_cache: *mut NeighborCache,
pub prefix_count: u32,
pub prefix_table: *mut AddressInfo,
pub icmp_type_count: u32,
pub icmp_type_list: *mut IcmpType,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ConfigData {
pub default_protocol: u8,
pub accept_any_protocol: crate::base::Boolean,
pub accept_icmp_errors: crate::base::Boolean,
pub accept_promiscuous: crate::base::Boolean,
pub destination_address: crate::base::Ipv6Address,
pub station_address: crate::base::Ipv6Address,
pub traffic_class: u8,
pub hop_limit: u8,
pub flow_lable: u32,
pub receive_timeout: u32,
pub transmit_timeout: u32,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct AddressInfo {
pub address: crate::base::Ipv6Address,
pub prefix_length: u8,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct RouteTable {
pub gateway: crate::base::Ipv6Address,
pub destination: crate::base::Ipv6Address,
pub prefix_length: u8,
}
pub type NeighborState = u32;
pub const NEIGHBOR_IN_COMPLETE: NeighborState = 0x00000000;
pub const NEIGHBOR_REACHABLE: NeighborState = 0x00000001;
pub const NEIGHBOR_STATE: NeighborState = 0x00000002;
pub const NEIGHBOR_DELAY: NeighborState = 0x00000003;
pub const NEIGHBOR_PROBE: NeighborState = 0x00000004;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct NeighborCache {
pub neighbor: crate::base::Ipv6Address,
pub link_address: crate::base::MacAddress,
pub state: NeighborState,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct IcmpType {
pub r#type: u8,
pub code: u8,
}
pub const ICMP_V6_DEST_UNREACHABLE: u8 = 0x01;
pub const ICMP_V6_PACKET_TOO_BIG: u8 = 0x02;
pub const ICMP_V6_TIME_EXCEEDED: u8 = 0x03;
pub const ICMP_V6_PARAMETER_PROBLEM: u8 = 0x04;
pub const ICMP_V6_ECHO_REQUEST: u8 = 0x80;
pub const ICMP_V6_ECHO_REPLY: u8 = 0x81;
pub const ICMP_V6_LISTENER_QUERY: u8 = 0x82;
pub const ICMP_V6_LISTENER_REPORT: u8 = 0x83;
pub const ICMP_V6_LISTENER_DONE: u8 = 0x84;
pub const ICMP_V6_ROUTER_SOLICIT: u8 = 0x85;
pub const ICMP_V6_ROUTER_ADVERTISE: u8 = 0x86;
pub const ICMP_V6_NEIGHBOR_SOLICIT: u8 = 0x87;
pub const ICMP_V6_NEIGHBOR_ADVERTISE: u8 = 0x88;
pub const ICMP_V6_REDIRECT: u8 = 0x89;
pub const ICMP_V6_LISTENER_REPORT_2: u8 = 0x8f;
pub const ICMP_V6_NO_ROUTE_TO_DEST: u8 = 0x00;
pub const ICMP_V6_COMM_PROHIBITED: u8 = 0x01;
pub const ICMP_V6_BEYOND_SCOPE: u8 = 0x02;
pub const ICMP_V6_ADDR_UNREACHABLE: u8 = 0x03;
pub const ICMP_V6_PORT_UNREACHABLE: u8 = 0x04;
pub const ICMP_V6_SOURCE_ADDR_FAILED: u8 = 0x05;
pub const ICMP_V6_ROUTE_REJECTED: u8 = 0x06;
pub const ICMP_V6_TIMEOUT_HOP_LIMIT: u8 = 0x00;
pub const ICMP_V6_TIMEOUT_REASSEMBLE: u8 = 0x01;
pub const ICMP_V6_ERRONEOUS_HEADER: u8 = 0x00;
pub const ICMP_V6_UNRECOGNIZE_NEXT_HDR: u8 = 0x01;
pub const ICMP_V6_UNRECOGNIZE_OPTION: u8 = 0x02;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CompletionToken {
pub event: crate::base::Event,
pub status: crate::base::Status,
pub packet: CompletionTokenPacket,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union CompletionTokenPacket {
pub rx_data: *mut ReceiveData,
pub tx_data: *mut TransmitData,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ReceiveData<const N: usize = 0> {
pub time_stamp: crate::system::Time,
pub recycle_signal: crate::base::Event,
pub header_length: u32,
pub header: *mut Header,
pub data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Header {
pub traffic_class_h_version: u8,
pub flow_label_h_traffic_class_l: u8,
pub flow_label_l: u16,
pub payload_length: u16,
pub next_header: u8,
pub hop_limit: u8,
pub source_address: crate::base::Ipv6Address,
pub destination_address: crate::base::Ipv6Address,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct FragmentData {
pub fragment_length: u32,
pub fragment_buffer: *mut core::ffi::c_void,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct TransmitData<const N: usize = 0> {
pub destination_address: *mut crate::base::Ipv6Address,
pub override_data: *mut OverrideData,
pub ext_hdrs_length: u32,
pub ext_hdrs: *mut core::ffi::c_void,
pub next_header: u8,
pub data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct OverrideData {
pub protocol: u8,
pub hop_limit: u8,
pub flow_label: u32,
}
pub type ProtocolGetModeData = eficall! {fn(
*mut Protocol,
*mut ModeData,
*mut crate::protocols::managed_network::ConfigData,
*mut crate::protocols::simple_network::Mode,
) -> crate::base::Status};
pub type ProtocolConfigure = eficall! {fn(
*mut Protocol,
*mut ConfigData,
) -> crate::base::Status};
pub type ProtocolGroups = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::Ipv6Address,
) -> crate::base::Status};
pub type ProtocolRoutes = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::Ipv6Address,
u8,
*mut crate::base::Ipv6Address,
) -> crate::base::Status};
pub type ProtocolNeighbors = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::Ipv6Address,
*mut crate::base::MacAddress,
u32,
crate::base::Boolean,
) -> crate::base::Status};
pub type ProtocolTransmit = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolReceive = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolCancel = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolPoll = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_mode_data: ProtocolGetModeData,
pub configure: ProtocolConfigure,
pub groups: ProtocolGroups,
pub routes: ProtocolRoutes,
pub neighbors: ProtocolNeighbors,
pub transmit: ProtocolTransmit,
pub receive: ProtocolReceive,
pub cancel: ProtocolCancel,
pub poll: ProtocolPoll,
}

26
vendor/r-efi/src/protocols/load_file.rs vendored Normal file
View File

@@ -0,0 +1,26 @@
//! Load File Protocol
//!
//! The Load File protocol is used to obtain files, that are primarily boot
//! options, from arbitrary devices.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x56ec3091,
0x954c,
0x11d2,
0x8e,
0x3f,
&[0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
);
pub type ProtocolLoadFile = eficall! {fn(
*mut Protocol,
*mut crate::protocols::device_path::Protocol,
crate::base::Boolean,
*mut usize,
*mut core::ffi::c_void
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub load_file: ProtocolLoadFile,
}

View File

@@ -0,0 +1,15 @@
//! Load File 2 Protocol
//!
//! The Load File 2 protocol is used to obtain files from arbitrary devices
//! that are not boot options.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x4006c0c1,
0xfcb3,
0x403e,
0x99,
0x6d,
&[0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d],
);
pub type Protocol = crate::protocols::load_file::Protocol;

View File

@@ -0,0 +1,39 @@
//! Loaded Image Protocol
//!
//! The loaded image protocol defines how to obtain information about a loaded image from an
//! image handle.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x5b1b31a1,
0x9562,
0x11d2,
0x8e,
0x3f,
&[0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
);
pub const REVISION: u32 = 0x00001000u32;
pub type ProtocolUnload = eficall! {fn(
crate::base::Handle,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub revision: u32,
pub parent_handle: crate::base::Handle,
pub system_table: *mut crate::system::SystemTable,
pub device_handle: crate::base::Handle,
pub file_path: *mut crate::protocols::device_path::Protocol,
pub reserved: *mut core::ffi::c_void,
pub load_options_size: u32,
pub load_options: *mut core::ffi::c_void,
pub image_base: *mut core::ffi::c_void,
pub image_size: u64,
pub image_code_type: crate::system::MemoryType,
pub image_data_type: crate::system::MemoryType,
pub unload: Option<ProtocolUnload>,
}

View File

@@ -0,0 +1,13 @@
//! Loaded Image Device Path Protocol
//!
//! The loaded image device path protocol provides the device path of a loaded image, using the
//! protocol structures of the device-path and loaded-image protocols.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xbc62157e,
0x3e33,
0x4fec,
0x99,
0x20,
&[0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf],
);

View File

@@ -0,0 +1,147 @@
//! Managed Network Protocol
//!
//! It provides raw (unformatted) asynchronous network packet I/O services.
//! These services make it possible for multiple-event-driven drivers and
//! applications to access and use the system network interfaces at the same
//! time.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x7ab33a91,
0xace5,
0x4326,
0xb5,
0x72,
&[0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16],
);
pub const SERVICE_BINDING_PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xf36ff770,
0xa7e1,
0x42cf,
0x9e,
0xd2,
&[0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c],
);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ConfigData {
pub received_queue_timeout_value: u32,
pub transmit_queue_timeout_value: u32,
pub protocol_type_filter: u16,
pub enable_unicast_receive: crate::base::Boolean,
pub enable_multicast_receive: crate::base::Boolean,
pub enable_broadcast_receive: crate::base::Boolean,
pub enable_promiscuous_receive: crate::base::Boolean,
pub flush_queues_on_reset: crate::base::Boolean,
pub enable_receive_timestamps: crate::base::Boolean,
pub disable_background_polling: crate::base::Boolean,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CompletionToken {
pub event: crate::base::Event,
pub status: crate::base::Status,
pub packet: CompletionTokenPacket,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union CompletionTokenPacket {
pub rx_data: *mut ReceiveData,
pub tx_data: *mut TransmitData,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ReceiveData {
pub timestamp: crate::system::Time,
pub recycle_event: crate::base::Event,
pub packet_length: u32,
pub header_length: u32,
pub address_length: u32,
pub data_length: u32,
pub broadcast_flag: crate::base::Boolean,
pub multicast_flag: crate::base::Boolean,
pub promiscuous_flag: crate::base::Boolean,
pub protocol_type: u16,
pub destination_address: *mut core::ffi::c_void,
pub source_address: *mut core::ffi::c_void,
pub media_header: *mut core::ffi::c_void,
pub packet_data: *mut core::ffi::c_void,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct TransmitData<const N: usize = 0> {
pub destination_address: *mut crate::base::MacAddress,
pub source_address: *mut crate::base::MacAddress,
pub protocol_type: u16,
pub data_length: u32,
pub header_length: u16,
pub fragment_count: u16,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct FragmentData {
pub fragment_length: u32,
pub fragment_buffer: *mut core::ffi::c_void,
}
pub type ProtocolGetModeData = eficall! {fn(
*mut Protocol,
*mut ConfigData,
*mut crate::protocols::simple_network::Mode,
) -> crate::base::Status};
pub type ProtocolConfigure = eficall! {fn(
*mut Protocol,
*mut ConfigData,
) -> crate::base::Status};
pub type ProtocolMcastIpToMac = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::IpAddress,
*mut crate::base::MacAddress,
) -> crate::base::Status};
pub type ProtocolGroups = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::MacAddress,
) -> crate::base::Status};
pub type ProtocolTransmit = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolReceive = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolCancel = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolPoll = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_mode_data: ProtocolGetModeData,
pub configure: ProtocolConfigure,
pub mcast_ip_to_mac: ProtocolMcastIpToMac,
pub groups: ProtocolGroups,
pub transmit: ProtocolTransmit,
pub receive: ProtocolReceive,
pub cancel: ProtocolCancel,
pub poll: ProtocolPoll,
}

View File

@@ -0,0 +1,40 @@
//! Memory Attribute Protocol
//!
//! Provides an interface to abstract setting or getting of memory attributes in the UEFI environment.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xf4560cf6,
0x40ec,
0x4b4a,
0xa1,
0x92,
&[0xbf, 0x1d, 0x57, 0xd0, 0xb1, 0x89],
);
pub type GetMemoryAttributes = eficall! {fn(
*mut Protocol,
crate::base::PhysicalAddress,
u64,
*mut u64,
) -> crate::base::Status};
pub type SetMemoryAttributes = eficall! {fn(
*mut Protocol,
crate::base::PhysicalAddress,
u64,
u64,
) -> crate::base::Status};
pub type ClearMemoryAttributes = eficall! {fn(
*mut Protocol,
crate::base::PhysicalAddress,
u64,
u64,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_memory_attributes: GetMemoryAttributes,
pub set_memory_attributes: SetMemoryAttributes,
pub clear_memory_attributes: ClearMemoryAttributes,
}

View File

@@ -0,0 +1,121 @@
//! Multi-Processor Services Protocol
//!
//! This Protocol is defined in the UEFI Platform Integration Specification,
//! Section 13.4.
//!
//! This provides a generalized way of performing the following tasks:
//! - Retrieving information of multi-processor environments.
//! - Dispatching user-provided function to APs.
//! - Maintain MP-related processor status.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x3fdda605,
0xa76e,
0x4f46,
0xad,
0x29,
&[0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08],
);
pub const PROCESSOR_AS_BSP_BIT: u32 = 0x00000001;
pub const PROCESSOR_ENABLED_BIT: u32 = 0x00000002;
pub const PROCESSOR_HEALTH_STATUS_BIT: u32 = 0x00000004;
pub const END_OF_CPU_LIST: usize = usize::MAX;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CpuPhysicalLocation {
pub package: u32,
pub core: u32,
pub thread: u32,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CpuPhysicalLocation2 {
pub package: u32,
pub module: u32,
pub tile: u32,
pub die: u32,
pub core: u32,
pub thread: u32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union ExtendedProcessorInformation {
pub location2: CpuPhysicalLocation2,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct ProcessorInformation {
pub processor_id: u64,
pub status_flag: u32,
pub location: CpuPhysicalLocation,
pub extended_information: ExtendedProcessorInformation,
}
pub type ApProcedure = eficall! {fn(*mut core::ffi::c_void)};
pub type GetNumberOfProcessors = eficall! {fn(
*mut Protocol,
*mut usize,
*mut usize,
) -> crate::base::Status};
pub type GetProcessorInfo = eficall! {fn(
*mut Protocol,
usize,
*mut ProcessorInformation,
) -> crate::base::Status};
pub type StartupAllAps = eficall! {fn(
*mut Protocol,
ApProcedure,
crate::base::Boolean,
crate::base::Event,
usize,
*mut core::ffi::c_void,
*mut *mut usize,
) -> crate::base::Status};
pub type StartupThisAp = eficall! {fn(
*mut Protocol,
ApProcedure,
usize,
crate::base::Event,
usize,
*mut core::ffi::c_void,
*mut crate::base::Boolean,
) -> crate::base::Status};
pub type SwitchBsp = eficall! {fn(
*mut Protocol,
usize,
crate::base::Boolean,
) -> crate::base::Status};
pub type EnableDisableAp = eficall! {fn(
*mut Protocol,
usize,
crate::base::Boolean,
*mut u32,
) -> crate::base::Status};
pub type WhoAmI = eficall! {fn(
*mut Protocol,
*mut usize,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_number_of_processors: GetNumberOfProcessors,
pub get_processor_info: GetProcessorInfo,
pub startup_all_aps: StartupAllAps,
pub startup_this_ap: StartupThisAp,
pub switch_bsp: SwitchBsp,
pub enable_disable_ap: EnableDisableAp,
pub who_am_i: WhoAmI,
}

203
vendor/r-efi/src/protocols/pci_io.rs vendored Normal file
View File

@@ -0,0 +1,203 @@
//! PCI I/O Protocol
//!
//! Used by code, typically drivers, running in the EFI boot services
//! environment to access memory and I/O on a PCI controller.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x4cf5b200,
0x68b8,
0x4ca5,
0x9e,
0xec,
&[0xb2, 0x3e, 0x3f, 0x50, 0x02, 0x9a],
);
pub type Width = u32;
pub const WIDTH_UINT8: Width = 0x00000000;
pub const WIDTH_UINT16: Width = 0x00000001;
pub const WIDTH_UINT32: Width = 0x00000002;
pub const WIDTH_UINT64: Width = 0x00000003;
pub const WIDTH_FIFO_UINT8: Width = 0x00000004;
pub const WIDTH_FIFO_UINT16: Width = 0x00000005;
pub const WIDTH_FIFO_UINT32: Width = 0x00000006;
pub const WIDTH_FIFO_UINT64: Width = 0x00000007;
pub const WIDTH_FILL_UINT8: Width = 0x00000008;
pub const WIDTH_FILL_UINT16: Width = 0x00000009;
pub const WIDTH_FILL_UINT32: Width = 0x0000000a;
pub const WIDTH_FILL_UINT64: Width = 0x0000000b;
pub const WIDTH_MAXIMUM: Width = 0x0000000c;
pub type Operation = u32;
pub const OPERATION_BUS_MASTER_READ: Operation = 0x00000000;
pub const OPERATION_BUS_MASTER_WRITE: Operation = 0x00000001;
pub const OPERATION_BUS_MASTER_COMMON_BUFFER: Operation = 0x00000002;
pub const OPERATION_MAXIMUM: Operation = 0x00000003;
pub type Attribute = u64;
pub const ATTRIBUTE_ISA_MOTHERBOARD_IO: Attribute = 0x00000001;
pub const ATTRIBUTE_ISA_IO: Attribute = 0x00000002;
pub const ATTRIBUTE_VGA_PALETTE_IO: Attribute = 0x00000004;
pub const ATTRIBUTE_VGA_MEMORY: Attribute = 0x00000008;
pub const ATTRIBUTE_VGA_IO: Attribute = 0x00000010;
pub const ATTRIBUTE_IDE_PRIMARY_IO: Attribute = 0x00000020;
pub const ATTRIBUTE_IDE_SECONDARY_IO: Attribute = 0x00000040;
pub const ATTRIBUTE_MEMORY_WRITE_COMBINE: Attribute = 0x00000080;
pub const ATTRIBUTE_IO: Attribute = 0x00000100;
pub const ATTRIBUTE_MEMORY: Attribute = 0x00000200;
pub const ATTRIBUTE_BUS_MASTER: Attribute = 0x00000400;
pub const ATTRIBUTE_MEMORY_CACHED: Attribute = 0x00000800;
pub const ATTRIBUTE_MEMORY_DISABLE: Attribute = 0x00001000;
pub const ATTRIBUTE_EMBEDDED_DEVICE: Attribute = 0x00002000;
pub const ATTRIBUTE_EMBEDDED_ROM: Attribute = 0x00004000;
pub const ATTRIBUTE_DUAL_ADDRESS_CYCLE: Attribute = 0x00008000;
pub const ATTRIBUTE_ISA_IO_16: Attribute = 0x00010000;
pub const ATTRIBUTE_VGA_PALETTE_IO_16: Attribute = 0x00020000;
pub const ATTRIBUTE_VGA_IO_16: Attribute = 0x00040000;
pub type AttributeOperation = u32;
pub const ATTRIBUTE_OPERATION_GET: AttributeOperation = 0x00000000;
pub const ATTRIBUTE_OPERATION_SET: AttributeOperation = 0x00000001;
pub const ATTRIBUTE_OPERATION_ENABLE: AttributeOperation = 0x00000002;
pub const ATTRIBUTE_OPERATION_DISABLE: AttributeOperation = 0x00000003;
pub const ATTRIBUTE_OPERATION_SUPPORTED: AttributeOperation = 0x00000004;
pub const ATTRIBUTE_OPERATION_MAXIMUM: AttributeOperation = 0x00000005;
pub const PASS_THROUGH_BAR: u8 = 0xff;
pub type ProtocolPollIoMem = eficall! {fn(
*mut Protocol,
Width,
u8,
u64,
u64,
u64,
u64,
*mut u64,
) -> crate::base::Status};
pub type ProtocolIoMem = eficall! {fn(
*mut Protocol,
Width,
u8,
u64,
usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolConfig = eficall! {fn(
*mut Protocol,
Width,
u32,
usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolCopyMem = eficall! {fn(
*mut Protocol,
Width,
u8,
u64,
u8,
u64,
usize,
) -> crate::base::Status};
pub type ProtocolMap = eficall! {fn(
*mut Protocol,
Operation,
*mut core::ffi::c_void,
*mut usize,
*mut crate::base::PhysicalAddress,
*mut *mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolUnmap = eficall! {fn(
*mut Protocol,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolAllocateBuffer = eficall! {fn(
*mut Protocol,
crate::system::AllocateType,
crate::system::MemoryType,
usize,
*mut *mut core::ffi::c_void,
Attribute,
) -> crate::base::Status};
pub type ProtocolFreeBuffer = eficall! {fn(
*mut Protocol,
usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolFlush = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
pub type ProtocolGetLocation = eficall! {fn(
*mut Protocol,
*mut usize,
*mut usize,
*mut usize,
*mut usize,
) -> crate::base::Status};
pub type ProtocolAttributes = eficall! {fn(
*mut Protocol,
AttributeOperation,
Attribute,
*mut Attribute,
) -> crate::base::Status};
pub type ProtocolGetBarAttributes = eficall! {fn(
*mut Protocol,
u8,
*mut Attribute,
*mut *mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolSetBarAttributes = eficall! {fn(
*mut Protocol,
Attribute,
u8,
*mut u64,
*mut u64,
) -> crate::base::Status};
#[repr(C)]
pub struct Access {
pub read: ProtocolIoMem,
pub write: ProtocolIoMem,
}
#[repr(C)]
pub struct ConfigAccess {
pub read: ProtocolConfig,
pub write: ProtocolConfig,
}
#[repr(C)]
pub struct Protocol {
pub poll_mem: ProtocolPollIoMem,
pub poll_io: ProtocolPollIoMem,
pub mem: Access,
pub io: Access,
pub pci: ConfigAccess,
pub copy_mem: ProtocolCopyMem,
pub map: ProtocolMap,
pub unmap: ProtocolUnmap,
pub allocate_buffer: ProtocolAllocateBuffer,
pub free_buffer: ProtocolFreeBuffer,
pub flush: ProtocolFlush,
pub get_location: ProtocolGetLocation,
pub attributes: ProtocolAttributes,
pub get_bar_attributes: ProtocolGetBarAttributes,
pub set_bar_attributes: ProtocolSetBarAttributes,
pub rom_size: u64,
pub rom_image: *mut core::ffi::c_void,
}

View File

@@ -0,0 +1,46 @@
//! Platform Driver Override Protocol
//!
//! This protocol matches one or more drivers to a controller. A platform driver
//! produces this protocol, and it is installed on a separate handle. This
//! protocol is used by the `EFI_BOOT_SERVICES.ConnectController()` boot service
//! to select the best driver for a controller. All of the drivers returned by
//! this protocol have a higher precedence than drivers found from an EFI Bus
//! Specific Driver Override Protocol or drivers found from the general UEFI
//! driver binding search algorithm. If more than one driver is returned by this
//! protocol, then the drivers are returned in order from highest precedence to
//! lowest precedence.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x6b30c738,
0xa391,
0x11d4,
0x9a,
0x3b,
&[0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d],
);
pub type ProtocolGetDriver = eficall! {fn(
*mut Protocol,
crate::base::Handle,
*mut crate::base::Handle,
) -> crate::base::Status};
pub type ProtocolGetDriverPath = eficall! {fn(
*mut Protocol,
crate::base::Handle,
*mut *mut crate::protocols::device_path::Protocol
) -> crate::base::Status};
pub type ProtocolDriverLoaded = eficall! {fn(
*mut Protocol,
crate::base::Handle,
*mut crate::protocols::device_path::Protocol,
crate::base::Handle,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_driver: ProtocolGetDriver,
pub get_driver_path: ProtocolGetDriverPath,
pub driver_loaded: ProtocolDriverLoaded,
}

83
vendor/r-efi/src/protocols/rng.rs vendored Normal file
View File

@@ -0,0 +1,83 @@
//! Random Number Generator Protocol
//!
//! This protocol is used to provide random numbers for use in applications, or
//! entropy for seeding other random number generators.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x3152bca5,
0xeade,
0x433d,
0x86,
0x2e,
&[0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44],
);
pub type Algorithm = crate::base::Guid;
pub const ALGORITHM_SP800_90_HASH_256_GUID: Algorithm = crate::base::Guid::from_fields(
0xa7af67cb,
0x603b,
0x4d42,
0xba,
0x21,
&[0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96],
);
pub const ALGORITHM_SP800_90_HMAC_256_GUID: Algorithm = crate::base::Guid::from_fields(
0xc5149b43,
0xae85,
0x4f53,
0x99,
0x82,
&[0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7],
);
pub const ALGORITHM_SP800_90_CTR_256_GUID: Algorithm = crate::base::Guid::from_fields(
0x44f0de6e,
0x4d8c,
0x4045,
0xa8,
0xc7,
&[0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e],
);
pub const ALGORITHM_X9_31_3DES_GUID: Algorithm = crate::base::Guid::from_fields(
0x63c4785a,
0xca34,
0x4012,
0xa3,
0xc8,
&[0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46],
);
pub const ALGORITHM_X9_31_AES_GUID: Algorithm = crate::base::Guid::from_fields(
0xacd03321,
0x777e,
0x4d3d,
0xb1,
0xc8,
&[0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9],
);
pub const ALGORITHM_RAW: Algorithm = crate::base::Guid::from_fields(
0xe43176d7,
0xb6e8,
0x4827,
0xb7,
0x84,
&[0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61],
);
pub type ProtocolGetInfo = eficall! {fn(
*mut Protocol,
*mut usize,
*mut Algorithm,
) -> crate::base::Status};
pub type ProtocolGetRng = eficall! {fn(
*mut Protocol,
*mut Algorithm,
usize,
*mut u8,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_info: ProtocolGetInfo,
pub get_rng: ProtocolGetRng,
}

View File

@@ -0,0 +1,20 @@
//! Service Binding Protocol
//!
//! Provides services that are required to create and destroy child handles
//! that support a given set of protocols.
pub type ProtocolCreateChild = eficall! {fn(
*mut Protocol,
*mut crate::base::Handle,
) -> crate::base::Status};
pub type ProtocolDestroyChild = eficall! {fn(
*mut Protocol,
crate::base::Handle,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub create_child: ProtocolCreateChild,
pub destroy_child: ProtocolDestroyChild,
}

295
vendor/r-efi/src/protocols/shell.rs vendored Normal file
View File

@@ -0,0 +1,295 @@
//! Shell Protocol
//!
//! Provides shell services to UEFI applications.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x6302d008,
0x7f9b,
0x4f30,
0x87,
0xac,
&[0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e],
);
pub const MAJOR_VERSION: u32 = 0x00000002;
pub const MINOR_VERSION: u32 = 0x00000002;
pub type FileHandle = *mut core::ffi::c_void;
pub type DeviceNameFlags = u32;
pub const DEVICE_NAME_USE_COMPONENT_NAME: DeviceNameFlags = 0x00000001;
pub const DEVICE_NAME_USE_DEVICE_PATH: DeviceNameFlags = 0x00000002;
#[repr(C)]
pub struct ListEntry {
pub flink: *mut ListEntry,
pub blink: *mut ListEntry,
}
#[repr(C)]
pub struct FileInfo {
pub link: ListEntry,
pub status: crate::base::Status,
pub full_name: *mut crate::base::Char16,
pub file_name: *mut crate::base::Char16,
pub handle: FileHandle,
pub info: *mut crate::protocols::file::Info,
}
pub type Execute = eficall! {fn(
*mut crate::base::Handle,
*mut crate::base::Char16,
*mut *mut crate::base::Char16,
*mut crate::base::Status,
) -> crate::base::Status};
pub type GetEnv = eficall! {fn(
*mut crate::base::Char16,
) -> *mut crate::base::Char16};
pub type SetEnv = eficall! {fn(
*mut crate::base::Char16,
*mut crate::base::Char16,
crate::base::Boolean,
) -> crate::base::Status};
pub type GetAlias = eficall! {fn(
*mut crate::base::Char16,
*mut crate::base::Boolean,
) -> *mut crate::base::Char16};
pub type SetAlias = eficall! {fn(
*mut crate::base::Char16,
*mut crate::base::Char16,
crate::base::Boolean,
crate::base::Boolean,
) -> crate::base::Status};
pub type GetHelpText = eficall! {fn(
*mut crate::base::Char16,
*mut crate::base::Char16,
*mut *mut crate::base::Char16,
) -> crate::base::Status};
pub type GetDevicePathFromMap = eficall! {fn(
*mut crate::base::Char16,
) -> *mut crate::protocols::device_path::Protocol};
pub type GetMapFromDevicePath = eficall! {fn(
*mut *mut crate::protocols::device_path::Protocol,
) -> *mut crate::base::Char16};
pub type GetDevicePathFromFilePath = eficall! {fn(
*mut crate::base::Char16,
) -> *mut crate::protocols::device_path::Protocol};
pub type GetFilePathFromDevicePath = eficall! {fn(
*mut crate::protocols::device_path::Protocol,
) -> *mut crate::base::Char16};
pub type SetMap = eficall! {fn(
*mut crate::protocols::device_path::Protocol,
*mut crate::base::Char16,
) -> crate::base::Status};
pub type GetCurDir = eficall! {fn(
*mut crate::base::Char16,
) -> *mut crate::base::Char16};
pub type SetCurDir = eficall! {fn(
*mut crate::base::Char16,
*mut crate::base::Char16,
) -> crate::base::Status};
pub type OpenFileList = eficall! {fn(
*mut crate::base::Char16,
u64,
*mut *mut FileInfo,
) -> crate::base::Status};
pub type FreeFileList = eficall! {fn(
*mut *mut FileInfo,
) -> crate::base::Status};
pub type RemoveDupInFileList = eficall! {fn(
*mut *mut FileInfo,
) -> crate::base::Status};
pub type BatchIsActive = eficall! {fn() -> crate::base::Boolean};
pub type IsRootShell = eficall! {fn() -> crate::base::Boolean};
pub type EnablePageBreak = eficall! {fn()};
pub type DisablePageBreak = eficall! {fn()};
pub type GetPageBreak = eficall! {fn() -> crate::base::Boolean};
pub type GetDeviceName = eficall! {fn(
crate::base::Handle,
DeviceNameFlags,
*mut crate::base::Char8,
*mut *mut crate::base::Char16,
) -> crate::base::Status};
pub type GetFileInfo = eficall! {fn(
FileHandle,
) -> *mut crate::protocols::file::Info};
pub type SetFileInfo = eficall! {fn(
FileHandle,
*mut crate::protocols::file::Info
) -> crate::base::Status};
pub type OpenFileByName = eficall! {fn(
*mut crate::base::Char16,
*mut FileHandle,
u64,
) -> crate::base::Status};
pub type CloseFile = eficall! {fn(
FileHandle,
) -> crate::base::Status};
pub type CreateFile = eficall! {fn(
*mut crate::base::Char16,
u64,
*mut FileHandle,
) -> crate::base::Status};
pub type ReadFile = eficall! {fn(
FileHandle,
*mut usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type WriteFile = eficall! {fn(
FileHandle,
*mut usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type DeleteFile = eficall! {fn(
FileHandle,
) -> crate::base::Status};
pub type DeleteFileByName = eficall! {fn(
*mut crate::base::Char16,
) -> crate::base::Status};
pub type GetFilePosition = eficall! {fn(
FileHandle,
*mut u64,
) -> crate::base::Status};
pub type SetFilePosition = eficall! {fn(
FileHandle,
u64,
) -> crate::base::Status};
pub type FlushFile = eficall! {fn(
FileHandle,
) -> crate::base::Status};
pub type FindFiles = eficall! {fn(
*mut crate::base::Char16,
*mut *mut FileInfo,
) -> crate::base::Status};
pub type FindFilesInDir = eficall! {fn(
FileHandle,
*mut *mut FileInfo,
) -> crate::base::Status};
pub type GetFileSize = eficall! {fn(
FileHandle,
*mut u64,
) -> crate::base::Status};
pub type OpenRoot = eficall! {fn(
*mut crate::protocols::device_path::Protocol,
*mut FileHandle,
) -> crate::base::Status};
pub type OpenRootByHandle = eficall! {fn(
crate::base::Handle,
*mut FileHandle,
) -> crate::base::Status};
pub type RegisterGuidName = eficall! {fn(
*mut crate::base::Guid,
*mut crate::base::Char16,
) -> crate::base::Status};
pub type GetGuidName = eficall! {fn(
*mut crate::base::Guid,
*mut *mut crate::base::Char16,
) -> crate::base::Status};
pub type GetGuidFromName = eficall! {fn(
*mut crate::base::Char16,
*mut crate::base::Guid,
) -> crate::base::Status};
pub type GetEnvEx = eficall! {fn(
*mut crate::base::Char16,
*mut u32,
) -> *mut crate::base::Char16};
#[repr(C)]
pub struct Protocol {
pub execute: Execute,
pub get_env: GetEnv,
pub set_env: SetEnv,
pub get_alias: GetAlias,
pub set_alias: SetAlias,
pub get_help_text: GetHelpText,
pub get_device_path_from_map: GetDevicePathFromMap,
pub get_map_from_device_path: GetMapFromDevicePath,
pub get_device_path_from_file_path: GetDevicePathFromFilePath,
pub get_file_path_from_device_path: GetFilePathFromDevicePath,
pub set_map: SetMap,
pub get_cur_dir: GetCurDir,
pub set_cur_dir: SetCurDir,
pub open_file_list: OpenFileList,
pub free_file_list: FreeFileList,
pub remove_dup_in_file_list: RemoveDupInFileList,
pub batch_is_active: BatchIsActive,
pub is_root_shell: IsRootShell,
pub enable_page_break: EnablePageBreak,
pub disable_page_break: DisablePageBreak,
pub get_page_break: GetPageBreak,
pub get_device_name: GetDeviceName,
pub get_file_info: GetFileInfo,
pub set_file_info: SetFileInfo,
pub open_file_by_name: OpenFileByName,
pub close_file: CloseFile,
pub create_file: CreateFile,
pub read_file: ReadFile,
pub write_file: WriteFile,
pub delete_file: DeleteFile,
pub delete_file_by_name: DeleteFileByName,
pub get_file_position: GetFilePosition,
pub set_file_position: SetFilePosition,
pub flush_file: FlushFile,
pub find_files: FindFiles,
pub find_files_in_dir: FindFilesInDir,
pub get_file_size: GetFileSize,
pub open_root: OpenRoot,
pub open_root_by_handle: OpenRootByHandle,
pub execution_break: crate::base::Event,
pub major_version: u32,
pub minor_version: u32,
pub register_guid_name: RegisterGuidName,
pub get_guid_name: GetGuidName,
pub get_guid_from_name: GetGuidFromName,
// Shell 2.1
pub get_env_ex: GetEnvEx,
}

View File

@@ -0,0 +1,33 @@
//! Shell Dynamic Command Protocol
//!
//! Defined in UEFI Shell Specification, Section 2.4
use super::{shell, shell_parameters};
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x3c7200e9,
0x005f,
0x4ea4,
0x87,
0xde,
&[0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3],
);
pub type CommandHandler = eficall! {fn(
*mut Protocol,
*mut crate::system::SystemTable,
*mut shell_parameters::Protocol,
*mut shell::Protocol,
) -> crate::base::Status};
pub type CommandGetHelp = eficall! {fn(
*mut Protocol,
*mut crate::base::Char8,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub command_name: *mut crate::base::Char16,
pub handler: CommandHandler,
pub get_help: CommandGetHelp,
}

View File

@@ -0,0 +1,23 @@
//! Shell Parameters Protocol
//!
//! Defined in the UEFI Shell Specification, Section 2.3.
use super::shell;
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x752f3136,
0x4e16,
0x4fdc,
0xa2,
0x2a,
&[0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca],
);
#[repr(C)]
pub struct Protocol {
pub argv: *mut *mut crate::base::Char16,
pub argc: usize,
pub std_in: shell::FileHandle,
pub std_out: shell::FileHandle,
pub std_err: shell::FileHandle,
}

View File

@@ -0,0 +1,26 @@
//! Simple File System Protocol
//!
//! Provides the `open_volume` function returning a file protocol representing the root directory
//! of a filesystem.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x964e5b22,
0x6459,
0x11d2,
0x8e,
0x39,
&[0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
);
pub const REVISION: u64 = 0x0000000000010000u64;
pub type ProtocolOpenVolume = eficall! {fn(
*mut Protocol,
*mut *mut crate::protocols::file::Protocol,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub revision: u64,
pub open_volume: ProtocolOpenVolume,
}

View File

@@ -0,0 +1,196 @@
//! Simple Network Protocol
//!
//! The simple network protcol provides services to initialize a network interface, transmit
//! packets, receive packets, and close a network interface.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xa19832b9,
0xac25,
0x11d3,
0x9a,
0x2d,
&[0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d],
);
pub const REVISION: u64 = 0x0000000000010000u64;
pub const MAX_MCAST_FILTER_CNT: usize = 16;
pub const RECEIVE_UNICAST: u32 = 0x00000001u32;
pub const RECEIVE_MULTICAST: u32 = 0x00000002u32;
pub const RECEIVE_BROADCAST: u32 = 0x00000004u32;
pub const RECEIVE_PROMISCUOUS: u32 = 0x00000008u32;
pub const RECEIVE_PROMISCUOUS_MULTICAST: u32 = 0x00000010u32;
pub const RECEIVE_INTERRUPT: u32 = 0x00000001u32;
pub const TRANSMIT_INTERRUPT: u32 = 0x00000002u32;
pub const COMMAND_INTERRUPT: u32 = 0x00000004u32;
pub const SOFTWARE_INTERRUPT: u32 = 0x000000008u32;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Mode {
pub state: u32,
pub hw_address_size: u32,
pub media_header_size: u32,
pub max_packet_size: u32,
pub nvram_size: u32,
pub nvram_access_size: u32,
pub receive_filter_mask: u32,
pub receive_filter_setting: u32,
pub max_mcast_filter_count: u32,
pub mcast_filter_count: u32,
pub mcast_filter: [crate::base::MacAddress; MAX_MCAST_FILTER_CNT],
pub current_address: crate::base::MacAddress,
pub broadcast_address: crate::base::MacAddress,
pub permanent_address: crate::base::MacAddress,
pub if_type: u8,
pub mac_address_changeable: crate::base::Boolean,
pub multiple_tx_supported: crate::base::Boolean,
pub media_present_supported: crate::base::Boolean,
pub media_present: crate::base::Boolean,
}
pub type State = u32;
pub const STOPPED: State = 0x00000000;
pub const STARTED: State = 0x00000001;
pub const INITIALIZED: State = 0x00000002;
pub const MAX_STATE: State = 0x00000003;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Statistics {
pub rx_total_frames: u64,
pub rx_good_frames: u64,
pub rx_undersize_frames: u64,
pub rx_oversize_frames: u64,
pub rx_dropped_frames: u64,
pub rx_unicast_frames: u64,
pub rx_broadcast_frames: u64,
pub rx_multicast_frames: u64,
pub rx_crc_error_frames: u64,
pub rx_total_bytes: u64,
pub tx_total_frames: u64,
pub tx_good_frames: u64,
pub tx_undersize_frames: u64,
pub tx_oversize_frames: u64,
pub tx_dropped_frames: u64,
pub tx_unicast_frames: u64,
pub tx_broadcast_frames: u64,
pub tx_multicast_frames: u64,
pub tx_crc_error_frames: u64,
pub tx_total_bytes: u64,
pub collisions: u64,
pub unsupported_protocol: u64,
pub rx_duplicated_frames: u64,
pub rx_decrypt_error_frames: u64,
pub tx_error_frames: u64,
pub tx_retry_frames: u64,
}
pub type ProtocolStart = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
pub type ProtocolStop = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
pub type ProtocolInitialize = eficall! {fn(
*mut Protocol,
usize,
usize,
) -> crate::base::Status};
pub type ProtocolReset = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
) -> crate::base::Status};
pub type ProtocolShutdown = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
pub type ProtocolReceiveFilters = eficall! {fn(
*mut Protocol,
u32,
u32,
crate::base::Boolean,
usize,
*mut crate::base::MacAddress,
) -> crate::base::Status};
pub type ProtocolStationAddress = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::MacAddress,
) -> crate::base::Status};
pub type ProtocolStatistics = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut usize,
*mut Statistics,
) -> crate::base::Status};
pub type ProtocolMcastIpToMac = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::IpAddress,
*mut crate::base::MacAddress,
) -> crate::base::Status};
pub type ProtocolNvData = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
usize,
usize,
*mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolGetStatus = eficall! {fn(
*mut Protocol,
*mut u32,
*mut *mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolTransmit = eficall! {fn(
*mut Protocol,
usize,
usize,
*mut core::ffi::c_void,
*mut crate::base::MacAddress,
*mut crate::base::MacAddress,
*mut u16,
) -> crate::base::Status};
pub type ProtocolReceive = eficall! {fn(
*mut Protocol,
*mut usize,
*mut usize,
*mut core::ffi::c_void,
*mut crate::base::MacAddress,
*mut crate::base::MacAddress,
*mut u16,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub revision: u64,
pub start: ProtocolStart,
pub stop: ProtocolStop,
pub initialize: ProtocolInitialize,
pub reset: ProtocolReset,
pub shutdown: ProtocolShutdown,
pub receive_filters: ProtocolReceiveFilters,
pub station_address: ProtocolStationAddress,
pub statistics: ProtocolStatistics,
pub mcast_ip_to_mac: ProtocolMcastIpToMac,
pub nv_data: ProtocolNvData,
pub get_status: ProtocolGetStatus,
pub transmit: ProtocolTransmit,
pub receive: ProtocolReceive,
pub wait_for_packet: crate::base::Event,
pub mode: *mut Mode,
}

View File

@@ -0,0 +1,38 @@
//! Simple Text Input Protocol
//!
//! The simple-text-input protocol defines how to read basic key-strokes. It is limited to
//! non-modifiers and lacks any detailed reporting. It is mostly useful for debugging and admin
//! interaction.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x387477c1,
0x69c7,
0x11d2,
0x8e,
0x39,
&[0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
);
#[repr(C)]
#[derive(Clone, Copy, Debug, Default)]
pub struct InputKey {
pub scan_code: u16,
pub unicode_char: crate::base::Char16,
}
pub type ProtocolReset = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
) -> crate::base::Status};
pub type ProtocolReadKeyStroke = eficall! {fn(
*mut Protocol,
*mut InputKey,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub reset: ProtocolReset,
pub read_key_stroke: ProtocolReadKeyStroke,
pub wait_for_key: crate::base::Event,
}

View File

@@ -0,0 +1,85 @@
//! Extended Simple Text Input Protocol
//!
//! The simple-text-input-ex protocol extends the simple-text-input protocol by allowing more
//! details reporting about modifiers, etc.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xdd9e7534,
0x7762,
0x4698,
0x8c,
0x14,
&[0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa],
);
pub const SHIFT_STATE_VALID: u32 = 0x80000000u32;
pub const RIGHT_SHIFT_PRESSED: u32 = 0x00000001u32;
pub const LEFT_SHIFT_PRESSED: u32 = 0x00000002u32;
pub const RIGHT_CONTROL_PRESSED: u32 = 0x00000004u32;
pub const LEFT_CONTROL_PRESSED: u32 = 0x00000008u32;
pub const RIGHT_ALT_PRESSED: u32 = 0x00000010u32;
pub const LEFT_ALT_PRESSED: u32 = 0x00000020u32;
pub const RIGHT_LOGO_PRESSED: u32 = 0x00000040u32;
pub const LEFT_LOGO_PRESSED: u32 = 0x00000080u32;
pub const MENU_KEY_PRESSED: u32 = 0x00000100u32;
pub const SYS_REQ_PRESSED: u32 = 0x00000200u32;
pub const TOGGLE_STATE_VALID: u8 = 0x80u8;
pub const KEY_STATE_EXPOSED: u8 = 0x40u8;
pub const SCROLL_LOCK_ACTIVE: u8 = 0x01u8;
pub const NUM_LOCK_ACTIVE: u8 = 0x02u8;
pub const CAPS_LOCK_ACTIVE: u8 = 0x04u8;
pub type KeyToggleState = u8;
pub type KeyNotifyFunction = eficall! {fn(*mut KeyData) -> crate::base::Status};
#[repr(C)]
#[derive(Clone, Copy, Debug, Default)]
pub struct KeyState {
pub key_shift_state: u32,
pub key_toggle_state: KeyToggleState,
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Default)]
pub struct KeyData {
pub key: crate::protocols::simple_text_input::InputKey,
pub key_state: KeyState,
}
pub type ProtocolReset = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
) -> crate::base::Status};
pub type ProtocolReadKeyStrokeEx = eficall! {fn(
*mut Protocol,
*mut KeyData,
) -> crate::base::Status};
pub type ProtocolSetState = eficall! {fn(
*mut Protocol,
*mut KeyToggleState,
) -> crate::base::Status};
pub type ProtocolRegisterKeyNotify = eficall! {fn(
*mut Protocol,
*mut KeyData,
KeyNotifyFunction,
*mut *mut core::ffi::c_void,
) -> crate::base::Status};
pub type ProtocolUnregisterKeyNotify = eficall! {fn(
*mut Protocol,
*mut core::ffi::c_void,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub reset: ProtocolReset,
pub read_key_stroke_ex: ProtocolReadKeyStrokeEx,
pub wait_for_key_ex: crate::base::Event,
pub set_state: ProtocolSetState,
pub register_key_notify: ProtocolRegisterKeyNotify,
pub unregister_key_notify: ProtocolUnregisterKeyNotify,
}

View File

@@ -0,0 +1,86 @@
//! Simple Text Output Protocol
//!
//! The simple-text-output protocol provides a simple way to print text on screen. It is modeled
//! around the old VGA-consoles, but does not carry all the old cruft. It expects a rectangular
//! text array and allows you to move the cursor around to write Unicode symbols to screen.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x387477c2,
0x69c7,
0x11d2,
0x8e,
0x39,
&[0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Mode {
pub max_mode: i32,
pub mode: i32,
pub attribute: i32,
pub cursor_column: i32,
pub cursor_row: i32,
pub cursor_visible: crate::base::Boolean,
}
pub type ProtocolReset = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
) -> crate::base::Status};
pub type ProtocolOutputString = eficall! {fn(
*mut Protocol,
*mut crate::base::Char16,
) -> crate::base::Status};
pub type ProtocolTestString = eficall! {fn(
*mut Protocol,
*mut crate::base::Char16,
) -> crate::base::Status};
pub type ProtocolQueryMode = eficall! {fn(
*mut Protocol,
usize,
*mut usize,
*mut usize,
) -> crate::base::Status};
pub type ProtocolSetMode = eficall! {fn(
*mut Protocol,
usize,
) -> crate::base::Status};
pub type ProtocolSetAttribute = eficall! {fn(
*mut Protocol,
usize,
) -> crate::base::Status};
pub type ProtocolClearScreen = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
pub type ProtocolSetCursorPosition = eficall! {fn(
*mut Protocol,
usize,
usize,
) -> crate::base::Status};
pub type ProtocolEnableCursor = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub reset: ProtocolReset,
pub output_string: ProtocolOutputString,
pub test_string: ProtocolTestString,
pub query_mode: ProtocolQueryMode,
pub set_mode: ProtocolSetMode,
pub set_attribute: ProtocolSetAttribute,
pub clear_screen: ProtocolClearScreen,
pub set_cursor_position: ProtocolSetCursorPosition,
pub enable_cursor: ProtocolEnableCursor,
pub mode: *mut Mode,
}

224
vendor/r-efi/src/protocols/tcp4.rs vendored Normal file
View File

@@ -0,0 +1,224 @@
//! Transmission Control Protocol version 4
//!
//! It provides services to send and receive data streams.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x65530bc7,
0xa359,
0x410f,
0xb0,
0x10,
&[0x5a, 0xad, 0xc7, 0xec, 0x2b, 0x62],
);
pub const SERVICE_BINDING_PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x00720665,
0x67eb,
0x4a99,
0xba,
0xf7,
&[0xd3, 0xc3, 0x3a, 0x1c, 0x7c, 0xc9],
);
pub type ConnectionState = u32;
pub const STATE_CLOSED: ConnectionState = 0x00000000;
pub const STATE_LISTEN: ConnectionState = 0x00000001;
pub const STATE_SYN_SENT: ConnectionState = 0x00000002;
pub const STATE_SYN_RECEIVED: ConnectionState = 0x00000003;
pub const STATE_ESTABLISHED: ConnectionState = 0x00000004;
pub const STATE_FIN_WAIT1: ConnectionState = 0x00000005;
pub const STATE_FIN_WAIT2: ConnectionState = 0x00000006;
pub const STATE_CLOSING: ConnectionState = 0x00000007;
pub const STATE_TIME_WAIT: ConnectionState = 0x00000008;
pub const STATE_CLOSE_WAIT: ConnectionState = 0x00000009;
pub const STATE_LAST_ACK: ConnectionState = 0x0000000a;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ConfigData {
pub type_of_service: u8,
pub time_to_live: u8,
pub access_point: AccessPoint,
pub control_option: *mut r#Option,
}
impl Default for ConfigData {
fn default() -> Self {
Self {
type_of_service: Default::default(),
time_to_live: Default::default(),
access_point: Default::default(),
control_option: core::ptr::null_mut(),
}
}
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Default)]
pub struct AccessPoint {
pub use_default_address: crate::base::Boolean,
pub station_address: crate::base::Ipv4Address,
pub subnet_mask: crate::base::Ipv4Address,
pub station_port: u16,
pub remote_address: crate::base::Ipv4Address,
pub remote_port: u16,
pub active_flag: crate::base::Boolean,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct r#Option {
pub receive_buffer_size: u32,
pub send_buffer_size: u32,
pub max_syn_back_log: u32,
pub connection_timeout: u32,
pub data_retries: u32,
pub fin_timeout: u32,
pub time_wait_timeout: u32,
pub keep_alive_probes: u32,
pub keep_alive_time: u32,
pub keep_alive_interval: u32,
pub enable_nagle: crate::base::Boolean,
pub enable_time_stamp: crate::base::Boolean,
pub enable_window_scaling: crate::base::Boolean,
pub enable_selective_ack: crate::base::Boolean,
pub enable_path_mtu_discovery: crate::base::Boolean,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct CompletionToken {
pub event: crate::base::Event,
pub status: crate::base::Status,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ConnectionToken {
pub completion_token: CompletionToken,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ListenToken {
pub completion_token: CompletionToken,
pub new_child_handle: crate::base::Handle,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct IoToken {
pub completion_token: CompletionToken,
pub packet: IoTokenPacket,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union IoTokenPacket {
pub rx_data: *mut ReceiveData,
pub tx_data: *mut TransmitData,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ReceiveData<const N: usize = 0> {
pub urgent_flag: crate::base::Boolean,
pub data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct FragmentData {
pub fragment_length: u32,
pub fragment_buffer: *mut core::ffi::c_void,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct TransmitData<const N: usize = 0> {
pub push: crate::base::Boolean,
pub urgent: crate::base::Boolean,
pub data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct CloseToken {
pub completion_token: CompletionToken,
pub abort_on_close: crate::base::Boolean,
}
pub type ProtocolGetModeData = eficall! {fn(
*mut Protocol,
*mut ConnectionState,
*mut ConfigData,
*mut crate::protocols::ip4::ModeData,
*mut crate::protocols::managed_network::ConfigData,
*mut crate::protocols::simple_network::Mode,
) -> crate::base::Status};
pub type ProtocolConfigure = eficall! {fn(
*mut Protocol,
*mut ConfigData,
) -> crate::base::Status};
pub type ProtocolRoutes = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::Ipv4Address,
*mut crate::base::Ipv4Address,
*mut crate::base::Ipv4Address,
) -> crate::base::Status};
pub type ProtocolConnect = eficall! {fn(
*mut Protocol,
*mut ConnectionToken,
) -> crate::base::Status};
pub type ProtocolAccept = eficall! {fn(
*mut Protocol,
*mut ListenToken,
) -> crate::base::Status};
pub type ProtocolTransmit = eficall! {fn(
*mut Protocol,
*mut IoToken,
) -> crate::base::Status};
pub type ProtocolReceive = eficall! {fn(
*mut Protocol,
*mut IoToken,
) -> crate::base::Status};
pub type ProtocolClose = eficall! {fn(
*mut Protocol,
*mut CloseToken,
) -> crate::base::Status};
pub type ProtocolCancel = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolPoll = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_mode_data: ProtocolGetModeData,
pub configure: ProtocolConfigure,
pub routes: ProtocolRoutes,
pub connect: ProtocolConnect,
pub accept: ProtocolAccept,
pub transmit: ProtocolTransmit,
pub receive: ProtocolReceive,
pub close: ProtocolClose,
pub cancel: ProtocolCancel,
pub poll: ProtocolPoll,
}

202
vendor/r-efi/src/protocols/tcp6.rs vendored Normal file
View File

@@ -0,0 +1,202 @@
//! Transmission Control Protocol version 6
//!
//! It provides services to send and receive data streams.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x46e44855,
0xbd60,
0x4ab7,
0xab,
0x0d,
&[0xa6, 0x79, 0xb9, 0x44, 0x7d, 0x77],
);
pub const SERVICE_BINDING_PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xec20eb79,
0x6c1a,
0x4664,
0x9a,
0x0d,
&[0xd2, 0xe4, 0xcc, 0x16, 0xd6, 0x64],
);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct AccessPoint {
pub station_address: crate::base::Ipv6Address,
pub station_port: u16,
pub remote_address: crate::base::Ipv6Address,
pub remote_port: u16,
pub active_flag: crate::base::Boolean,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct r#Option {
pub receive_buffer_size: u32,
pub send_buffer_size: u32,
pub max_syn_back_log: u32,
pub connection_timeout: u32,
pub data_retries: u32,
pub fin_timeout: u32,
pub time_wait_timeout: u32,
pub keep_alive_probes: u32,
pub keep_alive_time: u32,
pub keep_alive_interval: u32,
pub enable_nagle: crate::base::Boolean,
pub enable_time_stamp: crate::base::Boolean,
pub enable_window_scaling: crate::base::Boolean,
pub enable_selective_ack: crate::base::Boolean,
pub enable_path_mtu_discovery: crate::base::Boolean,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ConfigData {
pub traffic_class: u8,
pub hop_limit: u8,
pub access_point: AccessPoint,
pub control_option: *mut r#Option,
}
pub type ConnectionState = u32;
pub const STATE_CLOSED: ConnectionState = 0x00000000;
pub const STATE_LISTEN: ConnectionState = 0x00000001;
pub const STATE_SYN_SENT: ConnectionState = 0x00000002;
pub const STATE_SYN_RECEIVED: ConnectionState = 0x00000003;
pub const STATE_ESTABLISHED: ConnectionState = 0x00000004;
pub const STATE_FIN_WAIT1: ConnectionState = 0x00000005;
pub const STATE_FIN_WAIT2: ConnectionState = 0x00000006;
pub const STATE_CLOSING: ConnectionState = 0x00000007;
pub const STATE_TIME_WAIT: ConnectionState = 0x00000008;
pub const STATE_CLOSE_WAIT: ConnectionState = 0x00000009;
pub const STATE_LAST_ACK: ConnectionState = 0x0000000a;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct CompletionToken {
pub event: crate::base::Event,
pub status: crate::base::Status,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ConnectionToken {
pub completion_token: CompletionToken,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ListenToken {
pub completion_token: CompletionToken,
pub new_child_handle: crate::base::Handle,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct IoToken {
pub completion_token: CompletionToken,
pub packet: IoTokenPacket,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union IoTokenPacket {
pub rx_data: *mut ReceiveData,
pub tx_data: *mut TransmitData,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ReceiveData<const N: usize = 0> {
pub urgent_flag: crate::base::Boolean,
pub data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct FragmentData {
pub fragment_length: u32,
pub fragment_buffer: *mut core::ffi::c_void,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct TransmitData<const N: usize = 0> {
pub push: crate::base::Boolean,
pub urgent: crate::base::Boolean,
pub data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct CloseToken {
pub completion_token: CompletionToken,
pub abort_on_close: crate::base::Boolean,
}
pub type ProtocolGetModeData = eficall! {fn(
*mut Protocol,
*mut ConnectionState,
*mut ConfigData,
*mut crate::protocols::ip6::ModeData,
*mut crate::protocols::managed_network::ConfigData,
*mut crate::protocols::simple_network::Mode,
) -> crate::base::Status};
pub type ProtocolConfigure = eficall! {fn(
*mut Protocol,
*mut ConfigData,
) -> crate::base::Status};
pub type ProtocolConnect = eficall! {fn(
*mut Protocol,
*mut ConnectionToken,
) -> crate::base::Status};
pub type ProtocolAccept = eficall! {fn(
*mut Protocol,
*mut ListenToken,
) -> crate::base::Status};
pub type ProtocolTransmit = eficall! {fn(
*mut Protocol,
*mut IoToken,
) -> crate::base::Status};
pub type ProtocolReceive = eficall! {fn(
*mut Protocol,
*mut IoToken,
) -> crate::base::Status};
pub type ProtocolClose = eficall! {fn(
*mut Protocol,
*mut CloseToken,
) -> crate::base::Status};
pub type ProtocolCancel = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolPoll = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_mode_data: ProtocolGetModeData,
pub configure: ProtocolConfigure,
pub connect: ProtocolConnect,
pub accept: ProtocolAccept,
pub transmit: ProtocolTransmit,
pub receive: ProtocolReceive,
pub close: ProtocolClose,
pub cancel: ProtocolCancel,
pub poll: ProtocolPoll,
}

32
vendor/r-efi/src/protocols/timestamp.rs vendored Normal file
View File

@@ -0,0 +1,32 @@
//! EFI Timestamp Protocol
//!
//! The Timestamp protocol provides a platform independent interface for
//! retrieving a high resolution timestamp counter.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xafbfde41,
0x2e6e,
0x4262,
0xba,
0x65,
&[0x62, 0xb9, 0x23, 0x6e, 0x54, 0x95],
);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Properties {
pub frequency: u64,
pub end_value: u64,
}
pub type ProtocolGetTimestamp = eficall! {fn() -> u64};
pub type ProtocolGetProperties = eficall! {fn(
*mut Properties,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_timestamp: ProtocolGetTimestamp,
pub get_properties: ProtocolGetProperties,
}

151
vendor/r-efi/src/protocols/udp4.rs vendored Normal file
View File

@@ -0,0 +1,151 @@
//! User Datagram Protocol V4
//!
//! It provides simple packet-oriented services to transmit and receive UDP packets.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x3ad9df29,
0x4501,
0x478d,
0xb1,
0xf8,
&[0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3],
);
pub const SERVICE_BINDING_PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x83f01464,
0x99bd,
0x45e5,
0xb3,
0x83,
&[0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6],
);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ConfigData {
pub accept_broadcast: crate::base::Boolean,
pub accept_promiscuous: crate::base::Boolean,
pub accept_any_port: crate::base::Boolean,
pub allow_duplicate_port: crate::base::Boolean,
pub type_of_service: u8,
pub time_to_live: u8,
pub do_not_fragment: crate::base::Boolean,
pub receive_timeout: u32,
pub transmit_timeout: u32,
pub use_default_address: crate::base::Boolean,
pub station_address: crate::base::Ipv4Address,
pub subnet_mask: crate::base::Ipv4Address,
pub station_port: u16,
pub remote_address: crate::base::Ipv4Address,
pub remote_port: u16,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct SessionData {
pub source_address: crate::base::Ipv4Address,
pub source_port: u16,
pub destination_address: crate::base::Ipv4Address,
pub destination_port: u16,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct FragmentData {
pub fragment_length: u32,
pub fragment_buffer: *mut core::ffi::c_void,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct ReceiveData<const N: usize = 0> {
pub time_stamp: crate::system::Time,
pub recycle_signal: crate::base::Event,
pub udp_session: SessionData,
pub data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct TransmitData<const N: usize = 0> {
pub udp_session_data: *mut SessionData,
pub gateway_address: *mut crate::base::Ipv4Address,
pub data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union CompletionTokenPacket {
pub rx_data: *mut ReceiveData,
pub tx_data: *mut TransmitData,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CompletionToken {
pub event: crate::base::Event,
pub status: crate::base::Status,
pub packet: CompletionTokenPacket,
}
pub type ProtocolGetModeData = eficall! {fn(
*mut Protocol,
*mut ConfigData,
*mut crate::protocols::ip4::ModeData,
*mut crate::protocols::managed_network::ConfigData,
*mut crate::protocols::simple_network::Mode,
) -> crate::base::Status};
pub type ProtocolConfigure = eficall! {fn(
*mut Protocol,
*mut ConfigData,
) -> crate::base::Status};
pub type ProtocolGroups = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::Ipv4Address,
) -> crate::base::Status};
pub type ProtocolRoutes = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::Ipv4Address,
*mut crate::base::Ipv4Address,
*mut crate::base::Ipv4Address,
) -> crate::base::Status};
pub type ProtocolTransmit = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolReceive = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolCancel = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolPoll = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_mode_data: ProtocolGetModeData,
pub configure: ProtocolConfigure,
pub groups: ProtocolGroups,
pub routes: ProtocolRoutes,
pub transmit: ProtocolTransmit,
pub receive: ProtocolReceive,
pub cancel: ProtocolCancel,
pub poll: ProtocolPoll,
}

137
vendor/r-efi/src/protocols/udp6.rs vendored Normal file
View File

@@ -0,0 +1,137 @@
//! User Datagram Protocol V6
//!
//! It provides simple packet-oriented services to transmit and receive UDP packets.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x4f948815,
0xb4b9,
0x43cb,
0x8a,
0x33,
&[0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55],
);
pub const SERVICE_BINDING_PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x66ed4721,
0x3c98,
0x4d3e,
0x81,
0xe3,
&[0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54],
);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ConfigData {
pub accept_promiscuous: crate::base::Boolean,
pub accept_any_port: crate::base::Boolean,
pub allow_duplicate_port: crate::base::Boolean,
pub traffic_class: u8,
pub hop_limit: u8,
pub receive_timeout: u32,
pub transmit_timeout: u32,
pub station_address: crate::base::Ipv6Address,
pub station_port: u16,
pub remote_address: crate::base::Ipv6Address,
pub remote_port: u16,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct SessionData {
pub source_address: crate::base::Ipv6Address,
pub source_port: u16,
pub destination_address: crate::base::Ipv6Address,
pub destination_port: u16,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct FragmentData {
pub fragment_length: u32,
pub fragment_buffer: *mut core::ffi::c_void,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct ReceiveData<const N: usize = 0> {
pub time_stamp: crate::system::Time,
pub recycle_signal: crate::base::Event,
pub udp_session: SessionData,
pub data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct TransmitData<const N: usize = 0> {
pub udp_session_data: *mut SessionData,
pub data_length: u32,
pub fragment_count: u32,
pub fragment_table: [FragmentData; N],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union CompletionTokenPacket {
pub rx_data: *mut ReceiveData,
pub tx_data: *mut TransmitData,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CompletionToken {
pub event: crate::base::Event,
pub status: crate::base::Status,
pub packet: CompletionTokenPacket,
}
pub type ProtocolGetModeData = eficall! {fn(
*mut Protocol,
*mut ConfigData,
*mut crate::protocols::ip6::ModeData,
*mut crate::protocols::managed_network::ConfigData,
*mut crate::protocols::simple_network::Mode,
) -> crate::base::Status};
pub type ProtocolConfigure = eficall! {fn(
*mut Protocol,
*mut ConfigData,
) -> crate::base::Status};
pub type ProtocolGroups = eficall! {fn(
*mut Protocol,
crate::base::Boolean,
*mut crate::base::Ipv6Address,
) -> crate::base::Status};
pub type ProtocolTransmit = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolReceive = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolCancel = eficall! {fn(
*mut Protocol,
*mut CompletionToken,
) -> crate::base::Status};
pub type ProtocolPoll = eficall! {fn(
*mut Protocol,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub get_mode_data: ProtocolGetModeData,
pub configure: ProtocolConfigure,
pub groups: ProtocolGroups,
pub transmit: ProtocolTransmit,
pub receive: ProtocolReceive,
pub cancel: ProtocolCancel,
pub poll: ProtocolPoll,
}

1130
vendor/r-efi/src/system.rs vendored Normal file

File diff suppressed because it is too large Load Diff

10
vendor/r-efi/src/vendor.rs vendored Normal file
View File

@@ -0,0 +1,10 @@
//! UEFI Vendor Protocols
//!
//! Many vendor protocols are not part of the official specification. But we
//! still allow importing them here, so we have a central place to collect
//! them. Note that we separate them by vendor-name, which is not the best
//! name-space but should be acceptible.
pub mod intel {
pub mod console_control;
}

View File

@@ -0,0 +1,37 @@
//! Console Control Protocol
//!
//! The console-control protocols allows modifying the behavior of the default
//! console device. It is supported by TianoCore and widely adopted.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0xf42f7782,
0x012e,
0x4c12,
0x99,
0x56,
&[0x49, 0xf9, 0x43, 0x04, 0xf7, 0x21],
);
pub type ScreenMode = u32;
pub const SCREEN_TEXT: ScreenMode = 0x00000000;
pub const SCREEN_GRAPHICS: ScreenMode = 0x00000001;
pub const SCREEN_MAX_VALUE: ScreenMode = 0x00000002;
#[repr(C)]
pub struct Protocol {
pub get_mode: eficall! {fn(
*mut Protocol,
*mut ScreenMode,
*mut crate::base::Boolean,
*mut crate::base::Boolean,
) -> crate::base::Status},
pub set_mode: eficall! {fn(
*mut Protocol,
ScreenMode,
) -> crate::base::Status},
pub lock_std_in: eficall! {fn(
*mut Protocol,
*mut crate::base::Char16,
) -> crate::base::Status},
}