summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElizabeth Liner <eliner@us.ibm.com>2017-07-23 18:25:00 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-08-22 10:37:01 -0400
commitf01850d033176cb33c2396ed26377a3fc965787a (patch)
tree91618ccaf0a7baf690295a86271d2b7483d925ee
parentb74c51e043b4466f675cda22591b32aa50cef497 (diff)
downloadtalos-hostboot-f01850d033176cb33c2396ed26377a3fc965787a.tar.gz
talos-hostboot-f01850d033176cb33c2396ed26377a3fc965787a.zip
Adding in MEMD functionality with multiple copies
This commit adds support for a separate version of the MEMD VPD. In the PNOR, we will have a new optional section that will contain multiple versions of the MEMD VPD. This code adds the functionality to loop through the different versions and check the VM keyword to find a matching one. Change-Id: I3f8e6e589c31b3b480d915a1b29b4614fa809162 RTC:175158 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43508 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rwxr-xr-xsrc/build/mkrules/hbfw/img/makefile11
-rw-r--r--src/include/usr/fapi2/plat_vpd_access.H17
-rw-r--r--src/include/usr/vpd/memd_vpdenums.H21
-rw-r--r--src/usr/fapi2/plat_vpd_access.C218
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/attribute_types_hb.xml14
-rw-r--r--src/usr/targeting/common/xmltohb/target_types_hb.xml5
-rw-r--r--src/usr/vpd/ipvpd.C22
-rw-r--r--src/usr/vpd/ipvpd.H6
8 files changed, 293 insertions, 21 deletions
diff --git a/src/build/mkrules/hbfw/img/makefile b/src/build/mkrules/hbfw/img/makefile
index 2d1063bd6..b7a2b1a37 100755
--- a/src/build/mkrules/hbfw/img/makefile
+++ b/src/build/mkrules/hbfw/img/makefile
@@ -91,12 +91,13 @@ PAYLOAD_FINAL_IMG = PAYLOAD.bin
RINGOVD_FINAL_IMG = RINGOVD.bin
SBKT_FINAL_IMG = SBKT.bin
FIRDATA_FINAL_IMG = FIRDATA.bin
+MEMD_FINAL_IMG = MEMD.bin
FINAL_OUTPUT_IMAGES = ${HBBL_FINAL_IMG} ${HBB_FINAL_IMG} ${HBI_FINAL_IMG} \
${HBRT_FINAL_IMG} ${TEST_FINAL_IMG} ${TESTRO_FINAL_IMG} \
${HBEL_FINAL_IMG} ${GUARD_FINAL_IMG} ${GLOBAL_FINAL_IMG} \
${DJVPD_FINAL_IMG} ${MVPD_FINAL_IMG} ${CVPD_FINAL_IMG} \
${PAYLOAD_FINAL_IMG} ${RINGOVD_FINAL_IMG} ${SBKT_FINAL_IMG} \
- ${FIRDATA_FINAL_IMG}
+ ${FIRDATA_FINAL_IMG} ${MEMD_FINAL_IMG}
# Aggregate
ALL_DEFAULT_IMAGES = ${DEFAULT_INPUT_IMAGES} ${FINAL_OUTPUT_IMAGES}
@@ -122,7 +123,7 @@ PNOR_LAYOUT = ${pnorLayoutFSP.xml:P}
# Decide which PNOR to build
.if(${FAKEPNOR} == "")
# Parameters passed into GEN_PNOR_IMAGE_SCRIPT.
- GEN_DEFAULT_BIN_FILES = HBBL=${HBBL_IMG},HBB=${HBB_IMG},HBI=${HBI_IMG},HBRT=${HBRT_IMG},TEST=EMPTY,TESTRO=EMPTY,HBEL=EMPTY,GUARD=EMPTY,GLOBAL=EMPTY,PAYLOAD=EMPTY,CVPD=EMPTY,MVPD=EMPTY,DJVPD=EMPTY,RINGOVD=EMPTY,SBKT=EMPTY,FIRDATA=EMPTY
+ GEN_DEFAULT_BIN_FILES = HBBL=${HBBL_IMG},HBB=${HBB_IMG},HBI=${HBI_IMG},HBRT=${HBRT_IMG},TEST=EMPTY,TESTRO=EMPTY,HBEL=EMPTY,GUARD=EMPTY,GLOBAL=EMPTY,PAYLOAD=EMPTY,CVPD=EMPTY,MVPD=EMPTY,DJVPD=EMPTY,RINGOVD=EMPTY,SBKT=EMPTY,FIRDATA=EMPTY,MEMD=EMPTY
DEFAULT_PARAMS = --build-all --emit-eccless ${TARGET_TEST:b--test} ${HB_STANDALONE:b--hb-standalone} \
${CONFIG_SECUREBOOT:b--secureboot} --systemBinFiles ${GEN_DEFAULT_BIN_FILES} \
--pnorLayout ${PNOR_LAYOUT} ${KEY_TRANSITION_PARAMS} ${CORRUPT_PARAMS} \
@@ -130,7 +131,7 @@ PNOR_LAYOUT = ${pnorLayoutFSP.xml:P}
.else
PNOR_LAYOUT = ${pnorLayoutFake.xml:P}
# Parameters passed into GEN_PNOR_IMAGE_SCRIPT.
- GEN_DEFAULT_BIN_FILES = HBI=${HBI_IMG},HBEL=EMPTY,MVPD=${${VPO_FAKE_MVPD}:P},DJVPD=${${VPO_FAKE_DJVPD}:P},FIRDATA=EMPTY
+ GEN_DEFAULT_BIN_FILES = HBI=${HBI_IMG},HBEL=EMPTY,MVPD=${${VPO_FAKE_MVPD}:P},DJVPD=${${VPO_FAKE_DJVPD}:P},FIRDATA=EMPTY,MEMD=EMPTY
DEFAULT_PARAMS = --systemBinFiles ${GEN_DEFAULT_BIN_FILES} --pnorLayout ${PNOR_LAYOUT}
.endif
@@ -302,7 +303,7 @@ gen_system_specific_images_bypass_cache :
.endif
# @TODO RTC 178235 Remove Symbolic Link Creation Below
- ln -f -s p9n.SbePartition.header.bin p9nSbePartition.header.bin
+ ln -f -s p9n.SbePartition.header.bin p9nSbePartition.header.bin
# build_sbe_partitions build step generates SBE partition files that ODE is
# unaware of due to the file cache that we cannot disable. To work around that,
@@ -311,7 +312,7 @@ gen_system_specific_images_bypass_cache :
gen_system_specific_images: build_sbe_partitions .PMAKE
@${MAKE:T:R} gen_system_specific_images_bypass_cache
-HOSTBOOT_DEFAULT_SECTIONS = HBBL=${HBBL_FINAL_IMG},HBB=${HBB_FINAL_IMG},HBI=${HBI_FINAL_IMG},HBRT=${HBRT_FINAL_IMG},TEST=${TEST_FINAL_IMG},TESTRO=${TESTRO_FINAL_IMG},HBEL=${HBEL_FINAL_IMG},GUARD=${GUARD_FINAL_IMG},GLOBAL=${GLOBAL_FINAL_IMG},PAYLOAD=${PAYLOAD_FINAL_IMG},CVPD=${CVPD_FINAL_IMG},MVPD=${MVPD_FINAL_IMG},DJVPD=${DJVPD_FINAL_IMG},RINGOVD=${RINGOVD_FINAL_IMG},SBKT=${SBKT_FINAL_IMG},FIRDATA=${FIRDATA_FINAL_IMG}
+HOSTBOOT_DEFAULT_SECTIONS = HBBL=${HBBL_FINAL_IMG},HBB=${HBB_FINAL_IMG},HBI=${HBI_FINAL_IMG},HBRT=${HBRT_FINAL_IMG},TEST=${TEST_FINAL_IMG},TESTRO=${TESTRO_FINAL_IMG},HBEL=${HBEL_FINAL_IMG},GUARD=${GUARD_FINAL_IMG},GLOBAL=${GLOBAL_FINAL_IMG},PAYLOAD=${PAYLOAD_FINAL_IMG},CVPD=${CVPD_FINAL_IMG},MVPD=${MVPD_FINAL_IMG},DJVPD=${DJVPD_FINAL_IMG},RINGOVD=${RINGOVD_FINAL_IMG},SBKT=${SBKT_FINAL_IMG},FIRDATA=${FIRDATA_FINAL_IMG},MEMD=${MEMD_FINAL_IMG}
.if(${DEFAULT_PNOR} == 1)
NIMBUS_SECT = HBD=${NIMBUS_HBD_FINAL_IMG},SBE=${NIMBUS_SBE_FINAL_IMG},HCODE=${NIMBUS_HCODE_FINAL_IMG},OCC=${NIMBUS_OCC_FINAL_IMG},WOFDATA=${ZZ_WOFDATA_FINAL_IMG}
CUMULUS_SECT = HBD=${CUMULUS_HBD_FINAL_IMG},SBE=${CUMULUS_SBE_FINAL_IMG},HCODE=${CUMULUS_HCODE_FINAL_IMG},OCC=${CUMULUS_OCC_FINAL_IMG}
diff --git a/src/include/usr/fapi2/plat_vpd_access.H b/src/include/usr/fapi2/plat_vpd_access.H
index 715ddc875..f28317df9 100644
--- a/src/include/usr/fapi2/plat_vpd_access.H
+++ b/src/include/usr/fapi2/plat_vpd_access.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -31,6 +31,7 @@
#define _FAPI2_PLAT_VPDACCESS_H_
#include <fapi2_vpd_access.H>
+#include <vpd/memd_vpdenums.H>
namespace fapi2
{
@@ -51,5 +52,19 @@ fapi2::ReturnCode platGetVPD(
VPDInfo<fapi2::TARGET_TYPE_MCS>& io_vpd_info,
uint8_t* o_blob);
+/**
+ * @brief Search through the PNOR::MEMD section to find the copy with
+ * a matching VM keyword compared to the EEPROM's VM.
+ *
+ * @param[in] i_eepromVM - The EEPROM's copy of the VM keyword
+ * @param[in] i_header - The header from PNOR::MEMD
+ * @param[in] i_target - A valid fapi2 MCS target
+ * @param[in] i_vm_size - Size of the VM keyword
+ *
+ * @return boolean - true if a matching MEMD was found, false if not
+ */
+bool find_memd_in_pnor(uint8_t* i_eepromVM, MemdHeader_t i_header,
+ TARGETING::Target * i_target, size_t i_vm_size);
+
};
#endif // _FAPI2_PLAT_VPDACCESS_H_
diff --git a/src/include/usr/vpd/memd_vpdenums.H b/src/include/usr/vpd/memd_vpdenums.H
index 345d77d60..ecd20ef04 100644
--- a/src/include/usr/vpd/memd_vpdenums.H
+++ b/src/include/usr/vpd/memd_vpdenums.H
@@ -27,6 +27,27 @@
#include <vpd/ipvpdenums.H>
+/**
+ * @brief Define the set of information included at the beginning of the
+ * MEMD PNOR section
+ */
+struct MemdHeader_t
+{
+ uint32_t eyecatch; /* Eyecatch to determine validity. "OKOK" */
+ uint32_t header_version; /* What version of the header this is in */
+ uint32_t memd_version; /* What version of the MEMD this includes */
+ uint32_t expected_size_kb; /* Size in kilobytes of each MEMD instance */
+ uint16_t expected_num; /* Number of MEMD instances in this section */
+ uint8_t padding[14]; /* Padding for future changes */
+}__attribute__((packed));
+
+enum MEMD_valid_constants
+{
+ MEMD_VALID_HEADER = 0x4f4b4f4b, // "OKOK"
+ MEMD_VALID_HEADER_VERSION = 0x30312e30, // "01.0";
+ MEMD_VALID_MEMD_VERSION = 0x30312e30, //"01.0";
+};
+
namespace MEMD_VPD
{
diff --git a/src/usr/fapi2/plat_vpd_access.C b/src/usr/fapi2/plat_vpd_access.C
index 3adc5b514..ba9a720ca 100644
--- a/src/usr/fapi2/plat_vpd_access.C
+++ b/src/usr/fapi2/plat_vpd_access.C
@@ -36,8 +36,7 @@
#include <attribute_service.H>
#include <vpd/dvpdenums.H>
#include <vpd/memd_vpdenums.H>
-#include <pnor/pnorif.H>
-
+#include <errl/errlmanager.H>
//The following can be uncommented for unit testing
//#undef FAPI_DBG
//#define FAPI_DBG(args...) FAPI_INF(args)
@@ -206,21 +205,117 @@ fapi2::ReturnCode platGetVPD(
break; //return with error
}
+ // The PNOR::MEMD section potentially contains multiple copies of the
+ // MEMD VPD. This next section searches through the PNOR copy for a
+ // valid copy if it exists and uses that instead of the DVPD section.
+
//Read mapping keyword
size_t l_buffSize = VPD_KEYWORD_SIZE;
- uint8_t * l_pMapping = new uint8_t[VPD_KEYWORD_SIZE];
- l_errl = deviceRead((TARGETING::Target *)l_pMcsTarget,
- l_pMapping,
- l_buffSize,
- DEVICE_DVPD_ADDRESS(DVPD::MEMD,
- l_mapKeyword));
- if (l_errl)
+ uint8_t * l_pMapping = new uint8_t[VPD_KEYWORD_SIZE]();
+
+ // MEMD Processing
+ PNOR::SectionInfo_t l_memd_info;
+ l_errl = PNOR::getSectionInfo(PNOR::MEMD,l_memd_info);
+ bool l_memd_found = false;
+ MemdHeader_t l_header;
+ uint8_t* l_dvpd_vm = nullptr;
+ uint32_t* l_full_dvpdVM = nullptr;
+
+ if( l_errl )
{
- delete l_pMapping;
- FAPI_ERR("platGetVPD: ERROR reading mapping keyword");
- l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
- break; //return with error
+ FAPI_INF("platGetVPD: Optional MEMD section not found.");
+ delete l_errl;
+ l_errl = NULL;
+ }
+ else
+ {
+ do
+ {
+ const uint8_t * vaddr = reinterpret_cast<const uint8_t *>(
+ l_memd_info.vaddr);
+ // Get and process the header
+ memcpy(&l_header, vaddr, sizeof(l_header));
+
+ size_t theSize = 0;
+
+ // Get the VM keyword size
+ l_errl = deviceRead( l_pMcsTarget, nullptr,
+ theSize, DEVICE_DVPD_ADDRESS(
+ DVPD::MEMD, DVPD::VM));
+
+ if( l_errl )
+ {
+ FAPI_ERR("platGetVPD: ERROR getting MEMD VM size");
+ l_rc.setPlatDataPtr(reinterpret_cast<void *>( l_errl ));
+ break;
+ }
+
+ // Get the VM keyword from the real VPD
+ l_dvpd_vm = static_cast<uint8_t*>(malloc( theSize ));
+
+ l_errl = deviceRead( l_pMcsTarget, l_dvpd_vm,
+ theSize, DEVICE_DVPD_ADDRESS(
+ DVPD::MEMD, DVPD::VM));
+ if( l_errl )
+ {
+ FAPI_ERR("platGetVPD: ERROR getting DVPD VM keyword");
+ l_rc.setPlatDataPtr(reinterpret_cast<void *>( l_errl ));
+ break;
+ }
+ l_full_dvpdVM = reinterpret_cast<uint32_t*>(l_dvpd_vm);
+
+ l_memd_found = find_memd_in_pnor(l_dvpd_vm,
+ l_header, l_pMcsTarget, theSize);
+ uint64_t l_memd_offset_bytes = l_pMcsTarget->getAttr<
+ TARGETING::ATTR_MEMD_OFFSET>();
+
+ if(l_memd_found)
+ {
+ FAPI_INF("platGetVPD: Matching MEMD data was found in the "
+ "PNOR section, VM value is %llx. Reading in at "
+ "offset %llx",l_full_dvpdVM, l_memd_offset_bytes);
+ l_errl = deviceRead((TARGETING::Target *)l_pMcsTarget,
+ l_pMapping,
+ l_buffSize,
+ DEVICE_MEMD_VPD_ADDRESS(MEMD_VPD::MEMD,
+ l_mapKeyword) + l_memd_offset_bytes );
+ }else
+ {
+ FAPI_INF("platGetVPD: Matching MEMD data was not found in "
+ "the PNOR section, DVPD VM value is %llx",
+ l_full_dvpdVM);
+ }
+
+ }while(0);
+
+ }
+ if( !(l_memd_found) )
+ {
+ FAPI_INF("platGetVPD: MEMD data was not found in the PNOR "
+ "section. Using EEPROM. VM value is: %llx",
+ l_full_dvpdVM);
+
+ l_errl = deviceRead((TARGETING::Target *)l_pMcsTarget,
+ l_pMapping,
+ l_buffSize,
+ DEVICE_DVPD_ADDRESS(DVPD::MEMD,
+ l_mapKeyword));
+ if (l_errl)
+ {
+ delete l_pMapping;
+ free(l_dvpd_vm);
+ l_dvpd_vm = nullptr;
+ l_full_dvpdVM = nullptr;
+ l_pMapping = nullptr;
+ FAPI_ERR("platGetVPD: ERROR reading mapping keyword");
+ l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ break; //return with error
+ }
}
+ free(l_dvpd_vm);
+ l_dvpd_vm = nullptr;
+ l_full_dvpdVM = nullptr;
+
// Find vpd keyword name based on VPDInfo
FAPI_EXEC_HWP(l_rc,
@@ -281,11 +376,24 @@ fapi2::ReturnCode platGetVPD(
//Read vpd blob
l_buffSize = l_keywordInfo.kwBlobSize;
- l_errl = deviceRead((TARGETING::Target *)l_pMcsTarget,
+ if(l_memd_found)
+ {
+ l_errl = deviceRead((TARGETING::Target *)l_pMcsTarget,
+ o_blob,
+ l_buffSize,
+ DEVICE_MEMD_VPD_ADDRESS(MEMD_VPD::MEMD,
+ l_keywordEnum));
+
+ }
+ else
+ {
+ l_errl = deviceRead((TARGETING::Target *)l_pMcsTarget,
o_blob,
l_buffSize,
DEVICE_DVPD_ADDRESS(DVPD::MEMD,
l_keywordEnum));
+ }
+
if (l_errl)
{
FAPI_ERR("platGetVPD: ERROR reading keyword");
@@ -337,4 +445,86 @@ fapi2::ReturnCode platGetVPD(
return l_rc;
}
+bool find_memd_in_pnor(uint8_t* i_eepromVM, MemdHeader_t i_header,
+ TARGETING::Target * i_target, size_t i_vm_size)
+{
+ errlHndl_t l_errl = nullptr;
+
+ static bool memdFoundInPnor = false;
+ bool l_valid_memd = ((i_header.eyecatch == MEMD_VALID_HEADER) &
+ (i_header.header_version == MEMD_VALID_HEADER_VERSION) &
+ (i_header.memd_version == MEMD_VALID_MEMD_VERSION) );
+
+ uint8_t* l_memd_vm = nullptr;
+ uint32_t l_memd_iteration = 0;
+ bool l_retValue = false;
+
+ if(l_valid_memd && !memdFoundInPnor)
+ {
+ // Reset memd offset before we start the first iteration
+ i_target->setAttr<TARGETING::ATTR_MEMD_OFFSET>(0);
+
+ //do-while loop (needs to be executed at least once)
+ // while VM keywods don't match, and we haven't gone
+ // through all the MEMD copies
+ do
+ {
+ // Get the VM keyword from the copy in PNOR
+ l_memd_vm = static_cast<uint8_t*>(malloc( i_vm_size ));
+
+ uint64_t l_memd_offset = i_target->getAttr<
+ TARGETING::ATTR_MEMD_OFFSET>();
+
+ l_errl = deviceRead( i_target, l_memd_vm, i_vm_size,
+ DEVICE_MEMD_VPD_ADDRESS(
+ MEMD_VPD::MEMD, MEMD_VPD::VM));
+ if(l_errl)
+ {
+ FAPI_ERR("find_memd_in_pnor: ERROR getting MEMD VM keyword");
+ errlCommit(l_errl, FAPI2_COMP_ID);
+ break;
+ }
+
+ assert(i_vm_size != 0);
+
+ // Compare the last nibbles
+ if( !((i_eepromVM[i_vm_size-1] & 0x0F) ==
+ (l_memd_vm[i_vm_size-1] & 0x0F)) )
+ {
+ // VM's don't match, we need to keep looking
+ FAPI_INF("find_memd_in_pnor: DVPD and MEMD VM's last nibble"
+ " don't match: %llx and %llx",
+ reinterpret_cast<uint32_t*>(i_eepromVM),
+ reinterpret_cast<uint32_t*>(l_memd_vm) );
+ i_target->setAttr<TARGETING::ATTR_MEMD_OFFSET
+ >(l_memd_offset +
+ (i_header.expected_size_kb * 1000));
+ }
+ else
+ {
+ FAPI_INF("find_memd_in_pnor: Matching MEMD data was found in "
+ "the PNOR section. VM value is: %llx. Offset "
+ "is %llx", reinterpret_cast<uint32_t*>(l_memd_vm),
+ l_memd_offset);
+ memdFoundInPnor = true;
+ l_retValue = true;
+ break;
+ }
+
+ l_memd_iteration = l_memd_iteration + 1;
+ free(l_memd_vm);
+ l_memd_vm = nullptr;
+
+ }while(l_memd_iteration < i_header.expected_num);
+
+ free(l_memd_vm);
+ l_memd_vm = nullptr;
+ }
+
+ return l_retValue;
+
+}
+
+
+
} // namespace
diff --git a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
index 563a1ac7f..c711dbc93 100755
--- a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
@@ -1065,4 +1065,18 @@
<hbOnly/>
</attribute>
+<attribute>
+ <id>MEMD_OFFSET</id>
+ <description>
+ Working offset for MEMD section, this allows us to move between
+ the different MEMD instances and the MEMD header.
+ </description>
+ <simpleType>
+ <uint64_t></uint64_t>
+ </simpleType>
+ <persistency>volatile-zeroed</persistency>
+ <readable/>
+ <writeable/>
+</attribute>
+
</attributes>
diff --git a/src/usr/targeting/common/xmltohb/target_types_hb.xml b/src/usr/targeting/common/xmltohb/target_types_hb.xml
index 962acbf7b..a5fd2bd69 100644
--- a/src/usr/targeting/common/xmltohb/target_types_hb.xml
+++ b/src/usr/targeting/common/xmltohb/target_types_hb.xml
@@ -218,6 +218,11 @@
</targetTypeExtension>
<targetTypeExtension>
+ <id>unit-mcs-power9</id>
+ <attribute><id>MEMD_OFFSET</id></attribute>
+</targetTypeExtension>
+
+<targetTypeExtension>
<id>unit-mcs-nimbus</id>
<attribute><id>HB_TARGET_SCOMABLE</id></attribute>
<attribute><id>VPD_SWITCHES</id></attribute>
diff --git a/src/usr/vpd/ipvpd.C b/src/usr/vpd/ipvpd.C
index 6c4ff9953..4cd1449c9 100644
--- a/src/usr/vpd/ipvpd.C
+++ b/src/usr/vpd/ipvpd.C
@@ -41,6 +41,7 @@
#include <vpd/vpd_if.H>
#include <config.h>
#include <vpd/ipvpdenums.H>
+#include <vpd/memd_vpdenums.H>
#include "vpd.H"
#include "cvpd.H"
@@ -67,7 +68,7 @@ extern trace_desc_t* g_trac_vpd;
static const uint64_t IPVPD_TOC_SIZE = 0x100; //256
static const uint64_t IPVPD_TOC_ENTRY_SIZE = 8;
static const uint64_t IPVPD_TOC_INVALID_DATA = 0xFFFFFFFFFFFFFFFF;
-
+uint64_t MEMD_HEADER_SIZE = sizeof(MemdHeader_t);
/**
* @brief Constructor
@@ -91,6 +92,7 @@ IpVpdFacade::IpVpdFacade(uint64_t i_vpdSectionSize,
,iv_mutex(i_mutex)
,iv_cachePnorAddr(0x0)
,iv_vpdMsgType(i_vpdMsgType)
+,iv_memdAccessed(false)
{
iv_configInfo.vpdReadPNOR = false;
iv_configInfo.vpdReadHW = false;
@@ -1755,6 +1757,24 @@ errlHndl_t IpVpdFacade::findKeywordAddr ( const char * i_keywordName,
break;
}
+ if((iv_pnorSection == PNOR::MEMD))
+ {
+ static uint64_t l_basePnorAddr = 0;//getPnorAddr(*this);
+ uint64_t l_cache_address = 0;
+
+ if((iv_cachePnorAddr !=0) && !(iv_memdAccessed))
+ {
+ l_basePnorAddr = getPnorAddr(*this);
+ iv_memdAccessed = true;
+ }
+
+ TARGETING::ATTR_MEMD_OFFSET_type l_memd_offset =
+ i_target->getAttr<TARGETING::ATTR_MEMD_OFFSET>();
+ l_cache_address = l_basePnorAddr +
+ MEMD_HEADER_SIZE + l_memd_offset;
+ setPnorAddr(l_cache_address);
+ }
+
// Byte Swap
recordSize = le16toh( recordSize );
diff --git a/src/usr/vpd/ipvpd.H b/src/usr/vpd/ipvpd.H
index 299233eac..35bc6cac8 100644
--- a/src/usr/vpd/ipvpd.H
+++ b/src/usr/vpd/ipvpd.H
@@ -785,6 +785,12 @@ class IpVpdFacade
*/
configInfo iv_configInfo;
+ /**
+ * @brief Boolean variable to denote if the pnor section was
+ * accessed for the MEMD section
+ */
+ bool iv_memdAccessed;
+
};
OpenPOWER on IntegriCloud