summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZane Shelley <zshelle@us.ibm.com>2018-12-07 09:56:24 -0600
committerMartha Broyles <mbroyles@us.ibm.com>2019-01-02 12:53:35 -0600
commitb673f22459cae0494ac7c9e01a5c0215590168c4 (patch)
treecf23c9ff30c06b89050a0b193f46ba95f4a6a55c
parent69bac807b007001120103d2ff9e136fdc6f6781f (diff)
downloadtalos-occ-b673f22459cae0494ac7c9e01a5c0215590168c4.zip
talos-occ-b673f22459cae0494ac7c9e01a5c0215590168c4.tar.gz
FIRDATA: Further simplifying iteration variables in firData.c
Change-Id: I164f2285b754b8ee068a6c2ca1bf21227d3d509b RTC: 201994 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69557 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com> Reviewed-by: Caleb N. Palmer <cnpalmer@us.ibm.com> Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
-rw-r--r--src/occ_gpe0/firdata/firData.c80
1 files changed, 31 insertions, 49 deletions
diff --git a/src/occ_gpe0/firdata/firData.c b/src/occ_gpe0/firdata/firData.c
index 4677a64..72eefa9 100644
--- a/src/occ_gpe0/firdata/firData.c
+++ b/src/occ_gpe0/firdata/firData.c
@@ -806,9 +806,6 @@ bool FirData_addTrgtToPnor( FirData_t * io_fd, SCOM_Trgt_t i_sTrgt,
*/
void FirData_addTrgtsToPnor( FirData_t * io_fd )
{
- uint8_t u = 0;
- uint8_t l_unit = 0;
-
// We will need to keep track of where we are in the HOMER buffer.
uint8_t * byteIdx = io_fd->hBuf;
@@ -842,6 +839,8 @@ void FirData_addTrgtsToPnor( FirData_t * io_fd )
// Various other variables used below.
uint32_t mask = 0;
+ uint8_t u1 = 0, u2 = 0, u3 = 0;
+ uint8_t subUnitMax = 0;
#define PROC_MAX(TYPE) MAX_##TYPE##_PER_PROC
@@ -874,84 +873,67 @@ void FirData_addTrgtsToPnor( FirData_t * io_fd )
ADD_TO_PNOR( PROC, 0 )
- START_UNIT_LOOP( u, PROC_MAX(XBUS) )
- ADD_UNIT_TO_PNOR( xbusMask, XBUS, u )
+ START_UNIT_LOOP( u1, PROC_MAX(XBUS) )
+ ADD_UNIT_TO_PNOR( xbusMask, XBUS, u1 )
END_UNIT_LOOP
- START_UNIT_LOOP( u, PROC_MAX(OBUS) )
- ADD_UNIT_TO_PNOR( obusMask, OBUS, u )
+ START_UNIT_LOOP( u1, PROC_MAX(OBUS) )
+ ADD_UNIT_TO_PNOR( obusMask, OBUS, u1 )
END_UNIT_LOOP
- START_UNIT_LOOP( u, PROC_MAX(CAPP) )
- ADD_UNIT_TO_PNOR( cappMask, CAPP, u )
+ START_UNIT_LOOP( u1, PROC_MAX(CAPP) )
+ ADD_UNIT_TO_PNOR( cappMask, CAPP, u1 )
END_UNIT_LOOP
- START_UNIT_LOOP( u, PROC_MAX(PEC) )
- ADD_UNIT_TO_PNOR( pecMask, PEC, u )
+ START_UNIT_LOOP( u1, PROC_MAX(PEC) )
+
+ ADD_UNIT_TO_PNOR( pecMask, PEC, u1 )
// The PEC unit number matches the number of PHBs under
// that PEC.
- START_UNIT_LOOP( l_unit, u + 1 )
+ START_UNIT_LOOP( u2, u1 + 1 )
// Calculate the PHB unit position.
// PEC0-> PHB0
// PEC1-> PHB1 PHB2
// PEC2-> PHB3 PHB4 PHB5
- uint32_t l_PhbPos = u + l_unit;
- /** When we hit PEC2, need to bump PHB position */
- if ((MAX_PEC_PER_PROC - 1) == u)
- {
- l_PhbPos++;
- } /* if last PEC unit */
+ u3 = u1 + u2;
+ if ( (PROC_MAX(PEC) - 1) == u1 ) u3++;
- ADD_UNIT_TO_PNOR( phbMask, PHB, l_PhbPos )
+ ADD_UNIT_TO_PNOR( phbMask, PHB, u3 )
END_UNIT_LOOP
END_UNIT_LOOP
- START_UNIT_LOOP( u, PROC_MAX(EC) )
- ADD_UNIT_TO_PNOR( ecMask, EC, u )
-
+ START_UNIT_LOOP( u1, PROC_MAX(EC) )
+ ADD_UNIT_TO_PNOR( ecMask, EC, u1 )
END_UNIT_LOOP
- START_UNIT_LOOP( u, PROC_MAX(EQ) )
- ADD_UNIT_TO_PNOR( eqMask, EQ, u )
-
- /* gather other chiplets on the processor */
- uint32_t l_ExPerEq = (MAX_EX_PER_PROC/MAX_EQ_PER_PROC);
- uint32_t l_ExPos;
-
- START_UNIT_LOOP( l_unit, l_ExPerEq )
- l_ExPos = (l_ExPerEq * u) + l_unit;
-
- ADD_UNIT_TO_PNOR( exMask, EX, l_ExPos )
+ START_UNIT_LOOP( u1, PROC_MAX(EQ) )
+ ADD_UNIT_TO_PNOR( eqMask, EQ, u1 )
+ subUnitMax = PROC_MAX(EX) / PROC_MAX(EQ);
+ START_UNIT_LOOP( u2, subUnitMax )
+ u3 = (subUnitMax * u1) + u2;
+ ADD_UNIT_TO_PNOR( exMask, EX, u3 )
END_UNIT_LOOP
END_UNIT_LOOP
+ START_UNIT_LOOP( u1, PROC_MAX(MCBIST) )
+ ADD_UNIT_TO_PNOR( mcbistMask, MCBIST, u1 )
- /* processor type can impact next few units */
- uint32_t l_UnitPerMc = MAX_MCA_PER_PROC / MAX_MCBIST_PER_PROC;
- uint8_t l_unitNumber;
-
- START_UNIT_LOOP( u, PROC_MAX(MCBIST) )
- ADD_UNIT_TO_PNOR( mcbistMask, MCBIST, u )
-
- START_UNIT_LOOP( l_unit, l_UnitPerMc )
- /* u=0 or 1 while l_unit is 0 thru 3 */
- /* Leading to unit number 0:3 or 4:7 */
- l_unitNumber = l_unit + (u * l_UnitPerMc);
- ADD_UNIT_TO_PNOR( mcaMask, MCA, l_unitNumber )
-
+ subUnitMax = PROC_MAX(MCA) / PROC_MAX(MCBIST);
+ START_UNIT_LOOP( u2, subUnitMax )
+ u3 = (subUnitMax * u1) + u2;
+ ADD_UNIT_TO_PNOR( mcaMask, MCA, u3 )
END_UNIT_LOOP
END_UNIT_LOOP
-
- START_UNIT_LOOP( u, PROC_MAX(MCS) )
- ADD_UNIT_TO_PNOR( mcsMask, MCS, u )
+ START_UNIT_LOOP( u1, PROC_MAX(MCS) )
+ ADD_UNIT_TO_PNOR( mcsMask, MCS, u1 )
END_UNIT_LOOP
}
OpenPOWER on IntegriCloud