[OpenBIOS] [commit] r1264 - in trunk/openbios-devel: arch/sparc32 forth/device

repository service svn at openbios.org
Sun Feb 16 17:26:32 CET 2014


Author: mcayland
Date: Sun Feb 16 17:26:31 2014
New Revision: 1264
URL: http://tracker.coreboot.org/trac/openbios/changeset/1264

Log:
SPARC32: implement Forth get-msecs word

Switch obp_ticks over to be a pointer to the counter rather than its value, then
point this to the contents of a new Forth obp-ticks variable. This allows a
simple get-msecs word to be implemented for SPARC32 which simply reads the value
of the obp-ticks variable and places it on the stack.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/arch/sparc32/romvec.c
   trunk/openbios-devel/arch/sparc32/romvec.h
   trunk/openbios-devel/arch/sparc32/vectors.S
   trunk/openbios-devel/forth/device/other.fs

Modified: trunk/openbios-devel/arch/sparc32/romvec.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/romvec.c	Sun Feb 16 17:26:28 2014	(r1263)
+++ trunk/openbios-devel/arch/sparc32/romvec.c	Sun Feb 16 17:26:31 2014	(r1264)
@@ -449,7 +449,7 @@
   dstackcnt = dstacktmp;
 }
 
-volatile uint32_t obp_ticks;
+volatile uint32_t *obp_ticks;
 
 void *
 init_openprom(void)
@@ -482,9 +482,11 @@
     romvec0.pv_printf = obp_printf_handler;
     romvec0.pv_abort = obp_abort_handler;
     
-    /* Reset the tick counter */
-    obp_ticks = 0;
-    romvec0.pv_ticks = &obp_ticks;
+    /* Point to the Forth obp-ticks variable and reset */
+    fword("obp-ticks");
+    obp_ticks = cell2pointer(POP());
+    *obp_ticks = 0;
+    romvec0.pv_ticks = obp_ticks;
     
     romvec0.pv_halt = obp_halt_handler;
     romvec0.pv_synchook = &sync_hook;

Modified: trunk/openbios-devel/arch/sparc32/romvec.h
==============================================================================
--- trunk/openbios-devel/arch/sparc32/romvec.h	Sun Feb 16 17:26:28 2014	(r1263)
+++ trunk/openbios-devel/arch/sparc32/romvec.h	Sun Feb 16 17:26:31 2014	(r1264)
@@ -2,7 +2,7 @@
  * romvec main C function and handler declarations
  */
 
-extern volatile uint32_t obp_ticks;
+extern volatile uint32_t *obp_ticks;
 void *init_openprom(void);
 
 int obp_devopen(char *str);

Modified: trunk/openbios-devel/arch/sparc32/vectors.S
==============================================================================
--- trunk/openbios-devel/arch/sparc32/vectors.S	Sun Feb 16 17:26:28 2014	(r1263)
+++ trunk/openbios-devel/arch/sparc32/vectors.S	Sun Feb 16 17:26:31 2014	(r1264)
@@ -208,9 +208,10 @@
         ld      [%l7 + %lo(counter_regs)], %l7
         ld      [%l7], %g0
         sethi   %hi(obp_ticks), %l7
-        ld      [%l7 + %lo(obp_ticks)], %l6
+        ld      [%l7 + %lo(obp_ticks)], %l7
+        ld      [%l7], %l6
         add     %l6, 10, %l6
-        st      %l6, [%l7 + %lo(obp_ticks)]
+        st      %l6, [%l7]
         jmp     %l1
          rett  %l2
 

Modified: trunk/openbios-devel/forth/device/other.fs
==============================================================================
--- trunk/openbios-devel/forth/device/other.fs	Sun Feb 16 17:26:28 2014	(r1263)
+++ trunk/openbios-devel/forth/device/other.fs	Sun Feb 16 17:26:31 2014	(r1264)
@@ -93,12 +93,25 @@
  
 \ 5.3.7.3 Time
 
+[IFDEF] CONFIG_SPARC32
+
+\ OBP tick value updated by timer interrupt
+variable obp-ticks
+
+: get-msecs    ( -- n )
+  obp-ticks @
+  ;
+
+[ELSE]
+
 0 value dummy-msecs
 
 : get-msecs    ( -- n )
   dummy-msecs dup 1+ to dummy-msecs
   ;
-  
+
+[THEN]
+
 : ms    ( n -- )
   get-msecs +
   begin dup get-msecs < until



More information about the OpenBIOS mailing list