blob: 137251a7c844394b3e3a47b2a8abff9d7347604e [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,
Suryakanth Sekard509eb92018-11-15 17:44:11 +053029 cmdSetOEMUser2Activation = 0x5A,
Yong Li703922d2018-11-06 13:25:31 +080030 cmdSetShutdownPolicy = 0x60,
31 cmdGetShutdownPolicy = 0x62,
James Feist91244a62019-02-19 15:04:54 -080032 cmdSetFanConfig = 0x89,
33 cmdGetFanConfig = 0x8a,
James Feistacc8a4e2019-04-02 14:23:57 -070034 cmdSetFanSpeedOffset = 0x8c,
35 cmdGetFanSpeedOffset = 0x8d,
James Feist5f957ca2019-03-14 15:33:55 -070036 cmdSetFscParameter = 0x90,
37 cmdGetFscParameter = 0x91,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080038 cmdGetChassisIdentifier = 0x92,
Jason M. Bills64796042018-10-03 16:51:55 -070039 cmdGetProcessorErrConfig = 0x9A,
40 cmdSetProcessorErrConfig = 0x9B,
Kuiying Wang45f04982018-12-26 09:23:08 +080041 cmdGetLEDStatus = 0xB0,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080042};
43
Yong Li23737fe2019-02-19 08:49:55 +080044enum class IPMINetfnIntelOEMPlatformCmd
45{
46 cmdCfgHostSerialPortSpeed = 0x90,
47};
48
Jason M. Bills64796042018-10-03 16:51:55 -070049enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080050{
51 ipmiCCPayloadActive = 0x80,
52 ipmiCCInvalidPCIESlotID = 0x80,
53 ipmiCCParameterNotSupported = 0x80,
54 ipmiCCPayloadAlreadyDeactivated = 0x80,
55 ipmiCCSetInProcess = 0x81,
56 ipmiCCPayloadDisable = 0x81,
57 ipmiCCLostArbitration = 0x81,
58 ipmiCCInvalidCablePortIndex = 0x81,
59 ipmiCCHealthStatusNotAvailable = 0x81,
60 ipmiCCBusError = 0x82,
61 ipmiCCReadOnly = 0x82,
62 ipmiCCWriteOnly = 0x82,
63 ipmiCCNoCablePresent = 0x82,
64 ipmiCCDataCollectionInProgress = 0x82,
65 ipmiCCPayloadActivationLimitReached = 0x82,
66 ipmiCCNACKOnWrite = 0x83,
67 ipmiCCDataCollectionFailed = 0x83,
68 ipmiCCCanNotActivateWithEncrption = 0x83,
69 ipmiCCCanNotActivateWithoutEncryption = 0x84,
70 ipmiCCInvalidChecksum = 0x85,
71 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
72
73};
74
Jason M. Bills64796042018-10-03 16:51:55 -070075enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080076{
77 ipmiCCInvalidLUN = 0xC2,
78 ipmiCCTimeout = 0xC3,
79 ipmiCCStorageLeak = 0xC4,
80 ipmiCCRequestDataTruncated = 0xC6,
81 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
82 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
83 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
84 ipmiCCDestinationUnavailable = 0xD3,
85 ipmiCCParamterNotSupportInPresentState = 0xD5,
86};
87
Jason M. Bills64796042018-10-03 16:51:55 -070088constexpr const uint8_t netfunIntelAppOEM = 0x3E;
89static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080090 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
91 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +080092
93// Intel OEM Platform code is 0x32
94static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -070095static constexpr const uint8_t maxBIOSIDLength = 0xFF;
96static constexpr const uint8_t maxCPUNum = 4;
97static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
98static constexpr const char* biosIntf =
99 "xyz.openbmc_project.Inventory.Item.Bios";
100static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800101
Jason M. Bills64796042018-10-03 16:51:55 -0700102static constexpr const char* powerRestoreDelayObjPath =
103 "/xyz/openbmc_project/control/power_restore_delay";
104static constexpr const char* powerRestoreDelayIntf =
105 "xyz.openbmc_project.Control.Power.RestoreDelay";
106static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
107static constexpr const char* processorErrConfigObjPath =
108 "/xyz/openbmc_project/control/processor_error_config";
109static constexpr const char* processorErrConfigIntf =
110 "xyz.openbmc_project.Control.Processor.ErrConfig";
111
Yong Li703922d2018-11-06 13:25:31 +0800112static constexpr const char* postCodesObjPath =
113 "/xyz/openbmc_project/State/Boot/PostCode";
114static constexpr const char* postCodesIntf =
115 "xyz.openbmc_project.State.Boot.PostCode";
116
Kuiying Wang45f04982018-12-26 09:23:08 +0800117static constexpr const char* identifyLEDObjPath =
118 "/xyz/openbmc_project/led/physical/identify";
119static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
120static constexpr const char* statusAmberObjPath =
121 "/xyz/openbmc_project/led/physical/status_amber";
122static constexpr const char* statusGreenObjPath =
123 "/xyz/openbmc_project/led/physical/status_green";
124
Yong Li703922d2018-11-06 13:25:31 +0800125static constexpr const uint8_t noShutdownOnOCOT = 0;
126static constexpr const uint8_t shutdownOnOCOT = 1;
127static constexpr const uint8_t noShutdownPolicySupported = 0;
128static constexpr const uint8_t shutdownPolicySupported = 1;
129static constexpr const char* oemShutdownPolicyIntf =
130 "xyz.openbmc_project.Control.ShutdownPolicy";
131static constexpr const char* oemShutdownPolicyObjPath =
132 "/xyz/openbmc_project/control/shutdown_policy_config";
133static constexpr const char* oemShutdownPolicyObjPathProp = "Policy";
134
Yong Li23737fe2019-02-19 08:49:55 +0800135static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
136static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
137static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
138
James Feist91244a62019-02-19 15:04:54 -0800139constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
140
Yong Li23737fe2019-02-19 08:49:55 +0800141static constexpr const uint8_t getHostSerialCfgCmd = 0;
142static constexpr const uint8_t setHostSerialCfgCmd = 1;
143
144// parameters:
145// 0: host serial port 1 and 2 normal speed
146// 1: host serial port 1 high spend, port 2 normal speed
147// 2: host serial port 1 normal spend, port 2 high speed
148// 3: host serial port 1 and 2 high speed
149static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530150static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800151
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800152static constexpr const uint8_t selEvtTargetMask = 0xF0;
153static constexpr const uint8_t selEvtTargetShift = 4;
154
155static constexpr const uint8_t targetInstanceMask = 0x0E;
156static constexpr const uint8_t targetInstanceShift = 1;
157
Jason M. Bills64796042018-10-03 16:51:55 -0700158enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800159{
160 mdrStatus = 0x20,
161 mdrComplete = 0x21,
162 mdrEvent = 0x22,
163 mdrRead = 0x23,
164 mdrWrite = 0x24,
165 mdrLock = 0x25,
166 mdr2AgentStatus = 0x30,
167 mdr2GetDir = 0x31,
168 mdr2GetDataInfo = 0x32,
169 mdr2LockData = 0x33,
170 mdr2UnlockData = 0x34,
171 mdr2GetDataBlock = 0x35,
172 mdr2SendDir = 0x38,
173 mdr2SendDataInfoOffer = 0x39,
174 mdr2SendDataInfo = 0x3a,
175 mdr2DataStart = 0x3b,
176 mdr2DataDone = 0x3c,
177 mdr2SendDataBlock = 0x3d,
178};
179
Jason M. Bills64796042018-10-03 16:51:55 -0700180enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800181{
182 biosId,
183 devVer,
184 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700185};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800186
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800187enum class FWUpdateTarget : uint8_t
188{
189 targetBMC = 0x0,
190 targetBIOS = 0x1,
191 targetME = 0x2,
192 targetOEMEWS = 0x4,
193};
194
Jason M. Bills64796042018-10-03 16:51:55 -0700195#pragma pack(push, 1)
196struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800197{
198 uint8_t node1;
199 uint8_t node2;
200 uint8_t node3;
201 uint8_t node4;
202 uint8_t node5;
203 uint8_t node6;
204 uint8_t clock1;
205 uint8_t clock2;
206 uint8_t timeHigh1;
207 uint8_t timeHigh2;
208 uint8_t timeMid1;
209 uint8_t timeMid2;
210 uint8_t timeLow1;
211 uint8_t timeLow2;
212 uint8_t timeLow3;
213 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700214};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800215
Jason M. Bills64796042018-10-03 16:51:55 -0700216struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800217{
Jason M. Bills64796042018-10-03 16:51:55 -0700218 uint8_t biosIDLength;
219 uint8_t biosId[maxBIOSIDLength];
220};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800221
Jason M. Bills64796042018-10-03 16:51:55 -0700222struct SetPowerRestoreDelayReq
223{
224 uint8_t byteMSB;
225 uint8_t byteLSB;
226};
227
228struct GetPowerRestoreDelayRes
229{
230 uint8_t byteMSB;
231 uint8_t byteLSB;
232};
233
234struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800235{
236 uint8_t entityType;
237 uint8_t countToRead;
238 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700239};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800240
Jason M. Bills64796042018-10-03 16:51:55 -0700241struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800242{
243 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700244 uint8_t data[maxBIOSIDLength];
245};
246
247struct SetProcessorErrConfigReq
248{
249 uint8_t resetCfg; // Reset Configuration
250 // [0]: CATERR Reset Enabled
251 // 0b: Disabled
252 // 1b: Enabled
253 // [1]: ERR2 Reset Enabled
254 // 0b: Disabled
255 // 1b: Enabled
256 // [7:2]: Reserved
257 uint8_t reserved; // Reserved
258 uint8_t
259 resetErrorOccurrenceCounts; // Reset Error Occurrence Counts
260 //[0]: Reset CPU Error Counts
261 // 0b: Keep CPU Error Counts
262 // 1b: Reset all CPU Error Counts to zero
263 //[7:1]: Reserved
264};
265
266struct GetProcessorErrConfigRes
267{
268 uint8_t resetCfg; // Reset Configuration
269 // [0]: CATERR Reset Enabled
270 // 0b: Disabled
271 // 1b: Enabled
272 // [1]: ERR2 Reset Enabled
273 // 0b: Disabled
274 // 1b: Enabled
275 // [7:2]: Reserved
276 uint8_t reserved; // Reserved
277 char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy
278 // socket CPU CPU CATERR (Core Error)
279 // occurrence
280 // [5:0]: Error Occurrence Count
281 // [7:6]: CPU Status
282 // 00b: Disabled
283 // 01b: Enabled
284 // 11b: Not Present
285};
Yong Li703922d2018-11-06 13:25:31 +0800286
287struct GetOEMShutdownPolicyRes
288{
289 uint8_t policy;
290 uint8_t policySupport;
291};
Kuiying Wang45f04982018-12-26 09:23:08 +0800292
James Feist91244a62019-02-19 15:04:54 -0800293struct SetFanConfigReq
294{
295 uint8_t selectedProfile;
296 uint8_t flags;
297 // other parameters from previous generation are not supported
298};
299
300struct GetFanConfigResp
301{
302 uint8_t supportMask;
303 uint8_t profileSupport;
304 uint8_t fanControlProfileEnable;
305 uint8_t flags;
306 uint8_t dimmPresenceMap[4];
307};
308
Yong Li23737fe2019-02-19 08:49:55 +0800309struct CfgHostSerialReq
310{
311 uint8_t command;
312 uint8_t parameter;
313};
Kuiying Wang45f04982018-12-26 09:23:08 +0800314#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800315
316enum class setFanProfileFlags : uint8_t
317{
318 setFanProfile = 7,
319 setPerfAcousMode = 6,
320 // reserved [5:3]
321 performAcousSelect = 2
322 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700323};
324
325enum class setFscParamFlags : uint8_t
326{
327 tcontrol = 0x1,
328 pwmOffset = 0x2,
329 maxPwm = 0x3,
330 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800331};