Skip to content

Commit

Permalink
correctly propogate bad return code from p9_adu_coherent_status_check
Browse files Browse the repository at this point in the history
p9_adu_access.C
p9_adu_setup.C
  save current_err to local return code object at start of exit path,
  and return the saved value at exit (prior code was clobbering
  current_err by call to cleanup routines)

Change-Id: I2f247ba2e93c673b3581e3ebe1504d4f05cb3a24
CQ: SW434090
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/60607
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/60618
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
  • Loading branch information
jjmcgill authored and sgupta2m committed Jun 19, 2018
1 parent e746b0c commit c7e1778
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/import/chips/p9/procedures/hwp/nest/p9_adu_access.C
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ extern "C" {

bool l_busyBitStatus = false;
adu_status_busy_handler l_busyHandling;
fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;

// mark HWP entry
FAPI_DBG("Entering ...\n");
Expand Down Expand Up @@ -147,8 +148,11 @@ extern "C" {

fapi_try_exit:

l_rc = fapi2::current_err;
FAPI_DBG("Error to return : %08X", (uint64_t) l_rc);

//If there is an error and we want to cleanup the ADU
if ( fapi2::current_err && l_myAduFlag.getOperFailCleanup() )
if ( l_rc && l_myAduFlag.getOperFailCleanup() )
{
//reset the ADU
(void) p9_adu_coherent_utils_reset_adu(i_target);
Expand All @@ -160,16 +164,16 @@ extern "C" {
//Append the input data to an error if we got an error back
#ifndef __PPE__

if (fapi2::current_err)
if (l_rc)
{
p9_adu_coherent_append_input_data(i_address, i_rnw, i_flags, fapi2::current_err);
p9_adu_coherent_append_input_data(i_address, i_rnw, i_flags, l_rc);
}

#endif

FAPI_DBG("Exiting...");
FAPI_DBG("Exiting with return code : %08X...", (uint64_t) l_rc);
//Return the error that we got from up above
return fapi2::current_err;
return l_rc;
}

} // extern "C"
12 changes: 8 additions & 4 deletions src/import/chips/p9/procedures/hwp/nest/p9_adu_setup.C
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ extern "C"
uint32_t& o_numGranules)
{
//return code
fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;
uint32_t num_attempts = 1;
bool lock_pick = false;

Expand Down Expand Up @@ -129,9 +130,12 @@ extern "C"

fapi_try_exit:

l_rc = fapi2::current_err;
FAPI_DBG("Error to return : %08X", (uint64_t) l_rc);

//if an error has occurred, ADU is dirty, and instructed to clean up,
//attempt to reset ADU and free lock (propogate rc of original fail)
if (fapi2::current_err && adu_is_dirty && !adu_leave_dirty)
if (l_rc && adu_is_dirty && !adu_leave_dirty)
{
(void) p9_adu_coherent_utils_reset_adu(i_target);
(void) p9_adu_coherent_manage_lock(i_target, false, false, num_attempts);
Expand All @@ -140,15 +144,15 @@ extern "C"
//Append the input data to an error if we got an error back
#ifndef __PPE__

if (fapi2::current_err)
if (l_rc)
{
p9_adu_coherent_append_input_data(i_address, i_rnw, i_flags, fapi2::current_err);
}

#endif

FAPI_DBG("Exiting...");
return fapi2::current_err;
FAPI_DBG("Exiting with return code : %08X...", (uint64_t) l_rc);
return l_rc;
}

} // extern "C"
Expand Down

0 comments on commit c7e1778

Please sign in to comment.