Skip to content

Commit

Permalink
Remove hardcoding of partial good logic (2/2)
Browse files Browse the repository at this point in the history
The original pg logic was a hard-coded criss-crossed jumble of logic
that was difficult to understand. It has now been generalized to an
algorithm that applies the correct logic based on a set of rules kept in
a table. This should make it easier to understand and maintain going
forward.

Change-Id: I51435cc2ca6bbfa9ebc8a3d52d4ebf23b5bd2730
RTC:193270
CMVC-Prereq: 1072559
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/68232
Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
Matt Raybuck authored and dcrowell77 committed Dec 3, 2018
1 parent eb8d149 commit 8b6b1b2
Show file tree
Hide file tree
Showing 7 changed files with 3,077 additions and 1,199 deletions.
37 changes: 27 additions & 10 deletions src/include/usr/hwas/common/hwasCommon.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#ifndef HWASCOMMON_H_
#define HWASCOMMON_H_

#include<map>

// 'system' headers
#include <stdint.h>
#include <targeting/common/target.H>
Expand Down Expand Up @@ -244,22 +246,37 @@ bool isChipFunctional(const TARGETING::TargetHandle_t &i_target,
const uint16_t i_pgData[VPD_CP00_PG_DATA_LENGTH]);


// This map is used to track the state of previously checked targets in the
// isDescFunctional method. This is used instead of directly looking at
// hwasState to keep the isDescFunctional logic self-contained and work around
// a limitation with the unit testing. Since hwasState can't be changed during
// testing the only other way to verify the algorithm works is by modifing this
// to match the test conditions.
typedef std::map<const TARGETING::TargetHandle_t, bool> pgState_map;

/**
* @brief Checks the PG keyword data to determine if the descendant chiplet is
* functional. The caller is responsible for allocating and de-allocating the
* PG keyword space.
* @brief Checks the PG keyword data to determine if the
* descendant chiplet is functional. The caller
* is responsible for allocating and
* de-allocating the PG keyword space.
*
* @param[in] i_desc pointer to descendant of target we're looking at
* @param[in] i_pgData pointer to area holding the PG keyword read from
* VPD; must be malloc'ed by the caller, and must be
* VPD_CP00_PG_DATA_LENGTH in size.
* @param[in] i_desc Pointer to descendant of target we're looking
* at. Must not be nullptr.
*
* @param[in] i_pgData Reference to area holding the PG keyword read
* from VPD; must be malloc'ed by the caller, and
* must be VPD_CP00_PG_DATA_ENTRIES in size.
*
* @param[in] io_targetStates Reference to the target state map to prevent
* re-checking targets.
*
* @return bool Return true if the descendant is functional; false if not.
* @return bool Returns true if the descendant is functional;
* False if not.
*
*/
bool isDescFunctional(const TARGETING::TargetHandle_t &i_desc,
const uint16_t i_pgData[VPD_CP00_PG_DATA_LENGTH]);

const uint16_t (&i_pgData)[VPD_CP00_PG_DATA_ENTRIES],
pgState_map &io_targetStates);

/**
* @deprecated
Expand Down
2 changes: 2 additions & 0 deletions src/include/usr/hwas/common/hwas_reasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace HWAS
MOD_RUNTIME_DECONFIG = 0x06,
MOD_DISABLE_OBUS = 0x07,
MOD_UPDATE_PROC_MEM_TO_USE = 0x08,
MOD_IS_DESCENDANT_FUNCTIONAL = 0x09
};

enum HwasReasonCode
Expand Down Expand Up @@ -66,6 +67,7 @@ namespace HWAS
RC_NULL_TARGET = HWAS_COMP_ID | 0x13,
RC_ONLY_TWO_OBUS_SHOULD_BE_CONFIGURED = HWAS_COMP_ID | 0x14,
RC_NO_UPDATE_WHEN_MEM_MISSING = HWAS_COMP_ID | 0x15,
RC_NO_PG_LOGIC = HWAS_COMP_ID | 0x16
};
};

Expand Down

0 comments on commit 8b6b1b2

Please sign in to comment.