blob: 3255da1ce8d6d2eaf651fc089a77b0a1ad8f1e58 [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
Jason M. Bills64796042018-10-03 16:51:55 -070019enum class IPMINetfnIntelOEMGeneralCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080020{
21 cmdSetBIOSID = 0x26,
22 cmdGetOEMDeviceInfo = 0x27,
Jason M. Bills64796042018-10-03 16:51:55 -070023 cmdGetAICSlotFRUIDSlotPosRecords = 0x31,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080024 cmdSetSystemGUID = 0x41,
Jia, Chunhuicc49b542019-03-20 15:41:07 +080025 cmdSendEmbeddedFWUpdStatus = 0x44,
Jason M. Bills64796042018-10-03 16:51:55 -070026 cmdSetPowerRestoreDelay = 0x54,
27 cmdGetPowerRestoreDelay = 0x55,
Yong Li703922d2018-11-06 13:25:31 +080028 cmdSetShutdownPolicy = 0x60,
29 cmdGetShutdownPolicy = 0x62,
James Feist91244a62019-02-19 15:04:54 -080030 cmdSetFanConfig = 0x89,
31 cmdGetFanConfig = 0x8a,
James Feist5f957ca2019-03-14 15:33:55 -070032 cmdSetFscParameter = 0x90,
33 cmdGetFscParameter = 0x91,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080034 cmdGetChassisIdentifier = 0x92,
Jason M. Bills64796042018-10-03 16:51:55 -070035 cmdGetProcessorErrConfig = 0x9A,
36 cmdSetProcessorErrConfig = 0x9B,
Kuiying Wang45f04982018-12-26 09:23:08 +080037 cmdGetLEDStatus = 0xB0,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080038};
39
Yong Li23737fe2019-02-19 08:49:55 +080040enum class IPMINetfnIntelOEMPlatformCmd
41{
42 cmdCfgHostSerialPortSpeed = 0x90,
43};
44
Jason M. Bills64796042018-10-03 16:51:55 -070045enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080046{
47 ipmiCCPayloadActive = 0x80,
48 ipmiCCInvalidPCIESlotID = 0x80,
49 ipmiCCParameterNotSupported = 0x80,
50 ipmiCCPayloadAlreadyDeactivated = 0x80,
51 ipmiCCSetInProcess = 0x81,
52 ipmiCCPayloadDisable = 0x81,
53 ipmiCCLostArbitration = 0x81,
54 ipmiCCInvalidCablePortIndex = 0x81,
55 ipmiCCHealthStatusNotAvailable = 0x81,
56 ipmiCCBusError = 0x82,
57 ipmiCCReadOnly = 0x82,
58 ipmiCCWriteOnly = 0x82,
59 ipmiCCNoCablePresent = 0x82,
60 ipmiCCDataCollectionInProgress = 0x82,
61 ipmiCCPayloadActivationLimitReached = 0x82,
62 ipmiCCNACKOnWrite = 0x83,
63 ipmiCCDataCollectionFailed = 0x83,
64 ipmiCCCanNotActivateWithEncrption = 0x83,
65 ipmiCCCanNotActivateWithoutEncryption = 0x84,
66 ipmiCCInvalidChecksum = 0x85,
67 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
68
69};
70
Jason M. Bills64796042018-10-03 16:51:55 -070071enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080072{
73 ipmiCCInvalidLUN = 0xC2,
74 ipmiCCTimeout = 0xC3,
75 ipmiCCStorageLeak = 0xC4,
76 ipmiCCRequestDataTruncated = 0xC6,
77 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
78 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
79 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
80 ipmiCCDestinationUnavailable = 0xD3,
81 ipmiCCParamterNotSupportInPresentState = 0xD5,
82};
83
Jason M. Bills64796042018-10-03 16:51:55 -070084constexpr const uint8_t netfunIntelAppOEM = 0x3E;
85static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080086 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
87 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +080088
89// Intel OEM Platform code is 0x32
90static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -070091static constexpr const uint8_t maxBIOSIDLength = 0xFF;
92static constexpr const uint8_t maxCPUNum = 4;
93static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
94static constexpr const char* biosIntf =
95 "xyz.openbmc_project.Inventory.Item.Bios";
96static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080097
Jason M. Bills64796042018-10-03 16:51:55 -070098static constexpr const char* powerRestoreDelayObjPath =
99 "/xyz/openbmc_project/control/power_restore_delay";
100static constexpr const char* powerRestoreDelayIntf =
101 "xyz.openbmc_project.Control.Power.RestoreDelay";
102static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
103static constexpr const char* processorErrConfigObjPath =
104 "/xyz/openbmc_project/control/processor_error_config";
105static constexpr const char* processorErrConfigIntf =
106 "xyz.openbmc_project.Control.Processor.ErrConfig";
107
Yong Li703922d2018-11-06 13:25:31 +0800108static constexpr const char* postCodesObjPath =
109 "/xyz/openbmc_project/State/Boot/PostCode";
110static constexpr const char* postCodesIntf =
111 "xyz.openbmc_project.State.Boot.PostCode";
112
Kuiying Wang45f04982018-12-26 09:23:08 +0800113static constexpr const char* identifyLEDObjPath =
114 "/xyz/openbmc_project/led/physical/identify";
115static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
116static constexpr const char* statusAmberObjPath =
117 "/xyz/openbmc_project/led/physical/status_amber";
118static constexpr const char* statusGreenObjPath =
119 "/xyz/openbmc_project/led/physical/status_green";
120
Yong Li703922d2018-11-06 13:25:31 +0800121static constexpr const uint8_t noShutdownOnOCOT = 0;
122static constexpr const uint8_t shutdownOnOCOT = 1;
123static constexpr const uint8_t noShutdownPolicySupported = 0;
124static constexpr const uint8_t shutdownPolicySupported = 1;
125static constexpr const char* oemShutdownPolicyIntf =
126 "xyz.openbmc_project.Control.ShutdownPolicy";
127static constexpr const char* oemShutdownPolicyObjPath =
128 "/xyz/openbmc_project/control/shutdown_policy_config";
129static constexpr const char* oemShutdownPolicyObjPathProp = "Policy";
130
Yong Li23737fe2019-02-19 08:49:55 +0800131static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
132static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
133static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
134
James Feist91244a62019-02-19 15:04:54 -0800135constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
136
Yong Li23737fe2019-02-19 08:49:55 +0800137static constexpr const uint8_t getHostSerialCfgCmd = 0;
138static constexpr const uint8_t setHostSerialCfgCmd = 1;
139
140// parameters:
141// 0: host serial port 1 and 2 normal speed
142// 1: host serial port 1 high spend, port 2 normal speed
143// 2: host serial port 1 normal spend, port 2 high speed
144// 3: host serial port 1 and 2 high speed
145static constexpr const uint8_t HostSerialCfgParamMax = 3;
146
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800147static constexpr const uint8_t selEvtTargetMask = 0xF0;
148static constexpr const uint8_t selEvtTargetShift = 4;
149
150static constexpr const uint8_t targetInstanceMask = 0x0E;
151static constexpr const uint8_t targetInstanceShift = 1;
152
Jason M. Bills64796042018-10-03 16:51:55 -0700153enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800154{
155 mdrStatus = 0x20,
156 mdrComplete = 0x21,
157 mdrEvent = 0x22,
158 mdrRead = 0x23,
159 mdrWrite = 0x24,
160 mdrLock = 0x25,
161 mdr2AgentStatus = 0x30,
162 mdr2GetDir = 0x31,
163 mdr2GetDataInfo = 0x32,
164 mdr2LockData = 0x33,
165 mdr2UnlockData = 0x34,
166 mdr2GetDataBlock = 0x35,
167 mdr2SendDir = 0x38,
168 mdr2SendDataInfoOffer = 0x39,
169 mdr2SendDataInfo = 0x3a,
170 mdr2DataStart = 0x3b,
171 mdr2DataDone = 0x3c,
172 mdr2SendDataBlock = 0x3d,
173};
174
Jason M. Bills64796042018-10-03 16:51:55 -0700175enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800176{
177 biosId,
178 devVer,
179 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700180};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800181
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800182enum class FWUpdateTarget : uint8_t
183{
184 targetBMC = 0x0,
185 targetBIOS = 0x1,
186 targetME = 0x2,
187 targetOEMEWS = 0x4,
188};
189
Jason M. Bills64796042018-10-03 16:51:55 -0700190#pragma pack(push, 1)
191struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800192{
193 uint8_t node1;
194 uint8_t node2;
195 uint8_t node3;
196 uint8_t node4;
197 uint8_t node5;
198 uint8_t node6;
199 uint8_t clock1;
200 uint8_t clock2;
201 uint8_t timeHigh1;
202 uint8_t timeHigh2;
203 uint8_t timeMid1;
204 uint8_t timeMid2;
205 uint8_t timeLow1;
206 uint8_t timeLow2;
207 uint8_t timeLow3;
208 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700209};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800210
Jason M. Bills64796042018-10-03 16:51:55 -0700211struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800212{
Jason M. Bills64796042018-10-03 16:51:55 -0700213 uint8_t biosIDLength;
214 uint8_t biosId[maxBIOSIDLength];
215};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800216
Jason M. Bills64796042018-10-03 16:51:55 -0700217struct SetPowerRestoreDelayReq
218{
219 uint8_t byteMSB;
220 uint8_t byteLSB;
221};
222
223struct GetPowerRestoreDelayRes
224{
225 uint8_t byteMSB;
226 uint8_t byteLSB;
227};
228
229struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800230{
231 uint8_t entityType;
232 uint8_t countToRead;
233 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700234};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800235
Jason M. Bills64796042018-10-03 16:51:55 -0700236struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800237{
238 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700239 uint8_t data[maxBIOSIDLength];
240};
241
242struct SetProcessorErrConfigReq
243{
244 uint8_t resetCfg; // Reset Configuration
245 // [0]: CATERR Reset Enabled
246 // 0b: Disabled
247 // 1b: Enabled
248 // [1]: ERR2 Reset Enabled
249 // 0b: Disabled
250 // 1b: Enabled
251 // [7:2]: Reserved
252 uint8_t reserved; // Reserved
253 uint8_t
254 resetErrorOccurrenceCounts; // Reset Error Occurrence Counts
255 //[0]: Reset CPU Error Counts
256 // 0b: Keep CPU Error Counts
257 // 1b: Reset all CPU Error Counts to zero
258 //[7:1]: Reserved
259};
260
261struct GetProcessorErrConfigRes
262{
263 uint8_t resetCfg; // Reset Configuration
264 // [0]: CATERR Reset Enabled
265 // 0b: Disabled
266 // 1b: Enabled
267 // [1]: ERR2 Reset Enabled
268 // 0b: Disabled
269 // 1b: Enabled
270 // [7:2]: Reserved
271 uint8_t reserved; // Reserved
272 char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy
273 // socket CPU CPU CATERR (Core Error)
274 // occurrence
275 // [5:0]: Error Occurrence Count
276 // [7:6]: CPU Status
277 // 00b: Disabled
278 // 01b: Enabled
279 // 11b: Not Present
280};
Yong Li703922d2018-11-06 13:25:31 +0800281
282struct GetOEMShutdownPolicyRes
283{
284 uint8_t policy;
285 uint8_t policySupport;
286};
Kuiying Wang45f04982018-12-26 09:23:08 +0800287
James Feist91244a62019-02-19 15:04:54 -0800288struct SetFanConfigReq
289{
290 uint8_t selectedProfile;
291 uint8_t flags;
292 // other parameters from previous generation are not supported
293};
294
295struct GetFanConfigResp
296{
297 uint8_t supportMask;
298 uint8_t profileSupport;
299 uint8_t fanControlProfileEnable;
300 uint8_t flags;
301 uint8_t dimmPresenceMap[4];
302};
303
Yong Li23737fe2019-02-19 08:49:55 +0800304struct CfgHostSerialReq
305{
306 uint8_t command;
307 uint8_t parameter;
308};
Kuiying Wang45f04982018-12-26 09:23:08 +0800309#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800310
311enum class setFanProfileFlags : uint8_t
312{
313 setFanProfile = 7,
314 setPerfAcousMode = 6,
315 // reserved [5:3]
316 performAcousSelect = 2
317 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700318};
319
320enum class setFscParamFlags : uint8_t
321{
322 tcontrol = 0x1,
323 pwmOffset = 0x2,
324 maxPwm = 0x3,
325 cfm = 0x4
Jia, Chunhuicc49b542019-03-20 15:41:07 +0800326};