blob: 777dba451b906f23a494b4d845d2ed81625e0e71 [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;
55static constexpr Cmd cmdSetFanConfig = 0x89;
56static constexpr Cmd cmdGetFanConfig = 0x8a;
57static constexpr Cmd cmdSetFanSpeedOffset = 0x8c;
58static constexpr Cmd cmdGetFanSpeedOffset = 0x8d;
59static constexpr Cmd cmdSetDimmOffset = 0x8e;
60static constexpr Cmd cmdGetDimmOffset = 0x8f;
61static constexpr Cmd cmdSetFscParameter = 0x90;
62static constexpr Cmd cmdGetFscParameter = 0x91;
63static constexpr Cmd cmdGetChassisIdentifier = 0x92;
64static constexpr Cmd cmdReadBaseBoardProductId = 0x93;
65static constexpr Cmd cmdGetProcessorErrConfig = 0x9A;
66static constexpr Cmd cmdSetProcessorErrConfig = 0x9B;
67static constexpr Cmd cmdSetManufacturingData = 0xA1;
68static constexpr Cmd cmdGetManufacturingData = 0xA2;
69static constexpr Cmd cmdGetLEDStatus = 0xB0;
70static constexpr Cmd cmdControlBmcServices = 0xB1;
71static constexpr Cmd cmdGetBmcServiceStatus = 0xB2;
72static constexpr Cmd cmdGetSecurityMode = 0xB3;
73static constexpr Cmd cmdSetSecurityMode = 0xB4;
74static constexpr Cmd cmdMtmKeepAlive = 0xB5;
75static constexpr Cmd cmdGetNmiStatus = 0xE5;
76static constexpr Cmd cmdSetEfiBootOptions = 0xEA;
77static constexpr Cmd cmdGetEfiBootOptions = 0xEB;
78static constexpr Cmd cmdSetNmiStatus = 0xED;
79} // namespace general
80
81namespace platform
82{
83static constexpr Cmd cmdCfgHostSerialPortSpeed = 0x90;
84} // namespace platform
85
86namespace app
87{
88static constexpr Cmd cmdMdrStatus = 0x20;
89static constexpr Cmd cmdMdrComplete = 0x21;
90static constexpr Cmd cmdMdrEvent = 0x22;
91static constexpr Cmd cmdMdrRead = 0x23;
92static constexpr Cmd cmdMdrWrite = 0x24;
93static constexpr Cmd cmdMdrLock = 0x25;
94static constexpr Cmd cmdMdrIIAgentStatus = 0x30;
95static constexpr Cmd cmdMdrIIGetDir = 0x31;
96static constexpr Cmd cmdMdrIIGetDataInfo = 0x32;
97static constexpr Cmd cmdMdrIILockData = 0x33;
98static constexpr Cmd cmdMdrIIUnlockData = 0X34;
99static constexpr Cmd cmdMdrIIGetDataBlock = 0x35;
100static constexpr Cmd cmdMdrIISendDir = 0x38;
101static constexpr Cmd cmdMdrIISendDataInfoOffer = 0x39;
102static constexpr Cmd cmdMdrIISendDataInfo = 0x3a;
103static constexpr Cmd cmdMdrIIDataStart = 0x3b;
104static constexpr Cmd cmdMdrIIDataDone = 0x3c;
105static constexpr Cmd cmdMdrIISendDataBlock = 0x3d;
106} // namespace app
107
108} // namespace intel
109
110} // namespace ipmi
111
112// FIXME: put these in the cpp files that use them
Jason M. Bills64796042018-10-03 16:51:55 -0700113enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800114{
115 ipmiCCPayloadActive = 0x80,
116 ipmiCCInvalidPCIESlotID = 0x80,
117 ipmiCCParameterNotSupported = 0x80,
118 ipmiCCPayloadAlreadyDeactivated = 0x80,
119 ipmiCCSetInProcess = 0x81,
120 ipmiCCPayloadDisable = 0x81,
121 ipmiCCLostArbitration = 0x81,
122 ipmiCCInvalidCablePortIndex = 0x81,
123 ipmiCCHealthStatusNotAvailable = 0x81,
124 ipmiCCBusError = 0x82,
125 ipmiCCReadOnly = 0x82,
126 ipmiCCWriteOnly = 0x82,
127 ipmiCCNoCablePresent = 0x82,
128 ipmiCCDataCollectionInProgress = 0x82,
129 ipmiCCPayloadActivationLimitReached = 0x82,
130 ipmiCCNACKOnWrite = 0x83,
131 ipmiCCDataCollectionFailed = 0x83,
132 ipmiCCCanNotActivateWithEncrption = 0x83,
133 ipmiCCCanNotActivateWithoutEncryption = 0x84,
134 ipmiCCInvalidChecksum = 0x85,
135 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
136
137};
138
Jason M. Bills64796042018-10-03 16:51:55 -0700139enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800140{
141 ipmiCCInvalidLUN = 0xC2,
142 ipmiCCTimeout = 0xC3,
143 ipmiCCStorageLeak = 0xC4,
144 ipmiCCRequestDataTruncated = 0xC6,
145 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
146 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
147 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
148 ipmiCCDestinationUnavailable = 0xD3,
149 ipmiCCParamterNotSupportInPresentState = 0xD5,
150};
151
Jason M. Bills64796042018-10-03 16:51:55 -0700152static constexpr const uint8_t maxBIOSIDLength = 0xFF;
153static constexpr const uint8_t maxCPUNum = 4;
154static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
155static constexpr const char* biosIntf =
156 "xyz.openbmc_project.Inventory.Item.Bios";
157static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800158
Jason M. Bills64796042018-10-03 16:51:55 -0700159static constexpr const char* powerRestoreDelayObjPath =
160 "/xyz/openbmc_project/control/power_restore_delay";
161static constexpr const char* powerRestoreDelayIntf =
162 "xyz.openbmc_project.Control.Power.RestoreDelay";
163static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
164static constexpr const char* processorErrConfigObjPath =
165 "/xyz/openbmc_project/control/processor_error_config";
166static constexpr const char* processorErrConfigIntf =
167 "xyz.openbmc_project.Control.Processor.ErrConfig";
Jason M. Billsb02bf092019-08-15 13:01:56 -0700168static constexpr const char* bmcResetDisablesPath =
169 "/xyz/openbmc_project/control/bmc_reset_disables";
170static constexpr const char* bmcResetDisablesIntf =
171 "xyz.openbmc_project.Control.ResetDisables";
Jason M. Bills64796042018-10-03 16:51:55 -0700172
Yong Li703922d2018-11-06 13:25:31 +0800173static constexpr const char* postCodesObjPath =
174 "/xyz/openbmc_project/State/Boot/PostCode";
175static constexpr const char* postCodesIntf =
176 "xyz.openbmc_project.State.Boot.PostCode";
177
Kuiying Wang45f04982018-12-26 09:23:08 +0800178static constexpr const char* identifyLEDObjPath =
179 "/xyz/openbmc_project/led/physical/identify";
180static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
181static constexpr const char* statusAmberObjPath =
182 "/xyz/openbmc_project/led/physical/status_amber";
183static constexpr const char* statusGreenObjPath =
184 "/xyz/openbmc_project/led/physical/status_green";
185
Yong Li703922d2018-11-06 13:25:31 +0800186static constexpr const uint8_t noShutdownOnOCOT = 0;
187static constexpr const uint8_t shutdownOnOCOT = 1;
188static constexpr const uint8_t noShutdownPolicySupported = 0;
189static constexpr const uint8_t shutdownPolicySupported = 1;
190static constexpr const char* oemShutdownPolicyIntf =
Yong Li0669d192019-05-06 14:01:46 +0800191 "com.intel.Control.OCOTShutdownPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800192static constexpr const char* oemShutdownPolicyObjPath =
Yong Li0669d192019-05-06 14:01:46 +0800193 "/com/intel/control/ocotshutdown_policy_config";
194static constexpr const char* oemShutdownPolicyObjPathProp = "OCOTPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800195
Yong Li23737fe2019-02-19 08:49:55 +0800196static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
197static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
198static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
199
James Feist91244a62019-02-19 15:04:54 -0800200constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
201
Yong Li23737fe2019-02-19 08:49:55 +0800202static constexpr const uint8_t getHostSerialCfgCmd = 0;
203static constexpr const uint8_t setHostSerialCfgCmd = 1;
204
205// parameters:
206// 0: host serial port 1 and 2 normal speed
207// 1: host serial port 1 high spend, port 2 normal speed
208// 2: host serial port 1 normal spend, port 2 high speed
209// 3: host serial port 1 and 2 high speed
210static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530211static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800212
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800213static constexpr const uint8_t selEvtTargetMask = 0xF0;
214static constexpr const uint8_t selEvtTargetShift = 4;
215
216static constexpr const uint8_t targetInstanceMask = 0x0E;
217static constexpr const uint8_t targetInstanceShift = 1;
218
Jason M. Bills64796042018-10-03 16:51:55 -0700219enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800220{
221 mdrStatus = 0x20,
222 mdrComplete = 0x21,
223 mdrEvent = 0x22,
224 mdrRead = 0x23,
225 mdrWrite = 0x24,
226 mdrLock = 0x25,
227 mdr2AgentStatus = 0x30,
228 mdr2GetDir = 0x31,
229 mdr2GetDataInfo = 0x32,
230 mdr2LockData = 0x33,
231 mdr2UnlockData = 0x34,
232 mdr2GetDataBlock = 0x35,
233 mdr2SendDir = 0x38,
234 mdr2SendDataInfoOffer = 0x39,
235 mdr2SendDataInfo = 0x3a,
236 mdr2DataStart = 0x3b,
237 mdr2DataDone = 0x3c,
238 mdr2SendDataBlock = 0x3d,
239};
240
Jason M. Bills64796042018-10-03 16:51:55 -0700241enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800242{
243 biosId,
244 devVer,
245 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700246};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800247
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800248enum class FWUpdateTarget : uint8_t
249{
250 targetBMC = 0x0,
251 targetBIOS = 0x1,
252 targetME = 0x2,
253 targetOEMEWS = 0x4,
254};
255
Jason M. Bills42bd9c82019-06-28 16:39:34 -0700256enum class CPUStatus
257{
258 disabled = 0x0,
259 enabled = 0x1,
260 notPresent = 0x3,
261};
262
Jason M. Bills64796042018-10-03 16:51:55 -0700263#pragma pack(push, 1)
264struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800265{
266 uint8_t node1;
267 uint8_t node2;
268 uint8_t node3;
269 uint8_t node4;
270 uint8_t node5;
271 uint8_t node6;
272 uint8_t clock1;
273 uint8_t clock2;
274 uint8_t timeHigh1;
275 uint8_t timeHigh2;
276 uint8_t timeMid1;
277 uint8_t timeMid2;
278 uint8_t timeLow1;
279 uint8_t timeLow2;
280 uint8_t timeLow3;
281 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700282};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800283
Jason M. Bills64796042018-10-03 16:51:55 -0700284struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800285{
Jason M. Bills64796042018-10-03 16:51:55 -0700286 uint8_t biosIDLength;
287 uint8_t biosId[maxBIOSIDLength];
288};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800289
Jason M. Bills64796042018-10-03 16:51:55 -0700290struct SetPowerRestoreDelayReq
291{
292 uint8_t byteMSB;
293 uint8_t byteLSB;
294};
295
296struct GetPowerRestoreDelayRes
297{
298 uint8_t byteMSB;
299 uint8_t byteLSB;
300};
301
302struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800303{
304 uint8_t entityType;
305 uint8_t countToRead;
306 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700307};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800308
Jason M. Bills64796042018-10-03 16:51:55 -0700309struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800310{
311 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700312 uint8_t data[maxBIOSIDLength];
313};
314
Yong Li703922d2018-11-06 13:25:31 +0800315struct GetOEMShutdownPolicyRes
316{
317 uint8_t policy;
318 uint8_t policySupport;
319};
Kuiying Wang45f04982018-12-26 09:23:08 +0800320
James Feist91244a62019-02-19 15:04:54 -0800321struct SetFanConfigReq
322{
323 uint8_t selectedProfile;
324 uint8_t flags;
325 // other parameters from previous generation are not supported
326};
Yong Li23737fe2019-02-19 08:49:55 +0800327struct CfgHostSerialReq
328{
329 uint8_t command;
330 uint8_t parameter;
331};
Kuiying Wang45f04982018-12-26 09:23:08 +0800332#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800333
Zhu, Yungebe560b02019-04-21 21:19:21 -0400334//
335// Fault type enumeration
336//
337enum class RemoteFaultType
338{
339 fan, // 0
340 temperature, // 1
341 power, // 2
342 driveslot, // 3
343 software, // 4
344 memory, // 5
345 max = 6 // 6
346};
347
348// Enumeration for remote fault states as required by the HSC
349//
350enum class RemoteFaultState
351{
352 // fault indicators
353 fanLEDs,
354 cpu1DimmLeds,
355 cpu2DimmLeds,
356 cpu3DimmLeds,
357 cpu4DimmLeds,
358 maxFaultState,
359};
360
361enum class DimmFaultType
362{
363 cpu1cpu2Dimm,
364 cpu3cpu4Dimm,
365 maxFaultGroup,
366};
367
James Feist91244a62019-02-19 15:04:54 -0800368enum class setFanProfileFlags : uint8_t
369{
370 setFanProfile = 7,
371 setPerfAcousMode = 6,
372 // reserved [5:3]
373 performAcousSelect = 2
374 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700375};
376
377enum class setFscParamFlags : uint8_t
378{
379 tcontrol = 0x1,
380 pwmOffset = 0x2,
381 maxPwm = 0x3,
382 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800383};
Vernon Mauerya3702c12019-05-22 13:20:59 -0700384
James Feist63efafa2019-07-24 12:39:21 -0700385enum class dimmOffsetTypes : uint8_t
386{
387 staticCltt = 0x0,
388 dimmPower = 0x2
389};
390
Vernon Mauerya3702c12019-05-22 13:20:59 -0700391// FIXME: this stuff needs to be rewritten
392enum IPMI_INTEL_OEM_RETURN_CODES
393{
394 IPMI_CC_OEM_PAYLOAD_ACTIVE = 0x80,
395 IPMI_CC_OEM_INVALID_PCIE_SLOTID = 0x80,
396 IPMI_CC_OEM_PARAMETER_NOT_SUPPORTED = 0x80,
397 IPMI_CC_OEM_PAYLOAD_ALREADY_DEACTIVATED = 0x80,
398 IPMI_CC_OEM_SET_IN_PROCESS = 0x81,
399 IPMI_CC_OEM_PAYLOAD_DISABLE = 0x81,
400 IPMI_CC_OEM_LOST_ARBITRATION = 0x81,
401 IPMI_CC_OEM_INVALID_CABLE_PORT_INDEX = 0x81,
402 IPMI_CC_OEM_HEALTH_STATUS_NOT_AVAILABLE = 0x81,
403 IPMI_CC_OEM_BUS_ERROR = 0x82,
404 IPMI_CC_OEM_READ_ONLY = 0x82,
405 IPMI_CC_OEM_WRITE_ONLY = 0x82,
406 IPMI_CC_OEM_NO_CABLE_PRESENT = 0x82,
407 IPMI_CC_OEM_DATA_COLLECTION_IN_PROGRESS = 0x82,
408 IPMI_CC_OEM_PAYLOAD_ACTIVATION_LIMIT_REACH = 0x82,
409 IPMI_CC_OEM_NACK_ON_WRITE = 0x83,
410 IPMI_CC_OEM_DATA_COLLECTION_FAILED = 0x83,
411 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITH_ENCRYPTION = 0x83,
412 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITHOUT_ENCRYPTION = 0x84,
413 IPMI_CC_OEM_INVALID_CHECKSUM = 0x85,
414 IPMI_CC_OEM_NO_CABLED_PCIE_PORTS_AVAILABLE = 0xC2,
415};
416
417enum IPMI_RETURN_CODE_EXT
418{
419 IPMI_CC_INVALID_LUN = 0xC2,
420 IPMI_CC_STORGE_LEAK = 0xC4,
421 IPMI_CC_REQUEST_DATA_TRUNCATED = 0xC6,
422 IPMI_CC_REQUEST_DATA_FIELD_LENGTH_LIMIT_EXCEEDED = 0xC8,
423 IPMI_CC_CANNOT_RETURN_NUMBER_OF_REQUESTED_DATA_BYTES = 0xCA,
424 IPMI_CC_REQUEST_SENSOR_DATA_RECORD_NOT_FOUND = 0xCB,
425 IPMI_CC_DESTINATION_UNAVAILABLE = 0xD3,
426 IPMI_CC_PARAMETER_NOT_SUPPORT_IN_PRESENT_STATE = 0xD5,
427};