Port-sparc64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: autoconf hack for broken firmware



Hello,

On Mon, 2 Feb 2026 04:23:29 +0300
Valery Ushakov <uwe%stderr.spb.ru@localhost> wrote:

> On Sun, Feb 01, 2026 at 21:10:38 +0100, Julian Coleman wrote:
> 
> > My U45 doesn't attach jbus-i2c because the node has:
> > 
> >   f0096404: /i2c@400,fc62020
> >   
> >   #address-cells          00000002 ........ ........ ........     2
> >   #size-cells             00000000 ........ ........ ........     0
> >   compatible              6a627573 2d693263 00...... ........   "jbus-i2c"
> >   device_type             69326300 ........ ........ ........   "i2c"
> >   name                    69326300 ........ ........ ........   "i2c"
> >   reg                     00000400 0fc62020 00000010 ........   ......  ....
> > 
> > and the reg property is 96-bits wide.  We try to read it as 64-bit
> > words, which fails.  
> 
> I haven't touched OFW in _ages_, but
> 
>   "reg" - Standard property name to define the package’s registers.
> 
>   prop-encoded-array:
>     Arbitrary number of (phys-addr size) pairs.
>     phys-addr is a (phys.lo ... phys.hi) list, encoded with encod
>     size is a list of integers, each encoded with encode-int.
> 
> IIRC what is going on here, then assuming that #address-cells on the
> parent is 2 (which is the default and can be omitted), this
> 
>    reg 00000400 0fc62020 00000010
> 
> looks like two words for phys address and one word for size.

Yeah, the problem is that on every other machine it looks like this:
#address-cells          00000002 ........ ........ ........     2
#size-cells             00000000 ........ ........ ........     0
compatible              6a627573 2d693263 00...... ........   "jbus-i2c"
device_type             69326300 ........ ........ ........   "i2c"
name                    69326300 ........ ........ ........   "i2c"
reg                     00000400 0fc64000 00000000 00000010 ......@.........

... with size as a 64bit word. And all of them lie about #size-cells.
mainbus_attach() blindly reads it into a
struct upa_reg {
	int64_t	ur_paddr;
	int64_t	ur_len;
};
I'd just check the property length and patch up ur_len as needed.

have fun
Michael


Home | Main Index | Thread Index | Old Index