[openfirmware] r918 - cpu/x86/pc/neptune dev/geode

svn at openfirmware.info svn at openfirmware.info
Wed Sep 3 00:45:08 CEST 2008


Author: wmb
Date: 2008-09-03 00:45:08 +0200 (Wed, 03 Sep 2008)
New Revision: 918

Modified:
   cpu/x86/pc/neptune/banner.fth
   cpu/x86/pc/neptune/devices.fth
   dev/geode/msr.fth
Log:
Neptune - auto-detect PCI, CPU, and memory speeds in stand-init.




Modified: cpu/x86/pc/neptune/banner.fth
===================================================================
--- cpu/x86/pc/neptune/banner.fth	2008-09-02 21:20:06 UTC (rev 917)
+++ cpu/x86/pc/neptune/banner.fth	2008-09-02 22:45:08 UTC (rev 918)
@@ -3,25 +3,13 @@
 
 headerless
 
-: geode-print-pll ( -- )
-   ." Geode CPU Speed "
-   h# 4c00.0014 rdmsr swap drop
-   h# 3E and 2/
-   1 + d# 66 * 2/ decimal . cr
-
-   ." GeodeLink Speed "
-   h# 4c00.0014 rdmsr swap drop
-   h# FFF and 7 >>
-   1 + d# 66 * 2/ decimal . cr
-
-   ." PCI Speed "
-   h# 4c00.0014 rdmsr drop
-   1 7 << and
-   0= if d# 33 . else d# 66 . then cr
-
-   hex
+: show-speeds  ( -- )
+   \ Round so the numbers come out the way they are conventionally cited
+   ." CPU "     cpu-speed d# 1,000,000 rounded-/ .d  ." MHz, "
+   ." Memory "   gl-speed d# 1,000,000         / .d  ." MHz, "
+   ." PCI "     pci-speed d# 1,000,000         / .d  ." MHz" cr
 ;
-' geode-print-pll to banner-extras
+' show-speeds to banner-extras
 
 : .rom  ( -- )
    ." OpenFirmware  "
@@ -34,8 +22,7 @@
 ;
 
 : (xbanner-basics)  ( -- )
-   ?spaces  cpu-model type  ." , "   .memory  cr
-   ?spaces  .rom cr
+   ?spaces  cpu-model type  ." , "   .memory  ." , "  .rom cr
 ;
 ' (xbanner-basics) to banner-basics
 

Modified: cpu/x86/pc/neptune/devices.fth
===================================================================
--- cpu/x86/pc/neptune/devices.fth	2008-09-02 21:20:06 UTC (rev 917)
+++ cpu/x86/pc/neptune/devices.fth	2008-09-02 22:45:08 UTC (rev 918)
@@ -26,11 +26,9 @@
 
 \ Use the CPU chip's Time Stamp Counter for timing; it does just what we want
 fload ${BP}/cpu/x86/tsc.fth
-\ d# 366,666 to ms-factor  \ XXX is this right????
-\ d# 367 to us-factor
 
 stand-init:
-   d# 366,666,667  " AMD,Geode LX"
+   cpu-speed  " AMD,Geode LX"
 
    " /cpu" find-device                                  ( cpu-clock-hz model$ )
       " model" string-property                          ( cpu-clock-hz )
@@ -300,7 +298,7 @@
 
 stand-init: PCI properties
    " /pci" find-device
-   d# 66,666,667  " clock-frequency" integer-property
+   pci-speed  " clock-frequency" integer-property
    dend
 ;
 
@@ -339,6 +337,7 @@
 \ XXX perhaps report subordinate version info?
       " Neptune"  model
       " Dave Neptune" " banner-name" string-property
+      gl-speed " clock-frequency" integer-property
    dend
 
    " /openprom" find-device

Modified: dev/geode/msr.fth
===================================================================
--- dev/geode/msr.fth	2008-09-02 21:20:06 UTC (rev 917)
+++ dev/geode/msr.fth	2008-09-02 22:45:08 UTC (rev 918)
@@ -81,6 +81,23 @@
 : usb-base-off  ( msr# -- )  0. rot  msr!  ;
 : usb-kel-off   ( msr# -- )  0. rot  msr!  ;
 
+: pci-speed  ( -- hz )
+   h# 4c00.0014 rdmsr drop    ( low )
+   1 7 << and  if  d# 66,666,667  else d# 33,333,333  then
+;
+: gl-speed  ( -- hz )
+   pci-speed                         ( hz )
+   h# 4c00.0014 rdmsr  nip >r        ( hz r: high )
+   r@ 6 rshift 1 and  if  2/  then   ( hz' r: high )
+   r> 7 rshift h# 1f and 1+ *        ( hz' )
+;
+: cpu-speed  ( -- hz )
+   pci-speed                         ( hz )
+   h# 4c00.0014 rdmsr  nip >r        ( hz r: high )
+   r@ 1 and  if  2/  then            ( hz' r: high )
+   r> 1 rshift h# 1f and 1+ *        ( hz' )
+;
+
 \ LICENSE_BEGIN
 \ Copyright (c) 2008 FirmWorks
 \ 




More information about the openfirmware mailing list