blob: b90b3886464347a718c17842f629579838179989 [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,
Richard Marian Thomaiyarfc5e9852019-04-14 15:06:27 +053030 cmdSetSpecialUserPassword = 0x5F,
Yong Li703922d2018-11-06 13:25:31 +080031 cmdSetShutdownPolicy = 0x60,
32 cmdGetShutdownPolicy = 0x62,
James Feist91244a62019-02-19 15:04:54 -080033 cmdSetFanConfig = 0x89,
34 cmdGetFanConfig = 0x8a,
James Feistacc8a4e2019-04-02 14:23:57 -070035 cmdSetFanSpeedOffset = 0x8c,
36 cmdGetFanSpeedOffset = 0x8d,
James Feist5f957ca2019-03-14 15:33:55 -070037 cmdSetFscParameter = 0x90,
38 cmdGetFscParameter = 0x91,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080039 cmdGetChassisIdentifier = 0x92,
Jason M. Bills64796042018-10-03 16:51:55 -070040 cmdGetProcessorErrConfig = 0x9A,
41 cmdSetProcessorErrConfig = 0x9B,
Kuiying Wang45f04982018-12-26 09:23:08 +080042 cmdGetLEDStatus = 0xB0,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080043};
44
Yong Li23737fe2019-02-19 08:49:55 +080045enum class IPMINetfnIntelOEMPlatformCmd
46{
47 cmdCfgHostSerialPortSpeed = 0x90,
48};
49
Jason M. Bills64796042018-10-03 16:51:55 -070050enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080051{
52 ipmiCCPayloadActive = 0x80,
53 ipmiCCInvalidPCIESlotID = 0x80,
54 ipmiCCParameterNotSupported = 0x80,
55 ipmiCCPayloadAlreadyDeactivated = 0x80,
56 ipmiCCSetInProcess = 0x81,
57 ipmiCCPayloadDisable = 0x81,
58 ipmiCCLostArbitration = 0x81,
59 ipmiCCInvalidCablePortIndex = 0x81,
60 ipmiCCHealthStatusNotAvailable = 0x81,
61 ipmiCCBusError = 0x82,
62 ipmiCCReadOnly = 0x82,
63 ipmiCCWriteOnly = 0x82,
64 ipmiCCNoCablePresent = 0x82,
65 ipmiCCDataCollectionInProgress = 0x82,
66 ipmiCCPayloadActivationLimitReached = 0x82,
67 ipmiCCNACKOnWrite = 0x83,
68 ipmiCCDataCollectionFailed = 0x83,
69 ipmiCCCanNotActivateWithEncrption = 0x83,
70 ipmiCCCanNotActivateWithoutEncryption = 0x84,
71 ipmiCCInvalidChecksum = 0x85,
72 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
73
74};
75
Jason M. Bills64796042018-10-03 16:51:55 -070076enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080077{
78 ipmiCCInvalidLUN = 0xC2,
79 ipmiCCTimeout = 0xC3,
80 ipmiCCStorageLeak = 0xC4,
81 ipmiCCRequestDataTruncated = 0xC6,
82 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
83 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
84 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
85 ipmiCCDestinationUnavailable = 0xD3,
86 ipmiCCParamterNotSupportInPresentState = 0xD5,
87};
88
Jason M. Bills64796042018-10-03 16:51:55 -070089constexpr const uint8_t netfunIntelAppOEM = 0x3E;
90static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080091 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
92 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +080093
94// Intel OEM Platform code is 0x32
95static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -070096static constexpr const uint8_t maxBIOSIDLength = 0xFF;
97static constexpr const uint8_t maxCPUNum = 4;
98static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
99static constexpr const char* biosIntf =
100 "xyz.openbmc_project.Inventory.Item.Bios";
101static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800102
Jason M. Bills64796042018-10-03 16:51:55 -0700103static constexpr const char* powerRestoreDelayObjPath =
104 "/xyz/openbmc_project/control/power_restore_delay";
105static constexpr const char* powerRestoreDelayIntf =
106 "xyz.openbmc_project.Control.Power.RestoreDelay";
107static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
108static constexpr const char* processorErrConfigObjPath =
109 "/xyz/openbmc_project/control/processor_error_config";
110static constexpr const char* processorErrConfigIntf =
111 "xyz.openbmc_project.Control.Processor.ErrConfig";
112
Yong Li703922d2018-11-06 13:25:31 +0800113static constexpr const char* postCodesObjPath =
114 "/xyz/openbmc_project/State/Boot/PostCode";
115static constexpr const char* postCodesIntf =
116 "xyz.openbmc_project.State.Boot.PostCode";
117
Kuiying Wang45f04982018-12-26 09:23:08 +0800118static constexpr const char* identifyLEDObjPath =
119 "/xyz/openbmc_project/led/physical/identify";
120static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
121static constexpr const char* statusAmberObjPath =
122 "/xyz/openbmc_project/led/physical/status_amber";
123static constexpr const char* statusGreenObjPath =
124 "/xyz/openbmc_project/led/physical/status_green";
125
Yong Li703922d2018-11-06 13:25:31 +0800126static constexpr const uint8_t noShutdownOnOCOT = 0;
127static constexpr const uint8_t shutdownOnOCOT = 1;
128static constexpr const uint8_t noShutdownPolicySupported = 0;
129static constexpr const uint8_t shutdownPolicySupported = 1;
130static constexpr const char* oemShutdownPolicyIntf =
131 "xyz.openbmc_project.Control.ShutdownPolicy";
132static constexpr const char* oemShutdownPolicyObjPath =
133 "/xyz/openbmc_project/control/shutdown_policy_config";
134static constexpr const char* oemShutdownPolicyObjPathProp = "Policy";
135
Yong Li23737fe2019-02-19 08:49:55 +0800136static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
137static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
138static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
139
James Feist91244a62019-02-19 15:04:54 -0800140constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
141
Yong Li23737fe2019-02-19 08:49:55 +0800142static constexpr const uint8_t getHostSerialCfgCmd = 0;
143static constexpr const uint8_t setHostSerialCfgCmd = 1;
144
145// parameters:
146// 0: host serial port 1 and 2 normal speed
147// 1: host serial port 1 high spend, port 2 normal speed
148// 2: host serial port 1 normal spend, port 2 high speed
149// 3: host serial port 1 and 2 high speed
150static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530151static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800152
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800153static constexpr const uint8_t selEvtTargetMask = 0xF0;
154static constexpr const uint8_t selEvtTargetShift = 4;
155
156static constexpr const uint8_t targetInstanceMask = 0x0E;
157static constexpr const uint8_t targetInstanceShift = 1;
158
Jason M. Bills64796042018-10-03 16:51:55 -0700159enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800160{
161 mdrStatus = 0x20,
162 mdrComplete = 0x21,
163 mdrEvent = 0x22,
164 mdrRead = 0x23,
165 mdrWrite = 0x24,
166 mdrLock = 0x25,
167 mdr2AgentStatus = 0x30,
168 mdr2GetDir = 0x31,
169 mdr2GetDataInfo = 0x32,
170 mdr2LockData = 0x33,
171 mdr2UnlockData = 0x34,
172 mdr2GetDataBlock = 0x35,
173 mdr2SendDir = 0x38,
174 mdr2SendDataInfoOffer = 0x39,
175 mdr2SendDataInfo = 0x3a,
176 mdr2DataStart = 0x3b,
177 mdr2DataDone = 0x3c,
178 mdr2SendDataBlock = 0x3d,
179};
180
Jason M. Bills64796042018-10-03 16:51:55 -0700181enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800182{
183 biosId,
184 devVer,
185 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700186};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800187
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800188enum class FWUpdateTarget : uint8_t
189{
190 targetBMC = 0x0,
191 targetBIOS = 0x1,
192 targetME = 0x2,
193 targetOEMEWS = 0x4,
194};
195
Jason M. Bills64796042018-10-03 16:51:55 -0700196#pragma pack(push, 1)
197struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800198{
199 uint8_t node1;
200 uint8_t node2;
201 uint8_t node3;
202 uint8_t node4;
203 uint8_t node5;
204 uint8_t node6;
205 uint8_t clock1;
206 uint8_t clock2;
207 uint8_t timeHigh1;
208 uint8_t timeHigh2;
209 uint8_t timeMid1;
210 uint8_t timeMid2;
211 uint8_t timeLow1;
212 uint8_t timeLow2;
213 uint8_t timeLow3;
214 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700215};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800216
Jason M. Bills64796042018-10-03 16:51:55 -0700217struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800218{
Jason M. Bills64796042018-10-03 16:51:55 -0700219 uint8_t biosIDLength;
220 uint8_t biosId[maxBIOSIDLength];
221};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800222
Jason M. Bills64796042018-10-03 16:51:55 -0700223struct SetPowerRestoreDelayReq
224{
225 uint8_t byteMSB;
226 uint8_t byteLSB;
227};
228
229struct GetPowerRestoreDelayRes
230{
231 uint8_t byteMSB;
232 uint8_t byteLSB;
233};
234
235struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800236{
237 uint8_t entityType;
238 uint8_t countToRead;
239 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700240};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800241
Jason M. Bills64796042018-10-03 16:51:55 -0700242struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800243{
244 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700245 uint8_t data[maxBIOSIDLength];
246};
247
248struct SetProcessorErrConfigReq
249{
250 uint8_t resetCfg; // Reset Configuration
251 // [0]: CATERR Reset Enabled
252 // 0b: Disabled
253 // 1b: Enabled
254 // [1]: ERR2 Reset Enabled
255 // 0b: Disabled
256 // 1b: Enabled
257 // [7:2]: Reserved
258 uint8_t reserved; // Reserved
259 uint8_t
260 resetErrorOccurrenceCounts; // Reset Error Occurrence Counts
261 //[0]: Reset CPU Error Counts
262 // 0b: Keep CPU Error Counts
263 // 1b: Reset all CPU Error Counts to zero
264 //[7:1]: Reserved
265};
266
267struct GetProcessorErrConfigRes
268{
269 uint8_t resetCfg; // Reset Configuration
270 // [0]: CATERR Reset Enabled
271 // 0b: Disabled
272 // 1b: Enabled
273 // [1]: ERR2 Reset Enabled
274 // 0b: Disabled
275 // 1b: Enabled
276 // [7:2]: Reserved
277 uint8_t reserved; // Reserved
278 char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy
279 // socket CPU CPU CATERR (Core Error)
280 // occurrence
281 // [5:0]: Error Occurrence Count
282 // [7:6]: CPU Status
283 // 00b: Disabled
284 // 01b: Enabled
285 // 11b: Not Present
286};
Yong Li703922d2018-11-06 13:25:31 +0800287
288struct GetOEMShutdownPolicyRes
289{
290 uint8_t policy;
291 uint8_t policySupport;
292};
Kuiying Wang45f04982018-12-26 09:23:08 +0800293
James Feist91244a62019-02-19 15:04:54 -0800294struct SetFanConfigReq
295{
296 uint8_t selectedProfile;
297 uint8_t flags;
298 // other parameters from previous generation are not supported
299};
300
301struct GetFanConfigResp
302{
303 uint8_t supportMask;
304 uint8_t profileSupport;
305 uint8_t fanControlProfileEnable;
306 uint8_t flags;
307 uint8_t dimmPresenceMap[4];
308};
309
Yong Li23737fe2019-02-19 08:49:55 +0800310struct CfgHostSerialReq
311{
312 uint8_t command;
313 uint8_t parameter;
314};
Kuiying Wang45f04982018-12-26 09:23:08 +0800315#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800316
317enum 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};