axdriver/bus/
mmio.rs

1#[allow(unused_imports)]
2use crate::{AllDevices, prelude::*};
3
4impl AllDevices {
5    pub(crate) fn probe_bus_devices(&mut self) {
6        // TODO: parse device tree
7        #[cfg(feature = "virtio")]
8        for reg in axconfig::devices::VIRTIO_MMIO_REGIONS {
9            for_each_drivers!(type Driver, {
10                if let Some(dev) = Driver::probe_mmio(reg.0, reg.1) {
11                    info!(
12                        "registered a new {:?} device at [PA:{:#x}, PA:{:#x}): {:?}",
13                        dev.device_type(),
14                        reg.0, reg.0 + reg.1,
15                        dev.device_name(),
16                    );
17                    self.add_device(dev);
18                    continue; // skip to the next device
19                }
20            });
21        }
22    }
23}