Author: mcayland
Date: Mon May 12 17:44:01 2014
New Revision: 1297
URL: http://tracker.coreboot.org/trac/openbios/changeset/1297
Log:
ciface.fs: handle buggy callers to test-method
SPARC64 *BSDs accidentally call test-method with an ihandle rather than a
phandle which causes OpenBIOS to crash. Work around this by checking to
ensure that the phandle exists within the tree before trying to use it.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Modified:
trunk/openbios-devel/forth/system/ciface.fs
Modified: trunk/openbios-devel/forth/system/ciface.fs
==============================================================================
--- trunk/openbios-devel/forth/system/ciface.fs Mon May 12 17:43:57 2014 (r1296)
+++ trunk/openbios-devel/forth/system/ciface.fs Mon May 12 17:44:01 2014 (r1297)
@@ -55,6 +55,17 @@
." <" dup cstrlen dup 20 < if type else 2drop ." BAD" then ." >"
;
+: phandle-exists? ( phandle -- found? )
+ false swap 0
+ begin iterate-tree ?dup while
+ ( found? find-ph current-ph )
+ over over = if
+ rot drop true -rot
+ then
+ repeat
+ drop
+;
+
\ -------------------------------------------------------------
\ public interface
\ -------------------------------------------------------------
@@ -318,11 +329,15 @@
outer-interpreter
;
-( cstring-method phandle -- missing )
-
-: test-method
- swap dup cstrlen rot
- find-method 0= if -1 else drop 0 then
+: test-method ( cstring-method phandle -- missing? )
+ swap dup cstrlen rot
+
+ \ Check for incorrect phandle
+ dup phandle-exists? false = if
+ -1 throw
+ then
+
+ find-method 0= if -1 else drop 0 then
;
finish-device
Author: mcayland
Date: Mon May 12 17:43:57 2014
New Revision: 1296
URL: http://tracker.coreboot.org/trac/openbios/changeset/1296
Log:
SPARC64: fix up translations property mode to make it a valid TTE
NetBSD attempts to parse the translations property in order to set up the
virtual to physical translations for the kernel. Alter the mode cell to
include the physical address and valid bit so that it represents a real
TTE entry for the given start adddress.
This is confirmed by checking real dumps from prtconf examples, plus the
NetBSD kernel now starts to boot.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Modified:
trunk/openbios-devel/arch/sparc64/ofmem_sparc64.c
Modified: trunk/openbios-devel/arch/sparc64/ofmem_sparc64.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/ofmem_sparc64.c Mon May 12 17:43:52 2014 (r1295)
+++ trunk/openbios-devel/arch/sparc64/ofmem_sparc64.c Mon May 12 17:43:57 2014 (r1296)
@@ -103,12 +103,12 @@
virtual address
length
- mode
+ mode (valid TTE for start of translation region)
*/
transentry[0] = t->virt;
transentry[1] = t->size;
- transentry[2] = t->mode;
+ transentry[2] = t->phys | t->mode | SPITFIRE_TTE_VALID;
}
/* Return the size of a memory available entry given the phandle in cells */
Author: mcayland
Date: Mon May 12 17:43:41 2014
New Revision: 1291
URL: http://tracker.coreboot.org/trac/openbios/changeset/1291
Log:
ciface.fs: implement milliseconds service
Now that all platforms have at least some implementation of get-msecs we can
just call it in order to implement the milliseconds service.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Modified:
trunk/openbios-devel/forth/system/ciface.fs
Modified: trunk/openbios-devel/forth/system/ciface.fs
==============================================================================
--- trunk/openbios-devel/forth/system/ciface.fs Mon May 12 17:43:38 2014 (r1290)
+++ trunk/openbios-devel/forth/system/ciface.fs Mon May 12 17:43:41 2014 (r1291)
@@ -296,8 +296,9 @@
\ 6.3.2.7 Time
\ -------------------------------------------------------------
-\ : milliseconds ( -- ms ) ;
-
+: milliseconds ( -- ms )
+ get-msecs
+;
\ -------------------------------------------------------------
\ arch?
Author: mcayland
Date: Mon May 12 17:43:38 2014
New Revision: 1290
URL: http://tracker.coreboot.org/trac/openbios/changeset/1290
Log:
other.fs: rework get-msecs word so it can be shared cross-platform
Rather than mess with [IFDEF]s, just have one implementation which falls back
to a simple incrementing dummy counter if a pointer to a real counter hasn't
been configured.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Modified:
trunk/openbios-devel/forth/device/other.fs
Modified: trunk/openbios-devel/forth/device/other.fs
==============================================================================
--- trunk/openbios-devel/forth/device/other.fs Mon May 12 17:43:35 2014 (r1289)
+++ trunk/openbios-devel/forth/device/other.fs Mon May 12 17:43:38 2014 (r1290)
@@ -93,25 +93,22 @@
\ 5.3.7.3 Time
-[IFDEF] CONFIG_PPC
+\ Pointer to OBP tick value updated by timer interrupt
+variable obp-ticks
+\ Dummy implementation for platforms without a timer interrupt
0 value dummy-msecs
: get-msecs ( -- n )
- dummy-msecs dup 1+ to dummy-msecs
- ;
-
-[ELSE]
-
-\ OBP tick value updated by timer interrupt
-variable obp-ticks
-
-: get-msecs ( -- n )
- obp-ticks @
+ \ If obp-ticks pointer is set, use it. Otherwise fall back to
+ \ dummy implementation
+ obp-ticks @ 0<> if
+ obp-ticks @
+ else
+ dummy-msecs dup 1+ to dummy-msecs
+ then
;
-[THEN]
-
: ms ( n -- )
get-msecs +
begin dup get-msecs < until