update oemcommands.hpp to use new API
All the command handler numbers and netfn numbers were done
using the old API. This updates all the enums to be ipmi::Cmd
or ipmi::NetFn types. This improves readability by eliminating
unneeded static_casts and brings the legacy code to the present.
One minor fix, otherwise the code is the same. The call to
registerFilter was passing a netfn instead of a priority. It compiled
but it was incorrect. This updates it to use the correct parameter.
Tested: builds and produces the same binary output (other than the
aforementioned registerFilter fix)
Change-Id: I7e83123245b3f340088f8ec75a31b7611d0ecda0
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/src/appcommands.cpp b/src/appcommands.cpp
index b9e37e5..ebf95be 100644
--- a/src/appcommands.cpp
+++ b/src/appcommands.cpp
@@ -237,16 +237,17 @@
return std::nullopt;
}
} // namespace
-auto ipmiAppGetDeviceId() -> ipmi::RspType<uint8_t, // Device ID
- uint8_t, // Device Revision
- uint8_t, // Firmware Revision Major
- uint8_t, // Firmware Revision minor
- uint8_t, // IPMI version
- uint8_t, // Additional device support
- uint24_t, // MFG ID
- uint16_t, // Product ID
- uint32_t // AUX info
- >
+RspType<uint8_t, // Device ID
+ uint8_t, // Device Revision
+ uint8_t, // Firmware Revision Major
+ uint8_t, // Firmware Revision minor
+ uint8_t, // IPMI version
+ uint8_t, // Additional device support
+ uint24_t, // MFG ID
+ uint16_t, // Product ID
+ uint32_t // AUX info
+ >
+ ipmiAppGetDeviceId()
{
static struct
{
@@ -375,10 +376,8 @@
{
Log::log<Log::level::INFO>("Registering App commands");
// <Get Device ID>
- ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnApp,
- ipmi::app::cmdGetDeviceId, ipmi::Privilege::User,
- ipmiAppGetDeviceId);
- return;
+ registerHandler(prioOemBase, netFnApp, app::cmdGetDeviceId, Privilege::User,
+ ipmiAppGetDeviceId);
}
} // namespace ipmi
diff --git a/src/bmccontrolservices.cpp b/src/bmccontrolservices.cpp
index 159df91..5073149 100644
--- a/src/bmccontrolservices.cpp
+++ b/src/bmccontrolservices.cpp
@@ -201,16 +201,12 @@
void register_netfn_bmc_control_functions()
{
- ipmi::registerHandler(
- ipmi::prioOpenBmcBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdControlBmcServices),
- ipmi::Privilege::Admin, setBmcControlServices);
+ registerHandler(prioOpenBmcBase, intel::netFnGeneral,
+ intel::general::cmdControlBmcServices, Privilege::Admin,
+ setBmcControlServices);
- ipmi::registerHandler(
- ipmi::prioOpenBmcBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetBmcServiceStatus),
- ipmi::Privilege::User, getBmcControlServices);
+ registerHandler(prioOpenBmcBase, intel::netFnGeneral,
+ intel::general::cmdGetBmcServiceStatus, Privilege::User,
+ getBmcControlServices);
}
} // namespace ipmi
diff --git a/src/manufacturingcommands.cpp b/src/manufacturingcommands.cpp
index c7ab5cf..38c44d9 100644
--- a/src/manufacturingcommands.cpp
+++ b/src/manufacturingcommands.cpp
@@ -773,43 +773,33 @@
void register_mtm_commands()
{
// <Get SM Signal>
- ipmi::registerHandler(
- ipmi::prioOemBase, ipmi::netFnOemOne,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdGetSmSignal),
- ipmi::Privilege::Admin, ipmi::appMTMGetSignal);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnGeneral,
+ ipmi::intel::general::cmdGetSmSignal,
+ ipmi::Privilege::Admin, ipmi::appMTMGetSignal);
- ipmi::registerHandler(
- ipmi::prioOemBase, ipmi::netFnOemOne,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdSetSmSignal),
- ipmi::Privilege::Admin, ipmi::appMTMSetSignal);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnGeneral,
+ ipmi::intel::general::cmdSetSmSignal,
+ ipmi::Privilege::Admin, ipmi::appMTMSetSignal);
- ipmi::registerHandler(
- ipmi::prioOemBase, ipmi::netFnOemOne,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdMtmKeepAlive),
- ipmi::Privilege::Admin, ipmi::mtmKeepAlive);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnGeneral,
+ ipmi::intel::general::cmdMtmKeepAlive,
+ ipmi::Privilege::Admin, ipmi::mtmKeepAlive);
- ipmi::registerHandler(
- ipmi::prioOemBase, ipmi::netFnOemOne,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdSetManufacturingData),
- ipmi::Privilege::Admin, ipmi::setManufacturingData);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnGeneral,
+ ipmi::intel::general::cmdSetManufacturingData,
+ ipmi::Privilege::Admin, ipmi::setManufacturingData);
- ipmi::registerHandler(
- ipmi::prioOemBase, ipmi::netFnOemOne,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetManufacturingData),
- ipmi::Privilege::Admin, ipmi::getManufacturingData);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnGeneral,
+ ipmi::intel::general::cmdGetManufacturingData,
+ ipmi::Privilege::Admin, ipmi::getManufacturingData);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfunIntelAppOEM,
- static_cast<ipmi_cmd_t>(
- IPMINetfnIntelOEMGeneralCmd::cmdSlotI2CMasterWriteRead),
- ipmi::Privilege::Admin, ipmi::appSlotI2CMasterWriteRead);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::general::cmdSlotI2CMasterWriteRead,
+ ipmi::Privilege::Admin,
+ ipmi::appSlotI2CMasterWriteRead);
- ipmi::registerFilter(ipmi::netFnOemOne,
+ ipmi::registerFilter(ipmi::prioOemBase,
[](ipmi::message::Request::ptr request) {
return ipmi::mfgFilterMessage(request);
});
-
- return;
}
diff --git a/src/multinodecommands.cpp b/src/multinodecommands.cpp
index 7e79fc0..5966605 100644
--- a/src/multinodecommands.cpp
+++ b/src/multinodecommands.cpp
@@ -116,20 +116,17 @@
phosphor::logging::log<phosphor::logging::level::INFO>(
"Registering MultiNode commands");
- ipmi::registerHandler(
- ipmi::prioOemBase, ipmi::netFnOemOne,
- static_cast<ipmi::Cmd>(IPMINetfnMultiNodeCmd::cmdGetMultiNodePresence),
- ipmi::Privilege::User, ipmiGetMultiNodePresence);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnGeneral,
+ ipmi::intel::general::cmdGetMultiNodePresence,
+ ipmi::Privilege::User, ipmiGetMultiNodePresence);
- ipmi::registerHandler(
- ipmi::prioOemBase, ipmi::netFnOemOne,
- static_cast<ipmi::Cmd>(IPMINetfnMultiNodeCmd::cmdGetMultiNodeId),
- ipmi::Privilege::User, ipmiGetMultiNodeId);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnGeneral,
+ ipmi::intel::general::cmdGetMultiNodeId,
+ ipmi::Privilege::User, ipmiGetMultiNodeId);
- ipmi::registerHandler(
- ipmi::prioOemBase, ipmi::netFnOemOne,
- static_cast<ipmi::Cmd>(IPMINetfnMultiNodeCmd::cmdGetMultiNodeRole),
- ipmi::Privilege::User, ipmiGetMultiNodeRole);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnGeneral,
+ ipmi::intel::general::cmdGetMultiNodeRole,
+ ipmi::Privilege::User, ipmiGetMultiNodeRole);
}
} // namespace ipmi
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 133815d..d53f4ef 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -47,12 +47,6 @@
{
static void registerOEMFunctions() __attribute__((constructor));
-namespace netfn::intel
-{
-constexpr NetFn oemGeneral = netFnOemOne;
-constexpr Cmd cmdRestoreConfiguration = 0x02;
-} // namespace netfn::intel
-
static constexpr size_t maxFRUStringLength = 0x3F;
static constexpr auto ethernetIntf =
@@ -3280,215 +3274,166 @@
{
phosphor::logging::log<phosphor::logging::level::INFO>(
"Registering OEM commands");
- ipmiPrintAndRegister(netfnIntcOEMGeneral, IPMI_CMD_WILDCARD, NULL,
+ ipmiPrintAndRegister(intel::netFnGeneral, IPMI_CMD_WILDCARD, NULL,
ipmiOEMWildcard,
PRIVILEGE_USER); // wildcard default handler
- ipmiPrintAndRegister(netfunIntelAppOEM, IPMI_CMD_WILDCARD, NULL,
+
+ ipmiPrintAndRegister(intel::netFnApp, IPMI_CMD_WILDCARD, NULL,
ipmiOEMWildcard,
PRIVILEGE_USER); // wildcard default handler
- ipmiPrintAndRegister(
- netfnIntcOEMGeneral,
- static_cast<ipmi_cmd_t>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetChassisIdentifier),
- NULL, ipmiOEMGetChassisIdentifier,
- PRIVILEGE_USER); // get chassis identifier
- ipmiPrintAndRegister(
- netfnIntcOEMGeneral,
- static_cast<ipmi_cmd_t>(IPMINetfnIntelOEMGeneralCmd::cmdSetSystemGUID),
- NULL, ipmiOEMSetSystemGUID,
- PRIVILEGE_ADMIN); // set system guid
+
+ ipmiPrintAndRegister(intel::netFnGeneral,
+ intel::general::cmdGetChassisIdentifier, NULL,
+ ipmiOEMGetChassisIdentifier,
+ PRIVILEGE_USER); // get chassis identifier
+
+ ipmiPrintAndRegister(intel::netFnGeneral, intel::general::cmdSetSystemGUID,
+ NULL, ipmiOEMSetSystemGUID,
+ PRIVILEGE_ADMIN); // set system guid
// <Disable BMC System Reset Action>
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdDisableBMCSystemReset),
- ipmi::Privilege::Admin, ipmiOEMDisableBMCSystemReset);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdDisableBMCSystemReset, Privilege::Admin,
+ ipmiOEMDisableBMCSystemReset);
+
// <Get BMC Reset Disables>
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetBMCResetDisables),
- ipmi::Privilege::Admin, ipmiOEMGetBMCResetDisables);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdGetBMCResetDisables, Privilege::Admin,
+ ipmiOEMGetBMCResetDisables);
- ipmiPrintAndRegister(
- netfnIntcOEMGeneral,
- static_cast<ipmi_cmd_t>(IPMINetfnIntelOEMGeneralCmd::cmdSetBIOSID),
- NULL, ipmiOEMSetBIOSID, PRIVILEGE_ADMIN);
- ipmiPrintAndRegister(netfnIntcOEMGeneral,
- static_cast<ipmi_cmd_t>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetOEMDeviceInfo),
- NULL, ipmiOEMGetDeviceInfo, PRIVILEGE_USER);
- ipmiPrintAndRegister(
- netfnIntcOEMGeneral,
- static_cast<ipmi_cmd_t>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetAICSlotFRUIDSlotPosRecords),
- NULL, ipmiOEMGetAICFRU, PRIVILEGE_USER);
+ ipmiPrintAndRegister(intel::netFnGeneral, intel::general::cmdSetBIOSID,
+ NULL, ipmiOEMSetBIOSID, PRIVILEGE_ADMIN);
- ipmi::registerHandler(
- ipmi::prioOpenBmcBase, ipmi::netFnOemOne,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdSendEmbeddedFWUpdStatus),
- ipmi::Privilege::Operator, ipmiOEMSendEmbeddedFwUpdStatus);
+ ipmiPrintAndRegister(intel::netFnGeneral,
+ intel::general::cmdGetOEMDeviceInfo, NULL,
+ ipmiOEMGetDeviceInfo, PRIVILEGE_USER);
- ipmiPrintAndRegister(
- netfnIntcOEMGeneral,
- static_cast<ipmi_cmd_t>(
- IPMINetfnIntelOEMGeneralCmd::cmdSetPowerRestoreDelay),
- NULL, ipmiOEMSetPowerRestoreDelay, PRIVILEGE_OPERATOR);
- ipmiPrintAndRegister(
- netfnIntcOEMGeneral,
- static_cast<ipmi_cmd_t>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetPowerRestoreDelay),
- NULL, ipmiOEMGetPowerRestoreDelay, PRIVILEGE_USER);
+ ipmiPrintAndRegister(intel::netFnGeneral,
+ intel::general::cmdGetAICSlotFRUIDSlotPosRecords, NULL,
+ ipmiOEMGetAICFRU, PRIVILEGE_USER);
- ipmi::registerHandler(
- ipmi::prioOpenBmcBase, ipmi::netFnOemOne,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdSetOEMUser2Activation),
- ipmi::Privilege::Callback, ipmiOEMSetUser2Activation);
+ registerHandler(prioOpenBmcBase, intel::netFnGeneral,
+ intel::general::cmdSendEmbeddedFWUpdStatus,
+ Privilege::Operator, ipmiOEMSendEmbeddedFwUpdStatus);
- ipmi::registerHandler(
- ipmi::prioOpenBmcBase, ipmi::netFnOemOne,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdSetSpecialUserPassword),
- ipmi::Privilege::Callback, ipmiOEMSetSpecialUserPassword);
+ ipmiPrintAndRegister(intel::netFnGeneral,
+ intel::general::cmdSetPowerRestoreDelay, NULL,
+ ipmiOEMSetPowerRestoreDelay, PRIVILEGE_OPERATOR);
+
+ ipmiPrintAndRegister(intel::netFnGeneral,
+ intel::general::cmdGetPowerRestoreDelay, NULL,
+ ipmiOEMGetPowerRestoreDelay, PRIVILEGE_USER);
+
+ registerHandler(prioOpenBmcBase, intel::netFnGeneral,
+ intel::general::cmdSetOEMUser2Activation,
+ Privilege::Callback, ipmiOEMSetUser2Activation);
+
+ registerHandler(prioOpenBmcBase, intel::netFnGeneral,
+ intel::general::cmdSetSpecialUserPassword,
+ Privilege::Callback, ipmiOEMSetSpecialUserPassword);
// <Get Processor Error Config>
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetProcessorErrConfig),
- ipmi::Privilege::User, ipmiOEMGetProcessorErrConfig);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdGetProcessorErrConfig, Privilege::User,
+ ipmiOEMGetProcessorErrConfig);
+
// <Set Processor Error Config>
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdSetProcessorErrConfig),
- ipmi::Privilege::Admin, ipmiOEMSetProcessorErrConfig);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdSetProcessorErrConfig, Privilege::Admin,
+ ipmiOEMSetProcessorErrConfig);
- ipmiPrintAndRegister(netfnIntcOEMGeneral,
- static_cast<ipmi_cmd_t>(
- IPMINetfnIntelOEMGeneralCmd::cmdSetShutdownPolicy),
- NULL, ipmiOEMSetShutdownPolicy, PRIVILEGE_ADMIN);
- ipmiPrintAndRegister(netfnIntcOEMGeneral,
- static_cast<ipmi_cmd_t>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetShutdownPolicy),
- NULL, ipmiOEMGetShutdownPolicy, PRIVILEGE_ADMIN);
+ ipmiPrintAndRegister(intel::netFnGeneral,
+ intel::general::cmdSetShutdownPolicy, NULL,
+ ipmiOEMSetShutdownPolicy, PRIVILEGE_ADMIN);
- ipmiPrintAndRegister(
- netfnIntcOEMGeneral,
- static_cast<ipmi_cmd_t>(IPMINetfnIntelOEMGeneralCmd::cmdSetFanConfig),
- NULL, ipmiOEMSetFanConfig, PRIVILEGE_USER);
+ ipmiPrintAndRegister(intel::netFnGeneral,
+ intel::general::cmdGetShutdownPolicy, NULL,
+ ipmiOEMGetShutdownPolicy, PRIVILEGE_ADMIN);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdGetFanConfig),
- ipmi::Privilege::User, ipmiOEMGetFanConfig);
+ ipmiPrintAndRegister(intel::netFnGeneral, intel::general::cmdSetFanConfig,
+ NULL, ipmiOEMSetFanConfig, PRIVILEGE_USER);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetFanSpeedOffset),
- ipmi::Privilege::User, ipmiOEMGetFanSpeedOffset);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdGetFanConfig, Privilege::User,
+ ipmiOEMGetFanConfig);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdSetFanSpeedOffset),
- ipmi::Privilege::User, ipmiOEMSetFanSpeedOffset);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdGetFanSpeedOffset, Privilege::User,
+ ipmiOEMGetFanSpeedOffset);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdSetFscParameter),
- ipmi::Privilege::User, ipmiOEMSetFscParameter);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdSetFanSpeedOffset, Privilege::User,
+ ipmiOEMSetFanSpeedOffset);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdGetFscParameter),
- ipmi::Privilege::User, ipmiOEMGetFscParameter);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdSetFscParameter, Privilege::User,
+ ipmiOEMSetFscParameter);
- ipmi::registerHandler(
- ipmi::prioOpenBmcBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdReadBaseBoardProductId),
- ipmi::Privilege::Admin, ipmiOEMReadBoardProductId);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdGetFscParameter, Privilege::User,
+ ipmiOEMGetFscParameter);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdGetNmiStatus),
- ipmi::Privilege::User, ipmiOEMGetNmiSource);
+ registerHandler(prioOpenBmcBase, intel::netFnGeneral,
+ intel::general::cmdReadBaseBoardProductId, Privilege::Admin,
+ ipmiOEMReadBoardProductId);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdSetNmiStatus),
- ipmi::Privilege::Operator, ipmiOEMSetNmiSource);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdGetNmiStatus, Privilege::User,
+ ipmiOEMGetNmiSource);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetEfiBootOptions),
- ipmi::Privilege::User, ipmiOemGetEfiBootOptions);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdSetNmiStatus, Privilege::Operator,
+ ipmiOEMSetNmiSource);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdSetEfiBootOptions),
- ipmi::Privilege::Operator, ipmiOemSetEfiBootOptions);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdGetEfiBootOptions, Privilege::User,
+ ipmiOemGetEfiBootOptions);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdGetSecurityMode),
- Privilege::User, ipmiGetSecurityMode);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdSetEfiBootOptions, Privilege::Operator,
+ ipmiOemSetEfiBootOptions);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdSetSecurityMode),
- Privilege::Admin, ipmiSetSecurityMode);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdGetSecurityMode, Privilege::User,
+ ipmiGetSecurityMode);
- ipmiPrintAndRegister(
- netfnIntcOEMGeneral,
- static_cast<ipmi_cmd_t>(IPMINetfnIntelOEMGeneralCmd::cmdGetLEDStatus),
- NULL, ipmiOEMGetLEDStatus, PRIVILEGE_ADMIN);
- ipmiPrintAndRegister(
- netfnIntcOEMPlatform,
- static_cast<ipmi_cmd_t>(
- IPMINetfnIntelOEMPlatformCmd::cmdCfgHostSerialPortSpeed),
- NULL, ipmiOEMCfgHostSerialPortSpeed, PRIVILEGE_ADMIN);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdSetFaultIndication),
- ipmi::Privilege::Operator, ipmiOEMSetFaultIndication);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdSetSecurityMode, Privilege::Admin,
+ ipmiSetSecurityMode);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdSetColdRedundancyConfig),
- ipmi::Privilege::User, ipmiOEMSetCRConfig);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(
- IPMINetfnIntelOEMGeneralCmd::cmdGetColdRedundancyConfig),
- ipmi::Privilege::User, ipmiOEMGetCRConfig);
+ ipmiPrintAndRegister(intel::netFnGeneral, intel::general::cmdGetLEDStatus,
+ NULL, ipmiOEMGetLEDStatus, PRIVILEGE_ADMIN);
- registerHandler(prioOemBase, netfn::intel::oemGeneral,
- netfn::intel::cmdRestoreConfiguration, Privilege::Admin,
+ ipmiPrintAndRegister(ipmi::intel::netFnPlatform,
+ ipmi::intel::platform::cmdCfgHostSerialPortSpeed, NULL,
+ ipmiOEMCfgHostSerialPortSpeed, PRIVILEGE_ADMIN);
+
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdSetFaultIndication, Privilege::Operator,
+ ipmiOEMSetFaultIndication);
+
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdSetColdRedundancyConfig, Privilege::User,
+ ipmiOEMSetCRConfig);
+
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdGetColdRedundancyConfig, Privilege::User,
+ ipmiOEMGetCRConfig);
+
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdRestoreConfiguration, Privilege::Admin,
ipmiRestoreConfiguration);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdSetDimmOffset),
- ipmi::Privilege::Operator, ipmiOEMSetDimmOffset);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdSetDimmOffset, Privilege::Operator,
+ ipmiOEMSetDimmOffset);
- ipmi::registerHandler(
- ipmi::prioOemBase, netfnIntcOEMGeneral,
- static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdGetDimmOffset),
- ipmi::Privilege::Operator, ipmiOEMGetDimmOffset);
+ registerHandler(prioOemBase, intel::netFnGeneral,
+ intel::general::cmdGetDimmOffset, Privilege::Operator,
+ ipmiOEMGetDimmOffset);
- ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnChassis,
- ipmi::chassis::cmdSetSystemBootOptions,
- ipmi::Privilege::Operator, ipmiOemSetBootOptions);
+ registerHandler(prioOemBase, netFnChassis, chassis::cmdSetSystemBootOptions,
+ Privilege::Operator, ipmiOemSetBootOptions);
}
} // namespace ipmi
diff --git a/src/sensorcommands.cpp b/src/sensorcommands.cpp
index 28d68f4..764efe7 100644
--- a/src/sensorcommands.cpp
+++ b/src/sensorcommands.cpp
@@ -1450,92 +1450,76 @@
ipmiSensorWildcardHandler, PRIVILEGE_USER);
// <Get Sensor Type>
- ipmiPrintAndRegister(
- NETFUN_SENSOR,
- static_cast<ipmi_cmd_t>(IPMINetfnSensorCmds::ipmiCmdGetSensorType),
- nullptr, ipmiSensorWildcardHandler, PRIVILEGE_USER);
+ ipmiPrintAndRegister(NETFUN_SENSOR, ipmi::sensor_event::cmdGetSensorType,
+ nullptr, ipmiSensorWildcardHandler, PRIVILEGE_USER);
// <Set Sensor Reading and Event Status>
ipmiPrintAndRegister(
- NETFUN_SENSOR,
- static_cast<ipmi_cmd_t>(
- IPMINetfnSensorCmds::ipmiCmdSetSensorReadingAndEventStatus),
+ NETFUN_SENSOR, ipmi::sensor_event::cmdSetSensorReadingAndEvtSts,
nullptr, ipmiSensorWildcardHandler, PRIVILEGE_OPERATOR);
// <Platform Event>
- ipmi::registerHandler(
- ipmi::prioOemBase, ipmi::netFnSensor,
- static_cast<ipmi::Cmd>(ipmi::sensor_event::cmdPlatformEvent),
- ipmi::Privilege::Operator, ipmiSenPlatformEvent);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnSensor,
+ ipmi::sensor_event::cmdPlatformEvent,
+ ipmi::Privilege::Operator, ipmiSenPlatformEvent);
// <Get Sensor Reading>
- ipmi::registerHandler(
- ipmi::prioOemBase, NETFUN_SENSOR,
- static_cast<ipmi::Cmd>(IPMINetfnSensorCmds::ipmiCmdGetSensorReading),
- ipmi::Privilege::User, ipmiSenGetSensorReading);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnSensor,
+ ipmi::sensor_event::cmdGetSensorReading,
+ ipmi::Privilege::User, ipmiSenGetSensorReading);
// <Get Sensor Threshold>
- ipmi::registerHandler(
- ipmi::prioOemBase, NETFUN_SENSOR,
- static_cast<ipmi::Cmd>(IPMINetfnSensorCmds::ipmiCmdGetSensorThreshold),
- ipmi::Privilege::User, ipmiSenGetSensorThresholds);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnSensor,
+ ipmi::sensor_event::cmdGetSensorThreshold,
+ ipmi::Privilege::User, ipmiSenGetSensorThresholds);
// <Set Sensor Threshold>
- ipmi::registerHandler(
- ipmi::prioOemBase, NETFUN_SENSOR,
- static_cast<ipmi::Cmd>(IPMINetfnSensorCmds::ipmiCmdSetSensorThreshold),
- ipmi::Privilege::Operator, ipmiSenSetSensorThresholds);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnSensor,
+ ipmi::sensor_event::cmdSetSensorThreshold,
+ ipmi::Privilege::Operator,
+ ipmiSenSetSensorThresholds);
// <Get Sensor Event Enable>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_SENSOR,
- static_cast<ipmi::Cmd>(
- IPMINetfnSensorCmds::ipmiCmdGetSensorEventEnable),
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnSensor,
+ ipmi::sensor_event::cmdGetSensorEventEnable,
ipmi::Privilege::User, ipmiSenGetSensorEventEnable);
// <Get Sensor Event Status>
ipmiPrintAndRegister(NETFUN_SENSOR,
- static_cast<ipmi_cmd_t>(
- IPMINetfnSensorCmds::ipmiCmdGetSensorEventStatus),
- nullptr, ipmiSenGetSensorEventStatus, PRIVILEGE_USER);
+ ipmi::sensor_event::cmdGetSensorEventStatus, nullptr,
+ ipmiSenGetSensorEventStatus, PRIVILEGE_USER);
// register all storage commands for both Sensor and Storage command
// versions
// <Get SDR Repository Info>
- ipmi::registerHandler(
- ipmi::prioOemBase, NETFUN_STORAGE,
- static_cast<ipmi::Cmd>(IPMINetfnStorageCmds::ipmiCmdGetRepositoryInfo),
- ipmi::Privilege::User, ipmiStorageGetSDRRepositoryInfo);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnStorage,
+ ipmi::storage::cmdGetSdrRepositoryInfo,
+ ipmi::Privilege::User,
+ ipmiStorageGetSDRRepositoryInfo);
// <Get SDR Allocation Info>
- ipmi::registerHandler(
- ipmi::prioOemBase, NETFUN_STORAGE,
- static_cast<ipmi::Cmd>(
- IPMINetfnStorageCmds::ipmiCmdGetSDRAllocationInfo),
- ipmi::Privilege::User, ipmiStorageGetSDRAllocationInfo);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnStorage,
+ ipmi::storage::cmdGetSdrRepositoryAllocInfo,
+ ipmi::Privilege::User,
+ ipmiStorageGetSDRAllocationInfo);
// <Reserve SDR Repo>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_SENSOR,
- static_cast<ipmi::Cmd>(
- IPMINetfnSensorCmds::ipmiCmdReserveDeviceSDRRepo),
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnSensor,
+ ipmi::sensor_event::cmdReserveDeviceSdrRepository,
ipmi::Privilege::User, ipmiStorageReserveSDR);
- ipmi::registerHandler(
- ipmi::prioOemBase, NETFUN_STORAGE,
- static_cast<ipmi::Cmd>(IPMINetfnStorageCmds::ipmiCmdReserveSDR),
- ipmi::Privilege::User, ipmiStorageReserveSDR);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnStorage,
+ ipmi::storage::cmdReserveSdrRepository,
+ ipmi::Privilege::User, ipmiStorageReserveSDR);
// <Get Sdr>
- ipmi::registerHandler(
- ipmi::prioOemBase, NETFUN_SENSOR,
- static_cast<ipmi::Cmd>(IPMINetfnSensorCmds::ipmiCmdGetDeviceSDR),
- ipmi::Privilege::User, ipmiStorageGetSDR);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnSensor,
+ ipmi::sensor_event::cmdGetDeviceSdr,
+ ipmi::Privilege::User, ipmiStorageGetSDR);
- ipmi::registerHandler(
- ipmi::prioOemBase, NETFUN_STORAGE,
- static_cast<ipmi::Cmd>(IPMINetfnStorageCmds::ipmiCmdGetSDR),
- ipmi::Privilege::User, ipmiStorageGetSDR);
-
- return;
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::netFnStorage,
+ ipmi::storage::cmdGetSdr, ipmi::Privilege::User,
+ ipmiStorageGetSDR);
}
} // namespace ipmi
diff --git a/src/smbioshandler.cpp b/src/smbioshandler.cpp
index 9eebf7f..6e3cff9 100644
--- a/src/smbioshandler.cpp
+++ b/src/smbioshandler.cpp
@@ -471,27 +471,24 @@
{
// MDR V1 Command
// <Get MDR Status Command>
- ipmi_register_callback(NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDR_STATUS, NULL,
+ ipmi_register_callback(ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrStatus, NULL,
cmd_region_status, PRIVILEGE_OPERATOR);
// <Update Complete Status Command>
- ipmi_register_callback(NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDR_COMPLETE, NULL,
+ ipmi_register_callback(ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrComplete, NULL,
cmd_region_complete, PRIVILEGE_OPERATOR);
// <Read MDR Command>
- ipmi_register_callback(NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDR_READ, NULL,
- cmd_region_read, PRIVILEGE_OPERATOR);
+ ipmi_register_callback(ipmi::intel::netFnApp, ipmi::intel::app::cmdMdrRead,
+ NULL, cmd_region_read, PRIVILEGE_OPERATOR);
// <Write MDR Command>
- ipmi_register_callback(NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDR_WRITE, NULL,
- cmd_region_write, PRIVILEGE_OPERATOR);
+ ipmi_register_callback(ipmi::intel::netFnApp, ipmi::intel::app::cmdMdrWrite,
+ NULL, cmd_region_write, PRIVILEGE_OPERATOR);
// <Lock MDR Command>
- ipmi_register_callback(NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDR_LOCK, NULL,
- cmd_region_lock, PRIVILEGE_OPERATOR);
+ ipmi_register_callback(ipmi::intel::netFnApp, ipmi::intel::app::cmdMdrLock,
+ NULL, cmd_region_lock, PRIVILEGE_OPERATOR);
}
diff --git a/src/smbiosmdrv2handler.cpp b/src/smbiosmdrv2handler.cpp
index 18aff58..52d23ad 100644
--- a/src/smbiosmdrv2handler.cpp
+++ b/src/smbiosmdrv2handler.cpp
@@ -26,6 +26,7 @@
#include <fstream>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
+#include <oemcommands.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/message/types.hpp>
#include <smbiosmdrv2handler.hpp>
@@ -1252,63 +1253,62 @@
{
// MDR V2 Command
// <Get MDRII Status Command>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_AGENT_STATUS,
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIIAgentStatus,
ipmi::Privilege::Operator, mdr2AgentStatus);
// <Get MDRII Directory Command>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_GET_DIR,
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIIGetDir,
ipmi::Privilege::Operator, mdr2GetDir);
// <Send MDRII Directory Command>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_SEND_DIR,
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIISendDir,
ipmi::Privilege::Operator, mdr2SendDir);
// <Get MDRII Data Info Command>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_GET_DATA_INFO,
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIIGetDataInfo,
ipmi::Privilege::Operator, mdr2GetDataInfo);
// <Send MDRII Info Offer>
- ipmi::registerHandler(
- ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_SEND_DATA_INFO_OFFER,
- ipmi::Privilege::Operator, mdr2DataInfoOffer);
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIISendDataInfoOffer,
+ ipmi::Privilege::Operator, mdr2DataInfoOffer);
// <Send MDRII Data Info>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_SEND_DATA_INFO,
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIISendDataInfo,
ipmi::Privilege::Operator, mdr2SendDataInfo);
// <Get MDRII Data Block Command>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_GET_DATA_BLOCK,
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIIGetDataBlock,
ipmi::Privilege::Operator, mdr2GetDataBlock);
// <Send MDRII Data Block>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_SEND_DATA_BLOCK,
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIISendDataBlock,
ipmi::Privilege::Operator, mdr2SendDataBlock);
// <Lock MDRII Data Command>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_LOCK_DATA,
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIILockData,
ipmi::Privilege::Operator, mdr2LockData);
// <Unlock MDRII Data Command>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_UNLOCK_DATA,
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIIUnlockData,
ipmi::Privilege::Operator, mdr2UnlockData);
// <Send MDRII Data Start>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_DATA_START,
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIIDataStart,
ipmi::Privilege::Operator, cmd_mdr2_data_start);
// <Send MDRII Data Done>
- ipmi::registerHandler(ipmi::prioOemBase, NETFUN_INTEL_APP_OEM,
- IPMI_NETFN_INTEL_OEM_APP_CMD::MDRII_DATA_DONE,
+ ipmi::registerHandler(ipmi::prioOemBase, ipmi::intel::netFnApp,
+ ipmi::intel::app::cmdMdrIIDataDone,
ipmi::Privilege::Operator, cmd_mdr2_data_done);
}
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 8c716c2..1db2f0d 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -1108,7 +1108,7 @@
// <Add SEL Entry>
ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage,
- static_cast<ipmi::Cmd>(ipmi::storage::cmdAddSelEntry),
+ ipmi::storage::cmdAddSelEntry,
ipmi::Privilege::Operator, ipmiStorageAddSELEntry);
// <Clear SEL>