: Fix SILO initrd calculations
PATCH 1/1 : Fix SILO initrd calculations
SILO uses a different idea of "phys_base" than the kernel does when deciding the value to stick into the ramdisk cookie of the kernel.
The kernel uses the smallest "phys" found in the "available" properties, whereas SILO uses the "phys" of the first element of the "reg" property. This can be different, as the following Niagara system /memory node dump shows:
reg 00000000 00800000 00000003 ff800000
available 00000003 fffd0000 00000000 00002000
00000003 fffcc000 00000000 00002000
00000003 fffc0000 00000000 00006000
00000003 fffa4000 00000000 0000c000
00000003 ff000000 00000000 00fa2000
00000000 00c00000 00000003 fe3fe000 name memory
0x800000 vs. 0xc00000
The fix is simple, please apply.
memory.c renamed from memory.c.~1~ +6 -8
@@ -289,14 +289,6 @@ node =prom_finddevice ("/memory" ); -if (prom_getproperty (node,"reg" , (char *)p,2048 ) =-1 ) { -free (p); -printf ("Could not get reg property\n" ); -return (char *)0 ; - } - - phys_base = p[0 ].phys; - n =prom_getproplen (node,"available" );if (!n || n =-1 ||prom_getproperty (node,"available" , (char *)p,2048 ) =-1 ) {
@@ -308,6 +300,12 @@ phys =0 ; n /=sizeof (*p); + phys_base = ~(unsigned long long )0 ; +for (i =0 ; i < n; i++) { +if (p[i].phys < phys_base) + phys_base = p[i].phys; + } +for (i =0 ; i < n; i++) {/* Do not mess with first 4 Megs of memory */ if (p[i].phys = phys_base) {