Author: wmb Date: Mon Aug 29 03:21:48 2011 New Revision: 2479 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2479
Log: OLPC XO-1.75 - Big renaming of configuration constants associated with memory layout, accomplishing 3 things: a) To adapt to a different memory size, you now only have to change one parameter - /ram-total - instead of changing several. b) The early diagnostic frame buffer, used for numeric progress codes, is now stored in SRAM instead of DRAM, so its location does not change for different memory sizes. There is a corresponding change in CForth. c) The naming convention for memory resource addresses and sizes is now consistent - *-mem-pa for the address and /*-mem for the size - instead of the mixed bag that existed before.
Modified: cpu/arm/mmp2/hwaddrs.fth cpu/arm/mmp2/mmuon.fth cpu/arm/mmp2/rootnode.fth cpu/arm/olpc/1.75/addrs.fth cpu/arm/olpc/1.75/config.fth cpu/arm/olpc/1.75/devices.fth cpu/arm/olpc/1.75/fw.bth cpu/arm/olpc/1.75/lcd.fth cpu/arm/olpc/1.75/probemem.fth cpu/arm/olpc/fbnums.fth cpu/arm/olpc/initmmu.fth cpu/arm/olpc/numdot.fth cpu/arm/olpc/resetvec.bth
Modified: cpu/arm/mmp2/hwaddrs.fth ============================================================================== --- cpu/arm/mmp2/hwaddrs.fth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/mmp2/hwaddrs.fth Mon Aug 29 03:21:48 2011 (r2479) @@ -1,11 +1,29 @@ \ Defined by MMP2 hardware -h# 01.9000 constant gpio-base -h# 05.1024 constant acgr-pa +h# d000.0000 constant memctrl-pa + +h# d100.0000 constant sram-pa \ Base of SRAM +h# 0030.0000 constant /sram \ Size of SRAM + +h# d400.0000 constant apb-pa \ Base of APB bus +h# d420.0000 constant axi-pa \ Base of AXI bus + +h# e000.0000 constant audio-sram-pa \ Base of Audio SRAM +h# 0010.0000 constant /audio-sram \ Size of Audio SRAM + +apb-pa constant io-pa \ We use this as the base for most IO accesses +h# 0040.0000 constant /io + +\ The following are offsets from io-pa +\ AXI devices +h# 01.4000 constant timer-pa h# 01.5000 constant clock-unit-pa +h# 01.9000 constant gpio-base h# 05.0000 constant main-pmu-pa -h# 28.2800 constant pmua-pa \ Application processor PMU register base +h# 05.1024 constant acgr-pa + +\ APB devices h# 20.b800 constant dsi1-pa \ 4-lane controller h# 20.ba00 constant dsi2-pa \ 3-lane controller h# 20.b000 constant lcd-pa -h# 01.4000 constant timer-pa +h# 28.2800 constant pmua-pa \ Application processor PMU register base
Modified: cpu/arm/mmp2/mmuon.fth ============================================================================== --- cpu/arm/mmp2/mmuon.fth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/mmp2/mmuon.fth Mon Aug 29 03:21:48 2011 (r2479) @@ -23,11 +23,11 @@ ;
: ofw-sections ( -- ) - h# 0000.0000 h# c0e over dma-base map-sections \ Cache and write bufferable - dma-base h# c02 over dma-size map-sections \ Non-cacheable DMA space + h# 0000.0000 h# c0e over dma-mem-pa map-sections \ Cache and write bufferable + dma-mem-pa h# c02 over /dma-mem map-sections \ Non-cacheable DMA space extra-mem-pa h# c0e over /extra-mem map-sections \ Cache and write bufferable - fw-pa h# c0e over /fw-ram map-sections \ Cache and write bufferable - fb-pa h# c06 over fb-size map-sections \ Write bufferable + fw-mem-pa h# c0e over /fw-mem map-sections \ Cache and write bufferable + fb-mem-pa h# c06 over /fb-mem map-sections \ Write bufferable \ h# d100.0000 h# c0e over h# 0030.0000 map-sections \ Cache and write bufferable (SRAM) h# d100.0000 h# c02 over h# 0030.0000 map-sections \ I/O - no caching or buffering (SRAM) h# d400.0000 h# c02 over h# 0040.0000 map-sections \ I/O - no caching or buffering
Modified: cpu/arm/mmp2/rootnode.fth ============================================================================== --- cpu/arm/mmp2/rootnode.fth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/mmp2/rootnode.fth Mon Aug 29 03:21:48 2011 (r2479) @@ -25,15 +25,15 @@ : close ( -- ) ;
: map-in ( phys size -- virt ) - drop ( phys ) - dup fb-pa = if drop fb-va exit then ( phys ) + drop ( phys ) + dup fb-mem-pa = if drop fb-mem-va exit then ( phys ) io-pa - io-va + ; : map-out ( virtual size -- ) 2drop ;
-: dma-range ( -- start end ) dma-base dup dma-size + ; +: dma-range ( -- start end ) dma-mem-pa dup /dma-mem + ;
h# 0 constant dma-map-mode \ XXX what should this be?
Modified: cpu/arm/olpc/1.75/addrs.fth ============================================================================== --- cpu/arm/olpc/1.75/addrs.fth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/olpc/1.75/addrs.fth Mon Aug 29 03:21:48 2011 (r2479) @@ -2,62 +2,49 @@
fload ${BP}/cpu/arm/mmuparams.fth
-h# 2000.0000 constant total-ram-size +h# 2000.0000 constant /ram-total \ Total size of memory
-h# 1fc0.0000 constant fb-pa -h# 40.0000 constant fb-size \ The screen use a little more than 3 MiB at 1200x900x24 +h# 0040.0000 constant /fb-mem \ The screen uses a little more than 3 MiB at 1200x900x24 +/ram-total /fb-mem - constant fb-mem-pa \ e.g. h# 1fc0.0000
-fb-pa constant available-ram-size +fb-mem-pa constant /available-mem
- -h# 20000 constant dropin-offset \ Offset to dropin driver area in SPI FLASH -[ifdef] use-flash-nvram -h# d.0000 constant nvram-offset -[then] - -h# e.0000 constant mfg-data-offset \ Offset to manufacturing data area in SPI FLASH -h# f.0000 constant mfg-data-end-offset \ Offset to end of manufacturing data area in SPI FLASH -h# f.ffd8 constant crc-offset - -h# 10.0000 constant /rom \ Total size of SPI FLASH - -: (memory?) ( phys -- flag ) total-ram-size u< ; +: (memory?) ( phys -- flag ) /ram-total u< ;
\ OFW implementation choices -h# d400.0000 constant io-pa -h# 1fa0.0000 constant fw-pa +h# 0020.0000 constant /fw-mem +fb-mem-pa /fw-mem - constant fw-mem-pa \ e.g. h# 1fa0.0000
-h# 1f00.0000 constant dma-base -h# 80.0000 constant dma-size +h# 0020.0000 constant /extra-mem +fw-mem-pa /extra-mem - constant extra-mem-pa \ e.g. h# 1f80.0000
-h# 1f80.0000 constant extra-mem-pa -h# 20.0000 constant /extra-mem +h# 0080.0000 constant /dma-mem +extra-mem-pa /dma-mem - constant dma-mem-pa \ e.g. h# 1f00.0000
-h# fd00.0000 constant dma-va +h# fd00.0000 constant dma-mem-va h# fd80.0000 constant extra-mem-va -h# fda0.0000 constant fw-va -h# fdc0.0000 constant fb-va -h# fe00.0000 constant io-va +h# fda0.0000 constant fw-mem-va +h# fdc0.0000 constant fb-mem-va + +h# fe00.0000 constant io-va \ We map IO (APB + AXI) space at this virtual address
[ifdef] virtual-mode h# f700.0000 constant fw-virt-base h# 0100.0000 constant fw-virt-size \ 16 megs of mapping space [else] -\ fw-pa value fw-virt-base -fw-va value fw-virt-base -h# 20.0000 value fw-virt-size +fw-mem-va value fw-virt-base +/fw-mem value fw-virt-size [then]
-h# 0020.0000 constant /fw-ram -/fw-ram /page-table - constant page-table-offset -page-table-offset constant stack-offset \ Stack is below this +/fw-mem /page-table - constant page-table-offset +page-table-offset constant stack-offset \ Stack is below this
-fw-pa page-table-offset + constant page-table-pa +fw-mem-pa page-table-offset + constant page-table-pa
\ h# 0110.0000 constant def-load-base h# 0800.0000 constant def-load-base
-\ The heap starts at RAMtop, which on this system is "fw-pa /fw-ram +" +\ The heap starts at RAMtop, which on this system is "fw-mem-pa /fw-mem +"
h# 10.0000 constant heap-size heap-size constant initial-heap-size @@ -65,3 +52,24 @@ \ RAM address where the Security Processor code places the subset of the dropin module \ image that it copies out of SPI FLASH. h# 900.0000 constant 'dropins \ Must agree with 'compressed in cforth/src/app/arm-xo-1.75/ + +h# 20000 constant dropin-offset \ Offset to dropin driver area in SPI FLASH + +[ifdef] use-flash-nvram +h# d.0000 constant nvram-offset +[then] + +h# e.0000 constant mfg-data-offset \ Offset to manufacturing data area in SPI FLASH +h# f.0000 constant mfg-data-end-offset \ Offset to end of manufacturing data area in SPI FLASH +h# f.ffd8 constant crc-offset + +h# 10.0000 constant /rom \ Total size of SPI FLASH + +\ SRAM usage + +sram-pa constant sram-va + +sram-va h# 2.0000 + constant 'ddr-recal +sram-va h# 2.0100 + constant 'ddr-self-refresh + +sram-pa h# 2.4000 + constant diagfb-pa \ Low-resolution frame buffer for startup numbers
Modified: cpu/arm/olpc/1.75/config.fth ============================================================================== --- cpu/arm/olpc/1.75/config.fth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/olpc/1.75/config.fth Mon Aug 29 03:21:48 2011 (r2479) @@ -5,7 +5,7 @@ create use-null-nvram create use-elf
-fload ${BP}/cpu/arm/olpc/1.75/addrs.fth fload ${BP}/cpu/arm/mmp2/hwaddrs.fth +fload ${BP}/cpu/arm/olpc/1.75/addrs.fth
create machine-signature ," CL2"
Modified: cpu/arm/olpc/1.75/devices.fth ============================================================================== --- cpu/arm/olpc/1.75/devices.fth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/olpc/1.75/devices.fth Mon Aug 29 03:21:48 2011 (r2479) @@ -234,23 +234,23 @@ : display-on \ init-xo-display \ Turns on DCON smb-init - fb-pa hdisp vdisp * >bytes h# ffffffff lfill + frame-buffer-adr hdisp vdisp * >bytes h# ffffffff lfill init-lcd ; : map-frame-buffer ( -- ) - fb-pa fb-size " map-in" $call-parent to frame-buffer-adr + fb-mem-pa /fb-mem " map-in" $call-parent to frame-buffer-adr ; " display" device-type " ISO8859-1" encode-string " character-set" property 0 0 encode-bytes " iso6429-1983-colors" property
\ Used as temporary storage for images by $get-image - : graphmem ( -- adr ) dimensions * pixel* fb-pa + ; + : graphmem ( -- adr ) dimensions * pixel* fb-mem-pa + ;
: display-install ( -- ) + map-frame-buffer display-on default-font set-font - map-frame-buffer width height ( width height ) over char-width / over char-height / ( width height rows cols ) /scanline depth fb-install ( ) @@ -392,6 +392,7 @@ fload ${BP}/cpu/arm/mmp2/thermal.fth
fload ${BP}/cpu/arm/mmp2/dramrecal.fth +fload ${BP}/cpu/arm/mmp2/rtc.fth \ Internal RTC, used for wakeups
\ LICENSE_BEGIN \ Copyright (c) 2010 FirmWorks
Modified: cpu/arm/olpc/1.75/fw.bth ============================================================================== --- cpu/arm/olpc/1.75/fw.bth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/olpc/1.75/fw.bth Mon Aug 29 03:21:48 2011 (r2479) @@ -11,7 +11,6 @@ \ ' $report-name is include-hook \ ' noop is include-hook
-fb-pa constant display-pa fload ${BP}/cpu/arm/olpc/fbnums.fth fload ${BP}/cpu/arm/olpc/fbmsg.fth
@@ -46,7 +45,7 @@ d# 900 tag-w, \ Height d# 24 tag-w, \ Depth d# 1200 3 * tag-w, \ Pitch - fb-va tag-l, \ Base address + fb-mem-va tag-l, \ Base address d# 1200 3 * d# 900 * tag-l, \ Total size - perhaps could be larger 5 tag-b, \ Red size d# 11 tag-b, \ Red position @@ -70,12 +69,12 @@ \ Each of these groups is a struct map_desc as defined in arch/arm/include/asm/mach/ extra-mem-va tag-l, \ VA of OFW memory extra-mem-pa pageshift rshift tag-l, \ Page frame number of OFW memory - fw-virt-base /fw-ram + extra-mem-va - tag-l, \ Size of OFW memory + fw-mem-va /fw-mem + extra-mem-va - tag-l, \ Size of OFW memory MT_MEMORY tag-l, \ Mapping type of OFW memory
- fb-va tag-l, \ VA of OFW Frame Buffer - fb-pa pageshift rshift tag-l, \ PA of OFW Frame Buffer - fb-size tag-l, \ Size of OFW memory + fb-mem-va tag-l, \ VA of OFW Frame Buffer + fb-mem-pa pageshift rshift tag-l, \ PA of OFW Frame Buffer + /fb-mem tag-l, \ Size of OFW memory MT_DEVICE_WC tag-l, \ Mapping type of OFW frame buffer ; ' (ofw-tag,) to ofw-tag, @@ -267,11 +266,12 @@ device-end fload ${BP}/cpu/x86/pc/olpc/gridmap.fth \ Gridded display tools fload ${BP}/cpu/x86/pc/olpc/via/copynand.fth -fload ${BP}/cpu/arm/olpc/1.75/exc7200-touchscreen.fth \ Touchscreen driver and diagnostic +\ fload ${BP}/cpu/arm/olpc/1.75/exc7200-touchscreen.fth \ Touchscreen driver and diagnostic +fload ${BP}/cpu/arm/olpc/1.75/rm3150-touchscreen.fth \ Touchscreen driver and diagnostic fload ${BP}/cpu/arm/olpc/1.75/roller.fth \ Accelerometer test
-fload ${BP}/cpu/arm/olpc/1.75/pinch.fth \ Touchscreen gestures -: pinch " pinch" screen-ih $call-method ; +\ fload ${BP}/cpu/arm/olpc/1.75/pinch.fth \ Touchscreen gestures +\ : pinch " pinch" screen-ih $call-method ;
: emacs ( -- ) false to already-go? @@ -342,7 +342,7 @@ fload ${BP}/cpu/x86/pc/olpc/via/fsverify.fth devalias fsdisk int:0
-create pong-use-touchscreen +\ create pong-use-touchscreen fload ${BP}/ofw/gui/ofpong.fth fload ${BP}/cpu/x86/pc/olpc/life.fth
Modified: cpu/arm/olpc/1.75/lcd.fth ============================================================================== --- cpu/arm/olpc/1.75/lcd.fth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/olpc/1.75/lcd.fth Mon Aug 29 03:21:48 2011 (r2479) @@ -10,7 +10,7 @@ h# 1b pmua-disp-clk-sel + h# 28284c io!
0 h# 190 lcd! \ Disable LCD DMA controller - fb-pa h# f4 lcd! \ Frame buffer area 0 + fb-mem-pa h# f4 lcd! \ Frame buffer area 0 0 h# f8 lcd! \ Frame buffer area 1 hdisp bytes/pixel * h# fc lcd! \ Pitch in bytes
Modified: cpu/arm/olpc/1.75/probemem.fth ============================================================================== --- cpu/arm/olpc/1.75/probemem.fth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/olpc/1.75/probemem.fth Mon Aug 29 03:21:48 2011 (r2479) @@ -16,14 +16,14 @@
headers : probe ( -- ) - 0 available-ram-size log&release + 0 /available-mem log&release
0 0 encode-bytes ( adr 0 ) physavail ['] make-phys-memlist find-node ( adr len prev 0 ) 2drop " reg" property
\ Claim the memory used by OFW - fw-pa /fw-ram 0 claim drop + fw-mem-pa /fw-mem 0 claim drop extra-mem-pa /extra-mem 0 claim drop
0 pagesize 0 claim drop \ Vector table @@ -55,9 +55,12 @@ : show-line ( adr len -- ) (cr type 3 spaces kill-line ; ' show-line to show-status
-: test-mem ( adr len -- ) \ Test a chunk 'o memory - ." Testing address 0x" over .x ." length 0x" dup .x cr +[ifndef] 8u.h +: 8u.h ( n -- ) push-hex (.8) type pop-base ; +[then] +: .chunk ( adr len -- ) ." Testing address 0x" swap 8u.h ." length 0x" 8u.h cr ;
+: test-mem ( adr len -- ) \ Test a chunk 'o memory 2>r 2r@ 0 mem-claim to p-adr ( ) ( r: adr len ) [ifdef] virtual-mode @@ -95,6 +98,7 @@
begin dup while ( adr len ) 2 decode-ints swap ( adr len this-len r: this-padr ) + 2dup .chunk ( adr len this-len r: this-padr ) test-mem ( adr len ) mem-fail? if ( adr len ) 2drop true exit ( -- error )
Modified: cpu/arm/olpc/fbnums.fth ============================================================================== --- cpu/arm/olpc/fbnums.fth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/olpc/fbnums.fth Mon Aug 29 03:21:48 2011 (r2479) @@ -51,7 +51,7 @@ : putdig ( n pos -- ) numerals rot wa+ w@ ( pos glyph ) \ Vertical offset by 2 lines (fb-pitch 2*), horizontal by pos character cells - display-pa fb-pitch 2* + rot wa+ ( glyph fb-adr ) + diagfb-pa fb-pitch 2* + rot wa+ ( glyph fb-adr ) 5 0 do ( glyph fb-adr ) over 3 and ( glyph fb-adr pattern# ) patterns swap wa+ w@ ( glyph fb-adr pattern )
Modified: cpu/arm/olpc/initmmu.fth ============================================================================== --- cpu/arm/olpc/initmmu.fth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/olpc/initmmu.fth Mon Aug 29 03:21:48 2011 (r2479) @@ -221,12 +221,12 @@ 0= until
mov r1,0 \ Address of low memory - set r2,`dma-base #` \ Size of low memory - up to dma-base + set r2,`dma-mem-pa #` \ Size of low memory - up to dma-base set r3,#0xc0e \ Cache and write bufferable bl `map-sections-v=p`
- set r1,`dma-base #` \ Address of DMA area - set r2,`dma-size #` \ Size of DMA area + set r1,`dma-mem-pa #` \ Address of DMA area + set r2,`/dma-mem #` \ Size of DMA area set r3,#0xc02 \ No caching or write buffering bl `map-sections-v=p`
@@ -235,41 +235,41 @@ set r3,#0xc0e \ Write bufferable bl `map-sections-v=p`
- set r1,`fw-pa #` \ Address of Firmware region - set r2,`/fw-ram #` \ Size of firmware region + set r1,`fw-mem-pa #` \ Address of Firmware region + set r2,`/fw-mem #` \ Size of firmware region set r3,#0xc0e \ Write bufferable bl `map-sections-v=p`
- set r1,`fb-pa #` \ Address - Frame buffer - set r2,`fb-size #` \ Size of frame buffer + set r1,`fb-mem-pa #` \ Address - Frame buffer + set r2,`/fb-mem #` \ Size of frame buffer set r3,#0xc06 \ Write bufferable bl `map-sections-v=p`
- set r1,#0xd1000000 \ Address of SRAM - set r2,#0x00300000 \ Size of SRAM + set r1,`sram-pa #` \ Address of SRAM + set r2,`/sram #` \ Size of SRAM set r3,#0xc02 \ No caching or write buffering bl `map-sections-v=p`
- set r1,#0xd4000000 \ Address of I/O - set r2,#0x00400000 \ Size of I/O region + set r1,`io-pa #` \ Address of I/O + set r2,`/io #` \ Size of I/O region set r3,#0xc02 \ No caching or write buffering bl `map-sections-v=p`
- set r1,#0xe0000000 \ Address of Audio SRAM - set r2,#0x00100000 \ Size of audio SRAM + set r1,`audio-sram-pa #` \ Address of Audio SRAM + set r2,`/audio-sram #` \ Size of audio SRAM set r3,#0xc02 \ No caching or write buffering bl `map-sections-v=p`
- set r1,`dma-base #` \ Address of DMA area - set r2,`dma-size #` \ Size of DMA area + set r1,`dma-mem-pa #` \ Address of DMA area + set r2,`/dma-mem #` \ Size of DMA area set r3,#0xc02 \ No caching or write buffering - set r4,`dma-va #` \ Virtual address + set r4,`dma-mem-va #` \ Virtual address bl `map-sections`
- set r1,`fb-pa #` \ Address - Frame buffer - set r2,`fb-size #` \ Size of frame buffer + set r1,`fb-mem-pa #` \ Address - Frame buffer + set r2,`/fb-mem #` \ Size of frame buffer set r3,#0xc06 \ Write bufferable - set r4,`fb-va #` \ Virtual address + set r4,`fb-mem-va #` \ Virtual address bl `map-sections
set r1,`extra-mem-pa #` \ Address of additional allocatable memory @@ -278,14 +278,14 @@ set r4,`extra-mem-va #' \ Virtual address bl `map-sections`
- set r1,`fw-pa #` \ Address of Firmware region - set r2,`/fw-ram #` \ Size of firmware region + set r1,`fw-mem-pa #` \ Address of Firmware region + set r2,`/fw-mem #` \ Size of firmware region set r3,#0xc0e \ Write bufferable - set r4,`fw-va #` \ Virtual address + set r4,`fw-mem-va #` \ Virtual address bl `map-sections`
- set r1,#0xd4000000 \ Address of I/O - set r2,#0x00400000 \ Size of I/O region + set r1,`io-pa #` \ Address of I/O + set r2,`/io #` \ Size of I/O region set r3,#0xc02 \ No caching or write buffering set r4,`io-va #` \ Virtual address bl `map-sections`
Modified: cpu/arm/olpc/numdot.fth ============================================================================== --- cpu/arm/olpc/numdot.fth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/olpc/numdot.fth Mon Aug 29 03:21:48 2011 (r2479) @@ -13,7 +13,7 @@ \ work in any case.
label fb-adr-loc \ Frame buffer address -fb-pa , +diagfb-pa , end-code
label numerals
Modified: cpu/arm/olpc/resetvec.bth ============================================================================== --- cpu/arm/olpc/resetvec.bth Thu Aug 25 04:49:44 2011 (r2478) +++ cpu/arm/olpc/resetvec.bth Mon Aug 29 03:21:48 2011 (r2479) @@ -30,7 +30,7 @@ ; previous definitions
-\ /fw-ram constant stack-offset \ Offset of top of inflater stack within destination RAM +\ /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 @@ -152,7 +152,7 @@
\ Setup the page (section) table and turn on the MMU and caches \ set r0,`page-table-pa #` - set r0,`fw-pa page-table-offset + #` + set r0,`fw-mem-pa page-table-offset + #` bl `init-map` \ Setup the initial virtual address map bl `enable-mmu` \ Turn on the MMU bl `caches-on` \ Turn on the caches