Reunify the style of defining `arch` modules
This commit is contained in:
parent
35720de928
commit
d487e42b7c
|
|
@ -55,14 +55,9 @@
|
|||
#![no_std]
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[path = "arch/x86/mod.rs"]
|
||||
mod arch;
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
#[path = "arch/riscv/mod.rs"]
|
||||
mod arch;
|
||||
#[cfg(target_arch = "loongarch64")]
|
||||
#[path = "arch/loongarch/mod.rs"]
|
||||
#[cfg_attr(target_arch = "x86_64", path = "arch/x86/mod.rs")]
|
||||
#[cfg_attr(target_arch = "riscv64", path = "arch/riscv/mod.rs")]
|
||||
#[cfg_attr(target_arch = "loongarch64", path = "arch/loongarch/mod.rs")]
|
||||
mod arch;
|
||||
|
||||
pub mod bus;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ pub(super) fn probe_for_device() {
|
|||
})
|
||||
});
|
||||
mmio_nodes.for_each(|node| {
|
||||
let mmio_region = node.reg().unwrap().next().unwrap();
|
||||
let mmio_start = mmio_region.starting_address as usize;
|
||||
let mmio_end = mmio_start + mmio_region.size.unwrap();
|
||||
|
||||
let interrupt_source_in_fdt = InterruptSourceInFdt {
|
||||
interrupt: node.interrupts().unwrap().next().unwrap() as u32,
|
||||
interrupt_parent: node
|
||||
|
|
@ -26,9 +30,6 @@ pub(super) fn probe_for_device() {
|
|||
.and_then(|prop| prop.as_usize())
|
||||
.unwrap() as u32,
|
||||
};
|
||||
let mmio_region = node.reg().unwrap().next().unwrap();
|
||||
let mmio_start = mmio_region.starting_address as usize;
|
||||
let mmio_end = mmio_start + mmio_region.size.unwrap();
|
||||
|
||||
let _ = super::try_register_mmio_device(mmio_start..mmio_end, |irq_line| {
|
||||
IRQ_CHIP
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ use crate::transport::mmio::bus::common_device::{
|
|||
#[cfg_attr(target_arch = "x86_64", path = "arch/x86.rs")]
|
||||
#[cfg_attr(target_arch = "riscv64", path = "arch/riscv.rs")]
|
||||
#[cfg_attr(target_arch = "loongarch64", path = "arch/loongarch.rs")]
|
||||
pub mod arch;
|
||||
mod arch;
|
||||
|
||||
#[expect(clippy::module_inception)]
|
||||
pub(super) mod bus;
|
||||
pub(super) mod common_device;
|
||||
|
|
@ -37,7 +38,7 @@ pub(super) fn init() {
|
|||
arch::probe_for_device();
|
||||
}
|
||||
|
||||
/// Try to validate a potential VirtIO-MMIO device, map it to an IRQ line, and
|
||||
/// Tries to validate a potential VirtIO-MMIO device, map it to an IRQ line, and
|
||||
/// register it as a VirtIO-MMIO device.
|
||||
///
|
||||
/// Returns `Ok(())` if the device was registered, or a specific
|
||||
|
|
|
|||
|
|
@ -48,14 +48,9 @@ extern crate controlled;
|
|||
#[macro_use]
|
||||
extern crate getset;
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[path = "arch/x86/mod.rs"]
|
||||
mod arch;
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
#[path = "arch/riscv/mod.rs"]
|
||||
mod arch;
|
||||
#[cfg(target_arch = "loongarch64")]
|
||||
#[path = "arch/loongarch/mod.rs"]
|
||||
#[cfg_attr(target_arch = "x86_64", path = "arch/x86/mod.rs")]
|
||||
#[cfg_attr(target_arch = "riscv64", path = "arch/riscv/mod.rs")]
|
||||
#[cfg_attr(target_arch = "loongarch64", path = "arch/loongarch/mod.rs")]
|
||||
mod arch;
|
||||
|
||||
mod context;
|
||||
|
|
|
|||
|
|
@ -13,18 +13,14 @@ pub use timer_create::create_timer;
|
|||
|
||||
use crate::{context::Context, cpu::LinuxAbi, prelude::*};
|
||||
|
||||
#[cfg_attr(target_arch = "x86_64", path = "arch/x86.rs")]
|
||||
#[cfg_attr(target_arch = "riscv64", path = "arch/riscv.rs")]
|
||||
#[cfg_attr(target_arch = "loongarch64", path = "arch/loongarch.rs")]
|
||||
mod arch;
|
||||
|
||||
mod accept;
|
||||
mod access;
|
||||
mod alarm;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[path = "arch/x86.rs"]
|
||||
mod arch;
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
#[path = "arch/riscv.rs"]
|
||||
mod arch;
|
||||
#[cfg(target_arch = "loongarch64")]
|
||||
#[path = "arch/loongarch.rs"]
|
||||
mod arch;
|
||||
mod arch_prctl;
|
||||
mod bind;
|
||||
mod brk;
|
||||
|
|
|
|||
|
|
@ -22,14 +22,9 @@
|
|||
|
||||
extern crate alloc;
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[path = "arch/x86/mod.rs"]
|
||||
pub mod arch;
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
#[path = "arch/riscv/mod.rs"]
|
||||
pub mod arch;
|
||||
#[cfg(target_arch = "loongarch64")]
|
||||
#[path = "arch/loongarch/mod.rs"]
|
||||
#[cfg_attr(target_arch = "x86_64", path = "arch/x86/mod.rs")]
|
||||
#[cfg_attr(target_arch = "riscv64", path = "arch/riscv/mod.rs")]
|
||||
#[cfg_attr(target_arch = "loongarch64", path = "arch/loongarch/mod.rs")]
|
||||
pub mod arch;
|
||||
|
||||
pub mod boot;
|
||||
|
|
|
|||
Loading…
Reference in New Issue