MCPcopy Index your code
hub / github.com/cloud-hypervisor/cloud-hypervisor / create_devices_node

Function create_devices_node

arch/src/aarch64/fdt.rs:882–913  ·  view source on GitHub ↗
(
    fdt: &mut FdtWriter,
    dev_info: &HashMap<(DeviceType, String), T, S>,
)

Source from the content-addressed store, hash-verified

880}
881
882fn create_devices_node<T: DeviceInfoForFdt + Clone + Debug, S: ::std::hash::BuildHasher>(
883 fdt: &mut FdtWriter,
884 dev_info: &HashMap<(DeviceType, String), T, S>,
885) -> FdtWriterResult<()> {
886 // Create one temp Vec to store all virtio devices
887 let mut ordered_virtio_device: Vec<&T> = Vec::new();
888
889 for ((device_type, _device_id), info) in dev_info {
890 match device_type {
891 DeviceType::Gpio => create_gpio_node(fdt, info)?,
892 DeviceType::Rtc => create_rtc_node(fdt, info)?,
893 DeviceType::Serial => create_serial_node(fdt, info)?,
894 DeviceType::Virtio(_) => {
895 ordered_virtio_device.push(info);
896 }
897 #[cfg(feature = "fw_cfg")]
898 DeviceType::FwCfg => create_fw_cfg_node(fdt, info)?,
899 }
900 }
901
902 // Sort out virtio devices by address from low to high and insert them into fdt table.
903 ordered_virtio_device.sort_by_key(|&a| a.addr());
904 // Current address allocation strategy in cloud-hypervisor is: the first created device
905 // will be allocated to higher address. Here we reverse the vector to make sure that
906 // the older created device will appear in front of the newer created device in FDT.
907 ordered_virtio_device.reverse();
908 for ordered_device_info in ordered_virtio_device.drain(..) {
909 create_virtio_node(fdt, ordered_device_info)?;
910 }
911
912 Ok(())
913}
914
915fn create_pmu_node(fdt: &mut FdtWriter) -> FdtWriterResult<()> {
916 let compatible = "arm,armv8-pmuv3";

Callers 1

create_fdtFunction · 0.70

Calls 8

newFunction · 0.85
create_gpio_nodeFunction · 0.85
create_rtc_nodeFunction · 0.85
create_fw_cfg_nodeFunction · 0.85
create_virtio_nodeFunction · 0.85
create_serial_nodeFunction · 0.70
pushMethod · 0.45
addrMethod · 0.45

Tested by

no test coverage detected