diff options
author | Dean Sanner <dsanner@us.ibm.com> | 2014-12-09 13:21:28 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-02-19 14:28:00 -0600 |
commit | 7859f0c8e486326308c3f17200ca5ada75b71a98 (patch) | |
tree | fb49916cf4b7d73d342fa6b4d415ae406104451d /src | |
parent | 42cfb07e424a01af1504553975503e91aee7ab98 (diff) | |
download | talos-hostboot-7859f0c8e486326308c3f17200ca5ada75b71a98.tar.gz talos-hostboot-7859f0c8e486326308c3f17200ca5ada75b71a98.zip |
Add proc vpd to devtree
Change-Id: Ic5bcb3020f68897fec7000238cda712336e94edc
RTC: 120893
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14877
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/vpd/cvpdenums.H | 13 | ||||
-rw-r--r-- | src/include/usr/vpd/ipvpdenums.H | 60 | ||||
-rw-r--r-- | src/include/usr/vpd/mvpdenums.H | 14 | ||||
-rw-r--r-- | src/include/usr/vpd/spdenums.H | 3 | ||||
-rw-r--r-- | src/usr/devtree/bld_devtree.C | 191 | ||||
-rw-r--r-- | src/usr/devtree/makefile | 11 | ||||
-rw-r--r-- | src/usr/vpd/cvpd.H | 3 | ||||
-rw-r--r-- | src/usr/vpd/ipvpd.C | 103 | ||||
-rw-r--r-- | src/usr/vpd/ipvpd.H | 29 | ||||
-rw-r--r-- | src/usr/vpd/mvpd.H | 6 | ||||
-rwxr-xr-x | src/usr/vpd/spd.H | 2 | ||||
-rw-r--r-- | src/usr/vpd/spdDDR3.H | 5 | ||||
-rw-r--r-- | src/usr/vpd/spdDDR4.H | 5 | ||||
-rwxr-xr-x | src/usr/vpd/test/mvpdtest.H | 128 | ||||
-rwxr-xr-x | src/usr/vpd/test/spdtest.H | 4 |
15 files changed, 553 insertions, 24 deletions
diff --git a/src/include/usr/vpd/cvpdenums.H b/src/include/usr/vpd/cvpdenums.H index 71da3f207..53bfcb27b 100644 --- a/src/include/usr/vpd/cvpdenums.H +++ b/src/include/usr/vpd/cvpdenums.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -25,6 +25,8 @@ #ifndef __CVPDENUMS_H #define __CVPDENUMS_H +#include <vpd/ipvpdenums.H> + namespace CVPD { @@ -46,7 +48,9 @@ namespace CVPD // Last Record CVPD_LAST_RECORD, CVPD_TEST_RECORD, // Test purposes ONLY! - CVPD_INVALID_RECORD = 0xFFFF, + + //Start common IPVPD enums + CVPD_INVALID_RECORD = IPVPD::INVALID_RECORD, }; /** @@ -120,7 +124,10 @@ namespace CVPD // Last Keyword CVPD_LAST_KEYWORD, CVPD_TEST_KEYWORD, // Test purposes ONLY! - CVPD_INVALID_KEYWORD = 0xFFFF, + + //Start common IPVPD enums + FULL_RECORD = IPVPD::FULL_RECORD, + CVPD_INVALID_KEYWORD = IPVPD::INVALID_KEYWORD, }; }; // end CVPD diff --git a/src/include/usr/vpd/ipvpdenums.H b/src/include/usr/vpd/ipvpdenums.H new file mode 100644 index 000000000..8e0be2815 --- /dev/null +++ b/src/include/usr/vpd/ipvpdenums.H @@ -0,0 +1,60 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/vpd/ipvpdenums.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,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 */ +#ifndef __IPVPDENUMS_H +#define __IPVPDENUMS_H + +namespace IPVPD +{ + + /** + * @brief Enumeration for the IPVPD Records that contain + * the keyword enumerations below. + */ + enum ipvpdRecord + { + IPVPD_FIRST_RECORD = 0xFFF0, + INVALID_RECORD = IPVPD_FIRST_RECORD, + + // Last Record + IPVPD_LAST_RECORD, + }; + + /** + * @brief Enumerations for IPVPD keywords that can be + * accessed in the IPVPD. + */ + enum ipvpdKeyword + { + IPVPD_FIRST_KEYWORD = 0xFFF0, + FULL_RECORD = IPVPD_FIRST_KEYWORD, + INVALID_KEYWORD = 0xFFF1, + + // Last Keyword + IPVPD_LAST_KEYWORD, + }; + +}; // end IPVPD + +#endif diff --git a/src/include/usr/vpd/mvpdenums.H b/src/include/usr/vpd/mvpdenums.H index 668dc8cc1..950245f44 100644 --- a/src/include/usr/vpd/mvpdenums.H +++ b/src/include/usr/vpd/mvpdenums.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -31,6 +31,9 @@ #ifndef __MVPDENUMS_H #define __MVPDENUMS_H +#include <vpd/ipvpdenums.H> + + namespace MVPD { @@ -80,7 +83,9 @@ enum mvpdRecord // Last Record MVPD_LAST_RECORD, MVPD_TEST_RECORD, // Test purposes ONLY! - MVPD_INVALID_RECORD = 0xFFFF, + + //Start common IPVPD enums + MVPD_INVALID_RECORD = IPVPD::INVALID_RECORD, }; /** @@ -129,7 +134,10 @@ enum mvpdKeyword // Last Keyword MVPD_LAST_KEYWORD, MVPD_TEST_KEYWORD, // Test purposes ONLY! - INVALID_MVPD_KEYWORD = 0xFFFF, + + //Start common IPVPD enums + FULL_RECORD = IPVPD::FULL_RECORD, + INVALID_MVPD_KEYWORD = IPVPD::INVALID_KEYWORD, }; }; // end MVPD diff --git a/src/include/usr/vpd/spdenums.H b/src/include/usr/vpd/spdenums.H index fdd6ce530..d429690cf 100644 --- a/src/include/usr/vpd/spdenums.H +++ b/src/include/usr/vpd/spdenums.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -315,6 +315,7 @@ enum // This keyword should be last in the list // Invalid Keyword + ENTIRE_SPD = 0xFFFE, //read entire SPD INVALID_SPD_KEYWORD = 0xFFFF, }; diff --git a/src/usr/devtree/bld_devtree.C b/src/usr/devtree/bld_devtree.C index 6113d1e51..8ea4de329 100644 --- a/src/usr/devtree/bld_devtree.C +++ b/src/usr/devtree/bld_devtree.C @@ -49,6 +49,9 @@ #include <i2c/i2cif.H> #include <i2c/eepromif.H> #include <ipmi/ipmisensor.H> +#include <fapi.H> +#include <fapiPlatHwpInvoker.H> // for fapi::fapiRcToErrl() +#include <vpd/mvpdenums.H> trace_desc_t *g_trac_devtree = NULL; TRAC_INIT(&g_trac_devtree, "DEVTREE", 4096); @@ -1441,6 +1444,188 @@ errlHndl_t bld_fdt_bmc(devTree * i_dt, bool i_smallTree) return errhdl; } +errlHndl_t bld_fdt_vpd(devTree * i_dt, bool i_smallTree) +{ + // Nothing to do for small trees currently. + if (i_smallTree) { return NULL; } + + errlHndl_t errhdl = NULL; + size_t vpdSize; + + do + { + /* Find the / node and add a vpd node under it. */ + dtOffset_t rootNode = i_dt->findNode("/"); + dtOffset_t vpdNode = i_dt->addNode(rootNode, "vpd"); + + // Grab a system object to work with + TARGETING::Target* sys = NULL; + TARGETING::targetService().getTopLevelTarget(sys); + + + /***************************************************************/ + /* Add the ibm,vpd for all functional procs */ + /***************************************************************/ + // Add vpd (VINI record) for all functional procs + // and #V for all functional cores + TARGETING::TargetHandleList l_cpuTargetList; + getAllChips(l_cpuTargetList, TYPE_PROC); + + for ( size_t proc = 0; + (!errhdl) && (proc < l_cpuTargetList.size()); proc++ ) + { + TARGETING::Target * l_pProc = l_cpuTargetList[proc]; + + uint32_t l_procId = getProcChipId(l_pProc); + dtOffset_t procNode = i_dt->addNode(vpdNode, "processor", + l_procId); + + // Read entire VINI record to stuff in devtree + // Note: First read with NULL for o_buffer sets vpdSize to the + // correct length + errhdl = deviceRead( l_pProc, + NULL, + vpdSize, + DEVICE_MVPD_ADDRESS( MVPD::VINI, + MVPD::FULL_RECORD )); + + if(errhdl) + { + TRACFCOMP(g_trac_devtree,ERR_MRK" Couldn't get VINI size for HUID=0x%.8X", + TARGETING::get_huid(l_pProc)); + break; + } + + uint8_t viniBuf[vpdSize]; + + errhdl = deviceRead( l_pProc, + reinterpret_cast<void*>( &viniBuf ), + vpdSize, + DEVICE_MVPD_ADDRESS( MVPD::VINI, + MVPD::FULL_RECORD )); + + if(errhdl) + { + TRACFCOMP(g_trac_devtree,ERR_MRK" Couldn't read VINI for HUID=0x%.8X", + TARGETING::get_huid(l_pProc)); + break; + } + + //Add the proc chips vpd + i_dt->addPropertyBytes(procNode, "ibm,vpd", viniBuf, vpdSize); + + /***************************************************************/ + /* Add the #V bucket for each functional core */ + /***************************************************************/ + TARGETING::TargetHandleList l_exlist; + getChildChiplets( l_exlist, l_pProc, TYPE_CORE ); + for (size_t core = 0; core < l_exlist.size(); core++) + { + const TARGETING::Target * l_ex = l_exlist[core]; + + uint32_t l_coreNum = l_ex->getAttr<TARGETING::ATTR_CHIP_UNIT>(); + INTR::PIR_t pir(0); + pir.nodeId = CHIPID_EXTRACT_NODE(l_procId); + pir.chipId = CHIPID_EXTRACT_PROC(l_procId); + pir.coreId = l_coreNum; + + // Get #V bucket data + uint32_t l_record = (uint32_t) MVPD::LRP0 + l_coreNum; + fapi::voltageBucketData_t l_poundVdata = {0}; + fapi::ReturnCode l_rc = fapiGetPoundVBucketData(l_pProc, + l_record, + l_poundVdata); + if(l_rc) + { + TRACFCOMP( g_trac_devtree,ERR_MRK"Error getting #V data for HUID:" + "0x%08X", + l_pProc->getAttr<TARGETING::ATTR_HUID>()); + + // Convert fapi returnCode to Error handle + errhdl = fapiRcToErrl(l_rc); + break; + } + + //Add the attached core + dtOffset_t exNode = i_dt->addNode(procNode, "cpu", + pir.word); + + i_dt->addPropertyBytes(exNode, "frequency,voltage", + reinterpret_cast<uint8_t*>( &l_poundVdata), + sizeof(fapi::voltageBucketData_t)); + } + if(errhdl) + { + break; + } + } + if(errhdl) + { + break; + } + +#if 0 //TODO RTC123250 -- re-enable once fixed + /***************************************************************/ + /* Now loop on all the dimms in the system and add their spd */ + /***************************************************************/ + + // Get all functional dimm targets + TARGETING::TargetHandleList l_dimmList; + getAllLogicalCards(l_dimmList, TYPE_DIMM); + size_t spdSize; + + for ( size_t dimm = 0; + (!errhdl) && (dimm < l_dimmList.size()); dimm++ ) + { + TARGETING::Target * l_pDimm = l_dimmList[dimm]; + uint32_t l_huid = TARGETING::get_huid(l_pDimm); + + dtOffset_t dimmNode = i_dt->addNode(vpdNode, "dimm", + l_huid); + + // Read entire SPD record to stuff in devtree + // Note: First read with NULL for o_buffer sets spdSize to the + // correct length + errhdl = deviceRead( l_pDimm, + NULL, + spdSize, + DEVICE_SPD_ADDRESS(SPD::ENTIRE_SPD)); + + if(errhdl) + { + TRACFCOMP(g_trac_devtree,ERR_MRK" Couldn't get SPD size for HUID=0x%.8X", + TARGETING::get_huid(l_pDimm)); + break; + } + + uint8_t spdBuf[spdSize]; + + errhdl = deviceRead( l_pDimm, + reinterpret_cast<void*>( &spdBuf ), + spdSize, + DEVICE_SPD_ADDRESS(SPD::ENTIRE_SPD)); + + if(errhdl) + { + TRACFCOMP(g_trac_devtree,ERR_MRK" Couldn't read SPD for HUID=0x%.8X", + TARGETING::get_huid(l_pDimm)); + break; + } + + //Add the dimm spd + i_dt->addPropertyBytes(dimmNode, "spd", spdBuf, spdSize); + } + if(errhdl) + { + break; + } +#endif + + }while(0); + + return errhdl; +} + errlHndl_t build_flatdevtree( uint64_t i_dtAddr, size_t i_dtSize, bool i_smallTree ) { @@ -1498,6 +1683,12 @@ errlHndl_t build_flatdevtree( uint64_t i_dtAddr, size_t i_dtSize, } #endif + TRACFCOMP( g_trac_devtree, "---devtree vpd ---" ); + errhdl = bld_fdt_vpd(dt, i_smallTree); + if(errhdl) + { + break; + } }while(0); return errhdl; diff --git a/src/usr/devtree/makefile b/src/usr/devtree/makefile index a295d2033..48468421e 100644 --- a/src/usr/devtree/makefile +++ b/src/usr/devtree/makefile @@ -5,7 +5,9 @@ # # OpenPOWER HostBoot Project # -# COPYRIGHT International Business Machines Corp. 2012,2014 +# 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. @@ -30,6 +32,13 @@ ROOTPATH = ../../.. MODULE = devtree +## support for fapi +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp + + OBJS += devtree.o OBJS += bld_devtree.o diff --git a/src/usr/vpd/cvpd.H b/src/usr/vpd/cvpd.H index 7aefa430e..3a755162b 100644 --- a/src/usr/vpd/cvpd.H +++ b/src/usr/vpd/cvpd.H @@ -162,6 +162,9 @@ namespace CVPD // DO NOT USE!! This is for test purposes ONLY! { CVPD_TEST_KEYWORD, "XX" }, // ------------------------------------------------------------------- + + //Common ipvpd + { FULL_RECORD, "FL"}, }; }; // end CVPD namespace diff --git a/src/usr/vpd/ipvpd.C b/src/usr/vpd/ipvpd.C index af0055cd1..a0682d283 100644 --- a/src/usr/vpd/ipvpd.C +++ b/src/usr/vpd/ipvpd.C @@ -40,6 +40,7 @@ #include <vpd/vpdreasoncodes.H> #include <vpd/vpd_if.H> #include <config.h> +#include <vpd/ipvpdenums.H> #include "vpd.H" #include "ipvpd.H" @@ -147,15 +148,28 @@ errlHndl_t IpVpdFacade::read ( TARGETING::Target * i_target, break; } - // use record offset to find/read the keyword - err = retrieveKeyword( keywordName, - recordName, - recordOffset, - 0, - i_target, - io_buffer, - io_buflen, - i_args ); + if(IPVPD::FULL_RECORD == i_args.keyword) + { + // full record + err = retrieveRecord( recordName, + recordOffset, + i_target, + io_buffer, + io_buflen, + i_args ); + } + else //specific keyword + { + // use record offset to find/read the keyword + err = retrieveKeyword( keywordName, + recordName, + recordOffset, + 0, + i_target, + io_buffer, + io_buflen, + i_args ); + } if( err ) { @@ -1381,6 +1395,77 @@ errlHndl_t IpVpdFacade::retrieveKeyword ( const char * i_keywordName, } // ------------------------------------------------------------------ +// IpVpdFacade::retrieveRecord +// ------------------------------------------------------------------ +errlHndl_t IpVpdFacade::retrieveRecord( const char * i_recordName, + uint16_t i_offset, + TARGETING::Target * i_target, + void * io_buffer, + size_t & io_buflen, + input_args_t i_args ) +{ + errlHndl_t err = NULL; + uint16_t l_size = 0x0; + + TRACUCOMP( g_trac_vpd, + ENTER_MRK"IpVpdFacade::retrieveRecord()" ); + + do + { + // Get the record size.. it is the first two bytes of the record + err = fetchData( i_offset, + sizeof(l_size), + &l_size, + i_target, + i_args.location ); + + if( err ) + { + break; + } + + //byteswap + l_size = le16toh(l_size); + + // If the buffer is NULL, return the keyword size in io_buflen + if( NULL == io_buffer ) + { + io_buflen = l_size; + break; + } + + // check size of usr buffer with io_buflen + err = checkBufferSize( io_buflen, + (size_t)l_size, + i_target ); + if( err ) + { + break; + } + + // Read keyword data into io_buffer + err = fetchData( i_offset, + l_size, + io_buffer, + i_target, + i_args.location ); + if( err ) + { + break; + } + + // Everything worked + io_buflen = l_size; + + } while(0); + + TRACUCOMP( g_trac_vpd, + EXIT_MRK"IpVpdFacade::retrieveRecord()" ); + + return err; +} + +// ------------------------------------------------------------------ // IpVpdFacade::fetchData // ------------------------------------------------------------------ errlHndl_t IpVpdFacade::fetchData ( uint64_t i_byteAddr, diff --git a/src/usr/vpd/ipvpd.H b/src/usr/vpd/ipvpd.H index bd121dcae..2350bdd9e 100644 --- a/src/usr/vpd/ipvpd.H +++ b/src/usr/vpd/ipvpd.H @@ -456,6 +456,35 @@ class IpVpdFacade input_args_t i_args ); /** + * @brief This function will read the required record from the VPD data. + * + * @param[in] i_recordName - String representation of the record. + * + * @param[in] i_offset - The offset to start reading. + * + * @param[in] i_target - The target to retrieve data for. + * + * @param[out] io_buffer - The buffer to place the data in. + * + * @param[in/out] io_buflen - Length of the buffer to be read or written + * to/from the target. This value should indicate the size of the + * io_buffer parameter that has been allocated. Being returned it + * will indicate the number of valid bytes in the buffer being + * returned. + * + * @param[in] i_args - The input arguments. + * + * @return errHndl_t - NULL if successful, otherwise a pointer to the + * error log. + */ + errlHndl_t retrieveRecord ( const char * i_recordName, + uint16_t i_offset, + TARGETING::Target * i_target, + void * io_buffer, + size_t & io_buflen, + input_args_t i_args ); + + /** * @brief This function will write the required keyword into the VPD data. * * @param[in] i_keywordName - String representation of the keyword. diff --git a/src/usr/vpd/mvpd.H b/src/usr/vpd/mvpd.H index 591a2a250..60a8491f7 100644 --- a/src/usr/vpd/mvpd.H +++ b/src/usr/vpd/mvpd.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -141,10 +141,14 @@ namespace MVPD { MK, "MK" }, { PB, "PB" }, { CH, "CH" }, + // ------------------------------------------------------------------- // DO NOT USE!! This is for test purposes ONLY! { MVPD_TEST_KEYWORD, "XX" }, // ------------------------------------------------------------------- + + //Common ipvpd + { FULL_RECORD, "FL"}, }; } //end namespace MVPD diff --git a/src/usr/vpd/spd.H b/src/usr/vpd/spd.H index 8cc66fcf7..e53ca7e23 100755 --- a/src/usr/vpd/spd.H +++ b/src/usr/vpd/spd.H @@ -99,7 +99,7 @@ struct KeywordData { uint16_t keyword; // SPD keyword this data corresponds to uint16_t offset; // Byte offset in the SPD data - uint8_t length; // Number of bytes to retrieve + uint16_t length; // Number of bytes to retrieve uint8_t bitMask; // Bit mask, if non-zero it is used to mask off bits. // This applies to only byte0 in a non special case uint8_t shift; // Used for fields < 1 byte to right justify all values. diff --git a/src/usr/vpd/spdDDR3.H b/src/usr/vpd/spdDDR3.H index 6967d995e..a4a620aa9 100644 --- a/src/usr/vpd/spdDDR3.H +++ b/src/usr/vpd/spdDDR3.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ +/* 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. */ @@ -290,6 +292,7 @@ const KeywordData ddr3Data[] = { LRMM_PERSONALITY_BYTE12, 0x72, 0x01, 0x00, 0x00, false, false, LRMM }, { LRMM_PERSONALITY_BYTE13, 0x73, 0x01, 0x00, 0x00, false, false, LRMM }, { LRMM_PERSONALITY_BYTE14, 0x74, 0x01, 0x00, 0x00, false, false, LRMM }, + { ENTIRE_SPD, 0x00, 0x100, 0x00, 0x00, false, false, ALL }, //--------------------------------------------------------------------------------------- }; diff --git a/src/usr/vpd/spdDDR4.H b/src/usr/vpd/spdDDR4.H index 9031687e6..7e22f13d2 100644 --- a/src/usr/vpd/spdDDR4.H +++ b/src/usr/vpd/spdDDR4.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ +/* 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. */ @@ -159,6 +161,7 @@ const KeywordData ddr4Data[] = { RMM_ADDR_MAPPING, 0x88, 0x01, 0x01, 0x00, false, false, RMM }, { RMM_CRC, 0xff, 0x02, 0x00, 0x00, true, false, RMM }, { LRMM_CRC, 0xff, 0x02, 0x00, 0x00, true, false, LRMM }, + { ENTIRE_SPD, 0x00, 0x200, 0x00, 0x00, false, false, ALL }, //--------------------------------------------------------------------------------------- }; diff --git a/src/usr/vpd/test/mvpdtest.H b/src/usr/vpd/test/mvpdtest.H index b89bc3637..bec5abcdd 100755 --- a/src/usr/vpd/test/mvpdtest.H +++ b/src/usr/vpd/test/mvpdtest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -218,6 +218,17 @@ mvpdTestData mvpdData[] = { MVPD::MER0, MVPD::pdI }, }; +VPD::vpdRecord mvpdRecordData[] = +{ + MVPD::CP00, + MVPD::LRP4, + MVPD::LRP5, + MVPD::VINI, + MVPD::VWML, + MVPD::MER0, +}; + + void getProcTargets( TargetHandleList & o_procList ) { // Get top level system target @@ -386,6 +397,121 @@ class MVPDTest: public CxxTest::TestSuite } /** + * @brief This function will test MVPD reads. + */ + void testMvpdReadRecords ( void ) + { + errlHndl_t err = NULL; + uint64_t cmds = 0x0; + uint64_t fails = 0x0; + uint64_t theRecord = 0x0; + + TRACFCOMP( g_trac_vpd, + ENTER_MRK"testMvpdReadRecords()" ); + + do + { + TARGETING::Target * theTarget = getFunctionalProcTarget(); + if(theTarget == NULL) + { + TS_FAIL("testMvpdReadRecords() - No Functional Targets found!"); + break; + } + + uint8_t * theData = NULL; + size_t theSize = 0; + const uint32_t numCmds = + sizeof(mvpdRecordData)/sizeof(mvpdRecordData[0]); + for( uint32_t curCmd = 0; curCmd < numCmds; curCmd++ ) + { + cmds++; + theRecord = (uint64_t)mvpdRecordData[curCmd]; + err = deviceRead( theTarget, + NULL, + theSize, + DEVICE_MVPD_ADDRESS( theRecord, + MVPD::FULL_RECORD )); + + if( err ) + { + fails++; + TRACFCOMP( g_trac_vpd, + ERR_MRK"testMvpdReadRecords() - failure" + " reading record size!! rec: 0x%04x", + theRecord); + TS_FAIL("testMvpdReadRecords() -Failure reading keyword size!"); + errlCommit( err, + VPD_COMP_ID ); + continue; + } + + //Check for zero size, don't have a reliable way to check for too big + if( 0 == theSize ) + { + fails++; + TRACFCOMP( g_trac_vpd, + ERR_MRK"testMvpdReadRecords() - failure" + " reading record 0x%04x had size of zero!", + theRecord); + TS_FAIL("testMvpdReadRecords() -Failure on keyword size of zero!"); + continue; + } + + theData = static_cast<uint8_t*>(malloc( theSize )); + + // Read record/keyword pair + err = deviceRead( theTarget, + theData, + theSize, + DEVICE_MVPD_ADDRESS( theRecord, + MVPD::FULL_RECORD )); + + if( err ) + { + fails++; + TRACFCOMP( g_trac_vpd, + ERR_MRK"testMvpdReadRecords() - Failure on" + " Record: 0x%04x of size: 0x%04x - test %d", + theRecord, + theSize, curCmd ); + TS_FAIL( "testMvpdReadRecords() - Failure during MVPD read!" ); + errlCommit( err, + VPD_COMP_ID ); + + // Free the data + if( NULL != theData ) + { + free( theData ); + theData = NULL; + } + continue; + } + + TRACDCOMP( g_trac_vpd, + INFO_MRK"testMvpdRead Results:" ); + for( uint32_t i = 0; i < theSize; i++ ) + { + TRACDCOMP( g_trac_vpd, + INFO_MRK" Byte[%d]: 0x%02x", + i, theData[i] ); + } + + // Free the data + if( NULL != theData ) + { + free( theData ); + theData = NULL; + } + } + } while( 0 ); + + TRACFCOMP( g_trac_vpd, + "testMvpdReadRecords - %d/%d fails", + fails, cmds ); + } + + + /** * @brief This function will test MVPD writes. */ void testMvpdWrite ( void ) diff --git a/src/usr/vpd/test/spdtest.H b/src/usr/vpd/test/spdtest.H index c94e8af98..bc7ebbd5c 100755 --- a/src/usr/vpd/test/spdtest.H +++ b/src/usr/vpd/test/spdtest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -737,7 +737,7 @@ class SPDTest: public CxxTest::TestSuite // Test on first DIMM only. theTarget = dimmList[0]; //If theData is NULL, deviceRead will return the size - // need to give this an arbitrary size so test is still valid` + // need to give this an arbitrary size so test is still valid uint8_t * theData = static_cast<uint8_t*>(malloc( 0x1 )); size_t theSize = 0x0; // Invalid size of 0x0 |