Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/msrv_toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.68"
channel = "1.70"
targets = ["aarch64-unknown-uefi", "i686-unknown-uefi", "x86_64-unknown-uefi"]
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## uefi - [Unreleased]

### Changed
- MSRV bumped to 1.70.
- `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`.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ edition = "2021"
keywords = ["uefi", "efi"]
license = "MPL-2.0"
repository = "https://github.com/rust-osdev/uefi-rs"
rust-version = "1.68"
rust-version = "1.70"

[workspace.dependencies]
bitflags = "2.0.0"
Expand Down
6 changes: 0 additions & 6 deletions uefi-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ pub fn unsafe_protocol(args: TokenStream, input: TokenStream) -> TokenStream {
let (impl_generics, ty_generics, where_clause) = item_struct.generics.split_for_impl();

quote! {
// Disable this lint for now. It doesn't account for the fact that
// currently it doesn't work to `derive(Debug)` on structs that have
// `extern "efiapi" fn` fields, which most protocol structs have. The
// derive _does_ work in current nightly (1.70.0) though, so hopefully
// in a couple Rust releases we can drop this.
#[allow(missing_debug_implementations)]
#item_struct

unsafe impl #impl_generics ::uefi::Identify for #ident #ty_generics #where_clause {
Expand Down
1 change: 1 addition & 0 deletions uefi-raw/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![deny(missing_debug_implementations)]
#![deny(clippy::all)]
#![deny(clippy::ptr_as_ptr, unused)]
#![deny(clippy::must_use_candidate)]
Expand Down
1 change: 1 addition & 0 deletions uefi-raw/src/protocol/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct BlockIoMedia {
pub optimal_transfer_length_granularity: u32,
}

#[derive(Debug)]
#[repr(C)]
pub struct BlockIoProtocol {
pub revision: u64,
Expand Down
4 changes: 4 additions & 0 deletions uefi-raw/src/protocol/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct InputKey {
pub unicode_char: Char16,
}

#[derive(Debug)]
#[repr(C)]
pub struct SimpleTextInputProtocol {
pub reset: unsafe extern "efiapi" fn(this: *mut Self, extended_verification: bool) -> Status,
Expand All @@ -32,6 +33,7 @@ pub struct SimpleTextOutputMode {
pub cursor_visible: bool,
}

#[derive(Debug)]
#[repr(C)]
pub struct SimpleTextOutputProtocol {
pub reset: unsafe extern "efiapi" fn(this: *mut Self, extended: bool) -> Status,
Expand Down Expand Up @@ -76,6 +78,7 @@ pub struct SimplePointerState {
pub right_button: u8,
}

#[derive(Debug)]
#[repr(C)]
pub struct SimplePointerProtocol {
pub reset: unsafe extern "efiapi" fn(
Expand All @@ -94,6 +97,7 @@ impl SimplePointerProtocol {
pub const GUID: Guid = guid!("31878c87-0b75-11d5-9a4f-0090273fc14d");
}

#[derive(Debug)]
#[repr(C)]
pub struct GraphicsOutputProtocol {
pub query_mode: unsafe extern "efiapi" fn(
Expand Down
1 change: 1 addition & 0 deletions uefi-raw/src/protocol/console/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub struct SerialIoMode {
pub stop_bits: StopBits,
}

#[derive(Debug)]
#[repr(C)]
pub struct SerialIoProtocol {
pub revision: u32,
Expand Down
2 changes: 2 additions & 0 deletions uefi-raw/src/protocol/disk.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{guid, Event, Guid, Status};
use core::ffi::c_void;

#[derive(Debug)]
#[repr(C)]
pub struct DiskIoProtocol {
pub revision: u64,
Expand Down Expand Up @@ -32,6 +33,7 @@ pub struct DiskIo2Token {
pub transaction_status: Status,
}

#[derive(Debug)]
#[repr(C)]
pub struct DiskIo2Protocol {
pub revision: u64,
Expand Down
1 change: 1 addition & 0 deletions uefi-raw/src/protocol/driver.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{guid, Guid, Handle, Status};

#[derive(Debug)]
#[repr(C)]
pub struct ComponentName2Protocol {
pub get_driver_name: unsafe extern "efiapi" fn(
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/loaded_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::table::system::SystemTable;
use crate::{guid, Guid, Handle, Status};
use core::ffi::c_void;

#[derive(Clone, Copy)]
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct LoadedImageProtocol {
pub revision: u32,
Expand Down
1 change: 1 addition & 0 deletions uefi-raw/src/protocol/memory_protection.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::table::boot::MemoryAttribute;
use crate::{guid, Guid, PhysicalAddress, Status};

#[derive(Debug)]
#[repr(C)]
pub struct MemoryAttributeProtocol {
pub get_memory_attributes: unsafe extern "efiapi" fn(
Expand Down
1 change: 1 addition & 0 deletions uefi-raw/src/protocol/rng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ newtype_enum! {
}

/// Rng protocol.
#[derive(Debug)]
#[repr(C)]
pub struct RngProtocol {
pub get_info: unsafe extern "efiapi" fn(
Expand Down
2 changes: 2 additions & 0 deletions uefi-raw/src/table/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use bitflags::bitflags;
use core::ffi::c_void;

/// Table of pointers to all the boot services.
#[derive(Debug)]
#[repr(C)]
pub struct BootServices {
pub header: Header,
Expand Down Expand Up @@ -397,6 +398,7 @@ impl MemoryType {
}
}

#[derive(Debug)]
#[repr(C)]
pub struct OpenProtocolInformationEntry {
pub agent_handle: Handle,
Expand Down
1 change: 1 addition & 0 deletions uefi-raw/src/table/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use core::ffi::c_void;
///
/// This table, and the function pointers it contains are valid even after the
/// UEFI OS loader and OS have taken control of the platform.
#[derive(Debug)]
#[repr(C)]
pub struct RuntimeServices {
pub header: Header,
Expand Down
3 changes: 1 addition & 2 deletions uefi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ For additional information, refer to the [UEFI specification][spec].

## MSRV

The minimum supported Rust version is currently 1.68, which is the first Rust
release that fully supports all necessary features on the stable channel.
The minimum supported Rust version is currently 1.70.

Our policy is to support at least the past two stable releases.

Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/console/gop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub use uefi_raw::protocol::console::PixelBitmask;
///
/// The GOP can be used to set the properties of the frame buffer,
/// and also allows the app to access the in-memory buffer.
#[derive(Debug)]
#[repr(transparent)]
#[unsafe_protocol(GraphicsOutputProtocol::GUID)]
pub struct GraphicsOutput(GraphicsOutputProtocol);
Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/console/pointer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{Event, Result, Status, StatusExt};
use uefi_raw::protocol::console::SimplePointerProtocol;

/// Provides information about a pointer device.
#[derive(Debug)]
#[repr(transparent)]
#[unsafe_protocol(SimplePointerProtocol::GUID)]
pub struct Pointer(SimplePointerProtocol);
Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/console/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub use uefi_raw::protocol::console::serial::{ControlBits, Parity, StopBits};
///
/// Since UEFI drivers are implemented through polling, if you fail to regularly
/// check for input/output, some data might be lost.
#[derive(Debug)]
#[repr(transparent)]
#[unsafe_protocol(SerialIoProtocol::GUID)]
pub struct Serial(SerialIoProtocol);
Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/console/text/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use core::mem::MaybeUninit;
use uefi_raw::protocol::console::{InputKey, SimpleTextInputProtocol};

/// Interface for text-based input devices.
#[derive(Debug)]
#[repr(transparent)]
#[unsafe_protocol(SimpleTextInputProtocol::GUID)]
pub struct Input(SimpleTextInputProtocol);
Expand Down
34 changes: 1 addition & 33 deletions uefi/src/proto/console/text/output.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::proto::unsafe_protocol;
use crate::{CStr16, Result, ResultExt, Status, StatusExt};
use core::fmt;
use core::fmt::{Debug, Formatter};
use uefi_raw::protocol::console::{SimpleTextOutputMode, SimpleTextOutputProtocol};

/// Interface for text-based output devices.
Expand All @@ -21,6 +20,7 @@ use uefi_raw::protocol::console::{SimpleTextOutputMode, SimpleTextOutputProtocol
/// [`SystemTable::stdout`]: crate::table::SystemTable::stdout
/// [`SystemTable::stderr`]: crate::table::SystemTable::stderr
/// [`BootServices`]: crate::table::boot::BootServices#accessing-protocols
#[derive(Debug)]
#[repr(transparent)]
#[unsafe_protocol(SimpleTextOutputProtocol::GUID)]
pub struct Output(SimpleTextOutputProtocol);
Expand Down Expand Up @@ -217,38 +217,6 @@ impl fmt::Write for Output {
}
}

impl Debug for Output {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.debug_struct("Output")
.field("reset (fn ptr)", &(self.0.reset as *const u64))
.field(
"output_string (fn ptr)",
&(self.0.output_string as *const u64),
)
.field("test_string (fn ptr)", &(self.0.test_string as *const u64))
.field("query_mode (fn ptr)", &(self.0.query_mode as *const u64))
.field("set_mode (fn ptr)", &(self.0.set_mode as *const u64))
.field(
"set_attribute (fn ptr)",
&(self.0.set_attribute as *const u64),
)
.field(
"clear_screen (fn ptr)",
&(self.0.clear_screen as *const u64),
)
.field(
"set_cursor_position (fn ptr)",
&(self.0.set_cursor_position as *const u64),
)
.field(
"enable_cursor (fn ptr)",
&(self.0.enable_cursor as *const u64),
)
.field("data", &self.0.mode)
.finish()
}
}

/// The text mode (resolution) of the output device.
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct OutputMode {
Expand Down
2 changes: 2 additions & 0 deletions uefi/src/proto/debug/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ mod exception;
/// one for any given instruction set.
///
/// NOTE: OVMF only implements this protocol interface for the virtual EBC processor
#[derive(Debug)]
#[repr(C)]
#[unsafe_protocol("2755590c-6f3c-42fa-9ea4-a3ba543cda25")]
pub struct DebugSupport {
Expand Down Expand Up @@ -174,6 +175,7 @@ pub enum ProcessorArch: u32 => {

/// The debug port protocol abstracts the underlying debug port
/// hardware, whether it is a regular Serial port or something else.
#[derive(Debug)]
#[repr(C)]
#[unsafe_protocol("eba4e8d2-3858-41ec-a281-2647ba9660d0")]
pub struct DebugPort {
Expand Down
2 changes: 1 addition & 1 deletion uefi/src/proto/device_path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ pub enum NodeConversionError {
/// [`load_image`]: crate::table::boot::BootServices::load_image
#[repr(transparent)]
#[unsafe_protocol("bc62157e-3e33-4fec-9920-2d3b36d750df")]
#[derive(Pointee)]
#[derive(Debug, Pointee)]
pub struct LoadedImageDevicePath(DevicePath);

impl ProtocolPointer for LoadedImageDevicePath {
Expand Down
2 changes: 2 additions & 0 deletions uefi/src/proto/device_path/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ impl Drop for PoolString<'_> {
///
/// This protocol provides common utility functions for converting device
/// nodes and device paths to a text representation.
#[derive(Debug)]
#[repr(C)]
#[unsafe_protocol("8b843e20-8132-4852-90cc-551a4e4a7f1c")]
pub struct DevicePathToText {
Expand Down Expand Up @@ -147,6 +148,7 @@ impl DevicePathToText {
///
/// This protocol provides common utilities for converting text to
/// device paths and device nodes.
#[derive(Debug)]
#[repr(C)]
#[unsafe_protocol("05c99a21-c70f-4ad2-8a5f-35df3343f51e")]
pub struct DevicePathFromText {
Expand Down
2 changes: 2 additions & 0 deletions uefi/src/proto/driver/component_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use uefi_raw::protocol::driver::ComponentName2Protocol;
/// [RFC 4646]: https://www.rfc-editor.org/rfc/rfc4646
#[deprecated = "deprecated in UEFI 2.1; use ComponentName2 where possible"]
#[unsafe_protocol(ComponentName2Protocol::DEPRECATED_COMPONENT_NAME_GUID)]
#[derive(Debug)]
#[repr(transparent)]
pub struct ComponentName1(
// The layout of the protocol is the same as ComponentName2, only the format
Expand Down Expand Up @@ -97,6 +98,7 @@ impl ComponentName1 {
/// [ISO 639-2]: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
/// [RFC 4646]: https://www.rfc-editor.org/rfc/rfc4646
#[unsafe_protocol(ComponentName2Protocol::GUID)]
#[derive(Debug)]
#[repr(transparent)]
pub struct ComponentName2(ComponentName2Protocol);

Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/loaded_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use core::{mem, slice};
use uefi_raw::protocol::loaded_image::LoadedImageProtocol;

/// The LoadedImage protocol. This can be opened on any image handle using the `HandleProtocol` boot service.
#[derive(Debug)]
#[repr(transparent)]
#[unsafe_protocol(LoadedImageProtocol::GUID)]
pub struct LoadedImage(LoadedImageProtocol);
Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/media/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{Result, StatusExt};
pub use uefi_raw::protocol::block::{BlockIoProtocol, Lba};

/// The Block I/O protocol.
#[derive(Debug)]
#[repr(transparent)]
#[unsafe_protocol(BlockIoProtocol::GUID)]
pub struct BlockIO(BlockIoProtocol);
Expand Down
2 changes: 2 additions & 0 deletions uefi/src/proto/media/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use uefi_raw::protocol::disk::{DiskIo2Protocol, DiskIoProtocol};
/// 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.
#[derive(Debug)]
#[repr(transparent)]
#[unsafe_protocol(DiskIoProtocol::GUID)]
pub struct DiskIo(DiskIoProtocol);
Expand Down Expand Up @@ -87,6 +88,7 @@ pub struct DiskIo2Token {
///
/// This protocol provides an extension to the disk I/O protocol to enable
/// non-blocking / asynchronous byte-oriented disk operation.
#[derive(Debug)]
#[repr(transparent)]
#[unsafe_protocol(DiskIo2Protocol::GUID)]
pub struct DiskIo2(DiskIo2Protocol);
Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/media/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use core::ptr;
///
/// [`BootServices::get_image_file_system`]: crate::table::boot::BootServices::get_image_file_system
/// [`BootServices`]: crate::table::boot::BootServices#accessing-protocols
#[derive(Debug)]
#[repr(C)]
#[unsafe_protocol("964e5b22-6459-11d2-8e39-00a0c969723b")]
pub struct SimpleFileSystem {
Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/media/partition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ newtype_enum! {
}

/// Protocol for accessing partition information.
#[allow(missing_debug_implementations)]
#[repr(C)]
#[repr(packed)]
#[unsafe_protocol("8cf2f62c-bc9b-4821-808d-ec9ec421a1a0")]
Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/network/pxe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use crate::{CStr8, Char8, Result, Status, StatusExt};
use super::{IpAddress, MacAddress};

/// PXE Base Code protocol
#[derive(Debug)]
#[repr(C)]
#[unsafe_protocol("03c4e603-ac28-11d3-9a2d-0090273fc14d")]
#[allow(clippy::type_complexity)]
Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/network/snp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use core::ptr::NonNull;
use uefi_macros::unsafe_protocol;

/// The Simple Network Protocol
#[derive(Debug)]
#[repr(C)]
#[unsafe_protocol("a19832b9-ac25-11d3-9a2d-0090273fc14d")]
pub struct SimpleNetwork {
Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/pi/mp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ pub struct CpuPhysicalLocation {
}

/// Protocol that provides services needed for multi-processor management.
#[derive(Debug)]
#[repr(C)]
#[unsafe_protocol("3fdda605-a76e-4f46-ad29-12f4531b3d08")]
pub struct MpServices {
Expand Down
1 change: 1 addition & 0 deletions uefi/src/proto/rng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use core::{mem, ptr};
pub use uefi_raw::protocol::rng::RngAlgorithmType;

/// Rng protocol
#[derive(Debug)]
#[repr(transparent)]
#[unsafe_protocol(uefi_raw::protocol::rng::RngProtocol::GUID)]
pub struct Rng(uefi_raw::protocol::rng::RngProtocol);
Expand Down
Loading