memory.txt 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. * Memory binding
  2. The /memory node provides basic information about the address and size
  3. of the physical memory. This node is usually filled or updated by the
  4. bootloader, depending on the actual memory configuration of the given
  5. hardware.
  6. The memory layout is described by the folllowing node:
  7. memory {
  8. reg = <(baseaddr1) (size1)
  9. (baseaddr2) (size2)
  10. ...
  11. (baseaddrN) (sizeN)>;
  12. };
  13. baseaddrX: the base address of the defined memory bank
  14. sizeX: the size of the defined memory bank
  15. More than one memory bank can be defined.
  16. * Memory regions
  17. In /memory node one can create additional nodes describing particular
  18. memory regions, usually for the special usage by various device drivers.
  19. A good example are contiguous memory allocations or memory sharing with
  20. other operating system on the same hardware board. Those special memory
  21. regions might depend on the board configuration and devices used on the
  22. target system.
  23. Parameters for each memory region can be encoded into the device tree
  24. wit the following convention:
  25. (name): region@(base-address) {
  26. reg = <(baseaddr) (size)>;
  27. (linux,contiguous-region);
  28. (linux,default-contiguous-region);
  29. (linux,reserve-region);
  30. (linux,memory-limit);
  31. label = (unique_name);
  32. };
  33. name: an name given to the defined region.
  34. base-address: the base address of the defined region.
  35. size: the size of the memory region.
  36. linux,contiguous-region: property indicating that the defined memory
  37. region is used for contiguous memory allocations,
  38. Linux specific (optional)
  39. linux,default-contiguous-region: property indicating that the region
  40. is the default region for all contiguous memory
  41. allocations, Linux specific (optional)
  42. linux,reserve-region: property indicating that the contiguous memory will
  43. not be given back to the system allocator. The memory be
  44. always be available for contiguous use.
  45. linux,memory-limit: property specifying an upper bound on the physical address
  46. of the region if the region is placed dynamically. If no limit
  47. is specificed, the region may be placed anywhere in the physical
  48. address space. 0 may be used to specify lowmem (i.e. the region
  49. will be placed in the direct mapped lowmem region)
  50. label: an internal name used for automatically associating the
  51. cma region with a given device. The label is optional;
  52. if the label is not given the client is responsible for
  53. calling the appropriate functions to associate the region
  54. with a device.
  55. * Device nodes
  56. Once the regions in the /memory node are defined, they can be assigned
  57. to device some device nodes for their special use. The following
  58. properties are defined:
  59. linux,contiguous-region = <&phandle>;
  60. This property indicates that the device driver should use the
  61. memory region pointed by the given phandle.
  62. * Example:
  63. This example defines a memory consisting of 4 memory banks. 2 contiguous
  64. regions are defined for Linux kernel, one default of all device drivers
  65. (named contig_mem, placed at 0x72000000, 64MiB) and one dedicated to the
  66. framebuffer device (named display_mem, placed at 0x78000000, 16MiB). The
  67. display_mem region is then assigned to fb@12300000 device for contiguous
  68. memory allocation with Linux kernel drivers.
  69. The reason for creating a separate region for framebuffer device is to
  70. match the framebuffer address of from configuration done by bootloader,
  71. so once Linux kernel drivers starts, no glitches on the displayed boot
  72. logo appears.
  73. / {
  74. /* ... */
  75. memory {
  76. reg = <0x40000000 0x10000000
  77. 0x50000000 0x10000000
  78. 0x60000000 0x10000000
  79. 0x70000000 0x10000000>;
  80. contig_mem: region@72000000 {
  81. linux,contiguous-region;
  82. linux,default-contiguous-region;
  83. reg = <0x72000000 0x4000000>;
  84. };
  85. display_mem: region@78000000 {
  86. linux,contiguous-region;
  87. reg = <0x78000000 0x1000000>;
  88. };
  89. };
  90. fb@12300000 {
  91. linux,contiguous-region = <&display_mem>;
  92. status = "okay";
  93. };
  94. };