blob: 9020498daf3632d0052975a4aa64eb1834a3ba74 [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,
Kuiying Wang45f04982018-12-26 09:23:08 +080052 cmdGetLEDStatus = 0xB0,
Richard Marian Thomaiyar390b4352019-08-24 17:39:46 +053053 cmdControlBmcServices = 0xB1,
54 cmdGetBmcServiceStatus = 0xB2,
Richard Marian Thomaiyar666dd012019-08-02 20:55:37 +053055 cmdMtmKeepAlive = 0xB5,
Chen Yugang39736d52019-07-12 16:24:33 +080056 cmdGetNmiStatus = 0xE5,
57 cmdSetNmiStatus = 0xED,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080058};
59
Yong Li23737fe2019-02-19 08:49:55 +080060enum class IPMINetfnIntelOEMPlatformCmd
61{
62 cmdCfgHostSerialPortSpeed = 0x90,
63};
64
Jason M. Bills64796042018-10-03 16:51:55 -070065enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080066{
67 ipmiCCPayloadActive = 0x80,
68 ipmiCCInvalidPCIESlotID = 0x80,
69 ipmiCCParameterNotSupported = 0x80,
70 ipmiCCPayloadAlreadyDeactivated = 0x80,
71 ipmiCCSetInProcess = 0x81,
72 ipmiCCPayloadDisable = 0x81,
73 ipmiCCLostArbitration = 0x81,
74 ipmiCCInvalidCablePortIndex = 0x81,
75 ipmiCCHealthStatusNotAvailable = 0x81,
76 ipmiCCBusError = 0x82,
77 ipmiCCReadOnly = 0x82,
78 ipmiCCWriteOnly = 0x82,
79 ipmiCCNoCablePresent = 0x82,
80 ipmiCCDataCollectionInProgress = 0x82,
81 ipmiCCPayloadActivationLimitReached = 0x82,
82 ipmiCCNACKOnWrite = 0x83,
83 ipmiCCDataCollectionFailed = 0x83,
84 ipmiCCCanNotActivateWithEncrption = 0x83,
85 ipmiCCCanNotActivateWithoutEncryption = 0x84,
86 ipmiCCInvalidChecksum = 0x85,
87 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
88
89};
90
Jason M. Bills64796042018-10-03 16:51:55 -070091enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080092{
93 ipmiCCInvalidLUN = 0xC2,
94 ipmiCCTimeout = 0xC3,
95 ipmiCCStorageLeak = 0xC4,
96 ipmiCCRequestDataTruncated = 0xC6,
97 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
98 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
99 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
100 ipmiCCDestinationUnavailable = 0xD3,
101 ipmiCCParamterNotSupportInPresentState = 0xD5,
102};
103
Jason M. Bills64796042018-10-03 16:51:55 -0700104constexpr const uint8_t netfunIntelAppOEM = 0x3E;
105static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800106 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
107 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +0800108
109// Intel OEM Platform code is 0x32
110static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -0700111static constexpr const uint8_t maxBIOSIDLength = 0xFF;
112static constexpr const uint8_t maxCPUNum = 4;
113static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
114static constexpr const char* biosIntf =
115 "xyz.openbmc_project.Inventory.Item.Bios";
116static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800117
Jason M. Bills64796042018-10-03 16:51:55 -0700118static constexpr const char* powerRestoreDelayObjPath =
119 "/xyz/openbmc_project/control/power_restore_delay";
120static constexpr const char* powerRestoreDelayIntf =
121 "xyz.openbmc_project.Control.Power.RestoreDelay";
122static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
123static constexpr const char* processorErrConfigObjPath =
124 "/xyz/openbmc_project/control/processor_error_config";
125static constexpr const char* processorErrConfigIntf =
126 "xyz.openbmc_project.Control.Processor.ErrConfig";
Jason M. Billsb02bf092019-08-15 13:01:56 -0700127static constexpr const char* bmcResetDisablesPath =
128 "/xyz/openbmc_project/control/bmc_reset_disables";
129static constexpr const char* bmcResetDisablesIntf =
130 "xyz.openbmc_project.Control.ResetDisables";
Jason M. Bills64796042018-10-03 16:51:55 -0700131
Yong Li703922d2018-11-06 13:25:31 +0800132static constexpr const char* postCodesObjPath =
133 "/xyz/openbmc_project/State/Boot/PostCode";
134static constexpr const char* postCodesIntf =
135 "xyz.openbmc_project.State.Boot.PostCode";
136
Kuiying Wang45f04982018-12-26 09:23:08 +0800137static constexpr const char* identifyLEDObjPath =
138 "/xyz/openbmc_project/led/physical/identify";
139static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
140static constexpr const char* statusAmberObjPath =
141 "/xyz/openbmc_project/led/physical/status_amber";
142static constexpr const char* statusGreenObjPath =
143 "/xyz/openbmc_project/led/physical/status_green";
144
Yong Li703922d2018-11-06 13:25:31 +0800145static constexpr const uint8_t noShutdownOnOCOT = 0;
146static constexpr const uint8_t shutdownOnOCOT = 1;
147static constexpr const uint8_t noShutdownPolicySupported = 0;
148static constexpr const uint8_t shutdownPolicySupported = 1;
149static constexpr const char* oemShutdownPolicyIntf =
Yong Li0669d192019-05-06 14:01:46 +0800150 "com.intel.Control.OCOTShutdownPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800151static constexpr const char* oemShutdownPolicyObjPath =
Yong Li0669d192019-05-06 14:01:46 +0800152 "/com/intel/control/ocotshutdown_policy_config";
153static constexpr const char* oemShutdownPolicyObjPathProp = "OCOTPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800154
Yong Li23737fe2019-02-19 08:49:55 +0800155static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
156static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
157static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
158
James Feist91244a62019-02-19 15:04:54 -0800159constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
160
Yong Li23737fe2019-02-19 08:49:55 +0800161static constexpr const uint8_t getHostSerialCfgCmd = 0;
162static constexpr const uint8_t setHostSerialCfgCmd = 1;
163
164// parameters:
165// 0: host serial port 1 and 2 normal speed
166// 1: host serial port 1 high spend, port 2 normal speed
167// 2: host serial port 1 normal spend, port 2 high speed
168// 3: host serial port 1 and 2 high speed
169static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530170static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800171
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800172static constexpr const uint8_t selEvtTargetMask = 0xF0;
173static constexpr const uint8_t selEvtTargetShift = 4;
174
175static constexpr const uint8_t targetInstanceMask = 0x0E;
176static constexpr const uint8_t targetInstanceShift = 1;
177
Jason M. Bills64796042018-10-03 16:51:55 -0700178enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800179{
180 mdrStatus = 0x20,
181 mdrComplete = 0x21,
182 mdrEvent = 0x22,
183 mdrRead = 0x23,
184 mdrWrite = 0x24,
185 mdrLock = 0x25,
186 mdr2AgentStatus = 0x30,
187 mdr2GetDir = 0x31,
188 mdr2GetDataInfo = 0x32,
189 mdr2LockData = 0x33,
190 mdr2UnlockData = 0x34,
191 mdr2GetDataBlock = 0x35,
192 mdr2SendDir = 0x38,
193 mdr2SendDataInfoOffer = 0x39,
194 mdr2SendDataInfo = 0x3a,
195 mdr2DataStart = 0x3b,
196 mdr2DataDone = 0x3c,
197 mdr2SendDataBlock = 0x3d,
198};
199
Jason M. Bills64796042018-10-03 16:51:55 -0700200enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800201{
202 biosId,
203 devVer,
204 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700205};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800206
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800207enum class FWUpdateTarget : uint8_t
208{
209 targetBMC = 0x0,
210 targetBIOS = 0x1,
211 targetME = 0x2,
212 targetOEMEWS = 0x4,
213};
214
Jason M. Bills42bd9c82019-06-28 16:39:34 -0700215enum class CPUStatus
216{
217 disabled = 0x0,
218 enabled = 0x1,
219 notPresent = 0x3,
220};
221
Jason M. Bills64796042018-10-03 16:51:55 -0700222#pragma pack(push, 1)
223struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800224{
225 uint8_t node1;
226 uint8_t node2;
227 uint8_t node3;
228 uint8_t node4;
229 uint8_t node5;
230 uint8_t node6;
231 uint8_t clock1;
232 uint8_t clock2;
233 uint8_t timeHigh1;
234 uint8_t timeHigh2;
235 uint8_t timeMid1;
236 uint8_t timeMid2;
237 uint8_t timeLow1;
238 uint8_t timeLow2;
239 uint8_t timeLow3;
240 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700241};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800242
Jason M. Bills64796042018-10-03 16:51:55 -0700243struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800244{
Jason M. Bills64796042018-10-03 16:51:55 -0700245 uint8_t biosIDLength;
246 uint8_t biosId[maxBIOSIDLength];
247};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800248
Jason M. Bills64796042018-10-03 16:51:55 -0700249struct SetPowerRestoreDelayReq
250{
251 uint8_t byteMSB;
252 uint8_t byteLSB;
253};
254
255struct GetPowerRestoreDelayRes
256{
257 uint8_t byteMSB;
258 uint8_t byteLSB;
259};
260
261struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800262{
263 uint8_t entityType;
264 uint8_t countToRead;
265 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700266};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800267
Jason M. Bills64796042018-10-03 16:51:55 -0700268struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800269{
270 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700271 uint8_t data[maxBIOSIDLength];
272};
273
Yong Li703922d2018-11-06 13:25:31 +0800274struct GetOEMShutdownPolicyRes
275{
276 uint8_t policy;
277 uint8_t policySupport;
278};
Kuiying Wang45f04982018-12-26 09:23:08 +0800279
James Feist91244a62019-02-19 15:04:54 -0800280struct SetFanConfigReq
281{
282 uint8_t selectedProfile;
283 uint8_t flags;
284 // other parameters from previous generation are not supported
285};
Yong Li23737fe2019-02-19 08:49:55 +0800286struct CfgHostSerialReq
287{
288 uint8_t command;
289 uint8_t parameter;
290};
Kuiying Wang45f04982018-12-26 09:23:08 +0800291#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800292
Zhu, Yungebe560b02019-04-21 21:19:21 -0400293//
294// Fault type enumeration
295//
296enum class RemoteFaultType
297{
298 fan, // 0
299 temperature, // 1
300 power, // 2
301 driveslot, // 3
302 software, // 4
303 memory, // 5
304 max = 6 // 6
305};
306
307// Enumeration for remote fault states as required by the HSC
308//
309enum class RemoteFaultState
310{
311 // fault indicators
312 fanLEDs,
313 cpu1DimmLeds,
314 cpu2DimmLeds,
315 cpu3DimmLeds,
316 cpu4DimmLeds,
317 maxFaultState,
318};
319
320enum class DimmFaultType
321{
322 cpu1cpu2Dimm,
323 cpu3cpu4Dimm,
324 maxFaultGroup,
325};
326
James Feist91244a62019-02-19 15:04:54 -0800327enum class setFanProfileFlags : uint8_t
328{
329 setFanProfile = 7,
330 setPerfAcousMode = 6,
331 // reserved [5:3]
332 performAcousSelect = 2
333 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700334};
335
336enum class setFscParamFlags : uint8_t
337{
338 tcontrol = 0x1,
339 pwmOffset = 0x2,
340 maxPwm = 0x3,
341 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800342};
Vernon Mauerya3702c12019-05-22 13:20:59 -0700343
James Feist63efafa2019-07-24 12:39:21 -0700344enum class dimmOffsetTypes : uint8_t
345{
346 staticCltt = 0x0,
347 dimmPower = 0x2
348};
349
Vernon Mauerya3702c12019-05-22 13:20:59 -0700350// FIXME: this stuff needs to be rewritten
351enum IPMI_INTEL_OEM_RETURN_CODES
352{
353 IPMI_CC_OEM_PAYLOAD_ACTIVE = 0x80,
354 IPMI_CC_OEM_INVALID_PCIE_SLOTID = 0x80,
355 IPMI_CC_OEM_PARAMETER_NOT_SUPPORTED = 0x80,
356 IPMI_CC_OEM_PAYLOAD_ALREADY_DEACTIVATED = 0x80,
357 IPMI_CC_OEM_SET_IN_PROCESS = 0x81,
358 IPMI_CC_OEM_PAYLOAD_DISABLE = 0x81,
359 IPMI_CC_OEM_LOST_ARBITRATION = 0x81,
360 IPMI_CC_OEM_INVALID_CABLE_PORT_INDEX = 0x81,
361 IPMI_CC_OEM_HEALTH_STATUS_NOT_AVAILABLE = 0x81,
362 IPMI_CC_OEM_BUS_ERROR = 0x82,
363 IPMI_CC_OEM_READ_ONLY = 0x82,
364 IPMI_CC_OEM_WRITE_ONLY = 0x82,
365 IPMI_CC_OEM_NO_CABLE_PRESENT = 0x82,
366 IPMI_CC_OEM_DATA_COLLECTION_IN_PROGRESS = 0x82,
367 IPMI_CC_OEM_PAYLOAD_ACTIVATION_LIMIT_REACH = 0x82,
368 IPMI_CC_OEM_NACK_ON_WRITE = 0x83,
369 IPMI_CC_OEM_DATA_COLLECTION_FAILED = 0x83,
370 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITH_ENCRYPTION = 0x83,
371 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITHOUT_ENCRYPTION = 0x84,
372 IPMI_CC_OEM_INVALID_CHECKSUM = 0x85,
373 IPMI_CC_OEM_NO_CABLED_PCIE_PORTS_AVAILABLE = 0xC2,
374};
375
376enum IPMI_RETURN_CODE_EXT
377{
378 IPMI_CC_INVALID_LUN = 0xC2,
379 IPMI_CC_STORGE_LEAK = 0xC4,
380 IPMI_CC_REQUEST_DATA_TRUNCATED = 0xC6,
381 IPMI_CC_REQUEST_DATA_FIELD_LENGTH_LIMIT_EXCEEDED = 0xC8,
382 IPMI_CC_CANNOT_RETURN_NUMBER_OF_REQUESTED_DATA_BYTES = 0xCA,
383 IPMI_CC_REQUEST_SENSOR_DATA_RECORD_NOT_FOUND = 0xCB,
384 IPMI_CC_DESTINATION_UNAVAILABLE = 0xD3,
385 IPMI_CC_PARAMETER_NOT_SUPPORT_IN_PRESENT_STATE = 0xD5,
386};
387
388constexpr unsigned char NETFUN_INTEL_APP_OEM = 0x3E;
389
390enum IPMI_NETFN_INTEL_OEM_APP_CMD
391{
392 MDR_STATUS = 0x20,
393 MDR_COMPLETE = 0x21,
394 MDR_EVENT = 0x22,
395 MDR_READ = 0x23,
396 MDR_WRITE = 0x24,
397 MDR_LOCK = 0x25,
398 MDRII_AGENT_STATUS = 0x30,
399 MDRII_GET_DIR = 0x31,
400 MDRII_GET_DATA_INFO = 0x32,
401 MDRII_LOCK_DATA = 0x33,
402 MDRII_UNLOCK_DATA = 0x34,
403 MDRII_GET_DATA_BLOCK = 0x35,
404 MDRII_SEND_DIR = 0x38,
405 MDRII_SEND_DATA_INFO_OFFER = 0x39,
406 MDRII_SEND_DATA_INFO = 0x3a,
407 MDRII_DATA_START = 0x3b,
408 MDRII_DATA_DONE = 0x3c,
409 MDRII_SEND_DATA_BLOCK = 0x3d,
410};