diff options
author | Elizabeth Liner <eliner@us.ibm.com> | 2016-01-18 11:27:52 -0600 |
---|---|---|
committer | Stephen Cprek <smcprek@us.ibm.com> | 2016-02-19 17:06:15 -0600 |
commit | 6e1541d8bb6fbdbccf963941db9ab79bae2365e9 (patch) | |
tree | 3ca32ba7752a048e8775fe5074c4b539ac0dc71f /src/usr/ipmi | |
parent | ecb3640364de919e9a22683338cb46b8858073ca (diff) | |
download | talos-hostboot-6e1541d8bb6fbdbccf963941db9ab79bae2365e9.tar.gz talos-hostboot-6e1541d8bb6fbdbccf963941db9ab79bae2365e9.zip |
Set watchdog and set sensors are now asynchronous sends
Backport: master-p8
Change-Id: If8741e67986c6d6df95a655fb5669df764649e82
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/18993
Tested-by: Jenkins Server
Reviewed-by: Brian Silver <bsilver@us.ibm.com>
Reviewed-by: Richard J. Knight <rjknight@us.ibm.com>
Reviewed-by: WILLIAM G. HOFFA <wghoffa@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/ipmi')
-rw-r--r-- | src/usr/ipmi/ipmisensor.C | 38 | ||||
-rw-r--r-- | src/usr/ipmi/ipmiwatchdog.C | 20 | ||||
-rw-r--r-- | src/usr/ipmi/runtime/rt_ipmirp.C | 33 |
3 files changed, 44 insertions, 47 deletions
diff --git a/src/usr/ipmi/ipmisensor.C b/src/usr/ipmi/ipmisensor.C index 621aa7cf1..69a58dd95 100644 --- a/src/usr/ipmi/ipmisensor.C +++ b/src/usr/ipmi/ipmisensor.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* Contributors Listed Below - COPYRIGHT 2014,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -58,13 +58,9 @@ namespace SENSOR SensorBase::~SensorBase() { // The memory allocated for the set sensor reading command is deleted - // by the IPMI transport layer, this delete will get delete the memory - // allocated by the IPMI transport layer which contains the response - // to the set sensor reading command. - if( iv_msg ) - { - delete[] iv_msg; - } + // by the IPMI transport layer. Since we are sending messages + // asynchronously, the IPMI resource provider deletes the message + // and there is nothing to delete here. }; // @@ -208,24 +204,14 @@ namespace SENSOR if( iv_msg->iv_sensor_number != TARGETING::UTIL::INVALID_IPMI_SENSOR ) { - IPMI::completion_code l_rc = IPMI::CC_UNKBAD; - - // iv_msg is deleted by the destructor - l_err = sendSetSensorReading( iv_msg, l_rc); + // iv_msg is deleted by the IPMI resource provider. + l_err = sendSetSensorReading( iv_msg); if( l_err ) { TRACFCOMP(g_trac_ipmi,"error returned from " "sendSetSensorReading() for sensor number 0x%x", getSensorNumber()); - - // return error log to caller - } - else - { - // check the completion code to see if we need to generate a - // PEL. - l_err = processCompletionCode( l_rc ); } } else @@ -369,21 +355,17 @@ namespace SENSOR }; // - // Synchronously send a set sensor reading command to the BMC, - // the response is returned with the io_data pointer + // Asynchronously send a set sensor reading command to the BMC. // errlHndl_t SensorBase::sendSetSensorReading( - setSensorReadingRequest *& io_data, - IPMI::completion_code& o_completion_code ) + setSensorReadingRequest * i_data) { size_t l_len = sizeof( setSensorReadingRequest ); - o_completion_code = IPMI::CC_UNKBAD; - // i_data will hold the response when this returns - errlHndl_t l_err = sendrecv(IPMI::set_sensor_reading(), - o_completion_code, l_len, (uint8_t *&)io_data); + errlHndl_t l_err = send(IPMI::set_sensor_reading(), + l_len, (uint8_t *)i_data); return l_err; } diff --git a/src/usr/ipmi/ipmiwatchdog.C b/src/usr/ipmi/ipmiwatchdog.C index 75d875878..e232569a6 100644 --- a/src/usr/ipmi/ipmiwatchdog.C +++ b/src/usr/ipmi/ipmiwatchdog.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* Contributors Listed Below - COPYRIGHT 2014,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -61,8 +61,6 @@ errlHndl_t setWatchDogTimer( const uint16_t i_countdown_secs, const TIMER_ACTIONS i_timer_action, const TIMER_USE_CLR_FLAGS i_timer_clr_flag) { - errlHndl_t err_ipmi = NULL; - // Convert secs into lsb and msb values // the ipmi spec uses the count which is 100ms/count static const uint16_t ms_per_count = 100; @@ -85,8 +83,6 @@ errlHndl_t setWatchDogTimer( const uint16_t i_countdown_secs, //create request data buffer uint8_t* data = new uint8_t[len]; - IPMI::completion_code cc = IPMI::CC_UNKBAD; - data[0] = i_timer_use; // byte 1 timer use data[1] = i_timer_action; // byte 2 timer actions data[2] = 0x00; // byte 3 pre-interval timeout in secs @@ -94,20 +90,8 @@ errlHndl_t setWatchDogTimer( const uint16_t i_countdown_secs, data[4] = init_countdown_lsb; // byte 5 initial countdown timer LSByte data[5] = init_countdown_msb; // byte 6 initial countdown timer MSByte - err_ipmi = IPMI::sendrecv(IPMI::set_watchdog(), cc, len, data); - - //cleanup buffer - delete[] data; data = NULL; + return IPMI::send(IPMI::set_watchdog(), len, data); - if(cc != IPMI::CC_OK) - { - IPMI_TRAC("Watchdog: BMC returned not ok CC[%x]",cc); - // should we log error and then retry? - // what happens if the communication is broken - // reset will try and set it again. - } - - return err_ipmi; } diff --git a/src/usr/ipmi/runtime/rt_ipmirp.C b/src/usr/ipmi/runtime/rt_ipmirp.C index f3bb8c714..69d7c4feb 100644 --- a/src/usr/ipmi/runtime/rt_ipmirp.C +++ b/src/usr/ipmi/runtime/rt_ipmirp.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -157,4 +157,35 @@ namespace IPMI return err; } // sendrecv + + /* + * @brief Asynchronus message send + * + * @param[in] i_cmd, the command we're sending + * @param[in] i_len, the length of the data + * @param[in] i_data, the data we're sending + * @param[in] i_type, the type of message we're sending + * + */ + errlHndl_t send(const IPMI::command_t& i_cmd, + size_t i_len, uint8_t* i_data, + IPMI::message_type i_type) + { + IPMI::completion_code l_cc = IPMI::CC_UNKBAD; + + // We are calling a synchronous send in an asynchronous function + // This is needed to enable asynchronous message sending before + // runtime. A message should be synchronous during runtime, but + // by ignoring the cc returned and clearing the data, we're making + // a synchronous function "asynchronous". + errlHndl_t l_err = sendrecv(i_cmd,l_cc,i_len,i_data); + + if(i_data != NULL) + { + delete i_data; + } + + return l_err; + } + }; |