xref: /freebsd-src/sys/contrib/device-tree/Bindings/reserved-memory/reserved-memory.yaml (revision cb7aa33ac6cd46a5434798e50363136e64f3ae98)
18cc087a1SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
28cc087a1SEmmanuel Vadot%YAML 1.2
38cc087a1SEmmanuel Vadot---
48cc087a1SEmmanuel Vadot$id: http://devicetree.org/schemas/reserved-memory/reserved-memory.yaml#
58cc087a1SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
68cc087a1SEmmanuel Vadot
77ef62cebSEmmanuel Vadottitle: /reserved-memory Child Node Common
88cc087a1SEmmanuel Vadot
98cc087a1SEmmanuel Vadotmaintainers:
108cc087a1SEmmanuel Vadot  - devicetree-spec@vger.kernel.org
118cc087a1SEmmanuel Vadot
128cc087a1SEmmanuel Vadotdescription: >
138cc087a1SEmmanuel Vadot  Reserved memory is specified as a node under the /reserved-memory node. The
148cc087a1SEmmanuel Vadot  operating system shall exclude reserved memory from normal usage one can
158cc087a1SEmmanuel Vadot  create child nodes describing particular reserved (excluded from normal use)
168cc087a1SEmmanuel Vadot  memory regions. Such memory regions are usually designed for the special
178cc087a1SEmmanuel Vadot  usage by various device drivers.
188cc087a1SEmmanuel Vadot
198cc087a1SEmmanuel Vadot  Each child of the reserved-memory node specifies one or more regions
208cc087a1SEmmanuel Vadot  of reserved memory. Each child node may either use a 'reg' property to
218cc087a1SEmmanuel Vadot  specify a specific range of reserved memory, or a 'size' property with
228cc087a1SEmmanuel Vadot  optional constraints to request a dynamically allocated block of
238cc087a1SEmmanuel Vadot  memory.
248cc087a1SEmmanuel Vadot
258cc087a1SEmmanuel Vadot  Following the generic-names recommended practice, node names should
268cc087a1SEmmanuel Vadot  reflect the purpose of the node (ie. "framebuffer" or "dma-pool").
278cc087a1SEmmanuel Vadot  Unit address (@<address>) should be appended to the name if the node
288cc087a1SEmmanuel Vadot  is a static allocation.
298cc087a1SEmmanuel Vadot
308cc087a1SEmmanuel Vadotproperties:
318cc087a1SEmmanuel Vadot  reg: true
328cc087a1SEmmanuel Vadot
338cc087a1SEmmanuel Vadot  size:
34*cb7aa33aSEmmanuel Vadot    oneOf:
35*cb7aa33aSEmmanuel Vadot      - $ref: /schemas/types.yaml#/definitions/uint32
36*cb7aa33aSEmmanuel Vadot      - $ref: /schemas/types.yaml#/definitions/uint64
378cc087a1SEmmanuel Vadot    description: >
388cc087a1SEmmanuel Vadot      Length based on parent's \#size-cells. Size in bytes of memory to
398cc087a1SEmmanuel Vadot      reserve.
408cc087a1SEmmanuel Vadot
418cc087a1SEmmanuel Vadot  alignment:
42*cb7aa33aSEmmanuel Vadot    oneOf:
43*cb7aa33aSEmmanuel Vadot      - $ref: /schemas/types.yaml#/definitions/uint32
44*cb7aa33aSEmmanuel Vadot      - $ref: /schemas/types.yaml#/definitions/uint64
458cc087a1SEmmanuel Vadot    description: >
468cc087a1SEmmanuel Vadot      Length based on parent's \#size-cells. Address boundary for
478cc087a1SEmmanuel Vadot      alignment of allocation.
488cc087a1SEmmanuel Vadot
498cc087a1SEmmanuel Vadot  alloc-ranges:
508cc087a1SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32-array
518cc087a1SEmmanuel Vadot    description: >
528cc087a1SEmmanuel Vadot      Address and Length pairs. Specifies regions of memory that are
538cc087a1SEmmanuel Vadot      acceptable to allocate from.
548cc087a1SEmmanuel Vadot
55*cb7aa33aSEmmanuel Vadot  iommu-addresses:
56*cb7aa33aSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle-array
57*cb7aa33aSEmmanuel Vadot    description: >
58*cb7aa33aSEmmanuel Vadot      A list of phandle and specifier pairs that describe static IO virtual
59*cb7aa33aSEmmanuel Vadot      address space mappings and carveouts associated with a given reserved
60*cb7aa33aSEmmanuel Vadot      memory region. The phandle in the first cell refers to the device for
61*cb7aa33aSEmmanuel Vadot      which the mapping or carveout is to be created.
62*cb7aa33aSEmmanuel Vadot
63*cb7aa33aSEmmanuel Vadot      The specifier consists of an address/size pair and denotes the IO
64*cb7aa33aSEmmanuel Vadot      virtual address range of the region for the given device. The exact
65*cb7aa33aSEmmanuel Vadot      format depends on the values of the "#address-cells" and "#size-cells"
66*cb7aa33aSEmmanuel Vadot      properties of the device referenced via the phandle.
67*cb7aa33aSEmmanuel Vadot
68*cb7aa33aSEmmanuel Vadot      When used in combination with a "reg" property, an IOVA mapping is to
69*cb7aa33aSEmmanuel Vadot      be established for this memory region. One example where this can be
70*cb7aa33aSEmmanuel Vadot      useful is to create an identity mapping for physical memory that the
71*cb7aa33aSEmmanuel Vadot      firmware has configured some hardware to access (such as a bootsplash
72*cb7aa33aSEmmanuel Vadot      framebuffer).
73*cb7aa33aSEmmanuel Vadot
74*cb7aa33aSEmmanuel Vadot      If no "reg" property is specified, the "iommu-addresses" property
75*cb7aa33aSEmmanuel Vadot      defines carveout regions in the IOVA space for the given device. This
76*cb7aa33aSEmmanuel Vadot      can be useful if a certain memory region should not be mapped through
77*cb7aa33aSEmmanuel Vadot      the IOMMU.
78*cb7aa33aSEmmanuel Vadot
798cc087a1SEmmanuel Vadot  no-map:
808cc087a1SEmmanuel Vadot    type: boolean
818cc087a1SEmmanuel Vadot    description: >
828cc087a1SEmmanuel Vadot      Indicates the operating system must not create a virtual mapping
838cc087a1SEmmanuel Vadot      of the region as part of its standard mapping of system memory,
848cc087a1SEmmanuel Vadot      nor permit speculative access to it under any circumstances other
858cc087a1SEmmanuel Vadot      than under the control of the device driver using the region.
868cc087a1SEmmanuel Vadot
878cc087a1SEmmanuel Vadot  reusable:
888cc087a1SEmmanuel Vadot    type: boolean
898cc087a1SEmmanuel Vadot    description: >
908cc087a1SEmmanuel Vadot      The operating system can use the memory in this region with the
918cc087a1SEmmanuel Vadot      limitation that the device driver(s) owning the region need to be
928cc087a1SEmmanuel Vadot      able to reclaim it back. Typically that means that the operating
938cc087a1SEmmanuel Vadot      system can use that region to store volatile or cached data that
948cc087a1SEmmanuel Vadot      can be otherwise regenerated or migrated elsewhere.
958cc087a1SEmmanuel Vadot
968cc087a1SEmmanuel VadotallOf:
978cc087a1SEmmanuel Vadot  - if:
988cc087a1SEmmanuel Vadot      required:
998cc087a1SEmmanuel Vadot        - no-map
1008cc087a1SEmmanuel Vadot
1018cc087a1SEmmanuel Vadot    then:
1028cc087a1SEmmanuel Vadot      not:
1038cc087a1SEmmanuel Vadot        required:
1048cc087a1SEmmanuel Vadot          - reusable
1058cc087a1SEmmanuel Vadot
1068cc087a1SEmmanuel Vadot  - if:
1078cc087a1SEmmanuel Vadot      required:
1088cc087a1SEmmanuel Vadot        - reusable
1098cc087a1SEmmanuel Vadot
1108cc087a1SEmmanuel Vadot    then:
1118cc087a1SEmmanuel Vadot      not:
1128cc087a1SEmmanuel Vadot        required:
1138cc087a1SEmmanuel Vadot          - no-map
1148cc087a1SEmmanuel Vadot
1158cc087a1SEmmanuel VadotoneOf:
116*cb7aa33aSEmmanuel Vadot  - oneOf:
1178cc087a1SEmmanuel Vadot      - required:
1188cc087a1SEmmanuel Vadot          - reg
1198cc087a1SEmmanuel Vadot
1208cc087a1SEmmanuel Vadot      - required:
1218cc087a1SEmmanuel Vadot          - size
1228cc087a1SEmmanuel Vadot
123*cb7aa33aSEmmanuel Vadot  - oneOf:
124*cb7aa33aSEmmanuel Vadot      # IOMMU reservations
125*cb7aa33aSEmmanuel Vadot      - required:
126*cb7aa33aSEmmanuel Vadot          - iommu-addresses
127*cb7aa33aSEmmanuel Vadot
128*cb7aa33aSEmmanuel Vadot      # IOMMU mappings
129*cb7aa33aSEmmanuel Vadot      - required:
130*cb7aa33aSEmmanuel Vadot          - reg
131*cb7aa33aSEmmanuel Vadot          - iommu-addresses
132*cb7aa33aSEmmanuel Vadot
1338cc087a1SEmmanuel VadotadditionalProperties: true
1348cc087a1SEmmanuel Vadot
135*cb7aa33aSEmmanuel Vadotexamples:
136*cb7aa33aSEmmanuel Vadot  - |
137*cb7aa33aSEmmanuel Vadot    / {
138*cb7aa33aSEmmanuel Vadot      compatible = "foo";
139*cb7aa33aSEmmanuel Vadot      model = "foo";
140*cb7aa33aSEmmanuel Vadot
141*cb7aa33aSEmmanuel Vadot      #address-cells = <2>;
142*cb7aa33aSEmmanuel Vadot      #size-cells = <2>;
143*cb7aa33aSEmmanuel Vadot
144*cb7aa33aSEmmanuel Vadot      reserved-memory {
145*cb7aa33aSEmmanuel Vadot        #address-cells = <2>;
146*cb7aa33aSEmmanuel Vadot        #size-cells = <2>;
147*cb7aa33aSEmmanuel Vadot        ranges;
148*cb7aa33aSEmmanuel Vadot
149*cb7aa33aSEmmanuel Vadot        adsp_resv: reservation-adsp {
150*cb7aa33aSEmmanuel Vadot          /*
151*cb7aa33aSEmmanuel Vadot           * Restrict IOVA mappings for ADSP buffers to the 512 MiB region
152*cb7aa33aSEmmanuel Vadot           * from 0x40000000 - 0x5fffffff. Anything outside is reserved by
153*cb7aa33aSEmmanuel Vadot           * the ADSP for I/O memory and private memory allocations.
154*cb7aa33aSEmmanuel Vadot           */
155*cb7aa33aSEmmanuel Vadot          iommu-addresses = <&adsp 0x0 0x00000000 0x00 0x40000000>,
156*cb7aa33aSEmmanuel Vadot                            <&adsp 0x0 0x60000000 0xff 0xa0000000>;
157*cb7aa33aSEmmanuel Vadot        };
158*cb7aa33aSEmmanuel Vadot
159*cb7aa33aSEmmanuel Vadot        fb: framebuffer@90000000 {
160*cb7aa33aSEmmanuel Vadot          reg = <0x0 0x90000000 0x0 0x00800000>;
161*cb7aa33aSEmmanuel Vadot          iommu-addresses = <&dc0 0x0 0x90000000 0x0 0x00800000>;
162*cb7aa33aSEmmanuel Vadot        };
163*cb7aa33aSEmmanuel Vadot      };
164*cb7aa33aSEmmanuel Vadot
165*cb7aa33aSEmmanuel Vadot      bus@0 {
166*cb7aa33aSEmmanuel Vadot        #address-cells = <1>;
167*cb7aa33aSEmmanuel Vadot        #size-cells = <1>;
168*cb7aa33aSEmmanuel Vadot        ranges = <0x0 0x0 0x0 0x40000000>;
169*cb7aa33aSEmmanuel Vadot
170*cb7aa33aSEmmanuel Vadot        adsp: adsp@2990000 {
171*cb7aa33aSEmmanuel Vadot          reg = <0x2990000 0x2000>;
172*cb7aa33aSEmmanuel Vadot          memory-region = <&adsp_resv>;
173*cb7aa33aSEmmanuel Vadot        };
174*cb7aa33aSEmmanuel Vadot
175*cb7aa33aSEmmanuel Vadot        dc0: display@15200000 {
176*cb7aa33aSEmmanuel Vadot          reg = <0x15200000 0x10000>;
177*cb7aa33aSEmmanuel Vadot          memory-region = <&fb>;
178*cb7aa33aSEmmanuel Vadot        };
179*cb7aa33aSEmmanuel Vadot      };
180*cb7aa33aSEmmanuel Vadot    };
1818cc087a1SEmmanuel Vadot...
182