diff options
| author | Dzuy Nguyen <dzuy@us.ibm.com> | 2017-11-01 08:54:12 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-12-01 15:22:31 -0500 |
| commit | c71ed1c414501ce568f914e38b2ddbbc9c258cb6 (patch) | |
| tree | cb222fe6f89fc1905454576f0a75745cdc70282b /src/usr/util | |
| parent | 6bc72e2973d1868fcccf74f696bcb9bf08a62951 (diff) | |
| download | talos-hostboot-c71ed1c414501ce568f914e38b2ddbbc9c258cb6.tar.gz talos-hostboot-c71ed1c414501ce568f914e38b2ddbbc9c258cb6.zip | |
Add support for OBUS PLL buckets
Add MRW support for ATTR_FREQ_O_MHZ attribute
Add MACRO functions for ATTR_OB[0-3]_PLL_BUCKET attribute
Change-Id: I75d02192bc09c9814fccadadb6aed69606508a58
RTC: 176188
CMVC-Prereq: 1039767
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48890
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/util')
| -rw-r--r-- | src/usr/util/makefile | 1 | ||||
| -rw-r--r-- | src/usr/util/runtime/makefile | 2 | ||||
| -rw-r--r-- | src/usr/util/utilcommonattr.C | 159 |
3 files changed, 162 insertions, 0 deletions
diff --git a/src/usr/util/makefile b/src/usr/util/makefile index 4eddf52f1..c59c9852c 100644 --- a/src/usr/util/makefile +++ b/src/usr/util/makefile @@ -41,6 +41,7 @@ OBJS += utilsemipersist.o OBJS += utilrsvdmem.o OBJS += utilxipimage.o OBJS += utilmclmgr.o +OBJS += utilcommonattr.o SUBDIRS += test.d SUBDIRS += runtime.d diff --git a/src/usr/util/runtime/makefile b/src/usr/util/runtime/makefile index 3f2ea4e4b..dafd52431 100644 --- a/src/usr/util/runtime/makefile +++ b/src/usr/util/runtime/makefile @@ -28,6 +28,7 @@ MODULE = util_rt ## pointer to common HWP files EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/xip/ +EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/common/include OBJS += utilbase.o OBJS += utilstream.o @@ -39,6 +40,7 @@ OBJS += rt_cmds.o OBJS += util_rt.o OBJS += utilrsvdmem.o OBJS += utilxipimage.o +OBJS += utilcommonattr.o SUBDIRS += test.d diff --git a/src/usr/util/utilcommonattr.C b/src/usr/util/utilcommonattr.C new file mode 100644 index 000000000..193412a7b --- /dev/null +++ b/src/usr/util/utilcommonattr.C @@ -0,0 +1,159 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/util/utilcommonattr.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] 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 <util/utilcommonattr.H> + +#include "utilbase.H" +#include <util/util_reasoncodes.H> +#include <errl/errlmanager.H> + +#include <p9_frequency_buckets.H> +namespace Util +{ + +errlHndl_t getObusPllBucket(TARGETING::Target * i_chipTarget, + uint8_t &o_bucket_val, + const uint8_t i_index) +{ + errlHndl_t l_errl = nullptr; + + // Get the corresponding FREQ_O_MHZ frequency number + TARGETING::ATTR_FREQ_O_MHZ_type l_freq_array; + assert(i_chipTarget-> + tryGetAttr<TARGETING::ATTR_FREQ_O_MHZ>(l_freq_array), + "getPllBucket() failed to get ATTR_FREQ_O_MHZ"); + + // Get the frequency list from the chip + const uint32_t *l_freqList = nullptr; + + TARGETING::ATTR_MODEL_type l_chipModel = + i_chipTarget->getAttr<TARGETING::ATTR_MODEL>(); + + TARGETING::ATTR_EC_type l_chipECLevel = + i_chipTarget->getAttr<TARGETING::ATTR_EC>(); + + if(l_chipModel == TARGETING::MODEL_NIMBUS) + { + switch (l_chipECLevel) + { + case 0x10: + l_freqList = OBUS_PLL_FREQ_LIST_P9N_10; + break; + case 0x20: + l_freqList = OBUS_PLL_FREQ_LIST_P9N_20; + break; + case 0x21: + l_freqList = OBUS_PLL_FREQ_LIST_P9N_21; + break; + case 0x22: + l_freqList = OBUS_PLL_FREQ_LIST_P9N_22; + break; + default: + TRACFCOMP(g_util_trace, "Unknown EC level 0x%x for NIMBUS", + l_chipECLevel); + break; + } + } + else if(l_chipModel == TARGETING::MODEL_CUMULUS) + { + if(l_chipECLevel == 0x10) + { + l_freqList = OBUS_PLL_FREQ_LIST_P9C_10; + } + else + { + TRACFCOMP(g_util_trace, "Unknown EC level 0x%x for CUMULUS", + l_chipECLevel); + } + } + //else + //{ + // fall-through, will be caught by l_freqList nullptr check + //} + + if(l_freqList != nullptr) + { + // Look up the frequency from the frequency list + uint8_t i = 0; + for (i = 0; i < OBUS_PLL_FREQ_BUCKETS; i++) + { + if(l_freqList[i] == l_freq_array[i_index]) + { + o_bucket_val = i; + break; + } + } + + // make an error if we did not find a matching frequency + if(i == OBUS_PLL_FREQ_BUCKETS) + { + TRACFCOMP(g_util_trace, ERR_MRK + "getObusPllBucket: Unable to find matching frequency of %d", + l_freq_array[i_index]) + /*@ + * @errortype + * @moduleid UTIL_MOD_GET_OBUS_PLL_BUCKET + * @reasoncode UTIL_ERC_NO_MATCHING_FREQ + * @userdata1 HB Target HUID + * @userdata2 Input frequency + * @devdesc No matching frequency for PLL bucket + * @custdesc Firmware Error + */ + l_errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + UTIL_MOD_GET_OBUS_PLL_BUCKET, + UTIL_ERC_NO_MATCHING_FREQ, + TARGETING::get_huid(i_chipTarget), + l_freq_array[i_index]); + } + } + else // l_freqList equals nullptr + { + TRACFCOMP(g_util_trace, + ERR_MRK"getObusPllBucket: Unable to find frequency list" \ + " for model 0x%.8x, chip level 0x%x", l_chipModel, l_chipECLevel); + + /*@ + * @errortype + * @moduleid UTIL_MOD_GET_OBUS_PLL_BUCKET + * @reasoncode UTIL_ERC_NO_FREQ_LIST + * @userdata1 HB Target HUID + * @userdata1[0:31] Chip model + * @userdata2[32:63] Chip EC level + * @devdesc Unable to find frequency list + * @custdesc Firmware Error + */ + l_errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + UTIL_MOD_GET_OBUS_PLL_BUCKET, + UTIL_ERC_NO_FREQ_LIST, + TARGETING::get_huid(i_chipTarget), + TWO_UINT32_TO_UINT64( + l_chipModel, + l_chipECLevel) + ); + } + + return l_errl; +} + +} |

