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