blob: d20e53d171f261044c6c2d70e6c0c42c09bb3e90 [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{
22 cmdSetBIOSID = 0x26,
23 cmdGetOEMDeviceInfo = 0x27,
Cheng C Yang773703a2019-08-15 09:41:11 +080024 cmdSetColdRedundancyConfig = 0x2d,
25 cmdGetColdRedundancyConfig = 0x2e,
Jason M. Bills64796042018-10-03 16:51:55 -070026 cmdGetAICSlotFRUIDSlotPosRecords = 0x31,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080027 cmdSetSystemGUID = 0x41,
Jia, Chunhuicc49b542019-03-20 15:41:07 +080028 cmdSendEmbeddedFWUpdStatus = 0x44,
Jason M. Bills64796042018-10-03 16:51:55 -070029 cmdSetPowerRestoreDelay = 0x54,
30 cmdGetPowerRestoreDelay = 0x55,
Zhu, Yungebe560b02019-04-21 21:19:21 -040031 cmdSetFaultIndication = 0x57,
Suryakanth Sekard509eb92018-11-15 17:44:11 +053032 cmdSetOEMUser2Activation = 0x5A,
Richard Marian Thomaiyarfc5e9852019-04-14 15:06:27 +053033 cmdSetSpecialUserPassword = 0x5F,
Yong Li703922d2018-11-06 13:25:31 +080034 cmdSetShutdownPolicy = 0x60,
35 cmdGetShutdownPolicy = 0x62,
James Feist91244a62019-02-19 15:04:54 -080036 cmdSetFanConfig = 0x89,
37 cmdGetFanConfig = 0x8a,
James Feistacc8a4e2019-04-02 14:23:57 -070038 cmdSetFanSpeedOffset = 0x8c,
39 cmdGetFanSpeedOffset = 0x8d,
James Feist63efafa2019-07-24 12:39:21 -070040 cmdSetDimmOffset = 0x8e,
41 cmdGetDimmOffset = 0x8f,
James Feist5f957ca2019-03-14 15:33:55 -070042 cmdSetFscParameter = 0x90,
43 cmdGetFscParameter = 0x91,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080044 cmdGetChassisIdentifier = 0x92,
Richard Marian Thomaiyarea537d52019-04-24 21:33:48 +053045 cmdReadBaseBoardProductId = 0x93,
Jason M. Bills64796042018-10-03 16:51:55 -070046 cmdGetProcessorErrConfig = 0x9A,
47 cmdSetProcessorErrConfig = 0x9B,
Kuiying Wang45f04982018-12-26 09:23:08 +080048 cmdGetLEDStatus = 0xB0,
Richard Marian Thomaiyar666dd012019-08-02 20:55:37 +053049 cmdMtmKeepAlive = 0xB5,
Chen Yugang39736d52019-07-12 16:24:33 +080050 cmdGetNmiStatus = 0xE5,
51 cmdSetNmiStatus = 0xED,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080052};
53
Yong Li23737fe2019-02-19 08:49:55 +080054enum class IPMINetfnIntelOEMPlatformCmd
55{
56 cmdCfgHostSerialPortSpeed = 0x90,
57};
58
Jason M. Bills64796042018-10-03 16:51:55 -070059enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080060{
61 ipmiCCPayloadActive = 0x80,
62 ipmiCCInvalidPCIESlotID = 0x80,
63 ipmiCCParameterNotSupported = 0x80,
64 ipmiCCPayloadAlreadyDeactivated = 0x80,
65 ipmiCCSetInProcess = 0x81,
66 ipmiCCPayloadDisable = 0x81,
67 ipmiCCLostArbitration = 0x81,
68 ipmiCCInvalidCablePortIndex = 0x81,
69 ipmiCCHealthStatusNotAvailable = 0x81,
70 ipmiCCBusError = 0x82,
71 ipmiCCReadOnly = 0x82,
72 ipmiCCWriteOnly = 0x82,
73 ipmiCCNoCablePresent = 0x82,
74 ipmiCCDataCollectionInProgress = 0x82,
75 ipmiCCPayloadActivationLimitReached = 0x82,
76 ipmiCCNACKOnWrite = 0x83,
77 ipmiCCDataCollectionFailed = 0x83,
78 ipmiCCCanNotActivateWithEncrption = 0x83,
79 ipmiCCCanNotActivateWithoutEncryption = 0x84,
80 ipmiCCInvalidChecksum = 0x85,
81 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
82
83};
84
Jason M. Bills64796042018-10-03 16:51:55 -070085enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080086{
87 ipmiCCInvalidLUN = 0xC2,
88 ipmiCCTimeout = 0xC3,
89 ipmiCCStorageLeak = 0xC4,
90 ipmiCCRequestDataTruncated = 0xC6,
91 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
92 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
93 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
94 ipmiCCDestinationUnavailable = 0xD3,
95 ipmiCCParamterNotSupportInPresentState = 0xD5,
96};
97
Jason M. Bills64796042018-10-03 16:51:55 -070098constexpr const uint8_t netfunIntelAppOEM = 0x3E;
99static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800100 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
101 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +0800102
103// Intel OEM Platform code is 0x32
104static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -0700105static constexpr const uint8_t maxBIOSIDLength = 0xFF;
106static constexpr const uint8_t maxCPUNum = 4;
107static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
108static constexpr const char* biosIntf =
109 "xyz.openbmc_project.Inventory.Item.Bios";
110static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800111
Jason M. Bills64796042018-10-03 16:51:55 -0700112static constexpr const char* powerRestoreDelayObjPath =
113 "/xyz/openbmc_project/control/power_restore_delay";
114static constexpr const char* powerRestoreDelayIntf =
115 "xyz.openbmc_project.Control.Power.RestoreDelay";
116static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
117static constexpr const char* processorErrConfigObjPath =
118 "/xyz/openbmc_project/control/processor_error_config";
119static constexpr const char* processorErrConfigIntf =
120 "xyz.openbmc_project.Control.Processor.ErrConfig";
121
Yong Li703922d2018-11-06 13:25:31 +0800122static constexpr const char* postCodesObjPath =
123 "/xyz/openbmc_project/State/Boot/PostCode";
124static constexpr const char* postCodesIntf =
125 "xyz.openbmc_project.State.Boot.PostCode";
126
Kuiying Wang45f04982018-12-26 09:23:08 +0800127static constexpr const char* identifyLEDObjPath =
128 "/xyz/openbmc_project/led/physical/identify";
129static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
130static constexpr const char* statusAmberObjPath =
131 "/xyz/openbmc_project/led/physical/status_amber";
132static constexpr const char* statusGreenObjPath =
133 "/xyz/openbmc_project/led/physical/status_green";
134
Yong Li703922d2018-11-06 13:25:31 +0800135static constexpr const uint8_t noShutdownOnOCOT = 0;
136static constexpr const uint8_t shutdownOnOCOT = 1;
137static constexpr const uint8_t noShutdownPolicySupported = 0;
138static constexpr const uint8_t shutdownPolicySupported = 1;
139static constexpr const char* oemShutdownPolicyIntf =
Yong Li0669d192019-05-06 14:01:46 +0800140 "com.intel.Control.OCOTShutdownPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800141static constexpr const char* oemShutdownPolicyObjPath =
Yong Li0669d192019-05-06 14:01:46 +0800142 "/com/intel/control/ocotshutdown_policy_config";
143static constexpr const char* oemShutdownPolicyObjPathProp = "OCOTPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800144
Yong Li23737fe2019-02-19 08:49:55 +0800145static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
146static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
147static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
148
James Feist91244a62019-02-19 15:04:54 -0800149constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
150
Yong Li23737fe2019-02-19 08:49:55 +0800151static constexpr const uint8_t getHostSerialCfgCmd = 0;
152static constexpr const uint8_t setHostSerialCfgCmd = 1;
153
154// parameters:
155// 0: host serial port 1 and 2 normal speed
156// 1: host serial port 1 high spend, port 2 normal speed
157// 2: host serial port 1 normal spend, port 2 high speed
158// 3: host serial port 1 and 2 high speed
159static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530160static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800161
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800162static constexpr const uint8_t selEvtTargetMask = 0xF0;
163static constexpr const uint8_t selEvtTargetShift = 4;
164
165static constexpr const uint8_t targetInstanceMask = 0x0E;
166static constexpr const uint8_t targetInstanceShift = 1;
167
Jason M. Bills64796042018-10-03 16:51:55 -0700168enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800169{
170 mdrStatus = 0x20,
171 mdrComplete = 0x21,
172 mdrEvent = 0x22,
173 mdrRead = 0x23,
174 mdrWrite = 0x24,
175 mdrLock = 0x25,
176 mdr2AgentStatus = 0x30,
177 mdr2GetDir = 0x31,
178 mdr2GetDataInfo = 0x32,
179 mdr2LockData = 0x33,
180 mdr2UnlockData = 0x34,
181 mdr2GetDataBlock = 0x35,
182 mdr2SendDir = 0x38,
183 mdr2SendDataInfoOffer = 0x39,
184 mdr2SendDataInfo = 0x3a,
185 mdr2DataStart = 0x3b,
186 mdr2DataDone = 0x3c,
187 mdr2SendDataBlock = 0x3d,
188};
189
Jason M. Bills64796042018-10-03 16:51:55 -0700190enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800191{
192 biosId,
193 devVer,
194 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700195};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800196
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800197enum class FWUpdateTarget : uint8_t
198{
199 targetBMC = 0x0,
200 targetBIOS = 0x1,
201 targetME = 0x2,
202 targetOEMEWS = 0x4,
203};
204
Jason M. Bills42bd9c82019-06-28 16:39:34 -0700205enum class CPUStatus
206{
207 disabled = 0x0,
208 enabled = 0x1,
209 notPresent = 0x3,
210};
211
Jason M. Bills64796042018-10-03 16:51:55 -0700212#pragma pack(push, 1)
213struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800214{
215 uint8_t node1;
216 uint8_t node2;
217 uint8_t node3;
218 uint8_t node4;
219 uint8_t node5;
220 uint8_t node6;
221 uint8_t clock1;
222 uint8_t clock2;
223 uint8_t timeHigh1;
224 uint8_t timeHigh2;
225 uint8_t timeMid1;
226 uint8_t timeMid2;
227 uint8_t timeLow1;
228 uint8_t timeLow2;
229 uint8_t timeLow3;
230 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700231};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800232
Jason M. Bills64796042018-10-03 16:51:55 -0700233struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800234{
Jason M. Bills64796042018-10-03 16:51:55 -0700235 uint8_t biosIDLength;
236 uint8_t biosId[maxBIOSIDLength];
237};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800238
Jason M. Bills64796042018-10-03 16:51:55 -0700239struct SetPowerRestoreDelayReq
240{
241 uint8_t byteMSB;
242 uint8_t byteLSB;
243};
244
245struct GetPowerRestoreDelayRes
246{
247 uint8_t byteMSB;
248 uint8_t byteLSB;
249};
250
251struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800252{
253 uint8_t entityType;
254 uint8_t countToRead;
255 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700256};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800257
Jason M. Bills64796042018-10-03 16:51:55 -0700258struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800259{
260 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700261 uint8_t data[maxBIOSIDLength];
262};
263
Yong Li703922d2018-11-06 13:25:31 +0800264struct GetOEMShutdownPolicyRes
265{
266 uint8_t policy;
267 uint8_t policySupport;
268};
Kuiying Wang45f04982018-12-26 09:23:08 +0800269
James Feist91244a62019-02-19 15:04:54 -0800270struct SetFanConfigReq
271{
272 uint8_t selectedProfile;
273 uint8_t flags;
274 // other parameters from previous generation are not supported
275};
Yong Li23737fe2019-02-19 08:49:55 +0800276struct CfgHostSerialReq
277{
278 uint8_t command;
279 uint8_t parameter;
280};
Kuiying Wang45f04982018-12-26 09:23:08 +0800281#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800282
Zhu, Yungebe560b02019-04-21 21:19:21 -0400283//
284// Fault type enumeration
285//
286enum class RemoteFaultType
287{
288 fan, // 0
289 temperature, // 1
290 power, // 2
291 driveslot, // 3
292 software, // 4
293 memory, // 5
294 max = 6 // 6
295};
296
297// Enumeration for remote fault states as required by the HSC
298//
299enum class RemoteFaultState
300{
301 // fault indicators
302 fanLEDs,
303 cpu1DimmLeds,
304 cpu2DimmLeds,
305 cpu3DimmLeds,
306 cpu4DimmLeds,
307 maxFaultState,
308};
309
310enum class DimmFaultType
311{
312 cpu1cpu2Dimm,
313 cpu3cpu4Dimm,
314 maxFaultGroup,
315};
316
James Feist91244a62019-02-19 15:04:54 -0800317enum class setFanProfileFlags : uint8_t
318{
319 setFanProfile = 7,
320 setPerfAcousMode = 6,
321 // reserved [5:3]
322 performAcousSelect = 2
323 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700324};
325
326enum class setFscParamFlags : uint8_t
327{
328 tcontrol = 0x1,
329 pwmOffset = 0x2,
330 maxPwm = 0x3,
331 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800332};
Vernon Mauerya3702c12019-05-22 13:20:59 -0700333
James Feist63efafa2019-07-24 12:39:21 -0700334enum class dimmOffsetTypes : uint8_t
335{
336 staticCltt = 0x0,
337 dimmPower = 0x2
338};
339
Vernon Mauerya3702c12019-05-22 13:20:59 -0700340// FIXME: this stuff needs to be rewritten
341enum IPMI_INTEL_OEM_RETURN_CODES
342{
343 IPMI_CC_OEM_PAYLOAD_ACTIVE = 0x80,
344 IPMI_CC_OEM_INVALID_PCIE_SLOTID = 0x80,
345 IPMI_CC_OEM_PARAMETER_NOT_SUPPORTED = 0x80,
346 IPMI_CC_OEM_PAYLOAD_ALREADY_DEACTIVATED = 0x80,
347 IPMI_CC_OEM_SET_IN_PROCESS = 0x81,
348 IPMI_CC_OEM_PAYLOAD_DISABLE = 0x81,
349 IPMI_CC_OEM_LOST_ARBITRATION = 0x81,
350 IPMI_CC_OEM_INVALID_CABLE_PORT_INDEX = 0x81,
351 IPMI_CC_OEM_HEALTH_STATUS_NOT_AVAILABLE = 0x81,
352 IPMI_CC_OEM_BUS_ERROR = 0x82,
353 IPMI_CC_OEM_READ_ONLY = 0x82,
354 IPMI_CC_OEM_WRITE_ONLY = 0x82,
355 IPMI_CC_OEM_NO_CABLE_PRESENT = 0x82,
356 IPMI_CC_OEM_DATA_COLLECTION_IN_PROGRESS = 0x82,
357 IPMI_CC_OEM_PAYLOAD_ACTIVATION_LIMIT_REACH = 0x82,
358 IPMI_CC_OEM_NACK_ON_WRITE = 0x83,
359 IPMI_CC_OEM_DATA_COLLECTION_FAILED = 0x83,
360 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITH_ENCRYPTION = 0x83,
361 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITHOUT_ENCRYPTION = 0x84,
362 IPMI_CC_OEM_INVALID_CHECKSUM = 0x85,
363 IPMI_CC_OEM_NO_CABLED_PCIE_PORTS_AVAILABLE = 0xC2,
364};
365
366enum IPMI_RETURN_CODE_EXT
367{
368 IPMI_CC_INVALID_LUN = 0xC2,
369 IPMI_CC_STORGE_LEAK = 0xC4,
370 IPMI_CC_REQUEST_DATA_TRUNCATED = 0xC6,
371 IPMI_CC_REQUEST_DATA_FIELD_LENGTH_LIMIT_EXCEEDED = 0xC8,
372 IPMI_CC_CANNOT_RETURN_NUMBER_OF_REQUESTED_DATA_BYTES = 0xCA,
373 IPMI_CC_REQUEST_SENSOR_DATA_RECORD_NOT_FOUND = 0xCB,
374 IPMI_CC_DESTINATION_UNAVAILABLE = 0xD3,
375 IPMI_CC_PARAMETER_NOT_SUPPORT_IN_PRESENT_STATE = 0xD5,
376};
377
378constexpr unsigned char NETFUN_INTEL_APP_OEM = 0x3E;
379
380enum IPMI_NETFN_INTEL_OEM_APP_CMD
381{
382 MDR_STATUS = 0x20,
383 MDR_COMPLETE = 0x21,
384 MDR_EVENT = 0x22,
385 MDR_READ = 0x23,
386 MDR_WRITE = 0x24,
387 MDR_LOCK = 0x25,
388 MDRII_AGENT_STATUS = 0x30,
389 MDRII_GET_DIR = 0x31,
390 MDRII_GET_DATA_INFO = 0x32,
391 MDRII_LOCK_DATA = 0x33,
392 MDRII_UNLOCK_DATA = 0x34,
393 MDRII_GET_DATA_BLOCK = 0x35,
394 MDRII_SEND_DIR = 0x38,
395 MDRII_SEND_DATA_INFO_OFFER = 0x39,
396 MDRII_SEND_DATA_INFO = 0x3a,
397 MDRII_DATA_START = 0x3b,
398 MDRII_DATA_DONE = 0x3c,
399 MDRII_SEND_DATA_BLOCK = 0x3d,
400};
401
402enum class IPMINetFnIntelOemGeneralCmds
403{
404 GetSmSignal = 0x14,
405 SetSmSignal = 0x15,
Richard Marian Thomaiyaredf25e62019-06-11 01:14:49 +0530406 controlBmcServices = 0xB1,
407 getBmcServiceStatus = 0xB2,
Vernon Mauerya3702c12019-05-22 13:20:59 -0700408 SetSensorOverride = 0xEE,
409};