openfirmware
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
June 2012
- 1 participants
- 34 discussions
Author: wmb
Date: Sat Jun 30 01:42:38 2012
New Revision: 3027
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3027
Log:
OLPC ARM - fixed build problem for XO-3 introduced by recent change to build-fw.fth
Modified:
cpu/arm/olpc/build-fw.fth
Modified: cpu/arm/olpc/build-fw.fth
==============================================================================
--- cpu/arm/olpc/build-fw.fth Sat Jun 30 00:08:07 2012 (r3026)
+++ cpu/arm/olpc/build-fw.fth Sat Jun 30 01:42:38 2012 (r3027)
@@ -762,8 +762,13 @@
;
[then]
-defined? olpc-cl2 defined? olpc-cl4 or [if]
+[ifdef] olpc-cl3
+: game-key@ ( -- n )
+ 0
+;
+[then]
+[ifndef] game-key@
[ifdef] use_mmp2_keypad_control
: game-key@ ( -- n )
0 ( n )
1
0
Author: wmb
Date: Sat Jun 30 00:08:07 2012
New Revision: 3026
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3026
Log:
Checked in "slot.fth" file needed by previous checkin.
Added:
dev/mmc/sdhci/slot.fth
Added: dev/mmc/sdhci/slot.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dev/mmc/sdhci/slot.fth Sat Jun 30 00:08:07 2012 (r3026)
@@ -0,0 +1,29 @@
+" sdhci" name
+
+0 " #address-cells" integer-property
+0 " #size-cells" integer-property
+: open true ;
+: close ;
+
+: r/w-blocks " r/w-blocks" $call-parent ;
+: erase-blocks " erase-blocks" $call-parent ;
+: fresh-write-blocks-start " fresh-write-blocks-start" $call-parent ;
+: r/w-blocks-end " r/w-blocks-end" $call-parent ;
+: dma-alloc " dma-alloc" $call-parent ;
+: dma-free " dma-free" $call-parent ;
+: set-address ( rca -- ) my-unit " set-address" $call-parent ;
+: get-address " get-address" $call-parent ;
+: attach-card " attach-card" $call-parent ;
+: detach-card " detach-card" $call-parent ;
+: size " size" $call-parent ;
+: show-cid " show-cid" $call-parent ;
+: /block " /block" $call-parent ;
+: write-protected? " write-protected?" $call-parent ;
+: card-inserted? " card-inserted?" $call-parent ;
+
+: attach-sdio-card " attach-sdio-card" $call-parent ;
+: detach-sdio-card " detach-sdio-card" $call-parent ;
+: r/w-ioblocks " r/w-ioblocks" $call-parent ;
+: io-b@ " io-b@" $call-parent ;
+: io-b! " io-b!" $call-parent ;
+: io-b!@ " io-b!@" $call-parent ;
1
0
Author: wmb
Date: Fri Jun 29 23:15:23 2012
New Revision: 3025
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3025
Log:
Kernel - Increased the depth of the search order from 16 to 32 vocs, just in case.
Modified:
forth/kernel/kernel.fth
Modified: forth/kernel/kernel.fth
==============================================================================
--- forth/kernel/kernel.fth Fri Jun 29 23:09:12 2012 (r3024)
+++ forth/kernel/kernel.fth Fri Jun 29 23:15:23 2012 (r3025)
@@ -1683,7 +1683,7 @@
\ searched while interpreting Forth code.
decimal
-16 equ nvocs
+32 equ nvocs
nvocs constant #vocs \ The # of vocabularies that can be in the search path
nvocs /token-t * ualloc-t user context \ vocabulary searched first
1
0
June 29, 2012
Author: wmb
Date: Fri Jun 29 23:09:12 2012
New Revision: 3024
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3024
Log:
Moved the definition of "du*" into the kernel.
Modified:
cpu/x86/acpitimer.fth
forth/kernel/double.fth
ofw/disklabel/gpttools.fth
Modified: cpu/x86/acpitimer.fth
==============================================================================
--- cpu/x86/acpitimer.fth Fri Jun 29 23:04:07 2012 (r3023)
+++ cpu/x86/acpitimer.fth Fri Jun 29 23:09:12 2012 (r3024)
@@ -55,13 +55,8 @@
1+ dup to timer-high ( timer.low timer.high' )
then ( timer.low timer.high )
;
-: du* ( ud.lo ud.hi u -- res.lo res.mid res.hi ) \ Ignores overflow to third cell
- tuck um* 2>r ( ud.lo u r: res.mid0 res.hi0 )
- um* ( res.lo res.mid1 r: res.mid0 res.hi0 )
- 0 2r> d+ ( res.lo res.mid res.hi )
-;
: acpi-ticks>usecs ( d.ticks -- usec )
- d# 50 du* drop ( d.product ) \ The scale factor is 1000/3580 == 50/179
+ d# 50 du* ( d.product ) \ The scale factor is 1000/3580 == 50/179
d# 179 um/mod nip ( usecs )
;
Modified: forth/kernel/double.fth
==============================================================================
--- forth/kernel/double.fth Fri Jun 29 23:04:07 2012 (r3023)
+++ forth/kernel/double.fth Fri Jun 29 23:09:12 2012 (r3024)
@@ -65,6 +65,15 @@
-rot >>a or ( low2 r: high2 )
r> ( d2 )
;
+: du* ( d1 u -- d2 ) \ Double result
+ tuck u* >r ( d1.lo u r: d2.hi )
+ um* r> + ( d2 )
+;
+: du*t ( ud.lo ud.hi u -- res.lo res.mid res.hi ) \ Triple result
+ tuck um* 2>r ( ud.lo u r: res.mid0 res.hi0 )
+ um* ( res.lo res.mid1 r: res.mid0 res.hi0 )
+ 0 2r> d+ ( res.lo res.mid res.hi )
+;
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
Modified: ofw/disklabel/gpttools.fth
==============================================================================
--- ofw/disklabel/gpttools.fth Fri Jun 29 23:04:07 2012 (r3023)
+++ ofw/disklabel/gpttools.fth Fri Jun 29 23:09:12 2012 (r3024)
@@ -8,10 +8,6 @@
32\ alias x- d-
32\ alias xswap 2swap
32\ : onex 1. ;
-: du* ( d1 u -- d2 )
- tuck u* >r ( d1.lo u r: d2.hi )
- um* 0 r> d+ ( d2 )
-;
32\ : xu*d ( x u -- d ) du* ;
64\ alias xu*d um*
1
0
[commit] r3023 - cpu/arm cpu/arm/mmp2 cpu/arm/olpc cpu/arm/olpc/1.75 dev/olpc/kb3700 dev/olpc/mmp2camera ofw/core
by repository service June 29, 2012
by repository service June 29, 2012
June 29, 2012
Author: wmb
Date: Fri Jun 29 23:04:07 2012
New Revision: 3023
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3023
Log:
OLPC ARM - omnibus checkin of device tree additions to support the conversion of the XO Linux kernel to use the device tree.
Added:
cpu/arm/mmp2/apbc.fth
cpu/arm/mmp2/pmua.fth
Modified:
cpu/arm/linux.fth
cpu/arm/mmp2/devices.fth
cpu/arm/mmp2/gpio.fth
cpu/arm/mmp2/irq.fth
cpu/arm/mmp2/mfpr.fth
cpu/arm/mmp2/spimaster.fth
cpu/arm/mmp2/timer.fth
cpu/arm/mmp2/twsi.fth
cpu/arm/mmp2/uart.fth
cpu/arm/olpc/1.75/usb.fth
cpu/arm/olpc/build-fw.fth
cpu/arm/olpc/rtc.fth
cpu/arm/olpc/sdhci.fth
cpu/arm/olpc/sdregs.fth
cpu/arm/olpc/sound.fth
cpu/arm/olpc/spcmd.fth
dev/olpc/kb3700/spicmd.fth
dev/olpc/mmp2camera/loadpkg.fth
ofw/core/fdt.fth
Modified: cpu/arm/linux.fth
==============================================================================
--- cpu/arm/linux.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/linux.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -104,6 +104,7 @@
arm-linux-machine-type to r1
[ifdef] flatten-device-tree
use-fdt? if
+ load-base h# 40000 - to linux-params
linux-params h# 40000 flatten-device-tree
else
args-buf cscount linux-params set-parameters
Added: cpu/arm/mmp2/apbc.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/mmp2/apbc.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -0,0 +1,90 @@
+0 0 " " " /" begin-package
+" apbc" name
+" mrvl,pxa-apbc" +compatible
+" mrvl,mmp2-apbc" +compatible
+
+h# d4015000 h# 1000 reg
+1 " #clock-cells" integer-property
+
+: +string encode-string encode+ ;
+
+0 0 encode-bytes
+" RTC" +string \ 00
+" TWSI1" +string \ 01
+" TWSI2" +string \ 02
+" TWSI3" +string \ 03
+" TWSI4" +string \ 04
+" ONEWIRE" +string \ 05
+" KPC" +string \ 06
+" TB_ROTARY" +string \ 07
+" SW_JTAG" +string \ 08
+" TIMERS1" +string \ 09
+" UART1" +string \ 10
+" UART2" +string \ 11
+" UART3" +string \ 12
+" GPIO" +string \ 13
+" PWM0" +string \ 14
+" PWM1" +string \ 15
+" PWM2" +string \ 16
+" PWM3" +string \ 17
+" SSP0" +string \ 18
+" SSP1" +string \ 19
+" SSP2" +string \ 20
+" SSP3" +string \ 21
+" SSP4" +string \ 22
+" SSP5" +string \ 23
+" AIB" +string \ 24
+" ASFAR" +string \ 25
+" ASSAR" +string \ 26
+" USIM" +string \ 27
+" MPMU" +string \ 28
+" IPC" +string \ 29
+" TWSI5" +string \ 30
+" TWSI6" +string \ 31
+" UART4" +string \ 32
+" RIPC" +string \ 33
+" THSENS1" +string \ 34
+" clock-output-names" property
+
+: +int encode-int encode+ ;
+
+0 0 encode-bytes
+\ offset clr-mask value rate
+h# 00 +int h# f7 +int h# 87 +int d# 32,768 +int \ 00 RTC
+h# 04 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 01 TWSI1
+h# 08 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 02 TWSI2
+h# 0c +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 03 TWSI3
+h# 10 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 04 TWSI4
+h# 14 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 05 ONEWIRE
+h# 18 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 06 KPC
+h# 1c +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 07 TB_ROTARY
+h# 20 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 08 SW_JTAG
+h# 24 +int h# 77 +int h# 17 +int d# 6,500,000 +int \ 09 TIMERS1
+h# 2c +int h# 77 +int h# 17 +int d# 26,000,000 +int \ 10 UART1
+h# 30 +int h# 77 +int h# 17 +int d# 26,000,000 +int \ 11 UART2
+h# 34 +int h# 77 +int h# 17 +int d# 26,000,000 +int \ 12 UART3
+h# 38 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 13 GPIO
+h# 3c +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 14 PWM0
+h# 40 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 15 PWM1
+h# 44 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 16 PWM2
+h# 48 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 17 PWM3
+h# 4c +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 18 SSP0
+h# 50 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 19 SSP1
+h# 54 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 20 SSP2
+h# 58 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 21 SSP3
+h# 5c +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 22 SSP4
+h# 60 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 23 SSP5
+h# 64 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 24 AIB
+h# 68 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 25 ASFAR
+h# 6c +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 26 ASSAR
+h# 70 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 27 USIM
+h# 74 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 28 MPMU
+h# 78 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 29 IPC
+h# 7c +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 30 TWSI5
+h# 80 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 31 TWSI6
+h# 88 +int h# 77 +int h# 17 +int d# 26,000,000 +int \ 32 UART4
+h# 8c +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 33 RIPC
+h# 90 +int h# 77 +int h# 7 +int d# 26,000,000 +int \ 34 THSENS1
+" clock-enable-registers" property
+
+end-package
Modified: cpu/arm/mmp2/devices.fth
==============================================================================
--- cpu/arm/mmp2/devices.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/mmp2/devices.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -70,6 +70,7 @@
0 0 " d4018000" " /" begin-package \ UART3
fload ${BP}/cpu/arm/mmp2/uart.fth
+ d# 24 " interrupts" integer-property
end-package
devalias com1 /uart
: com1 " com1" ;
Modified: cpu/arm/mmp2/gpio.fth
==============================================================================
--- cpu/arm/mmp2/gpio.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/mmp2/gpio.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -39,3 +39,42 @@
: >gpio-xmsk ( gpio# -- mask pa ) >gpio-pin h# a8 + ;
: gpio-set-xmsk ( gpio# -- ) >gpio-xmsk tuck io@ or swap io! ;
: gpio-clr-xmsk ( gpio# -- ) >gpio-xmsk tuck io@ swap invert and swap io! ;
+
+\ See <Linux> Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
+0 0 " d4019000" " /" begin-package
+ " gpio" name
+
+ " mrvl,mmp-gpio" encode-string
+ " mrvl,pxa-gpio" encode-string encode+ " compatible" property
+
+ my-address my-space h# 1000 reg
+
+ d# 49 encode-int " interrupts" property
+ " gpio_mux" " interrupt-names" string-property
+ " " " gpio-controller" property
+ 3 " #gpio-cells" integer-property
+ " " " interrupt-controller" property
+ 1 " #interrupt-cells" integer-property
+
+ " /apbc" encode-phandle d# 13 encode-int encode+ " clocks" property
+ " GPIO" " clock-names" string-property
+
+
+ 1 " #address-cells" integer-property
+ 1 " #size-cells" integer-property
+ : encode-unit ( phys.. -- str ) push-hex (u.) pop-base ;
+ : decode-unit ( str -- phys.. ) push-hex $number if 0 then pop-base ;
+
+ : make-gpio-mux-node ( offset -- )
+ new-device
+ " gpio" name
+ 4 reg
+ finish-device
+ ;
+ h# 00 make-gpio-mux-node
+ h# 04 make-gpio-mux-node
+ h# 08 make-gpio-mux-node
+ h# 100 make-gpio-mux-node
+ h# 104 make-gpio-mux-node
+ h# 108 make-gpio-mux-node
+end-package
Modified: cpu/arm/mmp2/irq.fth
==============================================================================
--- cpu/arm/mmp2/irq.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/mmp2/irq.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -4,7 +4,8 @@
0 0 " d4282000" " /" begin-package
" interrupt-controller" device-name
-my-address my-space h# 400 reg
+\ my-address my-space h# 400 reg
+my-address my-space h# 1000 reg
0 value base-adr
d# 64 constant #levels
@@ -35,7 +36,7 @@
;
: open ( -- flag )
- my-unit h# 400 " map-in" $call-parent to base-adr
+ my-unit h# 1000 " map-in" $call-parent to base-adr
\ Leave the IRQ table alone so as not to steal interrupts from the SP
\ block-irqs
\ d# 64 0 do i disable-irq loop
@@ -44,6 +45,133 @@
;
: close ( -- ) ;
+" mrvl,mmp2-intc" " compatible" string-property
+1 " #address-cells" integer-property
+1 " #size-cells" integer-property
+: encode-unit ( phys.. -- str ) push-hex (u.) pop-base ;
+: decode-unit ( str -- phys.. ) push-hex $number if 0 then pop-base ;
+
+0 0 " interrupt-controller" property
+1 " #interrupt-cells" integer-property
+\ d# 64 " mrvl,intc-numbers" integer-property
+d# 64 " mrvl,intc-nr-irqs" integer-property
+\ h# 20 " mrvl,intc-enable-mask" integer-property
+
+: make-mux-node ( statreg maskreg irq# #irqs )
+ new-device
+ " interrupt-controller" name ( maskreg statreg irq# #irqs )
+ " mrvl,intc-nr-irqs" integer-property ( maskreg statreg irq# )
+ " interrupts" integer-property ( maskreg statreg )
+ >r 4 encode-reg r> 4 encode-reg encode+ " reg" property ( )
+ " mrvl,mmp2-mux-intc" +compatible
+ 0 0 " interrupt-controller" property
+ 1 " #interrupt-cells" integer-property
+ " mux status" encode-string " mux mask" encode-string encode+ " reg-names" property
+ finish-device
+;
+
+ h# 150 h# 168 4 2 make-mux-node \ intcmux4
+ h# 154 h# 16c 5 2 make-mux-node \ intcmux5
+ h# 180 h# 17c 9 3 make-mux-node \ intcmux9
+ h# 158 h# 170 d# 17 5 make-mux-node \ intcmux17
+ h# 15c h# 174 d# 35 d# 15 make-mux-node \ intcmux35
+ h# 160 h# 178 d# 51 2 make-mux-node \ intcmux51
+ h# 188 h# 184 d# 55 2 make-mux-node \ intcmux55
+
+0 [if]
+new-device
+ " interrupt-controller" name
+ " mrvl,mmp2-mux-intc" +compatible
+
+ 0 0
+ h# 150 encode-int encode+ 4 encode-int encode+
+ h# 168 encode-int encode+ 4 encode-int encode+ " reg" property
+ \ h# 150 " mrvl,intc-status" integer-property
+ \ h# 168 " mrvl,intc-mask" integer-property
+
+ 4 " interrupts" integer-property
+ d# 2 " mrvl,intc-nr-irqs" integer-property
+ \ 0: USB_CHARGER 1: PMIC
+finish-device
+
+new-device
+ " interrupt-controller" name
+ " mrvl,mmp2-mux-intc" +compatible
+
+ 0 0
+ h# 154 encode-int encode+ 4 encode-int encode+
+ h# 16c encode-int encode+ 4 encode-int encode+ " reg" property
+
+ 5 " interrupts" integer-property
+ d# 2 " mrvl,intc-numbers" integer-property
+ d# 1 " mrvl,clr-mfp-irq" integer-property
+ \ 0: RTC_ALARM 1: RTC
+finish-device
+
+new-device
+ " interrupt-controller" name
+
+ " mrvl,mmp2-mux-intc" +compatible
+
+ 0 0
+ h# 180 encode-int encode+ 4 encode-int encode+
+ h# 17c encode-int encode+ 4 encode-int encode+ " reg" property
+
+ d# 9 " interrupts" integer-property
+ d# 3 " mrvl,intc-numbers" integer-property
+ \ 0:KPC (keypad) 1:ROT (rotary) 2: TBALL (trackball)
+ \ h# 15c " mrvl,intc-status" integer-property
+ \ h# 174 " mrvl,intc-mask" integer-property
+finish-device
+
+new-device
+ " interrupt-controller" name
+ " mrvl,mmp2-mux-intc" +compatible
+
+ 0 0
+ h# 158 encode-int encode+ 4 encode-int encode+
+ h# 170 encode-int encode+ 4 encode-int encode+ " reg" property
+
+ d# 17 " interrupts" integer-property
+ d# 5 " mrvl,intc-numbers" integer-property
+ \ 0: TWSI2 1: TWSI3 2: TWSI4 3: TWSI5 4: TWSI6
+finish-device
+
+new-device
+ " interrupt-controller" name
+
+ " mrvl,mmp2-mux-intc" +compatible
+
+ 0 0
+ h# 15c encode-int encode+ 4 encode-int encode+
+ h# 174 encode-int encode+ 4 encode-int encode+ " reg" property
+ \ h# 15c " mrvl,intc-status" integer-property
+ \ h# 174 " mrvl,intc-mask" integer-property
+
+ d# 35 " interrupts" integer-property
+ d# 15 " mrvl,intc-numbers" integer-property
+ \ 0: PERF 1: L2_PA_ECC 2: L2_ECC 3: L2_UECC 4: DDR
+ \ 5: FABRIC0_TO 6: FABRIC1_TO 7: FABRIC2_TO 8: resv 9: THERMAL
+ \ 10: MAIN_PMU 11: WDT2 12: CORESIGHT 13: COMMTX 14: COMMRX
+finish-device
+
+new-device
+ " interrupt-controller" name
+ 0 0 " interrupt-controller" property
+ " mrvl,mmp2-mux-intc" +compatible
+
+ 0 0
+ h# 160 encode-int encode+ 4 encode-int encode+
+ h# 178 encode-int encode+ 4 encode-int encode+ " reg" property
+
+ d# 51 " interrupts" integer-property
+ d# 2 " mrvl,intc-numbers" integer-property
+ \ 0:HSI_CAWAKE 1:MIPI_HSI_INT1
+ \ h# 15c " mrvl,intc-status" integer-property
+ \ h# 174 " mrvl,intc-mask" integer-property
+finish-device
+[then]
+
end-package
\ LICENSE_BEGIN
Modified: cpu/arm/mmp2/mfpr.fth
==============================================================================
--- cpu/arm/mmp2/mfpr.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/mmp2/mfpr.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -64,3 +64,61 @@
: sleep0 ( n -- n' ) h# 0000 or ;
: sleep1 ( n -- n' ) h# 0100 or ;
: sleepi ( n -- n' ) h# 0080 or ;
+
+0 0 " d401e000" " /" begin-package \ MFPR
+ " mfpr" name
+ my-address my-space h# 1000 reg
+ " mrvl,pxa-mfpr" +compatible
+
+ \ These are for generating a table in a form used by arch/arm/plat-pxa/mfp.c
+ : +int ( adr len n -- adr len' ) encode-int encode+ ;
+ : +mfpr ( adr len gpio# reg-offset -- adr len' ) >r +int -1 +int r> +int ;
+ : +mfpr-range ( adr len gpio#-start gpio#-end reg-offset -- adr len' )
+ >r >r +int r> +int r> +int
+ ;
+ : +mfpr-end ( adr len -- adr len' ) -1 +int -1 +int -1 +int ;
+
+
+ 0 0 encode-bytes
+ d# 0 d# 58 h# 54 +mfpr-range
+ d# 59 d# 73 h# 280 +mfpr-range
+ d# 74 d# 101 h# 170 +mfpr-range
+ d# 102 d# 103 h# 00 +mfpr-range
+ d# 104 h# 1fc +mfpr
+ d# 105 h# 1f8 +mfpr
+ d# 106 h# 1f4 +mfpr
+ d# 107 h# 1f0 +mfpr
+ d# 108 h# 21c +mfpr
+ d# 109 h# 218 +mfpr
+ d# 110 h# 214 +mfpr
+ d# 111 h# 200 +mfpr
+ d# 112 h# 244 +mfpr
+ d# 113 h# 25c +mfpr
+ d# 114 h# 164 +mfpr
+ d# 115 d# 122 h# 260 +mfpr-range
+ d# 123 h# 148 +mfpr
+ d# 124 d# 141 h# 00c +mfpr-range
+ d# 142 h# 008 +mfpr
+ d# 143 d# 151 h# 220 +mfpr-range
+ d# 152 d# 152 h# 248 +mfpr-range
+ d# 154 d# 155 h# 254 +mfpr-range
+ d# 156 d# 159 h# 14c +mfpr-range
+
+ d# 160 h# 250 +mfpr
+ d# 161 h# 210 +mfpr
+ d# 162 h# 20c +mfpr
+ d# 163 h# 208 +mfpr
+ d# 164 h# 204 +mfpr
+ d# 165 h# 1ec +mfpr
+ d# 166 h# 1e8 +mfpr
+ d# 167 h# 1e4 +mfpr
+ d# 168 h# 1e0 +mfpr
+ d# 171 h# 2c8 +mfpr \ PXA2128 only
+ h# 15b h# 15c h# 140 +mfpr-range \ MFPR_PIN_TWSI1_SCL - MFPR_PIN_TWSI1_SDA
+ h# 15d h# 15e h# 2bc +mfpr-range \ MFPR_PIN_TWSI4_SCL - MFPR_PIN_TWSI4_SDA
+ h# 159 h# 2c4 +mfpr \ MFPR_PIN_PMIC_INT
+ h# 15f h# 160 +mfpr \ MFPR_PIN_CLK_REQ
+ +mfpr-end
+ " mrvl,pin-map" property
+
+end-package
Added: cpu/arm/mmp2/pmua.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/mmp2/pmua.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -0,0 +1,74 @@
+also known-int-properties definitions
+: clocks 2 ;
+previous definitions
+
+0 0 " " " /" begin-package
+" pmua" name
+" mrvl,pxa-apmu" +compatible
+" mrvl,mmp2-apmu" +compatible
+
+h# d4282800 h# 1000 reg
+1 " #clock-cells" integer-property
+
+: +string encode-string encode+ ;
+
+0 0 encode-bytes
+" IRE" +string \ 0
+" DISPLAY1" +string \ 1
+" CCIC" +string \ 2
+" SDH0" +string \ 3
+" SDH1" +string \ 4
+" USB" +string \ 5
+" NF" +string \ 6
+" DMA" +string \ 7
+" WTM" +string \ 8
+" BUS" +string \ 9
+" VMETA" +string \ 10
+" GC" +string \ 11
+" SMC" +string \ 12
+" MSPRO" +string \ 13
+" SDH2" +string \ 14
+" SDH3" +string \ 15
+" CCIC2" +string \ 16
+" HSIC1" +string \ 17
+" FSIC3" +string \ 18
+" HSI" +string \ 19
+" AUDIO" +string \ 20
+" DISPLAY2" +string \ 21
+" ISP" +string \ 22
+" EPD" +string \ 23
+" APB2" +string \ 24
+" clock-output-names" property
+
+: +int encode-int encode+ ;
+
+0 0 encode-bytes
+\ offset clr-mask value rate
+h# 048 +int h# 19 +int h# 19 +int d# 0 +int \ 0 IRE
+h# 04c +int h# fffff +int h# 71b +int d# 400,000,000 +int \ 1 DISPLAY1
+h# 050 +int h# 3f +int h# 3f +int d# 0 +int \ 2 CCIC
+h# 054 +int h# 1b +int h# 1b +int d# 200,000,000 +int \ 3 SDH0
+h# 058 +int h# 1b +int h# 1b +int d# 200,000,000 +int \ 4 SDH1
+h# 05c +int h# 09 +int h# 09 +int d# 480,000,000 +int \ 5 USB
+h# 060 +int h# 1ff +int h# bf +int d# 100,000,000 +int \ 6 NF
+h# 064 +int h# 09 +int h# 09 +int d# 0 +int \ 7 DMA
+h# 068 +int h# 1b +int h# 1b +int d# 0 +int \ 8 WTM
+h# 06c +int h# 01 +int h# 01 +int d# 0 +int \ 9 BUS
+h# 0a4 +int h# 1b +int h# 1b +int d# 0 +int \ 10 VMETA
+h# 0cc +int h# 0f +int h# 0f +int d# 0 +int \ 11 GC
+h# 0d4 +int h# 1b +int h# 1b +int d# 0 +int \ 12 SMC
+h# 0d8 +int h# 3f +int h# 3f +int d# 0 +int \ 13 MSPRO
+h# 0e8 +int h# 1b +int h# 1b +int d# 200,000,000 +int \ 14 SDH2
+h# 0ec +int h# 1b +int h# 1b +int d# 200,000,000 +int \ 15 SDH3
+h# 0f4 +int h# 3f +int h# 3f +int d# 0 +int \ 16 CCIC2
+h# 0f8 +int h# 1b +int h# 1b +int d# 0 +int \ 17 HSIC1
+h# 100 +int h# 1b +int h# 1b +int d# 0 +int \ 18 FSIC3
+h# 108 +int h# 09 +int h# 09 +int d# 0 +int \ 19 HSI
+h# 10c +int h# 13 +int h# 13 +int d# 0 +int \ 20 AUDIO
+h# 110 +int h# 1b +int h# 1b +int d# 0 +int \ 21 DISPLAY2
+h# 120 +int h# 3f +int h# 3f +int d# 0 +int \ 22 ISP
+h# 124 +int h# 1b +int h# 1b +int d# 0 +int \ 23 EPD
+h# 134 +int h# 12 +int h# 12 +int d# 0 +int \ 24 APB2
+" clock-enable-registers" property
+
+end-package
Modified: cpu/arm/mmp2/spimaster.fth
==============================================================================
--- cpu/arm/mmp2/spimaster.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/mmp2/spimaster.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -8,8 +8,9 @@
" spi" device-name
0 0 encode-bytes
- " Marvell,ssp-spi" encode-string encode+
+ " mrvl,ssp-spi" encode-string encode+
" compatible" property
+ " /abpc" encode-phandle d# 19 encode-int encode+ " clocks" property
my-address my-space h# 1000 encode-reg
" reg" property
Modified: cpu/arm/mmp2/timer.fth
==============================================================================
--- cpu/arm/mmp2/timer.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/mmp2/timer.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -188,3 +188,11 @@
do-lid
;
' safe-idle to stdin-idle
+
+0 0 " d4014000" " /" begin-package
+ " timer" name
+ " mrvl,mmp-timer" +compatible
+ my-address my-space h# 100 reg
+ d# 13 " interrupts" integer-property
+ " /apbc" encode-phandle 9 encode-int encode+ " clocks" property
+end-package
Modified: cpu/arm/mmp2/twsi.fth
==============================================================================
--- cpu/arm/mmp2/twsi.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/mmp2/twsi.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -156,6 +156,49 @@
: twsi-b! ( byte reg -- ) 2 twsi-out ;
[ifdef] begin-package
+: make-twsi-node ( baseadr clock# irq# muxed-irq? fast? unit# -- )
+ root-device
+ new-device
+ " linux,unit#" integer-property
+ " i2c" name
+ " mrvl,mmp-twsi" +compatible ( baseadr clock# irq# muxed-irq? fast? )
+ if 0 0 " mrvl,i2c-fast-mode" property then ( baseadr clock# irq# muxed-irq? )
+ if
+ " /interrupt-controller/interrupt-controller@158" encode-phandle " interrupt-parent" property
+ then ( baseadr clock# irq# )
+ " interrupts" integer-property ( baseadr clock# )
+ " /apbc" encode-phandle rot encode-int encode+ " clocks" property
+
+ h# 1000 reg ( )
+ 1 " #address-cells" integer-property
+ 1 " #size-cells" integer-property
+ " : open true ; : close ;" evaluate
+ " : encode-unit ( phys.. -- str ) push-hex (u.) pop-base ;" evaluate
+ " : decode-unit ( str -- phys.. ) push-hex $number if 0 then pop-base ;" evaluate
+ finish-device
+ device-end
+;
+
+\ baseadr clk irq mux? fast? unit#
+\ h# d4011000 1 7 false true N make-twsi-node \ TWSI1
+\ h# d4031000 2 0 true true N make-twsi-node \ TWSI2
+\ h# d4032000 3 1 true true N make-twsi-node \ TWSI3
+ h# d4033000 4 2 true true 0 make-twsi-node \ TWSI4
+\ h# d4038000 d# 30 3 true true N make-twsi-node \ TWSI5
+ h# d4034000 d# 31 4 true true 1 make-twsi-node \ TWSI6
+
+0 0 " 30" " /i2c@d4033000" begin-package \ TWSI
+ " touchscreen" name
+ " raydium_ts" +compatible
+ my-address my-space 1 reg
+end-package
+
+0 0 " 19" " /i2c@d4034000" begin-package
+ " accelerometer" name
+ " lis3lv02d" +compatible
+ my-address my-space 1 reg
+end-package
+
0 0 " " " /" begin-package
" twsi" name
Modified: cpu/arm/mmp2/uart.fth
==============================================================================
--- cpu/arm/mmp2/uart.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/mmp2/uart.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -1,4 +1,5 @@
" uart" name
+ " mrvl,mmp-uart" +compatible
my-space h# 20 reg
: write ( adr len -- actual )
Modified: cpu/arm/olpc/1.75/usb.fth
==============================================================================
--- cpu/arm/olpc/1.75/usb.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/olpc/1.75/usb.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -8,6 +8,9 @@
my-space swap " map-in" $call-parent h# 100 + ( adr )
;
: my-map-out ( adr len -- ) swap h# 100 - swap " map-out" $call-parent ;
+ " /pmua" encode-phandle 5 encode-int encode+ " clocks" property
+ d# 44 " interrupts" integer-property
+
false constant has-dbgp-regs?
false constant needs-dummy-qh?
: grab-controller ( config-adr -- error? ) drop false ;
Modified: cpu/arm/olpc/build-fw.fth
==============================================================================
--- cpu/arm/olpc/build-fw.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/olpc/build-fw.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -81,6 +81,9 @@
;
+fload ${BP}/cpu/arm/mmp2/pmua.fth
+fload ${BP}/cpu/arm/mmp2/apbc.fth
+fload ${BP}/cpu/arm/mmp2/irq.fth
fload ${BP}/cpu/arm/mmp2/timer.fth
fload ${BP}/cpu/arm/mmp2/twsi.fth
fload ${BP}/cpu/arm/mmp2/mfpr.fth
@@ -98,12 +101,13 @@
;
warning !
-fload ${BP}/cpu/arm/mmp2/irq.fth
-
fload ${BP}/cpu/arm/mmp2/watchdog.fth \ reset-all using watchdog timer
0 0 " d4018000" " /" begin-package \ UART3
fload ${BP}/cpu/arm/mmp2/uart.fth
+ " /apbc" encode-phandle d# 12 encode-int encode+ " clocks" property
+ d# 24 " interrupts" integer-property
+ 1 " linux,unit#" integer-property
end-package
devalias com1 /uart
: com1 " com1" ;
@@ -111,6 +115,9 @@
0 0 " d4030000" " /" begin-package \ UART1
fload ${BP}/cpu/arm/mmp2/uart.fth
+ d# 27 " interrupts" integer-property
+ " /apbc" encode-phandle d# 10 encode-int encode+ " clocks" property
+ 0 " linux,unit#" integer-property
end-package
devalias com2 /uart
: com2 " com2" ;
@@ -131,6 +138,8 @@
0 0 " d4035000" " /" begin-package
" flash" device-name
+ " /apbc" encode-phandle d# 19 encode-int encode+ " clocks" property
+ d# 0 " interrupts" integer-property
h# 10.0000 value /device
my-address my-space h# 100 reg
fload ${BP}/dev/nonmmflash.fth
@@ -177,8 +186,7 @@
: hdd-led-off ( -- ) ;
: hdd-led-on ( -- ) ;
: hdd-led-toggle ( -- ) ;
-[then]
-[ifdef] olpc-cl2
+[else]
: hdd-led-off ( -- ) d# 10 gpio-clr ;
: hdd-led-on ( -- ) d# 10 gpio-set ;
: hdd-led-toggle ( -- ) d# 10 gpio-pin@ if hdd-led-off else hdd-led-on then ;
@@ -219,13 +227,33 @@
: ofw-fw-filename$ " disk:\boot\olpc.rom" ;
' ofw-fw-filename$ to fw-filename$
+0 0 " f0400000" " /" begin-package
+ " vmeta" name
+ my-address my-space h# 1000 reg
+
+ " mrvl,mmp2-vmeta" +compatible
+
+ " /pmua" encode-phandle d# 10 encode-int encode+ " clocks" property
+ d# 26 " interrupts" integer-property
+end-package
+
0 0 " d420b000" " /" begin-package
" display" name
-\+ olpc-cl2 fload ${BP}/cpu/arm/olpc/1.75/lcdcfg.fth
-\+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/lcdcfg.fth
+ my-address my-space h# 1000 reg
+
+ " /pmua" encode-phandle 1 encode-int encode+ " clocks" property
+ d# 41 " interrupts" integer-property
+
+[ifdef] olpc-cl3
+ fload ${BP}/cpu/arm/olpc/3.0/lcdcfg.fth
+[else]
+ fload ${BP}/cpu/arm/olpc/1.75/lcdcfg.fth
+[then]
fload ${BP}/cpu/arm/olpc/lcd.fth
-\+ olpc-cl2 fload ${BP}/dev/olpc/dcon/mmp2dcon.fth \ DCON control
+[ifndef] olpc-cl3
+ fload ${BP}/dev/olpc/dcon/mmp2dcon.fth \ DCON control
+[then]
defer convert-color ' noop to convert-color
defer pixel*
defer pixel+
@@ -299,18 +327,21 @@
devalias screen /display
-\- olpc-cl3 devalias keyboard /keyboard
+[ifdef] olpc-cl3
+create cp881-16 " ${BP}/ofw/termemu/cp881-16.obf" $file,
+' cp881-16 to romfont
+[else]
+devalias keyboard /keyboard
-\+ olpc-cl2 create 15x30pc " ${BP}/ofw/termemu/15x30pc.psf" $file,
-\+ olpc-cl2 ' 15x30pc to romfont
-\+ olpc-cl3 create cp881-16 " ${BP}/ofw/termemu/cp881-16.obf" $file,
-\+ olpc-cl3 ' cp881-16 to romfont
+create 15x30pc " ${BP}/ofw/termemu/15x30pc.psf" $file,
+' 15x30pc to romfont
+[then]
fload ${BP}/cpu/arm/olpc/sdhci.fth
\- cl2-a1 fload ${BP}/cpu/arm/olpc/emmc.fth
-devalias int /sd/disk@3
-devalias ext /sd/disk@1
+devalias int /sd/sdhci@d4281000/disk
+devalias ext /sd/sdhci@d4280000/disk
devalias net /wlan \ XXX should report-net in case of USB Ethernet
fload ${BP}/dev/olpc/kb3700/spicmd.fth \ EC SPI Command Protocol
@@ -370,6 +401,7 @@
\+ olpc-cl2 fload ${BP}/cpu/arm/olpc/1.75/usb.fth
\+ olpc-cl3 fload ${BP}/cpu/arm/mmp2/ulpiphy.fth
\+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/usb.fth
+\+ olpc-cl4 fload ${BP}/cpu/arm/olpc/cl4/usb.fth
fload ${BP}/dev/olpc/mmp2camera/loadpkg.fth
@@ -393,6 +425,7 @@
board-revision " board-revision-int" integer-property
\+ olpc-cl2 " olpc,xo-1.75" " compatible" string-property
\+ olpc-cl3 " olpc,xo-3.0" " compatible" string-property
+\+ olpc-cl4 " olpc,xo-cl4" " compatible" string-property
\ The "1-" removes the null byte
" SN" find-tag if 1- else " Unknown" then " serial-number" string-property
@@ -402,6 +435,11 @@
['] ec-name$ catch 0= if " ec-name" string-property then
['] ec-date$ catch 0= if " ec-date" string-property then
['] ec-user$ catch 0= if " ec-user" string-property then
+ " /interrupt-controller" encode-phandle " interrupt-parent" property
+\ " /interrupt-controller" find-package if
+\ " interrupt-parent" integer-property
+\ then
+ 0 0 " ranges" property
dend
" /openprom" find-device
@@ -420,6 +458,7 @@
fload ${BP}/cpu/arm/mmp2/thermal.fth
fload ${BP}/cpu/arm/mmp2/fuse.fth
+fload ${BP}/cpu/arm/olpc/bsl.fth
[ifndef] virtual-mode
warning off
@@ -509,8 +548,12 @@
false
;
-\+ olpc-cl2 : rotate-button? ( -- flag ) d# 15 gpio-pin@ 0= ;
-\+ olpc-cl3 false value rotate-button?
+[ifdef] olpc-cl3
+false value rotate-button?
+[else]
+: rotate-button? ( -- flag ) d# 15 gpio-pin@ 0= ;
+[then]
+
warning @ warning off
: init
\ initial-heap add-memory
@@ -625,15 +668,23 @@
code halt ( -- ) wfi c;
-\+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/switches.fth \ Switches
\+ olpc-cl2 fload ${BP}/cpu/arm/olpc/1.75/switches.fth \ Lid and ebook switches
+\+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/switches.fth \ Switches
+\+ olpc-cl4 fload ${BP}/cpu/arm/olpc/cl4/switches.fth \ Lid and ebook switches
+
fload ${BP}/cpu/arm/mmp2/rtc.fth \ Internal RTC, used for wakeups
-\+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/leds.fth \ LEDs
+
\+ olpc-cl2 fload ${BP}/cpu/arm/olpc/1.75/leds.fth \ LEDs
+\+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/leds.fth \ LEDs
+\+ olpc-cl4 fload ${BP}/cpu/arm/olpc/cl4/leds.fth \ LEDs
+
fload ${BP}/cpu/x86/pc/olpc/via/factory.fth \ Manufacturing tools
fload ${BP}/cpu/arm/olpc/accelerometer.fth
-\+ olpc-cl2 fload ${BP}/cpu/arm/olpc/1.75/compass.fth
+
+[ifndef] olpc-cl3
+fload ${BP}/cpu/arm/olpc/1.75/compass.fth
+[then]
\ Suppress long memory test at final test stage
dev /memory
@@ -700,17 +751,22 @@
fload ${BP}/cpu/x86/pc/olpc/gamekeynames.fth
+[ifdef] cl2-a1
: game-key@ ( -- n )
0 ( n )
-[ifdef] cl2-a1
d# 16 gpio-pin@ 0= if h# 80 or then \ O
d# 17 gpio-pin@ 0= if h# 02 or then \ Check
d# 18 gpio-pin@ 0= if h# 100 or then \ X
d# 19 gpio-pin@ 0= if h# 01 or then \ Square
d# 20 gpio-pin@ 0= if h# 40 or then \ Rotate
+;
[then]
-[ifdef] olpc-cl2
-[ifdef] use_mmp2_keypad_control
+
+defined? olpc-cl2 defined? olpc-cl4 or [if]
+
+ [ifdef] use_mmp2_keypad_control
+: game-key@ ( -- n )
+ 0 ( n )
d# 15 gpio-pin@ 0= if button-rotate or then ( n )
scan-keypad ( n keypad )
button-o h# 01 keypad-bit ( n' keypad )
@@ -722,7 +778,10 @@
rocker-down h# 40 keypad-bit ( n' keypad )
rocker-left h# 80 keypad-bit ( n' keypad )
drop ( n )
-[else]
+;
+ [else]
+: game-key@ ( -- n )
+ 0 ( n )
d# 15 gpio-pin@ 0= if button-rotate or then
d# 16 gpio-pin@ 0= if button-o or then
d# 17 gpio-pin@ 0= if button-check or then
@@ -732,9 +791,10 @@
d# 21 gpio-pin@ 0= if rocker-right or then
d# 22 gpio-pin@ 0= if rocker-down or then
d# 23 gpio-pin@ 0= if rocker-left or then
-[then]
-[then]
;
+ [then]
+
+[then]
fload ${BP}/cpu/x86/pc/olpc/gamekeys.fth
@@ -756,9 +816,11 @@
fload ${BP}/cpu/x86/pc/olpc/gridmap.fth \ Gridded display tools
fload ${BP}/cpu/x86/pc/olpc/via/copynand.fth
+
+\+ olpc-cl2 fload ${BP}/cpu/arm/olpc/rm3150-touchscreen.fth \ Touchscreen driver and diagnostic
\+ olpc-cl3 fload ${BP}/cpu/arm/olpc/exc7200-touchscreen.fth \ Touchscreen driver and diagnostic
\+ olpc-cl3 fload ${BP}/dev/softkeyboard.fth \ On-screen keyboard
-\+ olpc-cl2 fload ${BP}/cpu/arm/olpc/rm3150-touchscreen.fth \ Touchscreen driver and diagnostic
+\+ olpc-cl4 fload ${BP}/cpu/arm/olpc/nn-touchscreen.fth \ Touchscreen driver and diagnostic
fload ${BP}/cpu/arm/olpc/roller.fth \ Accelerometer test
\ fload ${BP}/cpu/arm/olpc/pinch.fth \ Touchscreen gestures
@@ -828,8 +890,7 @@
devalias fsdisk int:0
\ create pong-use-touchscreen
-fload ${BP}/ofw/gui/ofpong.fth
-fload ${BP}/cpu/x86/pc/olpc/life.fth
+\ fload ${BP}/ofw/gui/ofpong.fth
d# 999 ' screen-#rows set-config-int-default \ Expand the terminal emulator to fill the screen
d# 999 ' screen-#columns set-config-int-default \ Expand the terminal emulator to fill the screen
@@ -897,11 +958,7 @@
: ?games ( -- )
rocker-right game-key? if
protect-fw
- time&date 5drop 1 and if
- ['] pong guarded
- else
- ['] life-demo guarded
- then
+\ ['] pong guarded
power-off
then
;
@@ -964,8 +1021,9 @@
[then]
fload ${BP}/cpu/arm/olpc/testitems.fth
-\+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/testinstructions.fth
\+ olpc-cl2 fload ${BP}/cpu/arm/olpc/1.75/testinstructions.fth
+\+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/testinstructions.fth
+\+ olpc-cl4 fload ${BP}/cpu/arm/olpc/cl4/testinstructions.fth
: startup ( -- )
standalone? 0= if exit then
Modified: cpu/arm/olpc/rtc.fth
==============================================================================
--- cpu/arm/olpc/rtc.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/olpc/rtc.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -1,7 +1,17 @@
purpose: Driver for external IDT1338 RTC chip on XO-1.75
-0 0 " " " /" begin-package
-" rtc" name
+0 0 " d4010000" " /" begin-package
+ " rtc" name
+ " mrvl,mmp-rtc" +compatible
+ my-address my-space h# 1000 reg
+
+ d# 1 encode-int 0 encode-int encode+ " interrupts" property
+ " /interrupt-controller/interrupt-controller@154" encode-phandle " interrupt-parent" property
+
+ " rtc 1Hz" encode-string " rtc alarm" encode-string encode+ " interrupt-names" property
+
+
+ " /apbc" encode-phandle 0 encode-int encode+ " clocks" property
[ifdef] cl2-a1
: set-address ( -- )
Modified: cpu/arm/olpc/sdhci.fth
==============================================================================
--- cpu/arm/olpc/sdhci.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/olpc/sdhci.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -1,16 +1,22 @@
purpose: Load file for SDHCI (Secure Digital Host Controller Interface)
-0 0 " d4280000" " /" begin-package
+0 0 " " " /" begin-package
fload ${BP}/cpu/arm/olpc/sdregs.fth
fload ${BP}/dev/mmc/sdhci/sdhci.fth
+ " simple-bus" +compatible
+ h# d4280000 encode-int h# d4280000 encode-int encode+ h# 2000 encode-int encode+ " ranges" property
+ 1 " #address-cells" integer-property
+ 1 " #size-cells" integer-property
+
d# 1 to power-off-time \ A2 and A3 have turn-off clamps
\ true to avoid-high-speed?
hex
+ : slot# ( -- n ) slot h# d4280000 - h# 800 / 1+ ;
: olpc-card-inserted? ( -- flag )
- slot 1 = if d# 31 gpio-pin@ 0= else true then
+ slot# 1 = if d# 31 gpio-pin@ 0= else true then
;
' olpc-card-inserted? to card-inserted?
@@ -18,35 +24,72 @@
: gpio-power-on ( -- )
sdhci-card-power-on
\ The CL3 version below actually works for CL2 >= B1
-\+ olpc-cl2 d# 36 slot - gpio-set
-\+ olpc-cl3 slot 2 = if d# 34 gpio-set then
+\+ olpc-cl2 d# 36 slot# - gpio-set
+\+ olpc-cl3 slot# 2 = if d# 34 gpio-set then
;
' gpio-power-on to card-power-on
: gpio-power-off ( -- )
-\+ olpc-cl2 d# 36 slot - gpio-clr
-\+ olpc-cl3 slot 2 = if d# 34 gpio-clr then
+\+ olpc-cl2 d# 36 slot# - gpio-clr
+\+ olpc-cl3 slot# 2 = if d# 34 gpio-clr then
sdhci-card-power-off
;
' gpio-power-off to card-power-off
\+ olpc-cl2 new-device
-\+ olpc-cl2 1 encode-int " reg" property
-\+ olpc-cl2 fload ${BP}/dev/mmc/sdhci/sdmmc.fth
-\+ olpc-cl2 fload ${BP}/dev/mmc/sdhci/selftest.fth
-\+ olpc-cl2 " external" " slot-name" string-property
+\+ olpc-cl2 h# d428.0000 h# 800 reg
+\+ olpc-cl2 8 encode-int " bus-width" property
+\+ olpc-cl2 " mrvl,pxav3-mmc" encode-string " compatible" property
+\+ olpc-cl2 d# 31 encode-int " clk-delay-cycles" property
+\+ olpc-cl2 fload ${BP}/dev/mmc/sdhci/slot.fth
+\+ olpc-cl2 d# 39 " interrupts" integer-property
+
+\+ olpc-cl2 " /pmua" encode-phandle 3 encode-int encode+ " clocks" property
+\+ olpc-cl2 " PXA-SDHCLK" " clock-names" string-property
+
+\+ olpc-cl2 new-device
+\+ olpc-cl2 fload ${BP}/dev/mmc/sdhci/sdmmc.fth
+\+ olpc-cl2 fload ${BP}/dev/mmc/sdhci/selftest.fth
+\+ olpc-cl2 " external" " slot-name" string-property
+\+ olpc-cl2 finish-device
\+ olpc-cl2 finish-device
new-device
- 2 encode-int " reg" property
- fload ${BP}/dev/mmc/sdhci/mv8686/loadpkg.fth
+ h# d428.0800 h# 800 reg
+ 8 encode-int " bus-width" property
+ " sdhci-pxav3" +compatible
+ " mrvl,pxav3-mmc" +compatible
+ d# 31 encode-int " clk-delay-cycles" property
+ 0 0 " non-removable" property
+ d# 52 " interrupts" integer-property
+
+ " /pmua" encode-phandle 4 encode-int encode+ " clocks" property
+ " PXA-SDHCLK" " clock-names" string-property
+
+ fload ${BP}/dev/mmc/sdhci/slot.fth
+ new-device
+ fload ${BP}/dev/mmc/sdhci/mv8686/loadpkg.fth
+ finish-device
finish-device
new-device
- 3 encode-int " reg" property
- fload ${BP}/dev/mmc/sdhci/sdmmc.fth
- fload ${BP}/dev/mmc/sdhci/selftest.fth
- " internal" " slot-name" string-property
+ h# d428.1000 h# 800 reg
+ 0 0 " non-removable" property
+ 8 encode-int " bus-width" property
+ " sdhci-pxav3" +compatible
+ " mrvl,pxav3-mmc" +compatible
+ d# 31 encode-int " clk-delay-cycles" property
+ d# 53 " interrupts" integer-property
+
+ " /pmua" encode-phandle d# 14 encode-int encode+ " clocks" property
+ " PXA-SDHCLK" " clock-names" string-property
+
+ fload ${BP}/dev/mmc/sdhci/slot.fth
+ new-device
+ fload ${BP}/dev/mmc/sdhci/sdmmc.fth
+ fload ${BP}/dev/mmc/sdhci/selftest.fth
+ " internal" " slot-name" string-property
+ finish-device
finish-device
end-package
Modified: cpu/arm/olpc/sdregs.fth
==============================================================================
--- cpu/arm/olpc/sdregs.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/olpc/sdregs.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -4,11 +4,11 @@
0 instance value slot
0 instance value chip
-my-space /regs reg
+\ my-space /regs reg
: map-regs ( -- )
chip if exit then
- slot 1- h# 800 * my-space + /regs " map-in" $call-parent
+ slot /regs " map-in" $call-parent
to chip
;
: unmap-regs ( -- )
Modified: cpu/arm/olpc/sound.fth
==============================================================================
--- cpu/arm/olpc/sound.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/olpc/sound.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -2,6 +2,9 @@
" audio" name
my-space h# 800 reg
+" /pmua" encode-phandle d# 20 encode-int encode+ " clocks" property
+d# 2 " interrupts" integer-property
+
0 value sspa-base \ E.g. h# 2a.0c00 +io
0 value adma-base \ E.g. h# 2a.0800 +io
: sspa! ( n offset -- ) sspa-base + rl! ; \ Write a register in SSPA1
Modified: cpu/arm/olpc/spcmd.fth
==============================================================================
--- cpu/arm/olpc/spcmd.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ cpu/arm/olpc/spcmd.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -24,6 +24,8 @@
0 0 encode-bytes
" olpc,ap-sp" encode-string encode+
" compatible" property
+ d# 40 " interrupts" integer-property
+ " /pmua" encode-phandle 8 encode-int encode+ " clocks" property
my-address my-space h# 1000 encode-reg
" reg" property
Modified: dev/olpc/kb3700/spicmd.fth
==============================================================================
--- dev/olpc/kb3700/spicmd.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ dev/olpc/kb3700/spicmd.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -35,6 +35,10 @@
1 " #address-cells" integer-property
0 " #size-cells" integer-property
+ d# 20 " interrupts" integer-property
+ " /apbc" encode-phandle d# 21 encode-int encode+ " clocks" property
+
+
: encode-unit ( phys -- adr len ) push-hex (u.) pop-base ;
: decode-unit ( adr len -- phys ) push-hex $number if 0 then pop-base ;
Modified: dev/olpc/mmp2camera/loadpkg.fth
==============================================================================
--- dev/olpc/mmp2camera/loadpkg.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ dev/olpc/mmp2camera/loadpkg.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -1,6 +1,8 @@
" " " d420a000" " /" begin-package
" camera" device-name
- 0 0 reg \ A reg property makes "test-all" consider this device
+ my-address my-space h# 800 reg
+ " /pmua" encode-phandle 2 encode-int encode+ " clocks" property
+ d# 42 " interrupts" integer-property
0 [if]
: alloc-capture-buffer ( len -- vadr padr )
Modified: ofw/core/fdt.fth
==============================================================================
--- ofw/core/fdt.fth Fri Jun 29 22:52:33 2012 (r3022)
+++ ofw/core/fdt.fth Fri Jun 29 23:04:07 2012 (r3023)
@@ -52,7 +52,6 @@
fdt-string, ( offset )
;
-also client-services
: flatten-path ( -- )
the-node phandle>devname ( adr len )
fdt$, 0 fdt-c, 4 fdt-align ( )
@@ -176,7 +175,7 @@
\ Test for unprintable characters
2dup -null text? if
- to-display-column -null type exit
+ to-display-column -null type cr exit
then ( adr,len )
dup /n /mod swap 0= if ( adr len #ints )
@@ -213,8 +212,6 @@
again
;
-previous
-
\ LICENSE_BEGIN
\ Copyright (c) 2012 FirmWorks
\
1
0
Author: wmb
Date: Fri Jun 29 22:52:33 2012
New Revision: 3022
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3022
Log:
Checked in TI MSP430 Bootstrap Loader download code.
Added:
cpu/arm/olpc/bsl.fth
Added: cpu/arm/olpc/bsl.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/bsl.fth Fri Jun 29 22:52:33 2012 (r3022)
@@ -0,0 +1,328 @@
+\ See license at end of file
+purpose: Downloader for TI MSP430 BootStrap Loader (BSL) protocol
+
+\ devalias bsl /uart@NNNN:9600,8,e,1//bsl-protocol
+
+h# fe016000 value bsl-uart-base \ Virtual address of UART; set later
+
+: bsl-baud ( baud-rate -- ) \ 9600,8,e,1
+ uart-base >r bsl-uart-base to uart-base baud h# 1b 3 uart! r> to uart-base
+;
+
+: send ( char -- ) uart-base >r bsl-uart-base to uart-base uemit r> to uart-base ;
+
+: receive? ( -- false | char true )
+ uart-base >r bsl-uart-base to uart-base
+ ukey? if ukey true else false then
+ r> to uart-base
+;
+
+0 value rst-gpio#
+0 value test-gpio#
+\ : bsl-config-test ( -- )
+: init-gpios
+ fallback-in-ih ?dup if dup remove-input close-dev 0 to fallback-in-ih then
+ fallback-out-ih ?dup if dup remove-output close-dev 0 to fallback-out-ih then
+
+ d# 115 to test-gpio#
+ d# 116 to rst-gpio#
+
+ test-gpio# 0 swap af!
+ rst-gpio# 0 swap af!
+;
+
+: bsl-open ( -- )
+ init-gpios
+
+ rst-gpio# gpio-clr
+ test-gpio# gpio-clr
+ rst-gpio# gpio-dir-out
+ test-gpio# gpio-dir-out
+ h# 16000 +io to bsl-uart-base
+
+ d# 9600 bsl-baud
+;
+: bsl-close ( -- )
+ rst-gpio# gpio-dir-in
+ test-gpio# gpio-dir-in
+;
+: msp430-off ( -- )
+ rst-gpio# gpio-clr
+ test-gpio# gpio-clr
+;
+
+: dly ( -- ) d# 10 ms ;
+: start-bsl ( -- )
+ bsl-open
+ d# 250 ms
+ test-gpio# gpio-set
+ dly
+ test-gpio# gpio-clr
+ dly
+ test-gpio# gpio-set
+ dly
+ rst-gpio# gpio-set
+ dly
+ test-gpio# gpio-clr
+;
+: flush-bsl ( -- ) begin receive? while drop repeat ;
+: rst-bsl ( -- ) msp430-off start-bsl flush-bsl ;
+
+d# 1000 constant timeout
+: wait-byte ( -- char )
+ get-msecs timeout + ( limit )
+ begin ( limit )
+ receive? if ( limit char )
+ nip exit ( -- char )
+ then ( limit )
+ dup get-msecs - 0< ( limit timeout? )
+ until ( limit )
+ drop true abort" BSL data timeout"
+;
+: ack? ( -- okay? )
+ get-msecs timeout + ( limit )
+ begin ( limit )
+ receive? if ( limit char )
+ case
+ h# 90 of ( limit )
+ drop true exit ( -- true )
+ endof
+ h# a0 of ( limit )
+ ." NAK!"
+ drop false exit
+ endof
+ endcase
+ then ( limit )
+ dup get-msecs - 0< ( limit timeout? )
+ until ( limit )
+ drop false ( false )
+;
+: bsl-sync ( -- )
+ d# 4 0 do
+ h# 80 send ack? if unloop exit then
+ loop
+ true abort" BSL unresponsive"
+;
+
+0 value checksum
+
+: +sum ( w -- ) checksum xor to checksum ;
+: send-summed ( w -- )
+ dup +sum wbsplit swap send send
+;
+: send-length ( n -- )
+ dup 1 and abort" BSL odd length!"
+ dup d# 255 > abort" BSL length >255"
+ dup bwjoin send-summed
+;
+: frame( ( extra-len cmd -- )
+ bsl-sync ( extra-len cmd )
+ 0 to checksum ( extra-len cmd )
+ h# 80 swap bwjoin ( extra-len cmd,hdr )
+ send-summed ( extra-len )
+ 4 + send-length ( )
+;
+
+: send-address ( w -- ) send-summed ;
+: send-data-length ( w -- ) send-summed ;
+: send-xx ( -- ) 0 send-summed ; \ Send don't care word
+: send-data ( adr len -- )
+ bounds ?do i le-w@ send-summed /w +loop
+;
+: )frame-no-ack ( -- )
+ checksum h# ffff xor wbsplit swap send send
+;
+: )frame ( -- )
+ )frame-no-ack
+ ack? 0= abort" BSL - no ACK!"
+;
+
+: rx-data-block ( adr len device-adr -- )
+ over h# 12 frame( ( adr len device-adr )
+ send-summed ( adr len ) \ device address
+ dup send-summed ( adr len ) \ data length
+ send-data ( )
+ )frame
+;
+: rx-password ( adr len -- )
+ dup d# 32 <> abort" BSL password must be 32 bytes long"
+ dup h# 10 frame( ( adr len )
+ send-xx send-xx ( adr len )
+ send-data ( )
+ )frame
+;
+: ff-password ( -- )
+ " "(ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff)"
+ rx-password
+;
+: 00-password ( -- )
+ " "(00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff)"
+ rx-password
+;
+: (erase) ( device-adr code -- )
+ swap ( device-adr code )
+ 0 h# 16 frame( ( code device-adr )
+ send-summed ( code )
+ send-summed ( )
+ )frame
+;
+: erase-segment ( device-adr -- ) h# a502 (erase) ;
+: erase-main ( device-adr -- ) h# a504 (erase) ;
+: mass-erase ( -- ) 0 h# a506 (erase) ;
+: change-baud-rate ( d3 d2 d1 -- )
+ 0 h# 20 frame( ( d3 d2 d1 )
+ swap bwjoin send-summed ( d3 )
+ send-summed ( )
+ )frame
+;
+: set-mem-offset ( device-adr -- )
+ 0 h# 21 frame( ( device-adr )
+ send-xx ( device-adr )
+ send-summed ( )
+ )frame
+;
+: load-pc ( device-adr -- )
+ 0 h# 1a frame( ( device-adr )
+ send-summed ( )
+ send-xx ( )
+ )frame
+;
+: wait-word ( -- w ) wait-byte wait-byte bwjoin dup +sum ;
+
+: )frame-receive ( adr len -- )
+ )frame-no-ack
+ wait-byte case
+ h# 80 of endof
+ h# a0 of true abort" NAK!" endof
+ ( default ) ." Received unexpected response frame first byte " dup .x cr
+ abort
+ endcase
+ wait-byte ?dup if
+ ." Received unexpected response frame second byte " dup .x cr
+ abort
+ then
+ h# 80 to checksum
+
+ wait-word wbsplit ( adr len response-len1 response-len2 )
+
+ over <> abort" BSL - response length check byte mismatch" ( adr len response-len )
+ over <> abort" BSL - unexpected response length" ( adr len )
+ bounds ?do wait-word i le-w! /w +loop ( )
+ wait-word drop ( ) \ Get checksum and add it in
+ checksum h# ffff <> abort" BSL - bad response checksum" ( )
+;
+: tx-data-block ( adr len device-adr -- )
+ 0 h# 14 frame( ( adr len device-adr )
+ send-summed ( adr len )
+ dup send-summed ( adr len )
+ )frame-receive ( )
+;
+: tx-bsl-version ( adr len -- )
+ dup d# 16 <> abort" BSL version buffer must be 16 bytes long"
+ 0 h# 1e frame( ( adr len )
+ send-xx ( adr len )
+ send-xx ( adr len )
+ )frame-receive ( )
+;
+
+d# 250 constant /bsl-max-read
+: bsl-read ( adr len device-adr -- )
+ >r even ( adr len' r: device-adr )
+ begin dup 0> while ( adr len r: device-adr )
+ r@ (cr .x
+ 2dup /bsl-max-read min ( adr len adr thislen r: device-adr )
+ r@ tx-data-block ( adr len r: device-adr )
+ /bsl-max-read /string ( adr' len' r: device-adr )
+ r> /bsl-max-read + >r ( adr len r: device-adr' )
+ repeat ( adr len r: device-adr' )
+ r> 3drop
+;
+
+0 value next-address
+0 value line-#bytes
+d# 50 buffer: binary-buf
+
+: hex-number ( adr len -- n )
+ push-hex ( adr len )
+ $number abort" Bad number in TI TXT file" ( n )
+ pop-base
+;
+: program-bytes ( adr len -- )
+ d# 50 0 do ( adr len )
+ dup if ( adr len )
+ bl left-parse-string ( adr' len' head$ )
+ hex-number ( adr len n )
+ binary-buf i + c! ( adr len )
+ else ( adr len )
+ 2drop ( )
+ (cr next-address . ( )
+ i 1 and if ( )
+ h# ff binary-buf i + c! ( )
+ i 1+ ( len )
+ else ( )
+ i ( len )
+ then
+ binary-buf swap next-address rx-data-block
+ next-address i + to next-address
+ unloop exit
+ then
+ loop ( adr len )
+ true abort" TI TXT Line too long!"
+;
+: handle-line ( adr len -- )
+ dup 0= if 2drop exit then ( adr len )
+ over c@ case
+ [char] @ of ( adr len )
+ 1 /string hex-number to next-address
+ endof
+ [char] q of ( adr len )
+ 2drop ( )
+ endof ( adr len )
+ ( default ) ( adr len char )
+ -rot program-bytes ( char )
+ endcase ( )
+;
+: force-erase ( -- )
+ ." Resetting/erasing" cr
+ rst-bsl
+ ['] 00-password catch drop
+ rst-bsl
+ ff-password
+;
+d# 100 buffer: line-buf
+: $bsl-ti-text-file ( filename$ -- )
+ $read-open ( )
+ force-erase ( )
+ ." Programming" cr
+ begin ( )
+ line-buf d# 100 ifd @ read-line abort" Read line failed"
+ while ( len )
+ line-buf swap handle-line ( )
+ repeat ( len )
+ drop
+ ifd @ fclose
+;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2012 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
1
0
[commit] r3021 - cpu/arm/mmp2 cpu/arm/olpc cpu/mips/bonito cpu/mips/broadcom/avx cpu/mips/cobalt cpu/x86/pc/alex cpu/x86/pc/biosload cpu/x86/pc/emu cpu/x86/pc/lxdevel cpu/x86/pc/neptune cpu/x86/pc/...
by repository service June 29, 2012
by repository service June 29, 2012
June 29, 2012
Author: wmb
Date: Fri Jun 29 22:46:30 2012
New Revision: 3021
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3021
Log:
Changed OFW core code to allow phandle values to be origin-relative addresses instead of absolute (possibly run-time-relocated) addresses, thus making it much easier to encode phandle values in properties built at compile time.
Modified:
cpu/arm/mmp2/fw.bth
cpu/arm/mmp2/mmp2.bth
cpu/arm/olpc/banner.fth
cpu/arm/olpc/prefw.fth
cpu/mips/bonito/forthmon.bth
cpu/mips/bonito/fw.bth
cpu/mips/broadcom/avx/fw.bth
cpu/mips/cobalt/fw.bth
cpu/x86/pc/alex/fw.bth
cpu/x86/pc/biosload/fw.bth
cpu/x86/pc/emu/fw.bth
cpu/x86/pc/lxdevel/fw.bth
cpu/x86/pc/neptune/fw.bth
cpu/x86/pc/newton/fw.bth
cpu/x86/pc/olpc/banner.fth
cpu/x86/pc/olpc/fw.bth
cpu/x86/pc/olpc/via/banner.fth
cpu/x86/pc/olpc/via/fw.bth
ofw/core/ofwcore.fth
ofw/inet/dhcp.fth
ofw/inetv6/dhcp.fth
Modified: cpu/arm/mmp2/fw.bth
==============================================================================
--- cpu/arm/mmp2/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/arm/mmp2/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -47,7 +47,7 @@
device-end
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/arm/mmp2/mmp2.bth
==============================================================================
--- cpu/arm/mmp2/mmp2.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/arm/mmp2/mmp2.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -72,7 +72,7 @@
device-end
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/arm/olpc/banner.fth
==============================================================================
--- cpu/arm/olpc/banner.fth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/arm/olpc/banner.fth Fri Jun 29 22:46:30 2012 (r3021)
@@ -113,7 +113,7 @@
;
: .ec
- " ec-name" ['] root-node get-package-property 0= if ( adr len )
+ " ec-name" root-phandle get-package-property 0= if ( adr len )
get-encoded-string ." EC Firmware " type
then
;
Modified: cpu/arm/olpc/prefw.fth
==============================================================================
--- cpu/arm/olpc/prefw.fth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/arm/olpc/prefw.fth Fri Jun 29 22:46:30 2012 (r3021)
@@ -50,7 +50,7 @@
device-end
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/mips/bonito/forthmon.bth
==============================================================================
--- cpu/mips/bonito/forthmon.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/mips/bonito/forthmon.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -38,7 +38,7 @@
device-end
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/mips/bonito/fw.bth
==============================================================================
--- cpu/mips/bonito/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/mips/bonito/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -44,7 +44,7 @@
device-end
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/mips/broadcom/avx/fw.bth
==============================================================================
--- cpu/mips/broadcom/avx/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/mips/broadcom/avx/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -60,7 +60,7 @@
d# 81,000,000 to cpu-clock-speed \ CPU clock in Hz
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/mips/cobalt/fw.bth
==============================================================================
--- cpu/mips/cobalt/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/mips/cobalt/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -72,7 +72,7 @@
device-end
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/x86/pc/alex/fw.bth
==============================================================================
--- cpu/x86/pc/alex/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/x86/pc/alex/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -50,7 +50,7 @@
fload ${BP}/cpu/x86/msr.fth \ Access to machine specific registers
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/x86/pc/biosload/fw.bth
==============================================================================
--- cpu/x86/pc/biosload/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/x86/pc/biosload/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -53,7 +53,7 @@
fload ${BP}/cpu/x86/msr.fth \ Access to machine specific registers
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/x86/pc/emu/fw.bth
==============================================================================
--- cpu/x86/pc/emu/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/x86/pc/emu/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -50,7 +50,7 @@
fload ${BP}/cpu/x86/initpgm.fth \ Basic boot handler
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/x86/pc/lxdevel/fw.bth
==============================================================================
--- cpu/x86/pc/lxdevel/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/x86/pc/lxdevel/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -54,7 +54,7 @@
fload ${BP}/cpu/x86/msr.fth \ Access to machine specific registers
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/x86/pc/neptune/fw.bth
==============================================================================
--- cpu/x86/pc/neptune/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/x86/pc/neptune/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -53,7 +53,7 @@
fload ${BP}/cpu/x86/msr.fth \ Access to machine specific registers
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/x86/pc/newton/fw.bth
==============================================================================
--- cpu/x86/pc/newton/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/x86/pc/newton/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -50,7 +50,7 @@
fload ${BP}/cpu/x86/msr.fth \ Access to machine specific registers
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/x86/pc/olpc/banner.fth
==============================================================================
--- cpu/x86/pc/olpc/banner.fth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/x86/pc/olpc/banner.fth Fri Jun 29 22:46:30 2012 (r3021)
@@ -19,7 +19,7 @@
;
: .ec
- " ec-name" ['] root-node get-package-property 0= if ( adr len )
+ " ec-name" root-phandle get-package-property 0= if ( adr len )
get-encoded-string ." EC Firmware " type
then
;
Modified: cpu/x86/pc/olpc/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/x86/pc/olpc/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -53,7 +53,7 @@
fload ${BP}/cpu/x86/msr.fth \ Access to machine specific registers
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: cpu/x86/pc/olpc/via/banner.fth
==============================================================================
--- cpu/x86/pc/olpc/via/banner.fth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/x86/pc/olpc/via/banner.fth Fri Jun 29 22:46:30 2012 (r3021)
@@ -113,7 +113,7 @@
;
: .ec
- " ec-name" ['] root-node get-package-property 0= if ( adr len )
+ " ec-name" root-phandle get-package-property 0= if ( adr len )
get-encoded-string ." EC Firmware " type
then
;
Modified: cpu/x86/pc/olpc/via/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/via/fw.bth Fri Jun 29 22:32:59 2012 (r3020)
+++ cpu/x86/pc/olpc/via/fw.bth Fri Jun 29 22:46:30 2012 (r3021)
@@ -53,7 +53,7 @@
fload ${BP}/cpu/x86/msr.fth \ Access to machine specific registers
: (cpu-arch ( -- adr len )
- " architecture" ['] root-node get-package-property drop
+ " architecture" root-phandle get-package-property drop
get-encoded-string
;
' (cpu-arch to cpu-arch
Modified: ofw/core/ofwcore.fth
==============================================================================
--- ofw/core/ofwcore.fth Fri Jun 29 22:32:59 2012 (r3020)
+++ ofw/core/ofwcore.fth Fri Jun 29 22:46:30 2012 (r3021)
@@ -682,6 +682,13 @@
defer voc>phandle ' noop to voc>phandle
defer phandle>voc ' noop to phandle>voc
+defer dt-null ' null to dt-null
+
+\ : : : lastacf .name cr ;
+
+: rel-voc>phandle ( voc -- ph ) origin - ; ' rel-voc>phandle to voc>phandle
+: rel-phandle>voc ( ph -- voc ) origin + ; ' rel-phandle>voc to phandle>voc
+' 0 to dt-null
\ TODO
\ Don't use the system search order; use a private stack
@@ -689,9 +696,11 @@
\ Change names back from "regprop" to "reg", etc.
\ Either implement a true breadth-first search or don't specify it.
+: cdev drop context token@ voc>phandle ;
+: devc drop phandle>voc context token! definitions ;
2 actions
-action: drop context token@ voc>phandle ;
-action: drop phandle>voc context token! definitions ;
+action: cdev ;
+action: devc ;
create current-device use-actions
headerless
@@ -725,7 +734,7 @@
constant /devnode-extra
headers
-: >parent ( node -- parent-node ) >voc-link link@ voc>phandle ;
+: >parent ( node -- parent-node ) phandle>voc >voc-link link@ voc>phandle ;
: parent-device ( -- parent-node ) current-device >parent ;
: (select-package) ( phandle -- ) phandle>voc execute ;
@@ -739,8 +748,9 @@
: push-device ( acf -- ) to current-device ;
: pop-device ( -- )
- parent-device ( parent-voc )
- non-null? if push-device then
+ parent-device ( parent-phandle )
+ dup dt-null <> if push-device else drop then
+\ non-null? if push-device then
;
\ Each package instance has its own private data storage area.
@@ -1099,7 +1109,7 @@
\ Internal factor used to implement first-child and next-child
: set-child? ( link-adr -- flag )
- get-token? if push-device true else false then
+ get-token? if voc>phandle push-device true else false then
;
\ Interface to searching code in breadth.fth:
@@ -1125,7 +1135,7 @@
\ Allocate user (RAM) space for properties, "last" field, children, peers
/devnode-extra unaligned-ualloc drop
- lastacf push-device ( parent's-child-field )
+ lastacf voc>phandle push-device ( parent's-child-field )
;
: init-properties ( -- ) (vocabulary) lastacf 'properties token! ;
@@ -1150,7 +1160,7 @@
headerless
: link-to-peer ( parent's-child-field -- )
dup token@ 'peer token! ( parent's-child-field )
- current-device swap token! ( )
+ current-device phandle>voc swap token! ( )
;
: device-node? ( voc -- flag )
voc-link begin another-link? while ( voc link )
@@ -1187,7 +1197,7 @@
headers
: new-node ( -- )
- (vocabulary) current-device link, ( ) \ Up-link to parent device
+ (vocabulary) current-device phandle>voc link, ( ) \ Up-link to parent device
\ Save parent linkage address on stack for later use
'child ( parent's-child-field )
@@ -1266,10 +1276,11 @@
0 init-node
allot-package-data
device-end
+: root-phandle ( -- ph ) ['] root-node voc>phandle ;
-: root-device ( -- ) only forth also ['] root-node push-device ;
+: root-device ( -- ) only forth also root-phandle push-device ;
-: root-device? ( -- flag ) parent-device null = ;
+: root-device? ( -- flag ) parent-device dt-null = ;
: finish-device ( -- ) finish-package-data pop-device ;
@@ -1732,10 +1743,10 @@
\ The path starts at the root directory if the first character is "/";
\ otherwise it starts at the current directory
dup 1 >= if ( str$ )
- over c@ ascii / = if 1 /string ['] root-node push-device then
+ over c@ ascii / = if 1 /string root-phandle push-device then
then ( str$ )
- current-device null = ?not-found
+ current-device dt-null = ?not-found
device-context? 0= ?not-found
(find-device)
;
@@ -1939,7 +1950,7 @@
device-context? if
'child token@ ( first-node )
begin non-null? while ( node )
- push-device ( )
+ voc>phandle push-device ( )
.nodeid ( )
'peer token@ ( node' )
pop-device
@@ -1970,7 +1981,7 @@
;
: .voc-name ( a -- )
dup device-node? if
- current-device swap context token! (pwd) space
+ current-device phandle>voc swap context token! (pwd) space
context token!
else
.name
@@ -2050,10 +2061,10 @@
\ transient
headerless
: relink-device ( -- false )
- current-device relink-voc false
+ current-device phandle>voc relink-voc false
;
: relink-devices ( -- )
- ['] root-node push-package
+ root-phandle push-package
['] relink-device (search-preorder) drop
pop-package
;
@@ -2076,7 +2087,7 @@
' noop is fm-hook
: find-method ( adr len phandle -- false | acf true )
- fm-hook (search-wordlist)
+ fm-hook phandle>voc (search-wordlist)
;
headerless
@@ -2098,7 +2109,7 @@
headers
: $call-self ( adr len -- )
my-self if
- my-voc fm-hook $find-word if execute exit then
+ my-voc fm-hook phandle>voc $find-word if execute exit then
then
my-self to error-instance
error-instance if my-voc to error-package then
@@ -2195,7 +2206,7 @@
\ because we use "exit" to make the control flow easier.
: (get-any) ( adr len -- true | adr' len' false )
begin my-self while ( adr len ) \ Search up parent chain
- my-voc current token! ( adr len )
+ my-voc phandle>voc current token! ( adr len )
2dup get-my-property 0= if ( adr len adr' len' )
2swap 2drop false exit ( adr' len' false ) \ Found
then ( adr len )
@@ -2433,7 +2444,7 @@
?dup if ( path$ )
\ Establish the initial parent
also ( path$ )
- null to current-device ( path$ )
+ dt-null to current-device ( path$ )
['] (open-path) catch dup if nip nip then ( error? )
previous definitions ( error? )
throw ( )
@@ -2596,7 +2607,7 @@
: (execute-phandle-method) ( method-adr,len phandle -- ??? )
0 to unit#-valid? ( method-adr,len phandle )
- dup >parent null open-parents ( method-adr,len phandle )
+ dup >parent dt-null open-parents ( method-adr,len phandle )
push-device ( method-adr,len )
" " new-instance ( method-adr,len )
set-default-unit ( method-adr,len )
@@ -2608,7 +2619,7 @@
0 package( ( phandle )
current-device >r ( phandle )
0 to unit#-valid? ( phandle )
- null ['] open-parents catch if ( x x )
+ dt-null ['] open-parents catch if ( x x )
2drop 0 ( 0 )
else ( )
my-self ( ihandle )
@@ -2674,7 +2685,7 @@
: my-parent-#size-cells ( -- #size-cells )
\ Root node has no parent, therefore the size of its parent's address
\ space is meaningless
- my-voc ['] root-node = if 0 exit then
+ my-voc root-phandle = if 0 exit then
" #size-cells" my-parent ihandle>phandle ( adr len phandle )
get-package-property if 1 else get-encoded-int then
@@ -2756,6 +2767,9 @@
>r >r >r encode-phys r> r> r> encode-reg encode+
;
headers
+: encode-phandle ( name$ -- adr len )
+ locate-device abort" encode-phandle - Can't find package" encode-int
+;
\ From finddisp.fth
purpose:
@@ -2895,7 +2909,7 @@
also magic-device-types definitions
: display ( -- )
- 'fb-node token@ origin = if current-device 'fb-node token! then
+ 'fb-node token@ origin = if current-device phandle>voc 'fb-node token! then
;
previous definitions
@@ -2908,13 +2922,16 @@
\ Create the standard system nodes
+hex
+\ debug devc
root-device
new-device \ Node for software "library" packages
" packages" device-name
- new-device current-device to client-services
+ new-device current-device phandle>voc to client-services
" client-services" device-name
finish-device
+
finish-device
new-device \ Reports firmware run-time choices
@@ -3248,7 +3265,7 @@
false value verbose-do-method?
: do-method? ( -- )
- method-name 2@ current-device (search-wordlist) if ( xt )
+ method-name 2@ current-device phandle>voc (search-wordlist) if ( xt )
drop pwd$ ( path-adr,len )
verbose-do-method? if 2dup type cr then
method-name 2@ execute-device-method drop cr ( )
@@ -3284,7 +3301,7 @@
' (hold-message) to hold-message
: most-tests ( -- exit? )
- " selftest" current-device (search-wordlist) if ( xt )
+ " selftest" current-device phandle>voc (search-wordlist) if ( xt )
drop ( )
@@ -3520,8 +3537,14 @@
: msize ( adr -- count ) dbuf-data> dbuf-size@ dbuf-data> ;
: >dbuf-header ( adr -- 'dbuf )
- dbuf-data> ( 'dbuf )
- dup dbuf-flag@ *dbuf-used* - abort" bad heap address."
+ dbuf-data> ( 'dbuf )
+ dup dbuf-flag@ case ( 'dbuf )
+ *dbuf-used* of endof ( 'dbuf )
+ *dbuf-free* of
+ true abort" Freeing or resizing already-free memory"
+ endof
+ true abort" bad heap address."
+ endcase ( 'dbuf )
;
: free-memory ( adr -- )
>dbuf-header merge-down link-with-free
@@ -4093,7 +4116,7 @@
;
: setnode ( nodeid | 0 -- )
- dup 0= if drop ['] root-node then (push-package)
+ dup 0= if drop root-phandle then (push-package)
;
\ : copyout ( buf adr len -- len ) >r swap r@ cmove r> ;
@@ -4192,24 +4215,25 @@
setnode ( )
0 'child ( last-nodeid &next-nodeid )
begin get-token? while ( last-nodeid next-nodeid )
- nip dup (select-package) ( next-nodeid )
+ nip dup voc>phandle (select-package) ( next-nodeid )
'peer ( last-nodeid' &next-nodeid )
repeat ( last-nodeid' )
(pop-package) ( nodeid )
+ dup if voc>phandle then
;
: peer ( phandle -- phandle' )
dup 0= if
- drop ['] root-node exit
+ drop root-phandle exit
then ( nodeid )
- dup ['] root-node = if
+ dup root-phandle = if
drop 0 exit
then ( nodeid )
\ Select the first child of our parent
dup >parent (push-package) ( nodeid )
- 'child token@ (select-package) ( nodeid )
+ 'child token@ voc>phandle (select-package) ( nodeid )
dup current-device = if ( nodeid )
\ Argument node is first child of parent; return "no more nodes"
@@ -4217,7 +4241,7 @@
else ( nodeid )
\ Search for the node preceding the argument node
begin ( nodeid )
- 'peer token@ 2dup <> ( nodeid next-nodeid flag )
+ 'peer token@ voc>phandle 2dup <> ( nodeid next-nodeid flag )
while ( nodeid next-nodeid )
push-device ( nodeid )
repeat ( nodeid )
@@ -4227,7 +4251,7 @@
;
: parent ( phandle -- phandle' )
- dup ['] root-node = if ( root-phandle )
+ dup root-phandle = if ( root-phandle )
drop 0 exit ( 0 )
then ( parent-phandle )
>parent
@@ -4429,7 +4453,7 @@
: (canon) ( path$ -- )
?dup if ( path$ )
\ Establish the initial parent
- null to current-device ( path$ )
+ dt-null to current-device ( path$ )
?expand-alias ( path$ )
begin canon-node dup 0= until ( path$' )
2drop ( )
@@ -4802,7 +4826,7 @@
;
: resolve-ih-method ( adr len ihandle -- xt )
dup 0= if 3drop ['] not-colon exit then ( adr len ihandle )
- package( my-voc $find-word )package ?not-colon ( xt )
+ package( my-voc phandle>voc $find-word )package ?not-colon ( xt )
;
: resolve-voc-method ( adr len voc -- xt )
(search-wordlist) ?not-colon
@@ -4847,17 +4871,17 @@
then ( xt )
dup ['] package-execute = if ( [ adr len ] xt )
- drop 2dup current-device ( adr len voc )
+ drop 2dup current-device ( adr len phandle )
resolve-ph-method exit ( -- xt )
then ( xt )
dup ['] apply-method = if ( [ adr len ] xt )
- drop 2dup my-voc ( adr len voc )
+ drop 2dup my-voc phandle>voc ( adr len voc )
resolve-voc-method exit ( -- xt )
then ( xt )
dup ['] (apply-method) = if ( [ adr len ] xt )
- drop 2dup my-voc ( adr len voc )
+ drop 2dup my-voc phandle>voc ( adr len voc )
resolve-voc-method exit ( -- xt )
then ( xt )
;
Modified: ofw/inet/dhcp.fth
==============================================================================
--- ofw/inet/dhcp.fth Fri Jun 29 22:32:59 2012 (r3020)
+++ ofw/inet/dhcp.fth Fri Jun 29 22:46:30 2012 (r3021)
@@ -89,7 +89,7 @@
: .nak-message ( -- ) d# 56 find-option if -nulls type cr then ;
: root-property ( name$ -- true | value false )
- ['] root-node get-package-property
+ root-phandle get-package-property
;
\ Add a "vendor class" option if there is an "architecture" property
@@ -520,7 +520,7 @@
\ we return the system architecture name in bootp-name-buf.
bootp-name-buf count nip 0= if
file-name-buf c@ 0= if
- " architecture" ['] root-node get-package-property 0= if ( prop$ )
+ " architecture" root-phandle get-package-property 0= if ( prop$ )
get-encoded-string ( name$ )
bootp-name-buf place ( )
then
Modified: ofw/inetv6/dhcp.fth
==============================================================================
--- ofw/inetv6/dhcp.fth Fri Jun 29 22:32:59 2012 (r3020)
+++ ofw/inetv6/dhcp.fth Fri Jun 29 22:46:30 2012 (r3021)
@@ -89,7 +89,7 @@
: .nak-message ( -- ) d# 56 find-option if -nulls type cr then ;
: root-property ( name$ -- true | value false )
- ['] root-node get-package-property
+ root-phandle get-package-property
;
\ Add a "vendor class" option if there is an "architecture" property
@@ -477,7 +477,7 @@
\ we return the system architecture name in bootp-name-buf.
bootp-name-buf count nip 0= if
file-name-buf c@ 0= if
- " architecture" ['] root-node get-package-property 0= if ( prop$ )
+ " architecture" root-phandle get-package-property 0= if ( prop$ )
get-encoded-string ( name$ )
bootp-name-buf place ( )
then
1
0
Author: wmb
Date: Fri Jun 29 22:32:59 2012
New Revision: 3020
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3020
Log:
OLPC ARM - Rearrangement of resetvec.fth / resetvec.bth so a different config
file can be used for different platform builds. No functional change.
Added:
cpu/arm/olpc/1.75/resetvec.bth
cpu/arm/olpc/3.0/resetvec.bth
cpu/arm/olpc/resetvec.fth
- copied unchanged from r3019, cpu/arm/olpc/resetvec.bth
Deleted:
cpu/arm/olpc/resetvec.bth
Added: cpu/arm/olpc/1.75/resetvec.bth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/1.75/resetvec.bth Fri Jun 29 22:32:59 2012 (r3020)
@@ -0,0 +1,7 @@
+purpose: Build script for low-level startup code
+
+command: &builder &this
+build-now
+
+fload ${BP}/cpu/arm/olpc/1.75/config.fth
+fload ${BP}/cpu/arm/olpc/resetvec.fth
Added: cpu/arm/olpc/3.0/resetvec.bth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/3.0/resetvec.bth Fri Jun 29 22:32:59 2012 (r3020)
@@ -0,0 +1,7 @@
+purpose: Build script for low-level startup code
+
+command: &builder &this
+build-now
+
+fload ${BP}/cpu/arm/olpc/3.0/config.fth
+fload ${BP}/cpu/arm/olpc/resetvec.fth
Copied: cpu/arm/olpc/resetvec.fth (from r3019, cpu/arm/olpc/resetvec.bth)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/resetvec.fth Fri Jun 29 22:32:59 2012 (r3020, copy of r3019, cpu/arm/olpc/resetvec.bth)
@@ -0,0 +1,279 @@
+\ See license at end of file
+purpose: Low-level startup code
+
+\ create debug-reset
+
+\needs start-assembling fload ${BP}/cpu/arm/asmtools.fth
+\needs write-dropin fload ${BP}/forth/lib/mkdropin.fth
+
+hex
+
+also forth definitions
+: c$, ( adr len -- )
+ 1+ here swap note-string dup allot move 4 (align)
+;
+previous definitions
+
+also arm-assembler definitions
+: $find-dropin, ( adr len -- )
+ 2>r
+ " mov r0,pc" evaluate \ Get address of string
+ " ahead" evaluate \ Skip string
+ 2r> c$, \ Place string
+ " then" evaluate
+ " bl `find-dropin`" evaluate \ and call find routine
+;
+previous definitions
+
+\ /fw-mem constant stack-offset \ Offset of top of inflater stack within destination RAM
+stack-offset h# 2.0000 - constant workspace-offset \ Offset of inflater workspace within destination RAM
+
+start-assembling
+
+label my-entry
+\ **** This is the primary entry point; it will contain a branch instruction
+\ that skips a few subroutines and lands at the startup sequence. That
+\ branch instruction is patched in below.
+ 0 , \ To be patched later
+end-code
+
+fload ${BP}/cpu/arm/olpc/numdot.fth
+
+\ This subroutine is used by the startup code.
+\ It compares two null-terminated strings, returning zero if they match.
+\ Destroys: r2, r3
+label strcmp ( r0: str1 r1: str2 -- r0: 0 if match, nonzero if mismatch )
+ begin
+ ldrb r2,[r0],#1
+ ldrb r3,[r1],#1
+ cmp r2,r3
+ <> if
+ sub r0,r3,r2
+ mov pc,lr
+ then
+
+ cmp r2,#0
+ = until
+ mov r0,#0
+ mov pc,lr
+end-code
+
+\ This subroutine is used by the startup code.
+\ It searches the ROM for a dropin module whose name field matches the
+\ null-terminated string that is passed in r0.
+\ Destroys: r1-6
+label find-dropin ( r0: module-name-ptr -- r0: address|-1 )
+ mov r6,lr \ r6: return address
+ mov r5,r0 \ r5: module name
+
+ \ Compute address of first dropin (the one containing this code)
+\ sub r4,pc,`here asm-base - h# 20 + 8 + #` \ r4: module pointer
+ set r4,`'dropins #`
+
+ begin
+ ldr r1,[r4]
+ set r2,#0x444d424f \ 'OBMD' in little-endian
+ cmp r1,r2
+ = while
+ mov r0,r5
+ add r1,r4,#16
+ bl `strcmp`
+ cmp r0,#0
+ = if \ It the strings match, we found the dropin
+ mov r0,r4
+ mov pc,r6
+ then
+ ldr r0,[r4,#4] \ Length of dropin image
+ eor r1,r0,r0, ror #16 \ Byte reverse r0
+ bic r1,r1,#0xff0000 \ using the tricky sequence
+ mov r0,r0,ror #8 \ shown in the ARM Programming Techniques
+ eor r0,r0,r1,lsr #8 \ manual
+
+ add r0,r0,r4 \ Added to base address of previous dropin
+ add r0,r0,#35 \ Plus length of header (32) + roundup (3)
+ bic r4,r0,#3 \ Aligned to 4-byte boundary = new dropin addr
+ repeat
+
+ mvn r0,#0 \ No more dropins; return -1 to indicate failure
+ mov pc,r6
+end-code
+
+\ This subroutine is used by the startup code.
+\ It copies n (r2) bytes of memory from src (r1) to dst (r0)
+\ Destroys: r0-r3
+label memcpy ( r0: dst r1: src r2: n -- r0: dst )
+ ahead begin
+ ldr r3,[r1],#4
+ str r3,[r0],#4
+ but then
+ subs r2,r2,#4
+ 0< until
+
+ mov pc,lr
+end-code
+
+\ Load some additional subroutines that are used by the startup code
+fload ${BP}/cpu/arm/olpc/initmmu.fth \ Setup the initial virtual address map
+
+\ **** This is the main-line code for the initial startup sequence.
+\ It is reached from a branch instruction (which will be patched in later)
+\ at the beginning of this module.
+
+label startup
+
+\ Place a branch instruction to this location at the entry address
+\ (i.e. the beginning) of this module
+here my-entry put-branch
+
+[ifdef] notdef
+ \ Locate and execute the dropin module named "start".
+ \ That module's job is to initialize the core logic and memory controller
+ \ at least to the point that memory works, and to size the memory.
+ \ It returns in r0 the physical address just past the end of the last
+ \ bank of memory. Near the beginning of the last megabyte of memory,
+ \ it stores bitmasks describing which memory banks are populated.
+
+ " start" $find-dropin, \ Assemble call to find-dropin with literal arg
+
+ add r0,r0,#32 \ Skip dropin header
+ mov lr,pc \ Set return address
+ mov pc,r0 \ Execute the dropin
+[then]
+
+ mov r0,#0x10
+ bl `puthex`
+
+ \ Setup the page (section) table and turn on the MMU and caches
+\ set r0,`page-table-pa #`
+ bl `init-map` \ Setup the initial virtual address map
+ bl `enable-mmu` \ Turn on the MMU
+ bl `caches-on` \ Turn on the caches
+
+ mov r0,#0x11
+ bl `puthex`
+
+ \ Now we are running with the MMU and caches on, thus going faster
+
+ \ Locate the dropin module named "firmware".
+
+ " firmware" $find-dropin, \ Assemble call to find-dropin with literal arg
+
+ ldr r1,[r0,#12] \ Get the module's "expanded size" field,
+ cmp r1,#0 \ which will be non0 if the module's compressed
+ <> if
+ \ The firmware dropin is compressed, so we find the inflater
+ \ and use it to inflate the firmware into RAM
+ mov r11,r0 \ Save address of firmware dropin
+
+ mov r0,#0x12
+ bl `puthex`
+
+ \ Locate the "inflate" module.
+ " inflate" $find-dropin, \ Assemble call to find-dropin with literal arg
+
+ add r4,r0,#32 \ r1: Base address of inflater code
+
+ mov r0,#0x13
+ bl `puthex`
+
+ \ Execute the inflater, giving it the address of the compressed firmware
+ \ module, the address where the inflated firmware should be placed, and
+ \ the address of some RAM the inflater can use for scratch variables.
+
+ set r0,`fw-virt-base workspace-offset + #` \ Scratch RAM for inflater
+ mov r1,#0 \ No-header flag (false)
+ set r2,`fw-virt-base #` \ Firmware RAM address
+ add r3,r11,#32 \ Address of compressed bits of firmware dropin
+
+ set sp,`fw-virt-base stack-offset + #` \ Stack for inflater
+
+[ifdef] notdef
+ \ Simple recipe for debug output to serial port
+ set r11, #0xd4018000
+ begin
+ ldr r10,[r11,0x14]
+ ands r10,r10,#0x20
+ 0<> until
+ set r10, #0x43 \ C
+ str r10, [r11]
+[then]
+
+ mov lr,pc
+ mov pc,r4 \ Inflate the firmware
+
+ else
+ \ The firmware dropin isn't compressed, so we just copy it to RAM
+
+ mov r11,r0
+
+ mov r0,#0x14
+ bl `puthex`
+
+ ldr r2,[r11,#4] \ Length of image
+
+ eor r1,r2,r2, ror #16 \ Byte reverse r2 using the
+ bic r1,r1,#0xff0000 \ tricky sequence shown in the
+ mov r2,r2,ror #8 \ ARM Programming Techniques
+ eor r2,r2,r1,lsr #8 \ manual
+
+ add r1,r0,#32 \ src: Skip dropin header
+
+ set r0,`fw-virt-base #` \ dst: Firmware RAM address
+ bl `memcpy` \ Copy the firmware
+ then
+
+ mov r0,#0x15
+ bl `puthex`
+
+ \ Synchronize the instruction and data caches so the firmware code can
+ \ be executed.
+ bl `sync-caches` \ Push Forth dictionary to memory
+
+ mov r0,#0x16
+ bl `puthex`
+
+[ifdef] notdef
+ " nanoforth" $find-dropin, \ Assemble call to find-dropin with literal arg
+
+ add r0,r0,#32 \ Skip dropin header
+ mov lr,pc \ Set return address
+ mov pc,r0 \ Execute the dropin
+[then]
+
+ \ Jump to the RAM firmware image
+ set r4, `fw-virt-base #` \ RAM start address
+ mov pc, r4
+
+ \ Notreached, in theory
+ begin again
+end-code
+
+end-assembling
+
+writing resetvec.img
+asm-base here over - ofd @ fputs
+ofd @ fclose
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
1
0
Author: wmb
Date: Fri Jun 29 22:27:32 2012
New Revision: 3019
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3019
Log:
Intermediate step in preparation for renaming resetvec.bth to resetvec.fth
Modified:
cpu/arm/olpc/resetvec.bth
Modified: cpu/arm/olpc/resetvec.bth
==============================================================================
--- cpu/arm/olpc/resetvec.bth Thu Jun 28 10:51:30 2012 (r3018)
+++ cpu/arm/olpc/resetvec.bth Fri Jun 29 22:27:32 2012 (r3019)
@@ -1,16 +1,11 @@
\ See license at end of file
purpose: Low-level startup code
-command: &builder &this
-build-now
-
\ create debug-reset
\needs start-assembling fload ${BP}/cpu/arm/asmtools.fth
\needs write-dropin fload ${BP}/forth/lib/mkdropin.fth
-fload ${BP}/cpu/arm/olpc/1.75/config.fth
-
hex
also forth definitions
@@ -38,9 +33,7 @@
label my-entry
\ **** This is the primary entry point; it will contain a branch instruction
\ that skips a few subroutines and lands at the startup sequence. That
-\ branch instruction is patched in below. The entry point for this module
-\ is in turn reached from a branch instruction at the beginning of the ROM,
-\ which is created by the file arch/dna/resetvec.bth
+\ branch instruction is patched in below.
0 , \ To be patched later
end-code
1
0
Author: quozl
Date: Thu Jun 28 10:51:30 2012
New Revision: 3018
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3018
Log:
OLPC - further work on libertas antenna test, #11976
Modified:
dev/libertas.fth
ofw/wifi/wifi-cfg.fth
Modified: dev/libertas.fth
==============================================================================
--- dev/libertas.fth Wed Jun 27 10:56:28 2012 (r3017)
+++ dev/libertas.fth Thu Jun 28 10:51:30 2012 (r3018)
@@ -1674,18 +1674,13 @@
: get-rssi ( -- avg_nf avg_snr nf snr )
2 h# 1f ( CMD_802_11_RSSI ) prepare-cmd
- 8 +xw \ number of beacons (N) to average the SNR and NF over
+ d# 32 +xw \ number of beacons (N) to average the SNR and NF over
outbuf-wait drop
- \ cmd_ds_802_11_rssi, observed response
- \ __le16 snr; /* most recent SNR */
- \ __le16 nf; /* most recent noise floor */
- \ __le16 avg_snr; /* average SNR weighted by N from request */
- \ __le16 avg_nf; /* average noise floor weighted by N from request */
respbuf >fw-data >r
- r@ 6 + le-w@ ( avg_nf )
- r@ 4 + le-w@ ( avg_nf avg_snr )
- r@ 2 + le-w@ ( avg_nf avg_snr nf )
- r@ le-w@ ( avg_nf avg_snr nf snr )
+ r@ 6 + le-w@ negate ( avg_nf ) \ dBm
+ r@ 4 + le-w@ ( avg_nf avg_snr ) \ dB
+ r@ 2 + le-w@ negate ( avg_nf avg_snr nf ) \ dBm
+ r@ le-w@ ( avg_nf avg_snr nf snr ) \ dB
r> drop
;
@@ -1704,7 +1699,6 @@
: set-antenna-diversity ( -- )
h# ffff 2 ( ACT_SET_TX ) rf-antenna
- d# 1000 ms
h# ffff 1 ( ACT_SET_RX ) rf-antenna
;
@@ -1713,41 +1707,6 @@
h# 0 8 ( ACT_GET_TX ) rf-antenna respbuf >fw-data 2+ le-w@ ( rx tx )
;
-: .antenna
- base @ decimal
- get-rssi
- ." snr:" 3 .r ." nf:" 3 .r ." avg_snr:" 3 .r ." avg_nf:" 3 .r
- hex
- get-antenna swap ." rx:" 4 .r ." tx:" 4 .r
- ." "
- base !
-;
-
-: test-antenna
- ." keys: (0,1,2,l,r,d,q)" cr
- begin
- .antenna
- key? if
- cr
- .antenna
- key
- case
- h# 71 ( q ) of cr exit endof
- h# 1b ( esc ) of cr exit endof
- h# 30 ( 0 ) of ." rx/tx to 0/0" 0 0 set-antenna endof
- h# 31 ( 1 ) of ." rx/tx to 1/1" 1 1 set-antenna endof
- h# 32 ( 2 ) of ." rx/tx to 2/2" 2 2 set-antenna endof
- h# 6c ( l ) of ." rx/tx to 1/2" 1 2 set-antenna endof
- h# 72 ( r ) of ." rx/tx to 2/1" 2 1 set-antenna endof
- h# 64 ( d ) of ." diversity" cr h# ffff dup set-antenna endof
- endcase
- then
- d# 100 ms
- (cr
- false
- until
-;
-
: .hw-spec ( -- )
marvel-get-hw-spec if
." marvel-get-hw-spec command failed" cr
@@ -2227,6 +2186,58 @@
: scan-wifi ( -- ) (scan-wifi) drop ;
+: .rssi ( snr nf -- )
+ 2dup swap + ." rssi" 4 .r ( snr nf )
+ ." snr" 3 .r ." nf" 4 .r ( )
+;
+
+: .antenna ( antenna -- )
+ dup h# ffff = if ." d" drop exit then \ diversity (default)
+ dup h# 100 = if ." ?" drop exit then \ occurs after 0/0
+ 2 .r
+;
+
+: show-antenna ( -- )
+ base @ ( base )
+ get-rssi ( base avg_nf avg_snr nf snr )
+ decimal
+ ." now" .rssi ( base avg_nf avg_snr )
+ ." avg" .rssi ( base )
+ get-antenna swap ( base tx rx )
+ hex
+ ." rx" .antenna ." tx" .antenna ( base )
+ ." "
+ base !
+;
+
+: ta-scan ( -- )
+ ." scan" cr
+ (scan) ( adr len error? )
+ 0= if drop .ssids cr then ( )
+;
+
+: test-antenna ( -- )
+ ." keys: (0,1,2,l,r,d,a,s,q)" cr
+ begin
+ d# 100 ms show-antenna key? if
+ cr show-antenna key
+ case
+ h# 71 ( q ) of cr exit endof
+ h# 1b of cr exit endof
+ h# 30 ( 0 ) of ." rx/tx to 0/0" 0 0 set-antenna endof
+ h# 31 ( 1 ) of ." rx/tx to 1/1" 1 1 set-antenna endof
+ h# 32 ( 2 ) of ." rx/tx to 2/2" 2 2 set-antenna endof
+ h# 6c ( l ) of ." rx/tx to 1/2" 1 2 set-antenna endof
+ h# 72 ( r ) of ." rx/tx to 2/1" 2 1 set-antenna endof
+ h# 64 ( d ) of ." diversity" cr set-antenna-diversity endof
+ h# 61 ( a ) of ." associate" cr close open drop endof
+ h# 73 ( s ) of ta-scan endof
+ endcase
+ then
+ (cr false
+ until
+;
+
: selftest ( -- error? ) (scan-wifi) ;
headers
Modified: ofw/wifi/wifi-cfg.fth
==============================================================================
--- ofw/wifi/wifi-cfg.fth Wed Jun 27 10:56:28 2012 (r3017)
+++ ofw/wifi/wifi-cfg.fth Thu Jun 28 10:51:30 2012 (r3018)
@@ -117,6 +117,11 @@
optional-arg-or-/$ ['] wifi-children scan-subtree
;
+: test-antenna ( -- )
+ " /wlan" open-dev >r ( r: dev )
+ " test-antenna" r@ $call-method ( r: dev )
+ r> close-dev ( )
+;
0 [if]
1
0