pcid/base bump + redox-driver-pci: 64-byte header reads
- base bump (b0e76065): pcid PCI 3.0 fallback no longer panics on
extended config reads (returns 0xFFFFFFFF, drops writes).
- redox-driver-pci PciBus reads only the 64-byte standard header it
consumes (vendor/device/class/subsystem), instead of the whole 4 KiB
config file per device per poll cycle — safe on MCFG-less machines
and cheaper everywhere.
This commit is contained in:
@@ -50,8 +50,20 @@ impl Bus for PciBus {
|
||||
}
|
||||
|
||||
let config_path = path.join("config");
|
||||
let config_data = match fs::read(&config_path) {
|
||||
Ok(d) => d,
|
||||
// Read only the 64-byte standard header: everything PciBus
|
||||
// consumes (vendor/device at 0x00, class block at 0x08-0x0B,
|
||||
// subsystem IDs at 0x2C-0x2F) lives there, and larger reads
|
||||
// cross into PCIe extended space which does not exist on
|
||||
// MCFG-less (PCI 3.0 I/O-port fallback) machines.
|
||||
let config_data = match std::fs::File::open(&config_path) {
|
||||
Ok(file) => {
|
||||
use std::io::Read;
|
||||
let mut buf = Vec::new();
|
||||
match file.take(64).read_to_end(&mut buf) {
|
||||
Ok(_) => buf,
|
||||
Err(_) => continue,
|
||||
}
|
||||
}
|
||||
Err(_) => continue,
|
||||
};
|
||||
|
||||
|
||||
+1
-1
Submodule local/sources/base updated: c72d4247a6...b0e760659c
Reference in New Issue
Block a user