1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/reserved-memory/ramoops.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Ramoops oops/panic logger
8
9description: |
10  ramoops provides persistent RAM storage for oops and panics, so they can be
11  recovered after a reboot. This is a child-node of "/reserved-memory", and
12  is named "ramoops" after the backend, rather than "pstore" which is the
13  subsystem.
14
15  Parts of this storage may be set aside for other persistent log buffers, such
16  as kernel log messages, or for optional ECC error-correction data.  The total
17  size of these optional buffers must fit in the reserved region.
18
19  Any remaining space will be used for a circular buffer of oops and panic
20  records.  These records have a configurable size, with a size of 0 indicating
21  that they should be disabled.
22
23  At least one of "record-size", "console-size", "ftrace-size", or "pmsg-size"
24  must be set non-zero, but are otherwise optional as listed below.
25
26maintainers:
27  - Kees Cook <keescook@chromium.org>
28
29allOf:
30  - $ref: reserved-memory.yaml
31
32properties:
33  compatible:
34    const: ramoops
35
36  reg:
37    description: region of memory that is preserved between reboots
38
39  ecc-size:
40    $ref: /schemas/types.yaml#/definitions/uint32
41    description: enables ECC support and specifies ECC buffer size in bytes
42    default: 0 # no ECC
43
44  record-size:
45    $ref: /schemas/types.yaml#/definitions/uint32
46    description: maximum size in bytes of each kmsg dump
47    default: 0
48
49  console-size:
50    $ref: /schemas/types.yaml#/definitions/uint32
51    description: size in bytes of log buffer reserved for kernel messages
52    default: 0
53
54  ftrace-size:
55    $ref: /schemas/types.yaml#/definitions/uint32
56    description: size in bytes of log buffer reserved for function tracing and profiling
57    default: 0
58
59  pmsg-size:
60    $ref: /schemas/types.yaml#/definitions/uint32
61    description: size in bytes of log buffer reserved for userspace messages
62    default: 0
63
64  mem-type:
65    $ref: /schemas/types.yaml#/definitions/uint32
66    description: if present, sets the type of mapping is to be used to map the reserved region.
67    default: 0
68    oneOf:
69      - const: 0
70        description: write-combined
71      - const: 1
72        description: unbuffered
73      - const: 2
74        description: cached
75
76  max-reason:
77    $ref: /schemas/types.yaml#/definitions/uint32
78    default: 2 # log oopses and panics
79    maximum: 0x7fffffff
80    description: |
81      If present, sets maximum type of kmsg dump reasons to store.
82      This can be set to INT_MAX to store all kmsg dumps.
83      See include/linux/kmsg_dump.h KMSG_DUMP_* for other kmsg dump reason values.
84      Setting this to 0 (KMSG_DUMP_UNDEF), means the reason filtering will be
85      controlled by the printk.always_kmsg_dump boot param.
86      If unset, it will be 2 (KMSG_DUMP_OOPS), otherwise 5 (KMSG_DUMP_MAX).
87
88  flags:
89    $ref: /schemas/types.yaml#/definitions/uint32
90    default: 0
91    description: |
92      If present, pass ramoops behavioral flags
93      (see include/linux/pstore_ram.h RAMOOPS_FLAG_* for flag values).
94
95  no-dump-oops:
96    deprecated: true
97    type: boolean
98    description: |
99      Use max_reason instead. If present, and max_reason is not specified,
100      it is equivalent to max_reason = 1 (KMSG_DUMP_PANIC).
101
102  unbuffered:
103    deprecated: true
104    type: boolean
105    description: |
106      Use mem_type instead. If present, and mem_type is not specified,
107      it is equivalent to mem_type = 1 and uses unbuffered mappings to map
108      the reserved region (defaults to buffered mappings mem_type = 0).
109      If both are specified -- "mem_type" overrides "unbuffered".
110
111unevaluatedProperties: false
112
113required:
114  - compatible
115  - reg
116
117anyOf:
118  - required: [record-size]
119  - required: [console-size]
120  - required: [ftrace-size]
121  - required: [pmsg-size]
122
123examples:
124  - |
125    / {
126        compatible = "foo";
127        model = "foo";
128        #address-cells = <1>;
129        #size-cells = <1>;
130
131        reserved-memory {
132            #address-cells = <1>;
133            #size-cells = <1>;
134            ranges;
135
136            ramoops@bfdf0000 {
137                compatible = "ramoops";
138                reg = <0xbfdf0000 0x10000>; /* 64kB */
139                console-size = <0x8000>;    /* 32kB */
140                record-size = <0x400>;      /*  1kB */
141                ecc-size = <16>;
142            };
143        };
144    };
145