1*4882a593Smuzhiyun*** Reserved memory regions *** 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunReserved memory is specified as a node under the /reserved-memory node. 4*4882a593SmuzhiyunThe operating system shall exclude reserved memory from normal usage 5*4882a593Smuzhiyunone can create child nodes describing particular reserved (excluded from 6*4882a593Smuzhiyunnormal use) memory regions. Such memory regions are usually designed for 7*4882a593Smuzhiyunthe special usage by various device drivers. 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunParameters for each memory region can be encoded into the device tree 10*4882a593Smuzhiyunwith the following nodes: 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun/reserved-memory node 13*4882a593Smuzhiyun--------------------- 14*4882a593Smuzhiyun#address-cells, #size-cells (required) - standard definition 15*4882a593Smuzhiyun - Should use the same values as the root node 16*4882a593Smuzhiyunranges (required) - standard definition 17*4882a593Smuzhiyun - Should be empty 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun/reserved-memory/ child nodes 20*4882a593Smuzhiyun----------------------------- 21*4882a593SmuzhiyunEach child of the reserved-memory node specifies one or more regions of 22*4882a593Smuzhiyunreserved memory. Each child node may either use a 'reg' property to 23*4882a593Smuzhiyunspecify a specific range of reserved memory, or a 'size' property with 24*4882a593Smuzhiyunoptional constraints to request a dynamically allocated block of memory. 25*4882a593Smuzhiyun 26*4882a593SmuzhiyunFollowing the generic-names recommended practice, node names should 27*4882a593Smuzhiyunreflect the purpose of the node (ie. "framebuffer" or "dma-pool"). Unit 28*4882a593Smuzhiyunaddress (@<address>) should be appended to the name if the node is a 29*4882a593Smuzhiyunstatic allocation. 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunProperties: 32*4882a593SmuzhiyunRequires either a) or b) below. 33*4882a593Smuzhiyuna) static allocation 34*4882a593Smuzhiyun reg (required) - standard definition 35*4882a593Smuzhiyunb) dynamic allocation 36*4882a593Smuzhiyun size (required) - length based on parent's #size-cells 37*4882a593Smuzhiyun - Size in bytes of memory to reserve. 38*4882a593Smuzhiyun alignment (optional) - length based on parent's #size-cells 39*4882a593Smuzhiyun - Address boundary for alignment of allocation. 40*4882a593Smuzhiyun alloc-ranges (optional) - prop-encoded-array (address, length pairs). 41*4882a593Smuzhiyun - Specifies regions of memory that are 42*4882a593Smuzhiyun acceptable to allocate from. 43*4882a593Smuzhiyun 44*4882a593SmuzhiyunIf both reg and size are present, then the reg property takes precedence 45*4882a593Smuzhiyunand size is ignored. 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunAdditional properties: 48*4882a593Smuzhiyuncompatible (optional) - standard definition 49*4882a593Smuzhiyun - may contain the following strings: 50*4882a593Smuzhiyun - shared-dma-pool: This indicates a region of memory meant to be 51*4882a593Smuzhiyun used as a shared pool of DMA buffers for a set of devices. It can 52*4882a593Smuzhiyun be used by an operating system to instantiate the necessary pool 53*4882a593Smuzhiyun management subsystem if necessary. 54*4882a593Smuzhiyun - vendor specific string in the form <vendor>,[<device>-]<usage> 55*4882a593Smuzhiyunno-map (optional) - empty property 56*4882a593Smuzhiyun - Indicates the operating system must not create a virtual mapping 57*4882a593Smuzhiyun of the region as part of its standard mapping of system memory, 58*4882a593Smuzhiyun nor permit speculative access to it under any circumstances other 59*4882a593Smuzhiyun than under the control of the device driver using the region. 60*4882a593Smuzhiyunreusable (optional) - empty property 61*4882a593Smuzhiyun - The operating system can use the memory in this region with the 62*4882a593Smuzhiyun limitation that the device driver(s) owning the region need to be 63*4882a593Smuzhiyun able to reclaim it back. Typically that means that the operating 64*4882a593Smuzhiyun system can use that region to store volatile or cached data that 65*4882a593Smuzhiyun can be otherwise regenerated or migrated elsewhere. 66*4882a593Smuzhiyun 67*4882a593SmuzhiyunA node must not carry both the no-map and the reusable property as these are 68*4882a593Smuzhiyunlogically contradictory. 69*4882a593Smuzhiyun 70*4882a593SmuzhiyunLinux implementation note: 71*4882a593Smuzhiyun- If a "linux,cma-default" property is present, then Linux will use the 72*4882a593Smuzhiyun region for the default pool of the contiguous memory allocator. 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun- If a "linux,dma-default" property is present, then Linux will use the 75*4882a593Smuzhiyun region for the default pool of the consistent DMA allocator. 76*4882a593Smuzhiyun 77*4882a593SmuzhiyunDevice node references to reserved memory 78*4882a593Smuzhiyun----------------------------------------- 79*4882a593SmuzhiyunRegions in the /reserved-memory node may be referenced by other device 80*4882a593Smuzhiyunnodes by adding a memory-region property to the device node. 81*4882a593Smuzhiyun 82*4882a593Smuzhiyunmemory-region (optional) - phandle, specifier pairs to children of /reserved-memory 83*4882a593Smuzhiyunmemory-region-names (optional) - a list of names, one for each corresponding 84*4882a593Smuzhiyun entry in the memory-region property 85*4882a593Smuzhiyun 86*4882a593SmuzhiyunExample 87*4882a593Smuzhiyun------- 88*4882a593SmuzhiyunThis example defines 3 contiguous regions are defined for Linux kernel: 89*4882a593Smuzhiyunone default of all device drivers (named linux,cma@72000000 and 64MiB in size), 90*4882a593Smuzhiyunone dedicated to the framebuffer device (named framebuffer@78000000, 8MiB), and 91*4882a593Smuzhiyunone for multimedia processing (named multimedia-memory@77000000, 64MiB). 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun/ { 94*4882a593Smuzhiyun #address-cells = <1>; 95*4882a593Smuzhiyun #size-cells = <1>; 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun memory { 98*4882a593Smuzhiyun reg = <0x40000000 0x40000000>; 99*4882a593Smuzhiyun }; 100*4882a593Smuzhiyun 101*4882a593Smuzhiyun reserved-memory { 102*4882a593Smuzhiyun #address-cells = <1>; 103*4882a593Smuzhiyun #size-cells = <1>; 104*4882a593Smuzhiyun ranges; 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun /* global autoconfigured region for contiguous allocations */ 107*4882a593Smuzhiyun linux,cma { 108*4882a593Smuzhiyun compatible = "shared-dma-pool"; 109*4882a593Smuzhiyun reusable; 110*4882a593Smuzhiyun size = <0x4000000>; 111*4882a593Smuzhiyun alignment = <0x2000>; 112*4882a593Smuzhiyun linux,cma-default; 113*4882a593Smuzhiyun }; 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun display_reserved: framebuffer@78000000 { 116*4882a593Smuzhiyun reg = <0x78000000 0x800000>; 117*4882a593Smuzhiyun }; 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun multimedia_reserved: multimedia@77000000 { 120*4882a593Smuzhiyun compatible = "acme,multimedia-memory"; 121*4882a593Smuzhiyun reg = <0x77000000 0x4000000>; 122*4882a593Smuzhiyun }; 123*4882a593Smuzhiyun }; 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun /* ... */ 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun fb0: video@12300000 { 128*4882a593Smuzhiyun memory-region = <&display_reserved>; 129*4882a593Smuzhiyun /* ... */ 130*4882a593Smuzhiyun }; 131*4882a593Smuzhiyun 132*4882a593Smuzhiyun scaler: scaler@12500000 { 133*4882a593Smuzhiyun memory-region = <&multimedia_reserved>; 134*4882a593Smuzhiyun /* ... */ 135*4882a593Smuzhiyun }; 136*4882a593Smuzhiyun 137*4882a593Smuzhiyun codec: codec@12600000 { 138*4882a593Smuzhiyun memory-region = <&multimedia_reserved>; 139*4882a593Smuzhiyun /* ... */ 140*4882a593Smuzhiyun }; 141*4882a593Smuzhiyun}; 142