blob: 01dca7d06593107d944febd113dbe17f7c07daf7 [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
Jason M. Bills64796042018-10-03 16:51:55 -070035enum class IPMIIntelOEMReturnCodes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080036{
37 ipmiCCPayloadActive = 0x80,
38 ipmiCCInvalidPCIESlotID = 0x80,
39 ipmiCCParameterNotSupported = 0x80,
40 ipmiCCPayloadAlreadyDeactivated = 0x80,
41 ipmiCCSetInProcess = 0x81,
42 ipmiCCPayloadDisable = 0x81,
43 ipmiCCLostArbitration = 0x81,
44 ipmiCCInvalidCablePortIndex = 0x81,
45 ipmiCCHealthStatusNotAvailable = 0x81,
46 ipmiCCBusError = 0x82,
47 ipmiCCReadOnly = 0x82,
48 ipmiCCWriteOnly = 0x82,
49 ipmiCCNoCablePresent = 0x82,
50 ipmiCCDataCollectionInProgress = 0x82,
51 ipmiCCPayloadActivationLimitReached = 0x82,
52 ipmiCCNACKOnWrite = 0x83,
53 ipmiCCDataCollectionFailed = 0x83,
54 ipmiCCCanNotActivateWithEncrption = 0x83,
55 ipmiCCCanNotActivateWithoutEncryption = 0x84,
56 ipmiCCInvalidChecksum = 0x85,
57 ipmiCCNoCabledPCIEPortsAvailable = 0xC2,
58
59};
60
Jason M. Bills64796042018-10-03 16:51:55 -070061enum class IPMIReturnCodeExt
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080062{
63 ipmiCCInvalidLUN = 0xC2,
64 ipmiCCTimeout = 0xC3,
65 ipmiCCStorageLeak = 0xC4,
66 ipmiCCRequestDataTruncated = 0xC6,
67 ipmiCCRequestDataFieldLengthLimitExceeded = 0xC8,
68 ipmiCCCanNotReturnNumberOfRequestedDataBytes = 0xCA,
69 ipmiCCRequestSensorDataRecordNotFound = 0xCB,
70 ipmiCCDestinationUnavailable = 0xD3,
71 ipmiCCParamterNotSupportInPresentState = 0xD5,
72};
73
Jason M. Bills64796042018-10-03 16:51:55 -070074constexpr const uint8_t netfunIntelAppOEM = 0x3E;
75static constexpr ipmi_netfn_t netfnIntcOEMGeneral =
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080076 NETFUN_NONE; // Netfun_none. In our platform, we use it as "intel oem
77 // general". The code is 0x30
Jason M. Bills64796042018-10-03 16:51:55 -070078static constexpr const uint8_t maxBIOSIDLength = 0xFF;
79static constexpr const uint8_t maxCPUNum = 4;
80static constexpr const char* biosObjPath = "/xyz/openbmc_project/bios";
81static constexpr const char* biosIntf =
82 "xyz.openbmc_project.Inventory.Item.Bios";
83static constexpr const char* biosProp = "BiosId";
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080084
Jason M. Bills64796042018-10-03 16:51:55 -070085static constexpr const char* powerRestoreDelayObjPath =
86 "/xyz/openbmc_project/control/power_restore_delay";
87static constexpr const char* powerRestoreDelayIntf =
88 "xyz.openbmc_project.Control.Power.RestoreDelay";
89static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
90static constexpr const char* processorErrConfigObjPath =
91 "/xyz/openbmc_project/control/processor_error_config";
92static constexpr const char* processorErrConfigIntf =
93 "xyz.openbmc_project.Control.Processor.ErrConfig";
94
Yong Li703922d2018-11-06 13:25:31 +080095static constexpr const char* postCodesObjPath =
96 "/xyz/openbmc_project/State/Boot/PostCode";
97static constexpr const char* postCodesIntf =
98 "xyz.openbmc_project.State.Boot.PostCode";
99
Kuiying Wang45f04982018-12-26 09:23:08 +0800100static constexpr const char* identifyLEDObjPath =
101 "/xyz/openbmc_project/led/physical/identify";
102static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
103static constexpr const char* statusAmberObjPath =
104 "/xyz/openbmc_project/led/physical/status_amber";
105static constexpr const char* statusGreenObjPath =
106 "/xyz/openbmc_project/led/physical/status_green";
107
Yong Li703922d2018-11-06 13:25:31 +0800108static constexpr const uint8_t noShutdownOnOCOT = 0;
109static constexpr const uint8_t shutdownOnOCOT = 1;
110static constexpr const uint8_t noShutdownPolicySupported = 0;
111static constexpr const uint8_t shutdownPolicySupported = 1;
112static constexpr const char* oemShutdownPolicyIntf =
113 "xyz.openbmc_project.Control.ShutdownPolicy";
114static constexpr const char* oemShutdownPolicyObjPath =
115 "/xyz/openbmc_project/control/shutdown_policy_config";
116static constexpr const char* oemShutdownPolicyObjPathProp = "Policy";
117
Jason M. Bills64796042018-10-03 16:51:55 -0700118enum class IPMINetfnIntelOEMAppCmd
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800119{
120 mdrStatus = 0x20,
121 mdrComplete = 0x21,
122 mdrEvent = 0x22,
123 mdrRead = 0x23,
124 mdrWrite = 0x24,
125 mdrLock = 0x25,
126 mdr2AgentStatus = 0x30,
127 mdr2GetDir = 0x31,
128 mdr2GetDataInfo = 0x32,
129 mdr2LockData = 0x33,
130 mdr2UnlockData = 0x34,
131 mdr2GetDataBlock = 0x35,
132 mdr2SendDir = 0x38,
133 mdr2SendDataInfoOffer = 0x39,
134 mdr2SendDataInfo = 0x3a,
135 mdr2DataStart = 0x3b,
136 mdr2DataDone = 0x3c,
137 mdr2SendDataBlock = 0x3d,
138};
139
Jason M. Bills64796042018-10-03 16:51:55 -0700140enum class OEMDevEntityType
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800141{
142 biosId,
143 devVer,
144 sdrVer,
Jason M. Bills64796042018-10-03 16:51:55 -0700145};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800146
Jason M. Bills64796042018-10-03 16:51:55 -0700147#pragma pack(push, 1)
148struct GUIDData
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800149{
150 uint8_t node1;
151 uint8_t node2;
152 uint8_t node3;
153 uint8_t node4;
154 uint8_t node5;
155 uint8_t node6;
156 uint8_t clock1;
157 uint8_t clock2;
158 uint8_t timeHigh1;
159 uint8_t timeHigh2;
160 uint8_t timeMid1;
161 uint8_t timeMid2;
162 uint8_t timeLow1;
163 uint8_t timeLow2;
164 uint8_t timeLow3;
165 uint8_t timeLow4;
Jason M. Bills64796042018-10-03 16:51:55 -0700166};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800167
Jason M. Bills64796042018-10-03 16:51:55 -0700168struct DeviceInfo
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800169{
Jason M. Bills64796042018-10-03 16:51:55 -0700170 uint8_t biosIDLength;
171 uint8_t biosId[maxBIOSIDLength];
172};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800173
Jason M. Bills64796042018-10-03 16:51:55 -0700174struct SetPowerRestoreDelayReq
175{
176 uint8_t byteMSB;
177 uint8_t byteLSB;
178};
179
180struct GetPowerRestoreDelayRes
181{
182 uint8_t byteMSB;
183 uint8_t byteLSB;
184};
185
186struct GetOemDeviceInfoReq
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800187{
188 uint8_t entityType;
189 uint8_t countToRead;
190 uint8_t offset;
Jason M. Bills64796042018-10-03 16:51:55 -0700191};
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800192
Jason M. Bills64796042018-10-03 16:51:55 -0700193struct GetOemDeviceInfoRes
Jia, Chunhuia835eaa2018-09-05 09:00:41 +0800194{
195 uint8_t resDatalen;
Jason M. Bills64796042018-10-03 16:51:55 -0700196 uint8_t data[maxBIOSIDLength];
197};
198
199struct SetProcessorErrConfigReq
200{
201 uint8_t resetCfg; // Reset Configuration
202 // [0]: CATERR Reset Enabled
203 // 0b: Disabled
204 // 1b: Enabled
205 // [1]: ERR2 Reset Enabled
206 // 0b: Disabled
207 // 1b: Enabled
208 // [7:2]: Reserved
209 uint8_t reserved; // Reserved
210 uint8_t
211 resetErrorOccurrenceCounts; // Reset Error Occurrence Counts
212 //[0]: Reset CPU Error Counts
213 // 0b: Keep CPU Error Counts
214 // 1b: Reset all CPU Error Counts to zero
215 //[7:1]: Reserved
216};
217
218struct GetProcessorErrConfigRes
219{
220 uint8_t resetCfg; // Reset Configuration
221 // [0]: CATERR Reset Enabled
222 // 0b: Disabled
223 // 1b: Enabled
224 // [1]: ERR2 Reset Enabled
225 // 0b: Disabled
226 // 1b: Enabled
227 // [7:2]: Reserved
228 uint8_t reserved; // Reserved
229 char caterrStatus[maxCPUNum]; // for all CPUs including the non-legacy
230 // socket CPU CPU CATERR (Core Error)
231 // occurrence
232 // [5:0]: Error Occurrence Count
233 // [7:6]: CPU Status
234 // 00b: Disabled
235 // 01b: Enabled
236 // 11b: Not Present
237};
Yong Li703922d2018-11-06 13:25:31 +0800238
239struct GetOEMShutdownPolicyRes
240{
241 uint8_t policy;
242 uint8_t policySupport;
243};
Kuiying Wang45f04982018-12-26 09:23:08 +0800244
245#pragma pack(pop)