blob: a6ece9c809152f28077294bac2c5c0b629b72d7a [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;
109} // namespace app
110
111} // namespace intel
112
113} // namespace ipmi
114
115// FIXME: put these in the cpp files that use them
Jason M. Bills64796042018-10-03 16:51:55 -0700116enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800117{
118 ipmiCCPayloadActive = 0x80,
119 ipmiCCInvalidPCIESlotID = 0x80,
120 ipmiCCParameterNotSupported = 0x80,
121 ipmiCCPayloadAlreadyDeactivated = 0x80,
122 ipmiCCSetInProcess = 0x81,
123 ipmiCCPayloadDisable = 0x81,
124 ipmiCCLostArbitration = 0x81,
125 ipmiCCInvalidCablePortIndex = 0x81,
126 ipmiCCHealthStatusNotAvailable = 0x81,
127 ipmiCCBusError = 0x82,
128 ipmiCCReadOnly = 0x82,
129 ipmiCCWriteOnly = 0x82,
130 ipmiCCNoCablePresent = 0x82,
131 ipmiCCDataCollectionInProgress = 0x82,
132 ipmiCCPayloadActivationLimitReached = 0x82,
133 ipmiCCNACKOnWrite = 0x83,
134 ipmiCCDataCollectionFailed = 0x83,
135 ipmiCCCanNotActivateWithEncrption = 0x83,
136 ipmiCCCanNotActivateWithoutEncryption = 0x84,
137 ipmiCCInvalidChecksum = 0x85,
138 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
139
140};
141
Jason M. Bills64796042018-10-03 16:51:55 -0700142enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800143{
144 ipmiCCInvalidLUN = 0xC2,
145 ipmiCCTimeout = 0xC3,
146 ipmiCCStorageLeak = 0xC4,
147 ipmiCCRequestDataTruncated = 0xC6,
148 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
149 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
150 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
151 ipmiCCDestinationUnavailable = 0xD3,
152 ipmiCCParamterNotSupportInPresentState = 0xD5,
153};
154
Jason M. Bills64796042018-10-03 16:51:55 -0700155static constexpr const uint8_t maxBIOSIDLength = 0xFF;
156static constexpr const uint8_t maxCPUNum = 4;
157static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
158static constexpr const char* biosIntf =
159 "xyz.openbmc_project.Inventory.Item.Bios";
160static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800161
Jason M. Bills64796042018-10-03 16:51:55 -0700162static constexpr const char* powerRestoreDelayObjPath =
163 "/xyz/openbmc_project/control/power_restore_delay";
164static constexpr const char* powerRestoreDelayIntf =
165 "xyz.openbmc_project.Control.Power.RestoreDelay";
166static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
167static constexpr const char* processorErrConfigObjPath =
168 "/xyz/openbmc_project/control/processor_error_config";
169static constexpr const char* processorErrConfigIntf =
170 "xyz.openbmc_project.Control.Processor.ErrConfig";
Jason M. Billsb02bf092019-08-15 13:01:56 -0700171static constexpr const char* bmcResetDisablesPath =
172 "/xyz/openbmc_project/control/bmc_reset_disables";
173static constexpr const char* bmcResetDisablesIntf =
174 "xyz.openbmc_project.Control.ResetDisables";
Jason M. Bills64796042018-10-03 16:51:55 -0700175
Yong Li703922d2018-11-06 13:25:31 +0800176static constexpr const char* postCodesObjPath =
177 "/xyz/openbmc_project/State/Boot/PostCode";
178static constexpr const char* postCodesIntf =
179 "xyz.openbmc_project.State.Boot.PostCode";
180
Kuiying Wang45f04982018-12-26 09:23:08 +0800181static constexpr const char* identifyLEDObjPath =
182 "/xyz/openbmc_project/led/physical/identify";
183static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
184static constexpr const char* statusAmberObjPath =
185 "/xyz/openbmc_project/led/physical/status_amber";
186static constexpr const char* statusGreenObjPath =
187 "/xyz/openbmc_project/led/physical/status_green";
188
Yong Li703922d2018-11-06 13:25:31 +0800189static constexpr const uint8_t noShutdownOnOCOT = 0;
190static constexpr const uint8_t shutdownOnOCOT = 1;
191static constexpr const uint8_t noShutdownPolicySupported = 0;
192static constexpr const uint8_t shutdownPolicySupported = 1;
193static constexpr const char* oemShutdownPolicyIntf =
Yong Li0669d192019-05-06 14:01:46 +0800194 "com.intel.Control.OCOTShutdownPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800195static constexpr const char* oemShutdownPolicyObjPath =
Yong Li0669d192019-05-06 14:01:46 +0800196 "/com/intel/control/ocotshutdown_policy_config";
197static constexpr const char* oemShutdownPolicyObjPathProp = "OCOTPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800198
Yong Li23737fe2019-02-19 08:49:55 +0800199static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
200static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
201static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
202
James Feist91244a62019-02-19 15:04:54 -0800203constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
204
Yong Li23737fe2019-02-19 08:49:55 +0800205static constexpr const uint8_t getHostSerialCfgCmd = 0;
206static constexpr const uint8_t setHostSerialCfgCmd = 1;
207
208// parameters:
209// 0: host serial port 1 and 2 normal speed
210// 1: host serial port 1 high spend, port 2 normal speed
211// 2: host serial port 1 normal spend, port 2 high speed
212// 3: host serial port 1 and 2 high speed
213static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530214static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800215
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800216static constexpr const uint8_t selEvtTargetMask = 0xF0;
217static constexpr const uint8_t selEvtTargetShift = 4;
218
219static constexpr const uint8_t targetInstanceMask = 0x0E;
220static constexpr const uint8_t targetInstanceShift = 1;
221
Jason M. Bills64796042018-10-03 16:51:55 -0700222enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800223{
224 mdrStatus = 0x20,
225 mdrComplete = 0x21,
226 mdrEvent = 0x22,
227 mdrRead = 0x23,
228 mdrWrite = 0x24,
229 mdrLock = 0x25,
230 mdr2AgentStatus = 0x30,
231 mdr2GetDir = 0x31,
232 mdr2GetDataInfo = 0x32,
233 mdr2LockData = 0x33,
234 mdr2UnlockData = 0x34,
235 mdr2GetDataBlock = 0x35,
236 mdr2SendDir = 0x38,
237 mdr2SendDataInfoOffer = 0x39,
238 mdr2SendDataInfo = 0x3a,
239 mdr2DataStart = 0x3b,
240 mdr2DataDone = 0x3c,
241 mdr2SendDataBlock = 0x3d,
242};
243
Jason M. Bills64796042018-10-03 16:51:55 -0700244enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800245{
246 biosId,
247 devVer,
248 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700249};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800250
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800251enum class FWUpdateTarget : uint8_t
252{
253 targetBMC = 0x0,
254 targetBIOS = 0x1,
255 targetME = 0x2,
256 targetOEMEWS = 0x4,
257};
258
Jason M. Bills42bd9c82019-06-28 16:39:34 -0700259enum class CPUStatus
260{
261 disabled = 0x0,
262 enabled = 0x1,
263 notPresent = 0x3,
264};
265
Jason M. Bills64796042018-10-03 16:51:55 -0700266#pragma pack(push, 1)
267struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800268{
269 uint8_t node1;
270 uint8_t node2;
271 uint8_t node3;
272 uint8_t node4;
273 uint8_t node5;
274 uint8_t node6;
275 uint8_t clock1;
276 uint8_t clock2;
277 uint8_t timeHigh1;
278 uint8_t timeHigh2;
279 uint8_t timeMid1;
280 uint8_t timeMid2;
281 uint8_t timeLow1;
282 uint8_t timeLow2;
283 uint8_t timeLow3;
284 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700285};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800286
Jason M. Bills64796042018-10-03 16:51:55 -0700287struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800288{
Jason M. Bills64796042018-10-03 16:51:55 -0700289 uint8_t biosIDLength;
290 uint8_t biosId[maxBIOSIDLength];
291};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800292
Jason M. Bills64796042018-10-03 16:51:55 -0700293struct SetPowerRestoreDelayReq
294{
295 uint8_t byteMSB;
296 uint8_t byteLSB;
297};
298
299struct GetPowerRestoreDelayRes
300{
301 uint8_t byteMSB;
302 uint8_t byteLSB;
303};
304
Jason M. Bills64796042018-10-03 16:51:55 -0700305struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800306{
307 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700308 uint8_t data[maxBIOSIDLength];
309};
310
Yong Li703922d2018-11-06 13:25:31 +0800311struct GetOEMShutdownPolicyRes
312{
313 uint8_t policy;
314 uint8_t policySupport;
315};
Kuiying Wang45f04982018-12-26 09:23:08 +0800316
Yong Li23737fe2019-02-19 08:49:55 +0800317struct CfgHostSerialReq
318{
319 uint8_t command;
320 uint8_t parameter;
321};
Kuiying Wang45f04982018-12-26 09:23:08 +0800322#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800323
Zhu, Yungebe560b02019-04-21 21:19:21 -0400324//
325// Fault type enumeration
326//
327enum class RemoteFaultType
328{
329 fan, // 0
330 temperature, // 1
331 power, // 2
332 driveslot, // 3
333 software, // 4
334 memory, // 5
335 max = 6 // 6
336};
337
338// Enumeration for remote fault states as required by the HSC
339//
340enum class RemoteFaultState
341{
342 // fault indicators
343 fanLEDs,
344 cpu1DimmLeds,
345 cpu2DimmLeds,
346 cpu3DimmLeds,
347 cpu4DimmLeds,
348 maxFaultState,
349};
350
351enum class DimmFaultType
352{
353 cpu1cpu2Dimm,
354 cpu3cpu4Dimm,
355 maxFaultGroup,
356};
357
James Feist5f957ca2019-03-14 15:33:55 -0700358enum class setFscParamFlags : uint8_t
359{
360 tcontrol = 0x1,
361 pwmOffset = 0x2,
362 maxPwm = 0x3,
363 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800364};
Vernon Mauerya3702c12019-05-22 13:20:59 -0700365
James Feist63efafa2019-07-24 12:39:21 -0700366enum class dimmOffsetTypes : uint8_t
367{
368 staticCltt = 0x0,
369 dimmPower = 0x2
370};
371
Vernon Mauerya3702c12019-05-22 13:20:59 -0700372// FIXME: this stuff needs to be rewritten
373enum IPMI_INTEL_OEM_RETURN_CODES
374{
375 IPMI_CC_OEM_PAYLOAD_ACTIVE = 0x80,
376 IPMI_CC_OEM_INVALID_PCIE_SLOTID = 0x80,
377 IPMI_CC_OEM_PARAMETER_NOT_SUPPORTED = 0x80,
378 IPMI_CC_OEM_PAYLOAD_ALREADY_DEACTIVATED = 0x80,
379 IPMI_CC_OEM_SET_IN_PROCESS = 0x81,
380 IPMI_CC_OEM_PAYLOAD_DISABLE = 0x81,
381 IPMI_CC_OEM_LOST_ARBITRATION = 0x81,
382 IPMI_CC_OEM_INVALID_CABLE_PORT_INDEX = 0x81,
383 IPMI_CC_OEM_HEALTH_STATUS_NOT_AVAILABLE = 0x81,
384 IPMI_CC_OEM_BUS_ERROR = 0x82,
385 IPMI_CC_OEM_READ_ONLY = 0x82,
386 IPMI_CC_OEM_WRITE_ONLY = 0x82,
387 IPMI_CC_OEM_NO_CABLE_PRESENT = 0x82,
388 IPMI_CC_OEM_DATA_COLLECTION_IN_PROGRESS = 0x82,
389 IPMI_CC_OEM_PAYLOAD_ACTIVATION_LIMIT_REACH = 0x82,
390 IPMI_CC_OEM_NACK_ON_WRITE = 0x83,
391 IPMI_CC_OEM_DATA_COLLECTION_FAILED = 0x83,
392 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITH_ENCRYPTION = 0x83,
393 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITHOUT_ENCRYPTION = 0x84,
394 IPMI_CC_OEM_INVALID_CHECKSUM = 0x85,
395 IPMI_CC_OEM_NO_CABLED_PCIE_PORTS_AVAILABLE = 0xC2,
396};
397
398enum IPMI_RETURN_CODE_EXT
399{
400 IPMI_CC_INVALID_LUN = 0xC2,
401 IPMI_CC_STORGE_LEAK = 0xC4,
402 IPMI_CC_REQUEST_DATA_TRUNCATED = 0xC6,
403 IPMI_CC_REQUEST_DATA_FIELD_LENGTH_LIMIT_EXCEEDED = 0xC8,
404 IPMI_CC_CANNOT_RETURN_NUMBER_OF_REQUESTED_DATA_BYTES = 0xCA,
405 IPMI_CC_REQUEST_SENSOR_DATA_RECORD_NOT_FOUND = 0xCB,
406 IPMI_CC_DESTINATION_UNAVAILABLE = 0xD3,
407 IPMI_CC_PARAMETER_NOT_SUPPORT_IN_PRESENT_STATE = 0xD5,
408};