[SLOF] [PATCH slof] fdt: Pass the resulting device tree to QEMU
Segher Boessenkool
segher at kernel.crashing.org
Thu Oct 5 00:39:59 AEDT 2017
On Tue, Oct 03, 2017 at 03:33:16PM +1100, Alexey Kardashevskiy wrote:
> On 03/10/17 02:12, Segher Boessenkool wrote:
> > On Mon, Oct 02, 2017 at 10:09:52PM +1100, Alexey Kardashevskiy wrote:
> >>> : fdt-c, fdt-here 1 fdt-allot c! ;
> >>> : fdt-align fdt-here 4 #aligned fdt-here - ; \ or fill with zeroes?
> >>> : fdt-str, ( str len -- ) fdt-here over fdt-allot swap move ;
> >>> : fdt-ztr, ( str len -- ) fdt-str, 0 fdt-c, ;
> >>> \ and now use fdt-str, fdt-align instead of false fdt-struct-add
> >>> \ and just fdt-ztr, fdt-align for true fdt-struct-add
> >
> > I don't see it, but I haven't tested it either, just typed it :-)
> >
> > : fdt-str, ( str len -- )
> > fdt-here over ( str len fhere len )
> > fdt-allot ( str len fhere )
> > swap ( str fhere len )
> > move ( -- )
> > ;
> >
> > Looks fine to me?
Well,
: fdt-str, ( str len -- ) dup fdt-allot fdt-here swap move ;
is probably clearer :-)
> >>> The properties are not a linked list, but a Forth wordlist. This is a)
> >>> faster, because wordlists are optimised a bit, say ten times faster; and
> >>> b) this allows use to run any code we want to get a property, not just
> >>> lookups of static data. From property.fs:
> >>>
> >>> \ Words on the property list for a node are actually executable words,
> >>> \ that return the address and length of the property's data. Special
> >>> \ nodes like /options can have their properties use specialized code to
> >>> \ dynamically generate their data; most nodes just use a 2CONSTANT.
> >>
> >> Hm. I wonder if it makes sense to rewrite fdt-properties using this.
> >
> > You might need to make a case-sensitive wordlist search then?
>
> I have no idea, any example? I'll probably skip this bit this time though.
Currently deep down all wordlists use string=ci (that is, case-insensitive
string compare). I think for the FDT string table you will want case-
sensitive instead.
(When searching the Forth dictionaries Open Firmware requires case-
insensitive; and upper case is not allowed in property names, so doing
a case-insensitive search works there, too (at least in practice, even
though people *do* use upper case in property names).
One option is to set some global flag before finding a word; another is
to have a separate word for case-sentive finding; yet another is to set
a flag in the wordlist itself saying if it should be case-sensitive.
That last one is probably the most useful for other purposes, too.
Segher
More information about the SLOF
mailing list