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