See Deprecating SystemTable/BootServices/RuntimeServices for details of the deprecated items that were removed in this release.
PartialEq and Eq for GptPartitionEntry.CStr16::from_u16_until_nul and CStr16::from_char16_until_nul.BootServices, RuntimeServices, and SystemTable structs.allocator::init, allocator::exit_boot_services, helpers::system_table, table::system_table_boot, and table::system_table_runtime.FileSystem no longer has a lifetime parameter, and the deprecated conversion from uefi::table::boot::ScopedProtocol has been removed.boot::open_protocol to properly handle a null interface pointer.VariableKey now has a public name field. This name field always contains a valid string, so the VariableKey::name() method has been deprecated. Since all fields of VariableKey are now public, the type can be constructed by users.VariableKeys iterator will now yield an error item if a variable name is not UCS-2.See Deprecating SystemTable/BootServices/RuntimeServices for details of the deprecations in this release.
We added documentation to lib.rs and the uefi-rs book about how uefi compares to “standard Rust binaries” for UEFI (those using std), and how to integrate the uefi crate into them.
Handle::new.uefi::boot, uefi::runtime, and uefi::system modules to the prelude.runtime::variable_exists.BootServices, RuntimeServices, and SystemTable structs have been deprecated (as well as related types Boot, Runtime, and SystemTableView). Use the uefi::boot and uefi::runtime, and uefi::system modules instead.uefi::table::boot, ScopedProtocol, TplGuard, ProtocolsPerHandle, and HandleBuffer have been deprecated. Use the structs of the same name in uefi::boot instead.uefi::table::system_table_boot and uefi::table::system_table_runtime have been deprecated. Use the uefi::runtime and uefi::boot modules instead.BootServices argument. The global system table is used instead.GraphicsOutput::modes no longer takes a BootServices argument. The global system table is used instead.ComponentName::open no longer takes a BootServices argument. The global system table is used instead.allocator::init and allocator::exit_boot_services have been deprecated. These functions are now no-ops. The allocator now internally uses the global system table.FileSystem::new now accepts boot::ScopedProtocol in addition to table::boot::ScopedProtocol.See Deprecating SystemTable/BootServices/RuntimeServices for details of the new system/boot/runtime modules, and upcoming deprecations.
uefi::system is a new module that provides freestanding functions for accessing fields of the global system table.uefi::boot is a new module that provides freestanding functions for boot services using the global system table.uefi::runtime is a new module that provides freestanding functions for runtime services using the global system table.uefi::table::system_table_raw is a new function to retrieve a raw pointer to the global system table.ConfigTableEntry.PcrEvent/PcrEventInputs impl Align, Eq, and PartialEq.PcrEvent::new_in_box and PcrEventInputs::new_in_box.VariableKey impls Clone, Eq, PartialEq, Ord, PartialOrd, and Hash.MemoryMap and MemoryMapMut have been introduced together with the implementations MemoryMapRef, MemoryMapRefMut, and MemoryMapOwned. This comes with some changes. Read below. We recommend to directly use the implementations instead of the traits.LoadFile and LoadFile2 which abstracts over the LOAD_FILE and LOAD_FILE2 protocols. The UEFI test runner includes an integration test that shows how Linux loaders can use this to implement the initrd loading mechanism used in Linux.uefi::helpers::init no longer takes an argument.SearchType returned from BootServices::register_protocol_notify is now tied to the protocol GUID. The old MemoryMap was renamed to MemoryMapOwned.pub fn memory_map(&self, mt: MemoryType) -> Result<MemoryMap> now returns a MemoryMapOwned.PcrEvent::new_in_buffer and PcrEventInputs::new_in_buffer now take an initialized buffer ([u8] instead of [MaybeUninit<u8>]), and if the buffer is too small the required size is returned in the error data.MemoryMap was renamed to MemoryMapOwned. MemoryMap is now a trait. Read the documentation of the uefi > mem > memory_map module to learn more.uefi::table::boot are now removed. Use uefi::mem::memory_map instead. The patch you have to apply to the use statements of your code might look as follows:< use uefi::table::boot::{BootServices, MemoryMap, MemoryMapMut, MemoryType};
---
> use uefi::mem::memory_map::{MemoryMap, MemoryMapMut, MemoryType};
> use uefi::table::boot::BootServices;
BootPolicy type which breaks existing usages of LoadImageSource.TryFrom<&[u8]> for &DevicePathHeader, &DevicePathNode and &DevicePath that could lead to memory unsafety. See https://github.com/rust-osdev/uefi-rs/issues/1281.RuntimeServices::update_capsule.RuntimeServices::query_capsule_capabilities.uefi::helpers now also logs to the debugcon device (QEMU) respectively the debug-console (cloud-hypervisor). This only works on x86. It is activated by default (only on x86) and can be deactivated by removing the log-debugcon cargo feature. The major benefit is that one can get log messages even after one exited the boot services.table::{set_system_table, system_table_boot, system_table_runtime}. This provides an initial API for global tables that do not require passing around a reference.ResetNotification protocol.TryFrom<&[u8]> for DevicePathHeader, DevicePathNode and DevicePath.ByteConversionError.CapsuleFlags.TimeError what fields of Time are outside its valid range. Time::is_valid has been updated accordingly.MemoryMap::as_raw which provides raw access to the memory map. This is for example useful if you create your own Multiboot2 bootloader that embeds the EFI mmap in a Multiboot2 boot information structure.Mode is now Copy and Clone.TryFrom<&[u8]> for Time.SystemTable::exit_boot_services is now unsafe. See that method's documentation for details of obligations for callers.BootServices::allocate_pool now returns NonZero<u8> instead of *mut u8.helpers::system_table is deprecated, use table::system_table_boot instead.BootServices::memory_map changed its signature from pub fn memory_map<'buf>(&self, buffer: &'buf mut [u8]) -> Result<MemoryMap<'buf>> { pub fn memory_map(&self, mt: MemoryType) -> Result<MemoryMap>GraphicsOutput::query_mode is now private. Use GraphicsOutput::modes instead.panic-on-logger-errors feature of the uefi crate. Logger errors are now silently ignored.Timestamp protocol.UnalignedSlice::as_ptr.Event and Handle.uefi::helpers::init with the functionality that used to be in uefi::services. With that, new features were added:global_allocatorpanic_handlerqemuPartialEq<char> for Char8 and Char16.CStr16::from_char16_with_nul and Char16::from_char16_with_nul_unchecked.device_path::messaging::Vendor.MemoryMap::from_raw.Hash for all char and string types.DevicePath::to_string and DevicePathNode::to_string now return out-of-memory errors as part of the error type rather than with an Option.Index, IndexMut, get, and get_mut on MemoryMap.SystemTable::as_ptr.GraphicsOutput::query_mode. As a consequence, we had to add &BootServices as additional parameter.BootServices::free_pages and BootServices::free_pool are now unsafe to call, since it is possible to trigger UB by freeing memory that is still in use.Logger no longer requires exterior mutability. Logger::new is now const, takes no arguments, and creates the logger in a disabled state. Call Logger::set_output to enable it.uefi::allocator::init now takes a &mut SystemTable<Boot> instead of &BootServices.BootServices::{install,reinstall,uninstall}_protocol_interface now take const interface pointers.Input::wait_for_key_event now returns an Option<Event>, and is no longer const.Protocol::wait_for_input_event now returns an Option<Event>, and is no longer const.LoadedImage::device now returns an Option<Handle> and is no longer const.BootServices::get_image_file_system now returns ScopedProtocol<SimpleFileSystem> instead of fs::FileSystem.uefi::proto::shim is now available on 32-bit x86 targets.Parity and StopBits are now a newtype-enums instead of Rust enums. Their members now have upper-case names.FileSystem::try_exists now returns FileSystemResult<bool>.FileSystem::copy is now more efficient for large files.MpService::startup_all_aps and MpService::startup_this_ap now accept an optional event parameter to allow non-blocking operation.core::error::Error implementations to all error types.SystemTable::exit_boot_services now takes one param memory_type to ensure the memory type of memory map.ShellParams protocolBootServices::memmove and BootServices::set_mem have been removed, use standard functions like core::ptr::copy and core::ptr::write_bytes instead.DevicePath::to_boxed, DevicePath::to_owned, and DevicePath::as_bytesDevicePathInstance::to_boxed, DevicePathInstance::to_owned, and DevicePathInstance::as_bytesDevicePathNode::dataEvent::from_ptr, Event::as_ptr, and Handle::as_ptr.ScopedProtocol::get and ScopedProtocol::get_mut to access potentially-null interfaces without panicking.DevicePath::to_string and DevicePathNode::to_stringLoadImageSource::FromFilePath to LoadImageSource::FromDevicePathDeref and DerefMut impls for ScopedProtocol will now panic if the interface pointer is null.BootServices::install_configuration_table.BootServices::install_configuration_table.FileSystemIOErrorContext to IoErrorContext.ResetType is now a newtype-enum instead of a Rust enum. Its members now have upper-case names.PointerMode and PointerState now contain arrays rather than tuples, as tuples are not FFI safe.RegularFile::read no longer returns Option<usize> in error data. A BUFFER_TOO_SMALL error can only occur when reading a directory, not a file.RegularFile::read now reads in 1 MiB chunks to avoid a bug in some firmware. This fix also applies to fs::FileSystem::read.fs module that provides a high-level API for file-system access. The API is close to the std::fs module. The module also provides a Path and a PathBuf abstraction that is similar to the ones from std::path. However, they are adapted for UEFI.CString16 and CStr16, including:CStr16::as_slice()CStr16::num_chars()CStr16::is_empty()CString16::new()CString16::is_empty()CString16::num_chars()CString16::replace_char()CString16::push()CString16::push_str()From<&CStr16> for CString16From<&CStr16> for StringFrom<&CString16> for StringRuntimeServices::get_variable_boxed (requires the alloc feature).CStr16::as_bytesAsRef<[u8]> and Borrow<[u8]> for Cstr8 and CStr16.LoadedImageDevicePath protocol.FileAttribute::is_directory(&self) and FileAttribute::is_regular_file(&self)LoadedImage::code_type() and LoadedImage::data_type()Allocator will now use the memory type of the running UEFI binary:MemoryType::LOADER_DATA for UEFI applicationsMemoryType::BOOT_SERVICES_DATA for UEFI boot driversMemoryType::RUNTIME_SERVICES_DATA for UEFI runtime driversglobal_allocator module has been renamed to allocator, and is now available regardless of whether the global_allocator feature is enabled. The global_allocator feature now only controls whether allocator::Allocator is set as Rust's global allocator.Error::new and Error::from now panic if the status is SUCCESS.Image::get_image_file_system now returns a fs::FileSystem instead of the protocol.CString16::default now always contains a null character.Status to Result has been reworked. The into_with, into_with_val, and into_with_err methods have been removed from Status. impl From<Status> for Result has also been removed. A new StatusExt trait has been added that provides conversion methods to replace the ones that have been removed. StatusExt has been added to the prelude.Guid struct and guid! macro implementations have been replaced with re-exports from the uguid crate. The from_values method has been removed; usually the guid! macro is a more convenient choice, but new or from_bytes can also be used if needed. There are also a number of new Guid methods.MEMORY_DESCRIPTOR_VERSION constant has been moved to MemoryDescriptor::VERSION.Revision struct's one field is now public.CStr8::to_bytes to CStr8::as_bytes and changed the semantics: The trailing null character is now always included in the returned slice.DevicePathBuilder::with_vec now clears the Vec before use.bitflags bumped from 1.3 to 2.1GptPartitionAttributes now has 16 additional TYPE_SPECIFIC_BIT_<N> constants.As of this release, the UEFI crates work on the stable channel. This requires Rust 1.68 or higher.
ComponentName1 and ComponentName2 protocols. The ComponentName wrapper will automatically select ComponentName2 if available, and fall back to ComponentName1 otherwise.FileType, FileHandle, RegularFile, and Directory now implement Debug.RuntimeServices::delete_variable() helper method.Borrow for CString16 and ToOwned for CStr16.Debug. Exceptions are cases when there is no sensible way of presenting a useful Debug representation, such as for Unions.SystemTable::exit_boot_services now takes no parameters and handles the memory map allocation itself. Errors are now treated as unrecoverable and will cause the system to reset.cstr8, cstr16, and entry macros from the root of the uefi crate.HandleBuffer and ProtocolsPerHandle now implement Deref. The HandleBuffer::handles and ProtocolsPerHandle::protocols methods have been deprecated.'boot lifetime from the GraphicsOutput, Output, Pointer, and Serial protocols.Data of uefi::Error<Data: Debug> doesn't need to be Display to be compatible with core::error::Error. Note that the error Trait requires the unstable feature.BootServices::locate_protocol and BootServices::handle_protocol were removed. BootServices::open_protocol and BootServices::open_protocol_exclusive are better variants and available since EFI 1.10 (2002).ScopedProtocol::interface is not public anymore. Use the Deref trait.table::boot::PAGE_SIZE constant.DevicePath): BootServices::locate_device_path, BootServices::get_handle_for_protocol, BootServices::test_protocol, BootServices::find_handles, and SearchType::from_proto.uefi as a dependency: “the following packages contain code that will be rejected by a future version”.EqStrUntilNul now allow ?Sized inputs. This means that you can write some_cstr16.eq_str_until_nul("test") instead of some_cstr16.eq_str_until_nul(&"test") now.TryFrom<core::ffi::CStr> implementation for CStr8.Directory::read_entry_boxed which works similar to File::get_boxed_info. This allows easier iteration over the entries in a directory. (requires the alloc feature)Directory::read_entry_boxed_in and File::get_boxed_info_in that use the allocator_api feature. (requires the unstable and alloc features)core::error::Error implementation for Error to ease integration with error-handling crates. (requires the unstable feature)uefi::proto::tcg.UnalignedSlice now implements Clone, and the Debug impl now prints the elements instead of the internal fields.negative_impls feature is no longer required to use this library.BootServices::memory_map() now returns MemoryMapIter instead of impl Iterator which simplifies usage.BootServices::exit_boot_services() now returns MemoryMapIter instead of impl Iterator which simplifies usage.GraphicsOutput::modes() now returns ModesIter instead of impl Iterator which simplifies usage.ptr_metadata feature has been replaced with a dependency on the ptr_meta crate.pxe::DiscoverInfo is now a DST. Create with new_in_buffer by supplying a MaybeUninit<u8> slice of appropriate length.MemoryDescriptor structure was removed. Now all fields of this struct are public.PhysicalAddress and VirtualAddress type aliases.Guid::from_bytes and Guid::to_bytes.UnalignedSlice for representing a reference to an unaligned slice.DeviceSubType::MESSAGING_REST_SERVICE and DeviceSubType::MESSAGING_NVME_OF_NAMESPACE.MemoryAttribute::SPECIAL_PURPOSE, MemoryAttribute::CPU_CRYPTO, MemoryAttribute::ISA_VALID, and MemoryAttribute::ISA_MASK.UnicodeCollation protocolDevicePathBuilder for building new device paths.BootServices::install_protocol_interface, BootServices::uninstall_protocol_interface, and BootServices::reinstall_protocol_interface.BootServices::register_protocol_notify.SearchType::ByRegisterNotifyand ProtocolSearchKey.alloc to global_allocator.exts to alloc.AllocateType so that MaxAddress and Address always take a 64-bit value, regardless of target platform.DevicePathToText and DevicePathFromText now return a uefi::Result instead of an Option.Event is now a newtype around NonNull<c_void> instead of *mut c_void.SystemTable::firmware_revision to return a u32 instead of a Revision. The firmware revision's format is vendor specific and may not have the same semantics as the UEFI revision.Revision to repr(transparent).Revision::EFI_2_100 constant.Revision type now implements Display with correct formatting for all UEFI versions. The custom Debug impl has been removed and replaced with a derived Debug impl.CStr16::from_u16_with_nul_unchecked and cstr16! are now allowed in const contexts.UnalignedCStr16; use UnalignedSlice instead. An UnalignedSlice<u16> can be converted to a string with to_cstr16 or to_cstring16.as_file_path_media_device_path and as_hard_drive_media_device_path from DevicePathNode. Use DevicePathNode::as_enum instead. Alternatively, convert with TryInto, e.g. let node: &proto::device_path::media::HardDrive = node.try_into()?.AcpiDevicePath and HardDriveMediaDevicePath. Use proto::device_path::acpi::Acpi and proto::device_path::media::HardDrive instead. `Deref and DerefMut trait implementations to ScopedProtocol. This eliminates the need to explicitly access the interface field, which is now marked as deprecated.core::fmt::Write for the Serial protocol.MemoryProtection protocol.BootServices::get_handle_for_protocol.EqStrUntilNul and implemented it for CStr8, CStr16, and CString16 (CString8 doesn't exist yet). Now you can compare everything that is AsRef<str> (such as String and str from the standard library) to UEFI strings. Please head to the documentation of EqStrUntilNul to find out limitations and further information.BootServices::image_handle to get the handle of the executing image. The image is set automatically by the #[entry] macro; if a program does not use that macro then it should call BootServices::set_image_handle.BootServices::open_protocol_exclusive. This provides a safe and convenient subset of open_protocol that can be used whenever a resource doesn't need to be shared. In same cases sharing is useful (e.g. you might want to draw to the screen using the graphics protocol, but still allow stdout output to go to the screen as well), and in those cases open_protocol can still be used.DiskIo and DiskIo2 protocols.HardDriveMediaDevicePath and related types.PartialOrd and Ord to the traits derived by Guid.File trait now knows the methods is_regular_file and is_directory. Developers profit from this on the struct FileHandle, for example.BootServices::handle_protocol as unsafe. (This method is also deprecated -- use open_protocol_exclusive or open_protocol instead.)BootServices::locate_protocol and marked it unsafe. Use BootServices::get_handle_for_protocol and BootServices::open_protocol_exclusive (or BootServices::open_protocol) instead.ignore-logger-errors to panic-on-logger-errors so that it is additive. It is now a default feature.BlockIOMedia::is_media_preset to is_media_present.exts::allocate_buffer function. This function could cause undefined behavior when called with a Layout with an alignment other than 1. A safe alternative is to use Vec::into_boxed_slice.From conversions from ucs2::Error to Status and Error.try_trait_v2 feature, which allowed ? to be used with Status in a function returning uefi::Result. This can be replaced by calling status.into(), or Result::from(status) in cases where the compiler needs a type hint.Revision.Header struct's Debug impl now prints the correct signature.BootServices::create_event_ex and RuntimeServices::query_variable_info methods now check the table version to make sure it's 2.0 or higher before calling the associated function pointers. This prevents potential invalid pointer access.Rng protocol that could cause undefined behavior.bitflags and log dependencies to allow earlier patch versions.doc_auto_cfg on docs.rs to show badges on items that are gated behind a feature.FileHandle::into_directory and FileHandle::into_regular_file.TimeParams, Time::invalid, and Time::is_invalid.RuntimeServices::query_variable_info and VariableStorageInfo.DevicePathToText and DevicePathFromText.LoadedImage::file_pathTryFrom<Vec<u16>> for CString16.UnalignedCStr16.FilePathMediaDevicePath.DevicePath::as_acpi_device_path and DevicePath::as_file_path_media_device_path.cstr8 and cstr16 macros from uefi-macros in the prelude.DevicePathInstance, DevicePathNode, and FfiDevicePath.Time::new now takes a single TimeParams argument so that date and time fields can be explicitly named at the call site.PartialEq and Eq.FileAttributes type is now repr(transparent).DevicePath is now a DST that represents an entire device path. The DevicePathInstance and DevicePathNode provide views of path instances and nodes, respectively.Revision are now const.proto::media::file::File::get_boxed_info.PartialEq impls for CStr16 == CStr16, &CStr16 == CString, and CString == &CStr16.Display impl for CString16.Handle::from_ptr and SystemTable<View>::from_ptr, which are unsafe methods for initializing from a raw pointer.CStr16::as_slice_with_nul to provide immutable access to the underlying slice.LoadedImage::load_options_as_bytes and LoadedImage::load_options_as_cstr16.Align::offset_up_to_alignment, Align::round_up_to_alignment, and Align::align_buf.BootServices::connect_controller and BootServices::disconnect_controller.BootServices::load_image and LoadImageSource. Together these replace BootServices::load_image_from_buffer and also allow an image to be loaded via the SimpleFileSystem protocol.Rng protocol.GptPartitionAttributes struct and associated constants.Output::output_string_lossy.ResultExt::handle_warning.File::open now takes the filename as &CStr16 instead of &str, avoiding an implicit string conversion.FileInfo::new, FileSystemInfo::new, and FileSystemVolumeLabel::new now take their name parameter as &CStr16 instead of &str, avoiding an implicit string conversion. Additionally, an unaligned storage buffer is now allowed as long as it is big enough to provide an aligned subslice.LoadImage::set_load_options now takes a u8 pointer instead of Char16.Error type is now public.GptPartitionEntry.attributes is now GptPartitionAttributes.uefi::Result type now treats UEFI warnings as errors by default. The uefi::Result::Ok variant no longer contains a Completion, so the type behaves more like a regular Rust Result type.CStr16::as_string method. Use ToString instead.FileInfoCreationError::InvalidChar. This error type is no longer needed due to the removal of implicit string conversions in file info types.LoadedImage::load_options, use LoadedImage::load_options_as_bytes or LoadedImage::load_options_as_cstr16 instead.NamedFileProtocolInfo, FileInfoHeader, FileSystemInfoHeader, and FileSystemVolumeLabelHeader. Use FileInfo, FileSystemInfo, and FileSystemVolumeLabel instead.BootServices::load_image_from_buffer. Use BootServices::load_image instead.Completion type. Warnings are now treated as errors.ResultExt methods, for most of them the standard Result methods can be used instead. Use unwrap instead of unwrap_success, expect instead of expect_success, expect_err instead of expect_error, and map instead of map_inner. The log_warning method has also been removed, use the new ResultExt::handle_warning method instead.vec_spare_capacity feature, which has been stabilized.FileInfo::new and FileSystemInfo::new.FileSystemInfo. This caused the beginning of the string to be truncated and could result in out-of-bounds reads.