xref: /linux/arch/powerpc/include/asm/papr-watchdog.h (revision 1200d84f4c0a929a0780180d25063d93773be79c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef _ASM_POWERPC_PAPR_WATCHDOG_H
4 #define _ASM_POWERPC_PAPR_WATCHDOG_H
5 
6 /*
7  * H_WATCHDOG Input
8  *
9  * R4: "flags":
10  *
11  *         Bits 48-55: "operation"
12  */
13 #define PSERIES_WDTF_OP_START	0x100UL		/* start timer */
14 #define PSERIES_WDTF_OP_STOP	0x200UL		/* stop timer */
15 #define PSERIES_WDTF_OP_QUERY	0x300UL		/* query timer capabilities */
16 
17 /*
18  *         Bits 56-63: "timeoutAction" (for "Start Watchdog" only)
19  */
20 #define PSERIES_WDTF_ACTION_HARD_POWEROFF	0x1UL	/* poweroff */
21 #define PSERIES_WDTF_ACTION_HARD_RESTART	0x2UL	/* restart */
22 #define PSERIES_WDTF_ACTION_DUMP_RESTART	0x3UL	/* dump + restart */
23 
24 /*
25  * R5: "watchdogNumber":
26  *       PAPR says use -1 (all ones) to stop all watchdogs.
27  */
28 #define PSERIES_WDT_NUM_ALL	((unsigned long)-1)
29 
30 /*
31  * H_WATCHDOG Output
32  *
33  * R3: Return code
34  *
35  *     H_SUCCESS    The operation completed.
36  *
37  *     H_BUSY	    The hypervisor is too busy; retry the operation.
38  *
39  *     H_PARAMETER  The given "flags" are somehow invalid.  Either the
40  *                  "operation" or "timeoutAction" is invalid, or a
41  *                  reserved bit is set.
42  *
43  *     H_P2         The given "watchdogNumber" is zero or exceeds the
44  *                  supported maximum value.
45  *
46  *     H_P3         The given "timeoutInMs" is below the supported
47  *                  minimum value.
48  *
49  *     H_NOOP       The given "watchdogNumber" is already stopped.
50  *
51  *     H_HARDWARE   The operation failed for ineffable reasons.
52  *
53  *     H_FUNCTION   The H_WATCHDOG hypercall is not supported by this
54  *                  hypervisor.
55  *
56  * R4:
57  *
58  * - For the "Query Watchdog Capabilities" operation, a 64-bit
59  *   structure:
60  */
61 #define PSERIES_WDTQ_MIN_TIMEOUT(cap)	(((cap) >> 48) & 0xffff)
62 #define PSERIES_WDTQ_MAX_NUMBER(cap)	(((cap) >> 32) & 0xffff)
63 
64 #endif /* _ASM_POWERPC_PAPR_WATCHDOG_H */
65