blob: 9863480e98675e0e736134c00a80fa973b667e31 [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;
46static constexpr Cmd cmdSlotI2CMasterWriteRead = 0x52;
47static 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;
70static constexpr Cmd cmdGetLEDStatus = 0xB0;
71static constexpr Cmd cmdControlBmcServices = 0xB1;
72static constexpr Cmd cmdGetBmcServiceStatus = 0xB2;
73static constexpr Cmd cmdGetSecurityMode = 0xB3;
74static constexpr Cmd cmdSetSecurityMode = 0xB4;
75static constexpr Cmd cmdMtmKeepAlive = 0xB5;
76static constexpr Cmd cmdGetNmiStatus = 0xE5;
77static constexpr Cmd cmdSetEfiBootOptions = 0xEA;
78static constexpr Cmd cmdGetEfiBootOptions = 0xEB;
79static constexpr Cmd cmdSetNmiStatus = 0xED;
Cheng C Yang4e6ee152019-09-25 10:27:44 +080080static constexpr Cmd cmdGetPSUVersion = 0xEF;
Vernon Mauery98bbf692019-09-16 11:14:59 -070081} // namespace general
82
83namespace platform
84{
85static constexpr Cmd cmdCfgHostSerialPortSpeed = 0x90;
Yong Li068b4f22019-09-17 16:32:18 +080086static constexpr Cmd cmdClearCMOS = 0x91;
Vernon Mauery98bbf692019-09-16 11:14:59 -070087} // namespace platform
88
89namespace app
90{
91static constexpr Cmd cmdMdrStatus = 0x20;
92static constexpr Cmd cmdMdrComplete = 0x21;
93static constexpr Cmd cmdMdrEvent = 0x22;
94static constexpr Cmd cmdMdrRead = 0x23;
95static constexpr Cmd cmdMdrWrite = 0x24;
96static constexpr Cmd cmdMdrLock = 0x25;
97static constexpr Cmd cmdMdrIIAgentStatus = 0x30;
98static constexpr Cmd cmdMdrIIGetDir = 0x31;
99static constexpr Cmd cmdMdrIIGetDataInfo = 0x32;
100static constexpr Cmd cmdMdrIILockData = 0x33;
101static constexpr Cmd cmdMdrIIUnlockData = 0X34;
102static constexpr Cmd cmdMdrIIGetDataBlock = 0x35;
103static constexpr Cmd cmdMdrIISendDir = 0x38;
104static constexpr Cmd cmdMdrIISendDataInfoOffer = 0x39;
105static constexpr Cmd cmdMdrIISendDataInfo = 0x3a;
106static constexpr Cmd cmdMdrIIDataStart = 0x3b;
107static constexpr Cmd cmdMdrIIDataDone = 0x3c;
108static constexpr Cmd cmdMdrIISendDataBlock = 0x3d;
Rajashekar Gade Reddy2b664d52020-03-23 22:09:00 +0530109static constexpr Cmd cmdSlotIpmb = 0x51;
Vernon Mauery98bbf692019-09-16 11:14:59 -0700110} // namespace app
111
112} // namespace intel
113
114} // namespace ipmi
115
116// FIXME: put these in the cpp files that use them
Jason M. Bills64796042018-10-03 16:51:55 -0700117enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800118{
119 ipmiCCPayloadActive = 0x80,
120 ipmiCCInvalidPCIESlotID = 0x80,
121 ipmiCCParameterNotSupported = 0x80,
122 ipmiCCPayloadAlreadyDeactivated = 0x80,
123 ipmiCCSetInProcess = 0x81,
124 ipmiCCPayloadDisable = 0x81,
125 ipmiCCLostArbitration = 0x81,
126 ipmiCCInvalidCablePortIndex = 0x81,
127 ipmiCCHealthStatusNotAvailable = 0x81,
128 ipmiCCBusError = 0x82,
129 ipmiCCReadOnly = 0x82,
130 ipmiCCWriteOnly = 0x82,
131 ipmiCCNoCablePresent = 0x82,
132 ipmiCCDataCollectionInProgress = 0x82,
133 ipmiCCPayloadActivationLimitReached = 0x82,
134 ipmiCCNACKOnWrite = 0x83,
135 ipmiCCDataCollectionFailed = 0x83,
136 ipmiCCCanNotActivateWithEncrption = 0x83,
137 ipmiCCCanNotActivateWithoutEncryption = 0x84,
138 ipmiCCInvalidChecksum = 0x85,
139 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
140
141};
142
Jason M. Bills64796042018-10-03 16:51:55 -0700143enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800144{
145 ipmiCCInvalidLUN = 0xC2,
146 ipmiCCTimeout = 0xC3,
147 ipmiCCStorageLeak = 0xC4,
148 ipmiCCRequestDataTruncated = 0xC6,
149 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
150 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
151 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
152 ipmiCCDestinationUnavailable = 0xD3,
153 ipmiCCParamterNotSupportInPresentState = 0xD5,
154};
155
Jason M. Bills64796042018-10-03 16:51:55 -0700156static constexpr const uint8_t maxBIOSIDLength = 0xFF;
157static constexpr const uint8_t maxCPUNum = 4;
Chalapathi899bfd12020-04-15 15:07:02 +0000158static constexpr const char* biosActiveObjPath =
159 "/xyz/openbmc_project/software/bios_active";
Yong Li2742b852019-12-16 14:55:11 +0800160static constexpr const char* biosVersionIntf =
161 "xyz.openbmc_project.Software.Version";
162static constexpr const char* biosVersionProp = "Version";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800163
Jason M. Bills64796042018-10-03 16:51:55 -0700164static constexpr const char* powerRestoreDelayObjPath =
165 "/xyz/openbmc_project/control/power_restore_delay";
166static constexpr const char* powerRestoreDelayIntf =
167 "xyz.openbmc_project.Control.Power.RestoreDelay";
168static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
169static constexpr const char* processorErrConfigObjPath =
170 "/xyz/openbmc_project/control/processor_error_config";
171static constexpr const char* processorErrConfigIntf =
172 "xyz.openbmc_project.Control.Processor.ErrConfig";
Jason M. Billsb02bf092019-08-15 13:01:56 -0700173static constexpr const char* bmcResetDisablesPath =
174 "/xyz/openbmc_project/control/bmc_reset_disables";
175static constexpr const char* bmcResetDisablesIntf =
176 "xyz.openbmc_project.Control.ResetDisables";
Jason M. Bills64796042018-10-03 16:51:55 -0700177
Yong Li703922d2018-11-06 13:25:31 +0800178static constexpr const char* postCodesObjPath =
179 "/xyz/openbmc_project/State/Boot/PostCode";
180static constexpr const char* postCodesIntf =
181 "xyz.openbmc_project.State.Boot.PostCode";
182
Kuiying Wang45f04982018-12-26 09:23:08 +0800183static constexpr const char* identifyLEDObjPath =
184 "/xyz/openbmc_project/led/physical/identify";
185static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
186static constexpr const char* statusAmberObjPath =
187 "/xyz/openbmc_project/led/physical/status_amber";
188static constexpr const char* statusGreenObjPath =
189 "/xyz/openbmc_project/led/physical/status_green";
190
Yong Li703922d2018-11-06 13:25:31 +0800191static constexpr const uint8_t noShutdownOnOCOT = 0;
192static constexpr const uint8_t shutdownOnOCOT = 1;
193static constexpr const uint8_t noShutdownPolicySupported = 0;
194static constexpr const uint8_t shutdownPolicySupported = 1;
195static constexpr const char* oemShutdownPolicyIntf =
Yong Li0669d192019-05-06 14:01:46 +0800196 "com.intel.Control.OCOTShutdownPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800197static constexpr const char* oemShutdownPolicyObjPath =
Yong Li0669d192019-05-06 14:01:46 +0800198 "/com/intel/control/ocotshutdown_policy_config";
199static constexpr const char* oemShutdownPolicyObjPathProp = "OCOTPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800200
Yong Li23737fe2019-02-19 08:49:55 +0800201static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
202static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
203static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
204
James Feist91244a62019-02-19 15:04:54 -0800205constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
206
Yong Li23737fe2019-02-19 08:49:55 +0800207static constexpr const uint8_t getHostSerialCfgCmd = 0;
208static constexpr const uint8_t setHostSerialCfgCmd = 1;
209
210// parameters:
211// 0: host serial port 1 and 2 normal speed
212// 1: host serial port 1 high spend, port 2 normal speed
213// 2: host serial port 1 normal spend, port 2 high speed
214// 3: host serial port 1 and 2 high speed
215static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530216static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800217
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800218static constexpr const uint8_t selEvtTargetMask = 0xF0;
219static constexpr const uint8_t selEvtTargetShift = 4;
220
221static constexpr const uint8_t targetInstanceMask = 0x0E;
222static constexpr const uint8_t targetInstanceShift = 1;
223
Jason M. Bills64796042018-10-03 16:51:55 -0700224enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800225{
226 mdrStatus = 0x20,
227 mdrComplete = 0x21,
228 mdrEvent = 0x22,
229 mdrRead = 0x23,
230 mdrWrite = 0x24,
231 mdrLock = 0x25,
232 mdr2AgentStatus = 0x30,
233 mdr2GetDir = 0x31,
234 mdr2GetDataInfo = 0x32,
235 mdr2LockData = 0x33,
236 mdr2UnlockData = 0x34,
237 mdr2GetDataBlock = 0x35,
238 mdr2SendDir = 0x38,
239 mdr2SendDataInfoOffer = 0x39,
240 mdr2SendDataInfo = 0x3a,
241 mdr2DataStart = 0x3b,
242 mdr2DataDone = 0x3c,
243 mdr2SendDataBlock = 0x3d,
244};
245
Jason M. Bills64796042018-10-03 16:51:55 -0700246enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800247{
248 biosId,
249 devVer,
250 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700251};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800252
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800253enum class FWUpdateTarget : uint8_t
254{
255 targetBMC = 0x0,
256 targetBIOS = 0x1,
257 targetME = 0x2,
258 targetOEMEWS = 0x4,
259};
260
Jason M. Bills42bd9c82019-06-28 16:39:34 -0700261enum class CPUStatus
262{
263 disabled = 0x0,
264 enabled = 0x1,
265 notPresent = 0x3,
266};
267
Jason M. Bills64796042018-10-03 16:51:55 -0700268#pragma pack(push, 1)
269struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800270{
271 uint8_t node1;
272 uint8_t node2;
273 uint8_t node3;
274 uint8_t node4;
275 uint8_t node5;
276 uint8_t node6;
277 uint8_t clock1;
278 uint8_t clock2;
279 uint8_t timeHigh1;
280 uint8_t timeHigh2;
281 uint8_t timeMid1;
282 uint8_t timeMid2;
283 uint8_t timeLow1;
284 uint8_t timeLow2;
285 uint8_t timeLow3;
286 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700287};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800288
Jason M. Bills64796042018-10-03 16:51:55 -0700289struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800290{
Jason M. Bills64796042018-10-03 16:51:55 -0700291 uint8_t biosIDLength;
292 uint8_t biosId[maxBIOSIDLength];
293};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800294
Jason M. Bills64796042018-10-03 16:51:55 -0700295struct SetPowerRestoreDelayReq
296{
297 uint8_t byteMSB;
298 uint8_t byteLSB;
299};
300
301struct GetPowerRestoreDelayRes
302{
303 uint8_t byteMSB;
304 uint8_t byteLSB;
305};
306
Jason M. Bills64796042018-10-03 16:51:55 -0700307struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800308{
309 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700310 uint8_t data[maxBIOSIDLength];
311};
312
Yong Li703922d2018-11-06 13:25:31 +0800313struct GetOEMShutdownPolicyRes
314{
315 uint8_t policy;
316 uint8_t policySupport;
317};
Kuiying Wang45f04982018-12-26 09:23:08 +0800318
Yong Li23737fe2019-02-19 08:49:55 +0800319struct CfgHostSerialReq
320{
321 uint8_t command;
322 uint8_t parameter;
323};
Kuiying Wang45f04982018-12-26 09:23:08 +0800324#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800325
Zhu, Yungebe560b02019-04-21 21:19:21 -0400326//
327// Fault type enumeration
328//
329enum class RemoteFaultType
330{
331 fan, // 0
332 temperature, // 1
333 power, // 2
334 driveslot, // 3
335 software, // 4
336 memory, // 5
337 max = 6 // 6
338};
339
340// Enumeration for remote fault states as required by the HSC
341//
342enum class RemoteFaultState
343{
344 // fault indicators
345 fanLEDs,
346 cpu1DimmLeds,
347 cpu2DimmLeds,
348 cpu3DimmLeds,
349 cpu4DimmLeds,
350 maxFaultState,
351};
352
353enum class DimmFaultType
354{
355 cpu1cpu2Dimm,
356 cpu3cpu4Dimm,
357 maxFaultGroup,
358};
359
James Feist5f957ca2019-03-14 15:33:55 -0700360enum class setFscParamFlags : uint8_t
361{
362 tcontrol = 0x1,
363 pwmOffset = 0x2,
364 maxPwm = 0x3,
365 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800366};
Vernon Mauerya3702c12019-05-22 13:20:59 -0700367
James Feist63efafa2019-07-24 12:39:21 -0700368enum class dimmOffsetTypes : uint8_t
369{
370 staticCltt = 0x0,
371 dimmPower = 0x2
372};
373
Vernon Mauerya3702c12019-05-22 13:20:59 -0700374// FIXME: this stuff needs to be rewritten
375enum IPMI_INTEL_OEM_RETURN_CODES
376{
377 IPMI_CC_OEM_PAYLOAD_ACTIVE = 0x80,
378 IPMI_CC_OEM_INVALID_PCIE_SLOTID = 0x80,
379 IPMI_CC_OEM_PARAMETER_NOT_SUPPORTED = 0x80,
380 IPMI_CC_OEM_PAYLOAD_ALREADY_DEACTIVATED = 0x80,
381 IPMI_CC_OEM_SET_IN_PROCESS = 0x81,
382 IPMI_CC_OEM_PAYLOAD_DISABLE = 0x81,
383 IPMI_CC_OEM_LOST_ARBITRATION = 0x81,
384 IPMI_CC_OEM_INVALID_CABLE_PORT_INDEX = 0x81,
385 IPMI_CC_OEM_HEALTH_STATUS_NOT_AVAILABLE = 0x81,
386 IPMI_CC_OEM_BUS_ERROR = 0x82,
387 IPMI_CC_OEM_READ_ONLY = 0x82,
388 IPMI_CC_OEM_WRITE_ONLY = 0x82,
389 IPMI_CC_OEM_NO_CABLE_PRESENT = 0x82,
390 IPMI_CC_OEM_DATA_COLLECTION_IN_PROGRESS = 0x82,
391 IPMI_CC_OEM_PAYLOAD_ACTIVATION_LIMIT_REACH = 0x82,
392 IPMI_CC_OEM_NACK_ON_WRITE = 0x83,
393 IPMI_CC_OEM_DATA_COLLECTION_FAILED = 0x83,
394 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITH_ENCRYPTION = 0x83,
395 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITHOUT_ENCRYPTION = 0x84,
396 IPMI_CC_OEM_INVALID_CHECKSUM = 0x85,
397 IPMI_CC_OEM_NO_CABLED_PCIE_PORTS_AVAILABLE = 0xC2,
398};
399
400enum IPMI_RETURN_CODE_EXT
401{
402 IPMI_CC_INVALID_LUN = 0xC2,
403 IPMI_CC_STORGE_LEAK = 0xC4,
404 IPMI_CC_REQUEST_DATA_TRUNCATED = 0xC6,
405 IPMI_CC_REQUEST_DATA_FIELD_LENGTH_LIMIT_EXCEEDED = 0xC8,
406 IPMI_CC_CANNOT_RETURN_NUMBER_OF_REQUESTED_DATA_BYTES = 0xCA,
407 IPMI_CC_REQUEST_SENSOR_DATA_RECORD_NOT_FOUND = 0xCB,
408 IPMI_CC_DESTINATION_UNAVAILABLE = 0xD3,
409 IPMI_CC_PARAMETER_NOT_SUPPORT_IN_PRESENT_STATE = 0xD5,
410};