blob: 6852aa9e7cd785ed7bd4fb3638539e8e2f8ede1a [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
Suryakanth Sekard509eb92018-11-15 17:44:11 +053019#include <user_channel/user_layer.hpp>
Jason M. Bills64796042018-10-03 16:51:55 -070020enum class IPMINetfnIntelOEMGeneralCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080021{
Richard Marian Thomaiyar390b4352019-08-24 17:39:46 +053022 cmdGetSmSignal = 0x14,
23 cmdSetSmSignal = 0x15,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080024 cmdSetBIOSID = 0x26,
25 cmdGetOEMDeviceInfo = 0x27,
Cheng C Yang773703a2019-08-15 09:41:11 +080026 cmdSetColdRedundancyConfig = 0x2d,
27 cmdGetColdRedundancyConfig = 0x2e,
Jason M. Bills64796042018-10-03 16:51:55 -070028 cmdGetAICSlotFRUIDSlotPosRecords = 0x31,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080029 cmdSetSystemGUID = 0x41,
Jason M. Billsb02bf092019-08-15 13:01:56 -070030 cmdDisableBMCSystemReset = 0x42,
31 cmdGetBMCResetDisables = 0x43,
Jia, Chunhuicc49b542019-03-20 15:41:07 +080032 cmdSendEmbeddedFWUpdStatus = 0x44,
Jason M. Bills64796042018-10-03 16:51:55 -070033 cmdSetPowerRestoreDelay = 0x54,
34 cmdGetPowerRestoreDelay = 0x55,
Zhu, Yungebe560b02019-04-21 21:19:21 -040035 cmdSetFaultIndication = 0x57,
Suryakanth Sekard509eb92018-11-15 17:44:11 +053036 cmdSetOEMUser2Activation = 0x5A,
Richard Marian Thomaiyarfc5e9852019-04-14 15:06:27 +053037 cmdSetSpecialUserPassword = 0x5F,
Yong Li703922d2018-11-06 13:25:31 +080038 cmdSetShutdownPolicy = 0x60,
39 cmdGetShutdownPolicy = 0x62,
James Feist91244a62019-02-19 15:04:54 -080040 cmdSetFanConfig = 0x89,
41 cmdGetFanConfig = 0x8a,
James Feistacc8a4e2019-04-02 14:23:57 -070042 cmdSetFanSpeedOffset = 0x8c,
43 cmdGetFanSpeedOffset = 0x8d,
James Feist63efafa2019-07-24 12:39:21 -070044 cmdSetDimmOffset = 0x8e,
45 cmdGetDimmOffset = 0x8f,
James Feist5f957ca2019-03-14 15:33:55 -070046 cmdSetFscParameter = 0x90,
47 cmdGetFscParameter = 0x91,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080048 cmdGetChassisIdentifier = 0x92,
Richard Marian Thomaiyarea537d52019-04-24 21:33:48 +053049 cmdReadBaseBoardProductId = 0x93,
Jason M. Bills64796042018-10-03 16:51:55 -070050 cmdGetProcessorErrConfig = 0x9A,
51 cmdSetProcessorErrConfig = 0x9B,
Richard Marian Thomaiyar1f0839c2019-08-25 20:10:52 +053052 cmdSetManufacturingData = 0xA1,
53 cmdGetManufacturingData = 0xA2,
Kuiying Wang45f04982018-12-26 09:23:08 +080054 cmdGetLEDStatus = 0xB0,
Richard Marian Thomaiyar390b4352019-08-24 17:39:46 +053055 cmdControlBmcServices = 0xB1,
56 cmdGetBmcServiceStatus = 0xB2,
Richard Marian Thomaiyard801e462019-06-20 01:05:40 +053057 cmdGetSecurityMode = 0xB3,
58 cmdSetSecurityMode = 0xB4,
Richard Marian Thomaiyar666dd012019-08-02 20:55:37 +053059 cmdMtmKeepAlive = 0xB5,
Chen Yugang39736d52019-07-12 16:24:33 +080060 cmdGetNmiStatus = 0xE5,
Chen,Yugang4f7e76b2019-08-20 09:28:06 +080061 cmdSetEfiBootOptions = 0xEA,
62 cmdGetEfiBootOptions = 0xEB,
Chen Yugang39736d52019-07-12 16:24:33 +080063 cmdSetNmiStatus = 0xED,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080064};
65
Yong Li23737fe2019-02-19 08:49:55 +080066enum class IPMINetfnIntelOEMPlatformCmd
67{
68 cmdCfgHostSerialPortSpeed = 0x90,
69};
70
Jason M. Bills64796042018-10-03 16:51:55 -070071enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080072{
73 ipmiCCPayloadActive = 0x80,
74 ipmiCCInvalidPCIESlotID = 0x80,
75 ipmiCCParameterNotSupported = 0x80,
76 ipmiCCPayloadAlreadyDeactivated = 0x80,
77 ipmiCCSetInProcess = 0x81,
78 ipmiCCPayloadDisable = 0x81,
79 ipmiCCLostArbitration = 0x81,
80 ipmiCCInvalidCablePortIndex = 0x81,
81 ipmiCCHealthStatusNotAvailable = 0x81,
82 ipmiCCBusError = 0x82,
83 ipmiCCReadOnly = 0x82,
84 ipmiCCWriteOnly = 0x82,
85 ipmiCCNoCablePresent = 0x82,
86 ipmiCCDataCollectionInProgress = 0x82,
87 ipmiCCPayloadActivationLimitReached = 0x82,
88 ipmiCCNACKOnWrite = 0x83,
89 ipmiCCDataCollectionFailed = 0x83,
90 ipmiCCCanNotActivateWithEncrption = 0x83,
91 ipmiCCCanNotActivateWithoutEncryption = 0x84,
92 ipmiCCInvalidChecksum = 0x85,
93 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
94
95};
96
Jason M. Bills64796042018-10-03 16:51:55 -070097enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080098{
99 ipmiCCInvalidLUN = 0xC2,
100 ipmiCCTimeout = 0xC3,
101 ipmiCCStorageLeak = 0xC4,
102 ipmiCCRequestDataTruncated = 0xC6,
103 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
104 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
105 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
106 ipmiCCDestinationUnavailable = 0xD3,
107 ipmiCCParamterNotSupportInPresentState = 0xD5,
108};
109
Jason M. Bills64796042018-10-03 16:51:55 -0700110constexpr const uint8_t netfunIntelAppOEM = 0x3E;
111static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800112 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
113 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +0800114
115// Intel OEM Platform code is 0x32
116static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -0700117static constexpr const uint8_t maxBIOSIDLength = 0xFF;
118static constexpr const uint8_t maxCPUNum = 4;
119static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
120static constexpr const char* biosIntf =
121 "xyz.openbmc_project.Inventory.Item.Bios";
122static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800123
Jason M. Bills64796042018-10-03 16:51:55 -0700124static constexpr const char* powerRestoreDelayObjPath =
125 "/xyz/openbmc_project/control/power_restore_delay";
126static constexpr const char* powerRestoreDelayIntf =
127 "xyz.openbmc_project.Control.Power.RestoreDelay";
128static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
129static constexpr const char* processorErrConfigObjPath =
130 "/xyz/openbmc_project/control/processor_error_config";
131static constexpr const char* processorErrConfigIntf =
132 "xyz.openbmc_project.Control.Processor.ErrConfig";
Jason M. Billsb02bf092019-08-15 13:01:56 -0700133static constexpr const char* bmcResetDisablesPath =
134 "/xyz/openbmc_project/control/bmc_reset_disables";
135static constexpr const char* bmcResetDisablesIntf =
136 "xyz.openbmc_project.Control.ResetDisables";
Jason M. Bills64796042018-10-03 16:51:55 -0700137
Yong Li703922d2018-11-06 13:25:31 +0800138static constexpr const char* postCodesObjPath =
139 "/xyz/openbmc_project/State/Boot/PostCode";
140static constexpr const char* postCodesIntf =
141 "xyz.openbmc_project.State.Boot.PostCode";
142
Kuiying Wang45f04982018-12-26 09:23:08 +0800143static constexpr const char* identifyLEDObjPath =
144 "/xyz/openbmc_project/led/physical/identify";
145static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
146static constexpr const char* statusAmberObjPath =
147 "/xyz/openbmc_project/led/physical/status_amber";
148static constexpr const char* statusGreenObjPath =
149 "/xyz/openbmc_project/led/physical/status_green";
150
Yong Li703922d2018-11-06 13:25:31 +0800151static constexpr const uint8_t noShutdownOnOCOT = 0;
152static constexpr const uint8_t shutdownOnOCOT = 1;
153static constexpr const uint8_t noShutdownPolicySupported = 0;
154static constexpr const uint8_t shutdownPolicySupported = 1;
155static constexpr const char* oemShutdownPolicyIntf =
Yong Li0669d192019-05-06 14:01:46 +0800156 "com.intel.Control.OCOTShutdownPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800157static constexpr const char* oemShutdownPolicyObjPath =
Yong Li0669d192019-05-06 14:01:46 +0800158 "/com/intel/control/ocotshutdown_policy_config";
159static constexpr const char* oemShutdownPolicyObjPathProp = "OCOTPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800160
Yong Li23737fe2019-02-19 08:49:55 +0800161static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
162static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
163static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
164
James Feist91244a62019-02-19 15:04:54 -0800165constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
166
Yong Li23737fe2019-02-19 08:49:55 +0800167static constexpr const uint8_t getHostSerialCfgCmd = 0;
168static constexpr const uint8_t setHostSerialCfgCmd = 1;
169
170// parameters:
171// 0: host serial port 1 and 2 normal speed
172// 1: host serial port 1 high spend, port 2 normal speed
173// 2: host serial port 1 normal spend, port 2 high speed
174// 3: host serial port 1 and 2 high speed
175static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530176static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800177
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800178static constexpr const uint8_t selEvtTargetMask = 0xF0;
179static constexpr const uint8_t selEvtTargetShift = 4;
180
181static constexpr const uint8_t targetInstanceMask = 0x0E;
182static constexpr const uint8_t targetInstanceShift = 1;
183
Jason M. Bills64796042018-10-03 16:51:55 -0700184enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800185{
186 mdrStatus = 0x20,
187 mdrComplete = 0x21,
188 mdrEvent = 0x22,
189 mdrRead = 0x23,
190 mdrWrite = 0x24,
191 mdrLock = 0x25,
192 mdr2AgentStatus = 0x30,
193 mdr2GetDir = 0x31,
194 mdr2GetDataInfo = 0x32,
195 mdr2LockData = 0x33,
196 mdr2UnlockData = 0x34,
197 mdr2GetDataBlock = 0x35,
198 mdr2SendDir = 0x38,
199 mdr2SendDataInfoOffer = 0x39,
200 mdr2SendDataInfo = 0x3a,
201 mdr2DataStart = 0x3b,
202 mdr2DataDone = 0x3c,
203 mdr2SendDataBlock = 0x3d,
204};
205
Jason M. Bills64796042018-10-03 16:51:55 -0700206enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800207{
208 biosId,
209 devVer,
210 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700211};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800212
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800213enum class FWUpdateTarget : uint8_t
214{
215 targetBMC = 0x0,
216 targetBIOS = 0x1,
217 targetME = 0x2,
218 targetOEMEWS = 0x4,
219};
220
Jason M. Bills42bd9c82019-06-28 16:39:34 -0700221enum class CPUStatus
222{
223 disabled = 0x0,
224 enabled = 0x1,
225 notPresent = 0x3,
226};
227
Jason M. Bills64796042018-10-03 16:51:55 -0700228#pragma pack(push, 1)
229struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800230{
231 uint8_t node1;
232 uint8_t node2;
233 uint8_t node3;
234 uint8_t node4;
235 uint8_t node5;
236 uint8_t node6;
237 uint8_t clock1;
238 uint8_t clock2;
239 uint8_t timeHigh1;
240 uint8_t timeHigh2;
241 uint8_t timeMid1;
242 uint8_t timeMid2;
243 uint8_t timeLow1;
244 uint8_t timeLow2;
245 uint8_t timeLow3;
246 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700247};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800248
Jason M. Bills64796042018-10-03 16:51:55 -0700249struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800250{
Jason M. Bills64796042018-10-03 16:51:55 -0700251 uint8_t biosIDLength;
252 uint8_t biosId[maxBIOSIDLength];
253};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800254
Jason M. Bills64796042018-10-03 16:51:55 -0700255struct SetPowerRestoreDelayReq
256{
257 uint8_t byteMSB;
258 uint8_t byteLSB;
259};
260
261struct GetPowerRestoreDelayRes
262{
263 uint8_t byteMSB;
264 uint8_t byteLSB;
265};
266
267struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800268{
269 uint8_t entityType;
270 uint8_t countToRead;
271 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700272};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800273
Jason M. Bills64796042018-10-03 16:51:55 -0700274struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800275{
276 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700277 uint8_t data[maxBIOSIDLength];
278};
279
Yong Li703922d2018-11-06 13:25:31 +0800280struct GetOEMShutdownPolicyRes
281{
282 uint8_t policy;
283 uint8_t policySupport;
284};
Kuiying Wang45f04982018-12-26 09:23:08 +0800285
James Feist91244a62019-02-19 15:04:54 -0800286struct SetFanConfigReq
287{
288 uint8_t selectedProfile;
289 uint8_t flags;
290 // other parameters from previous generation are not supported
291};
Yong Li23737fe2019-02-19 08:49:55 +0800292struct CfgHostSerialReq
293{
294 uint8_t command;
295 uint8_t parameter;
296};
Kuiying Wang45f04982018-12-26 09:23:08 +0800297#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800298
Zhu, Yungebe560b02019-04-21 21:19:21 -0400299//
300// Fault type enumeration
301//
302enum class RemoteFaultType
303{
304 fan, // 0
305 temperature, // 1
306 power, // 2
307 driveslot, // 3
308 software, // 4
309 memory, // 5
310 max = 6 // 6
311};
312
313// Enumeration for remote fault states as required by the HSC
314//
315enum class RemoteFaultState
316{
317 // fault indicators
318 fanLEDs,
319 cpu1DimmLeds,
320 cpu2DimmLeds,
321 cpu3DimmLeds,
322 cpu4DimmLeds,
323 maxFaultState,
324};
325
326enum class DimmFaultType
327{
328 cpu1cpu2Dimm,
329 cpu3cpu4Dimm,
330 maxFaultGroup,
331};
332
James Feist91244a62019-02-19 15:04:54 -0800333enum class setFanProfileFlags : uint8_t
334{
335 setFanProfile = 7,
336 setPerfAcousMode = 6,
337 // reserved [5:3]
338 performAcousSelect = 2
339 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700340};
341
342enum class setFscParamFlags : uint8_t
343{
344 tcontrol = 0x1,
345 pwmOffset = 0x2,
346 maxPwm = 0x3,
347 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800348};
Vernon Mauerya3702c12019-05-22 13:20:59 -0700349
James Feist63efafa2019-07-24 12:39:21 -0700350enum class dimmOffsetTypes : uint8_t
351{
352 staticCltt = 0x0,
353 dimmPower = 0x2
354};
355
Vernon Mauerya3702c12019-05-22 13:20:59 -0700356// FIXME: this stuff needs to be rewritten
357enum IPMI_INTEL_OEM_RETURN_CODES
358{
359 IPMI_CC_OEM_PAYLOAD_ACTIVE = 0x80,
360 IPMI_CC_OEM_INVALID_PCIE_SLOTID = 0x80,
361 IPMI_CC_OEM_PARAMETER_NOT_SUPPORTED = 0x80,
362 IPMI_CC_OEM_PAYLOAD_ALREADY_DEACTIVATED = 0x80,
363 IPMI_CC_OEM_SET_IN_PROCESS = 0x81,
364 IPMI_CC_OEM_PAYLOAD_DISABLE = 0x81,
365 IPMI_CC_OEM_LOST_ARBITRATION = 0x81,
366 IPMI_CC_OEM_INVALID_CABLE_PORT_INDEX = 0x81,
367 IPMI_CC_OEM_HEALTH_STATUS_NOT_AVAILABLE = 0x81,
368 IPMI_CC_OEM_BUS_ERROR = 0x82,
369 IPMI_CC_OEM_READ_ONLY = 0x82,
370 IPMI_CC_OEM_WRITE_ONLY = 0x82,
371 IPMI_CC_OEM_NO_CABLE_PRESENT = 0x82,
372 IPMI_CC_OEM_DATA_COLLECTION_IN_PROGRESS = 0x82,
373 IPMI_CC_OEM_PAYLOAD_ACTIVATION_LIMIT_REACH = 0x82,
374 IPMI_CC_OEM_NACK_ON_WRITE = 0x83,
375 IPMI_CC_OEM_DATA_COLLECTION_FAILED = 0x83,
376 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITH_ENCRYPTION = 0x83,
377 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITHOUT_ENCRYPTION = 0x84,
378 IPMI_CC_OEM_INVALID_CHECKSUM = 0x85,
379 IPMI_CC_OEM_NO_CABLED_PCIE_PORTS_AVAILABLE = 0xC2,
380};
381
382enum IPMI_RETURN_CODE_EXT
383{
384 IPMI_CC_INVALID_LUN = 0xC2,
385 IPMI_CC_STORGE_LEAK = 0xC4,
386 IPMI_CC_REQUEST_DATA_TRUNCATED = 0xC6,
387 IPMI_CC_REQUEST_DATA_FIELD_LENGTH_LIMIT_EXCEEDED = 0xC8,
388 IPMI_CC_CANNOT_RETURN_NUMBER_OF_REQUESTED_DATA_BYTES = 0xCA,
389 IPMI_CC_REQUEST_SENSOR_DATA_RECORD_NOT_FOUND = 0xCB,
390 IPMI_CC_DESTINATION_UNAVAILABLE = 0xD3,
391 IPMI_CC_PARAMETER_NOT_SUPPORT_IN_PRESENT_STATE = 0xD5,
392};
393
394constexpr unsigned char NETFUN_INTEL_APP_OEM = 0x3E;
395
396enum IPMI_NETFN_INTEL_OEM_APP_CMD
397{
398 MDR_STATUS = 0x20,
399 MDR_COMPLETE = 0x21,
400 MDR_EVENT = 0x22,
401 MDR_READ = 0x23,
402 MDR_WRITE = 0x24,
403 MDR_LOCK = 0x25,
404 MDRII_AGENT_STATUS = 0x30,
405 MDRII_GET_DIR = 0x31,
406 MDRII_GET_DATA_INFO = 0x32,
407 MDRII_LOCK_DATA = 0x33,
408 MDRII_UNLOCK_DATA = 0x34,
409 MDRII_GET_DATA_BLOCK = 0x35,
410 MDRII_SEND_DIR = 0x38,
411 MDRII_SEND_DATA_INFO_OFFER = 0x39,
412 MDRII_SEND_DATA_INFO = 0x3a,
413 MDRII_DATA_START = 0x3b,
414 MDRII_DATA_DONE = 0x3c,
415 MDRII_SEND_DATA_BLOCK = 0x3d,
416};