summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorZhi Wang <zhiw@nvidia.com>2026-01-21 22:22:10 +0200
committerDanilo Krummrich <dakr@kernel.org>2026-01-23 21:23:16 +0100
commit4dc0bacb1d3c4722cbd002c4aab6bd458d30d869 (patch)
treeaaae06aaf61ea463d288f99c1b0c845589f76863 /samples
parent5981d03c27a14df1c03e10570eeb1ab26e9709f7 (diff)
rust: pci: add config space read/write support
Drivers might need to access PCI config space for querying capability structures and access the registers inside the structures. For Rust drivers need to access PCI config space, the Rust PCI abstraction needs to support it in a way that upholds Rust's safety principles. Introduce a `ConfigSpace` wrapper in Rust PCI abstraction to provide safe accessors for PCI config space. The new type implements the `Io` trait and `IoCapable<T>` for u8, u16, and u32 to share offset validation and bound-checking logic with other I/O backends. The `ConfigSpace` type uses marker types (`Normal` and `Extended`) to represent configuration space sizes at the type level. Cc: Alexandre Courbot <acourbot@nvidia.com> Cc: Danilo Krummrich <dakr@kernel.org> Cc: Gary Guo <gary@garyguo.net> Cc: Joel Fernandes <joelagnelf@nvidia.com> Signed-off-by: Zhi Wang <zhiw@nvidia.com> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/all/DFV4IJDQC2J6.1Q91JOAL6CJSG@kernel.org/ [1] Link: https://patch.msgid.link/20260121202212.4438-5-zhiw@nvidia.com [ Applied the diff from [1], considering subsequent comment; remove #[expect(unused)] from define_{read,write}!(). - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions