@@ -8,6 +8,8 @@ use crate::mem::paging::PhysAddr;
8
8
use crate :: userland:: scheduler;
9
9
use crate :: utils:: io;
10
10
11
+ use super :: pci:: PciHeader ;
12
+
11
13
struct LaiHost ;
12
14
13
15
impl lai:: Host for LaiHost {
@@ -68,6 +70,24 @@ impl lai::Host for LaiHost {
68
70
fn ind ( & self , port : u16 ) -> u32 {
69
71
unsafe { io:: inl ( port) }
70
72
}
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
+ }
71
91
}
72
92
73
93
pub fn init_lai ( ) {
0 commit comments