Expand description
Software Development Kit (SDK) for Patina
This crate implements the core SDK for Patina and is only part of the Patina solution. For general knowledge on Patina, refer to the Patina book.
§License
Copyright (C) Microsoft Corporation.
SPDX-License-Identifier: Apache-2.0
Modules§
- arch
- Arch Specific abstractions for Patina.
- c_ptr
- This module provides C pointer abstractions for safe pointer handling in Rust.
- component
- Module for creating UEFI components.
- debug
- Debug and diagnostics facilities for Patina.
- error
- Module for converting UEFI errors to rusty errors.
- guid
- Patina GUID type
- hash
- Hash utilities for Patina
- management_
mode - Management Mode (MM) definitions for Patina.
- mmio
- Re-export of the
safe-mmiocrate. - performance
- Patina SDK Performance Module
- peripheral
- Device interface abstractions for Patina.
- pi
- Platform Initialization (PI) Specification Definitions and Support Code
- protocol
- Protocol interface abstraction and implementations for spec-defined protocols.
- standard
- This module contains industry standard definitions used by Patina.
- string
- Patina UEFI string types
- uefi
- UEFI specification definitions and interfaces.
Macros§
- bit
- A macro to generate a bit mask with the nth bit set.
- char8
- Builds a
&'staticChar8Strfrom a string literal, validated as Latin-1 at compile time. - char16
- Builds a
&'staticChar16Strfrom a string literal, validated as UCS-2 at compile time. - devpath
- Encodes a UEFI text device path as an owned byte array at compile time.
- function
- Gives a
&'static strthat is the name of the containing function. - log_
debug_ assert - Logs an error message and fires a
debug_assert!(false)with the same message. - pci_
address - Constructs a PCI library address from the given bus, device, function, and register values.
- signature
- Generates a UEFI-style signature from between 1 to 8 bytes, packing them into a u16, u32 or u64 as appropriate for the parameters passed.
- uefi_
pages_ to_ size - Converts a number of UEFI pages to the corresponding size in bytes.
- uefi_
size_ to_ pages - Converts a size in bytes to the number of UEFI pages required.
- writelncrlf
- Writes a line to the Writer target, followed by CRLF.
Structs§
- Binary
Guid - A binary-compatible GUID wrapper for use in
#[repr(C)]structures. - Char8
Array - A fixed capacity, NUL-terminated CHAR8 (ASCII / ISO-Latin-1) string of
Nbytes. - Char8
Str - A borrowed, NUL-terminated CHAR8 (ASCII / ISO-Latin-1) string.
- Char8
String - An owned, heap-backed, NUL-terminated CHAR8 (ASCII / ISO-Latin-1) string.
- Char16
Array - A fixed capacity, NUL-terminated UCS-2 (UEFI CHAR16) string of
Ncode units. - Char16
Str - A borrowed, NUL-terminated UCS-2 (UEFI CHAR16) string.
- Char16
String - An owned, heap-backed, NUL-terminated UCS-2 (UEFI CHAR16) string.
Enums§
- Guid
- A wrapper type for displaying UEFI GUIDs in a human-readable format.
- Guid
Error - Error type for GUID parsing operations
- String
Error - Error returned when constructing or validating a UEFI string.
Constants§
- DEFAULT_
CACHE_ ATTR - Patina uses write back as the default cache attribute for memory allocations.
- SIZE_
1GB - 1GB, 0x40000000, 2^30
- SIZE_
1KB - 1KB, 1024 bytes, 0x400, 2^10
- SIZE_
1MB - 1MB, 0x100000, 2^20
- SIZE_
1TB - 1TB, 0x10000000000, 2^40
- SIZE_
2GB - 2GB, 0x80000000, 2^31
- SIZE_
2KB - 2KB, 2048 bytes, 0x800, 2^11
- SIZE_
2MB - 2MB, 0x200000, 2^21
- SIZE_
2TB - 2TB, 0x20000000000, 2^41
- SIZE_
4GB - 4GB, 0x100000000, 2^32
- SIZE_
4KB - 4KB, 4096 bytes, 0x1000, 2^12
- SIZE_
4MB - 4MB, 0x400000, 2^22
- SIZE_
4TB - 4TB, 0x40000000000, 2^42
- SIZE_
8GB - 8GB, 0x200000000, 2^33
- SIZE_
8KB - 8KB, 8192 bytes, 0x2000, 2^13
- SIZE_
8MB - 8MB, 0x800000, 2^23
- SIZE_
8TB - 8TB, 0x80000000000, 2^43
- SIZE_
16GB - 16GB, 0x400000000, 2^34
- SIZE_
16KB - 16KB, 16384 bytes, 0x4000, 2^14
- SIZE_
16MB - 16MB, 0x1000000, 2^24
- SIZE_
16TB - 16TB, 0x100000000000, 2^44
- SIZE_
32GB - 32GB, 0x800000000, 2^35
- SIZE_
32KB - 32KB, 32768 bytes, 0x8000, 2^15
- SIZE_
32MB - 32MB, 0x2000000, 2^25
- SIZE_
32TB - 32TB, 0x200000000000, 2^45
- SIZE_
64GB - 64GB, 0x1000000000, 2^36
- SIZE_
64KB - 64KB, 65536 bytes, 0x10000, 2^16
- SIZE_
64MB - 64MB, 0x4000000, 2^26
- SIZE_
64TB - 64TB, 0x400000000000, 2^46
- SIZE_
128GB - 128GB, 0x2000000000, 2^37
- SIZE_
128KB - 128KB, 0x20000, 2^17
- SIZE_
128MB - 128MB, 0x8000000, 2^27
- SIZE_
128TB - 128TB, 0x800000000000, 2^47
- SIZE_
256GB - 256GB, 0x4000000000, 2^38
- SIZE_
256KB - 256KB, 0x40000, 2^18
- SIZE_
256MB - 256MB, 0x10000000, 2^28
- SIZE_
256TB - 256TB, 0x1000000000000, 2^48
- SIZE_
512GB - 512GB, 0x8000000000, 2^39
- SIZE_
512KB - 512KB, 0x80000, 2^19
- SIZE_
512MB - 512MB, 0x20000000, 2^29
- UEFI_
PAGE_ MASK - The mask to apply to an address to get the page offset in UEFI.
- UEFI_
PAGE_ SHIFT - The shift to apply to an address to get the page frame number in UEFI.
- UEFI_
PAGE_ SIZE - EFI memory allocation functions work in units of
EFI_PAGEsthat are 4KB. This should in no way be confused with the page size of the processor. AnEFI_PAGEis just the quanta of memory in EFI.
Functions§
- align_
down - Aligns the given address down to the nearest boundary specified by align.
- align_
range - Aligns the given address down to the nearest boundary specified by align. Also calculates the aligned length based on the base and length provided.
- align_
up - Aligns the given address up to the nearest boundary specified by align.
- is_
power_ of_ two - Checks if the given value is a power of two.
This function checks if the value
xis greater than zero and if it is a power of two. - page_
shift_ from_ alignment - Converts a page-aligned byte granularity to the corresponding bit shift value.
Type Aliases§
- Owned
Guid - A GUID that owns its data and has no lifetime dependencies.