Changeset 2644
- Timestamp:
- Oct 22, 2011 12:40:13 PM (19 months ago)
- Location:
- cpu/arm
- Files:
-
- 4 edited
-
linux.fth (modified) (2 diffs)
-
mmp2/rootnode.fth (modified) (2 diffs)
-
olpc/1.75/fw.bth (modified) (1 diff)
-
olpc/1.75/probemem.fth (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cpu/arm/linux.fth
r2501 r2644 10 10 0 value linux-memtop 11 11 12 defer memory-limit 12 13 \ Find the end of the largest piece of memory 13 : memory-limit( -- limit )14 : (memory-limit) ( -- limit ) 14 15 \ If we have already loaded a RAMdisk in high memory, its base is the memory limit 15 16 ramdisk-adr ?dup if exit then … … 31 32 + ( limit ) 32 33 ; 34 ' (memory-limit) to memory-limit \ Override by platform code if necessary 33 35 34 36 \ see http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html -
cpu/arm/mmp2/rootnode.fth
r2593 r2644 35 35 ; 36 36 37 : dma-range ( -- start end ) dma-mem-va >physical dup /dma-mem + ; 38 37 [ifdef] virtual-mode 39 38 h# 0 constant dma-map-mode \ XXX what should this be? 40 41 \ Used with "find-node" to locate a physical memory node containing 42 \ enough memory in the DMA range. 43 \ We first compute the intersection between the memory piece and the 44 \ range reachable by DMA. If the regions are disjoint, then ok-high 45 \ will be (unsigned) less than ok-low. We then subtract ok-low from 46 \ ok-high to give the (possibly negative) size of the intersection. 47 : in-range? ( size mem-low mem-high range-low range-high -- flag ) 48 rot umin -rot ( size min-high mem-low mem-high ) 49 umax ( size min-high max-low ) 50 - <= ( flag ) 51 ; 52 53 : dma-ok? ( size node-adr -- size flag ) 54 node-range ( size mem-adr mem-len ) 55 over + ( size mem-adr mem-end ) 56 57 3dup dma-range in-range? if ( size mem-adr mem-end ) 58 2drop true exit ( size true ) 59 then ( size mem-adr mem-end ) 60 61 2drop false ( size false ) 62 ; 63 64 \ Find an available physical address range suitable for DMA. This word 65 \ doesn't actually claim the memory (that is done later), but simply locates 66 \ a suitable range that can be successfully claimed. 67 : find-dma-address ( size -- true | adr false ) 68 " physavail" memory-node @ $call-method ( list ) 69 ['] dma-ok? find-node is next-node drop ( size' ) 70 next-node 0= if drop true exit then ( size' ) 71 next-end ( size mem-end ) 72 dma-range ( size mem-end range-l,h ) 73 nip umin swap - false ( adr false ) 74 ; 39 [then] 75 40 76 41 headers 77 42 : dma-alloc ( size -- virt ) 78 pagesize round-up 79 80 \ Locate a suitable physical range 81 dup find-dma-address throw ( size' phys ) 82 83 \ Claim it 84 over 0 mem-claim ( size' phys ) 43 \ Allocate the physical memory 44 dup " allocate-dma-phys" $call-mem-method ( size' phys ) 85 45 86 46 [ifdef] virtual-mode … … 112 72 [then] 113 73 [then] 114 mem-release( )74 " free-dma-phys" $call-mem-method ( ) 115 75 ; 116 76 -
cpu/arm/olpc/1.75/fw.bth
r2641 r2644 27 27 28 28 fload ${BP}/cpu/arm/linux.fth 29 30 \ The bottom of extra-mem is the top of DMA memory. 31 \ We give everything up to that address to Linux. 32 : olpc-memory-limit ( -- adr ) extra-mem-va >physical ; 33 ' olpc-memory-limit to memory-limit 29 34 30 35 : usb-quiet ( -- ) -
cpu/arm/olpc/1.75/probemem.fth
r2638 r2644 9 9 headerless 10 10 11 h# ffff.ffff value low 12 h# 0 value high 11 list: dmaavail 0 dmaavail ! 13 12 14 : log&release ( adr len -- ) 15 over low umin to low ( adr len ) 16 2dup + high umax to high ( adr len ) 17 release 13 headers 14 : allocate-dma-phys ( size -- phys ) 15 \ Minumum granularity of memory chunks is 1 page 16 pagesize round-up ( size' ) 17 18 pagesize over dmaavail ( size alignment size list ) 19 allocate-memrange ( size [ adr ] error? ) 20 abort" Insufficient DMA memory" ( size adr ) 21 dup rot clear-mem ( phys ) 22 ; 23 24 : free-dma-phys ( phys size -- ) 25 >page-boundaries ( adr' size' ) 26 ['] 2drop is ?splice ( adr' size' ) 27 dmaavail free-memrange 18 28 ; 19 29 20 30 headers 21 31 : probe ( -- ) 22 0 fb-mem-va >physical /fb-mem + log&release32 0 fb-mem-va >physical /fb-mem + release 23 33 24 34 0 0 encode-bytes ( adr 0 ) … … 30 40 fw-mem-va >physical /fw-mem 0 claim drop 31 41 extra-mem-va >physical /extra-mem 0 claim drop 42 dma-mem-va >physical /dma-mem 0 claim drop 43 44 dma-mem-va >physical /dma-mem free-dma-phys 32 45 33 46 0 pagesize 0 claim drop \ Vector table
Note: See TracChangeset
for help on using the changeset viewer.
