Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 1 | /* |
| 2 | // Copyright (c) 2018 Intel Corporation |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 19 | enum class IPMINetfnIntelOEMGeneralCmd |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 20 | { |
| 21 | cmdSetBIOSID = 0x26, |
| 22 | cmdGetOEMDeviceInfo = 0x27, |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 23 | cmdGetAICSlotFRUIDSlotPosRecords = 0x31, |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 24 | cmdSetSystemGUID = 0x41, |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 25 | cmdSetPowerRestoreDelay = 0x54, |
| 26 | cmdGetPowerRestoreDelay = 0x55, |
Yong Li | 703922d | 2018-11-06 13:25:31 +0800 | [diff] [blame] | 27 | cmdSetShutdownPolicy = 0x60, |
| 28 | cmdGetShutdownPolicy = 0x62, |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 29 | cmdGetChassisIdentifier = 0x92, |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 30 | cmdGetProcessorErrConfig = 0x9A, |
| 31 | cmdSetProcessorErrConfig = 0x9B, |
Kuiying Wang | 45f0498 | 2018-12-26 09:23:08 +0800 | [diff] [blame] | 32 | cmdGetLEDStatus = 0xB0, |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 33 | }; |
| 34 | |
Yong Li | 23737fe | 2019-02-19 08:49:55 +0800 | [diff] [blame] | 35 | enum class IPMINetfnIntelOEMPlatformCmd |
| 36 | { |
| 37 | cmdCfgHostSerialPortSpeed = 0x90, |
| 38 | }; |
| 39 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 40 | enum class IPMIIntelOEMReturnCodes |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 41 | { |
| 42 | ipmiCCPayloadActive = 0x80, |
| 43 | ipmiCCInvalidPCIESlotID = 0x80, |
| 44 | ipmiCCParameterNotSupported = 0x80, |
| 45 | ipmiCCPayloadAlreadyDeactivated = 0x80, |
| 46 | ipmiCCSetInProcess = 0x81, |
| 47 | ipmiCCPayloadDisable = 0x81, |
| 48 | ipmiCCLostArbitration = 0x81, |
| 49 | ipmiCCInvalidCablePortIndex = 0x81, |
| 50 | ipmiCCHealthStatusNotAvailable = 0x81, |
| 51 | ipmiCCBusError = 0x82, |
| 52 | ipmiCCReadOnly = 0x82, |
| 53 | ipmiCCWriteOnly = 0x82, |
| 54 | ipmiCCNoCablePresent = 0x82, |
| 55 | ipmiCCDataCollectionInProgress = 0x82, |
| 56 | ipmiCCPayloadActivationLimitReached = 0x82, |
| 57 | ipmiCCNACKOnWrite = 0x83, |
| 58 | ipmiCCDataCollectionFailed = 0x83, |
| 59 | ipmiCCCanNotActivateWithEncrption = 0x83, |
| 60 | ipmiCCCanNotActivateWithoutEncryption = 0x84, |
| 61 | ipmiCCInvalidChecksum = 0x85, |
| 62 | ipmiCCNoCabledPCIEPortsAvailable = 0xC2, |
| 63 | |
| 64 | }; |
| 65 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 66 | enum class IPMIReturnCodeExt |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 67 | { |
| 68 | ipmiCCInvalidLUN = 0xC2, |
| 69 | ipmiCCTimeout = 0xC3, |
| 70 | ipmiCCStorageLeak = 0xC4, |
| 71 | ipmiCCRequestDataTruncated = 0xC6, |
| 72 | ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8, |
| 73 | ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA, |
| 74 | ipmiCCRequestSensorDataRecordNotFound = 0xCB, |
| 75 | ipmiCCDestinationUnavailable = 0xD3, |
| 76 | ipmiCCParamterNotSupportInPresentState = 0xD5, |
| 77 | }; |
| 78 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 79 | constexpr const uint8_t netfunIntelAppOEM = 0x3E; |
| 80 | static constexpr ipmi_netfn_t netfnIntcOEMGeneral = |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 81 | NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem |
| 82 | // general". The code is 0x30 |
Yong Li | 23737fe | 2019-02-19 08:49:55 +0800 | [diff] [blame] | 83 | |
| 84 | // Intel OEM Platform code is 0x32 |
| 85 | static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM; |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 86 | static constexpr const uint8_t maxBIOSIDLength = 0xFF; |
| 87 | static constexpr const uint8_t maxCPUNum = 4; |
| 88 | static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios"; |
| 89 | static constexpr const char* biosIntf = |
| 90 | "xyz.openbmc_project.Inventory.Item.Bios"; |
| 91 | static constexpr const char* biosProp = "BiosId"; |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 92 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 93 | static constexpr const char* powerRestoreDelayObjPath = |
| 94 | "/xyz/openbmc_project/control/power_restore_delay"; |
| 95 | static constexpr const char* powerRestoreDelayIntf = |
| 96 | "xyz.openbmc_project.Control.Power.RestoreDelay"; |
| 97 | static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay"; |
| 98 | static constexpr const char* processorErrConfigObjPath = |
| 99 | "/xyz/openbmc_project/control/processor_error_config"; |
| 100 | static constexpr const char* processorErrConfigIntf = |
| 101 | "xyz.openbmc_project.Control.Processor.ErrConfig"; |
| 102 | |
Yong Li | 703922d | 2018-11-06 13:25:31 +0800 | [diff] [blame] | 103 | static constexpr const char* postCodesObjPath = |
| 104 | "/xyz/openbmc_project/State/Boot/PostCode"; |
| 105 | static constexpr const char* postCodesIntf = |
| 106 | "xyz.openbmc_project.State.Boot.PostCode"; |
| 107 | |
Kuiying Wang | 45f0498 | 2018-12-26 09:23:08 +0800 | [diff] [blame] | 108 | static constexpr const char* identifyLEDObjPath = |
| 109 | "/xyz/openbmc_project/led/physical/identify"; |
| 110 | static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical"; |
| 111 | static constexpr const char* statusAmberObjPath = |
| 112 | "/xyz/openbmc_project/led/physical/status_amber"; |
| 113 | static constexpr const char* statusGreenObjPath = |
| 114 | "/xyz/openbmc_project/led/physical/status_green"; |
| 115 | |
Yong Li | 703922d | 2018-11-06 13:25:31 +0800 | [diff] [blame] | 116 | static constexpr const uint8_t noShutdownOnOCOT = 0; |
| 117 | static constexpr const uint8_t shutdownOnOCOT = 1; |
| 118 | static constexpr const uint8_t noShutdownPolicySupported = 0; |
| 119 | static constexpr const uint8_t shutdownPolicySupported = 1; |
| 120 | static constexpr const char* oemShutdownPolicyIntf = |
| 121 | "xyz.openbmc_project.Control.ShutdownPolicy"; |
| 122 | static constexpr const char* oemShutdownPolicyObjPath = |
| 123 | "/xyz/openbmc_project/control/shutdown_policy_config"; |
| 124 | static constexpr const char* oemShutdownPolicyObjPathProp = "Policy"; |
| 125 | |
Yong Li | 23737fe | 2019-02-19 08:49:55 +0800 | [diff] [blame] | 126 | static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv"; |
| 127 | static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv"; |
| 128 | static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg"; |
| 129 | |
| 130 | static constexpr const uint8_t getHostSerialCfgCmd = 0; |
| 131 | static constexpr const uint8_t setHostSerialCfgCmd = 1; |
| 132 | |
| 133 | // parameters: |
| 134 | // 0: host serial port 1 and 2 normal speed |
| 135 | // 1: host serial port 1 high spend, port 2 normal speed |
| 136 | // 2: host serial port 1 normal spend, port 2 high speed |
| 137 | // 3: host serial port 1 and 2 high speed |
| 138 | static constexpr const uint8_t HostSerialCfgParamMax = 3; |
| 139 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 140 | enum class IPMINetfnIntelOEMAppCmd |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 141 | { |
| 142 | mdrStatus = 0x20, |
| 143 | mdrComplete = 0x21, |
| 144 | mdrEvent = 0x22, |
| 145 | mdrRead = 0x23, |
| 146 | mdrWrite = 0x24, |
| 147 | mdrLock = 0x25, |
| 148 | mdr2AgentStatus = 0x30, |
| 149 | mdr2GetDir = 0x31, |
| 150 | mdr2GetDataInfo = 0x32, |
| 151 | mdr2LockData = 0x33, |
| 152 | mdr2UnlockData = 0x34, |
| 153 | mdr2GetDataBlock = 0x35, |
| 154 | mdr2SendDir = 0x38, |
| 155 | mdr2SendDataInfoOffer = 0x39, |
| 156 | mdr2SendDataInfo = 0x3a, |
| 157 | mdr2DataStart = 0x3b, |
| 158 | mdr2DataDone = 0x3c, |
| 159 | mdr2SendDataBlock = 0x3d, |
| 160 | }; |
| 161 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 162 | enum class OEMDevEntityType |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 163 | { |
| 164 | biosId, |
| 165 | devVer, |
| 166 | sdrVer, |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 167 | }; |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 168 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 169 | #pragma pack(push, 1) |
| 170 | struct GUIDData |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 171 | { |
| 172 | uint8_t node1; |
| 173 | uint8_t node2; |
| 174 | uint8_t node3; |
| 175 | uint8_t node4; |
| 176 | uint8_t node5; |
| 177 | uint8_t node6; |
| 178 | uint8_t clock1; |
| 179 | uint8_t clock2; |
| 180 | uint8_t timeHigh1; |
| 181 | uint8_t timeHigh2; |
| 182 | uint8_t timeMid1; |
| 183 | uint8_t timeMid2; |
| 184 | uint8_t timeLow1; |
| 185 | uint8_t timeLow2; |
| 186 | uint8_t timeLow3; |
| 187 | uint8_t timeLow4; |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 188 | }; |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 189 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 190 | struct DeviceInfo |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 191 | { |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 192 | uint8_t biosIDLength; |
| 193 | uint8_t biosId[maxBIOSIDLength]; |
| 194 | }; |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 195 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 196 | struct SetPowerRestoreDelayReq |
| 197 | { |
| 198 | uint8_t byteMSB; |
| 199 | uint8_t byteLSB; |
| 200 | }; |
| 201 | |
| 202 | struct GetPowerRestoreDelayRes |
| 203 | { |
| 204 | uint8_t byteMSB; |
| 205 | uint8_t byteLSB; |
| 206 | }; |
| 207 | |
| 208 | struct GetOemDeviceInfoReq |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 209 | { |
| 210 | uint8_t entityType; |
| 211 | uint8_t countToRead; |
| 212 | uint8_t offset; |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 213 | }; |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 214 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 215 | struct GetOemDeviceInfoRes |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 216 | { |
| 217 | uint8_t resDatalen; |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 218 | uint8_t data[maxBIOSIDLength]; |
| 219 | }; |
| 220 | |
| 221 | struct SetProcessorErrConfigReq |
| 222 | { |
| 223 | uint8_t resetCfg; // Reset Configuration |
| 224 | // [0]: CATERR Reset Enabled |
| 225 | // 0b: Disabled |
| 226 | // 1b: Enabled |
| 227 | // [1]: ERR2 Reset Enabled |
| 228 | // 0b: Disabled |
| 229 | // 1b: Enabled |
| 230 | // [7:2]: Reserved |
| 231 | uint8_t reserved; // Reserved |
| 232 | uint8_t |
| 233 | resetErrorOccurrenceCounts; // Reset Error Occurrence Counts |
| 234 | //[0]: Reset CPU Error Counts |
| 235 | // 0b: Keep CPU Error Counts |
| 236 | // 1b: Reset all CPU Error Counts to zero |
| 237 | //[7:1]: Reserved |
| 238 | }; |
| 239 | |
| 240 | struct GetProcessorErrConfigRes |
| 241 | { |
| 242 | uint8_t resetCfg; // Reset Configuration |
| 243 | // [0]: CATERR Reset Enabled |
| 244 | // 0b: Disabled |
| 245 | // 1b: Enabled |
| 246 | // [1]: ERR2 Reset Enabled |
| 247 | // 0b: Disabled |
| 248 | // 1b: Enabled |
| 249 | // [7:2]: Reserved |
| 250 | uint8_t reserved; // Reserved |
| 251 | char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy |
| 252 | // socket CPU CPU CATERR (Core Error) |
| 253 | // occurrence |
| 254 | // [5:0]: Error Occurrence Count |
| 255 | // [7:6]: CPU Status |
| 256 | // 00b: Disabled |
| 257 | // 01b: Enabled |
| 258 | // 11b: Not Present |
| 259 | }; |
Yong Li | 703922d | 2018-11-06 13:25:31 +0800 | [diff] [blame] | 260 | |
| 261 | struct GetOEMShutdownPolicyRes |
| 262 | { |
| 263 | uint8_t policy; |
| 264 | uint8_t policySupport; |
| 265 | }; |
Kuiying Wang | 45f0498 | 2018-12-26 09:23:08 +0800 | [diff] [blame] | 266 | |
Yong Li | 23737fe | 2019-02-19 08:49:55 +0800 | [diff] [blame] | 267 | struct CfgHostSerialReq |
| 268 | { |
| 269 | uint8_t command; |
| 270 | uint8_t parameter; |
| 271 | }; |
Kuiying Wang | 45f0498 | 2018-12-26 09:23:08 +0800 | [diff] [blame] | 272 | #pragma pack(pop) |