Remove the override set boot option command for set-in-progress state
The get/set boot option commands are sharing a variable
for the set-in-progress state.Both of them need to be in the same file.
The override is used to disable safe boot mode support on Intel platforms.
Currently host-ipmi supports a new added compile option to disable it,
the override can be removed to re-use the implementation in host-ipmi.
Tested:
// set safe mode boot option fail
// after enabled the disable-boot-flag-safe-mode-support in ipmi-host
ipmitool raw 0x00 0x08 0x05 0x80 0x0c
Unable to send RAW command (channel=0x0 netfn=0x0 lun=0x0 cmd=0x8 rsp=0xcc):
Invalid data field in request
// bootdev command works
ipmitool chassis bootdev bios
Set Boot Device to bios
Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
Change-Id: Id5d2f1a039d679dda445005d56381d7239ee6593
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index b7f6bd1..a6eb4a1 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -3221,126 +3221,6 @@
return ipmi::responseSuccess();
}
-ipmi::RspType<>
- ipmiOemSetBootOptions(uint8_t bootFlag, uint8_t bootParam,
- std::optional<uint8_t> bootOption,
- std::optional<std::array<uint8_t, 3>> bootResv)
-{
- bool oneTimeEnabled = false;
- uint8_t bootOptionValue = 0;
- static constexpr const uint8_t shiftBits = 2;
-
- if (bootFlag ==
- static_cast<uint8_t>(boot_options::BootOptionParameter::setInProgress))
- {
- if (bootOption)
- {
- return ipmi::responseReqDataLenInvalid();
- }
-
- boot_options::transferStatus = bootParam;
- return ipmi::responseSuccess();
- }
-
- if (bootFlag !=
- static_cast<uint8_t>(boot_options::BootOptionParameter::bootFlags))
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "Unsupported parameter");
- return ipmi::responseResponseError();
- }
-
- if (!bootOption)
- {
- return ipmi::responseReqDataLenInvalid();
- }
- bootOptionValue =
- (bootOption.value() & boot_options::bootSourceMask) >> shiftBits;
-
- try
- {
- bool permanent =
- (bootParam & boot_options::setParmBootFlagsPermanent) ==
- boot_options::setParmBootFlagsPermanent;
- auto bootMode = boot_options::Mode::Modes::Regular;
- auto bootSource = boot_options::Source::Sources::Default;
-
- // read one time Enabled property
- std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- std::string service = getService(*dbus, boot_options::enabledIntf,
- boot_options::oneTimePath);
- Value variant = getDbusProperty(
- *dbus, service, boot_options::oneTimePath,
- boot_options::enabledIntf, boot_options::oneTimeBootEnableProp);
- auto pTmp = std::get_if<bool>(&variant);
- if (pTmp != nullptr)
- {
- oneTimeEnabled = *pTmp;
- }
-
- /*
- * Check if the current boot setting is onetime or permanent, if the
- * request in the command is otherwise, then set the "Enabled"
- * property in one_time object path to 'True' to indicate onetime
- * and 'False' to indicate permanent.
- *
- * Once the onetime/permanent setting is applied, then the bootMode
- * and bootSource is updated for the corresponding object.
- */
- if (permanent == oneTimeEnabled)
- {
- setDbusProperty(*dbus, service, boot_options::oneTimePath,
- boot_options::enabledIntf,
- boot_options::oneTimeBootEnableProp, !permanent);
- oneTimeEnabled = !permanent;
- }
-
- // set BootSource and BootMode properties
- // according to oneTimeEnable or persistent
- auto bootObjPath = boot_options::oneTimePath;
- if (oneTimeEnabled == false)
- {
- bootObjPath = boot_options::persistentObjPath;
- }
-
- auto modeItr = boot_options::modeIpmiToDbus.find(bootOptionValue);
- auto sourceItr = boot_options::sourceIpmiToDbus.find(bootOptionValue);
-
- if (boot_options::sourceIpmiToDbus.end() != sourceItr)
- {
- bootSource = sourceItr->second;
- }
-
- if (boot_options::modeIpmiToDbus.end() != modeItr)
- {
- bootMode = modeItr->second;
- }
-
- if ((boot_options::modeIpmiToDbus.end() == modeItr) &&
- (boot_options::sourceIpmiToDbus.end() == sourceItr))
- {
- // return error if boot option is not supported
- return ipmi::responseInvalidFieldRequest();
- }
- service = getService(*dbus, boot_options::bootModeIntf, bootObjPath);
- setDbusProperty(*dbus, service, bootObjPath, boot_options::bootModeIntf,
- boot_options::bootModeProp,
- convertForMessage(bootMode));
-
- service = getService(*dbus, boot_options::bootSourceIntf, bootObjPath);
- setDbusProperty(
- *dbus, service, bootObjPath, boot_options::bootSourceIntf,
- boot_options::bootSourceProp, convertForMessage(bootSource));
- }
- catch (sdbusplus::exception_t& e)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
- return ipmi::responseResponseError();
- }
-
- return ipmi::responseSuccess();
-}
-
using BasicVariantType =
std::variant<std::vector<std::string>, std::vector<uint64_t>, std::string,
int64_t, uint64_t, double, int32_t, uint32_t, int16_t,
@@ -3606,9 +3486,6 @@
intel::general::cmdGetDimmOffset, Privilege::Operator,
ipmiOEMGetDimmOffset);
- registerHandler(prioOemBase, netFnChassis, chassis::cmdSetSystemBootOptions,
- Privilege::Operator, ipmiOemSetBootOptions);
-
registerHandler(prioOemBase, intel::netFnGeneral,
intel::general::cmdGetPSUVersion, Privilege::User,
ipmiOEMGetPSUVersion);