[OpenBIOS] [PATCH] pathres: consistently encode unit address on 64bit target

Igor V. Kovalenko igor.v.kovalenko at gmail.com
Mon Feb 1 22:05:57 CET 2010


From: Igor V. Kovalenko <igor.v.kovalenko at gmail.com>

This change fixes node unit address matching on arch
where cell is not 4 byte integer (tested with sparc64.)

Since we encode "reg" property chunks with encode-int
we need to use the same encoding while preparing unit
phys addr for comparison at path resolution time.

- (exact-match): calculate phys addr length using 4 byte
  member encoding with /l* not cells

- find-child: encode phys addr components similar to
  encode-int with 4 byte stores

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko at gmail.com>
---
 forth/device/pathres.fs |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/forth/device/pathres.fs b/forth/device/pathres.fs
index 4184d07..f248e8d 100644
--- a/forth/device/pathres.fs
+++ b/forth/device/pathres.fs
@@ -125,7 +125,7 @@ constant sinfo.size
   r@ common-match
 
   \ b) UNIT_PHYS nonempty?
-  r@ >si.unit_phys_len @ cells ?dup if
+  r@ >si.unit_phys_len @ /l* ?dup if
     \ check if unit_phys matches
     " reg" r@ >si.child @ get-package-property if -3 throw then
     ( unitbytes propaddr proplen )
@@ -191,7 +191,7 @@ constant sinfo.size
       ( ... a_lo ... a_hi olddepth n )
       r@ >si.unit_phys >r
       begin 1- dup 0>= while
-        rot r> dup na1+ >r !
+        rot r> dup la1+ >r l!-be
       repeat
       r> 2drop
       depth!




More information about the OpenBIOS mailing list