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

Function create_serial_node

arch/src/riscv64/fdt.rs:272–288  ·  view source on GitHub ↗
(
    fdt: &mut FdtWriter,
    dev_info: &T,
)

Source from the content-addressed store, hash-verified

270}
271
272fn create_serial_node<T: DeviceInfoForFdt + Clone + Debug>(
273 fdt: &mut FdtWriter,
274 dev_info: &T,
275) -> FdtWriterResult<()> {
276 let serial_reg_prop = [dev_info.addr(), dev_info.length()];
277 let irq = [dev_info.irq() - IRQ_BASE, IRQ_TYPE_LEVEL_HI];
278
279 let serial_node = fdt.begin_node(&format!("serial@{:x}", dev_info.addr()))?;
280 fdt.property_string("compatible", "ns16550a")?;
281 fdt.property_array_u64("reg", &serial_reg_prop)?;
282 fdt.property_u32("clock-frequency", 3686400)?;
283 fdt.property_u32("interrupt-parent", AIA_APLIC_PHANDLE)?;
284 fdt.property_array_u32("interrupts", &irq)?;
285 fdt.end_node(serial_node)?;
286
287 Ok(())
288}
289
290fn create_devices_node<T: DeviceInfoForFdt + Clone + Debug, S: ::std::hash::BuildHasher>(
291 fdt: &mut FdtWriter,

Callers 1

create_devices_nodeFunction · 0.70

Calls 3

addrMethod · 0.45
lengthMethod · 0.45
irqMethod · 0.45

Tested by

no test coverage detected