summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Swenson <cswenson@us.ibm.com>2015-05-15 10:30:04 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-07-17 09:50:29 -0500
commita34452451070830c8f9149100a8a8523220527a9 (patch)
treeceeef38401d1c3eed596b1c3e1bb705570b75892
parent5d1ff7656b2b1b8e50d9f30b180ff3e10b3adf3e (diff)
downloadtalos-hostboot-a34452451070830c8f9149100a8a8523220527a9.tar.gz
talos-hostboot-a34452451070830c8f9149100a8a8523220527a9.zip
Fix for VPD issues in golden and mfg boot
Change-Id: I86bed87da21ec9037c7b828874052066e4ec5f4a RTC: 128100 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/17821 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: William H. Schwartz <whs@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r--src/include/usr/vpd/vpd_if.H16
-rw-r--r--src/usr/hwas/hwasPlat.C20
-rw-r--r--src/usr/hwpf/hwp/start_payload/start_payload.C34
-rw-r--r--src/usr/initservice/extinitsvc/extinitsvctasks.H2
-rw-r--r--src/usr/targeting/common/xmltohb/attribute_types_hb.xml21
-rw-r--r--src/usr/vpd/HBconfig4
-rw-r--r--src/usr/vpd/mvpd.C2
-rw-r--r--src/usr/vpd/rtvpd_load.C53
-rw-r--r--src/usr/vpd/runtime/rt_vpd.C136
-rwxr-xr-xsrc/usr/vpd/vpd.C118
-rw-r--r--src/usr/vpd/vpd.H15
-rw-r--r--src/usr/vpd/vpd.mk1
-rw-r--r--src/usr/vpd/vpd_common.C139
13 files changed, 320 insertions, 241 deletions
diff --git a/src/include/usr/vpd/vpd_if.H b/src/include/usr/vpd/vpd_if.H
index eff196042..e6f32dcc6 100644
--- a/src/include/usr/vpd/vpd_if.H
+++ b/src/include/usr/vpd/vpd_if.H
@@ -112,6 +112,22 @@ namespace VPD
*/
errlHndl_t invalidateAllPnorCaches ( bool i_setHwOnly );
+ /**
+ * @brief This function checks for golden-side boot and updates
+ * the VPD SWITCHES attribute if true
+ * @return errlHndl_t - NULL if successful, otherwise a pointer to the
+ * error log.
+ */
+ errlHndl_t goldenSwitchUpdate ( void );
+
+ /**
+ * @brief This function checks for manufacturing mode or
+ * golden-side boot and invalidates VPD PNOR cache if true
+ * @return errlHndl_t - NULL if successful, otherwise a pointer to the
+ * error log.
+ */
+ errlHndl_t goldenCacheInvalidate ( void );
+
}; //end vpd namespace
#endif
diff --git a/src/usr/hwas/hwasPlat.C b/src/usr/hwas/hwasPlat.C
index ef631b50a..1eb3241c0 100644
--- a/src/usr/hwas/hwasPlat.C
+++ b/src/usr/hwas/hwasPlat.C
@@ -396,12 +396,30 @@ errlHndl_t platPresenceDetect(TargetHandleList &io_targets)
}
if( l_pnorInfo.isGolden )
{
- errl = VPD::invalidateAllPnorCaches(false);
+#ifdef CONFIG_DJVPD_WRITE_TO_PNOR
+ errl = PNOR::clearSection( PNOR::DIMM_JEDEC_VPD );
if( errl )
{
// commit the error but keep going
errlCommit(errl, HWAS_COMP_ID);
}
+#endif
+#ifdef CONFIG_MVPD_WRITE_TO_PNOR
+ errl = PNOR::clearSection( PNOR::MODULE_VPD );
+ if( errl )
+ {
+ // commit the error but keep going
+ errlCommit(errl, HWAS_COMP_ID);
+ }
+#endif
+#ifdef CONFIG_CVPD_WRITE_TO_PNOR
+ errl = PNOR::clearSection( PNOR::CENTAUR_VPD );
+ if( errl )
+ {
+ // commit the error but keep going
+ errlCommit(errl, HWAS_COMP_ID);
+ }
+#endif
}
#endif
diff --git a/src/usr/hwpf/hwp/start_payload/start_payload.C b/src/usr/hwpf/hwp/start_payload/start_payload.C
index 12f62a331..c582696a0 100644
--- a/src/usr/hwpf/hwp/start_payload/start_payload.C
+++ b/src/usr/hwpf/hwp/start_payload/start_payload.C
@@ -343,6 +343,14 @@ void* call_host_runtime_setup( void *io_pArgs )
if( is_sapphire_load() && (!INITSERVICE::spBaseServicesEnabled()) )
{
+ // Update the VPD switches for golden side boot
+ // Must do this before building the devtree
+ l_err = VPD::goldenSwitchUpdate();
+ if ( l_err )
+ {
+ break;
+ }
+
// Write the devtree out in Sapphire mode when SP Base Services not
// enabled
l_err = DEVTREE::build_flatdevtree();
@@ -354,28 +362,14 @@ void* call_host_runtime_setup( void *io_pArgs )
break;
}
-#ifdef CONFIG_PNOR_TWO_SIDE_SUPPORT
- // We also need to wipe the cache out after booting from the
- // golden side of pnor
- PNOR::SideInfo_t l_pnorInfo;
- l_err = PNOR::getSideInfo( PNOR::WORKING, l_pnorInfo );
- if( l_err )
- {
- // commit the error but keep going
- errlCommit(l_err, ISTEP_COMP_ID);
- // force the caches to get wiped out just in case
- l_pnorInfo.isGolden = true;
- }
- if( l_pnorInfo.isGolden )
+ // Invalidate the VPD cache for golden side boot
+ // Also invalidate in manufacturing mode
+ // Must do this after building the devtree
+ l_err = VPD::goldenCacheInvalidate();
+ if ( l_err )
{
- // Invalidate the VPD Caches for all targets
- l_err = VPD::invalidateAllPnorCaches(true);
- if (l_err)
- {
- break;
- }
+ break;
}
-#endif
}
else if( is_sapphire_load() )
diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H
index 087d08c1a..34374c197 100644
--- a/src/usr/initservice/extinitsvc/extinitsvctasks.H
+++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2011,2015 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
diff --git a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
index 87839cb9a..8d38f69bc 100644
--- a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
@@ -279,7 +279,7 @@
<attribute>
<id>HB_EXISTING_IMAGE</id>
<description>Indicates which logical nodes have a hostboot image.</description>
- <!-- Bit position [0-7] (left to right) represents logical node.
+ <!-- Bit position [0-7] (left to right) represents logical node.
'1' means the logical node has an active hostboot image.
-->
<simpleType>
@@ -801,10 +801,27 @@
<default>0</default>
</field>
<field>
+ <name>pnorCacheValidRT</name>
+ <description>See pnorCacheValid. Allows runtime version to be
+ set separately from common version.
+ </description>
+ <type>uint8_t</type>
+ <bits>1</bits>
+ <default>0</default>
+ </field>
+ <field>
+ <name>disableWriteToPnorRT</name>
+ <description>Set to disable write-thru to PNOR at runtime
+ </description>
+ <type>uint8_t</type>
+ <bits>1</bits>
+ <default>0</default>
+ </field>
+ <field>
<name>reserved</name>
<description>Reserved for future expansion</description>
<type>uint8_t</type>
- <bits>7</bits>
+ <bits>5</bits>
<default>0</default>
</field>
</complexType>
diff --git a/src/usr/vpd/HBconfig b/src/usr/vpd/HBconfig
index 1d6e6f1b8..615a548e8 100644
--- a/src/usr/vpd/HBconfig
+++ b/src/usr/vpd/HBconfig
@@ -45,7 +45,7 @@ config PVPD_READ_FROM_HW
config PVPD_WRITE_TO_PNOR
default y if PVPD_READ_FROM_PNOR
- depends on PVPD_READ_FROM_PNOR
+ depends on PVPD_READ_FROM_PNOR && CVPD_WRITE_TO_PNOR
help
Write Planar VPD data to PNOR cache
@@ -92,7 +92,7 @@ config DJVPD_READ_FROM_PNOR
default y
help
Read Dimm JEDEC VPD/SPD data from PNOR cache
-
+
config DJVPD_READ_FROM_HW
default n
help
diff --git a/src/usr/vpd/mvpd.C b/src/usr/vpd/mvpd.C
index a1c41be5b..6a8cd2777 100644
--- a/src/usr/vpd/mvpd.C
+++ b/src/usr/vpd/mvpd.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,2015 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
diff --git a/src/usr/vpd/rtvpd_load.C b/src/usr/vpd/rtvpd_load.C
index d7b46436f..b9fbf2fef 100644
--- a/src/usr/vpd/rtvpd_load.C
+++ b/src/usr/vpd/rtvpd_load.C
@@ -82,7 +82,7 @@ errlHndl_t bld_vpd_image(PNOR::SectionId vpd_type,
* @moduleid VPD::VPD_BLD_RT_IMAGE
* @userdata1 Size provided
* @userdata2 vpd_type | Size required
- * @devdesc Reserved size in memory insufficient
+ * @devdesc Reserved size in memory insufficient
* for runtime VPD
*/
err = new ERRORLOG::ErrlEntry
@@ -152,6 +152,57 @@ errlHndl_t VPD::vpd_load_rt_image(uint64_t & o_vpd_addr)
mm_block_unmap(vptr);
+ } while( 0 );
+
+ return err;
+}
+
+// External function see vpd_if.H
+errlHndl_t VPD::goldenSwitchUpdate(void)
+{
+ errlHndl_t err = NULL;
+
+ do
+ {
+#ifdef CONFIG_PNOR_TWO_SIDE_SUPPORT
+ // Do not write to the PNOR at runtime after booting from the
+ // golden side of pnor
+ PNOR::SideInfo_t l_pnorInfo;
+ err = PNOR::getSideInfo( PNOR::WORKING, l_pnorInfo );
+ if( err )
+ {
+ break;
+ }
+ else if( l_pnorInfo.isGolden )
+ {
+ TARGETING::ATTR_VPD_SWITCHES_type l_switch;
+
+ // Find all the targets with VPD switches
+ for (TARGETING::TargetIterator target =
+ TARGETING::targetService().begin();
+ target != TARGETING::targetService().end();
+ ++target)
+ {
+ if(target->tryGetAttr<TARGETING::ATTR_VPD_SWITCHES>(l_switch))
+ {
+ l_switch.disableWriteToPnorRT = 1;
+ target->setAttr<TARGETING::ATTR_VPD_SWITCHES>( l_switch );
+ }
+ }
+ }
+#endif
+ } while( 0 );
+
+ return err;
+}
+
+// External function see vpd_if.H
+errlHndl_t VPD::goldenCacheInvalidate(void)
+{
+ errlHndl_t err = NULL;
+
+ do
+ {
bool l_invalidateCaches = false;
// In manufacturing mode the VPD PNOR cache needs to be cleared
diff --git a/src/usr/vpd/runtime/rt_vpd.C b/src/usr/vpd/runtime/rt_vpd.C
index d73b0dc1a..f6bc47139 100644
--- a/src/usr/vpd/runtime/rt_vpd.C
+++ b/src/usr/vpd/runtime/rt_vpd.C
@@ -37,11 +37,7 @@
#include "cvpd.H"
#include "spd.H"
-// ----------------------------------------------
-// Trace definitions
-// ----------------------------------------------
-trace_desc_t* g_trac_vpd = NULL;
-TRAC_INIT( & g_trac_vpd, "VPD", KILOBYTE );
+extern trace_desc_t* g_trac_vpd;
// ------------------------
// Macros for unit testing
@@ -50,30 +46,39 @@ TRAC_INIT( & g_trac_vpd, "VPD", KILOBYTE );
//#define TRACSSCOMP(args...) TRACFCOMP(args)
#define TRACSSCOMP(args...)
+
namespace VPD
{
// ------------------------------------------------------------------
-// getVpdLocation
+// rtVpdInit
// ------------------------------------------------------------------
-errlHndl_t getVpdLocation ( int64_t & o_vpdLocation,
- TARGETING::Target * i_target )
+struct rtVpdInit
{
- errlHndl_t err = NULL;
-
- TRACSSCOMP( g_trac_vpd,
- ENTER_MRK"getVpdLocation()" );
-
- o_vpdLocation = i_target->getAttr<TARGETING::ATTR_VPD_REC_NUM>();
- TRACUCOMP( g_trac_vpd,
- INFO_MRK"Using VPD location: %d",
- o_vpdLocation );
-
- TRACSSCOMP( g_trac_vpd,
- EXIT_MRK"getVpdLocation()" );
-
- return err;
-}
+ rtVpdInit()
+ {
+ // The VPD code that is common to IPL and runtime uses the
+ // pnorCacheValid switch. During a golden-side boot this switch
+ // gets cleared when the VPD cache is invalidated. At runtime
+ // we may need to use the VPD cache (really the devtree data in
+ // memory) so we copy the RT switch to the common switch.
+
+ // Find all the targets with VPD switches
+ for (TARGETING::TargetIterator target =
+ TARGETING::targetService().begin();
+ target != TARGETING::targetService().end();
+ ++target)
+ {
+ TARGETING::ATTR_VPD_SWITCHES_type l_switch;
+ if(target->tryGetAttr<TARGETING::ATTR_VPD_SWITCHES>(l_switch))
+ {
+ l_switch.pnorCacheValid = l_switch.pnorCacheValidRT;
+ target->setAttr<TARGETING::ATTR_VPD_SWITCHES>( l_switch );
+ }
+ }
+ }
+};
+rtVpdInit g_rtVpdInit;
// ------------------------------------------------------------------
// Fake getPnorAddr - VPD image is in memory
@@ -347,7 +352,7 @@ errlHndl_t writePNOR ( uint64_t i_byteAddr,
// Check if the VPD PNOR cache is loaded for this target
TARGETING::ATTR_VPD_SWITCHES_type vpdSwitches =
i_target->getAttr<TARGETING::ATTR_VPD_SWITCHES>();
- if( vpdSwitches.pnorCacheValid )
+ if( vpdSwitches.pnorCacheValid && !(vpdSwitches.disableWriteToPnorRT) )
{
PNOR::SectionInfo_t info;
writeAddr = NULL;
@@ -386,21 +391,6 @@ errlHndl_t writePNOR ( uint64_t i_byteAddr,
}
}
- //------------------------
- // Write HW version of VPD
- //------------------------
- err = DeviceFW::deviceOp( DeviceFW::WRITE,
- i_target,
- i_data,
- i_numBytes,
- DEVICE_EEPROM_ADDRESS(
- EEPROM::VPD_PRIMARY,
- i_byteAddr ) );
- if( err )
- {
- break;
- }
-
} while(0);
TRACSSCOMP( g_trac_vpd,
@@ -454,73 +444,5 @@ errlHndl_t sendMboxWriteMsg ( size_t i_numBytes,
return err;
}
-// ------------------------------------------------------------------
-// resolveVpdSource
-// ------------------------------------------------------------------
-bool resolveVpdSource( TARGETING::Target * i_target,
- bool i_readFromPnorEnabled,
- bool i_readFromHwEnabled,
- vpdCmdTarget i_vpdCmdTarget,
- vpdCmdTarget& o_vpdSource )
-{
- bool badConfig = false;
- o_vpdSource = VPD::INVALID_LOCATION;
-
- if( i_vpdCmdTarget == VPD::PNOR )
- {
- if( i_readFromPnorEnabled )
- {
- o_vpdSource = VPD::PNOR;
- }
- else
- {
- badConfig = true;
- }
- }
- else if( i_vpdCmdTarget == VPD::SEEPROM )
- {
- if( i_readFromHwEnabled )
- {
- o_vpdSource = VPD::SEEPROM;
- }
- else
- {
- badConfig = true;
- }
- }
- else
- {
- if( i_readFromPnorEnabled &&
- i_readFromHwEnabled )
- {
- // PNOR needs to be loaded before we can use it
- TARGETING::ATTR_VPD_SWITCHES_type vpdSwitches =
- i_target->getAttr<TARGETING::ATTR_VPD_SWITCHES>();
- if( vpdSwitches.pnorCacheValid )
- {
- o_vpdSource = VPD::PNOR;
- }
- else
- {
- o_vpdSource = VPD::SEEPROM;
- }
- }
- else if( i_readFromPnorEnabled )
- {
- o_vpdSource = VPD::PNOR;
- }
- else if( i_readFromHwEnabled )
- {
- o_vpdSource = VPD::SEEPROM;
- }
- else
- {
- badConfig = true;
- }
- }
-
- return badConfig;
-}
-
}; // end namepsace VPD
diff --git a/src/usr/vpd/vpd.C b/src/usr/vpd/vpd.C
index e3773bff3..4a8ccf408 100755
--- a/src/usr/vpd/vpd.C
+++ b/src/usr/vpd/vpd.C
@@ -39,10 +39,9 @@
#include "ipvpd.H"
// ----------------------------------------------
-// Trace definitions
+// Trace - defined in vpd_common
// ----------------------------------------------
-trace_desc_t* g_trac_vpd = NULL;
-TRAC_INIT( & g_trac_vpd, "VPD", KILOBYTE );
+extern trace_desc_t* g_trac_vpd;
// ------------------------
// Macros for unit testing
@@ -55,29 +54,6 @@ namespace VPD
{
// ------------------------------------------------------------------
-// getVpdLocation
-// ------------------------------------------------------------------
-errlHndl_t getVpdLocation ( int64_t & o_vpdLocation,
- TARGETING::Target * i_target )
-{
- errlHndl_t err = NULL;
-
- TRACSSCOMP( g_trac_vpd,
- ENTER_MRK"getVpdLocation()" );
-
- o_vpdLocation = i_target->getAttr<TARGETING::ATTR_VPD_REC_NUM>();
- TRACUCOMP( g_trac_vpd,
- INFO_MRK"Using VPD location: %d",
- o_vpdLocation );
-
- TRACSSCOMP( g_trac_vpd,
- EXIT_MRK"getVpdLocation()" );
-
- return err;
-}
-
-
-// ------------------------------------------------------------------
// getPnorAddr
// ------------------------------------------------------------------
errlHndl_t getPnorAddr ( pnorInformation & i_pnorInfo,
@@ -355,78 +331,6 @@ errlHndl_t sendMboxWriteMsg ( size_t i_numBytes,
// ------------------------------------------------------------------
-// resolveVpdSource
-// ------------------------------------------------------------------
-bool resolveVpdSource( TARGETING::Target * i_target,
- bool i_rwPnorEnabled,
- bool i_rwHwEnabled,
- vpdCmdTarget i_vpdCmdTarget,
- vpdCmdTarget& o_vpdSource )
-{
- bool badConfig = false;
- o_vpdSource = VPD::INVALID_LOCATION;
-
- if( i_vpdCmdTarget == VPD::PNOR )
- {
- if( i_rwPnorEnabled )
- {
- o_vpdSource = VPD::PNOR;
- }
- else
- {
- badConfig = true;
- TRACFCOMP(g_trac_vpd,"resolveVpdSource: VpdCmdTarget=PNOR but READ/WRITE PNOR CONFIG is disabled");
- }
- }
- else if( i_vpdCmdTarget == VPD::SEEPROM )
- {
- if( i_rwHwEnabled )
- {
- o_vpdSource = VPD::SEEPROM;
- }
- else
- {
- badConfig = true;
- TRACFCOMP(g_trac_vpd,"resolveVpdSource: VpdCmdTarget=SEEPROM but READ/WRITE HW CONFIG is disabled");
- }
- }
- else // i_vpdCmdTarget == VPD::AUTOSELECT
- {
- if( i_rwPnorEnabled &&
- i_rwHwEnabled )
- {
- // PNOR needs to be loaded before we can use it
- TARGETING::ATTR_VPD_SWITCHES_type vpdSwitches =
- i_target->getAttr<TARGETING::ATTR_VPD_SWITCHES>();
- if( vpdSwitches.pnorCacheValid )
- {
- o_vpdSource = VPD::PNOR;
- }
- else
- {
- o_vpdSource = VPD::SEEPROM;
- }
- }
- else if( i_rwPnorEnabled )
- {
- o_vpdSource = VPD::PNOR;
- }
- else if( i_rwHwEnabled )
- {
- o_vpdSource = VPD::SEEPROM;
- }
- else
- {
- badConfig = true;
- TRACFCOMP(g_trac_vpd,"resolveVpdSource: READ/WRITE PNOR CONFIG and READ/WRITE HW CONFIG disabled");
- }
- }
-
- return badConfig;
-}
-
-
-// ------------------------------------------------------------------
// setPartAndSerialNumberAttributes
// ------------------------------------------------------------------
void setPartAndSerialNumberAttributes( TARGETING::Target * i_target )
@@ -815,10 +719,11 @@ errlHndl_t ensureCacheIsInSync ( TARGETING::Target * i_target )
}
}
- // Set target attribute switch that says VPD is loaded into PNOR
+ // Set target attribute switches that say VPD is loaded into PNOR
TARGETING::ATTR_VPD_SWITCHES_type vpdSwitches =
i_target->getAttr<TARGETING::ATTR_VPD_SWITCHES>();
vpdSwitches.pnorCacheValid = 1;
+ vpdSwitches.pnorCacheValidRT = 1;
i_target->setAttr<TARGETING::ATTR_VPD_SWITCHES>( vpdSwitches );
} while(0);
@@ -876,6 +781,7 @@ void setVpdConfigFlagsHW ( )
{
Singleton<MvpdFacade>::instance().setConfigFlagsHW();
Singleton<CvpdFacade>::instance().setConfigFlagsHW();
+ Singleton<PvpdFacade>::instance().setConfigFlagsHW();
SPD::setConfigFlagsHW();
}
@@ -889,13 +795,6 @@ errlHndl_t invalidateAllPnorCaches ( bool i_setHwOnly )
errlHndl_t l_err = NULL;
do {
- // Reset the PNOR config flags to HW - MVPD/CVPD/SPD
- // Checks for PNOR caching mode before reset
- if( i_setHwOnly )
- {
- VPD::setVpdConfigFlagsHW();
- }
-
// Find all the targets with VPD switches
for (TARGETING::TargetIterator target =
TARGETING::targetService().begin();
@@ -922,6 +821,13 @@ errlHndl_t invalidateAllPnorCaches ( bool i_setHwOnly )
break;
}
+ // Reset the PNOR config flags to HW - MVPD/CVPD/SPD
+ // Checks for PNOR caching mode before reset
+ if( i_setHwOnly )
+ {
+ VPD::setVpdConfigFlagsHW();
+ }
+
} while(0);
return l_err;
diff --git a/src/usr/vpd/vpd.H b/src/usr/vpd/vpd.H
index 3d7b22a6e..1451feae8 100644
--- a/src/usr/vpd/vpd.H
+++ b/src/usr/vpd/vpd.H
@@ -83,6 +83,21 @@ union VpdWriteMsg_t
/**
+ * @brief This function is used to query the attribute code to get the VPD
+ * Location value for the target provided.
+ *
+ * @param[out] o_vpdLocation - The value of the VPD Location attribute.
+ *
+ * @param[in] i_target - The target to query.
+ *
+ * @return errlHndl_t - NULL if successful, otherwise a pointer to the
+ * Error log.
+ */
+errlHndl_t getVpdLocation ( int64_t & o_vpdLocation,
+ TARGETING::Target * i_target );
+
+
+/**
* @brief This function will query the PNOR RP to get the offset of the
* section requested. It will then set global variables to save this
* value away for later use. This function only needs to be called once.
diff --git a/src/usr/vpd/vpd.mk b/src/usr/vpd/vpd.mk
index 65d22e344..a541ccc7e 100644
--- a/src/usr/vpd/vpd.mk
+++ b/src/usr/vpd/vpd.mk
@@ -23,6 +23,7 @@
#
# IBM_PROLOG_END_TAG
# common objects with runtime
+OBJS += vpd_common.o
OBJS += ipvpd.o
OBJS += mvpd.o
OBJS += cvpd.o
diff --git a/src/usr/vpd/vpd_common.C b/src/usr/vpd/vpd_common.C
new file mode 100644
index 000000000..d11dc8743
--- /dev/null
+++ b/src/usr/vpd/vpd_common.C
@@ -0,0 +1,139 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/vpd/vpd.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2013,2015 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#include "vpd.H"
+
+// ----------------------------------------------
+// Trace definitions
+// ----------------------------------------------
+trace_desc_t* g_trac_vpd = NULL;
+TRAC_INIT( & g_trac_vpd, "VPD", KILOBYTE );
+
+// ------------------------
+// Macros for unit testing
+//#define TRACUCOMP(args...) TRACFCOMP(args)
+#define TRACUCOMP(args...)
+//#define TRACSSCOMP(args...) TRACFCOMP(args)
+#define TRACSSCOMP(args...)
+
+
+namespace VPD
+{
+
+// ------------------------------------------------------------------
+// getVpdLocation
+// ------------------------------------------------------------------
+errlHndl_t getVpdLocation ( int64_t & o_vpdLocation,
+ TARGETING::Target * i_target )
+{
+ errlHndl_t err = NULL;
+
+ TRACSSCOMP( g_trac_vpd,
+ ENTER_MRK"getVpdLocation()" );
+
+ o_vpdLocation = i_target->getAttr<TARGETING::ATTR_VPD_REC_NUM>();
+ TRACUCOMP( g_trac_vpd,
+ INFO_MRK"Using VPD location: %d",
+ o_vpdLocation );
+
+ TRACSSCOMP( g_trac_vpd,
+ EXIT_MRK"getVpdLocation()" );
+
+ return err;
+}
+
+
+// ------------------------------------------------------------------
+// resolveVpdSource
+// ------------------------------------------------------------------
+bool resolveVpdSource( TARGETING::Target * i_target,
+ bool i_rwPnorEnabled,
+ bool i_rwHwEnabled,
+ vpdCmdTarget i_vpdCmdTarget,
+ vpdCmdTarget& o_vpdSource )
+{
+ bool badConfig = false;
+ o_vpdSource = VPD::INVALID_LOCATION;
+
+ if( i_vpdCmdTarget == VPD::PNOR )
+ {
+ if( i_rwPnorEnabled )
+ {
+ o_vpdSource = VPD::PNOR;
+ }
+ else
+ {
+ badConfig = true;
+ TRACFCOMP(g_trac_vpd,"resolveVpdSource: VpdCmdTarget=PNOR but READ/WRITE PNOR CONFIG is disabled");
+ }
+ }
+ else if( i_vpdCmdTarget == VPD::SEEPROM )
+ {
+ if( i_rwHwEnabled )
+ {
+ o_vpdSource = VPD::SEEPROM;
+ }
+ else
+ {
+ badConfig = true;
+ TRACFCOMP(g_trac_vpd,"resolveVpdSource: VpdCmdTarget=SEEPROM but READ/WRITE HW CONFIG is disabled");
+ }
+ }
+ else // i_vpdCmdTarget == VPD::AUTOSELECT
+ {
+ if( i_rwPnorEnabled &&
+ i_rwHwEnabled )
+ {
+ // PNOR needs to be loaded before we can use it
+ TARGETING::ATTR_VPD_SWITCHES_type vpdSwitches =
+ i_target->getAttr<TARGETING::ATTR_VPD_SWITCHES>();
+ if( vpdSwitches.pnorCacheValid )
+ {
+ o_vpdSource = VPD::PNOR;
+ }
+ else
+ {
+ o_vpdSource = VPD::SEEPROM;
+ }
+ }
+ else if( i_rwPnorEnabled )
+ {
+ o_vpdSource = VPD::PNOR;
+ }
+ else if( i_rwHwEnabled )
+ {
+ o_vpdSource = VPD::SEEPROM;
+ }
+ else
+ {
+ badConfig = true;
+ TRACFCOMP(g_trac_vpd,"resolveVpdSource: READ/WRITE PNOR CONFIG and READ/WRITE HW CONFIG disabled");
+ }
+ }
+
+ return badConfig;
+}
+
+}; //end VPD namespace
OpenPOWER on IntegriCloud