From 43c7aed1a01cf20acd11307ce08aab99eb5bcd1c Mon Sep 17 00:00:00 2001 From: Corey Swenson Date: Mon, 16 Mar 2015 13:23:05 -0500 Subject: Fix VPD cache records/keywords The CVPD should be checking OPFR:VS/VP first, then VINI:SN/PN The MVPD should be checking VRML:SN/PN not VINI:SN/PN Change-Id: If792fae2964011c1ca80e8cc08235477dc8a7a3b RTC: 124992 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16396 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell Reviewed-by: ANDRES A. LUGO-REYES Reviewed-by: A. Patrick Williams III --- src/usr/vpd/ipvpd.C | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/usr/vpd/ipvpd.H | 21 ++++++++++++++++++ src/usr/vpd/mvpd.H | 1 + src/usr/vpd/vpd.C | 42 +++++++++++++++++++++++++++++++---- 4 files changed, 123 insertions(+), 4 deletions(-) (limited to 'src/usr') diff --git a/src/usr/vpd/ipvpd.C b/src/usr/vpd/ipvpd.C index a0682d283..b409c503f 100644 --- a/src/usr/vpd/ipvpd.C +++ b/src/usr/vpd/ipvpd.C @@ -409,6 +409,69 @@ errlHndl_t IpVpdFacade::cmpPnorToSeeprom ( TARGETING::Target * i_target, return l_err; } +// ------------------------------------------------------------------ +// IpVpdFacade::cmpSeepromToZero +// ------------------------------------------------------------------ +errlHndl_t IpVpdFacade::cmpSeepromToZero ( TARGETING::Target * i_target, + VPD::vpdRecord i_record, + VPD::vpdKeyword i_keyword, + bool &o_match ) +{ + errlHndl_t l_err = NULL; + + TRACSSCOMP( g_trac_vpd, ENTER_MRK"cmpSeepromToZero() " ); + + o_match = false; + + input_args_t l_seepromArgs; + l_seepromArgs.record = i_record; + l_seepromArgs.keyword = i_keyword; + l_seepromArgs.location = VPD::SEEPROM; + + do + { + // Get the SEEPROM size + size_t l_sizeSeeprom = 0; + l_err = read( i_target, + NULL, + l_sizeSeeprom, + l_seepromArgs ); + if( l_err || (l_sizeSeeprom == 0) ) + { + break; + } + + // Get the SEEPROM data + uint8_t l_dataSeeprom[l_sizeSeeprom]; + l_err = read( i_target, + l_dataSeeprom, + l_sizeSeeprom, + l_seepromArgs ); + if( l_err ) + { + break; + } + + // Compare the SEEPROM data to zero + uint8_t l_zero[l_sizeSeeprom]; + memset(l_zero,0,l_sizeSeeprom); + + if( memcmp( l_zero, + l_dataSeeprom, + l_sizeSeeprom ) != 0 ) + { + break; + } + + o_match = true; + + } while(0); + + TRACSSCOMP( g_trac_vpd, EXIT_MRK"cmpSeepromToZero()" ); + + return l_err; +} + /* IPVPD PNOR FORMAT |-----------------------------------------------------------|----| |TOC0|TOC1|...........................................|TOC31| | diff --git a/src/usr/vpd/ipvpd.H b/src/usr/vpd/ipvpd.H index 2350bdd9e..7a38c3e28 100644 --- a/src/usr/vpd/ipvpd.H +++ b/src/usr/vpd/ipvpd.H @@ -253,6 +253,27 @@ class IpVpdFacade VPD::vpdKeyword i_keyword, bool &o_match ); + /** + * @brief This function compares the specified record/keyword + * in SEEPROM to zero and returns the result. A mismatch + * will not return an error. + * + * @param[in] i_target - Target device + * + * @param[in] i_record - Record to compare + * + * @param[in] i_keyword - Keyword to compare + * + * @param[out] o_match - Result of compare + * + * @return errlHndl_t - NULL if successful, otherwise a pointer to the + * error log. + */ + errlHndl_t cmpSeepromToZero ( TARGETING::Target * i_target, + VPD::vpdRecord i_record, + VPD::vpdKeyword i_keyword, + bool &o_match ); + /** * @brief This function will perform the steps required to load the * MVPD data from SEEPROM into the PNOR cache. diff --git a/src/usr/vpd/mvpd.H b/src/usr/vpd/mvpd.H index 60a8491f7..e9fe90523 100644 --- a/src/usr/vpd/mvpd.H +++ b/src/usr/vpd/mvpd.H @@ -88,6 +88,7 @@ namespace MVPD { LWPE, "LWPE" }, { VWML, "VWML" }, { MER0, "MER0" }, + { VRML, "VRML" }, // ------------------------------------------------------------------- // DO NOT USE!! This is for test purposes ONLY! { MVPD_TEST_RECORD, "TEST" }, diff --git a/src/usr/vpd/vpd.C b/src/usr/vpd/vpd.C index 3533af9d1..fa32478e5 100755 --- a/src/usr/vpd/vpd.C +++ b/src/usr/vpd/vpd.C @@ -445,16 +445,16 @@ errlHndl_t ensureCacheIsInSync ( TARGETING::Target * i_target ) if( l_type == TARGETING::TYPE_PROC ) { - l_record = MVPD::VINI; + l_record = MVPD::VRML; l_keywordPN = MVPD::PN; l_keywordSN = MVPD::SN; } else if( l_type == TARGETING::TYPE_MEMBUF ) { l_ipvpd = &(Singleton::instance()); - l_record = CVPD::VINI; - l_keywordPN = CVPD::PN; - l_keywordSN = CVPD::SN; + l_record = CVPD::OPFR; + l_keywordPN = CVPD::VP; + l_keywordSN = CVPD::VS; } else if( l_type == TARGETING::TYPE_DIMM ) { @@ -486,6 +486,40 @@ errlHndl_t ensureCacheIsInSync ( TARGETING::Target * i_target ) do { + // Make sure we are comparing the correct pn/sn for CVPD + if( l_type == TARGETING::TYPE_MEMBUF ) + { + bool l_zeroPN; + l_err = l_ipvpd->cmpSeepromToZero( i_target, + l_record, + l_keywordPN, + l_zeroPN ); + if (l_err) + { + TRACFCOMP(g_trac_vpd,ERR_MRK"VPD::ensureCacheIsInSync: Error checking if OPFR:VP == 0"); + break; + } + + bool l_zeroSN; + l_err = l_ipvpd->cmpSeepromToZero( i_target, + l_record, + l_keywordSN, + l_zeroSN ); + if (l_err) + { + TRACFCOMP(g_trac_vpd,ERR_MRK"VPD::ensureCacheIsInSync: Error checking if OPFR:VS == 0"); + break; + } + + // If VP and VS are zero, use VINI instead + if( l_zeroPN && l_zeroSN ) + { + l_record = CVPD::VINI; + l_keywordPN = CVPD::PN; + l_keywordSN = CVPD::SN; + } + } + // Compare the Part Numbers in PNOR/SEEPROM bool l_matchPN = false; if( ( l_type == TARGETING::TYPE_PROC ) || -- cgit v1.2.1