blob: a348db2ad1a66d6f21bb771e05ccfff31c7fee08 [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,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080029 cmdGetChassisIdentifier = 0x92,
Jason M. Bills64796042018-10-03 16:51:55 -070030 cmdGetProcessorErrConfig = 0x9A,
31 cmdSetProcessorErrConfig = 0x9B,
Kuiying Wang45f04982018-12-26 09:23:08 +080032 cmdGetLEDStatus = 0xB0,
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080033};
34
Yong Li23737fe2019-02-19 08:49:55 +080035enum class IPMINetfnIntelOEMPlatformCmd
36{
37 cmdCfgHostSerialPortSpeed = 0x90,
38};
39
Jason M. Bills64796042018-10-03 16:51:55 -070040enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080041{
42 ipmiCCPayloadActive = 0x80,
43 ipmiCCInvalidPCIESlotID = 0x80,
44 ipmiCCParameterNotSupported = 0x80,
45 ipmiCCPayloadAlreadyDeactivated = 0x80,
46 ipmiCCSetInProcess = 0x81,
47 ipmiCCPayloadDisable = 0x81,
48 ipmiCCLostArbitration = 0x81,
49 ipmiCCInvalidCablePortIndex = 0x81,
50 ipmiCCHealthStatusNotAvailable = 0x81,
51 ipmiCCBusError = 0x82,
52 ipmiCCReadOnly = 0x82,
53 ipmiCCWriteOnly = 0x82,
54 ipmiCCNoCablePresent = 0x82,
55 ipmiCCDataCollectionInProgress = 0x82,
56 ipmiCCPayloadActivationLimitReached = 0x82,
57 ipmiCCNACKOnWrite = 0x83,
58 ipmiCCDataCollectionFailed = 0x83,
59 ipmiCCCanNotActivateWithEncrption = 0x83,
60 ipmiCCCanNotActivateWithoutEncryption = 0x84,
61 ipmiCCInvalidChecksum = 0x85,
62 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
63
64};
65
Jason M. Bills64796042018-10-03 16:51:55 -070066enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080067{
68 ipmiCCInvalidLUN = 0xC2,
69 ipmiCCTimeout = 0xC3,
70 ipmiCCStorageLeak = 0xC4,
71 ipmiCCRequestDataTruncated = 0xC6,
72 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
73 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
74 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
75 ipmiCCDestinationUnavailable = 0xD3,
76 ipmiCCParamterNotSupportInPresentState = 0xD5,
77};
78
Jason M. Bills64796042018-10-03 16:51:55 -070079constexpr const uint8_t netfunIntelAppOEM = 0x3E;
80static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080081 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
82 // general". The code is 0x30
Yong Li23737fe2019-02-19 08:49:55 +080083
84// Intel OEM Platform code is 0x32
85static constexpr ipmi_netfn_t netfnIntcOEMPlatform = NETFUN_OEM;
Jason M. Bills64796042018-10-03 16:51:55 -070086static constexpr const uint8_t maxBIOSIDLength = 0xFF;
87static constexpr const uint8_t maxCPUNum = 4;
88static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
89static constexpr const char* biosIntf =
90 "xyz.openbmc_project.Inventory.Item.Bios";
91static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080092
Jason M. Bills64796042018-10-03 16:51:55 -070093static constexpr const char* powerRestoreDelayObjPath =
94 "/xyz/openbmc_project/control/power_restore_delay";
95static constexpr const char* powerRestoreDelayIntf =
96 "xyz.openbmc_project.Control.Power.RestoreDelay";
97static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
98static constexpr const char* processorErrConfigObjPath =
99 "/xyz/openbmc_project/control/processor_error_config";
100static constexpr const char* processorErrConfigIntf =
101 "xyz.openbmc_project.Control.Processor.ErrConfig";
102
Yong Li703922d2018-11-06 13:25:31 +0800103static constexpr const char* postCodesObjPath =
104 "/xyz/openbmc_project/State/Boot/PostCode";
105static constexpr const char* postCodesIntf =
106 "xyz.openbmc_project.State.Boot.PostCode";
107
Kuiying Wang45f04982018-12-26 09:23:08 +0800108static constexpr const char* identifyLEDObjPath =
109 "/xyz/openbmc_project/led/physical/identify";
110static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
111static constexpr const char* statusAmberObjPath =
112 "/xyz/openbmc_project/led/physical/status_amber";
113static constexpr const char* statusGreenObjPath =
114 "/xyz/openbmc_project/led/physical/status_green";
115
Yong Li703922d2018-11-06 13:25:31 +0800116static constexpr const uint8_t noShutdownOnOCOT = 0;
117static constexpr const uint8_t shutdownOnOCOT = 1;
118static constexpr const uint8_t noShutdownPolicySupported = 0;
119static constexpr const uint8_t shutdownPolicySupported = 1;
120static constexpr const char* oemShutdownPolicyIntf =
121 "xyz.openbmc_project.Control.ShutdownPolicy";
122static constexpr const char* oemShutdownPolicyObjPath =
123 "/xyz/openbmc_project/control/shutdown_policy_config";
124static constexpr const char* oemShutdownPolicyObjPathProp = "Policy";
125
Yong Li23737fe2019-02-19 08:49:55 +0800126static constexpr const char* fwGetEnvCmd = "/sbin/fw_printenv";
127static constexpr const char* fwSetEnvCmd = "/sbin/fw_setenv";
128static constexpr const char* fwHostSerailCfgEnvName = "hostserialcfg";
129
130static constexpr const uint8_t getHostSerialCfgCmd = 0;
131static constexpr const uint8_t setHostSerialCfgCmd = 1;
132
133// parameters:
134// 0: host serial port 1 and 2 normal speed
135// 1: host serial port 1 high spend, port 2 normal speed
136// 2: host serial port 1 normal spend, port 2 high speed
137// 3: host serial port 1 and 2 high speed
138static constexpr const uint8_t HostSerialCfgParamMax = 3;
139
Jason M. Bills64796042018-10-03 16:51:55 -0700140enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800141{
142 mdrStatus = 0x20,
143 mdrComplete = 0x21,
144 mdrEvent = 0x22,
145 mdrRead = 0x23,
146 mdrWrite = 0x24,
147 mdrLock = 0x25,
148 mdr2AgentStatus = 0x30,
149 mdr2GetDir = 0x31,
150 mdr2GetDataInfo = 0x32,
151 mdr2LockData = 0x33,
152 mdr2UnlockData = 0x34,
153 mdr2GetDataBlock = 0x35,
154 mdr2SendDir = 0x38,
155 mdr2SendDataInfoOffer = 0x39,
156 mdr2SendDataInfo = 0x3a,
157 mdr2DataStart = 0x3b,
158 mdr2DataDone = 0x3c,
159 mdr2SendDataBlock = 0x3d,
160};
161
Jason M. Bills64796042018-10-03 16:51:55 -0700162enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800163{
164 biosId,
165 devVer,
166 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700167};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800168
Jason M. Bills64796042018-10-03 16:51:55 -0700169#pragma pack(push, 1)
170struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800171{
172 uint8_t node1;
173 uint8_t node2;
174 uint8_t node3;
175 uint8_t node4;
176 uint8_t node5;
177 uint8_t node6;
178 uint8_t clock1;
179 uint8_t clock2;
180 uint8_t timeHigh1;
181 uint8_t timeHigh2;
182 uint8_t timeMid1;
183 uint8_t timeMid2;
184 uint8_t timeLow1;
185 uint8_t timeLow2;
186 uint8_t timeLow3;
187 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700188};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800189
Jason M. Bills64796042018-10-03 16:51:55 -0700190struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800191{
Jason M. Bills64796042018-10-03 16:51:55 -0700192 uint8_t biosIDLength;
193 uint8_t biosId[maxBIOSIDLength];
194};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800195
Jason M. Bills64796042018-10-03 16:51:55 -0700196struct SetPowerRestoreDelayReq
197{
198 uint8_t byteMSB;
199 uint8_t byteLSB;
200};
201
202struct GetPowerRestoreDelayRes
203{
204 uint8_t byteMSB;
205 uint8_t byteLSB;
206};
207
208struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800209{
210 uint8_t entityType;
211 uint8_t countToRead;
212 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700213};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800214
Jason M. Bills64796042018-10-03 16:51:55 -0700215struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800216{
217 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700218 uint8_t data[maxBIOSIDLength];
219};
220
221struct SetProcessorErrConfigReq
222{
223 uint8_t resetCfg; // Reset Configuration
224 // [0]: CATERR Reset Enabled
225 // 0b: Disabled
226 // 1b: Enabled
227 // [1]: ERR2 Reset Enabled
228 // 0b: Disabled
229 // 1b: Enabled
230 // [7:2]: Reserved
231 uint8_t reserved; // Reserved
232 uint8_t
233 resetErrorOccurrenceCounts; // Reset Error Occurrence Counts
234 //[0]: Reset CPU Error Counts
235 // 0b: Keep CPU Error Counts
236 // 1b: Reset all CPU Error Counts to zero
237 //[7:1]: Reserved
238};
239
240struct GetProcessorErrConfigRes
241{
242 uint8_t resetCfg; // Reset Configuration
243 // [0]: CATERR Reset Enabled
244 // 0b: Disabled
245 // 1b: Enabled
246 // [1]: ERR2 Reset Enabled
247 // 0b: Disabled
248 // 1b: Enabled
249 // [7:2]: Reserved
250 uint8_t reserved; // Reserved
251 char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy
252 // socket CPU CPU CATERR (Core Error)
253 // occurrence
254 // [5:0]: Error Occurrence Count
255 // [7:6]: CPU Status
256 // 00b: Disabled
257 // 01b: Enabled
258 // 11b: Not Present
259};
Yong Li703922d2018-11-06 13:25:31 +0800260
261struct GetOEMShutdownPolicyRes
262{
263 uint8_t policy;
264 uint8_t policySupport;
265};
Kuiying Wang45f04982018-12-26 09:23:08 +0800266
Yong Li23737fe2019-02-19 08:49:55 +0800267struct CfgHostSerialReq
268{
269 uint8_t command;
270 uint8_t parameter;
271};
Kuiying Wang45f04982018-12-26 09:23:08 +0800272#pragma pack(pop)