···11+*** Reserved memory regions ***22+33+Reserved memory is specified as a node under the /reserved-memory node.44+The operating system shall exclude reserved memory from normal usage55+one can create child nodes describing particular reserved (excluded from66+normal use) memory regions. Such memory regions are usually designed for77+the special usage by various device drivers.88+99+Parameters for each memory region can be encoded into the device tree1010+with the following nodes:1111+1212+/reserved-memory node1313+---------------------1414+#address-cells, #size-cells (required) - standard definition1515+ - Should use the same values as the root node1616+ranges (required) - standard definition1717+ - Should be empty1818+1919+/reserved-memory/ child nodes2020+-----------------------------2121+Each child of the reserved-memory node specifies one or more regions of2222+reserved memory. Each child node may either use a 'reg' property to2323+specify a specific range of reserved memory, or a 'size' property with2424+optional constraints to request a dynamically allocated block of memory.2525+2626+Following the generic-names recommended practice, node names should2727+reflect the purpose of the node (ie. "framebuffer" or "dma-pool"). Unit2828+address (@<address>) should be appended to the name if the node is a2929+static allocation.3030+3131+Properties:3232+Requires either a) or b) below.3333+a) static allocation3434+ reg (required) - standard definition3535+b) dynamic allocation3636+ size (required) - length based on parent's #size-cells3737+ - Size in bytes of memory to reserve.3838+ alignment (optional) - length based on parent's #size-cells3939+ - Address boundary for alignment of allocation.4040+ alloc-ranges (optional) - prop-encoded-array (address, length pairs).4141+ - Specifies regions of memory that are4242+ acceptable to allocate from.4343+4444+If both reg and size are present, then the reg property takes precedence4545+and size is ignored.4646+4747+Additional properties:4848+compatible (optional) - standard definition4949+ - may contain the following strings:5050+ - shared-dma-pool: This indicates a region of memory meant to be5151+ used as a shared pool of DMA buffers for a set of devices. It can5252+ be used by an operating system to instanciate the necessary pool5353+ management subsystem if necessary.5454+ - vendor specific string in the form <vendor>,[<device>-]<usage>5555+no-map (optional) - empty property5656+ - Indicates the operating system must not create a virtual mapping5757+ of the region as part of its standard mapping of system memory,5858+ nor permit speculative access to it under any circumstances other5959+ than under the control of the device driver using the region.6060+reusable (optional) - empty property6161+ - The operating system can use the memory in this region with the6262+ limitation that the device driver(s) owning the region need to be6363+ able to reclaim it back. Typically that means that the operating6464+ system can use that region to store volatile or cached data that6565+ can be otherwise regenerated or migrated elsewhere.6666+6767+Linux implementation note:6868+- If a "linux,cma-default" property is present, then Linux will use the6969+ region for the default pool of the contiguous memory allocator.7070+7171+Device node references to reserved memory7272+-----------------------------------------7373+Regions in the /reserved-memory node may be referenced by other device7474+nodes by adding a memory-region property to the device node.7575+7676+memory-region (optional) - phandle, specifier pairs to children of /reserved-memory7777+7878+Example7979+-------8080+This example defines 3 contiguous regions are defined for Linux kernel:8181+one default of all device drivers (named linux,cma@72000000 and 64MiB in size),8282+one dedicated to the framebuffer device (named framebuffer@78000000, 8MiB), and8383+one for multimedia processing (named multimedia-memory@77000000, 64MiB).8484+8585+/ {8686+ #address-cells = <1>;8787+ #size-cells = <1>;8888+8989+ memory {9090+ reg = <0x40000000 0x40000000>;9191+ };9292+9393+ reserved-memory {9494+ #address-cells = <1>;9595+ #size-cells = <1>;9696+ ranges;9797+9898+ /* global autoconfigured region for contiguous allocations */9999+ linux,cma {100100+ compatible = "shared-dma-pool";101101+ reusable;102102+ size = <0x4000000>;103103+ alignment = <0x2000>;104104+ linux,cma-default;105105+ };106106+107107+ display_reserved: framebuffer@78000000 {108108+ reg = <0x78000000 0x800000>;109109+ };110110+111111+ multimedia_reserved: multimedia@77000000 {112112+ compatible = "acme,multimedia-memory";113113+ reg = <0x77000000 0x4000000>;114114+ };115115+ };116116+117117+ /* ... */118118+119119+ fb0: video@12300000 {120120+ memory-region = <&display_reserved>;121121+ /* ... */122122+ };123123+124124+ scaler: scaler@12500000 {125125+ memory-region = <&multimedia_reserved>;126126+ /* ... */127127+ };128128+129129+ codec: codec@12600000 {130130+ memory-region = <&multimedia_reserved>;131131+ /* ... */132132+ };133133+};
···323323 if (mdesc->reserve)324324 mdesc->reserve();325325326326+ early_init_fdt_scan_reserved_mem();327327+326328 /*327329 * reserve memory for DMA contigouos allocations,328330 * must come from DMA area inside low memory
···7171 depends on MTD7272 def_bool y73737474+config OF_RESERVED_MEM7575+ depends on OF_EARLY_FLATTREE7676+ bool7777+ help7878+ Helpers to allow for reservation of memory regions7979+7480endmenu # OF