Skip to content

Commit

Permalink
Adds explorer OMI training code
Browse files Browse the repository at this point in the history
Change-Id: Ic08c41538ae95b08ce05aa1a2413d45318f3e4ee
Original-Change-Id: Ic4fcd226eea7478ffff6cacb830f8e1e83e6f247
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/64919
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: RYAN P. KING <rpking@us.ibm.com>
Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/71772
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
  • Loading branch information
sglancy6 authored and crgeddes committed Feb 13, 2019
1 parent 73bc592 commit 8212d72
Show file tree
Hide file tree
Showing 4 changed files with 232 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 <aamarin@us.ibm.com>
// *HWP HWP Backup: Stephen Glancy <sglancy@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 3
// *HWP Consumed by: Memory

#include <fapi2.H>
#include <generic/memory/lib/utils/c_str.H>
#include <lib/omi/exp_omi_utils.H>
#include <lib/i2c/exp_i2c.H>
#include <exp_omi_train.H>

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<fapi2::TARGET_TYPE_OCMB_CHIP>& 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<uint8_t> 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;
}
}
Original file line number Diff line number Diff line change
@@ -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 <aamarin@us.ibm.com>
// *HWP HWP Backup: Stephen Glancy <sglancy@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 3
// *HWP Consumed by: Memory
#ifndef EXP_OMI_TRAIN_H_
#define EXP_OMI_TRAIN_H_

#include <fapi2.H>

typedef fapi2::ReturnCode (*exp_omi_train_FP_t) (const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>&);

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<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target);
}

#endif
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aamarin@us.ibm.com>
// *HWP HWP Backup: Stephen Glancy <sglancy@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 3
// *HWP Consumed by: Memory

#include <lib/omi/exp_omi_utils.H>
#include <lib/shared/exp_consts.H>
#include <lib/i2c/exp_i2c_fields.H>

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<fapi2::TARGET_TYPE_OCMB_CHIP>& 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<uint8_t>& 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

0 comments on commit 8212d72

Please sign in to comment.