Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * OPAL API definitions.
0004  *
0005  * Copyright 2011-2015 IBM Corp.
0006  */
0007 
0008 #ifndef __OPAL_API_H
0009 #define __OPAL_API_H
0010 
0011 /****** OPAL APIs ******/
0012 
0013 /* Return codes */
0014 #define OPAL_SUCCESS        0
0015 #define OPAL_PARAMETER      -1
0016 #define OPAL_BUSY       -2
0017 #define OPAL_PARTIAL        -3
0018 #define OPAL_CONSTRAINED    -4
0019 #define OPAL_CLOSED     -5
0020 #define OPAL_HARDWARE       -6
0021 #define OPAL_UNSUPPORTED    -7
0022 #define OPAL_PERMISSION     -8
0023 #define OPAL_NO_MEM     -9
0024 #define OPAL_RESOURCE       -10
0025 #define OPAL_INTERNAL_ERROR -11
0026 #define OPAL_BUSY_EVENT     -12
0027 #define OPAL_HARDWARE_FROZEN    -13
0028 #define OPAL_WRONG_STATE    -14
0029 #define OPAL_ASYNC_COMPLETION   -15
0030 #define OPAL_EMPTY      -16
0031 #define OPAL_I2C_TIMEOUT    -17
0032 #define OPAL_I2C_INVALID_CMD    -18
0033 #define OPAL_I2C_LBUS_PARITY    -19
0034 #define OPAL_I2C_BKEND_OVERRUN  -20
0035 #define OPAL_I2C_BKEND_ACCESS   -21
0036 #define OPAL_I2C_ARBT_LOST  -22
0037 #define OPAL_I2C_NACK_RCVD  -23
0038 #define OPAL_I2C_STOP_ERR   -24
0039 #define OPAL_XIVE_PROVISIONING  -31
0040 #define OPAL_XIVE_FREE_ACTIVE   -32
0041 #define OPAL_TIMEOUT        -33
0042 
0043 /* API Tokens (in r0) */
0044 #define OPAL_INVALID_CALL              -1
0045 #define OPAL_TEST               0
0046 #define OPAL_CONSOLE_WRITE          1
0047 #define OPAL_CONSOLE_READ           2
0048 #define OPAL_RTC_READ               3
0049 #define OPAL_RTC_WRITE              4
0050 #define OPAL_CEC_POWER_DOWN         5
0051 #define OPAL_CEC_REBOOT             6
0052 #define OPAL_READ_NVRAM             7
0053 #define OPAL_WRITE_NVRAM            8
0054 #define OPAL_HANDLE_INTERRUPT           9
0055 #define OPAL_POLL_EVENTS            10
0056 #define OPAL_PCI_SET_HUB_TCE_MEMORY     11
0057 #define OPAL_PCI_SET_PHB_TCE_MEMORY     12
0058 #define OPAL_PCI_CONFIG_READ_BYTE       13
0059 #define OPAL_PCI_CONFIG_READ_HALF_WORD      14
0060 #define OPAL_PCI_CONFIG_READ_WORD       15
0061 #define OPAL_PCI_CONFIG_WRITE_BYTE      16
0062 #define OPAL_PCI_CONFIG_WRITE_HALF_WORD     17
0063 #define OPAL_PCI_CONFIG_WRITE_WORD      18
0064 #define OPAL_SET_XIVE               19
0065 #define OPAL_GET_XIVE               20
0066 #define OPAL_GET_COMPLETION_TOKEN_STATUS    21 /* obsolete */
0067 #define OPAL_REGISTER_OPAL_EXCEPTION_HANDLER    22
0068 #define OPAL_PCI_EEH_FREEZE_STATUS      23
0069 #define OPAL_PCI_SHPC               24
0070 #define OPAL_CONSOLE_WRITE_BUFFER_SPACE     25
0071 #define OPAL_PCI_EEH_FREEZE_CLEAR       26
0072 #define OPAL_PCI_PHB_MMIO_ENABLE        27
0073 #define OPAL_PCI_SET_PHB_MEM_WINDOW     28
0074 #define OPAL_PCI_MAP_PE_MMIO_WINDOW     29
0075 #define OPAL_PCI_SET_PHB_TABLE_MEMORY       30
0076 #define OPAL_PCI_SET_PE             31
0077 #define OPAL_PCI_SET_PELTV          32
0078 #define OPAL_PCI_SET_MVE            33
0079 #define OPAL_PCI_SET_MVE_ENABLE         34
0080 #define OPAL_PCI_GET_XIVE_REISSUE       35
0081 #define OPAL_PCI_SET_XIVE_REISSUE       36
0082 #define OPAL_PCI_SET_XIVE_PE            37
0083 #define OPAL_GET_XIVE_SOURCE            38
0084 #define OPAL_GET_MSI_32             39
0085 #define OPAL_GET_MSI_64             40
0086 #define OPAL_START_CPU              41
0087 #define OPAL_QUERY_CPU_STATUS           42
0088 #define OPAL_WRITE_OPPANEL          43 /* unimplemented */
0089 #define OPAL_PCI_MAP_PE_DMA_WINDOW      44
0090 #define OPAL_PCI_MAP_PE_DMA_WINDOW_REAL     45
0091 #define OPAL_PCI_RESET              49
0092 #define OPAL_PCI_GET_HUB_DIAG_DATA      50
0093 #define OPAL_PCI_GET_PHB_DIAG_DATA      51
0094 #define OPAL_PCI_FENCE_PHB          52
0095 #define OPAL_PCI_REINIT             53
0096 #define OPAL_PCI_MASK_PE_ERROR          54
0097 #define OPAL_SET_SLOT_LED_STATUS        55
0098 #define OPAL_GET_EPOW_STATUS            56
0099 #define OPAL_SET_SYSTEM_ATTENTION_LED       57
0100 #define OPAL_RESERVED1              58
0101 #define OPAL_RESERVED2              59
0102 #define OPAL_PCI_NEXT_ERROR         60
0103 #define OPAL_PCI_EEH_FREEZE_STATUS2     61
0104 #define OPAL_PCI_POLL               62
0105 #define OPAL_PCI_MSI_EOI            63
0106 #define OPAL_PCI_GET_PHB_DIAG_DATA2     64
0107 #define OPAL_XSCOM_READ             65
0108 #define OPAL_XSCOM_WRITE            66
0109 #define OPAL_LPC_READ               67
0110 #define OPAL_LPC_WRITE              68
0111 #define OPAL_RETURN_CPU             69
0112 #define OPAL_REINIT_CPUS            70
0113 #define OPAL_ELOG_READ              71
0114 #define OPAL_ELOG_WRITE             72
0115 #define OPAL_ELOG_ACK               73
0116 #define OPAL_ELOG_RESEND            74
0117 #define OPAL_ELOG_SIZE              75
0118 #define OPAL_FLASH_VALIDATE         76
0119 #define OPAL_FLASH_MANAGE           77
0120 #define OPAL_FLASH_UPDATE           78
0121 #define OPAL_RESYNC_TIMEBASE            79
0122 #define OPAL_CHECK_TOKEN            80
0123 #define OPAL_DUMP_INIT              81
0124 #define OPAL_DUMP_INFO              82
0125 #define OPAL_DUMP_READ              83
0126 #define OPAL_DUMP_ACK               84
0127 #define OPAL_GET_MSG                85
0128 #define OPAL_CHECK_ASYNC_COMPLETION     86
0129 #define OPAL_SYNC_HOST_REBOOT           87
0130 #define OPAL_SENSOR_READ            88
0131 #define OPAL_GET_PARAM              89
0132 #define OPAL_SET_PARAM              90
0133 #define OPAL_DUMP_RESEND            91
0134 #define OPAL_ELOG_SEND              92  /* Deprecated */
0135 #define OPAL_PCI_SET_PHB_CAPI_MODE      93
0136 #define OPAL_DUMP_INFO2             94
0137 #define OPAL_WRITE_OPPANEL_ASYNC        95
0138 #define OPAL_PCI_ERR_INJECT         96
0139 #define OPAL_PCI_EEH_FREEZE_SET         97
0140 #define OPAL_HANDLE_HMI             98
0141 #define OPAL_CONFIG_CPU_IDLE_STATE      99
0142 #define OPAL_SLW_SET_REG            100
0143 #define OPAL_REGISTER_DUMP_REGION       101
0144 #define OPAL_UNREGISTER_DUMP_REGION     102
0145 #define OPAL_WRITE_TPO              103
0146 #define OPAL_READ_TPO               104
0147 #define OPAL_GET_DPO_STATUS         105
0148 #define OPAL_OLD_I2C_REQUEST            106 /* Deprecated */
0149 #define OPAL_IPMI_SEND              107
0150 #define OPAL_IPMI_RECV              108
0151 #define OPAL_I2C_REQUEST            109
0152 #define OPAL_FLASH_READ             110
0153 #define OPAL_FLASH_WRITE            111
0154 #define OPAL_FLASH_ERASE            112
0155 #define OPAL_PRD_MSG                113
0156 #define OPAL_LEDS_GET_INDICATOR         114
0157 #define OPAL_LEDS_SET_INDICATOR         115
0158 #define OPAL_CEC_REBOOT2            116
0159 #define OPAL_CONSOLE_FLUSH          117
0160 #define OPAL_GET_DEVICE_TREE            118
0161 #define OPAL_PCI_GET_PRESENCE_STATE     119
0162 #define OPAL_PCI_GET_POWER_STATE        120
0163 #define OPAL_PCI_SET_POWER_STATE        121
0164 #define OPAL_INT_GET_XIRR           122
0165 #define OPAL_INT_SET_CPPR           123
0166 #define OPAL_INT_EOI                124
0167 #define OPAL_INT_SET_MFRR           125
0168 #define OPAL_PCI_TCE_KILL           126
0169 #define OPAL_NMMU_SET_PTCR          127
0170 #define OPAL_XIVE_RESET             128
0171 #define OPAL_XIVE_GET_IRQ_INFO          129
0172 #define OPAL_XIVE_GET_IRQ_CONFIG        130
0173 #define OPAL_XIVE_SET_IRQ_CONFIG        131
0174 #define OPAL_XIVE_GET_QUEUE_INFO        132
0175 #define OPAL_XIVE_SET_QUEUE_INFO        133
0176 #define OPAL_XIVE_DONATE_PAGE           134
0177 #define OPAL_XIVE_ALLOCATE_VP_BLOCK     135
0178 #define OPAL_XIVE_FREE_VP_BLOCK         136
0179 #define OPAL_XIVE_GET_VP_INFO           137
0180 #define OPAL_XIVE_SET_VP_INFO           138
0181 #define OPAL_XIVE_ALLOCATE_IRQ          139
0182 #define OPAL_XIVE_FREE_IRQ          140
0183 #define OPAL_XIVE_SYNC              141
0184 #define OPAL_XIVE_DUMP              142
0185 #define OPAL_XIVE_GET_QUEUE_STATE       143
0186 #define OPAL_XIVE_SET_QUEUE_STATE       144
0187 #define OPAL_SIGNAL_SYSTEM_RESET        145
0188 #define OPAL_NPU_INIT_CONTEXT           146
0189 #define OPAL_NPU_DESTROY_CONTEXT        147
0190 #define OPAL_NPU_MAP_LPAR           148
0191 #define OPAL_IMC_COUNTERS_INIT          149
0192 #define OPAL_IMC_COUNTERS_START         150
0193 #define OPAL_IMC_COUNTERS_STOP          151
0194 #define OPAL_GET_POWERCAP           152
0195 #define OPAL_SET_POWERCAP           153
0196 #define OPAL_GET_POWER_SHIFT_RATIO      154
0197 #define OPAL_SET_POWER_SHIFT_RATIO      155
0198 #define OPAL_SENSOR_GROUP_CLEAR         156
0199 #define OPAL_PCI_SET_P2P            157
0200 #define OPAL_QUIESCE                158
0201 #define OPAL_NPU_SPA_SETUP          159
0202 #define OPAL_NPU_SPA_CLEAR_CACHE        160
0203 #define OPAL_NPU_TL_SET             161
0204 #define OPAL_SENSOR_READ_U64            162
0205 #define OPAL_SENSOR_GROUP_ENABLE        163
0206 #define OPAL_PCI_GET_PBCQ_TUNNEL_BAR        164
0207 #define OPAL_PCI_SET_PBCQ_TUNNEL_BAR        165
0208 #define OPAL_HANDLE_HMI2            166
0209 #define OPAL_NX_COPROC_INIT         167
0210 #define OPAL_XIVE_GET_VP_STATE          170
0211 #define OPAL_MPIPL_UPDATE           173
0212 #define OPAL_MPIPL_REGISTER_TAG         174
0213 #define OPAL_MPIPL_QUERY_TAG            175
0214 #define OPAL_SECVAR_GET             176
0215 #define OPAL_SECVAR_GET_NEXT            177
0216 #define OPAL_SECVAR_ENQUEUE_UPDATE      178
0217 #define OPAL_LAST               178
0218 
0219 #define QUIESCE_HOLD            1 /* Spin all calls at entry */
0220 #define QUIESCE_REJECT          2 /* Fail all calls with OPAL_BUSY */
0221 #define QUIESCE_LOCK_BREAK      3 /* Set to ignore locks. */
0222 #define QUIESCE_RESUME          4 /* Un-quiesce */
0223 #define QUIESCE_RESUME_FAST_REBOOT  5 /* Un-quiesce, fast reboot */
0224 
0225 /* Device tree flags */
0226 
0227 /*
0228  * Flags set in power-mgmt nodes in device tree describing
0229  * idle states that are supported in the platform.
0230  */
0231 
0232 #define OPAL_PM_TIMEBASE_STOP       0x00000002
0233 #define OPAL_PM_LOSE_HYP_CONTEXT    0x00002000
0234 #define OPAL_PM_LOSE_FULL_CONTEXT   0x00004000
0235 #define OPAL_PM_NAP_ENABLED     0x00010000
0236 #define OPAL_PM_SLEEP_ENABLED       0x00020000
0237 #define OPAL_PM_WINKLE_ENABLED      0x00040000
0238 #define OPAL_PM_SLEEP_ENABLED_ER1   0x00080000 /* with workaround */
0239 #define OPAL_PM_STOP_INST_FAST      0x00100000
0240 #define OPAL_PM_STOP_INST_DEEP      0x00200000
0241 
0242 /*
0243  * OPAL_CONFIG_CPU_IDLE_STATE parameters
0244  */
0245 #define OPAL_CONFIG_IDLE_FASTSLEEP  1
0246 #define OPAL_CONFIG_IDLE_UNDO       0
0247 #define OPAL_CONFIG_IDLE_APPLY      1
0248 
0249 #ifndef __ASSEMBLY__
0250 
0251 /* Other enums */
0252 enum OpalFreezeState {
0253     OPAL_EEH_STOPPED_NOT_FROZEN = 0,
0254     OPAL_EEH_STOPPED_MMIO_FREEZE = 1,
0255     OPAL_EEH_STOPPED_DMA_FREEZE = 2,
0256     OPAL_EEH_STOPPED_MMIO_DMA_FREEZE = 3,
0257     OPAL_EEH_STOPPED_RESET = 4,
0258     OPAL_EEH_STOPPED_TEMP_UNAVAIL = 5,
0259     OPAL_EEH_STOPPED_PERM_UNAVAIL = 6
0260 };
0261 
0262 enum OpalEehFreezeActionToken {
0263     OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO = 1,
0264     OPAL_EEH_ACTION_CLEAR_FREEZE_DMA = 2,
0265     OPAL_EEH_ACTION_CLEAR_FREEZE_ALL = 3,
0266 
0267     OPAL_EEH_ACTION_SET_FREEZE_MMIO = 1,
0268     OPAL_EEH_ACTION_SET_FREEZE_DMA  = 2,
0269     OPAL_EEH_ACTION_SET_FREEZE_ALL  = 3
0270 };
0271 
0272 enum OpalPciStatusToken {
0273     OPAL_EEH_NO_ERROR   = 0,
0274     OPAL_EEH_IOC_ERROR  = 1,
0275     OPAL_EEH_PHB_ERROR  = 2,
0276     OPAL_EEH_PE_ERROR   = 3,
0277     OPAL_EEH_PE_MMIO_ERROR  = 4,
0278     OPAL_EEH_PE_DMA_ERROR   = 5
0279 };
0280 
0281 enum OpalPciErrorSeverity {
0282     OPAL_EEH_SEV_NO_ERROR   = 0,
0283     OPAL_EEH_SEV_IOC_DEAD   = 1,
0284     OPAL_EEH_SEV_PHB_DEAD   = 2,
0285     OPAL_EEH_SEV_PHB_FENCED = 3,
0286     OPAL_EEH_SEV_PE_ER  = 4,
0287     OPAL_EEH_SEV_INF    = 5
0288 };
0289 
0290 enum OpalErrinjectType {
0291     OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR    = 0,
0292     OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64  = 1,
0293 };
0294 
0295 enum OpalErrinjectFunc {
0296     /* IOA bus specific errors */
0297     OPAL_ERR_INJECT_FUNC_IOA_LD_MEM_ADDR    = 0,
0298     OPAL_ERR_INJECT_FUNC_IOA_LD_MEM_DATA    = 1,
0299     OPAL_ERR_INJECT_FUNC_IOA_LD_IO_ADDR = 2,
0300     OPAL_ERR_INJECT_FUNC_IOA_LD_IO_DATA = 3,
0301     OPAL_ERR_INJECT_FUNC_IOA_LD_CFG_ADDR    = 4,
0302     OPAL_ERR_INJECT_FUNC_IOA_LD_CFG_DATA    = 5,
0303     OPAL_ERR_INJECT_FUNC_IOA_ST_MEM_ADDR    = 6,
0304     OPAL_ERR_INJECT_FUNC_IOA_ST_MEM_DATA    = 7,
0305     OPAL_ERR_INJECT_FUNC_IOA_ST_IO_ADDR = 8,
0306     OPAL_ERR_INJECT_FUNC_IOA_ST_IO_DATA = 9,
0307     OPAL_ERR_INJECT_FUNC_IOA_ST_CFG_ADDR    = 10,
0308     OPAL_ERR_INJECT_FUNC_IOA_ST_CFG_DATA    = 11,
0309     OPAL_ERR_INJECT_FUNC_IOA_DMA_RD_ADDR    = 12,
0310     OPAL_ERR_INJECT_FUNC_IOA_DMA_RD_DATA    = 13,
0311     OPAL_ERR_INJECT_FUNC_IOA_DMA_RD_MASTER  = 14,
0312     OPAL_ERR_INJECT_FUNC_IOA_DMA_RD_TARGET  = 15,
0313     OPAL_ERR_INJECT_FUNC_IOA_DMA_WR_ADDR    = 16,
0314     OPAL_ERR_INJECT_FUNC_IOA_DMA_WR_DATA    = 17,
0315     OPAL_ERR_INJECT_FUNC_IOA_DMA_WR_MASTER  = 18,
0316     OPAL_ERR_INJECT_FUNC_IOA_DMA_WR_TARGET  = 19,
0317 };
0318 
0319 enum OpalMmioWindowType {
0320     OPAL_M32_WINDOW_TYPE = 1,
0321     OPAL_M64_WINDOW_TYPE = 2,
0322     OPAL_IO_WINDOW_TYPE  = 3
0323 };
0324 
0325 enum OpalExceptionHandler {
0326     OPAL_MACHINE_CHECK_HANDLER      = 1,
0327     OPAL_HYPERVISOR_MAINTENANCE_HANDLER = 2,
0328     OPAL_SOFTPATCH_HANDLER          = 3
0329 };
0330 
0331 enum OpalPendingState {
0332     OPAL_EVENT_OPAL_INTERNAL   = 0x1,
0333     OPAL_EVENT_NVRAM       = 0x2,
0334     OPAL_EVENT_RTC         = 0x4,
0335     OPAL_EVENT_CONSOLE_OUTPUT  = 0x8,
0336     OPAL_EVENT_CONSOLE_INPUT   = 0x10,
0337     OPAL_EVENT_ERROR_LOG_AVAIL = 0x20,
0338     OPAL_EVENT_ERROR_LOG       = 0x40,
0339     OPAL_EVENT_EPOW        = 0x80,
0340     OPAL_EVENT_LED_STATUS      = 0x100,
0341     OPAL_EVENT_PCI_ERROR       = 0x200,
0342     OPAL_EVENT_DUMP_AVAIL      = 0x400,
0343     OPAL_EVENT_MSG_PENDING     = 0x800,
0344 };
0345 
0346 enum OpalThreadStatus {
0347     OPAL_THREAD_INACTIVE = 0x0,
0348     OPAL_THREAD_STARTED = 0x1,
0349     OPAL_THREAD_UNAVAILABLE = 0x2 /* opal-v3 */
0350 };
0351 
0352 enum OpalPciBusCompare {
0353     OpalPciBusAny   = 0,    /* Any bus number match */
0354     OpalPciBus3Bits = 2,    /* Match top 3 bits of bus number */
0355     OpalPciBus4Bits = 3,    /* Match top 4 bits of bus number */
0356     OpalPciBus5Bits = 4,    /* Match top 5 bits of bus number */
0357     OpalPciBus6Bits = 5,    /* Match top 6 bits of bus number */
0358     OpalPciBus7Bits = 6,    /* Match top 7 bits of bus number */
0359     OpalPciBusAll   = 7,    /* Match bus number exactly */
0360 };
0361 
0362 enum OpalDeviceCompare {
0363     OPAL_IGNORE_RID_DEVICE_NUMBER = 0,
0364     OPAL_COMPARE_RID_DEVICE_NUMBER = 1
0365 };
0366 
0367 enum OpalFuncCompare {
0368     OPAL_IGNORE_RID_FUNCTION_NUMBER = 0,
0369     OPAL_COMPARE_RID_FUNCTION_NUMBER = 1
0370 };
0371 
0372 enum OpalPeAction {
0373     OPAL_UNMAP_PE = 0,
0374     OPAL_MAP_PE = 1
0375 };
0376 
0377 enum OpalPeltvAction {
0378     OPAL_REMOVE_PE_FROM_DOMAIN = 0,
0379     OPAL_ADD_PE_TO_DOMAIN = 1
0380 };
0381 
0382 enum OpalMveEnableAction {
0383     OPAL_DISABLE_MVE = 0,
0384     OPAL_ENABLE_MVE = 1
0385 };
0386 
0387 enum OpalM64Action {
0388     OPAL_DISABLE_M64 = 0,
0389     OPAL_ENABLE_M64_SPLIT = 1,
0390     OPAL_ENABLE_M64_NON_SPLIT = 2
0391 };
0392 
0393 enum OpalPciResetScope {
0394     OPAL_RESET_PHB_COMPLETE     = 1,
0395     OPAL_RESET_PCI_LINK     = 2,
0396     OPAL_RESET_PHB_ERROR        = 3,
0397     OPAL_RESET_PCI_HOT      = 4,
0398     OPAL_RESET_PCI_FUNDAMENTAL  = 5,
0399     OPAL_RESET_PCI_IODA_TABLE   = 6
0400 };
0401 
0402 enum OpalPciReinitScope {
0403     /*
0404      * Note: we chose values that do not overlap
0405      * OpalPciResetScope as OPAL v2 used the same
0406      * enum for both
0407      */
0408     OPAL_REINIT_PCI_DEV = 1000
0409 };
0410 
0411 enum OpalPciResetState {
0412     OPAL_DEASSERT_RESET = 0,
0413     OPAL_ASSERT_RESET   = 1
0414 };
0415 
0416 enum OpalPciSlotPresence {
0417     OPAL_PCI_SLOT_EMPTY = 0,
0418     OPAL_PCI_SLOT_PRESENT   = 1
0419 };
0420 
0421 enum OpalPciSlotPower {
0422     OPAL_PCI_SLOT_POWER_OFF = 0,
0423     OPAL_PCI_SLOT_POWER_ON  = 1,
0424     OPAL_PCI_SLOT_OFFLINE   = 2,
0425     OPAL_PCI_SLOT_ONLINE    = 3
0426 };
0427 
0428 enum OpalSlotLedType {
0429     OPAL_SLOT_LED_TYPE_ID = 0,  /* IDENTIFY LED */
0430     OPAL_SLOT_LED_TYPE_FAULT = 1,   /* FAULT LED */
0431     OPAL_SLOT_LED_TYPE_ATTN = 2,    /* System Attention LED */
0432     OPAL_SLOT_LED_TYPE_MAX = 3
0433 };
0434 
0435 enum OpalSlotLedState {
0436     OPAL_SLOT_LED_STATE_OFF = 0,    /* LED is OFF */
0437     OPAL_SLOT_LED_STATE_ON = 1  /* LED is ON */
0438 };
0439 
0440 /*
0441  * Address cycle types for LPC accesses. These also correspond
0442  * to the content of the first cell of the "reg" property for
0443  * device nodes on the LPC bus
0444  */
0445 enum OpalLPCAddressType {
0446     OPAL_LPC_MEM    = 0,
0447     OPAL_LPC_IO = 1,
0448     OPAL_LPC_FW = 2,
0449 };
0450 
0451 enum opal_msg_type {
0452     OPAL_MSG_ASYNC_COMP = 0,    /* params[0] = token, params[1] = rc,
0453                      * additional params function-specific
0454                      */
0455     OPAL_MSG_MEM_ERR    = 1,
0456     OPAL_MSG_EPOW       = 2,
0457     OPAL_MSG_SHUTDOWN   = 3,    /* params[0] = 1 reboot, 0 shutdown */
0458     OPAL_MSG_HMI_EVT    = 4,
0459     OPAL_MSG_DPO        = 5,
0460     OPAL_MSG_PRD        = 6,
0461     OPAL_MSG_OCC        = 7,
0462     OPAL_MSG_PRD2       = 8,
0463     OPAL_MSG_TYPE_MAX,
0464 };
0465 
0466 struct opal_msg {
0467     __be32 msg_type;
0468     __be32 reserved;
0469     __be64 params[8];
0470 };
0471 
0472 /* System parameter permission */
0473 enum OpalSysparamPerm {
0474     OPAL_SYSPARAM_READ  = 0x1,
0475     OPAL_SYSPARAM_WRITE = 0x2,
0476     OPAL_SYSPARAM_RW    = (OPAL_SYSPARAM_READ | OPAL_SYSPARAM_WRITE),
0477 };
0478 
0479 enum {
0480     OPAL_IPMI_MSG_FORMAT_VERSION_1 = 1,
0481 };
0482 
0483 struct opal_ipmi_msg {
0484     uint8_t version;
0485     uint8_t netfn;
0486     uint8_t cmd;
0487     uint8_t data[];
0488 };
0489 
0490 /* FSP memory errors handling */
0491 enum OpalMemErr_Version {
0492     OpalMemErr_V1 = 1,
0493 };
0494 
0495 enum OpalMemErrType {
0496     OPAL_MEM_ERR_TYPE_RESILIENCE    = 0,
0497     OPAL_MEM_ERR_TYPE_DYN_DALLOC,
0498 };
0499 
0500 /* Memory Reilience error type */
0501 enum OpalMemErr_ResilErrType {
0502     OPAL_MEM_RESILIENCE_CE      = 0,
0503     OPAL_MEM_RESILIENCE_UE,
0504     OPAL_MEM_RESILIENCE_UE_SCRUB,
0505 };
0506 
0507 /* Dynamic Memory Deallocation type */
0508 enum OpalMemErr_DynErrType {
0509     OPAL_MEM_DYNAMIC_DEALLOC    = 0,
0510 };
0511 
0512 struct OpalMemoryErrorData {
0513     enum OpalMemErr_Version version:8;  /* 0x00 */
0514     enum OpalMemErrType type:8;     /* 0x01 */
0515     __be16          flags;      /* 0x02 */
0516     uint8_t         reserved_1[4];  /* 0x04 */
0517 
0518     union {
0519         /* Memory Resilience corrected/uncorrected error info */
0520         struct {
0521             enum OpalMemErr_ResilErrType    resil_err_type:8;
0522             uint8_t             reserved_1[7];
0523             __be64              physical_address_start;
0524             __be64              physical_address_end;
0525         } resilience;
0526         /* Dynamic memory deallocation error info */
0527         struct {
0528             enum OpalMemErr_DynErrType  dyn_err_type:8;
0529             uint8_t             reserved_1[7];
0530             __be64              physical_address_start;
0531             __be64              physical_address_end;
0532         } dyn_dealloc;
0533     } u;
0534 };
0535 
0536 /* HMI interrupt event */
0537 enum OpalHMI_Version {
0538     OpalHMIEvt_V1 = 1,
0539     OpalHMIEvt_V2 = 2,
0540 };
0541 
0542 enum OpalHMI_Severity {
0543     OpalHMI_SEV_NO_ERROR = 0,
0544     OpalHMI_SEV_WARNING = 1,
0545     OpalHMI_SEV_ERROR_SYNC = 2,
0546     OpalHMI_SEV_FATAL = 3,
0547 };
0548 
0549 enum OpalHMI_Disposition {
0550     OpalHMI_DISPOSITION_RECOVERED = 0,
0551     OpalHMI_DISPOSITION_NOT_RECOVERED = 1,
0552 };
0553 
0554 enum OpalHMI_ErrType {
0555     OpalHMI_ERROR_MALFUNC_ALERT = 0,
0556     OpalHMI_ERROR_PROC_RECOV_DONE,
0557     OpalHMI_ERROR_PROC_RECOV_DONE_AGAIN,
0558     OpalHMI_ERROR_PROC_RECOV_MASKED,
0559     OpalHMI_ERROR_TFAC,
0560     OpalHMI_ERROR_TFMR_PARITY,
0561     OpalHMI_ERROR_HA_OVERFLOW_WARN,
0562     OpalHMI_ERROR_XSCOM_FAIL,
0563     OpalHMI_ERROR_XSCOM_DONE,
0564     OpalHMI_ERROR_SCOM_FIR,
0565     OpalHMI_ERROR_DEBUG_TRIG_FIR,
0566     OpalHMI_ERROR_HYP_RESOURCE,
0567     OpalHMI_ERROR_CAPP_RECOVERY,
0568 };
0569 
0570 enum OpalHMI_XstopType {
0571     CHECKSTOP_TYPE_UNKNOWN  =   0,
0572     CHECKSTOP_TYPE_CORE =   1,
0573     CHECKSTOP_TYPE_NX   =   2,
0574     CHECKSTOP_TYPE_NPU  =   3
0575 };
0576 
0577 enum OpalHMI_CoreXstopReason {
0578     CORE_CHECKSTOP_IFU_REGFILE      = 0x00000001,
0579     CORE_CHECKSTOP_IFU_LOGIC        = 0x00000002,
0580     CORE_CHECKSTOP_PC_DURING_RECOV      = 0x00000004,
0581     CORE_CHECKSTOP_ISU_REGFILE      = 0x00000008,
0582     CORE_CHECKSTOP_ISU_LOGIC        = 0x00000010,
0583     CORE_CHECKSTOP_FXU_LOGIC        = 0x00000020,
0584     CORE_CHECKSTOP_VSU_LOGIC        = 0x00000040,
0585     CORE_CHECKSTOP_PC_RECOV_IN_MAINT_MODE   = 0x00000080,
0586     CORE_CHECKSTOP_LSU_REGFILE      = 0x00000100,
0587     CORE_CHECKSTOP_PC_FWD_PROGRESS      = 0x00000200,
0588     CORE_CHECKSTOP_LSU_LOGIC        = 0x00000400,
0589     CORE_CHECKSTOP_PC_LOGIC         = 0x00000800,
0590     CORE_CHECKSTOP_PC_HYP_RESOURCE      = 0x00001000,
0591     CORE_CHECKSTOP_PC_HANG_RECOV_FAILED = 0x00002000,
0592     CORE_CHECKSTOP_PC_AMBI_HANG_DETECTED    = 0x00004000,
0593     CORE_CHECKSTOP_PC_DEBUG_TRIG_ERR_INJ    = 0x00008000,
0594     CORE_CHECKSTOP_PC_SPRD_HYP_ERR_INJ  = 0x00010000,
0595 };
0596 
0597 enum OpalHMI_NestAccelXstopReason {
0598     NX_CHECKSTOP_SHM_INVAL_STATE_ERR    = 0x00000001,
0599     NX_CHECKSTOP_DMA_INVAL_STATE_ERR_1  = 0x00000002,
0600     NX_CHECKSTOP_DMA_INVAL_STATE_ERR_2  = 0x00000004,
0601     NX_CHECKSTOP_DMA_CH0_INVAL_STATE_ERR    = 0x00000008,
0602     NX_CHECKSTOP_DMA_CH1_INVAL_STATE_ERR    = 0x00000010,
0603     NX_CHECKSTOP_DMA_CH2_INVAL_STATE_ERR    = 0x00000020,
0604     NX_CHECKSTOP_DMA_CH3_INVAL_STATE_ERR    = 0x00000040,
0605     NX_CHECKSTOP_DMA_CH4_INVAL_STATE_ERR    = 0x00000080,
0606     NX_CHECKSTOP_DMA_CH5_INVAL_STATE_ERR    = 0x00000100,
0607     NX_CHECKSTOP_DMA_CH6_INVAL_STATE_ERR    = 0x00000200,
0608     NX_CHECKSTOP_DMA_CH7_INVAL_STATE_ERR    = 0x00000400,
0609     NX_CHECKSTOP_DMA_CRB_UE         = 0x00000800,
0610     NX_CHECKSTOP_DMA_CRB_SUE        = 0x00001000,
0611     NX_CHECKSTOP_PBI_ISN_UE         = 0x00002000,
0612 };
0613 
0614 struct OpalHMIEvent {
0615     uint8_t     version;    /* 0x00 */
0616     uint8_t     severity;   /* 0x01 */
0617     uint8_t     type;       /* 0x02 */
0618     uint8_t     disposition;    /* 0x03 */
0619     uint8_t     reserved_1[4];  /* 0x04 */
0620 
0621     __be64      hmer;
0622     /* TFMR register. Valid only for TFAC and TFMR_PARITY error type. */
0623     __be64      tfmr;
0624 
0625     /* version 2 and later */
0626     union {
0627         /*
0628          * checkstop info (Core/NX).
0629          * Valid for OpalHMI_ERROR_MALFUNC_ALERT.
0630          */
0631         struct {
0632             uint8_t xstop_type; /* enum OpalHMI_XstopType */
0633             uint8_t reserved_1[3];
0634             __be32  xstop_reason;
0635             union {
0636                 __be32 pir; /* for CHECKSTOP_TYPE_CORE */
0637                 __be32 chip_id; /* for CHECKSTOP_TYPE_NX */
0638             } u;
0639         } xstop_error;
0640     } u;
0641 };
0642 
0643 /* OPAL_HANDLE_HMI2 out_flags */
0644 enum {
0645     OPAL_HMI_FLAGS_TB_RESYNC    = (1ull << 0), /* Timebase has been resynced */
0646     OPAL_HMI_FLAGS_DEC_LOST     = (1ull << 1), /* DEC lost, needs to be reprogrammed */
0647     OPAL_HMI_FLAGS_HDEC_LOST    = (1ull << 2), /* HDEC lost, needs to be reprogrammed */
0648     OPAL_HMI_FLAGS_TOD_TB_FAIL  = (1ull << 3), /* TOD/TB recovery failed. */
0649     OPAL_HMI_FLAGS_NEW_EVENT    = (1ull << 63), /* An event has been created */
0650 };
0651 
0652 enum {
0653     OPAL_P7IOC_DIAG_TYPE_NONE   = 0,
0654     OPAL_P7IOC_DIAG_TYPE_RGC    = 1,
0655     OPAL_P7IOC_DIAG_TYPE_BI     = 2,
0656     OPAL_P7IOC_DIAG_TYPE_CI     = 3,
0657     OPAL_P7IOC_DIAG_TYPE_MISC   = 4,
0658     OPAL_P7IOC_DIAG_TYPE_I2C    = 5,
0659     OPAL_P7IOC_DIAG_TYPE_LAST   = 6
0660 };
0661 
0662 struct OpalIoP7IOCErrorData {
0663     __be16 type;
0664 
0665     /* GEM */
0666     __be64 gemXfir;
0667     __be64 gemRfir;
0668     __be64 gemRirqfir;
0669     __be64 gemMask;
0670     __be64 gemRwof;
0671 
0672     /* LEM */
0673     __be64 lemFir;
0674     __be64 lemErrMask;
0675     __be64 lemAction0;
0676     __be64 lemAction1;
0677     __be64 lemWof;
0678 
0679     union {
0680         struct OpalIoP7IOCRgcErrorData {
0681             __be64 rgcStatus;   /* 3E1C10 */
0682             __be64 rgcLdcp;     /* 3E1C18 */
0683         }rgc;
0684         struct OpalIoP7IOCBiErrorData {
0685             __be64 biLdcp0;     /* 3C0100, 3C0118 */
0686             __be64 biLdcp1;     /* 3C0108, 3C0120 */
0687             __be64 biLdcp2;     /* 3C0110, 3C0128 */
0688             __be64 biFenceStatus;   /* 3C0130, 3C0130 */
0689 
0690             uint8_t biDownbound;    /* BI Downbound or Upbound */
0691         }bi;
0692         struct OpalIoP7IOCCiErrorData {
0693             __be64 ciPortStatus;    /* 3Dn008 */
0694             __be64 ciPortLdcp;  /* 3Dn010 */
0695 
0696             uint8_t ciPort;     /* Index of CI port: 0/1 */
0697         }ci;
0698     };
0699 };
0700 
0701 /**
0702  * This structure defines the overlay which will be used to store PHB error
0703  * data upon request.
0704  */
0705 enum {
0706     OPAL_PHB_ERROR_DATA_VERSION_1 = 1,
0707 };
0708 
0709 enum {
0710     OPAL_PHB_ERROR_DATA_TYPE_P7IOC = 1,
0711     OPAL_PHB_ERROR_DATA_TYPE_PHB3 = 2,
0712     OPAL_PHB_ERROR_DATA_TYPE_PHB4 = 3
0713 };
0714 
0715 enum {
0716     OPAL_P7IOC_NUM_PEST_REGS = 128,
0717     OPAL_PHB3_NUM_PEST_REGS = 256,
0718     OPAL_PHB4_NUM_PEST_REGS = 512
0719 };
0720 
0721 struct OpalIoPhbErrorCommon {
0722     __be32 version;
0723     __be32 ioType;
0724     __be32 len;
0725 };
0726 
0727 struct OpalIoP7IOCPhbErrorData {
0728     struct OpalIoPhbErrorCommon common;
0729 
0730     __be32 brdgCtl;
0731 
0732     // P7IOC utl regs
0733     __be32 portStatusReg;
0734     __be32 rootCmplxStatus;
0735     __be32 busAgentStatus;
0736 
0737     // P7IOC cfg regs
0738     __be32 deviceStatus;
0739     __be32 slotStatus;
0740     __be32 linkStatus;
0741     __be32 devCmdStatus;
0742     __be32 devSecStatus;
0743 
0744     // cfg AER regs
0745     __be32 rootErrorStatus;
0746     __be32 uncorrErrorStatus;
0747     __be32 corrErrorStatus;
0748     __be32 tlpHdr1;
0749     __be32 tlpHdr2;
0750     __be32 tlpHdr3;
0751     __be32 tlpHdr4;
0752     __be32 sourceId;
0753 
0754     __be32 rsv3;
0755 
0756     // Record data about the call to allocate a buffer.
0757     __be64 errorClass;
0758     __be64 correlator;
0759 
0760     //P7IOC MMIO Error Regs
0761     __be64 p7iocPlssr;                // n120
0762     __be64 p7iocCsr;                  // n110
0763     __be64 lemFir;                    // nC00
0764     __be64 lemErrorMask;              // nC18
0765     __be64 lemWOF;                    // nC40
0766     __be64 phbErrorStatus;            // nC80
0767     __be64 phbFirstErrorStatus;       // nC88
0768     __be64 phbErrorLog0;              // nCC0
0769     __be64 phbErrorLog1;              // nCC8
0770     __be64 mmioErrorStatus;           // nD00
0771     __be64 mmioFirstErrorStatus;      // nD08
0772     __be64 mmioErrorLog0;             // nD40
0773     __be64 mmioErrorLog1;             // nD48
0774     __be64 dma0ErrorStatus;           // nD80
0775     __be64 dma0FirstErrorStatus;      // nD88
0776     __be64 dma0ErrorLog0;             // nDC0
0777     __be64 dma0ErrorLog1;             // nDC8
0778     __be64 dma1ErrorStatus;           // nE00
0779     __be64 dma1FirstErrorStatus;      // nE08
0780     __be64 dma1ErrorLog0;             // nE40
0781     __be64 dma1ErrorLog1;             // nE48
0782     __be64 pestA[OPAL_P7IOC_NUM_PEST_REGS];
0783     __be64 pestB[OPAL_P7IOC_NUM_PEST_REGS];
0784 };
0785 
0786 struct OpalIoPhb3ErrorData {
0787     struct OpalIoPhbErrorCommon common;
0788 
0789     __be32 brdgCtl;
0790 
0791     /* PHB3 UTL regs */
0792     __be32 portStatusReg;
0793     __be32 rootCmplxStatus;
0794     __be32 busAgentStatus;
0795 
0796     /* PHB3 cfg regs */
0797     __be32 deviceStatus;
0798     __be32 slotStatus;
0799     __be32 linkStatus;
0800     __be32 devCmdStatus;
0801     __be32 devSecStatus;
0802 
0803     /* cfg AER regs */
0804     __be32 rootErrorStatus;
0805     __be32 uncorrErrorStatus;
0806     __be32 corrErrorStatus;
0807     __be32 tlpHdr1;
0808     __be32 tlpHdr2;
0809     __be32 tlpHdr3;
0810     __be32 tlpHdr4;
0811     __be32 sourceId;
0812 
0813     __be32 rsv3;
0814 
0815     /* Record data about the call to allocate a buffer */
0816     __be64 errorClass;
0817     __be64 correlator;
0818 
0819     /* PHB3 MMIO Error Regs */
0820     __be64 nFir;            /* 000 */
0821     __be64 nFirMask;        /* 003 */
0822     __be64 nFirWOF;     /* 008 */
0823     __be64 phbPlssr;        /* 120 */
0824     __be64 phbCsr;      /* 110 */
0825     __be64 lemFir;      /* C00 */
0826     __be64 lemErrorMask;        /* C18 */
0827     __be64 lemWOF;      /* C40 */
0828     __be64 phbErrorStatus;  /* C80 */
0829     __be64 phbFirstErrorStatus; /* C88 */
0830     __be64 phbErrorLog0;        /* CC0 */
0831     __be64 phbErrorLog1;        /* CC8 */
0832     __be64 mmioErrorStatus; /* D00 */
0833     __be64 mmioFirstErrorStatus;    /* D08 */
0834     __be64 mmioErrorLog0;       /* D40 */
0835     __be64 mmioErrorLog1;       /* D48 */
0836     __be64 dma0ErrorStatus; /* D80 */
0837     __be64 dma0FirstErrorStatus;    /* D88 */
0838     __be64 dma0ErrorLog0;       /* DC0 */
0839     __be64 dma0ErrorLog1;       /* DC8 */
0840     __be64 dma1ErrorStatus; /* E00 */
0841     __be64 dma1FirstErrorStatus;    /* E08 */
0842     __be64 dma1ErrorLog0;       /* E40 */
0843     __be64 dma1ErrorLog1;       /* E48 */
0844     __be64 pestA[OPAL_PHB3_NUM_PEST_REGS];
0845     __be64 pestB[OPAL_PHB3_NUM_PEST_REGS];
0846 };
0847 
0848 struct OpalIoPhb4ErrorData {
0849     struct OpalIoPhbErrorCommon common;
0850 
0851     __be32 brdgCtl;
0852 
0853     /* PHB4 cfg regs */
0854     __be32 deviceStatus;
0855     __be32 slotStatus;
0856     __be32 linkStatus;
0857     __be32 devCmdStatus;
0858     __be32 devSecStatus;
0859 
0860     /* cfg AER regs */
0861     __be32 rootErrorStatus;
0862     __be32 uncorrErrorStatus;
0863     __be32 corrErrorStatus;
0864     __be32 tlpHdr1;
0865     __be32 tlpHdr2;
0866     __be32 tlpHdr3;
0867     __be32 tlpHdr4;
0868     __be32 sourceId;
0869 
0870     /* PHB4 ETU Error Regs */
0871     __be64 nFir;                /* 000 */
0872     __be64 nFirMask;            /* 003 */
0873     __be64 nFirWOF;             /* 008 */
0874     __be64 phbPlssr;            /* 120 */
0875     __be64 phbCsr;              /* 110 */
0876     __be64 lemFir;              /* C00 */
0877     __be64 lemErrorMask;            /* C18 */
0878     __be64 lemWOF;              /* C40 */
0879     __be64 phbErrorStatus;          /* C80 */
0880     __be64 phbFirstErrorStatus;     /* C88 */
0881     __be64 phbErrorLog0;            /* CC0 */
0882     __be64 phbErrorLog1;            /* CC8 */
0883     __be64 phbTxeErrorStatus;       /* D00 */
0884     __be64 phbTxeFirstErrorStatus;      /* D08 */
0885     __be64 phbTxeErrorLog0;         /* D40 */
0886     __be64 phbTxeErrorLog1;         /* D48 */
0887     __be64 phbRxeArbErrorStatus;        /* D80 */
0888     __be64 phbRxeArbFirstErrorStatus;   /* D88 */
0889     __be64 phbRxeArbErrorLog0;      /* DC0 */
0890     __be64 phbRxeArbErrorLog1;      /* DC8 */
0891     __be64 phbRxeMrgErrorStatus;        /* E00 */
0892     __be64 phbRxeMrgFirstErrorStatus;   /* E08 */
0893     __be64 phbRxeMrgErrorLog0;      /* E40 */
0894     __be64 phbRxeMrgErrorLog1;      /* E48 */
0895     __be64 phbRxeTceErrorStatus;        /* E80 */
0896     __be64 phbRxeTceFirstErrorStatus;   /* E88 */
0897     __be64 phbRxeTceErrorLog0;      /* EC0 */
0898     __be64 phbRxeTceErrorLog1;      /* EC8 */
0899 
0900     /* PHB4 REGB Error Regs */
0901     __be64 phbPblErrorStatus;       /* 1900 */
0902     __be64 phbPblFirstErrorStatus;      /* 1908 */
0903     __be64 phbPblErrorLog0;         /* 1940 */
0904     __be64 phbPblErrorLog1;         /* 1948 */
0905     __be64 phbPcieDlpErrorLog1;     /* 1AA0 */
0906     __be64 phbPcieDlpErrorLog2;     /* 1AA8 */
0907     __be64 phbPcieDlpErrorStatus;       /* 1AB0 */
0908     __be64 phbRegbErrorStatus;      /* 1C00 */
0909     __be64 phbRegbFirstErrorStatus;     /* 1C08 */
0910     __be64 phbRegbErrorLog0;        /* 1C40 */
0911     __be64 phbRegbErrorLog1;        /* 1C48 */
0912 
0913     __be64 pestA[OPAL_PHB4_NUM_PEST_REGS];
0914     __be64 pestB[OPAL_PHB4_NUM_PEST_REGS];
0915 };
0916 
0917 enum {
0918     OPAL_REINIT_CPUS_HILE_BE    = (1 << 0),
0919     OPAL_REINIT_CPUS_HILE_LE    = (1 << 1),
0920 
0921     /* These two define the base MMU mode of the host on P9
0922      *
0923      * On P9 Nimbus DD2.0 and Cumlus (and later), KVM can still
0924      * create hash guests in "radix" mode with care (full core
0925      * switch only).
0926      */
0927     OPAL_REINIT_CPUS_MMU_HASH   = (1 << 2),
0928     OPAL_REINIT_CPUS_MMU_RADIX  = (1 << 3),
0929 
0930     OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED = (1 << 4),
0931 };
0932 
0933 typedef struct oppanel_line {
0934     __be64 line;
0935     __be64 line_len;
0936 } oppanel_line_t;
0937 
0938 enum opal_prd_msg_type {
0939     OPAL_PRD_MSG_TYPE_INIT = 0, /* HBRT --> OPAL */
0940     OPAL_PRD_MSG_TYPE_FINI,     /* HBRT/kernel --> OPAL */
0941     OPAL_PRD_MSG_TYPE_ATTN,     /* HBRT <-- OPAL */
0942     OPAL_PRD_MSG_TYPE_ATTN_ACK, /* HBRT --> OPAL */
0943     OPAL_PRD_MSG_TYPE_OCC_ERROR,    /* HBRT <-- OPAL */
0944     OPAL_PRD_MSG_TYPE_OCC_RESET,    /* HBRT <-- OPAL */
0945 };
0946 
0947 struct opal_prd_msg_header {
0948     uint8_t     type;
0949     uint8_t     pad[1];
0950     __be16      size;
0951 };
0952 
0953 struct opal_prd_msg;
0954 
0955 #define OCC_RESET                       0
0956 #define OCC_LOAD                        1
0957 #define OCC_THROTTLE                    2
0958 #define OCC_MAX_THROTTLE_STATUS         5
0959 
0960 struct opal_occ_msg {
0961     __be64 type;
0962     __be64 chip;
0963     __be64 throttle_status;
0964 };
0965 
0966 /*
0967  * SG entries
0968  *
0969  * WARNING: The current implementation requires each entry
0970  * to represent a block that is 4k aligned *and* each block
0971  * size except the last one in the list to be as well.
0972  */
0973 struct opal_sg_entry {
0974     __be64 data;
0975     __be64 length;
0976 };
0977 
0978 /*
0979  * Candidate image SG list.
0980  *
0981  * length = VER | length
0982  */
0983 struct opal_sg_list {
0984     __be64 length;
0985     __be64 next;
0986     struct opal_sg_entry entry[];
0987 };
0988 
0989 /*
0990  * Dump region ID range usable by the OS
0991  */
0992 #define OPAL_DUMP_REGION_HOST_START     0x80
0993 #define OPAL_DUMP_REGION_LOG_BUF        0x80
0994 #define OPAL_DUMP_REGION_HOST_END       0xFF
0995 
0996 /* CAPI modes for PHB */
0997 enum {
0998     OPAL_PHB_CAPI_MODE_PCIE     = 0,
0999     OPAL_PHB_CAPI_MODE_CAPI     = 1,
1000     OPAL_PHB_CAPI_MODE_SNOOP_OFF    = 2,
1001     OPAL_PHB_CAPI_MODE_SNOOP_ON = 3,
1002     OPAL_PHB_CAPI_MODE_DMA      = 4,
1003     OPAL_PHB_CAPI_MODE_DMA_TVT1 = 5,
1004 };
1005 
1006 /* OPAL I2C request */
1007 struct opal_i2c_request {
1008     uint8_t type;
1009 #define OPAL_I2C_RAW_READ   0
1010 #define OPAL_I2C_RAW_WRITE  1
1011 #define OPAL_I2C_SM_READ    2
1012 #define OPAL_I2C_SM_WRITE   3
1013     uint8_t flags;
1014 #define OPAL_I2C_ADDR_10    0x01    /* Not supported yet */
1015     uint8_t subaddr_sz;     /* Max 4 */
1016     uint8_t reserved;
1017     __be16 addr;            /* 7 or 10 bit address */
1018     __be16 reserved2;
1019     __be32 subaddr;     /* Sub-address if any */
1020     __be32 size;            /* Data size */
1021     __be64 buffer_ra;       /* Buffer real address */
1022 };
1023 
1024 /*
1025  * EPOW status sharing (OPAL and the host)
1026  *
1027  * The host will pass on OPAL, a buffer of length OPAL_SYSEPOW_MAX
1028  * with individual elements being 16 bits wide to fetch the system
1029  * wide EPOW status. Each element in the buffer will contain the
1030  * EPOW status in it's bit representation for a particular EPOW sub
1031  * class as defined here. So multiple detailed EPOW status bits
1032  * specific for any sub class can be represented in a single buffer
1033  * element as it's bit representation.
1034  */
1035 
1036 /* System EPOW type */
1037 enum OpalSysEpow {
1038     OPAL_SYSEPOW_POWER  = 0,    /* Power EPOW */
1039     OPAL_SYSEPOW_TEMP   = 1,    /* Temperature EPOW */
1040     OPAL_SYSEPOW_COOLING    = 2,    /* Cooling EPOW */
1041     OPAL_SYSEPOW_MAX    = 3,    /* Max EPOW categories */
1042 };
1043 
1044 /* Power EPOW */
1045 enum OpalSysPower {
1046     OPAL_SYSPOWER_UPS   = 0x0001, /* System on UPS power */
1047     OPAL_SYSPOWER_CHNG  = 0x0002, /* System power config change */
1048     OPAL_SYSPOWER_FAIL  = 0x0004, /* System impending power failure */
1049     OPAL_SYSPOWER_INCL  = 0x0008, /* System incomplete power */
1050 };
1051 
1052 /* Temperature EPOW */
1053 enum OpalSysTemp {
1054     OPAL_SYSTEMP_AMB    = 0x0001, /* System over ambient temperature */
1055     OPAL_SYSTEMP_INT    = 0x0002, /* System over internal temperature */
1056     OPAL_SYSTEMP_HMD    = 0x0004, /* System over ambient humidity */
1057 };
1058 
1059 /* Cooling EPOW */
1060 enum OpalSysCooling {
1061     OPAL_SYSCOOL_INSF   = 0x0001, /* System insufficient cooling */
1062 };
1063 
1064 /* Argument to OPAL_CEC_REBOOT2() */
1065 enum {
1066     OPAL_REBOOT_NORMAL      = 0,
1067     OPAL_REBOOT_PLATFORM_ERROR  = 1,
1068     OPAL_REBOOT_FULL_IPL        = 2,
1069     OPAL_REBOOT_MPIPL       = 3,
1070     OPAL_REBOOT_FAST        = 4,
1071 };
1072 
1073 /* Argument to OPAL_PCI_TCE_KILL */
1074 enum {
1075     OPAL_PCI_TCE_KILL_PAGES,
1076     OPAL_PCI_TCE_KILL_PE,
1077     OPAL_PCI_TCE_KILL_ALL,
1078 };
1079 
1080 /* The xive operation mode indicates the active "API" and
1081  * corresponds to the "mode" parameter of the opal_xive_reset()
1082  * call
1083  */
1084 enum {
1085     OPAL_XIVE_MODE_EMU  = 0,
1086     OPAL_XIVE_MODE_EXPL = 1,
1087 };
1088 
1089 /* Flags for OPAL_XIVE_GET_IRQ_INFO */
1090 enum {
1091     OPAL_XIVE_IRQ_TRIGGER_PAGE  = 0x00000001,
1092     OPAL_XIVE_IRQ_STORE_EOI     = 0x00000002,
1093     OPAL_XIVE_IRQ_LSI       = 0x00000004,
1094     OPAL_XIVE_IRQ_SHIFT_BUG     = 0x00000008, /* P9 DD1.0 workaround */
1095     OPAL_XIVE_IRQ_MASK_VIA_FW   = 0x00000010, /* P9 DD1.0 workaround */
1096     OPAL_XIVE_IRQ_EOI_VIA_FW    = 0x00000020, /* P9 DD1.0 workaround */
1097     OPAL_XIVE_IRQ_STORE_EOI2    = 0x00000040,
1098 };
1099 
1100 /* Flags for OPAL_XIVE_GET/SET_QUEUE_INFO */
1101 enum {
1102     OPAL_XIVE_EQ_ENABLED        = 0x00000001,
1103     OPAL_XIVE_EQ_ALWAYS_NOTIFY  = 0x00000002,
1104     OPAL_XIVE_EQ_ESCALATE       = 0x00000004,
1105 };
1106 
1107 /* Flags for OPAL_XIVE_GET/SET_VP_INFO */
1108 enum {
1109     OPAL_XIVE_VP_ENABLED        = 0x00000001,
1110     OPAL_XIVE_VP_SINGLE_ESCALATION  = 0x00000002,
1111 };
1112 
1113 /* "Any chip" replacement for chip ID for allocation functions */
1114 enum {
1115     OPAL_XIVE_ANY_CHIP      = 0xffffffff,
1116 };
1117 
1118 /* Xive sync options */
1119 enum {
1120     /* This bits are cumulative, arg is a girq */
1121     XIVE_SYNC_EAS           = 0x00000001, /* Sync irq source */
1122     XIVE_SYNC_QUEUE         = 0x00000002, /* Sync irq target */
1123 };
1124 
1125 /* Dump options */
1126 enum {
1127     XIVE_DUMP_TM_HYP    = 0,
1128     XIVE_DUMP_TM_POOL   = 1,
1129     XIVE_DUMP_TM_OS     = 2,
1130     XIVE_DUMP_TM_USER   = 3,
1131     XIVE_DUMP_VP        = 4,
1132     XIVE_DUMP_EMU_STATE = 5,
1133 };
1134 
1135 /* "type" argument options for OPAL_IMC_COUNTERS_* calls */
1136 enum {
1137     OPAL_IMC_COUNTERS_NEST = 1,
1138     OPAL_IMC_COUNTERS_CORE = 2,
1139     OPAL_IMC_COUNTERS_TRACE = 3,
1140 };
1141 
1142 
1143 /* PCI p2p descriptor */
1144 #define OPAL_PCI_P2P_ENABLE     0x1
1145 #define OPAL_PCI_P2P_LOAD       0x2
1146 #define OPAL_PCI_P2P_STORE      0x4
1147 
1148 /* MPIPL update operations */
1149 enum opal_mpipl_ops {
1150     OPAL_MPIPL_ADD_RANGE            = 0,
1151     OPAL_MPIPL_REMOVE_RANGE         = 1,
1152     OPAL_MPIPL_REMOVE_ALL           = 2,
1153     OPAL_MPIPL_FREE_PRESERVED_MEMORY    = 3,
1154 };
1155 
1156 /* Tag will point to various metadata area. Kernel will
1157  * use tag to get metadata value.
1158  */
1159 enum opal_mpipl_tags {
1160     OPAL_MPIPL_TAG_CPU  = 0,
1161     OPAL_MPIPL_TAG_OPAL = 1,
1162     OPAL_MPIPL_TAG_KERNEL   = 2,
1163     OPAL_MPIPL_TAG_BOOT_MEM = 3,
1164 };
1165 
1166 /* Preserved memory details */
1167 struct opal_mpipl_region {
1168     __be64  src;
1169     __be64  dest;
1170     __be64  size;
1171 };
1172 
1173 /* Structure version */
1174 #define OPAL_MPIPL_VERSION      0x01
1175 
1176 struct opal_mpipl_fadump {
1177     u8  version;
1178     u8  reserved[7];
1179     __be32  crashing_pir;   /* OPAL crashing CPU PIR */
1180     __be32  cpu_data_version;
1181     __be32  cpu_data_size;
1182     __be32  region_cnt;
1183     struct  opal_mpipl_region region[];
1184 } __packed;
1185 
1186 #endif /* __ASSEMBLY__ */
1187 
1188 #endif /* __OPAL_API_H */