summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/chip_accessors
diff options
context:
space:
mode:
authorBill Schwartz <whs@us.ibm.com>2015-04-21 05:17:09 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-09-16 11:04:39 -0500
commitdf5c383842ed36306c537b22f7ac23971ed04b1d (patch)
tree67bbf99bdf8fdbf02edf147917dc6017f5461a45 /src/usr/hwpf/hwp/chip_accessors
parenta67ea7384ec6c326cfe553ee235b13eb434adee7 (diff)
downloadtalos-hostboot-df5c383842ed36306c537b22f7ac23971ed04b1d.tar.gz
talos-hostboot-df5c383842ed36306c537b22f7ac23971ed04b1d.zip
Supply WOF data
Create new attributes to make available WOF information to HTMGT and HWPs. Change-Id: I45689bc06e5a3808b9b9c3a356b70dd6e9cd2dd2 RTC: 125378 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/17367 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Reviewed-by: William H. Schwartz <whs@us.ibm.com> Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp/chip_accessors')
-rw-r--r--src/usr/hwpf/hwp/chip_accessors/chip.mk5
-rw-r--r--src/usr/hwpf/hwp/chip_accessors/chip_errors.xml25
-rw-r--r--src/usr/hwpf/hwp/chip_accessors/getTdpRdpCurrentFactor.C142
3 files changed, 169 insertions, 3 deletions
diff --git a/src/usr/hwpf/hwp/chip_accessors/chip.mk b/src/usr/hwpf/hwp/chip_accessors/chip.mk
index 8bca9427c..e98de05ec 100644
--- a/src/usr/hwpf/hwp/chip_accessors/chip.mk
+++ b/src/usr/hwpf/hwp/chip_accessors/chip.mk
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2012,2014
+# 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.
@@ -27,4 +29,5 @@ VPATH += ${HWPPATH}/chip_accessors
OBJS += getPciOscswitchConfig.o
OBJS += getOscswitchCtlAttr.o
+OBJS += getTdpRdpCurrentFactor.o
diff --git a/src/usr/hwpf/hwp/chip_accessors/chip_errors.xml b/src/usr/hwpf/hwp/chip_accessors/chip_errors.xml
index 388ab2721..c9abf520e 100644
--- a/src/usr/hwpf/hwp/chip_accessors/chip_errors.xml
+++ b/src/usr/hwpf/hwp/chip_accessors/chip_errors.xml
@@ -5,7 +5,9 @@
<!-- -->
<!-- OpenPOWER HostBoot Project -->
<!-- -->
-<!-- COPYRIGHT International Business Machines Corp. 2014 -->
+<!-- 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. -->
@@ -20,7 +22,7 @@
<!-- permissions and limitations under the License. -->
<!-- -->
<!-- IBM_PROLOG_END_TAG -->
-<!-- $Id: chip_errors.xml,v 1.3 2014/05/23 01:07:27 whs Exp $ -->
+<!-- $Id: chip_errors.xml,v 1.5 2015/08/11 08:55:24 whs Exp $ -->
<hwpErrors>
<!-- ******************************************************************** -->
<hwpError>
@@ -97,4 +99,23 @@
<ffdc>FFDC_PASSED_SIZE</ffdc>
</hwpError>
<!-- ******************************************************************** -->
+ <hwpError>
+ <rc>RC_INSUFFICIENT_VPD_RETURNED</rc>
+ <description>
+ VPD keyword record returned is smaller than expected.
+ Probably a firmware bug, but could be bad VPD
+ </description>
+ <ffdc>KEYWORD</ffdc>
+ <ffdc>RETURNED_SIZE</ffdc>
+ <ffdc>EXPECTED_SIZE</ffdc>
+ <callout>
+ <procedure>CODE</procedure>
+ <priority>HIGH</priority>
+ </callout>
+ <callout>
+ <target>CHIP_TARGET</target>
+ <priority>MEDIUM</priority>
+ </callout>
+ </hwpError>
+ <!-- ********************************************************************* -->
</hwpErrors>
diff --git a/src/usr/hwpf/hwp/chip_accessors/getTdpRdpCurrentFactor.C b/src/usr/hwpf/hwp/chip_accessors/getTdpRdpCurrentFactor.C
new file mode 100644
index 000000000..f7da05c85
--- /dev/null
+++ b/src/usr/hwpf/hwp/chip_accessors/getTdpRdpCurrentFactor.C
@@ -0,0 +1,142 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/hwpf/hwp/chip_accessors/getTdpRdpCurrentFactor.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 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 */
+// $Id: getTdpRdpCurrentFactor.C,v 1.6 2015/09/15 20:31:49 whs Exp $
+/**
+ * @file getTdpRdpCurrentFactor.C
+ *
+ * @brief Accessor for providing the ATTR_TDP_RDP_CURRENT_FACTOR attribute
+ *
+ */
+
+#include <stdint.h>
+
+// fapi support
+#include <fapi.H>
+#include <fapiUtil.H>
+#include <getTdpRdpCurrentFactor.H>
+
+extern "C"
+{
+using namespace fapi;
+
+fapi::ReturnCode getTdpRdpCurrentFactor(
+ const fapi::Target &i_procTarget,
+ uint32_t & o_val)
+{
+
+ const uint32_t DEFAULT_TDP_RDP_CURRENT_FACTOR = 9180; // 91.90% = 0x9180
+ // IQ keyword layout
+ const uint8_t NUM_ENTRIES = 4; // The IQ keyword has 4 sub entries
+ const uint8_t TDP_RDP_ENTRY =0; // Array index for LRP9 Entry 1
+
+ struct iq_entry
+ {
+ uint8_t iv_MSB; // data in big endian format
+ uint8_t iv_LSB;
+ };
+ struct iq_keyword
+ {
+ uint8_t iv_version;
+ iq_entry entry[NUM_ENTRIES];
+ };
+
+ fapi::ReturnCode l_fapirc;
+ uint32_t l_tdpRdp = 0;
+
+ FAPI_DBG("getTdpRdpCurrentFactor: entry");
+
+ do
+ {
+ // On WOF enabled systems, mvpd record LRP9 keyword IQ has the
+ // TDP RDP current factor. LRP9 is not present for Murano processors
+ // and is present, but not defined as TDP RPD current factor on other
+ // Venice processors.
+ // Only look for TDP RPD current factor in vpd for WOF enabled systems.
+
+ // See if WOF enabled
+ uint8_t l_WofEnabled = ENUM_ATTR_WOF_ENABLED_DISABLED;
+ l_fapirc = FAPI_ATTR_GET(ATTR_WOF_ENABLED,NULL,l_WofEnabled);
+ if ( l_fapirc )
+ {
+ FAPI_IMP("getTdpRdpCurrentFactor: get ATTR_WOF_ENABLED failed, "
+ "rc=0x%08x",
+ static_cast<uint32_t>(l_fapirc));
+ break; // return with error. Unexpected.
+ }
+ else if (ENUM_ATTR_WOF_ENABLED_DISABLED == l_WofEnabled)
+ {
+ break; // not a WOF enabled system. Return with 0 value. No error.
+ }
+
+ // Read TDP RDP current factor from LRP9 IQ keyword.
+ // Expected to be present on WOF enabled system.
+ iq_keyword l_iqKeyword = {0,{{0}}};
+ uint32_t l_bufsize = sizeof(l_iqKeyword);
+
+ l_fapirc = fapiGetMvpdField(MVPD_RECORD_LRP9,
+ MVPD_KEYWORD_IQ,
+ i_procTarget,
+ (uint8_t*)(&l_iqKeyword),
+ l_bufsize );
+ if ( l_fapirc )
+ {
+ FAPI_IMP("getTdpRdpCurrentFactor: get LRP9 IQ failed, "
+ "rc=0x%08x",
+ static_cast<uint32_t>(l_fapirc));
+ break; // return with error
+ }
+ if (l_bufsize < sizeof(l_iqKeyword)) //ensure expected data retured
+ {
+ FAPI_ERR("getTdpRdpCurrentFacto:"
+ " less IQ keyword returned than expected %d < %d, "
+ " use default",
+ l_bufsize, sizeof(l_iqKeyword));
+ const uint32_t & KEYWORD = fapi::MVPD_KEYWORD_IQ;
+ const uint32_t & RETURNED_SIZE = l_bufsize;
+ const uint32_t & EXPECTED_SIZE = sizeof(l_iqKeyword);
+ const fapi::Target & CHIP_TARGET = i_procTarget;
+ FAPI_SET_HWP_ERROR(l_fapirc, RC_INSUFFICIENT_VPD_RETURNED );
+ break; // return with error. Unexpected.
+ }
+ // get TDP RDP current factor endian safe
+ l_tdpRdp = l_iqKeyword.entry[TDP_RDP_ENTRY].iv_LSB;
+ l_tdpRdp |= (l_iqKeyword.entry[TDP_RDP_ENTRY].iv_MSB<<8);
+ FAPI_DBG("getTdpRdpCurrentFactor: LRP9 IQ value=%d",l_tdpRdp);
+
+ // use default if value not filled in by mfg
+ if (!l_tdpRdp)
+ {
+ l_tdpRdp = DEFAULT_TDP_RDP_CURRENT_FACTOR;
+ FAPI_IMP("getTdpRdpCurrentFactor: use default value=%d",l_tdpRdp);
+ }
+ } while (0);
+
+ // return value
+ o_val = l_tdpRdp;
+
+ return l_fapirc;
+}
+
+} // extern "C"
OpenPOWER on IntegriCloud