blob: df6b0073df0267280d2fa4401e072c5557fa78a0 [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,
Jason M. Bills64796042018-10-03 16:51:55 -070025 cmdSetPowerRestoreDelay = 0x54,
26 cmdGetPowerRestoreDelay = 0x55,
Yong Li703922d2018-11-06 13:25:31 +080027 cmdSetShutdownPolicy = 0x60,
28 cmdGetShutdownPolicy = 0x62,
James Feist91244a62019-02-19 15:04:54 -080029 cmdSetFanConfig = 0x89,
30 cmdGetFanConfig = 0x8a,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080031 cmdGetChassisIdentifier = 0x92,
Jason M. Bills64796042018-10-03 16:51:55 -070032 cmdGetProcessorErrConfig = 0x9A,
33 cmdSetProcessorErrConfig = 0x9B,
Kuiying Wang45f04982018-12-26 09:23:08 +080034 cmdGetLEDStatus = 0xB0,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080035};
36
Yong Li23737fe2019-02-19 08:49:55 +080037enum class IPMINetfnIntelOEMPlatformCmd
38{
39 cmdCfgHostSerialPortSpeed = 0x90,
40};
41
Jason M. Bills64796042018-10-03 16:51:55 -070042enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080043{
44 ipmiCCPayloadActive = 0x80,
45 ipmiCCInvalidPCIESlotID = 0x80,
46 ipmiCCParameterNotSupported = 0x80,
47 ipmiCCPayloadAlreadyDeactivated = 0x80,
48 ipmiCCSetInProcess = 0x81,
49 ipmiCCPayloadDisable = 0x81,
50 ipmiCCLostArbitration = 0x81,
51 ipmiCCInvalidCablePortIndex = 0x81,
52 ipmiCCHealthStatusNotAvailable = 0x81,
53 ipmiCCBusError = 0x82,
54 ipmiCCReadOnly = 0x82,
55 ipmiCCWriteOnly = 0x82,
56 ipmiCCNoCablePresent = 0x82,
57 ipmiCCDataCollectionInProgress = 0x82,
58 ipmiCCPayloadActivationLimitReached = 0x82,
59 ipmiCCNACKOnWrite = 0x83,
60 ipmiCCDataCollectionFailed = 0x83,
61 ipmiCCCanNotActivateWithEncrption = 0x83,
62 ipmiCCCanNotActivateWithoutEncryption = 0x84,
63 ipmiCCInvalidChecksum = 0x85,
64 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
65
66};
67
Jason M. Bills64796042018-10-03 16:51:55 -070068enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080069{
70 ipmiCCInvalidLUN = 0xC2,
71 ipmiCCTimeout = 0xC3,
72 ipmiCCStorageLeak = 0xC4,
73 ipmiCCRequestDataTruncated = 0xC6,
74 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
75 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
76 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
77 ipmiCCDestinationUnavailable = 0xD3,
78 ipmiCCParamterNotSupportInPresentState = 0xD5,
79};
80
Jason M. Bills64796042018-10-03 16:51:55 -070081constexpr const uint8_t netfunIntelAppOEM = 0x3E;
82static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080083 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
84 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +080085
86// Intel OEM Platform code is 0x32
87static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -070088static constexpr const uint8_t maxBIOSIDLength = 0xFF;
89static constexpr const uint8_t maxCPUNum = 4;
90static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
91static constexpr const char* biosIntf =
92 "xyz.openbmc_project.Inventory.Item.Bios";
93static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080094
Jason M. Bills64796042018-10-03 16:51:55 -070095static constexpr const char* powerRestoreDelayObjPath =
96 "/xyz/openbmc_project/control/power_restore_delay";
97static constexpr const char* powerRestoreDelayIntf =
98 "xyz.openbmc_project.Control.Power.RestoreDelay";
99static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
100static constexpr const char* processorErrConfigObjPath =
101 "/xyz/openbmc_project/control/processor_error_config";
102static constexpr const char* processorErrConfigIntf =
103 "xyz.openbmc_project.Control.Processor.ErrConfig";
104
Yong Li703922d2018-11-06 13:25:31 +0800105static constexpr const char* postCodesObjPath =
106 "/xyz/openbmc_project/State/Boot/PostCode";
107static constexpr const char* postCodesIntf =
108 "xyz.openbmc_project.State.Boot.PostCode";
109
Kuiying Wang45f04982018-12-26 09:23:08 +0800110static constexpr const char* identifyLEDObjPath =
111 "/xyz/openbmc_project/led/physical/identify";
112static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
113static constexpr const char* statusAmberObjPath =
114 "/xyz/openbmc_project/led/physical/status_amber";
115static constexpr const char* statusGreenObjPath =
116 "/xyz/openbmc_project/led/physical/status_green";
117
Yong Li703922d2018-11-06 13:25:31 +0800118static constexpr const uint8_t noShutdownOnOCOT = 0;
119static constexpr const uint8_t shutdownOnOCOT = 1;
120static constexpr const uint8_t noShutdownPolicySupported = 0;
121static constexpr const uint8_t shutdownPolicySupported = 1;
122static constexpr const char* oemShutdownPolicyIntf =
123 "xyz.openbmc_project.Control.ShutdownPolicy";
124static constexpr const char* oemShutdownPolicyObjPath =
125 "/xyz/openbmc_project/control/shutdown_policy_config";
126static constexpr const char* oemShutdownPolicyObjPathProp = "Policy";
127
Yong Li23737fe2019-02-19 08:49:55 +0800128static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
129static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
130static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
131
James Feist91244a62019-02-19 15:04:54 -0800132constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
133
Yong Li23737fe2019-02-19 08:49:55 +0800134static constexpr const uint8_t getHostSerialCfgCmd = 0;
135static constexpr const uint8_t setHostSerialCfgCmd = 1;
136
137// parameters:
138// 0: host serial port 1 and 2 normal speed
139// 1: host serial port 1 high spend, port 2 normal speed
140// 2: host serial port 1 normal spend, port 2 high speed
141// 3: host serial port 1 and 2 high speed
142static constexpr const uint8_t HostSerialCfgParamMax = 3;
143
Jason M. Bills64796042018-10-03 16:51:55 -0700144enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800145{
146 mdrStatus = 0x20,
147 mdrComplete = 0x21,
148 mdrEvent = 0x22,
149 mdrRead = 0x23,
150 mdrWrite = 0x24,
151 mdrLock = 0x25,
152 mdr2AgentStatus = 0x30,
153 mdr2GetDir = 0x31,
154 mdr2GetDataInfo = 0x32,
155 mdr2LockData = 0x33,
156 mdr2UnlockData = 0x34,
157 mdr2GetDataBlock = 0x35,
158 mdr2SendDir = 0x38,
159 mdr2SendDataInfoOffer = 0x39,
160 mdr2SendDataInfo = 0x3a,
161 mdr2DataStart = 0x3b,
162 mdr2DataDone = 0x3c,
163 mdr2SendDataBlock = 0x3d,
164};
165
Jason M. Bills64796042018-10-03 16:51:55 -0700166enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800167{
168 biosId,
169 devVer,
170 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700171};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800172
Jason M. Bills64796042018-10-03 16:51:55 -0700173#pragma pack(push, 1)
174struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800175{
176 uint8_t node1;
177 uint8_t node2;
178 uint8_t node3;
179 uint8_t node4;
180 uint8_t node5;
181 uint8_t node6;
182 uint8_t clock1;
183 uint8_t clock2;
184 uint8_t timeHigh1;
185 uint8_t timeHigh2;
186 uint8_t timeMid1;
187 uint8_t timeMid2;
188 uint8_t timeLow1;
189 uint8_t timeLow2;
190 uint8_t timeLow3;
191 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700192};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800193
Jason M. Bills64796042018-10-03 16:51:55 -0700194struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800195{
Jason M. Bills64796042018-10-03 16:51:55 -0700196 uint8_t biosIDLength;
197 uint8_t biosId[maxBIOSIDLength];
198};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800199
Jason M. Bills64796042018-10-03 16:51:55 -0700200struct SetPowerRestoreDelayReq
201{
202 uint8_t byteMSB;
203 uint8_t byteLSB;
204};
205
206struct GetPowerRestoreDelayRes
207{
208 uint8_t byteMSB;
209 uint8_t byteLSB;
210};
211
212struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800213{
214 uint8_t entityType;
215 uint8_t countToRead;
216 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700217};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800218
Jason M. Bills64796042018-10-03 16:51:55 -0700219struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800220{
221 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700222 uint8_t data[maxBIOSIDLength];
223};
224
225struct SetProcessorErrConfigReq
226{
227 uint8_t resetCfg; // Reset Configuration
228 // [0]: CATERR Reset Enabled
229 // 0b: Disabled
230 // 1b: Enabled
231 // [1]: ERR2 Reset Enabled
232 // 0b: Disabled
233 // 1b: Enabled
234 // [7:2]: Reserved
235 uint8_t reserved; // Reserved
236 uint8_t
237 resetErrorOccurrenceCounts; // Reset Error Occurrence Counts
238 //[0]: Reset CPU Error Counts
239 // 0b: Keep CPU Error Counts
240 // 1b: Reset all CPU Error Counts to zero
241 //[7:1]: Reserved
242};
243
244struct GetProcessorErrConfigRes
245{
246 uint8_t resetCfg; // Reset Configuration
247 // [0]: CATERR Reset Enabled
248 // 0b: Disabled
249 // 1b: Enabled
250 // [1]: ERR2 Reset Enabled
251 // 0b: Disabled
252 // 1b: Enabled
253 // [7:2]: Reserved
254 uint8_t reserved; // Reserved
255 char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy
256 // socket CPU CPU CATERR (Core Error)
257 // occurrence
258 // [5:0]: Error Occurrence Count
259 // [7:6]: CPU Status
260 // 00b: Disabled
261 // 01b: Enabled
262 // 11b: Not Present
263};
Yong Li703922d2018-11-06 13:25:31 +0800264
265struct GetOEMShutdownPolicyRes
266{
267 uint8_t policy;
268 uint8_t policySupport;
269};
Kuiying Wang45f04982018-12-26 09:23:08 +0800270
James Feist91244a62019-02-19 15:04:54 -0800271struct SetFanConfigReq
272{
273 uint8_t selectedProfile;
274 uint8_t flags;
275 // other parameters from previous generation are not supported
276};
277
278struct GetFanConfigResp
279{
280 uint8_t supportMask;
281 uint8_t profileSupport;
282 uint8_t fanControlProfileEnable;
283 uint8_t flags;
284 uint8_t dimmPresenceMap[4];
285};
286
Yong Li23737fe2019-02-19 08:49:55 +0800287struct CfgHostSerialReq
288{
289 uint8_t command;
290 uint8_t parameter;
291};
Kuiying Wang45f04982018-12-26 09:23:08 +0800292#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800293
294enum class setFanProfileFlags : uint8_t
295{
296 setFanProfile = 7,
297 setPerfAcousMode = 6,
298 // reserved [5:3]
299 performAcousSelect = 2
300 // reserved [1:0]
301};