From 54fa13068e049ac8fe866ad2d96f89f1623c6645 Mon Sep 17 00:00:00 2001 From: Marri Devender Rao Date: Mon, 7 May 2018 01:06:23 -0500 Subject: Fix get boot options returning unexpected results Get boot options is returning wrong value when boot device is set to cdrom followed by setting boot device to bios. In the IPMI spec the boot device selector has options for both "boot source" (default/disk/crdom/network) and "boot mode" (default/bios/safe/diag). Since this isn't a bit field, you can't override for eg both the source and mode at the same time. The solution is if a set boot device is mapping to a boot source, then reset the boot mode D-Bus property to default, or vice versa. This way the ipmid code can determine which property is not at the default value Resolves openbmc/openbmc#3067 Resolves openbmc/openbmc#3068 Change-Id: I072c82a161d56f118510fe1f9e5c75cb5c610295 Signed-off-by: Marri Devender Rao --- chassishandler.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/chassishandler.cpp b/chassishandler.cpp index 9c0a97b..0ee593c 100644 --- a/chassishandler.cpp +++ b/chassishandler.cpp @@ -1446,6 +1446,14 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd, *data_len = 0; return rc; } + // If a set boot device is mapping to a boot source, then reset + // the boot mode D-Bus property to default. + // This way the ipmid code can determine which property is not + // at the default value + if(sourceItr->second != Source::Sources::Default) + { + setBootMode(Mode::Modes::Regular); + } } if (modeIpmiToDbus.end() != modeItr) { @@ -1455,6 +1463,14 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd, *data_len = 0; return rc; } + // If a set boot device is mapping to a boot mode, then reset + // the boot source D-Bus property to default. + // This way the ipmid code can determine which property is not + // at the default value + if(modeItr->second != Mode::Modes::Regular) + { + setBootSource(Source::Sources::Default); + } } } catch (InternalFailure& e) -- cgit v1.2.1