From 8212d722bc1054b61b066c7464d487dc9d4c29d4 Mon Sep 17 00:00:00 2001 From: Stephen Glancy Date: Mon, 20 Aug 2018 14:32:40 -0500 Subject: Adds explorer OMI training code Change-Id: Ic08c41538ae95b08ce05aa1a2413d45318f3e4ee Original-Change-Id: Ic4fcd226eea7478ffff6cacb830f8e1e83e6f247 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/64919 Reviewed-by: Louis Stermole Tested-by: Jenkins Server Reviewed-by: RYAN P. KING Reviewed-by: ANDRE A. MARIN Reviewed-by: Jennifer A. Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/71772 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Christian R. Geddes --- .../explorer/procedures/hwp/memory/exp_omi_train.C | 80 ++++++++++++++++++++++ .../explorer/procedures/hwp/memory/exp_omi_train.H | 53 ++++++++++++++ .../procedures/hwp/memory/exp_omi_train.mk | 29 ++++++++ .../procedures/hwp/memory/lib/omi/exp_omi_utils.C | 70 +++++++++++++++++++ 4 files changed, 232 insertions(+) create mode 100644 src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.C create mode 100644 src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.H create mode 100644 src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.mk (limited to 'src/import/chips/ocmb') diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.C b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.C new file mode 100644 index 000000000..adcd12f6a --- /dev/null +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.C @@ -0,0 +1,80 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2018 */ +/* [+] 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 exp_omi_train.C +/// @brief Contains the explorer OMI train +/// +// *HWP HWP Owner: Andre Marin +// *HWP HWP Backup: Stephen Glancy +// *HWP Team: Memory +// *HWP Level: 3 +// *HWP Consumed by: Memory + +#include +#include +#include +#include +#include + +extern "C" +{ + + /// + /// @brief Trains the OCMB link + /// @param[in] i_target the OCMB target to operate on + /// @return FAPI2_RC_SUCCESS iff ok + /// + fapi2::ReturnCode exp_omi_train(const fapi2::Target& i_target) + { + // TODO:RTC197867 Update these constants to read out actual values from attributes + constexpr uint8_t MANUFACTURING_MODE_OFF = 0x00; + constexpr uint8_t NO_LOOPBACK_TESTING = 0x00; + constexpr uint8_t OPENCAPI_TRANSPORT_LAYER = 0x00; + constexpr uint8_t IMMEDIATE_DL_LAYER_BOOT = 0x00; + constexpr uint8_t FULL_BOOT_MODE = 0x00; + constexpr uint8_t LANE_MODE_8 = 0x01; + constexpr uint8_t SERDES_25600MBPS = 0x03; + std::vector l_data; + + // Gets the data setup + FAPI_TRY(mss::exp::omi::train::setup_fw_boot_config(i_target, + MANUFACTURING_MODE_OFF, + NO_LOOPBACK_TESTING, + OPENCAPI_TRANSPORT_LAYER, + IMMEDIATE_DL_LAYER_BOOT, + FULL_BOOT_MODE, + LANE_MODE_8, + SERDES_25600MBPS, + l_data)); + + // Issues the command and checks for completion + // Note: the status check also checks for the OMI training completion, so after we run this command, we're good to go + FAPI_TRY(mss::exp::i2c::boot_config(i_target, l_data)); + + fapi_try_exit: + return fapi2::current_err; + } +} diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.H new file mode 100644 index 000000000..17bbe7fc9 --- /dev/null +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.H @@ -0,0 +1,53 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2018 */ +/* [+] 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 exp_omi_train.H +/// @brief Contains the explorer OMI train +/// +// *HWP HWP Owner: Andre Marin +// *HWP HWP Backup: Stephen Glancy +// *HWP Team: Memory +// *HWP Level: 3 +// *HWP Consumed by: Memory +#ifndef EXP_OMI_TRAIN_H_ +#define EXP_OMI_TRAIN_H_ + +#include + +typedef fapi2::ReturnCode (*exp_omi_train_FP_t) (const fapi2::Target&); + +extern "C" +{ + + /// + /// @brief Trains the OCMB link + /// @param[in] i_target the OCMB target to operate on + /// @return FAPI2_RC_SUCCESS iff ok + /// + fapi2::ReturnCode exp_omi_train(const fapi2::Target& i_target); +} + +#endif diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.mk b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.mk new file mode 100644 index 000000000..50a85754e --- /dev/null +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.mk @@ -0,0 +1,29 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_train.mk $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2018 +# [+] 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 00exp_common.mk + +PROCEDURE=exp_omi_train +$(eval $(call ADD_EXP_MEMORY_INCDIRS,$(PROCEDURE))) +$(call BUILD_PROCEDURE) diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/omi/exp_omi_utils.C b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/omi/exp_omi_utils.C index 4fc39619f..c98b3efec 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/omi/exp_omi_utils.C +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/omi/exp_omi_utils.C @@ -22,3 +22,73 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ + +/// +/// @file exp_omi_utils.C +/// @brief OMI utility functions +/// +// *HWP HWP Owner: Andre Marin +// *HWP HWP Backup: Stephen Glancy +// *HWP Team: Memory +// *HWP Level: 3 +// *HWP Consumed by: Memory + +#include +#include +#include + +namespace mss +{ +namespace exp +{ +namespace omi +{ +namespace train +{ + +/// +/// @brief Sets up the OMI training +/// @param[in] i_target target on which the code is operating +/// @param[in] i_manufacturing_mode manufacturing mode control +/// @param[in] i_loopback_testing loopback testing control +/// @param[in] i_transport_layer transport layer configuration +/// @param[in] i_dl_layer DL layer boot mode +/// @param[in] i_boot_mode true if step-by-step mode +/// @param[in] i_lane_mode lane mode configuration +/// @param[in] i_serdes serdes frequency +/// @param[out] o_data data for the FW_BOOT_CONFIG +/// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff get is OK +/// +fapi2::ReturnCode setup_fw_boot_config( const fapi2::Target& i_target, + const uint8_t i_manufacturing_mode, + const uint8_t i_loopback_testing, + const uint8_t i_transport_layer, + const uint8_t i_dl_layer, + const uint8_t i_boot_mode, + const uint8_t i_lane_mode, + const uint8_t i_serdes, + std::vector& o_data ) +{ + // Clears o_data, just in case + o_data.clear(); + o_data.assign(mss::exp::i2c::FW_BOOT_CONFIG_BYTE_LEN, 0); + + FAPI_TRY(mss::exp::i2c::boot_cfg::set_serdes_freq( i_target, o_data, i_serdes )); + FAPI_TRY(mss::exp::i2c::boot_cfg::set_lane_mode( i_target, o_data, i_lane_mode )); + FAPI_TRY(mss::exp::i2c::boot_cfg::set_boot_mode( i_target, o_data, i_boot_mode )); + FAPI_TRY(mss::exp::i2c::boot_cfg::set_dl_layer_boot_mode( i_target, o_data, i_dl_layer )); + FAPI_TRY(mss::exp::i2c::boot_cfg::set_transport_layer( i_target, o_data, i_transport_layer )); + FAPI_TRY(mss::exp::i2c::boot_cfg::set_loopback_test( i_target, o_data, i_loopback_testing )); + FAPI_TRY(mss::exp::i2c::boot_cfg::set_fw_mode( i_target, o_data, i_manufacturing_mode )); + +fapi_try_exit: + return fapi2::current_err; +} + +} // ns train + +} // ns omi + +} // ns exp + +} // ns mss -- cgit v1.2.1