fn create_cpu_nodes(fdt: &mut Vec<u8>, vcpu_mpidr: &[u64]) -> Result<()> {
    // See https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/arm/cpus.yaml.
    append_begin_node(fdt, "cpus")?;
    // As per documentation, on ARM v8 64-bit systems value should be set to 2.
    append_property_u32(fdt, "#address-cells", 0x02)?;
    append_property_u32(fdt, "#size-cells", 0x0)?;
    let num_cpus = vcpu_mpidr.len();

    for (index, mpidr) in vcpu_mpidr.iter().enumerate() {
        let cpu_name = format!("cpu@{:x}", index);
        append_begin_node(fdt, &cpu_name)?;
        append_property_string(fdt, "device_type", "cpu")?;
        append_property_string(fdt, "compatible", "arm,arm-v8")?;
        if num_cpus > 1 {
            // This is required on armv8 64-bit. See aforementioned documentation.
            append_property_string(fdt, "enable-method", "psci")?;
        }
        // Set the field to first 24 bits of the MPIDR - Multiprocessor Affinity Register.
        // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0488c/BABHBJCI.html.
        append_property_u64(fdt, "reg", mpidr & 0x7FFFFF)?;
        append_end_node(fdt)?;
    }
    append_end_node(fdt)?;
    Ok(())
}
// Following are the auxiliary function for creating the different nodes that we append to our FDT.
Following are the auxiliary function for creating the different nodes that we append to our FDT.
Following are the auxiliary function for creating the different nodes that we append to our FDT .
fn create_cpu_nodes(fdt: &mut Vec<u8>, vcpu_mpidr: &[u64]) -> Result<()> {
    // See https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/arm/cpus.yaml.
    append_begin_node(fdt, "cpus")?;
    // As per documentation, on ARM v8 64-bit systems value should be set to 2.
    append_property_u32(fdt, "#address-cells", 0x02)?;
    append_property_u32(fdt, "#size-cells", 0x0)?;
    let num_cpus = vcpu_mpidr.len();
    for (index, mpidr) in vcpu_mpidr.iter().enumerate() {
        let cpu_name = format!("cpu@{:x}", index);
        append_begin_node(fdt, &cpu_name)?;
        append_property_string(fdt, "device_type", "cpu")?;
        append_property_string(fdt, "compatible", "arm,arm-v8")?;
        if num_cpus > 1 {
            // This is required on armv8 64-bit. See aforementioned documentation.
            append_property_string(fdt, "enable-method", "psci")?;
        }
        // Set the field to first 24 bits of the MPIDR - Multiprocessor Affinity Register.
        // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0488c/BABHBJCI.html.
        append_property_u64(fdt, "reg", mpidr & 0x7FFFFF)?;
        append_end_node(fdt)?;
    }
    append_end_node(fdt)?;
    Ok(())
}
fn create_cpu_nodes ( fdt : & mut Vec < u8 > , vcpu_mpidr : & [ u64 ] ) -> Result < ( ) > { // See https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/arm/cpus.yaml. append_begin_node ( fdt , " " ) ? ; // As per documentation, on ARM v8 64-bit systems value should be set to 2. append_property_u32 ( fdt , " " , 0x02 ) ? ; append_property_u32 ( fdt , " " , 0x0 ) ? ; let num_cpus = vcpu_mpidr . len ( ) ; for ( index , mpidr ) in vcpu_mpidr . iter ( ) . enumerate ( ) { let cpu_name = format ! ( " " index ) ; append_begin_node ( fdt , & cpu_name ) ? ; append_property_string ( fdt , " " , " " ) ? ; append_property_string ( fdt , " " , " " ) ? ; if num_cpus > 1 { // This is required on armv8 64-bit. See aforementioned documentation. append_property_string ( fdt , " " , " " ) ? ; } // Set the field to first 24 bits of the MPIDR - Multiprocessor Affinity Register. // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0488c/BABHBJCI.html. append_property_u64 ( fdt , " " , mpidr & 0x7FFFFF ) ? ; append_end_node ( fdt ) ? ; } append_end_node ( fdt ) ? ; Ok ( ( ) ) }
Following are the auxiliary function for creating the different nodes that we append to our FDT.
Following are the auxiliary function for creating the different nodes that we append to our FDT .
fdt
&mut Vec<u8>
vcpu_mpidr
&[u64]