Merge branch 'minor_changes' into 'master'

Couple of minor changes

See merge request redox-os/drivers!162
This commit is contained in:
Jeremy Soller
2024-06-11 19:17:15 +00:00
4 changed files with 4 additions and 14 deletions
Generated
-1
View File
@@ -922,7 +922,6 @@ dependencies = [
"bincode",
"bit_field",
"bitflags 1.3.2",
"byteorder",
"common",
"fdt 0.1.0",
"libc",
-1
View File
@@ -15,7 +15,6 @@ path = "src/lib.rs"
bincode = "1.2"
bitflags = "1"
bit_field = "0.10"
byteorder = "1.2"
fdt = { git = "https://gitlab.redox-os.org/rosehuds/fdt.git" }
libc = "0.2"
log = "0.4"
+3 -11
View File
@@ -1,4 +1,3 @@
use byteorder::{ByteOrder, LittleEndian};
use pci_types::{ConfigRegionAccess, PciAddress};
pub struct PciFunc<'pci> {
@@ -9,17 +8,10 @@ pub struct PciFunc<'pci> {
impl<'pci> PciFunc<'pci> {
pub unsafe fn read_range(&self, offset: u16, len: u16) -> Vec<u8> {
assert!(len > 3 && len % 4 == 0, "invalid range length: {}", len);
let mut ret = Vec::with_capacity(len as usize);
let results = (offset..offset + len)
(offset..offset + len)
.step_by(4)
.fold(Vec::new(), |mut acc, offset| {
let val = self.read_u32(offset);
acc.push(val);
acc
});
ret.set_len(len as usize);
LittleEndian::write_u32_into(&*results, &mut ret);
ret
.flat_map(|offset| self.read_u32(offset).to_le_bytes())
.collect::<Vec<u8>>()
}
pub unsafe fn read_u8(&self, offset: u16) -> u8 {
+1 -1
View File
@@ -33,7 +33,7 @@ pub struct PciCapability {
pub cfg_type: CfgType,
/// Where to find it.
pub bar: u8,
/// Multiple capabilities of the same typel
/// Multiple capabilities of the same type.
pub id: u8,
/// Pad to a full dword.
pub padding: [u8; 2],