blob: 9ce2e55993b6213eac81d3fcb38dd42c1f6858ce [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,
Jason M. Bills64796042018-10-03 16:51:55 -070024 cmdGetAICSlotFRUIDSlotPosRecords = 0x31,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080025 cmdSetSystemGUID = 0x41,
Jia, Chunhuicc49b542019-03-20 15:41:07 +080026 cmdSendEmbeddedFWUpdStatus = 0x44,
Jason M. Bills64796042018-10-03 16:51:55 -070027 cmdSetPowerRestoreDelay = 0x54,
28 cmdGetPowerRestoreDelay = 0x55,
Zhu, Yungebe560b02019-04-21 21:19:21 -040029 cmdSetFaultIndication = 0x57,
Suryakanth Sekard509eb92018-11-15 17:44:11 +053030 cmdSetOEMUser2Activation = 0x5A,
Richard Marian Thomaiyarfc5e9852019-04-14 15:06:27 +053031 cmdSetSpecialUserPassword = 0x5F,
Yong Li703922d2018-11-06 13:25:31 +080032 cmdSetShutdownPolicy = 0x60,
33 cmdGetShutdownPolicy = 0x62,
James Feist91244a62019-02-19 15:04:54 -080034 cmdSetFanConfig = 0x89,
35 cmdGetFanConfig = 0x8a,
James Feistacc8a4e2019-04-02 14:23:57 -070036 cmdSetFanSpeedOffset = 0x8c,
37 cmdGetFanSpeedOffset = 0x8d,
James Feist63efafa2019-07-24 12:39:21 -070038 cmdSetDimmOffset = 0x8e,
39 cmdGetDimmOffset = 0x8f,
James Feist5f957ca2019-03-14 15:33:55 -070040 cmdSetFscParameter = 0x90,
41 cmdGetFscParameter = 0x91,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080042 cmdGetChassisIdentifier = 0x92,
Richard Marian Thomaiyarea537d52019-04-24 21:33:48 +053043 cmdReadBaseBoardProductId = 0x93,
Jason M. Bills64796042018-10-03 16:51:55 -070044 cmdGetProcessorErrConfig = 0x9A,
45 cmdSetProcessorErrConfig = 0x9B,
Kuiying Wang45f04982018-12-26 09:23:08 +080046 cmdGetLEDStatus = 0xB0,
Richard Marian Thomaiyar666dd012019-08-02 20:55:37 +053047 cmdMtmKeepAlive = 0xB5,
Chen Yugang39736d52019-07-12 16:24:33 +080048 cmdGetNmiStatus = 0xE5,
49 cmdSetNmiStatus = 0xED,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080050};
51
Yong Li23737fe2019-02-19 08:49:55 +080052enum class IPMINetfnIntelOEMPlatformCmd
53{
54 cmdCfgHostSerialPortSpeed = 0x90,
55};
56
Jason M. Bills64796042018-10-03 16:51:55 -070057enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080058{
59 ipmiCCPayloadActive = 0x80,
60 ipmiCCInvalidPCIESlotID = 0x80,
61 ipmiCCParameterNotSupported = 0x80,
62 ipmiCCPayloadAlreadyDeactivated = 0x80,
63 ipmiCCSetInProcess = 0x81,
64 ipmiCCPayloadDisable = 0x81,
65 ipmiCCLostArbitration = 0x81,
66 ipmiCCInvalidCablePortIndex = 0x81,
67 ipmiCCHealthStatusNotAvailable = 0x81,
68 ipmiCCBusError = 0x82,
69 ipmiCCReadOnly = 0x82,
70 ipmiCCWriteOnly = 0x82,
71 ipmiCCNoCablePresent = 0x82,
72 ipmiCCDataCollectionInProgress = 0x82,
73 ipmiCCPayloadActivationLimitReached = 0x82,
74 ipmiCCNACKOnWrite = 0x83,
75 ipmiCCDataCollectionFailed = 0x83,
76 ipmiCCCanNotActivateWithEncrption = 0x83,
77 ipmiCCCanNotActivateWithoutEncryption = 0x84,
78 ipmiCCInvalidChecksum = 0x85,
79 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
80
81};
82
Jason M. Bills64796042018-10-03 16:51:55 -070083enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080084{
85 ipmiCCInvalidLUN = 0xC2,
86 ipmiCCTimeout = 0xC3,
87 ipmiCCStorageLeak = 0xC4,
88 ipmiCCRequestDataTruncated = 0xC6,
89 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
90 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
91 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
92 ipmiCCDestinationUnavailable = 0xD3,
93 ipmiCCParamterNotSupportInPresentState = 0xD5,
94};
95
Jason M. Bills64796042018-10-03 16:51:55 -070096constexpr const uint8_t netfunIntelAppOEM = 0x3E;
97static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080098 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
99 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +0800100
101// Intel OEM Platform code is 0x32
102static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -0700103static constexpr const uint8_t maxBIOSIDLength = 0xFF;
104static constexpr const uint8_t maxCPUNum = 4;
105static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
106static constexpr const char* biosIntf =
107 "xyz.openbmc_project.Inventory.Item.Bios";
108static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800109
Jason M. Bills64796042018-10-03 16:51:55 -0700110static constexpr const char* powerRestoreDelayObjPath =
111 "/xyz/openbmc_project/control/power_restore_delay";
112static constexpr const char* powerRestoreDelayIntf =
113 "xyz.openbmc_project.Control.Power.RestoreDelay";
114static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
115static constexpr const char* processorErrConfigObjPath =
116 "/xyz/openbmc_project/control/processor_error_config";
117static constexpr const char* processorErrConfigIntf =
118 "xyz.openbmc_project.Control.Processor.ErrConfig";
119
Yong Li703922d2018-11-06 13:25:31 +0800120static constexpr const char* postCodesObjPath =
121 "/xyz/openbmc_project/State/Boot/PostCode";
122static constexpr const char* postCodesIntf =
123 "xyz.openbmc_project.State.Boot.PostCode";
124
Kuiying Wang45f04982018-12-26 09:23:08 +0800125static constexpr const char* identifyLEDObjPath =
126 "/xyz/openbmc_project/led/physical/identify";
127static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
128static constexpr const char* statusAmberObjPath =
129 "/xyz/openbmc_project/led/physical/status_amber";
130static constexpr const char* statusGreenObjPath =
131 "/xyz/openbmc_project/led/physical/status_green";
132
Yong Li703922d2018-11-06 13:25:31 +0800133static constexpr const uint8_t noShutdownOnOCOT = 0;
134static constexpr const uint8_t shutdownOnOCOT = 1;
135static constexpr const uint8_t noShutdownPolicySupported = 0;
136static constexpr const uint8_t shutdownPolicySupported = 1;
137static constexpr const char* oemShutdownPolicyIntf =
Yong Li0669d192019-05-06 14:01:46 +0800138 "com.intel.Control.OCOTShutdownPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800139static constexpr const char* oemShutdownPolicyObjPath =
Yong Li0669d192019-05-06 14:01:46 +0800140 "/com/intel/control/ocotshutdown_policy_config";
141static constexpr const char* oemShutdownPolicyObjPathProp = "OCOTPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800142
Yong Li23737fe2019-02-19 08:49:55 +0800143static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
144static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
145static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
146
James Feist91244a62019-02-19 15:04:54 -0800147constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
148
Yong Li23737fe2019-02-19 08:49:55 +0800149static constexpr const uint8_t getHostSerialCfgCmd = 0;
150static constexpr const uint8_t setHostSerialCfgCmd = 1;
151
152// parameters:
153// 0: host serial port 1 and 2 normal speed
154// 1: host serial port 1 high spend, port 2 normal speed
155// 2: host serial port 1 normal spend, port 2 high speed
156// 3: host serial port 1 and 2 high speed
157static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530158static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800159
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800160static constexpr const uint8_t selEvtTargetMask = 0xF0;
161static constexpr const uint8_t selEvtTargetShift = 4;
162
163static constexpr const uint8_t targetInstanceMask = 0x0E;
164static constexpr const uint8_t targetInstanceShift = 1;
165
Jason M. Bills64796042018-10-03 16:51:55 -0700166enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800167{
168 mdrStatus = 0x20,
169 mdrComplete = 0x21,
170 mdrEvent = 0x22,
171 mdrRead = 0x23,
172 mdrWrite = 0x24,
173 mdrLock = 0x25,
174 mdr2AgentStatus = 0x30,
175 mdr2GetDir = 0x31,
176 mdr2GetDataInfo = 0x32,
177 mdr2LockData = 0x33,
178 mdr2UnlockData = 0x34,
179 mdr2GetDataBlock = 0x35,
180 mdr2SendDir = 0x38,
181 mdr2SendDataInfoOffer = 0x39,
182 mdr2SendDataInfo = 0x3a,
183 mdr2DataStart = 0x3b,
184 mdr2DataDone = 0x3c,
185 mdr2SendDataBlock = 0x3d,
186};
187
Jason M. Bills64796042018-10-03 16:51:55 -0700188enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800189{
190 biosId,
191 devVer,
192 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700193};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800194
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800195enum class FWUpdateTarget : uint8_t
196{
197 targetBMC = 0x0,
198 targetBIOS = 0x1,
199 targetME = 0x2,
200 targetOEMEWS = 0x4,
201};
202
Jason M. Bills42bd9c82019-06-28 16:39:34 -0700203enum class CPUStatus
204{
205 disabled = 0x0,
206 enabled = 0x1,
207 notPresent = 0x3,
208};
209
Jason M. Bills64796042018-10-03 16:51:55 -0700210#pragma pack(push, 1)
211struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800212{
213 uint8_t node1;
214 uint8_t node2;
215 uint8_t node3;
216 uint8_t node4;
217 uint8_t node5;
218 uint8_t node6;
219 uint8_t clock1;
220 uint8_t clock2;
221 uint8_t timeHigh1;
222 uint8_t timeHigh2;
223 uint8_t timeMid1;
224 uint8_t timeMid2;
225 uint8_t timeLow1;
226 uint8_t timeLow2;
227 uint8_t timeLow3;
228 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700229};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800230
Jason M. Bills64796042018-10-03 16:51:55 -0700231struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800232{
Jason M. Bills64796042018-10-03 16:51:55 -0700233 uint8_t biosIDLength;
234 uint8_t biosId[maxBIOSIDLength];
235};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800236
Jason M. Bills64796042018-10-03 16:51:55 -0700237struct SetPowerRestoreDelayReq
238{
239 uint8_t byteMSB;
240 uint8_t byteLSB;
241};
242
243struct GetPowerRestoreDelayRes
244{
245 uint8_t byteMSB;
246 uint8_t byteLSB;
247};
248
249struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800250{
251 uint8_t entityType;
252 uint8_t countToRead;
253 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700254};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800255
Jason M. Bills64796042018-10-03 16:51:55 -0700256struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800257{
258 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700259 uint8_t data[maxBIOSIDLength];
260};
261
Yong Li703922d2018-11-06 13:25:31 +0800262struct GetOEMShutdownPolicyRes
263{
264 uint8_t policy;
265 uint8_t policySupport;
266};
Kuiying Wang45f04982018-12-26 09:23:08 +0800267
James Feist91244a62019-02-19 15:04:54 -0800268struct SetFanConfigReq
269{
270 uint8_t selectedProfile;
271 uint8_t flags;
272 // other parameters from previous generation are not supported
273};
Yong Li23737fe2019-02-19 08:49:55 +0800274struct CfgHostSerialReq
275{
276 uint8_t command;
277 uint8_t parameter;
278};
Kuiying Wang45f04982018-12-26 09:23:08 +0800279#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800280
Zhu, Yungebe560b02019-04-21 21:19:21 -0400281//
282// Fault type enumeration
283//
284enum class RemoteFaultType
285{
286 fan, // 0
287 temperature, // 1
288 power, // 2
289 driveslot, // 3
290 software, // 4
291 memory, // 5
292 max = 6 // 6
293};
294
295// Enumeration for remote fault states as required by the HSC
296//
297enum class RemoteFaultState
298{
299 // fault indicators
300 fanLEDs,
301 cpu1DimmLeds,
302 cpu2DimmLeds,
303 cpu3DimmLeds,
304 cpu4DimmLeds,
305 maxFaultState,
306};
307
308enum class DimmFaultType
309{
310 cpu1cpu2Dimm,
311 cpu3cpu4Dimm,
312 maxFaultGroup,
313};
314
James Feist91244a62019-02-19 15:04:54 -0800315enum class setFanProfileFlags : uint8_t
316{
317 setFanProfile = 7,
318 setPerfAcousMode = 6,
319 // reserved [5:3]
320 performAcousSelect = 2
321 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700322};
323
324enum class setFscParamFlags : uint8_t
325{
326 tcontrol = 0x1,
327 pwmOffset = 0x2,
328 maxPwm = 0x3,
329 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800330};
Vernon Mauerya3702c12019-05-22 13:20:59 -0700331
James Feist63efafa2019-07-24 12:39:21 -0700332enum class dimmOffsetTypes : uint8_t
333{
334 staticCltt = 0x0,
335 dimmPower = 0x2
336};
337
Vernon Mauerya3702c12019-05-22 13:20:59 -0700338// FIXME: this stuff needs to be rewritten
339enum IPMI_INTEL_OEM_RETURN_CODES
340{
341 IPMI_CC_OEM_PAYLOAD_ACTIVE = 0x80,
342 IPMI_CC_OEM_INVALID_PCIE_SLOTID = 0x80,
343 IPMI_CC_OEM_PARAMETER_NOT_SUPPORTED = 0x80,
344 IPMI_CC_OEM_PAYLOAD_ALREADY_DEACTIVATED = 0x80,
345 IPMI_CC_OEM_SET_IN_PROCESS = 0x81,
346 IPMI_CC_OEM_PAYLOAD_DISABLE = 0x81,
347 IPMI_CC_OEM_LOST_ARBITRATION = 0x81,
348 IPMI_CC_OEM_INVALID_CABLE_PORT_INDEX = 0x81,
349 IPMI_CC_OEM_HEALTH_STATUS_NOT_AVAILABLE = 0x81,
350 IPMI_CC_OEM_BUS_ERROR = 0x82,
351 IPMI_CC_OEM_READ_ONLY = 0x82,
352 IPMI_CC_OEM_WRITE_ONLY = 0x82,
353 IPMI_CC_OEM_NO_CABLE_PRESENT = 0x82,
354 IPMI_CC_OEM_DATA_COLLECTION_IN_PROGRESS = 0x82,
355 IPMI_CC_OEM_PAYLOAD_ACTIVATION_LIMIT_REACH = 0x82,
356 IPMI_CC_OEM_NACK_ON_WRITE = 0x83,
357 IPMI_CC_OEM_DATA_COLLECTION_FAILED = 0x83,
358 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITH_ENCRYPTION = 0x83,
359 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITHOUT_ENCRYPTION = 0x84,
360 IPMI_CC_OEM_INVALID_CHECKSUM = 0x85,
361 IPMI_CC_OEM_NO_CABLED_PCIE_PORTS_AVAILABLE = 0xC2,
362};
363
364enum IPMI_RETURN_CODE_EXT
365{
366 IPMI_CC_INVALID_LUN = 0xC2,
367 IPMI_CC_STORGE_LEAK = 0xC4,
368 IPMI_CC_REQUEST_DATA_TRUNCATED = 0xC6,
369 IPMI_CC_REQUEST_DATA_FIELD_LENGTH_LIMIT_EXCEEDED = 0xC8,
370 IPMI_CC_CANNOT_RETURN_NUMBER_OF_REQUESTED_DATA_BYTES = 0xCA,
371 IPMI_CC_REQUEST_SENSOR_DATA_RECORD_NOT_FOUND = 0xCB,
372 IPMI_CC_DESTINATION_UNAVAILABLE = 0xD3,
373 IPMI_CC_PARAMETER_NOT_SUPPORT_IN_PRESENT_STATE = 0xD5,
374};
375
376constexpr unsigned char NETFUN_INTEL_APP_OEM = 0x3E;
377
378enum IPMI_NETFN_INTEL_OEM_APP_CMD
379{
380 MDR_STATUS = 0x20,
381 MDR_COMPLETE = 0x21,
382 MDR_EVENT = 0x22,
383 MDR_READ = 0x23,
384 MDR_WRITE = 0x24,
385 MDR_LOCK = 0x25,
386 MDRII_AGENT_STATUS = 0x30,
387 MDRII_GET_DIR = 0x31,
388 MDRII_GET_DATA_INFO = 0x32,
389 MDRII_LOCK_DATA = 0x33,
390 MDRII_UNLOCK_DATA = 0x34,
391 MDRII_GET_DATA_BLOCK = 0x35,
392 MDRII_SEND_DIR = 0x38,
393 MDRII_SEND_DATA_INFO_OFFER = 0x39,
394 MDRII_SEND_DATA_INFO = 0x3a,
395 MDRII_DATA_START = 0x3b,
396 MDRII_DATA_DONE = 0x3c,
397 MDRII_SEND_DATA_BLOCK = 0x3d,
398};
399
400enum class IPMINetFnIntelOemGeneralCmds
401{
402 GetSmSignal = 0x14,
403 SetSmSignal = 0x15,
Richard Marian Thomaiyaredf25e62019-06-11 01:14:49 +0530404 controlBmcServices = 0xB1,
405 getBmcServiceStatus = 0xB2,
Vernon Mauerya3702c12019-05-22 13:20:59 -0700406 SetSensorOverride = 0xEE,
407};