1# uefi - [Unreleased] 2 3 4# uefi - 0.33.0 (2024-10-23) 5 6See [Deprecating SystemTable/BootServices/RuntimeServices][funcmigrate] for 7details of the deprecated items that were removed in this release. 8 9## Added 10- Impl `PartialEq` and `Eq` for `GptPartitionEntry`. 11- Added `CStr16::from_u16_until_nul` and `CStr16::from_char16_until_nul`. 12 13## Changed 14- **Breaking:** Deleted the deprecated `BootServices`, `RuntimeServices`, and 15 `SystemTable` structs. 16- **Breaking:** Deleted deprecated functions `allocator::init`, 17 `allocator::exit_boot_services`, `helpers::system_table`, 18 `table::system_table_boot`, and `table::system_table_runtime`. 19- **Breaking:** `FileSystem` no longer has a lifetime parameter, and the 20 deprecated conversion from `uefi::table::boot::ScopedProtocol` has been 21 removed. 22- Fixed `boot::open_protocol` to properly handle a null interface pointer. 23- `VariableKey` now has a public `name` field. This `name` field always contains 24 a valid string, so the `VariableKey::name()` method has been deprecated. Since 25 all fields of `VariableKey` are now public, the type can be constructed by 26 users. 27- The `VariableKeys` iterator will now yield an error item if a variable name is 28 not UCS-2. 29 30 31# uefi - 0.32.0 (2024-09-09) 32 33See [Deprecating SystemTable/BootServices/RuntimeServices][funcmigrate] for 34details of the deprecations in this release. 35 36We added documentation to `lib.rs` and the [uefi-rs book] about how 37`uefi` compares to "standard Rust binaries" for UEFI (those using `std`), and 38how to integrate the `uefi` crate into them. 39 40## Added 41- Added `Handle::new`. 42- Added the `uefi::boot`, `uefi::runtime`, and `uefi::system` modules to the 43 prelude. 44- Added `runtime::variable_exists`. 45 46## Changed 47- The `BootServices`, `RuntimeServices`, and `SystemTable` structs have been 48 deprecated (as well as related types `Boot`, `Runtime`, and 49 `SystemTableView`). Use the `uefi::boot` and `uefi::runtime`, and 50 `uefi::system` modules instead. 51- In `uefi::table::boot`, `ScopedProtocol`, `TplGuard`, `ProtocolsPerHandle`, 52 and `HandleBuffer` have been deprecated. Use the structs of the same name in 53 `uefi::boot` instead. 54- `uefi::table::system_table_boot` and `uefi::table::system_table_runtime` have 55 been deprecated. Use the `uefi::runtime` and `uefi::boot` modules instead. 56- **Breaking:** The conversion functions between device paths and text no longer 57 take a `BootServices` argument. The global system table is used instead. 58- **Breaking:** `GraphicsOutput::modes` no longer takes a `BootServices` 59 argument. The global system table is used instead. 60- **Breaking:** `ComponentName::open` no longer takes a `BootServices` 61 argument. The global system table is used instead. 62- `allocator::init` and `allocator::exit_boot_services` have been 63 deprecated. These functions are now no-ops. The allocator now internally uses 64 the global system table. 65- `FileSystem::new` now accepts `boot::ScopedProtocol` in addition to 66 `table::boot::ScopedProtocol`. 67 68 69# uefi - 0.31.0 (2024-08-21) 70 71See [Deprecating SystemTable/BootServices/RuntimeServices][funcmigrate] for 72details of the new `system`/`boot`/`runtime` modules, and upcoming deprecations. 73 74## Added 75- `uefi::system` is a new module that provides freestanding functions for 76 accessing fields of the global system table. 77- `uefi::boot` is a new module that provides freestanding functions for 78 boot services using the global system table. 79- `uefi::runtime` is a new module that provides freestanding functions for 80 runtime services using the global system table. 81- `uefi::table::system_table_raw` is a new function to retrieve a raw pointer to 82 the global system table. 83- Add standard derives for `ConfigTableEntry`. 84- `PcrEvent`/`PcrEventInputs` impl `Align`, `Eq`, and `PartialEq`. 85- Added `PcrEvent::new_in_box` and `PcrEventInputs::new_in_box`. 86- `VariableKey` impls `Clone`, `Eq`, `PartialEq`, `Ord`, `PartialOrd`, and `Hash`. 87- The traits `MemoryMap` and `MemoryMapMut` have been introduced together with 88 the implementations `MemoryMapRef`, `MemoryMapRefMut`, and `MemoryMapOwned`. 89 This comes with some changes. Read below. We recommend to directly use the 90 implementations instead of the traits. 91- Added `LoadFile` and `LoadFile2` which abstracts over the `LOAD_FILE` and 92 `LOAD_FILE2` protocols. The UEFI test runner includes an integration test 93 that shows how Linux loaders can use this to implement the initrd loading 94 mechanism used in Linux. 95 96## Changed 97- **Breaking:** `uefi::helpers::init` no longer takes an argument. 98- The lifetime of the `SearchType` returned from 99 `BootServices::register_protocol_notify` is now tied to the protocol GUID. 100 The old `MemoryMap` was renamed to `MemoryMapOwned`. 101 - `pub fn memory_map(&self, mt: MemoryType) -> Result<MemoryMap>` now returns 102 a `MemoryMapOwned`. 103- **Breaking:** `PcrEvent::new_in_buffer` and `PcrEventInputs::new_in_buffer` 104 now take an initialized buffer (`[u8`] instead of `[MaybeUninit<u8>]`), and if 105 the buffer is too small the required size is returned in the error data. 106- **Breaking:** The type `MemoryMap` was renamed to `MemoryMapOwned`. `MemoryMap` 107 is now a trait. Read the [documentation](https://docs.rs/uefi/latest/uefi/) of the 108 `uefi > mem > memory_map` module to learn more. 109- **Breaking:** Exports of Memory Map-related types from `uefi::table::boot` are 110 now removed. Use `uefi::mem::memory_map` instead. The patch you have to apply 111 to the `use` statements of your code might look as follows: 112 ```diff 113 < use uefi::table::boot::{BootServices, MemoryMap, MemoryMapMut, MemoryType}; 114 --- 115 > use uefi::mem::memory_map::{MemoryMap, MemoryMapMut, MemoryType}; 116 > use uefi::table::boot::BootServices; 117 ``` 118- **Breaking:** Added a new `BootPolicy` type which breaks existing usages 119 of `LoadImageSource`. 120 121[funcmigrate]: ../docs/funcs_migration.md 122 123# uefi - 0.30.0 (2024-08-02) 124 125## Changed 126- **Breaking:**: Fixed a bug in the impls of `TryFrom<&[u8]>` for 127 `&DevicePathHeader`, `&DevicePathNode` and `&DevicePath` that could lead to 128 memory unsafety. See <https://github.com/rust-osdev/uefi-rs/issues/1281>. 129 130 131# uefi - 0.29.0 (2024-07-02) 132 133## Added 134- Added `RuntimeServices::update_capsule`. 135- Added `RuntimeServices::query_capsule_capabilities`. 136- The logger from `uefi::helpers` now also logs to the [debugcon](https://phip1611.de/blog/how-to-use-qemus-debugcon-feature/) 137 device (QEMU) respectively the debug-console (cloud-hypervisor). This only 138 works on x86. It is activated by default (only on x86) and can be deactivated 139 by removing the `log-debugcon` cargo feature. The major benefit is that one 140 can get log messages even after one exited the boot services. 141- Added `table::{set_system_table, system_table_boot, system_table_runtime}`. 142 This provides an initial API for global tables that do not require passing 143 around a reference. 144- Added `ResetNotification` protocol. 145- Added `TryFrom<&[u8]>` for `DevicePathHeader`, `DevicePathNode` and `DevicePath`. 146- Added `ByteConversionError`. 147- Re-exported `CapsuleFlags`. 148- One can now specify in `TimeError` what fields of `Time` are outside its valid 149 range. `Time::is_valid` has been updated accordingly. 150- `MemoryMap::as_raw` which provides raw access to the memory map. This is for 151 example useful if you create your own Multiboot2 bootloader that embeds the 152 EFI mmap in a Multiboot2 boot information structure. 153- `Mode` is now `Copy` and `Clone`. 154- Added `TryFrom<&[u8]>` for `Time`. 155 156## Changed 157- `SystemTable::exit_boot_services` is now `unsafe`. See that method's 158 documentation for details of obligations for callers. 159- `BootServices::allocate_pool` now returns `NonZero<u8>` instead of 160 `*mut u8`. 161- `helpers::system_table` is deprecated, use `table::system_table_boot` instead. 162- `BootServices::memory_map` changed its signature from \ 163 `pub fn memory_map<'buf>(&self, buffer: &'buf mut [u8]) -> Result<MemoryMap<'buf>> {` \ 164 to \ 165 `pub fn memory_map(&self, mt: MemoryType) -> Result<MemoryMap>` 166 - Allocations now happen automatically internally on the UEFI heap. Also, the 167 returned type is automatically freed on the UEFI heap, as long as boot 168 services are not excited. By removing the need for that explicit buffer and 169 the lifetime, the API is simpler. 170- `GraphicsOutput::query_mode` is now private. Use `GraphicsOutput::modes` 171 instead. 172 173## Removed 174- Removed the `panic-on-logger-errors` feature of the `uefi` crate. Logger 175 errors are now silently ignored. 176 177 178# uefi - 0.28.0 (2024-04-19) 179 180## Added 181- Added `Timestamp` protocol. 182- Added `UnalignedSlice::as_ptr`. 183- Added common derives for `Event` and `Handle`. 184- `uefi::helpers::init` with the functionality that used to be in 185`uefi::services`. With that, new features were added: 186- `global_allocator` 187- `panic_handler` 188- `qemu` 189 190 191# uefi - 0.27.0 (2024-03-17) 192 193## Added 194- Implemented `PartialEq<char>` for `Char8` and `Char16`. 195- Added `CStr16::from_char16_with_nul` and `Char16::from_char16_with_nul_unchecked`. 196- Added terminal GUID constants to `device_path::messaging::Vendor`. 197- Added `MemoryMap::from_raw`. 198- Implemented `Hash` for all char and string types. 199 200## Changed 201- `DevicePath::to_string` and `DevicePathNode::to_string` now return 202 out-of-memory errors as part of the error type rather than with an `Option`. 203 204 205# uefi - 0.26.0 (2023-11-12) 206 207## Added 208- Implemented `Index`, `IndexMut`, `get`, and `get_mut` on `MemoryMap`. 209- Added `SystemTable::as_ptr`. 210 211## Changed 212- We fixed a memory leak in `GraphicsOutput::query_mode`. As a consequence, we 213 had to add `&BootServices` as additional parameter. 214- `BootServices::free_pages` and `BootServices::free_pool` are now `unsafe` to 215 call, since it is possible to trigger UB by freeing memory that is still in use. 216- `Logger` no longer requires exterior mutability. `Logger::new` is now `const`, 217 takes no arguments, and creates the logger in a disabled state. Call 218 `Logger::set_output` to enable it. 219- `uefi::allocator::init` now takes a `&mut SystemTable<Boot>` instead of 220 `&BootServices`. 221- `BootServices::{install,reinstall,uninstall}_protocol_interface` now take 222 `const` interface pointers. 223 224 225# uefi - 0.25.0 (2023-10-10) 226 227## Changed 228- MSRV bumped to 1.70. 229- `Input::wait_for_key_event` now returns an `Option<Event>`, and is no longer `const`. 230- `Protocol::wait_for_input_event` now returns an `Option<Event>`, and is no longer `const`. 231- `LoadedImage::device` now returns an `Option<Handle>` and is no longer `const`. 232- `BootServices::get_image_file_system` now returns 233 `ScopedProtocol<SimpleFileSystem>` instead of `fs::FileSystem`. 234- `uefi::proto::shim` is now available on 32-bit x86 targets. 235- `Parity` and `StopBits` are now a newtype-enums instead of Rust enums. Their 236 members now have upper-case names. 237- `FileSystem::try_exists` now returns `FileSystemResult<bool>`. 238- `FileSystem::copy` is now more efficient for large files. 239- `MpService::startup_all_aps` and `MpService::startup_this_ap` now accept an 240 optional `event` parameter to allow non-blocking operation. 241- Added `core::error::Error` implementations to all error types. 242- `SystemTable::exit_boot_services` now takes one param `memory_type` to ensure 243 the memory type of memory map. 244- Added the `ShellParams` protocol 245 246## Removed 247- `BootServices::memmove` and `BootServices::set_mem` have been removed, use 248 standard functions like `core::ptr::copy` and `core::ptr::write_bytes` instead. 249 250 251# uefi - 0.24.0 (2023-06-20) 252 253## Added 254- `DevicePath::to_boxed`, `DevicePath::to_owned`, and `DevicePath::as_bytes` 255- `DevicePathInstance::to_boxed`, `DevicePathInstance::to_owned`, and `DevicePathInstance::as_bytes` 256- `DevicePathNode::data` 257- Added `Event::from_ptr`, `Event::as_ptr`, and `Handle::as_ptr`. 258- Added `ScopedProtocol::get` and `ScopedProtocol::get_mut` to access 259 potentially-null interfaces without panicking. 260- `DevicePath::to_string` and `DevicePathNode::to_string` 261 262## Changed 263- Renamed `LoadImageSource::FromFilePath` to `LoadImageSource::FromDevicePath` 264- The `Deref` and `DerefMut` impls for `ScopedProtocol` will now panic if the 265 interface pointer is null. 266 267 268# uefi - 0.23.0 (2023-06-04) 269 270## Changed 271- Fixed function signature bug in `BootServices::install_configuration_table`. 272 273 274# uefi - 0.22.0 (2023-06-01) 275 276## Added 277- Added `BootServices::install_configuration_table`. 278 279## Changed 280- Renamed `FileSystemIOErrorContext` to `IoErrorContext`. 281- `ResetType` is now a newtype-enum instead of a Rust enum. Its members now have 282 upper-case names. 283- `PointerMode` and `PointerState` now contain arrays rather than tuples, as 284 tuples are not FFI safe. 285- `RegularFile::read` no longer returns `Option<usize>` in error data. A 286 `BUFFER_TOO_SMALL` error can only occur when reading a directory, not a file. 287- `RegularFile::read` now reads in 1 MiB chunks to avoid a bug in some 288 firmware. This fix also applies to `fs::FileSystem::read`. 289 290 291# uefi - 0.21.0 (2023-05-15) 292 293## Added 294- There is a new `fs` module that provides a high-level API for file-system 295 access. The API is close to the `std::fs` module. The module also provides a 296 `Path` and a `PathBuf` abstraction that is similar to the ones from 297 `std::path`. However, they are adapted for UEFI. 298- Multiple convenience methods for `CString16` and `CStr16`, including: 299 - `CStr16::as_slice()` 300 - `CStr16::num_chars()` 301 - `CStr16::is_empty()` 302 - `CString16::new()` 303 - `CString16::is_empty()` 304 - `CString16::num_chars()` 305 - `CString16::replace_char()` 306 - `CString16::push()` 307 - `CString16::push_str()` 308 - `From<&CStr16>` for `CString16` 309 - `From<&CStr16>` for `String` 310 - `From<&CString16>` for `String` 311- Added `RuntimeServices::get_variable_boxed` (requires the `alloc` feature). 312- Added `CStr16::as_bytes` 313- Added `AsRef<[u8]>` and `Borrow<[u8]>` for `Cstr8` and `CStr16`. 314- Added `LoadedImageDevicePath` protocol. 315- Added `FileAttribute::is_directory(&self)` and 316 `FileAttribute::is_regular_file(&self)` 317- Added `LoadedImage::code_type()` and `LoadedImage::data_type()` 318- `Allocator` will now use the memory type of the running UEFI binary: 319 - `MemoryType::LOADER_DATA` for UEFI applications 320 - `MemoryType::BOOT_SERVICES_DATA` for UEFI boot drivers 321 - `MemoryType::RUNTIME_SERVICES_DATA` for UEFI runtime drivers 322 323## Changed 324- The `global_allocator` module has been renamed to `allocator`, and is now 325 available regardless of whether the `global_allocator` feature is enabled. The 326 `global_allocator` feature now only controls whether `allocator::Allocator` is 327 set as Rust's global allocator. 328- `Error::new` and `Error::from` now panic if the status is `SUCCESS`. 329- `Image::get_image_file_system` now returns a `fs::FileSystem` instead of the 330 protocol. 331- `CString16::default` now always contains a null character. 332- Conversion from `Status` to `Result` has been reworked. The `into_with`, 333 `into_with_val`, and `into_with_err` methods have been removed from 334 `Status`. `impl From<Status> for Result` has also been removed. A new 335 `StatusExt` trait has been added that provides conversion methods to replace 336 the ones that have been removed. `StatusExt` has been added to the prelude. 337- The `Guid` struct and `guid!` macro implementations have been replaced with 338 re-exports from the [`uguid`](https://docs.rs/uguid) crate. The `from_values` 339 method has been removed; usually the `guid!` macro is a more convenient 340 choice, but `new` or `from_bytes` can also be used if needed. There are also a 341 number of new `Guid` methods. 342- The `MEMORY_DESCRIPTOR_VERSION` constant has been moved to 343 `MemoryDescriptor::VERSION`. 344- The `Revision` struct's one field is now public. 345- Renamed `CStr8::to_bytes` to `CStr8::as_bytes` and changed the semantics: 346 The trailing null character is now always included in the returned slice. 347- `DevicePathBuilder::with_vec` now clears the `Vec` before use. 348- `bitflags` bumped from `1.3` to `2.1` 349 - `GptPartitionAttributes` now has 16 additional `TYPE_SPECIFIC_BIT_<N>` 350 constants. 351 352 353# uefi - 0.20.0 (2023-03-19) 354 355As of this release, the UEFI crates work on the stable channel. This requires 356Rust 1.68 or higher. 357 358## Added 359- Added the `ComponentName1` and `ComponentName2` protocols. The `ComponentName` 360 wrapper will automatically select `ComponentName2` if available, and fall back 361 to `ComponentName1` otherwise. 362- `FileType`, `FileHandle`, `RegularFile`, and `Directory` now implement `Debug`. 363- Added `RuntimeServices::delete_variable()` helper method. 364- Implement `Borrow` for `CString16` and `ToOwned` for `CStr16`. 365- Every public struct now implements `Debug`. Exceptions are cases when there 366 is no sensible way of presenting a useful Debug representation, such as for 367 Unions. 368 369## Changed 370- `SystemTable::exit_boot_services` now takes no parameters and handles 371 the memory map allocation itself. Errors are now treated as 372 unrecoverable and will cause the system to reset. 373- Re-export the `cstr8`, `cstr16`, and `entry` macros from the root of the 374 `uefi` crate. 375- `HandleBuffer` and `ProtocolsPerHandle` now implement `Deref`. The 376 `HandleBuffer::handles` and `ProtocolsPerHandle::protocols` methods have been 377 deprecated. 378- Removed `'boot` lifetime from the `GraphicsOutput`, `Output`, `Pointer`, and 379 `Serial` protocols. 380- The generic type `Data` of `uefi::Error<Data: Debug>` doesn't need to be 381 `Display` to be compatible with `core::error::Error`. Note that the error 382 Trait requires the `unstable` feature. 383- deprecation removals: 384 - interfaces `BootServices::locate_protocol` and 385 `BootServices::handle_protocol` were removed. `BootServices::open_protocol` 386 and `BootServices::open_protocol_exclusive` are better variants and 387 available since EFI 1.10 (2002). 388 - `ScopedProtocol::interface` is not public anymore. Use the `Deref` trait. 389 390 391# uefi - 0.19.1 (2023-02-04) 392 393## Added 394- Added `table::boot::PAGE_SIZE` constant. 395 396## Changed 397- Fixed several protocol functions so that they work with unsized protocols 398 (like `DevicePath`): `BootServices::locate_device_path`, 399 `BootServices::get_handle_for_protocol`, `BootServices::test_protocol`, 400 `BootServices::find_handles`, and `SearchType::from_proto`. 401- Fixed a warning printed when using `uefi` as a dependency: "the following 402 packages contain code that will be rejected by a future version". 403 404 405# uefi - 0.19.0 (2023-01-16) 406 407## Added 408- Implementations for the trait `EqStrUntilNul` now allow `?Sized` inputs. This means that 409 you can write `some_cstr16.eq_str_until_nul("test")` instead of 410 `some_cstr16.eq_str_until_nul(&"test")` now. 411- Added `TryFrom<core::ffi::CStr>` implementation for `CStr8`. 412- Added `Directory::read_entry_boxed` which works similar to `File::get_boxed_info`. This allows 413 easier iteration over the entries in a directory. (requires the **alloc** feature) 414- Added `Directory::read_entry_boxed_in` and `File::get_boxed_info_in` that use the `allocator_api` 415 feature. (requires the **unstable** and **alloc** features) 416- Added an `core::error::Error` implementation for `Error` to ease 417 integration with error-handling crates. (requires the **unstable** feature) 418- Added partial support for the TCG protocols for TPM devices under `uefi::proto::tcg`. 419 420## Changed 421- `UnalignedSlice` now implements `Clone`, and the `Debug` impl now 422 prints the elements instead of the internal fields. 423- The unstable `negative_impls` feature is no longer required to use this library. 424- `BootServices::memory_map()` now returns `MemoryMapIter` instead of 425 `impl Iterator` which simplifies usage. 426- `BootServices::exit_boot_services()` now returns `MemoryMapIter` instead of 427 `impl Iterator` which simplifies usage. 428- `GraphicsOutput::modes()` now returns `ModesIter` instead of `impl Iterator` 429 which simplifies usage. 430- Use of the unstable `ptr_metadata` feature has been replaced with a dependency 431 on the [`ptr_meta`](https://docs.rs/ptr_meta) crate. 432- `pxe::DiscoverInfo` is now a DST. Create with `new_in_buffer` by supplying a 433 `MaybeUninit<u8>` slice of appropriate length. 434- Redundant private field used for padding in `MemoryDescriptor` structure was removed. Now all 435 fields of this struct are public. 436 437 438# uefi - 0.18.0 (2022-11-15) 439 440## Added 441- Added `PhysicalAddress` and `VirtualAddress` type aliases. 442- Added `Guid::from_bytes` and `Guid::to_bytes`. 443- Added `UnalignedSlice` for representing a reference to an unaligned 444 slice. 445- Added `DeviceSubType::MESSAGING_REST_SERVICE` and 446 `DeviceSubType::MESSAGING_NVME_OF_NAMESPACE`. 447- Added `MemoryAttribute::SPECIAL_PURPOSE`, `MemoryAttribute::CPU_CRYPTO`, 448 `MemoryAttribute::ISA_VALID`, and `MemoryAttribute::ISA_MASK`. 449- Added the `UnicodeCollation` protocol 450- Added structs to represent each type of device path node. All node 451 types specified in the UEFI 2.10 Specification are now supported. 452- Added `DevicePathBuilder` for building new device paths. 453- Added `BootServices::install_protocol_interface`, 454 `BootServices::uninstall_protocol_interface`, and 455 `BootServices::reinstall_protocol_interface`. 456- Added `BootServices::register_protocol_notify`. 457- Added `SearchType::ByRegisterNotify`and `ProtocolSearchKey`. 458 459## Changed 460- Renamed crate feature `alloc` to `global_allocator`. 461- Renamed crate feature `exts` to `alloc`. 462- Fixed the definition of `AllocateType` so that `MaxAddress` and 463 `Address` always take a 64-bit value, regardless of target platform. 464- The conversion methods on `DevicePathToText` and `DevicePathFromText` 465 now return a `uefi::Result` instead of an `Option`. 466- `Event` is now a newtype around `NonNull<c_void>` instead of `*mut c_void`. 467- Changed `SystemTable::firmware_revision` to return a `u32` instead of 468 a `Revision`. The firmware revision's format is vendor specific and 469 may not have the same semantics as the UEFI revision. 470- Changed `Revision` to `repr(transparent)`. 471- Add `Revision::EFI_2_100` constant. 472- The `Revision` type now implements `Display` with correct formatting 473 for all UEFI versions. The custom `Debug` impl has been removed and 474 replaced with a derived `Debug` impl. 475- `CStr16::from_u16_with_nul_unchecked` and `cstr16!` are now allowed in 476 `const` contexts. 477 478## Removed 479- Removed `UnalignedCStr16`; use `UnalignedSlice` instead. An 480 `UnalignedSlice<u16>` can be converted to a string with `to_cstr16` or 481 `to_cstring16`. 482- Removed `as_file_path_media_device_path` and 483 `as_hard_drive_media_device_path` from `DevicePathNode`. Use 484 `DevicePathNode::as_enum` instead. Alternatively, convert with `TryInto`, 485 e.g. `let node: &proto::device_path::media::HardDrive = node.try_into()?`. 486- Removed `AcpiDevicePath` and `HardDriveMediaDevicePath`. Use 487 `proto::device_path::acpi::Acpi` and 488 `proto::device_path::media::HardDrive` instead. ` 489 490 491# uefi - 0.17.0 (2022-09-09) 492 493## Added 494- Added `Deref` and `DerefMut` trait implementations to `ScopedProtocol`. 495 This eliminates the need to explicitly access the `interface` field, 496 which is now marked as deprecated. 497- Implemented `core::fmt::Write` for the `Serial` protocol. 498- Added the `MemoryProtection` protocol. 499- Added `BootServices::get_handle_for_protocol`. 500- Added trait `EqStrUntilNul` and implemented it for `CStr8`, `CStr16`, and `CString16` 501 (CString8 doesn't exist yet). Now you can compare everything that is `AsRef<str>` 502 (such as `String` and `str` from the standard library) to UEFI strings. Please head to the 503 documentation of `EqStrUntilNul` to find out limitations and further information. 504- Added `BootServices::image_handle` to get the handle of the executing 505 image. The image is set automatically by the `#[entry]` macro; if a 506 program does not use that macro then it should call 507 `BootServices::set_image_handle`. 508- Added `BootServices::open_protocol_exclusive`. This provides a safe 509 and convenient subset of `open_protocol` that can be used whenever a 510 resource doesn't need to be shared. In same cases sharing is useful 511 (e.g. you might want to draw to the screen using the graphics 512 protocol, but still allow stdout output to go to the screen as 513 well), and in those cases `open_protocol` can still be used. 514- Added `DiskIo` and `DiskIo2` protocols. 515- Added `HardDriveMediaDevicePath` and related types. 516- Added `PartialOrd` and `Ord` to the traits derived by `Guid`. 517- The `File` trait now knows the methods `is_regular_file` and `is_directory`. 518 Developers profit from this on the struct `FileHandle`, for example. 519 520## Changed 521- Marked `BootServices::handle_protocol` as `unsafe`. (This method is 522 also deprecated -- use `open_protocol_exclusive` or `open_protocol` instead.) 523- Deprecated `BootServices::locate_protocol` and marked it `unsafe`. Use 524 `BootServices::get_handle_for_protocol` and 525 `BootServices::open_protocol_exclusive` (or 526 `BootServices::open_protocol`) instead. 527- Renamed feature `ignore-logger-errors` to `panic-on-logger-errors` so that it is 528 additive. It is now a default feature. 529- Corrected the name of `BlockIOMedia::is_media_preset` to `is_media_present`. 530 531## Removed 532- Removed the `exts::allocate_buffer` function. This function could 533 cause undefined behavior when called with a `Layout` with an alignment 534 other than 1. A safe alternative is to use 535 [`Vec::into_boxed_slice`](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.into_boxed_slice). 536- Removed `From` conversions from `ucs2::Error` to `Status` and `Error`. 537- Removed use of the unstable `try_trait_v2` feature, which allowed `?` 538 to be used with `Status` in a function returning `uefi::Result`. This 539 can be replaced by calling `status.into()`, or `Result::from(status)` 540 in cases where the compiler needs a type hint. 541 542 543# uefi - 0.16.1 544 545## Added 546- Added EFI revision constants to `Revision`. 547 548## Fixed 549- The table `Header` struct's `Debug` impl now prints the correct signature. 550- The `BootServices::create_event_ex` and 551 `RuntimeServices::query_variable_info` methods now check the table 552 version to make sure it's 2.0 or higher before calling the associated 553 function pointers. This prevents potential invalid pointer access. 554- Fixed an incorrect pointer cast in the `Rng` protocol that could cause 555 undefined behavior. 556 557## Changed 558- Relaxed the version requirements for the `bitflags` and `log` 559 dependencies to allow earlier patch versions. 560- Enabled `doc_auto_cfg` on docs.rs to show badges on items that are 561 gated behind a feature. 562 563 564# uefi - 0.16.0 (2022-05-16) 565 566## Added 567- Added `FileHandle::into_directory` and `FileHandle::into_regular_file`. 568- Added `TimeParams`, `Time::invalid`, and `Time::is_invalid`. 569- Added `RuntimeServices::query_variable_info` and `VariableStorageInfo`. 570- Added `DevicePathToText` and `DevicePathFromText`. 571- Added `LoadedImage::file_path` 572- Implemented `TryFrom<Vec<u16>> for CString16`. 573- Added `UnalignedCStr16`. 574- Added `FilePathMediaDevicePath`. 575- Added `DevicePath::as_acpi_device_path` and 576 `DevicePath::as_file_path_media_device_path`. 577- Included `cstr8` and `cstr16` macros from `uefi-macros` in the prelude. 578- Added `DevicePathInstance`, `DevicePathNode`, and `FfiDevicePath`. 579 580## Changed 581- `Time::new` now takes a single `TimeParams` argument so that date and 582 time fields can be explicitly named at the call site. 583- The file info types now derive `PartialEq` and `Eq`. 584- The `FileAttributes` type is now `repr(transparent)`. 585- `DevicePath` is now a DST that represents an entire device path. The 586 `DevicePathInstance` and `DevicePathNode` provide views of path 587 instances and nodes, respectively. 588- The methods of `Revision` are now `const`. 589 590## Fixed 591 592- Fixed undefined behavior in `proto::media::file::File::get_boxed_info`. 593 594 595# uefi - 0.15.2 (2022-03-15) 596 597## Added 598- Added `PartialEq` impls for `CStr16 == CStr16`, `&CStr16 == CString`, 599 and `CString == &CStr16`. 600- Added `Display` impl for `CString16`. 601- Added `Handle::from_ptr` and `SystemTable<View>::from_ptr`, which are 602 `unsafe` methods for initializing from a raw pointer. 603- Added `CStr16::as_slice_with_nul` to provide immutable access to the 604 underlying slice. 605- Added `LoadedImage::load_options_as_bytes` and 606 `LoadedImage::load_options_as_cstr16`. 607- Added `Align::offset_up_to_alignment`, `Align::round_up_to_alignment`, 608 and `Align::align_buf`. 609- Added `BootServices::connect_controller` and 610 `BootServices::disconnect_controller`. 611- Added `BootServices::load_image` and `LoadImageSource`. Together these 612 replace `BootServices::load_image_from_buffer` and also allow an image 613 to be loaded via the `SimpleFileSystem` protocol. 614- Added `Rng` protocol. 615- Added `GptPartitionAttributes` struct and associated constants. 616- Added `Output::output_string_lossy`. 617- Added `ResultExt::handle_warning`. 618 619## Changed 620- Updated to the 2021 edition. 621- `File::open` now takes the filename as `&CStr16` instead of `&str`, 622 avoiding an implicit string conversion. 623- `FileInfo::new`, `FileSystemInfo::new`, and 624 `FileSystemVolumeLabel::new` now take their `name` parameter as 625 `&CStr16` instead of `&str`, avoiding an implicit string 626 conversion. Additionally, an unaligned storage buffer is now allowed 627 as long as it is big enough to provide an aligned subslice. 628- `LoadImage::set_load_options` now takes a `u8` pointer instead of 629 `Char16`. 630- The `Error` type is now public. 631- The type of `GptPartitionEntry.attributes` is now 632 `GptPartitionAttributes`. 633- The `uefi::Result` type now treats UEFI warnings as errors by 634 default. The `uefi::Result::Ok` variant no longer contains a 635 `Completion`, so the type behaves more like a regular Rust `Result` 636 type. 637 638## Removed 639- Removed `CStr16::as_string` method. Use 640 [`ToString`](https://doc.rust-lang.org/alloc/string/trait.ToString.html) 641 instead. 642- Removed `FileInfoCreationError::InvalidChar`. This error type is no 643 longer needed due to the removal of implicit string conversions in 644 file info types. 645- Removed `LoadedImage::load_options`, use 646 `LoadedImage::load_options_as_bytes` or 647 `LoadedImage::load_options_as_cstr16` instead. 648- Removed `NamedFileProtocolInfo`, `FileInfoHeader`, 649 `FileSystemInfoHeader`, and `FileSystemVolumeLabelHeader`. Use 650 `FileInfo`, `FileSystemInfo`, and `FileSystemVolumeLabel` instead. 651- Removed `BootServices::load_image_from_buffer`. Use 652 `BootServices::load_image` instead. 653- Removed `Completion` type. Warnings are now treated as errors. 654- Removed many `ResultExt` methods, for most of them the standard 655 `Result` methods can be used instead. Use `unwrap` instead of 656 `unwrap_success`, `expect` instead of `expect_success`, `expect_err` 657 instead of `expect_error`, and `map` instead of `map_inner`. The 658 `log_warning` method has also been removed, use the new 659 `ResultExt::handle_warning` method instead. 660 661## Fixed 662- Fixed compilation with Rust 1.60 by no longer enabling the 663 `vec_spare_capacity` feature, which has been stabilized. 664- Fixed the header size calculated by `FileInfo::new` and 665 `FileSystemInfo::new`. 666- Fixed incorrect alignment of the volume label field in 667 `FileSystemInfo`. This caused the beginning of the string to be 668 truncated and could result in out-of-bounds reads. 669- Fixed size check for file info types so that alignment padding is 670 taken into account. This fixes potential out-of-bounds writes. 671 672 673[uefi-rs book]: https://rust-osdev.github.io/uefi-rs/HEAD 674