diff options
author | Luke Mulkey <lwmulkey@us.ibm.com> | 2016-11-14 16:33:46 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-07-26 00:21:18 -0400 |
commit | c5da870a2aa8a754e0037d6bffff1e2599d3100d (patch) | |
tree | fb80099209075ac6f4b2f4284a6553cf5e128727 /src/import | |
parent | 4282b36da43457988eb261923aa7da2adb7a8f43 (diff) | |
download | talos-hostboot-c5da870a2aa8a754e0037d6bffff1e2599d3100d.tar.gz talos-hostboot-c5da870a2aa8a754e0037d6bffff1e2599d3100d.zip |
mss_get_ecid code for 11/15 SOA chkpt
Change-Id: I1c61f1f20fcdd16d014d13833f3a8eef92559175
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/32617
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Johannes Koesters <koesters@de.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43530
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import')
8 files changed, 1403 insertions, 0 deletions
diff --git a/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.C b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.C new file mode 100644 index 000000000..069ce379c --- /dev/null +++ b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.C @@ -0,0 +1,356 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016,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 */ +/// @file p9c_mss_get_cen_ecid.C +/// @brief HWP for training DRAM delay values +/// +/// *HWP HWP Owner: Luke Mulkey <lwmulkey@us.ibm.com> +/// *HWP HWP Backup: +/// *HWP Team: Memory +/// *HWP Level: 2 +/// *HWP Consumed by: HB +////// +#include <fapi2.H> +#include <p9c_mss_get_cen_ecid.H> + +extern "C" { + +//------------------------------------------------------------------------------ +// Function definitions +//------------------------------------------------------------------------------ + fapi2::ReturnCode user_ecid( uint8_t& o_ddr_port_status, + uint8_t& o_cache_enable, + uint8_t& o_centaur_sub_revision, + ecid_user_struct& ecid_struct + ); + +// HWP entry point + fapi2::ReturnCode p9c_mss_get_cen_ecid( + const fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>& i_target, + uint8_t& o_ddr_port_status, + uint8_t& o_cache_enable, + uint8_t& o_centaur_sub_revision, + ecid_user_struct& ecid_struct + ) + { + // return code + + + + // set the init state attribute to CLOCKS_ON + uint8_t l_attr_mss_init_state; + uint8_t l_bluewaterfall_nwell_broken; + uint8_t l_psro; + uint64_t ecid[2]; + fapi2::buffer<uint64_t> scom; + uint8_t l_bluewaterfall_broken; + uint8_t l_nwell_misplacement; + uint8_t l_ecidContainsPortLogicBadIndication = 0; + uint8_t l_checkL4CacheEnableUnknown = 0; + l_attr_mss_init_state = fapi2::ENUM_ATTR_CEN_MSS_INIT_STATE_CLOCKS_ON; + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_CEN_MSS_INIT_STATE, i_target, l_attr_mss_init_state)); + + + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CEN_CENTAUR_EC_FEATURE_BLUEWATERFALL_NWELL_BROKEN_CHECK_FLAG, + i_target, l_bluewaterfall_nwell_broken), + "mss_get_cen_ecid: could not GET ATTR_CEN_CENTAUR_EC_FEATURE_BLUEWATERFALL_NWELL_BROKEN_CHECK_FLAG"); + + // For certain Centaur DD1.0* subversions, adjustments need to be made to + // the bluewaterfall and the transistor misplaced in the nwell. + // l_bluewaterfall_nwell_broken will be 1 if needing changes and 0 if not + if(l_bluewaterfall_nwell_broken) + { + ecid_struct.io_ec = 0x10; + } + else + { + ecid_struct.io_ec = 0x20; + } + + FAPI_INF("Centaur EC version 0x%02x", ecid_struct.io_ec); + + if(ecid_struct.valid) + { + + FAPI_TRY(mss_parse_ecid(ecid_struct.io_ecid, + ecid_struct.i_checkL4CacheEnableUnknown, + ecid_struct.i_ecidContainsPortLogicBadIndication, + l_bluewaterfall_nwell_broken, + o_ddr_port_status, + o_cache_enable, + o_centaur_sub_revision, + ecid_struct.o_psro, + ecid_struct.o_bluewaterfall_broken, + ecid_struct.o_nwell_misplacement )); + + // procedure is done. + return fapi2::current_err; + } + + + // mark HWP entry + FAPI_IMP("Entering mss_get_cen_ecid...."); + FAPI_TRY(fapi2::getScom( i_target, ECID_PART_0_0x00010000, scom ), + "mss_get_cen_ecid: could not read scom address 0x00010000"); + scom.reverse(); + FAPI_TRY(scom.extract(ecid_struct.io_ecid[0], 0, 64)); + + //gets the second part of the ecid and sets the attribute + FAPI_TRY(fapi2::getScom( i_target, ECID_PART_1_0x00010001, scom ), + "mss_get_cen_ecid: could not read scom address 0x00010001" ); + scom.reverse(); + FAPI_TRY(scom.extract(ecid_struct.io_ecid[1], 0, 64)); + + ecid[0] = ecid_struct.io_ecid[0]; + ecid[1] = ecid_struct.io_ecid[1]; + + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_CEN_ECID, i_target, ecid), "mss_get_cen_ecid: Could not set ATTR_ECID" ); + + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CEN_CENTAUR_EC_FEATURE_CHECK_L4_CACHE_ENABLE_UNKNOWN, + i_target, l_checkL4CacheEnableUnknown), + "mss_get_cen_ecid: could not get ATTR_CEN_CENTAUR_EC_FEATURE_CHECK_L4_CACHE_ENABLE_UNKNOWN"); + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CEN_CENTAUR_EC_FEATURE_ECID_CONTAINS_PORT_LOGIC_BAD_INDICATION, + i_target, l_ecidContainsPortLogicBadIndication), + "mss_get_cen_ecid: could not get ATTR_CEN_CENTAUR_EC_FEATURE_ECID_CONTAINS_PORT_LOGIC_BAD_INDICATION" ); + + FAPI_TRY(mss_parse_ecid(ecid, + l_checkL4CacheEnableUnknown, + l_ecidContainsPortLogicBadIndication, + l_bluewaterfall_nwell_broken, + o_ddr_port_status, + o_cache_enable, + o_centaur_sub_revision, + l_psro, + l_bluewaterfall_broken, + l_nwell_misplacement )); + + ecid_struct.o_psro = l_psro; + ecid_struct.o_bluewaterfall_broken = l_bluewaterfall_broken; + ecid_struct.o_nwell_misplacement = l_nwell_misplacement; + + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_CEN_MSS_PSRO, i_target, l_psro), + "mss_get_cen_ecid: could not set ATTR_CEN_MSS_PSRO" ); + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_CEN_MSS_BLUEWATERFALL_BROKEN, i_target, l_bluewaterfall_broken), + "mss_get_cen_ecid: could not set ATTR_CEN_MSS_BLUEWATERFALL_BROKEN"); + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_CEN_MSS_NWELL_MISPLACEMENT, i_target, l_nwell_misplacement), + "mss_get_cen_ecid: could not set ATTR_CEN_MSS_NWELL_MISPLACEMENT"); + // mark HWP exit + FAPI_IMP("Exiting mss_get_cen_ecid...."); + fapi_try_exit: + return fapi2::current_err; + } + +// Decoder function which allows us to pass in just the raw ECID data and get it decoded for in the lab +// or we can just use it to set up all the needed attributes + + fapi2::ReturnCode mss_parse_ecid(uint64_t ecid[2], + const uint8_t i_checkL4CacheEnableUnknown, + const uint8_t i_ecidContainsPortLogicBadIndication, + const uint8_t i_bluewaterfall_nwell_broken, + uint8_t& o_ddr_port_status, + uint8_t& o_cache_enable, + uint8_t& o_centaur_sub_revision, + uint8_t& o_psro, + uint8_t& o_bluewaterfall_broken, + uint8_t& o_nwell_misplacement ) + { +//get bit128 + uint8_t bit128 = 0; + uint8_t bit126 = 0; + uint8_t bit125 = 0; + uint8_t bit117_124 = 0; + + fapi2::buffer<uint64_t> scom; + + o_nwell_misplacement = 0; + o_bluewaterfall_broken = 0; + + + FAPI_TRY(scom.insert(ecid[1], 0, 64), "mss_get_cen_ecid: error manipulating fapi2::variable_buffer"); + FAPI_TRY(scom.extract(bit128, 63, 1), "mss_get_cen_ecid: could not extract cache data_valid bit"); + bit128 = bit128 >> 7; + + if(bit128 == 1) // Cache enable bit is valid + { + + //gets bits 113 and 114 to determine the state of the cache + uint8_t bit113_114 = 0; + FAPI_TRY(scom.extract(bit113_114, 48, 2), "mss_get_cen_ecid: could not extract cache data"); + bit113_114 = bit113_114 >> 6; + uint8_t t; + + //determines the state of the cache + if(bit113_114 == 0) + { + t = fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_ON; + } + else if(bit113_114 == 1) + { + t = fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_HALF_A; + } + else if(bit113_114 == 2) + { + t = fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_HALF_B; + } + else + { + t = fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_OFF; + } + + // Centaur DD1.X chips have an ECBIT in bit127, if this is zero then the + // cache enable bits are in an unknown state. DD2.X chips and higher do not + // have an ECBIT. The decision to look at the ECBIT is done with a Chip EC + // Feature Attribute - the attribute XML can be easily tweaked if it is + // found that other DD levels also have an ECBIT. + // Centaur | DataValid | ECBIT | Return Value | Firmware Action | Cronus Action**| + // 1.* | 0 | 0 or 1 | DIS | DIS | DIS | + // 1.* | 1 | 0 | Unk ENA/DIS/A/B| DIS | ENA/DIS/A/B | + // 1.* | 1 | 1 | ENA/DIS/A/B | ENA/DIS* | ENA/DIS/A/B | + // != 1.* | 0 | N/A | DIS | DIS | DIS | + // != 1.* | 1 | N/A | ENA/DIS/A/B | ENA/DIS | ENA/DIS/A/B | + // + // * firmware can suport paritial cache if it wants to for DD1.* (e.g. DD1.0 DD1.01, DD1.1 etc) + // However, if it chooses to, it should still make all Unk ones disabled + // ** Cronus Action - cronus and all fapi2 procedures only support the original defintion of ENA/DIS/A/B + // Cronus actually uses its config file for the 4 values and checks the hardware via the get_cen_ecid + // procedure during step 11 to make sure the end user does not enable a disable cache + // Under cronus, the Unk information is only printed to the screen + + if (i_checkL4CacheEnableUnknown) + { + uint8_t bit127 = 0; + FAPI_TRY(scom.extract(bit127, 62, 1), "mss_get_cen_ecid: could not extract ECBIT bit"); + bit127 = bit127 >> 7; + + if(bit127 == 0) + { + FAPI_INF("mss_get_cen_ecid: Cache Enable Bits are in Unknown State"); + + if(bit113_114 == 0) + { + t = fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_UNK_ON; + } + else if(bit113_114 == 1) + { + t = fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_UNK_HALF_A; + } + else if(bit113_114 == 2) + { + t = fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_UNK_HALF_B; + } + else + { + t = fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_UNK_OFF; + } + } + else + { + FAPI_INF("mss_get_cen_ecid: Cache Enable Bits are in Known State"); + } + } + + o_cache_enable = t; + } + else + { + FAPI_INF("Cache Disbled because eDRAM data bits are assumed to be bad"); + o_cache_enable = fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_OFF; + } + + //reads in the ECID info for whether a DDR port side is good or bad + //This is only defined for DD1.x parts + if(i_ecidContainsPortLogicBadIndication ) + { + FAPI_TRY(scom.extract(o_ddr_port_status, 50, 2), "mss_get_cen_ecid: could not extract DDR status data" ); + o_ddr_port_status = o_ddr_port_status >> 6; + } + else + { + o_ddr_port_status = 0x0; // logic in both ports are good + } + + + //116..123 average PSRO from 85C wafer test + FAPI_TRY(scom.extract(bit117_124, 52, 8), "mss_get_cen_ecid: could not extract PSRO"); + o_psro = bit117_124; + + // read the bit in the ecid to see if we are a DD1.01 + // Bit 124 DD1.01 Indicator Bit. Set to '1' for DD1.01 devices + FAPI_TRY(scom.extract(bit125, 60, 1), "mss_get_cen_ecid: could not extract dd1.01 indicator bit"); + bit125 = bit125 >> 7; + o_centaur_sub_revision = bit125; + + // The ecid contains the chip's subrevision, changes in the subrevision should not + // change firmware behavior but for the exceptions, update attributes to indicate + // those behaviors + if (i_bluewaterfall_nwell_broken && (o_centaur_sub_revision < 1)) + { + // For DD1.00, the transistor misplaced in the nwell needs some setting adjustments to get it to function + // after DD1.00, we no longer need to make that adjustment + o_nwell_misplacement = 1; + } + + FAPI_TRY(scom.extract(bit126, 61, 1), "mss_get_cen_ecid: could not extract dd1.03 indicator bit"); + bit126 = bit126 >> 7; + + // we have to look at both the bluewaterfall and the n-well misplacement to determine the proper values of the n-well + if (i_bluewaterfall_nwell_broken) + { + if(bit126 == 0) + { + // on and after DD1.03, we no longer need to make adjustments due to the bluewaterfall - this is before + o_bluewaterfall_broken = 1; + } + else + { + o_nwell_misplacement = 0; // Assume if the bluewaterfall is fixed, then the nwell is also fixed + } + } + + fapi_try_exit: + return fapi2::current_err; + } + + fapi2::ReturnCode user_ecid( uint8_t& o_ddr_port_status, + uint8_t& o_cache_enable, + uint8_t& o_centaur_sub_revision, + ecid_user_struct& ecid_struct + ) + { + + return mss_parse_ecid(ecid_struct.io_ecid, + ecid_struct.i_checkL4CacheEnableUnknown, + ecid_struct.i_ecidContainsPortLogicBadIndication, + ecid_struct.i_bluewaterfall_nwell_broken, + o_ddr_port_status, + o_cache_enable, + o_centaur_sub_revision, + ecid_struct.o_psro, + ecid_struct.o_bluewaterfall_broken, + ecid_struct.o_nwell_misplacement ); + + } + + +} // extern "C" diff --git a/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.H b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.H new file mode 100644 index 000000000..ef0e0d734 --- /dev/null +++ b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.H @@ -0,0 +1,138 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016,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 */ +/// @file p9c_mss_get_cen_ecid.H +/// @brief HWP for decoding ECID +/// +/// *HWP HWP Owner: Luke Mulkey <lwmulkey@us.ibm.com> +/// *HWP HWP Backup: +/// *HWP Team: Memory +/// *HWP Level: 2 +/// *HWP Consumed by: HB +////// +#ifndef _MSS_GET_CEN_ECID_H_ +#define _MSS_GET_CEN_ECID_H_ + + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#include <fapi2.H> +#include <cen_scom_addresses.H> + +//defines enumerators +enum mss_get_cen_ecid_ddr_status +{ + MSS_GET_CEN_ECID_DDR_STATUS_ALL_GOOD = 0, + MSS_GET_CEN_ECID_DDR_STATUS_MBA1_BAD = 1, + MSS_GET_CEN_ECID_DDR_STATUS_MBA0_BAD = 2, + MSS_GET_CEN_ECID_DDR_STATUS_ALL_BAD = 3, +}; + +//------------------------------------------------------------------------------ +// Structure definitions +//------------------------------------------------------------------------------ +class ecid_user_struct +{ + public: + uint8_t valid; + uint8_t i_checkL4CacheEnableUnknown; + uint8_t i_ecidContainsPortLogicBadIndication; + uint8_t i_bluewaterfall_nwell_broken; + uint8_t i_user_defined; + uint8_t io_ec; + uint64_t io_ecid[2]; + uint8_t o_psro; + uint8_t o_bluewaterfall_broken; + uint8_t o_nwell_misplacement; + + ecid_user_struct(); +}; + +inline ecid_user_struct::ecid_user_struct() +{ + valid = 0; + i_checkL4CacheEnableUnknown = 0; + i_ecidContainsPortLogicBadIndication = 0; + i_user_defined = 0; + io_ec = 0; + io_ecid[0] = 0; + io_ecid[1] = 0; +} + + +// function pointer typedef definition for HWP call support +typedef fapi2::ReturnCode +(*p9c_mss_get_cen_ecid_FP_t)(const fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>& i_target, uint8_t& o_ddr_port_status, + uint8_t& o_cache_enable, uint8_t& o_centaur_sub_revision, ecid_user_struct& user_data + + ); + + +//------------------------------------------------------------------------------ +// Function prototypes +//------------------------------------------------------------------------------ + +extern "C" +{ + +// function: FAPI mss_get_cen_ecid HWP entry point +// parameters: i_target => cen chip target +// &o_ddr_port_status => indicates if the MBA's are bad, with MBA 1 being the rightmost bit and MBA 0 being the next to right most bit +// &o_cache_enable => what it would have set the cache enable attribute to if it sets attributes +// &o_centaur_sub_revision => the sub revision indicator between DD1.0 and DD1.01 +// returns: FAPI_RC_SUCCESS if FBC stop is deasserted at end of execution +// else FAPI return code for failing operation +// Updates attributes: ATTR_ECID[2] -> bits 1-64 and 65-128 of the ECID +// ATTR_MSS_PSRO -> average PSRO from 85C wafer test +// ATTR_MSS_NWELL_MISPLACEMENT -> indicates if nwell defect in hardware + fapi2::ReturnCode p9c_mss_get_cen_ecid( + const fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>& i_target, + uint8_t& o_ddr_port_status, + uint8_t& o_cache_enable, + uint8_t& o_centaur_sub_revision, + ecid_user_struct& user_data + + ); + + fapi2::ReturnCode mss_parse_ecid( + uint64_t ecid[2], // input ECID in bit order + const uint8_t l_checkL4CacheEnableUnknown, // input L4CacheEnableUnknown is possible + const uint8_t l_ecidContainsPortLogicBadIndication, // input logic can be bad + const uint8_t + l_bluewaterfall_nwell_broken, // adjustments possibly needed for bluewaterfall and transistor misplaced in the nwell + uint8_t& ddr_port, //output ddr ports are non functional + uint8_t& cache_enable_o, // output cache is functional or not + uint8_t& centaur_sub_revision_o, // output sub revsion number + uint8_t& o_psro, // output psro + uint8_t& o_bluewaterfall_broken, // output blue waterfall broken + uint8_t& o_nwell_misplacement // output nwell misplacement + ); + + + +} // extern "C" + +#endif // _MSS_GET_CEN_ECID_H_ diff --git a/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.mk b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.mk new file mode 100755 index 000000000..bc6ed538e --- /dev/null +++ b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.mk @@ -0,0 +1,32 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid.mk $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2016,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 the macros and things for MSS procedures + +PROCEDURE=p9c_mss_get_cen_ecid +OBJS+=p9c_mss_get_cen_ecid_decode.o +$(eval $(call ADD_MEMORY_INCDIRS,$(PROCEDURE))) +#lib$(PROCEDURE)_DEPLIBS+=mss +$(call BUILD_PROCEDURE) diff --git a/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.C b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.C new file mode 100644 index 000000000..0c09c3705 --- /dev/null +++ b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.C @@ -0,0 +1,319 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016,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 */ +/// @file p9c_mss_get_cen_ecid_decode.C +/// @brief HWP for decoding ECID +/// +/// *HWP HWP Owner: Luke Mulkey <lwmulkey@us.ibm.com> +/// *HWP HWP Backup: +/// *HWP Team: Memory +/// *HWP Level: 2 +/// *HWP Consumed by: HB +////// +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ +#include <fapi2.H> +#include <p9c_mss_get_cen_ecid_decode.H> + +extern "C" { + +//------------------------------------------------------------------------------ +// Function definitions +//------------------------------------------------------------------------------ +// HWP entry point + fapi2::ReturnCode p9c_mss_get_cen_ecid_decode( + uint8_t& i_ddr_port_status, + uint8_t& i_cache_enable, + uint8_t& i_centaur_sub_revision, + ecid_user_struct& i_user_info, + char* o_display_string + ) + { + // return code + + + +//void decode_base_code(uint64_t ecid[2], uint8_t ddr_port, uint8_t cache_enable_o, uint8_t centaur_sub_revision_o, uint8_t nwell, uint8_t waterfall_broken, uint8_t user_input, uint8_t psro, uint8_t i_ec) { + //checks the DDR ports and outputs the results + //prints out all of the information + uint32_t t = i_user_info.io_ecid[0]; + fapi2::variable_buffer temp(64); + uint64_t data[2]; + data[0] = i_user_info.io_ecid[0]; + data[1] = i_user_info.io_ecid[1]; + char ecid_char; + uint8_t c = 0; + float chip_version; + char ECID[13]; + + for(int i = 0; i < 13; i++) + { + ECID[i] = '\0'; + } + + uint8_t x = 0; + uint8_t y = 0; + char temp_string[200]; + + + o_display_string[0] = '\0'; + + + FAPI_TRY(temp.insert(t, 32, 32, 0)); + t = data[0] >> 32; + FAPI_TRY(temp.insert(t, 0, 32, 0)); + + for(uint8_t i = 0; i < 10; i++) + { + FAPI_TRY(temp.extract(c, 4 + i * 6, 6)); + c = c >> 2; + FAPI_TRY(get_ecid_char( c, &ecid_char)); + ECID[i] = ecid_char; + } + + get_ecid_checksum(ECID); + + //generates the x and y location from the ecid + t = data[1]; + FAPI_TRY(temp.insert(t, 32, 32, 0)); + t = data[1] >> 32; + FAPI_TRY(temp.insert(t, 0, 32, 0)); + FAPI_TRY(temp.extract(x, 0, 8)); + FAPI_TRY(temp.extract(y, 8, 8)); + + chip_version = i_user_info.io_ec / 0x10; + + if(i_user_info.io_ec < 0x20) + { + if(!i_user_info.o_nwell_misplacement) + { + chip_version = 1.01; + } + + if(!i_user_info.o_bluewaterfall_broken) + { + chip_version = 1.10; + } + } + else + { + chip_version = 2.00; + } + + if(!(i_user_info.i_user_defined & CSV)) + { + sprintf(temp_string, "ECID(1:64) 0x%016llx\n", static_cast<unsigned long long int>(i_user_info.io_ecid[0])); + strcat(o_display_string, temp_string); + sprintf(temp_string, "ECID(65:128) 0x%016llx\n", static_cast<unsigned long long int>(i_user_info.io_ecid[1])); + strcat(o_display_string, temp_string); + sprintf(temp_string, " Wafer ID: %s\n", ECID); + strcat(o_display_string, temp_string); + sprintf(temp_string, " Chip X/Y loc: x:%d y:%d\n", x, y); + strcat(o_display_string, temp_string); + sprintf(temp_string, " Chip version: DD%.02f\n", chip_version); + strcat(o_display_string, temp_string); + + switch(i_cache_enable) + { + case fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_ON: + sprintf(temp_string, " All eDRAMs Halves are good\n"); // Note A is Even, B is Odd + break; + + case fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_HALF_A: + sprintf(temp_string, " eDRAM Half A is good. eDRAM Half B is bad\n"); + break; + + case fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_HALF_B: + sprintf(temp_string, " eDRAM Half A is bad. eDRAM Half B is good\n"); + break; + + case fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_OFF: + sprintf(temp_string, " All eDRAMs Halves are bad\n"); + break; + + case fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_UNK_ON: + sprintf(temp_string, " All eDRAMs Halves are full unk good\n"); + break; + + case fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_UNK_HALF_A: + sprintf(temp_string, " All eDRAMs A or Even unk good\n"); + break; + + case fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_UNK_HALF_B: + sprintf(temp_string, " All eDRAMs B or odd unk good\n"); + break; + + default: + sprintf(temp_string, " All eDRAMs Halves are full unk bad\n"); + break; + } + + strcat(o_display_string, temp_string); + + if(i_ddr_port_status == 0) + { + sprintf(temp_string, " All DDR Ports are good\n"); + } + else if(i_ddr_port_status == 1) + { + sprintf(temp_string, " DDR Port 0/1 is good. DDR Port 2/3 is bad\n"); + } + else if(i_ddr_port_status == 2) + { + sprintf(temp_string, " DDR Port 0/1 is bad. DDR Port 2/3 is good\n"); + } + else + { + sprintf(temp_string, " All DDR Ports are bad\n"); // this is informational, so no callouts are made + } + + strcat(o_display_string, temp_string); + + sprintf(temp_string, " PSRO: 0x%02x %f ps\n", i_user_info.o_psro, i_user_info.o_psro * 0.025 + 7.5); + strcat(o_display_string, temp_string); + } + //prints out a CSV + else + { + uint8_t repair, bad_edram_a, bad_edram_b; + uint8_t bad_ddr_port01, bad_ddr_port23; + + if(i_cache_enable == fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_ON) + { + repair = 1; + bad_edram_a = 0; + bad_edram_b = 0; + } + else if(i_cache_enable == fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_HALF_A) + { + repair = 1; + bad_edram_a = 0; + bad_edram_b = 1; + } + else if(i_cache_enable == fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_HALF_B) + { + repair = 1; + bad_edram_a = 1; + bad_edram_b = 0; + } + else if(i_cache_enable == fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_OFF) + { + repair = 1; + bad_edram_a = 1; + bad_edram_b = 1; + } +// else if(cache_enable_o == fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_UNK_ON) {repair=0;bad_edram_a=0;bad_edram_b=0; } +// else if(cache_enable_o == fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_UNK_HALF_A) {repair=0;bad_edram_a=0;bad_edram_b=1; } +// else if(cache_enable_o == fapi2::ENUM_ATTR_CEN_MSS_CACHE_ENABLE_UNK_HALF_B) {repair=0;bad_edram_a=1;bad_edram_b=0; } + else + { + repair = 0; + bad_edram_a = 1; + bad_edram_b = 1; + } + + if(i_ddr_port_status == 0) + { + bad_ddr_port01 = 0 ; + bad_ddr_port23 = 0; + } + else if(i_ddr_port_status == 1) + { + bad_ddr_port01 = 0 ; + bad_ddr_port23 = 1; + } + else if(i_ddr_port_status == 2) + { + bad_ddr_port01 = 1 ; + bad_ddr_port23 = 0; + } + else + { + bad_ddr_port01 = 1 ; + bad_ddr_port23 = 1; + } + + sprintf(o_display_string, "%s,%d,%d,%0.2f,%d,%d,%d,%d,%d,%f ps\n", ECID, x, y, chip_version, repair, bad_edram_a, + bad_edram_b, bad_ddr_port01, bad_ddr_port23, ((float)i_user_info.o_psro * 0.025 + 7.5)); + } + + fapi_try_exit: + return fapi2::current_err; + } + +//gets the character for the ECID + fapi2::ReturnCode get_ecid_char(uint8_t c, char* creturn) + { + //c is a number, so use the offset for a number + if(c < 10) + { + *creturn = (char)(c + 48); + } + else + { + *creturn = (char)(c + 55); + } + + return fapi2::FAPI2_RC_SUCCESS; + } + +//gets the checksum, the last two characters, in the ecid string + void get_ecid_checksum(char ECID[13]) + { + char rtn[13]; + + for(uint32_t i = 0; i < 10; i++) + { + rtn[i] = ECID[i]; + } + + rtn[10] = 'A'; + rtn[11] = '0'; + rtn[12] = '\0'; + int sum = 0; + + for (uint32_t i = 0; i < 12; i++) + { + sum = ((sum * 8) + (rtn[i] - 32)) % 59; + } + + if (sum != 0) + { + int adjust = 59 - sum; + rtn[11] += adjust & 7; + adjust >>= 3; + rtn[10] += adjust & 7; + } + + for (uint32_t i = 0; i < 13; i++) + { + ECID[i] = rtn[i]; + } + } + + + + +} // extern "C" diff --git a/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.H b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.H new file mode 100644 index 000000000..a22eee8e4 --- /dev/null +++ b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.H @@ -0,0 +1,96 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016,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 */ +// Version:| Author: | Date: | Comment: +/// +/// @file p9c_mss_get_cen_ecid_decode.H +/// @brief HWP for decoding ecid +/// +/// *HWP HWP Owner: Luke Mulkey <lwmulkey@us.ibm.com> +/// *HWP HWP Backup: +/// *HWP Team: Memory +/// *HWP Level: 2 +/// *HWP Consumed by: HB +////// +#ifndef _MSS_GET_CEN_ECID_DECODE_H_ +#define _MSS_GET_CEN_ECID_DECODE_H_ + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#include <fapi2.H> +#include <p9c_mss_get_cen_ecid.H> + + + +// function pointer typedef definition for HWP call support +typedef fapi2::ReturnCode +(*p9c_mss_get_cen_ecid_decode_FP_t)(uint8_t& i_ddr_port_status, uint8_t& i_cache_enable, + uint8_t& i_centaur_sub_revision, ecid_user_struct& i_user_data, char* o_display_string + ); + +const int MSS_GET_CEN_ECID_DECODE_STRING_LENGTH = 1000; + +//void decode_base_code(uint64_t ecid[2], uint8_t ddr_port, uint8_t cache_enable_o, uint8_t centaur_sub_revision_o, uint8_t o_nwell_misplacement, uint8_t o_bluewaterfall_broken, uint8_t user_defined, uint8_t psro, uint8_t i_ec ); +//ReturnCode get_ecid_char(uint8_t c, char *creturn); +//void get_ecid_checksum(char ECID[12]); + +enum user_flags +{ + USER_INPUT_ECID = 1, + CSV = 2, + COMMENT = 4, +}; + +//------------------------------------------------------------------------------ +// Function prototypes +//------------------------------------------------------------------------------ + +extern "C" +{ + +// function: FAPI mss_get_cen_ecid_decode HWP entry point +// parameters: +// &o_ddr_port_status => indicates if the MBA's are bad, with MBA 1 being the rightmost bit and MBA 0 being the next to right most bit +// &o_cache_enable => what it would have set the cache enable attribute to if it sets attributes +// &o_centaur_sub_revision => the sub revision indicator between DD1.0 and DD1.01 +// &o_user_data => holder for additional information for printing +// &o_display_string -> output string- max of MSS_GET_CEN_ECID_DECODE_STRING_LENGTH length +// returns: FAPI_RC_SUCCESS if FBC stop is deasserted at end of execution +// else FAPI return code for failing operation + fapi2::ReturnCode p9c_mss_get_cen_ecid_decode( + uint8_t& i_ddr_port_status, + uint8_t& i_cache_enable, + uint8_t& i_centaur_sub_revision, + ecid_user_struct& i_user_data, + char* o_display_string + + ); + fapi2::ReturnCode get_ecid_char(uint8_t c, char* creturn); // print helping function + void get_ecid_checksum(char ECID[13]); + +} // extern "C" + +#endif // _MSS_GET_CEN_ECID_DECODE_H_ diff --git a/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.mk b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.mk new file mode 100755 index 000000000..6efb70b9b --- /dev/null +++ b/src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.mk @@ -0,0 +1,31 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/import/chips/centaur/procedures/hwp/memory/p9c_mss_get_cen_ecid_decode.mk $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2016,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 the macros and things for MSS procedures + +PROCEDURE=p9c_mss_get_cen_ecid_decode +$(eval $(call ADD_MEMORY_INCDIRS,$(PROCEDURE))) +#lib$(PROCEDURE)_DEPLIBS+=mss +$(call BUILD_PROCEDURE) diff --git a/src/import/chips/centaur/procedures/hwp/memory/wrapper/p9c_mss_get_cen_ecid_wrap.C b/src/import/chips/centaur/procedures/hwp/memory/wrapper/p9c_mss_get_cen_ecid_wrap.C new file mode 100644 index 000000000..de36acb49 --- /dev/null +++ b/src/import/chips/centaur/procedures/hwp/memory/wrapper/p9c_mss_get_cen_ecid_wrap.C @@ -0,0 +1,402 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/centaur/procedures/hwp/memory/wrapper/p9c_mss_get_cen_ecid_wrap.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016,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 */ +/// @file p9c_mss_get_cen_ecid_wrap.C +/// @brief Wrapper for calling p9c_mss_get_cen_ecid hwp +/// +/// *HWP HWP Owner: Luke Mulkey <lwmulkey@us.ibm.com> +/// *HWP HWP Backup: +/// *HWP Team: Memory +/// *HWP Level: 2 +/// *HWP Consumed by: HB +////// + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +//#include <prcdUtils.H> + +//---------------------------------------------------------------------- +// eCMD Includes +//---------------------------------------------------------------------- +#include <ecmdClientCapi.H> +#include <ecmdDataBuffer.H> +#include <ecmdUtils.H> +#include <ecmdSharedUtils.H> +#include <fapi2ClientCapi.H> +#include <croClientCapi.H> +#include <fapi2.H> +#include <fapi2SharedUtils.H> + +//---------------------------------------------------------------------- +// PROCEDURE Includes +//---------------------------------------------------------------------- +#include <p9c_mss_get_cen_ecid.H> +#include <p9c_mss_get_cen_ecid_decode.H> + + +void help() +{ + printf("Help function for mss_get_cen_ecid\n"); + printf(" Default case, gets the ecid from a centaur\n"); + printf(" -h displays the help function\n"); + printf(" -user_defined allows the user to input 2 user defined, 64 bit hex values to be processed and displayed to the screen \n"); + printf(" -ecid0= corresponds to register 10000 and -ecid1= corresponds to 10001\n"); + printf(" -attr0= corresponds to ATTR_ECID[0] -attr1= corresponds to ATTR_ECID[1]\n"); + printf(" -user_ec= EC level of the chip in user mode: 10, 20, etc\n"); + printf(" eg -user_defined -ecid0=69AC004284086980 -ecid1=93C37C000000E8F4 \n"); + printf(" -csv print in comma separated values \n"); +} + +//ecid_user_struct::ecid_user_struct() { valid=0; i_checkL4CacheEnableUnknown=0; i_ecidContainsPortLogicBadIndication=0; i_ec=0; io_ecid[0]=0; io_ecid[1]=0; } + +int main( int argc, char* argv[] ) +{ + fapi2::ReturnCode f_rc = fapi2::FAPI2_RC_SUCCESS; + uint32_t rc; + ecmdLooperData node_looper; + ecmdChipTarget node_target; + ecmdDataBuffer data; + char printStr[200]; + char user_ec[20] = "2.0"; + uint8_t ddr_port; + uint8_t cache_enable_o; + uint64_t ecid0 = 0, ecid1 = 0; + uint8_t centaur_sub_revision_o; + char* value; + char* comment; + ecid_user_struct user_data; + user_data.valid = 0; + user_data.i_user_defined = 0; + + //------------------------------------------------------------------------------------------------- + //-h was selected, so print out the help screen and exit out. + //------------------------------------------------------------------------------------------------- + if (ecmdParseOption(&argc, &argv, "-h")) + { + help(); + return 1; + } + + //parses the user -csv option + if (ecmdParseOption(&argc, &argv, "-csv")) + { + user_data.i_user_defined |= CSV; + } + + //parses the user -comment= + if ((comment = ecmdParseOptionWithArgs(&argc, &argv, "-comment="))) + { + user_data.i_user_defined |= COMMENT; + } + + //user defined input selected + if (ecmdParseOption(&argc, &argv, "-user_defined")) + { + user_data.i_user_defined |= USER_INPUT_ECID; + ecmdDataBufferBase scom(64); + printf("User defined input selected.....\n"); + + //processes the ecid value so it can be interpretted by the get_cen_ecid_lab function + if ((value = ecmdParseOptionWithArgs(&argc, &argv, "-ecid0="))) + { + ecid0 = strtoull( value, NULL, 16 ); + scom.setDoubleWord(0, ecid0); + scom.reverse(); + ecid0 = scom.getDoubleWord(0); + } + else if ((value = ecmdParseOptionWithArgs(&argc, &argv, "-attr0="))) + { + ecid0 = strtoull( value, NULL, 16 ); + } + else + { + printf("ERROR: ecid0 not set! Exiting....\n"); + return 1; + } + + if ((value = ecmdParseOptionWithArgs(&argc, &argv, "-ecid1="))) + { + ecid1 = strtoull( value, NULL, 16 ); + scom.setDoubleWord(0, ecid1); + scom.reverse(); + ecid1 = scom.getDoubleWord(0); + } + else if ((value = ecmdParseOptionWithArgs(&argc, &argv, "-attr1="))) + { + ecid1 = strtoull( value, NULL, 16 ); + } + else + { + printf("ERROR: ecid1 not set! Exiting....\n"); + return 1; + } + + if ((value = ecmdParseOptionWithArgs(&argc, &argv, "-user_ec="))) + { + strcpy(user_ec, value); + } + else + { + printf("Using default EC level of %s\n", user_ec); + } + } + + //------------------------------------------------------------------------------------------------- + // Pick up the name of the Procedure your looking to compile + //------------------------------------------------------------------------------------------------- + std::string myHWP = "mss_get_cen_ecid"; + std::string myInput = ""; + std::string myTarget = "centaur"; + std::string myTargetChiplet = "mba"; + + //------------------------------------------------------------------------------------------------- + // Load and initialize the eCMD Dll + // If left NULL, which DLL to load is determined by the ECMD_DLL_FILE environment variable + // If set to a specific value, the specified dll will be loaded + //------------------------------------------------------------------------------------------------- + rc = ecmdLoadDll(""); + + if (rc) + { + return rc; + } + + //------------------------------------------------------------------------------------------------- + // This is needed if you're running a FAPI procedure from this eCMD procedure + //------------------------------------------------------------------------------------------------- + rc = fapi2InitExtension(); + + if (rc) + { + printf("Error init fapi2 extension\n"); + return rc; + } + + rc = croInitExtension(); + + if (rc) + { + printf("Error init cro extension\n"); + return rc; + } + + //------------------------------------------------------------------------------------------------- + // Parse out common eCMD args like -p0, -c0, -coe, etc.. + // Any found args will be removed from arg list upon return + //------------------------------------------------------------------------------------------------- + rc = ecmdCommandArgs(&argc, &argv); + + if (rc) + { + return rc; + } + + //------------------------------------------------------------------------------------------------- + // Let's always print the dll info to the screen, unless in quiet mode + //------------------------------------------------------------------------------------------------- + if (!ecmdGetGlobalVar(ECMD_GLOBALVAR_QUIETMODE)) + { + rc = ecmdDisplayDllInfo(); + + if (rc) + { + return rc; + } + } + + char o_display_string[MSS_GET_CEN_ECID_DECODE_STRING_LENGTH]; + + if(user_data.i_user_defined & USER_INPUT_ECID) + { + user_data.valid = 1; + + if(strcmp(user_ec, "1.0") == 0 || strcmp(user_ec, "1.00") == 0 || + strcmp(user_ec, "1.01") == 0 || strcmp(user_ec, "1.1") == 0 || + strcmp(user_ec, "1.10") == 0 || strcmp(user_ec, "10") == 0) + { + user_data.i_checkL4CacheEnableUnknown = 1; + user_data.i_ecidContainsPortLogicBadIndication = 1; + user_data.io_ec = 0x10; + } + else + { + user_data.i_checkL4CacheEnableUnknown = 0; + user_data.i_ecidContainsPortLogicBadIndication = 0; + user_data.io_ec = int((atof(user_ec) + 0.00001) * 0x10); + } + + printf("User EC level is set to %s with major revision of %02x\n", user_ec, user_data.io_ec); + + fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> fTarget; + user_data.io_ecid[0] = ecid0; + user_data.io_ecid[1] = ecid1; + + FAPI_EXEC_HWP(f_rc, p9c_mss_get_cen_ecid, fTarget, ddr_port, cache_enable_o, centaur_sub_revision_o, user_data ); + + if (f_rc != fapi2::FAPI2_RC_SUCCESS) + { + ecmdOutputError("-----------------------------------------------------------\n"); + snprintf(printStr, 200, " Procedure: %s exited early with ...\n", myHWP.c_str()); + ecmdOutputError(printStr); + snprintf(printStr, 200, " Return code = %s 0x%08x \n", ecmdParseReturnCode(f_rc).c_str(), (uint32_t)f_rc); + ecmdOutputError(printStr); + ecmdOutputError("-----------------------------------------------------------\n"); + return 1; + } + + FAPI_EXEC_HWP(f_rc, p9c_mss_get_cen_ecid_decode, ddr_port, cache_enable_o, centaur_sub_revision_o, user_data, + o_display_string ); + + if (f_rc != fapi2::FAPI2_RC_SUCCESS) + { + ecmdOutputError("-----------------------------------------------------------\n"); + snprintf(printStr, 200, " Procedure: %s exited early with ...\n", myHWP.c_str()); + ecmdOutputError(printStr); + snprintf(printStr, 200, " Return code = %s 0x%08x \n", ecmdParseReturnCode(f_rc).c_str(), (uint32_t)f_rc); + ecmdOutputError(printStr); + ecmdOutputError("-----------------------------------------------------------\n"); + return 1; + } + + printf("%s\n", o_display_string); + } + else + { + //------------------------------------------------------------------------------------------------- + // Loop over all all Centaur chips + //------------------------------------------------------------------------------------------------- + // ecmdOutput("---------------------------------------------\n"); + // sprintf(printStr, "Loop over all %s chips:\n", myTarget.c_str()); + // ecmdOutput(printStr); + // ecmdOutput("---------------------------------------------\n"); + + // configure looper to iterate over all nodes + node_target.cageState = ECMD_TARGET_FIELD_WILDCARD; + node_target.nodeState = ECMD_TARGET_FIELD_WILDCARD; + node_target.slotState = ECMD_TARGET_FIELD_UNUSED; + node_target.posState = ECMD_TARGET_FIELD_UNUSED; + node_target.coreState = ECMD_TARGET_FIELD_UNUSED; + node_target.threadState = ECMD_TARGET_FIELD_UNUSED; + rc = ecmdConfigLooperInit(node_target, ECMD_SELECTED_TARGETS_LOOP_DEFALL, node_looper); + + if (rc) + { + ecmdOutputError("Error initializing node looper!\n"); + return rc; + } + + // loop over specified configured nodes + while (ecmdConfigLooperNext(node_target, node_looper)) + { + ecmdLooperData cen_looper; + ecmdChipTarget cen_target; + + if (!ecmdGetGlobalVar(ECMD_GLOBALVAR_QUIETMODE)) + { + snprintf(printStr, sizeof(printStr), "Processing %s\n", + ecmdWriteTarget(node_target).c_str()); + ecmdOutput(printStr); + } + + cen_target.chipType = "cen"; + cen_target.chipTypeState = ECMD_TARGET_FIELD_VALID; + + cen_target.cage = node_target.cage; + cen_target.node = node_target.node; + + cen_target.cageState = ECMD_TARGET_FIELD_VALID; + cen_target.nodeState = ECMD_TARGET_FIELD_VALID; + cen_target.slotState = ECMD_TARGET_FIELD_WILDCARD; + cen_target.posState = ECMD_TARGET_FIELD_WILDCARD; + cen_target.coreState = ECMD_TARGET_FIELD_UNUSED; + cen_target.threadState = ECMD_TARGET_FIELD_UNUSED; + + rc = ecmdConfigLooperInit(cen_target, ECMD_SELECTED_TARGETS_LOOP_DEFALL, cen_looper); + + if (rc) + { + ecmdOutputError("Error initializing chip looper!\n"); + return rc; + } + + // loop over configured positions inside current node + while(ecmdConfigLooperNext(cen_target, cen_looper)) + { + if (!ecmdGetGlobalVar(ECMD_GLOBALVAR_QUIETMODE)) + { + snprintf(printStr, sizeof(printStr), "Going to call %s on %s\n", + myHWP.c_str(), + ecmdWriteTarget(cen_target).c_str()); + ecmdOutput(printStr); + } + + // invoke FAPI procedure core + fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> fapi_target(&cen_target); + FAPI_EXEC_HWP(f_rc, p9c_mss_get_cen_ecid, fapi_target, ddr_port, cache_enable_o, centaur_sub_revision_o, user_data); + rc = (uint32_t) f_rc; + + if (rc) + { + snprintf(printStr, sizeof(printStr), "ERROR: %s FAPI call exited with bad return code = %s 0x%08x\n", + myHWP.c_str(), + ecmdParseReturnCode(rc).c_str(), rc); + ecmdOutputError(printStr); + return rc; + } + + FAPI_EXEC_HWP(f_rc, p9c_mss_get_cen_ecid_decode, ddr_port, cache_enable_o, centaur_sub_revision_o, user_data, + o_display_string ); + rc = (uint32_t) f_rc; + + if (rc) + { + snprintf(printStr, sizeof(printStr), "ERROR: %s FAPI call exited with bad return code = %s 0x%08x\n", + myHWP.c_str(), + ecmdParseReturnCode(rc).c_str(), rc); + ecmdOutputError(printStr); + return rc; + } + + printf("%s\n", o_display_string); + } + } + + +// ecmdOutput("---------------------------\n"); +// ecmdOutput(" Procedure is Done\n"); +// ecmdOutput("---------------------------\n"); + } + + //----------------------------------------------------------------------------------------------- + // Unload the eCMD Dll, this should always be the last thing you do + //----------------------------------------------------------------------------------------------- + ecmdUnloadDll(); + + return rc; +} + + + + diff --git a/src/import/chips/centaur/procedures/hwp/memory/wrapper/p9c_mss_get_cen_ecid_wrap.mk b/src/import/chips/centaur/procedures/hwp/memory/wrapper/p9c_mss_get_cen_ecid_wrap.mk new file mode 100755 index 000000000..0b4babb5d --- /dev/null +++ b/src/import/chips/centaur/procedures/hwp/memory/wrapper/p9c_mss_get_cen_ecid_wrap.mk @@ -0,0 +1,29 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/import/chips/centaur/procedures/hwp/memory/wrapper/p9c_mss_get_cen_ecid_wrap.mk $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2015,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 + +WRAPPER=p9c_mss_get_cen_ecid_wrap +$(WRAPPER)_USELIBS+=p9c_mss_get_cen_ecid +#$(WRAPPER)_DEPLIBS+=mss +$(call BUILD_WRAPPER) |