Skip to content

Commit

Permalink
Mem interface fapi rc check
Browse files Browse the repository at this point in the history
Propogate fapi rc properly and break access on setup failure

Change-Id: If4c308fab0f67237fbb4faf7869a49d6c7ef3af7
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40743
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
  • Loading branch information
Shakeebbk authored and sgupta2m committed May 19, 2017
1 parent db756f4 commit 3b3b66a
Showing 1 changed file with 44 additions and 33 deletions.
77 changes: 44 additions & 33 deletions src/sbefw/sbeMemAccessInterface.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/* OpenPOWER sbe Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
Expand Down Expand Up @@ -81,28 +82,35 @@ ReturnCode sbeMemAccessInterface::accessGranule()
{
ReturnCode l_fapiRc = FAPI2_RC_SUCCESS;

// Check if we need to do a setup before access
if(iv_maxGranule == 0)
{
l_fapiRc = setup();
}
if(iv_interface == SBE_MEM_ACCESS_PBA)
{
// Call PBA access for read/write
SBE_EXEC_HWP(l_fapiRc,
p9_pba_access,
plat_getChipTarget(),
iv_addr,
(iv_mode == SBE_MEM_ACCESS_READ),
((p9_PBA_oper_flag*)iv_flags)->setFlag(),
(iv_currGranule == 0),
(iv_lastGranule || (iv_maxGranule == 1)),
(uint8_t *)&iv_buffer);
}
if(iv_interface == SBE_MEM_ACCESS_ADU)
do
{
// Call ADU access HWP for ADU write/read request
SBE_EXEC_HWP(l_fapiRc,
// Check if we need to do a setup before access
if(iv_maxGranule == 0)
{
l_fapiRc = setup();
// if setup returns error
if( l_fapiRc != FAPI2_RC_SUCCESS )
{
break;
}
}
if(iv_interface == SBE_MEM_ACCESS_PBA)
{
// Call PBA access for read/write
SBE_EXEC_HWP(l_fapiRc,
p9_pba_access,
plat_getChipTarget(),
iv_addr,
(iv_mode == SBE_MEM_ACCESS_READ),
((p9_PBA_oper_flag*)iv_flags)->setFlag(),
(iv_currGranule == 0),
(iv_lastGranule || (iv_maxGranule == 1)),
(uint8_t *)&iv_buffer);
}
if(iv_interface == SBE_MEM_ACCESS_ADU)
{
// Call ADU access HWP for ADU write/read request
SBE_EXEC_HWP(l_fapiRc,
p9_adu_access_hwp,
plat_getChipTarget(),
iv_addr,
Expand All @@ -111,22 +119,20 @@ ReturnCode sbeMemAccessInterface::accessGranule()
(iv_currGranule == 0),
(iv_lastGranule || (iv_maxGranule == 1)),
(uint8_t *)&iv_buffer)
}

// if access returns error
if( l_fapiRc != FAPI2_RC_SUCCESS )
{
SBE_ERROR(SBE_FUNC" access Failed");
}
else
{
}
if(l_fapiRc != FAPI2_RC_SUCCESS)
{
SBE_ERROR(SBE_FUNC" access HWP failed");
break;
}
iv_maxGranule--;
iv_currGranule++;
// Advance the address
iv_addr += iv_granuleSize;
iv_iterator = (iv_mode == SBE_MEM_ACCESS_READ)?
iv_granuleSize : 0;
}
} while(false);

return l_fapiRc;
}

Expand Down Expand Up @@ -181,6 +187,11 @@ ReturnCode sbeMemAccessInterface::accessWithBuffer(const void *io_buffer,
}
}
l_fapiRc = accessGranule();
// Break out on error
if(l_fapiRc != FAPI2_RC_SUCCESS)
{
break;
}
}

if(iv_mode == SBE_MEM_ACCESS_READ)
Expand Down Expand Up @@ -209,8 +220,8 @@ ReturnCode sbeMemAccessInterface::accessWithBuffer(const void *io_buffer,
}
}

// Break out on error or if the data is completely sent
if((l_fapiRc != FAPI2_RC_SUCCESS) || (l_iterator >= i_len))
// data is completely processed
if(l_iterator >= i_len)
{
break;
}
Expand Down

0 comments on commit 3b3b66a

Please sign in to comment.