162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * OPAL API definitions.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright 2011-2015 IBM Corp.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __OPAL_API_H
962306a36Sopenharmony_ci#define __OPAL_API_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/****** OPAL APIs ******/
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/* Return codes */
1462306a36Sopenharmony_ci#define OPAL_SUCCESS		0
1562306a36Sopenharmony_ci#define OPAL_PARAMETER		-1
1662306a36Sopenharmony_ci#define OPAL_BUSY		-2
1762306a36Sopenharmony_ci#define OPAL_PARTIAL		-3
1862306a36Sopenharmony_ci#define OPAL_CONSTRAINED	-4
1962306a36Sopenharmony_ci#define OPAL_CLOSED		-5
2062306a36Sopenharmony_ci#define OPAL_HARDWARE		-6
2162306a36Sopenharmony_ci#define OPAL_UNSUPPORTED	-7
2262306a36Sopenharmony_ci#define OPAL_PERMISSION		-8
2362306a36Sopenharmony_ci#define OPAL_NO_MEM		-9
2462306a36Sopenharmony_ci#define OPAL_RESOURCE		-10
2562306a36Sopenharmony_ci#define OPAL_INTERNAL_ERROR	-11
2662306a36Sopenharmony_ci#define OPAL_BUSY_EVENT		-12
2762306a36Sopenharmony_ci#define OPAL_HARDWARE_FROZEN	-13
2862306a36Sopenharmony_ci#define OPAL_WRONG_STATE	-14
2962306a36Sopenharmony_ci#define OPAL_ASYNC_COMPLETION	-15
3062306a36Sopenharmony_ci#define OPAL_EMPTY		-16
3162306a36Sopenharmony_ci#define OPAL_I2C_TIMEOUT	-17
3262306a36Sopenharmony_ci#define OPAL_I2C_INVALID_CMD	-18
3362306a36Sopenharmony_ci#define OPAL_I2C_LBUS_PARITY	-19
3462306a36Sopenharmony_ci#define OPAL_I2C_BKEND_OVERRUN	-20
3562306a36Sopenharmony_ci#define OPAL_I2C_BKEND_ACCESS	-21
3662306a36Sopenharmony_ci#define OPAL_I2C_ARBT_LOST	-22
3762306a36Sopenharmony_ci#define OPAL_I2C_NACK_RCVD	-23
3862306a36Sopenharmony_ci#define OPAL_I2C_STOP_ERR	-24
3962306a36Sopenharmony_ci#define OPAL_XIVE_PROVISIONING	-31
4062306a36Sopenharmony_ci#define OPAL_XIVE_FREE_ACTIVE	-32
4162306a36Sopenharmony_ci#define OPAL_TIMEOUT		-33
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/* API Tokens (in r0) */
4462306a36Sopenharmony_ci#define OPAL_INVALID_CALL		       -1
4562306a36Sopenharmony_ci#define OPAL_TEST				0
4662306a36Sopenharmony_ci#define OPAL_CONSOLE_WRITE			1
4762306a36Sopenharmony_ci#define OPAL_CONSOLE_READ			2
4862306a36Sopenharmony_ci#define OPAL_RTC_READ				3
4962306a36Sopenharmony_ci#define OPAL_RTC_WRITE				4
5062306a36Sopenharmony_ci#define OPAL_CEC_POWER_DOWN			5
5162306a36Sopenharmony_ci#define OPAL_CEC_REBOOT				6
5262306a36Sopenharmony_ci#define OPAL_READ_NVRAM				7
5362306a36Sopenharmony_ci#define OPAL_WRITE_NVRAM			8
5462306a36Sopenharmony_ci#define OPAL_HANDLE_INTERRUPT			9
5562306a36Sopenharmony_ci#define OPAL_POLL_EVENTS			10
5662306a36Sopenharmony_ci#define OPAL_PCI_SET_HUB_TCE_MEMORY		11
5762306a36Sopenharmony_ci#define OPAL_PCI_SET_PHB_TCE_MEMORY		12
5862306a36Sopenharmony_ci#define OPAL_PCI_CONFIG_READ_BYTE		13
5962306a36Sopenharmony_ci#define OPAL_PCI_CONFIG_READ_HALF_WORD  	14
6062306a36Sopenharmony_ci#define OPAL_PCI_CONFIG_READ_WORD		15
6162306a36Sopenharmony_ci#define OPAL_PCI_CONFIG_WRITE_BYTE		16
6262306a36Sopenharmony_ci#define OPAL_PCI_CONFIG_WRITE_HALF_WORD		17
6362306a36Sopenharmony_ci#define OPAL_PCI_CONFIG_WRITE_WORD		18
6462306a36Sopenharmony_ci#define OPAL_SET_XIVE				19
6562306a36Sopenharmony_ci#define OPAL_GET_XIVE				20
6662306a36Sopenharmony_ci#define OPAL_GET_COMPLETION_TOKEN_STATUS	21 /* obsolete */
6762306a36Sopenharmony_ci#define OPAL_REGISTER_OPAL_EXCEPTION_HANDLER	22
6862306a36Sopenharmony_ci#define OPAL_PCI_EEH_FREEZE_STATUS		23
6962306a36Sopenharmony_ci#define OPAL_PCI_SHPC				24
7062306a36Sopenharmony_ci#define OPAL_CONSOLE_WRITE_BUFFER_SPACE		25
7162306a36Sopenharmony_ci#define OPAL_PCI_EEH_FREEZE_CLEAR		26
7262306a36Sopenharmony_ci#define OPAL_PCI_PHB_MMIO_ENABLE		27
7362306a36Sopenharmony_ci#define OPAL_PCI_SET_PHB_MEM_WINDOW		28
7462306a36Sopenharmony_ci#define OPAL_PCI_MAP_PE_MMIO_WINDOW		29
7562306a36Sopenharmony_ci#define OPAL_PCI_SET_PHB_TABLE_MEMORY		30
7662306a36Sopenharmony_ci#define OPAL_PCI_SET_PE				31
7762306a36Sopenharmony_ci#define OPAL_PCI_SET_PELTV			32
7862306a36Sopenharmony_ci#define OPAL_PCI_SET_MVE			33
7962306a36Sopenharmony_ci#define OPAL_PCI_SET_MVE_ENABLE			34
8062306a36Sopenharmony_ci#define OPAL_PCI_GET_XIVE_REISSUE		35
8162306a36Sopenharmony_ci#define OPAL_PCI_SET_XIVE_REISSUE		36
8262306a36Sopenharmony_ci#define OPAL_PCI_SET_XIVE_PE			37
8362306a36Sopenharmony_ci#define OPAL_GET_XIVE_SOURCE			38
8462306a36Sopenharmony_ci#define OPAL_GET_MSI_32				39
8562306a36Sopenharmony_ci#define OPAL_GET_MSI_64				40
8662306a36Sopenharmony_ci#define OPAL_START_CPU				41
8762306a36Sopenharmony_ci#define OPAL_QUERY_CPU_STATUS			42
8862306a36Sopenharmony_ci#define OPAL_WRITE_OPPANEL			43 /* unimplemented */
8962306a36Sopenharmony_ci#define OPAL_PCI_MAP_PE_DMA_WINDOW		44
9062306a36Sopenharmony_ci#define OPAL_PCI_MAP_PE_DMA_WINDOW_REAL		45
9162306a36Sopenharmony_ci#define OPAL_PCI_RESET				49
9262306a36Sopenharmony_ci#define OPAL_PCI_GET_HUB_DIAG_DATA		50
9362306a36Sopenharmony_ci#define OPAL_PCI_GET_PHB_DIAG_DATA		51
9462306a36Sopenharmony_ci#define OPAL_PCI_FENCE_PHB			52
9562306a36Sopenharmony_ci#define OPAL_PCI_REINIT				53
9662306a36Sopenharmony_ci#define OPAL_PCI_MASK_PE_ERROR			54
9762306a36Sopenharmony_ci#define OPAL_SET_SLOT_LED_STATUS		55
9862306a36Sopenharmony_ci#define OPAL_GET_EPOW_STATUS			56
9962306a36Sopenharmony_ci#define OPAL_SET_SYSTEM_ATTENTION_LED		57
10062306a36Sopenharmony_ci#define OPAL_RESERVED1				58
10162306a36Sopenharmony_ci#define OPAL_RESERVED2				59
10262306a36Sopenharmony_ci#define OPAL_PCI_NEXT_ERROR			60
10362306a36Sopenharmony_ci#define OPAL_PCI_EEH_FREEZE_STATUS2		61
10462306a36Sopenharmony_ci#define OPAL_PCI_POLL				62
10562306a36Sopenharmony_ci#define OPAL_PCI_MSI_EOI			63
10662306a36Sopenharmony_ci#define OPAL_PCI_GET_PHB_DIAG_DATA2		64
10762306a36Sopenharmony_ci#define OPAL_XSCOM_READ				65
10862306a36Sopenharmony_ci#define OPAL_XSCOM_WRITE			66
10962306a36Sopenharmony_ci#define OPAL_LPC_READ				67
11062306a36Sopenharmony_ci#define OPAL_LPC_WRITE				68
11162306a36Sopenharmony_ci#define OPAL_RETURN_CPU				69
11262306a36Sopenharmony_ci#define OPAL_REINIT_CPUS			70
11362306a36Sopenharmony_ci#define OPAL_ELOG_READ				71
11462306a36Sopenharmony_ci#define OPAL_ELOG_WRITE				72
11562306a36Sopenharmony_ci#define OPAL_ELOG_ACK				73
11662306a36Sopenharmony_ci#define OPAL_ELOG_RESEND			74
11762306a36Sopenharmony_ci#define OPAL_ELOG_SIZE				75
11862306a36Sopenharmony_ci#define OPAL_FLASH_VALIDATE			76
11962306a36Sopenharmony_ci#define OPAL_FLASH_MANAGE			77
12062306a36Sopenharmony_ci#define OPAL_FLASH_UPDATE			78
12162306a36Sopenharmony_ci#define OPAL_RESYNC_TIMEBASE			79
12262306a36Sopenharmony_ci#define OPAL_CHECK_TOKEN			80
12362306a36Sopenharmony_ci#define OPAL_DUMP_INIT				81
12462306a36Sopenharmony_ci#define OPAL_DUMP_INFO				82
12562306a36Sopenharmony_ci#define OPAL_DUMP_READ				83
12662306a36Sopenharmony_ci#define OPAL_DUMP_ACK				84
12762306a36Sopenharmony_ci#define OPAL_GET_MSG				85
12862306a36Sopenharmony_ci#define OPAL_CHECK_ASYNC_COMPLETION		86
12962306a36Sopenharmony_ci#define OPAL_SYNC_HOST_REBOOT			87
13062306a36Sopenharmony_ci#define OPAL_SENSOR_READ			88
13162306a36Sopenharmony_ci#define OPAL_GET_PARAM				89
13262306a36Sopenharmony_ci#define OPAL_SET_PARAM				90
13362306a36Sopenharmony_ci#define OPAL_DUMP_RESEND			91
13462306a36Sopenharmony_ci#define OPAL_ELOG_SEND				92	/* Deprecated */
13562306a36Sopenharmony_ci#define OPAL_PCI_SET_PHB_CAPI_MODE		93
13662306a36Sopenharmony_ci#define OPAL_DUMP_INFO2				94
13762306a36Sopenharmony_ci#define OPAL_WRITE_OPPANEL_ASYNC		95
13862306a36Sopenharmony_ci#define OPAL_PCI_ERR_INJECT			96
13962306a36Sopenharmony_ci#define OPAL_PCI_EEH_FREEZE_SET			97
14062306a36Sopenharmony_ci#define OPAL_HANDLE_HMI				98
14162306a36Sopenharmony_ci#define OPAL_CONFIG_CPU_IDLE_STATE		99
14262306a36Sopenharmony_ci#define OPAL_SLW_SET_REG			100
14362306a36Sopenharmony_ci#define OPAL_REGISTER_DUMP_REGION		101
14462306a36Sopenharmony_ci#define OPAL_UNREGISTER_DUMP_REGION		102
14562306a36Sopenharmony_ci#define OPAL_WRITE_TPO				103
14662306a36Sopenharmony_ci#define OPAL_READ_TPO				104
14762306a36Sopenharmony_ci#define OPAL_GET_DPO_STATUS			105
14862306a36Sopenharmony_ci#define OPAL_OLD_I2C_REQUEST			106	/* Deprecated */
14962306a36Sopenharmony_ci#define OPAL_IPMI_SEND				107
15062306a36Sopenharmony_ci#define OPAL_IPMI_RECV				108
15162306a36Sopenharmony_ci#define OPAL_I2C_REQUEST			109
15262306a36Sopenharmony_ci#define OPAL_FLASH_READ				110
15362306a36Sopenharmony_ci#define OPAL_FLASH_WRITE			111
15462306a36Sopenharmony_ci#define OPAL_FLASH_ERASE			112
15562306a36Sopenharmony_ci#define OPAL_PRD_MSG				113
15662306a36Sopenharmony_ci#define OPAL_LEDS_GET_INDICATOR			114
15762306a36Sopenharmony_ci#define OPAL_LEDS_SET_INDICATOR			115
15862306a36Sopenharmony_ci#define OPAL_CEC_REBOOT2			116
15962306a36Sopenharmony_ci#define OPAL_CONSOLE_FLUSH			117
16062306a36Sopenharmony_ci#define OPAL_GET_DEVICE_TREE			118
16162306a36Sopenharmony_ci#define OPAL_PCI_GET_PRESENCE_STATE		119
16262306a36Sopenharmony_ci#define OPAL_PCI_GET_POWER_STATE		120
16362306a36Sopenharmony_ci#define OPAL_PCI_SET_POWER_STATE		121
16462306a36Sopenharmony_ci#define OPAL_INT_GET_XIRR			122
16562306a36Sopenharmony_ci#define	OPAL_INT_SET_CPPR			123
16662306a36Sopenharmony_ci#define OPAL_INT_EOI				124
16762306a36Sopenharmony_ci#define OPAL_INT_SET_MFRR			125
16862306a36Sopenharmony_ci#define OPAL_PCI_TCE_KILL			126
16962306a36Sopenharmony_ci#define OPAL_NMMU_SET_PTCR			127
17062306a36Sopenharmony_ci#define OPAL_XIVE_RESET				128
17162306a36Sopenharmony_ci#define OPAL_XIVE_GET_IRQ_INFO			129
17262306a36Sopenharmony_ci#define OPAL_XIVE_GET_IRQ_CONFIG		130
17362306a36Sopenharmony_ci#define OPAL_XIVE_SET_IRQ_CONFIG		131
17462306a36Sopenharmony_ci#define OPAL_XIVE_GET_QUEUE_INFO		132
17562306a36Sopenharmony_ci#define OPAL_XIVE_SET_QUEUE_INFO		133
17662306a36Sopenharmony_ci#define OPAL_XIVE_DONATE_PAGE			134
17762306a36Sopenharmony_ci#define OPAL_XIVE_ALLOCATE_VP_BLOCK		135
17862306a36Sopenharmony_ci#define OPAL_XIVE_FREE_VP_BLOCK			136
17962306a36Sopenharmony_ci#define OPAL_XIVE_GET_VP_INFO			137
18062306a36Sopenharmony_ci#define OPAL_XIVE_SET_VP_INFO			138
18162306a36Sopenharmony_ci#define OPAL_XIVE_ALLOCATE_IRQ			139
18262306a36Sopenharmony_ci#define OPAL_XIVE_FREE_IRQ			140
18362306a36Sopenharmony_ci#define OPAL_XIVE_SYNC				141
18462306a36Sopenharmony_ci#define OPAL_XIVE_DUMP				142
18562306a36Sopenharmony_ci#define OPAL_XIVE_GET_QUEUE_STATE		143
18662306a36Sopenharmony_ci#define OPAL_XIVE_SET_QUEUE_STATE		144
18762306a36Sopenharmony_ci#define OPAL_SIGNAL_SYSTEM_RESET		145
18862306a36Sopenharmony_ci#define OPAL_NPU_INIT_CONTEXT			146
18962306a36Sopenharmony_ci#define OPAL_NPU_DESTROY_CONTEXT		147
19062306a36Sopenharmony_ci#define OPAL_NPU_MAP_LPAR			148
19162306a36Sopenharmony_ci#define OPAL_IMC_COUNTERS_INIT			149
19262306a36Sopenharmony_ci#define OPAL_IMC_COUNTERS_START			150
19362306a36Sopenharmony_ci#define OPAL_IMC_COUNTERS_STOP			151
19462306a36Sopenharmony_ci#define OPAL_GET_POWERCAP			152
19562306a36Sopenharmony_ci#define OPAL_SET_POWERCAP			153
19662306a36Sopenharmony_ci#define OPAL_GET_POWER_SHIFT_RATIO		154
19762306a36Sopenharmony_ci#define OPAL_SET_POWER_SHIFT_RATIO		155
19862306a36Sopenharmony_ci#define OPAL_SENSOR_GROUP_CLEAR			156
19962306a36Sopenharmony_ci#define OPAL_PCI_SET_P2P			157
20062306a36Sopenharmony_ci#define OPAL_QUIESCE				158
20162306a36Sopenharmony_ci#define OPAL_NPU_SPA_SETUP			159
20262306a36Sopenharmony_ci#define OPAL_NPU_SPA_CLEAR_CACHE		160
20362306a36Sopenharmony_ci#define OPAL_NPU_TL_SET				161
20462306a36Sopenharmony_ci#define OPAL_SENSOR_READ_U64			162
20562306a36Sopenharmony_ci#define OPAL_SENSOR_GROUP_ENABLE		163
20662306a36Sopenharmony_ci#define OPAL_PCI_GET_PBCQ_TUNNEL_BAR		164
20762306a36Sopenharmony_ci#define OPAL_PCI_SET_PBCQ_TUNNEL_BAR		165
20862306a36Sopenharmony_ci#define OPAL_HANDLE_HMI2			166
20962306a36Sopenharmony_ci#define	OPAL_NX_COPROC_INIT			167
21062306a36Sopenharmony_ci#define OPAL_XIVE_GET_VP_STATE			170
21162306a36Sopenharmony_ci#define OPAL_MPIPL_UPDATE			173
21262306a36Sopenharmony_ci#define OPAL_MPIPL_REGISTER_TAG			174
21362306a36Sopenharmony_ci#define OPAL_MPIPL_QUERY_TAG			175
21462306a36Sopenharmony_ci#define OPAL_SECVAR_GET				176
21562306a36Sopenharmony_ci#define OPAL_SECVAR_GET_NEXT			177
21662306a36Sopenharmony_ci#define OPAL_SECVAR_ENQUEUE_UPDATE		178
21762306a36Sopenharmony_ci#define OPAL_LAST				178
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci#define QUIESCE_HOLD			1 /* Spin all calls at entry */
22062306a36Sopenharmony_ci#define QUIESCE_REJECT			2 /* Fail all calls with OPAL_BUSY */
22162306a36Sopenharmony_ci#define QUIESCE_LOCK_BREAK		3 /* Set to ignore locks. */
22262306a36Sopenharmony_ci#define QUIESCE_RESUME			4 /* Un-quiesce */
22362306a36Sopenharmony_ci#define QUIESCE_RESUME_FAST_REBOOT	5 /* Un-quiesce, fast reboot */
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci/* Device tree flags */
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_ci/*
22862306a36Sopenharmony_ci * Flags set in power-mgmt nodes in device tree describing
22962306a36Sopenharmony_ci * idle states that are supported in the platform.
23062306a36Sopenharmony_ci */
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci#define OPAL_PM_TIMEBASE_STOP		0x00000002
23362306a36Sopenharmony_ci#define OPAL_PM_LOSE_HYP_CONTEXT	0x00002000
23462306a36Sopenharmony_ci#define OPAL_PM_LOSE_FULL_CONTEXT	0x00004000
23562306a36Sopenharmony_ci#define OPAL_PM_NAP_ENABLED		0x00010000
23662306a36Sopenharmony_ci#define OPAL_PM_SLEEP_ENABLED		0x00020000
23762306a36Sopenharmony_ci#define OPAL_PM_WINKLE_ENABLED		0x00040000
23862306a36Sopenharmony_ci#define OPAL_PM_SLEEP_ENABLED_ER1	0x00080000 /* with workaround */
23962306a36Sopenharmony_ci#define OPAL_PM_STOP_INST_FAST		0x00100000
24062306a36Sopenharmony_ci#define OPAL_PM_STOP_INST_DEEP		0x00200000
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci/*
24362306a36Sopenharmony_ci * OPAL_CONFIG_CPU_IDLE_STATE parameters
24462306a36Sopenharmony_ci */
24562306a36Sopenharmony_ci#define OPAL_CONFIG_IDLE_FASTSLEEP	1
24662306a36Sopenharmony_ci#define OPAL_CONFIG_IDLE_UNDO		0
24762306a36Sopenharmony_ci#define OPAL_CONFIG_IDLE_APPLY		1
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci#ifndef __ASSEMBLY__
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci/* Other enums */
25262306a36Sopenharmony_cienum OpalFreezeState {
25362306a36Sopenharmony_ci	OPAL_EEH_STOPPED_NOT_FROZEN = 0,
25462306a36Sopenharmony_ci	OPAL_EEH_STOPPED_MMIO_FREEZE = 1,
25562306a36Sopenharmony_ci	OPAL_EEH_STOPPED_DMA_FREEZE = 2,
25662306a36Sopenharmony_ci	OPAL_EEH_STOPPED_MMIO_DMA_FREEZE = 3,
25762306a36Sopenharmony_ci	OPAL_EEH_STOPPED_RESET = 4,
25862306a36Sopenharmony_ci	OPAL_EEH_STOPPED_TEMP_UNAVAIL = 5,
25962306a36Sopenharmony_ci	OPAL_EEH_STOPPED_PERM_UNAVAIL = 6
26062306a36Sopenharmony_ci};
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_cienum OpalEehFreezeActionToken {
26362306a36Sopenharmony_ci	OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO = 1,
26462306a36Sopenharmony_ci	OPAL_EEH_ACTION_CLEAR_FREEZE_DMA = 2,
26562306a36Sopenharmony_ci	OPAL_EEH_ACTION_CLEAR_FREEZE_ALL = 3,
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci	OPAL_EEH_ACTION_SET_FREEZE_MMIO = 1,
26862306a36Sopenharmony_ci	OPAL_EEH_ACTION_SET_FREEZE_DMA  = 2,
26962306a36Sopenharmony_ci	OPAL_EEH_ACTION_SET_FREEZE_ALL  = 3
27062306a36Sopenharmony_ci};
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_cienum OpalPciStatusToken {
27362306a36Sopenharmony_ci	OPAL_EEH_NO_ERROR	= 0,
27462306a36Sopenharmony_ci	OPAL_EEH_IOC_ERROR	= 1,
27562306a36Sopenharmony_ci	OPAL_EEH_PHB_ERROR	= 2,
27662306a36Sopenharmony_ci	OPAL_EEH_PE_ERROR	= 3,
27762306a36Sopenharmony_ci	OPAL_EEH_PE_MMIO_ERROR	= 4,
27862306a36Sopenharmony_ci	OPAL_EEH_PE_DMA_ERROR	= 5
27962306a36Sopenharmony_ci};
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_cienum OpalPciErrorSeverity {
28262306a36Sopenharmony_ci	OPAL_EEH_SEV_NO_ERROR	= 0,
28362306a36Sopenharmony_ci	OPAL_EEH_SEV_IOC_DEAD	= 1,
28462306a36Sopenharmony_ci	OPAL_EEH_SEV_PHB_DEAD	= 2,
28562306a36Sopenharmony_ci	OPAL_EEH_SEV_PHB_FENCED	= 3,
28662306a36Sopenharmony_ci	OPAL_EEH_SEV_PE_ER	= 4,
28762306a36Sopenharmony_ci	OPAL_EEH_SEV_INF	= 5
28862306a36Sopenharmony_ci};
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_cienum OpalErrinjectType {
29162306a36Sopenharmony_ci	OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR	= 0,
29262306a36Sopenharmony_ci	OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64	= 1,
29362306a36Sopenharmony_ci};
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_cienum OpalErrinjectFunc {
29662306a36Sopenharmony_ci	/* IOA bus specific errors */
29762306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_LD_MEM_ADDR	= 0,
29862306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_LD_MEM_DATA	= 1,
29962306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_LD_IO_ADDR	= 2,
30062306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_LD_IO_DATA	= 3,
30162306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_LD_CFG_ADDR	= 4,
30262306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_LD_CFG_DATA	= 5,
30362306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_ST_MEM_ADDR	= 6,
30462306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_ST_MEM_DATA	= 7,
30562306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_ST_IO_ADDR	= 8,
30662306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_ST_IO_DATA	= 9,
30762306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_ST_CFG_ADDR	= 10,
30862306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_ST_CFG_DATA	= 11,
30962306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_DMA_RD_ADDR	= 12,
31062306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_DMA_RD_DATA	= 13,
31162306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_DMA_RD_MASTER	= 14,
31262306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_DMA_RD_TARGET	= 15,
31362306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_DMA_WR_ADDR	= 16,
31462306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_DMA_WR_DATA	= 17,
31562306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_DMA_WR_MASTER	= 18,
31662306a36Sopenharmony_ci	OPAL_ERR_INJECT_FUNC_IOA_DMA_WR_TARGET	= 19,
31762306a36Sopenharmony_ci};
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_cienum OpalMmioWindowType {
32062306a36Sopenharmony_ci	OPAL_M32_WINDOW_TYPE = 1,
32162306a36Sopenharmony_ci	OPAL_M64_WINDOW_TYPE = 2,
32262306a36Sopenharmony_ci	OPAL_IO_WINDOW_TYPE  = 3
32362306a36Sopenharmony_ci};
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_cienum OpalExceptionHandler {
32662306a36Sopenharmony_ci	OPAL_MACHINE_CHECK_HANDLER	    = 1,
32762306a36Sopenharmony_ci	OPAL_HYPERVISOR_MAINTENANCE_HANDLER = 2,
32862306a36Sopenharmony_ci	OPAL_SOFTPATCH_HANDLER		    = 3
32962306a36Sopenharmony_ci};
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_cienum OpalPendingState {
33262306a36Sopenharmony_ci	OPAL_EVENT_OPAL_INTERNAL   = 0x1,
33362306a36Sopenharmony_ci	OPAL_EVENT_NVRAM	   = 0x2,
33462306a36Sopenharmony_ci	OPAL_EVENT_RTC		   = 0x4,
33562306a36Sopenharmony_ci	OPAL_EVENT_CONSOLE_OUTPUT  = 0x8,
33662306a36Sopenharmony_ci	OPAL_EVENT_CONSOLE_INPUT   = 0x10,
33762306a36Sopenharmony_ci	OPAL_EVENT_ERROR_LOG_AVAIL = 0x20,
33862306a36Sopenharmony_ci	OPAL_EVENT_ERROR_LOG	   = 0x40,
33962306a36Sopenharmony_ci	OPAL_EVENT_EPOW		   = 0x80,
34062306a36Sopenharmony_ci	OPAL_EVENT_LED_STATUS	   = 0x100,
34162306a36Sopenharmony_ci	OPAL_EVENT_PCI_ERROR	   = 0x200,
34262306a36Sopenharmony_ci	OPAL_EVENT_DUMP_AVAIL	   = 0x400,
34362306a36Sopenharmony_ci	OPAL_EVENT_MSG_PENDING	   = 0x800,
34462306a36Sopenharmony_ci};
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_cienum OpalThreadStatus {
34762306a36Sopenharmony_ci	OPAL_THREAD_INACTIVE = 0x0,
34862306a36Sopenharmony_ci	OPAL_THREAD_STARTED = 0x1,
34962306a36Sopenharmony_ci	OPAL_THREAD_UNAVAILABLE = 0x2 /* opal-v3 */
35062306a36Sopenharmony_ci};
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_cienum OpalPciBusCompare {
35362306a36Sopenharmony_ci	OpalPciBusAny	= 0,	/* Any bus number match */
35462306a36Sopenharmony_ci	OpalPciBus3Bits	= 2,	/* Match top 3 bits of bus number */
35562306a36Sopenharmony_ci	OpalPciBus4Bits	= 3,	/* Match top 4 bits of bus number */
35662306a36Sopenharmony_ci	OpalPciBus5Bits	= 4,	/* Match top 5 bits of bus number */
35762306a36Sopenharmony_ci	OpalPciBus6Bits	= 5,	/* Match top 6 bits of bus number */
35862306a36Sopenharmony_ci	OpalPciBus7Bits	= 6,	/* Match top 7 bits of bus number */
35962306a36Sopenharmony_ci	OpalPciBusAll	= 7,	/* Match bus number exactly */
36062306a36Sopenharmony_ci};
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_cienum OpalDeviceCompare {
36362306a36Sopenharmony_ci	OPAL_IGNORE_RID_DEVICE_NUMBER = 0,
36462306a36Sopenharmony_ci	OPAL_COMPARE_RID_DEVICE_NUMBER = 1
36562306a36Sopenharmony_ci};
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_cienum OpalFuncCompare {
36862306a36Sopenharmony_ci	OPAL_IGNORE_RID_FUNCTION_NUMBER = 0,
36962306a36Sopenharmony_ci	OPAL_COMPARE_RID_FUNCTION_NUMBER = 1
37062306a36Sopenharmony_ci};
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_cienum OpalPeAction {
37362306a36Sopenharmony_ci	OPAL_UNMAP_PE = 0,
37462306a36Sopenharmony_ci	OPAL_MAP_PE = 1
37562306a36Sopenharmony_ci};
37662306a36Sopenharmony_ci
37762306a36Sopenharmony_cienum OpalPeltvAction {
37862306a36Sopenharmony_ci	OPAL_REMOVE_PE_FROM_DOMAIN = 0,
37962306a36Sopenharmony_ci	OPAL_ADD_PE_TO_DOMAIN = 1
38062306a36Sopenharmony_ci};
38162306a36Sopenharmony_ci
38262306a36Sopenharmony_cienum OpalMveEnableAction {
38362306a36Sopenharmony_ci	OPAL_DISABLE_MVE = 0,
38462306a36Sopenharmony_ci	OPAL_ENABLE_MVE = 1
38562306a36Sopenharmony_ci};
38662306a36Sopenharmony_ci
38762306a36Sopenharmony_cienum OpalM64Action {
38862306a36Sopenharmony_ci	OPAL_DISABLE_M64 = 0,
38962306a36Sopenharmony_ci	OPAL_ENABLE_M64_SPLIT = 1,
39062306a36Sopenharmony_ci	OPAL_ENABLE_M64_NON_SPLIT = 2
39162306a36Sopenharmony_ci};
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_cienum OpalPciResetScope {
39462306a36Sopenharmony_ci	OPAL_RESET_PHB_COMPLETE		= 1,
39562306a36Sopenharmony_ci	OPAL_RESET_PCI_LINK		= 2,
39662306a36Sopenharmony_ci	OPAL_RESET_PHB_ERROR		= 3,
39762306a36Sopenharmony_ci	OPAL_RESET_PCI_HOT		= 4,
39862306a36Sopenharmony_ci	OPAL_RESET_PCI_FUNDAMENTAL	= 5,
39962306a36Sopenharmony_ci	OPAL_RESET_PCI_IODA_TABLE	= 6
40062306a36Sopenharmony_ci};
40162306a36Sopenharmony_ci
40262306a36Sopenharmony_cienum OpalPciReinitScope {
40362306a36Sopenharmony_ci	/*
40462306a36Sopenharmony_ci	 * Note: we chose values that do not overlap
40562306a36Sopenharmony_ci	 * OpalPciResetScope as OPAL v2 used the same
40662306a36Sopenharmony_ci	 * enum for both
40762306a36Sopenharmony_ci	 */
40862306a36Sopenharmony_ci	OPAL_REINIT_PCI_DEV = 1000
40962306a36Sopenharmony_ci};
41062306a36Sopenharmony_ci
41162306a36Sopenharmony_cienum OpalPciResetState {
41262306a36Sopenharmony_ci	OPAL_DEASSERT_RESET = 0,
41362306a36Sopenharmony_ci	OPAL_ASSERT_RESET   = 1
41462306a36Sopenharmony_ci};
41562306a36Sopenharmony_ci
41662306a36Sopenharmony_cienum OpalPciSlotPresence {
41762306a36Sopenharmony_ci	OPAL_PCI_SLOT_EMPTY	= 0,
41862306a36Sopenharmony_ci	OPAL_PCI_SLOT_PRESENT	= 1
41962306a36Sopenharmony_ci};
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_cienum OpalPciSlotPower {
42262306a36Sopenharmony_ci	OPAL_PCI_SLOT_POWER_OFF	= 0,
42362306a36Sopenharmony_ci	OPAL_PCI_SLOT_POWER_ON	= 1,
42462306a36Sopenharmony_ci	OPAL_PCI_SLOT_OFFLINE	= 2,
42562306a36Sopenharmony_ci	OPAL_PCI_SLOT_ONLINE	= 3
42662306a36Sopenharmony_ci};
42762306a36Sopenharmony_ci
42862306a36Sopenharmony_cienum OpalSlotLedType {
42962306a36Sopenharmony_ci	OPAL_SLOT_LED_TYPE_ID = 0,	/* IDENTIFY LED */
43062306a36Sopenharmony_ci	OPAL_SLOT_LED_TYPE_FAULT = 1,	/* FAULT LED */
43162306a36Sopenharmony_ci	OPAL_SLOT_LED_TYPE_ATTN = 2,	/* System Attention LED */
43262306a36Sopenharmony_ci	OPAL_SLOT_LED_TYPE_MAX = 3
43362306a36Sopenharmony_ci};
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_cienum OpalSlotLedState {
43662306a36Sopenharmony_ci	OPAL_SLOT_LED_STATE_OFF = 0,	/* LED is OFF */
43762306a36Sopenharmony_ci	OPAL_SLOT_LED_STATE_ON = 1	/* LED is ON */
43862306a36Sopenharmony_ci};
43962306a36Sopenharmony_ci
44062306a36Sopenharmony_ci/*
44162306a36Sopenharmony_ci * Address cycle types for LPC accesses. These also correspond
44262306a36Sopenharmony_ci * to the content of the first cell of the "reg" property for
44362306a36Sopenharmony_ci * device nodes on the LPC bus
44462306a36Sopenharmony_ci */
44562306a36Sopenharmony_cienum OpalLPCAddressType {
44662306a36Sopenharmony_ci	OPAL_LPC_MEM	= 0,
44762306a36Sopenharmony_ci	OPAL_LPC_IO	= 1,
44862306a36Sopenharmony_ci	OPAL_LPC_FW	= 2,
44962306a36Sopenharmony_ci};
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_cienum opal_msg_type {
45262306a36Sopenharmony_ci	OPAL_MSG_ASYNC_COMP	= 0,	/* params[0] = token, params[1] = rc,
45362306a36Sopenharmony_ci					 * additional params function-specific
45462306a36Sopenharmony_ci					 */
45562306a36Sopenharmony_ci	OPAL_MSG_MEM_ERR	= 1,
45662306a36Sopenharmony_ci	OPAL_MSG_EPOW		= 2,
45762306a36Sopenharmony_ci	OPAL_MSG_SHUTDOWN	= 3,	/* params[0] = 1 reboot, 0 shutdown */
45862306a36Sopenharmony_ci	OPAL_MSG_HMI_EVT	= 4,
45962306a36Sopenharmony_ci	OPAL_MSG_DPO		= 5,
46062306a36Sopenharmony_ci	OPAL_MSG_PRD		= 6,
46162306a36Sopenharmony_ci	OPAL_MSG_OCC		= 7,
46262306a36Sopenharmony_ci	OPAL_MSG_PRD2		= 8,
46362306a36Sopenharmony_ci	OPAL_MSG_TYPE_MAX,
46462306a36Sopenharmony_ci};
46562306a36Sopenharmony_ci
46662306a36Sopenharmony_cistruct opal_msg {
46762306a36Sopenharmony_ci	__be32 msg_type;
46862306a36Sopenharmony_ci	__be32 reserved;
46962306a36Sopenharmony_ci	__be64 params[8];
47062306a36Sopenharmony_ci};
47162306a36Sopenharmony_ci
47262306a36Sopenharmony_ci/* System parameter permission */
47362306a36Sopenharmony_cienum OpalSysparamPerm {
47462306a36Sopenharmony_ci	OPAL_SYSPARAM_READ  = 0x1,
47562306a36Sopenharmony_ci	OPAL_SYSPARAM_WRITE = 0x2,
47662306a36Sopenharmony_ci	OPAL_SYSPARAM_RW    = (OPAL_SYSPARAM_READ | OPAL_SYSPARAM_WRITE),
47762306a36Sopenharmony_ci};
47862306a36Sopenharmony_ci
47962306a36Sopenharmony_cienum {
48062306a36Sopenharmony_ci	OPAL_IPMI_MSG_FORMAT_VERSION_1 = 1,
48162306a36Sopenharmony_ci};
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_cistruct opal_ipmi_msg {
48462306a36Sopenharmony_ci	uint8_t version;
48562306a36Sopenharmony_ci	uint8_t netfn;
48662306a36Sopenharmony_ci	uint8_t cmd;
48762306a36Sopenharmony_ci	uint8_t data[];
48862306a36Sopenharmony_ci};
48962306a36Sopenharmony_ci
49062306a36Sopenharmony_ci/* FSP memory errors handling */
49162306a36Sopenharmony_cienum OpalMemErr_Version {
49262306a36Sopenharmony_ci	OpalMemErr_V1 = 1,
49362306a36Sopenharmony_ci};
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_cienum OpalMemErrType {
49662306a36Sopenharmony_ci	OPAL_MEM_ERR_TYPE_RESILIENCE	= 0,
49762306a36Sopenharmony_ci	OPAL_MEM_ERR_TYPE_DYN_DALLOC,
49862306a36Sopenharmony_ci};
49962306a36Sopenharmony_ci
50062306a36Sopenharmony_ci/* Memory Reilience error type */
50162306a36Sopenharmony_cienum OpalMemErr_ResilErrType {
50262306a36Sopenharmony_ci	OPAL_MEM_RESILIENCE_CE		= 0,
50362306a36Sopenharmony_ci	OPAL_MEM_RESILIENCE_UE,
50462306a36Sopenharmony_ci	OPAL_MEM_RESILIENCE_UE_SCRUB,
50562306a36Sopenharmony_ci};
50662306a36Sopenharmony_ci
50762306a36Sopenharmony_ci/* Dynamic Memory Deallocation type */
50862306a36Sopenharmony_cienum OpalMemErr_DynErrType {
50962306a36Sopenharmony_ci	OPAL_MEM_DYNAMIC_DEALLOC	= 0,
51062306a36Sopenharmony_ci};
51162306a36Sopenharmony_ci
51262306a36Sopenharmony_cistruct OpalMemoryErrorData {
51362306a36Sopenharmony_ci	enum OpalMemErr_Version	version:8;	/* 0x00 */
51462306a36Sopenharmony_ci	enum OpalMemErrType	type:8;		/* 0x01 */
51562306a36Sopenharmony_ci	__be16			flags;		/* 0x02 */
51662306a36Sopenharmony_ci	uint8_t			reserved_1[4];	/* 0x04 */
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_ci	union {
51962306a36Sopenharmony_ci		/* Memory Resilience corrected/uncorrected error info */
52062306a36Sopenharmony_ci		struct {
52162306a36Sopenharmony_ci			enum OpalMemErr_ResilErrType	resil_err_type:8;
52262306a36Sopenharmony_ci			uint8_t				reserved_1[7];
52362306a36Sopenharmony_ci			__be64				physical_address_start;
52462306a36Sopenharmony_ci			__be64				physical_address_end;
52562306a36Sopenharmony_ci		} resilience;
52662306a36Sopenharmony_ci		/* Dynamic memory deallocation error info */
52762306a36Sopenharmony_ci		struct {
52862306a36Sopenharmony_ci			enum OpalMemErr_DynErrType	dyn_err_type:8;
52962306a36Sopenharmony_ci			uint8_t				reserved_1[7];
53062306a36Sopenharmony_ci			__be64				physical_address_start;
53162306a36Sopenharmony_ci			__be64				physical_address_end;
53262306a36Sopenharmony_ci		} dyn_dealloc;
53362306a36Sopenharmony_ci	} u;
53462306a36Sopenharmony_ci};
53562306a36Sopenharmony_ci
53662306a36Sopenharmony_ci/* HMI interrupt event */
53762306a36Sopenharmony_cienum OpalHMI_Version {
53862306a36Sopenharmony_ci	OpalHMIEvt_V1 = 1,
53962306a36Sopenharmony_ci	OpalHMIEvt_V2 = 2,
54062306a36Sopenharmony_ci};
54162306a36Sopenharmony_ci
54262306a36Sopenharmony_cienum OpalHMI_Severity {
54362306a36Sopenharmony_ci	OpalHMI_SEV_NO_ERROR = 0,
54462306a36Sopenharmony_ci	OpalHMI_SEV_WARNING = 1,
54562306a36Sopenharmony_ci	OpalHMI_SEV_ERROR_SYNC = 2,
54662306a36Sopenharmony_ci	OpalHMI_SEV_FATAL = 3,
54762306a36Sopenharmony_ci};
54862306a36Sopenharmony_ci
54962306a36Sopenharmony_cienum OpalHMI_Disposition {
55062306a36Sopenharmony_ci	OpalHMI_DISPOSITION_RECOVERED = 0,
55162306a36Sopenharmony_ci	OpalHMI_DISPOSITION_NOT_RECOVERED = 1,
55262306a36Sopenharmony_ci};
55362306a36Sopenharmony_ci
55462306a36Sopenharmony_cienum OpalHMI_ErrType {
55562306a36Sopenharmony_ci	OpalHMI_ERROR_MALFUNC_ALERT	= 0,
55662306a36Sopenharmony_ci	OpalHMI_ERROR_PROC_RECOV_DONE,
55762306a36Sopenharmony_ci	OpalHMI_ERROR_PROC_RECOV_DONE_AGAIN,
55862306a36Sopenharmony_ci	OpalHMI_ERROR_PROC_RECOV_MASKED,
55962306a36Sopenharmony_ci	OpalHMI_ERROR_TFAC,
56062306a36Sopenharmony_ci	OpalHMI_ERROR_TFMR_PARITY,
56162306a36Sopenharmony_ci	OpalHMI_ERROR_HA_OVERFLOW_WARN,
56262306a36Sopenharmony_ci	OpalHMI_ERROR_XSCOM_FAIL,
56362306a36Sopenharmony_ci	OpalHMI_ERROR_XSCOM_DONE,
56462306a36Sopenharmony_ci	OpalHMI_ERROR_SCOM_FIR,
56562306a36Sopenharmony_ci	OpalHMI_ERROR_DEBUG_TRIG_FIR,
56662306a36Sopenharmony_ci	OpalHMI_ERROR_HYP_RESOURCE,
56762306a36Sopenharmony_ci	OpalHMI_ERROR_CAPP_RECOVERY,
56862306a36Sopenharmony_ci};
56962306a36Sopenharmony_ci
57062306a36Sopenharmony_cienum OpalHMI_XstopType {
57162306a36Sopenharmony_ci	CHECKSTOP_TYPE_UNKNOWN	=	0,
57262306a36Sopenharmony_ci	CHECKSTOP_TYPE_CORE	=	1,
57362306a36Sopenharmony_ci	CHECKSTOP_TYPE_NX	=	2,
57462306a36Sopenharmony_ci	CHECKSTOP_TYPE_NPU	=	3
57562306a36Sopenharmony_ci};
57662306a36Sopenharmony_ci
57762306a36Sopenharmony_cienum OpalHMI_CoreXstopReason {
57862306a36Sopenharmony_ci	CORE_CHECKSTOP_IFU_REGFILE		= 0x00000001,
57962306a36Sopenharmony_ci	CORE_CHECKSTOP_IFU_LOGIC		= 0x00000002,
58062306a36Sopenharmony_ci	CORE_CHECKSTOP_PC_DURING_RECOV		= 0x00000004,
58162306a36Sopenharmony_ci	CORE_CHECKSTOP_ISU_REGFILE		= 0x00000008,
58262306a36Sopenharmony_ci	CORE_CHECKSTOP_ISU_LOGIC		= 0x00000010,
58362306a36Sopenharmony_ci	CORE_CHECKSTOP_FXU_LOGIC		= 0x00000020,
58462306a36Sopenharmony_ci	CORE_CHECKSTOP_VSU_LOGIC		= 0x00000040,
58562306a36Sopenharmony_ci	CORE_CHECKSTOP_PC_RECOV_IN_MAINT_MODE	= 0x00000080,
58662306a36Sopenharmony_ci	CORE_CHECKSTOP_LSU_REGFILE		= 0x00000100,
58762306a36Sopenharmony_ci	CORE_CHECKSTOP_PC_FWD_PROGRESS		= 0x00000200,
58862306a36Sopenharmony_ci	CORE_CHECKSTOP_LSU_LOGIC		= 0x00000400,
58962306a36Sopenharmony_ci	CORE_CHECKSTOP_PC_LOGIC			= 0x00000800,
59062306a36Sopenharmony_ci	CORE_CHECKSTOP_PC_HYP_RESOURCE		= 0x00001000,
59162306a36Sopenharmony_ci	CORE_CHECKSTOP_PC_HANG_RECOV_FAILED	= 0x00002000,
59262306a36Sopenharmony_ci	CORE_CHECKSTOP_PC_AMBI_HANG_DETECTED	= 0x00004000,
59362306a36Sopenharmony_ci	CORE_CHECKSTOP_PC_DEBUG_TRIG_ERR_INJ	= 0x00008000,
59462306a36Sopenharmony_ci	CORE_CHECKSTOP_PC_SPRD_HYP_ERR_INJ	= 0x00010000,
59562306a36Sopenharmony_ci};
59662306a36Sopenharmony_ci
59762306a36Sopenharmony_cienum OpalHMI_NestAccelXstopReason {
59862306a36Sopenharmony_ci	NX_CHECKSTOP_SHM_INVAL_STATE_ERR	= 0x00000001,
59962306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_INVAL_STATE_ERR_1	= 0x00000002,
60062306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_INVAL_STATE_ERR_2	= 0x00000004,
60162306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_CH0_INVAL_STATE_ERR	= 0x00000008,
60262306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_CH1_INVAL_STATE_ERR	= 0x00000010,
60362306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_CH2_INVAL_STATE_ERR	= 0x00000020,
60462306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_CH3_INVAL_STATE_ERR	= 0x00000040,
60562306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_CH4_INVAL_STATE_ERR	= 0x00000080,
60662306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_CH5_INVAL_STATE_ERR	= 0x00000100,
60762306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_CH6_INVAL_STATE_ERR	= 0x00000200,
60862306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_CH7_INVAL_STATE_ERR	= 0x00000400,
60962306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_CRB_UE			= 0x00000800,
61062306a36Sopenharmony_ci	NX_CHECKSTOP_DMA_CRB_SUE		= 0x00001000,
61162306a36Sopenharmony_ci	NX_CHECKSTOP_PBI_ISN_UE			= 0x00002000,
61262306a36Sopenharmony_ci};
61362306a36Sopenharmony_ci
61462306a36Sopenharmony_cistruct OpalHMIEvent {
61562306a36Sopenharmony_ci	uint8_t		version;	/* 0x00 */
61662306a36Sopenharmony_ci	uint8_t		severity;	/* 0x01 */
61762306a36Sopenharmony_ci	uint8_t		type;		/* 0x02 */
61862306a36Sopenharmony_ci	uint8_t		disposition;	/* 0x03 */
61962306a36Sopenharmony_ci	uint8_t		reserved_1[4];	/* 0x04 */
62062306a36Sopenharmony_ci
62162306a36Sopenharmony_ci	__be64		hmer;
62262306a36Sopenharmony_ci	/* TFMR register. Valid only for TFAC and TFMR_PARITY error type. */
62362306a36Sopenharmony_ci	__be64		tfmr;
62462306a36Sopenharmony_ci
62562306a36Sopenharmony_ci	/* version 2 and later */
62662306a36Sopenharmony_ci	union {
62762306a36Sopenharmony_ci		/*
62862306a36Sopenharmony_ci		 * checkstop info (Core/NX).
62962306a36Sopenharmony_ci		 * Valid for OpalHMI_ERROR_MALFUNC_ALERT.
63062306a36Sopenharmony_ci		 */
63162306a36Sopenharmony_ci		struct {
63262306a36Sopenharmony_ci			uint8_t	xstop_type;	/* enum OpalHMI_XstopType */
63362306a36Sopenharmony_ci			uint8_t reserved_1[3];
63462306a36Sopenharmony_ci			__be32  xstop_reason;
63562306a36Sopenharmony_ci			union {
63662306a36Sopenharmony_ci				__be32 pir;	/* for CHECKSTOP_TYPE_CORE */
63762306a36Sopenharmony_ci				__be32 chip_id;	/* for CHECKSTOP_TYPE_NX */
63862306a36Sopenharmony_ci			} u;
63962306a36Sopenharmony_ci		} xstop_error;
64062306a36Sopenharmony_ci	} u;
64162306a36Sopenharmony_ci};
64262306a36Sopenharmony_ci
64362306a36Sopenharmony_ci/* OPAL_HANDLE_HMI2 out_flags */
64462306a36Sopenharmony_cienum {
64562306a36Sopenharmony_ci	OPAL_HMI_FLAGS_TB_RESYNC	= (1ull << 0), /* Timebase has been resynced */
64662306a36Sopenharmony_ci	OPAL_HMI_FLAGS_DEC_LOST		= (1ull << 1), /* DEC lost, needs to be reprogrammed */
64762306a36Sopenharmony_ci	OPAL_HMI_FLAGS_HDEC_LOST	= (1ull << 2), /* HDEC lost, needs to be reprogrammed */
64862306a36Sopenharmony_ci	OPAL_HMI_FLAGS_TOD_TB_FAIL	= (1ull << 3), /* TOD/TB recovery failed. */
64962306a36Sopenharmony_ci	OPAL_HMI_FLAGS_NEW_EVENT	= (1ull << 63), /* An event has been created */
65062306a36Sopenharmony_ci};
65162306a36Sopenharmony_ci
65262306a36Sopenharmony_cienum {
65362306a36Sopenharmony_ci	OPAL_P7IOC_DIAG_TYPE_NONE	= 0,
65462306a36Sopenharmony_ci	OPAL_P7IOC_DIAG_TYPE_RGC	= 1,
65562306a36Sopenharmony_ci	OPAL_P7IOC_DIAG_TYPE_BI		= 2,
65662306a36Sopenharmony_ci	OPAL_P7IOC_DIAG_TYPE_CI		= 3,
65762306a36Sopenharmony_ci	OPAL_P7IOC_DIAG_TYPE_MISC	= 4,
65862306a36Sopenharmony_ci	OPAL_P7IOC_DIAG_TYPE_I2C	= 5,
65962306a36Sopenharmony_ci	OPAL_P7IOC_DIAG_TYPE_LAST	= 6
66062306a36Sopenharmony_ci};
66162306a36Sopenharmony_ci
66262306a36Sopenharmony_cistruct OpalIoP7IOCErrorData {
66362306a36Sopenharmony_ci	__be16 type;
66462306a36Sopenharmony_ci
66562306a36Sopenharmony_ci	/* GEM */
66662306a36Sopenharmony_ci	__be64 gemXfir;
66762306a36Sopenharmony_ci	__be64 gemRfir;
66862306a36Sopenharmony_ci	__be64 gemRirqfir;
66962306a36Sopenharmony_ci	__be64 gemMask;
67062306a36Sopenharmony_ci	__be64 gemRwof;
67162306a36Sopenharmony_ci
67262306a36Sopenharmony_ci	/* LEM */
67362306a36Sopenharmony_ci	__be64 lemFir;
67462306a36Sopenharmony_ci	__be64 lemErrMask;
67562306a36Sopenharmony_ci	__be64 lemAction0;
67662306a36Sopenharmony_ci	__be64 lemAction1;
67762306a36Sopenharmony_ci	__be64 lemWof;
67862306a36Sopenharmony_ci
67962306a36Sopenharmony_ci	union {
68062306a36Sopenharmony_ci		struct OpalIoP7IOCRgcErrorData {
68162306a36Sopenharmony_ci			__be64 rgcStatus;	/* 3E1C10 */
68262306a36Sopenharmony_ci			__be64 rgcLdcp;		/* 3E1C18 */
68362306a36Sopenharmony_ci		}rgc;
68462306a36Sopenharmony_ci		struct OpalIoP7IOCBiErrorData {
68562306a36Sopenharmony_ci			__be64 biLdcp0;		/* 3C0100, 3C0118 */
68662306a36Sopenharmony_ci			__be64 biLdcp1;		/* 3C0108, 3C0120 */
68762306a36Sopenharmony_ci			__be64 biLdcp2;		/* 3C0110, 3C0128 */
68862306a36Sopenharmony_ci			__be64 biFenceStatus;	/* 3C0130, 3C0130 */
68962306a36Sopenharmony_ci
69062306a36Sopenharmony_ci			uint8_t biDownbound;	/* BI Downbound or Upbound */
69162306a36Sopenharmony_ci		}bi;
69262306a36Sopenharmony_ci		struct OpalIoP7IOCCiErrorData {
69362306a36Sopenharmony_ci			__be64 ciPortStatus;	/* 3Dn008 */
69462306a36Sopenharmony_ci			__be64 ciPortLdcp;	/* 3Dn010 */
69562306a36Sopenharmony_ci
69662306a36Sopenharmony_ci			uint8_t ciPort;		/* Index of CI port: 0/1 */
69762306a36Sopenharmony_ci		}ci;
69862306a36Sopenharmony_ci	};
69962306a36Sopenharmony_ci};
70062306a36Sopenharmony_ci
70162306a36Sopenharmony_ci/**
70262306a36Sopenharmony_ci * This structure defines the overlay which will be used to store PHB error
70362306a36Sopenharmony_ci * data upon request.
70462306a36Sopenharmony_ci */
70562306a36Sopenharmony_cienum {
70662306a36Sopenharmony_ci	OPAL_PHB_ERROR_DATA_VERSION_1 = 1,
70762306a36Sopenharmony_ci};
70862306a36Sopenharmony_ci
70962306a36Sopenharmony_cienum {
71062306a36Sopenharmony_ci	OPAL_PHB_ERROR_DATA_TYPE_P7IOC = 1,
71162306a36Sopenharmony_ci	OPAL_PHB_ERROR_DATA_TYPE_PHB3 = 2,
71262306a36Sopenharmony_ci	OPAL_PHB_ERROR_DATA_TYPE_PHB4 = 3
71362306a36Sopenharmony_ci};
71462306a36Sopenharmony_ci
71562306a36Sopenharmony_cienum {
71662306a36Sopenharmony_ci	OPAL_P7IOC_NUM_PEST_REGS = 128,
71762306a36Sopenharmony_ci	OPAL_PHB3_NUM_PEST_REGS = 256,
71862306a36Sopenharmony_ci	OPAL_PHB4_NUM_PEST_REGS = 512
71962306a36Sopenharmony_ci};
72062306a36Sopenharmony_ci
72162306a36Sopenharmony_cistruct OpalIoPhbErrorCommon {
72262306a36Sopenharmony_ci	__be32 version;
72362306a36Sopenharmony_ci	__be32 ioType;
72462306a36Sopenharmony_ci	__be32 len;
72562306a36Sopenharmony_ci};
72662306a36Sopenharmony_ci
72762306a36Sopenharmony_cistruct OpalIoP7IOCPhbErrorData {
72862306a36Sopenharmony_ci	struct OpalIoPhbErrorCommon common;
72962306a36Sopenharmony_ci
73062306a36Sopenharmony_ci	__be32 brdgCtl;
73162306a36Sopenharmony_ci
73262306a36Sopenharmony_ci	// P7IOC utl regs
73362306a36Sopenharmony_ci	__be32 portStatusReg;
73462306a36Sopenharmony_ci	__be32 rootCmplxStatus;
73562306a36Sopenharmony_ci	__be32 busAgentStatus;
73662306a36Sopenharmony_ci
73762306a36Sopenharmony_ci	// P7IOC cfg regs
73862306a36Sopenharmony_ci	__be32 deviceStatus;
73962306a36Sopenharmony_ci	__be32 slotStatus;
74062306a36Sopenharmony_ci	__be32 linkStatus;
74162306a36Sopenharmony_ci	__be32 devCmdStatus;
74262306a36Sopenharmony_ci	__be32 devSecStatus;
74362306a36Sopenharmony_ci
74462306a36Sopenharmony_ci	// cfg AER regs
74562306a36Sopenharmony_ci	__be32 rootErrorStatus;
74662306a36Sopenharmony_ci	__be32 uncorrErrorStatus;
74762306a36Sopenharmony_ci	__be32 corrErrorStatus;
74862306a36Sopenharmony_ci	__be32 tlpHdr1;
74962306a36Sopenharmony_ci	__be32 tlpHdr2;
75062306a36Sopenharmony_ci	__be32 tlpHdr3;
75162306a36Sopenharmony_ci	__be32 tlpHdr4;
75262306a36Sopenharmony_ci	__be32 sourceId;
75362306a36Sopenharmony_ci
75462306a36Sopenharmony_ci	__be32 rsv3;
75562306a36Sopenharmony_ci
75662306a36Sopenharmony_ci	// Record data about the call to allocate a buffer.
75762306a36Sopenharmony_ci	__be64 errorClass;
75862306a36Sopenharmony_ci	__be64 correlator;
75962306a36Sopenharmony_ci
76062306a36Sopenharmony_ci	//P7IOC MMIO Error Regs
76162306a36Sopenharmony_ci	__be64 p7iocPlssr;                // n120
76262306a36Sopenharmony_ci	__be64 p7iocCsr;                  // n110
76362306a36Sopenharmony_ci	__be64 lemFir;                    // nC00
76462306a36Sopenharmony_ci	__be64 lemErrorMask;              // nC18
76562306a36Sopenharmony_ci	__be64 lemWOF;                    // nC40
76662306a36Sopenharmony_ci	__be64 phbErrorStatus;            // nC80
76762306a36Sopenharmony_ci	__be64 phbFirstErrorStatus;       // nC88
76862306a36Sopenharmony_ci	__be64 phbErrorLog0;              // nCC0
76962306a36Sopenharmony_ci	__be64 phbErrorLog1;              // nCC8
77062306a36Sopenharmony_ci	__be64 mmioErrorStatus;           // nD00
77162306a36Sopenharmony_ci	__be64 mmioFirstErrorStatus;      // nD08
77262306a36Sopenharmony_ci	__be64 mmioErrorLog0;             // nD40
77362306a36Sopenharmony_ci	__be64 mmioErrorLog1;             // nD48
77462306a36Sopenharmony_ci	__be64 dma0ErrorStatus;           // nD80
77562306a36Sopenharmony_ci	__be64 dma0FirstErrorStatus;      // nD88
77662306a36Sopenharmony_ci	__be64 dma0ErrorLog0;             // nDC0
77762306a36Sopenharmony_ci	__be64 dma0ErrorLog1;             // nDC8
77862306a36Sopenharmony_ci	__be64 dma1ErrorStatus;           // nE00
77962306a36Sopenharmony_ci	__be64 dma1FirstErrorStatus;      // nE08
78062306a36Sopenharmony_ci	__be64 dma1ErrorLog0;             // nE40
78162306a36Sopenharmony_ci	__be64 dma1ErrorLog1;             // nE48
78262306a36Sopenharmony_ci	__be64 pestA[OPAL_P7IOC_NUM_PEST_REGS];
78362306a36Sopenharmony_ci	__be64 pestB[OPAL_P7IOC_NUM_PEST_REGS];
78462306a36Sopenharmony_ci};
78562306a36Sopenharmony_ci
78662306a36Sopenharmony_cistruct OpalIoPhb3ErrorData {
78762306a36Sopenharmony_ci	struct OpalIoPhbErrorCommon common;
78862306a36Sopenharmony_ci
78962306a36Sopenharmony_ci	__be32 brdgCtl;
79062306a36Sopenharmony_ci
79162306a36Sopenharmony_ci	/* PHB3 UTL regs */
79262306a36Sopenharmony_ci	__be32 portStatusReg;
79362306a36Sopenharmony_ci	__be32 rootCmplxStatus;
79462306a36Sopenharmony_ci	__be32 busAgentStatus;
79562306a36Sopenharmony_ci
79662306a36Sopenharmony_ci	/* PHB3 cfg regs */
79762306a36Sopenharmony_ci	__be32 deviceStatus;
79862306a36Sopenharmony_ci	__be32 slotStatus;
79962306a36Sopenharmony_ci	__be32 linkStatus;
80062306a36Sopenharmony_ci	__be32 devCmdStatus;
80162306a36Sopenharmony_ci	__be32 devSecStatus;
80262306a36Sopenharmony_ci
80362306a36Sopenharmony_ci	/* cfg AER regs */
80462306a36Sopenharmony_ci	__be32 rootErrorStatus;
80562306a36Sopenharmony_ci	__be32 uncorrErrorStatus;
80662306a36Sopenharmony_ci	__be32 corrErrorStatus;
80762306a36Sopenharmony_ci	__be32 tlpHdr1;
80862306a36Sopenharmony_ci	__be32 tlpHdr2;
80962306a36Sopenharmony_ci	__be32 tlpHdr3;
81062306a36Sopenharmony_ci	__be32 tlpHdr4;
81162306a36Sopenharmony_ci	__be32 sourceId;
81262306a36Sopenharmony_ci
81362306a36Sopenharmony_ci	__be32 rsv3;
81462306a36Sopenharmony_ci
81562306a36Sopenharmony_ci	/* Record data about the call to allocate a buffer */
81662306a36Sopenharmony_ci	__be64 errorClass;
81762306a36Sopenharmony_ci	__be64 correlator;
81862306a36Sopenharmony_ci
81962306a36Sopenharmony_ci	/* PHB3 MMIO Error Regs */
82062306a36Sopenharmony_ci	__be64 nFir;			/* 000 */
82162306a36Sopenharmony_ci	__be64 nFirMask;		/* 003 */
82262306a36Sopenharmony_ci	__be64 nFirWOF;		/* 008 */
82362306a36Sopenharmony_ci	__be64 phbPlssr;		/* 120 */
82462306a36Sopenharmony_ci	__be64 phbCsr;		/* 110 */
82562306a36Sopenharmony_ci	__be64 lemFir;		/* C00 */
82662306a36Sopenharmony_ci	__be64 lemErrorMask;		/* C18 */
82762306a36Sopenharmony_ci	__be64 lemWOF;		/* C40 */
82862306a36Sopenharmony_ci	__be64 phbErrorStatus;	/* C80 */
82962306a36Sopenharmony_ci	__be64 phbFirstErrorStatus;	/* C88 */
83062306a36Sopenharmony_ci	__be64 phbErrorLog0;		/* CC0 */
83162306a36Sopenharmony_ci	__be64 phbErrorLog1;		/* CC8 */
83262306a36Sopenharmony_ci	__be64 mmioErrorStatus;	/* D00 */
83362306a36Sopenharmony_ci	__be64 mmioFirstErrorStatus;	/* D08 */
83462306a36Sopenharmony_ci	__be64 mmioErrorLog0;		/* D40 */
83562306a36Sopenharmony_ci	__be64 mmioErrorLog1;		/* D48 */
83662306a36Sopenharmony_ci	__be64 dma0ErrorStatus;	/* D80 */
83762306a36Sopenharmony_ci	__be64 dma0FirstErrorStatus;	/* D88 */
83862306a36Sopenharmony_ci	__be64 dma0ErrorLog0;		/* DC0 */
83962306a36Sopenharmony_ci	__be64 dma0ErrorLog1;		/* DC8 */
84062306a36Sopenharmony_ci	__be64 dma1ErrorStatus;	/* E00 */
84162306a36Sopenharmony_ci	__be64 dma1FirstErrorStatus;	/* E08 */
84262306a36Sopenharmony_ci	__be64 dma1ErrorLog0;		/* E40 */
84362306a36Sopenharmony_ci	__be64 dma1ErrorLog1;		/* E48 */
84462306a36Sopenharmony_ci	__be64 pestA[OPAL_PHB3_NUM_PEST_REGS];
84562306a36Sopenharmony_ci	__be64 pestB[OPAL_PHB3_NUM_PEST_REGS];
84662306a36Sopenharmony_ci};
84762306a36Sopenharmony_ci
84862306a36Sopenharmony_cistruct OpalIoPhb4ErrorData {
84962306a36Sopenharmony_ci	struct OpalIoPhbErrorCommon common;
85062306a36Sopenharmony_ci
85162306a36Sopenharmony_ci	__be32 brdgCtl;
85262306a36Sopenharmony_ci
85362306a36Sopenharmony_ci	/* PHB4 cfg regs */
85462306a36Sopenharmony_ci	__be32 deviceStatus;
85562306a36Sopenharmony_ci	__be32 slotStatus;
85662306a36Sopenharmony_ci	__be32 linkStatus;
85762306a36Sopenharmony_ci	__be32 devCmdStatus;
85862306a36Sopenharmony_ci	__be32 devSecStatus;
85962306a36Sopenharmony_ci
86062306a36Sopenharmony_ci	/* cfg AER regs */
86162306a36Sopenharmony_ci	__be32 rootErrorStatus;
86262306a36Sopenharmony_ci	__be32 uncorrErrorStatus;
86362306a36Sopenharmony_ci	__be32 corrErrorStatus;
86462306a36Sopenharmony_ci	__be32 tlpHdr1;
86562306a36Sopenharmony_ci	__be32 tlpHdr2;
86662306a36Sopenharmony_ci	__be32 tlpHdr3;
86762306a36Sopenharmony_ci	__be32 tlpHdr4;
86862306a36Sopenharmony_ci	__be32 sourceId;
86962306a36Sopenharmony_ci
87062306a36Sopenharmony_ci	/* PHB4 ETU Error Regs */
87162306a36Sopenharmony_ci	__be64 nFir;				/* 000 */
87262306a36Sopenharmony_ci	__be64 nFirMask;			/* 003 */
87362306a36Sopenharmony_ci	__be64 nFirWOF;				/* 008 */
87462306a36Sopenharmony_ci	__be64 phbPlssr;			/* 120 */
87562306a36Sopenharmony_ci	__be64 phbCsr;				/* 110 */
87662306a36Sopenharmony_ci	__be64 lemFir;				/* C00 */
87762306a36Sopenharmony_ci	__be64 lemErrorMask;			/* C18 */
87862306a36Sopenharmony_ci	__be64 lemWOF;				/* C40 */
87962306a36Sopenharmony_ci	__be64 phbErrorStatus;			/* C80 */
88062306a36Sopenharmony_ci	__be64 phbFirstErrorStatus;		/* C88 */
88162306a36Sopenharmony_ci	__be64 phbErrorLog0;			/* CC0 */
88262306a36Sopenharmony_ci	__be64 phbErrorLog1;			/* CC8 */
88362306a36Sopenharmony_ci	__be64 phbTxeErrorStatus;		/* D00 */
88462306a36Sopenharmony_ci	__be64 phbTxeFirstErrorStatus;		/* D08 */
88562306a36Sopenharmony_ci	__be64 phbTxeErrorLog0;			/* D40 */
88662306a36Sopenharmony_ci	__be64 phbTxeErrorLog1;			/* D48 */
88762306a36Sopenharmony_ci	__be64 phbRxeArbErrorStatus;		/* D80 */
88862306a36Sopenharmony_ci	__be64 phbRxeArbFirstErrorStatus;	/* D88 */
88962306a36Sopenharmony_ci	__be64 phbRxeArbErrorLog0;		/* DC0 */
89062306a36Sopenharmony_ci	__be64 phbRxeArbErrorLog1;		/* DC8 */
89162306a36Sopenharmony_ci	__be64 phbRxeMrgErrorStatus;		/* E00 */
89262306a36Sopenharmony_ci	__be64 phbRxeMrgFirstErrorStatus;	/* E08 */
89362306a36Sopenharmony_ci	__be64 phbRxeMrgErrorLog0;		/* E40 */
89462306a36Sopenharmony_ci	__be64 phbRxeMrgErrorLog1;		/* E48 */
89562306a36Sopenharmony_ci	__be64 phbRxeTceErrorStatus;		/* E80 */
89662306a36Sopenharmony_ci	__be64 phbRxeTceFirstErrorStatus;	/* E88 */
89762306a36Sopenharmony_ci	__be64 phbRxeTceErrorLog0;		/* EC0 */
89862306a36Sopenharmony_ci	__be64 phbRxeTceErrorLog1;		/* EC8 */
89962306a36Sopenharmony_ci
90062306a36Sopenharmony_ci	/* PHB4 REGB Error Regs */
90162306a36Sopenharmony_ci	__be64 phbPblErrorStatus;		/* 1900 */
90262306a36Sopenharmony_ci	__be64 phbPblFirstErrorStatus;		/* 1908 */
90362306a36Sopenharmony_ci	__be64 phbPblErrorLog0;			/* 1940 */
90462306a36Sopenharmony_ci	__be64 phbPblErrorLog1;			/* 1948 */
90562306a36Sopenharmony_ci	__be64 phbPcieDlpErrorLog1;		/* 1AA0 */
90662306a36Sopenharmony_ci	__be64 phbPcieDlpErrorLog2;		/* 1AA8 */
90762306a36Sopenharmony_ci	__be64 phbPcieDlpErrorStatus;		/* 1AB0 */
90862306a36Sopenharmony_ci	__be64 phbRegbErrorStatus;		/* 1C00 */
90962306a36Sopenharmony_ci	__be64 phbRegbFirstErrorStatus;		/* 1C08 */
91062306a36Sopenharmony_ci	__be64 phbRegbErrorLog0;		/* 1C40 */
91162306a36Sopenharmony_ci	__be64 phbRegbErrorLog1;		/* 1C48 */
91262306a36Sopenharmony_ci
91362306a36Sopenharmony_ci	__be64 pestA[OPAL_PHB4_NUM_PEST_REGS];
91462306a36Sopenharmony_ci	__be64 pestB[OPAL_PHB4_NUM_PEST_REGS];
91562306a36Sopenharmony_ci};
91662306a36Sopenharmony_ci
91762306a36Sopenharmony_cienum {
91862306a36Sopenharmony_ci	OPAL_REINIT_CPUS_HILE_BE	= (1 << 0),
91962306a36Sopenharmony_ci	OPAL_REINIT_CPUS_HILE_LE	= (1 << 1),
92062306a36Sopenharmony_ci
92162306a36Sopenharmony_ci	/* These two define the base MMU mode of the host on P9
92262306a36Sopenharmony_ci	 *
92362306a36Sopenharmony_ci	 * On P9 Nimbus DD2.0 and Cumlus (and later), KVM can still
92462306a36Sopenharmony_ci	 * create hash guests in "radix" mode with care (full core
92562306a36Sopenharmony_ci	 * switch only).
92662306a36Sopenharmony_ci	 */
92762306a36Sopenharmony_ci	OPAL_REINIT_CPUS_MMU_HASH	= (1 << 2),
92862306a36Sopenharmony_ci	OPAL_REINIT_CPUS_MMU_RADIX	= (1 << 3),
92962306a36Sopenharmony_ci
93062306a36Sopenharmony_ci	OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED = (1 << 4),
93162306a36Sopenharmony_ci};
93262306a36Sopenharmony_ci
93362306a36Sopenharmony_citypedef struct oppanel_line {
93462306a36Sopenharmony_ci	__be64 line;
93562306a36Sopenharmony_ci	__be64 line_len;
93662306a36Sopenharmony_ci} oppanel_line_t;
93762306a36Sopenharmony_ci
93862306a36Sopenharmony_cienum opal_prd_msg_type {
93962306a36Sopenharmony_ci	OPAL_PRD_MSG_TYPE_INIT = 0,	/* HBRT --> OPAL */
94062306a36Sopenharmony_ci	OPAL_PRD_MSG_TYPE_FINI,		/* HBRT/kernel --> OPAL */
94162306a36Sopenharmony_ci	OPAL_PRD_MSG_TYPE_ATTN,		/* HBRT <-- OPAL */
94262306a36Sopenharmony_ci	OPAL_PRD_MSG_TYPE_ATTN_ACK,	/* HBRT --> OPAL */
94362306a36Sopenharmony_ci	OPAL_PRD_MSG_TYPE_OCC_ERROR,	/* HBRT <-- OPAL */
94462306a36Sopenharmony_ci	OPAL_PRD_MSG_TYPE_OCC_RESET,	/* HBRT <-- OPAL */
94562306a36Sopenharmony_ci};
94662306a36Sopenharmony_ci
94762306a36Sopenharmony_cistruct opal_prd_msg_header {
94862306a36Sopenharmony_ci	uint8_t		type;
94962306a36Sopenharmony_ci	uint8_t		pad[1];
95062306a36Sopenharmony_ci	__be16		size;
95162306a36Sopenharmony_ci};
95262306a36Sopenharmony_ci
95362306a36Sopenharmony_cistruct opal_prd_msg;
95462306a36Sopenharmony_ci
95562306a36Sopenharmony_ci#define OCC_RESET                       0
95662306a36Sopenharmony_ci#define OCC_LOAD                        1
95762306a36Sopenharmony_ci#define OCC_THROTTLE                    2
95862306a36Sopenharmony_ci#define OCC_MAX_THROTTLE_STATUS         5
95962306a36Sopenharmony_ci
96062306a36Sopenharmony_cistruct opal_occ_msg {
96162306a36Sopenharmony_ci	__be64 type;
96262306a36Sopenharmony_ci	__be64 chip;
96362306a36Sopenharmony_ci	__be64 throttle_status;
96462306a36Sopenharmony_ci};
96562306a36Sopenharmony_ci
96662306a36Sopenharmony_ci/*
96762306a36Sopenharmony_ci * SG entries
96862306a36Sopenharmony_ci *
96962306a36Sopenharmony_ci * WARNING: The current implementation requires each entry
97062306a36Sopenharmony_ci * to represent a block that is 4k aligned *and* each block
97162306a36Sopenharmony_ci * size except the last one in the list to be as well.
97262306a36Sopenharmony_ci */
97362306a36Sopenharmony_cistruct opal_sg_entry {
97462306a36Sopenharmony_ci	__be64 data;
97562306a36Sopenharmony_ci	__be64 length;
97662306a36Sopenharmony_ci};
97762306a36Sopenharmony_ci
97862306a36Sopenharmony_ci/*
97962306a36Sopenharmony_ci * Candidate image SG list.
98062306a36Sopenharmony_ci *
98162306a36Sopenharmony_ci * length = VER | length
98262306a36Sopenharmony_ci */
98362306a36Sopenharmony_cistruct opal_sg_list {
98462306a36Sopenharmony_ci	__be64 length;
98562306a36Sopenharmony_ci	__be64 next;
98662306a36Sopenharmony_ci	struct opal_sg_entry entry[];
98762306a36Sopenharmony_ci};
98862306a36Sopenharmony_ci
98962306a36Sopenharmony_ci/*
99062306a36Sopenharmony_ci * Dump region ID range usable by the OS
99162306a36Sopenharmony_ci */
99262306a36Sopenharmony_ci#define OPAL_DUMP_REGION_HOST_START		0x80
99362306a36Sopenharmony_ci#define OPAL_DUMP_REGION_LOG_BUF		0x80
99462306a36Sopenharmony_ci#define OPAL_DUMP_REGION_HOST_END		0xFF
99562306a36Sopenharmony_ci
99662306a36Sopenharmony_ci/* CAPI modes for PHB */
99762306a36Sopenharmony_cienum {
99862306a36Sopenharmony_ci	OPAL_PHB_CAPI_MODE_PCIE		= 0,
99962306a36Sopenharmony_ci	OPAL_PHB_CAPI_MODE_CAPI		= 1,
100062306a36Sopenharmony_ci	OPAL_PHB_CAPI_MODE_SNOOP_OFF    = 2,
100162306a36Sopenharmony_ci	OPAL_PHB_CAPI_MODE_SNOOP_ON	= 3,
100262306a36Sopenharmony_ci	OPAL_PHB_CAPI_MODE_DMA		= 4,
100362306a36Sopenharmony_ci	OPAL_PHB_CAPI_MODE_DMA_TVT1	= 5,
100462306a36Sopenharmony_ci};
100562306a36Sopenharmony_ci
100662306a36Sopenharmony_ci/* OPAL I2C request */
100762306a36Sopenharmony_cistruct opal_i2c_request {
100862306a36Sopenharmony_ci	uint8_t	type;
100962306a36Sopenharmony_ci#define OPAL_I2C_RAW_READ	0
101062306a36Sopenharmony_ci#define OPAL_I2C_RAW_WRITE	1
101162306a36Sopenharmony_ci#define OPAL_I2C_SM_READ	2
101262306a36Sopenharmony_ci#define OPAL_I2C_SM_WRITE	3
101362306a36Sopenharmony_ci	uint8_t flags;
101462306a36Sopenharmony_ci#define OPAL_I2C_ADDR_10	0x01	/* Not supported yet */
101562306a36Sopenharmony_ci	uint8_t	subaddr_sz;		/* Max 4 */
101662306a36Sopenharmony_ci	uint8_t reserved;
101762306a36Sopenharmony_ci	__be16 addr;			/* 7 or 10 bit address */
101862306a36Sopenharmony_ci	__be16 reserved2;
101962306a36Sopenharmony_ci	__be32 subaddr;		/* Sub-address if any */
102062306a36Sopenharmony_ci	__be32 size;			/* Data size */
102162306a36Sopenharmony_ci	__be64 buffer_ra;		/* Buffer real address */
102262306a36Sopenharmony_ci};
102362306a36Sopenharmony_ci
102462306a36Sopenharmony_ci/*
102562306a36Sopenharmony_ci * EPOW status sharing (OPAL and the host)
102662306a36Sopenharmony_ci *
102762306a36Sopenharmony_ci * The host will pass on OPAL, a buffer of length OPAL_SYSEPOW_MAX
102862306a36Sopenharmony_ci * with individual elements being 16 bits wide to fetch the system
102962306a36Sopenharmony_ci * wide EPOW status. Each element in the buffer will contain the
103062306a36Sopenharmony_ci * EPOW status in it's bit representation for a particular EPOW sub
103162306a36Sopenharmony_ci * class as defined here. So multiple detailed EPOW status bits
103262306a36Sopenharmony_ci * specific for any sub class can be represented in a single buffer
103362306a36Sopenharmony_ci * element as it's bit representation.
103462306a36Sopenharmony_ci */
103562306a36Sopenharmony_ci
103662306a36Sopenharmony_ci/* System EPOW type */
103762306a36Sopenharmony_cienum OpalSysEpow {
103862306a36Sopenharmony_ci	OPAL_SYSEPOW_POWER	= 0,	/* Power EPOW */
103962306a36Sopenharmony_ci	OPAL_SYSEPOW_TEMP	= 1,	/* Temperature EPOW */
104062306a36Sopenharmony_ci	OPAL_SYSEPOW_COOLING	= 2,	/* Cooling EPOW */
104162306a36Sopenharmony_ci	OPAL_SYSEPOW_MAX	= 3,	/* Max EPOW categories */
104262306a36Sopenharmony_ci};
104362306a36Sopenharmony_ci
104462306a36Sopenharmony_ci/* Power EPOW */
104562306a36Sopenharmony_cienum OpalSysPower {
104662306a36Sopenharmony_ci	OPAL_SYSPOWER_UPS	= 0x0001, /* System on UPS power */
104762306a36Sopenharmony_ci	OPAL_SYSPOWER_CHNG	= 0x0002, /* System power config change */
104862306a36Sopenharmony_ci	OPAL_SYSPOWER_FAIL	= 0x0004, /* System impending power failure */
104962306a36Sopenharmony_ci	OPAL_SYSPOWER_INCL	= 0x0008, /* System incomplete power */
105062306a36Sopenharmony_ci};
105162306a36Sopenharmony_ci
105262306a36Sopenharmony_ci/* Temperature EPOW */
105362306a36Sopenharmony_cienum OpalSysTemp {
105462306a36Sopenharmony_ci	OPAL_SYSTEMP_AMB	= 0x0001, /* System over ambient temperature */
105562306a36Sopenharmony_ci	OPAL_SYSTEMP_INT	= 0x0002, /* System over internal temperature */
105662306a36Sopenharmony_ci	OPAL_SYSTEMP_HMD	= 0x0004, /* System over ambient humidity */
105762306a36Sopenharmony_ci};
105862306a36Sopenharmony_ci
105962306a36Sopenharmony_ci/* Cooling EPOW */
106062306a36Sopenharmony_cienum OpalSysCooling {
106162306a36Sopenharmony_ci	OPAL_SYSCOOL_INSF	= 0x0001, /* System insufficient cooling */
106262306a36Sopenharmony_ci};
106362306a36Sopenharmony_ci
106462306a36Sopenharmony_ci/* Argument to OPAL_CEC_REBOOT2() */
106562306a36Sopenharmony_cienum {
106662306a36Sopenharmony_ci	OPAL_REBOOT_NORMAL		= 0,
106762306a36Sopenharmony_ci	OPAL_REBOOT_PLATFORM_ERROR	= 1,
106862306a36Sopenharmony_ci	OPAL_REBOOT_FULL_IPL		= 2,
106962306a36Sopenharmony_ci	OPAL_REBOOT_MPIPL		= 3,
107062306a36Sopenharmony_ci	OPAL_REBOOT_FAST		= 4,
107162306a36Sopenharmony_ci};
107262306a36Sopenharmony_ci
107362306a36Sopenharmony_ci/* Argument to OPAL_PCI_TCE_KILL */
107462306a36Sopenharmony_cienum {
107562306a36Sopenharmony_ci	OPAL_PCI_TCE_KILL_PAGES,
107662306a36Sopenharmony_ci	OPAL_PCI_TCE_KILL_PE,
107762306a36Sopenharmony_ci	OPAL_PCI_TCE_KILL_ALL,
107862306a36Sopenharmony_ci};
107962306a36Sopenharmony_ci
108062306a36Sopenharmony_ci/* The xive operation mode indicates the active "API" and
108162306a36Sopenharmony_ci * corresponds to the "mode" parameter of the opal_xive_reset()
108262306a36Sopenharmony_ci * call
108362306a36Sopenharmony_ci */
108462306a36Sopenharmony_cienum {
108562306a36Sopenharmony_ci	OPAL_XIVE_MODE_EMU	= 0,
108662306a36Sopenharmony_ci	OPAL_XIVE_MODE_EXPL	= 1,
108762306a36Sopenharmony_ci};
108862306a36Sopenharmony_ci
108962306a36Sopenharmony_ci/* Flags for OPAL_XIVE_GET_IRQ_INFO */
109062306a36Sopenharmony_cienum {
109162306a36Sopenharmony_ci	OPAL_XIVE_IRQ_TRIGGER_PAGE	= 0x00000001,
109262306a36Sopenharmony_ci	OPAL_XIVE_IRQ_STORE_EOI		= 0x00000002,
109362306a36Sopenharmony_ci	OPAL_XIVE_IRQ_LSI		= 0x00000004,
109462306a36Sopenharmony_ci	OPAL_XIVE_IRQ_SHIFT_BUG		= 0x00000008, /* P9 DD1.0 workaround */
109562306a36Sopenharmony_ci	OPAL_XIVE_IRQ_MASK_VIA_FW	= 0x00000010, /* P9 DD1.0 workaround */
109662306a36Sopenharmony_ci	OPAL_XIVE_IRQ_EOI_VIA_FW	= 0x00000020, /* P9 DD1.0 workaround */
109762306a36Sopenharmony_ci	OPAL_XIVE_IRQ_STORE_EOI2	= 0x00000040,
109862306a36Sopenharmony_ci};
109962306a36Sopenharmony_ci
110062306a36Sopenharmony_ci/* Flags for OPAL_XIVE_GET/SET_QUEUE_INFO */
110162306a36Sopenharmony_cienum {
110262306a36Sopenharmony_ci	OPAL_XIVE_EQ_ENABLED		= 0x00000001,
110362306a36Sopenharmony_ci	OPAL_XIVE_EQ_ALWAYS_NOTIFY	= 0x00000002,
110462306a36Sopenharmony_ci	OPAL_XIVE_EQ_ESCALATE		= 0x00000004,
110562306a36Sopenharmony_ci};
110662306a36Sopenharmony_ci
110762306a36Sopenharmony_ci/* Flags for OPAL_XIVE_GET/SET_VP_INFO */
110862306a36Sopenharmony_cienum {
110962306a36Sopenharmony_ci	OPAL_XIVE_VP_ENABLED		= 0x00000001,
111062306a36Sopenharmony_ci	OPAL_XIVE_VP_SINGLE_ESCALATION	= 0x00000002,
111162306a36Sopenharmony_ci};
111262306a36Sopenharmony_ci
111362306a36Sopenharmony_ci/* "Any chip" replacement for chip ID for allocation functions */
111462306a36Sopenharmony_cienum {
111562306a36Sopenharmony_ci	OPAL_XIVE_ANY_CHIP		= 0xffffffff,
111662306a36Sopenharmony_ci};
111762306a36Sopenharmony_ci
111862306a36Sopenharmony_ci/* Xive sync options */
111962306a36Sopenharmony_cienum {
112062306a36Sopenharmony_ci	/* This bits are cumulative, arg is a girq */
112162306a36Sopenharmony_ci	XIVE_SYNC_EAS			= 0x00000001, /* Sync irq source */
112262306a36Sopenharmony_ci	XIVE_SYNC_QUEUE			= 0x00000002, /* Sync irq target */
112362306a36Sopenharmony_ci};
112462306a36Sopenharmony_ci
112562306a36Sopenharmony_ci/* Dump options */
112662306a36Sopenharmony_cienum {
112762306a36Sopenharmony_ci	XIVE_DUMP_TM_HYP	= 0,
112862306a36Sopenharmony_ci	XIVE_DUMP_TM_POOL	= 1,
112962306a36Sopenharmony_ci	XIVE_DUMP_TM_OS		= 2,
113062306a36Sopenharmony_ci	XIVE_DUMP_TM_USER	= 3,
113162306a36Sopenharmony_ci	XIVE_DUMP_VP		= 4,
113262306a36Sopenharmony_ci	XIVE_DUMP_EMU_STATE	= 5,
113362306a36Sopenharmony_ci};
113462306a36Sopenharmony_ci
113562306a36Sopenharmony_ci/* "type" argument options for OPAL_IMC_COUNTERS_* calls */
113662306a36Sopenharmony_cienum {
113762306a36Sopenharmony_ci	OPAL_IMC_COUNTERS_NEST = 1,
113862306a36Sopenharmony_ci	OPAL_IMC_COUNTERS_CORE = 2,
113962306a36Sopenharmony_ci	OPAL_IMC_COUNTERS_TRACE = 3,
114062306a36Sopenharmony_ci};
114162306a36Sopenharmony_ci
114262306a36Sopenharmony_ci
114362306a36Sopenharmony_ci/* PCI p2p descriptor */
114462306a36Sopenharmony_ci#define OPAL_PCI_P2P_ENABLE		0x1
114562306a36Sopenharmony_ci#define OPAL_PCI_P2P_LOAD		0x2
114662306a36Sopenharmony_ci#define OPAL_PCI_P2P_STORE		0x4
114762306a36Sopenharmony_ci
114862306a36Sopenharmony_ci/* MPIPL update operations */
114962306a36Sopenharmony_cienum opal_mpipl_ops {
115062306a36Sopenharmony_ci	OPAL_MPIPL_ADD_RANGE			= 0,
115162306a36Sopenharmony_ci	OPAL_MPIPL_REMOVE_RANGE			= 1,
115262306a36Sopenharmony_ci	OPAL_MPIPL_REMOVE_ALL			= 2,
115362306a36Sopenharmony_ci	OPAL_MPIPL_FREE_PRESERVED_MEMORY	= 3,
115462306a36Sopenharmony_ci};
115562306a36Sopenharmony_ci
115662306a36Sopenharmony_ci/* Tag will point to various metadata area. Kernel will
115762306a36Sopenharmony_ci * use tag to get metadata value.
115862306a36Sopenharmony_ci */
115962306a36Sopenharmony_cienum opal_mpipl_tags {
116062306a36Sopenharmony_ci	OPAL_MPIPL_TAG_CPU	= 0,
116162306a36Sopenharmony_ci	OPAL_MPIPL_TAG_OPAL	= 1,
116262306a36Sopenharmony_ci	OPAL_MPIPL_TAG_KERNEL	= 2,
116362306a36Sopenharmony_ci	OPAL_MPIPL_TAG_BOOT_MEM	= 3,
116462306a36Sopenharmony_ci};
116562306a36Sopenharmony_ci
116662306a36Sopenharmony_ci/* Preserved memory details */
116762306a36Sopenharmony_cistruct opal_mpipl_region {
116862306a36Sopenharmony_ci	__be64	src;
116962306a36Sopenharmony_ci	__be64	dest;
117062306a36Sopenharmony_ci	__be64	size;
117162306a36Sopenharmony_ci};
117262306a36Sopenharmony_ci
117362306a36Sopenharmony_ci/* Structure version */
117462306a36Sopenharmony_ci#define OPAL_MPIPL_VERSION		0x01
117562306a36Sopenharmony_ci
117662306a36Sopenharmony_cistruct opal_mpipl_fadump {
117762306a36Sopenharmony_ci	u8	version;
117862306a36Sopenharmony_ci	u8	reserved[7];
117962306a36Sopenharmony_ci	__be32	crashing_pir;	/* OPAL crashing CPU PIR */
118062306a36Sopenharmony_ci	__be32	cpu_data_version;
118162306a36Sopenharmony_ci	__be32	cpu_data_size;
118262306a36Sopenharmony_ci	__be32	region_cnt;
118362306a36Sopenharmony_ci	struct	opal_mpipl_region region[];
118462306a36Sopenharmony_ci} __packed;
118562306a36Sopenharmony_ci
118662306a36Sopenharmony_ci#endif /* __ASSEMBLY__ */
118762306a36Sopenharmony_ci
118862306a36Sopenharmony_ci#endif /* __OPAL_API_H */
1189