summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2012-07-19 17:05:38 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-07-30 17:15:51 -0500
commit0dbf0dfdd65a967045976979a33569db73fc0878 (patch)
treeed2fda18d7ac8213f3d2d660e8fccb645d5ffbfe
parent0a7124143589d15b534f7f2384fecc5a5cd0725f (diff)
downloadtalos-hostboot-0dbf0dfdd65a967045976979a33569db73fc0878.tar.gz
talos-hostboot-0dbf0dfdd65a967045976979a33569db73fc0878.zip
HWPF: Update FAPI Module VPD field access function
In a design meeting, it was agreed that the FAPI Module VPD field access function would be changed to take a record and keyword enumerator, rather than having a separate function for each MVPD field. Change-Id: I0072f2010dbb85ca9edd390ebd5b3730826f3ed0 RTC: 43796 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1404 Tested-by: Jenkins Server Reviewed-by: Van H. Lee <vanlee@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r--src/include/usr/hwpf/fapi/fapiMvpdAccess.H108
-rw-r--r--src/include/usr/hwpf/hwp/RepairRingFunc.H2
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatReasonCodes.H3
-rw-r--r--src/usr/hwpf/hwp/RepairRingFunc.C28
-rw-r--r--src/usr/hwpf/plat/fapiMvpdAccess.C129
-rw-r--r--src/usr/hwpf/plat/fapiPlatMvpdAccess.C271
-rw-r--r--src/usr/hwpf/plat/makefile2
-rw-r--r--src/usr/hwpf/test/fapiwinkletest.H23
8 files changed, 397 insertions, 169 deletions
diff --git a/src/include/usr/hwpf/fapi/fapiMvpdAccess.H b/src/include/usr/hwpf/fapi/fapiMvpdAccess.H
index 92dc8a3b9..85a5c089b 100644
--- a/src/include/usr/hwpf/fapi/fapiMvpdAccess.H
+++ b/src/include/usr/hwpf/fapi/fapiMvpdAccess.H
@@ -21,11 +21,11 @@
*
* IBM_PROLOG_END_TAG
*/
-
+// $Id: fapiMvpdAccess.H,v 1.1 2012/07/19 22:00:12 mjjones Exp $
/**
* @file fapiMvpdAccess.H
*
- * @brief Prototype file for fapiMvpdAccess - read / write records from MVPD
+ * @brief Defines the Module VPD functions that platform must implement
*
*/
@@ -34,32 +34,106 @@
#include <stdint.h>
#include <stddef.h>
-#include <fapi.H>
+#include <fapiReturnCode.H>
+#include <fapiTarget.H>
+
+namespace fapi
+{
+ enum MvpdRecord
+ {
+ MVPD_RECORD_CRP0 = 0x00,
+ MVPD_RECORD_CP00 = 0x01,
+ MVPD_RECORD_VINI = 0x02,
+ MVPD_RECORD_LRP0 = 0x03,
+ MVPD_RECORD_LRP1 = 0x04,
+ MVPD_RECORD_LRP2 = 0x05,
+ MVPD_RECORD_LRP3 = 0x06,
+ MVPD_RECORD_LRP4 = 0x07,
+ MVPD_RECORD_LRP5 = 0x08,
+ MVPD_RECORD_LRP6 = 0x09,
+ MVPD_RECORD_LRP7 = 0x0a,
+ MVPD_RECORD_LRP8 = 0x0b,
+ MVPD_RECORD_LRP9 = 0x0c,
+ MVPD_RECORD_LRPA = 0x0d,
+ MVPD_RECORD_LRPB = 0x0e,
+ MVPD_RECORD_LWP0 = 0x0f,
+ MVPD_RECORD_LWP1 = 0x10,
+ MVPD_RECORD_LWP2 = 0x11,
+ MVPD_RECORD_LWP3 = 0x12,
+ MVPD_RECORD_LWP4 = 0x13,
+ MVPD_RECORD_LWP5 = 0x14,
+ MVPD_RECORD_LWP6 = 0x15,
+ MVPD_RECORD_LWP7 = 0x16,
+ MVPD_RECORD_LWP8 = 0x17,
+ MVPD_RECORD_LWP9 = 0x18,
+ MVPD_RECORD_LWPA = 0x19,
+ MVPD_RECORD_LWPB = 0x1a,
+ MVPD_RECORD_VWML = 0x1b,
+ };
+
+ enum MvpdKeyword
+ {
+ MVPD_KEYWORD_VD = 0x00,
+ MVPD_KEYWORD_ED = 0x01,
+ MVPD_KEYWORD_TE = 0x02,
+ MVPD_KEYWORD_DD = 0x03,
+ MVPD_KEYWORD_PDP = 0x04,
+ MVPD_KEYWORD_ST = 0x05,
+ MVPD_KEYWORD_DN = 0x06,
+ MVPD_KEYWORD_PG = 0x07,
+ MVPD_KEYWORD_PK = 0x08,
+ MVPD_KEYWORD_PDR = 0x09,
+ MVPD_KEYWORD_PDV = 0x0a,
+ MVPD_KEYWORD_PDH = 0x0b,
+ MVPD_KEYWORD_SB = 0x0c,
+ MVPD_KEYWORD_DR = 0x0d,
+ MVPD_KEYWORD_VZ = 0x0e,
+ MVPD_KEYWORD_CC = 0x0f,
+ MVPD_KEYWORD_CE = 0x10,
+ MVPD_KEYWORD_FN = 0x11,
+ MVPD_KEYWORD_PN = 0x12,
+ MVPD_KEYWORD_SN = 0x13,
+ MVPD_KEYWORD_PR = 0x14,
+ MVPD_KEYWORD_HE = 0x15,
+ MVPD_KEYWORD_CT = 0x16,
+ MVPD_KEYWORD_HW = 0x17,
+ MVPD_KEYWORD_PDM = 0x18,
+ MVPD_KEYWORD_IN = 0x19,
+ MVPD_KEYWORD_PD2 = 0x1a,
+ MVPD_KEYWORD_PD3 = 0x1b,
+ MVPD_KEYWORD_OC = 0x1c,
+ MVPD_KEYWORD_FO = 0x1d,
+ MVPD_KEYWORD_PDI = 0x1e,
+ };
+}
extern "C"
{
/**
- * @brief fetch Module VPD #R record.
+ * @brief Get Module VPD field.
+ *
+ * A Module VPD field is specified using a record and keyword enumerator
+ *
* Suggested way to call this routine is to call it once with a NULL buffer
* pointer to to retrieve the size of the record, then allocate the proper
* size of the buffer and call again.
*
- * @param[in] - i_fapiTarget - target that the #R record belongs to
- * @param[in] - i_pPdrRecord - pointer to a buffer
- * Caller is responsible for allocating the buffer ahead
- * of time.
- * If NULL is passed in, the proper size of the #R record
- * will be returned in the o_rPdrSize parameter below.
- * @param[in,out] - io_rPdrSize - size of the #R record in BYTES.
- * If the record was not found, an error will be returned
- * and this will be set to 0.
+ * @param[in] i_record Record enumerator
+ * @param[in] i_keyword Keyword enumerator
+ * @param[in] i_procTarget Pointer to processor chip target for the record
+ * @param[in] i_pBuffer Pointer to buffer where record will be stored. If
+ * NULL then the size of record will be stored in
+ * io_fieldSize
+ * @param[io] io_fieldSize Size of i_pBuffer in bytes
*
- * @return - FAPI_RC_SUCCESS, or failure value.
+ * @return fapi::ReturnCode. FAPI_RC_SUCCESS, or failure value.
*/
-fapi::ReturnCode fapiGetMvpdPdr( const fapi::Target &i_fapiTarget,
- uint8_t *i_pPdrRecord,
- uint32_t &io_rPdrSize );
+fapi::ReturnCode fapiGetMvpdField(const fapi::MvpdRecord i_record,
+ const fapi::MvpdKeyword i_keyword,
+ const fapi::Target &i_procTarget,
+ uint8_t * const i_pBuffer,
+ uint32_t &io_fieldSize);
}
#endif
diff --git a/src/include/usr/hwpf/hwp/RepairRingFunc.H b/src/include/usr/hwpf/hwp/RepairRingFunc.H
index 921b9628e..976ecde76 100644
--- a/src/include/usr/hwpf/hwp/RepairRingFunc.H
+++ b/src/include/usr/hwpf/hwp/RepairRingFunc.H
@@ -21,7 +21,7 @@
*
* IBM_PROLOG_END_TAG
*/
-
+// $Id: RepairRingFunc.H,v 1.1 2012/07/19 22:00:38 mjjones Exp $
/**
* @file RepairRingFunc.H
*
diff --git a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H
index 3bc7749d4..ac6bd71cc 100644
--- a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H
+++ b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H
@@ -76,6 +76,7 @@ namespace fapi
MOD_ATTR_PROC_PCIE_BAR_ENABLE_GET = 0x24,
MOD_ATTR_PROC_PCIE_BAR_BASE_ADDR_GET = 0x25,
MOD_ATTR_PROC_PCIE_BAR_SIZE_GET = 0x26,
+ MOD_MVPD_ACCESS = 0x27,
};
/**
@@ -109,6 +110,8 @@ namespace fapi
RC_UNEXPECTED_TARGET_TYPE = HWPF_COMP_ID | 0x20,
RC_ATTR_UNKNOWN_TARGET_NAME = HWPF_COMP_ID | 0x21,
RC_ATTR_UNSUPPORTED_PROC_NUM = HWPF_COMP_ID | 0x22,
+ RC_INVALID_RECORD = HWPF_COMP_ID | 0x23,
+ RC_INVALID_KEYWORD = HWPF_COMP_ID | 0x24,
};
/**
diff --git a/src/usr/hwpf/hwp/RepairRingFunc.C b/src/usr/hwpf/hwp/RepairRingFunc.C
index 2d63f4c60..3b84f19f6 100644
--- a/src/usr/hwpf/hwp/RepairRingFunc.C
+++ b/src/usr/hwpf/hwp/RepairRingFunc.C
@@ -21,7 +21,7 @@
*
* IBM_PROLOG_END_TAG
*/
-
+// $Id: RepairRingFunc.C,v 1.1 2012/07/19 22:00:40 mjjones Exp $
/**
* @file RepairRingFunc.C
*
@@ -99,21 +99,23 @@ fapi::ReturnCode getRepairRing( const fapi::Target &i_fapiTarget,
FAPI_DBG( "getRepairRing: get MVPD #R buffer" );
- // call fapiGetMvpdPdr once with a NULL pointer to get the buffer size
- // no error should be returned.
- l_fapirc = fapiGetMvpdPdr( i_fapiTarget,
- NULL,
- l_pdRLen );
+ // 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: fapiGetMvpdPdr failed to get buffer size");
+ FAPI_ERR("getRepairRing: fapiGetMvpdField failed to get buffer size");
io_rRingBufsize = 0;
// break out with fapirc
break;
}
- FAPI_DBG( "getRepairRing: fapiGetMvpdPdr returned l_pdRLen=0x%x",
+ FAPI_DBG( "getRepairRing: fapiGetMvpdField returned l_pdRLen=0x%x",
l_pdRLen );
// allocate buffer for the record
@@ -130,12 +132,14 @@ fapi::ReturnCode getRepairRing( const fapi::Target &i_fapiTarget,
}
// load repair ring from MVPD for this target
- l_fapirc = fapiGetMvpdPdr( i_fapiTarget,
- l_pdRRecord,
- l_pdRLen );
+ l_fapirc = fapiGetMvpdField( fapi::MVPD_RECORD_CP00,
+ fapi::MVPD_KEYWORD_PDR,
+ i_fapiTarget,
+ l_pdRRecord,
+ l_pdRLen );
if ( l_fapirc )
{
- FAPI_ERR("getRepairRing: fapiGetMvpdPdr failed");
+ FAPI_ERR("getRepairRing: fapiGetMvpdField failed");
io_rRingBufsize = 0;
// break out with fapirc
diff --git a/src/usr/hwpf/plat/fapiMvpdAccess.C b/src/usr/hwpf/plat/fapiMvpdAccess.C
deleted file mode 100644
index b7d57726b..000000000
--- a/src/usr/hwpf/plat/fapiMvpdAccess.C
+++ /dev/null
@@ -1,129 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/hwpf/plat/fapiMvpdAccess.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 fapiMvpdAccess.C
- *
- * @brief fetch #R records from MVPD
- *
- * More prototypes may be added later to fetch other records from MVPD
- *
- */
-
-#include <stdint.h>
-
-#include <errl/errlentry.H>
-
-// targeting support
-#include <targeting/common/commontargeting.H>
-
-// fapi support
-#include <fapi.H>
-#include <fapiPlatHwpInvoker.H>
-#include <hwpf/plat/fapiPlatReasonCodes.H>
-
-// MVPD
-#include <devicefw/userif.H>
-#include <mvpd/mvpdenums.H>
-
-#include <fapiMvpdAccess.H>
-
-
-extern "C"
-{
-using namespace TARGETING;
-using namespace fapi;
-using namespace DeviceFW;
-
-
-/**
- * @def Max length for #R record
- */
-const size_t MAX_pdR_RECORD = 0xffff;
-
-// *********************************************************************
-// fapiGetMvpdPdr - get #R record from MVPD
-//
-// @NOTE: The P8 module VPD specification, March 27, 2012,
-// section 5.30.1 is wrong - #R records are in CP00.
-// *********************************************************************
-fapi::ReturnCode fapiGetMvpdPdr( const fapi::Target &i_fapiTarget,
- uint8_t *i_pPdrRecord,
- uint32_t &io_rPdrSize )
-{
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
- errlHndl_t l_errl = NULL;
- size_t l_pdRLen = 0;
-
- FAPI_DBG( "fapiGetMvpdPdr entry" );
-
- // #R record looks like this:
- // Field Type length Value
- // Name ASCII 2 "#R"
- // Length HEX 2 -
- // Version HEX 1 0x10
- // Chiplet-max HEX 12288 -
-
- do
- {
- // pass the parameters through to deviceRead. If the pointer is NULL,
- // deviceRead will pass the correct size back to the caller with no
- // error. ( RTC 42489 )
-
- l_pdRLen = io_rPdrSize;
- // Try to read the data
- l_errl = deviceRead( reinterpret_cast< TARGETING::Target*>(i_fapiTarget.get()),
- i_pPdrRecord,
- l_pdRLen,
- DEVICE_MVPD_ADDRESS( MVPD::CP00,
- MVPD::pdR ) );
- if ( l_errl )
- {
- FAPI_ERR( "fapiGetMvpdPdr: ERROR: deviceRead : errorlog PLID=0x%x",
- l_errl->plid() );
-
- // set fapi error and commit errlog
- l_fapirc.setPlatError(reinterpret_cast<void *> (l_errl));
-
- // set returned size to 0
- io_rPdrSize = 0;
-
- // Return fapirc to caller
- break;
- }
-
- // made it all the way to the bottom with no errors,
- // return to caller with buffer and size filled in
- FAPI_DBG( "fapiGetMvpdPdr: returning #R record len=0x%x",
- l_pdRLen );
- io_rPdrSize = l_pdRLen;
-
- } while ( 0 );
-
-
- FAPI_DBG( "fapiGetMvpdPdr: exit" );
-
- return l_fapirc;
-}
-
-} // extern "C"
diff --git a/src/usr/hwpf/plat/fapiPlatMvpdAccess.C b/src/usr/hwpf/plat/fapiPlatMvpdAccess.C
new file mode 100644
index 000000000..5328145e9
--- /dev/null
+++ b/src/usr/hwpf/plat/fapiPlatMvpdAccess.C
@@ -0,0 +1,271 @@
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/hwpf/plat/fapiPlatMvpdAccess.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 fapiPlatMvpdAccess.C
+ *
+ * @brief Implements the fapiMvpdAccess.H functions
+ */
+
+#include <stdint.h>
+#include <errl/errlentry.H>
+
+// fapi support
+#include <hwpf/plat/fapiPlatReasonCodes.H>
+#include <fapiMvpdAccess.H>
+
+// MVPD
+#include <devicefw/userif.H>
+#include <mvpd/mvpdenums.H>
+
+
+namespace fapi
+{
+
+//******************************************************************************
+// MvpdRecordXlate
+// Translates a FAPI MVPD Record enumerator into a Hostboot MVPD Record
+// enumerator
+//******************************************************************************
+fapi::ReturnCode MvpdRecordXlate(const fapi::MvpdRecord i_fapiRecord,
+ MVPD::mvpdRecord & o_hbRecord)
+{
+ // Create a lookup table for converting a FAPI MVPD record enumerator to a
+ // Hostboot MVPD record enumerator. This is a simple array and relies on
+ // the FAPI record enumerators starting at zero and incrementing.
+ const uint8_t NUM_MVPD_RECORDS = 0x1c;
+ static const MVPD::mvpdRecord mvpdFapiRecordToHbRecord[NUM_MVPD_RECORDS] =
+ {
+ MVPD::CRP0,
+ MVPD::CP00,
+ MVPD::VINI,
+ MVPD::LRP0,
+ MVPD::LRP1,
+ MVPD::LRP2,
+ MVPD::LRP3,
+ MVPD::LRP4,
+ MVPD::LRP5,
+ MVPD::LRP6,
+ MVPD::LRP7,
+ MVPD::LRP8,
+ MVPD::LRP9,
+ MVPD::LRPA,
+ MVPD::LRPB,
+ MVPD::LWP0,
+ MVPD::LWP1,
+ MVPD::LWP2,
+ MVPD::LWP3,
+ MVPD::LWP4,
+ MVPD::LWP5,
+ MVPD::LWP6,
+ MVPD::LWP7,
+ MVPD::LWP8,
+ MVPD::LWP9,
+ MVPD::LWPA,
+ MVPD::LWPB,
+ MVPD::VWML,
+ };
+
+ fapi::ReturnCode l_rc;
+
+ uint8_t l_index = static_cast<uint8_t>(i_fapiRecord);
+
+ if (l_index >= NUM_MVPD_RECORDS)
+ {
+ FAPI_ERR("MvpdRecordXlate: Invalid MVPD Record: 0x%x", i_fapiRecord);
+ /*@
+ * @errortype
+ * @moduleid MOD_MVPD_ACCESS
+ * @reasoncode RC_INVALID_RECORD
+ * @userdata1 Record enumerator
+ * @devdesc Attempt to read an MVPD field using an invalid record
+ */
+ errlHndl_t l_errl = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi::MOD_MVPD_ACCESS,
+ fapi::RC_INVALID_RECORD,
+ i_fapiRecord);
+
+ // Add the error log pointer as data to the ReturnCode
+ l_rc.setPlatError(reinterpret_cast<void *> (l_errl));
+ }
+ else
+ {
+ o_hbRecord = mvpdFapiRecordToHbRecord[l_index];
+ }
+
+ return l_rc;
+}
+
+//******************************************************************************
+// MvpdKeywordXlate
+// Translates a FAPI MVPD Keyword enumerator into a Hostboot MVPD Keyword
+// enumerator
+//******************************************************************************
+fapi::ReturnCode MvpdKeywordXlate(const fapi::MvpdKeyword i_fapiKeyword,
+ MVPD::mvpdKeyword & o_hbKeyword)
+{
+ // Create a lookup table for converting a FAPI MVPD keyword enumerator to a
+ // Hostboot MVPD keyword enumerator. This is a simple array and relies on
+ // the FAPI record enumerators starting at zero and incrementing.
+ const uint8_t NUM_MVPD_KEYWORDS = 0x1f;
+ static const MVPD::mvpdKeyword
+ mvpdFapiKeywordToHbKeyword[NUM_MVPD_KEYWORDS] =
+ {
+ MVPD::VD,
+ MVPD::ED,
+ MVPD::TE,
+ MVPD::DD,
+ MVPD::pdP,
+ MVPD::ST,
+ MVPD::DN,
+ MVPD::PG,
+ MVPD::PK,
+ MVPD::pdR,
+ MVPD::pdV,
+ MVPD::pdH,
+ MVPD::SB,
+ MVPD::DR,
+ MVPD::VZ,
+ MVPD::CC,
+ MVPD::CE,
+ MVPD::FN,
+ MVPD::PN,
+ MVPD::SN,
+ MVPD::PR,
+ MVPD::HE,
+ MVPD::CT,
+ MVPD::HW,
+ MVPD::pdM,
+ MVPD::IN,
+ MVPD::pd2,
+ MVPD::pd3,
+ MVPD::OC,
+ MVPD::FO,
+ MVPD::pdI,
+ };
+
+ fapi::ReturnCode l_rc;
+
+ uint8_t l_index = static_cast<uint8_t>(i_fapiKeyword);
+
+ if (l_index >= NUM_MVPD_KEYWORDS)
+ {
+ FAPI_ERR("MvpdKeywordXlate: Invalid MVPD Keyword: 0x%x", i_fapiKeyword);
+ /*@
+ * @errortype
+ * @moduleid MOD_MVPD_ACCESS
+ * @reasoncode RC_INVALID_KEYWORD
+ * @userdata1 Keyword enumerator
+ * @devdesc Attempt to read an MVPD field using an invalid keyword
+ */
+ errlHndl_t l_errl = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi::MOD_MVPD_ACCESS,
+ fapi::RC_INVALID_KEYWORD,
+ i_fapiKeyword);
+
+ // Add the error log pointer as data to the ReturnCode
+ l_rc.setPlatError(reinterpret_cast<void *> (l_errl));
+ }
+ else
+ {
+ o_hbKeyword = mvpdFapiKeywordToHbKeyword[l_index];
+ }
+
+ return l_rc;
+}
+
+}
+
+extern "C"
+{
+
+//******************************************************************************
+// fapiGetMvpdField
+//******************************************************************************
+fapi::ReturnCode fapiGetMvpdField(const fapi::MvpdRecord i_record,
+ const fapi::MvpdKeyword i_keyword,
+ const fapi::Target &i_procTarget,
+ uint8_t * const i_pBuffer,
+ uint32_t &io_fieldSize)
+{
+ fapi::ReturnCode l_rc;
+ FAPI_DBG("fapiGetMvpdField entry");
+
+ do
+ {
+ // Translate the FAPI record to a Hostboot record
+ MVPD::mvpdRecord l_hbRecord = MVPD::MVPD_INVALID_RECORD;
+
+ l_rc = fapi::MvpdRecordXlate(i_record, l_hbRecord);
+
+ if (l_rc)
+ {
+ break;
+ }
+
+ // Translate the FAPI keyword to a Hostboot keyword
+ MVPD::mvpdKeyword l_hbKeyword = MVPD::INVALID_MVPD_KEYWORD;
+
+ l_rc = fapi::MvpdKeywordXlate(i_keyword, l_hbKeyword);
+
+ if (l_rc)
+ {
+ break;
+ }
+
+ // Similarly to this function, deviceRead will return the size of the
+ // field if the pointer is NULL
+ size_t l_fieldLen = io_fieldSize;
+
+ errlHndl_t l_errl = deviceRead(
+ reinterpret_cast< TARGETING::Target*>(i_procTarget.get()),
+ i_pBuffer,
+ l_fieldLen,
+ DEVICE_MVPD_ADDRESS(l_hbRecord, l_hbKeyword));
+
+ if (l_errl)
+ {
+ FAPI_ERR("fapiGetMvpdField: ERROR: deviceRead : errorlog PLID=0x%x",
+ l_errl->plid());
+
+ // Add the error log pointer as data to the ReturnCode
+ l_rc.setPlatError(reinterpret_cast<void *> (l_errl));
+
+ break;
+ }
+
+ // Success, update callers io_fieldSize for the case where the pointer
+ // is NULL and deviceRead returned the actual size
+ io_fieldSize = l_fieldLen;
+ FAPI_DBG("fapiGetMvpdField: returning field len=0x%x", io_fieldSize);
+
+ } while(0);
+
+ FAPI_DBG( "fapiGetMvpdField: exit" );
+
+ return l_rc;
+}
+
+} // extern "C"
diff --git a/src/usr/hwpf/plat/makefile b/src/usr/hwpf/plat/makefile
index 1056e9ecd..4bb17e545 100644
--- a/src/usr/hwpf/plat/makefile
+++ b/src/usr/hwpf/plat/makefile
@@ -35,7 +35,7 @@ OBJS = fapiPlatHwAccess.o \
fapiPlatTarget.o \
fapiPlatUtil.o \
fapiPlatAttributeService.o \
- fapiMvpdAccess.o \
+ fapiPlatMvpdAccess.o \
fapiPlatTask.o \
fapiPlatAttrOverrideDirect.o
diff --git a/src/usr/hwpf/test/fapiwinkletest.H b/src/usr/hwpf/test/fapiwinkletest.H
index ceaff03ad..f9bd7c0c5 100644
--- a/src/usr/hwpf/test/fapiwinkletest.H
+++ b/src/usr/hwpf/test/fapiwinkletest.H
@@ -50,7 +50,7 @@ class FapiWinkleTest: public CxxTest::TestSuite
public:
/**
- * @brief call fapiGetMvpdPdr to fetch a #R record.
+ * @brief call fapiGetMvpdField to fetch a #R record.
*
*/
void testGetMvpdPdr()
@@ -86,16 +86,18 @@ public:
reinterpret_cast<void *>
(const_cast<TARGETING::Target*>(l_cpu_target)) );
- TS_TRACE( "call fapiGetMvpdPdr with NULL pointer" );
+ TS_TRACE( "call fapiGetMvpdField with NULL pointer" );
- // call fapiGetMvpdPdr once with a NULL pointer to get the buffer size
+ // call fapiGetMvpdField once with a NULL pointer to get the buffer size
// should return no error now.
- l_fapirc = fapiGetMvpdPdr( l_fapi_cpu_target,
+ l_fapirc = fapiGetMvpdField(fapi::MVPD_RECORD_CP00,
+ fapi::MVPD_KEYWORD_PDR,
+ l_fapi_cpu_target,
NULL,
l_pdRLen );
if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
{
- TS_FAIL( "testGetMvpdPdr: expected FAPI_RC_SUCCESS" );
+ TS_FAIL( "fapiGetMvpdField: expected FAPI_RC_SUCCESS" );
fapiLogError(l_fapirc);
return;
}
@@ -104,7 +106,7 @@ public:
// above.
if ( l_pdRLen != MVPD_PDR_TEST_SIZE )
{
- TS_FAIL( "testGetMvpdPdr: expected size = 0x%x, received 0x%x",
+ TS_FAIL( "fapiGetMvpdField: expected size = 0x%x, received 0x%x",
MVPD_PDR_TEST_SIZE,
l_pdRLen );
fapiLogError(l_fapirc);
@@ -114,14 +116,17 @@ public:
// do a malloc instead of a new just for variety
l_pdRRecord = reinterpret_cast<uint8_t *>(malloc(l_pdRLen) );
- // call fapiGetMvpdPdr once with a NULL pointer to get the buffer size
- l_fapirc = fapiGetMvpdPdr( l_fapi_cpu_target,
+ // call fapiGetMvpdField once with a valid pointer
+ l_fapirc = fapiGetMvpdField(fapi::MVPD_RECORD_CP00,
+ fapi::MVPD_KEYWORD_PDR,
+ l_fapi_cpu_target,
l_pdRRecord,
l_pdRLen );
if ( l_fapirc != fapi::FAPI_RC_SUCCESS )
{
- TS_FAIL( "testGetMvpdPdr: expected FAPI_RC_SUCCESS" );
+ TS_FAIL( "fapiGetMvpdField: expected FAPI_RC_SUCCESS" );
fapiLogError(l_fapirc);
+ free( l_pdRRecord );
return;
}
OpenPOWER on IntegriCloud