I'm still learning myself but writing the X1 loader taught me some quirks about the OF API works.xeno74 wrote: Thu Feb 27, 2025 6:41 pm I don't have really much knowledge about patching the dtb during the boot.

I'll make some comments.Maybe this can help but I am not sure if it is correct:

Code: Select all
+ prom_setprop(iob, NULL, "#address-cells", "3", sizeof(3));
+ prom_setprop(iob, NULL, "#size-cells", "2", sizeof(2));
+ prom_setprop(iob, NULL, "#interrupt-cells", "1", sizeof(1));
That's a good start. I'm not sure if it will reject properties that don't exist as it needs to add them but it should work fine. The only issue is the hash values are integers so will need be sent as such. So the following (untested) example may be needed:What do you think?
Code: Select all
arch/powerpc/kernel/prom_init.c:
/*
* The io-bridge has device_type set to 'io-bridge' change it to 'isa'
* so that generic isa-bridge code can add the SB600 and its on-board
* peripherals.
*/
name = "/pxp@0,e0000000/io-bridge@0";
iob = call_prom("finddevice", 1, 1, ADDR(name));
if (!PHANDLE_VALID(iob))
return;
/* device_type is already set, just change it. */
prom_printf("Changing device_type of SB600 node...\n");
prom_setprop(iob, name, "device_type", "isa", sizeof("isa"));
+ u32 addresss_cells = 3, size_cells =2, interrupt_cells = 1;
+ prom_setprop(iob, name, "#address-cells", &address_cells, sizeof(u32));
+ prom_setprop(iob, name, "#size-cells", &size_cells, sizeof(u32));
+ prom_setprop(iob, name, "#interrupt-cells", &interrupt_cells, sizeof(u32));