blob: 06a3caa60bf2c925cb55d7580bf822d1b85e15c0 [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 Feist5f957ca2019-03-14 15:33:55 -070034 cmdSetFscParameter = 0x90,
35 cmdGetFscParameter = 0x91,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080036 cmdGetChassisIdentifier = 0x92,
Jason M. Bills64796042018-10-03 16:51:55 -070037 cmdGetProcessorErrConfig = 0x9A,
38 cmdSetProcessorErrConfig = 0x9B,
Kuiying Wang45f04982018-12-26 09:23:08 +080039 cmdGetLEDStatus = 0xB0,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080040};
41
Yong Li23737fe2019-02-19 08:49:55 +080042enum class IPMINetfnIntelOEMPlatformCmd
43{
44 cmdCfgHostSerialPortSpeed = 0x90,
45};
46
Jason M. Bills64796042018-10-03 16:51:55 -070047enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080048{
49 ipmiCCPayloadActive = 0x80,
50 ipmiCCInvalidPCIESlotID = 0x80,
51 ipmiCCParameterNotSupported = 0x80,
52 ipmiCCPayloadAlreadyDeactivated = 0x80,
53 ipmiCCSetInProcess = 0x81,
54 ipmiCCPayloadDisable = 0x81,
55 ipmiCCLostArbitration = 0x81,
56 ipmiCCInvalidCablePortIndex = 0x81,
57 ipmiCCHealthStatusNotAvailable = 0x81,
58 ipmiCCBusError = 0x82,
59 ipmiCCReadOnly = 0x82,
60 ipmiCCWriteOnly = 0x82,
61 ipmiCCNoCablePresent = 0x82,
62 ipmiCCDataCollectionInProgress = 0x82,
63 ipmiCCPayloadActivationLimitReached = 0x82,
64 ipmiCCNACKOnWrite = 0x83,
65 ipmiCCDataCollectionFailed = 0x83,
66 ipmiCCCanNotActivateWithEncrption = 0x83,
67 ipmiCCCanNotActivateWithoutEncryption = 0x84,
68 ipmiCCInvalidChecksum = 0x85,
69 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
70
71};
72
Jason M. Bills64796042018-10-03 16:51:55 -070073enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080074{
75 ipmiCCInvalidLUN = 0xC2,
76 ipmiCCTimeout = 0xC3,
77 ipmiCCStorageLeak = 0xC4,
78 ipmiCCRequestDataTruncated = 0xC6,
79 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
80 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
81 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
82 ipmiCCDestinationUnavailable = 0xD3,
83 ipmiCCParamterNotSupportInPresentState = 0xD5,
84};
85
Jason M. Bills64796042018-10-03 16:51:55 -070086constexpr const uint8_t netfunIntelAppOEM = 0x3E;
87static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080088 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
89 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +080090
91// Intel OEM Platform code is 0x32
92static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -070093static constexpr const uint8_t maxBIOSIDLength = 0xFF;
94static constexpr const uint8_t maxCPUNum = 4;
95static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
96static constexpr const char* biosIntf =
97 "xyz.openbmc_project.Inventory.Item.Bios";
98static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080099
Jason M. Bills64796042018-10-03 16:51:55 -0700100static constexpr const char* powerRestoreDelayObjPath =
101 "/xyz/openbmc_project/control/power_restore_delay";
102static constexpr const char* powerRestoreDelayIntf =
103 "xyz.openbmc_project.Control.Power.RestoreDelay";
104static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
105static constexpr const char* processorErrConfigObjPath =
106 "/xyz/openbmc_project/control/processor_error_config";
107static constexpr const char* processorErrConfigIntf =
108 "xyz.openbmc_project.Control.Processor.ErrConfig";
109
Yong Li703922d2018-11-06 13:25:31 +0800110static constexpr const char* postCodesObjPath =
111 "/xyz/openbmc_project/State/Boot/PostCode";
112static constexpr const char* postCodesIntf =
113 "xyz.openbmc_project.State.Boot.PostCode";
114
Kuiying Wang45f04982018-12-26 09:23:08 +0800115static constexpr const char* identifyLEDObjPath =
116 "/xyz/openbmc_project/led/physical/identify";
117static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
118static constexpr const char* statusAmberObjPath =
119 "/xyz/openbmc_project/led/physical/status_amber";
120static constexpr const char* statusGreenObjPath =
121 "/xyz/openbmc_project/led/physical/status_green";
122
Yong Li703922d2018-11-06 13:25:31 +0800123static constexpr const uint8_t noShutdownOnOCOT = 0;
124static constexpr const uint8_t shutdownOnOCOT = 1;
125static constexpr const uint8_t noShutdownPolicySupported = 0;
126static constexpr const uint8_t shutdownPolicySupported = 1;
127static constexpr const char* oemShutdownPolicyIntf =
128 "xyz.openbmc_project.Control.ShutdownPolicy";
129static constexpr const char* oemShutdownPolicyObjPath =
130 "/xyz/openbmc_project/control/shutdown_policy_config";
131static constexpr const char* oemShutdownPolicyObjPathProp = "Policy";
132
Yong Li23737fe2019-02-19 08:49:55 +0800133static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
134static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
135static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
136
James Feist91244a62019-02-19 15:04:54 -0800137constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
138
Yong Li23737fe2019-02-19 08:49:55 +0800139static constexpr const uint8_t getHostSerialCfgCmd = 0;
140static constexpr const uint8_t setHostSerialCfgCmd = 1;
141
142// parameters:
143// 0: host serial port 1 and 2 normal speed
144// 1: host serial port 1 high spend, port 2 normal speed
145// 2: host serial port 1 normal spend, port 2 high speed
146// 3: host serial port 1 and 2 high speed
147static constexpr const uint8_t HostSerialCfgParamMax = 3;
Suryakanth Sekard509eb92018-11-15 17:44:11 +0530148static constexpr uint8_t ipmiDefaultUserId = 2;
Yong Li23737fe2019-02-19 08:49:55 +0800149
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800150static constexpr const uint8_t selEvtTargetMask = 0xF0;
151static constexpr const uint8_t selEvtTargetShift = 4;
152
153static constexpr const uint8_t targetInstanceMask = 0x0E;
154static constexpr const uint8_t targetInstanceShift = 1;
155
Jason M. Bills64796042018-10-03 16:51:55 -0700156enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800157{
158 mdrStatus = 0x20,
159 mdrComplete = 0x21,
160 mdrEvent = 0x22,
161 mdrRead = 0x23,
162 mdrWrite = 0x24,
163 mdrLock = 0x25,
164 mdr2AgentStatus = 0x30,
165 mdr2GetDir = 0x31,
166 mdr2GetDataInfo = 0x32,
167 mdr2LockData = 0x33,
168 mdr2UnlockData = 0x34,
169 mdr2GetDataBlock = 0x35,
170 mdr2SendDir = 0x38,
171 mdr2SendDataInfoOffer = 0x39,
172 mdr2SendDataInfo = 0x3a,
173 mdr2DataStart = 0x3b,
174 mdr2DataDone = 0x3c,
175 mdr2SendDataBlock = 0x3d,
176};
177
Jason M. Bills64796042018-10-03 16:51:55 -0700178enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800179{
180 biosId,
181 devVer,
182 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700183};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800184
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800185enum class FWUpdateTarget : uint8_t
186{
187 targetBMC = 0x0,
188 targetBIOS = 0x1,
189 targetME = 0x2,
190 targetOEMEWS = 0x4,
191};
192
Jason M. Bills64796042018-10-03 16:51:55 -0700193#pragma pack(push, 1)
194struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800195{
196 uint8_t node1;
197 uint8_t node2;
198 uint8_t node3;
199 uint8_t node4;
200 uint8_t node5;
201 uint8_t node6;
202 uint8_t clock1;
203 uint8_t clock2;
204 uint8_t timeHigh1;
205 uint8_t timeHigh2;
206 uint8_t timeMid1;
207 uint8_t timeMid2;
208 uint8_t timeLow1;
209 uint8_t timeLow2;
210 uint8_t timeLow3;
211 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700212};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800213
Jason M. Bills64796042018-10-03 16:51:55 -0700214struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800215{
Jason M. Bills64796042018-10-03 16:51:55 -0700216 uint8_t biosIDLength;
217 uint8_t biosId[maxBIOSIDLength];
218};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800219
Jason M. Bills64796042018-10-03 16:51:55 -0700220struct SetPowerRestoreDelayReq
221{
222 uint8_t byteMSB;
223 uint8_t byteLSB;
224};
225
226struct GetPowerRestoreDelayRes
227{
228 uint8_t byteMSB;
229 uint8_t byteLSB;
230};
231
232struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800233{
234 uint8_t entityType;
235 uint8_t countToRead;
236 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700237};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800238
Jason M. Bills64796042018-10-03 16:51:55 -0700239struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800240{
241 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700242 uint8_t data[maxBIOSIDLength];
243};
244
245struct SetProcessorErrConfigReq
246{
247 uint8_t resetCfg; // Reset Configuration
248 // [0]: CATERR Reset Enabled
249 // 0b: Disabled
250 // 1b: Enabled
251 // [1]: ERR2 Reset Enabled
252 // 0b: Disabled
253 // 1b: Enabled
254 // [7:2]: Reserved
255 uint8_t reserved; // Reserved
256 uint8_t
257 resetErrorOccurrenceCounts; // Reset Error Occurrence Counts
258 //[0]: Reset CPU Error Counts
259 // 0b: Keep CPU Error Counts
260 // 1b: Reset all CPU Error Counts to zero
261 //[7:1]: Reserved
262};
263
264struct GetProcessorErrConfigRes
265{
266 uint8_t resetCfg; // Reset Configuration
267 // [0]: CATERR Reset Enabled
268 // 0b: Disabled
269 // 1b: Enabled
270 // [1]: ERR2 Reset Enabled
271 // 0b: Disabled
272 // 1b: Enabled
273 // [7:2]: Reserved
274 uint8_t reserved; // Reserved
275 char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy
276 // socket CPU CPU CATERR (Core Error)
277 // occurrence
278 // [5:0]: Error Occurrence Count
279 // [7:6]: CPU Status
280 // 00b: Disabled
281 // 01b: Enabled
282 // 11b: Not Present
283};
Yong Li703922d2018-11-06 13:25:31 +0800284
285struct GetOEMShutdownPolicyRes
286{
287 uint8_t policy;
288 uint8_t policySupport;
289};
Kuiying Wang45f04982018-12-26 09:23:08 +0800290
James Feist91244a62019-02-19 15:04:54 -0800291struct SetFanConfigReq
292{
293 uint8_t selectedProfile;
294 uint8_t flags;
295 // other parameters from previous generation are not supported
296};
297
298struct GetFanConfigResp
299{
300 uint8_t supportMask;
301 uint8_t profileSupport;
302 uint8_t fanControlProfileEnable;
303 uint8_t flags;
304 uint8_t dimmPresenceMap[4];
305};
306
Yong Li23737fe2019-02-19 08:49:55 +0800307struct CfgHostSerialReq
308{
309 uint8_t command;
310 uint8_t parameter;
311};
Kuiying Wang45f04982018-12-26 09:23:08 +0800312#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800313
314enum class setFanProfileFlags : uint8_t
315{
316 setFanProfile = 7,
317 setPerfAcousMode = 6,
318 // reserved [5:3]
319 performAcousSelect = 2
320 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700321};
322
323enum class setFscParamFlags : uint8_t
324{
325 tcontrol = 0x1,
326 pwmOffset = 0x2,
327 maxPwm = 0x3,
328 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800329};