blob: 3dd452d6267261793d40696dfd6f9eade593de16 [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,
Jason M. Bills64796042018-10-03 16:51:55 -070041 cmdGetProcessorErrConfig = 0x9A,
42 cmdSetProcessorErrConfig = 0x9B,
Kuiying Wang45f04982018-12-26 09:23:08 +080043 cmdGetLEDStatus = 0xB0,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080044};
45
Yong Li23737fe2019-02-19 08:49:55 +080046enum class IPMINetfnIntelOEMPlatformCmd
47{
48 cmdCfgHostSerialPortSpeed = 0x90,
49};
50
Jason M. Bills64796042018-10-03 16:51:55 -070051enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080052{
53 ipmiCCPayloadActive = 0x80,
54 ipmiCCInvalidPCIESlotID = 0x80,
55 ipmiCCParameterNotSupported = 0x80,
56 ipmiCCPayloadAlreadyDeactivated = 0x80,
57 ipmiCCSetInProcess = 0x81,
58 ipmiCCPayloadDisable = 0x81,
59 ipmiCCLostArbitration = 0x81,
60 ipmiCCInvalidCablePortIndex = 0x81,
61 ipmiCCHealthStatusNotAvailable = 0x81,
62 ipmiCCBusError = 0x82,
63 ipmiCCReadOnly = 0x82,
64 ipmiCCWriteOnly = 0x82,
65 ipmiCCNoCablePresent = 0x82,
66 ipmiCCDataCollectionInProgress = 0x82,
67 ipmiCCPayloadActivationLimitReached = 0x82,
68 ipmiCCNACKOnWrite = 0x83,
69 ipmiCCDataCollectionFailed = 0x83,
70 ipmiCCCanNotActivateWithEncrption = 0x83,
71 ipmiCCCanNotActivateWithoutEncryption = 0x84,
72 ipmiCCInvalidChecksum = 0x85,
73 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
74
75};
76
Jason M. Bills64796042018-10-03 16:51:55 -070077enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080078{
79 ipmiCCInvalidLUN = 0xC2,
80 ipmiCCTimeout = 0xC3,
81 ipmiCCStorageLeak = 0xC4,
82 ipmiCCRequestDataTruncated = 0xC6,
83 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
84 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
85 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
86 ipmiCCDestinationUnavailable = 0xD3,
87 ipmiCCParamterNotSupportInPresentState = 0xD5,
88};
89
Jason M. Bills64796042018-10-03 16:51:55 -070090constexpr const uint8_t netfunIntelAppOEM = 0x3E;
91static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080092 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
93 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +080094
95// Intel OEM Platform code is 0x32
96static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -070097static constexpr const uint8_t maxBIOSIDLength = 0xFF;
98static constexpr const uint8_t maxCPUNum = 4;
99static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
100static constexpr const char* biosIntf =
101 "xyz.openbmc_project.Inventory.Item.Bios";
102static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800103
Jason M. Bills64796042018-10-03 16:51:55 -0700104static constexpr const char* powerRestoreDelayObjPath =
105 "/xyz/openbmc_project/control/power_restore_delay";
106static constexpr const char* powerRestoreDelayIntf =
107 "xyz.openbmc_project.Control.Power.RestoreDelay";
108static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
109static constexpr const char* processorErrConfigObjPath =
110 "/xyz/openbmc_project/control/processor_error_config";
111static constexpr const char* processorErrConfigIntf =
112 "xyz.openbmc_project.Control.Processor.ErrConfig";
113
Yong Li703922d2018-11-06 13:25:31 +0800114static constexpr const char* postCodesObjPath =
115 "/xyz/openbmc_project/State/Boot/PostCode";
116static constexpr const char* postCodesIntf =
117 "xyz.openbmc_project.State.Boot.PostCode";
118
Kuiying Wang45f04982018-12-26 09:23:08 +0800119static constexpr const char* identifyLEDObjPath =
120 "/xyz/openbmc_project/led/physical/identify";
121static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
122static constexpr const char* statusAmberObjPath =
123 "/xyz/openbmc_project/led/physical/status_amber";
124static constexpr const char* statusGreenObjPath =
125 "/xyz/openbmc_project/led/physical/status_green";
126
Yong Li703922d2018-11-06 13:25:31 +0800127static constexpr const uint8_t noShutdownOnOCOT = 0;
128static constexpr const uint8_t shutdownOnOCOT = 1;
129static constexpr const uint8_t noShutdownPolicySupported = 0;
130static constexpr const uint8_t shutdownPolicySupported = 1;
131static constexpr const char* oemShutdownPolicyIntf =
132 "xyz.openbmc_project.Control.ShutdownPolicy";
133static constexpr const char* oemShutdownPolicyObjPath =
134 "/xyz/openbmc_project/control/shutdown_policy_config";
135static constexpr const char* oemShutdownPolicyObjPathProp = "Policy";
136
Yong Li23737fe2019-02-19 08:49:55 +0800137static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
138static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
139static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
140
James Feist91244a62019-02-19 15:04:54 -0800141constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
142
Yong Li23737fe2019-02-19 08:49:55 +0800143static constexpr const uint8_t getHostSerialCfgCmd = 0;
144static constexpr const uint8_t setHostSerialCfgCmd = 1;
145
146// parameters:
147// 0: host serial port 1 and 2 normal speed
148// 1: host serial port 1 high spend, port 2 normal speed
149// 2: host serial port 1 normal spend, port 2 high speed
150// 3: host serial port 1 and 2 high speed
151static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530152static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800153
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800154static constexpr const uint8_t selEvtTargetMask = 0xF0;
155static constexpr const uint8_t selEvtTargetShift = 4;
156
157static constexpr const uint8_t targetInstanceMask = 0x0E;
158static constexpr const uint8_t targetInstanceShift = 1;
159
Jason M. Bills64796042018-10-03 16:51:55 -0700160enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800161{
162 mdrStatus = 0x20,
163 mdrComplete = 0x21,
164 mdrEvent = 0x22,
165 mdrRead = 0x23,
166 mdrWrite = 0x24,
167 mdrLock = 0x25,
168 mdr2AgentStatus = 0x30,
169 mdr2GetDir = 0x31,
170 mdr2GetDataInfo = 0x32,
171 mdr2LockData = 0x33,
172 mdr2UnlockData = 0x34,
173 mdr2GetDataBlock = 0x35,
174 mdr2SendDir = 0x38,
175 mdr2SendDataInfoOffer = 0x39,
176 mdr2SendDataInfo = 0x3a,
177 mdr2DataStart = 0x3b,
178 mdr2DataDone = 0x3c,
179 mdr2SendDataBlock = 0x3d,
180};
181
Jason M. Bills64796042018-10-03 16:51:55 -0700182enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800183{
184 biosId,
185 devVer,
186 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700187};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800188
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800189enum class FWUpdateTarget : uint8_t
190{
191 targetBMC = 0x0,
192 targetBIOS = 0x1,
193 targetME = 0x2,
194 targetOEMEWS = 0x4,
195};
196
Jason M. Bills64796042018-10-03 16:51:55 -0700197#pragma pack(push, 1)
198struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800199{
200 uint8_t node1;
201 uint8_t node2;
202 uint8_t node3;
203 uint8_t node4;
204 uint8_t node5;
205 uint8_t node6;
206 uint8_t clock1;
207 uint8_t clock2;
208 uint8_t timeHigh1;
209 uint8_t timeHigh2;
210 uint8_t timeMid1;
211 uint8_t timeMid2;
212 uint8_t timeLow1;
213 uint8_t timeLow2;
214 uint8_t timeLow3;
215 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700216};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800217
Jason M. Bills64796042018-10-03 16:51:55 -0700218struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800219{
Jason M. Bills64796042018-10-03 16:51:55 -0700220 uint8_t biosIDLength;
221 uint8_t biosId[maxBIOSIDLength];
222};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800223
Jason M. Bills64796042018-10-03 16:51:55 -0700224struct SetPowerRestoreDelayReq
225{
226 uint8_t byteMSB;
227 uint8_t byteLSB;
228};
229
230struct GetPowerRestoreDelayRes
231{
232 uint8_t byteMSB;
233 uint8_t byteLSB;
234};
235
236struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800237{
238 uint8_t entityType;
239 uint8_t countToRead;
240 uint8_t offset;
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 GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800244{
245 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700246 uint8_t data[maxBIOSIDLength];
247};
248
249struct SetProcessorErrConfigReq
250{
251 uint8_t resetCfg; // Reset Configuration
252 // [0]: CATERR Reset Enabled
253 // 0b: Disabled
254 // 1b: Enabled
255 // [1]: ERR2 Reset Enabled
256 // 0b: Disabled
257 // 1b: Enabled
258 // [7:2]: Reserved
259 uint8_t reserved; // Reserved
260 uint8_t
261 resetErrorOccurrenceCounts; // Reset Error Occurrence Counts
262 //[0]: Reset CPU Error Counts
263 // 0b: Keep CPU Error Counts
264 // 1b: Reset all CPU Error Counts to zero
265 //[7:1]: Reserved
266};
267
268struct GetProcessorErrConfigRes
269{
270 uint8_t resetCfg; // Reset Configuration
271 // [0]: CATERR Reset Enabled
272 // 0b: Disabled
273 // 1b: Enabled
274 // [1]: ERR2 Reset Enabled
275 // 0b: Disabled
276 // 1b: Enabled
277 // [7:2]: Reserved
278 uint8_t reserved; // Reserved
279 char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy
280 // socket CPU CPU CATERR (Core Error)
281 // occurrence
282 // [5:0]: Error Occurrence Count
283 // [7:6]: CPU Status
284 // 00b: Disabled
285 // 01b: Enabled
286 // 11b: Not Present
287};
Yong Li703922d2018-11-06 13:25:31 +0800288
289struct GetOEMShutdownPolicyRes
290{
291 uint8_t policy;
292 uint8_t policySupport;
293};
Kuiying Wang45f04982018-12-26 09:23:08 +0800294
James Feist91244a62019-02-19 15:04:54 -0800295struct SetFanConfigReq
296{
297 uint8_t selectedProfile;
298 uint8_t flags;
299 // other parameters from previous generation are not supported
300};
301
302struct GetFanConfigResp
303{
304 uint8_t supportMask;
305 uint8_t profileSupport;
306 uint8_t fanControlProfileEnable;
307 uint8_t flags;
308 uint8_t dimmPresenceMap[4];
309};
310
Yong Li23737fe2019-02-19 08:49:55 +0800311struct CfgHostSerialReq
312{
313 uint8_t command;
314 uint8_t parameter;
315};
Kuiying Wang45f04982018-12-26 09:23:08 +0800316#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800317
Zhu, Yungebe560b02019-04-21 21:19:21 -0400318//
319// Fault type enumeration
320//
321enum class RemoteFaultType
322{
323 fan, // 0
324 temperature, // 1
325 power, // 2
326 driveslot, // 3
327 software, // 4
328 memory, // 5
329 max = 6 // 6
330};
331
332// Enumeration for remote fault states as required by the HSC
333//
334enum class RemoteFaultState
335{
336 // fault indicators
337 fanLEDs,
338 cpu1DimmLeds,
339 cpu2DimmLeds,
340 cpu3DimmLeds,
341 cpu4DimmLeds,
342 maxFaultState,
343};
344
345enum class DimmFaultType
346{
347 cpu1cpu2Dimm,
348 cpu3cpu4Dimm,
349 maxFaultGroup,
350};
351
James Feist91244a62019-02-19 15:04:54 -0800352enum class setFanProfileFlags : uint8_t
353{
354 setFanProfile = 7,
355 setPerfAcousMode = 6,
356 // reserved [5:3]
357 performAcousSelect = 2
358 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700359};
360
361enum class setFscParamFlags : uint8_t
362{
363 tcontrol = 0x1,
364 pwmOffset = 0x2,
365 maxPwm = 0x3,
366 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800367};