@@ -8,6 +8,8 @@ use crate::mem::paging::PhysAddr;
88use crate :: userland:: scheduler;
99use crate :: utils:: io;
1010
11+ use super :: pci:: PciHeader ;
12+
1113struct LaiHost ;
1214
1315impl lai:: Host for LaiHost {
@@ -68,6 +70,24 @@ impl lai::Host for LaiHost {
6870 fn ind ( & self , port : u16 ) -> u32 {
6971 unsafe { io:: inl ( port) }
7072 }
73+
74+ // PCI read functions:
75+ //
76+ // todo: do not ignore the segment once we use MCFG.
77+ fn pci_readb ( & self , _seg : u16 , bus : u8 , slot : u8 , fun : u8 , offset : u16 ) -> u8 {
78+ let header = PciHeader :: new ( bus, slot, fun) ;
79+ unsafe { header. read :: < u8 > ( offset as u32 ) as u8 }
80+ }
81+
82+ fn pci_readw ( & self , _seg : u16 , bus : u8 , slot : u8 , fun : u8 , offset : u16 ) -> u16 {
83+ let header = PciHeader :: new ( bus, slot, fun) ;
84+ unsafe { header. read :: < u16 > ( offset as u32 ) as u16 }
85+ }
86+
87+ fn pci_readd ( & self , _seg : u16 , bus : u8 , slot : u8 , fun : u8 , offset : u16 ) -> u32 {
88+ let header = PciHeader :: new ( bus, slot, fun) ;
89+ unsafe { header. read :: < u32 > ( offset as u32 ) }
90+ }
7191}
7292
7393pub fn init_lai ( ) {
0 commit comments