Skip to content

Commit

Permalink
update HWP level metadata for nest, common files
Browse files Browse the repository at this point in the history
Change-Id: If6f5b8548bb7b64bb868497c6de39ae12306eb1b
Original-Change-Id: I451695b8ae1d8f7d5ed6d512631992dea98b5ee8
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/46967
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Benjamin Gass <bgass@us.ibm.com>
Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48380
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: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
jjmcgill authored and dcrowell77 committed Oct 16, 2017
1 parent 4b4eded commit c80b7f1
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 91 deletions.
113 changes: 50 additions & 63 deletions src/import/chips/p9/procedures/hwp/nest/p9_phb_hv_access.C
Expand Up @@ -22,93 +22,80 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
//-----------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
/// @file p9_phb_hv_access.C
/// @brief Perform read/write to PHB HV register space. (FAPI)
///
// *HWP HWP Owner: Ricardo Mata Jr. ricmata@us.ibm.com
// *HWP FW Owner: Thi Tran thi@us.ibm.com
// *HWP Team: Nest
// *HWP Level: 2
// *HWP Level: 3
// *HWP Consumed by: HB
//
//-----------------------------------------------------------------------------------
//------------------------------------------------------------------------------

//-----------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#include <p9_phb_hv_access.H>
#include <p9_phb_hv_utils.H>

extern "C"
{
//---------------------------------------------------------------------------------
// Function definitions
//---------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// name: p9_phb_hv_access
//------------------------------------------------------------------------------
// purpose:
// Performs read/write to PHB HV register space.
//
// parameters:
// 'i_target' is reference to phb target.
// 'i_address' is the PHB HV register offset between 0x0000 - 0x1FFF
// 'i_rnw' is flag to specify read (1) or write (0).
// 'i_size' is flag to specify 4B op (1) or 8B op (0).
// 'io_data' input data for writes or output data for reads.
//
// returns:
// FAPI_RC_SUCCESS (success)
//
// getscom/putscom fapi errors
// fapi error assigned from eCMD function failure
//
//------------------------------------------------------------------------------
fapi2::ReturnCode p9_phb_hv_access(const fapi2::Target<fapi2::TARGET_TYPE_PHB>& i_target, const uint32_t i_address,
bool const i_rnw, bool const i_size, uint64_t& io_data)
{
//------------------------------------------------------------------------------
// Function definitions
//------------------------------------------------------------------------------

uint8_t l_phb_id = 0;
fapi2::ReturnCode p9_phb_hv_access(
const fapi2::Target<fapi2::TARGET_TYPE_PHB>& i_target,
const uint32_t i_address,
bool const i_rnw,
bool const i_size,
uint64_t& io_data)
{

//Get the PHB id
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, i_target, l_phb_id));
uint8_t l_phb_id = 0;

FAPI_DBG("PHB%i: Start PHB HV read/write access", l_phb_id);
//Get the PHB id
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, i_target, l_phb_id));

//Check ETU state
FAPI_TRY(p9_phb_hv_check_etu_state(i_target), " Error from p9_phb_hv_check_etu_state");
FAPI_DBG("PHB%i: Start PHB HV read/write access", l_phb_id);

//Check arguments
FAPI_TRY(p9_phb_hv_check_args(i_target, i_address, i_size), " Error from p9_phb_hv_check_args");
//Check ETU state
FAPI_TRY(p9_phb_hv_check_etu_state(i_target),
"Error from p9_phb_hv_check_etu_state");

//Clear contents of PHB HV Indirect Address Register
FAPI_TRY(p9_phb_hv_clear(i_target), " Error from p9_phb_hv_clear");
//Check arguments
FAPI_TRY(p9_phb_hv_check_args(i_target, i_address, i_size),
"Error from p9_phb_hv_check_args");

//setup the PHB HV registers for the read/write
FAPI_TRY(p9_phb_hv_setup(i_target, i_address, i_size), " Error from p9_phb_hv_setup");
//Clear contents of PHB HV Indirect Address Register
FAPI_TRY(p9_phb_hv_clear(i_target),
"Error from p9_phb_hv_clear");

if (i_rnw)
{
//Setup PHB HV Indirect for read access
FAPI_TRY(p9_phb_hv_read(i_target, i_address, i_size, io_data), " Error from p9_phb_hv_read");
}
else
{
//Setup PHB HV Indirect for write access
FAPI_TRY(p9_phb_hv_write(i_target, i_address, i_size, io_data), " Error from p9_phb_hv_write");
}
//setup the PHB HV registers for the read/write
FAPI_TRY(p9_phb_hv_setup(i_target, i_address, i_size),
"Error from p9_phb_hv_setup");

