Skip to content

Commit

Permalink
schemas: Enforce root node unit-address and reg checks
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
robherring committed Feb 8, 2021
1 parent f754e83 commit af62002
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions schemas/root-node.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-2-Clause
# Copyright 2018 Linaro Ltd.
# Copyright 2018 Arm Ltd.
# Copyright 2018,2021 Arm Ltd.
%YAML 1.2
---
$id: http://devicetree.org/schemas/root-node.yaml#
Expand All @@ -23,13 +23,40 @@ properties:
enum: [1, 2]
memory: false

patternProperties:
"@(0|[1-9a-f][0-9a-f]*)$":
type: object
properties:
reg:
items:
minItems: 2
maxItems: 4
minItems: 1
maxItems: 1024
ranges:
oneOf:
- items:
minItems: 3
maxItems: 7
minItems: 1
maxItems: 1024
- $ref: "types.yaml#/definitions/flag"
anyOf:
- required:
- reg
- required:
- ranges

# Anything else should not have a unit-address
"^[^@]+$": true

required:
- compatible
- model
- "#address-cells"
- "#size-cells"

additionalProperties: true
additionalProperties: false

examples:
- |
Expand Down

0 comments on commit af62002

Please sign in to comment.