diff options
Diffstat (limited to 'src/hwpf')
-rw-r--r-- | src/hwpf/include/fapi2_attribute_service.H (renamed from src/hwpf/include/fapi2AttributeService.H) | 9 | ||||
-rw-r--r-- | src/hwpf/include/plat/hw_access.H (renamed from src/hwpf/include/hw_access.H) | 3 | ||||
-rw-r--r-- | src/hwpf/include/plat/plat_attributes.H | 5 | ||||
-rw-r--r-- | src/hwpf/src/plat/plat_attribute_service.H | 1416 | ||||
-rw-r--r-- | src/hwpf/src/plat/plat_utils.C | 98 | ||||
-rw-r--r-- | src/hwpf/src/plat_ring_traverse.C | 44 |
6 files changed, 1446 insertions, 129 deletions
diff --git a/src/hwpf/include/fapi2AttributeService.H b/src/hwpf/include/fapi2_attribute_service.H index 6b0300c7..b1c7a668 100644 --- a/src/hwpf/include/fapi2AttributeService.H +++ b/src/hwpf/include/fapi2_attribute_service.H @@ -1,12 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/hwpf/include/fapi2AttributeService.H $ */ +/* $Source: src/hwpf/include/fapi2_attribute_service.H $ */ /* */ /* OpenPOWER sbe Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2016 */ -/* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -33,12 +32,10 @@ #ifndef FAPI2ATTRIBUTESERVICE_H_ #define FAPI2ATTRIBUTESERVICE_H_ #include <stdint.h> -//#include <attribute_ids.H> -#include <fapi2AttributeIds.H> +#include <attribute_ids.H> #include <target.H> #include <target_types.H> -//#include <plat_attribute_service.H> -#include <fapi2PlatAttributeService.H> +#include <plat_attribute_service.H> /// @brief Macros called by user to get/set attributes for FAPI2 targets /// diff --git a/src/hwpf/include/hw_access.H b/src/hwpf/include/plat/hw_access.H index 0501970c..24f826a3 100644 --- a/src/hwpf/include/hw_access.H +++ b/src/hwpf/include/plat/hw_access.H @@ -1,12 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/hwpf/include/hw_access.H $ */ +/* $Source: src/hwpf/include/plat/hw_access.H $ */ /* */ /* OpenPOWER sbe Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2012,2016 */ -/* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ diff --git a/src/hwpf/include/plat/plat_attributes.H b/src/hwpf/include/plat/plat_attributes.H index e89062d3..781cbd56 100644 --- a/src/hwpf/include/plat/plat_attributes.H +++ b/src/hwpf/include/plat/plat_attributes.H @@ -30,8 +30,7 @@ #ifndef __PLAT_ATTTRIBUTE_H__ #define __PLAT_ATTTRIBUTE_H__ -#include <fapi2AttributeService.H> -#include <fapi2AttributeIds.H> // Generated file -//#include <plat_target_pg_attributes.H> +#include <fapi2_attribute_service.H> +#include <attribute_ids.H> // Generated file #endif // __PLAT_ATTTRIBUTE_H__ diff --git a/src/hwpf/src/plat/plat_attribute_service.H b/src/hwpf/src/plat/plat_attribute_service.H new file mode 100644 index 00000000..9e2a26a2 --- /dev/null +++ b/src/hwpf/src/plat/plat_attribute_service.H @@ -0,0 +1,1416 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/hwpf/src/plat/plat_attribute_service.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* */ +/* */ +/* 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 fapiPlatAttributeService.H + * + * @brief Defines the PLAT attribute access macros and defines which macro + * handles each attribute. + * + */ + + +#ifndef FAPI2PLATATTRIBUTESERVICE_H_ +#define FAPI2PLATATTRIBUTESERVICE_H_ + +#include <stdint.h> +#include <stddef.h> +#include <type_traits> +#include <attribute_ids.H> +#include <fapi2_chip_ec_feature.H> +#include <plat_includes.H> +#include "proc_sbe_fixed.H" +#include "plat_target_parms.H" + +#define PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) \ + _getEcFeatureOverride<ID##_Type>(ID, PTARGET, VAL) + +/* INSERT NEW ATTRIBUTES HERE */ + + +/******************************************************************************/ +/* * Global macros * */ +/* These macros are called by the macros above to invoke the appropriate API. */ +/* These macros do not need to change when a new attribute is introduced. */ +/******************************************************************************/ + +/* global get uint8_t 1D array macro */ +#define PLAT_ATTR_GET_UINT8_1D_ARRAY(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) \ + _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) \ + _getAttributeArrayShort(ID, PTARGET, VAL[0]) +/* global set uint8_t 2D array macro */ +#define PLAT_ATTR_SET_UINT8_2D_ARRAY(ID, PTARGET, VAL) \ + _setAttributeArrayShort(ID, PTARGET, VAL[0]) + +/* global get uint8_t 3D array macro */ +#define PLAT_ATTR_GET_UINT8_3D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeArrayShort(ID, PTARGET, VAL[0][0]) +/* global set uint8_t 3D array macro */ +#define PLAT_ATTR_SET_UINT8_3D_ARRAY(ID, PTARGET, VAL) \ + _setAttributeArrayShort(ID, PTARGET, VAL[0][0]) + +/* global get uint8_t 4D array macro */ +#define PLAT_ATTR_GET_UINT8_4D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeArrayShort(ID, PTARGET, VAL[0][0][0]) +/* global set uint8_t 4D array macro */ +#define PLAT_ATTR_SET_UINT8_4D_ARRAY(ID, PTARGET, VAL) \ + _setAttributeArrayShort(ID, PTARGET, VAL[0][0][0]) + +/* global get uint32_t 1D array macro */ +#define PLAT_ATTR_GET_UINT32_1D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeArrayWord(ID, PTARGET, VAL) +/* global set uint32_t 1D array macro */ +#define PLAT_ATTR_SET_UINT32_1D_ARRAY(ID, PTARGET, VAL) \ + _setAttributeArrayWord(ID, PTARGET, VAL) + +/* global get uint32_t 2D array macro */ +#define PLAT_ATTR_GET_UINT32_2D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeArrayWord(ID, PTARGET, VAL[0]) +/* global set uint32_t 2D array macro */ +#define PLAT_ATTR_SET_UINT32_2D_ARRAY(ID, PTARGET, VAL) \ + _setAttributeArrayWord(ID, PTARGET, VAL[0]) + +/* global get uint32_t 3D array macro */ +#define PLAT_ATTR_GET_UINT32_3D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeArrayWord(ID, PTARGET, VAL[0][0]) +/* global set uint32_t 3D array macro */ +#define PLAT_ATTR_SET_UINT32_3D_ARRAY(ID, PTARGET, VAL) \ + _setAttributeArrayWord(ID, PTARGET, VAL[0][0]) + +/* global get uint32_t 4D array macro */ +#define PLAT_ATTR_GET_UINT32_4D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeArrayWord(ID, PTARGET, VAL[0][0][0]) +/* global set uint32_t 4D array macro */ +#define PLAT_ATTR_SET_UINT32_4D_ARRAY(ID, PTARGET, VAL) \ + _setAttributeArrayWord(ID, PTARGET, VAL[0][0][0]) + + +/* global get uint64_t 1D array macro */ +#define PLAT_ATTR_GET_UINT64_1D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeArrayDoubleWord(ID, PTARGET, VAL) +/* global set uint64_t 1D array macro */ +#define PLAT_ATTR_SET_UINT64_1D_ARRAY(ID, PTARGET, VAL) \ + _setAttributeArrayDoubleWord(ID, PTARGET, VAL) + +/* global get uint64_t 2D array macro */ +#define PLAT_ATTR_GET_UINT64_2D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0]) +/* global set uint64_t 2D array macro */ +#define PLAT_ATTR_SET_UINT64_2D_ARRAY(ID, PTARGET, VAL) \ + _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0]) + +/* global get uint64_t 3D array macro */ +#define PLAT_ATTR_GET_UINT64_3D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0]) +/* global set uint64_t 3D array macro */ +#define PLAT_ATTR_SET_UINT64_3D_ARRAY(ID, PTARGET, VAL) \ + _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0]) + +/* global get uint64_t 4D array macro */ +#define PLAT_ATTR_GET_UINT64_4D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0][0]) +/* global set uint64_t 4D array macro */ +#define PLAT_ATTR_SET_UINT64_4D_ARRAY(ID, PTARGET, VAL) \ + _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0][0]) + +/* global get int macro (uint8_t, 16, 32 and 64) */ +#define PLAT_ATTR_GET_GLOBAL_INT(ID, PTARGET, VAL) \ + _get<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetTypes), ID> \ + (ID, PTARGET, VAL) + +/* global set int macro (uint8_t, 16, 32 and 64) */ +#define PLAT_ATTR_SET_GLOBAL_INT(ID, PTARGET, VAL) \ + _set<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetTypes), ID> \ + (ID, PTARGET, VAL) + + +//here + +/******************************************************************************/ +// Get Override Macros +/******************************************************************************/ +/* global get override uint8_t 1D array macro */ +#define PLAT_ATTR_GET_OVERRIDE_UINT8_1D_ARRAY(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) \ + _getAttributeOverrideArrayShort(ID, PTARGET, VAL[0]) +/* global get override uint8_t 3D array macro */ +#define PLAT_ATTR_GET_OVERRIDE_UINT8_3D_ARRAY(ID, PTARGET, VAL) \ + _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) \ + _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) \ + _getAttributeOverrideArrayWord(ID, PTARGET, VAL) +/* global get override uint32_t 2D array macro */ +#define PLAT_ATTR_GET_OVERRIDE_UINT32_2D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeOverrideArrayWord(ID, PTARGET, VAL[0]) +/* global get override uint32_t 3D array macro */ +#define PLAT_ATTR_GET_OVERRIDE_UINT32_3D_ARRAY(ID, PTARGET, VAL) \ + _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) \ + _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) \ + _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL) +/* global get override uint64_t 2D array macro */ +#define PLAT_ATTR_GET_OVERRIDE_UINT64_2D_ARRAY(ID, PTARGET, VAL) \ + _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL[0]) +/* global get override uint64_t 3D array macro */ +#define PLAT_ATTR_GET_OVERRIDE_UINT64_3D_ARRAY(ID, PTARGET, VAL) \ + _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) \ + _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) \ + _getOverride<ID##_Type>(ID, PTARGET, VAL) + +/******************************************************************************/ +// Get string +/******************************************************************************/ + +extern "C" +{ + extern fapi2attr::SystemAttributes_t G_system_attributes asm("G_system_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::SystemAttributes_t* G_system_attributes_ptr; + 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; + +} + +namespace fapi2 +{ + + +// Parameters are done as pointers (vs references) to allow the attribute +// storage to be relocated +template<TargetType K, typename TAttrStruct, typename TValue, AttributeId AId> +void __set( const Target<K>& i_ptarget, TAttrStruct* object, const AttributeId attrid, const TValue& value ); + +template<TargetType K, typename TAttrStruct, typename TValue, AttributeId AId> +void __get( const Target<K>& i_ptarget, const TAttrStruct* object, const AttributeId attrid, TValue* value ); + + +/* INSERT NEW GETTER AND SETTER FUNCTIONS HERE */ + + + +//****************************************************************************** +// Get base template +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _get(const AttributeId i_id, + const Target<K> & i_pTarget, + T& o_value) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Get uint8_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +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_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + + 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; +} + +//****************************************************************************** +// 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_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + + 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; +} + + +//****************************************************************************** +// Get uint32_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _get(const AttributeId i_id, + 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_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + + 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; +} + + +//****************************************************************************** +// Get uint64_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _get(const AttributeId i_id, + const Target<K> & i_pTarget, + uint64_t& o_value) +{ + static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); + + if(K & TARGET_TYPE_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + + 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; +} + + +//****************************************************************************** +// Get Override uint8_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getOverride(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"); + + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// 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> & i_pTarget, + uint32_t& o_value) +{ + static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); + + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Get Override uint64_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getOverride(const AttributeId i_id, + const Target<K> & i_pTarget, + uint64_t& o_value) +{ + static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); + + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Get override EC Feature (uint8_t) +//****************************************************************************** +template<typename T, TargetType K> +ReturnCode _getEcFeatureOverride(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"); + + // The way this is implemented, we want to return a non-zero return code if we found an override. + // Return 0 if there was an error. + // This is how it's implemented: + // PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) ? fapi::FAPI_RC_SUCCESS : fapi::fapiQueryChipEcFeature(fapi::ID, PTARGET, VAL) + + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Get uint8_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getAttributeArrayShort(const AttributeId i_id, + const Target<K> & i_pTarget, + uint8_t * o_pValues) +{ +// fapi2::Attributeta o_data; +// fapi2::ReturnCode l_fapi_rc(FAPI2_RC_SUCCESS); +// uint32_t l_ecmd_rc = ECMD_SUCCESS; +// +// ecmdChipTarget l_ecmd_target; +// fapiTargetPointerToEcmdTarget(i_pTarget, l_ecmd_target); +// +// o_data.faValidMask = FAPI_ATTRIBUTE_TYPE_UINT8ARY; +// o_data.faUint8ary = o_pValues; +// +// l_ecmd_rc = fapi2GetAttribute(l_ecmd_target, i_id, o_data); +// if (l_ecmd_rc) +// { +// l_fapi_rc = (ReturnCodes) l_ecmd_rc; +// } +// return l_fapi_rc; + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Set uint8_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _setAttributeArrayShort(const AttributeId i_id, + const Target<K> & i_pTarget, + uint8_t * i_pValues) +{ + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, *i_pValues ); + } + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::ProcChipAttributes_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_ptr, *i_pValues ); + } + + if(K & TARGET_TYPE_CORE) + { + __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_ptr, *i_pValues ); + } + + if(K & TARGET_TYPE_EX) + { + __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> & i_pTarget, + uint32_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Set uint32_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _setAttributeArrayWord(const AttributeId i_id, + 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> & i_pTarget, + uint64_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Set uint64_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _setAttributeArrayDoubleWord(const AttributeId i_id, + const Target<K> & i_pTarget, + uint64_t * i_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Get Override uint8_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getAttributeOverrideArrayShort(const AttributeId i_id, + 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> & i_pTarget, + uint32_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Get Override uint64_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getAttributeOverrideArrayDoubleWord(const AttributeId i_id, + const Target<K> & i_pTarget, + uint64_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Set base template +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, + const Target<K> & i_pTarget, + const T& i_value) +{ + return FAPI2_RC_SUCCESS; +} + + + +//****************************************************************************** +// Set uint8_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, + const Target<K> & i_pTarget, + const uint8_t& i_value) +{ + static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); // May need to remove + + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); + } + + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Set uint16_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, + const Target<K> & i_pTarget, + const uint16_t& i_value) +{ + static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch"); // May need to remove + + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); + } + + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Set uint32_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, + const Target<K> & i_pTarget, + const uint32_t& i_value) +{ + static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); // May need to remove + + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id,i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); + } + + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Set uint64_t +//****************************************************************************** + +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, + 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_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); + } + + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Get int8_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _get(const AttributeId i_id, + 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_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + + 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; +} + +//****************************************************************************** +// 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_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + + 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; +} + + +//****************************************************************************** +// Get int32_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _get(const AttributeId i_id, + 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_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + + 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; +} + + +//****************************************************************************** +// Get int64_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _get(const AttributeId i_id, + 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_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + + 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; +} + + +//****************************************************************************** +// Get Override int8_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getOverride(const AttributeId i_id, + const Target<K> & i_pTarget, + int8_t& o_value) +{ + static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); + + 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> & i_pTarget, + int32_t& o_value) +{ + static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); + + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Get Override int64_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getOverride(const AttributeId i_id, + const Target<K> & i_pTarget, + int64_t& o_value) +{ + static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); + + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Get int8_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _getAttributeArraySignedShort(const AttributeId i_id, + const Target<K> & i_pTarget, + int8_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Set int8_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _setAttributeArraySignedShort(const AttributeId i_id, + 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> & i_pTarget, + int32_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Set int32_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _setAttributeArraySignedWord(const AttributeId i_id, + const Target<K> & i_pTarget, + int32_t * i_pValues) +{ + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Get int64_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _getAttributeArraySignedDoubleWord(const AttributeId i_id, + const Target<K> & i_pTarget, + int64_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Set int64_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _setAttributeArraySignedDoubleWord(const AttributeId i_id, + const Target<K> & i_pTarget, + int64_t * i_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Get Override int8_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _getAttributeOverrideArraySignedShort(const AttributeId i_id, + 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> & i_pTarget, + int32_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Get Override int64_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _getAttributeOverrideArraySignedDoubleWord(const AttributeId i_id, + const Target<K> & i_pTarget, + int64_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Set int8_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, + const Target<K> & i_pTarget, + const int8_t& i_value) +{ + static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); // May need to remove + + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, 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, + const int16_t& i_value) +{ + static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch"); // May need to remove + + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, 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> & i_pTarget, + const int32_t& i_value) +{ + static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); // May need to remove + + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); + } + + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Set int64_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, + 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_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); + } + + return FAPI2_RC_SUCCESS; +} + + +} // namespace fapi2 +#endif // FAPIPLATATTRIBUTESERVICE_H_ diff --git a/src/hwpf/src/plat/plat_utils.C b/src/hwpf/src/plat/plat_utils.C index 93a0cb2f..f9bbea9a 100644 --- a/src/hwpf/src/plat/plat_utils.C +++ b/src/hwpf/src/plat/plat_utils.C @@ -29,109 +29,15 @@ */ #include <stdint.h> -#include <fapi2AttributeService.H> -#include <fapi2AttributeIds.H> +#include <fapi2_attribute_service.H> +#include <attribute_ids.H> #include <return_code.H> #include <plat_trace.H> #include <target.H> -#ifndef __PPE__ -#include <error_info.H> -#endif - namespace fapi2 { -#ifndef __PPE__ - /// - /// @brief Log an error. - /// - void logError( - fapi2::ReturnCode & io_rc, - fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE, - bool i_unitTestError = false ) - { - // To keep the compiler from complaing about i_sevbeing unused. - static_cast<void>(i_sev); - static_cast<void>(i_unitTestError); - - FAPI_DBG("logging 0x%lx.", uint64_t(io_rc)); - - // Iterate over the vectors and output what is in them. - const ErrorInfo* ei = io_rc.getErrorInfo(); - - FAPI_DBG("ffdcs: %lu", ei->iv_ffdcs.size()); - for( auto i = ei->iv_ffdcs.begin(); i != ei->iv_ffdcs.end(); ++i ) - { - uint32_t sz; - (*i)->getData(sz); - FAPI_DBG("\tid: 0x%x size %d", (*i)->getFfdcId(), sz); - } - - FAPI_DBG("hwCallouts: %lu", ei->iv_hwCallouts.size()); - for( auto i = ei->iv_hwCallouts.begin(); i != ei->iv_hwCallouts.end(); - ++i ) - { - FAPI_DBG("\thw: %d pri %d target: 0x%lx", - (*i)->iv_hw, (*i)->iv_calloutPriority, - (*i)->iv_refTarget.get()); - } - - FAPI_DBG("procedureCallouts: %lu", ei->iv_procedureCallouts.size()); - for( auto i = ei->iv_procedureCallouts.begin(); - i != ei->iv_procedureCallouts.end(); ++i ) - { - FAPI_DBG("\tprocedure: %d pri %d", - (*i)->iv_procedure, (*i)->iv_calloutPriority); - } - -e FAPI_DBG("busCallouts: %lu", ei->iv_busCallouts.size()); - for( auto i = ei->iv_busCallouts.begin(); i != ei->iv_busCallouts.end(); - ++i ) - { - FAPI_DBG("\tbus: t1: 0x%lx t2: 0x%lx pri: %d", - (*i)->iv_target1.get(), (*i)->iv_target2.get(), - (*i)->iv_calloutPriority); - } - - - FAPI_DBG("cdgs: %lu", ei->iv_CDGs.size()); - for( auto i = ei->iv_CDGs.begin(); i != ei->iv_CDGs.end(); ++i ) - { - FAPI_DBG("\ttarget: 0x%lx co: %d dc: %d gard: %d pri: %d", - (*i)->iv_target.get(), - (*i)->iv_callout, - (*i)->iv_deconfigure, - (*i)->iv_gard, - (*i)->iv_calloutPriority); - - } - - FAPI_DBG("childrenCDGs: %lu", ei->iv_childrenCDGs.size()); - for( auto i = ei->iv_childrenCDGs.begin(); - i != ei->iv_childrenCDGs.end(); ++i ) - { - FAPI_DBG("\tchildren: parent 0x%lx co: %d dc: %d gard: %d pri: %d", - (*i)->iv_parent.get(), - (*i)->iv_callout, - (*i)->iv_deconfigure, - (*i)->iv_gard, - (*i)->iv_calloutPriority); - } - - FAPI_DBG("traces: %lu", ei->iv_traces.size()); - for( auto i = ei->iv_traces.begin(); i != ei->iv_traces.end(); ++i ) - { - FAPI_DBG("\ttraces: 0x%x", (*i)->iv_eiTraceId); - } - - // Release the ffdc information now that we're done with it. - io_rc.forgetData(); - - } -#endif - - /// /// @brief Delay this thread. /// ReturnCode delay(uint64_t i_nanoSeconds, uint64_t i_simCycles, bool i_fixed /* = false*/) diff --git a/src/hwpf/src/plat_ring_traverse.C b/src/hwpf/src/plat_ring_traverse.C index 42dab1b2..86c6515d 100644 --- a/src/hwpf/src/plat_ring_traverse.C +++ b/src/hwpf/src/plat_ring_traverse.C @@ -27,7 +27,7 @@ #include <p9_putRingUtils.H> // for RS4 decompression utilities #include <sbeXipUtils.H> -#include <fapi2AttributeService.H> // for FAPI_ATTR_GET +#include <fapi2_attribute_service.H> // for FAPI_ATTR_GET #include <plat_target_utils.H> // for plat_getChipTarget // SEEPROM start address @@ -64,7 +64,7 @@ fapi2::ReturnCode findRS4InImageAndApply( // Get the address of the Section-TOR P9XipHeader *l_hdr = getXipHdr(); - P9XipSection *l_section = + P9XipSection *l_section = &(l_hdr->iv_section[P9_XIP_SECTION_SBE_RINGS]); if (!(l_section->iv_offset)) @@ -73,7 +73,7 @@ fapi2::ReturnCode findRS4InImageAndApply( break; } - SectionTOR *l_sectionTOR = (SectionTOR *)(g_seepromAddr + + SectionTOR *l_sectionTOR = (SectionTOR *)(g_seepromAddr + l_section->iv_offset); l_rc = getRS4ImageFromTor(i_target,i_ringID,l_sectionTOR, @@ -89,7 +89,7 @@ fapi2::ReturnCode findRS4InImageAndApply( //Apply scanring from .ring section l_applyOverride = true; l_section = NULL; - l_section = + l_section = &(l_hdr->iv_section[P9_XIP_SECTION_SBE_OVERRIDES]); if (!(l_section->iv_offset)) @@ -99,7 +99,7 @@ fapi2::ReturnCode findRS4InImageAndApply( } l_sectionTOR = NULL; - l_sectionTOR = (SectionTOR *)(g_seepromAddr + + l_sectionTOR = (SectionTOR *)(g_seepromAddr + l_section->iv_offset); @@ -149,10 +149,10 @@ fapi2::ReturnCode getRS4ImageFromTor( { case PERV_TYPE: // PERV l_chipletData = PERV::g_pervData; - l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : - (sizeof(PERV::RingVariants) / + l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : + (sizeof(PERV::RingVariants) / sizeof(l_cpltRingVariantSz)); - + l_sectionOffset = i_sectionTOR->TOC_PERV_COMMON_RING; if(INSTANCE_RING == l_ringType) { @@ -164,7 +164,7 @@ fapi2::ReturnCode getRS4ImageFromTor( case N0_TYPE: // Nest - N0 l_chipletData = N0::g_n0Data; l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : - (sizeof(N0::RingVariants) / + (sizeof(N0::RingVariants) / sizeof(l_cpltRingVariantSz)); l_sectionOffset = i_sectionTOR->TOC_N0_COMMON_RING; @@ -206,7 +206,7 @@ fapi2::ReturnCode getRS4ImageFromTor( case N3_TYPE: // Nest - N3 l_chipletData = N3::g_n3Data; l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : - (sizeof(N3::RingVariants) / + (sizeof(N3::RingVariants) / sizeof(l_cpltRingVariantSz)); l_sectionOffset = i_sectionTOR->TOC_N3_COMMON_RING; @@ -234,7 +234,7 @@ fapi2::ReturnCode getRS4ImageFromTor( case MC_TYPE: // MC - MC23 l_chipletData = MC::g_mcData; l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : - (sizeof(MC::RingVariants)/ + (sizeof(MC::RingVariants)/ sizeof(l_cpltRingVariantSz)); l_sectionOffset = i_sectionTOR->TOC_MC_COMMON_RING; @@ -248,7 +248,7 @@ fapi2::ReturnCode getRS4ImageFromTor( case OB0_TYPE: // OB0 l_chipletData = OB0::g_ob0Data; l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : - (sizeof(OB0::RingVariants) / + (sizeof(OB0::RingVariants) / sizeof(l_cpltRingVariantSz)); l_sectionOffset = i_sectionTOR->TOC_OB0_COMMON_RING; @@ -261,7 +261,7 @@ fapi2::ReturnCode getRS4ImageFromTor( case OB1_TYPE: // OB1 l_chipletData = OB1::g_ob1Data; l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : - (sizeof(OB1::RingVariants) / + (sizeof(OB1::RingVariants) / sizeof(l_cpltRingVariantSz)); l_sectionOffset = i_sectionTOR->TOC_OB1_COMMON_RING; @@ -274,7 +274,7 @@ fapi2::ReturnCode getRS4ImageFromTor( case OB2_TYPE: // OB2 l_chipletData = OB2::g_ob2Data; l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : - (sizeof(OB2::RingVariants) / + (sizeof(OB2::RingVariants) / sizeof(l_cpltRingVariantSz)); l_sectionOffset = i_sectionTOR->TOC_OB2_COMMON_RING; @@ -287,7 +287,7 @@ fapi2::ReturnCode getRS4ImageFromTor( case OB3_TYPE: // OB3 l_chipletData = OB3::g_ob3Data; l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : - (sizeof(OB3::RingVariants) / + (sizeof(OB3::RingVariants) / sizeof(l_cpltRingVariantSz)); l_sectionOffset = i_sectionTOR->TOC_OB3_COMMON_RING; @@ -316,7 +316,7 @@ fapi2::ReturnCode getRS4ImageFromTor( case PCI1_TYPE: // PCI - PCI1 l_chipletData = PCI1::g_pci1Data; l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : - (sizeof(PCI1::RingVariants) / + (sizeof(PCI1::RingVariants) / sizeof(l_cpltRingVariantSz)); l_sectionOffset = i_sectionTOR->TOC_PCI1_COMMON_RING; @@ -330,7 +330,7 @@ fapi2::ReturnCode getRS4ImageFromTor( case PCI2_TYPE: // PCI - PCI2 l_chipletData = PCI2::g_pci2Data; l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : - (sizeof(PCI2::RingVariants) / + (sizeof(PCI2::RingVariants) / sizeof(l_cpltRingVariantSz)); l_sectionOffset = i_sectionTOR->TOC_PCI2_COMMON_RING; @@ -344,7 +344,7 @@ fapi2::ReturnCode getRS4ImageFromTor( case EQ_TYPE: // EQ - Quad 0 - Quad 5 l_chipletData = EQ::g_eqData; l_cpltRingVariantSz = i_applyOverride ? OVERRIDE_VARIANT_SIZE : - ( sizeof(EQ::RingVariants) / + ( sizeof(EQ::RingVariants) / sizeof(l_cpltRingVariantSz)); l_sectionOffset = i_sectionTOR->TOC_EQ_COMMON_RING; @@ -383,7 +383,7 @@ fapi2::ReturnCode getRS4ImageFromTor( FAPI_INF("l_sectionOffset %08x",l_sectionOffset); // Determine the section TOR address for the ring - uint32_t *l_sectionAddr = reinterpret_cast<uint32_t *>(g_seepromAddr + + uint32_t *l_sectionAddr = reinterpret_cast<uint32_t *>(g_seepromAddr + i_sectionOffset + l_sectionOffset); SBE_TRACE ("l_sectionAddr %08X",l_sectionAddr); @@ -395,7 +395,7 @@ fapi2::ReturnCode getRS4ImageFromTor( { uint8_t l_chipletOffset = (l_chipletID - l_chipletData.iv_base_chiplet_number); - l_sectionAddr += (l_chipletOffset * + l_sectionAddr += (l_chipletOffset * (l_chipletData.iv_num_instance_rings )); } } @@ -408,8 +408,8 @@ fapi2::ReturnCode getRS4ImageFromTor( SBE_TRACE ("l_sectionAddr %08X",l_sectionAddr); // TOR records of Ring TOR are 2 bytes in size. - uint16_t *l_ringTorAddr = reinterpret_cast<uint16_t *>(l_sectionAddr) + - (l_torOffset * l_cpltRingVariantSz); + uint16_t *l_ringTorAddr = reinterpret_cast<uint16_t *>(l_sectionAddr) + + (l_torOffset * l_cpltRingVariantSz); SBE_TRACE ("ring tor address %04X\n",l_ringTorAddr); // If there are non-base variants of the ring, we'll have to check |