1 use system_error::SystemError; 2 use unified_init::macros::unified_init; 3 4 use crate::{ 5 arch::TraitPciArch, 6 driver::{ 7 open_firmware::fdt::open_firmware_fdt_driver, 8 pci::pci::{pci_init, BusDeviceFunction, PciAddr, PciError, SegmentGroupNumber}, 9 }, 10 init::{boot_params, initcall::INITCALL_SUBSYS}, 11 kwarn, 12 mm::PhysAddr, 13 }; 14 15 use self::pci_host_ecam::pci_host_ecam_driver_init; 16 17 mod pci_host_ecam; 18 19 pub struct RiscV64PciArch; 20 impl TraitPciArch for RiscV64PciArch { 21 fn read_config(bus_device_function: &BusDeviceFunction, offset: u8) -> u32 { 22 unimplemented!("RiscV64PciArch::read_config") 23 } 24 25 fn write_config(bus_device_function: &BusDeviceFunction, offset: u8, data: u32) { 26 unimplemented!("RiscV64pci_root_0().write_config") 27 } 28 29 fn address_pci_to_physical(pci_address: PciAddr) -> crate::mm::PhysAddr { 30 return PhysAddr::new(pci_address.data()); 31 } 32 } 33 34 #[unified_init(INITCALL_SUBSYS)] 35 fn riscv_pci_init() -> Result<(), SystemError> { 36 let fdt = open_firmware_fdt_driver().fdt_ref()?; 37 38 pci_host_ecam_driver_init(&fdt)?; 39 pci_init(); 40 41 return Ok(()); 42 } 43