1/* SPDX-License-Identifier: GPL-2.0-only */
2#ifndef __LINUX_PAPR_SCM_H
3#define __LINUX_PAPR_SCM_H
4
5/* DIMM health bitmap indicators */
6/* SCM device is unable to persist memory contents */
7#define PAPR_PMEM_UNARMED                   (1ULL << (63 - 0))
8/* SCM device failed to persist memory contents */
9#define PAPR_PMEM_SHUTDOWN_DIRTY            (1ULL << (63 - 1))
10/* SCM device contents are persisted from previous IPL */
11#define PAPR_PMEM_SHUTDOWN_CLEAN            (1ULL << (63 - 2))
12/* SCM device contents are not persisted from previous IPL */
13#define PAPR_PMEM_EMPTY                     (1ULL << (63 - 3))
14/* SCM device memory life remaining is critically low */
15#define PAPR_PMEM_HEALTH_CRITICAL           (1ULL << (63 - 4))
16/* SCM device will be garded off next IPL due to failure */
17#define PAPR_PMEM_HEALTH_FATAL              (1ULL << (63 - 5))
18/* SCM contents cannot persist due to current platform health status */
19#define PAPR_PMEM_HEALTH_UNHEALTHY          (1ULL << (63 - 6))
20/* SCM device is unable to persist memory contents in certain conditions */
21#define PAPR_PMEM_HEALTH_NON_CRITICAL       (1ULL << (63 - 7))
22/* SCM device is encrypted */
23#define PAPR_PMEM_ENCRYPTED                 (1ULL << (63 - 8))
24/* SCM device has been scrubbed and locked */
25#define PAPR_PMEM_SCRUBBED_AND_LOCKED       (1ULL << (63 - 9))
26
27#define PAPR_PMEM_SAVE_FAILED               (1ULL << (63 - 10))
28
29/* Bits status indicators for health bitmap indicating unarmed dimm */
30#define PAPR_PMEM_UNARMED_MASK (PAPR_PMEM_UNARMED |            \
31				PAPR_PMEM_HEALTH_UNHEALTHY)
32
33/* Bits status indicators for health bitmap indicating unflushed dimm */
34#define PAPR_PMEM_BAD_SHUTDOWN_MASK (PAPR_PMEM_SHUTDOWN_DIRTY)
35
36/* Bits status indicators for health bitmap indicating unrestored dimm */
37#define PAPR_PMEM_BAD_RESTORE_MASK  (PAPR_PMEM_EMPTY)
38
39/* Bit status indicators for smart event notification */
40#define PAPR_PMEM_SMART_EVENT_MASK (PAPR_PMEM_HEALTH_CRITICAL | \
41					PAPR_PMEM_HEALTH_FATAL | \
42					PAPR_PMEM_HEALTH_UNHEALTHY)
43
44#define PAPR_PMEM_SAVE_MASK                (PAPR_PMEM_SAVE_FAILED)
45
46#define PAPR_SCM_PERF_STATS_EYECATCHER __stringify(SCMSTATS)
47#define PAPR_SCM_PERF_STATS_VERSION 0x1
48
49#endif /* __LINUX_PAPR_SCM_H */
50