162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/reserved-memory/ramoops.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: Ramoops oops/panic logger
862306a36Sopenharmony_ci
962306a36Sopenharmony_cidescription: |
1062306a36Sopenharmony_ci  ramoops provides persistent RAM storage for oops and panics, so they can be
1162306a36Sopenharmony_ci  recovered after a reboot. This is a child-node of "/reserved-memory", and
1262306a36Sopenharmony_ci  is named "ramoops" after the backend, rather than "pstore" which is the
1362306a36Sopenharmony_ci  subsystem.
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci  Parts of this storage may be set aside for other persistent log buffers, such
1662306a36Sopenharmony_ci  as kernel log messages, or for optional ECC error-correction data.  The total
1762306a36Sopenharmony_ci  size of these optional buffers must fit in the reserved region.
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci  Any remaining space will be used for a circular buffer of oops and panic
2062306a36Sopenharmony_ci  records.  These records have a configurable size, with a size of 0 indicating
2162306a36Sopenharmony_ci  that they should be disabled.
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci  At least one of "record-size", "console-size", "ftrace-size", or "pmsg-size"
2462306a36Sopenharmony_ci  must be set non-zero, but are otherwise optional as listed below.
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_cimaintainers:
2762306a36Sopenharmony_ci  - Kees Cook <keescook@chromium.org>
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciallOf:
3062306a36Sopenharmony_ci  - $ref: reserved-memory.yaml
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciproperties:
3362306a36Sopenharmony_ci  compatible:
3462306a36Sopenharmony_ci    const: ramoops
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci  reg:
3762306a36Sopenharmony_ci    description: region of memory that is preserved between reboots
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci  ecc-size:
4062306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
4162306a36Sopenharmony_ci    description: enables ECC support and specifies ECC buffer size in bytes
4262306a36Sopenharmony_ci    default: 0 # no ECC
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci  record-size:
4562306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
4662306a36Sopenharmony_ci    description: maximum size in bytes of each kmsg dump
4762306a36Sopenharmony_ci    default: 0
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci  console-size:
5062306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
5162306a36Sopenharmony_ci    description: size in bytes of log buffer reserved for kernel messages
5262306a36Sopenharmony_ci    default: 0
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci  ftrace-size:
5562306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
5662306a36Sopenharmony_ci    description: size in bytes of log buffer reserved for function tracing and profiling
5762306a36Sopenharmony_ci    default: 0
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci  pmsg-size:
6062306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
6162306a36Sopenharmony_ci    description: size in bytes of log buffer reserved for userspace messages
6262306a36Sopenharmony_ci    default: 0
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci  mem-type:
6562306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
6662306a36Sopenharmony_ci    description: if present, sets the type of mapping is to be used to map the reserved region.
6762306a36Sopenharmony_ci    default: 0
6862306a36Sopenharmony_ci    oneOf:
6962306a36Sopenharmony_ci      - const: 0
7062306a36Sopenharmony_ci        description: write-combined
7162306a36Sopenharmony_ci      - const: 1
7262306a36Sopenharmony_ci        description: unbuffered
7362306a36Sopenharmony_ci      - const: 2
7462306a36Sopenharmony_ci        description: cached
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci  max-reason:
7762306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
7862306a36Sopenharmony_ci    default: 2 # log oopses and panics
7962306a36Sopenharmony_ci    maximum: 0x7fffffff
8062306a36Sopenharmony_ci    description: |
8162306a36Sopenharmony_ci      If present, sets maximum type of kmsg dump reasons to store.
8262306a36Sopenharmony_ci      This can be set to INT_MAX to store all kmsg dumps.
8362306a36Sopenharmony_ci      See include/linux/kmsg_dump.h KMSG_DUMP_* for other kmsg dump reason values.
8462306a36Sopenharmony_ci      Setting this to 0 (KMSG_DUMP_UNDEF), means the reason filtering will be
8562306a36Sopenharmony_ci      controlled by the printk.always_kmsg_dump boot param.
8662306a36Sopenharmony_ci      If unset, it will be 2 (KMSG_DUMP_OOPS), otherwise 5 (KMSG_DUMP_MAX).
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci  flags:
8962306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
9062306a36Sopenharmony_ci    default: 0
9162306a36Sopenharmony_ci    description: |
9262306a36Sopenharmony_ci      If present, pass ramoops behavioral flags
9362306a36Sopenharmony_ci      (see include/linux/pstore_ram.h RAMOOPS_FLAG_* for flag values).
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci  no-dump-oops:
9662306a36Sopenharmony_ci    deprecated: true
9762306a36Sopenharmony_ci    type: boolean
9862306a36Sopenharmony_ci    description: |
9962306a36Sopenharmony_ci      Use max_reason instead. If present, and max_reason is not specified,
10062306a36Sopenharmony_ci      it is equivalent to max_reason = 1 (KMSG_DUMP_PANIC).
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci  unbuffered:
10362306a36Sopenharmony_ci    deprecated: true
10462306a36Sopenharmony_ci    type: boolean
10562306a36Sopenharmony_ci    description: |
10662306a36Sopenharmony_ci      Use mem_type instead. If present, and mem_type is not specified,
10762306a36Sopenharmony_ci      it is equivalent to mem_type = 1 and uses unbuffered mappings to map
10862306a36Sopenharmony_ci      the reserved region (defaults to buffered mappings mem_type = 0).
10962306a36Sopenharmony_ci      If both are specified -- "mem_type" overrides "unbuffered".
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ciunevaluatedProperties: false
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_cirequired:
11462306a36Sopenharmony_ci  - compatible
11562306a36Sopenharmony_ci  - reg
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_cianyOf:
11862306a36Sopenharmony_ci  - required: [record-size]
11962306a36Sopenharmony_ci  - required: [console-size]
12062306a36Sopenharmony_ci  - required: [ftrace-size]
12162306a36Sopenharmony_ci  - required: [pmsg-size]
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ciexamples:
12462306a36Sopenharmony_ci  - |
12562306a36Sopenharmony_ci    / {
12662306a36Sopenharmony_ci        compatible = "foo";
12762306a36Sopenharmony_ci        model = "foo";
12862306a36Sopenharmony_ci        #address-cells = <1>;
12962306a36Sopenharmony_ci        #size-cells = <1>;
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci        reserved-memory {
13262306a36Sopenharmony_ci            #address-cells = <1>;
13362306a36Sopenharmony_ci            #size-cells = <1>;
13462306a36Sopenharmony_ci            ranges;
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci            ramoops@bfdf0000 {
13762306a36Sopenharmony_ci                compatible = "ramoops";
13862306a36Sopenharmony_ci                reg = <0xbfdf0000 0x10000>; /* 64kB */
13962306a36Sopenharmony_ci                console-size = <0x8000>;    /* 32kB */
14062306a36Sopenharmony_ci                record-size = <0x400>;      /*  1kB */
14162306a36Sopenharmony_ci                ecc-size = <16>;
14262306a36Sopenharmony_ci            };
14362306a36Sopenharmony_ci        };
14462306a36Sopenharmony_ci    };
145