blob: 753fdf346912a8f60eb84fb5a11a56144067f05b [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;
Cheng C Yang4e6ee152019-09-25 10:27:44 +080079static constexpr Cmd cmdGetPSUVersion = 0xEF;
Vernon Mauery98bbf692019-09-16 11:14:59 -070080} // namespace general
81
82namespace platform
83{
84static constexpr Cmd cmdCfgHostSerialPortSpeed = 0x90;
Yong Li068b4f22019-09-17 16:32:18 +080085static constexpr Cmd cmdClearCMOS = 0x91;
Vernon Mauery98bbf692019-09-16 11:14:59 -070086} // namespace platform
87
88namespace app
89{
90static constexpr Cmd cmdMdrStatus = 0x20;
91static constexpr Cmd cmdMdrComplete = 0x21;
92static constexpr Cmd cmdMdrEvent = 0x22;
93static constexpr Cmd cmdMdrRead = 0x23;
94static constexpr Cmd cmdMdrWrite = 0x24;
95static constexpr Cmd cmdMdrLock = 0x25;
96static constexpr Cmd cmdMdrIIAgentStatus = 0x30;
97static constexpr Cmd cmdMdrIIGetDir = 0x31;
98static constexpr Cmd cmdMdrIIGetDataInfo = 0x32;
99static constexpr Cmd cmdMdrIILockData = 0x33;
100static constexpr Cmd cmdMdrIIUnlockData = 0X34;
101static constexpr Cmd cmdMdrIIGetDataBlock = 0x35;
102static constexpr Cmd cmdMdrIISendDir = 0x38;
103static constexpr Cmd cmdMdrIISendDataInfoOffer = 0x39;
104static constexpr Cmd cmdMdrIISendDataInfo = 0x3a;
105static constexpr Cmd cmdMdrIIDataStart = 0x3b;
106static constexpr Cmd cmdMdrIIDataDone = 0x3c;
107static constexpr Cmd cmdMdrIISendDataBlock = 0x3d;
108} // namespace app
109
110} // namespace intel
111
112} // namespace ipmi
113
114// FIXME: put these in the cpp files that use them
Jason M. Bills64796042018-10-03 16:51:55 -0700115enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800116{
117 ipmiCCPayloadActive = 0x80,
118 ipmiCCInvalidPCIESlotID = 0x80,
119 ipmiCCParameterNotSupported = 0x80,
120 ipmiCCPayloadAlreadyDeactivated = 0x80,
121 ipmiCCSetInProcess = 0x81,
122 ipmiCCPayloadDisable = 0x81,
123 ipmiCCLostArbitration = 0x81,
124 ipmiCCInvalidCablePortIndex = 0x81,
125 ipmiCCHealthStatusNotAvailable = 0x81,
126 ipmiCCBusError = 0x82,
127 ipmiCCReadOnly = 0x82,
128 ipmiCCWriteOnly = 0x82,
129 ipmiCCNoCablePresent = 0x82,
130 ipmiCCDataCollectionInProgress = 0x82,
131 ipmiCCPayloadActivationLimitReached = 0x82,
132 ipmiCCNACKOnWrite = 0x83,
133 ipmiCCDataCollectionFailed = 0x83,
134 ipmiCCCanNotActivateWithEncrption = 0x83,
135 ipmiCCCanNotActivateWithoutEncryption = 0x84,
136 ipmiCCInvalidChecksum = 0x85,
137 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
138
139};
140
Jason M. Bills64796042018-10-03 16:51:55 -0700141enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800142{
143 ipmiCCInvalidLUN = 0xC2,
144 ipmiCCTimeout = 0xC3,
145 ipmiCCStorageLeak = 0xC4,
146 ipmiCCRequestDataTruncated = 0xC6,
147 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
148 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
149 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
150 ipmiCCDestinationUnavailable = 0xD3,
151 ipmiCCParamterNotSupportInPresentState = 0xD5,
152};
153
Jason M. Bills64796042018-10-03 16:51:55 -0700154static constexpr const uint8_t maxBIOSIDLength = 0xFF;
155static constexpr const uint8_t maxCPUNum = 4;
156static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
157static constexpr const char* biosIntf =
158 "xyz.openbmc_project.Inventory.Item.Bios";
159static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800160
Jason M. Bills64796042018-10-03 16:51:55 -0700161static constexpr const char* powerRestoreDelayObjPath =
162 "/xyz/openbmc_project/control/power_restore_delay";
163static constexpr const char* powerRestoreDelayIntf =
164 "xyz.openbmc_project.Control.Power.RestoreDelay";
165static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
166static constexpr const char* processorErrConfigObjPath =
167 "/xyz/openbmc_project/control/processor_error_config";
168static constexpr const char* processorErrConfigIntf =
169 "xyz.openbmc_project.Control.Processor.ErrConfig";
Jason M. Billsb02bf092019-08-15 13:01:56 -0700170static constexpr const char* bmcResetDisablesPath =
171 "/xyz/openbmc_project/control/bmc_reset_disables";
172static constexpr const char* bmcResetDisablesIntf =
173 "xyz.openbmc_project.Control.ResetDisables";
Jason M. Bills64796042018-10-03 16:51:55 -0700174
Yong Li703922d2018-11-06 13:25:31 +0800175static constexpr const char* postCodesObjPath =
176 "/xyz/openbmc_project/State/Boot/PostCode";
177static constexpr const char* postCodesIntf =
178 "xyz.openbmc_project.State.Boot.PostCode";
179
Kuiying Wang45f04982018-12-26 09:23:08 +0800180static constexpr const char* identifyLEDObjPath =
181 "/xyz/openbmc_project/led/physical/identify";
182static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
183static constexpr const char* statusAmberObjPath =
184 "/xyz/openbmc_project/led/physical/status_amber";
185static constexpr const char* statusGreenObjPath =
186 "/xyz/openbmc_project/led/physical/status_green";
187
Yong Li703922d2018-11-06 13:25:31 +0800188static constexpr const uint8_t noShutdownOnOCOT = 0;
189static constexpr const uint8_t shutdownOnOCOT = 1;
190static constexpr const uint8_t noShutdownPolicySupported = 0;
191static constexpr const uint8_t shutdownPolicySupported = 1;
192static constexpr const char* oemShutdownPolicyIntf =
Yong Li0669d192019-05-06 14:01:46 +0800193 "com.intel.Control.OCOTShutdownPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800194static constexpr const char* oemShutdownPolicyObjPath =
Yong Li0669d192019-05-06 14:01:46 +0800195 "/com/intel/control/ocotshutdown_policy_config";
196static constexpr const char* oemShutdownPolicyObjPathProp = "OCOTPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800197
Yong Li23737fe2019-02-19 08:49:55 +0800198static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
199static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
200static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
201
James Feist91244a62019-02-19 15:04:54 -0800202constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
203
Yong Li23737fe2019-02-19 08:49:55 +0800204static constexpr const uint8_t getHostSerialCfgCmd = 0;
205static constexpr const uint8_t setHostSerialCfgCmd = 1;
206
207// parameters:
208// 0: host serial port 1 and 2 normal speed
209// 1: host serial port 1 high spend, port 2 normal speed
210// 2: host serial port 1 normal spend, port 2 high speed
211// 3: host serial port 1 and 2 high speed
212static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530213static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800214
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800215static constexpr const uint8_t selEvtTargetMask = 0xF0;
216static constexpr const uint8_t selEvtTargetShift = 4;
217
218static constexpr const uint8_t targetInstanceMask = 0x0E;
219static constexpr const uint8_t targetInstanceShift = 1;
220
Jason M. Bills64796042018-10-03 16:51:55 -0700221enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800222{
223 mdrStatus = 0x20,
224 mdrComplete = 0x21,
225 mdrEvent = 0x22,
226 mdrRead = 0x23,
227 mdrWrite = 0x24,
228 mdrLock = 0x25,
229 mdr2AgentStatus = 0x30,
230 mdr2GetDir = 0x31,
231 mdr2GetDataInfo = 0x32,
232 mdr2LockData = 0x33,
233 mdr2UnlockData = 0x34,
234 mdr2GetDataBlock = 0x35,
235 mdr2SendDir = 0x38,
236 mdr2SendDataInfoOffer = 0x39,
237 mdr2SendDataInfo = 0x3a,
238 mdr2DataStart = 0x3b,
239 mdr2DataDone = 0x3c,
240 mdr2SendDataBlock = 0x3d,
241};
242
Jason M. Bills64796042018-10-03 16:51:55 -0700243enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800244{
245 biosId,
246 devVer,
247 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700248};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800249
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800250enum class FWUpdateTarget : uint8_t
251{
252 targetBMC = 0x0,
253 targetBIOS = 0x1,
254 targetME = 0x2,
255 targetOEMEWS = 0x4,
256};
257
Jason M. Bills42bd9c82019-06-28 16:39:34 -0700258enum class CPUStatus
259{
260 disabled = 0x0,
261 enabled = 0x1,
262 notPresent = 0x3,
263};
264
Jason M. Bills64796042018-10-03 16:51:55 -0700265#pragma pack(push, 1)
266struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800267{
268 uint8_t node1;
269 uint8_t node2;
270 uint8_t node3;
271 uint8_t node4;
272 uint8_t node5;
273 uint8_t node6;
274 uint8_t clock1;
275 uint8_t clock2;
276 uint8_t timeHigh1;
277 uint8_t timeHigh2;
278 uint8_t timeMid1;
279 uint8_t timeMid2;
280 uint8_t timeLow1;
281 uint8_t timeLow2;
282 uint8_t timeLow3;
283 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700284};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800285
Jason M. Bills64796042018-10-03 16:51:55 -0700286struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800287{
Jason M. Bills64796042018-10-03 16:51:55 -0700288 uint8_t biosIDLength;
289 uint8_t biosId[maxBIOSIDLength];
290};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800291
Jason M. Bills64796042018-10-03 16:51:55 -0700292struct SetPowerRestoreDelayReq
293{
294 uint8_t byteMSB;
295 uint8_t byteLSB;
296};
297
298struct GetPowerRestoreDelayRes
299{
300 uint8_t byteMSB;
301 uint8_t byteLSB;
302};
303
Jason M. Bills64796042018-10-03 16:51:55 -0700304struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800305{
306 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700307 uint8_t data[maxBIOSIDLength];
308};
309
Yong Li703922d2018-11-06 13:25:31 +0800310struct GetOEMShutdownPolicyRes
311{
312 uint8_t policy;
313 uint8_t policySupport;
314};
Kuiying Wang45f04982018-12-26 09:23:08 +0800315
James Feist91244a62019-02-19 15:04:54 -0800316struct SetFanConfigReq
317{
318 uint8_t selectedProfile;
319 uint8_t flags;
320 // other parameters from previous generation are not supported
321};
Yong Li23737fe2019-02-19 08:49:55 +0800322struct CfgHostSerialReq
323{
324 uint8_t command;
325 uint8_t parameter;
326};
Kuiying Wang45f04982018-12-26 09:23:08 +0800327#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800328
Zhu, Yungebe560b02019-04-21 21:19:21 -0400329//
330// Fault type enumeration
331//
332enum 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//
345enum class RemoteFaultState
346{
347 // fault indicators
348 fanLEDs,
349 cpu1DimmLeds,
350 cpu2DimmLeds,
351 cpu3DimmLeds,
352 cpu4DimmLeds,
353 maxFaultState,
354};
355
356enum class DimmFaultType
357{
358 cpu1cpu2Dimm,
359 cpu3cpu4Dimm,
360 maxFaultGroup,
361};
362
James Feist91244a62019-02-19 15:04:54 -0800363enum class setFanProfileFlags : uint8_t
364{
365 setFanProfile = 7,
366 setPerfAcousMode = 6,
367 // reserved [5:3]
368 performAcousSelect = 2
369 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700370};
371
372enum class setFscParamFlags : uint8_t
373{
374 tcontrol = 0x1,
375 pwmOffset = 0x2,
376 maxPwm = 0x3,
377 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800378};
Vernon Mauerya3702c12019-05-22 13:20:59 -0700379
James Feist63efafa2019-07-24 12:39:21 -0700380enum class dimmOffsetTypes : uint8_t
381{
382 staticCltt = 0x0,
383 dimmPower = 0x2
384};
385
Vernon Mauerya3702c12019-05-22 13:20:59 -0700386// FIXME: this stuff needs to be rewritten
387enum IPMI_INTEL_OEM_RETURN_CODES
388{
389 IPMI_CC_OEM_PAYLOAD_ACTIVE = 0x80,
390 IPMI_CC_OEM_INVALID_PCIE_SLOTID = 0x80,
391 IPMI_CC_OEM_PARAMETER_NOT_SUPPORTED = 0x80,
392 IPMI_CC_OEM_PAYLOAD_ALREADY_DEACTIVATED = 0x80,
393 IPMI_CC_OEM_SET_IN_PROCESS = 0x81,
394 IPMI_CC_OEM_PAYLOAD_DISABLE = 0x81,
395 IPMI_CC_OEM_LOST_ARBITRATION = 0x81,
396 IPMI_CC_OEM_INVALID_CABLE_PORT_INDEX = 0x81,
397 IPMI_CC_OEM_HEALTH_STATUS_NOT_AVAILABLE = 0x81,
398 IPMI_CC_OEM_BUS_ERROR = 0x82,
399 IPMI_CC_OEM_READ_ONLY = 0x82,
400 IPMI_CC_OEM_WRITE_ONLY = 0x82,
401 IPMI_CC_OEM_NO_CABLE_PRESENT = 0x82,
402 IPMI_CC_OEM_DATA_COLLECTION_IN_PROGRESS = 0x82,
403 IPMI_CC_OEM_PAYLOAD_ACTIVATION_LIMIT_REACH = 0x82,
404 IPMI_CC_OEM_NACK_ON_WRITE = 0x83,
405 IPMI_CC_OEM_DATA_COLLECTION_FAILED = 0x83,
406 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITH_ENCRYPTION = 0x83,
407 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITHOUT_ENCRYPTION = 0x84,
408 IPMI_CC_OEM_INVALID_CHECKSUM = 0x85,
409 IPMI_CC_OEM_NO_CABLED_PCIE_PORTS_AVAILABLE = 0xC2,
410};
411
412enum IPMI_RETURN_CODE_EXT
413{
414 IPMI_CC_INVALID_LUN = 0xC2,
415 IPMI_CC_STORGE_LEAK = 0xC4,
416 IPMI_CC_REQUEST_DATA_TRUNCATED = 0xC6,
417 IPMI_CC_REQUEST_DATA_FIELD_LENGTH_LIMIT_EXCEEDED = 0xC8,
418 IPMI_CC_CANNOT_RETURN_NUMBER_OF_REQUESTED_DATA_BYTES = 0xCA,
419 IPMI_CC_REQUEST_SENSOR_DATA_RECORD_NOT_FOUND = 0xCB,
420 IPMI_CC_DESTINATION_UNAVAILABLE = 0xD3,
421 IPMI_CC_PARAMETER_NOT_SUPPORT_IN_PRESENT_STATE = 0xD5,
422};