summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Derksen <mderkse1@us.ibm.com>2017-12-14 11:52:15 -0600
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2017-12-21 16:51:42 -0500
commit6141805efc9ca2e9109ca29c837ee3f51d63b141 (patch)
treede6945f3e0ee156a152a9829467bb8cf09199c8a /src
parent25cb28c5a6cf36e77719a1ae3e8bd142e09cd491 (diff)
downloadtalos-hostboot-6141805efc9ca2e9109ca29c837ee3f51d63b141.tar.gz
talos-hostboot-6141805efc9ca2e9109ca29c837ee3f51d63b141.zip
Add HB_VOLATILE sensor so OpenBMC can mark volatile sections
Set sensor to 1 to tell OpenBMC code to allow hostboot volatile section to be cleared. RTC: 180772 Change-Id: Id63e3ae8a24facd5e01e8bf94688a60f066ba838 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/51101 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/ipmi/ipmi_reasoncodes.H1
-rw-r--r--src/include/usr/ipmi/ipmisensor.H68
-rw-r--r--src/usr/ipmi/ipmisensor.C79
-rw-r--r--src/usr/isteps/istep16/call_host_ipl_complete.C21
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/attribute_types_hb.xml4
5 files changed, 172 insertions, 1 deletions
diff --git a/src/include/usr/ipmi/ipmi_reasoncodes.H b/src/include/usr/ipmi/ipmi_reasoncodes.H
index 972391675..65d8e64d3 100644
--- a/src/include/usr/ipmi/ipmi_reasoncodes.H
+++ b/src/include/usr/ipmi/ipmi_reasoncodes.H
@@ -43,6 +43,7 @@ namespace IPMI
MOD_IPMISENSOR_ENTITY_ID = 0x09, // IPMI::getSensorEntityId
MOD_IPMISENSOR_NAME = 0x0A, // IPMI::getSensorName
MOD_IPMISENSOR_REBOOTCNTRL = 0x0B, // IPMI::SENSOR getRebootControl
+ MOD_IPMISENSOR_HBVOLATILE = 0x0C, // IPMI::SENSOR getHbVolatile
};
enum IPMIReasonCode
diff --git a/src/include/usr/ipmi/ipmisensor.H b/src/include/usr/ipmi/ipmisensor.H
index 15499ce13..676833309 100644
--- a/src/include/usr/ipmi/ipmisensor.H
+++ b/src/include/usr/ipmi/ipmisensor.H
@@ -908,6 +908,74 @@ namespace SENSOR
GpuSensor();
};
+
+ /**
+ * @class HbVolatileSensor
+ *
+ * @brief Specialized class for the hostboot volatile memory setup
+ *
+ * @par Detailed Description:
+ * Provides the functionality needed by OpenBMC to set hostboot
+ * section as volatile or not
+ *
+ * Usage:
+ * HbVolatileSensor l_hbVolatileCtl;
+ * l_hbVolatileCtl.setHbVolatile( HbVolatileSensor::ENABLE_VOLATILE );
+ * l_hbVolatileCtl.setHbVolatile( HbVolatileSensor::DISABLE_VOLATILE );
+ *
+ */
+ class HbVolatileSensor : public SensorBase
+ {
+
+ public:
+
+ /**
+ * @enum hbVolatileSetting
+ * enum to define the contr
+ */
+ enum hbVolatileSetting
+ {
+ DISABLE_VOLATILE = 0x00, // (default)
+ ENABLE_VOLATILE = 0x01, // allow volatile memory to be cleared
+ };
+
+ /**
+ * @brief Constructor for the HbVolatileSensor
+ *
+ * The system target holds the IPMI sensor number for this sensor.
+ *
+ */
+ HbVolatileSensor();
+
+ /**
+ * @brief Destructor for the HbVolatileSensor
+ *
+ */
+ ~HbVolatileSensor();
+
+ /**
+ * @brief Set hostboot volatile section to volatile or not
+ *
+ * @param[in] i_setting - enable/disable volatility of section
+ *
+ * @return Errorlog handle
+ *
+ */
+ errlHndl_t setHbVolatile( hbVolatileSetting i_setting );
+
+ /**
+ * @brief get the value of the hostboot volatile
+ * section from the BMC.
+ *
+ * @param[o] i_setting - value = volatile or not
+ *
+ * @return Errorlog handle
+ *
+ */
+ errlHndl_t getHbVolatile( hbVolatileSetting & o_setting );
+
+ };
+
/**
* @brief Updates initial state of Hostboot relevant fault sensors on the
* BMC
diff --git a/src/usr/ipmi/ipmisensor.C b/src/usr/ipmi/ipmisensor.C
index 5eb850c6a..fadb65e05 100644
--- a/src/usr/ipmi/ipmisensor.C
+++ b/src/usr/ipmi/ipmisensor.C
@@ -1679,4 +1679,83 @@ namespace SENSOR
} // end of GPU loop
} // end of if check for non-default values
} // end of updateGpuSensorStatus()
+
+
+ //
+ // HbVolatileSensor constructor - uses system target
+ //
+ HbVolatileSensor::HbVolatileSensor()
+ :SensorBase(TARGETING::SENSOR_NAME_HB_VOLATILE, NULL)
+ {
+ // message buffer created and initialized in base object.
+ }
+
+ //
+ // HbVolatileSensor destructor
+ //
+ HbVolatileSensor::~HbVolatileSensor(){};
+
+ //
+ // setHbVolatile - tell BMC to make hostboot volatile memory
+ // (volatile(1) or not(0))
+ //
+ errlHndl_t HbVolatileSensor::setHbVolatile( hbVolatileSetting i_setting )
+ {
+ // adjust the operation to overwrite the sensor reading
+ // to the value we send.
+ iv_msg->iv_operation = SET_SENSOR_VALUE_OPERATION;
+
+ // the HB_VOLATILE Sensor is defined as a discrete sensor
+ // but the assertion bytes are being used to transfer the state
+ iv_msg->iv_assertion_mask = le16toh(i_setting);
+
+ TRACFCOMP(g_trac_ipmi,"HbVolatileSensor::setHbVolatile(%d)",
+ i_setting);
+
+ return writeSensorData();
+ }
+
+ //
+ // getHbVolatile - get the HB volatile memory setting from the BMC
+ //
+ errlHndl_t HbVolatileSensor::getHbVolatile( hbVolatileSetting &o_setting )
+ {
+ // the HB_VOLATILE sensor is defined as a discrete sensor
+ getSensorReadingData l_data;
+
+ errlHndl_t l_err = readSensorData( l_data );
+
+ if( l_err == nullptr )
+ {
+ // check if in valid range of hbVolatileSetting enums
+ if (l_data.event_status <= ENABLE_VOLATILE)
+ {
+ o_setting = static_cast<hbVolatileSetting>(l_data.event_status);
+ }
+ else
+ {
+ TRACFCOMP(g_trac_ipmi,"Unknown hb volatile setting: %d",
+ l_data.event_status);
+
+ /*@
+ * @errortype ERRL_SEV_UNRECOVERABLE
+ * @moduleid IPMI::MOD_IPMISENSOR_HBVOLATILE
+ * @reasoncode IPMI::RC_INVALID_SENSOR_SETTING
+ * @userdata1 Invalid hb volatile control setting
+ * @userdata2 <unused>
+ * @devdesc The sensor returned an invalid setting
+ * @custdesc Unable to find a valid sensor setting.
+ */
+ l_err = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ IPMI::MOD_IPMISENSOR_HBVOLATILE,
+ IPMI::RC_INVALID_SENSOR_SETTING,
+ l_data.event_status,
+ 0,
+ false);
+ }
+ }
+ return l_err;
+ }
+
}; // end name space
diff --git a/src/usr/isteps/istep16/call_host_ipl_complete.C b/src/usr/isteps/istep16/call_host_ipl_complete.C
index 40484d107..484faa070 100644
--- a/src/usr/isteps/istep16/call_host_ipl_complete.C
+++ b/src/usr/isteps/istep16/call_host_ipl_complete.C
@@ -48,7 +48,9 @@
#include <util/utilsemipersist.H>
#include <hwas/common/deconfigGard.H>
-
+#ifdef CONFIG_BMC_IPMI
+#include <ipmi/ipmisensor.H>
+#endif
using namespace ERRORLOG;
using namespace TARGETING;
using namespace ISTEP;
@@ -88,6 +90,23 @@ void* call_host_ipl_complete (void *io_pArgs)
errlCommit( l_err, ISTEP_COMP_ID );
}
+#ifdef CONFIG_BMC_IPMI
+ // Alert BMC to clear HB volatile memory
+ SENSOR::HbVolatileSensor l_hbVolatileCtl;
+ l_err = l_hbVolatileCtl.setHbVolatile(
+ SENSOR::HbVolatileSensor::ENABLE_VOLATILE );
+ if(l_err)
+ {
+ TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
+ "Failure in notifying BMC to clear hostboot volatile section,"
+ " RC=%X", ERRL_GETRC_SAFE(l_err) );
+
+ // This error could come from OpenPower system without
+ // updated OpenBMC code so just delete the error
+ delete l_err;
+ l_err = nullptr;
+ }
+#endif
// Setup the TCEs needed for the FSP to DMA the PAYLOAD
if (TCE::utilUseTcesForDmas())
diff --git a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
index 28e58dbe4..a28b7e96f 100755
--- a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
@@ -521,6 +521,10 @@
<value>0x0C20</value>
</enumerator>
<enumerator>
+ <name>HB_VOLATILE</name>
+ <value>0x0C21</value>
+ </enumerator>
+ <enumerator>
<name>MEMBUF_STATE</name>
<value>0x0CD1</value>
</enumerator>
OpenPOWER on IntegriCloud