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 | |
Suryakanth Sekar | d509eb9 | 2018-11-15 17:44:11 +0530 | [diff] [blame] | 19 | #include <user_channel/user_layer.hpp> |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 20 | enum class IPMINetfnIntelOEMGeneralCmd |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 21 | { |
| 22 | cmdSetBIOSID = 0x26, |
| 23 | cmdGetOEMDeviceInfo = 0x27, |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 24 | cmdGetAICSlotFRUIDSlotPosRecords = 0x31, |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 25 | cmdSetSystemGUID = 0x41, |
Jia, Chunhui | cc49b54 | 2019-03-20 15:41:07 +0800 | [diff] [blame] | 26 | cmdSendEmbeddedFWUpdStatus = 0x44, |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 27 | cmdSetPowerRestoreDelay = 0x54, |
| 28 | cmdGetPowerRestoreDelay = 0x55, |
Suryakanth Sekar | d509eb9 | 2018-11-15 17:44:11 +0530 | [diff] [blame] | 29 | cmdSetOEMUser2Activation = 0x5A, |
Yong Li | 703922d | 2018-11-06 13:25:31 +0800 | [diff] [blame] | 30 | cmdSetShutdownPolicy = 0x60, |
| 31 | cmdGetShutdownPolicy = 0x62, |
James Feist | 91244a6 | 2019-02-19 15:04:54 -0800 | [diff] [blame] | 32 | cmdSetFanConfig = 0x89, |
| 33 | cmdGetFanConfig = 0x8a, |
James Feist | 5f957ca | 2019-03-14 15:33:55 -0700 | [diff] [blame] | 34 | cmdSetFscParameter = 0x90, |
| 35 | cmdGetFscParameter = 0x91, |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 36 | cmdGetChassisIdentifier = 0x92, |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 37 | cmdGetProcessorErrConfig = 0x9A, |
| 38 | cmdSetProcessorErrConfig = 0x9B, |
Kuiying Wang | 45f0498 | 2018-12-26 09:23:08 +0800 | [diff] [blame] | 39 | cmdGetLEDStatus = 0xB0, |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 40 | }; |
| 41 | |
Yong Li | 23737fe | 2019-02-19 08:49:55 +0800 | [diff] [blame] | 42 | enum class IPMINetfnIntelOEMPlatformCmd |
| 43 | { |
| 44 | cmdCfgHostSerialPortSpeed = 0x90, |
| 45 | }; |
| 46 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 47 | enum class IPMIIntelOEMReturnCodes |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 48 | { |
| 49 | ipmiCCPayloadActive = 0x80, |
| 50 | ipmiCCInvalidPCIESlotID = 0x80, |
| 51 | ipmiCCParameterNotSupported = 0x80, |
| 52 | ipmiCCPayloadAlreadyDeactivated = 0x80, |
| 53 | ipmiCCSetInProcess = 0x81, |
| 54 | ipmiCCPayloadDisable = 0x81, |
| 55 | ipmiCCLostArbitration = 0x81, |
| 56 | ipmiCCInvalidCablePortIndex = 0x81, |
| 57 | ipmiCCHealthStatusNotAvailable = 0x81, |
| 58 | ipmiCCBusError = 0x82, |
| 59 | ipmiCCReadOnly = 0x82, |
| 60 | ipmiCCWriteOnly = 0x82, |
| 61 | ipmiCCNoCablePresent = 0x82, |
| 62 | ipmiCCDataCollectionInProgress = 0x82, |
| 63 | ipmiCCPayloadActivationLimitReached = 0x82, |
| 64 | ipmiCCNACKOnWrite = 0x83, |
| 65 | ipmiCCDataCollectionFailed = 0x83, |
| 66 | ipmiCCCanNotActivateWithEncrption = 0x83, |
| 67 | ipmiCCCanNotActivateWithoutEncryption = 0x84, |
| 68 | ipmiCCInvalidChecksum = 0x85, |
| 69 | ipmiCCNoCabledPCIEPortsAvailable = 0xC2, |
| 70 | |
| 71 | }; |
| 72 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 73 | enum class IPMIReturnCodeExt |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 74 | { |
| 75 | ipmiCCInvalidLUN = 0xC2, |
| 76 | ipmiCCTimeout = 0xC3, |
| 77 | ipmiCCStorageLeak = 0xC4, |
| 78 | ipmiCCRequestDataTruncated = 0xC6, |
| 79 | ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8, |
| 80 | ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA, |
| 81 | ipmiCCRequestSensorDataRecordNotFound = 0xCB, |
| 82 | ipmiCCDestinationUnavailable = 0xD3, |
| 83 | ipmiCCParamterNotSupportInPresentState = 0xD5, |
| 84 | }; |
| 85 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 86 | constexpr const uint8_t netfunIntelAppOEM = 0x3E; |
| 87 | static constexpr ipmi_netfn_t netfnIntcOEMGeneral = |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 88 | NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem |
| 89 | // general". The code is 0x30 |
Yong Li | 23737fe | 2019-02-19 08:49:55 +0800 | [diff] [blame] | 90 | |
| 91 | // Intel OEM Platform code is 0x32 |
| 92 | static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM; |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 93 | static constexpr const uint8_t maxBIOSIDLength = 0xFF; |
| 94 | static constexpr const uint8_t maxCPUNum = 4; |
| 95 | static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios"; |
| 96 | static constexpr const char* biosIntf = |
| 97 | "xyz.openbmc_project.Inventory.Item.Bios"; |
| 98 | static constexpr const char* biosProp = "BiosId"; |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 99 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 100 | static constexpr const char* powerRestoreDelayObjPath = |
| 101 | "/xyz/openbmc_project/control/power_restore_delay"; |
| 102 | static constexpr const char* powerRestoreDelayIntf = |
| 103 | "xyz.openbmc_project.Control.Power.RestoreDelay"; |
| 104 | static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay"; |
| 105 | static constexpr const char* processorErrConfigObjPath = |
| 106 | "/xyz/openbmc_project/control/processor_error_config"; |
| 107 | static constexpr const char* processorErrConfigIntf = |
| 108 | "xyz.openbmc_project.Control.Processor.ErrConfig"; |
| 109 | |
Yong Li | 703922d | 2018-11-06 13:25:31 +0800 | [diff] [blame] | 110 | static constexpr const char* postCodesObjPath = |
| 111 | "/xyz/openbmc_project/State/Boot/PostCode"; |
| 112 | static constexpr const char* postCodesIntf = |
| 113 | "xyz.openbmc_project.State.Boot.PostCode"; |
| 114 | |
Kuiying Wang | 45f0498 | 2018-12-26 09:23:08 +0800 | [diff] [blame] | 115 | static constexpr const char* identifyLEDObjPath = |
| 116 | "/xyz/openbmc_project/led/physical/identify"; |
| 117 | static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical"; |
| 118 | static constexpr const char* statusAmberObjPath = |
| 119 | "/xyz/openbmc_project/led/physical/status_amber"; |
| 120 | static constexpr const char* statusGreenObjPath = |
| 121 | "/xyz/openbmc_project/led/physical/status_green"; |
| 122 | |
Yong Li | 703922d | 2018-11-06 13:25:31 +0800 | [diff] [blame] | 123 | static constexpr const uint8_t noShutdownOnOCOT = 0; |
| 124 | static constexpr const uint8_t shutdownOnOCOT = 1; |
| 125 | static constexpr const uint8_t noShutdownPolicySupported = 0; |
| 126 | static constexpr const uint8_t shutdownPolicySupported = 1; |
| 127 | static constexpr const char* oemShutdownPolicyIntf = |
| 128 | "xyz.openbmc_project.Control.ShutdownPolicy"; |
| 129 | static constexpr const char* oemShutdownPolicyObjPath = |
| 130 | "/xyz/openbmc_project/control/shutdown_policy_config"; |
| 131 | static constexpr const char* oemShutdownPolicyObjPathProp = "Policy"; |
| 132 | |
Yong Li | 23737fe | 2019-02-19 08:49:55 +0800 | [diff] [blame] | 133 | static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv"; |
| 134 | static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv"; |
| 135 | static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg"; |
| 136 | |
James Feist | 91244a6 | 2019-02-19 15:04:54 -0800 | [diff] [blame] | 137 | constexpr const char* settingsBusName = "xyz.openbmc_project.Settings"; |
| 138 | |
Yong Li | 23737fe | 2019-02-19 08:49:55 +0800 | [diff] [blame] | 139 | static constexpr const uint8_t getHostSerialCfgCmd = 0; |
| 140 | static constexpr const uint8_t setHostSerialCfgCmd = 1; |
| 141 | |
| 142 | // parameters: |
| 143 | // 0: host serial port 1 and 2 normal speed |
| 144 | // 1: host serial port 1 high spend, port 2 normal speed |
| 145 | // 2: host serial port 1 normal spend, port 2 high speed |
| 146 | // 3: host serial port 1 and 2 high speed |
| 147 | static constexpr const uint8_t HostSerialCfgParamMax = 3; |
Suryakanth Sekar | d509eb9 | 2018-11-15 17:44:11 +0530 | [diff] [blame] | 148 | static constexpr uint8_t ipmiDefaultUserId = 2; |
Yong Li | 23737fe | 2019-02-19 08:49:55 +0800 | [diff] [blame] | 149 | |
Jia, Chunhui | cc49b54 | 2019-03-20 15:41:07 +0800 | [diff] [blame] | 150 | static constexpr const uint8_t selEvtTargetMask = 0xF0; |
| 151 | static constexpr const uint8_t selEvtTargetShift = 4; |
| 152 | |
| 153 | static constexpr const uint8_t targetInstanceMask = 0x0E; |
| 154 | static constexpr const uint8_t targetInstanceShift = 1; |
| 155 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 156 | enum class IPMINetfnIntelOEMAppCmd |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 157 | { |
| 158 | mdrStatus = 0x20, |
| 159 | mdrComplete = 0x21, |
| 160 | mdrEvent = 0x22, |
| 161 | mdrRead = 0x23, |
| 162 | mdrWrite = 0x24, |
| 163 | mdrLock = 0x25, |
| 164 | mdr2AgentStatus = 0x30, |
| 165 | mdr2GetDir = 0x31, |
| 166 | mdr2GetDataInfo = 0x32, |
| 167 | mdr2LockData = 0x33, |
| 168 | mdr2UnlockData = 0x34, |
| 169 | mdr2GetDataBlock = 0x35, |
| 170 | mdr2SendDir = 0x38, |
| 171 | mdr2SendDataInfoOffer = 0x39, |
| 172 | mdr2SendDataInfo = 0x3a, |
| 173 | mdr2DataStart = 0x3b, |
| 174 | mdr2DataDone = 0x3c, |
| 175 | mdr2SendDataBlock = 0x3d, |
| 176 | }; |
| 177 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 178 | enum class OEMDevEntityType |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 179 | { |
| 180 | biosId, |
| 181 | devVer, |
| 182 | sdrVer, |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 183 | }; |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 184 | |
Jia, Chunhui | cc49b54 | 2019-03-20 15:41:07 +0800 | [diff] [blame] | 185 | enum class FWUpdateTarget : uint8_t |
| 186 | { |
| 187 | targetBMC = 0x0, |
| 188 | targetBIOS = 0x1, |
| 189 | targetME = 0x2, |
| 190 | targetOEMEWS = 0x4, |
| 191 | }; |
| 192 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 193 | #pragma pack(push, 1) |
| 194 | struct GUIDData |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 195 | { |
| 196 | uint8_t node1; |
| 197 | uint8_t node2; |
| 198 | uint8_t node3; |
| 199 | uint8_t node4; |
| 200 | uint8_t node5; |
| 201 | uint8_t node6; |
| 202 | uint8_t clock1; |
| 203 | uint8_t clock2; |
| 204 | uint8_t timeHigh1; |
| 205 | uint8_t timeHigh2; |
| 206 | uint8_t timeMid1; |
| 207 | uint8_t timeMid2; |
| 208 | uint8_t timeLow1; |
| 209 | uint8_t timeLow2; |
| 210 | uint8_t timeLow3; |
| 211 | uint8_t timeLow4; |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 212 | }; |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 213 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 214 | struct DeviceInfo |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 215 | { |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 216 | uint8_t biosIDLength; |
| 217 | uint8_t biosId[maxBIOSIDLength]; |
| 218 | }; |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 219 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 220 | struct SetPowerRestoreDelayReq |
| 221 | { |
| 222 | uint8_t byteMSB; |
| 223 | uint8_t byteLSB; |
| 224 | }; |
| 225 | |
| 226 | struct GetPowerRestoreDelayRes |
| 227 | { |
| 228 | uint8_t byteMSB; |
| 229 | uint8_t byteLSB; |
| 230 | }; |
| 231 | |
| 232 | struct GetOemDeviceInfoReq |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 233 | { |
| 234 | uint8_t entityType; |
| 235 | uint8_t countToRead; |
| 236 | uint8_t offset; |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 237 | }; |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 238 | |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 239 | struct GetOemDeviceInfoRes |
Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame] | 240 | { |
| 241 | uint8_t resDatalen; |
Jason M. Bills | 6479604 | 2018-10-03 16:51:55 -0700 | [diff] [blame] | 242 | uint8_t data[maxBIOSIDLength]; |
| 243 | }; |
| 244 | |
| 245 | struct SetProcessorErrConfigReq |
| 246 | { |
| 247 | uint8_t resetCfg; // Reset Configuration |
| 248 | // [0]: CATERR Reset Enabled |
| 249 | // 0b: Disabled |
| 250 | // 1b: Enabled |
| 251 | // [1]: ERR2 Reset Enabled |
| 252 | // 0b: Disabled |
| 253 | // 1b: Enabled |
| 254 | // [7:2]: Reserved |
| 255 | uint8_t reserved; // Reserved |
| 256 | uint8_t |
| 257 | resetErrorOccurrenceCounts; // Reset Error Occurrence Counts |
| 258 | //[0]: Reset CPU Error Counts |
| 259 | // 0b: Keep CPU Error Counts |
| 260 | // 1b: Reset all CPU Error Counts to zero |
| 261 | //[7:1]: Reserved |
| 262 | }; |
| 263 | |
| 264 | struct GetProcessorErrConfigRes |
| 265 | { |
| 266 | uint8_t resetCfg; // Reset Configuration |
| 267 | // [0]: CATERR Reset Enabled |
| 268 | // 0b: Disabled |
| 269 | // 1b: Enabled |
| 270 | // [1]: ERR2 Reset Enabled |
| 271 | // 0b: Disabled |
| 272 | // 1b: Enabled |
| 273 | // [7:2]: Reserved |
| 274 | uint8_t reserved; // Reserved |
| 275 | char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy |
| 276 | // socket CPU CPU CATERR (Core Error) |
| 277 | // occurrence |
| 278 | // [5:0]: Error Occurrence Count |
| 279 | // [7:6]: CPU Status |
| 280 | // 00b: Disabled |
| 281 | // 01b: Enabled |
| 282 | // 11b: Not Present |
| 283 | }; |
Yong Li | 703922d | 2018-11-06 13:25:31 +0800 | [diff] [blame] | 284 | |
| 285 | struct GetOEMShutdownPolicyRes |
| 286 | { |
| 287 | uint8_t policy; |
| 288 | uint8_t policySupport; |
| 289 | }; |
Kuiying Wang | 45f0498 | 2018-12-26 09:23:08 +0800 | [diff] [blame] | 290 | |
James Feist | 91244a6 | 2019-02-19 15:04:54 -0800 | [diff] [blame] | 291 | struct SetFanConfigReq |
| 292 | { |
| 293 | uint8_t selectedProfile; |
| 294 | uint8_t flags; |
| 295 | // other parameters from previous generation are not supported |
| 296 | }; |
| 297 | |
| 298 | struct GetFanConfigResp |
| 299 | { |
| 300 | uint8_t supportMask; |
| 301 | uint8_t profileSupport; |
| 302 | uint8_t fanControlProfileEnable; |
| 303 | uint8_t flags; |
| 304 | uint8_t dimmPresenceMap[4]; |
| 305 | }; |
| 306 | |
Yong Li | 23737fe | 2019-02-19 08:49:55 +0800 | [diff] [blame] | 307 | struct CfgHostSerialReq |
| 308 | { |
| 309 | uint8_t command; |
| 310 | uint8_t parameter; |
| 311 | }; |
Kuiying Wang | 45f0498 | 2018-12-26 09:23:08 +0800 | [diff] [blame] | 312 | #pragma pack(pop) |
James Feist | 91244a6 | 2019-02-19 15:04:54 -0800 | [diff] [blame] | 313 | |
| 314 | enum class setFanProfileFlags : uint8_t |
| 315 | { |
| 316 | setFanProfile = 7, |
| 317 | setPerfAcousMode = 6, |
| 318 | // reserved [5:3] |
| 319 | performAcousSelect = 2 |
| 320 | // reserved [1:0] |
James Feist | 5f957ca | 2019-03-14 15:33:55 -0700 | [diff] [blame] | 321 | }; |
| 322 | |
| 323 | enum class setFscParamFlags : uint8_t |
| 324 | { |
| 325 | tcontrol = 0x1, |
| 326 | pwmOffset = 0x2, |
| 327 | maxPwm = 0x3, |
| 328 | cfm = 0x4 |
Jia, Chunhui | cc49b54 | 2019-03-20 15:41:07 +0800 | [diff] [blame] | 329 | }; |