Skip to content
Open
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
7 changes: 7 additions & 0 deletions rust/kernel/io/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ use crate::types::Opaque;
/// `CONFIG_PHYS_ADDR_T_64BIT`, and it can be a u64 even on 32-bit architectures.
pub type ResourceSize = bindings::phys_addr_t;

#[cfg(CONFIG_HAS_IOPORT)]
/// Returns a reference to the global `ioport_resource` variable.
pub fn ioport_resource() -> &'static Resource {
// SAFETY: `bindings::ioport_resoure` has global lifetime and is of type Resource.
unsafe { Resource::from_raw(&raw mut bindings::ioport_resource) }
}

/// A region allocated from a parent [`Resource`].
///
/// # Invariants
Expand Down