summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/plat
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/hwpf/plat')
-rw-r--r--src/usr/hwpf/plat/fapiPlatMBvpdAccess.C279
-rw-r--r--src/usr/hwpf/plat/fapiPlatMvpdAccess.C18
-rw-r--r--src/usr/hwpf/plat/makefile3
3 files changed, 295 insertions, 5 deletions
diff --git a/src/usr/hwpf/plat/fapiPlatMBvpdAccess.C b/src/usr/hwpf/plat/fapiPlatMBvpdAccess.C
new file mode 100644
index 000000000..f04029038
--- /dev/null
+++ b/src/usr/hwpf/plat/fapiPlatMBvpdAccess.C
@@ -0,0 +1,279 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/hwpf/plat/fapiPlatMBvpdAccess.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* 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 */
+/**
+ * @file fapiPlatMBvpdAccess.C
+ *
+ * @brief Implements the fapiMBvpdAccess.H functions
+ */
+
+#include <stdint.h>
+#include <errl/errlentry.H>
+
+// fapi support
+#include <hwpf/hwpf_reasoncodes.H>
+#include <fapiMBvpdAccess.H>
+
+// MBVPD
+#include <devicefw/userif.H>
+#include <vpd/cvpdenums.H>
+
+
+namespace fapi
+{
+
+//******************************************************************************
+// MBvpdRecordXlate
+// Translates a FAPI MBVPD Record enumerator into a Hostboot MBVPD Record
+// enumerator
+//******************************************************************************
+fapi::ReturnCode MBvpdRecordXlate(const fapi::MBvpdRecord i_fapiRecord,
+ CVPD::cvpdRecord & o_hbRecord)
+{
+ // Create a lookup table for converting a FAPI MBVPD record enumerator to a
+ // Hostboot CVPD record enumerator. This is a simple array and relies on
+ // the FAPI record enumerators starting at zero and incrementing.
+ static const CVPD::cvpdRecord
+ mbvpdFapiRecordToHbRecord[] =
+ {
+ CVPD::VEIR,
+ CVPD::VER0,
+ CVPD::MER0,
+ };
+ const uint8_t NUM_MBVPD_RECORDS =
+ sizeof(mbvpdFapiRecordToHbRecord)/sizeof(mbvpdFapiRecordToHbRecord[0]);
+
+ fapi::ReturnCode l_rc;
+
+ uint8_t l_index = static_cast<uint8_t>(i_fapiRecord);
+
+ if (l_index >= NUM_MBVPD_RECORDS)
+ {
+ FAPI_ERR("MBvpdRecordXlate: Invalid MBVPD Record: 0x%x", i_fapiRecord);
+ /*@
+ * @errortype
+ * @moduleid MOD_MBVPD_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,
+ MOD_MBVPD_ACCESS,
+ 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 = mbvpdFapiRecordToHbRecord[l_index];
+ }
+
+ return l_rc;
+}
+
+//******************************************************************************
+// MBvpdKeywordXlate
+// Translates a FAPI MBVPD Keyword enumerator into a Hostboot CVPD Keyword
+// enumerator
+//******************************************************************************
+fapi::ReturnCode MBvpdKeywordXlate(const fapi::MBvpdKeyword i_fapiKeyword,
+ CVPD::cvpdKeyword & o_hbKeyword)
+{
+ // Create a lookup table for converting a FAPI MBVPD keyword enumerator to a
+ // Hostboot CVPD keyword enumerator. This is a simple array and relies on
+ // the FAPI record enumerators starting at zero and incrementing.
+ static const CVPD::cvpdKeyword
+ mbvpdFapiKeywordToHbKeyword[] =
+ {
+ CVPD::pdI,
+ };
+ const uint8_t NUM_MBVPD_KEYWORDS =
+ sizeof(mbvpdFapiKeywordToHbKeyword)/sizeof(mbvpdFapiKeywordToHbKeyword[0]);
+
+ fapi::ReturnCode l_rc;
+
+ uint8_t l_index = static_cast<uint8_t>(i_fapiKeyword);
+
+ if (l_index >= NUM_MBVPD_KEYWORDS)
+ {
+ FAPI_ERR("MbvpdKeywordXlate: Invalid MVPD Keyword: 0x%x",
+ i_fapiKeyword);
+ /*@
+ * @errortype
+ * @moduleid MOD_MBVPD_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,
+ MOD_MBVPD_ACCESS,
+ 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 = mbvpdFapiKeywordToHbKeyword[l_index];
+ }
+
+ return l_rc;
+}
+
+}
+
+extern "C"
+{
+
+//******************************************************************************
+// fapiGetMBvpdField
+//******************************************************************************
+fapi::ReturnCode fapiGetMBvpdField(const fapi::MBvpdRecord i_record,
+ const fapi::MBvpdKeyword i_keyword,
+ const fapi::Target &i_memBufTarget,
+ uint8_t * const i_pBuffer,
+ uint32_t &io_fieldSize)
+{
+ fapi::ReturnCode l_rc;
+ FAPI_DBG("fapiGetMBvpdField entry");
+
+ do
+ {
+ // Translate the FAPI record to a Hostboot record
+ CVPD::cvpdRecord l_hbRecord = CVPD::CVPD_INVALID_RECORD;
+
+ l_rc = fapi::MBvpdRecordXlate(i_record, l_hbRecord);
+
+ if (l_rc)
+ {
+ break;
+ }
+
+ // Translate the FAPI keyword to a Hostboot keyword
+ CVPD::cvpdKeyword l_hbKeyword = CVPD::CVPD_INVALID_KEYWORD;
+
+ l_rc = fapi::MBvpdKeywordXlate(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_memBufTarget.get()),
+ i_pBuffer,
+ l_fieldLen,
+ DEVICE_CVPD_ADDRESS(l_hbRecord, l_hbKeyword));
+
+ if (l_errl)
+ {
+ FAPI_ERR("fapGetMBvpdField: 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("fapGetMBvpdField: returning field len=0x%x", io_fieldSize);
+
+ } while(0);
+
+ FAPI_DBG( "fapGetMBvpdField: exit" );
+
+ return l_rc;
+}
+
+//******************************************************************************
+// fapSetMBvpdField
+//******************************************************************************
+fapi::ReturnCode fapiSetMBvpdField(const fapi::MBvpdRecord i_record,
+ const fapi::MBvpdKeyword i_keyword,
+ const fapi::Target &i_memBufTarget,
+ const uint8_t * const i_pBuffer,
+ const uint32_t i_fieldSize)
+{
+ fapi::ReturnCode l_rc;
+ FAPI_DBG("fapiSetMBvpdField entry");
+
+ do
+ {
+ // Translate the FAPI record to a Hostboot record
+ CVPD::cvpdRecord l_hbRecord = CVPD::CVPD_INVALID_RECORD;
+
+ l_rc = fapi::MBvpdRecordXlate(i_record, l_hbRecord);
+
+ if (l_rc)
+ {
+ break;
+ }
+
+ // Translate the FAPI keyword to a Hostboot keyword
+ CVPD::cvpdKeyword l_hbKeyword = CVPD::CVPD_INVALID_KEYWORD;
+
+ l_rc = fapi::MBvpdKeywordXlate(i_keyword, l_hbKeyword);
+
+ if (l_rc)
+ {
+ break;
+ }
+
+ size_t l_fieldLen = i_fieldSize;
+
+ errlHndl_t l_errl = deviceWrite(
+ reinterpret_cast< TARGETING::Target*>(i_memBufTarget.get()),
+ const_cast<uint8_t *>(i_pBuffer),
+ l_fieldLen,
+ DEVICE_CVPD_ADDRESS(l_hbRecord, l_hbKeyword));
+
+ if (l_errl)
+ {
+ FAPI_ERR("fapSetMBvpdField: ERROR:deviceWrite : 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;
+ }
+
+ } while(0);
+
+ FAPI_DBG( "fapSetMBvpdField: exit" );
+
+ return l_rc;
+}
+
+} // extern "C"
diff --git a/src/usr/hwpf/plat/fapiPlatMvpdAccess.C b/src/usr/hwpf/plat/fapiPlatMvpdAccess.C
index a048b930f..79a641b8a 100644
--- a/src/usr/hwpf/plat/fapiPlatMvpdAccess.C
+++ b/src/usr/hwpf/plat/fapiPlatMvpdAccess.C
@@ -52,8 +52,7 @@ fapi::ReturnCode MvpdRecordXlate(const fapi::MvpdRecord i_fapiRecord,
// 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] =
+ static const MVPD::mvpdRecord mvpdFapiRecordToHbRecord[] =
{
MVPD::CRP0,
MVPD::CP00,
@@ -70,6 +69,9 @@ fapi::ReturnCode MvpdRecordXlate(const fapi::MvpdRecord i_fapiRecord,
MVPD::LRP9,
MVPD::LRPA,
MVPD::LRPB,
+ MVPD::LRPC,
+ MVPD::LRPD,
+ MVPD::LRPE,
MVPD::LWP0,
MVPD::LWP1,
MVPD::LWP2,
@@ -82,8 +84,14 @@ fapi::ReturnCode MvpdRecordXlate(const fapi::MvpdRecord i_fapiRecord,
MVPD::LWP9,
MVPD::LWPA,
MVPD::LWPB,
+ MVPD::LWPC,
+ MVPD::LWPD,
+ MVPD::LWPE,
MVPD::VWML,
+ MVPD::MER0,
};
+ const uint8_t NUM_MVPD_RECORDS =
+ sizeof(mvpdFapiRecordToHbRecord)/sizeof(mvpdFapiRecordToHbRecord[0]);
fapi::ReturnCode l_rc;
@@ -127,9 +135,8 @@ fapi::ReturnCode MvpdKeywordXlate(const fapi::MvpdKeyword i_fapiKeyword,
// 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 = 0x22;
static const MVPD::mvpdKeyword
- mvpdFapiKeywordToHbKeyword[NUM_MVPD_KEYWORDS] =
+ mvpdFapiKeywordToHbKeyword[] =
{
MVPD::VD,
MVPD::ED,
@@ -165,7 +172,10 @@ fapi::ReturnCode MvpdKeywordXlate(const fapi::MvpdKeyword i_fapiKeyword,
MVPD::pdG,
MVPD::MK,
MVPD::PB,
+ MVPD::CH,
};
+ const uint8_t NUM_MVPD_KEYWORDS =
+ sizeof(mvpdFapiKeywordToHbKeyword)/sizeof(mvpdFapiKeywordToHbKeyword[0]);
fapi::ReturnCode l_rc;
diff --git a/src/usr/hwpf/plat/makefile b/src/usr/hwpf/plat/makefile
index 11a7a8c11..07c1f2cd3 100644
--- a/src/usr/hwpf/plat/makefile
+++ b/src/usr/hwpf/plat/makefile
@@ -5,7 +5,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011,2012
+# COPYRIGHT International Business Machines Corp. 2011,2013
#
# p1
#
@@ -36,6 +36,7 @@ OBJS = fapiPlatHwAccess.o \
fapiPlatUtil.o \
fapiPlatAttributeService.o \
fapiPlatMvpdAccess.o \
+ fapiPlatMBvpdAccess.o \
fapiPlatTask.o \
fapiPlatAttrOverrideSync.o
OpenPOWER on IntegriCloud