Author: wmb
Date: 2008-09-02 04:45:16 +0200 (Tue, 02 Sep 2008)
New Revision: 912
Modified:
cpu/x86/pc/neptune/addrs.fth
cpu/x86/pc/neptune/banner.fth
cpu/x86/pc/neptune/build/Makefile
cpu/x86/pc/neptune/devices.fth
cpu/x86/pc/neptune/fw.bth
cpu/x86/pc/neptune/neptune.bth
Log:
Neptune - fixes to support FPGA programming; also big cleanup
of "startup" to eliminate OLPC-centric UI stuff, aligning the
Neptune startup sequence with the conventional OFW
"probe-all,install-console,banner" sequence.
Modified: cpu/x86/pc/neptune/addrs.fth
===================================================================
--- cpu/x86/pc/neptune/addrs.fth 2008-09-02 02:34:47 UTC (rev 911)
+++ cpu/x86/pc/neptune/addrs.fth 2008-09-02 02:45:16 UTC (rev 912)
@@ -11,6 +11,14 @@
dropin-base h# 20 + constant ResetBase \ Location of "reset" dropin in ROM
+h# ffe0.0000 constant rom1-pa \ Secondary ROM (FLASH) on dongle
+
+h# ff80.0000 constant lpc-pa \ Extra stuff decoded by LPC FLASH chips
+h# 60.0000 constant /lpc \ Space to reserve for LPC stuff
+
+h# ffbc.0100 constant lpc-gpi0-pa \ GPI port for LPC FLASH 0
+h# ffac.0100 constant lpc-gpi1-pa \ GPI port for LPC FLASH 1
+
\ Firmware reflash parameters
h# 8.0000 constant fw-offset \ Where to start reflashing
h# 8.0000 constant /fw-reflash \ Expected size of a reflash image
@@ -40,10 +48,6 @@
h# 80.0000 constant fb-size
-\ If you change these, also change {g/l}xmsrs.fth and {g/l}xearly.fth
-h# fd00.0000 constant fw-map-base
-h# ffc0.0000 constant fw-map-limit
-
h# fd00.0000 constant fb-pci-base
h# fe00.0000 constant gp-pci-base
h# fe00.4000 constant dc-pci-base
@@ -57,11 +61,19 @@
h# fe02.8000 constant camera-pci-base
h# fe02.c000 constant uoc-pci-base
+\ These two are used when running in physical mode, to delimit
+\ a set of v=p mappings that we create just before invoking Linux.
+h# fd00.0000 constant fw-map-base
+h# ffc0.0000 constant fw-map-limit
+
fload ${BP}/cpu/x86/pc/virtaddr.fth
-[ifndef] virtual-mode
-h# fec0.0000 to fw-virt-base \ Override the usual setting; we use an MSR to double-map some memory up high
+
+\ Override the usual fw-virt-base setting.
+\ There's some LPC stuff in the way of the normal OFW virtual address ff80.0000
+\ And if we are running in physical mode, we use an MSR to double-map some memory up high
+
+h# ff40.0000 to fw-virt-base
h# 40.0000 to fw-virt-size
-[then]
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
Modified: cpu/x86/pc/neptune/banner.fth
===================================================================
--- cpu/x86/pc/neptune/banner.fth 2008-09-02 02:34:47 UTC (rev 911)
+++ cpu/x86/pc/neptune/banner.fth 2008-09-02 02:45:16 UTC (rev 912)
@@ -3,6 +3,26 @@
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
+;
+' geode-print-pll to banner-extras
+
: .rom ( -- )
." OpenFirmware "
push-decimal
@@ -14,22 +34,14 @@
;
: (xbanner-basics) ( -- )
- ?spaces cpu-model type ." , " .memory
- ?spaces .rom
+ ?spaces cpu-model type ." , " .memory cr
+ ?spaces .rom cr
;
' (xbanner-basics) to banner-basics
' (banner-warnings) to banner-warnings
-: stop-auto? ( -- flag ) idprom-valid? 0= auto-boot? and ;
-defer gui-banner ' true to gui-banner
-: ?gui-banner ( -- )
- stop-auto? if suppress-auto-boot then
-
- gui-banner drop
-;
-
headers
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
Modified: cpu/x86/pc/neptune/build/Makefile
===================================================================
--- cpu/x86/pc/neptune/build/Makefile 2008-09-02 02:34:47 UTC (rev 911)
+++ cpu/x86/pc/neptune/build/Makefile 2008-09-02 02:45:16 UTC (rev 912)
@@ -1,8 +1,17 @@
OS := $(shell uname)
+BASEDIR= `(cd ../../../../..; pwd;)`
+TAGFILES= ../../../build/*.tag *.tag
+CLIENTDIR=../../../../../clients
+CLIENTPROGS=${CLIENTDIR}/memtest86/memtest
-all: neptune.rom
+all: neptune.rom tags
-neptune.rom: FORCE build ../../../build/inflate.bin ../../../../../clients/memtest86/memtest
+fw.tag: neptune.rom
+
+tags: fw.tag
+ @${BASEDIR}/forth/lib/toctags ${BASEDIR} ${TAGFILES}
+
+neptune.rom: FORCE build ../../../build/inflate.bin ${CLIENTPROGS}
./build $@
../../../${OS}/forth:
@@ -11,8 +20,8 @@
../../../build/inflate.bin:
@make -C ../../../build inflate.bin
-../../../../../clients/memtest86/memtest:
- @make -C ../../../../../clients/memtest86 memtest
+${CLIENTDIR}/memtest86/memtest:
+ @make -C ${CLIENTDIR}/memtest86 memtest
build: ../../../${OS}/forth
@ln -sf ../../../${OS}/forth build
@@ -24,5 +33,6 @@
@make -C ../../../build clean
@make -C ../../../${OS} clean
@make -C ../../../../../clients/memtest86 clean
+ @make -C ../../../../../clients/ispvme clean
.PHONY: FORCE clean all clean-all
Modified: cpu/x86/pc/neptune/devices.fth
===================================================================
--- cpu/x86/pc/neptune/devices.fth 2008-09-02 02:34:47 UTC (rev 911)
+++ cpu/x86/pc/neptune/devices.fth 2008-09-02 02:45:16 UTC (rev 912)
@@ -340,7 +340,7 @@
root-device
\ XXX perhaps report subordinate version info?
" Neptune" model
- " Neptune" " banner-name" string-property
+ " Dave Neptune" " banner-name" string-property
dend
" /openprom" find-device
Modified: cpu/x86/pc/neptune/fw.bth
===================================================================
--- cpu/x86/pc/neptune/fw.bth 2008-09-02 02:34:47 UTC (rev 911)
+++ cpu/x86/pc/neptune/fw.bth 2008-09-02 02:45:16 UTC (rev 912)
@@ -6,6 +6,7 @@
in: builton.fth
build-now
+" fw.tag" r/w create-file drop tag-file !
hex
\ ' $report-name is include-hook
@@ -193,14 +194,19 @@
[ifdef] virtual-mode
fload ${BP}/cpu/x86/pc/mmusetup.fth \ Initial values for MMU lists
-\ XXX check me
-\ dev /mmu
-\ : claim-rom ( -- )
-\ (initial-claim)
-\ rom-pa h# ffff.0000 over - claim-virtual drop \ ROM 1-1 map
-\ ;
-\ ' claim-rom to initial-claim
-\ dend
+dev /mmu
+
+\ The LPC FLASH chips decode several addresses below the FLASH "memory" array,
+\ for "registers" used for programming and access to general purpose inputs.
+\ The FPGA programming program wants to access the GPI register at virtual
+\ address = physical address, so we pre-claim that range of virtual addresses.
+
+: claim-lpc ( -- )
+ (initial-claim)
+ lpc-pa /lpc claim-virtual drop \ Space for 1-1 mapping LPC GPIO stuff
+;
+' claim-lpc to initial-claim
+dend
[then]
: background-rgb ( -- r g b ) h# ff h# ff h# ff ;
@@ -226,7 +232,7 @@
h# 3ea constant usb-port-power-map \ USB4:PWR2 USB3:PWR1 USB2:PWR1 USB1:PWR1
fload ${BP}/dev/geode/usb.fth
-\ ' noop to go-hook \ this is required for accessing USB device from client program (e.g. VME)
+' noop to go-hook \ this is required for accessing USB device from client program (e.g. VME)
\ false to stand-init-debug?
true to stand-init-debug?
@@ -274,24 +280,20 @@
' (.firmware) to .firmware
: probe-all ( -- )
- probe-pci
- probe-usb
+ ." Probe PCI" cr probe-pci
+ ." Probe USB" cr probe-usb
;
-fload ${BP}/ofw/gui/bmptools.fth
fload ${BP}/dev/null.fth
fload ${BP}/ofw/core/bailout.fth
fload ${BP}/cpu/x86/pc/neptune/banner.fth
-fload ${BP}/ofw/gui/loadmenu.fth
-\ fload ${BP}/ofw/gui/insticon.fth
-
\ Use values like these if you want to boot directly instead of through an intermediate script
" u:\boot\bzImage" ' boot-device set-config-string-default
\ " console=uart,io,0x3f8,115200" ' boot-file set-config-string-default
\ " console=uart,io,0x3f8,115200 root=/dev/nfs rw nfsroot=192.168.42.100:/usr/local/rfs_x86,proto=tcp,hard ip=192.168.42.99:192.168.42.100::255.255.255.0:neptune:eth0:off init=/bin/sh" ' boot-file set-config-string-default
- " console=uart,io,0x3f8,115200 console=tty0 root=/dev/nfs rw nfsroot=192.168.0.23:/home/shared/devel/neptune/sw/rfs/x86_32_rfs,proto=tcp,hard ip=192.168.0.77:192.168.0.23::255.255.255.0:neptune:eth0:off video=1027x768M@60m init=/bin/bash" ' boot-file set-config-string-default
+ " console=uart,io,0x3f8,115200 root=/dev/nfs rw nfsroot=192.168.0.23:/home/shared/devel/neptune/sw/rfs/x86_32_rfs,proto=tcp,hard ip=192.168.0.78:192.168.0.23::255.255.255.0:neptune:eth0:off video=1027x768M@60m ethaddr=00:50:C2:1E:AF:B0 init=/bin/sh" ' boot-file set-config-string-default
\ \needs ramdisk " u:\boot\initrd.img" d# 128 config-string ramdisk
\needs ramdisk " " d# 128 config-string ramdisk
\ " " ' boot-file set-config-string-default \ Let the boot script set the cmdline
@@ -349,16 +351,6 @@
\ fload ${BP}/cpu/x86/pc/report.fth
fload ${BP}/ofw/core/dualconsole.fth
-true constant user-switch? ( -- flag )
-: fast-boot? ( -- flag )
-[ifdef] rom-loaded
-false exit
- user-switch? 0=
-[else]
- false
-[then]
-;
-
: interpreter-init ( -- )
hex
warning on
@@ -376,49 +368,14 @@
[ifdef] rom-loaded
video-map cr
[then]
- " screen" open-dev ?dup if
- set-stdout
-\ logo-banner drop
-\ close-dev
-\ 0 stdout !
- then
-
+ install-console
+\ ?usb-keyboard
install-dual-console
- ?gui-banner
- " probe-" do-drop-in
-\ ." nvramrc" cr
-\ use-nvramrc? if nvramrc safe-evaluate then
+ " nvramrc-" do-drop-in
+ use-nvramrc? if nvramrc safe-evaluate then
;
-: debug-interact ( -- )
- early-interact? if
- " Interrupting startup sequence prior to probing" .because
- ." Type 'resume' to resume normal startup sequence." cr
- \ fallback-device io console-io
- ( help-msg ) interact
- then
-;
-: 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
-
-;
-
fload ${BP}/dev/flashui.fth
\ Copies internal flash to external - everything, including config vars
@@ -443,49 +400,37 @@
" devalias flash /flash@fff00000" evaluate
;
+\ Change this to lpc-gpi1-pa to use the dongle LPC FLASH
+lpc-gpi0-pa value lpc-gpi-pa
+
: vme ( -- )
- ." Running Lattice programmer "
- com1 io
- verbose-cif
- " u:\neptune.vme" to boot-file
- " u:\vme.elf" $boot
+ ." Running Lattice programmer "
+
+ lpc-gpi-pa lpc-gpi-pa h# 100 -1 mmu-map
+ \ verbose-cif
+ " rom:\isp u:\neptune.vme" $boot
+
+ lpc-gpi-pa h# 100 mmu-unmap
;
fload ${BP}/cpu/x86/pc/neptune/versions.fth
-: optional-startup ( -- )
- probe-usb
- ?usb-keyboard
-;
+0 to major-release
+9 to minor-release
+: subrel " .3" ; ' subrel to sub-release
: startup ( -- )
standalone? 0= if exit then
\ ?bailout
- no-page
-
+ probe-all
console-start
- ." Welcome to Dave Neptune (OFW 0.9.3)" cr
- geode-print-pll
+ banner
- fast-boot? if
- probe-pci
- ['] false to interrupt-auto-boot?
- interpreter-init
- auto-boot
- optional-startup
- else
- ." Interactive boot" cr
+ interpreter-init
+ auto-boot
- ." PCI Probe" cr
- probe-pci
- ." USB probe" cr
- optional-startup
- interpreter-init
- auto-boot
- then
-
blue-letters ." Type 'help' for more information." black-letters
cr cr
@@ -499,6 +444,8 @@
warning !
previous previous definitions
+tag-file @ fclose tag-file off
+
.( --- Saving fw.dic ...)
" fw.dic" $save-forth cr
Modified: cpu/x86/pc/neptune/neptune.bth
===================================================================
--- cpu/x86/pc/neptune/neptune.bth 2008-09-02 02:34:47 UTC (rev 911)
+++ cpu/x86/pc/neptune/neptune.bth 2008-09-02 02:45:16 UTC (rev 912)
@@ -18,6 +18,7 @@
in: ${BP}/dev/pci/build/pcibridg.fc
in: ${BP}/dev/dnet/build/dnet.fc
\ in: ${BP}/clients/memtest86/memtest
+in: vme.elf
build-now
@@ -72,6 +73,7 @@
" ${BP}/clients/memtest86/memtest" " memtest" $add-deflated-dropin
[then]
" ${BP}/dev/pci/build/pcibridg.fc" " class060400" $add-deflated-dropin
+ " vme.elf" " isp" $add-deflated-dropin
dropin-size h# 400 - pad-file \ rmstart image must start 0x400 from end
" rmstart.img" $add-file