changes needed for meson build
Fix warnings that the meson build turns into errors.
Tested: builds without warnings.
Change-Id: I66b02c4c616f37d09ceba61c494903acc3d28bd5
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/src/allowlist-filter.cpp b/src/allowlist-filter.cpp
index acf423c..844bf56 100644
--- a/src/allowlist-filter.cpp
+++ b/src/allowlist-filter.cpp
@@ -1,7 +1,6 @@
#include <ipmi-allowlist.hpp>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
-#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Control/Security/RestrictionMode/server.hpp>
diff --git a/src/biosconfigcommands.cpp b/src/biosconfigcommands.cpp
index 8f3baa2..92b1f41 100644
--- a/src/biosconfigcommands.cpp
+++ b/src/biosconfigcommands.cpp
@@ -184,7 +184,7 @@
return true;
}
-bool getPendingList(ipmi::Context::ptr ctx, std::string& payloadData)
+bool getPendingList(ipmi::Context::ptr& ctx, std::string& payloadData)
{
std::variant<PendingAttributesType> pendingAttributesData;
boost::system::error_code ec;
@@ -358,7 +358,7 @@
return true;
}
-bool update(ipmi::Context::ptr ctx)
+bool update(ipmi::Context::ptr& ctx)
{
std::string payloadFilePath =
"/var/oob/Payload" +
@@ -630,9 +630,6 @@
**/
static Cc InitNVOOBdata()
{
- FILE* fptr;
- uint16_t size;
-
if (!(std::filesystem::exists(biosConfigFolder)))
{
std::filesystem::create_directory(biosConfigFolder);
@@ -651,9 +648,9 @@
return ipmi::ccResponseError;
}
-ipmi::RspType<> ipmiOEMSetBIOSCap(ipmi::Context::ptr ctx,
- uint8_t BIOSCapabilties, uint8_t reserved1,
- uint8_t reserved2, uint8_t reserved3)
+ipmi::RspType<> ipmiOEMSetBIOSCap(ipmi::Context::ptr&, uint8_t BIOSCapabilties,
+ uint8_t reserved1, uint8_t reserved2,
+ uint8_t reserved3)
{
if (getPostCompleted())
{
@@ -673,7 +670,7 @@
}
ipmi::RspType<uint8_t, uint8_t, uint8_t, uint8_t>
- ipmiOEMGetBIOSCap(ipmi::Context::ptr ctx)
+ ipmiOEMGetBIOSCap(ipmi::Context::ptr&)
{
if (gNVOOBdata.mIsBIOSCapInitDone)
{
@@ -686,8 +683,8 @@
}
}
-ipmi::RspType<uint32_t> ipmiOEMSetPayload(ipmi::Context::ptr ctx,
- uint8_t paramSel, uint8_t payloadType,
+ipmi::RspType<uint32_t> ipmiOEMSetPayload(ipmi::Context::ptr&, uint8_t paramSel,
+ uint8_t payloadType,
std::vector<uint8_t> payload)
{
uint8_t biosCapOffsetBit = 2; // BIT:1 0-OOB BIOS config not supported
@@ -917,7 +914,7 @@
}
ipmi::RspType<message::Payload>
- ipmiOEMGetPayload(ipmi::Context::ptr ctx, uint8_t paramSel,
+ ipmiOEMGetPayload(ipmi::Context::ptr& ctx, uint8_t paramSel,
uint8_t payloadType, ipmi::message::Payload& payload)
{
// 1-OOB BIOS config is supported
@@ -1021,7 +1018,7 @@
}
std::ifstream::pos_type fileSize = ifs.tellg();
// Total file data within given offset
- if (fileSize < static_cast<uint64_t>(offset))
+ if (fileSize < static_cast<int64_t>(offset))
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiOEMGetPayload: filesize < offset");
@@ -1049,7 +1046,7 @@
retValue.pack(readCount);
retValue.pack(chkSum);
- for (int i = 0; i < readCount; i++)
+ for (uint32_t i = 0; i < readCount; i++)
{
retValue.pack(Buffer.at(i));
}
@@ -1075,7 +1072,7 @@
}
ipmi::RspType<> ipmiOEMSetBIOSHashInfo(
- ipmi::Context::ptr ctx, std::array<uint8_t, maxSeedSize>& pwdSeed,
+ ipmi::Context::ptr&, std::array<uint8_t, maxSeedSize>& pwdSeed,
uint8_t algoInfo, std::array<uint8_t, maxHashSize>& adminPwdHash)
{
// We should not support this command after System Booted - After Exit Boot
@@ -1121,7 +1118,7 @@
ipmi::RspType<std::array<uint8_t, maxSeedSize>, uint8_t,
std::array<uint8_t, maxHashSize>>
- ipmiOEMGetBIOSHash(ipmi::Context::ptr ctx)
+ ipmiOEMGetBIOSHash(ipmi::Context::ptr&)
{
nlohmann::json data = nullptr;
diff --git a/src/bridgingcommands.cpp b/src/bridgingcommands.cpp
index 0f4cc20..f1fa2e1 100644
--- a/src/bridgingcommands.cpp
+++ b/src/bridgingcommands.cpp
@@ -240,7 +240,7 @@
}
}
-ipmi::Cc Bridging::handleIpmbChannel(ipmi::Context::ptr ctx,
+ipmi::Cc Bridging::handleIpmbChannel(ipmi::Context::ptr& ctx,
const uint8_t tracking,
const std::vector<uint8_t>& msgData,
std::vector<uint8_t>& rspData)
@@ -393,7 +393,7 @@
**/
ipmi::RspType<std::vector<uint8_t> // responseData
>
- ipmiAppSendMessage(ipmi::Context::ptr ctx, const uint4_t channelNumber,
+ ipmiAppSendMessage(ipmi::Context::ptr& ctx, const uint4_t channelNumber,
const bool authenticationEnabled,
const bool encryptionEnabled, const uint2_t tracking,
ipmi::message::Payload& msg)
@@ -417,10 +417,9 @@
ipmi::Cc returnVal;
std::vector<uint8_t> rspData(ipmbMaxFrameLength);
- size_t dataLength = 0;
std::vector<uint8_t> unpackMsg;
- auto channelNo = static_cast<const uint8_t>(channelNumber);
+ auto channelNo = static_cast<uint8_t>(channelNumber);
// Get the channel number
switch (channelNo)
{
@@ -433,7 +432,7 @@
}
returnVal = bridging.handleIpmbChannel(
- ctx, static_cast<const uint8_t>(tracking), unpackMsg, rspData);
+ ctx, static_cast<uint8_t>(tracking), unpackMsg, rspData);
break;
// fall through to default
case targetChannelIcmb10:
@@ -469,7 +468,7 @@
ipmi::RspType<uint8_t, // channelNumber
std::vector<uint8_t> // messageData
>
- ipmiAppGetMessage(ipmi::Context::ptr ctx)
+ ipmiAppGetMessage(ipmi::Context::ptr& ctx)
{
ipmi::ChannelInfo chInfo;
@@ -536,7 +535,7 @@
@return IPMI completion code plus Flags as response data on success.
**/
-ipmi::RspType<std::bitset<8>> ipmiAppGetMessageFlags(ipmi::Context::ptr ctx)
+ipmi::RspType<std::bitset<8>> ipmiAppGetMessageFlags(ipmi::Context::ptr& ctx)
{
ipmi::ChannelInfo chInfo;
@@ -615,11 +614,12 @@
* @return IPMI completion code on success
*/
-ipmi::RspType<> ipmiAppClearMessageFlags(ipmi::Context::ptr ctx,
+ipmi::RspType<> ipmiAppClearMessageFlags(ipmi::Context::ptr& ctx,
bool receiveMessage,
bool eventMsgBufFull, bool reserved2,
bool watchdogTimeout, bool reserved1,
- bool oem0, bool oem1, bool oem2)
+ bool /* oem0 */, bool /* oem1 */,
+ bool /* oem2 */)
{
ipmi::ChannelInfo chInfo;
@@ -711,7 +711,7 @@
uint8_t, // Record Type
std::variant<systemEventType, oemTsEventType,
oemEventType>> // Record Content
- ipmiAppReadEventMessageBuffer(ipmi::Context::ptr ctx)
+ ipmiAppReadEventMessageBuffer(ipmi::Context::ptr& ctx)
{
ipmi::ChannelInfo chInfo;
diff --git a/src/chassiscommands.cpp b/src/chassiscommands.cpp
index a452ae6..93ab200 100644
--- a/src/chassiscommands.cpp
+++ b/src/chassiscommands.cpp
@@ -249,6 +249,8 @@
case RestorePolicy::Policy::AlwaysOn:
restorePolicy = 0x02;
break;
+ default:
+ break;
}
}
catch (const std::exception& e)
@@ -499,25 +501,22 @@
}
bool chassisIntrusionActive = false;
- try
- {
- constexpr const char* chassisIntrusionObj =
- "/xyz/openbmc_project/Chassis/Intrusion";
- constexpr const char* chassisIntrusionInf =
- "xyz.openbmc_project.Chassis.Intrusion";
+ constexpr const char* chassisIntrusionObj =
+ "/xyz/openbmc_project/Chassis/Intrusion";
+ constexpr const char* chassisIntrusionInf =
+ "xyz.openbmc_project.Chassis.Intrusion";
- std::string intrusionService;
- boost::system::error_code ec = ipmi::getService(
- ctx, chassisIntrusionInf, chassisIntrusionObj, intrusionService);
-
- chassisIntrusionActive = !intrusionService.empty();
- }
- catch (const std::exception& e)
+ std::string intrusionService;
+ boost::system::error_code ec = ipmi::getService(
+ ctx, chassisIntrusionInf, chassisIntrusionObj, intrusionService);
+ if (ec)
{
log<level::ERR>("Failed to get Chassis Intrusion service",
- entry("ERROR=%s", e.what()));
+ entry("ERROR=%s", ec.message().c_str()));
}
+ chassisIntrusionActive = !intrusionService.empty();
+
// This response has a lot of hard-coded, unsupported fields
// They are set to false or 0
constexpr bool powerOverload = false;
@@ -629,11 +628,10 @@
reserved, channel);
}
-ipmi::RspType<> ipmiSetFrontPanelButtonEnables(bool disablePowerButton,
- bool disableResetButton,
- bool disableInterruptButton,
- bool disableSleepButton,
- uint4_t reserved)
+ipmi::RspType<> ipmiSetFrontPanelButtonEnables(
+ bool disablePowerButton, bool disableResetButton,
+ bool disableInterruptButton, [[maybe_unused]] bool disableSleepButton,
+ uint4_t reserved)
{
if (reserved)
{
diff --git a/src/firmware-update.cpp b/src/firmware-update.cpp
index f8672fd..7e8f82f 100644
--- a/src/firmware-update.cpp
+++ b/src/firmware-update.cpp
@@ -74,8 +74,8 @@
} // namespace ipmi
static constexpr size_t imageCount = 2;
-std::array<std::array<uint8_t, imageCount>, imageCount> imgFwSecurityVersion = {
- (0, 0), (0, 0)};
+std::array<std::array<uint8_t, imageCount>, imageCount> imgFwSecurityVersion =
+ {};
static constexpr size_t svnActiveVerOffsetInPfm = 0x404;
static constexpr size_t bkcActiveVerOffsetInPfm = 0x405;
static constexpr size_t svnRecoveryVerOffsetInPfm = 0x804;
@@ -314,8 +314,8 @@
}
private:
- size_t fsize;
void* addr;
+ size_t fsize;
};
class FwUpdateStatusCache
@@ -578,8 +578,6 @@
// callback function for capturing signal
auto callback = [&](sdbusplus::message_t& m) {
- bool flag = false;
-
std::vector<
std::pair<std::string,
std::vector<std::pair<std::string, ipmi::DbusVariant>>>>
@@ -721,7 +719,6 @@
static bool transferImageFromUsb(const std::string& uri)
{
bool ret = false;
- char fwpath[fwPathMaxLength];
phosphor::logging::log<phosphor::logging::level::INFO>(
"Transfer Image From USB.",
@@ -1144,7 +1141,7 @@
fwRandomNumGenTs = std::chrono::steady_clock::now();
- for (int i = 0; i < fwRandomNumLength; i++)
+ for (size_t i = 0; i < fwRandomNumLength; i++)
{
fwRandomNum[i] = dist(gen);
}
@@ -1194,7 +1191,7 @@
}
/* Validate random number */
- for (int i = 0; i < fwRandomNumLength; i++)
+ for (size_t i = 0; i < fwRandomNumLength; i++)
{
if (fwRandomNum[i] != randNum[i])
{
@@ -1530,6 +1527,10 @@
"Set firmware update options.");
bool isIPMBChannel = false;
+ if (reserved1 || reserved2)
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
if (checkIPMBChannel(ctx, isIPMBChannel) != ipmi::ccSuccess)
{
return ipmi::responseUnspecifiedError();
@@ -1558,7 +1559,7 @@
{
if (sha2Check)
{
- auto hashSize = EVP_MD_size(EVP_sha256());
+ size_t hashSize = EVP_MD_size(EVP_sha256());
if ((*integrityCheckVal).size() != hashSize)
{
phosphor::logging::log<phosphor::logging::level::DEBUG>(
@@ -1586,7 +1587,7 @@
sha2CheckState = sha2CheckMask;
}
return ipmi::responseSuccess(noDowngradeState, deferRestartState,
- sha2CheckState, reserved1);
+ sha2CheckState, uint5_t{});
}
ipmi::RspType<uint32_t>
@@ -1657,7 +1658,7 @@
if (((fileDataLen + writeDataLen) >= sizeof(PFRImageBlock0)) &&
(!block0Mapped))
{
- struct PFRImageBlock0 block0Data = {0};
+ PFRImageBlock0 block0Data{};
std::ifstream inFile(firmwareBufferFile,
std::ios::binary | std::ios::in);
diff --git a/src/manufacturingcommands.cpp b/src/manufacturingcommands.cpp
index cb55ee2..2bcb348 100644
--- a/src/manufacturingcommands.cpp
+++ b/src/manufacturingcommands.cpp
@@ -473,7 +473,7 @@
// it to sample action to make tools happy.
action = SmActionGet::sample;
}
- // fall-through
+ [[fallthrough]];
}
case SmSignalGet::smResetButton:
case SmSignalGet::smPowerButton:
@@ -1094,9 +1094,6 @@
return ipmi::responseParmOutOfRange();
}
- constexpr uint8_t invalidData = 0;
- constexpr uint8_t validData = 1;
-
ipmi::Cc ret = writeMacToFru(ctx, dataType, ethData);
if (ret != ipmi::ccDestinationUnavailable)
{
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 05661fc..d0158de 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -270,6 +270,11 @@
std::vector<uint8_t> readBuf(0);
ipmi::Cc retI2C = ipmi::i2cWriteRead(i2cBus, targetAddr, writeData,
readBuf);
+ if (retI2C)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "i2cWriteRead returns non-zero");
+ }
}
} // namespace mailbox
@@ -312,11 +317,9 @@
}
// Returns the Chassis Identifier (serial #)
-ipmi_ret_t ipmiOEMGetChassisIdentifier(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_request_t request,
+ipmi_ret_t ipmiOEMGetChassisIdentifier(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t,
ipmi_response_t response,
- ipmi_data_len_t dataLen,
- ipmi_context_t context)
+ ipmi_data_len_t dataLen, ipmi_context_t)
{
std::string serial;
if (*dataLen != 0) // invalid request if there are extra parameters
@@ -337,10 +340,9 @@
return IPMI_CC_RESPONSE_ERROR;
}
-ipmi_ret_t ipmiOEMSetSystemGUID(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t dataLen, ipmi_context_t context)
+ipmi_ret_t ipmiOEMSetSystemGUID(ipmi_netfn_t, ipmi_cmd_t,
+ ipmi_request_t request, ipmi_response_t,
+ ipmi_data_len_t dataLen, ipmi_context_t)
{
static constexpr size_t safeBufferLength = 50;
char buf[safeBufferLength] = {0};
@@ -429,13 +431,13 @@
return ipmi::responseSuccess(disableResetOnSMI, 0);
}
-ipmi_ret_t ipmiOEMSetBIOSID(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_request_t request, ipmi_response_t response,
- ipmi_data_len_t dataLen, ipmi_context_t context)
+ipmi_ret_t ipmiOEMSetBIOSID(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t request,
+ ipmi_response_t response, ipmi_data_len_t dataLen,
+ ipmi_context_t)
{
DeviceInfo* data = reinterpret_cast<DeviceInfo*>(request);
- if ((*dataLen < 2) || (*dataLen != (1 + data->biosIDLength)))
+ if ((*dataLen < 2ul) || (*dataLen != (1ul + data->biosIDLength)))
{
*dataLen = 0;
return IPMI_CC_REQ_DATA_LEN_INVALID;
@@ -485,9 +487,9 @@
return true;
}
-bool getHscVerInfo(ipmi::Context::ptr ctx, uint8_t& hsc0Major,
- uint8_t& hsc0Minor, uint8_t& hsc1Major, uint8_t& hsc1Minor,
- uint8_t& hsc2Major, uint8_t& hsc2Minor)
+bool getHscVerInfo(ipmi::Context::ptr&, uint8_t& hsc0Major, uint8_t& hsc0Minor,
+ uint8_t& hsc1Major, uint8_t& hsc1Minor, uint8_t& hsc2Major,
+ uint8_t& hsc2Minor)
{
std::string hscVersion;
std::array<uint8_t, 6> hscVersions{0};
@@ -524,7 +526,7 @@
return true;
}
-bool getSwVerInfo(ipmi::Context::ptr ctx, uint8_t& bmcMajor, uint8_t& bmcMinor,
+bool getSwVerInfo(ipmi::Context::ptr& ctx, uint8_t& bmcMajor, uint8_t& bmcMinor,
uint8_t& meMajor, uint8_t& meMinor)
{
// step 1 : get BMC Major and Minor numbers from its DBUS property
@@ -571,7 +573,7 @@
std::array<uint8_t, 2>, std::array<uint8_t, 2>,
std::array<uint8_t, 2>, std::array<uint8_t, 2>>,
std::tuple<uint8_t, std::array<uint8_t, 2>>>>
- ipmiOEMGetDeviceInfo(ipmi::Context::ptr ctx, uint8_t entityType,
+ ipmiOEMGetDeviceInfo(ipmi::Context::ptr& ctx, uint8_t entityType,
std::optional<uint8_t> countToRead,
std::optional<uint8_t> offset)
{
@@ -682,9 +684,9 @@
}
}
-ipmi_ret_t ipmiOEMGetAICFRU(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_request_t request, ipmi_response_t response,
- ipmi_data_len_t dataLen, ipmi_context_t context)
+ipmi_ret_t ipmiOEMGetAICFRU(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t,
+ ipmi_response_t response, ipmi_data_len_t dataLen,
+ ipmi_context_t)
{
if (*dataLen != 0)
{
@@ -701,11 +703,9 @@
return IPMI_CC_OK;
}
-ipmi_ret_t ipmiOEMGetPowerRestoreDelay(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_request_t request,
+ipmi_ret_t ipmiOEMGetPowerRestoreDelay(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t,
ipmi_response_t response,
- ipmi_data_len_t dataLen,
- ipmi_context_t context)
+ ipmi_data_len_t dataLen, ipmi_context_t)
{
GetPowerRestoreDelayRes* resp =
reinterpret_cast<GetPowerRestoreDelayRes*>(response);
@@ -843,10 +843,10 @@
}
ipmi::RspType<uint8_t, std::vector<uint8_t>>
- ipmiOEMSlotIpmb(ipmi::Context::ptr ctx, uint6_t reserved1,
+ ipmiOEMSlotIpmb(ipmi::Context::ptr& ctx, uint6_t reserved1,
uint2_t slotNumber, uint3_t baseBoardSlotNum,
- uint3_t riserSlotNum, uint2_t reserved2, uint8_t targetAddr,
- uint8_t netFn, uint8_t cmd,
+ [[maybe_unused]] uint3_t riserSlotNum, uint2_t reserved2,
+ uint8_t targetAddr, uint8_t netFn, uint8_t cmd,
std::optional<std::vector<uint8_t>> writeData)
{
if (reserved1 || reserved2)
@@ -885,11 +885,9 @@
return ipmi::responseSuccess(cc, dataReceived);
}
-ipmi_ret_t ipmiOEMSetPowerRestoreDelay(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t dataLen,
- ipmi_context_t context)
+ipmi_ret_t ipmiOEMSetPowerRestoreDelay(ipmi_netfn_t, ipmi_cmd_t,
+ ipmi_request_t request, ipmi_response_t,
+ ipmi_data_len_t dataLen, ipmi_context_t)
{
SetPowerRestoreDelayReq* data =
reinterpret_cast<SetPowerRestoreDelayReq*>(request);
@@ -1071,11 +1069,9 @@
return ipmi::responseSuccess();
}
-ipmi_ret_t ipmiOEMGetShutdownPolicy(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_request_t request,
+ipmi_ret_t ipmiOEMGetShutdownPolicy(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t,
ipmi_response_t response,
- ipmi_data_len_t dataLen,
- ipmi_context_t context)
+ ipmi_data_len_t dataLen, ipmi_context_t)
{
GetOEMShutdownPolicyRes* resp =
reinterpret_cast<GetOEMShutdownPolicyRes*>(response);
@@ -1135,11 +1131,9 @@
return IPMI_CC_OK;
}
-ipmi_ret_t ipmiOEMSetShutdownPolicy(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t dataLen,
- ipmi_context_t context)
+ipmi_ret_t ipmiOEMSetShutdownPolicy(ipmi_netfn_t, ipmi_cmd_t,
+ ipmi_request_t request, ipmi_response_t,
+ ipmi_data_len_t dataLen, ipmi_context_t)
{
uint8_t* req = reinterpret_cast<uint8_t*>(request);
sdbusplus::com::intel::Control::server::OCOTShutdownPolicy::Policy policy =
@@ -1425,7 +1419,7 @@
* @param[in] userPassword - new password in 20 bytes
* @returns ipmi completion code.
*/
-ipmi::RspType<> ipmiOEMSetSpecialUserPassword(ipmi::Context::ptr ctx,
+ipmi::RspType<> ipmiOEMSetSpecialUserPassword(ipmi::Context::ptr& ctx,
uint8_t specialUserIndex,
std::vector<uint8_t> userPassword)
{
@@ -1562,11 +1556,11 @@
return ipmi::responseSuccess(ledstate);
}
-ipmi_ret_t ipmiOEMCfgHostSerialPortSpeed(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
+ipmi_ret_t ipmiOEMCfgHostSerialPortSpeed(ipmi_netfn_t, ipmi_cmd_t,
ipmi_request_t request,
ipmi_response_t response,
ipmi_data_len_t dataLen,
- ipmi_context_t context)
+ ipmi_context_t)
{
CfgHostSerialReq* req = reinterpret_cast<CfgHostSerialReq*>(request);
uint8_t* resp = reinterpret_cast<uint8_t*>(response);
@@ -1728,13 +1722,11 @@
*
* @return IPMI completion code.
**/
-ipmi::RspType<> ipmiOEMSetFanConfig(uint8_t selectedFanProfile,
-
- uint2_t reserved1, bool performanceMode,
- uint3_t reserved2, bool setPerformanceMode,
- bool setFanProfile,
- std::optional<uint8_t> dimmGroupId,
- std::optional<uint32_t> dimmPresenceBitmap)
+ipmi::RspType<> ipmiOEMSetFanConfig(
+ [[maybe_unused]] uint8_t selectedFanProfile, uint2_t reserved1,
+ bool performanceMode, uint3_t reserved2, bool setPerformanceMode,
+ [[maybe_unused]] bool setFanProfile, std::optional<uint8_t> dimmGroupId,
+ [[maybe_unused]] std::optional<uint32_t> dimmPresenceBitmap)
{
if (reserved1 || reserved2)
{
@@ -2102,7 +2094,6 @@
}
else if (command == static_cast<uint8_t>(setFscParamFlags::maxPwm))
{
- constexpr const size_t maxDomainCount = 8;
uint8_t requestedDomainMask = param1;
boost::container::flat_map data = getPidConfigs();
if (data.empty())
@@ -2307,9 +2298,10 @@
using crConfigVariant = ipmi::DbusVariant;
-int setCRConfig(ipmi::Context::ptr ctx, const std::string& property,
+int setCRConfig(ipmi::Context::ptr& ctx, const std::string& property,
const crConfigVariant& value,
- std::chrono::microseconds timeout = ipmi::IPMI_DBUS_TIMEOUT)
+ [[maybe_unused]] std::chrono::microseconds timeout =
+ ipmi::IPMI_DBUS_TIMEOUT)
{
boost::system::error_code ec;
ctx->bus->yield_method_call<void>(
@@ -2328,9 +2320,11 @@
}
int getCRConfig(
- ipmi::Context::ptr ctx, const std::string& property, crConfigVariant& value,
+ ipmi::Context::ptr& ctx, const std::string& property,
+ crConfigVariant& value,
const std::string& service = "xyz.openbmc_project.PSURedundancy",
- std::chrono::microseconds timeout = ipmi::IPMI_DBUS_TIMEOUT)
+ [[maybe_unused]] std::chrono::microseconds timeout =
+ ipmi::IPMI_DBUS_TIMEOUT)
{
boost::system::error_code ec;
value = ctx->bus->yield_method_call<crConfigVariant>(
@@ -2419,7 +2413,7 @@
static const constexpr uint32_t oneMonth = 0xf53700;
static const constexpr uint8_t userSpecific = 0x01;
static const constexpr uint8_t crSetCompleted = 0;
-ipmi::RspType<uint8_t> ipmiOEMSetCRConfig(ipmi::Context::ptr ctx,
+ipmi::RspType<uint8_t> ipmiOEMSetCRConfig(ipmi::Context::ptr& ctx,
uint8_t parameter,
ipmi::message::Payload& payload)
{
@@ -2539,7 +2533,7 @@
}
ipmi::RspType<uint8_t, std::variant<uint8_t, uint32_t, std::vector<uint8_t>>>
- ipmiOEMGetCRConfig(ipmi::Context::ptr ctx, uint8_t parameter)
+ ipmiOEMGetCRConfig(ipmi::Context::ptr& ctx, uint8_t parameter)
{
crConfigVariant value;
switch (static_cast<crParameter>(parameter))
@@ -2858,14 +2852,14 @@
// assemble ledState
uint64_t ledState = 0;
bool hasError = false;
- for (int i = 0; i < sizeof(ledStateData); i++)
+ for (size_t i = 0; i < sizeof(ledStateData); i++)
{
ledState = (uint64_t)(ledState << 8);
ledState = (uint64_t)(ledState | (uint64_t)ledStateData[i]);
}
std::bitset<size> ledStateBits(ledState);
- for (int group = 0; group < pinGroupMax; group++)
+ for (size_t group = 0; group < pinGroupMax; group++)
{
for (int i = 0; i < groupSize; i++)
{ // skip non-existing pins
@@ -2960,7 +2954,7 @@
* - special mode value - As specified in
* xyz.openbmc_project.Control.Security.SpecialMode.interface.yaml
*/
-ipmi::RspType<uint8_t, uint8_t> ipmiGetSecurityMode(ipmi::Context::ptr ctx)
+ipmi::RspType<uint8_t, uint8_t> ipmiGetSecurityMode(ipmi::Context::ptr& ctx)
{
namespace securityNameSpace =
sdbusplus::xyz::openbmc_project::Control::Security::server;
@@ -3011,7 +3005,7 @@
*
* @returns IPMI completion code
*/
-ipmi::RspType<> ipmiSetSecurityMode(ipmi::Context::ptr ctx,
+ipmi::RspType<> ipmiSetSecurityMode(ipmi::Context::ptr& ctx,
uint8_t restrictionMode,
std::optional<uint8_t> specialMode)
{
@@ -3499,7 +3493,8 @@
uint8_t, // data0, dependent on parameter
std::optional<uint8_t> // data1, dependent on parameter
>
- ipmiOemGetEfiBootOptions(uint8_t parameter, uint8_t set, uint8_t block)
+ ipmiOemGetEfiBootOptions(uint8_t parameter, [[maybe_unused]] uint8_t set,
+ [[maybe_unused]] uint8_t block)
{
using namespace boot_options;
uint8_t bootOption = 0;
@@ -3684,7 +3679,7 @@
boost::container::flat_map<std::string, BasicVariantType>;
static constexpr const std::array<const char*, 1> psuPresenceTypes = {
"xyz.openbmc_project.Configuration.PSUPresence"};
-int getPSUAddress(ipmi::Context::ptr ctx, uint8_t& bus,
+int getPSUAddress(ipmi::Context::ptr& ctx, uint8_t& bus,
std::vector<uint64_t>& addrTable)
{
boost::system::error_code ec;
@@ -3741,7 +3736,8 @@
static const constexpr uint8_t defaultPSUBus = 7;
// Second Minor, Primary Minor, Major
static const constexpr size_t verLen = 3;
-ipmi::RspType<std::vector<uint8_t>> ipmiOEMGetPSUVersion(ipmi::Context::ptr ctx)
+ipmi::RspType<std::vector<uint8_t>>
+ ipmiOEMGetPSUVersion(ipmi::Context::ptr& ctx)
{
uint8_t bus = defaultPSUBus;
std::vector<uint64_t> addrTable;
@@ -3779,7 +3775,7 @@
return ipmi::responseSuccess(result);
}
-std::optional<uint8_t> getMultiNodeInfoPresence(ipmi::Context::ptr ctx,
+std::optional<uint8_t> getMultiNodeInfoPresence(ipmi::Context::ptr& ctx,
const std::string& name)
{
Value dbusValue = 0;
@@ -3835,10 +3831,10 @@
uint4_t, // reading Type
uint16_t // reading Value
>
- ipmiOEMGetReading(ipmi::Context::ptr ctx, uint4_t domainId,
+ ipmiOEMGetReading(ipmi::Context::ptr& ctx, uint4_t domainId,
uint4_t readingType, uint16_t reserved)
{
- constexpr uint8_t platformPower = 0;
+ [[maybe_unused]] constexpr uint8_t platformPower = 0;
constexpr uint8_t inletAirTemp = 1;
constexpr uint8_t iccTdc = 2;
@@ -3928,49 +3924,46 @@
case ipmi::mailbox::registerType::fifoReadRegister:
{
// Check if readRegister is an FIFO read register
- if (registerIdentifier == 1)
+ if (ipmi::mailbox::readFifoReg.find(readRegister) ==
+ ipmi::mailbox::readFifoReg.end())
{
- if (ipmi::mailbox::readFifoReg.find(readRegister) ==
- ipmi::mailbox::readFifoReg.end())
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "OEM IPMI command: Register is not a Read FIFO ");
- return ipmi::responseInvalidFieldRequest();
- }
-
phosphor::logging::log<phosphor::logging::level::ERR>(
- "OEM IPMI command: Register is a Read FIFO ");
+ "OEM IPMI command: Register is not a Read FIFO ");
+ return ipmi::responseInvalidFieldRequest();
+ }
- ipmi::mailbox::writefifo(ipmi::mailbox::provisioningCommand,
- readRegister);
- ipmi::mailbox::writefifo(ipmi::mailbox::triggerCommand,
- ipmi::mailbox::flushRead);
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "OEM IPMI command: Register is a Read FIFO ");
- std::vector<uint8_t> writeData = {ipmi::mailbox::readFifo};
- std::vector<uint8_t> readBuf(1);
- std::vector<uint8_t> result;
+ ipmi::mailbox::writefifo(ipmi::mailbox::provisioningCommand,
+ readRegister);
+ ipmi::mailbox::writefifo(ipmi::mailbox::triggerCommand,
+ ipmi::mailbox::flushRead);
- for (int i = 0; i < numOfBytes; i++)
+ std::vector<uint8_t> writeData = {ipmi::mailbox::readFifo};
+ std::vector<uint8_t> readBuf(1);
+ std::vector<uint8_t> result;
+
+ for (int i = 0; i < numOfBytes; i++)
+ {
+ ipmi::Cc ret = ipmi::i2cWriteRead(ipmi::mailbox::i2cBus,
+ ipmi::mailbox::targetAddr,
+ writeData, readBuf);
+ if (ret != ipmi::ccSuccess)
{
- ipmi::Cc ret = ipmi::i2cWriteRead(ipmi::mailbox::i2cBus,
- ipmi::mailbox::targetAddr,
- writeData, readBuf);
- if (ret != ipmi::ccSuccess)
- {
- return ipmi::response(ret);
- }
-
- else
- {
- for (const uint8_t& data : readBuf)
- {
- result.emplace_back(data);
- }
- }
+ return ipmi::response(ret);
}
- return ipmi::responseSuccess(result);
+ else
+ {
+ for (const uint8_t& data : readBuf)
+ {
+ result.emplace_back(data);
+ }
+ }
}
+
+ return ipmi::responseSuccess(result);
}
case ipmi::mailbox::registerType::singleByteRegister:
diff --git a/src/sensorcommands.cpp b/src/sensorcommands.cpp
index 4dc170f..95bb491 100644
--- a/src/sensorcommands.cpp
+++ b/src/sensorcommands.cpp
@@ -34,6 +34,7 @@
#include <array>
#include <chrono>
#include <cmath>
+#include <cstdint>
#include <cstring>
#include <iostream>
#include <map>
@@ -91,7 +92,7 @@
*getSdBus(),
"type='signal',member='InterfacesAdded',arg0path='/xyz/openbmc_project/"
"sensors/'",
- [](sdbusplus::message_t& m) {
+ [](sdbusplus::message_t&) {
sensorTree.clear();
sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
@@ -102,7 +103,7 @@
*getSdBus(),
"type='signal',member='InterfacesRemoved',arg0path='/xyz/openbmc_project/"
"sensors/'",
- [](sdbusplus::message_t& m) {
+ [](sdbusplus::message_t&) {
sensorTree.clear();
sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
@@ -601,12 +602,10 @@
bool lowerCriticalThreshMask, bool lowerNonRecovThreshMask,
bool upperNonCriticalThreshMask, bool upperCriticalThreshMask,
bool upperNonRecovThreshMask, uint2_t reserved, uint8_t lowerNonCritical,
- uint8_t lowerCritical, uint8_t lowerNonRecoverable,
+ uint8_t lowerCritical, [[maybe_unused]] uint8_t lowerNonRecoverable,
uint8_t upperNonCritical, uint8_t upperCritical,
- uint8_t upperNonRecoverable)
+ [[maybe_unused]] uint8_t upperNonRecoverable)
{
- constexpr uint8_t thresholdMask = 0xFF;
-
if (sensorNum == reservedSensorNumber)
{
return ipmi::responseInvalidFieldRequest();
@@ -1328,7 +1327,7 @@
"getSensorDataRecord: sensor record mismatch");
return GENERAL_ERROR;
}
- get_sdr::SensorDataFullRecord record = {0};
+ get_sdr::SensorDataFullRecord record = {{}, {}, {}};
get_sdr::header::set_record_id(
recordID, reinterpret_cast<get_sdr::SensorDataRecordHeader*>(&record));
diff --git a/src/smbiosmdrv2handler.cpp b/src/smbiosmdrv2handler.cpp
index fac3d94..d3c862e 100644
--- a/src/smbiosmdrv2handler.cpp
+++ b/src/smbiosmdrv2handler.cpp
@@ -911,7 +911,6 @@
uint16_t timeout)
{
bool ret = false;
- uint32_t u32Status = 0;
if (timeout == 0)
{
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 67ca8d8..c124235 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -295,7 +295,7 @@
recalculateHashes();
}
-ipmi::Cc getFru(ipmi::Context::ptr ctx, uint8_t devId)
+ipmi::Cc getFru(ipmi::Context::ptr& ctx, uint8_t devId)
{
if (lastDevId == devId && devId != 0xFF)
{
@@ -451,7 +451,7 @@
ipmi::RspType<uint8_t, // Count
std::vector<uint8_t> // Requested data
>
- ipmiStorageReadFruData(ipmi::Context::ptr ctx, uint8_t fruDeviceId,
+ ipmiStorageReadFruData(ipmi::Context::ptr& ctx, uint8_t fruDeviceId,
uint16_t fruInventoryOffset, uint8_t countToRead)
{
if (fruDeviceId == 0xFF)
@@ -499,7 +499,7 @@
* - countWritten - Count written
*/
ipmi::RspType<uint8_t>
- ipmiStorageWriteFruData(ipmi::Context::ptr ctx, uint8_t fruDeviceId,
+ ipmiStorageWriteFruData(ipmi::Context::ptr& ctx, uint8_t fruDeviceId,
uint16_t fruInventoryOffset,
std::vector<uint8_t>& dataToWrite)
{
@@ -515,7 +515,7 @@
{
return ipmi::response(status);
}
- int lastWriteAddr = fruInventoryOffset + writeLen;
+ size_t lastWriteAddr = fruInventoryOffset + writeLen;
if (fruCache.size() < lastWriteAddr)
{
fruCache.resize(fruInventoryOffset + writeLen);
@@ -531,7 +531,7 @@
FRUHeader* header = reinterpret_cast<FRUHeader*>(fruCache.data());
int areaLength = 0;
- int lastRecordStart = std::max(
+ size_t lastRecordStart = std::max(
{header->internalOffset, header->chassisOffset, header->boardOffset,
header->productOffset, header->multiRecordOffset});
lastRecordStart *= 8; // header starts in are multiples of 8 bytes
@@ -608,7 +608,7 @@
*/
ipmi::RspType<uint16_t, // inventorySize
uint8_t> // accessType
- ipmiStorageGetFruInvAreaInfo(ipmi::Context::ptr ctx, uint8_t fruDeviceId)
+ ipmiStorageGetFruInvAreaInfo(ipmi::Context::ptr& ctx, uint8_t fruDeviceId)
{
if (fruDeviceId == 0xFF)
{
@@ -627,18 +627,18 @@
return ipmi::responseSuccess(fruCache.size(), accessType);
}
-ipmi_ret_t getFruSdrCount(ipmi::Context::ptr ctx, size_t& count)
+ipmi::Cc getFruSdrCount(ipmi::Context::ptr&, size_t& count)
{
count = deviceHashes.size();
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
-ipmi_ret_t getFruSdrs(ipmi::Context::ptr ctx, size_t index,
- get_sdr::SensorDataFruRecord& resp)
+ipmi::Cc getFruSdrs(ipmi::Context::ptr& ctx, size_t index,
+ get_sdr::SensorDataFruRecord& resp)
{
if (deviceHashes.size() < index)
{
- return IPMI_CC_INVALID_FIELD_REQUEST;
+ return ipmi::ccInvalidFieldRequest;
}
auto device = deviceHashes.begin() + index;
uint16_t& bus = device->second.first;
@@ -672,7 +672,7 @@
});
if (fru == frus.end())
{
- return IPMI_CC_RESPONSE_ERROR;
+ return ipmi::ccResponseError;
}
#ifdef USING_ENTITY_MANAGER_DECORATORS
@@ -807,7 +807,7 @@
resp.body.deviceIDLen = name.size();
name.copy(resp.body.deviceID, name.size());
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
static bool getSELLogFiles(std::vector<std::filesystem::path>& selLogFiles)
@@ -1206,7 +1206,7 @@
return ipmi::responseSuccess(responseID);
}
-ipmi::RspType<uint8_t> ipmiStorageClearSEL(ipmi::Context::ptr ctx,
+ipmi::RspType<uint8_t> ipmiStorageClearSEL(ipmi::Context::ptr&,
uint16_t reservationID,
const std::array<uint8_t, 3>& clr,
uint8_t eraseOperation)
@@ -1283,7 +1283,7 @@
return ipmi::responseSuccess(selTime.tv_sec);
}
-ipmi::RspType<> ipmiStorageSetSELTime(uint32_t selTime)
+ipmi::RspType<> ipmiStorageSetSELTime([[maybe_unused]] uint32_t selTime)
{
// Set SEL Time is not supported
return ipmi::responseInvalidCommand();