[openfirmware] [commit] r2851 - cpu/arm ofw/core
repository service
svn at openfirmware.info
Sat Feb 4 00:16:53 CET 2012
Author: wmb
Date: Sat Feb 4 00:16:53 2012
New Revision: 2851
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2851
Log:
Flattened device tree fixes from debugging session.
Modified:
cpu/arm/linux.fth
ofw/core/fdt.fth
Modified: cpu/arm/linux.fth
==============================================================================
--- cpu/arm/linux.fth Tue Jan 24 23:11:27 2012 (r2850)
+++ cpu/arm/linux.fth Sat Feb 4 00:16:53 2012 (r2851)
@@ -48,8 +48,8 @@
defer fb-tag, ' noop to fb-tag, \ Define externally if appropriate
defer ofw-tag, ' noop to ofw-tag, \ Define externally if appropriate
-: set-parameters ( cmdline$ -- )
- linux-params to tag-adr
+: set-parameters ( cmdline$ adr -- )
+ to tag-adr
5 tag-l, \ size
h# 54410001 tag-l, \ ATAG_CORE
@@ -94,9 +94,9 @@
: linux-fixup ( -- )
[ifdef] linux-logo linux-logo [then]
- use-fdt? 0= if
- args-buf cscount set-parameters ( )
- then
+\ use-fdt? 0= if
+\ args-buf cscount set-parameters ( )
+\ then
disable-interrupts
linux-base linux-base (init-program) \ Starting address, SP
@@ -104,13 +104,12 @@
arm-linux-machine-type to r1
[ifdef] flatten-device-tree
use-fdt? if
- flatten-device-tree to r2
+ linux-params h# 40000 flatten-device-tree
else
- linux-params to r2
+ args-buf cscount linux-params set-parameters
then
-[else]
- linux-params to r2
[then]
+ linux-params to r2
linux-hook
;
@@ -127,8 +126,8 @@
\ dup to linux-memtop
to ramdisk-adr
- ramdisk-adr " linux,initd-start" chosen-int-property
- ramdisk-adr /ramdisk + " linux,initd-end" chosen-int-property
+ ramdisk-adr " linux,initrd-start" chosen-int-property
+ ramdisk-adr /ramdisk + " linux,initrd-end" chosen-int-property
;
: $load-ramdisk ( name$ -- )
0 to /ramdisk ( name$ )
Modified: ofw/core/fdt.fth
==============================================================================
--- ofw/core/fdt.fth Tue Jan 24 23:11:27 2012 (r2850)
+++ ofw/core/fdt.fth Sat Feb 4 00:16:53 2012 (r2851)
@@ -10,14 +10,11 @@
0 value fdt-strings
0 value fdt-strings-ptr
0 value fdt-strings-end
-h# 40000 value /fdt
+0 value /fdt
0 value the-node
: fdt-remaining ( -- n ) fdt-end fdt-ptr - ;
-: ?fdt-enough ( n -- )
-
-;
: +fdt ( n -- ptr )
dup fdt-remaining > abort" FDT buffer overflow" ( n )
@@ -101,9 +98,8 @@
2 fdt, \ OF_DT_END_NODE
;
-: flatten-device-tree ( -- adr )
- /fdt alloc-mem /fdt-align round-up to fdt
- fdt /fdt erase
+: flatten-device-tree ( adr len -- )
+ to /fdt to fdt
fdt to fdt-ptr
fdt /fdt + to fdt-end
@@ -166,6 +162,57 @@
fdt
;
+
+: fdt@ ( offset -- l ) fdt + be-l@ ;
+: +fdt-ptr ( n -- ) fdt-ptr + 4 round-up to fdt-ptr ;
+: fdt@@ ( -- l ) fdt-ptr be-l@ /l +fdt-ptr ;
+
+: fdt@$ ( -- adr len )
+ fdt-ptr cscount ( adr len )
+ dup 1+ +fdt-ptr
+;
+: .fdt-value ( value$ name$ -- )
+ " compatible" $= if show-strings exit then
+
+ \ Test for unprintable characters
+ 2dup -null text? if
+ to-display-column -null type exit
+ then ( adr,len )
+
+ dup /n /mod swap 0= if ( adr len #ints )
+ .ints exit ( -- )
+ then ( adr,len #ints )
+ drop ( adr,len )
+
+ to-display-column h# 10 min cdump ( )
+;
+: .fdt-property ( -- )
+ [ also hidden ] indent [ previous ]
+ fdt@@ ( value-length )
+ fdt@@ fdt-strings + cscount 2dup type ( value-length name$ )
+ 2>r fdt-ptr over 2r> .fdt-value ( value-length )
+ +fdt-ptr ( )
+;
+: .fdt-node ( -- )
+ [ also hidden ] indent [ previous ]
+ fdt@$ type cr
+;
+
+: dump-fdt ( -- )
+ 0 fdt@ h# d00dfeed <> abort" FDT magic mismatch"
+ fdt h# 0c fdt@ + to fdt-strings
+ fdt h# 80 + to fdt-ptr
+ begin
+ fdt@@ case
+ 1 of .fdt-node 2 lmargin +! endof
+ 2 of -2 lmargin +! endof
+ 3 of .fdt-property endof
+ 9 of exit endof
+ ( -- ) ." Bogus DT tag " . cr exit
+ endcase
+ again
+;
+
previous
\ LICENSE_BEGIN
More information about the openfirmware
mailing list