master
h 118 lines 3.92 KB
Raw
1 /*
2 * Watchdog Action Table (WDAT) definitions
3 *
4 * Copyright Red Hat, Inc. 2026
5 * Author(s): Igor Mammedov <imammedo@redhat.com>
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9 #ifndef QEMU_HW_ACPI_WDAT_H
10 #define QEMU_HW_ACPI_WDAT_H
11
12 #include "hw/acpi/acpi-defs.h"
13
14 /*
15 * Watchdog actions as described in
16 * "Hardware Watchdog Timers Design Specification"
17 * for link to spec see https://uefi.org/acpi
18 * 'Watchdog Action Table (WDAT)'
19 */
20 typedef enum {
21 /*
22 * Restarts the watchdog timer's countdown. This action is
23 * required.
24 */
25 WDAT_ACTION_RESET = 0x1,
26 /*
27 * Returns the current countdown value of the watchdog hardware
28 * (in count intervals).
29 */
30 WDAT_ACTION_QUERY_CURRENT_COUNTDOWN_PERIOD = 0x4,
31 /*
32 * Returns the countdown value the watchdog hardware is
33 * configured to use when reset (in count intervals).
34 */
35 WDAT_ACTION_QUERY_COUNTDOWN_PERIOD = 0x5,
36 /*
37 * Sets the countdown value (in count intervals) to be used when
38 * the watchdog timer is reset. This action is required if
39 * WDAT_ACTION_RESET does not explicitly write a new
40 * countdown value to a register during a reset. Otherwise, this
41 * action is optional.
42 */
43 WDAT_ACTION_SET_COUNTDOWN_PERIOD = 0x6,
44 /*
45 * Determines if the watchdog hardware is currently in enabled/
46 * running state. The same result must occur when performed from
47 * both from enabled/stopped state and enabled/running state. If
48 * the watchdog hardware is disabled, results are indeterminate.
49 * This action is required.
50 */
51 WDAT_ACTION_QUERY_RUNNING_STATE = 0x8,
52 /*
53 * Starts the watchdog, if not already in running state. If the
54 * watchdog hardware is disabled, results are indeterminate.
55 * This action is required.
56 */
57 WDAT_ACTION_SET_RUNNING_STATE = 0x9,
58 /*
59 * Determines if the watchdog hardware is currently in enabled/
60 * stopped state. The same result must occur when performed from
61 * both the enabled/stopped state and enabled/running state. If
62 * the watchdog hardware is disabled, results are indeterminate.
63 * This action is required.
64 */
65 WDAT_ACTION_QUERY_STOPPED_STATE = 0xA,
66 /*
67 * Stops the watchdog, if not already in stopped state. If the
68 * watchdog hardware is disabled, results are indeterminate.
69 * This action is required.
70 */
71 WDAT_ACTION_SET_STOPPED_STATE = 0xB,
72 /*
73 * Determines if the watchdog hardware is configured to perform a
74 * reboot when the watchdog is fired.
75 */
76 WDAT_ACTION_QUERY_REBOOT = 0x10,
77 /*
78 * Configures the watchdog hardware to perform a reboot when it
79 * is fired.
80 */
81 WDAT_ACTION_SET_REBOOT = 0x11,
82 /*
83 * Determines if the watchdog hardware is configured to perform a
84 * system shutdown when fired.
85 */
86 WDAT_ACTION_QUERY_SHUTDOWN = 0x12,
87 /*
88 * Configures the watchdog hardware to perform a system shutdown
89 * when fired.
90 */
91 WDAT_ACTION_SET_SHUTDOWN = 0x13,
92 /*
93 * Determines if the current boot was caused by the watchdog
94 * firing. The boot status is required to be set if the watchdog
95 * fired and caused a reboot. It is recommended that the
96 * Watchdog Status be set if the watchdog fired and caused a
97 * shutdown. This action is required.
98 */
99 WDAT_ACTION_QUERY_WATCHDOG_STATUS = 0x20,
100 /*
101 * Sets the watchdog's boot status to the default value. This
102 * action is required.
103 */
104 WDAT_ACTION_SET_WATCHDOG_STATUS = 0x21,
105 } WDATAction;
106
107 #define WDAT_INS_READ_VALUE 0x0
108 #define WDAT_INS_READ_COUNTDOWN 0x1
109 #define WDAT_INS_WRITE_VALUE 0x2
110 #define WDAT_INS_WRITE_COUNTDOWN 0x3
111 #define WDAT_INS_PRESERVE_REGISTER 0x80
112
113 void build_append_wdat_ins(GArray *table_data,
114 WDATAction action, uint8_t flags,
115 struct AcpiGenericAddress as,
116 uint32_t val, uint32_t mask);
117
118 #endif /* QEMU_HW_ACPI_WDAT_H */