//Clear contents of PHB HV Indirect Address Register
FAPI_TRY(p9_phb_hv_clear(i_target), " Error from p9_phb_hv_clear");
if (i_rnw)
{
//Setup PHB HV Indirect for read access
FAPI_TRY(p9_phb_hv_read(i_target, i_address, i_size, io_data),
"Error from p9_phb_hv_read");
}
else
{
//Setup PHB HV Indirect for write access
FAPI_TRY(p9_phb_hv_write(i_target, i_address, i_size, io_data),
"Error from p9_phb_hv_write");
}

//Clear contents of PHB HV Indirect Address Register
FAPI_TRY(p9_phb_hv_clear(i_target),
"Error from p9_phb_hv_clear");

fapi_try_exit:
FAPI_DBG("PHB%i: End PHB HV read/write Procedure", l_phb_id);
return fapi2::current_err;

}
fapi_try_exit:
FAPI_DBG("PHB%i: End PHB HV read/write Procedure", l_phb_id);
return fapi2::current_err;

} // extern "C
}
59 changes: 31 additions & 28 deletions src/import/chips/p9/procedures/hwp/nest/p9_phb_hv_access.H
Expand Up @@ -22,58 +22,61 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
//-----------------------------------------------------------------------------------
// *!
//------------------------------------------------------------------------------

///
/// @file p9_phb_hv_access.H
/// @brief Code to support PHB HV Indirect access procedures (FAPI)
///
/// @author ricmata@us.ibm.com
///

// *HWP HWP Owner: Ricardo Mata Jr. ricmata@us.ibm.com
// *HWP FW Owner: Thi Tran thi@us.ibm.com
// *HWP Team: Nest
// *HWP Level: 2
// *HWP Level: 3
// *HWP Consumed by: HB

#ifndef _P9_PHB_HV_ACCESS_H_
#define _P9_PHB_HV_ACCESS_H_


//-----------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#include <fapi2.H>

//------------------------------------------------------------------------------
// Constant definitions
//------------------------------------------------------------------------------

//-----------------------------------------------------------------------------------
// Structure definitions
//-----------------------------------------------------------------------------------
//------------------------------------------------------------------------------

//function pointer typedef definition for HWP call support
typedef fapi2::ReturnCode (*p9_phb_hv_access_FP_t) (const fapi2::Target<fapi2::TARGET_TYPE_PHB>&, const uint32_t,
bool const, bool const, uint64_t&);
typedef fapi2::ReturnCode (*p9_phb_hv_access_FP_t) (
const fapi2::Target<fapi2::TARGET_TYPE_PHB>&,
const uint32_t,
bool const,
bool const,
uint64_t&);

//-----------------------------------------------------------------------------------
// Constant definitions
//-----------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Function prototypes
//------------------------------------------------------------------------------

extern "C" {

//-----------------------------------------------------------------------------------
// Function prototypes
//-----------------------------------------------------------------------------------

/// @briefF perform read/write to PHB HV register space
/// @param[in] i_target => phb target
/// @param[in] i_address => PHB HV register offset between 0x0000 - 0x1FFF
/// @param[in] i_rnw => 1 for read, 0 for write.
/// @param[in] i_size => 1 for 8B op to access PHB HV. 0 for 4B op for config ops.
/// @param[in, out] io_data => input data for writes. output data for reads.
/// @brief perform read/write to PHB HV register space
/// @param[in] i_target PHB target
/// @param[in] i_address PHB HV register offset between 0x0000 - 0x1FFF
/// @param[in] i_rnw 1 for read, 0 for write
/// @param[in] i_size 1 for 8B op to access PHB HV. 0 for 4B op for config ops
/// @param[inout] io_data Input data for writes / output data for reads
///
/// @return FAPI_RC_SUCCESS if the read/write completes successfully.
fapi2::ReturnCode p9_phb_hv_access(const fapi2::Target<fapi2::TARGET_TYPE_PHB>& i_target, const uint32_t i_address,
bool const i_rnw, bool const i_size, uint64_t& io_data);
fapi2::ReturnCode p9_phb_hv_access(
const fapi2::Target<fapi2::TARGET_TYPE_PHB>& i_target,
const uint32_t i_address,
bool const i_rnw,
bool const i_size,
uint64_t& io_data);

} // extern "C"

Expand Down

0 comments on commit c80b7f1

Please sign in to comment.