diff options
author | Elizabeth Liner <eliner@us.ibm.com> | 2014-09-02 15:46:56 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-10-06 11:01:35 -0500 |
commit | 5e8d612185ddcaf6af1c66c9ce4d2a98eebdb1ef (patch) | |
tree | b7f7b68aee478c8b2a10b48307087915574d0f56 /src/usr/hwpf | |
parent | 79ab9af6f2d2413c4154226e6dd5b99c00df2873 (diff) | |
download | talos-hostboot-5e8d612185ddcaf6af1c66c9ce4d2a98eebdb1ef.tar.gz talos-hostboot-5e8d612185ddcaf6af1c66c9ce4d2a98eebdb1ef.zip |
add support for ATTR_MSS_POWER_CONTROL_CAPABLE
RTC:112608
Change-Id: If3cdeda8d8cd4a25f6ea4823c8f4cc8de05450cc
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/13107
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf')
-rw-r--r-- | src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C | 77 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk | 5 | ||||
-rw-r--r-- | src/usr/hwpf/plat/fapiPlatAttributeService.C | 13 | ||||
-rw-r--r-- | src/usr/hwpf/test/hwpMBvpdAccessorTest.H | 58 |
4 files changed, 150 insertions, 3 deletions
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C b/src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C new file mode 100644 index 000000000..b52512a31 --- /dev/null +++ b/src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C @@ -0,0 +1,77 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014 */ +/* [+] 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 */ +// $ID: getControlCapableData.C, v 1.1 2014/9/4 09:05:00 eliner Exp $ +/** + * @file getControlCapable.C + * + * @brief MBvpd accessor for the ATTR_MSS_POWER_CONTROL_CAPABLE attributes + */ + +#include <stdint.h> +#include <fapi.H> +#include <getControlCapableData.H> + +extern "C" +{ +using namespace fapi; +fapi::ReturnCode getControlCapableData( + const fapi::Target &i_mbTarget, + uint8_t & o_val) +{ + //Record:VSPD, Keyword:MR, offset: 253, 1 byte. + const uint32_t MR_KEYWORD_SIZE = 255; + + struct mr_keyword + { + uint8_t filler[253]; + uint8_t position; //offset 253 + uint8_t extraFiller[MR_KEYWORD_SIZE-sizeof(filler)-sizeof(position)]; + }; + + fapi::ReturnCode l_fapirc; + mr_keyword * l_pMrBuffer = new mr_keyword; + uint32_t l_MrBufsize = MR_KEYWORD_SIZE; + do{ + + l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, + fapi::MBVPD_KEYWORD_MR, + i_mbTarget, + reinterpret_cast<uint8_t *>(l_pMrBuffer), + l_MrBufsize); + if(l_fapirc) + { + FAPI_ERR("getControlCapableData: Read of MR Keyword failed"); + break; + } + o_val = l_pMrBuffer->position; + + }while(0); + + delete l_pMrBuffer; + l_pMrBuffer = NULL; + + return l_fapirc; +} +} diff --git a/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk b/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk index e2769a606..73e2281fd 100644 --- a/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk +++ b/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk @@ -5,7 +5,9 @@ # # OpenPOWER HostBoot Project # -# COPYRIGHT International Business Machines Corp. 2012,2014 +# Contributors Listed Below - COPYRIGHT 2012,2014 +# [+] 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. @@ -38,5 +40,6 @@ OBJS += getMBvpdSpareDramData.o OBJS += getMBvpdVersion.o OBJS += getMBvpdDram2NModeEnabled.o OBJS += getMBvpdSensorMap.o +OBJS += getControlCapableData.o OBJS += accessMBvpdL4BankDelete.o diff --git a/src/usr/hwpf/plat/fapiPlatAttributeService.C b/src/usr/hwpf/plat/fapiPlatAttributeService.C index bf0a4b192..05fbc9413 100644 --- a/src/usr/hwpf/plat/fapiPlatAttributeService.C +++ b/src/usr/hwpf/plat/fapiPlatAttributeService.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2014 */ +/* [+] 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. */ @@ -1572,6 +1574,15 @@ fapi::ReturnCode fapiPlatGetOscswitchCtl return l_rc; } +//----------------------------------------------------------------------------- +fapi::ReturnCode fapiPlatGetControlCapable(const fapi::Target * i_pTarget, + uint8_t & o_val) +{ + fapi::ReturnCode l_rc; + FAPI_EXEC_HWP(l_rc,getControlCapableData,*i_pTarget,o_val); + return l_rc; +} + } // End platAttrSvc namespace diff --git a/src/usr/hwpf/test/hwpMBvpdAccessorTest.H b/src/usr/hwpf/test/hwpMBvpdAccessorTest.H index 383c47928..7b686a2f9 100644 --- a/src/usr/hwpf/test/hwpMBvpdAccessorTest.H +++ b/src/usr/hwpf/test/hwpMBvpdAccessorTest.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2014 */ +/* [+] 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. */ @@ -56,6 +58,7 @@ #include <mvpd_accessors/getMBvpdVersion.H> #include <mvpd_accessors/getMBvpdDram2NModeEnabled.H> #include <mvpd_accessors/getMBvpdSensorMap.H> +#include <mvpd_accessors/getControlCapableData.H> #include <mvpd_accessors/accessMBvpdL4BankDelete.H> #include <errl/errlmanager.H> @@ -203,6 +206,59 @@ public: } /** + * @brief call getControlCapableData to ensure that it's getting the MR + * keyword correctly, and getting the right data + * + */ + void testGetControlCapableData() + { + fapi::ReturnCode l_fapirc; + + TS_TRACE( "getControlCapableData entry" ); + + TARGETING::TargetHandleList l_memBufList; + getAllChips(l_memBufList, TYPE_MEMBUF); + +#if HWPMBVPDACCESSORTEST_UT0 + uint8_t l_mbNum = 0; //check them all in unit test +#else + uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0; +#endif + for (; l_mbNum < l_memBufList.size(); l_mbNum++ ) + { + // make a local copy of the memory buffer target + TARGETING::Target* l_mb_target = l_memBufList[l_mbNum]; + + // dump physical path to target + EntityPath l_path; + l_path = l_mb_target->getAttr<ATTR_PHYS_PATH>(); + l_path.dump(); + + // cast OUR type of target to a FAPI type of target. + fapi::Target l_fapi_mb_target( + TARGET_TYPE_MEMBUF_CHIP, + (const_cast<TARGETING::Target*>(l_mb_target)) ); + + + uint8_t l_val = 5; + l_fapirc = FAPI_ATTR_GET(ATTR_MSS_POWER_CONTROL_CAPABLE, + &l_fapi_mb_target,l_val); + + if(l_fapirc) break; + TS_TRACE( "Power Control Capable Accessor " + "POWER_CONTROL_CAPABLE=0x%02x", l_val); + } + if (l_fapirc) + { + TS_FAIL( "getControlCapableData: FAPI_ATTR_GET fail rc=0x%x", + static_cast<uint32_t>(l_fapirc) ); + fapiLogError(l_fapirc); + } + + TS_TRACE( "testGetControlCapableData exit" ); + + } + /** * @brief call getMBvpdSlopeInterceptData to fetch power slope and intercept * attributes from the MW and MV keywords * |