Skip to content

Commit af62002

Browse files
committed
schemas: Enforce root node unit-address and reg checks
Root nodes generally follow simple-bus structure except child nodes may not have unit-addresses. If they do, the same rules for unit-address format and reg and ranges properties apply. So let's copy the simple-bus schema. Signed-off-by: Rob Herring <[email protected]>
1 parent f754e83 commit af62002

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

schemas/root-node.yaml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: BSD-2-Clause
22
# Copyright 2018 Linaro Ltd.
3-
# Copyright 2018 Arm Ltd.
3+
# Copyright 2018,2021 Arm Ltd.
44
%YAML 1.2
55
---
66
$id: http://devicetree.org/schemas/root-node.yaml#
@@ -23,13 +23,40 @@ properties:
2323
enum: [1, 2]
2424
memory: false
2525

26+
patternProperties:
27+
"@(0|[1-9a-f][0-9a-f]*)$":
28+
type: object
29+
properties:
30+
reg:
31+
items:
32+
minItems: 2
33+
maxItems: 4
34+
minItems: 1
35+
maxItems: 1024
36+
ranges:
37+
oneOf:
38+
- items:
39+
minItems: 3
40+
maxItems: 7
41+
minItems: 1
42+
maxItems: 1024
43+
- $ref: "types.yaml#/definitions/flag"
44+
anyOf:
45+
- required:
46+
- reg
47+
- required:
48+
- ranges
49+
50+
# Anything else should not have a unit-address
51+
"^[^@]+$": true
52+
2653
required:
2754
- compatible
2855
- model
2956
- "#address-cells"
3057
- "#size-cells"
3158

32-
additionalProperties: true
59+
additionalProperties: false
3360

3461
examples:
3562
- |

0 commit comments

Comments
 (0)