summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZane Shelley <zshelle@us.ibm.com>2018-12-06 16:32:57 -0600
committerMartha Broyles <mbroyles@us.ibm.com>2019-01-02 12:53:08 -0600
commit69bac807b007001120103d2ff9e136fdc6f6781f (patch)
treebf9c9a663687561a55a31b4fdfec535a63cbfc18
parent29d1d67db71cc277e12d0a7a1e6dc6be1043985b (diff)
downloadtalos-occ-69bac807b007001120103d2ff9e136fdc6f6781f.zip
talos-occ-69bac807b007001120103d2ff9e136fdc6f6781f.tar.gz
FIRDATA: Simplified iterating targets from HOMER in firData.c
Change-Id: Ibed7a6eb3f3c6a893c0e5f469427d45ab83045b3 RTC: 201994 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69540 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Caleb N. Palmer <cnpalmer@us.ibm.com> Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com> Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
-rw-r--r--src/occ_gpe0/firdata/firData.c103
1 files changed, 40 insertions, 63 deletions
diff --git a/src/occ_gpe0/firdata/firData.c b/src/occ_gpe0/firdata/firData.c
index b367104..4677a64 100644
--- a/src/occ_gpe0/firdata/firData.c
+++ b/src/occ_gpe0/firdata/firData.c
@@ -856,6 +856,14 @@ void FirData_addTrgtsToPnor( FirData_t * io_fd )
if ( 0 == (chipData->MASK & mask) ) continue; \
ADD_TO_PNOR( TYPE, UNIT )
+#define START_UNIT_LOOP( ITR, MAX ) \
+ for ( ITR = 0; ITR < (MAX); ITR++ ) \
+ {
+
+#define END_UNIT_LOOP \
+ } \
+ if ( full ) break;
+
if ( HOMER_CHIP_NIMBUS == chipHdr->chipType )
{
// Keep a pointer of the current chip data.
@@ -866,46 +874,30 @@ void FirData_addTrgtsToPnor( FirData_t * io_fd )
ADD_TO_PNOR( PROC, 0 )
- /* gather other chiplets on the processor */
- for ( u = 0; u < MAX_XBUS_PER_PROC; u++ )
- {
+ START_UNIT_LOOP( u, PROC_MAX(XBUS) )
ADD_UNIT_TO_PNOR( xbusMask, XBUS, u )
- }
- if ( full ) break;
+ END_UNIT_LOOP
- /* gather other chiplets on the processor */
- for ( u = 0; u < MAX_OBUS_PER_PROC; u++ )
- {
+ START_UNIT_LOOP( u, PROC_MAX(OBUS) )
ADD_UNIT_TO_PNOR( obusMask, OBUS, u )
- }
- if ( full ) break;
+ END_UNIT_LOOP
- /* gather more proc chiplets */
- for ( u = 0; u < MAX_CAPP_PER_PROC; u++ )
- {
+ START_UNIT_LOOP( u, PROC_MAX(CAPP) )
ADD_UNIT_TO_PNOR( cappMask, CAPP, u )
- }
- if ( full ) break;
+ END_UNIT_LOOP
- /* gather other chiplets on the processor */
- for ( u = 0; u < MAX_PEC_PER_PROC; u++ )
- {
+ START_UNIT_LOOP( u, PROC_MAX(PEC) )
ADD_UNIT_TO_PNOR( pecMask, PEC, u )
- /* gather PHB's under the PEC */
- /* ************************** */
- /* PEC0-> PHB0 */
- /* PEC1-> PHB1 PHB2 */
- /* PEC2-> PHB3 PHB4 PHB5 */
- /* ************************** */
- uint32_t l_PhbPos;
-
- /* u will be 0, l_unit 0 */
- /* u will be 1, l_unit 0 and 1 */
- /* u will be 2, l_unit 0 and 1 and 2 */
- for ( l_unit = 0; l_unit < (u+1); l_unit++ )
- {
- l_PhbPos = u + l_unit;
+ // The PEC unit number matches the number of PHBs under
+ // that PEC.
+ START_UNIT_LOOP( l_unit, u + 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)
{
@@ -914,70 +906,53 @@ void FirData_addTrgtsToPnor( FirData_t * io_fd )
ADD_UNIT_TO_PNOR( phbMask, PHB, l_PhbPos )
- } /* end for on PHB chiplet */
- if ( full ) break;
+ END_UNIT_LOOP
- } /* end for on PEC chiplet */
- if ( full ) break;
+ END_UNIT_LOOP
- /* gather other chiplets on the processor */
- for ( u = 0; u < MAX_EC_PER_PROC; u++ )
- {
+ START_UNIT_LOOP( u, PROC_MAX(EC) )
ADD_UNIT_TO_PNOR( ecMask, EC, u )
- } /* end for on EC chiplet */
- if ( full ) break;
+ END_UNIT_LOOP
- /* gather other chiplets on the processor */
- for ( u = 0; u < MAX_EQ_PER_PROC; u++ )
- {
+ 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;
- for (l_unit=0; l_unit < l_ExPerEq; l_unit++)
- {
+ START_UNIT_LOOP( l_unit, l_ExPerEq )
l_ExPos = (l_ExPerEq * u) + l_unit;
ADD_UNIT_TO_PNOR( exMask, EX, l_ExPos )
- } /* end for on EX chiplet */
- if ( full ) break;
+ END_UNIT_LOOP
- } /* end for on EQ chiplet */
- if ( full ) break;
+ END_UNIT_LOOP
/* processor type can impact next few units */
uint32_t l_UnitPerMc = MAX_MCA_PER_PROC / MAX_MCBIST_PER_PROC;
uint8_t l_unitNumber;
- for ( u = 0; u < MAX_MCBIST_PER_PROC; u++ )
- {
+ START_UNIT_LOOP( u, PROC_MAX(MCBIST) )
ADD_UNIT_TO_PNOR( mcbistMask, MCBIST, u )
- /* Grab underlying MCA chiplet */
- for ( l_unit = 0; l_unit < l_UnitPerMc; l_unit++ )
- {
+ 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 )
- } /* end for on MCA/DMI */
- if ( full ) break;
+ END_UNIT_LOOP
- } /* end for on MCBIST */
- if ( full ) break;
+ END_UNIT_LOOP
- for ( u = 0; u < MAX_MCS_PER_PROC; u++ )
- {
+ START_UNIT_LOOP( u, PROC_MAX(MCS) )
ADD_UNIT_TO_PNOR( mcsMask, MCS, u )
- }
- if ( full ) break;
+ END_UNIT_LOOP
}
else
@@ -990,6 +965,8 @@ void FirData_addTrgtsToPnor( FirData_t * io_fd )
#undef PROC_MAX
#undef ADD_TO_PNOR
#undef ADD_UNIT_TO_PNOR
+#undef START_UNIT_LOOP
+#undef END_UNIT_LOOP
}
}
OpenPOWER on IntegriCloud