On 18/02/2025 21:34, Jd Lyons via OpenBIOS wrote:
I don’t know why, I can’t seem to get Openbios to set and interrupt-parent in the init.c for any /cpus, this code should work, no?
void add_cpu_nodes(void) { int num_cpus = fw_cfg_read_i32(FW_CFG_NB_CPUS); printk("Detected %d CPUs\n", num_cpus);
/* Ensure /cpus node exists */ phandle cpus_node = dt_find_by_path("/cpus"); if (!cpus_node) { printk("ERROR: /cpus node not found! Delaying CPU setup.\\n"); return; } /* Wait until the interrupt controller exists */ phandle intc_node = NULL; int retries = 5; while (retries-- > 0) { intc_node = dt_find_by_path("/pci/mac-io/@40000");
Is this for the mac99 machine? If so you probably want /pci@f2000000/mac-io@c/interrupt-controller@40000 (see the output of show-devs for the full device paths).
if (intc_node) { break; } printk("Waiting for /pci/mac-io/@40000...\\n"); msleep(100); // Wait 100ms before retrying } if (!intc_node) { printk("ERROR: Interrupt controller (/pci/mac-io/@40000) not found! SMP will not work.\\n"); return; } for (int i = 0; i < num_cpus; i++) { phandle cpu_node = dt_new_node(cpus_node); if (!cpu_node) { printk("ERROR: Failed to create CPU node for CPU %d!\\n", i); continue; } dt_set_property_string(cpu_node, "device_type", "cpu"); dt_set_property_string(cpu_node, "compatible", "PowerPC,G4"); /* Assign a unique CPU interrupt */ int cpu_irq[2] = { 16 + i, 0 }; dt_set_property_cells(cpu_node, "interrupts", cpu_irq, 2); printk("CPU %d assigned IRQ %d\\n", i, cpu_irq[0]); /* Ensure interrupt-parent is set */ dt_set_property_phandle(cpu_node, "interrupt-parent", intc_node); printk("CPU %d linked to interrupt-parent /pci/mac-io/@40000\\n", i); /* Register CPU ID */ PUSH(i); fword("encode-int"); push_str("reg"); fword("property"); fword("finish-device"); printk("Initialized CPU %d\\n", i); }
}
ATB,
Mark.