[openfirmware] r1191 - clients/memtest86 cpu/x86/pc/biosload cpu/x86/pc/olpc cpu/x86/pc/olpc/build cpu/x86/pc/olpc/via cpu/x86/pc/olpc/via/build

svn at openfirmware.info svn at openfirmware.info
Thu May 14 09:48:27 CEST 2009


Author: wmb
Date: 2009-05-14 09:48:27 +0200 (Thu, 14 May 2009)
New Revision: 1191

Added:
   clients/memtest86/olpcvia.c
Modified:
   clients/memtest86/Makefile
   clients/memtest86/config.h
   clients/memtest86/memsize.c
   cpu/x86/pc/biosload/fw.bth
   cpu/x86/pc/biosload/ofw.bth
   cpu/x86/pc/olpc/build/Makefile
   cpu/x86/pc/olpc/olpc.bth
   cpu/x86/pc/olpc/via/build/Makefile
   cpu/x86/pc/olpc/via/fw.bth
   cpu/x86/pc/olpc/via/olpc.bth
   cpu/x86/pc/olpc/via/smbus.fth
Log:
memtest - Made memtest86 work on the Via demo board.




Modified: clients/memtest86/Makefile
===================================================================
--- clients/memtest86/Makefile	2009-05-14 07:45:40 UTC (rev 1190)
+++ clients/memtest86/Makefile	2009-05-14 07:48:27 UTC (rev 1191)
@@ -8,28 +8,51 @@
 #
 FDISK=/dev/fd0
 
+DEFINES =
+
+#
+# We tune the build for different platforms by passing arguments to make, e.g.
+#   make VARIANT=_VIA memtest
+# 
+ifeq ($(VARIANT), OLPCVIA)
+    DEFINES += -DOLPC
+    DEFINES += -DSZ_MODE_EXT=SZ_MODE_BIOS
+endif
+
+ifeq ($(VARIANT), OLPCGEODE)
+    DEFINES += -DOLPC
+    DEFINES += -DEMULATE_EGA
+    DEFINES += -DSZ_MODE_EXT=SZ_MODE_PROBE
+endif
+
 CC=gcc
 #
 # gcc compiler options, these settings should suffice
 #
 CCFLAGS=-Wall -march=i486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffreestanding 
 CCFLAGS += -fno-stack-protector
+CCFLAGS += $(DEFINES)
 
+
 AS=as -32
 
 COMMON_OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o config.o memsize.o random.o
 
-PC_OBJS= $(COMMON_OBJS) linuxbios.o pci.o controller.o extra.o spd.o
+OBJS_PC= $(COMMON_OBJS) linuxbios.o pci.o controller.o extra.o spd.o
 
-OLPC_OBJS= $(COMMON_OBJS) lfbega.o olpc.o
+OBJS_OLPCGEODE= $(COMMON_OBJS) olpc.o    lfbega.o 
+OBJS_OLPCVIA  = $(COMMON_OBJS) olpcvia.o linuxbios.o 
 
-OBJS= $(OLPC_OBJS)
+OBJS= $(OBJS_$(VARIANT))
 
 all: memtest.bin memtest
 
 olpc.o: olpc.c msr.h
 	$(CC) -c $(CCFLAGS) -fPIC olpc.c
 
+olpcvia.o: olpcvia.c
+	$(CC) -c $(CCFLAGS) -fPIC olpcvia.c
+
 reloc.o: reloc.c
 	$(CC) -c -m32 -fPIC -Wall -O -fno-strict-aliasing reloc.c
 
@@ -82,7 +105,7 @@
 	$(CC) -S $(CCFLAGS) -fPIC controller.c
 
 head.s: head.S
-	$(CC) -E -m32 -traditional $< -o $@
+	$(CC) $(DEFINES) -E -m32 -traditional $< -o $@
 
 head.o: head.s
 	$(AS) -o $@ $<

Modified: clients/memtest86/config.h
===================================================================
--- clients/memtest86/config.h	2009-05-14 07:45:40 UTC (rev 1190)
+++ clients/memtest86/config.h	2009-05-14 07:48:27 UTC (rev 1191)
@@ -13,7 +13,7 @@
 /* SERIAL_CONSOLE_DEFAULT -  The default state of the serial console. */
 /*	This is normally off since it slows down testing.  Change to a 1 */
 /*	to enable. */
