diff options
author | Zane Shelley <zshelle@us.ibm.com> | 2017-01-10 09:31:36 -0600 |
---|---|---|
committer | Zane C. Shelley <zshelle@us.ibm.com> | 2017-01-25 17:33:28 -0500 |
commit | 049679c48e1fce3c18f7ca9547ec6b7ac565b879 (patch) | |
tree | b554f497e5c8c3ae1237ea8621ef312faa0d2c29 /src/usr/diag/prdf/common/plat/pegasus | |
parent | bf0eecf3d45af318152bb791d1a333c703233098 (diff) | |
download | talos-hostboot-049679c48e1fce3c18f7ca9547ec6b7ac565b879.tar.gz talos-hostboot-049679c48e1fce3c18f7ca9547ec6b7ac565b879.zip |
PRD: Ported CE table from P8 to P9
Change-Id: Ib3992610867f8f2ec72992f6c2936d7a4881a3fd
RTC: 165381
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/34742
Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Caleb N. Palmer <cnpalmer@us.ibm.com>
Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com>
Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/35414
Diffstat (limited to 'src/usr/diag/prdf/common/plat/pegasus')
-rw-r--r-- | src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaCeTable.C | 259 | ||||
-rw-r--r-- | src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaCeTable.H | 199 |
2 files changed, 0 insertions, 458 deletions
diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaCeTable.C b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaCeTable.C deleted file mode 100644 index 8430d58df..000000000 --- a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaCeTable.C +++ /dev/null @@ -1,259 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaCeTable.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -#include <prdfCenMbaCeTable.H> - -#include <algorithm> - -// Framwork includes -#include <iipServiceDataCollector.h> -#include <prdfPlatServices.H> -#include <UtilHash.H> - -// Pegasus includes -#include <prdfCenMarkstore.H> - -using namespace TARGETING; - -namespace PRDF -{ - -using namespace PlatServices; -using namespace CE_TABLE; - -//------------------------------------------------------------------------------ - -uint32_t CenMbaCeTable::addEntry( const CenAddr & i_addr, - const CenSymbol & i_symbol, bool i_isHard ) -{ - uint32_t o_rc = NO_TH_REACHED; - - TableData data ( i_addr, i_symbol.getDram(), i_symbol.getDramPins(), - i_symbol.getPortSlct(), i_symbol.getWiringType(), - i_isHard, i_symbol.isDramSpared(), - i_symbol.isEccSpared() ); - - // First, check if the entry already exists. If so, increment its count and - // move it to the end of the queue. - CeTable::iterator it = std::find( iv_table.begin(), iv_table.end(), data ); - if ( iv_table.end() != it ) - { - // Update the count only if the entry is active. Otherwise, use the - // reset count from the contructor. - if ( it->active ) - data.count = it->count + 1; - - // Update the DRAM pins - data.dramPins |= it->dramPins; - - // Check the hard CE status - if ( it->isHard ) data.isHard = true; - - // Remove the old entry - iv_table.erase( it ); - } - - // Add the new entry to the end of the list. - iv_table.push_back( data ); - - // Check the new entry's count for single entry threshold. - if ( TPS_ENTRY_COUNT_TH <= data.count ) - { - o_rc |= ENTRY_TH_REACHED; - } - - // Get number of entries in this table on the same rank as the new entry and - // threshold if needed. - CenRank thisRank = data.addr.getRank(); - uint32_t rankCount = 0; - for ( CeTable::iterator it = iv_table.begin(); it != iv_table.end(); it++ ) - { - if ( it->active && (it->addr.getRank() == thisRank) ) - rankCount++; - } - - if ( TPS_RANK_ENTRY_TH <= rankCount ) - o_rc |= RANK_TH_REACHED; - - // Note that we intentially checked the entries-per-rank threshold before - // removing any entries, if the table is full. This is to catch the corner - // case where the oldest entry is on the same rank as the new entry. - - // If the table is full, remove the oldest inactive entry - if ( MAX_ENTRIES < iv_table.size() ) - { - for ( CeTable::iterator it = iv_table.begin(); - it != iv_table.end(); it++ ) - { - if ( !it->active ) - { - iv_table.erase( it ); - break; - } - } - } - - // If the table is still full, all entries are active. Pop off the oldest - // active entry. - if ( MAX_ENTRIES < iv_table.size() ) - { - iv_table.pop_front(); - - // The table is full of active entries so do TPS. - o_rc |= TABLE_FULL; - } - - return o_rc; -} - -//------------------------------------------------------------------------------ - -void CenMbaCeTable::deactivateAll() -{ - // NOTE: We don't want to reset the count here because it will be used for - // FFDC. Instead the count will be reset in addEntry() if the entry is - // not active. - for ( CeTable::iterator it = iv_table.begin(); it != iv_table.end(); it++ ) - it->active = false; -} - -//------------------------------------------------------------------------------ - -void CenMbaCeTable::deactivateRank( const CenRank & i_rank ) -{ - // NOTE: We don't want to reset the count here because it will be used for - // FFDC. Instead the count will be reset in addEntry() if the entry is - // not active. - for ( CeTable::iterator it = iv_table.begin(); it != iv_table.end(); it++ ) - { - if ( it->addr.getRank() == i_rank ) - it->active = false; - } -} - -//------------------------------------------------------------------------------ - -void CenMbaCeTable::getMnfgCounts( const CenRank & i_rank, - const CenSymbol & i_symbol, - uint32_t & o_dramCount, - uint32_t & o_hrCount, - uint32_t & o_dimmCount ) -{ - o_dramCount = 0; o_hrCount = 0; o_dimmCount = 0; - - const uint32_t dram = i_symbol.getDram(); - const uint32_t ps = i_symbol.getPortSlct(); - const uint32_t ds = i_rank.getDimmSlct(); - - for ( CeTable::iterator it = iv_table.begin(); it != iv_table.end(); it++ ) - { - if ( ps != it->portSlct ) continue; - - CenRank itRank = it->addr.getRank(); - - if ( ds == itRank.getDimmSlct() ) - { - o_dimmCount++; - - if ( i_rank == itRank ) - { - o_hrCount++; - - if ( dram == it->dram ) - o_dramCount++; - } - } - } -} - -//------------------------------------------------------------------------------ - -void CenMbaCeTable::addCapData( CaptureData & io_cd ) -{ - static const size_t sz_word = sizeof(CPU_WORD); - - // Get the maximum capture data size and adjust the size for endianness. - static const size_t sz_maxData = ((MAX_SIZE+sz_word-1) / sz_word) * sz_word; - - // Initialize to 0. - uint8_t data[sz_maxData]; - memset( data, 0x00, sz_maxData ); - - size_t sz_actData = 0; - - uint32_t mbaPos = getTargetPosition( iv_mbaTrgt ); - - for ( CeTable::iterator it = iv_table.begin(); it != iv_table.end(); it++ ) - { - uint32_t mrnk = it->addr.getRank().getMaster(); // 3-bit - uint32_t srnk = it->addr.getRank().getSlave(); // 3-bit - uint32_t svld = it->addr.getRank().isSlaveValid() ? 1 : 0; // 1-bit - uint32_t bnk = it->addr.getBank(); // 4-bit - uint32_t row = it->addr.getRow(); // 17-bit - uint32_t col = it->addr.getCol(); // 12-bit - - uint8_t row0 = (row & 0x10000) >> 16; - uint8_t row1_8 = (row & 0x0ff00) >> 8; - uint8_t row9_16 = row & 0x000ff; - - uint8_t col0_3 = (col & 0xf00) >> 8; - uint8_t col4_11 = col & 0x0ff; - - uint8_t active = it->active ? 1 : 0; - uint8_t isHard = it->isHard ? 1 : 0; - uint8_t isSp = it->isDramSpared ? 1 : 0; - uint8_t isEcc = it->isEccSpared ? 1 : 0; - - data[sz_actData ] = it->count; - data[sz_actData+1] = ((it->type & 0x7) << 5) | - (mbaPos << 4) | (it->portSlct << 3) | - (isSp << 2) | (isEcc << 1) | - ((it->type & 0x8) >> 3); - data[sz_actData+2] = (isHard << 7) | (active << 6) | (it->dram & 0x3f); - data[sz_actData+3] = it->dramPins; - data[sz_actData+4] = (mrnk << 5) | (srnk << 2) | (svld << 1) | row0; - data[sz_actData+5] = row1_8; - data[sz_actData+6] = row9_16; - data[sz_actData+7] = (bnk << 4) | col0_3; - data[sz_actData+8] = col4_11; - - sz_actData += ENTRY_SIZE; - } - - if ( 0 != sz_actData ) - { - // Fix endianness issues with non PPC machines. - sz_actData = ((sz_actData + sz_word-1) / sz_word) * sz_word; - for ( uint32_t i = 0; i < (sz_actData/sz_word); i++ ) - ((CPU_WORD*)data)[i] = htonl(((CPU_WORD*)data)[i]); - - // Add data to capture data. - BIT_STRING_ADDRESS_CLASS bs ( 0, sz_actData*8, (CPU_WORD *) &data ); - io_cd.Add( iv_mbaTrgt, Util::hashString("MEM_CE_TABLE"), bs ); - } -} - -} // end namespace PRDF - diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaCeTable.H b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaCeTable.H deleted file mode 100644 index 3842819ba..000000000 --- a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaCeTable.H +++ /dev/null @@ -1,199 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaCeTable.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -#ifndef __prdfCenMbaCeTable_H -#define __prdfCenMbaCeTable_H - -/** @file prdfCenMbaCeTable.H */ - -// Framwork includes -#include <iipCaptureData.h> -#include <prdfParserEnums.H> -#include <prdfPlatServices.H> - -// Pegasus includes -#include <prdfCenAddress.H> -#include <prdfCenSymbol.H> - -// Other includes -#include <list> - -namespace PRDF -{ - -class CenMark; - -/** - * @brief A table of memory CEs. - * @note Only one of these tables will exist per MBA. - * @note Will be used to determine when to do a TPS procedure for Targeted - * Diagnostics at runtime. Will be used for FFDC only during Hostboot. - */ -class CenMbaCeTable -{ - - public: // constants, enums - - /** @brief Return values from addEntry(). */ - enum AddEntryRc - { - NO_TH_REACHED = 0x00, ///< No thresholds reached. - ENTRY_TH_REACHED = 0x01, ///< The entry threshold has been reached. - RANK_TH_REACHED = 0x02, ///< The rank threshold has been reached. - TABLE_FULL = 0x04, ///< The table is full of active entries. - }; - - private: // constants, enums - - /** @brief Table size limits. */ - enum TableTHs - { - TPS_RANK_ENTRY_TH = 8, ///< Threshold of entries per rank that - ///< triggers a TPS procedure - TPS_ENTRY_COUNT_TH = 32, ///< Entry count threshold that triggers - ///< a TPS procedure - }; - - public: // functions - - /** - * @brief Constructor - * @param i_mbaTrgt An MBA target. - */ - explicit CenMbaCeTable( TARGETING::TargetHandle_t i_mbaTrgt ) : - iv_mbaTrgt( i_mbaTrgt ) - {} - - /** - * @brief Will attempt to add a new entry to the table. - * - * If an entry already exists, the entry's count is incremented. Otherwise, - * a new entry is created. Will return TRUE if the CE triggers one of the - * following TPS conditions: - * - A single entry reaches count of TPS_ENTRY_COUNT_TH. - * - A rank has an entry count of TPS_RANK_ENTRY_TH. - * - The table is full. - * - * @param i_addr The address reporting the CE. - * @param i_symbol The symbol reporting the CE. - * @param i_isHard TRUE if a hard CE was detected on this address/symbol. - * @return Mask of possible return codes (see enum AddEntryRc). - */ - uint32_t addEntry( const CenAddr & i_addr, const CenSymbol & i_symbol, - bool i_isHard = false ); - - /** - * @brief Deactivates all entries in the table. - */ - void deactivateAll(); - - /** - * @brief Deactivates all entries covered by a rank. - * @param i_rank The target rank. - */ - void deactivateRank( const CenRank & i_rank ); - - /** - * @brief Iterates the entire table and returns the number of unique entries - * that exist for the target DRAM, half-rank, logical DIMM. - * @param i_rank The failing rank. - * @param i_symbol The failing symbol. - * @param o_dramCount The entry count for the target dram. - * @param o_hrCount The entry count for the target half-rank (per rank - * per port select). - * @param o_dimmCount The entry count for the target logical DIMM. - */ - void getMnfgCounts( const CenRank & i_rank, const CenSymbol & i_symbol, - uint32_t & o_dramCount, uint32_t & o_hrCount, - uint32_t & o_dimmCount ); - - /** - * @brief Gathers all table data to be stored in capture data. - * @param io_cd Capture data struct. - */ - void addCapData( CaptureData & io_cd ); - - private: // structs, typedefs - - /** @brief Individual entries of iv_table. */ - struct TableData - { - bool active; ///< TRUE if this entry is active - uint8_t count; ///< Number of times this entry is detected - CenAddr addr; ///< Physical address of this entry - uint8_t dram; ///< The DRAM in which the CE was detected - uint8_t dramPins; ///< The failing pins of the DRAM - uint8_t portSlct; ///< The port select of the DRAM - CEN_SYMBOL::WiringType type; ///< The wiring type - bool isHard; ///< TRUE if a hard CE was detected - bool isDramSpared; ///< TRUE if on spare DRAM - bool isEccSpared; ///< TRUE if on ECC spare - - /** @brief Default constructor. */ - TableData() : - active(false), count(0), addr(), dram(0), dramPins(0), portSlct(0), - type(CEN_SYMBOL::WIRING_INVALID), isHard(false), - isDramSpared(false), isEccSpared(false) - {} - - /** - * @brief Constructor from components. - * @param i_addr The physical address of this entry. - * @param i_dram The DRAM in which the CE was detected - * @param i_dramPins The failing pins of the DRAM - * @param i_type The wiring type (for DRAM site locations). - */ - TableData( const CenAddr & i_addr, uint8_t i_dram, uint8_t i_dramPins, - uint8_t i_portSlct, CEN_SYMBOL::WiringType i_type, - bool i_isHard, bool i_isDramSpared, bool i_isEccSpared ) : - active(true), count(1), addr(i_addr), dram(i_dram), - dramPins(i_dramPins), portSlct(i_portSlct), type(i_type), - isHard(i_isHard), isDramSpared(i_isDramSpared), - isEccSpared(i_isEccSpared) - {} - - /** An entry is equivalent if the address and DRAM match. */ - bool operator==( const TableData & i_data ) const - { - return ( this->addr == i_data.addr && this->dram == i_data.dram ); - } - }; - - typedef std::list<TableData> CeTable; - - private: // instance variables - - /** MBA associated with this table. */ - TARGETING::TargetHandle_t iv_mbaTrgt; - - /** A storage container for memory fetch CE errors. */ - CeTable iv_table; - -}; - -} // end namespace PRDF - -#endif // __prdfCenMbaCeTable_H - |