diff options
24 files changed, 1277 insertions, 577 deletions
diff --git a/hwp/lib/libcommonerrors.mk b/hwp/lib/libcommonerrors.mk index a344d6b1..7bebb4ce 100644 --- a/hwp/lib/libcommonerrors.mk +++ b/hwp/lib/libcommonerrors.mk @@ -17,4 +17,4 @@ LIB_CURR_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) # This variable name must not change ERROR_XML_FILES += $(LIB_CURR_DIR)/p9_avsbus_lib_errors.xml -#ERROR_XML_FILES += $(LIB_CURR_DIR)/p9_common_pro_epi_log_errors.xml +ERROR_XML_FILES += $(LIB_CURR_DIR)/p9_poweronoff_errors.xml diff --git a/hwpf/plat/include/fapi2.H b/hwpf/plat/include/fapi2.H index 178860fc..de2295b4 100644 --- a/hwpf/plat/include/fapi2.H +++ b/hwpf/plat/include/fapi2.H @@ -35,7 +35,7 @@ #include <plat_target_utils.H> -#include <hwp_executor.H> +#include <fapi2_hwp_executor.H> // Block of headers not currently in fapi2 #ifdef FAPI2_MISSING_HEADERS diff --git a/hwpf/plat/include/fapi2_target.H b/hwpf/plat/include/fapi2_target.H index 47b6d55a..32b68618 100644 --- a/hwpf/plat/include/fapi2_target.H +++ b/hwpf/plat/include/fapi2_target.H @@ -94,7 +94,7 @@ namespace fapi2 /// they might need. value( K | V ), for example /// Target(V Value); - + // Target(V Value): // iv_handle(Value) // {} @@ -176,7 +176,7 @@ namespace fapi2 { // return ( (K == TARGET_TYPE_PROC_CHIP) || // (K == TARGET_TYPE_MEMBUF_CHIP) ); - + return ( (K == TARGET_TYPE_PROC_CHIP) ); } @@ -249,44 +249,44 @@ namespace fapi2 } #ifdef __PPE__ - - /// - /// @brief Get the target present setting - /// @return Bool whether present - /// - inline bool getPresent(void) const - { - return (this->iv_handle.fields.present ? true : false); - } - - /// - /// @brief Get the target functional setting - /// @return Bool whether functional - /// - inline bool getFunctional(void) const - { - return (this->iv_handle.fields.functional ? true : false); - } - - /// - /// @brief Set the target present setting - /// @return Bool whether present - /// - inline void setPresent(void) const - { - this->iv_handle.fields.present = 1; - return; - } - - /// - /// @brief Set the target functional setting - /// @return Bool whether functional - /// - inline void setFunctional(void) const - { - this->iv_handle.fields.functional = 1; - return; - } + + /// + /// @brief Get the target present setting + /// @return Bool whether present + /// + inline bool getPresent(void) const + { + return (this->iv_handle.fields.present ? true : false); + } + + /// + /// @brief Get the target functional setting + /// @return Bool whether functional + /// + inline bool getFunctional(void) const + { + return (this->iv_handle.fields.functional ? true : false); + } + + /// + /// @brief Set the target present setting + /// @return Bool whether present + /// + inline void setPresent(void) + { + this->iv_handle.fields.present = 1; + return; + } + + /// + /// @brief Set the target functional setting + /// @return Bool whether functional + /// + inline void setFunctional(void) + { + this->iv_handle.fields.functional = 1; + return; + } /// Need to optimize PPE Target resoulution in a cheap manner @@ -310,7 +310,7 @@ namespace fapi2 { return static_cast<uint32_t>(this->iv_handle.fields.type_target_num); } - + /// /// @brief Get target type directly from the handle /// @return Overlay as a type V @@ -319,7 +319,7 @@ namespace fapi2 { return static_cast<TargetTypes_t>(this->iv_handle.fields.type); } - + /// /// @brief Get chiplet number from the handle /// @return ChipletNumber_t Chiplet Number @@ -328,7 +328,7 @@ namespace fapi2 { return static_cast<ChipletNumber_t>(this->iv_handle.fields.chiplet_num); } - + #endif @@ -362,7 +362,7 @@ namespace fapi2 // iv_handle(V i_value = 0):value(i_value) {} } iv_handle; }; - + // EX threads map to CORE threads: // t0 / t2 / t4 / t6 fused = t0 / t1 / t2 / t3 normal (c0) // t1 / t3 / t5 / t7 fused = t0 / t1 / t2 / t3 normal (c1) diff --git a/hwpf/plat/include/hwp_executor.H b/hwpf/plat/include/hwp_executor.H index e69de29b..5a451081 100644 --- a/hwpf/plat/include/hwp_executor.H +++ b/hwpf/plat/include/hwp_executor.H @@ -0,0 +1,59 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// fipsrefactordoc src/hwpf/plat/fapi2PlatHwpExecutor.H 1.1 +// +// IBM CONFIDENTIAL +// +// OBJECT CODE ONLY SOURCE MATERIALS +// +// COPYRIGHT International Business Machines Corp. 2011 +// All Rights Reserved +// +// The source code for this program is not published or otherwise +// divested of its trade secrets, irrespective of what has been +// deposited with the U.S. Copyright Office. +// +// IBM_PROLOG_END_TAG +/** + * @file fapi2PlatHwpExecutor.H + * + * @brief Defines the FAPI HWP Executor Macro. + * + * The HWP Executor macro is called when a PLAT invoker function or a HWP wants + * to execute a HWP. Each platform can modify the macro to do any platform + * specific work to execute the HWP (e.g. dlopening a shared library) + */ + +#ifndef FAPI2PLATHWPEXECUTOR_H_ +#define FAPI2PLATHWPEXECUTOR_H_ + +/** + * @brief HWP Executor macro + * + * By default, this macro just calls the HWP directly. If this cannot be done + * then the platform needs to modify + */ + +#include <return_code.H> +#include <target.H> +#include <string> + + + +// Macro to execute an arbitrary function with an arbitray number of arguments. The +// function is in a shared lib that must be dlopened. All that is required is that +// there is a typedef for the function pointer available that is called <FUNC>_FP_t +// i.e. if the function is called foo, then the typedef is called foo_FP_t +#define FAPI_PLAT_EXEC_HWP(RC, FUNC, _args_...) \ +{\ + RC = FUNC(_args_); \ +} + +#define FAPI_PLAT_EXEC_HWP_LAMBDA(FUNC, _args_...) \ +[&]()->fapi2::ReturnCode \ +{\ + FUNC(_args_); \ +}() + +#endif // FAPI2PLATHWPEXECUTOR_H_ diff --git a/hwpf/plat/include/plat_attributes.H b/hwpf/plat/include/plat_attributes.H index 2a55b221..894d516d 100644 --- a/hwpf/plat/include/plat_attributes.H +++ b/hwpf/plat/include/plat_attributes.H @@ -32,5 +32,6 @@ #include <fapi2AttributeService.H> #include <fapi2AttributeIds.H> // Generated file +//#include <plat_target_pg_attributes.H> #endif // __PLAT_ATTTRIBUTE_H__ diff --git a/hwpf/plat/include/plat_target_parms.H b/hwpf/plat/include/plat_target_parms.H index bbe4b8ba..d495241a 100644 --- a/hwpf/plat/include/plat_target_parms.H +++ b/hwpf/plat/include/plat_target_parms.H @@ -36,19 +36,22 @@ CONST_UINT32_T(CHIP_TARGET_OFFSET, 0); CONST_UINT32_T(CHIP_TARGET_COUNT , 1); - +// Pervasive Targets (note; these include the MCS targets as well) CONST_UINT32_T(PERV_TARGET_OFFSET, CHIP_TARGET_OFFSET + CHIP_TARGET_COUNT); CONST_UINT32_T(PERV_CHIPLET_OFFSET, 0x1); CONST_UINT32_T(PERV_TARGET_COUNT, 15); +// Cache Targets CONST_UINT32_T(EQ_TARGET_OFFSET, PERV_TARGET_OFFSET + PERV_TARGET_COUNT); CONST_UINT32_T(EQ_CHIPLET_OFFSET, 0x10); CONST_UINT32_T(EQ_TARGET_COUNT, 6); +// Core Targets CONST_UINT32_T(CORE_TARGET_OFFSET, EQ_TARGET_OFFSET + EQ_TARGET_COUNT); CONST_UINT32_T(CORE_CHIPLET_OFFSET, 0x20); CONST_UINT32_T(CORE_TARGET_COUNT, 24); +// MCS Targets (note: these are phyically Pervastive targets) CONST_UINT32_T(MCS_TARGET_OFFSET, CORE_TARGET_OFFSET + CORE_TARGET_COUNT); CONST_UINT32_T(MCS_CHIPLET_OFFSET, 0x7); CONST_UINT32_T(MCS_TARGET_COUNT, 2); @@ -57,9 +60,6 @@ CONST_UINT32_T(EX_TARGET_OFFSET, MCS_TARGET_OFFSET + MCS_TARGET_COUNT); CONST_UINT32_T(EX_CHIPLET_OFFSET, 0x10); CONST_UINT32_T(EX_TARGET_COUNT, 12); - -//CONST_UINT32_T(TARGET_COUNT, EX_TARGET_OFFSET + EX_TARGET_COUNT); - CONST_UINT32_T(TARGET_COUNT, CHIP_TARGET_COUNT + PERV_TARGET_COUNT + EQ_TARGET_COUNT + diff --git a/hwpf/plat/include/plat_target_pg_attributes.H b/hwpf/plat/include/plat_target_pg_attributes.H new file mode 100644 index 00000000..e27a1784 --- /dev/null +++ b/hwpf/plat/include/plat_target_pg_attributes.H @@ -0,0 +1,97 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] 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 plat_target_pg_attribute.H + * @brief Definitions for fapi2 PPE targets' partial good attribute mapping + */ + +#ifndef __FAPI2_PPE_TARGET_PG_ATTR__ +#define __FAPI2_PPE_TARGET_PG_ATTR__ + + +typedef struct chiplet_pg_entry_t +{ + // char[16] pg_attribute; + uint32_t pg_attribute; + uint8_t target_type; + uint16_t relative_target_num; +} chiplet_pg_entry_t; + +const chiplet_pg_entry_t CHIPLET_PG_ARRAY[] = +{ + // Pervasive Chiplets + { fapi2::ATTR_PG_PRV , fapi2::TARGET_TYPE_PERV, 0x01 }, + { fapi2::ATTR_PG_N0 , fapi2::TARGET_TYPE_PERV, 0x02 }, + { fapi2::ATTR_PG_N1 , fapi2::TARGET_TYPE_PERV, 0x03 }, + { fapi2::ATTR_PG_N2 , fapi2::TARGET_TYPE_PERV, 0x04 }, + { fapi2::ATTR_PG_N3 , fapi2::TARGET_TYPE_PERV, 0x05 }, + { fapi2::ATTR_PG_XB , fapi2::TARGET_TYPE_PERV, 0x06 }, + { fapi2::ATTR_PG_MC01, fapi2::TARGET_TYPE_PERV, 0x07 }, + { fapi2::ATTR_PG_MC23, fapi2::TARGET_TYPE_PERV, 0x08 }, + { fapi2::ATTR_PG_OB0 , fapi2::TARGET_TYPE_PERV, 0x09 }, + { fapi2::ATTR_PG_OB1 , fapi2::TARGET_TYPE_PERV, 0x0A }, + { fapi2::ATTR_PG_OB2 , fapi2::TARGET_TYPE_PERV, 0x0B }, + { fapi2::ATTR_PG_OB3 , fapi2::TARGET_TYPE_PERV, 0x0C }, + { fapi2::ATTR_PG_PCI0, fapi2::TARGET_TYPE_PERV, 0x0D }, + { fapi2::ATTR_PG_PCI1, fapi2::TARGET_TYPE_PERV, 0x0E }, + { fapi2::ATTR_PG_PCI2, fapi2::TARGET_TYPE_PERV, 0x0F }, + // EQ Chiplets + { fapi2::ATTR_PG_EQ0 , fapi2::TARGET_TYPE_EQ, 0x00 }, + { fapi2::ATTR_PG_EQ1 , fapi2::TARGET_TYPE_EQ, 0x01 }, + { fapi2::ATTR_PG_EQ2 , fapi2::TARGET_TYPE_EQ, 0x02 }, + { fapi2::ATTR_PG_EQ3 , fapi2::TARGET_TYPE_EQ, 0x03 }, + { fapi2::ATTR_PG_EQ4 , fapi2::TARGET_TYPE_EQ, 0x04 }, + { fapi2::ATTR_PG_EQ5 , fapi2::TARGET_TYPE_EQ, 0x05 }, + // Core Chiplets + { fapi2::ATTR_PG_EC00, fapi2::TARGET_TYPE_CORE, 0x00 }, + { fapi2::ATTR_PG_EC01, fapi2::TARGET_TYPE_CORE, 0x01 }, + { fapi2::ATTR_PG_EC02, fapi2::TARGET_TYPE_CORE, 0x02 }, + { fapi2::ATTR_PG_EC03, fapi2::TARGET_TYPE_CORE, 0x03 }, + { fapi2::ATTR_PG_EC04, fapi2::TARGET_TYPE_CORE, 0x04 }, + { fapi2::ATTR_PG_EC05, fapi2::TARGET_TYPE_CORE, 0x05 }, + { fapi2::ATTR_PG_EC06, fapi2::TARGET_TYPE_CORE, 0x06 }, + { fapi2::ATTR_PG_EC07, fapi2::TARGET_TYPE_CORE, 0x07 }, + { fapi2::ATTR_PG_EC08, fapi2::TARGET_TYPE_CORE, 0x08 }, + { fapi2::ATTR_PG_EC09, fapi2::TARGET_TYPE_CORE, 0x09 }, + { fapi2::ATTR_PG_EC10, fapi2::TARGET_TYPE_CORE, 0x0A }, + { fapi2::ATTR_PG_EC11, fapi2::TARGET_TYPE_CORE, 0x0B }, + { fapi2::ATTR_PG_EC12, fapi2::TARGET_TYPE_CORE, 0x0C }, + { fapi2::ATTR_PG_EC13, fapi2::TARGET_TYPE_CORE, 0x0D }, + { fapi2::ATTR_PG_EC14, fapi2::TARGET_TYPE_CORE, 0x0E }, + { fapi2::ATTR_PG_EC15, fapi2::TARGET_TYPE_CORE, 0x0F }, + { fapi2::ATTR_PG_EC16, fapi2::TARGET_TYPE_CORE, 0x10 }, + { fapi2::ATTR_PG_EC17, fapi2::TARGET_TYPE_CORE, 0x11 }, + { fapi2::ATTR_PG_EC18, fapi2::TARGET_TYPE_CORE, 0x12 }, + { fapi2::ATTR_PG_EC19, fapi2::TARGET_TYPE_CORE, 0x13 }, + { fapi2::ATTR_PG_EC20, fapi2::TARGET_TYPE_CORE, 0x14 }, + { fapi2::ATTR_PG_EC21, fapi2::TARGET_TYPE_CORE, 0x15 }, + { fapi2::ATTR_PG_EC22, fapi2::TARGET_TYPE_CORE, 0x16 }, + { fapi2::ATTR_PG_EC23, fapi2::TARGET_TYPE_CORE, 0x17 } +}; + +uint32_t CHIPLET_PG_ARRAY_ENTRIES = sizeof(CHIPLET_PG_ARRAY) / + sizeof(chiplet_pg_entry_t); + +#endif // __FAPI2_PPE_TARGET_PG_ATTR__ diff --git a/hwpf/plat/include/target.H b/hwpf/plat/include/target.H index cce4e86e..0c40642b 100644 --- a/hwpf/plat/include/target.H +++ b/hwpf/plat/include/target.H @@ -77,13 +77,6 @@ namespace fapi2 if(K & TARGET_TYPE_CORE) { - /* - if (Value > CORE_CHIPLET_COUNT) - { - PK_TRACE("Chiplet number is greater than CORE_CHIPLET_COUNT"); - return -1; - } - */ this->iv_handle.fields.chiplet_num = Value + CORE_CHIPLET_OFFSET; this->iv_handle.fields.type = TARGET_TYPE_CORE | TARGET_TYPE_PERV; this->iv_handle.fields.type_target_num = Value; @@ -112,67 +105,11 @@ namespace fapi2 this->iv_handle.fields.type_target_num = Value; } -// if(K & TARGET_TYPE_EQ_MC_WRITE) -// { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | -// ((MC_WRITE << 3) | (Value & 0x07))) & -// BITS(57,7)); -// this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_WRITE; -// } -// -// if(K & TARGET_TYPE_EQ_MC_READOR) -// { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | -// ((MC_READ_OR << 3) | (Value & 0x07))) & -// BITS(57,7)); -// this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_READOR; -// } -// -// if(K & TARGET_TYPE_EQ_MC_READAND) -// { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | -// ((MC_READ_AND << 3) | (Value & 0x07))) & -// BITS(57,7)); -// this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_READAND; -// } -// -// if(K & TARGET_TYPE_CORE_MC_WRITE) -// { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | -// ((MC_WRITE << 3) | (Value & 0x07))) & -// BITS(57,7)); -// this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_WRITE; -// } -// -// if(K & TARGET_TYPE_CORE_MC_READOR) -// { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | -// ((MC_READ_OR << 3) | (Value & 0x07))) & -// BITS(57,7)); -// this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_READOR; -// } -// -// if(K & TARGET_TYPE_CORE_MC_READAND) -// { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | -// ((MC_READ_AND << 3) | (Value & 0x07))) & -// BITS(57,7)); -// this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_READAND; -// } - if(K == TARGET_TYPE_ALL) { this->iv_handle.fields.chiplet_num = Value; this->iv_handle.fields.type = TARGET_TYPE_ALL; } - this->iv_handle.fields.present = 1; - this->iv_handle.fields.functional = 1; this->iv_handle.fields.address_overlay = (this->iv_handle.fields.chiplet_num << 24); @@ -235,7 +172,8 @@ namespace fapi2 /// /// @brief Get this target's children - /// @tparam T The type of the parent + /// @tparam K The type of the parent + /// @tparam T The type of child /// @param[in] i_state The desired TargetState of the children /// @return std::vector<Target<T> > a vector of present/functional /// children diff --git a/hwpf/plat/src/target.C b/hwpf/plat/src/target.C index 4b422f3c..bceb2e33 100644 --- a/hwpf/plat/src/target.C +++ b/hwpf/plat/src/target.C @@ -23,14 +23,18 @@ /* */ /* IBM_PROLOG_END_TAG */ -#include <target.H> + +#include <fapi2.H> #include <new> #include <utility> // For move +#include <plat_target_pg_attributes.H> + // Global Vector containing ALL targets. This structure is referenced by // fapi2::getChildren to produce the resultant returned vector from that // call. std::vector<fapi2::plat_target_handle_t> G_vec_targets; + namespace fapi2 { @@ -38,11 +42,257 @@ namespace fapi2 ReturnCode current_err; #endif + + // Not a fan of the switch technique; I would prefer an array lookup + // but the attritute lookup is done via compile time macros that are + // resolved to attribute Ids (hashes). + fapi2::ReturnCode plat_PervPGTargets(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target, + const fapi2::TargetTypes_t i_chiplet_num, + bool & o_present) + { + + o_present = false; + uint16_t attr_value = 0; + switch (i_chiplet_num) + { + case 0x00: // Nop + break; + case 0x01: + FAPI_ATTR_GET(ATTR_PG_PRV, i_target, *(&attr_value)); + FAPI_DBG("ATTR_PG_PRV value = %x", attr_value); + break; + case 0x02: + FAPI_ATTR_GET(ATTR_PG_N0, i_target, attr_value); + FAPI_DBG("ATTR_PG_N0 value = %x", attr_value); + break; + case 0x03: + FAPI_ATTR_GET(ATTR_PG_N1, i_target, attr_value); + FAPI_DBG("ATTR_PG_N1 value = %x", attr_value); + break; + case 0x04: + FAPI_ATTR_GET(ATTR_PG_N2, i_target, attr_value); + FAPI_DBG("ATTR_PG_N2 value = %x", attr_value); + break; + case 0x05: + FAPI_ATTR_GET(ATTR_PG_N3, i_target, attr_value); + FAPI_DBG("ATTR_PG_N0 value = %x", attr_value); + break; + case 0x06: + FAPI_ATTR_GET(ATTR_PG_XB, i_target, attr_value); + FAPI_DBG("ATTR_PG_XB value = %x", attr_value); + break; + case 0x07: + FAPI_ATTR_GET(ATTR_PG_MC01, i_target, attr_value); + FAPI_DBG("ATTR_PG_MC01 value = %x", attr_value); + break; + case 0x08: + FAPI_ATTR_GET(ATTR_PG_MC23, i_target, attr_value); + FAPI_DBG("ATTR_PG_MC23 value = %x", attr_value); + break; + case 0x09: + FAPI_ATTR_GET(ATTR_PG_OB0, i_target, attr_value); + FAPI_DBG("ATTR_PG_OB0 value = %x", attr_value); + break; + case 0x0A: + FAPI_ATTR_GET(ATTR_PG_OB1, i_target, attr_value); + FAPI_DBG("ATTR_PG_OB1 value = %x", attr_value); + break; + case 0x0B: + FAPI_ATTR_GET(ATTR_PG_OB2, i_target, attr_value); + FAPI_DBG("ATTR_PG_OB2 value = %x", attr_value); + break; + case 0x0C: + FAPI_ATTR_GET(ATTR_PG_OB3, i_target, attr_value); + FAPI_DBG("ATTR_PG_OB3 value = %x", attr_value); + break; + case 0x0D: + FAPI_ATTR_GET(ATTR_PG_PCI0, i_target, attr_value); + FAPI_DBG("ATTR_PG_PCI0 value = %x", attr_value); + break; + case 0x0E: + FAPI_ATTR_GET(ATTR_PG_PCI1, i_target, attr_value); + FAPI_DBG("ATTR_PG_PCI1 value = %x", attr_value); + break; + case 0x0F: + FAPI_ATTR_GET(ATTR_PG_PCI2, i_target, attr_value); + FAPI_DBG("ATTR_PG_PCI2 value = %x", attr_value); + break; + case 0x10: + FAPI_ATTR_GET(ATTR_PG_EQ0, i_target, attr_value); + FAPI_DBG("ATTR_PG_EQ0 value = %x", attr_value); + break; + case 0x11: + FAPI_ATTR_GET(ATTR_PG_EQ1, i_target, attr_value); + FAPI_DBG("ATTR_PG_EQ1 value = %x", attr_value); + break; + case 0x12: + FAPI_ATTR_GET(ATTR_PG_EQ2, i_target, attr_value); + FAPI_DBG("ATTR_PG_EQ2 value = %x", attr_value); + break; + case 0x13: + FAPI_ATTR_GET(ATTR_PG_EQ3, i_target, attr_value); + FAPI_DBG("ATTR_PG_EQ3 value = %x", attr_value); + break; + case 0x14: + FAPI_ATTR_GET(ATTR_PG_EQ4, i_target, attr_value); + FAPI_DBG("ATTR_PG_EQ4 value = %x", attr_value); + break; + case 0x15: + FAPI_ATTR_GET(ATTR_PG_EQ5, i_target, attr_value); + FAPI_DBG("ATTR_PG_EQ5 value = %x", attr_value); + break; + case 0x20: + FAPI_ATTR_GET(ATTR_PG_EC00, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC00 value = %x", attr_value); + break; + case 0x21: + FAPI_ATTR_GET(ATTR_PG_EC01, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC01 value = %x", attr_value); + break; + case 0x22: + FAPI_ATTR_GET(ATTR_PG_EC02, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC02 value = %x", attr_value); + break; + case 0x23: + FAPI_ATTR_GET(ATTR_PG_EC03, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC03 value = %x", attr_value); + break; + case 0x24: + FAPI_ATTR_GET(ATTR_PG_EC04, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC04 value = %x", attr_value); + break; + case 0x25: + FAPI_ATTR_GET(ATTR_PG_EC05, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC05 value = %x", attr_value); + break; + case 0x26: + FAPI_ATTR_GET(ATTR_PG_EC06, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC06 value = %x", attr_value); + break; + case 0x27: + FAPI_ATTR_GET(ATTR_PG_EC07, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC07 value = %x", attr_value); + break; + case 0x28: + FAPI_ATTR_GET(ATTR_PG_EC08, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC08 value = %x", attr_value); + break; + case 0x29: + FAPI_ATTR_GET(ATTR_PG_EC09, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC09 value = %x", attr_value); + break; + case 0x2A: + FAPI_ATTR_GET(ATTR_PG_EC10, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC10 value = %x", attr_value); + break; + case 0x2B: + FAPI_ATTR_GET(ATTR_PG_EC11, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC11 value = %x", attr_value); + break; + case 0x2C: + FAPI_ATTR_GET(ATTR_PG_EC12, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC12 value = %x", attr_value); + break; + case 0x2D: + FAPI_ATTR_GET(ATTR_PG_EC13, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC13 value = %x", attr_value); + break; + case 0x2E: + FAPI_ATTR_GET(ATTR_PG_EC14, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC14 value = %x", attr_value); + break; + case 0x2F: + FAPI_ATTR_GET(ATTR_PG_EC15, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC15 value = %x", attr_value); + break; + case 0x30: + FAPI_ATTR_GET(ATTR_PG_EC16, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC16 value = %x", attr_value); + break; + case 0x31: + FAPI_ATTR_GET(ATTR_PG_EC17, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC17 value = %x", attr_value); + break; + case 0x32: + FAPI_ATTR_GET(ATTR_PG_EC18, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC18 value = %x", attr_value); + break; + case 0x33: + FAPI_ATTR_GET(ATTR_PG_EC19, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC19 value = %x", attr_value); + break; + case 0x34: + FAPI_ATTR_GET(ATTR_PG_EC20, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC20 value = %x", attr_value); + break; + case 0x35: + FAPI_ATTR_GET(ATTR_PG_EC21, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC21 value = %x", attr_value); + break; + case 0x36: + FAPI_ATTR_GET(ATTR_PG_EC22, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC22 value = %x", attr_value); + break; + case 0x37: + FAPI_ATTR_GET(ATTR_PG_EC23, i_target, attr_value); + FAPI_DBG("ATTR_PG_EC23 value = %x", attr_value); + break; + default: + FAPI_ERR("PervPGTargets: invalid chiplet number %u", i_chiplet_num); + } + + if (attr_value & 0xC000) + { + o_present = true; + } + + return fapi2::FAPI2_RC_SUCCESS; + + } + + /// @brief Function to determine if pervsaive target within a chip is + /// present and, thus, considered functional per PG attributes + template<fapi2::TargetType K> + fapi2::ReturnCode + plat_TargetPresent( fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_chip_target, + fapi2::Target<K> & i_chiplet_target, + bool & b_present) + { + + // Find the PERV target number in the partial good initialization + // array + fapi2::ChipletNumber_t chiplet_number = i_chiplet_target.getChipletNumber(); + + FAPI_TRY(plat_PervPGTargets(i_chip_target, chiplet_number, b_present)); + + if (b_present) + { + i_chiplet_target.setPresent(); + i_chiplet_target.setFunctional(); + } + else + { + FAPI_DBG("Perv target NOT present (nor functional): chiplet_number = %d", + chiplet_number); + } + + FAPI_DBG("Target present = %u, Target functional = %u", + i_chiplet_target.getPresent(), + i_chiplet_target.getFunctional()); + +fapi_try_exit: + return fapi2::current_err; + } + + /// @brief Function to initialize the G_targets vector based on partial good /// attributes /// this will move to plat_target.H formally fapi2::ReturnCode plat_TargetsInit() { + bool b_present = false; + uint32_t c = 0; + // This is workaround. Currently we do not have code to initialise // global objects. So initializing global objects against using local // initialized object @@ -52,69 +302,71 @@ namespace fapi2 uint32_t l_beginning_offset; FAPI_DBG("Platform target initialization. Target Count = %u", TARGET_COUNT); - // Initialize all entries to NULL + /* + * Initialize all entries to NULL + */ for (uint32_t i = 0; i < TARGET_COUNT; ++i) { G_vec_targets.push_back((fapi2::plat_target_handle_t)0x0); FAPI_DBG("Nulling G_vec_targets[%u] hi value=0x%08X", i, (uint32_t)(G_vec_targets.at(i)>>32)); - // FAPI_DBG("Nulling G_vec_targets[%u] lo value=0x%08X", - // i, (uint32_t)(G_vec_targets.at(i)&0x00000000ffffffffull)); + } - FAPI_DBG("Vector size: %u", G_vec_targets.size()); + FAPI_DBG("Vector size: %u", G_vec_targets.size()); - // Chip Target is the first one + /* + * Chip Target is the first one + */ FAPI_DBG("Chip Target info: CHIP_TARGET_OFFSET %u CHIP_TARGET_COUNT %u ", CHIP_TARGET_OFFSET,CHIP_TARGET_COUNT); - l_beginning_offset = CHIP_TARGET_OFFSET; - FAPI_DBG("Chip beginning offset =%u", l_beginning_offset); - for (uint32_t i = 0; i < CHIP_TARGET_COUNT; ++i) - { - fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> target_name((fapi2::plat_target_handle_t)i); - G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); - // FAPI_DBG("Chip Target initialization: %u G_vec_targets[%u] value=0x%08X", - // i, - // (l_beginning_offset+i), - // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32)); - } - // Chip Level Pervasive Targets + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> chip_target((fapi2::plat_target_handle_t)0); + G_vec_targets.at(l_beginning_offset) = revle64((fapi2::plat_target_handle_t)(chip_target.get())); + + /* + * Pervasive Targets + */ FAPI_DBG("Pervasive Target info: PERV_TARGET_OFFSET %u PERV_TARGET_COUNT %u", PERV_TARGET_OFFSET, PERV_TARGET_COUNT); l_beginning_offset = PERV_TARGET_OFFSET; - FAPI_DBG("Perv beginning offset =%u", l_beginning_offset); for (uint32_t i = 0; i < PERV_TARGET_COUNT; ++i) { - fapi2::Target<fapi2::TARGET_TYPE_PERV> target_name((fapi2::plat_target_handle_t)i); - FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32)); + fapi2::Target<fapi2::TARGET_TYPE_PERV> target_name((fapi2::plat_target_handle_t)i+1); + FAPI_DBG("target_name i = %d hi word = 0x%08X", i+1, (uint32_t)(target_name.get()>>32)); + + // Determine if the chiplet is present and, thus, functional + // via partial good attributes + FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); - // FAPI_DBG("Pervasive Target initialization: %u G_vec_targets[%u] value=0x%08X", - // i, - // (l_beginning_offset+i), - // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32)); + FAPI_DBG("G offset = %d", l_beginning_offset+i); } - // Cache (EQ) Targets + /* + * Cache (EQ) Targets + */ FAPI_DBG("EQ Target info: EQ_TARGET_OFFSET %u EQ_TARGET_COUNT %u", EQ_TARGET_OFFSET, EQ_TARGET_COUNT); l_beginning_offset = EQ_TARGET_OFFSET; - FAPI_DBG("EQ beginning offset =%u", l_beginning_offset); for (uint32_t i = 0; i < EQ_TARGET_COUNT; ++i) { fapi2::Target<fapi2::TARGET_TYPE_EQ> target_name((fapi2::plat_target_handle_t)i); - FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32)); + FAPI_DBG("target_name i = %d hi word = 0x%08X", i, (uint32_t)(target_name.get()>>32)); + + // Determine if the chiplet is present and, thus, functional + // via partial good attributes + FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); + G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); - // FAPI_DBG("EQ Target initialization: %u G_vec_targets[%u] value=%16llX", - // i, - // (l_beginning_offset+i), - // revle64((uint64_t)G_vec_targets[l_beginning_offset+i])); + FAPI_DBG("G offset = %d", l_beginning_offset+i); } - // Core (EC) Targets + /* + * Core (EC) Targets + */ FAPI_DBG("Core Target info: CORE_TARGET_OFFSET %u CORE_TARGET_COUNT %u", CORE_TARGET_OFFSET, CORE_TARGET_COUNT); @@ -123,15 +375,19 @@ namespace fapi2 for (uint32_t i = 0; i < CORE_TARGET_COUNT; ++i) { fapi2::Target<fapi2::TARGET_TYPE_CORE> target_name((fapi2::plat_target_handle_t)i); - FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32)); + FAPI_DBG("target_name i = %d hi word = 0x%08X", i, (uint32_t)(target_name.get()>>32)); + + // Determine if the chiplet is present and, thus, functional + // via partial good attributes + FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); + G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); - // FAPI_DBG("Core Target initialization: %u G_vec_targets[%u] value=0x%08X", - // i, - // (l_beginning_offset+i), - // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32)); + FAPI_DBG("G offset = %d", l_beginning_offset+i); } - // Memroy Controller Synchronous (MCS) Targets + /* + * Memory Controller Synchronous (MCS) Targets + */ FAPI_DBG("MCS Target info: MCS_TARGET_OFFSET %u MCS_TARGET_COUNT %u", MCS_TARGET_OFFSET, MCS_TARGET_COUNT); @@ -140,23 +396,26 @@ namespace fapi2 for (uint32_t i = 0; i < MCS_TARGET_COUNT; ++i) { fapi2::Target<fapi2::TARGET_TYPE_MCS> target_name((fapi2::plat_target_handle_t)i); - FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32)); + FAPI_DBG("target_name i = %d hi word = 0x%08X", i, (uint32_t)(target_name.get()>>32)); + + // Determine if the chiplet is present and, thus, functional + // via partial good attributes + FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); + G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); - // FAPI_DBG("MCS Target initialization: %u G_vec_targets[%u] value=0x%08X", - // i, - // (l_beginning_offset+i), - // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32)); + FAPI_DBG("G offset = %d", l_beginning_offset+i); + } // Trace all entries - uint32_t c = 0; - for (tgt_iter = G_vec_targets.begin(); tgt_iter != G_vec_targets.end(); ++tgt_iter) + for (auto tgt_iter : G_vec_targets) { FAPI_DBG("Trace hi word G_vec_targets[%u] value=%08X", - c, (uint32_t)((*tgt_iter)>>32)); + c, (uint32_t)(tgt_iter>>32)); ++c; } +fapi_try_exit: return fapi2::current_err; } @@ -167,7 +426,7 @@ namespace fapi2 // Get the chip specific target return ((fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>)G_vec_targets.at(0)); - } + } -}; +} // fapi2 diff --git a/importtemp/xml/attribute_info/pervasive_attributes.xml b/importtemp/xml/attribute_info/pervasive_attributes.xml index 34b53f10..c73224a7 100644 --- a/importtemp/xml/attribute_info/pervasive_attributes.xml +++ b/importtemp/xml/attribute_info/pervasive_attributes.xml @@ -19,7 +19,7 @@ <attribute> <id>ATTR_CHIP_UNIT_POS</id> - <targetType>TARGET_TYPE_PERV,TARGET_TYPE_PROC_CHIP</targetType> + <targetType>TARGET_TYPE_PERV</targetType> <description></description> <valueType>uint8</valueType> </attribute> diff --git a/importtemp/xml/p9_ppe_attributes.xml b/importtemp/xml/p9_ppe_attributes.xml index 7ae5e48e..d8c19074 100644 --- a/importtemp/xml/p9_ppe_attributes.xml +++ b/importtemp/xml/p9_ppe_attributes.xml @@ -43,7 +43,7 @@ <entry> <name>ATTR_REPR_RING</name> <value>0xcafe</value> - <value>0xaffe</value> + <value>0xdead</value> </entry> <entry> <name>ATTR_TIME_RING</name> @@ -275,4 +275,23 @@ <name>ATTR_PG_EC23</name> <value>0xF1FF</value> </entry> + <entry> + <name>ATTR_CHIP_UNIT_POS</name> + <value>0x00</value> + <value>0x01</value> + <value>0x02</value> + <value>0x03</value> + <value>0x04</value> + <value>0x05</value> + <value>0x06</value> + <value>0x07</value> + <value>0x08</value> + <value>0x09</value> + <value>0x0A</value> + <value>0x0B</value> + <value>0x0C</value> + <value>0x0D</value> + <value>0x0E</value> + <value>0x0F</value> + </entry> </entries> diff --git a/sbe/image/Makefile b/sbe/image/Makefile index 1bc7aa8c..6d54fa35 100644 --- a/sbe/image/Makefile +++ b/sbe/image/Makefile @@ -1,4 +1,5 @@ + #remove this once we have a real compiler export P2P_ENABLE = 1 @@ -102,7 +103,7 @@ LINK_SCRIPT_LOADER = $(addprefix $(OBJDIR)/, linkscriptloader) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin --pad-to 0x`/usr/bin/nm $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out | grep "A _seeprom_end" | cut -d " " -f 1` $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis - + #create a linked ELF executable $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out: $(LINK_OBJS) $(LINK_SCRIPT_SEEPROM) $(LD) -e __system_reset -T$(LINK_SCRIPT_SEEPROM) -Map $(OBJDIR)/$(IMAGE_SEEPROM_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(LIB_DIRS) $(OBJS) --start-group $(LLIBS) --end-group @@ -131,7 +132,7 @@ $(LINK_SCRIPT_SBE): linksbe.cmd $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).dis: $(OBJDIR)/$(IMAGE_LOADER_NAME).out $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_LOADER_NAME).bin --pad-to 0x`/usr/bin/nm $(OBJDIR)/$(IMAGE_LOADER_NAME).out | grep "A _loader_end" | cut -d " " -f 1` $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_LOADER_NAME).dis - + #create a linked ELF executable $(OBJDIR)/$(IMAGE_LOADER_NAME).out: $(OBJDIR)/base_loader.o $(LINK_OBJS) $(LINK_SCRIPT_LOADER) $(LD) -e base_loader -T$(LINK_SCRIPT_LOADER) -Map $(OBJDIR)/$(IMAGE_LOADER_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_LOADER_NAME).out $(LIB_DIRS) $(OBJDIR)/base_loader.o --start-group $(SBEFWLIB) $(LLIBS) --end-group @@ -144,13 +145,16 @@ $(LINK_SCRIPT_LOADER): linkloader.cmd all: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(SBE_TOOLS) normalize defaultset $(OBJDIR)/fixed.bin appendbase appendloader + $(TOOLS_IMAGE_DIR)/sbe_xip_tool $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin report > $(OBJDIR)/$(IMAGE_SEEPROM_NAME).rpt generic: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(SBE_TOOLS) normalize defaultset $(OBJDIR)/fixed.bin + $(TOOLS_IMAGE_DIR)/sbe_xip_tool $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin report > $(OBJDIR)/$(IMAGE_SEEPROM_NAME).rpt #Create an obj directory if needed $(LINK_OBJS) $(OBJS) $(OBJS:.o=.d) $(OBJDIR)/base_sbe_fixed.o $(OBJDIR)/base_sbe_fixed.d: | $(OBJDIR) ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/perv_attributes.xml +ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/pervasive_attributes.xml ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/proc_attributes.xml ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/ex_attributes.xml ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/eq_attributes.xml @@ -285,7 +289,7 @@ tracehash: clean: rm -fr $(OBJDIR) rm -f $(TOP-FIXED-HEADERS) - rm -fr $(TOOLS_IMAGE_DIR)/bin/* + $(MAKE) -C $(TOOLS_IMAGE_DIR) -f Makefile clean rm -f *.dump rm -f hwp_return_codes.H hwp_error_info.H hwp_ffdc_classes.H collect_reg_ffdc.C set_sbe_error.H @@ -295,14 +299,17 @@ dump: .PHONY : run_spgpe run_pmgpe # load and run the SBE SeeProm image in a GPE simics environment -run_spgpe: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out +#run_spgpe: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out +run_spgpe: generic $(SIMICS_WS)/simics \ - -e '$$occ_gpe0_binary_to_load=$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out' modelsetup.simics + -e '$$occ_gpe0_binary_to_load=$(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin;$$occ_gpe0_sym_tbl_file=$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out' \ + modelsetup.simics # load and run the SBE PibMem image in a GPE simics environment run_pmgpe: $(OBJDIR)/$(IMAGE_NAME).out $(SIMICS_WS)/simics \ - -e '$$occ_gpe0_binary_to_load=$(OBJDIR)/$(IMAGE_SBE_NAME).out' modelsetup.simics + -e '$$occ_gpe0_binary_to_load=$(OBJDIR)/$(IMAGE_SBE_NAME).bin;$$occ_gpe0_binary_to_load=$(OBJDIR)/$(IMAGE_SBE_NAME).bin' \ + modelsetup.simics diff --git a/sbe/image/img_defs.mk b/sbe/image/img_defs.mk index 522562ad..c1214c80 100644 --- a/sbe/image/img_defs.mk +++ b/sbe/image/img_defs.mk @@ -191,7 +191,10 @@ GCC-DEFS += -D__PK__=1 GCC-DEFS += -D__SBE__=1 GCC-DEFS += -D__PPE__=1 GCC-DEFS += -DFAPI2_NO_FFDC=1 -GCC-DEFS += -DPK_TRACE_SZ=512 +# use the default settings in the code unless a size is defined +ifdef PK_TRACE_SZ +GCC-DEFS += -DPK_TRACE_SZ=$(PK_TRACE_SZ) +endif DEFS += $(GCC-DEFS) export LD_LIBRARY_PATH = /afs/awd.austin.ibm.com/proj/p3/cte/tools/gcc405lin/vol1/usr/lib diff --git a/sbe/image/sbe_common.H b/sbe/image/sbe_common.H index db7c114f..4e48339b 100644 --- a/sbe/image/sbe_common.H +++ b/sbe/image/sbe_common.H @@ -38,8 +38,8 @@ .rept ((\tnumber)*(\elements)) .byte 0 .endr - - .xip_toc \symbol, SBE_XIP_UINT8, \symbol, (\elements) + + .xip_toc \symbol, SBE_XIP_UINT8, \symbol, ((\tnumber)*(\elements)) .pushsection .fixed_toc .space 8 @@ -53,8 +53,8 @@ .rept ((\tnumber)*(\elements)) .byte 0 .endr - - .xip_toc \symbol, SBE_XIP_INT8, \symbol, (\elements) + + .xip_toc \symbol, SBE_XIP_INT8, \symbol, ((\tnumber)*(\elements)) .pushsection .fixed_toc .space 8 @@ -68,10 +68,10 @@ \symbol\(): .rept ((\tnumber)*(\elements)) - .long 0 + .byte 0,0 .endr - - .xip_toc \symbol, SBE_XIP_UINT16, \symbol, (\elements) + + .xip_toc \symbol, SBE_XIP_UINT16, \symbol, ((\tnumber)*(\elements)) .pushsection .fixed_toc .space 8 @@ -85,10 +85,10 @@ \symbol\(): .rept ((\tnumber)*(\elements)) - .long 0 + .byte 0,0 .endr - - .xip_toc \symbol, SBE_XIP_INT16, \symbol, (\elements) + + .xip_toc \symbol, SBE_XIP_INT16, \symbol, ((\tnumber)*(\elements)) .pushsection .fixed_toc .space 8 @@ -104,8 +104,8 @@ .rept ((\tnumber)*(\elements)) .long 0 .endr - - .xip_toc \symbol, SBE_XIP_UINT32, \symbol, (\elements) + + .xip_toc \symbol, SBE_XIP_UINT32, \symbol, ((\tnumber)*(\elements)) .pushsection .fixed_toc .space 8 @@ -121,8 +121,8 @@ .rept ((\tnumber)*(\elements)) .long 0 .endr - - .xip_toc \symbol, SBE_XIP_INT32, \symbol, (\elements) + + .xip_toc \symbol, SBE_XIP_INT32, \symbol, ((\tnumber)*(\elements)) .pushsection .fixed_toc .space 8 @@ -137,8 +137,8 @@ .rept ((\tnumber)*(\elements)) .quad 0 .endr - - .xip_toc \symbol, SBE_XIP_UINT64, \symbol, (\elements) + + .xip_toc \symbol, SBE_XIP_UINT64, \symbol, ((\tnumber)*(\elements)) .pushsection .fixed_toc .space 8 @@ -153,8 +153,8 @@ .rept ((\tnumber)*(\elements)) .quad 0 .endr - - .xip_toc \symbol, SBE_XIP_INT64, \symbol, (\elements) + + .xip_toc \symbol, SBE_XIP_INT64, \symbol, ((\tnumber)*(\elements)) .pushsection .fixed_toc .space 8 @@ -166,7 +166,7 @@ .global \symbol \symbol\(): .quadia (\space), (\address) - + .xip_toc \symbol, SBE_XIP_UINT64, \symbol .pushsection .fixed_toc @@ -201,79 +201,79 @@ proc_sbe_fixed_int64 symbol #define PROC_SBE_FIXED_UINT8_VECTOR(symbol, elements) \ - proc_sbe_fixed_uint8 symbol, elements + proc_sbe_fixed_uint8 symbol, 1, elements #define PROC_SBE_FIXED_INT8_VECTOR(symbol, elements) \ - proc_sbe_fixed_int8 symbol, elements - + proc_sbe_fixed_int8 symbol, 1, elements + #define PROC_SBE_FIXED_UINT16_VECTOR(symbol, elements) \ - proc_sbe_fixed_uint16 symbol, elements + proc_sbe_fixed_uint16 symbol, 1, elements #define PROC_SBE_FIXED_INT16_VECTOR(symbol, elements) \ - proc_sbe_fixed_int16 symbol, elements - + proc_sbe_fixed_int16 symbol, 1, elements + #define PROC_SBE_FIXED_UINT32_VECTOR(symbol, elements) \ - proc_sbe_fixed_uint32 symbol, elements + proc_sbe_fixed_uint32 symbol, 1, elements #define PROC_SBE_FIXED_INT32_VECTOR(symbol, elements) \ - proc_sbe_fixed_int32 symbol, elements + proc_sbe_fixed_int32 symbol, 1, elements #define PROC_SBE_FIXED_UINT64_VECTOR(symbol, elements) \ - proc_sbe_fixed_uint64 symbol, elements + proc_sbe_fixed_uint64 symbol, 1, elements #define PROC_SBE_FIXED_INT64_VECTOR(symbol, elements) \ - proc_sbe_fixed_int64 symbol, elements + proc_sbe_fixed_int64 symbol, 1, elements #define PROC_SBE_FIXED_UINT8_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_uint8 symbol, dim1 * dim2 + proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 #define PROC_SBE_FIXED_INT8_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_int8 symbol, dim1 * dim2 + proc_sbe_fixed_int8 symbol, 1, dim1 * dim2 #define PROC_SBE_FIXED_UINT16_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_uint16 symbol, dim1 * dim2 + proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 #define PROC_SBE_FIXED_INT16_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_int16 symbol, dim1 * dim2 + proc_sbe_fixed_int16 symbol, 1, dim1 * dim2 #define PROC_SBE_FIXED_UINT32_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_uint32 symbol, dim1 * dim2 + proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 #define PROC_SBE_FIXED_INT32_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_int32 symbol, dim1 * dim2 - + proc_sbe_fixed_int32 symbol, 1, dim1 * dim2 + #define PROC_SBE_FIXED_UINT64_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_uint64 symbol, dim1 * dim2 + proc_sbe_fixed_uint64 symbol, 1, dim1 * dim2 #define PROC_SBE_FIXED_INT64_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_int64 symbol, dim1 * dim2 + proc_sbe_fixed_int64 symbol, 1, dim1 * dim2 #define PROC_SBE_FIXED_UINT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint8 symbol, dim1 * dim2 * dim3 - + proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 * dim3 + #define PROC_SBE_FIXED_INT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint8 symbol, dim1 * dim2 * dim3 + proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 * dim3 #define PROC_SBE_FIXED_UINT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint16 symbol, dim1 * dim2 * dim3 - + proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 * dim3 + #define PROC_SBE_FIXED_INT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint16 symbol, dim1 * dim2 * dim3 + proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 * dim3 #define PROC_SBE_FIXED_UINT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint32 symbol, dim1 * dim2 * dim3 - + proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 * dim3 + #define PROC_SBE_FIXED_INT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint32 symbol, dim1 * dim2 * dim3 + proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 * dim3 #define PROC_SBE_FIXED_UINT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint64 symbol, dim1 * dim2 * dim3 - + proc_sbe_fixed_uint64 symbol, 1, dim1 * dim2 * dim3 + #define PROC_SBE_FIXED_INT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint64 symbol, dim1 * dim2 * dim3 - + proc_sbe_fixed_uint64 symbol, 1, dim1 * dim2 * dim3 + // Non-Chip Target Attributes - + #define PROC_SBE_FIXED_TARGET_UINT8(symbol, tnumber) \ proc_sbe_fixed_uint8 symbol, tnumber @@ -299,80 +299,80 @@ proc_sbe_fixed_int64 symbol, tnumber #define PROC_SBE_FIXED_TARGET_UINT8_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_uint8 symbol, tnumber * elements + proc_sbe_fixed_uint8 symbol, tnumber, elements #define PROC_SBE_FIXED_TARGET_INT8_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_int8 symbol, tnumber * elements - + proc_sbe_fixed_int8 symbol, tnumber, elements + #define PROC_SBE_FIXED_TARGET_UINT16_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_uint16 symbol, tnumber * elements + proc_sbe_fixed_uint16 symbol, tnumber, elements #define PROC_SBE_FIXED_TARGET_INT16_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_int16 symbol, tnumber * elements - + proc_sbe_fixed_int16 symbol, tnumber, elements + #define PROC_SBE_FIXED_TARGET_UINT32_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_uint32 symbol, tnumber * elements + proc_sbe_fixed_uint32 symbol, tnumber, elements #define PROC_SBE_FIXED_TARGET_INT32_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_int32 symbol, tnumber * elements + proc_sbe_fixed_int32 symbol, tnumber, elements #define PROC_SBE_FIXED_TARGET_UINT64_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_uint64 symbol, tnumber * elements + proc_sbe_fixed_uint64 symbol, tnumber, elements #define PROC_SBE_FIXED_TARGET_INT64_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_int64 symbol, tnumber * elements + proc_sbe_fixed_int64 symbol, tnumber, elements #define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_uint8 symbol, tnumber * dim1 * dim2 + proc_sbe_fixed_uint8 symbol, tnumber, dim1 * dim2 #define PROC_SBE_FIXED_TARGET_INT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_int8 symbol, tnumber * dim1 * dim2 + proc_sbe_fixed_int8 symbol, tnumber, dim1 * dim2 #define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_uint16 symbol, tnumber * dim1 * dim2 + proc_sbe_fixed_uint16 symbol, tnumber, dim1 * dim2 #define PROC_SBE_FIXED_TARGET_INT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_int16 symbol, tnumber * dim1 * dim2 + proc_sbe_fixed_int16 symbol, tnumber, dim1 * dim2 #define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_uint32 symbol, tnumber * dim1 * dim2 + proc_sbe_fixed_uint32 symbol, tnumber, dim1 * dim2 #define PROC_SBE_FIXED_TARGET_INT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_int32 symbol, tnumber * dim1 * dim2 - + proc_sbe_fixed_int32 symbol, tnumber, dim1 * dim2 + #define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_uint64 symbol, tnumber * dim1 * dim2 + proc_sbe_fixed_uint64 symbol, tnumber, dim1 * dim2 #define PROC_SBE_FIXED_TARGET_INT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_int64 symbol, tnumber * dim1 * dim2 + proc_sbe_fixed_int64 symbol, tnumber, dim1 * dim2 #define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint8 symbol, tnumber * dim1 * dim2 * dim3 - + proc_sbe_fixed_uint8 symbol, tnumber, dim1 * dim2 * dim3 + #define PROC_SBE_FIXED_TARGET_INT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint8 symbol, tnumber * dim1 * dim2 * dim3 + proc_sbe_fixed_uint8 symbol, tnumber, dim1 * dim2 * dim3 #define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint16 symbol, tnumber * dim1 * dim2 * dim3 - + proc_sbe_fixed_uint16 symbol, tnumber, dim1 * dim2 * dim3 + #define PROC_SBE_FIXED_TARGET_INT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint16 symbol, tnumber * dim1 * dim2 * dim3 + proc_sbe_fixed_uint16 symbol, tnumber, dim1 * dim2 * dim3 #define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint32 symbol, tnumber * dim1 * dim2 * dim3 - + proc_sbe_fixed_uint32 symbol, tnumber, dim1 * dim2 * dim3 + #define PROC_SBE_FIXED_TARGET_INT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint32 symbol, tnumber * dim1 * dim2 * dim3 + proc_sbe_fixed_uint32 symbol, tnumber, dim1 * dim2 * dim3 #define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint64 symbol, tnumber * dim1 * dim2 * dim3 - + proc_sbe_fixed_uint64 symbol, tnumber, dim1 * dim2 * dim3 + #define PROC_SBE_FIXED_TARGET_INT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint64 symbol, tnumber * dim1 * dim2 * dim3 + proc_sbe_fixed_uint64 symbol, tnumber, dim1 * dim2 * dim3 #define PROC_SBE_FIXED_QUADIA(symbol, space, address) \ proc_sbe_fixed_quadia symbol, (space), (address) - + #else // __ASSEMBLER__ (eg the C portion) @@ -399,19 +399,19 @@ #define PROC_SBE_FIXED_INT64(symbol) \ int64_t symbol - + #define PROC_SBE_FIXED_UINT8_VECTOR(symbol, elements) \ uint8_t symbol[elements] #define PROC_SBE_FIXED_INT8_VECTOR(symbol, elements) \ int8_t symbol[elements] - + #define PROC_SBE_FIXED_UINT16_VECTOR(symbol, elements) \ uint16_t symbol[elements] #define PROC_SBE_FIXED_INT16_VECTOR(symbol, elements) \ int16_t symbol[elements] - + #define PROC_SBE_FIXED_UINT32_VECTOR(symbol, elements) \ uint32_t symbol[elements] @@ -422,29 +422,29 @@ uint64_t symbol[elements] #define PROC_SBE_FIXED_INT64_VECTOR(symbol, elements) \ - int64_t symbol[elements] - + int64_t symbol[elements] + #define PROC_SBE_FIXED_UINT8_VECTOR_2(symbol, dim1, dim2 ) \ uint8_t symbol[dim1][dim2] - + #define PROC_SBE_FIXED_INT8_VECTOR_2(symbol, dim1, dim2 ) \ int8_t symbol[dim1][dim2] #define PROC_SBE_FIXED_UINT16_VECTOR_2(symbol, dim1, dim2 ) \ uint16_t symbol[dim1][dim2] - + #define PROC_SBE_FIXED_INT16_VECTOR_2(symbol, dim1, dim2 ) \ int16_t symbol[dim1][dim2] - + #define PROC_SBE_FIXED_UINT32_VECTOR_2(symbol, dim1, dim2 ) \ uint32_t symbol[dim1][dim2] - + #define PROC_SBE_FIXED_INT32_VECTOR_2(symbol, dim1, dim2 ) \ int32_t symbol[dim1][dim2] - + #define PROC_SBE_FIXED_UINT64_VECTOR_2(symbol, dim1, dim2 ) \ uint64_t symbol[dim1][dim2] - + #define PROC_SBE_FIXED_INT64_VECTOR_2(symbol, dim1, dim2 ) \ int64_t symbol[dim1][dim2] @@ -453,7 +453,7 @@ #define PROC_SBE_FIXED_INT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ int8_t symbol[dim1][dim2][dim3] - + #define PROC_SBE_FIXED_UINT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ uint16_t symbol[dim1][dim2][dim3] @@ -497,19 +497,19 @@ #define PROC_SBE_FIXED_TARGET_INT64(symbol, tnumber) \ int64_t symbol[tnumber] - + #define PROC_SBE_FIXED_TARGET_UINT8_VECTOR(symbol, tnumber, elements) \ uint8_t symbol[tnumber][elements] #define PROC_SBE_FIXED_TARGET_INT8_VECTOR(symbol, tnumber, elements) \ int8_t symbol[tnumber][elements] - + #define PROC_SBE_FIXED_TARGET_UINT16_VECTOR(symbol, tnumber, elements) \ uint16_t symbol[tnumber][elements] #define PROC_SBE_FIXED_TARGET_INT16_VECTOR(symbol, tnumber, elements) \ int16_t symbol[tnumber][elements] - + #define PROC_SBE_FIXED_TARGET_UINT32_VECTOR(symbol, tnumber, elements) \ uint32_t symbol[tnumber][elements] @@ -520,29 +520,29 @@ uint64_t symbol[tnumber][elements] #define PROC_SBE_FIXED_TARGET_INT64_VECTOR(symbol, tnumber, elements) \ - int64_t symbol[tnumber][elements] - + int64_t symbol[tnumber][elements] + #define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ uint8_t symbol[tnumber][dim1][dim2] - + #define PROC_SBE_FIXED_TARGET_INT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ int8_t symbol[tnumber][dim1][dim2] #define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ uint16_t symbol[tnumber][dim1][dim2] - + #define PROC_SBE_FIXED_TARGET_INT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ int16_t symbol[tnumber][dim1][dim2] - + #define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ uint32_t symbol[tnumber][dim1][dim2] - + #define PROC_SBE_FIXED_TARGET_INT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ int32_t symbol[tnumber][dim1][dim2] - + #define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ uint64_t symbol[tnumber][dim1][dim2] - + #define PROC_SBE_FIXED_TARGET_INT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ int64_t symbol[tnumber][dim1][dim2] @@ -551,7 +551,7 @@ #define PROC_SBE_FIXED_TARGET_INT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ int8_t symbol[tnumber][dim1][dim2][dim3] - + #define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ uint16_t symbol[tnumber][dim1][dim2][dim3] diff --git a/sbe/image/sbe_main.C b/sbe/image/sbe_main.C index 3f859e86..54d4fdc6 100644 --- a/sbe/image/sbe_main.C +++ b/sbe/image/sbe_main.C @@ -35,11 +35,12 @@ extern "C" namespace fapi2attr { -extern ProcChipAttributes_t* G_proc_chip_attributes asm("G_proc_chip_attributes") __attribute__ ((section (".fixed"))); -extern PervAttributes_t* G_perv_attributes asm("G_perv_attributes") __attribute__ ((section (".fixed"))); -extern CoreAttributes_t* G_core_attributes asm("G_core_attributes") __attribute__ ((section (".fixed"))); -extern EQAttributes_t* G_eq_attributes asm("G_eq_attributes") __attribute__ ((section (".fixed"))); -extern EXAttributes_t* G_ex_attributes asm("G_ex_attributes") __attribute__ ((section (".fixed"))); +extern ProcChipAttributes_t G_proc_chip_attributes asm("G_proc_chip_attributes") __attribute__ ((section (".fixed"))); +extern PervAttributes_t G_perv_attributes asm("G_perv_attributes") __attribute__ ((section (".fixed"))); +extern CoreAttributes_t G_core_attributes asm("G_core_attributes") __attribute__ ((section (".fixed"))); +extern EQAttributes_t G_eq_attributes asm("G_eq_attributes") __attribute__ ((section (".fixed"))); +extern EXAttributes_t G_ex_attributes asm("G_ex_attributes") __attribute__ ((section (".fixed"))); + } @@ -55,8 +56,20 @@ uint8_t G_main_thread_stack[MAIN_THREAD_STACK_SIZE]; PkThread G_main_thread; +fapi2attr::ProcChipAttributes_t* G_proc_chip_attributes_ptr ; +fapi2attr::PervAttributes_t* G_perv_attributes_ptr; +fapi2attr::CoreAttributes_t* G_core_attributes_ptr; +fapi2attr::EQAttributes_t* G_eq_attributes_ptr; +fapi2attr::EXAttributes_t* G_ex_attributes_ptr; + + + fapi2::ReturnCode -hwp_chip(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target); +hwp_chip_present(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target); + +fapi2::ReturnCode +hwp_chip_functional(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target); + fapi2::ReturnCode hwp_chip2(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target); @@ -85,6 +98,9 @@ void main_thread(void* arg) std::vector<fapi2::plat_target_handle_t> targets1; G_vec_targets = std::move(targets1); + // Establish the pointer to the global attributes + G_proc_chip_attributes_ptr = &G_proc_chip_attributes; + // Intialize the targets fapi2::plat_TargetsInit(); @@ -94,7 +110,8 @@ void main_thread(void* arg) FAPI_DBG("chip_target_new = 0x%08X", (uint32_t)(chip_target_new.get()>>32)); - FAPI_TRY(hwp_chip(chip_target_new)); +// FAPI_TRY(hwp_chip_present(chip_target_new)); + FAPI_TRY(hwp_chip_functional(chip_target_new)); FAPI_TRY(hwp_chip2(chip_target_new)); @@ -123,21 +140,21 @@ fapi_try_exit: // A Chip try fapi2::ReturnCode -hwp_chip(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target) +hwp_chip_present(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target) { FAPI_DBG("i_target = 0x%08X", (uint32_t)(i_target.get()>>32)); - auto l_perv_functional_vector = + auto l_perv_present_vector = i_target.getChildren<fapi2::TARGET_TYPE_PERV> (fapi2::TARGET_STATE_PRESENT); // Get the TPChiplet target uint32_t i = 0; - for (auto it: l_perv_functional_vector) + for (auto it: l_perv_present_vector) { - FAPI_DBG("Perv Functional Target %u value=%08X chiplet %02X", + FAPI_DBG("Perv Present Target %u value=%08X chiplet %02X", i, (uint32_t)(it.get()>>32), (uint32_t)(it.getChipletNumber())); @@ -145,16 +162,16 @@ hwp_chip(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target) ++i; } - auto l_core_functional_vector = + auto l_core_present_vector = i_target.getChildren<fapi2::TARGET_TYPE_CORE> (fapi2::TARGET_STATE_PRESENT); // Get the Core Chiplet targets uint32_t j = 0; - for (auto it: l_core_functional_vector) + for (auto it: l_core_present_vector) { - FAPI_DBG("Core Functional Target %u value=%08X chiplet %02X", + FAPI_DBG("Core Present Target %u value=%08X chiplet %02X", j, (uint32_t)(it.get()>>32), (uint32_t)(it.getChipletNumber())); @@ -180,7 +197,7 @@ hwp_chip(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target) FAPI_TRY(fapi2::getScom(i_target, address, data)); - FAPI_DBG("First getSCOM: data = %016llX", revle64(data)); +// FAPI_DBG("The First getSCOM: data = %016llX", revle64(data)); data.setBit<0, 16>(); FAPI_TRY(fapi2::putScom(i_target, 0x0006d010, data)); @@ -193,6 +210,54 @@ fapi_try_exit: // A Chip try fapi2::ReturnCode +hwp_chip_functional(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target) +{ + + FAPI_DBG("i_target = 0x%08X", (uint32_t)(i_target.get()>>32)); + + auto l_perv_functional_vector = + i_target.getChildren<fapi2::TARGET_TYPE_PERV> + (fapi2::TARGET_STATE_FUNCTIONAL); + + // Get the TPChiplet target + uint32_t i = 0; + for (auto it: l_perv_functional_vector) + { + + FAPI_DBG("Perv Functional Target %u value=%08X chiplet %02X", + i, + (uint32_t)(it.get()>>32), + (uint32_t)(it.getChipletNumber())); + + ++i; + } + + auto l_core_functional_vector = + i_target.getChildren<fapi2::TARGET_TYPE_CORE> + (fapi2::TARGET_STATE_FUNCTIONAL); + + // Get the Core Chiplet targets + uint32_t j = 0; + for (auto it: l_core_functional_vector) + { + + FAPI_DBG("Core Functional Target %u value=%08X chiplet %02X", + j, + (uint32_t)(it.get()>>32), + (uint32_t)(it.getChipletNumber())); + + ++j; + } + + return fapi2::FAPI2_RC_SUCCESS; + +fapi_try_exit: + return fapi2::FAPI2_RC_PLAT_ERR_SEE_DATA; +} + + +// A Chip try +fapi2::ReturnCode hwp_chip2(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target) { diff --git a/sbe/image/sbe_xip_image.c b/sbe/image/sbe_xip_image.c index 270b450d..d800650b 100644 --- a/sbe/image/sbe_xip_image.c +++ b/sbe/image/sbe_xip_image.c @@ -30,28 +30,6 @@ // Local Functions //////////////////////////////////////////////////////////////////////////// -// PHYP has their own way of implementing the <string.h> functions. PHYP also -// does not allow static functions or data, so all of the XIP_STATIC functions -// defined here are global to PHYP. - -#ifdef PPC_HYP - -#ifdef PLIC_MODULE - -#define strcpy(dest, src) hvstrcpy(dest, src) -#define strlen(s) hvstrlen(s) -#define strcmp(s1, s2) hvstrcmp(s1, s2) -#endif //PLIC_MODULE - -#define XIP_STATIC - -#else // PPC_HYP - -#define XIP_STATIC static - -#endif // PPC_HYP - - #ifdef DEBUG_SBE_XIP_IMAGE // Debugging support, normally disabled. All of the formatted I/O you see in @@ -1947,6 +1925,10 @@ sbe_xip_set_element(void *i_image, case SBE_XIP_UINT8: ((uint8_t*)(item.iv_imageData))[i_index] = (uint8_t)i_data; break; + case SBE_XIP_UINT16: + ((uint16_t*)(item.iv_imageData))[i_index] = + xipRevLe16((uint16_t)i_data); + break; case SBE_XIP_UINT32: ((uint32_t*)(item.iv_imageData))[i_index] = xipRevLe32((uint32_t)i_data); @@ -1955,6 +1937,21 @@ sbe_xip_set_element(void *i_image, ((uint64_t*)(item.iv_imageData))[i_index] = xipRevLe64((uint64_t)i_data); break; + case SBE_XIP_INT8: + ((int8_t*)(item.iv_imageData))[i_index] = (int8_t)i_data; + break; + case SBE_XIP_INT16: + ((int16_t*)(item.iv_imageData))[i_index] = + xipRevLe16((uint16_t)i_data); + break; + case SBE_XIP_INT32: + ((int32_t*)(item.iv_imageData))[i_index] = + xipRevLe32((uint32_t)i_data); + break; + case SBE_XIP_INT64: + ((int64_t*)(item.iv_imageData))[i_index] = + xipRevLe64((uint64_t)i_data); + break; default: rc = TRACE_ERROR(SBE_XIP_TYPE_ERROR); break; diff --git a/sbe/image/sbe_xip_image.h b/sbe/image/sbe_xip_image.h index fc1bf47c..41b83311 100644 --- a/sbe/image/sbe_xip_image.h +++ b/sbe/image/sbe_xip_image.h @@ -1250,6 +1250,46 @@ sbe_xip_host2image(const void* i_image, uint64_t* o_imageAddress); + +// PHYP has their own way of implementing the <string.h> functions. PHYP also +// does not allow static functions or data, so all of the XIP_STATIC functions +// defined here are global to PHYP. + +#ifdef PPC_HYP + +#ifdef PLIC_MODULE + +#define strcpy(dest, src) hvstrcpy(dest, src) +#define strlen(s) hvstrlen(s) +#define strcmp(s1, s2) hvstrcmp(s1, s2) +#endif //PLIC_MODULE + +#define XIP_STATIC + +#else // PPC_HYP + +// #define XIP_STATIC static +#define XIP_STATIC + +#endif // PPC_HYP + +// Note: For maximum flexibility we provide private versions of +// endian-conversion routines rather than counting on a system-specific header +// to provide these. + +/// Byte-reverse a 16-bit integer if on a little-endian machine +XIP_STATIC uint16_t +xipRevLe16(const uint16_t i_x); + +/// Byte-reverse a 32-bit integer if on a little-endian machine +XIP_STATIC uint32_t +xipRevLe32(const uint32_t i_x); + + +/// Byte-reverse a 64-bit integer if on a little-endian machine +XIP_STATIC uint64_t +xipRevLe64(const uint64_t i_x); + /// \defgroup sbe_xip_image_errors Error codes from SBE-XIP image APIs /// /// @{ diff --git a/sbe/image/topfiles.mk b/sbe/image/topfiles.mk index 37af6c2b..88c11bee 100644 --- a/sbe/image/topfiles.mk +++ b/sbe/image/topfiles.mk @@ -1,5 +1,5 @@ -TOP-C-SOURCES = sbe_loader.c -TOP-CPP-SOURCES = sbe_main.C +TOP-C-SOURCES = base_ppe_demo.c sbe_loader.c +TOP-CPP-SOURCES = TOP-S-SOURCES = base_ppe_header.S TOP-FIXED-HEADERS += $(IMAGE_SRCDIR)/proc_sbe_fixed_perv.H diff --git a/tools/image/Makefile b/tools/image/Makefile index 0afc09ee..a7da7ae9 100644 --- a/tools/image/Makefile +++ b/tools/image/Makefile @@ -20,36 +20,6 @@ $(warning CTEPATH not defined; defaulting to awd) CTEPATH = /afs/awd/projects/cte endif - -# Are we setup for eCMD, if so let's get our eCMD Release from there -ifneq ($(strip $(ECMD_RELEASE)),) - ECMD_RELEASE := $(shell ecmdVersion full) - # Make sure we got a valid version back - ifeq ($(findstring ver,$(ECMD_RELEASE)),) - ECMD_RELEASE := rel - endif -else - # If not setup for eCMD, default to rel - ECMD_RELEASE := rel -endif - - -# Ok, now set our eCMD Path, if not set already -ifeq ($(strip $(ECMD_PATH)),) - ECMD_PATH := ${CTEPATH}/tools/ecmd/${ECMD_RELEASE}/ -endif - -ifeq ($(strip $(ECMD_PLUGIN)),cro) -# Cronus plugin specific setup - CRONUS_PATH := $(shell echo ${ECMD_EXE} | sed -n 's|\([a-zA-Z0-9]*\)\(_*\)\([a-zA-Z0-9]*\)_x86\.exe|prcd_d|p') - ifeq ($(strip $(CRONUS_PATH)),) - $(error "Error determining CRONUS_PATH from env!") - endif -endif - -# We need common up-to-date headers for FAPI - currently using these. -FAPI = $(ECMD_PATH)ext/fapi - # Locations of required headers. INCLUDES += -I. -I../../ -I../../utils INCLUDES += -I ../../sbe/image/ @@ -63,10 +33,6 @@ INCLUDES += -I ../../pk/trace/ INCLUDES += -I ../../tools/ppetracepp/ INCLUDES += -I ../../importtemp/fapi2/include/ -INCLUDES += -I$(CRONUS_PATH) -INCLUDES += -I$(ECMD_PATH)/capi -INCLUDES += -I$(FAPI)/capi - # Under Linux the scheme is to use a common compiler to create procedures. # However, the common compiler can be VERY slow, so if the system compiler is # also 4.1.2 we're using that one instead. Also, the Linux FAPI libraries we @@ -101,8 +67,11 @@ UTILITIES-DEPENDENCIES = $(patsubst %.o,%.d,$(UTILITIES-OBJECTS)) UTILITIES-EXECUTABLES = $(patsubst %,bin/%,$(UTILITIES)) -.PHONY : utilities -utilities: $(UTILITIES-EXECUTABLES) +.PHONY : utilities buildBinDir +utilities: buildBinDir $(UTILITIES-EXECUTABLES) + +buildBinDir: + mkdir -p bin bin/%.o: %.c $(CXX) -std=c++11 $(INCLUDES) $(CXXFLAGS) -DDEBUG_SBE_XIP_IMAGE=1 -DFAPI2_NO_FFDC -c -o $@ $< @@ -119,6 +88,6 @@ bin/sbe_default_tool: bin/sbe_xip_image.o bin/sbe_default_tool.o ln -sf bin/sbe_default_tool sbe_default_tool clean: - rm sbe_xip_tool sbe_default_tool + rm -f sbe_xip_tool sbe_default_tool rm -rf bin - mkdir -p bin
\ No newline at end of file + mkdir -p bin diff --git a/tools/image/bin/.empty b/tools/image/bin/.empty deleted file mode 100644 index e69de29b..00000000 --- a/tools/image/bin/.empty +++ /dev/null diff --git a/tools/image/sbe_default_tool.c b/tools/image/sbe_default_tool.c index 2b1679ef..817eee09 100644 --- a/tools/image/sbe_default_tool.c +++ b/tools/image/sbe_default_tool.c @@ -18,6 +18,7 @@ #define __PPE__ #include "fapi2.H" #include "proc_sbe_fixed.H" +#include "sbe_xip_image.h" const char* g_usage = "Usage: sbe_default_tool <image> <attribute> <value> <target type> <index>\n" @@ -46,31 +47,35 @@ void assertTarget(const char* str, unsigned int index) if(strcmp(str, "TARGET_TYPE_PROC_CHIP") == 0) { if (index > 0) { - fprintf(stderr, "sbe_default_tool: index is larger than 0\n"); + fprintf(stderr, "sbe_default_tool: index (%d) is larger than 0\n", index); exit(1); } return; } else if(strcmp(str, "TARGET_TYPE_EX") == 0) { - if (index >= EX_TARGET_COUNT) { - fprintf(stderr, "sbe_default_tool: index is larger than EX_TARGET_COUNT\n"); + if (index > EX_TARGET_COUNT) { + fprintf(stderr, "sbe_default_tool: index (%d) is larger than EX_TARGET_COUNT (%d)\n", + index, EX_TARGET_COUNT); exit(1); } return; } else if(strcmp(str, "TARGET_TYPE_EQ") == 0) { - if (index >= EQ_TARGET_COUNT) { - fprintf(stderr, "sbe_default_tool: index is larger than EQ_TARGET_COUNT\n"); + if (index > EQ_TARGET_COUNT) { + fprintf(stderr, "sbe_default_tool: index (%d) is larger than EQ_TARGET_COUNT (%d)\n", + index, EQ_TARGET_COUNT); exit(1); } return; } else if(strcmp(str, "TARGET_TYPE_CORE") == 0) { - if (index >= CORE_TARGET_COUNT) { - fprintf(stderr, "sbe_default_tool: index is larger than EQ_TARGET_COUNT\n"); + if (index > CORE_TARGET_COUNT) { + fprintf(stderr, "sbe_default_tool: index (%d) is larger than CORE_TARGET_COUNT (%d)\n", + index, CORE_TARGET_COUNT); exit(1); } return; } else if(strcmp(str, "TARGET_TYPE_PERV") == 0) { - if (index >= PERV_TARGET_COUNT) { - fprintf(stderr, "sbe_default_tool: index is larger than PERV_TARGET_COUNT\n"); + if (index > PERV_TARGET_COUNT) { + fprintf(stderr, "sbe_default_tool: index (%d) is larger than PERV_TARGET_COUNT (%d)\n", + index, PERV_TARGET_COUNT); exit(1); } return; @@ -100,45 +105,44 @@ void setAttribute(void* image, const char* attribute, unsigned int index, uint64 // debug purpose //printf("offset in string section: 0x%x \n", be32toh(item.iv_toc->iv_id)); - //printf("address: 0x%x \n", item.iv_address); + //printf("address: 0x%x index: %2d 0x%x\n", item.iv_address, index, index); sbe_xip_image2host(image, item.iv_address, &thePointer); // debug purpose - //printf("pointer1: 0x%x \n", thePointer); - //printf("val: 0x%llx \n", val); + //printf("pointer1: 0x%x val: 0x%llx \n", thePointer, val); if(item.iv_toc->iv_type == SBE_XIP_UINT8) { - *((uint8_t*)thePointer + index) = (uint8_t)val; + *((uint8_t*)thePointer + (index * sizeof(uint8_t))) = (uint8_t)val; } else if(item.iv_toc->iv_type == SBE_XIP_INT8) { - *((int8_t*)thePointer + index) = (int8_t)val; + *((int8_t*)thePointer + (index * sizeof(int8_t))) = (int8_t)val; } else if(item.iv_toc->iv_type == SBE_XIP_UINT16) { - *((uint16_t*)thePointer + index) = (uint16_t)val; + *((uint16_t*)thePointer + (index * sizeof(uint16_t))) = xipRevLe16((uint16_t)val); } else if(item.iv_toc->iv_type == SBE_XIP_INT16) { - *((int16_t*)thePointer + index) = (int16_t)val; + *((int16_t*)thePointer + (index * sizeof(int16_t))) = xipRevLe16((int16_t)val); } else if(item.iv_toc->iv_type == SBE_XIP_UINT32) { - *((uint32_t*)thePointer + index) = (uint32_t)val; + *((uint32_t*)thePointer + (index * sizeof(uint32_t))) = xipRevLe32((uint32_t)val); } else if(item.iv_toc->iv_type == SBE_XIP_INT32) { - *((int32_t*)thePointer + index) = (int32_t)val; + *((int32_t*)thePointer + (index * sizeof(int32_t))) = xipRevLe32((int32_t)val); } else if(item.iv_toc->iv_type == SBE_XIP_UINT64) { - *((uint64_t*)thePointer + index) = (uint64_t)val; + *((uint64_t*)thePointer + (index * sizeof(uint64_t))) = xipRevLe64((uint64_t)val); } else if(item.iv_toc->iv_type == SBE_XIP_INT64) { - *((int64_t*)thePointer + index) = (int64_t)val; + *((int64_t*)thePointer + (index * sizeof(int64_t))) = xipRevLe64((int64_t)val); } else { fprintf(stderr, "sbe_default_tool: type not available"); @@ -152,7 +156,8 @@ void setAttribute(void* image, const char* attribute, unsigned int index, uint64 SBE_XIP_TYPE_STRINGS(type_name); // debug purpose - //printf("pointer2: 0x%x \n", thePointer); + //printf("pointer2: 0x%x \n", thePointer + index); + //printf("elements: %d \n", item.iv_elements); //printf("section id: %s \n", section_name[item.iv_toc->iv_section]); //printf("location in section: 0x%x \n", be32toh(item.iv_toc->iv_data)); //printf("type name: %s \n", type_name[item.iv_toc->iv_type]); @@ -180,38 +185,38 @@ uint64_t getAttribute(void* image, const char* attribute, unsigned int index) { if(item.iv_toc->iv_type == SBE_XIP_UINT8) { - val = *((uint8_t*)thePointer + index); + val = *((uint8_t*)thePointer + (index * sizeof(uint8_t))); } else if(item.iv_toc->iv_type == SBE_XIP_INT8) { - val = *((int8_t*)thePointer + index); + val = *((int8_t*)thePointer + (index * sizeof(int8_t))); val &= 0xFF; } else if(item.iv_toc->iv_type == SBE_XIP_UINT16) { - val = *((uint16_t*)thePointer + index); + val = xipRevLe16(*((uint16_t*)thePointer + (index * sizeof(uint16_t)))); } else if(item.iv_toc->iv_type == SBE_XIP_INT16) { - val = *((int16_t*)thePointer + index); + val = xipRevLe16(*((int16_t*)thePointer + (index * sizeof(int16_t)))); val &= 0xFFFF; } else if(item.iv_toc->iv_type == SBE_XIP_UINT32) { - val = *((uint32_t*)thePointer + index); + val = xipRevLe32(*((uint32_t*)thePointer + (index * sizeof(uint32_t)))); } else if(item.iv_toc->iv_type == SBE_XIP_INT32) { - val = *((int32_t*)thePointer + index); + val = xipRevLe32(*((int32_t*)thePointer + (index * sizeof(int32_t)))); val &= 0xFFFFFFFF; } else if(item.iv_toc->iv_type == SBE_XIP_UINT64) { - val = *((uint64_t*)thePointer + index); + val = xipRevLe64(*((uint64_t*)thePointer + (index * sizeof(uint64_t)))); } else if(item.iv_toc->iv_type == SBE_XIP_INT64) { - val = *((int64_t*)thePointer + index); + val = xipRevLe64(*((int64_t*)thePointer + (index * sizeof(int64_t)))); } else { fprintf(stderr, "sbe_default_tool: type not available"); @@ -269,7 +274,7 @@ int main(int argc, const char** argv) if((check & val) != check) { - fprintf(stderr, "sbe_default_tool: set and get values not equal"); + fprintf(stderr, "sbe_default_tool: set and get values not equal -> "); fprintf(stderr, "%lx != %lx\n", check, val); exit(1); diff --git a/tools/image/sbe_xip_tool.c b/tools/image/sbe_xip_tool.c index 75448a25..8f6318db 100644 --- a/tools/image/sbe_xip_tool.c +++ b/tools/image/sbe_xip_tool.c @@ -324,40 +324,40 @@ tocListing(void* io_image, if (rc) break; printf("0x%02x", (uint8_t)data); break; - case SBE_XIP_INT8: + case SBE_XIP_UINT16: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("%d", (int8_t)data); + printf("0x%04x", (uint16_t)data); break; - case SBE_XIP_UINT16: + case SBE_XIP_UINT32: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("0x%08x", (uint16_t)data); + printf("0x%08x", (uint32_t)data); break; - case SBE_XIP_INT16: + case SBE_XIP_UINT64: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("%d", (int16_t)data); + printf("0x%016llx", data); break; - case SBE_XIP_UINT32: + case SBE_XIP_INT8: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("0x%08x", (uint32_t)data); + printf("0x%02x", (uint8_t)data); break; - case SBE_XIP_INT32: + case SBE_XIP_INT16: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("%d", (int32_t)data); + printf("0x%04x", (uint16_t)data); break; - case SBE_XIP_UINT64: + case SBE_XIP_INT32: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("0x%016llx", data); + printf("0x%08x", (uint32_t)data); break; case SBE_XIP_INT64: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("%d", (int64_t)data); + printf("0x%016llx", data); break; case SBE_XIP_STRING: rc = sbe_xip_get_string(io_image, i_item->iv_id, &s); @@ -781,14 +781,6 @@ get(void* i_image, const int i_argc, const char** i_argv, int i_getv) } printf("%s\n", s); break; - case SBE_XIP_INT8: - case SBE_XIP_INT16: - case SBE_XIP_INT32: - case SBE_XIP_INT64: - fprintf(stderr, "%s%d : Bug, int types not implemented %d\n", - __FILE__, __LINE__, item.iv_type); - exit(1); - break; default: fprintf(stderr, "%s%d : Bug, unexpected type %d\n", __FILE__, __LINE__, item.iv_type); diff --git a/tools/scripts/ppeCreateAttrGetSetMacros.pl b/tools/scripts/ppeCreateAttrGetSetMacros.pl index 74eeb03e..78e8552f 100755 --- a/tools/scripts/ppeCreateAttrGetSetMacros.pl +++ b/tools/scripts/ppeCreateAttrGetSetMacros.pl @@ -215,12 +215,16 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { } else { if ($type =~ m/uint8_t/) { $macroPostfix = "_UINT8_" . $dimension . "D_ARRAY"; + } elsif ($type =~ m/uint16_t/) { + $macroPostfix = "_UINT16_" . $dimension . "D_ARRAY"; } elsif ($type =~ m/uint32_t/) { $macroPostfix = "_UINT32_" . $dimension . "D_ARRAY"; } elsif ($type =~ m/uint64_t/) { $macroPostfix = "_UINT64_" . $dimension . "D_ARRAY"; } elsif ($type =~ m/int8_t/) { $macroPostfix = "_INT8_" . $dimension . "D_ARRAY"; + } elsif ($type =~ m/int16_t/) { + $macroPostfix = "_INT16_" . $dimension . "D_ARRAY"; } elsif ($type =~ m/int32_t/) { $macroPostfix = "_INT32_" . $dimension . "D_ARRAY"; } elsif ($type =~ m/int64_t/) { @@ -257,7 +261,7 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { if(defined $targetMacro) { - my $targetFunction = "template<> void __get<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>* i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type *value )"; + my $targetFunction = "template<> void __get<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>& i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type *value )"; push(@newTargetDefines, $targetFunction . ";"); my $targetImplementation = ""; @@ -267,7 +271,7 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { } else { - $targetImplementation .= "\n" . $targetFunction . "\n{\n uint32_t index = (i_ptarget)->getTargetNumber();\n *value = object->fapi2attr::${macroTarget}::${attribute}[index];\n}\n"; + $targetImplementation .= "\n" . $targetFunction . "\n{\n uint32_t index = i_ptarget.getTargetNumber();\n *value = object->fapi2attr::${macroTarget}::${attribute}[index];\n}\n"; } push(@newTargetImplementations, $targetImplementation); @@ -280,7 +284,7 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { if(defined $targetMacro) { - my $targetFunction = "template<> void __set<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>* i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type* value )"; + my $targetFunction = "template<> void __set<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>& i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type* value )"; push(@newTargetDefines, $targetFunction . ";"); my $targetImplementation = ""; @@ -289,7 +293,7 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { $targetImplementation = "\n" . $targetFunction . "\n{\n object->fapi2attr::${macroTarget}::${attribute} = *value;\n}\n"; } else { - $targetImplementation = "\n" . $targetFunction . "\n{\n uint32_t index = (i_ptarget)->getTargetNumber();\n object->fapi2attr::${macroTarget}::${attribute}[index] = *value;\n}\n"; + $targetImplementation = "\n" . $targetFunction . "\n{\n uint32_t index = i_ptarget.getTargetNumber();\n object->fapi2attr::${macroTarget}::${attribute}[index] = *value;\n}\n"; } push(@newTargetImplementations, $targetImplementation); diff --git a/tools/scripts/src/fapi2PlatAttributeService.H b/tools/scripts/src/fapi2PlatAttributeService.H index 3a3a7769..5010b2ea 100644 --- a/tools/scripts/src/fapi2PlatAttributeService.H +++ b/tools/scripts/src/fapi2PlatAttributeService.H @@ -18,14 +18,10 @@ #include "plat_target_parms.H" #define PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) \ - fapi2::_getEcFeatureOverride<fapi2::ID##_Type>(fapi2::ID, PTARGET, VAL) + _getEcFeatureOverride<ID##_Type>(ID, PTARGET, VAL) /* INSERT NEW ATTRIBUTES HERE */ -#define ATTR_TARGET_SCOMABLE_GETMACRO PLAT_ATTR_GET_GLOBAL_INT -#define ATTR_TARGET_SCOMABLE_SETMACRO PLAT_ATTR_SET_GLOBAL_INT - - /******************************************************************************/ /* * Global macros * */ @@ -35,101 +31,101 @@ /* global get uint8_t 1D array macro */ #define PLAT_ATTR_GET_UINT8_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayShort<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \ - (fapi2::ID, PTARGET, VAL) + _getAttributeArrayShort<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetTypes), ID> \ + (ID, PTARGET, VAL) /* global set uint8_t 1D array macro */ #define PLAT_ATTR_SET_UINT8_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayShort<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \ - (fapi2::ID, PTARGET, VAL) + _setAttributeArrayShort<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetTypes), ID> \ + (ID, PTARGET, VAL) /* global get uint8_t 2D array macro */ #define PLAT_ATTR_GET_UINT8_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayShort(fapi2::ID, PTARGET, VAL[0]) + _getAttributeArrayShort(ID, PTARGET, VAL[0]) /* global set uint8_t 2D array macro */ #define PLAT_ATTR_SET_UINT8_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayShort(fapi2::ID, PTARGET, VAL[0]) + _setAttributeArrayShort(ID, PTARGET, VAL[0]) /* global get uint8_t 3D array macro */ #define PLAT_ATTR_GET_UINT8_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeArrayShort(ID, PTARGET, VAL[0][0]) /* global set uint8_t 3D array macro */ #define PLAT_ATTR_SET_UINT8_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0]) + _setAttributeArrayShort(ID, PTARGET, VAL[0][0]) /* global get uint8_t 4D array macro */ #define PLAT_ATTR_GET_UINT8_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeArrayShort(ID, PTARGET, VAL[0][0][0]) /* global set uint8_t 4D array macro */ #define PLAT_ATTR_SET_UINT8_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0][0]) + _setAttributeArrayShort(ID, PTARGET, VAL[0][0][0]) /* global get uint32_t 1D array macro */ #define PLAT_ATTR_GET_UINT32_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL) + _getAttributeArrayWord(ID, PTARGET, VAL) /* global set uint32_t 1D array macro */ #define PLAT_ATTR_SET_UINT32_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL) + _setAttributeArrayWord(ID, PTARGET, VAL) /* global get uint32_t 2D array macro */ #define PLAT_ATTR_GET_UINT32_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL[0]) + _getAttributeArrayWord(ID, PTARGET, VAL[0]) /* global set uint32_t 2D array macro */ #define PLAT_ATTR_SET_UINT32_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL[0]) + _setAttributeArrayWord(ID, PTARGET, VAL[0]) /* global get uint32_t 3D array macro */ #define PLAT_ATTR_GET_UINT32_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeArrayWord(ID, PTARGET, VAL[0][0]) /* global set uint32_t 3D array macro */ #define PLAT_ATTR_SET_UINT32_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0]) + _setAttributeArrayWord(ID, PTARGET, VAL[0][0]) /* global get uint32_t 4D array macro */ #define PLAT_ATTR_GET_UINT32_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeArrayWord(ID, PTARGET, VAL[0][0][0]) /* global set uint32_t 4D array macro */ #define PLAT_ATTR_SET_UINT32_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _setAttributeArrayWord(ID, PTARGET, VAL[0][0][0]) /* global get uint64_t 1D array macro */ #define PLAT_ATTR_GET_UINT64_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL) + _getAttributeArrayDoubleWord(ID, PTARGET, VAL) /* global set uint64_t 1D array macro */ #define PLAT_ATTR_SET_UINT64_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL) + _setAttributeArrayDoubleWord(ID, PTARGET, VAL) /* global get uint64_t 2D array macro */ #define PLAT_ATTR_GET_UINT64_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0]) + _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0]) /* global set uint64_t 2D array macro */ #define PLAT_ATTR_SET_UINT64_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0]) + _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0]) /* global get uint64_t 3D array macro */ #define PLAT_ATTR_GET_UINT64_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0]) /* global set uint64_t 3D array macro */ #define PLAT_ATTR_SET_UINT64_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0]) + _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0]) /* global get uint64_t 4D array macro */ #define PLAT_ATTR_GET_UINT64_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0][0]) /* global set uint64_t 4D array macro */ #define PLAT_ATTR_SET_UINT64_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0][0]) -/* global get int macro (uint8_t, 32 and 64) */ +/* global get int macro (uint8_t, 16, 32 and 64) */ #define PLAT_ATTR_GET_GLOBAL_INT(ID, PTARGET, VAL) \ - fapi2::_get<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \ - (fapi2::ID, PTARGET, VAL) + _get<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetTypes), ID> \ + (ID, PTARGET, VAL) -/* global set int macro (uint8_t, 32 and 64) */ +/* global set int macro (uint8_t, 16, 32 and 64) */ #define PLAT_ATTR_SET_GLOBAL_INT(ID, PTARGET, VAL) \ - fapi2::_set<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \ - (fapi2::ID, PTARGET, VAL) + _set<ID##_Type, static_cast<fapi2:TargetType>(ID##_TargetTypes), ID> \ + (ID, PTARGET, VAL) //here @@ -139,48 +135,48 @@ /******************************************************************************/ /* global get override uint8_t 1D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT8_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL) + _getAttributeOverrideArrayShort(ID, PTARGET, VAL) /* global get override uint8_t 2D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT8_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL[0]) + _getAttributeOverrideArrayShort(ID, PTARGET, VAL[0]) /* global get override uint8_t 3D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT8_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeOverrideArrayShort(ID, PTARGET, VAL[0][0]) /* global get override uint8_t 4D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT8_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeOverrideArrayShort(ID, PTARGET, VAL[0][0][0]) /* global get override uint32_t 1D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT32_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL) + _getAttributeOverrideArrayWord(ID, PTARGET, VAL) /* global get override uint32_t 2D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT32_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL[0]) + _getAttributeOverrideArrayWord(ID, PTARGET, VAL[0]) /* global get override uint32_t 3D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT32_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeOverrideArrayWord(ID, PTARGET, VAL[0][0]) /* global get override uint32_t 4D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT32_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeOverrideArrayWord(ID, PTARGET, VAL[0][0][0]) /* global get override uint64_t 1D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT64_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL) + _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL) /* global get override uint64_t 2D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT64_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL[0]) + _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL[0]) /* global get override uint64_t 3D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT64_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL[0][0]) /* global get override uint64_t 4D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT64_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL[0][0][0]) /* global get override int macro (uint8_t, 32 and 64) */ #define PLAT_ATTR_GET_OVERRIDE_GLOBAL_INT(ID, PTARGET, VAL) \ - fapi2::_getOverride<fapi2::ID##_Type>(fapi2::ID, PTARGET, VAL) + _getOverride<ID##_Type>(ID, PTARGET, VAL) /******************************************************************************/ // Get string @@ -188,11 +184,17 @@ extern "C" { - extern fapi2attr::ProcChipAttributes_t* G_proc_chip_attributes asm("G_proc_chip_attributes") __attribute__ ((section (".fixed"))); - extern fapi2attr::PervAttributes_t* G_perv_attributes asm("G_perv_attributes") __attribute__ ((section (".fixed"))); - extern fapi2attr::CoreAttributes_t* G_core_attributes asm("G_core_attributes") __attribute__ ((section (".fixed"))); - extern fapi2attr::EQAttributes_t* G_eq_attributes asm("G_eq_attributes") __attribute__ ((section (".fixed"))); - extern fapi2attr::EXAttributes_t* G_ex_attributes asm("G_ex_attributes") __attribute__ ((section (".fixed"))); + extern fapi2attr::ProcChipAttributes_t G_proc_chip_attributes asm("G_proc_chip_attributes") __attribute__ ((section (".fixed"))); + extern fapi2attr::PervAttributes_t G_perv_attributes asm("G_perv_attributes") __attribute__ ((section (".fixed"))); + extern fapi2attr::CoreAttributes_t G_core_attributes asm("G_core_attributes") __attribute__ ((section (".fixed"))); + extern fapi2attr::EQAttributes_t G_eq_attributes asm("G_eq_attributes") __attribute__ ((section (".fixed"))); + extern fapi2attr::EXAttributes_t G_ex_attributes asm("G_ex_attributes") __attribute__ ((section (".fixed"))); + + extern fapi2attr::ProcChipAttributes_t* G_proc_chip_attributes_ptr ; + extern fapi2attr::PervAttributes_t* G_perv_attributes_ptr; + extern fapi2attr::CoreAttributes_t* G_core_attributes_ptr; + extern fapi2attr::EQAttributes_t* G_eq_attributes_ptr; + extern fapi2attr::EXAttributes_t* G_ex_attributes_ptr; } @@ -202,11 +204,11 @@ namespace fapi2 // Parameters are done as pointers (vs references) to allow the attribute // storage to be relocated -template<fapi2::TargetType K, typename TAttrStruct, typename TValue, fapi2::AttributeId AId> -void __set( const fapi2::Target<K>* i_ptarget, TAttrStruct* object, const fapi2::AttributeId attrid, TValue* value ); +template<TargetType K, typename TAttrStruct, typename TValue, AttributeId AId> +void __set( const Target<K>& i_ptarget, TAttrStruct* object, const AttributeId attrid, TValue* value ); -template<fapi2::TargetType K, typename TAttrStruct, typename TValue, fapi2::AttributeId AId> -void __get( const fapi2::Target<K>* i_ptarget, TAttrStruct* object, const fapi2::AttributeId attrid, TValue* value ); +template<TargetType K, typename TAttrStruct, typename TValue, AttributeId AId> +void __get( const Target<K>& i_ptarget, TAttrStruct* object, const AttributeId attrid, TValue* value ); /* INSERT NEW GETTER AND SETTER FUNCTIONS HERE */ @@ -218,7 +220,7 @@ void __get( const fapi2::Target<K>* i_ptarget, TAttrStruct* object, const fapi2: //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_Id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, T& o_value) { return FAPI2_RC_SUCCESS; @@ -228,35 +230,73 @@ ReturnCode _get(const AttributeId i_Id, // Get uint8_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> -ReturnCode _get(const fapi2::AttributeId i_id, - const Target<K> * const i_pTarget, +ReturnCode _get(const AttributeId i_id, + const Target<K> & i_pTarget, uint8_t& o_value) { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } + + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Get uint16_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _get(const AttributeId i_id, + const Target<K> & i_pTarget, + uint16_t& o_value) +{ + static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch"); + + if(K & TARGET_TYPE_PROC_CHIP) + { + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_EX) + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -268,34 +308,34 @@ ReturnCode _get(const fapi2::AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t& o_value) { static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -307,7 +347,7 @@ ReturnCode _get(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint64_t& o_value) { static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); @@ -315,27 +355,27 @@ ReturnCode _get(const AttributeId i_id, if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -347,7 +387,7 @@ ReturnCode _get(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t& o_value) { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); @@ -357,11 +397,25 @@ ReturnCode _getOverride(const AttributeId i_id, //****************************************************************************** +// Get Override uint16_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getOverride(const AttributeId i_id, + const Target<K> & i_pTarget, + uint16_t& o_value) +{ + static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch"); + + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** // Get Override uint32_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t& o_value) { static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); @@ -375,7 +429,7 @@ ReturnCode _getOverride(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint64_t& o_value) { static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); @@ -389,7 +443,7 @@ ReturnCode _getOverride(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getEcFeatureOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t& o_value) { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); @@ -408,7 +462,7 @@ ReturnCode _getEcFeatureOverride(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeArrayShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t * o_pValues) { // fapi2::Attributeta o_data; @@ -435,43 +489,65 @@ ReturnCode _getAttributeArrayShort(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _setAttributeArrayShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t * i_pValues) { if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, *i_pValues ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, *i_pValues ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_pValues ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_pValues ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, *i_pValues ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, *i_pValues ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, *i_pValues ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, *i_pValues ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, *i_pValues ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, *i_pValues ); } return FAPI2_RC_SUCCESS; } //****************************************************************************** +// Get uint16_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getAttributeArrayWord(const AttributeId i_id, + const Target<K> & i_pTarget, + uint16_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Set uint16_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _setAttributeArrayWord(const AttributeId i_id, + const Target<K> & i_pTarget, + uint16_t * i_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** // Get uint32_t array //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeArrayWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -482,18 +558,19 @@ ReturnCode _getAttributeArrayWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _setAttributeArrayWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t * i_pValues) { return FAPI2_RC_SUCCESS; } + //****************************************************************************** // Get uint64_t array //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeArrayDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint64_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -504,7 +581,7 @@ ReturnCode _getAttributeArrayDoubleWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _setAttributeArrayDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint64_t * i_pValues) { return FAPI2_RC_SUCCESS; @@ -515,18 +592,29 @@ ReturnCode _setAttributeArrayDoubleWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeOverrideArrayShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t * o_pValues) { return FAPI2_RC_SUCCESS; } //****************************************************************************** +// Get Override uint16_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getAttributeOverrideArrayWord(const AttributeId i_id, + const Target<K> & i_pTarget, + uint16_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** // Get Override uint32_t array //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeOverrideArrayWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -537,7 +625,7 @@ ReturnCode _getAttributeOverrideArrayWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeOverrideArrayDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint64_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -549,7 +637,7 @@ ReturnCode _getAttributeOverrideArrayDoubleWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_Id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, T& i_value) { return FAPI2_RC_SUCCESS; @@ -562,34 +650,34 @@ ReturnCode _set(const AttributeId i_Id, //****************************************************************************** template<typename T, TargetType K, typename A> ReturnCode _set(const AttributeId i_Id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t& i_value) { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; @@ -597,38 +685,76 @@ ReturnCode _set(const AttributeId i_Id, //****************************************************************************** +// Set uint16_t +//****************************************************************************** +template<typename T, TargetType K, typename A> +ReturnCode _set( + const Target<K> & i_pTarget, + uint16_t& i_value) +{ + static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch"); // May need to remove + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + } + + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** // Set uint32_t //****************************************************************************** template<typename T, TargetType K, typename A> ReturnCode _set( - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t& i_value) { static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; @@ -641,34 +767,35 @@ ReturnCode _set( template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_Id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, const uint64_t & i_value) { static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; @@ -680,34 +807,72 @@ ReturnCode _set(const AttributeId i_Id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t& o_value) { static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } + + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Get int16_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _get(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t& o_value) +{ + static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch"); + + if(K & TARGET_TYPE_PROC_CHIP) + { + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_EX) + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -719,34 +884,34 @@ ReturnCode _get(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t& o_value) { static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -758,34 +923,34 @@ ReturnCode _get(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int64_t& o_value) { static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -797,7 +962,7 @@ ReturnCode _get(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t& o_value) { static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); @@ -805,13 +970,25 @@ ReturnCode _getOverride(const AttributeId i_id, return FAPI2_RC_SUCCESS; } +//****************************************************************************** +// Get Override int16_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getOverride(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t& o_value) +{ + static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch"); + + return FAPI2_RC_SUCCESS; +} //****************************************************************************** // Get Override int32_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t& o_value) { static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); @@ -819,13 +996,12 @@ ReturnCode _getOverride(const AttributeId i_id, return FAPI2_RC_SUCCESS; } - //****************************************************************************** // Get Override int64_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int64_t& o_value) { static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); @@ -839,7 +1015,7 @@ ReturnCode _getOverride(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _getAttributeArraySignedShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -851,19 +1027,41 @@ ReturnCode _getAttributeArraySignedShort(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _setAttributeArraySignedShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t * i_pValues) { return FAPI2_RC_SUCCESS; } +//****************************************************************************** +// Get int16_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _getAttributeArraySignedWord(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Set int16_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _setAttributeArraySignedWord(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t * i_pValues) +{ + return FAPI2_RC_SUCCESS; +} //****************************************************************************** // Get int32_t array //****************************************************************************** template<TargetType K> ReturnCode _getAttributeArraySignedWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -875,7 +1073,7 @@ ReturnCode _getAttributeArraySignedWord(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _setAttributeArraySignedWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t * i_pValues) { return FAPI2_RC_SUCCESS; @@ -887,7 +1085,7 @@ ReturnCode _setAttributeArraySignedWord(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _getAttributeArraySignedDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int64_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -898,7 +1096,7 @@ ReturnCode _getAttributeArraySignedDoubleWord(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _setAttributeArraySignedDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int64_t * i_pValues) { return FAPI2_RC_SUCCESS; @@ -909,19 +1107,29 @@ ReturnCode _setAttributeArraySignedDoubleWord(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _getAttributeOverrideArraySignedShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t * o_pValues) { return FAPI2_RC_SUCCESS; } +//****************************************************************************** +// Get Override int16_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _getAttributeOverrideArraySignedWord(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} //****************************************************************************** // Get Override int32_t array //****************************************************************************** template<TargetType K> ReturnCode _getAttributeOverrideArraySignedWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -933,7 +1141,7 @@ ReturnCode _getAttributeOverrideArraySignedWord(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _getAttributeOverrideArraySignedDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int64_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -945,73 +1153,110 @@ ReturnCode _getAttributeOverrideArraySignedDoubleWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t& i_value) { static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; } +//****************************************************************************** +// Set int16_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t& i_value) +{ + static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch"); // May need to remove + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + } + + return FAPI2_RC_SUCCESS; +} //****************************************************************************** // Set int32_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t& i_value) { static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; @@ -1023,34 +1268,34 @@ ReturnCode _set(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, const int64_t & i_value) { static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; |