-#define SERIAL_CONSOLE_DEFAULT 0
+#define SERIAL_CONSOLE_DEFAULT 1
 
 /* SERIAL_BAUD_RATE - Baud rate for the serial console
  * If this is not defined it is assumed a previous program has set the
@@ -39,9 +39,9 @@
 /* EMULATE_EGA - Enables EGA emulation instead of writing to EGA buffer directly */
 /*      Normally not enabled */
 /*      Enabled for OLPC */
-#define EMULATE_EGA
+/* #define EMULATE_EGA */
 
 /* OLPC - uses OLPC hardware instead of BIOS */
 /*      Normally not enabled */
 /*      Enabled for OLPC */
-#define OLPC
+/* #define OLPC */

Modified: clients/memtest86/memsize.c
===================================================================
--- clients/memtest86/memsize.c	2009-05-14 07:45:40 UTC (rev 1190)
+++ clients/memtest86/memsize.c	2009-05-14 07:48:27 UTC (rev 1191)
@@ -9,8 +9,8 @@
 #include "config.h"
 
 short e820_nr;
-short memsz_mode = SZ_MODE_PROBE;
 short firmware = FIRMWARE_UNKNOWN;
+short memsz_mode = SZ_MODE_EXT;
 
 static ulong alt_mem_k;
 static ulong ext_mem_k;

Added: clients/memtest86/olpcvia.c
===================================================================
--- clients/memtest86/olpcvia.c	                        (rev 0)
+++ clients/memtest86/olpcvia.c	2009-05-14 07:48:27 UTC (rev 1191)
@@ -0,0 +1,43 @@
+#include "io.h"
+
+#include "test.h"
+#include "defs.h"
+#include "config.h"
+
+void poll_errors(void)
+{
+}
+void set_ecc_polling(int val)
+{
+}
+void show_spd(void)
+{
+}
+void get_menu(void)
+{
+}
+void find_controller(void)
+{
+}
+int pci_init(void)
+{
+    return 0;
+}
+void warm_start()
+{
+    outb(0,0x92);
+    outb(1,0x92);
+//    wrmsr(0x51400017, 1, 0);
+}
+// int query_linuxbios(void)
+// {
+//     return 1;
+// }
+int query_pcbios(void)
+{
+    return 0;
+}
+// int query_ofw(void)
+// {
+//     return 1;
+// }

Modified: cpu/x86/pc/biosload/fw.bth
===================================================================
--- cpu/x86/pc/biosload/fw.bth	2009-05-14 07:45:40 UTC (rev 1190)
+++ cpu/x86/pc/biosload/fw.bth	2009-05-14 07:48:27 UTC (rev 1191)
@@ -305,6 +305,10 @@
 devalias net /wlan
 [then]
 
+[ifdef] via-demo
+fload ${BP}/cpu/x86/pc/biosload/memtest.fth
+[then]
+
 : probe-all  ( -- )
    " probe-" do-drop-in
    ." probe-pci"  cr

Modified: cpu/x86/pc/biosload/ofw.bth
===================================================================
--- cpu/x86/pc/biosload/ofw.bth	2009-05-14 07:45:40 UTC (rev 1190)
+++ cpu/x86/pc/biosload/ofw.bth	2009-05-14 07:48:27 UTC (rev 1191)
@@ -99,6 +99,8 @@
    " ${BP}/dev/mmc/sdhci/mv8686/build/mv8686.fc" " mv8686"         $add-deflated-dropin
    " sd8686_helper.bin"                         " helper_sd.bin"   $add-deflated-dropin
    " sd8686.bin"                                " sd8686.bin"      $add-deflated-dropin
+
+   " ../../olpc/via/build/memtest"              " memtest"       $add-deflated-dropin
 [else]
    " ${BP}/dev/mmc/sdhci/build/sdhci.fc"        " class080501"     $add-deflated-dropin
    " ${BP}/dev/mmc/sdhci/build/sdmmc.fc"        " sdmmc"           $add-deflated-dropin

