From e4c32d91dc6100d9f9bac47855b3f0c675530b1f Mon Sep 17 00:00:00 2001 From: Mike Jones Date: Wed, 22 Feb 2012 17:09:18 -0600 Subject: HWPF Attribute Support. DQ Attribute Change-Id: I05e6f4f435574e25f65702c875e332e253927ff7 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/686 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- src/include/usr/hwpf/fapi/fapiReturnCode.H | 28 ++++++- src/include/usr/hwpf/fapi/fapiSystemConfig.H | 9 +-- src/include/usr/hwpf/fapi/fapiTarget.H | 22 ++++- .../usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.H | 77 ++++++++++++++++++ src/include/usr/hwpf/hwp/dimmBadDqBitmapFuncs.H | 94 ++++++++++++++++++++++ src/include/usr/hwpf/hwp/dimmConsts.H | 60 ++++++++++++++ src/include/usr/hwpf/hwp/fapiTestHwpDq.H | 57 +++++++++++++ .../usr/hwpf/plat/fapiPlatAttributeService.H | 47 ++++++++++- src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H | 2 + src/include/usr/hwpf/plat/fapiPlatReasonCodes.H | 1 + 10 files changed, 384 insertions(+), 13 deletions(-) create mode 100644 src/include/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.H create mode 100644 src/include/usr/hwpf/hwp/dimmBadDqBitmapFuncs.H create mode 100644 src/include/usr/hwpf/hwp/dimmConsts.H create mode 100644 src/include/usr/hwpf/hwp/fapiTestHwpDq.H (limited to 'src/include') diff --git a/src/include/usr/hwpf/fapi/fapiReturnCode.H b/src/include/usr/hwpf/fapi/fapiReturnCode.H index bd19c40e8..504e82c9a 100644 --- a/src/include/usr/hwpf/fapi/fapiReturnCode.H +++ b/src/include/usr/hwpf/fapi/fapiReturnCode.H @@ -39,6 +39,7 @@ * mjjones 09/22/2011 Added ErrorInfo Support * mjjones 11/10/2011 Use ecmdDataBufferBase * mjjones 01/12/2012 Enforce correct usage + * mjjones 02/22/2012 Allow user to add Target FFDC */ #ifndef FAPIRETURNCODE_H_ @@ -46,6 +47,7 @@ #include #include +#include #include #include #include @@ -397,6 +399,7 @@ namespace ReturnCodeFfdc enum ErrorInfoFfdcSize { EI_FFDC_SIZE_ECMDDB = -1, // ecmdDataBufferBase + EI_FFDC_SIZE_TARGET = -2, // fapi::Target }; /** @@ -425,6 +428,16 @@ namespace ReturnCodeFfdc return EI_FFDC_SIZE_ECMDDB; } + /** + * @brief Get FFDC Size specialization for fapi::Target + */ + template<> + inline int16_t getErrorInfoFfdcSize( + const fapi::Target &) + { + return EI_FFDC_SIZE_TARGET; + } + /** * @brief Compile error if caller tries to get the FFDC size of a pointer * @@ -472,11 +485,24 @@ namespace ReturnCodeFfdc // Deliberately not checking return code from extract to save code space i_ffdc.extract(l_pData, 0, i_ffdc.getBitLength()); - o_rc.addEIFfdc(l_pData, (i_ffdc.getWordLength() * 4)); delete [] l_pData; } + /** + * @brief Specialization of addEIFfdc for fapi::Target + * + * @param[out] o_rc Reference to ReturnCode to copy FFDC to + * @param[in] i_ffdc Reference to fapi::Target to add FFDC for + */ + template<> + inline void addEIFfdc(ReturnCode & o_rc, + const fapi::Target & i_ffdc) + { + const char * l_ecmdString = i_ffdc.toEcmdString(); + o_rc.addEIFfdc(l_ecmdString, (strlen(l_ecmdString) + 1)); + } + /** * @brief Compile error if caller tries to add a pointer as FFDC * diff --git a/src/include/usr/hwpf/fapi/fapiSystemConfig.H b/src/include/usr/hwpf/fapi/fapiSystemConfig.H index 5bb704661..7c2b904ee 100644 --- a/src/include/usr/hwpf/fapi/fapiSystemConfig.H +++ b/src/include/usr/hwpf/fapi/fapiSystemConfig.H @@ -32,6 +32,8 @@ * Flag Defect/Feature User Date Description * ------ -------------- ---------- ----------- ---------------------------- * mjjones 09/12/2011 Updated with new functions. + * mjjones 02/17/2012 Updated fapiGetAssociatedDimms + * description to only allow MBA * */ @@ -65,12 +67,9 @@ fapi::ReturnCode fapiGetChildChiplets( const fapi::TargetState i_state = fapi::TARGET_STATE_FUNCTIONAL); /** - * @brief Gets the DIMMs that are logically associated with the input target + * @brief Gets the DIMMs that are logically associated with the input MBA target * - * The logical association is MCS-MBS-MBA-DIMM. The input target must be a MCS, - * MBS or MBA chiplet and the output will be the associated DIMMs - * - * @param[in] i_target Input target + * @param[in] i_target Input MBA chiplet target * @param[out] o_dimms Reference to vector that is cleared then filled in with * the associated DIMM Targets * @param[in] i_state Only return targets of the specified state. Either diff --git a/src/include/usr/hwpf/fapi/fapiTarget.H b/src/include/usr/hwpf/fapi/fapiTarget.H index 9a09c7644..e09e8fd5d 100644 --- a/src/include/usr/hwpf/fapi/fapiTarget.H +++ b/src/include/usr/hwpf/fapi/fapiTarget.H @@ -38,6 +38,7 @@ * mjjones 09/12/2011 Added isChip and isChiplet * mjjones 02/07/2012 Remove MBS_CHIPLET * Add XBUS_ENDPOINT ABUS_ENDPOINT + * mjjones 02/21/2012 Add high performance toEcmdString */ #ifndef FAPITARGET_H_ @@ -212,7 +213,21 @@ public: /** * @brief Convert a target to an ecmd-format target string * - * This is used in order to trace the target in the common SCAN trace + * This is used by HWP/FAPI code to trace the target. + * + * @return Pointer to NULL terminated character string. The caller must use + * the string before the Target object is destructed. + */ + const char * toEcmdString() const; + +private: + + /** + * @brief Convert a target to an ecmd-format target string + * + * This is a private function called by toEcmdString to load the ecmd-format + * string into the Target object. Subsequent calls of toEcmdString are high + * performance and just return a pointer to the internal string. * * @note Implemented by platform code * @@ -222,8 +237,6 @@ public: */ void toString(char (&o_ecmdString)[MAX_ECMD_STRING_LEN]) const; -private: - /** * @brief Compare the handle * @@ -259,6 +272,9 @@ private: // Pointer to platform specific Target Handle void * iv_pHandle; + + // Pointer to the ecmd-format string representing the Target + mutable char * iv_pEcmdString; }; } diff --git a/src/include/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.H b/src/include/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.H new file mode 100644 index 000000000..fc7703ebc --- /dev/null +++ b/src/include/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.H @@ -0,0 +1,77 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +/** + * @file dimmBadDqBitmapAccessHwp.H + * + * @brief FW Team HWP that accesses the Bad DQ Bitmap. + */ + +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 02/17/2012 Created. + */ + +#ifndef DIMMBADDQBITMAPACCESSHWP_H_ +#define DIMMBADDQBITMAPACCESSHWP_H_ + +#include +#include + +typedef fapi::ReturnCode (*dimmBadDqBitmapAccessHwp_FP_t)( + const fapi::Target &, + const uint8_t (&)[DIMM_DQ_MAX_DIMM_RANKS][DIMM_DQ_RANK_BITMAP_SIZE], + const bool); + +extern "C" +{ + +/** + * @brief FW Team HWP that accesses the Bad DQ Bitmap. It accesses the raw data + * from DIMM SPD and does any necessary processing to turn it into a + * bitmap from a Centaur DQ point of view. If the data in SPD is not + * valid then it has never been written and all zeroes are returned (no + * bad DQs). + * + * This HWP should be called by HWP/PLAT code to access the BAD DQ Bitmap + * + * Note that the MSB of each byte corresponds to the lowest DQ. + * if (data[1][0] == 0x80) then rank 1, Centaur DQ0 is bad + * if (data[1][0] == 0x40) then rank 1, Centaur DQ1 is bad + * if (data[1][1] == 0x20) then rank 1, Centaur DQ10 is bad + * + * @param[in] i_dimm Reference to DIMM Target + * @param[io] io_data Reference to bad DQ bitmap data for the DIMM. + * @param[in] i_get True if getting DQ Bitmap data. False if setting data. + * + * @return ReturnCode + */ +fapi::ReturnCode dimmBadDqBitmapAccessHwp( + const fapi::Target & i_dimm, + uint8_t (&io_data)[DIMM_DQ_MAX_DIMM_RANKS][DIMM_DQ_RANK_BITMAP_SIZE], + const bool i_get); + +} + +#endif diff --git a/src/include/usr/hwpf/hwp/dimmBadDqBitmapFuncs.H b/src/include/usr/hwpf/hwp/dimmBadDqBitmapFuncs.H new file mode 100644 index 000000000..73a8ae8b6 --- /dev/null +++ b/src/include/usr/hwpf/hwp/dimmBadDqBitmapFuncs.H @@ -0,0 +1,94 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/hwpf/hwp/dimmBadDqBitmapFuncs.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +/** + * @file dimmBadDqBitmapFuncs.H + * + * @brief FW Team Utility functions that accesses the Bad DQ Bitmap. + */ + +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 02/17/2012 Created. + */ + +#ifndef DIMMBADDQBITMAPFUNCS_H_ +#define DIMMBADDQBITMAPFUNCS_H_ + +#include +#include + +extern "C" +{ + +/** + * @brief FW Team Utility function that gets the Bad DQ Bitmap. + * + * This utility functon should be called by a HWP needing to get the Bad DQ + * bitmap for a particular mba, port, dimm and rank. + * + * This function finds the corresponding DIMM Target, calls + * dimmBadDqBitmapAccessHwp to get the DQ bitmap and returns the data + * for the specified rank. + * + * @param[in] i_mba Reference to MBA Chiplet + * @param[in] i_port MBA port number (0-(DIMM_DQ_MAX_MBA_PORTS - 1)) + * @param[in] i_dimm MBA port DIMM number (0-(DIMM_DQ_MAX_MBAPORT_DIMMS - 1)) + * @param[in] i_rank DIMM rank number (0-(DIMM_DQ_MAX_DIMM_RANKS -1)) + * @param[out] o_data Reference to data where Bad DQ bitmap is copied to + * + * @return ReturnCode + */ +fapi::ReturnCode dimmGetBadDqBitmap(const fapi::Target & i_mba, + const uint8_t i_port, + const uint8_t i_dimm, + const uint8_t i_rank, + uint8_t (&o_data)[DIMM_DQ_RANK_BITMAP_SIZE]); + +/** + * @brief FW Team Utility function that sets the Bad DQ Bitmap. + * + * This utility functon should be called by a HWP needing to set the Bad DQ + * bitmap for a particular mba, port, dimm and rank. + * + * This utility function finds the corresponding DIMM Target, calls + * dimmBadDqBitmapAccessHwp to get the DQ bitmap, fills in the data for the + * specified rank and calls dimmBadDqBitmapAccessHwp to set the DQ bitmap + * + * @param[in] i_mba Reference to MBA Chiplet + * @param[in] i_port MBA port number (0-(DIMM_DQ_MAX_MBA_PORTS - 1)) + * @param[in] i_dimm MBA port DIMM number (0-(DIMM_DQ_MAX_MBAPORT_DIMMS - 1)) + * @param[in] i_rank DIMM rank number (0-(DIMM_DQ_MAX_DIMM_RANKS -1)) + * @param[in] i_data Reference to data where Bad DQ bitmap is copied from + * + * @return ReturnCode + */ +fapi::ReturnCode dimmSetBadDqBitmap(const fapi::Target & i_mba, + const uint8_t i_port, + const uint8_t i_dimm, + const uint8_t i_rank, + const uint8_t (&i_data)[DIMM_DQ_RANK_BITMAP_SIZE]); +} + +#endif diff --git a/src/include/usr/hwpf/hwp/dimmConsts.H b/src/include/usr/hwpf/hwp/dimmConsts.H new file mode 100644 index 000000000..cf63586b2 --- /dev/null +++ b/src/include/usr/hwpf/hwp/dimmConsts.H @@ -0,0 +1,60 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/hwpf/hwp/dimmConsts.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +/** + * @file dimmConsts.H + * + * @brief DIMM Constants + */ + +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 02/17/2012 Created. + */ + +#ifndef DIMMCONSTS_H_ +#define DIMMCONSTS_H_ + +// Maximum number of ports on an MBA +const uint8_t DIMM_DQ_MAX_MBA_PORTS = 2; + +// Maximum number of DIMMs attached to an MBA PORT +const uint8_t DIMM_DQ_MAX_MBAPORT_DIMMS = 2; + +// Maximum number of ranks on a DIMM +const uint8_t DIMM_DQ_MAX_DIMM_RANKS = 4; + +// Size in bytes of the Bad DQ bitmap for a rank. +const uint8_t DIMM_DQ_RANK_BITMAP_SIZE = 10; + +// Number of DQs (data query pins). +// This is the number of bits in DIMM_DQ_RANK_BITMAP_SIZE. +const uint8_t DIMM_DQ_NUM_DQS = DIMM_DQ_RANK_BITMAP_SIZE * 8; + +// Size in bytes of Bad DQ Data in DIMM SPD +// This must be big enough to contain the bitmap for each rank +// (DIMM_DQ_MAX_DIMM_RANKS * DIMM_DQ_RANK_BITMAP_SIZE), plus the header +const uint8_t DIMM_DQ_SPD_DATA_SIZE = 80; + +#endif diff --git a/src/include/usr/hwpf/hwp/fapiTestHwpDq.H b/src/include/usr/hwpf/hwp/fapiTestHwpDq.H new file mode 100644 index 000000000..72c6aa8e1 --- /dev/null +++ b/src/include/usr/hwpf/hwp/fapiTestHwpDq.H @@ -0,0 +1,57 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/hwpf/hwp/fapiTestHwpDq.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +/** + * @file fapiTestHwpDq.H + * + * @brief Test Hardware Procedure that exercises the bad DQ data + */ + +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 02/21/2012 Created + */ + +#ifndef FAPITESTHWPDQ_H_ +#define FAPITESTHWPDQ_H_ + +#include + +typedef fapi::ReturnCode (*fapiTestHwpDq_FP_t)(const fapi::Target &); + +extern "C" +{ + +/** + * @brief Test Hardware Procedure that exercises the bad DQ data + * + * @param[in] i_mba Reference to MBA chiplet + * + * @return ReturnCode + */ +fapi::ReturnCode fapiTestHwpDq(const fapi::Target & i_mba); + +} + +#endif diff --git a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H index 6bd206383..f94e5dd4f 100755 --- a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H +++ b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H @@ -53,6 +53,7 @@ #include #include #include +#include //****************************************************************************** // Interface @@ -125,7 +126,7 @@ namespace platAttrSvc /** * @brief This function is called by the FAPI_ATTR_GET macro when accessing - * SPD ATTR. IT should not be called directly + * SPD ATTR. It should not be called directly * * @param[in] i_target Target pointer to operate on * @param[in] i_keyword SPD keyword @@ -133,9 +134,25 @@ namespace platAttrSvc * @param[in] i_len Size of storage * @return ReturnCode. Zero on success, else platform specified error */ -ReturnCode fapiPlatGetSpdAttr(const Target * i_target, - const uint16_t i_keyword, - void * o_data, size_t i_len ); +fapi::ReturnCode fapiPlatGetSpdAttr(const fapi::Target * i_target, + const uint16_t i_keyword, + void * o_data, + size_t i_len ); + +/** + * @brief This function is called by the FAPI_ATTR_SET macro when accessing + * SPD ATTR. It should not be called directly + * + * @param[in] i_target Target pointer to operate on + * @param[in] i_keyword SPD keyword + * @param[in] i_data Pointer to data + * @param[in] i_len Size of data + * @return ReturnCode. Zero on success, else platform specified error + */ +fapi::ReturnCode fapiPlatSetSpdAttr(const fapi::Target * i_target, + const uint16_t i_keyword, + void * i_data, + size_t i_len ); /** * @brief This function is called by the FAPI_ATTR_GET macro when getting @@ -159,6 +176,17 @@ fapi::ReturnCode fapiPlatGetMemoryBaseAddr(const fapi::Target * i_pMcsTarget, fapi::ReturnCode fapiPlatGetMirrorBaseAddr(const fapi::Target * i_pMcsTarget, uint64_t & o_addr); +/** + * @brief This function is called by the FAPI_ATTR_GET macro when getting + * ATTR_CEN_DQ_TO_DIMM_CONN_DQ. It should not be called directly + * + * @param[in] i_pDimmTarget DIMM target pointer + * @param[out] o_data Output data + * @return ReturnCode. Zero on success, else platform specified error + */ +fapi::ReturnCode fapiPlatGetDqMapping(const fapi::Target * i_pDimmTarget, + uint8_t (&o_data)[DIMM_DQ_NUM_DQS]); + } } @@ -254,6 +282,10 @@ fapi::ReturnCode fapiPlatGetMirrorBaseAddr(const fapi::Target * i_pMcsTarget, fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_REVISION_CODE, &(VAL), sizeof(VAL) ) #define ATTR_SPD_DRAM_MANUFACTURER_JEDEC_ID_CODE_GETMACRO(ID, PTARGET, VAL) \ fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::DRAM_MANUFACTURER_ID, &(VAL), sizeof(VAL) ) +#define ATTR_SPD_BAD_DQ_DATA_GETMACRO(ID, PTARGET, VAL) \ + fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::DIMM_BAD_DQ_DATA, &(VAL), sizeof(VAL) ) +#define ATTR_SPD_BAD_DQ_DATA_SETMACRO(ID, PTARGET, VAL) \ + fapi::platAttrSvc::fapiPlatSetSpdAttr( PTARGET, SPD::DIMM_BAD_DQ_DATA, &(VAL), sizeof(VAL) ) //------------------------------------------------------------------------------ // MACROs to route ATTR Base Address accesses to the correct Hostboot function @@ -263,4 +295,11 @@ fapi::ReturnCode fapiPlatGetMirrorBaseAddr(const fapi::Target * i_pMcsTarget, #define ATTR_MSS_MIRROR_BASE_GETMACRO(ID, PTARGET, VAL) \ fapi::platAttrSvc::fapiPlatGetMirrorBaseAddr(PTARGET, VAL) +//------------------------------------------------------------------------------ +// MACRO to route ATTR_CEN_DQ_TO_DIMM_CONN_DQ access to the correct Hostboot +// function +//------------------------------------------------------------------------------ +#define ATTR_CEN_DQ_TO_DIMM_CONN_DQ_GETMACRO(ID, PTARGET, VAL) \ + fapi::platAttrSvc::fapiPlatGetDqMapping(PTARGET, VAL) + #endif // FAPIPLATATTRIBUTESERVICE_H_ diff --git a/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H b/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H index b3441ea9b..c179c0ddb 100644 --- a/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H +++ b/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H @@ -40,6 +40,8 @@ #include #include #include +#include +#include /** * @brief HWP Executor macro diff --git a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H index 0eaa87920..59e70adb6 100644 --- a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H +++ b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H @@ -42,6 +42,7 @@ namespace fapi MOD_HANDLE_ECMD_BUF_RC = 0x06, MOD_VERIFY_CFAM_ACCESS_TARGET = 0x07, MOD_ATTR_BASE_ADDR_GET = 0x08, + MOD_ATTR_DQ_MAP_GET = 0x09, }; // Note that for HWP generated errors (MOD_HWP_RC_TO_ERRL), the -- cgit v1.2.1