From edb753be279189a97014b2d685370b777e340c7c Mon Sep 17 00:00:00 2001 From: Shakeeb Date: Mon, 24 Oct 2016 06:11:34 -0500 Subject: L1 - trace array on SBE Also adapt existing p9_proc_tracearray to share trace array defs with the new procedure. RTC:128332 Change-Id: I319ae7f33ad56eccb5821db74e52aa2d79af415d Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31703 Tested-by: Jenkins Server Reviewed-by: Joachim Fenkes Reviewed-by: Sachin Gupta Reviewed-by: PARVATHI RACHAKONDA Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/35790 Tested-by: FSP CI Jenkins --- .../p9/procedures/hwp/perv/p9_sbe_tracearray.H | 150 +++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 src/import/chips/p9/procedures/hwp/perv/p9_sbe_tracearray.H (limited to 'src/import/chips/p9/procedures/hwp/perv/p9_sbe_tracearray.H') diff --git a/src/import/chips/p9/procedures/hwp/perv/p9_sbe_tracearray.H b/src/import/chips/p9/procedures/hwp/perv/p9_sbe_tracearray.H new file mode 100644 index 00000000..21e4dbb5 --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/perv/p9_sbe_tracearray.H @@ -0,0 +1,150 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/perv/p9_sbe_tracearray.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* */ +/* */ +/* 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 p9_sbe_tracearray.H +/// +/// @brief Collect contents of specified trace array via SCOM. +/// +/// Collects contents of specified trace array via SCOM. Optionally +/// manages chiplet domain trace engine state (start/stop/reset) around +/// trace array data collection. Trace array data can be collected only +/// when its controlling chiplet trace engine is stopped. +/// +/// Request number of Trace array entries will be packed into data buffer from +/// oldest->youngest entry. +/// +/// Calling code is expected to pass the proper target type based on the +/// desired trace resource; a convenience function is provided to find out +/// the expected target type for a given trace resource. +//------------------------------------------------------------------------------ +// *HWP HW Owner : Joachim Fenkes +// *HWP HW Backup Owner : Joe McGill +// *HWP FW Owner : Shakeeb Pasha +// *HWP Team : Perv +// *HWP Level : 1 +// *HWP Consumed by : SBE +//------------------------------------------------------------------------------ + +#ifndef _P9_SBE_TRACEARRAY_H +#define _P9_SBE_TRACEARRAY_H +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#include +#include "p9_tracearray_defs.H" + +// structure to represent HWP arguments +struct proc_gettracearray_args +{ + p9_tracearray_bus_id trace_bus; ///< The trace bus whose associated trace array should be dumped + bool stop_pre_dump; ///< Stop the trace array before starting the dump + bool ignore_mux_setting; ///< Do not fail if the primary trace mux is set to a different bus + bool collect_dump; ///< Do dump the trace array; useful if you just want to start/stop + bool reset_post_dump; ///< Reset the debug logic after dumping + bool restart_post_dump; ///< Start the trace array after dumping +}; + +static const fapi2::TargetType P9_SBE_TRACEARRAY_TARGET_TYPES = + fapi2::TARGET_TYPE_PROC_CHIP | + fapi2::TARGET_TYPE_EX | + fapi2::TARGET_TYPE_CORE; + +//function pointer typedef definition for HWP call support +typedef fapi2::ReturnCode (*p9_sbe_tracearray_FP_t) ( + const fapi2::Target& i_target, + const proc_gettracearray_args& i_args, + uint8_t* o_ta_data, + const uint32_t i_num_rows +); + +extern "C" { + /** + * @brief Return the target type needed to access a given trace array + * + * @param ta_id The trace array / trace bus ID requested. + * + * @return The type of target to hand to p9_sbe_tracearray to clearly + * identify the array instance. + */ + static inline fapi2::TargetType proc_gettracearray_target_type(p9_tracearray_bus_id i_trace_bus) + { + /* On SBE there is no support for MCBIST and OBUS fapi targets. + * But since the usage related to these targets in p9_sbe_tracearray + * is only for SCOMs with fully qualified adresses, PROC + * target is used for MCBIST and OBUS as well */ + if (i_trace_bus <= _PROC_TB_LAST_MC_TARGET) + { + return fapi2::TARGET_TYPE_PROC_CHIP; + } + else if (i_trace_bus <= _PROC_TB_LAST_EX_TARGET) + { + return fapi2::TARGET_TYPE_EX; + } + else + { + return fapi2::TARGET_TYPE_CORE; + } + } + + + + /* TODO via RTC:164528 - Look at optimization to improve performance + * @brief Retrieve trace array data, based on the number of + * rows requested, from selected trace array via SCOM. + * Optionally performing trace stop (prior to dump) and/or + * trace restart, reset (after dump). + * If dump is requested along with other control flags, pre-dump control + * would take effect before reading row 0 and post-dump control would + * take effect after reading last row. + * + * @param i_target Chip or chiplet target. The necessary target type can be + * queried through proc_gettracearray_target_type(). + * @param i_args Argument structure with additional parameters + * @param o_ta_data Trace array data. Will contain requested number of trace + * rows from the array concatenated, + * starting with the oldest trace entry after the previous + * dump call and ending with the newest + * @param i_num_rows Number of rows of the tracearray to read. + * By default P9_TRACEARRAY_NUM_ROWS are read + * + * @return FAPI2_RC_SUCCESS + * if trace array dump sequence completes successfully, + * RC_PROC_GETTRACEARRAY_INVALID_BUS + * if an invalid trace bus ID has been requested + * RC_PROC_GETTRACEARRAY_CORE_NOT_DUMPABLE + * if a core trace array has been requested but the chip's core + * is not dumpable via SCOM -> use fastarray instead + * RC_PROC_GETTRACEARRAY_TRACE_MUX_INCORRECT + * if the primary trace mux is not set up to trace the requested bus, + * else FAPI getscom/putscom return code for failing operation + */ + fapi2::ReturnCode p9_sbe_tracearray( + const fapi2::Target& i_target, + const proc_gettracearray_args& i_args, + uint64_t* o_ta_data, + const uint32_t i_num_rows = P9_TRACEARRAY_NUM_ROWS + ); +} // extern "C" +#endif //_P9_SBE_TRACEARRAY_H -- cgit v1.2.1