Modified: cpu/x86/pc/olpc/build/Makefile
===================================================================
--- cpu/x86/pc/olpc/build/Makefile	2009-05-14 07:45:40 UTC (rev 1190)
+++ cpu/x86/pc/olpc/build/Makefile	2009-05-14 07:48:27 UTC (rev 1191)
@@ -3,7 +3,7 @@
 BASEDIR= `(cd ../../../../..; pwd;)`
 TAGFILES= ../../../build/*.tag *.tag
 CLIENTDIR=../../../../../clients
-CLIENTPROGS=${CLIENTDIR}/memtest86/memtest ${CLIENTDIR}/emacs/x86/emacs
+CLIENTPROGS=memtest ${CLIENTDIR}/emacs/x86/emacs
 
 all: olpc.rom tags
 
@@ -24,8 +24,10 @@
 ../../../build/inflate.bin:
 	@make -C ../../../build inflate.bin
 
-${CLIENTDIR}/memtest86/memtest:
-	@make -C ${CLIENTDIR}/memtest86 memtest
+memtest:
+	make -C ${CLIENTDIR}/memtest86 VARIANT=OLPCGEODE memtest
+	@mv ${CLIENTDIR}/memtest86/memtest .
+	@make -C ${CLIENTDIR}/memtest86 clean
 
 ${CLIENTDIR}/emacs/x86/emacs:
 	@make -C ${CLIENTDIR}/emacs/x86 emacs

Modified: cpu/x86/pc/olpc/olpc.bth
===================================================================
--- cpu/x86/pc/olpc/olpc.bth	2009-05-14 07:45:40 UTC (rev 1190)
+++ cpu/x86/pc/olpc/olpc.bth	2009-05-14 07:48:27 UTC (rev 1191)
@@ -22,7 +22,7 @@
 in: ${BP}/dev/usb2/device/wlan/build/usb8388.fc
 in: ${BP}/dev/olpc/cafenand/build/cafenand.fc
 in: ${BP}/dev/olpc/cafecamera/build/cafecamera.fc
-in: ${BP}/clients/memtest86/memtest
+in: memtest
 in: ${BP}/clients/emacs/x86/emacs
 in: ${BP}/cpu/x86/pc/olpc/build/verify.img
 in: ${BP}/cpu/x86/pc/olpc/build/usb8388.bin
@@ -68,7 +68,7 @@
    fload ${BP}/cpu/x86/pc/olpc/loaddropins.fth
    " sourceurl"   " sourceurl"                    $add-dropin
 
-   " ${BP}/clients/memtest86/memtest"               " memtest"  $add-deflated-dropin
+   " memtest"                                        " memtest"  $add-deflated-dropin
 \   " ${BP}/cpu/x86/pc/olpc/images/olpc16EQima.wav"  " splash"   $add-deflated-dropin
 \   " ${BP}/cpu/x86/pc/olpc/images/Edge1-16k-EQ-Comp-Amp-ima.wav"  " splash"   $add-deflated-dropin
    " ${BP}/cpu/x86/pc/olpc/images/Edge1-8k-EQ-Comp-Amp-Short.wav"  " splash"   $add-deflated-dropin

Modified: cpu/x86/pc/olpc/via/build/Makefile
===================================================================
--- cpu/x86/pc/olpc/via/build/Makefile	2009-05-14 07:45:40 UTC (rev 1190)
+++ cpu/x86/pc/olpc/via/build/Makefile	2009-05-14 07:48:27 UTC (rev 1191)
@@ -4,7 +4,7 @@
 BASEDIR := $(shell cd ${CPUDIR}/../..; pwd;)
 TAGFILES= ${CPUDIR}/build/*.tag *.tag
 CLIENTDIR=${BASEDIR}/clients
-CLIENTPROGS=${CLIENTDIR}/memtest86/memtest ${CLIENTDIR}/emacs/x86/emacs
+CLIENTPROGS=memtest ${CLIENTDIR}/emacs/x86/emacs
 
 all: olpc.rom tags
 
@@ -25,8 +25,10 @@
 ${CPUDIR}/build/inflate.bin:
 	@make -C ${CPUDIR}/build inflate.bin
 
-${CLIENTDIR}/memtest86/memtest:
-	@make -C ${CLIENTDIR}/memtest86 memtest
+memtest:
+	make -C ${CLIENTDIR}/memtest86 VARIANT=OLPCVIA memtest
+	@mv ${CLIENTDIR}/memtest86/memtest .
+	@make -C ${CLIENTDIR}/memtest86 clean
 
 ${CLIENTDIR}/emacs/x86/emacs:
 	@make -C ${CLIENTDIR}/emacs/x86 emacs

Modified: cpu/x86/pc/olpc/via/fw.bth
===================================================================
--- cpu/x86/pc/olpc/via/fw.bth	2009-05-14 07:45:40 UTC (rev 1190)
+++ cpu/x86/pc/olpc/via/fw.bth	2009-05-14 07:48:27 UTC (rev 1191)
@@ -301,7 +301,6 @@
 fload ${BP}/ofw/core/bailout.fth
 
 [ifdef] Later
-[ifdef] olpc
 \ GUI
 false value gui-safeboot?
 
@@ -312,13 +311,11 @@
 true value user-mode?
 
 fload ${BP}/cpu/x86/pc/olpc/banner.fth
-[then]
 
 fload ${BP}/ofw/gui/loadmenu.fth
 fload ${BP}/cpu/x86/pc/olpc/disptest.fth
 \ fload ${BP}/ofw/gui/insticon.fth
 
-[ifdef] olpc
 : setup-for-linux  ( -- )
    [ ' linux-hook behavior compile, ]    \ Chain to old behavior
    vpci-devices-on   \ Do this after quieting USB
@@ -339,14 +336,16 @@
 \ fload ${BP}/cpu/x86/pc/olpc/carousel.fth     \ Carouseled NAND writing
 fload ${BP}/cpu/x86/pc/olpc/crypto.fth       \ Cryptographic image validation
 fload ${BP}/cpu/x86/pc/olpc/lzip.fth         \ Access zip images from memory
+
 fload ${BP}/cpu/x86/pc/olpc/gamekeys.fth
-fload ${BP}/cpu/x86/pc/olpc/memtest.fth
+[then]
 
 : emacs  ( -- )
    false to already-go?
    boot-getline to boot-file   " rom:emacs" $boot
 ;
 
+[ifdef] Later
 fload ${BP}/cpu/x86/pc/rmtools.fth
 fload ${BP}/dev/geode/smi.fth
 fload ${BP}/cpu/x86/pc/olpc/acpi.fth
@@ -362,7 +361,7 @@
 fload ${BP}/cpu/x86/pc/olpc/sound.fth
 [ifdef] wlan-wackup
 fload ${BP}/cpu/x86/pc/olpc/wlantest.fth
-[then]
+
 fload ${BP}/cpu/x86/pc/olpc/rtcwake.fth
 ' gx-power-off to power-off
 [then]
@@ -469,6 +468,8 @@
    fload ${BP}/ofw/inet/http.fth	\ HTTP client
 end-support-package
 
+fload ${BP}/cpu/x86/pc/olpc/via/memtest.fth
+
 [ifdef] Later
 fload ${BP}/ofw/wifi/wifi-cfg.fth
 support-package: supplicant

Modified: cpu/x86/pc/olpc/via/olpc.bth
===================================================================
--- cpu/x86/pc/olpc/via/olpc.bth	2009-05-14 07:45:40 UTC (rev 1190)
+++ cpu/x86/pc/olpc/via/olpc.bth	2009-05-14 07:48:27 UTC (rev 1191)
@@ -29,7 +29,9 @@
 \ in: ${BP}/cpu/x86/pc/olpc/via/build/dsdt.aml
 \ in: ${BP}/cpu/x86/pc/olpc/via/build/mcastnand.bin
 \ in: ${BP}/dev/hdaudio/build/hdaudio.fc
+in: sd8686.bin
 
+
 build-now
 
 fload ${BP}/cpu/x86/pc/olpc/via/versions.fth
@@ -94,17 +96,20 @@
    " ${BP}/dev/mmc/sdhci/build/sdhci2.fc"        " class080501"   $add-deflated-dropin
    " ${BP}/dev/mmc/sdhci/build/sdmmc.fc"         " sdmmc"         $add-deflated-dropin
    " ${BP}/dev/mmc/sdhci/mv8686/build/mv8686.fc" " mv8686"        $add-deflated-dropin
+   " sd8686_helper.bin"                          " helper_sd.bin" $add-deflated-dropin
+   " sd8686.bin"                                 " sd8686.bin"    $add-deflated-dropin
+
    " builton.fth"                       " probe-"          $add-dropin
 
    " ${BP}/clients/emacs/x86/emacs"             " emacs"         $add-deflated-dropin
    " ${BP}/clients/emacs/x86/emacs.rc"          " emacs.rc"      $add-deflated-dropin
    " ${BP}/clients/emacs/emacs.hlp"             " emacs.hlp"     $add-deflated-dropin
 
+   " ${BP}/ofw/fcode/memtest.fth"  " memtest.fth"          $add-deflated-dropin
+
 [ifdef] Later
    " ${BP}/dev/hdaudio/build/hdaudio.fc"         " class040300"   $add-deflated-dropin
 
-   " ${BP}/ofw/fcode/memtest.fth"  " memtest.fth"          $add-deflated-dropin
-
    " ${BP}/ofw/inet/telnetd.fth"          " telnetd"             $add-deflated-dropin
 
 \    " ${BP}/cpu/x86/pc/olpc/images/warnings.565"  " warnings.565"  $add-deflated-dropin
@@ -135,6 +140,8 @@
    " ${BP}/ofw/termemu/cp881-16.obf"            " pcfont"        $add-deflated-dropin
 [then]
 
+   " memtest"                                   " memtest"       $add-deflated-dropin
+
 [ifdef] Later
    " verify.img"                                " verify"        $add-deflated-dropin
    " os.public"                                 " ospubkey"      $add-dropin \ Incompressible
@@ -145,7 +152,6 @@
 
    " sourceurl"   " sourceurl"                    $add-dropin
 
-   " ${BP}/clients/memtest86/memtest"               " memtest"  $add-deflated-dropin
    " ${BP}/cpu/x86/pc/olpc/images/Edge1-8k-EQ-Comp-Amp-Short.wav"  " splash"   $add-deflated-dropin
    " ${BP}/cpu/x86/pc/olpc/via/build/dsdt.aml"      " dsdt"            $add-deflated-dropin
 \  " ${BP}/cpu/x86/pc/olpc/via/build/ssdt.aml"      " ssdt"            $add-deflated-dropin

Modified: cpu/x86/pc/olpc/via/smbus.fth
===================================================================
--- cpu/x86/pc/olpc/via/smbus.fth	2009-05-14 07:45:40 UTC (rev 1190)
+++ cpu/x86/pc/olpc/via/smbus.fth	2009-05-14 07:48:27 UTC (rev 1191)
@@ -1,9 +1,11 @@
 purpose: Driver for SMBUS controller in Via chipset
 \ See license at end of file
 
-: smb-reg@  ( reg# -- value )  smbus-io-base + pc@  ;
-: smb-reg!  ( value reg# -- )  smbus-io-base + pc!  ;
+0 value smbus-port
 
+: smb-reg@  ( reg# -- value )  smbus-port + pc@  ;
+: smb-reg!  ( value reg# -- )  smbus-port + pc!  ;
+
 0 value smbus-target
 
 \ Register 1 is slave status; we don't use it
@@ -33,12 +35,11 @@
    smbus-wait             ( )
    smb-hoststat@          ( stat )
    dup h# 9c and  if      ( stat )
-      ." SMBUS error:"    ( stat )
-      dup h# 80 and  if  ."  PEC"                   then
-      dup h# 10 and  if  ."  FailedBusTransaction"  then
-      dup h# 08 and  if  ."  Collision"             then
-      dup h# 04 and  if  ."  DeviceError"           then
-      cr                  ( stat )
+      dup h# 80 and  abort" SMBUS error: PEC"                   
+      dup h# 10 and  abort" SMBUS error: FailedBusTransaction"
+      dup h# 08 and  abort" SMBUS error: Collision"
+      dup h# 04 and  abort" SMBUS error: DeviceError"
+      drop
    then                   ( stat )
    drop                   ( )
    h# 9e smb-hoststat!    ( )  \ Clear all status bits
@@ -95,6 +96,7 @@
    smb-hostdata0!              ( )
    h# c smbus-cmd              ( )   \ Word data command
 ;
+
 : smbus-w@  ( offset -- word )
    smbus-target 1 or smb-xmitadr!  ( offset )
    smb-hostcmd!                    ( )
@@ -107,7 +109,7 @@
 
 : enable-smbus  ( -- )
    h# 8894 config-b@  h# 80 invert and  h# 8894 config-b!  \ Clock from 14 MHz divider
-   smbus-io-base 1 or  h# 88d0 config-w!
+\  smbus-io-base 1 or  h# 88d0 config-w!  \ Assume already set up
    5 h# 88d2 config-b!   \ Clock source (bit meaning is unclear), enable SMBUS HC
    3 h# 8804 config-w!   \ Enable in PCI command register
    smbus-release
@@ -118,7 +120,33 @@
    smbus-b@
    smbus-release
 ;
+: dump-dimm  ( dimm# -- )
+   h# 80 0  do
+     i 2 u.r  ." : "
+     i 10 bounds do
+        i over get-spd-data 3 u.r
+     loop
+     cr
+   h# 10 +loop
+;
+: dump-dimms  ( -- )
+   2 0 do
+      0 i ['] get-spd-data catch  if  ( x x )
+         2drop
+      else    ( byte )
+         drop
+         ." DIMM# " i . cr
+         i dump-dimm
+      then
+   loop
+;
 
+stand-init: SMBUS
+   enable-smbus
+   h# 88d0 config-w@ h# fff0 and  to smbus-port
+;
+
+
 \ LICENSE_BEGIN
 \ Copyright (c) 2009 FirmWorks
 \ 




More information about the openfirmware mailing list