summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf
diff options
context:
space:
mode:
authorBill Schwartz <whs@us.ibm.com>2012-10-30 11:27:48 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-11-09 08:29:21 -0600
commited66b035444144109e66283e4b97087b918c6b93 (patch)
treee792b1444cbe0b84c313d32c88e43e5e97e6cb6d /src/usr/hwpf
parentc5d3f875c2f5daec90556edead0d4af8c7ff5470 (diff)
downloadtalos-hostboot-ed66b035444144109e66283e4b97087b918c6b93.tar.gz
talos-hostboot-ed66b035444144109e66283e4b97087b918c6b93.zip
MVPD Accessor Function: setRepairRing
mvpdtest.H comments out tests due to missing mvpd data (issue 51716). Might not need to be merged depending on the timing of fixing the data. Brian is working on errltest.H and errluserdetailtest.H to not deconfigure. As it is mvpd and getRingRepair tests do not run because the dependent targets are deconfigured. When fixed, then errors occur in mvpdtest. The problems are commented out for now in fapiwinkletest (get/set Repair Ring). RTC: 50971 Change-Id: I60d499ebb2d9966ffe2c0cc155a7875820b1ee83 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2171 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf')
-rw-r--r--src/usr/hwpf/hwp/RepairRingFunc.C252
-rw-r--r--src/usr/hwpf/hwp/makefile7
-rw-r--r--src/usr/hwpf/hwp/mvpd_accessors/getRepairRing.C164
-rw-r--r--src/usr/hwpf/hwp/mvpd_accessors/getRepairRing.H74
-rw-r--r--src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk30
-rw-r--r--src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.C164
-rw-r--r--src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.H68
-rw-r--r--src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml (renamed from src/usr/hwpf/hwp/mvpd_errors.xml)1
-rw-r--r--src/usr/hwpf/hwp/mvpd_accessors/setRepairRing.C178
-rw-r--r--src/usr/hwpf/hwp/mvpd_accessors/setRepairRing.H76
-rw-r--r--src/usr/hwpf/makefile2
-rw-r--r--src/usr/hwpf/test/fapiwinkletest.H212
-rw-r--r--src/usr/hwpf/test/makefile29
13 files changed, 950 insertions, 307 deletions
diff --git a/src/usr/hwpf/hwp/RepairRingFunc.C b/src/usr/hwpf/hwp/RepairRingFunc.C
deleted file mode 100644
index 713deba1b..000000000
--- a/src/usr/hwpf/hwp/RepairRingFunc.C
+++ /dev/null
@@ -1,252 +0,0 @@
- /* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/hwpf/hwp/RepairRingFunc.C $
- *
- * 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_TAG
- */
-// $Id: RepairRingFunc.C,v 1.1 2012/07/19 22:00:40 mjjones Exp $
-/**
- * @file RepairRingFunc.C
- *
- * @brief fetch repair rings from MVPD #R records
- *
- */
-
-#include <stdint.h>
-
-// fapi support
-#include <fapi.H>
-
-#include <RepairRingFunc.H>
-
-// pull in CompressedScanData def from proc_slw_build HWP
-#include <p8_scan_compression.H>
-
-extern "C"
-{
-using namespace fapi;
-
-
-fapi::ReturnCode getRepairRing( const fapi::Target &i_fapiTarget,
- const uint8_t i_chipletId,
- const uint8_t i_ringId,
- uint8_t *io_pRingBuf,
- uint32_t &io_rRingBufsize)
-{
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
- uint8_t *l_pRing = NULL;
- uint32_t l_offset = 0;
- CompressedScanData *l_pScanData = NULL;
- uint8_t *l_pdRRecord = NULL;
- uint32_t l_pdRLen = 0;
- bool l_foundflag = false;
-
-
- FAPI_DBG(" getRepairRing: entry ringId=0x%x, chipletId=0x%x, size=0x%x ",
- i_ringId,
- i_chipletId,
- io_rRingBufsize );
-
- do {
-
- // input check
- if ( io_pRingBuf == NULL )
- {
- FAPI_ERR("getRepairRing: NULL pointer passed in");
-
- io_rRingBufsize = 0;
- FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_INVALID_RINGBUF_PTR );
-
- break;
- }
-
- FAPI_DBG( "getRepairRing: get MVPD #R buffer" );
-
- // call fapiGetMvpdField once with a NULL pointer to get the buffer
- // size no error should be returned.
- l_fapirc = fapiGetMvpdField( fapi::MVPD_RECORD_CP00,
- fapi::MVPD_KEYWORD_PDR,
- i_fapiTarget,
- NULL,
- l_pdRLen );
- if ( l_fapirc )
- {
- FAPI_ERR("getRepairRing: fapiGetMvpdField failed to get buffer size");
-
- io_rRingBufsize = 0;
- // break out with fapirc
- break;
- }
-
- FAPI_DBG( "getRepairRing: fapiGetMvpdField returned l_pdRLen=0x%x",
- l_pdRLen );
-
- // allocate buffer for the record
- l_pdRRecord = new uint8_t[l_pdRLen];
- // check to make sure it got allocated
- if ( l_pdRRecord == NULL )
- {
- FAPI_ERR( "getRepairRing: failed to alloc buffer");
- FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_ALLOC_FAIL );
-
- io_rRingBufsize = 0;
- // break out with fapirc
- break;
- }
-
- // load repair ring from MVPD for this target
- l_fapirc = fapiGetMvpdField( fapi::MVPD_RECORD_CP00,
- fapi::MVPD_KEYWORD_PDR,
- i_fapiTarget,
- l_pdRRecord,
- l_pdRLen );
- if ( l_fapirc )
- {
- FAPI_ERR("getRepairRing: fapiGetMvpdField failed");
-
- io_rRingBufsize = 0;
- // break out with fapirc
- break;
- }
-
- // point to #R record
- l_pRing = l_pdRRecord;
- //
- // 1) Find first RSA data block in #R (fixed offset defined by
- // MVPD spec)
- //
- // First byte in #R record should be the version number, skip
- // over this.
- //
- FAPI_DBG( "getRepairRing: #R record version = 0x%x", *l_pRing );
- l_pRing++;
- l_offset = 0;
-
- l_foundflag = false;
- while ( l_offset < l_pdRLen )
- {
- // point to header
- l_pScanData =
- reinterpret_cast<CompressedScanData *>( l_pRing+l_offset );
-
- // dump record info for debug
- FAPI_DBG( "getRepairRing: %d ringId=0x%x, size=0x%x, chipletId=0x%x",
- l_offset,
- l_pScanData->iv_ringId,
- l_pScanData->iv_chipletId,
- l_pScanData->iv_size );
-
- // Check magic key to make sure this is a valid record.
- if ( l_pScanData->iv_magic != RS4_MAGIC )
- {
- FAPI_ERR( "getRepairRing: Header 0x%x at offset 0x%x, break",
- l_pScanData->iv_magic,
- l_offset );
-
- // @todo
- // test image does not have correct headers, this
- // returns early. Revisit this later.
- //
- // $$const uint32_t &MAGIC = l_pScanData->magic;
- // $$FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_INVALID_MAGIC );
-
- // return 0 size to indicate bad record
- io_rRingBufsize = 0;
- // break out of scan loop
- break;
- }
-
-
- if ( (l_pScanData->iv_ringId == i_ringId)
- && (l_pScanData->iv_chipletId == i_chipletId) )
- {
- FAPI_DBG( "getRepairRing: Found it: 0x%x.0x%x, 0x%x",
- i_ringId,
- i_chipletId,
- l_pScanData->iv_size );
-
- l_foundflag = true;
- // check if we have enough space
- if ( io_rRingBufsize < l_pScanData->iv_size )
- {
- FAPI_ERR( "getRepairRing: output buffer too small: 0x%x < 0x%x",
- io_rRingBufsize,
- l_pScanData->iv_size
- );
-
- // return actual size of data, so caller can re-try with
- // the correct value
- io_rRingBufsize = l_pScanData->iv_size;
- FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_INVALID_SIZE );
-
- // break out of do block with fapi rc set
- break;
- }
-
- // Goodness, return ring and actual size of data.
- io_rRingBufsize = l_pScanData->iv_size;
- // we're good, copy data into the passed-in buffer
- memcpy( io_pRingBuf, l_pScanData, io_rRingBufsize );
-
- FAPI_DBG( "getRepairRing: return record: 0x%x.0x%x %p, 0x%x",
- i_ringId,
- i_chipletId,
- l_pScanData,
- io_rRingBufsize );
-
- // got it, break out of scan loop
- break;
- }
-
- // bump to next ring
- l_offset += l_pScanData->iv_size ;
-
- } // end while scan loop
-
- // foundflag not set, set error and quit
- // @todo
- // revisit here too, this will overwrite RC_REPAIR_INVALID_MAGIC
- //
- if ( ! l_foundflag )
- {
- const uint32_t & RING_MODIFIER = i_ringId;
- FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_NOT_FOUND );
-
- io_rRingBufsize = 0;
- }
-
- } while ( 0 );
-
- // unload the repair ring
- if ( l_pdRRecord != NULL )
- {
- FAPI_DBG( "Unload repair #R record" );
-
- delete[] l_pdRRecord;
- l_pdRRecord = NULL;
- l_pdRLen = 0;
- }
-
- FAPI_DBG(" getRepairRing: exit" );
-
- return l_fapirc;
-}
-
-} // extern "C"
diff --git a/src/usr/hwpf/hwp/makefile b/src/usr/hwpf/hwp/makefile
index 3034d975d..564433632 100644
--- a/src/usr/hwpf/hwp/makefile
+++ b/src/usr/hwpf/hwp/makefile
@@ -41,15 +41,16 @@ OBJS = fapiTestHwp.o \
fapiHwpExecInitFile.o \
dimmBadDqBitmapFuncs.o \
dimmBadDqBitmapAccessHwp.o \
- RepairRingFunc.o \
erepairGetFailedLanesHwp.o \
hwpisteperror.o \
- hwpistepud.o \
+ hwpistepud.o
SUBDIRS = dmi_training.d sbe_centaur_init.d mc_config.d \
dram_training.d activate_powerbus.d build_winkle_images.d \
core_activate.d dram_initialization.d edi_ei_initialization.d \
establish_system_smp.d bus_training.d \
- nest_chiplets.d start_payload.d thread_activate.d slave_sbe.d
+ nest_chiplets.d start_payload.d thread_activate.d slave_sbe.d
+
+include mvpd_accessors/mvpd.mk
include ${ROOTPATH}/config.mk
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getRepairRing.C b/src/usr/hwpf/hwp/mvpd_accessors/getRepairRing.C
new file mode 100644
index 000000000..e88a51001
--- /dev/null
+++ b/src/usr/hwpf/hwp/mvpd_accessors/getRepairRing.C
@@ -0,0 +1,164 @@
+ /* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/hwpf/hwp/RepairRingFunc.C $
+ *
+ * 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_TAG
+ */
+// $Id: RepairRingFunc.C,v 1.1 2012/07/19 22:00:40 mjjones Exp $
+/**
+ * @file getRepairRing.C
+ *
+ * @brief fetch repair rings from MVPD #R records
+ *
+ */
+
+#include <stdint.h>
+
+// fapi support
+#include <fapi.H>
+
+#include <getRepairRing.H>
+#include <mvpdRingFuncs.H>
+
+// pull in CompressedScanData def from proc_slw_build HWP
+#include <p8_scan_compression.H>
+extern "C"
+{
+using namespace fapi;
+
+
+fapi::ReturnCode getRepairRing( const fapi::Target &i_fapiTarget,
+ const uint8_t i_chipletId,
+ const uint8_t i_ringId,
+ uint8_t *io_pRingBuf,
+ uint32_t &io_rRingBufsize)
+{
+ fapi::ReturnCode l_fapirc;
+ uint8_t *l_pRing = NULL;
+ uint8_t *l_pdRRecord = NULL;
+ uint32_t l_pdRLen = 0;
+ uint32_t l_ringLen = 0;
+
+
+ FAPI_DBG(" getRepairRing: entry ringId=0x%x, chipletId=0x%x, size=0x%x ",
+ i_ringId,
+ i_chipletId,
+ io_rRingBufsize );
+
+ do {
+
+ // call fapiGetMvpdField once with a NULL pointer to get the buffer
+ // size no error should be returned.
+ l_fapirc = fapiGetMvpdField( fapi::MVPD_RECORD_CP00,
+ fapi::MVPD_KEYWORD_PDR,
+ i_fapiTarget,
+ NULL,
+ l_pdRLen );
+ if ( l_fapirc )
+ {
+ FAPI_ERR("getRepairRing: fapiGetMvpdField failed to get buffer size");
+
+ io_rRingBufsize = 0;
+ // break out with fapirc
+ break;
+ }
+
+ FAPI_DBG( "getRepairRing: fapiGetMvpdField returned l_pdRLen=0x%x",
+ l_pdRLen );
+
+ // allocate buffer for the record. Always works.
+ l_pdRRecord = new uint8_t[l_pdRLen];
+
+ // load repair ring from MVPD for this target
+ l_fapirc = fapiGetMvpdField( fapi::MVPD_RECORD_CP00,
+ fapi::MVPD_KEYWORD_PDR,
+ i_fapiTarget,
+ l_pdRRecord,
+ l_pdRLen );
+ if ( l_fapirc )
+ {
+ FAPI_ERR("getRepairRing: fapiGetMvpdField failed");
+
+ io_rRingBufsize = 0;
+ // break out with fapirc
+ break;
+ }
+
+ // find ring in Field
+ l_fapirc = findMvpdRingField (i_chipletId,
+ i_ringId,
+ l_pdRRecord,
+ l_pdRLen,
+ l_pRing,
+ l_ringLen);
+ if ( l_fapirc )
+ {
+ FAPI_ERR("getRepairRing: findMvpdRing failed");
+
+ io_rRingBufsize = 0;
+ // break out with fapirc
+ break;
+ }
+ // return buffer pointer is NULL if just looking for the size
+ if ( io_pRingBuf == NULL )
+ {
+ io_rRingBufsize = l_ringLen;
+ // break out of do block with success rc
+ break;
+ }
+ // check if we have enough space
+ if ( io_rRingBufsize < l_ringLen )
+ {
+ FAPI_ERR( "getRepairRing: output buffer too small: 0x%x < 0x%x",
+ io_rRingBufsize,
+ l_ringLen
+ );
+
+ // return actual size of data, so caller can re-try with
+ // the correct value
+ io_rRingBufsize = l_ringLen;
+ FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_INVALID_SIZE );
+
+ // break out of do block with fapi rc set
+ break;
+ }
+ // we're good, copy data into the passed-in buffer
+ memcpy( io_pRingBuf, l_pRing, l_ringLen );
+ io_rRingBufsize = l_ringLen;
+
+ FAPI_DBG( "getRepairRing: return record: 0x%x.0x%x %p, 0x%x",
+ i_ringId,
+ i_chipletId,
+ io_pRingBuf,
+ io_rRingBufsize );
+
+ } while ( 0 );
+
+ // unload the repair ring
+ delete[] l_pdRRecord;
+ l_pdRRecord = NULL;
+
+ FAPI_DBG(" getRepairRing: exit rc=0x%x",
+ static_cast<uint32_t>(l_fapirc) );
+
+ return l_fapirc;
+}
+
+} // extern "C"
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getRepairRing.H b/src/usr/hwpf/hwp/mvpd_accessors/getRepairRing.H
new file mode 100644
index 000000000..07fca40e4
--- /dev/null
+++ b/src/usr/hwpf/hwp/mvpd_accessors/getRepairRing.H
@@ -0,0 +1,74 @@
+ /* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/include/usr/hwpf/hwp/getRepairRing.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_TAG
+ */
+// $Id: RepairRingFunc.H,v 1.1 2012/07/19 22:00:38 mjjones Exp $
+/**
+ * @file getRepairRing.H
+ *
+ * @brief Prototype for getRepairRing() -
+ * get a repair ring from the MVPD #R record
+ */
+
+ #ifndef _HWP_GETREPAIRRING_
+ #define _HWP_GETREPAIRRING_
+
+ #include <fapi.H>
+
+// function pointer typedef definition for HWP call support
+typedef fapi::ReturnCode (*getRepairRing_FP_t) (const fapi::Target &, const uint8_t, const uint8_t, uint8_t *, uint32_t &);
+
+
+extern "C"
+{
+/**
+ * @brief get specified repair ring from MVPD #R record for the specified
+ * target CPU.
+ *
+ * @param i_fapiTarget - cpu target
+ * @param i_chipletId - Chiplet ID
+ * @param i_ringId - Ring ID
+ * @param io_pRingBuf - pointer to a buffer allocated by the caller
+ * if NULL, the size of the buffer required will
+ * be returned with FAPI_RC_SUCCESS.
+ * @param io_rRingBufsize - in: size of ring buffer that caller has
+ * allocated
+ * out: number of BYTES that were copied to the
+ * output buffer.
+ * If the ring was not found, an error
+ * will be returned and this will be 0.
+ * If the output buffer is not big enough,
+ * an error will be returned and this will
+ * be the size required.
+ *
+ * @return fapi::ReturnCode - FAPI_RC_SUCCESS if success,
+ * relevant error code for failure.
+ */
+fapi::ReturnCode getRepairRing( const fapi::Target &i_fapiTarget,
+ const uint8_t i_chipletId,
+ const uint8_t i_ringId,
+ uint8_t *io_pRingBuf,
+ uint32_t &io_rRingBufsize );
+
+}
+
+#endif
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk b/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk
new file mode 100644
index 000000000..995e8efc5
--- /dev/null
+++ b/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk
@@ -0,0 +1,30 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk $
+#
+# 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 otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
+# IBM_PROLOG_END_TAG
+EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/mvpd_accessors
+
+VPATH += mvpd_accessors
+
+OBJS += getRepairRing.o \
+ setRepairRing.o \
+ mvpdRingFuncs.o
+
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.C b/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.C
new file mode 100644
index 000000000..c42b9ffb5
--- /dev/null
+++ b/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.C
@@ -0,0 +1,164 @@
+ /* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/hwpf/hwp/RepairRingFunc.C $
+ *
+ * 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_TAG
+ */
+/**
+ * @file mvpdRingFuncs.C
+ *
+ * @brief common routines
+ *
+ */
+
+#include <stdint.h>
+
+// fapi support
+#include <fapi.H>
+
+#include <mvpdRingFuncs.H>
+
+// pull in CompressedScanData def from proc_slw_build HWP
+#include <p8_scan_compression.H>
+
+extern "C"
+{
+using namespace fapi;
+
+fapi::ReturnCode findMvpdRingField( const uint8_t i_chipletId,
+ const uint8_t i_ringId,
+ uint8_t * const i_pFieldBuf,
+ uint32_t i_fieldBufsize,
+ uint8_t * &o_rRingBuf,
+ uint32_t &o_rRingBufsize)
+{
+ fapi::ReturnCode l_fapirc;
+ uint8_t *l_pRing = NULL;
+ uint32_t l_offset = 0;
+ CompressedScanData *l_pScanData = NULL;
+ bool l_foundflag = false;
+
+ // initialize return fields in case of an error.
+ o_rRingBuf=NULL;
+ o_rRingBufsize=0;
+
+ FAPI_DBG(" findMvpdRingField: entry chipletId=0x%x, ringId=0x%x ",
+ i_chipletId,
+ i_ringId );
+
+ do {
+ // point to #R record
+ l_pRing = i_pFieldBuf;
+
+ //
+ // Find first RSA data block in #R (fixed offset defined by
+ // MVPD spec)
+ //
+ // First byte in #R record should be the version number, skip
+ // over this.
+ //
+ FAPI_DBG( "findMvpdRingField: #R record version = 0x%x", *l_pRing );
+ l_pRing++;
+ l_offset = 0;
+
+ l_foundflag = false;
+ // be sure that data we will look at is within the passed buffer
+ while ( l_offset+sizeof(CompressedScanData) < i_fieldBufsize )
+ {
+ // point to header
+ l_pScanData =
+ reinterpret_cast<CompressedScanData *>( l_pRing+l_offset );
+
+ // Check magic key to make sure this is a valid record.
+ if ( l_pScanData->iv_magic != RS4_MAGIC )
+ {
+ FAPI_ERR( "findMvpdRingField: Header 0x%x at offset 0x%x,hit end of list",
+ l_pScanData->iv_magic,
+ l_offset );
+
+ // TODO: RTC 51917 how to tell the end of the list? Assume that
+ // finding a header without RS4_MAGIC is the end.
+ // TODO: RTC 51716 test image does not have correct header
+ //
+ // keep the following incase there is a different way to find
+ // the end.
+ // $$const uint32_t &MAGIC = l_pScanData->magic;
+ // $$FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_INVALID_MAGIC );
+ // break out of scan loop, ring not found
+ break;
+ }
+ // dump record info for debug
+ FAPI_DBG( "findMvpdRingField: %d ringId=0x%x, chipletId=0x%x, size=0x%x",
+ l_offset,
+ l_pScanData->iv_ringId,
+ l_pScanData->iv_chipletId,
+ l_pScanData->iv_size );
+
+
+ if ( (l_pScanData->iv_ringId == i_ringId)
+ && (l_pScanData->iv_chipletId == i_chipletId) )
+ {
+ FAPI_DBG( "findMvpdRingField: Found it: 0x%x.0x%x, 0x%x",
+ i_ringId,
+ i_chipletId,
+ l_pScanData->iv_size );
+
+ if (l_offset+l_pScanData->iv_size > i_fieldBufsize)
+ {
+ // shouldn't happen, but does not all fit
+ FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_INVALID_SIZE );
+ break;
+ }
+ l_foundflag = true;
+ o_rRingBuf = l_pRing+l_offset;
+ o_rRingBufsize=l_pScanData->iv_size;
+ // got it, break out of scan loop
+ break;
+ }
+
+ // being defensive.
+ if (l_pScanData->iv_size == 0)
+ {
+ // size of 0 is invalid, would loop forever.
+ break;
+ }
+ // bump to next ring
+ l_offset += l_pScanData->iv_size ;
+
+ } // end while scan loop
+
+ // foundflag not set, set error if no other error
+ if ( !l_fapirc && ! l_foundflag )
+ {
+ const uint8_t & RING_MODIFIER = i_ringId;
+ const uint8_t & CHIPLET_ID = i_chipletId;
+ FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_NOT_FOUND );
+ }
+
+ } while ( 0 );
+
+
+ FAPI_DBG(" findMvpdRingField: exit RC=0x%x",
+ static_cast<uint32_t>(l_fapirc) );
+
+ return l_fapirc;
+}
+
+} // extern "C"
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.H b/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.H
new file mode 100644
index 000000000..14e6e40db
--- /dev/null
+++ b/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.H
@@ -0,0 +1,68 @@
+ /* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/include/usr/hwpf/hwp/RepairRingFunc.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_TAG
+ */
+/**
+ * @file mvpdRingFuncs.H
+ *
+ * @brief Prototype for getMvpdRingField() -
+ * return a buffer containing the entire field with a pointer to
+ * the requested ring.
+ */
+
+ #ifndef _HWP_MVPDRINGFUNCS_
+ #define _HWP_MVPDRINGFUNCS_
+
+ #include <fapi.H>
+
+
+
+extern "C"
+{
+
+/**
+ * @brief return mvpd field with pointer to requested ring
+ * for the specified target CPU.
+ * It is an error if the requested ring is not there.
+ * RC_REPAIR_RING_NOT_FOUND will be returned if the requested
+ * ring is not there.
+ *
+ * @param i_chipletId - Chiplet ID to search for
+ * @param i_ringId - Ring ID to search for
+ * @param i_pFieldBuf - The buffer containing the field to search
+ * @param i_fieldBufsize - Number of bytes in the field buffer
+ * @param o_pRingBuf - Pointer to ring in the field buffer
+ * @param o_rRingBufsize - Size of ring
+ *
+ * @return fapi::ReturnCode - FAPI_RC_SUCCESS if success,
+ * relevant error code for failure.
+ */
+
+fapi::ReturnCode findMvpdRingField( const uint8_t i_chipletId,
+ const uint8_t i_ringId,
+ uint8_t * const i_pFieldBuf,
+ uint32_t i_fieldBufsize,
+ uint8_t * &o_rRingBuf,
+ uint32_t &o_rRingBufsize);
+} // extern "C"
+
+#endif // _HWP_REPAIRRINGFUNC
diff --git a/src/usr/hwpf/hwp/mvpd_errors.xml b/src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml
index dacd905e5..c042816c7 100644
--- a/src/usr/hwpf/hwp/mvpd_errors.xml
+++ b/src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml
@@ -58,6 +58,7 @@
The repair ring specified was not found.
</description>
<ffdc>RING_MODIFIER</ffdc>
+ <ffdc>CHIPLET_ID</ffdc>
</hwpError>
<!-- *********************************************************************** -->
</hwpErrors>
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/setRepairRing.C b/src/usr/hwpf/hwp/mvpd_accessors/setRepairRing.C
new file mode 100644
index 000000000..4298c64e0
--- /dev/null
+++ b/src/usr/hwpf/hwp/mvpd_accessors/setRepairRing.C
@@ -0,0 +1,178 @@
+ /* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/hwpf/hwp/setRepairRing.C $
+ *
+ * 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_TAG
+ */
+/**
+ * @file setRepairRing.C
+ *
+ * @brief update repair rings in MVPD #R records
+ *
+ */
+
+#include <stdint.h>
+
+// fapi support
+#include <fapi.H>
+
+#include <setRepairRing.H>
+#include <mvpdRingFuncs.H>
+
+// pull in CompressedScanData def from proc_slw_build HWP
+#include <p8_scan_compression.H>
+extern "C"
+{
+using namespace fapi;
+
+
+fapi::ReturnCode setRepairRing( const fapi::Target &i_fapiTarget,
+ const uint8_t i_chipletId,
+ const uint8_t i_ringId,
+ uint8_t *io_pRingBuf,
+ uint32_t &io_rRingBufsize)
+{
+ fapi::ReturnCode l_fapirc;
+ uint8_t *l_pRing = NULL;
+ uint8_t *l_pdRRecord = NULL;
+ uint32_t l_pdRLen = 0;
+ uint32_t l_ringLen = 0;
+
+
+ FAPI_DBG(" setRepairRing: entry ringId=0x%x, chipletId=0x%x, size=0x%x ",
+ i_ringId,
+ i_chipletId,
+ io_rRingBufsize );
+
+ do {
+
+ // call fapiGetMvpdField once with a NULL pointer to get the buffer
+ // size no error should be returned.
+ l_fapirc = fapiGetMvpdField( fapi::MVPD_RECORD_CP00,
+ fapi::MVPD_KEYWORD_PDR,
+ i_fapiTarget,
+ NULL,
+ l_pdRLen );
+ if ( l_fapirc )
+ {
+ FAPI_ERR("setRepairRing: fapiGetMvpdField failed to get buffer size");
+
+ io_rRingBufsize = 0;
+ // break out with fapirc
+ break;
+ }
+
+ FAPI_DBG( "setRepairRing: fapiGetMvpdField returned l_pdRLen=0x%x",
+ l_pdRLen );
+
+ // allocate buffer for the record. Always works
+ l_pdRRecord = new uint8_t[l_pdRLen];
+
+ // load repair ring from MVPD for this target
+ l_fapirc = fapiGetMvpdField( fapi::MVPD_RECORD_CP00,
+ fapi::MVPD_KEYWORD_PDR,
+ i_fapiTarget,
+ l_pdRRecord,
+ l_pdRLen );
+ if ( l_fapirc )
+ {
+ FAPI_ERR("setRepairRing: fapiGetMvpdField failed");
+
+ io_rRingBufsize = 0;
+ // break out with fapirc
+ break;
+ }
+
+ // find ring in Field
+ l_fapirc = findMvpdRingField (i_chipletId,
+ i_ringId,
+ l_pdRRecord,
+ l_pdRLen,
+ l_pRing,
+ l_ringLen);
+ if ( l_fapirc )
+ {
+ FAPI_ERR("setRepairRing: findMvpdRingField failed");
+
+ io_rRingBufsize = 0;
+ // break out with fapirc
+ break;
+ }
+ // buffer pointer is NULL if just looking for the size
+ if ( io_pRingBuf == NULL )
+ {
+ io_rRingBufsize = l_ringLen;
+ // break out of do block with success rc
+ break;
+ }
+ // check if the ring passes is exactly the same size
+ if ( io_rRingBufsize != l_ringLen )
+ {
+ FAPI_ERR( "setRepairRing: buffer not exactly same size: 0x%x != 0x%x",
+ io_rRingBufsize,
+ l_ringLen
+ );
+
+ // return actual size of data, so caller can re-try with
+ // the correct value
+ io_rRingBufsize = l_ringLen;
+ FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_INVALID_SIZE );
+
+ // break out of do block with fapi rc set
+ break;
+ }
+ // we're good, copy data from the passed-in buffer
+ memcpy( l_pRing, io_pRingBuf, l_ringLen );
+ io_rRingBufsize = l_ringLen;
+
+ FAPI_DBG( "setRepairRing: update record: 0x%x.0x%x %p, 0x%x",
+ i_ringId,
+ i_chipletId,
+ io_pRingBuf,
+ io_rRingBufsize );
+
+ // update repair ring from MVPD for this target
+ l_fapirc = fapiSetMvpdField( fapi::MVPD_RECORD_CP00,
+ fapi::MVPD_KEYWORD_PDR,
+ i_fapiTarget,
+ l_pdRRecord,
+ l_pdRLen );
+ if ( l_fapirc )
+ {
+ FAPI_ERR("setRepairRing: fapiSetMvpdField failed");
+
+ io_rRingBufsize = 0;
+ // break out with fapirc
+ break;
+ }
+
+ } while ( 0 );
+
+ // unload the repair ring
+ delete[] l_pdRRecord;
+ l_pdRRecord = NULL;
+
+ FAPI_DBG(" setRepairRing: exit rc=0x%x",
+ static_cast<uint32_t>(l_fapirc) );
+
+ return l_fapirc;
+}
+
+} // extern "C"
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/setRepairRing.H b/src/usr/hwpf/hwp/mvpd_accessors/setRepairRing.H
new file mode 100644
index 000000000..8af07e53a
--- /dev/null
+++ b/src/usr/hwpf/hwp/mvpd_accessors/setRepairRing.H
@@ -0,0 +1,76 @@
+ /* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/include/usr/hwpf/hwp/setRepairRing.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_TAG
+ */
+// $Id: RepairRingFunc.H,v 1.1 2012/07/19 22:00:38 mjjones Exp $
+/**
+ * @file setRepairRing.H
+ *
+ * @brief Prototype for setRepairRing() -
+ * get a repair ring from the MVPD #R record
+ */
+
+ #ifndef _HWP_SETREPAIRRING_
+ #define _HWP_SETREPAIRRING_
+
+ #include <fapi.H>
+
+// function pointer typedef definition for HWP call support
+typedef fapi::ReturnCode (*setRepairRing_FP_t) (const fapi::Target &, const uint8_t, const uint8_t, uint8_t *, uint32_t &);
+
+extern "C"
+{
+
+/**
+ * @brief update specified repair ring in MVPD #R record for the specified
+ * target CPU. The ring must already be present. This function can not
+ * be used to 'add' a ring. The size of the updated ring must exactly
+ * match the exiting ring, which is updated in place.
+ *
+ * @param i_fapiTarget - cpu target
+ * @param i_chipletId - Chiplet ID
+ * @param i_ringId - Ring ID
+ * @param io_pRingBuf - pointer to a buffer allocated by the caller
+ * if NULL, the size of the buffer required will
+ * be returned with FAPI_RC_SUCCESS.
+ * @param io_rRingBufsize - in: size of ring buffer that caller has
+ * allocated. The size must be the exact
+ * size of the existing ring.
+ * out: If the ring was not found, an error
+ * will be returned and this will be 0.
+ * If the passed ring size does not
+ * exactly match the existing ring,
+ * an error will be returned and this will
+ * be the size required.
+ *
+ * @return fapi::ReturnCode - FAPI_RC_SUCCESS if success,
+ * relevant error code for failure.
+ */
+fapi::ReturnCode setRepairRing( const fapi::Target &i_fapiTarget,
+ const uint8_t i_chipletId,
+ const uint8_t i_ringId,
+ uint8_t *io_pRingBuf,
+ uint32_t &io_rRingBufsize );
+
+}
+
+#endif
diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile
index a48b4df62..9a9cccb96 100644
--- a/src/usr/hwpf/makefile
+++ b/src/usr/hwpf/makefile
@@ -37,7 +37,7 @@ HWP_ERROR_XML_FILES = hwp/fapiHwpErrorInfo.xml \
hwp/dram_training/memory_errors.xml \
hwp/nest_chiplets/proc_start_clocks_chiplets/proc_start_clocks_chiplets_errors.xml \
hwp/edi_ei_initialization/proc_fab_iovalid/proc_fab_smp_errors.xml \
- hwp/mvpd_errors.xml \
+ hwp/mvpd_accessors/mvpd_errors.xml \
../pore/fapiporeve/fapiPoreVe_errors.xml \
hwp/dram_initialization/proc_setup_bars/proc_setup_bars_errors.xml \
hwp/nest_chiplets/proc_chiplet_scominit/proc_chiplet_scominit_errors.xml \
diff --git a/src/usr/hwpf/test/fapiwinkletest.H b/src/usr/hwpf/test/fapiwinkletest.H
index da11c9347..969b0696f 100644
--- a/src/usr/hwpf/test/fapiwinkletest.H
+++ b/src/usr/hwpf/test/fapiwinkletest.H
@@ -40,7 +40,8 @@
#include <targeting/common/commontargeting.H>
#include <targeting/common/utilFilter.H>
-#include <RepairRingFunc.H>
+#include <getRepairRing.H>
+#include <setRepairRing.H>
using namespace fapi;
using namespace TARGETING;
@@ -63,6 +64,9 @@ public:
TARGETING::TargetHandleList l_cpuTargetList;
getAllChips(l_cpuTargetList, TYPE_PROC);
+
+ TS_TRACE( "testGetMvpdPdr l_cpuTargetList.size()= 0x%x ",l_cpuTargetList.size() );
+
// loop thru all the cpu's
for ( uint8_t l_cpuNum=0; l_cpuNum < l_cpuTargetList.size(); l_cpuNum++ )
@@ -139,12 +143,14 @@ public:
uint32_t l_ringBufsize = 0;
uint32_t l_ringId = 0;
uint32_t l_chipletId = 0;
+ uint32_t l_bufsize = 0x200;
+/* TODO comment out until mvpd test data is fixed. RTC 51716
struct _testRRstr {
uint32_t ringIdval;
uint32_t chipletIdval;
uint32_t size;
} l_ringModifiers[] = {
- { 0xe0, 0x8 , 0x20 },
+ { 0xe0, 0x8 , 0x20 },
{ 0xe1, 0x11 , 0x20 },
{ 0xe1, 0x12 , 0x20 },
{ 0xe1, 0x13 , 0x20 },
@@ -166,7 +172,7 @@ public:
{ 0xea, 0x1 , 0x20 },
{ 0xeb, 0x4 , 0x20 },
};
-
+*/
TS_TRACE( "testRepairRings entry" );
TARGETING::TargetHandleList l_cpuTargetList;
@@ -192,38 +198,15 @@ public:
(const_cast<TARGETING::Target*>(l_cpu_target)) );
// allocate some space to put the record(s)
- l_pRingBuf = new uint8_t[ 0x200];
+ l_pRingBuf = new uint8_t[ l_bufsize];
// ----------------------------------------------------------------
- // Pass in a NULL pointer for the ring buffer, should get an error.
- // ----------------------------------------------------------------
- TS_TRACE( "testRepairRings: pass in NULL ptr" );
- l_ringBufsize = 0x0;
- l_ringId = 0;
- l_chipletId = 0;
- l_fapirc = getRepairRing( l_fapi_cpu_target,
- l_chipletId,
- l_ringId,
- NULL,
- l_ringBufsize );
- TS_TRACE( "testRepairRings: ringId=0x%x, chipletId=0x%x: l_ringBufsize=0x%x",
- l_ringId, l_chipletId, l_ringBufsize );
- if ( l_fapirc != fapi::RC_REPAIR_RING_INVALID_RINGBUF_PTR )
- {
- // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL( "testRepairRings: rc FAIL: 0x%x, 0x%x",
- fapi::RC_REPAIR_RING_INVALID_RINGBUF_PTR,
- static_cast<uint32_t>(l_fapirc) );
- fapiLogError(l_fapirc);
- return;
- }
- // ----------------------------------------------------------------
// Pass in 0 for the ring modifier, should return with "not found"
// error
// ----------------------------------------------------------------
TS_TRACE( "testRepairRings: pass in invalid ringId" );
- l_ringBufsize = 0x100;
- l_ringId = 0; // ringId
+ l_ringBufsize = l_bufsize;
+ l_ringId = 0; // ringId
l_chipletId = 0; // chipletId
l_fapirc = getRepairRing( l_fapi_cpu_target,
l_chipletId,
@@ -244,13 +227,15 @@ public:
return;
}
+/* TODO comment out until mvpd test data is fixed. RTC 51716
// loop takes too long, test ring 5
uint8_t i = 5;
// ----------------------------------------------------------------
- // Pass in 0 length with a valid ringId/chipletId, should return
- // with correct length and no buffer.
+ // Pass in a buffer size that is too small with a valid
+ // ringId/chipletId, should return with correct length
+ // and invalid size return code.
// ----------------------------------------------------------------
- TS_TRACE( "testRepairRings: get size of ring %d ", i );
+ TS_TRACE( "testRepairRings: pass buffer too small %d ", i );
l_ringBufsize = 0x0;
l_ringId = l_ringModifiers[i].ringIdval;
l_chipletId = l_ringModifiers[i].chipletIdval;
@@ -280,14 +265,46 @@ public:
l_ringBufsize );
return;
}
+ // ----------------------------------------------------------------
+ // Pass in a NULL pointer with a valid ringId/chipletId, should
+ // return with correct length and successful return code.
+ // ----------------------------------------------------------------
+ TS_TRACE( "testRepairRings: get size of ring %d ", i );
+ l_ringBufsize = 0x0;
+ l_ringId = l_ringModifiers[i].ringIdval;
+ l_chipletId = l_ringModifiers[i].chipletIdval;
+ l_fapirc = getRepairRing( l_fapi_cpu_target,
+ l_chipletId,
+ l_ringId,
+ NULL,
+ l_ringBufsize );
+ TS_TRACE( "testRepairRings: ringId=0x%x, chipletId=0x%x: l_ringBufsize=0x%x",
+ l_ringId,
+ l_chipletId,
+ l_ringBufsize );
+ if ( l_fapirc )
+ {
+ // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
+ TS_FAIL( "testRepairRings: rc FAIL: 0x%x, 0x%x",
+ fapi::FAPI_RC_SUCCESS,
+ static_cast<uint32_t>(l_fapirc));
+ fapiLogError(l_fapirc);
+ return;
+ }
+ if ( l_ringBufsize != l_ringModifiers[i].size )
+ {
+ TS_FAIL( "testRepairRings: size FAIL: 0x%x, 0x%x",
+ l_ringModifiers[i].size,
+ l_ringBufsize );
+ return;
+ }
// ----------------------------------------------------------------
- // RingBufsize should now have the correct size, fetch ring 5.
+ // Fetch ring 5.
// ----------------------------------------------------------------
TS_TRACE( "testRepairRings: get ring %d", i );
-
- // l_ringBufsize set from above...
+ l_ringBufsize = l_bufsize;
l_ringId = l_ringModifiers[i].ringIdval;
l_chipletId = l_ringModifiers[i].chipletIdval;
l_fapirc = getRepairRing( l_fapi_cpu_target,
@@ -298,10 +315,10 @@ public:
TS_TRACE( "testRepairRings: ringId=0x%x, chipletId=0x%x: l_ringBufsize=0x%x",
l_ringId, l_chipletId, l_ringBufsize );
- if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
+ if ( l_fapirc )
{
// note: "uint32_t" below is an _operator_ of fapi::ReturnCode
- TS_FAIL( "testRepairRings: rc FAIL: 0x%x, 0x%x",
+ TS_FAIL( "testRepairRings: getRepairRing rc FAIL: 0x%x, 0x%x",
fapi::FAPI_RC_SUCCESS,
static_cast<uint32_t>(l_fapirc) );
fapiLogError(l_fapirc);
@@ -319,7 +336,128 @@ public:
TRACDBIN( g_trac_test, "testRepairRings: Dump Repair Ring Buffer:",
l_pRingBuf,
l_ringBufsize );
+*/
+
+/* TODO comment out til mvpd dd supports write. Story 39177 and data is fixed
+ // ----------------------------------------------------------------
+ // update the data.
+ // TODO write different data, once the DD is written(story 39177)
+ // read it back to verify, then put the original data back.
+ // ----------------------------------------------------------------
+ TS_TRACE( "testRepairRings: set ring %d", i );
+
+ // l_ringBufsize set from above...
+ l_fapirc = setRepairRing( l_fapi_cpu_target,
+ l_chipletId,
+ l_ringId,
+ l_pRingBuf,
+ l_ringBufsize );
+
+ if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
+ {
+ // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
+ TS_FAIL( "testRepairRings: setRepairRing rc FAIL: 0x%x, 0x%x",
+ fapi::FAPI_RC_SUCCESS,
+ static_cast<uint32_t>(l_fapirc) );
+
+ fapiLogError(l_fapirc);
+ }
+ // ----------------------------------------------------------------
+ // Pass in a buffer size that does not match the exact size
+ // of the ringId/chipletId, should return with correct length
+ // and invalid size return code.
+ // ----------------------------------------------------------------
+ TS_TRACE( "testRepairRings: pass wrong size buffer %d ", i );
+ l_ringBufsize = l_bufsize;
+ l_ringId = l_ringModifiers[i].ringIdval;
+ l_chipletId = l_ringModifiers[i].chipletIdval;
+ l_fapirc = setRepairRing( l_fapi_cpu_target,
+ l_chipletId,
+ l_ringId,
+ l_pRingBuf,
+ l_ringBufsize );
+ TS_TRACE( "testRepairRings: ringId=0x%x, chipletId=0x%x: l_ringBufsize=0x%x",
+ l_ringId,
+ l_chipletId,
+ l_ringBufsize );
+ if ( l_fapirc != fapi::RC_REPAIR_RING_INVALID_SIZE )
+ {
+ // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
+ TS_FAIL( "testRepairRings: rc FAIL: 0x%x, 0x%x",
+ fapi::RC_REPAIR_RING_INVALID_SIZE,
+ static_cast<uint32_t>(l_fapirc));
+ fapiLogError(l_fapirc);
+ return;
+ }
+ if ( l_ringBufsize != l_ringModifiers[i].size )
+ {
+ TS_FAIL( "testRepairRings: size FAIL: 0x%x, 0x%x",
+ l_ringModifiers[i].size,
+ l_ringBufsize );
+ return;
+ }
+ // ----------------------------------------------------------------
+ // Pass in 0 for the ring modifier, should return with "not found"
+ // error
+ // ----------------------------------------------------------------
+ TS_TRACE( "testRepairRings: pass in invalid ringId" );
+ l_ringBufsize = l_ringModifiers[i].size;
+ l_ringId = 0; // ringId
+ l_chipletId = 0; // chipletId
+ l_fapirc = setRepairRing( l_fapi_cpu_target,
+ l_chipletId,
+ l_ringId,
+ l_pRingBuf,
+ l_ringBufsize );
+ TS_TRACE( "testRepairRings: ringId=0x%x, chipletId=0x%x: l_ringBufsize=0x%x",
+ l_ringId,
+ l_chipletId,
+ l_ringBufsize );
+ if ( l_fapirc != fapi::RC_REPAIR_RING_NOT_FOUND )
+ {
+ // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
+ TS_FAIL( "testRepairRings: rc FAIL: 0x%x, 0x%x",
+ fapi::RC_REPAIR_RING_NOT_FOUND,
+ static_cast<uint32_t>(l_fapirc) );
+ fapiLogError(l_fapirc);
+ return;
+ }
+ // ----------------------------------------------------------------
+ // Pass in a NULL pointer with a valid ringId/chipletId, should
+ // return with correct length and successful return code.
+ // ----------------------------------------------------------------
+ TS_TRACE( "testRepairRings: get size of ring(from set) %d ", i );
+ l_ringBufsize = 0x0;
+ l_ringId = l_ringModifiers[i].ringIdval;
+ l_chipletId = l_ringModifiers[i].chipletIdval;
+ l_fapirc = setRepairRing( l_fapi_cpu_target,
+ l_chipletId,
+ l_ringId,
+ NULL,
+ l_ringBufsize );
+ TS_TRACE( "testRepairRings: ringId=0x%x, chipletId=0x%x: l_ringBufsize=0x%x",
+ l_ringId,
+ l_chipletId,
+ l_ringBufsize );
+ if ( l_fapirc )
+ {
+ // note: "uint32_t" below is an _operator_ of fapi::ReturnCode
+ TS_FAIL( "testRepairRings: rc FAIL: 0x%x, 0x%x",
+ fapi::FAPI_RC_SUCCESS,
+ static_cast<uint32_t>(l_fapirc));
+
+ fapiLogError(l_fapirc);
+ return;
+ }
+ if ( l_ringBufsize != l_ringModifiers[i].size )
+ {
+ TS_FAIL( "testRepairRings: size FAIL: 0x%x, 0x%x",
+ l_ringModifiers[i].size,
+ l_ringBufsize );
+ return;
+ }
+*/
// delete allocated space
delete[] l_pRingBuf;
}
diff --git a/src/usr/hwpf/test/makefile b/src/usr/hwpf/test/makefile
index d27b004a1..de77289e4 100644
--- a/src/usr/hwpf/test/makefile
+++ b/src/usr/hwpf/test/makefile
@@ -1,31 +1,32 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/usr/hwpf/test/makefile $
+# $Source: src/usr/hwpf/test/makefile $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011
+# COPYRIGHT International Business Machines Corp. 2011,2012
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# 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.
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
#
-# Origin: 30
+# Origin: 30
#
-# IBM_PROLOG_END
+# IBM_PROLOG_END_TAG
ROOTPATH = ../../../..
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp
+EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/mvpd_accessors
MODULE = testhwpf
TESTS = *.H
OpenPOWER on IntegriCloud