MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / create_gic_node

Function create_gic_node

arch/src/aarch64/fdt.rs:660–705  ·  view source on GitHub ↗
(fdt: &mut FdtWriter, gic_device: &Arc<Mutex<dyn Vgic>>)

Source from the content-addressed store, hash-verified

658}
659
660fn create_gic_node(fdt: &mut FdtWriter, gic_device: &Arc<Mutex<dyn Vgic>>) -> FdtWriterResult<()> {
661 let gic_reg_prop = gic_device.lock().unwrap().device_properties();
662
663 let intc_node = fdt.begin_node("intc")?;
664
665 fdt.property_string("compatible", gic_device.lock().unwrap().fdt_compatibility())?;
666 fdt.property_null("interrupt-controller")?;
667 // "interrupt-cells" field specifies the number of cells needed to encode an
668 // interrupt source. The type shall be a <u32> and the value shall be 3 if no PPI affinity description
669 // is required.
670 fdt.property_u32("#interrupt-cells", 3)?;
671 fdt.property_array_u64("reg", &gic_reg_prop)?;
672 fdt.property_u32("phandle", GIC_PHANDLE)?;
673 fdt.property_u32("#address-cells", 2)?;
674 fdt.property_u32("#size-cells", 2)?;
675 fdt.property_null("ranges")?;
676
677 let gic_intr_prop = [
678 GIC_FDT_IRQ_TYPE_PPI,
679 gic_device.lock().unwrap().fdt_maint_irq(),
680 IRQ_TYPE_LEVEL_HI,
681 ];
682 fdt.property_array_u32("interrupts", &gic_intr_prop)?;
683
684 if gic_device.lock().unwrap().msi_compatible() {
685 let msic_node = fdt.begin_node("msic")?;
686 let msi_compatibility = gic_device.lock().unwrap().msi_compatibility().to_string();
687
688 fdt.property_string("compatible", msi_compatibility.as_str())?;
689 fdt.property_null("msi-controller")?;
690 fdt.property_u32("phandle", MSI_PHANDLE)?;
691 let msi_reg_prop = gic_device.lock().unwrap().msi_properties();
692 fdt.property_array_u64("reg", &msi_reg_prop)?;
693
694 if msi_compatibility == GIC_V2M_COMPATIBLE {
695 fdt.property_u32("arm,msi-base-spi", GICV2M_SPI_BASE)?;
696 fdt.property_u32("arm,msi-num-spis", GICV2M_SPI_NUM)?;
697 }
698
699 fdt.end_node(msic_node)?;
700 }
701
702 fdt.end_node(intc_node)?;
703
704 Ok(())
705}
706
707fn create_clock_node(fdt: &mut FdtWriter) -> FdtWriterResult<()> {
708 // The Advanced Peripheral Bus (APB) is part of the Advanced Microcontroller Bus Architecture

Callers 1

create_fdtFunction · 0.85

Calls 6

device_propertiesMethod · 0.45
fdt_compatibilityMethod · 0.45
fdt_maint_irqMethod · 0.45
msi_compatibleMethod · 0.45
msi_compatibilityMethod · 0.45
msi_propertiesMethod · 0.45

Tested by

no test coverage detected