OBP naming for 64-bit systems
PATCH 1/1 OBP naming for 64-bit systems
This was Keith M Wesolowski's work back before he was working for Sun, but his employment contract prohibits him from making contributions (including asking for this patch to be pushed into mainline), so I am asking.
Here are his words on this patch:
Quoted 1 line
Also, what are the problems with the obp64-naming patch that you
mention
Quoted 6 lines
in the patch header? You said it is totally broken on Cheetah/Jalapeno.
Change the OBP naming for 64-bit systems. This better matches the reg/offset calculations done by the PROM on Spitfire systems, and prevents duplicate names (!) in openpromfs. It's utterly broken on Cheetah/Jalapeno however.
The sunfire systems and some of the smaller Cheetah-based boards also use a different board numbering system that's incompatible with the overly simple algorithm I included. In other words, we trade one kind of breakage for another - the patch is useful because the systems it breaks are rare and the ones it fixes are common. :-)
Signature · 1 line
Jeremy Huddleston <[email protected]>
From http://dev.gentoo.org/~wesolows
Change the OBP naming for 64-bit systems. This better matches the reg/offset calculations done by the PROM on Spitfire systems, and prevents duplicate names (!) in openpromfs. It's utterly broken on Cheetah/Jalapeno however.
-------------------------------------------------------------------------------
===== arch/sparc64/prom/tree.c 1.1 vs edited =====
arch/sparc64/prom/tree.c +10 -2
@@ -196,6 +196,7 @@ {int i, sbus =0 ;int pci =0 , ebus =0 , ide =0 ; +char *name;struct linux_prom_registers *reg;struct linux_prom64_registers reg64[PROMREG_MAX ];
@@ -241,6 +242,7 @@return -1 ; } buffer [i] =0 ; + name = buffer; len -= i; i =prom_getproperty (node,"reg" , (char *)reg64,sizeof (reg64));if (i <=0 )return 0 ;
@@ -267,9 +269,15 @@ }else if (i ==4 ) {/* Happens on 8042's children on Ultra/PCI. */ reg = (struct linux_prom_registers *)reg64;sprintf (buffer,"@%x" , reg[0 ].which_io); + }else if (!strcmp (name,"fhc" ) || !strcmp (name,"counter-timer" )) { +sprintf (buffer,"@%x,%x" , + (unsigned int )((reg64[0 ].phys_addr >>33 ) &0x1f ), + (unsigned int )(reg64[0 ].phys_addr)); }else { -sprintf (buffer,"@%x,%x" , - (unsigned int )(reg64[0 ].phys_addr >>36 ), +int upaid =prom_getint (node,"upa-portid" ); +if (upaid <0 ) + upaid = (unsigned int )(reg64[0 ].phys_addr >>36 ); +sprintf (buffer,"@%x,%x" , upaid, (unsigned int )(reg64[0 ].phys_addr)); }return 0 ;