Files
RedBear-OS/local/patches/base/P2-pcid-cfg-access.patch
vasilito 76b75d80b4 fix: absorb redundant base daemon and driver patches
Consolidate ~30 absorbed base patches into surviving carriers. Add
new init service files, driver sources, and network/storage modules
for the base recipe. Move absorbed patches to local/patches/base/absorbed/.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 10:09:25 +01:00

44 lines
1.8 KiB
Diff

--- a/drivers/pcid/src/cfg_access/fallback.rs
+++ b/drivers/pcid/src/cfg_access/fallback.rs
@@ -22,14 +22,17 @@ impl Pci {
// make sure that pcid is not granted io port permission unless pcie memory-mapped
// configuration space is not available.
info!(
"PCI: couldn't find or access PCIe extended configuration, \
and thus falling back to PCI 3.0 io ports"
);
- common::acquire_port_io_rights().expect("pcid: failed to get IO port rights");
+ common::acquire_port_io_rights()
+ .map_err(|err| {
+ log::error!("pcid: failed to get IO port rights: {err}");
+ err
+ })
+ .expect("pcid: IO port rights required for PCI 3.0 fallback");
}
});
}
@@ -55,7 +58,10 @@ impl ConfigRegionAccess for Pci {
Self::set_iopl();
- let offset =
- u8::try_from(offset).expect("offset too large for PCI 3.0 configuration space");
+ let Ok(offset) = u8::try_from(offset) else {
+ // PCI config space is only 256 bytes (offset 0-255)
+ return 0xFFFFFFFF;
+ };
let address = Self::address(address, offset);
Pio::<u32>::new(0xCF8).write(address);
@@ -67,7 +73,10 @@ impl ConfigRegionAccess for Pci {
Self::set_iopl();
- let offset =
- u8::try_from(offset).expect("offset too large for PCI 3.0 configuration space");
+ let Ok(offset) = u8::try_from(offset) else {
+ // PCI config space is only 256 bytes (offset 0-255)
+ return;
+ };
let address = Self::address(address, offset);
Pio::<u32>::new(0xCF8).write(address);