blob: cd51038d9e36d8cdfd53228d1fabca594841bcd2 [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,
James Feist5f957ca2019-03-14 15:33:55 -070031 cmdSetFscParameter = 0x90,
32 cmdGetFscParameter = 0x91,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080033 cmdGetChassisIdentifier = 0x92,
Jason M. Bills64796042018-10-03 16:51:55 -070034 cmdGetProcessorErrConfig = 0x9A,
35 cmdSetProcessorErrConfig = 0x9B,
Kuiying Wang45f04982018-12-26 09:23:08 +080036 cmdGetLEDStatus = 0xB0,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080037};
38
Yong Li23737fe2019-02-19 08:49:55 +080039enum class IPMINetfnIntelOEMPlatformCmd
40{
41 cmdCfgHostSerialPortSpeed = 0x90,
42};
43
Jason M. Bills64796042018-10-03 16:51:55 -070044enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080045{
46 ipmiCCPayloadActive = 0x80,
47 ipmiCCInvalidPCIESlotID = 0x80,
48 ipmiCCParameterNotSupported = 0x80,
49 ipmiCCPayloadAlreadyDeactivated = 0x80,
50 ipmiCCSetInProcess = 0x81,
51 ipmiCCPayloadDisable = 0x81,
52 ipmiCCLostArbitration = 0x81,
53 ipmiCCInvalidCablePortIndex = 0x81,
54 ipmiCCHealthStatusNotAvailable = 0x81,
55 ipmiCCBusError = 0x82,
56 ipmiCCReadOnly = 0x82,
57 ipmiCCWriteOnly = 0x82,
58 ipmiCCNoCablePresent = 0x82,
59 ipmiCCDataCollectionInProgress = 0x82,
60 ipmiCCPayloadActivationLimitReached = 0x82,
61 ipmiCCNACKOnWrite = 0x83,
62 ipmiCCDataCollectionFailed = 0x83,
63 ipmiCCCanNotActivateWithEncrption = 0x83,
64 ipmiCCCanNotActivateWithoutEncryption = 0x84,
65 ipmiCCInvalidChecksum = 0x85,
66 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
67
68};
69
Jason M. Bills64796042018-10-03 16:51:55 -070070enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080071{
72 ipmiCCInvalidLUN = 0xC2,
73 ipmiCCTimeout = 0xC3,
74 ipmiCCStorageLeak = 0xC4,
75 ipmiCCRequestDataTruncated = 0xC6,
76 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
77 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
78 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
79 ipmiCCDestinationUnavailable = 0xD3,
80 ipmiCCParamterNotSupportInPresentState = 0xD5,
81};
82
Jason M. Bills64796042018-10-03 16:51:55 -070083constexpr const uint8_t netfunIntelAppOEM = 0x3E;
84static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080085 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
86 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +080087
88// Intel OEM Platform code is 0x32
89static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -070090static constexpr const uint8_t maxBIOSIDLength = 0xFF;
91static constexpr const uint8_t maxCPUNum = 4;
92static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
93static constexpr const char* biosIntf =
94 "xyz.openbmc_project.Inventory.Item.Bios";
95static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080096
Jason M. Bills64796042018-10-03 16:51:55 -070097static constexpr const char* powerRestoreDelayObjPath =
98 "/xyz/openbmc_project/control/power_restore_delay";
99static constexpr const char* powerRestoreDelayIntf =
100 "xyz.openbmc_project.Control.Power.RestoreDelay";
101static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
102static constexpr const char* processorErrConfigObjPath =
103 "/xyz/openbmc_project/control/processor_error_config";
104static constexpr const char* processorErrConfigIntf =
105 "xyz.openbmc_project.Control.Processor.ErrConfig";
106
Yong Li703922d2018-11-06 13:25:31 +0800107static constexpr const char* postCodesObjPath =
108 "/xyz/openbmc_project/State/Boot/PostCode";
109static constexpr const char* postCodesIntf =
110 "xyz.openbmc_project.State.Boot.PostCode";
111
Kuiying Wang45f04982018-12-26 09:23:08 +0800112static constexpr const char* identifyLEDObjPath =
113 "/xyz/openbmc_project/led/physical/identify";
114static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
115static constexpr const char* statusAmberObjPath =
116 "/xyz/openbmc_project/led/physical/status_amber";
117static constexpr const char* statusGreenObjPath =
118 "/xyz/openbmc_project/led/physical/status_green";
119
Yong Li703922d2018-11-06 13:25:31 +0800120static constexpr const uint8_t noShutdownOnOCOT = 0;
121static constexpr const uint8_t shutdownOnOCOT = 1;
122static constexpr const uint8_t noShutdownPolicySupported = 0;
123static constexpr const uint8_t shutdownPolicySupported = 1;
124static constexpr const char* oemShutdownPolicyIntf =
125 "xyz.openbmc_project.Control.ShutdownPolicy";
126static constexpr const char* oemShutdownPolicyObjPath =
127 "/xyz/openbmc_project/control/shutdown_policy_config";
128static constexpr const char* oemShutdownPolicyObjPathProp = "Policy";
129
Yong Li23737fe2019-02-19 08:49:55 +0800130static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
131static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
132static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
133
James Feist91244a62019-02-19 15:04:54 -0800134constexpr const char* settingsBusName = "xyz.openbmc_project.Settings";
135
Yong Li23737fe2019-02-19 08:49:55 +0800136static constexpr const uint8_t getHostSerialCfgCmd = 0;
137static constexpr const uint8_t setHostSerialCfgCmd = 1;
138
139// parameters:
140// 0: host serial port 1 and 2 normal speed
141// 1: host serial port 1 high spend, port 2 normal speed
142// 2: host serial port 1 normal spend, port 2 high speed
143// 3: host serial port 1 and 2 high speed
144static constexpr const uint8_t HostSerialCfgParamMax = 3;
145
Jason M. Bills64796042018-10-03 16:51:55 -0700146enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800147{
148 mdrStatus = 0x20,
149 mdrComplete = 0x21,
150 mdrEvent = 0x22,
151 mdrRead = 0x23,
152 mdrWrite = 0x24,
153 mdrLock = 0x25,
154 mdr2AgentStatus = 0x30,
155 mdr2GetDir = 0x31,
156 mdr2GetDataInfo = 0x32,
157 mdr2LockData = 0x33,
158 mdr2UnlockData = 0x34,
159 mdr2GetDataBlock = 0x35,
160 mdr2SendDir = 0x38,
161 mdr2SendDataInfoOffer = 0x39,
162 mdr2SendDataInfo = 0x3a,
163 mdr2DataStart = 0x3b,
164 mdr2DataDone = 0x3c,
165 mdr2SendDataBlock = 0x3d,
166};
167
Jason M. Bills64796042018-10-03 16:51:55 -0700168enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800169{
170 biosId,
171 devVer,
172 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700173};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800174
Jason M. Bills64796042018-10-03 16:51:55 -0700175#pragma pack(push, 1)
176struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800177{
178 uint8_t node1;
179 uint8_t node2;
180 uint8_t node3;
181 uint8_t node4;
182 uint8_t node5;
183 uint8_t node6;
184 uint8_t clock1;
185 uint8_t clock2;
186 uint8_t timeHigh1;
187 uint8_t timeHigh2;
188 uint8_t timeMid1;
189 uint8_t timeMid2;
190 uint8_t timeLow1;
191 uint8_t timeLow2;
192 uint8_t timeLow3;
193 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700194};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800195
Jason M. Bills64796042018-10-03 16:51:55 -0700196struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800197{
Jason M. Bills64796042018-10-03 16:51:55 -0700198 uint8_t biosIDLength;
199 uint8_t biosId[maxBIOSIDLength];
200};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800201
Jason M. Bills64796042018-10-03 16:51:55 -0700202struct SetPowerRestoreDelayReq
203{
204 uint8_t byteMSB;
205 uint8_t byteLSB;
206};
207
208struct GetPowerRestoreDelayRes
209{
210 uint8_t byteMSB;
211 uint8_t byteLSB;
212};
213
214struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800215{
216 uint8_t entityType;
217 uint8_t countToRead;
218 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700219};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800220
Jason M. Bills64796042018-10-03 16:51:55 -0700221struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800222{
223 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700224 uint8_t data[maxBIOSIDLength];
225};
226
227struct SetProcessorErrConfigReq
228{
229 uint8_t resetCfg; // Reset Configuration
230 // [0]: CATERR Reset Enabled
231 // 0b: Disabled
232 // 1b: Enabled
233 // [1]: ERR2 Reset Enabled
234 // 0b: Disabled
235 // 1b: Enabled
236 // [7:2]: Reserved
237 uint8_t reserved; // Reserved
238 uint8_t
239 resetErrorOccurrenceCounts; // Reset Error Occurrence Counts
240 //[0]: Reset CPU Error Counts
241 // 0b: Keep CPU Error Counts
242 // 1b: Reset all CPU Error Counts to zero
243 //[7:1]: Reserved
244};
245
246struct GetProcessorErrConfigRes
247{
248 uint8_t resetCfg; // Reset Configuration
249 // [0]: CATERR Reset Enabled
250 // 0b: Disabled
251 // 1b: Enabled
252 // [1]: ERR2 Reset Enabled
253 // 0b: Disabled
254 // 1b: Enabled
255 // [7:2]: Reserved
256 uint8_t reserved; // Reserved
257 char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy
258 // socket CPU CPU CATERR (Core Error)
259 // occurrence
260 // [5:0]: Error Occurrence Count
261 // [7:6]: CPU Status
262 // 00b: Disabled
263 // 01b: Enabled
264 // 11b: Not Present
265};
Yong Li703922d2018-11-06 13:25:31 +0800266
267struct GetOEMShutdownPolicyRes
268{
269 uint8_t policy;
270 uint8_t policySupport;
271};
Kuiying Wang45f04982018-12-26 09:23:08 +0800272
James Feist91244a62019-02-19 15:04:54 -0800273struct SetFanConfigReq
274{
275 uint8_t selectedProfile;
276 uint8_t flags;
277 // other parameters from previous generation are not supported
278};
279
280struct GetFanConfigResp
281{
282 uint8_t supportMask;
283 uint8_t profileSupport;
284 uint8_t fanControlProfileEnable;
285 uint8_t flags;
286 uint8_t dimmPresenceMap[4];
287};
288
Yong Li23737fe2019-02-19 08:49:55 +0800289struct CfgHostSerialReq
290{
291 uint8_t command;
292 uint8_t parameter;
293};
Kuiying Wang45f04982018-12-26 09:23:08 +0800294#pragma pack(pop)
James Feist91244a62019-02-19 15:04:54 -0800295
296enum class setFanProfileFlags : uint8_t
297{
298 setFanProfile = 7,
299 setPerfAcousMode = 6,
300 // reserved [5:3]
301 performAcousSelect = 2
302 // reserved [1:0]
James Feist5f957ca2019-03-14 15:33:55 -0700303};
304
305enum class setFscParamFlags : uint8_t
306{
307 tcontrol = 0x1,
308 pwmOffset = 0x2,
309 maxPwm = 0x3,
310 cfm = 0x4
James Feist91244a62019-02-19 15:04:54 -0800311};