blob: 4f8166f90407feb65d6f732cefa367d9878ed447 [file] [log] [blame]
Jia, Chunhuia835eaa2018-09-05 09:00:41 +08001/*
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
Vernon Mauery98bbf692019-09-16 11:14:59 -070019#include <ipmid/api-types.hpp>
Suryakanth Sekard509eb92018-11-15 17:44:11 +053020#include <user_channel/user_layer.hpp>
Vernon Mauery98bbf692019-09-16 11:14:59 -070021namespace ipmi
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080022{
Vernon Mauery98bbf692019-09-16 11:14:59 -070023namespace intel
Yong Li23737fe2019-02-19 08:49:55 +080024{
Yong Li23737fe2019-02-19 08:49:55 +080025
Vernon Mauery98bbf692019-09-16 11:14:59 -070026static constexpr NetFn netFnGeneral = netFnOemOne;
27static constexpr NetFn netFnPlatform = netFnOemTwo;
28static constexpr NetFn netFnApp = netFnOemEight;
29
30namespace general
31{
32static constexpr Cmd cmdRestoreConfiguration = 0x02;
33static constexpr Cmd cmdGetSmSignal = 0x14;
34static constexpr Cmd cmdSetSmSignal = 0x15;
35static constexpr Cmd cmdSetBIOSID = 0x26;
36static constexpr Cmd cmdGetOEMDeviceInfo = 0x27;
37static constexpr Cmd cmdSetColdRedundancyConfig = 0x2d;
38static constexpr Cmd cmdGetColdRedundancyConfig = 0x2e;
39static constexpr Cmd cmdGetAICSlotFRUIDSlotPosRecords = 0x31;
40static constexpr Cmd cmdGetMultiNodeRole = 0x33;
41static constexpr Cmd cmdGetMultiNodeId = 0x36;
42static constexpr Cmd cmdSetSystemGUID = 0x41;
43static constexpr Cmd cmdDisableBMCSystemReset = 0x42;
44static constexpr Cmd cmdGetBMCResetDisables = 0x43;
45static constexpr Cmd cmdSendEmbeddedFWUpdStatus = 0x44;
Matt Simmering80d4d5f2023-02-15 15:18:51 -080046static constexpr Cmd cmdSlotI2CControllerWriteRead = 0x52;
Vernon Mauery98bbf692019-09-16 11:14:59 -070047static constexpr Cmd cmdSetPowerRestoreDelay = 0x54;
48static constexpr Cmd cmdGetPowerRestoreDelay = 0x55;
49static constexpr Cmd cmdSetFaultIndication = 0x57;
50static constexpr Cmd cmdSetOEMUser2Activation = 0x5A;
51static constexpr Cmd cmdSetSpecialUserPassword = 0x5F;
52static constexpr Cmd cmdSetShutdownPolicy = 0x60;
53static constexpr Cmd cmdGetShutdownPolicy = 0x62;
54static constexpr Cmd cmdGetMultiNodePresence = 0x63;
AppaRao Puli28972062019-11-11 02:04:45 +053055static constexpr Cmd cmdGetBufferSize = 0x66;
Vernon Mauery98bbf692019-09-16 11:14:59 -070056static constexpr Cmd cmdSetFanConfig = 0x89;
57static constexpr Cmd cmdGetFanConfig = 0x8a;
58static constexpr Cmd cmdSetFanSpeedOffset = 0x8c;
59static constexpr Cmd cmdGetFanSpeedOffset = 0x8d;
60static constexpr Cmd cmdSetDimmOffset = 0x8e;
61static constexpr Cmd cmdGetDimmOffset = 0x8f;
62static constexpr Cmd cmdSetFscParameter = 0x90;
63static constexpr Cmd cmdGetFscParameter = 0x91;
64static constexpr Cmd cmdGetChassisIdentifier = 0x92;
65static constexpr Cmd cmdReadBaseBoardProductId = 0x93;
66static constexpr Cmd cmdGetProcessorErrConfig = 0x9A;
67static constexpr Cmd cmdSetProcessorErrConfig = 0x9B;
68static constexpr Cmd cmdSetManufacturingData = 0xA1;
69static constexpr Cmd cmdGetManufacturingData = 0xA2;
Vernon Mauery27d23562021-08-12 10:43:39 -070070static constexpr Cmd cmdSetFITcLayout = 0xA3;
Arun P. Mohanan06584cd2021-08-13 20:56:01 +053071static constexpr Cmd cmdMTMBMCFeatureControl = 0xA4;
Vernon Mauery98bbf692019-09-16 11:14:59 -070072static constexpr Cmd cmdGetLEDStatus = 0xB0;
73static constexpr Cmd cmdControlBmcServices = 0xB1;
74static constexpr Cmd cmdGetBmcServiceStatus = 0xB2;
75static constexpr Cmd cmdGetSecurityMode = 0xB3;
76static constexpr Cmd cmdSetSecurityMode = 0xB4;
77static constexpr Cmd cmdMtmKeepAlive = 0xB5;
srikanta mondal2030d7c2020-05-03 17:25:25 +000078static constexpr Cmd cmdOEMGetReading = 0xE2;
Kuiying Wang6d6dc7a2020-04-02 10:15:19 +080079static constexpr Cmd cmdSetBIOSCap = 0xD3;
80static constexpr Cmd cmdGetBIOSCap = 0xD4;
81static constexpr Cmd cmdSetPayload = 0xD5;
82static constexpr Cmd cmdGetPayload = 0xD6;
83static constexpr Cmd cmdSetBIOSPwdHashInfo = 0xD7;
84static constexpr Cmd cmdGetBIOSPwdHash = 0xD8;
Vernon Mauery98bbf692019-09-16 11:14:59 -070085static constexpr Cmd cmdGetNmiStatus = 0xE5;
86static constexpr Cmd cmdSetEfiBootOptions = 0xEA;
87static constexpr Cmd cmdGetEfiBootOptions = 0xEB;
88static constexpr Cmd cmdSetNmiStatus = 0xED;
Cheng C Yang4e6ee152019-09-25 10:27:44 +080089static constexpr Cmd cmdGetPSUVersion = 0xEF;
Vernon Mauery98bbf692019-09-16 11:14:59 -070090} // namespace general
91
92namespace platform
93{
94static constexpr Cmd cmdCfgHostSerialPortSpeed = 0x90;
Yong Li068b4f22019-09-17 16:32:18 +080095static constexpr Cmd cmdClearCMOS = 0x91;
Vernon Mauery98bbf692019-09-16 11:14:59 -070096} // namespace platform
97
98namespace app
99{
100static constexpr Cmd cmdMdrStatus = 0x20;
101static constexpr Cmd cmdMdrComplete = 0x21;
102static constexpr Cmd cmdMdrEvent = 0x22;
103static constexpr Cmd cmdMdrRead = 0x23;
104static constexpr Cmd cmdMdrWrite = 0x24;
105static constexpr Cmd cmdMdrLock = 0x25;
106static constexpr Cmd cmdMdrIIAgentStatus = 0x30;
107static constexpr Cmd cmdMdrIIGetDir = 0x31;
108static constexpr Cmd cmdMdrIIGetDataInfo = 0x32;
109static constexpr Cmd cmdMdrIILockData = 0x33;
110static constexpr Cmd cmdMdrIIUnlockData = 0X34;
111static constexpr Cmd cmdMdrIIGetDataBlock = 0x35;
112static constexpr Cmd cmdMdrIISendDir = 0x38;
113static constexpr Cmd cmdMdrIISendDataInfoOffer = 0x39;
114static constexpr Cmd cmdMdrIISendDataInfo = 0x3a;
115static constexpr Cmd cmdMdrIIDataStart = 0x3b;
116static constexpr Cmd cmdMdrIIDataDone = 0x3c;
117static constexpr Cmd cmdMdrIISendDataBlock = 0x3d;
Rajashekar Gade Reddy2b664d52020-03-23 22:09:00 +0530118static constexpr Cmd cmdSlotIpmb = 0x51;
Ankita Vilas Gawadea1650382022-01-08 10:30:40 +0000119static constexpr Cmd cmdPFRMailboxRead = 0x84;
Vernon Mauery98bbf692019-09-16 11:14:59 -0700120} // namespace app
121
122} // namespace intel
123
124} // namespace ipmi
125
126// FIXME: put these in the cpp files that use them
Jason M. Bills64796042018-10-03 16:51:55 -0700127enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800128{
129 ipmiCCPayloadActive = 0x80,
130 ipmiCCInvalidPCIESlotID = 0x80,
131 ipmiCCParameterNotSupported = 0x80,
132 ipmiCCPayloadAlreadyDeactivated = 0x80,
133 ipmiCCSetInProcess = 0x81,
134 ipmiCCPayloadDisable = 0x81,
135 ipmiCCLostArbitration = 0x81,
136 ipmiCCInvalidCablePortIndex = 0x81,
137 ipmiCCHealthStatusNotAvailable = 0x81,
138 ipmiCCBusError = 0x82,
139 ipmiCCReadOnly = 0x82,
140 ipmiCCWriteOnly = 0x82,
141 ipmiCCNoCablePresent = 0x82,
142 ipmiCCDataCollectionInProgress = 0x82,
143 ipmiCCPayloadActivationLimitReached = 0x82,
144 ipmiCCNACKOnWrite = 0x83,
145 ipmiCCDataCollectionFailed = 0x83,
146 ipmiCCCanNotActivateWithEncrption = 0x83,
147 ipmiCCCanNotActivateWithoutEncryption = 0x84,
148 ipmiCCInvalidChecksum = 0x85,
149 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
150
151};
152
Jason M. Bills64796042018-10-03 16:51:55 -0700153enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800154{
155 ipmiCCInvalidLUN = 0xC2,
156 ipmiCCTimeout = 0xC3,
157 ipmiCCStorageLeak = 0xC4,
158 ipmiCCRequestDataTruncated = 0xC6,
159 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
160 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
161 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
162 ipmiCCDestinationUnavailable = 0xD3,
163 ipmiCCParamterNotSupportInPresentState = 0xD5,
164};
165
Jason M. Bills64796042018-10-03 16:51:55 -0700166static constexpr const uint8_t maxBIOSIDLength = 0xFF;
167static constexpr const uint8_t maxCPUNum = 4;
Chalapathi899bfd12020-04-15 15:07:02 +0000168static constexpr const char* biosActiveObjPath =
169 "/xyz/openbmc_project/software/bios_active";
Yong Li2742b852019-12-16 14:55:11 +0800170static constexpr const char* biosVersionIntf =
171 "xyz.openbmc_project.Software.Version";
172static constexpr const char* biosVersionProp = "Version";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800173
Jason M. Bills64796042018-10-03 16:51:55 -0700174static constexpr const char* powerRestoreDelayObjPath =
Andrei Kartashevc42c7ed2022-01-10 12:17:34 +0300175 "/xyz/openbmc_project/control/host0/power_restore_policy";
Jason M. Bills64796042018-10-03 16:51:55 -0700176static constexpr const char* powerRestoreDelayIntf =
Andrei Kartashevc42c7ed2022-01-10 12:17:34 +0300177 "xyz.openbmc_project.Control.Power.RestorePolicy";
Jason M. Bills64796042018-10-03 16:51:55 -0700178static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
179static constexpr const char* processorErrConfigObjPath =
180 "/xyz/openbmc_project/control/processor_error_config";
181static constexpr const char* processorErrConfigIntf =
182 "xyz.openbmc_project.Control.Processor.ErrConfig";
Jason M. Billsb02bf092019-08-15 13:01:56 -0700183static constexpr const char* bmcResetDisablesPath =
184 "/xyz/openbmc_project/control/bmc_reset_disables";
185static constexpr const char* bmcResetDisablesIntf =
186 "xyz.openbmc_project.Control.ResetDisables";
Jason M. Bills64796042018-10-03 16:51:55 -0700187
Kuiying Wang45f04982018-12-26 09:23:08 +0800188static constexpr const char* identifyLEDObjPath =
189 "/xyz/openbmc_project/led/physical/identify";
190static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
191static constexpr const char* statusAmberObjPath =
192 "/xyz/openbmc_project/led/physical/status_amber";
193static constexpr const char* statusGreenObjPath =
194 "/xyz/openbmc_project/led/physical/status_green";
195
Yong Li703922d2018-11-06 13:25:31 +0800196static constexpr const uint8_t noShutdownOnOCOT = 0;
197static constexpr const uint8_t shutdownOnOCOT = 1;
198static constexpr const uint8_t noShutdownPolicySupported = 0;
199static constexpr const uint8_t shutdownPolicySupported = 1;
200static constexpr const char* oemShutdownPolicyIntf =
Yong Li0669d192019-05-06 14:01:46 +0800201 "com.intel.Control.OCOTShutdownPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800202static constexpr const char* oemShutdownPolicyObjPath =
Yong Li0669d192019-05-06 14:01:46 +0800203 "/com/intel/control/ocotshutdown_policy_config";
204static constexpr const char* oemShutdownPolicyObjPathProp = "OCOTPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800205
Yong Li23737fe2019-02-19 08:49:55 +0800206static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
207static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
208static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
209
James Feist91244a62019-02-19 15:04:54 -0800210constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
211
Yong Li23737fe2019-02-19 08:49:55 +0800212static constexpr const uint8_t getHostSerialCfgCmd = 0;
213static constexpr const uint8_t setHostSerialCfgCmd = 1;
214
215// parameters:
216// 0: host serial port 1 and 2 normal speed
217// 1: host serial port 1 high spend, port 2 normal speed
218// 2: host serial port 1 normal spend, port 2 high speed
219// 3: host serial port 1 and 2 high speed
220static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530221static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800222
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800223static constexpr const uint8_t selEvtTargetMask = 0xF0;
224static constexpr const uint8_t selEvtTargetShift = 4;
225
226static constexpr const uint8_t targetInstanceMask = 0x0E;
227static constexpr const uint8_t targetInstanceShift = 1;
228
Jason M. Bills64796042018-10-03 16:51:55 -0700229enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800230{
231 mdrStatus = 0x20,
232 mdrComplete = 0x21,
233 mdrEvent = 0x22,
234 mdrRead = 0x23,
235 mdrWrite = 0x24,
236 mdrLock = 0x25,
237 mdr2AgentStatus = 0x30,
238 mdr2GetDir = 0x31,
239 mdr2GetDataInfo = 0x32,
240 mdr2LockData = 0x33,
241 mdr2UnlockData = 0x34,
242 mdr2GetDataBlock = 0x35,
243 mdr2SendDir = 0x38,
244 mdr2SendDataInfoOffer = 0x39,
245 mdr2SendDataInfo = 0x3a,
246 mdr2DataStart = 0x3b,
247 mdr2DataDone = 0x3c,
248 mdr2SendDataBlock = 0x3d,
249};
250
Jason M. Bills64796042018-10-03 16:51:55 -0700251enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800252{
253 biosId,
254 devVer,
255 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700256};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800257
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800258enum class FWUpdateTarget : uint8_t
259{
260 targetBMC = 0x0,
261 targetBIOS = 0x1,
262 targetME = 0x2,
263 targetOEMEWS = 0x4,
264};
265
Jason M. Bills42bd9c82019-06-28 16:39:34 -0700266enum class CPUStatus
267{
268 disabled = 0x0,
269 enabled = 0x1,
270 notPresent = 0x3,
271};
272
Jason M. Bills64796042018-10-03 16:51:55 -0700273#pragma pack(push, 1)
274struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800275{
276 uint8_t node1;
277 uint8_t node2;
278 uint8_t node3;
279 uint8_t node4;
280 uint8_t node5;
281 uint8_t node6;
282 uint8_t clock1;
283 uint8_t clock2;
284 uint8_t timeHigh1;
285 uint8_t timeHigh2;
286 uint8_t timeMid1;
287 uint8_t timeMid2;
288 uint8_t timeLow1;
289 uint8_t timeLow2;
290 uint8_t timeLow3;
291 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700292};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800293
Jason M. Bills64796042018-10-03 16:51:55 -0700294struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800295{
Jason M. Bills64796042018-10-03 16:51:55 -0700296 uint8_t biosIDLength;
297 uint8_t biosId[maxBIOSIDLength];
298};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800299
Jason M. Bills64796042018-10-03 16:51:55 -0700300struct SetPowerRestoreDelayReq
301{
302 uint8_t byteMSB;
303 uint8_t byteLSB;
304};
305
306struct GetPowerRestoreDelayRes
307{
308 uint8_t byteMSB;
309 uint8_t byteLSB;
310};
311
Jason M. Bills64796042018-10-03 16:51:55 -0700312struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800313{
314 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700315 uint8_t data[maxBIOSIDLength];
316};
317
Yong Li703922d2018-11-06 13:25:31 +0800318struct GetOEMShutdownPolicyRes
319{
320 uint8_t policy;
321 uint8_t policySupport;
322};
Kuiying Wang45f04982018-12-26 09:23:08 +0800323
Yong Li23737fe2019-02-19 08:49:55 +0800324struct CfgHostSerialReq
325{
326 uint8_t command;
327 uint8_t parameter;
328};
Kuiying Wang45f04982018-12-26 09:23:08 +0800329#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800330
Zhu, Yungebe560b02019-04-21 21:19:21 -0400331//
332// Fault type enumeration
333//
334enum class RemoteFaultType
335{
336 fan, // 0
337 temperature, // 1
338 power, // 2
339 driveslot, // 3
340 software, // 4
341 memory, // 5
342 max = 6 // 6
343};
344
345// Enumeration for remote fault states as required by the HSC
346//
347enum class RemoteFaultState
348{
349 // fault indicators
350 fanLEDs,
351 cpu1DimmLeds,
352 cpu2DimmLeds,
353 cpu3DimmLeds,
354 cpu4DimmLeds,
355 maxFaultState,
356};
357
358enum class DimmFaultType
359{
360 cpu1cpu2Dimm,
361 cpu3cpu4Dimm,
362 maxFaultGroup,
363};
364
James Feist5f957ca2019-03-14 15:33:55 -0700365enum class setFscParamFlags : uint8_t
366{
367 tcontrol = 0x1,
368 pwmOffset = 0x2,
369 maxPwm = 0x3,
370 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800371};
Vernon Mauerya3702c12019-05-22 13:20:59 -0700372
James Feist63efafa2019-07-24 12:39:21 -0700373enum class dimmOffsetTypes : uint8_t
374{
375 staticCltt = 0x0,
376 dimmPower = 0x2
377};
378
Vernon Mauerya3702c12019-05-22 13:20:59 -0700379// FIXME: this stuff needs to be rewritten
380enum IPMI_INTEL_OEM_RETURN_CODES
381{
382 IPMI_CC_OEM_PAYLOAD_ACTIVE = 0x80,
383 IPMI_CC_OEM_INVALID_PCIE_SLOTID = 0x80,
384 IPMI_CC_OEM_PARAMETER_NOT_SUPPORTED = 0x80,
385 IPMI_CC_OEM_PAYLOAD_ALREADY_DEACTIVATED = 0x80,
386 IPMI_CC_OEM_SET_IN_PROCESS = 0x81,
387 IPMI_CC_OEM_PAYLOAD_DISABLE = 0x81,
388 IPMI_CC_OEM_LOST_ARBITRATION = 0x81,
389 IPMI_CC_OEM_INVALID_CABLE_PORT_INDEX = 0x81,
390 IPMI_CC_OEM_HEALTH_STATUS_NOT_AVAILABLE = 0x81,
391 IPMI_CC_OEM_BUS_ERROR = 0x82,
392 IPMI_CC_OEM_READ_ONLY = 0x82,
393 IPMI_CC_OEM_WRITE_ONLY = 0x82,
394 IPMI_CC_OEM_NO_CABLE_PRESENT = 0x82,
395 IPMI_CC_OEM_DATA_COLLECTION_IN_PROGRESS = 0x82,
396 IPMI_CC_OEM_PAYLOAD_ACTIVATION_LIMIT_REACH = 0x82,
397 IPMI_CC_OEM_NACK_ON_WRITE = 0x83,
398 IPMI_CC_OEM_DATA_COLLECTION_FAILED = 0x83,
399 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITH_ENCRYPTION = 0x83,
400 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITHOUT_ENCRYPTION = 0x84,
401 IPMI_CC_OEM_INVALID_CHECKSUM = 0x85,
402 IPMI_CC_OEM_NO_CABLED_PCIE_PORTS_AVAILABLE = 0xC2,
403};
404
405enum IPMI_RETURN_CODE_EXT
406{
407 IPMI_CC_INVALID_LUN = 0xC2,
408 IPMI_CC_STORGE_LEAK = 0xC4,
409 IPMI_CC_REQUEST_DATA_TRUNCATED = 0xC6,
410 IPMI_CC_REQUEST_DATA_FIELD_LENGTH_LIMIT_EXCEEDED = 0xC8,
411 IPMI_CC_CANNOT_RETURN_NUMBER_OF_REQUESTED_DATA_BYTES = 0xCA,
412 IPMI_CC_REQUEST_SENSOR_DATA_RECORD_NOT_FOUND = 0xCB,
413 IPMI_CC_DESTINATION_UNAVAILABLE = 0xD3,
414 IPMI_CC_PARAMETER_NOT_SUPPORT_IN_PRESENT_STATE = 0xD5,
415};