blob: e0e690332a11d21cdb371135b8814712dbb24112 [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 Feist5f957ca2019-03-14 15:33:55 -070038 cmdSetFscParameter = 0x90,
39 cmdGetFscParameter = 0x91,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080040 cmdGetChassisIdentifier = 0x92,
Richard Marian Thomaiyarea537d52019-04-24 21:33:48 +053041 cmdReadBaseBoardProductId = 0x93,
Jason M. Bills64796042018-10-03 16:51:55 -070042 cmdGetProcessorErrConfig = 0x9A,
43 cmdSetProcessorErrConfig = 0x9B,
Kuiying Wang45f04982018-12-26 09:23:08 +080044 cmdGetLEDStatus = 0xB0,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080045};
46
Yong Li23737fe2019-02-19 08:49:55 +080047enum class IPMINetfnIntelOEMPlatformCmd
48{
49 cmdCfgHostSerialPortSpeed = 0x90,
50};
51
Jason M. Bills64796042018-10-03 16:51:55 -070052enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080053{
54 ipmiCCPayloadActive = 0x80,
55 ipmiCCInvalidPCIESlotID = 0x80,
56 ipmiCCParameterNotSupported = 0x80,
57 ipmiCCPayloadAlreadyDeactivated = 0x80,
58 ipmiCCSetInProcess = 0x81,
59 ipmiCCPayloadDisable = 0x81,
60 ipmiCCLostArbitration = 0x81,
61 ipmiCCInvalidCablePortIndex = 0x81,
62 ipmiCCHealthStatusNotAvailable = 0x81,
63 ipmiCCBusError = 0x82,
64 ipmiCCReadOnly = 0x82,
65 ipmiCCWriteOnly = 0x82,
66 ipmiCCNoCablePresent = 0x82,
67 ipmiCCDataCollectionInProgress = 0x82,
68 ipmiCCPayloadActivationLimitReached = 0x82,
69 ipmiCCNACKOnWrite = 0x83,
70 ipmiCCDataCollectionFailed = 0x83,
71 ipmiCCCanNotActivateWithEncrption = 0x83,
72 ipmiCCCanNotActivateWithoutEncryption = 0x84,
73 ipmiCCInvalidChecksum = 0x85,
74 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
75
76};
77
Jason M. Bills64796042018-10-03 16:51:55 -070078enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080079{
80 ipmiCCInvalidLUN = 0xC2,
81 ipmiCCTimeout = 0xC3,
82 ipmiCCStorageLeak = 0xC4,
83 ipmiCCRequestDataTruncated = 0xC6,
84 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
85 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
86 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
87 ipmiCCDestinationUnavailable = 0xD3,
88 ipmiCCParamterNotSupportInPresentState = 0xD5,
89};
90
Jason M. Bills64796042018-10-03 16:51:55 -070091constexpr const uint8_t netfunIntelAppOEM = 0x3E;
92static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080093 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
94 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +080095
96// Intel OEM Platform code is 0x32
97static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -070098static constexpr const uint8_t maxBIOSIDLength = 0xFF;
99static constexpr const uint8_t maxCPUNum = 4;
100static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
101static constexpr const char* biosIntf =
102 "xyz.openbmc_project.Inventory.Item.Bios";
103static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800104
Jason M. Bills64796042018-10-03 16:51:55 -0700105static constexpr const char* powerRestoreDelayObjPath =
106 "/xyz/openbmc_project/control/power_restore_delay";
107static constexpr const char* powerRestoreDelayIntf =
108 "xyz.openbmc_project.Control.Power.RestoreDelay";
109static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
110static constexpr const char* processorErrConfigObjPath =
111 "/xyz/openbmc_project/control/processor_error_config";
112static constexpr const char* processorErrConfigIntf =
113 "xyz.openbmc_project.Control.Processor.ErrConfig";
114
Yong Li703922d2018-11-06 13:25:31 +0800115static constexpr const char* postCodesObjPath =
116 "/xyz/openbmc_project/State/Boot/PostCode";
117static constexpr const char* postCodesIntf =
118 "xyz.openbmc_project.State.Boot.PostCode";
119
Kuiying Wang45f04982018-12-26 09:23:08 +0800120static constexpr const char* identifyLEDObjPath =
121 "/xyz/openbmc_project/led/physical/identify";
122static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
123static constexpr const char* statusAmberObjPath =
124 "/xyz/openbmc_project/led/physical/status_amber";
125static constexpr const char* statusGreenObjPath =
126 "/xyz/openbmc_project/led/physical/status_green";
127
Yong Li703922d2018-11-06 13:25:31 +0800128static constexpr const uint8_t noShutdownOnOCOT = 0;
129static constexpr const uint8_t shutdownOnOCOT = 1;
130static constexpr const uint8_t noShutdownPolicySupported = 0;
131static constexpr const uint8_t shutdownPolicySupported = 1;
132static constexpr const char* oemShutdownPolicyIntf =
Yong Li0669d192019-05-06 14:01:46 +0800133 "com.intel.Control.OCOTShutdownPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800134static constexpr const char* oemShutdownPolicyObjPath =
Yong Li0669d192019-05-06 14:01:46 +0800135 "/com/intel/control/ocotshutdown_policy_config";
136static constexpr const char* oemShutdownPolicyObjPathProp = "OCOTPolicy";
Yong Li703922d2018-11-06 13:25:31 +0800137
Yong Li23737fe2019-02-19 08:49:55 +0800138static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
139static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
140static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
141
James Feist91244a62019-02-19 15:04:54 -0800142constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
143
Yong Li23737fe2019-02-19 08:49:55 +0800144static constexpr const uint8_t getHostSerialCfgCmd = 0;
145static constexpr const uint8_t setHostSerialCfgCmd = 1;
146
147// parameters:
148// 0: host serial port 1 and 2 normal speed
149// 1: host serial port 1 high spend, port 2 normal speed
150// 2: host serial port 1 normal spend, port 2 high speed
151// 3: host serial port 1 and 2 high speed
152static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530153static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800154
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800155static constexpr const uint8_t selEvtTargetMask = 0xF0;
156static constexpr const uint8_t selEvtTargetShift = 4;
157
158static constexpr const uint8_t targetInstanceMask = 0x0E;
159static constexpr const uint8_t targetInstanceShift = 1;
160
Jason M. Bills64796042018-10-03 16:51:55 -0700161enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800162{
163 mdrStatus = 0x20,
164 mdrComplete = 0x21,
165 mdrEvent = 0x22,
166 mdrRead = 0x23,
167 mdrWrite = 0x24,
168 mdrLock = 0x25,
169 mdr2AgentStatus = 0x30,
170 mdr2GetDir = 0x31,
171 mdr2GetDataInfo = 0x32,
172 mdr2LockData = 0x33,
173 mdr2UnlockData = 0x34,
174 mdr2GetDataBlock = 0x35,
175 mdr2SendDir = 0x38,
176 mdr2SendDataInfoOffer = 0x39,
177 mdr2SendDataInfo = 0x3a,
178 mdr2DataStart = 0x3b,
179 mdr2DataDone = 0x3c,
180 mdr2SendDataBlock = 0x3d,
181};
182
Jason M. Bills64796042018-10-03 16:51:55 -0700183enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800184{
185 biosId,
186 devVer,
187 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700188};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800189
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800190enum class FWUpdateTarget : uint8_t
191{
192 targetBMC = 0x0,
193 targetBIOS = 0x1,
194 targetME = 0x2,
195 targetOEMEWS = 0x4,
196};
197
Jason M. Bills64796042018-10-03 16:51:55 -0700198#pragma pack(push, 1)
199struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800200{
201 uint8_t node1;
202 uint8_t node2;
203 uint8_t node3;
204 uint8_t node4;
205 uint8_t node5;
206 uint8_t node6;
207 uint8_t clock1;
208 uint8_t clock2;
209 uint8_t timeHigh1;
210 uint8_t timeHigh2;
211 uint8_t timeMid1;
212 uint8_t timeMid2;
213 uint8_t timeLow1;
214 uint8_t timeLow2;
215 uint8_t timeLow3;
216 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700217};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800218
Jason M. Bills64796042018-10-03 16:51:55 -0700219struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800220{
Jason M. Bills64796042018-10-03 16:51:55 -0700221 uint8_t biosIDLength;
222 uint8_t biosId[maxBIOSIDLength];
223};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800224
Jason M. Bills64796042018-10-03 16:51:55 -0700225struct SetPowerRestoreDelayReq
226{
227 uint8_t byteMSB;
228 uint8_t byteLSB;
229};
230
231struct GetPowerRestoreDelayRes
232{
233 uint8_t byteMSB;
234 uint8_t byteLSB;
235};
236
237struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800238{
239 uint8_t entityType;
240 uint8_t countToRead;
241 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700242};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800243
Jason M. Bills64796042018-10-03 16:51:55 -0700244struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800245{
246 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700247 uint8_t data[maxBIOSIDLength];
248};
249
250struct SetProcessorErrConfigReq
251{
252 uint8_t resetCfg; // Reset Configuration
253 // [0]: CATERR Reset Enabled
254 // 0b: Disabled
255 // 1b: Enabled
256 // [1]: ERR2 Reset Enabled
257 // 0b: Disabled
258 // 1b: Enabled
259 // [7:2]: Reserved
260 uint8_t reserved; // Reserved
261 uint8_t
262 resetErrorOccurrenceCounts; // Reset Error Occurrence Counts
263 //[0]: Reset CPU Error Counts
264 // 0b: Keep CPU Error Counts
265 // 1b: Reset all CPU Error Counts to zero
266 //[7:1]: Reserved
267};
268
269struct GetProcessorErrConfigRes
270{
271 uint8_t resetCfg; // Reset Configuration
272 // [0]: CATERR Reset Enabled
273 // 0b: Disabled
274 // 1b: Enabled
275 // [1]: ERR2 Reset Enabled
276 // 0b: Disabled
277 // 1b: Enabled
278 // [7:2]: Reserved
279 uint8_t reserved; // Reserved
280 char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy
281 // socket CPU CPU CATERR (Core Error)
282 // occurrence
283 // [5:0]: Error Occurrence Count
284 // [7:6]: CPU Status
285 // 00b: Disabled
286 // 01b: Enabled
287 // 11b: Not Present
288};
Yong Li703922d2018-11-06 13:25:31 +0800289
290struct GetOEMShutdownPolicyRes
291{
292 uint8_t policy;
293 uint8_t policySupport;
294};
Kuiying Wang45f04982018-12-26 09:23:08 +0800295
James Feist91244a62019-02-19 15:04:54 -0800296struct SetFanConfigReq
297{
298 uint8_t selectedProfile;
299 uint8_t flags;
300 // other parameters from previous generation are not supported
301};
302
303struct GetFanConfigResp
304{
305 uint8_t supportMask;
306 uint8_t profileSupport;
307 uint8_t fanControlProfileEnable;
308 uint8_t flags;
309 uint8_t dimmPresenceMap[4];
310};
311
Yong Li23737fe2019-02-19 08:49:55 +0800312struct CfgHostSerialReq
313{
314 uint8_t command;
315 uint8_t parameter;
316};
Kuiying Wang45f04982018-12-26 09:23:08 +0800317#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800318
Zhu, Yungebe560b02019-04-21 21:19:21 -0400319//
320// Fault type enumeration
321//
322enum class RemoteFaultType
323{
324 fan, // 0
325 temperature, // 1
326 power, // 2
327 driveslot, // 3
328 software, // 4
329 memory, // 5
330 max = 6 // 6
331};
332
333// Enumeration for remote fault states as required by the HSC
334//
335enum class RemoteFaultState
336{
337 // fault indicators
338 fanLEDs,
339 cpu1DimmLeds,
340 cpu2DimmLeds,
341 cpu3DimmLeds,
342 cpu4DimmLeds,
343 maxFaultState,
344};
345
346enum class DimmFaultType
347{
348 cpu1cpu2Dimm,
349 cpu3cpu4Dimm,
350 maxFaultGroup,
351};
352
James Feist91244a62019-02-19 15:04:54 -0800353enum class setFanProfileFlags : uint8_t
354{
355 setFanProfile = 7,
356 setPerfAcousMode = 6,
357 // reserved [5:3]
358 performAcousSelect = 2
359 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700360};
361
362enum class setFscParamFlags : uint8_t
363{
364 tcontrol = 0x1,
365 pwmOffset = 0x2,
366 maxPwm = 0x3,
367 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800368};
Vernon Mauerya3702c12019-05-22 13:20:59 -0700369
370// FIXME: this stuff needs to be rewritten
371enum IPMI_INTEL_OEM_RETURN_CODES
372{
373 IPMI_CC_OEM_PAYLOAD_ACTIVE = 0x80,
374 IPMI_CC_OEM_INVALID_PCIE_SLOTID = 0x80,
375 IPMI_CC_OEM_PARAMETER_NOT_SUPPORTED = 0x80,
376 IPMI_CC_OEM_PAYLOAD_ALREADY_DEACTIVATED = 0x80,
377 IPMI_CC_OEM_SET_IN_PROCESS = 0x81,
378 IPMI_CC_OEM_PAYLOAD_DISABLE = 0x81,
379 IPMI_CC_OEM_LOST_ARBITRATION = 0x81,
380 IPMI_CC_OEM_INVALID_CABLE_PORT_INDEX = 0x81,
381 IPMI_CC_OEM_HEALTH_STATUS_NOT_AVAILABLE = 0x81,
382 IPMI_CC_OEM_BUS_ERROR = 0x82,
383 IPMI_CC_OEM_READ_ONLY = 0x82,
384 IPMI_CC_OEM_WRITE_ONLY = 0x82,
385 IPMI_CC_OEM_NO_CABLE_PRESENT = 0x82,
386 IPMI_CC_OEM_DATA_COLLECTION_IN_PROGRESS = 0x82,
387 IPMI_CC_OEM_PAYLOAD_ACTIVATION_LIMIT_REACH = 0x82,
388 IPMI_CC_OEM_NACK_ON_WRITE = 0x83,
389 IPMI_CC_OEM_DATA_COLLECTION_FAILED = 0x83,
390 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITH_ENCRYPTION = 0x83,
391 IPMI_CC_OEM_CAN_NOT_ACTIVATE_WITHOUT_ENCRYPTION = 0x84,
392 IPMI_CC_OEM_INVALID_CHECKSUM = 0x85,
393 IPMI_CC_OEM_NO_CABLED_PCIE_PORTS_AVAILABLE = 0xC2,
394};
395
396enum IPMI_RETURN_CODE_EXT
397{
398 IPMI_CC_INVALID_LUN = 0xC2,
399 IPMI_CC_STORGE_LEAK = 0xC4,
400 IPMI_CC_REQUEST_DATA_TRUNCATED = 0xC6,
401 IPMI_CC_REQUEST_DATA_FIELD_LENGTH_LIMIT_EXCEEDED = 0xC8,
402 IPMI_CC_CANNOT_RETURN_NUMBER_OF_REQUESTED_DATA_BYTES = 0xCA,
403 IPMI_CC_REQUEST_SENSOR_DATA_RECORD_NOT_FOUND = 0xCB,
404 IPMI_CC_DESTINATION_UNAVAILABLE = 0xD3,
405 IPMI_CC_PARAMETER_NOT_SUPPORT_IN_PRESENT_STATE = 0xD5,
406};
407
408constexpr unsigned char NETFUN_INTEL_APP_OEM = 0x3E;
409
410enum IPMI_NETFN_INTEL_OEM_APP_CMD
411{
412 MDR_STATUS = 0x20,
413 MDR_COMPLETE = 0x21,
414 MDR_EVENT = 0x22,
415 MDR_READ = 0x23,
416 MDR_WRITE = 0x24,
417 MDR_LOCK = 0x25,
418 MDRII_AGENT_STATUS = 0x30,
419 MDRII_GET_DIR = 0x31,
420 MDRII_GET_DATA_INFO = 0x32,
421 MDRII_LOCK_DATA = 0x33,
422 MDRII_UNLOCK_DATA = 0x34,
423 MDRII_GET_DATA_BLOCK = 0x35,
424 MDRII_SEND_DIR = 0x38,
425 MDRII_SEND_DATA_INFO_OFFER = 0x39,
426 MDRII_SEND_DATA_INFO = 0x3a,
427 MDRII_DATA_START = 0x3b,
428 MDRII_DATA_DONE = 0x3c,
429 MDRII_SEND_DATA_BLOCK = 0x3d,
430};
431
432enum class IPMINetFnIntelOemGeneralCmds
433{
434 GetSmSignal = 0x14,
435 SetSmSignal = 0x15,
436 BmcControlServices = 0xC0,
437 SetSensorOverride = 0xEE,
438};