remove IPMI_CC
Since IPMI_CC declared in api.h has been gradually deprecated,
this submission will use ipmi::cc in api.hpp instead.
Change-Id: Iaaf74396f59ba924753398c136e232c5b8fcd796
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 9bb1e77..a356ecb 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -434,7 +434,7 @@
ipmi_ret_t getNetworkData(uint8_t lan_param, char* data)
{
- ipmi_ret_t rc = IPMI_CC_OK;
+ ipmi_ret_t rc = ipmi::ccSuccess;
sdbusplus::bus_t bus(ipmid_get_sd_bus_connection());
const std::string ethdevice = "eth0";
@@ -496,7 +496,7 @@
break;
default:
- rc = IPMI_CC_PARM_OUT_OF_RANGE;
+ rc = ipmi::ccParmOutOfRange;
}
return rc;
}
@@ -813,7 +813,7 @@
res[SIZE_IANA_ID] = num_frames;
*data_len = SIZE_IANA_ID + 1;
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -835,7 +835,7 @@
res[SIZE_IANA_ID + 2] = 2; // cri sel update
res[SIZE_IANA_ID + 3] = 3; // cri sensor update
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -862,7 +862,7 @@
{
memcpy(res, req, SIZE_IANA_ID); // IANA ID
*data_len = SIZE_IANA_ID;
- return IPMI_CC_UNSPECIFIED_ERROR;
+ return ipmi::ccUnspecifiedError;
}
memcpy(res, req, SIZE_IANA_ID); // IANA ID
@@ -873,7 +873,7 @@
res[7] = descLen;
*data_len = SIZE_IANA_ID + 5 + descLen;
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -901,7 +901,7 @@
{
memcpy(res, req, SIZE_IANA_ID); // IANA ID
*data_len = SIZE_IANA_ID;
- return IPMI_CC_UNSPECIFIED_ERROR;
+ return ipmi::ccUnspecifiedError;
}
memcpy(res, req, SIZE_IANA_ID); // IANA ID
@@ -912,7 +912,7 @@
res[7] = descLen;
*data_len = SIZE_IANA_ID + 5 + descLen;
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -938,7 +938,7 @@
{
memcpy(res, req, SIZE_IANA_ID); // IANA ID
*data_len = SIZE_IANA_ID;
- return IPMI_CC_UNSPECIFIED_ERROR;
+ return ipmi::ccUnspecifiedError;
}
memcpy(res, req, SIZE_IANA_ID); // IANA ID
@@ -948,7 +948,7 @@
res[6] = count;
*data_len = SIZE_IANA_ID + 4 + count;
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -1009,7 +1009,7 @@
*data_len = 0;
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -1022,7 +1022,7 @@
/* TODO: Needs to implement this after GPIO implementation */
*data_len = 0;
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -1154,7 +1154,7 @@
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Invalid machine configuration length received");
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
}
if (req->chassis_type >= sizeof(chassisType) / sizeof(uint8_t*))
@@ -1217,7 +1217,7 @@
flushOemData();
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -1231,7 +1231,7 @@
/* Do nothing, return success */
*data_len = 0;
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -1255,7 +1255,7 @@
// Sync time with system
// TODO: Add code for syncing time
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -1288,7 +1288,7 @@
oemData[KEY_PPIN_INFO] = ppinStr.c_str();
flushOemData();
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -1300,7 +1300,7 @@
{
/* Do nothing, return success */
*data_len = 0;
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
// Helper function to set guid at offset in EEPROM
@@ -1388,16 +1388,16 @@
if (*data_len != GUID_SIZE) // 16bytes
{
*data_len = 0;
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
}
*data_len = 0;
if (setGUID(OFFSET_SYS_GUID, req))
{
- return IPMI_CC_UNSPECIFIED_ERROR;
+ return ipmi::ccUnspecifiedError;
}
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
#endif
@@ -1410,7 +1410,7 @@
{
/* Do nothing, return success */
*data_len = 0;
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -1449,20 +1449,20 @@
break;
case PPR_ROW_COUNT:
if (req[1] > 100)
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
oemData[KEY_PPR][KEY_PPR_ROW_COUNT] = req[1];
break;
case PPR_ROW_ADDR:
pprIndex = req[1];
if (pprIndex > 100)
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
if (len < PPR_ROW_ADDR_LEN + 1)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Invalid PPR Row Address length received");
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
}
ss << std::hex;
@@ -1476,13 +1476,13 @@
case PPR_HISTORY_DATA:
pprIndex = req[1];
if (pprIndex > 100)
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
if (len < PPR_HST_DATA_LEN + 1)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Invalid PPR history data length received");
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
}
ss << std::hex;
@@ -1494,13 +1494,13 @@
oemData[KEY_PPR][ss.str()][KEY_PPR_HST_DATA] = str.c_str();
break;
default:
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
break;
}
flushOemData();
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -1550,17 +1550,17 @@
case PPR_ROW_ADDR:
pprIndex = req[1];
if (pprIndex > 100)
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
ss << std::hex;
ss << std::setw(2) << std::setfill('0') << (int)pprIndex;
if (oemData[KEY_PPR].find(ss.str()) == oemData[KEY_PPR].end())
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
if (oemData[KEY_PPR][ss.str()].find(KEY_PPR_ROW_ADDR) ==
oemData[KEY_PPR][ss.str()].end())
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
str = oemData[KEY_PPR][ss.str()][KEY_PPR_ROW_ADDR];
*data_len = strToBytes(str, res);
@@ -1568,27 +1568,27 @@
case PPR_HISTORY_DATA:
pprIndex = req[1];
if (pprIndex > 100)
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
ss << std::hex;
ss << std::setw(2) << std::setfill('0') << (int)pprIndex;
if (oemData[KEY_PPR].find(ss.str()) == oemData[KEY_PPR].end())
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
if (oemData[KEY_PPR][ss.str()].find(KEY_PPR_HST_DATA) ==
oemData[KEY_PPR][ss.str()].end())
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
str = oemData[KEY_PPR][ss.str()][KEY_PPR_HST_DATA];
*data_len = strToBytes(str, res);
break;
default:
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
break;
}
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
/* FB OEM QC Commands */
@@ -1997,7 +1997,7 @@
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Invalid parameter received");
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
}
len = len - 6; // Get Actual data length
@@ -2013,7 +2013,7 @@
[driveInfoKey[req->paramSel]] = str.c_str();
flushOemData();
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
//----------------------------------------------------------------------
@@ -2056,7 +2056,7 @@
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Invalid parameter received");
- return IPMI_CC_PARM_OUT_OF_RANGE;
+ return ipmi::ccParmOutOfRange;
}
if (oemData[KEY_Q_DRIVE_INFO].find(ctrlTypeKey[ctrlType]) ==
@@ -2079,7 +2079,7 @@
[dimmInfoKey[req->paramSel]];
*data_len = strToBytes(str, res);
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
/* Helper function for sending DCMI commands to ME/BIC and
@@ -2236,11 +2236,11 @@
case CrdState::free:
break;
default:
- return IPMI_CC_UNSPECIFIED_ERROR;
+ return ipmi::ccUnspecifiedError;
}
currState = newState;
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
static ipmi_ret_t handleMcaBank(const CrashDumpHdr& hdr,
@@ -2248,7 +2248,7 @@
CrdState& currState, std::stringstream& ss)
{
if (data.size() < sizeof(CrdMcaBank))
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
ipmi_ret_t res = setDumpState(currState, CrdState::waitData);
if (res)
@@ -2270,7 +2270,7 @@
ss << std::format(" MCA_MISC1 : 0x{:016X}\n", pBank->mcaMisc1);
ss << "\n";
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
template <typename T>
@@ -2278,12 +2278,12 @@
CrdState& currState, std::stringstream& ss)
{
if (data.size() < sizeof(T))
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
const auto* pBank = reinterpret_cast<const T*>(data.data());
if (data.size() < sizeof(T) + sizeof(BankCorePair) * pBank->mcaCount)
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
ipmi_ret_t res = setDumpState(currState, CrdState::waitData);
if (res)
@@ -2310,14 +2310,14 @@
}
ss << "\n\n";
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
static ipmi_ret_t handleCpuWdtBank(std::span<const uint8_t> data,
CrdState& currState, std::stringstream& ss)
{
if (data.size() < sizeof(CrdCpuWdtBank))
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
ipmi_ret_t res = setDumpState(currState, CrdState::waitData);
if (res)
@@ -2344,7 +2344,7 @@
}
ss << "\n";
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
template <size_t N>
@@ -2353,7 +2353,7 @@
CrdState& currState, std::stringstream& ss)
{
if (data.size() < sizeof(CrdHwAssertBank<N>))
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
ipmi_ret_t res = setDumpState(currState, CrdState::waitData);
if (res)
@@ -2376,14 +2376,14 @@
}
ss << "\n";
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
static ipmi_ret_t handlePcieAerBank(std::span<const uint8_t> data,
CrdState& currState, std::stringstream& ss)
{
if (data.size() < sizeof(CrdPcieAerBank))
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
ipmi_ret_t res = setDumpState(currState, CrdState::waitData);
if (res)
@@ -2438,18 +2438,18 @@
pBank->laneErrSts);
ss << "\n";
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
static ipmi_ret_t handleWdtRegBank(std::span<const uint8_t> data,
CrdState& currState, std::stringstream& ss)
{
if (data.size() < sizeof(CrdWdtRegBank))
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
const auto* pBank = reinterpret_cast<const CrdWdtRegBank*>(data.data());
if (data.size() < sizeof(CrdWdtRegBank) + sizeof(uint32_t) * pBank->count)
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
ipmi_ret_t res = setDumpState(currState, CrdState::waitData);
if (res)
@@ -2465,14 +2465,14 @@
}
ss << "\n";
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
static ipmi_ret_t handleCrdHdrBank(std::span<const uint8_t> data,
CrdState& currState, std::stringstream& ss)
{
if (data.size() < sizeof(CrdHdrBank))
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
ipmi_ret_t res = setDumpState(currState, CrdState::waitData);
if (res)
@@ -2494,7 +2494,7 @@
(pBank->pmio & 0x10) >> 4);
ss << "\n";
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
static std::string getFilename(const std::filesystem::path& dir,
@@ -2527,7 +2527,7 @@
CrdState& currState, std::stringstream& ss)
{
if (data.empty())
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
switch (static_cast<CrdCtrl>(data[0]))
{
@@ -2543,7 +2543,7 @@
std::string filename = getFilename(dumpDir, "crashdump_");
std::ofstream outFile(dumpDir / filename);
if (!outFile.is_open())
- return IPMI_CC_UNSPECIFIED_ERROR;
+ return ipmi::ccUnspecifiedError;
auto now = std::chrono::system_clock::to_time_t(
std::chrono::system_clock::now());
@@ -2561,7 +2561,7 @@
return ccInvalidParam;
}
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
ipmi::RspType<std::vector<uint8_t>> ipmiOemCrashdump(
@@ -2620,7 +2620,7 @@
break;
case BankType::ctrl:
res = handleCtrlBank(bData, dumpState, ss);
- if (res == IPMI_CC_OK &&
+ if (res == ipmi::ccSuccess &&
static_cast<CrdCtrl>(bData[0]) == CrdCtrl::getState)
{
return ipmi::responseSuccess(