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 19 #include <ipmid/api-types.hpp> 20 #include <user_channel/user_layer.hpp> 21 namespace ipmi 22 { 23 namespace intel 24 { 25 26 static constexpr NetFn netFnGeneral = netFnOemOne; 27 static constexpr NetFn netFnPlatform = netFnOemTwo; 28 static constexpr NetFn netFnApp = netFnOemEight; 29 30 namespace general 31 { 32 static constexpr Cmd cmdRestoreConfiguration = 0x02; 33 static constexpr Cmd cmdGetSmSignal = 0x14; 34 static constexpr Cmd cmdSetSmSignal = 0x15; 35 static constexpr Cmd cmdSetBIOSID = 0x26; 36 static constexpr Cmd cmdGetOEMDeviceInfo = 0x27; 37 static constexpr Cmd cmdSetColdRedundancyConfig = 0x2d; 38 static constexpr Cmd cmdGetColdRedundancyConfig = 0x2e; 39 static constexpr Cmd cmdGetAICSlotFRUIDSlotPosRecords = 0x31; 40 static constexpr Cmd cmdGetMultiNodeRole = 0x33; 41 static constexpr Cmd cmdGetMultiNodeId = 0x36; 42 static constexpr Cmd cmdSetSystemGUID = 0x41; 43 static constexpr Cmd cmdDisableBMCSystemReset = 0x42; 44 static constexpr Cmd cmdGetBMCResetDisables = 0x43; 45 static constexpr Cmd cmdSendEmbeddedFWUpdStatus = 0x44; 46 static constexpr Cmd cmdSlotI2CMasterWriteRead = 0x52; 47 static constexpr Cmd cmdSetPowerRestoreDelay = 0x54; 48 static constexpr Cmd cmdGetPowerRestoreDelay = 0x55; 49 static constexpr Cmd cmdSetFaultIndication = 0x57; 50 static constexpr Cmd cmdSetOEMUser2Activation = 0x5A; 51 static constexpr Cmd cmdSetSpecialUserPassword = 0x5F; 52 static constexpr Cmd cmdSetShutdownPolicy = 0x60; 53 static constexpr Cmd cmdGetShutdownPolicy = 0x62; 54 static constexpr Cmd cmdGetMultiNodePresence = 0x63; 55 static constexpr Cmd cmdGetBufferSize = 0x66; 56 static constexpr Cmd cmdSetFanConfig = 0x89; 57 static constexpr Cmd cmdGetFanConfig = 0x8a; 58 static constexpr Cmd cmdSetFanSpeedOffset = 0x8c; 59 static constexpr Cmd cmdGetFanSpeedOffset = 0x8d; 60 static constexpr Cmd cmdSetDimmOffset = 0x8e; 61 static constexpr Cmd cmdGetDimmOffset = 0x8f; 62 static constexpr Cmd cmdSetFscParameter = 0x90; 63 static constexpr Cmd cmdGetFscParameter = 0x91; 64 static constexpr Cmd cmdGetChassisIdentifier = 0x92; 65 static constexpr Cmd cmdReadBaseBoardProductId = 0x93; 66 static constexpr Cmd cmdGetProcessorErrConfig = 0x9A; 67 static constexpr Cmd cmdSetProcessorErrConfig = 0x9B; 68 static constexpr Cmd cmdSetManufacturingData = 0xA1; 69 static constexpr Cmd cmdGetManufacturingData = 0xA2; 70 static constexpr Cmd cmdSetFITcLayout = 0xA3; 71 static constexpr Cmd cmdGetLEDStatus = 0xB0; 72 static constexpr Cmd cmdControlBmcServices = 0xB1; 73 static constexpr Cmd cmdGetBmcServiceStatus = 0xB2; 74 static constexpr Cmd cmdGetSecurityMode = 0xB3; 75 static constexpr Cmd cmdSetSecurityMode = 0xB4; 76 static constexpr Cmd cmdMtmKeepAlive = 0xB5; 77 static constexpr Cmd cmdOEMGetReading = 0xE2; 78 static constexpr Cmd cmdSetBIOSCap = 0xD3; 79 static constexpr Cmd cmdGetBIOSCap = 0xD4; 80 static constexpr Cmd cmdSetPayload = 0xD5; 81 static constexpr Cmd cmdGetPayload = 0xD6; 82 static constexpr Cmd cmdSetBIOSPwdHashInfo = 0xD7; 83 static constexpr Cmd cmdGetBIOSPwdHash = 0xD8; 84 static constexpr Cmd cmdGetNmiStatus = 0xE5; 85 static constexpr Cmd cmdSetEfiBootOptions = 0xEA; 86 static constexpr Cmd cmdGetEfiBootOptions = 0xEB; 87 static constexpr Cmd cmdSetNmiStatus = 0xED; 88 static constexpr Cmd cmdGetPSUVersion = 0xEF; 89 } // namespace general 90 91 namespace platform 92 { 93 static constexpr Cmd cmdCfgHostSerialPortSpeed = 0x90; 94 static constexpr Cmd cmdClearCMOS = 0x91; 95 } // namespace platform 96 97 namespace app 98 { 99 static constexpr Cmd cmdMdrStatus = 0x20; 100 static constexpr Cmd cmdMdrComplete = 0x21; 101 static constexpr Cmd cmdMdrEvent = 0x22; 102 static constexpr Cmd cmdMdrRead = 0x23; 103 static constexpr Cmd cmdMdrWrite = 0x24; 104 static constexpr Cmd cmdMdrLock = 0x25; 105 static constexpr Cmd cmdMdrIIAgentStatus = 0x30; 106 static constexpr Cmd cmdMdrIIGetDir = 0x31; 107 static constexpr Cmd cmdMdrIIGetDataInfo = 0x32; 108 static constexpr Cmd cmdMdrIILockData = 0x33; 109 static constexpr Cmd cmdMdrIIUnlockData = 0X34; 110 static constexpr Cmd cmdMdrIIGetDataBlock = 0x35; 111 static constexpr Cmd cmdMdrIISendDir = 0x38; 112 static constexpr Cmd cmdMdrIISendDataInfoOffer = 0x39; 113 static constexpr Cmd cmdMdrIISendDataInfo = 0x3a; 114 static constexpr Cmd cmdMdrIIDataStart = 0x3b; 115 static constexpr Cmd cmdMdrIIDataDone = 0x3c; 116 static constexpr Cmd cmdMdrIISendDataBlock = 0x3d; 117 static constexpr Cmd cmdSlotIpmb = 0x51; 118 } // namespace app 119 120 } // namespace intel 121 122 } // namespace ipmi 123 124 // FIXME: put these in the cpp files that use them 125 enum class IPMIIntelOEMReturnCodes 126 { 127 ipmiCCPayloadActive = 0x80, 128 ipmiCCInvalidPCIESlotID = 0x80, 129 ipmiCCParameterNotSupported = 0x80, 130 ipmiCCPayloadAlreadyDeactivated = 0x80, 131 ipmiCCSetInProcess = 0x81, 132 ipmiCCPayloadDisable = 0x81, 133 ipmiCCLostArbitration = 0x81, 134 ipmiCCInvalidCablePortIndex = 0x81, 135 ipmiCCHealthStatusNotAvailable = 0x81, 136 ipmiCCBusError = 0x82, 137 ipmiCCReadOnly = 0x82, 138 ipmiCCWriteOnly = 0x82, 139 ipmiCCNoCablePresent = 0x82, 140 ipmiCCDataCollectionInProgress = 0x82, 141 ipmiCCPayloadActivationLimitReached = 0x82, 142 ipmiCCNACKOnWrite = 0x83, 143 ipmiCCDataCollectionFailed = 0x83, 144 ipmiCCCanNotActivateWithEncrption = 0x83, 145 ipmiCCCanNotActivateWithoutEncryption = 0x84, 146 ipmiCCInvalidChecksum = 0x85, 147 ipmiCCNoCabledPCIEPortsAvailable = 0xC2, 148 149 }; 150 151 enum class IPMIReturnCodeExt 152 { 153 ipmiCCInvalidLUN = 0xC2, 154 ipmiCCTimeout = 0xC3, 155 ipmiCCStorageLeak = 0xC4, 156 ipmiCCRequestDataTruncated = 0xC6, 157 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8, 158 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA, 159 ipmiCCRequestSensorDataRecordNotFound = 0xCB, 160 ipmiCCDestinationUnavailable = 0xD3, 161 ipmiCCParamterNotSupportInPresentState = 0xD5, 162 }; 163 164 static constexpr const uint8_t maxBIOSIDLength = 0xFF; 165 static constexpr const uint8_t maxCPUNum = 4; 166 static constexpr const char* biosActiveObjPath = 167 "/xyz/openbmc_project/software/bios_active"; 168 static constexpr const char* biosVersionIntf = 169 "xyz.openbmc_project.Software.Version"; 170 static constexpr const char* biosVersionProp = "Version"; 171 172 static constexpr const char* powerRestoreDelayObjPath = 173 "/xyz/openbmc_project/control/power_restore_delay"; 174 static constexpr const char* powerRestoreDelayIntf = 175 "xyz.openbmc_project.Control.Power.RestoreDelay"; 176 static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay"; 177 static constexpr const char* processorErrConfigObjPath = 178 "/xyz/openbmc_project/control/processor_error_config"; 179 static constexpr const char* processorErrConfigIntf = 180 "xyz.openbmc_project.Control.Processor.ErrConfig"; 181 static constexpr const char* bmcResetDisablesPath = 182 "/xyz/openbmc_project/control/bmc_reset_disables"; 183 static constexpr const char* bmcResetDisablesIntf = 184 "xyz.openbmc_project.Control.ResetDisables"; 185 186 static constexpr const char* identifyLEDObjPath = 187 "/xyz/openbmc_project/led/physical/identify"; 188 static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical"; 189 static constexpr const char* statusAmberObjPath = 190 "/xyz/openbmc_project/led/physical/status_amber"; 191 static constexpr const char* statusGreenObjPath = 192 "/xyz/openbmc_project/led/physical/status_green"; 193 194 static constexpr const uint8_t noShutdownOnOCOT = 0; 195 static constexpr const uint8_t shutdownOnOCOT = 1; 196 static constexpr const uint8_t noShutdownPolicySupported = 0; 197 static constexpr const uint8_t shutdownPolicySupported = 1; 198 static constexpr const char* oemShutdownPolicyIntf = 199 "com.intel.Control.OCOTShutdownPolicy"; 200 static constexpr const char* oemShutdownPolicyObjPath = 201 "/com/intel/control/ocotshutdown_policy_config"; 202 static constexpr const char* oemShutdownPolicyObjPathProp = "OCOTPolicy"; 203 204 static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv"; 205 static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv"; 206 static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg"; 207 208 constexpr const char* settingsBusName = "xyz.openbmc_project.Settings"; 209 210 static constexpr const uint8_t getHostSerialCfgCmd = 0; 211 static constexpr const uint8_t setHostSerialCfgCmd = 1; 212 213 // parameters: 214 // 0: host serial port 1 and 2 normal speed 215 // 1: host serial port 1 high spend, port 2 normal speed 216 // 2: host serial port 1 normal spend, port 2 high speed 217 // 3: host serial port 1 and 2 high speed 218 static constexpr const uint8_t HostSerialCfgParamMax = 3; 219 static constexpr uint8_t ipmiDefaultUserId = 2; 220 221 static constexpr const uint8_t selEvtTargetMask = 0xF0; 222 static constexpr const uint8_t selEvtTargetShift = 4; 223 224 static constexpr const uint8_t targetInstanceMask = 0x0E; 225 static constexpr const uint8_t targetInstanceShift = 1; 226 227 enum class IPMINetfnIntelOEMAppCmd 228 { 229 mdrStatus = 0x20, 230 mdrComplete = 0x21, 231 mdrEvent = 0x22, 232 mdrRead = 0x23, 233 mdrWrite = 0x24, 234 mdrLock = 0x25, 235 mdr2AgentStatus = 0x30, 236 mdr2GetDir = 0x31, 237 mdr2GetDataInfo = 0x32, 238 mdr2LockData = 0x33, 239 mdr2UnlockData = 0x34, 240 mdr2GetDataBlock = 0x35, 241 mdr2SendDir = 0x38, 242 mdr2SendDataInfoOffer = 0x39, 243 mdr2SendDataInfo = 0x3a, 244 mdr2DataStart = 0x3b, 245 mdr2DataDone = 0x3c, 246 mdr2SendDataBlock = 0x3d, 247 }; 248 249 enum class OEMDevEntityType 250 { 251 biosId, 252 devVer, 253 sdrVer, 254 }; 255 256 enum class FWUpdateTarget : uint8_t 257 { 258 targetBMC = 0x0, 259 targetBIOS = 0x1, 260 targetME = 0x2, 261 targetOEMEWS = 0x4, 262 }; 263 264 enum class CPUStatus 265 { 266 disabled = 0x0, 267 enabled = 0x1, 268 notPresent = 0x3, 269 }; 270 271 #pragma pack(push, 1) 272 struct GUIDData 273 { 274 uint8_t node1; 275 uint8_t node2; 276 uint8_t node3; 277 uint8_t node4; 278 uint8_t node5; 279 uint8_t node6; 280 uint8_t clock1; 281 uint8_t clock2; 282 uint8_t timeHigh1; 283 uint8_t timeHigh2; 284 uint8_t timeMid1; 285 uint8_t timeMid2; 286 uint8_t timeLow1; 287 uint8_t timeLow2; 288 uint8_t timeLow3; 289 uint8_t timeLow4; 290 }; 291 292 struct DeviceInfo 293 { 294 uint8_t biosIDLength; 295 uint8_t biosId[maxBIOSIDLength]; 296 }; 297 298 struct SetPowerRestoreDelayReq 299 { 300 uint8_t byteMSB; 301 uint8_t byteLSB; 302 }; 303 304 struct GetPowerRestoreDelayRes 305 { 306 uint8_t byteMSB; 307 uint8_t byteLSB; 308 }; 309 310 struct GetOemDeviceInfoRes 311 { 312 uint8_t resDatalen; 313 uint8_t data[maxBIOSIDLength]; 314 }; 315 316 struct GetOEMShutdownPolicyRes 317 { 318 uint8_t policy; 319 uint8_t policySupport; 320 }; 321 322 struct CfgHostSerialReq 323 { 324 uint8_t command; 325 uint8_t parameter; 326 }; 327 #pragma pack(pop) 328 329 // 330 // Fault type enumeration 331 // 332 enum class RemoteFaultType 333 { 334 fan, // 0 335 temperature, // 1 336 power, // 2 337 driveslot, // 3 338 software, // 4 339 memory, // 5 340 max = 6 // 6 341 }; 342 343 // Enumeration for remote fault states as required by the HSC 344 // 345 enum class RemoteFaultState 346 { 347 // fault indicators 348 fanLEDs, 349 cpu1DimmLeds, 350 cpu2DimmLeds, 351 cpu3DimmLeds, 352 cpu4DimmLeds, 353 maxFaultState, 354 }; 355 356 enum class DimmFaultType 357 { 358 cpu1cpu2Dimm, 359 cpu3cpu4Dimm, 360 maxFaultGroup, 361 }; 362 363 enum class setFscParamFlags : uint8_t 364 { 365 tcontrol = 0x1, 366 pwmOffset = 0x2, 367 maxPwm = 0x3, 368 cfm = 0x4 369 }; 370 371 enum class dimmOffsetTypes : uint8_t 372 { 373 staticCltt = 0x0, 374 dimmPower = 0x2 375 }; 376 377 // FIXME: this stuff needs to be rewritten 378 enum IPMI_INTEL_OEM_RETURN_CODES 379 { 380 IPMI_CC_OEM_PAYLOAD_ACTIVE = 0x80, 381 IPMI_CC_OEM_INVALID_PCIE_SLOTID = 0x80, 382 IPMI_CC_OEM_PARAMETER_NOT_SUPPORTED = 0x80, 383 IPMI_CC_OEM_PAYLOAD_ALREADY_DEACTIVATED = 0x80, 384 IPMI_CC_OEM_SET_IN_PROCESS = 0x81, 385 IPMI_CC_OEM_PAYLOAD_DISABLE = 0x81, 386 IPMI_CC_OEM_LOST_ARBITRATION = 0x81, 387 IPMI_CC_OEM_INVALID_CABLE_PORT_INDEX = 0x81, 388 IPMI_CC_OEM_HEALTH_STATUS_NOT_AVAILABLE = 0x81, 389 IPMI_CC_OEM_BUS_ERROR = 0x82, 390 IPMI_CC_OEM_READ_ONLY = 0x82, 391 IPMI_CC_OEM_WRITE_ONLY = 0x82, 392 IPMI_CC_OEM_NO_CABLE_PRESENT = 0x82, 393 IPMI_CC_OEM_DATA_COLLECTION_IN_PROGRESS = 0x82, 394 IPMI_CC_OEM_PAYLOAD_ACTIVATION_LIMIT_REACH = 0x82, 395 IPMI_CC_OEM_NACK_ON_WRITE = 0x83, 396 IPMI_CC_OEM_DATA_COLLECTION_FAILED = 0x83, 397 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITH_ENCRYPTION = 0x83, 398 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITHOUT_ENCRYPTION = 0x84, 399 IPMI_CC_OEM_INVALID_CHECKSUM = 0x85, 400 IPMI_CC_OEM_NO_CABLED_PCIE_PORTS_AVAILABLE = 0xC2, 401 }; 402 403 enum IPMI_RETURN_CODE_EXT 404 { 405 IPMI_CC_INVALID_LUN = 0xC2, 406 IPMI_CC_STORGE_LEAK = 0xC4, 407 IPMI_CC_REQUEST_DATA_TRUNCATED = 0xC6, 408 IPMI_CC_REQUEST_DATA_FIELD_LENGTH_LIMIT_EXCEEDED = 0xC8, 409 IPMI_CC_CANNOT_RETURN_NUMBER_OF_REQUESTED_DATA_BYTES = 0xCA, 410 IPMI_CC_REQUEST_SENSOR_DATA_RECORD_NOT_FOUND = 0xCB, 411 IPMI_CC_DESTINATION_UNAVAILABLE = 0xD3, 412 IPMI_CC_PARAMETER_NOT_SUPPORT_IN_PRESENT_STATE = 0xD5, 413 }; 414