diff options
author | Greg Still <stillgs@us.ibm.com> | 2015-10-13 20:54:36 -0500 |
---|---|---|
committer | Martin Peschke <mpeschke@de.ibm.com> | 2015-10-21 07:20:47 -0500 |
commit | 82fc55596dd107514bc3dea1b8be3c23b653c76a (patch) | |
tree | 7375f72411c9ff16775d145ce7ea727fbde46806 /hwpf/include | |
parent | 43aaa85b59ba06dce6e0f7063234235384e31135 (diff) | |
download | talos-sbe-82fc55596dd107514bc3dea1b8be3c23b653c76a.tar.gz talos-sbe-82fc55596dd107514bc3dea1b8be3c23b653c76a.zip |
Rearrange PPE FAPI2 directory structure to be more in-line with HWPF
- Move files into new structure
- Delete old, obsolete files and directories
- Pre-import mirror of HWPF into importtemp
- No additional function
Change-Id: Iadad6eb05349f807acea362ec77d7f58273878b5
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/21150
Tested-by: Jenkins Server
Reviewed-by: Santosh S. Puranik <santosh.puranik@in.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Reviewed-by: Martin Peschke <mpeschke@de.ibm.com>
Diffstat (limited to 'hwpf/include')
36 files changed, 8305 insertions, 0 deletions
diff --git a/hwpf/include/array.H b/hwpf/include/array.H new file mode 100644 index 00000000..1b976f2b --- /dev/null +++ b/hwpf/include/array.H @@ -0,0 +1,174 @@ +/* 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 array.H + * @brief definitions for fapi2 arrays + */ + +#ifndef __FAPI2_ARRAY__ +#define __FAPI2_ARRAY__ + +#include <stdint.h> +#include <utility> +#include <assert.h> +#include <string.h> + +namespace fapi2 +{ + /// + /// @brief Class representing a FAPI2 array + /// FAPI2 arrays are defined to be very lightweight but support + /// c++ container operations (iterators, bounds checking, assignment, etc.) + /// To avoid the code-bloat associated with std::vector templates, + /// fapi2::array is presently limited to 64-bit elements. + /// + /// To construct an array, you can either pass in an existing chunk + /// of memory, or let the container allocate memory for you: + /// fapi2::array foo(3, &PIB_MEM_BLOCK); + /// creates an array 3 x uit64_t in size, located at &PIB_MEM_BLOCK. + /// The memory pointed to by the address passed in is untouched + /// during creation. This allows for a light-weight overlay on top + /// of existing memory. It also means you need to initialize the space + /// yourself. + /// fapi2_array foo(3); + /// creates an array 3 x uint64_t in size, and that memory will be + /// allocated by the constructor and initiaized to 0's. + /// + /// + class array + { + public: + + typedef uint64_t element_type; + typedef element_type* iterator; + typedef const element_type* const_iterator; + + /// + /// @brief Create an array + /// @param[in] the size of the array + /// @param[in] a pointer to memory of appropriate size + /// defaults to nullptr which causes the platform to + /// allocate memory of size * element_type + /// @warning fapi2::arrays, like arrays, can not be re-sized after + /// creation. + /// + array(const uint32_t i_size, element_type* i_data = nullptr); + + /// + /// @brief Destroy an array + /// + ~array(void); + + /// + /// @brief operator[] + /// @param[in] the index of the element + /// @return a reference to the element in question. + /// @note array[0] = 0 works as well as foo = array[0] + /// + element_type& operator[](const uint32_t i_index); + + /// + /// @brief operator=() + /// @param[in] the other array + /// @return a reference to this, after the assignement + /// + array& operator=(const array& i_other); + + /// + /// @brief move operator=() + /// @note To use: new_array = std::move(old_array). old_array will be + /// destroyed and no copy will be made (moved) + /// + array& operator=(array&& i_other); + + /// + /// @brief operator==() + /// + bool operator==(const array& i_other); + + /// + /// @brief operator!=() + /// + __attribute__ ((always_inline)) + bool operator!=(const array& i_other) + { return ! operator==(i_other); } + + /// + /// @brief Return an iterator the to beginning of the array + /// @return An iterator to the beginning of the array + /// + __attribute__ ((always_inline)) + iterator begin(void) + { return iv_data; } + + /// + /// @brief Return an iterator the to end of the array + /// @return An iterator to the end of the array + /// + __attribute__ ((always_inline)) + iterator end(void) + { return iv_data + size(); } + + /// + /// @brief Return a const_iterator the to beginning of the array + /// @return A const_iterator to the beginning of the array + /// + __attribute__ ((always_inline)) + const_iterator begin(void) const + { return iv_data; } + + /// + /// @brief Return a const_iterator the to end of the array + /// @return A const_iterator to the end the array + /// + __attribute__ ((always_inline)) + const_iterator end(void) const + { return iv_data + size(); } + + private: + + enum + { + // Bit in iv_size representing whether we delete in the dtor + delete_bit = 0x80000000, + + // The resulting size limit + size_limit = 0x7FFFFFFF, + }; + + __attribute__ ((always_inline)) + uint32_t size(void) + { return (iv_size & ~delete_bit); } + + __attribute__ ((always_inline)) + uint32_t size(void) const + { return (iv_size & ~delete_bit); } + + uint32_t iv_size; + element_type* iv_data; + }; +} + +#endif diff --git a/hwpf/include/buffer_traits.H b/hwpf/include/buffer_traits.H new file mode 100644 index 00000000..7cab81ff --- /dev/null +++ b/hwpf/include/buffer_traits.H @@ -0,0 +1,242 @@ +/* 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 buffer_traits.H + * @brief trait definitions for fapi2 buffer base class + */ + +#ifndef __FAPI2_BUFFER_TRAITS__ +#define __FAPI2_BUFFER_TRAITS__ + +#include <stdint.h> +#include <vector> +#include <algorithm> +#include <buffer_parameters.H> + +#ifdef FAPI2_DEBUG +#include <iostream> +#endif + +#if !defined(DOXYGEN) && defined(FAPI2_DEBUG) +#include <iterator> +#endif + +namespace fapi2 +{ + /// @cond + /// Types representing a container of bits. Used to create + /// variable_buffer. container_unit must remain 32-bits + /// for now - there will be a lot of code to change if it + /// changes. There are assertions helping to enforce this + /// in places in the code. + typedef uint32_t container_unit; + typedef std::vector<container_unit> bits_container; + + /// @brief Traits of buffers + // In general, we try to give buffers traits reflecting integral types. If + // this fails, the compiler will let someone know. + /// + /// @tparam T is the type of iv_data (std::vector, etc) + /// @tparam B is the type of the bit-specifier, typically uint32_t + template<typename T, typename B = uint32_t> + class bufferTraits + { + public: + +#if !defined(DOXYGEN) && defined(FAPI2_DEBUG) + /// + /// @brief Print a container of bits + /// @param[in] i_data the container of bits + /// + static inline void print(const T& i_data) + { + // convert to uint64_t to prevent uint8_t from being + // printed as a char. + std::cout << "\tdata is " + << std::hex + << static_cast<uint64_t>(i_data) + << std::dec << std::endl; + } +#endif + + /// + /// @brief Return the size of the buffer in E units + /// @tparam E, the element size. + /// @param[in] io_buffer the buffer which to size + /// @return The size of the buffer in E's rounded up + /// + template<typename E> + constexpr static B size(const T& i_buffer) + { + return (bit_length(i_buffer) + + (parameterTraits<E>::bit_length() - 1)) / + parameterTraits<E>::bit_length(); + } + + /// + /// @brief Return the size of the buffer itself + /// @param[in] io_buffer the buffer which to size + /// @return The size of the buffer in bits (not units) + /// + constexpr static B bit_length(const T&) + { return sizeof(T) * 8; } + + /// + /// @brief Clear the buffer + /// @param[in,out] io_buffer the buffer which to clear + /// + static inline void clear(T& io_buffer) + { io_buffer = static_cast<T>(0); } + + /// + /// @brief Set the buffer + /// @param[in,out] io_buffer the buffer which to set + /// + static inline void set(T& io_buffer) + { io_buffer = static_cast<T>(~0); } + + /// + /// @brief Invert the buffer + /// @param[in,out] io_buffer the buffer which to invert + /// + static inline void invert(T& io_buffer) + { io_buffer = ~io_buffer; } + + /// + /// @brief Reverse the buffer + /// @param[in,out] io_buffer the buffer which to reverse + /// + static inline void reverse(T& io_buffer) + { + io_buffer = + ((io_buffer & 0xAAAAAAAAAAAAAAAA) >> 1) | + ((io_buffer & 0x5555555555555555) << 1); + } + + /// + /// @brief Get the address of the buffer as an array + /// @param[in] i_buffer the buffer which to invert + /// @return The address of the first element of the buffer + /// + static inline void* get_address(T& i_buffer) + { return (void*)&i_buffer; } + + typedef B bits_type; + typedef T unit_type; + constexpr static uint32_t bits_per_unit(void) + { return sizeof(unit_type) * 8; } + }; + + // + // + /// @brief Traits for buffers which are a container of bits + // + // + template<> + class bufferTraits<bits_container, uint32_t> + { + public: +#if !defined(DOXYGEN) && defined(FAPI2_DEBUG) + /// + /// @brief Print a container of bits + /// @param[in] i_data the container of bits + /// + static inline void print(const bits_container& i_data) + { + std::cout << "\tdata is " << std::hex; + std::copy(i_data.begin(), i_data.end(), + std::ostream_iterator<container_unit>(std::cout, " ")); + std::cout << std::dec << std::endl; + } +#endif + + /// + /// @brief Return the size of the buffer in E units + /// @tparam E, the element size. + /// @param[in] io_buffer the buffer which to size + /// @return The size of the buffer in E's rounded up + /// + template<typename E> + constexpr static uint32_t size(const bits_container& i_buffer) + { + return (bit_length(i_buffer) + + (parameterTraits<E>::bit_length() - 1)) / + parameterTraits<E>::bit_length(); + } + + /// + /// @brief Return the size of the buffer itself + /// @param[in,out] io_buffer the buffer which to size + /// @return The size of the buffer in bits (not units) + /// + static inline uint32_t bit_length(const bits_container& i_buffer) + { return i_buffer.size() * sizeof(container_unit) * 8; } + + /// + /// @brief Clear the buffer + /// @param[in,out] io_buffer the buffer which to clear + /// + static inline void clear(bits_container& io_buffer) + { io_buffer.assign(io_buffer.size(), 0); } + + /// + /// @brief Set the buffer + /// @param[in,out] io_buffer the buffer which to set + /// + static inline void set(bits_container& io_buffer) + { io_buffer.assign(io_buffer.size(), ~0); } + + /// + /// @brief Invert the buffer + /// @param[in,out] io_buffer the buffer which to invert + /// + static inline void invert(bits_container& io_buffer) + { + std::transform(io_buffer.begin(), io_buffer.end(), + io_buffer.begin(), + [](container_unit u) { return ~u; }); + } + + /// + /// @brief Get the address of the buffer as an array + /// @param[in] i_buffer the buffer which to invert + /// @return The address of the first element of the buffer + /// + static inline void* get_address(bits_container& i_buffer) + { + return (void*)&(i_buffer[0]); + } + + typedef uint32_t bits_type; + typedef container_unit unit_type; + constexpr static uint32_t bits_per_unit(void) + { return sizeof(unit_type) * 8; } + }; + /// @endcond +} + + + +#endif diff --git a/hwpf/include/error_info_defs.H b/hwpf/include/error_info_defs.H new file mode 100644 index 00000000..d7f418a2 --- /dev/null +++ b/hwpf/include/error_info_defs.H @@ -0,0 +1,252 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] 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 error_info_defs.H +/// @brief Defines to support the Error Information class +/// + +#ifndef FAPI2_ERRORINFO_DEFS_H_ +#define FAPI2_ERRORINFO_DEFS_H_ + +#include <stdint.h> +#include <target.H> + +#ifndef __PPE__ +#include <variable_buffer.H> +#include <iostream> +#endif // __PPE__ + +namespace fapi2 +{ + /// + /// @brief Type to hold the ffdc element in the ffdc class + /// Needed so that the size can be squirled away before the + /// macro is called. + /// + class ffdc_t + { + public: + ffdc_t(void) + {} + + operator const void*() const { return iv_value.first; } + operator uint8_t() const + { return *(reinterpret_cast<const uint8_t*>(iv_value.first)); } + + int16_t size(void) const { return iv_value.second; } + int16_t& size(void) { return iv_value.second; } + + const void* ptr(void) const { return iv_value.first; } + const void*& ptr(void) { return iv_value.first; } + + private: + std::pair<const void*, int16_t> iv_value; + }; + + /// + /// @brief Enumeration of ErrorInfo FFDC sizes that are used to indicate a + /// special type that cannot simply be memcopied + enum ErrorInfoFfdcSize + { + EI_FFDC_SIZE_BUF = 0xffff, // fapi2::buffer<T> + EI_FFDC_SIZE_TARGET = 0xfffe, // fapi2::Target + EI_FFDC_SIZE_VBUF = 0xfffd, // fapi2::variable_buffer + EI_FFDC_MAX_SIZE = 0x1000, // Limit regular FFDC capture to 4kb + }; + + /// + /// @brief Enumeration of error log severity. + /// + enum errlSeverity_t + { + FAPI2_ERRL_SEV_UNDEFINED = 0x00, /// Used internally by ffdc mechanism + FAPI2_ERRL_SEV_RECOVERED = 0x10, /// Not seen by customer + FAPI2_ERRL_SEV_PREDICTIVE = 0x20, /// Error recovered but customer will see + FAPI2_ERRL_SEV_UNRECOVERABLE = 0x40 /// Unrecoverable, general + }; + + /// + /// @brief Enumeration of ErrorInfo types + /// + enum ErrorInfoType + { + EI_TYPE_FFDC = 0, + EI_TYPE_HW_CALLOUT = 1, + EI_TYPE_PROCEDURE_CALLOUT = 2, + EI_TYPE_BUS_CALLOUT = 3, + EI_TYPE_CDG = 4, // Target Callout/Deconfig/GARD + EI_TYPE_CHILDREN_CDG = 5, // Children Callout/Deconfig/GARD + EI_TYPE_COLLECT_TRACE = 6, + EI_LAST_TYPE = EI_TYPE_COLLECT_TRACE + 1, + }; + + /// + /// @enum HwCallout + /// + /// This enumeration defines the possible Hardware Callouts that are not + /// represented by fapi2::Targets + /// + /// Note that platform code may depend on the enum values starting at 0 and + /// incrementing in order to efficiently convert to a platform callout value + /// so do not reorder without consulting all platforms + /// + namespace HwCallouts + { + enum HwCallout + { + // Where indicated, a HW Callout in FAPI Error XML must include a + // reference target that is used to identify the HW. e.g. for + // TOD_CLOCK, the proc chip that the clock is attached to must be + // specified + TOD_CLOCK = 0, // Include proc-chip ref (or child chiplet) + MEM_REF_CLOCK = 1, // Include membuf-chip ref (or child chiplet) + PROC_REF_CLOCK = 2, // Include proc-chip ref (or child chiplet) + PCI_REF_CLOCK = 3, // Include proc-chip ref (or child chiplet) + FLASH_CONTROLLER_PART = 4, + PNOR_PART = 5, + SBE_SEEPROM_PART = 6, + VPD_PART = 7, + LPC_SLAVE_PART = 8, + GPIO_EXPANDER_PART = 9, + SPIVID_SLAVE_PART = 10, + }; + } + + /// + /// @enum ProcedureCallout + /// + /// This enumeration defines the possible Procedure Callouts + /// These instruct the customer/customer-engineer what to do + /// + /// Note that platform code may depend on the enum values starting at 0 and + /// incrementing in order to efficiently convert to a platform callout value + /// so do not reorder without consulting all platforms + /// + namespace ProcedureCallouts + { + enum ProcedureCallout + { + CODE = 0, // Code problem + LVL_SUPPORT = 1, // Call next level of support + MEMORY_PLUGGING_ERROR = 2, // DIMM Plugging error + BUS_CALLOUT = 3, // Bus Called Out + }; + } + + /// + /// @enum CalloutPriority + /// + /// This enumeration defines the possible Procedure and Target callout priorities + /// + /// Note that platform code may depend on the enum values starting at 0 and + /// incrementing in order to efficiently convert to a platform priority value + /// so do not reorder without consulting all platforms + /// + namespace CalloutPriorities + { + enum CalloutPriority + { + LOW = 0, + MEDIUM = 1, + HIGH = 2, + }; + } + + /// + /// @enum Collect Trace + /// + /// This enumeration defines the possible firmware traces to collect + /// + namespace CollectTraces + { + const uint32_t TRACE_SIZE = 256; // limit collected trace size + enum CollectTrace + { + FSI = 1, + SCOM = 2, + SCAN = 3, + MBOX = 4, + }; + } + + /// + /// @brief Get FFDC Size + /// + /// This is called by the FAPI_SET_HWP_ERROR macro to find out the size of + /// FFDC data. If the data is of a special type that is handled differently + /// than types that are simply memcopied then it is handled by a template + /// specialization. + /// If this function template is instantiated with a pointer, the compile + /// will fail. + /// + /// @return uint16_t. Size of the FFDC data + /// + template<typename T> + inline uint16_t getErrorInfoFfdcSize(const T &) + { + static_assert(sizeof(T) <= EI_FFDC_MAX_SIZE, + "FFDC too large to capture"); + return sizeof(T); + } + + /// + /// @brief Compile error if caller tries to get the FFDC size of a pointer + /// + template<typename T> + inline uint16_t getErrorInfoFfdcSize(const T*) + { + static_assert(std::is_pointer<T>::value, + "pointer passed to getErrorInfoFfdcSize"); + return 0; + } + + /// + /// @brief Get FFDC Size specialization for fapi2::Target + /// + template<fapi2::TargetType T> + inline uint16_t getErrorInfoFfdcSize(const fapi2::Target<T>&) + { + return EI_FFDC_SIZE_TARGET; + } + +#ifndef __PPE__ + /// + /// @brief Get FFDC Size specialization for variable buffers + /// + template<> + inline uint16_t getErrorInfoFfdcSize(const fapi2::variable_buffer& i_thing) + { + // Limit a variable buffer to 4kb bytes, and we can memcpy the storage. + return std::min(static_cast<uint32_t>(EI_FFDC_MAX_SIZE), + i_thing.getLength<uint8_t>()); + } +#endif // __PPE__ + +}; + + + +#endif // FAPI2_ERRORINFO_DEFS_H_ diff --git a/hwpf/include/fapi2.H b/hwpf/include/fapi2.H new file mode 100644 index 00000000..eeef6b4c --- /dev/null +++ b/hwpf/include/fapi2.H @@ -0,0 +1,72 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: hwpf/fapi2/include/fapi2.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* EKB Project */ +/* */ +/* COPYRIGHT 2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* 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 fapi2.H +/// @brief top level header for fapi2 +/// + +#ifndef __FAPI2_TOP_LEVEL__ +#define __FAPI2_TOP_LEVEL__ + +// Define which platforms will not have FAPI Return Codes +#undef __noRC__ +#if defined (__CME__) || defined (__SGPE__) || defined (__PGPE__) +#define __noRC__ +#endif + +// Determine if running on a PPE platform +#ifndef __PPE__ +#if defined (__SBE__) || defined (__CME__) || defined (__SGPE__) || defined (__PGPE__) +#define __PPE__ +#endif +#endif + +#include <plat_trace.H> +#include <target.H> +#include <return_code.H> +#include <buffer.H> +#include <hw_access.H> +#include <utils.H> + +// In turn includes the needed generated headers (hwp_ffd_classes, etc.) +#include <error_scope.H> +#include <set_sbe_error.H> // Generated file +#include <plat_attributes.H> +#include <plat_target_utils.H> + +// Not supported by PPE +#ifndef __PPE__ +#include <mvpdAccess.H> +#endif + +#include <fapi2_hwp_executor.H> + +// Block of headers not currently in fapi2 +#ifdef FAPI2_MISSING_HEADERS + #include <mbvpdAccess.H> +#endif + + +#endif // __FAPI2_TOP_LEVEL__ + + + + + + diff --git a/hwpf/include/fapi2AttrEnumInfo.csv b/hwpf/include/fapi2AttrEnumInfo.csv new file mode 100644 index 00000000..2d740720 --- /dev/null +++ b/hwpf/include/fapi2AttrEnumInfo.csv @@ -0,0 +1,15 @@ +# fapiAttrEnumInfo.csv +# This file is generated by perl script fapiParseAttributeInfo.pl +# It lists information about FAPI attribute enumeratorss and is +# used to process FAPI Attribute text files (overrides/syncs) +# Format: +# <ENUM-STR>,<ENUM-VAL> +ATTR_SCRATCH_UINT64_2_VAL_A,0 +ATTR_SCRATCH_UINT64_2_VAL_B,5 +ATTR_SCRATCH_UINT64_2_VAL_C,0xffffffffffffffff +ATTR_SCRATCH_INT64_2_VAL_A,0 +ATTR_SCRATCH_INT64_2_VAL_B,5 +ATTR_SCRATCH_INT64_2_VAL_C,0xffffffffffffffff +ATTR_SYSTEM_IPL_PHASE_HB_IPL,0x1 +ATTR_SYSTEM_IPL_PHASE_HB_RUNTIME,0x2 +ATTR_SYSTEM_IPL_PHASE_CACHE_CONTAINED,0x4 diff --git a/hwpf/include/fapi2AttrInfo.csv b/hwpf/include/fapi2AttrInfo.csv new file mode 100644 index 00000000..0ebe9e41 --- /dev/null +++ b/hwpf/include/fapi2AttrInfo.csv @@ -0,0 +1,87 @@ +# fapiAttrInfo.csv +# This file is generated by perl script fapiParseAttributeInfo.pl +# It lists information about FAPI attributes and is used to +# process FAPI Attribute text files (overrides/syncs) +# Format: +# <FAPI-ATTR-ID-STR>,<LAYER-ATTR-ID-STR>,<ATTR-ID-VAL>,<ATTR-TYPE> +# Note that for the AttributeTanks at the FAPI layer, the +# FAPI-ATTR-ID-STR and LAYER-ATTR-ID-STR will be identical +ATTR_SCRATCH_UINT8_1,ATTR_SCRATCH_UINT8_1,0xd16a035,u8 +ATTR_SCRATCH_UINT8_2,ATTR_SCRATCH_UINT8_2,0xd53bc45,u8 +ATTR_SCRATCH_UINT32_1,ATTR_SCRATCH_UINT32_1,0x6e35711,u32 +ATTR_SCRATCH_UINT32_2,ATTR_SCRATCH_UINT32_2,0xb6b04cf,u32 +ATTR_SCRATCH_UINT64_1,ATTR_SCRATCH_UINT64_1,0x97c0c12,u64 +ATTR_SCRATCH_UINT64_2,ATTR_SCRATCH_UINT64_2,0xa09fac0,u64 +ATTR_SCRATCH_INT8_1,ATTR_SCRATCH_INT8_1,0x8d69f35,8 +ATTR_SCRATCH_INT8_2,ATTR_SCRATCH_INT8_2,0xd0a271b,8 +ATTR_SCRATCH_INT32_1,ATTR_SCRATCH_INT32_1,0xb5d67e7,32 +ATTR_SCRATCH_INT32_2,ATTR_SCRATCH_INT32_2,0xedc4c34,32 +ATTR_SCRATCH_INT64_1,ATTR_SCRATCH_INT64_1,0x439b62e,64 +ATTR_SCRATCH_INT64_2,ATTR_SCRATCH_INT64_2,0x1201173,64 +ATTR_SCRATCH_UINT32_ARRAY,ATTR_SCRATCH_UINT32_ARRAY,0xc4ffba2,u32[64] +ATTR_SCRATCH_UINT32_PERV_ARRAY,ATTR_SCRATCH_UINT32_PERV_ARRAY,0xb53ac5c,u32[64] +ATTR_REPR_RING,ATTR_REPR_RING,0xb4a5f78,u32 +ATTR_TIME_RING,ATTR_TIME_RING,0x3b26e38,u32 +ATTR_GPTR_RING,ATTR_GPTR_RING,0xe41805b,u32 +ATTR_PLL_RING,ATTR_PLL_RING,0x2548674,u32 +ATTR_CORE_REPR_RING,ATTR_CORE_REPR_RING,0x938b8fc,u32 +ATTR_CORE_TIME_RING,ATTR_CORE_TIME_RING,0xd3f938f,u32 +ATTR_CORE_GPTR_RING,ATTR_CORE_GPTR_RING,0x94e6329,u32 +ATTR_L2_REPR_RING,ATTR_L2_REPR_RING,0x9db7d8a,u32 +ATTR_L2_TIME_RING,ATTR_L2_TIME_RING,0x5999526,u32 +ATTR_L2_GPTR_RING,ATTR_L2_GPTR_RING,0x780f3d2,u32 +ATTR_L3_REPR_RING,ATTR_L3_REPR_RING,0x1364905,u32 +ATTR_L3_TIME_RING,ATTR_L3_TIME_RING,0x514ea87,u32 +ATTR_L3_GPTR_RING,ATTR_L3_GPTR_RING,0x2179cb4,u32 +ATTR_DPLL_RING,ATTR_DPLL_RING,0xad1e658,u32 +ATTR_PG_FSI,ATTR_PG_FSI,0xa484728,u8 +ATTR_PG_PRV,ATTR_PG_PRV,0xf1e3768,u8 +ATTR_PG_N0,ATTR_PG_N0,0x6e7e43d,u8 +ATTR_PG_N1,ATTR_PG_N1,0x916d851,u8 +ATTR_PG_N2,ATTR_PG_N2,0x311b213,u8 +ATTR_PG_N3,ATTR_PG_N3,0x196b4d6,u8 +ATTR_PG_XB,ATTR_PG_XB,0xbdda26f,u8 +ATTR_PG_MC01,ATTR_PG_MC01,0xc307a5c,u8 +ATTR_PG_MC23,ATTR_PG_MC23,0xe2ae686,u8 +ATTR_PG_OB0,ATTR_PG_OB0,0x4b73198,u8 +ATTR_PG_OB1,ATTR_PG_OB1,0x51edd9c,u8 +ATTR_PG_OB2,ATTR_PG_OB2,0x8588771,u8 +ATTR_PG_OB3,ATTR_PG_OB3,0x5f2d7ec,u8 +ATTR_PG_PCI0,ATTR_PG_PCI0,0x16db49c,u8 +ATTR_PG_PCI1,ATTR_PG_PCI1,0x3056952,u8 +ATTR_PG_PCI2,ATTR_PG_PCI2,0x122b6d7,u8 +ATTR_PG_EQ0,ATTR_PG_EQ0,0x878b5c8,u8 +ATTR_PG_EQ1,ATTR_PG_EQ1,0x03c3069,u8 +ATTR_PG_EQ2,ATTR_PG_EQ2,0xc013357,u8 +ATTR_PG_EQ3,ATTR_PG_EQ3,0xf230319,u8 +ATTR_PG_EQ4,ATTR_PG_EQ4,0xbbac8d0,u8 +ATTR_PG_EQ5,ATTR_PG_EQ5,0x2dc5723,u8 +ATTR_PG_EC00,ATTR_PG_EC00,0x901df3a,u8 +ATTR_PG_EC01,ATTR_PG_EC01,0x47d022a,u8 +ATTR_PG_EC02,ATTR_PG_EC02,0x08de5af,u8 +ATTR_PG_EC03,ATTR_PG_EC03,0xb7fc8f5,u8 +ATTR_PG_EC04,ATTR_PG_EC04,0xb5fcba5,u8 +ATTR_PG_EC05,ATTR_PG_EC05,0x83a3441,u8 +ATTR_PG_EC06,ATTR_PG_EC06,0x1b6bebf,u8 +ATTR_PG_EC07,ATTR_PG_EC07,0x1eb958b,u8 +ATTR_PG_EC08,ATTR_PG_EC08,0x09e32c8,u8 +ATTR_PG_EC09,ATTR_PG_EC09,0x6775c2d,u8 +ATTR_PG_EC10,ATTR_PG_EC10,0xddbba81,u8 +ATTR_PG_EC11,ATTR_PG_EC11,0xfc76788,u8 +ATTR_PG_EC12,ATTR_PG_EC12,0x3f34e1f,u8 +ATTR_PG_EC13,ATTR_PG_EC13,0x9ff5ec8,u8 +ATTR_PG_EC14,ATTR_PG_EC14,0x0aa4ad3,u8 +ATTR_PG_EC15,ATTR_PG_EC15,0x30379c7,u8 +ATTR_PG_EC16,ATTR_PG_EC16,0x0f4b161,u8 +ATTR_PG_EC17,ATTR_PG_EC17,0xcf99c88,u8 +ATTR_PG_EC18,ATTR_PG_EC18,0x9867191,u8 +ATTR_PG_EC19,ATTR_PG_EC19,0xeb29d56,u8 +ATTR_PG_EC20,ATTR_PG_EC20,0xeb32b14,u8 +ATTR_PG_EC21,ATTR_PG_EC21,0x31c5be4,u8 +ATTR_PG_EC22,ATTR_PG_EC22,0x0563eb4,u8 +ATTR_PG_EC23,ATTR_PG_EC23,0x8477c54,u8 +ATTR_CHIP_UNIT_POS,ATTR_CHIP_UNIT_POS,0x07f067a,u8 +ATTR_FABRIC_SYSTEM_ID,ATTR_FABRIC_SYSTEM_ID,0x6856732,u8 +ATTR_SYSTEM_IPL_PHASE,ATTR_SYSTEM_IPL_PHASE,0xf9c1ac6,u8 +ATTR_BACKUP_SEEPROM_SELECT,ATTR_BACKUP_SEEPROM_SELECT,0x4ca9b40,u8 +ATTR_MC_SYNC_MODE,ATTR_MC_SYNC_MODE,0x0472be6,u8 diff --git a/hwpf/include/fapi2AttributeIds.H b/hwpf/include/fapi2AttributeIds.H new file mode 100644 index 00000000..4a36c506 --- /dev/null +++ b/hwpf/include/fapi2AttributeIds.H @@ -0,0 +1,746 @@ +// fapi2AttributeIds.H +// This file is generated by perl script fapiParseAttributeInfo.pl + +#ifndef FAPI2ATTRIBUTEIDS_H_ +#define FAPI2ATTRIBUTEIDS_H_ + +#ifndef __ASSEMBLER__ + +#include <target.H> +#include <target_types.H> + +namespace fapi2 +{ + +/** + * @brief Enumeration of attribute IDs + */ +enum AttributeId +{ + ATTR_SCRATCH_UINT8_1 = 0xd16a035, + ATTR_SCRATCH_UINT8_2 = 0xd53bc45, + ATTR_SCRATCH_UINT32_1 = 0x6e35711, + ATTR_SCRATCH_UINT32_2 = 0xb6b04cf, + ATTR_SCRATCH_UINT64_1 = 0x97c0c12, + ATTR_SCRATCH_UINT64_2 = 0xa09fac0, + ATTR_SCRATCH_INT8_1 = 0x8d69f35, + ATTR_SCRATCH_INT8_2 = 0xd0a271b, + ATTR_SCRATCH_INT32_1 = 0xb5d67e7, + ATTR_SCRATCH_INT32_2 = 0xedc4c34, + ATTR_SCRATCH_INT64_1 = 0x439b62e, + ATTR_SCRATCH_INT64_2 = 0x1201173, + ATTR_SCRATCH_UINT32_ARRAY = 0xc4ffba2, + ATTR_SCRATCH_UINT32_PERV_ARRAY = 0xb53ac5c, + ATTR_REPR_RING = 0xb4a5f78, + ATTR_TIME_RING = 0x3b26e38, + ATTR_GPTR_RING = 0xe41805b, + ATTR_PLL_RING = 0x2548674, + ATTR_CORE_REPR_RING = 0x938b8fc, + ATTR_CORE_TIME_RING = 0xd3f938f, + ATTR_CORE_GPTR_RING = 0x94e6329, + ATTR_L2_REPR_RING = 0x9db7d8a, + ATTR_L2_TIME_RING = 0x5999526, + ATTR_L2_GPTR_RING = 0x780f3d2, + ATTR_L3_REPR_RING = 0x1364905, + ATTR_L3_TIME_RING = 0x514ea87, + ATTR_L3_GPTR_RING = 0x2179cb4, + ATTR_DPLL_RING = 0xad1e658, + ATTR_PG_FSI = 0xa484728, + ATTR_PG_PRV = 0xf1e3768, + ATTR_PG_N0 = 0x6e7e43d, + ATTR_PG_N1 = 0x916d851, + ATTR_PG_N2 = 0x311b213, + ATTR_PG_N3 = 0x196b4d6, + ATTR_PG_XB = 0xbdda26f, + ATTR_PG_MC01 = 0xc307a5c, + ATTR_PG_MC23 = 0xe2ae686, + ATTR_PG_OB0 = 0x4b73198, + ATTR_PG_OB1 = 0x51edd9c, + ATTR_PG_OB2 = 0x8588771, + ATTR_PG_OB3 = 0x5f2d7ec, + ATTR_PG_PCI0 = 0x16db49c, + ATTR_PG_PCI1 = 0x3056952, + ATTR_PG_PCI2 = 0x122b6d7, + ATTR_PG_EQ0 = 0x878b5c8, + ATTR_PG_EQ1 = 0x03c3069, + ATTR_PG_EQ2 = 0xc013357, + ATTR_PG_EQ3 = 0xf230319, + ATTR_PG_EQ4 = 0xbbac8d0, + ATTR_PG_EQ5 = 0x2dc5723, + ATTR_PG_EC00 = 0x901df3a, + ATTR_PG_EC01 = 0x47d022a, + ATTR_PG_EC02 = 0x08de5af, + ATTR_PG_EC03 = 0xb7fc8f5, + ATTR_PG_EC04 = 0xb5fcba5, + ATTR_PG_EC05 = 0x83a3441, + ATTR_PG_EC06 = 0x1b6bebf, + ATTR_PG_EC07 = 0x1eb958b, + ATTR_PG_EC08 = 0x09e32c8, + ATTR_PG_EC09 = 0x6775c2d, + ATTR_PG_EC10 = 0xddbba81, + ATTR_PG_EC11 = 0xfc76788, + ATTR_PG_EC12 = 0x3f34e1f, + ATTR_PG_EC13 = 0x9ff5ec8, + ATTR_PG_EC14 = 0x0aa4ad3, + ATTR_PG_EC15 = 0x30379c7, + ATTR_PG_EC16 = 0x0f4b161, + ATTR_PG_EC17 = 0xcf99c88, + ATTR_PG_EC18 = 0x9867191, + ATTR_PG_EC19 = 0xeb29d56, + ATTR_PG_EC20 = 0xeb32b14, + ATTR_PG_EC21 = 0x31c5be4, + ATTR_PG_EC22 = 0x0563eb4, + ATTR_PG_EC23 = 0x8477c54, + ATTR_CHIP_UNIT_POS = 0x07f067a, + ATTR_FABRIC_SYSTEM_ID = 0x6856732, + ATTR_SYSTEM_IPL_PHASE = 0xf9c1ac6, + ATTR_BACKUP_SEEPROM_SELECT = 0x4ca9b40, + ATTR_MC_SYNC_MODE = 0x0472be6, +}; + +/** + * @brief Attribute Information + */ +/* ATTR_SCRATCH_UINT8_1 */ +typedef uint8_t ATTR_SCRATCH_UINT8_1_Type; +const bool ATTR_SCRATCH_UINT8_1_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_UINT8_1_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_UINT8_1_PlatInit = true; +const bool ATTR_SCRATCH_UINT8_1_InitToZero = false; + +/* ATTR_SCRATCH_UINT8_2 */ +typedef uint8_t ATTR_SCRATCH_UINT8_2_Type; +const bool ATTR_SCRATCH_UINT8_2_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_UINT8_2_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_UINT8_2_PlatInit = true; +const bool ATTR_SCRATCH_UINT8_2_InitToZero = false; + +/* ATTR_SCRATCH_UINT32_1 */ +typedef uint32_t ATTR_SCRATCH_UINT32_1_Type; +const bool ATTR_SCRATCH_UINT32_1_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_UINT32_1_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_UINT32_1_PlatInit = true; +const bool ATTR_SCRATCH_UINT32_1_InitToZero = false; + +/* ATTR_SCRATCH_UINT32_2 */ +typedef uint32_t ATTR_SCRATCH_UINT32_2_Type; +const bool ATTR_SCRATCH_UINT32_2_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_UINT32_2_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_UINT32_2_PlatInit = true; +const bool ATTR_SCRATCH_UINT32_2_InitToZero = false; + +/* ATTR_SCRATCH_UINT64_1 */ +typedef uint64_t ATTR_SCRATCH_UINT64_1_Type; +const bool ATTR_SCRATCH_UINT64_1_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_UINT64_1_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_UINT64_1_PlatInit = true; +const bool ATTR_SCRATCH_UINT64_1_InitToZero = false; + +/* ATTR_SCRATCH_UINT64_2 */ +typedef uint64_t ATTR_SCRATCH_UINT64_2_Type; +const bool ATTR_SCRATCH_UINT64_2_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_UINT64_2_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_UINT64_2_PlatInit = true; +const bool ATTR_SCRATCH_UINT64_2_InitToZero = false; +enum ATTR_SCRATCH_UINT64_2_Enum +{ + ENUM_ATTR_SCRATCH_UINT64_2_VAL_A = 0ULL, + ENUM_ATTR_SCRATCH_UINT64_2_VAL_B = 5ULL, + ENUM_ATTR_SCRATCH_UINT64_2_VAL_C = 0xffffffffffffffffULL, +}; +#define ATTR_SCRATCH_UINT64_2_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_SCRATCH_INT8_1 */ +typedef int8_t ATTR_SCRATCH_INT8_1_Type; +const bool ATTR_SCRATCH_INT8_1_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_INT8_1_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_INT8_1_PlatInit = true; +const bool ATTR_SCRATCH_INT8_1_InitToZero = false; +#define ATTR_SCRATCH_INT8_1_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_SCRATCH_INT8_2 */ +typedef int8_t ATTR_SCRATCH_INT8_2_Type; +const bool ATTR_SCRATCH_INT8_2_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_INT8_2_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_INT8_2_PlatInit = true; +const bool ATTR_SCRATCH_INT8_2_InitToZero = false; +#define ATTR_SCRATCH_INT8_2_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_SCRATCH_INT32_1 */ +typedef int32_t ATTR_SCRATCH_INT32_1_Type; +const bool ATTR_SCRATCH_INT32_1_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_INT32_1_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_INT32_1_PlatInit = true; +const bool ATTR_SCRATCH_INT32_1_InitToZero = false; + +/* ATTR_SCRATCH_INT32_2 */ +typedef int32_t ATTR_SCRATCH_INT32_2_Type; +const bool ATTR_SCRATCH_INT32_2_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_INT32_2_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_INT32_2_PlatInit = true; +const bool ATTR_SCRATCH_INT32_2_InitToZero = false; + +/* ATTR_SCRATCH_INT64_1 */ +typedef int64_t ATTR_SCRATCH_INT64_1_Type; +const bool ATTR_SCRATCH_INT64_1_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_INT64_1_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_INT64_1_PlatInit = true; +const bool ATTR_SCRATCH_INT64_1_InitToZero = false; +#define ATTR_SCRATCH_INT64_1_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_SCRATCH_INT64_2 */ +typedef int64_t ATTR_SCRATCH_INT64_2_Type; +const bool ATTR_SCRATCH_INT64_2_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_INT64_2_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_INT64_2_PlatInit = true; +const bool ATTR_SCRATCH_INT64_2_InitToZero = false; +enum ATTR_SCRATCH_INT64_2_Enum +{ + ENUM_ATTR_SCRATCH_INT64_2_VAL_A = 0, + ENUM_ATTR_SCRATCH_INT64_2_VAL_B = 5, + ENUM_ATTR_SCRATCH_INT64_2_VAL_C = 0xffffffffffffffff, +}; +#define ATTR_SCRATCH_INT64_2_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_SCRATCH_UINT32_ARRAY */ +typedef uint32_t ATTR_SCRATCH_UINT32_ARRAY_Type[64]; +const bool ATTR_SCRATCH_UINT32_ARRAY_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_UINT32_ARRAY_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_SCRATCH_UINT32_ARRAY_PlatInit = true; +const bool ATTR_SCRATCH_UINT32_ARRAY_InitToZero = false; + +/* ATTR_SCRATCH_UINT32_PERV_ARRAY */ +typedef uint32_t ATTR_SCRATCH_UINT32_PERV_ARRAY_Type[64]; +const bool ATTR_SCRATCH_UINT32_PERV_ARRAY_Privileged = false; +const TargetTypes_t ATTR_SCRATCH_UINT32_PERV_ARRAY_TargetTypes = TARGET_TYPE_PERV; +const bool ATTR_SCRATCH_UINT32_PERV_ARRAY_PlatInit = true; +const bool ATTR_SCRATCH_UINT32_PERV_ARRAY_InitToZero = false; + +/* ATTR_REPR_RING */ +typedef uint32_t ATTR_REPR_RING_Type; +const bool ATTR_REPR_RING_Privileged = false; +const TargetTypes_t ATTR_REPR_RING_TargetTypes = TARGET_TYPE_PERV; +const bool ATTR_REPR_RING_PlatInit = true; +const bool ATTR_REPR_RING_InitToZero = false; +#define ATTR_REPR_RING_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_TIME_RING */ +typedef uint32_t ATTR_TIME_RING_Type; +const bool ATTR_TIME_RING_Privileged = false; +const TargetTypes_t ATTR_TIME_RING_TargetTypes = TARGET_TYPE_PERV; +const bool ATTR_TIME_RING_PlatInit = true; +const bool ATTR_TIME_RING_InitToZero = false; +#define ATTR_TIME_RING_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_GPTR_RING */ +typedef uint32_t ATTR_GPTR_RING_Type; +const bool ATTR_GPTR_RING_Privileged = false; +const TargetTypes_t ATTR_GPTR_RING_TargetTypes = TARGET_TYPE_PERV; +const bool ATTR_GPTR_RING_PlatInit = true; +const bool ATTR_GPTR_RING_InitToZero = false; +#define ATTR_GPTR_RING_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PLL_RING */ +typedef uint32_t ATTR_PLL_RING_Type; +const bool ATTR_PLL_RING_Privileged = false; +const TargetTypes_t ATTR_PLL_RING_TargetTypes = TARGET_TYPE_PERV; +const bool ATTR_PLL_RING_PlatInit = true; +const bool ATTR_PLL_RING_InitToZero = false; +#define ATTR_PLL_RING_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_CORE_REPR_RING */ +typedef uint32_t ATTR_CORE_REPR_RING_Type; +const bool ATTR_CORE_REPR_RING_Privileged = false; +const TargetTypes_t ATTR_CORE_REPR_RING_TargetTypes = TARGET_TYPE_CORE; +const bool ATTR_CORE_REPR_RING_PlatInit = true; +const bool ATTR_CORE_REPR_RING_InitToZero = false; + +/* ATTR_CORE_TIME_RING */ +typedef uint32_t ATTR_CORE_TIME_RING_Type; +const bool ATTR_CORE_TIME_RING_Privileged = false; +const TargetTypes_t ATTR_CORE_TIME_RING_TargetTypes = TARGET_TYPE_CORE; +const bool ATTR_CORE_TIME_RING_PlatInit = true; +const bool ATTR_CORE_TIME_RING_InitToZero = false; + +/* ATTR_CORE_GPTR_RING */ +typedef uint32_t ATTR_CORE_GPTR_RING_Type; +const bool ATTR_CORE_GPTR_RING_Privileged = false; +const TargetTypes_t ATTR_CORE_GPTR_RING_TargetTypes = TARGET_TYPE_CORE; +const bool ATTR_CORE_GPTR_RING_PlatInit = true; +const bool ATTR_CORE_GPTR_RING_InitToZero = false; + +/* ATTR_L2_REPR_RING */ +typedef uint32_t ATTR_L2_REPR_RING_Type; +const bool ATTR_L2_REPR_RING_Privileged = false; +const TargetTypes_t ATTR_L2_REPR_RING_TargetTypes = TARGET_TYPE_EX; +const bool ATTR_L2_REPR_RING_PlatInit = true; +const bool ATTR_L2_REPR_RING_InitToZero = false; +#define ATTR_L2_REPR_RING_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_L2_TIME_RING */ +typedef uint32_t ATTR_L2_TIME_RING_Type; +const bool ATTR_L2_TIME_RING_Privileged = false; +const TargetTypes_t ATTR_L2_TIME_RING_TargetTypes = TARGET_TYPE_EX; +const bool ATTR_L2_TIME_RING_PlatInit = true; +const bool ATTR_L2_TIME_RING_InitToZero = false; +#define ATTR_L2_TIME_RING_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_L2_GPTR_RING */ +typedef uint32_t ATTR_L2_GPTR_RING_Type; +const bool ATTR_L2_GPTR_RING_Privileged = false; +const TargetTypes_t ATTR_L2_GPTR_RING_TargetTypes = TARGET_TYPE_EX; +const bool ATTR_L2_GPTR_RING_PlatInit = true; +const bool ATTR_L2_GPTR_RING_InitToZero = false; +#define ATTR_L2_GPTR_RING_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_L3_REPR_RING */ +typedef uint32_t ATTR_L3_REPR_RING_Type; +const bool ATTR_L3_REPR_RING_Privileged = false; +const TargetTypes_t ATTR_L3_REPR_RING_TargetTypes = TARGET_TYPE_EX; +const bool ATTR_L3_REPR_RING_PlatInit = true; +const bool ATTR_L3_REPR_RING_InitToZero = false; +#define ATTR_L3_REPR_RING_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_L3_TIME_RING */ +typedef uint32_t ATTR_L3_TIME_RING_Type; +const bool ATTR_L3_TIME_RING_Privileged = false; +const TargetTypes_t ATTR_L3_TIME_RING_TargetTypes = TARGET_TYPE_EX; +const bool ATTR_L3_TIME_RING_PlatInit = true; +const bool ATTR_L3_TIME_RING_InitToZero = false; +#define ATTR_L3_TIME_RING_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_L3_GPTR_RING */ +typedef uint32_t ATTR_L3_GPTR_RING_Type; +const bool ATTR_L3_GPTR_RING_Privileged = false; +const TargetTypes_t ATTR_L3_GPTR_RING_TargetTypes = TARGET_TYPE_EX; +const bool ATTR_L3_GPTR_RING_PlatInit = true; +const bool ATTR_L3_GPTR_RING_InitToZero = false; +#define ATTR_L3_GPTR_RING_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_DPLL_RING */ +typedef uint32_t ATTR_DPLL_RING_Type; +const bool ATTR_DPLL_RING_Privileged = false; +const TargetTypes_t ATTR_DPLL_RING_TargetTypes = TARGET_TYPE_EQ; +const bool ATTR_DPLL_RING_PlatInit = true; +const bool ATTR_DPLL_RING_InitToZero = false; +#define ATTR_DPLL_RING_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_FSI */ +typedef uint16_t ATTR_PG_FSI_Type; +const bool ATTR_PG_FSI_Privileged = false; +const TargetTypes_t ATTR_PG_FSI_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_FSI_PlatInit = false; +const bool ATTR_PG_FSI_InitToZero = false; +#define ATTR_PG_FSI_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_PRV */ +typedef uint16_t ATTR_PG_PRV_Type; +const bool ATTR_PG_PRV_Privileged = false; +const TargetTypes_t ATTR_PG_PRV_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_PRV_PlatInit = false; +const bool ATTR_PG_PRV_InitToZero = false; +#define ATTR_PG_PRV_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_N0 */ +typedef uint16_t ATTR_PG_N0_Type; +const bool ATTR_PG_N0_Privileged = false; +const TargetTypes_t ATTR_PG_N0_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_N0_PlatInit = false; +const bool ATTR_PG_N0_InitToZero = false; +#define ATTR_PG_N0_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_N1 */ +typedef uint16_t ATTR_PG_N1_Type; +const bool ATTR_PG_N1_Privileged = false; +const TargetTypes_t ATTR_PG_N1_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_N1_PlatInit = false; +const bool ATTR_PG_N1_InitToZero = false; +#define ATTR_PG_N1_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_N2 */ +typedef uint16_t ATTR_PG_N2_Type; +const bool ATTR_PG_N2_Privileged = false; +const TargetTypes_t ATTR_PG_N2_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_N2_PlatInit = false; +const bool ATTR_PG_N2_InitToZero = false; +#define ATTR_PG_N2_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_N3 */ +typedef uint16_t ATTR_PG_N3_Type; +const bool ATTR_PG_N3_Privileged = false; +const TargetTypes_t ATTR_PG_N3_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_N3_PlatInit = false; +const bool ATTR_PG_N3_InitToZero = false; +#define ATTR_PG_N3_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_XB */ +typedef uint16_t ATTR_PG_XB_Type; +const bool ATTR_PG_XB_Privileged = false; +const TargetTypes_t ATTR_PG_XB_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_XB_PlatInit = false; +const bool ATTR_PG_XB_InitToZero = false; +#define ATTR_PG_XB_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_MC01 */ +typedef uint16_t ATTR_PG_MC01_Type; +const bool ATTR_PG_MC01_Privileged = false; +const TargetTypes_t ATTR_PG_MC01_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_MC01_PlatInit = false; +const bool ATTR_PG_MC01_InitToZero = false; +#define ATTR_PG_MC01_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_MC23 */ +typedef uint16_t ATTR_PG_MC23_Type; +const bool ATTR_PG_MC23_Privileged = false; +const TargetTypes_t ATTR_PG_MC23_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_MC23_PlatInit = false; +const bool ATTR_PG_MC23_InitToZero = false; +#define ATTR_PG_MC23_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_OB0 */ +typedef uint16_t ATTR_PG_OB0_Type; +const bool ATTR_PG_OB0_Privileged = false; +const TargetTypes_t ATTR_PG_OB0_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_OB0_PlatInit = false; +const bool ATTR_PG_OB0_InitToZero = false; +#define ATTR_PG_OB0_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_OB1 */ +typedef uint16_t ATTR_PG_OB1_Type; +const bool ATTR_PG_OB1_Privileged = false; +const TargetTypes_t ATTR_PG_OB1_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_OB1_PlatInit = false; +const bool ATTR_PG_OB1_InitToZero = false; +#define ATTR_PG_OB1_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_OB2 */ +typedef uint16_t ATTR_PG_OB2_Type; +const bool ATTR_PG_OB2_Privileged = false; +const TargetTypes_t ATTR_PG_OB2_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_OB2_PlatInit = false; +const bool ATTR_PG_OB2_InitToZero = false; +#define ATTR_PG_OB2_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_OB3 */ +typedef uint16_t ATTR_PG_OB3_Type; +const bool ATTR_PG_OB3_Privileged = false; +const TargetTypes_t ATTR_PG_OB3_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_OB3_PlatInit = false; +const bool ATTR_PG_OB3_InitToZero = false; +#define ATTR_PG_OB3_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_PCI0 */ +typedef uint16_t ATTR_PG_PCI0_Type; +const bool ATTR_PG_PCI0_Privileged = false; +const TargetTypes_t ATTR_PG_PCI0_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_PCI0_PlatInit = false; +const bool ATTR_PG_PCI0_InitToZero = false; +#define ATTR_PG_PCI0_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_PCI1 */ +typedef uint16_t ATTR_PG_PCI1_Type; +const bool ATTR_PG_PCI1_Privileged = false; +const TargetTypes_t ATTR_PG_PCI1_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_PCI1_PlatInit = false; +const bool ATTR_PG_PCI1_InitToZero = false; +#define ATTR_PG_PCI1_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_PCI2 */ +typedef uint16_t ATTR_PG_PCI2_Type; +const bool ATTR_PG_PCI2_Privileged = false; +const TargetTypes_t ATTR_PG_PCI2_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_PCI2_PlatInit = false; +const bool ATTR_PG_PCI2_InitToZero = false; +#define ATTR_PG_PCI2_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EQ0 */ +typedef uint16_t ATTR_PG_EQ0_Type; +const bool ATTR_PG_EQ0_Privileged = false; +const TargetTypes_t ATTR_PG_EQ0_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EQ0_PlatInit = false; +const bool ATTR_PG_EQ0_InitToZero = false; +#define ATTR_PG_EQ0_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EQ1 */ +typedef uint16_t ATTR_PG_EQ1_Type; +const bool ATTR_PG_EQ1_Privileged = false; +const TargetTypes_t ATTR_PG_EQ1_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EQ1_PlatInit = false; +const bool ATTR_PG_EQ1_InitToZero = false; +#define ATTR_PG_EQ1_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EQ2 */ +typedef uint16_t ATTR_PG_EQ2_Type; +const bool ATTR_PG_EQ2_Privileged = false; +const TargetTypes_t ATTR_PG_EQ2_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EQ2_PlatInit = false; +const bool ATTR_PG_EQ2_InitToZero = false; +#define ATTR_PG_EQ2_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EQ3 */ +typedef uint16_t ATTR_PG_EQ3_Type; +const bool ATTR_PG_EQ3_Privileged = false; +const TargetTypes_t ATTR_PG_EQ3_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EQ3_PlatInit = false; +const bool ATTR_PG_EQ3_InitToZero = false; +#define ATTR_PG_EQ3_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EQ4 */ +typedef uint16_t ATTR_PG_EQ4_Type; +const bool ATTR_PG_EQ4_Privileged = false; +const TargetTypes_t ATTR_PG_EQ4_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EQ4_PlatInit = false; +const bool ATTR_PG_EQ4_InitToZero = false; +#define ATTR_PG_EQ4_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EQ5 */ +typedef uint16_t ATTR_PG_EQ5_Type; +const bool ATTR_PG_EQ5_Privileged = false; +const TargetTypes_t ATTR_PG_EQ5_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EQ5_PlatInit = false; +const bool ATTR_PG_EQ5_InitToZero = false; +#define ATTR_PG_EQ5_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC00 */ +typedef uint16_t ATTR_PG_EC00_Type; +const bool ATTR_PG_EC00_Privileged = false; +const TargetTypes_t ATTR_PG_EC00_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC00_PlatInit = false; +const bool ATTR_PG_EC00_InitToZero = false; +#define ATTR_PG_EC00_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC01 */ +typedef uint16_t ATTR_PG_EC01_Type; +const bool ATTR_PG_EC01_Privileged = false; +const TargetTypes_t ATTR_PG_EC01_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC01_PlatInit = false; +const bool ATTR_PG_EC01_InitToZero = false; +#define ATTR_PG_EC01_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC02 */ +typedef uint16_t ATTR_PG_EC02_Type; +const bool ATTR_PG_EC02_Privileged = false; +const TargetTypes_t ATTR_PG_EC02_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC02_PlatInit = false; +const bool ATTR_PG_EC02_InitToZero = false; +#define ATTR_PG_EC02_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC03 */ +typedef uint16_t ATTR_PG_EC03_Type; +const bool ATTR_PG_EC03_Privileged = false; +const TargetTypes_t ATTR_PG_EC03_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC03_PlatInit = false; +const bool ATTR_PG_EC03_InitToZero = false; +#define ATTR_PG_EC03_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC04 */ +typedef uint16_t ATTR_PG_EC04_Type; +const bool ATTR_PG_EC04_Privileged = false; +const TargetTypes_t ATTR_PG_EC04_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC04_PlatInit = false; +const bool ATTR_PG_EC04_InitToZero = false; +#define ATTR_PG_EC04_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC05 */ +typedef uint16_t ATTR_PG_EC05_Type; +const bool ATTR_PG_EC05_Privileged = false; +const TargetTypes_t ATTR_PG_EC05_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC05_PlatInit = false; +const bool ATTR_PG_EC05_InitToZero = false; +#define ATTR_PG_EC05_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC06 */ +typedef uint16_t ATTR_PG_EC06_Type; +const bool ATTR_PG_EC06_Privileged = false; +const TargetTypes_t ATTR_PG_EC06_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC06_PlatInit = false; +const bool ATTR_PG_EC06_InitToZero = false; +#define ATTR_PG_EC06_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC07 */ +typedef uint16_t ATTR_PG_EC07_Type; +const bool ATTR_PG_EC07_Privileged = false; +const TargetTypes_t ATTR_PG_EC07_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC07_PlatInit = false; +const bool ATTR_PG_EC07_InitToZero = false; +#define ATTR_PG_EC07_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC08 */ +typedef uint16_t ATTR_PG_EC08_Type; +const bool ATTR_PG_EC08_Privileged = false; +const TargetTypes_t ATTR_PG_EC08_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC08_PlatInit = false; +const bool ATTR_PG_EC08_InitToZero = false; +#define ATTR_PG_EC08_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC09 */ +typedef uint16_t ATTR_PG_EC09_Type; +const bool ATTR_PG_EC09_Privileged = false; +const TargetTypes_t ATTR_PG_EC09_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC09_PlatInit = false; +const bool ATTR_PG_EC09_InitToZero = false; +#define ATTR_PG_EC09_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC10 */ +typedef uint16_t ATTR_PG_EC10_Type; +const bool ATTR_PG_EC10_Privileged = false; +const TargetTypes_t ATTR_PG_EC10_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC10_PlatInit = false; +const bool ATTR_PG_EC10_InitToZero = false; +#define ATTR_PG_EC10_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC11 */ +typedef uint16_t ATTR_PG_EC11_Type; +const bool ATTR_PG_EC11_Privileged = false; +const TargetTypes_t ATTR_PG_EC11_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC11_PlatInit = false; +const bool ATTR_PG_EC11_InitToZero = false; +#define ATTR_PG_EC11_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC12 */ +typedef uint16_t ATTR_PG_EC12_Type; +const bool ATTR_PG_EC12_Privileged = false; +const TargetTypes_t ATTR_PG_EC12_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC12_PlatInit = false; +const bool ATTR_PG_EC12_InitToZero = false; +#define ATTR_PG_EC12_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC13 */ +typedef uint16_t ATTR_PG_EC13_Type; +const bool ATTR_PG_EC13_Privileged = false; +const TargetTypes_t ATTR_PG_EC13_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC13_PlatInit = false; +const bool ATTR_PG_EC13_InitToZero = false; +#define ATTR_PG_EC13_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC14 */ +typedef uint16_t ATTR_PG_EC14_Type; +const bool ATTR_PG_EC14_Privileged = false; +const TargetTypes_t ATTR_PG_EC14_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC14_PlatInit = false; +const bool ATTR_PG_EC14_InitToZero = false; +#define ATTR_PG_EC14_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC15 */ +typedef uint16_t ATTR_PG_EC15_Type; +const bool ATTR_PG_EC15_Privileged = false; +const TargetTypes_t ATTR_PG_EC15_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC15_PlatInit = false; +const bool ATTR_PG_EC15_InitToZero = false; +#define ATTR_PG_EC15_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC16 */ +typedef uint16_t ATTR_PG_EC16_Type; +const bool ATTR_PG_EC16_Privileged = false; +const TargetTypes_t ATTR_PG_EC16_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC16_PlatInit = false; +const bool ATTR_PG_EC16_InitToZero = false; +#define ATTR_PG_EC16_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC17 */ +typedef uint16_t ATTR_PG_EC17_Type; +const bool ATTR_PG_EC17_Privileged = false; +const TargetTypes_t ATTR_PG_EC17_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC17_PlatInit = false; +const bool ATTR_PG_EC17_InitToZero = false; +#define ATTR_PG_EC17_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC18 */ +typedef uint16_t ATTR_PG_EC18_Type; +const bool ATTR_PG_EC18_Privileged = false; +const TargetTypes_t ATTR_PG_EC18_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC18_PlatInit = false; +const bool ATTR_PG_EC18_InitToZero = false; +#define ATTR_PG_EC18_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC19 */ +typedef uint16_t ATTR_PG_EC19_Type; +const bool ATTR_PG_EC19_Privileged = false; +const TargetTypes_t ATTR_PG_EC19_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC19_PlatInit = false; +const bool ATTR_PG_EC19_InitToZero = false; +#define ATTR_PG_EC19_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC20 */ +typedef uint16_t ATTR_PG_EC20_Type; +const bool ATTR_PG_EC20_Privileged = false; +const TargetTypes_t ATTR_PG_EC20_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC20_PlatInit = false; +const bool ATTR_PG_EC20_InitToZero = false; +#define ATTR_PG_EC20_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC21 */ +typedef uint16_t ATTR_PG_EC21_Type; +const bool ATTR_PG_EC21_Privileged = false; +const TargetTypes_t ATTR_PG_EC21_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC21_PlatInit = false; +const bool ATTR_PG_EC21_InitToZero = false; +#define ATTR_PG_EC21_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC22 */ +typedef uint16_t ATTR_PG_EC22_Type; +const bool ATTR_PG_EC22_Privileged = false; +const TargetTypes_t ATTR_PG_EC22_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC22_PlatInit = false; +const bool ATTR_PG_EC22_InitToZero = false; +#define ATTR_PG_EC22_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_PG_EC23 */ +typedef uint16_t ATTR_PG_EC23_Type; +const bool ATTR_PG_EC23_Privileged = false; +const TargetTypes_t ATTR_PG_EC23_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_PG_EC23_PlatInit = false; +const bool ATTR_PG_EC23_InitToZero = false; +#define ATTR_PG_EC23_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_CHIP_UNIT_POS */ +typedef uint8_t ATTR_CHIP_UNIT_POS_Type; +const bool ATTR_CHIP_UNIT_POS_Privileged = false; +const TargetTypes_t ATTR_CHIP_UNIT_POS_TargetTypes = TARGET_TYPE_PERV; +const bool ATTR_CHIP_UNIT_POS_PlatInit = false; +const bool ATTR_CHIP_UNIT_POS_InitToZero = false; +#define ATTR_CHIP_UNIT_POS_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_FABRIC_SYSTEM_ID */ +typedef uint8_t ATTR_FABRIC_SYSTEM_ID_Type; +const bool ATTR_FABRIC_SYSTEM_ID_Privileged = false; +const TargetTypes_t ATTR_FABRIC_SYSTEM_ID_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_FABRIC_SYSTEM_ID_PlatInit = true; +const bool ATTR_FABRIC_SYSTEM_ID_InitToZero = false; +#define ATTR_FABRIC_SYSTEM_ID_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_SYSTEM_IPL_PHASE */ +typedef uint8_t ATTR_SYSTEM_IPL_PHASE_Type; +const bool ATTR_SYSTEM_IPL_PHASE_Privileged = false; +const TargetTypes_t ATTR_SYSTEM_IPL_PHASE_TargetTypes = TARGET_TYPE_SYSTEM; +const bool ATTR_SYSTEM_IPL_PHASE_PlatInit = true; +const bool ATTR_SYSTEM_IPL_PHASE_InitToZero = false; +enum ATTR_SYSTEM_IPL_PHASE_Enum +{ + ENUM_ATTR_SYSTEM_IPL_PHASE_HB_IPL = 0x1, + ENUM_ATTR_SYSTEM_IPL_PHASE_HB_RUNTIME = 0x2, + ENUM_ATTR_SYSTEM_IPL_PHASE_CACHE_CONTAINED = 0x4, +}; +#define ATTR_SYSTEM_IPL_PHASE_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_BACKUP_SEEPROM_SELECT */ +typedef uint8_t ATTR_BACKUP_SEEPROM_SELECT_Type; +const bool ATTR_BACKUP_SEEPROM_SELECT_Privileged = false; +const TargetTypes_t ATTR_BACKUP_SEEPROM_SELECT_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_BACKUP_SEEPROM_SELECT_PlatInit = false; +const bool ATTR_BACKUP_SEEPROM_SELECT_InitToZero = false; +#define ATTR_BACKUP_SEEPROM_SELECT_SETMACRO ATTRIBUTE_NOT_WRITABLE + +/* ATTR_MC_SYNC_MODE */ +typedef uint8_t ATTR_MC_SYNC_MODE_Type; +const bool ATTR_MC_SYNC_MODE_Privileged = false; +const TargetTypes_t ATTR_MC_SYNC_MODE_TargetTypes = TARGET_TYPE_PROC_CHIP; +const bool ATTR_MC_SYNC_MODE_PlatInit = false; +const bool ATTR_MC_SYNC_MODE_InitToZero = false; +#define ATTR_MC_SYNC_MODE_SETMACRO ATTRIBUTE_NOT_WRITABLE + +} //fapi2 + +#endif // __ASSEMBLER__ + +#endif diff --git a/hwpf/include/fapi2AttributePlatCheck.H b/hwpf/include/fapi2AttributePlatCheck.H new file mode 100644 index 00000000..f02c02cc --- /dev/null +++ b/hwpf/include/fapi2AttributePlatCheck.H @@ -0,0 +1,361 @@ +// fapiAttributePlatCheck.H +// This file is generated by perl script fapiParseAttributeInfo.pl +// A platform can include it to ensure that it handles all HWPF +// attributes + +#ifndef FAPIATTRIBUTEPLATCHECK_H_ +#define FAPIATTRIBUTEPLATCHECK_H_ + +#ifndef ATTR_SCRATCH_UINT8_1_SETMACRO +#error Platform does not support set of HWPF attr ATTR_SCRATCH_UINT8_1 +#endif +#ifndef ATTR_SCRATCH_UINT8_1_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_UINT8_1 +#endif + +#ifndef ATTR_SCRATCH_UINT8_2_SETMACRO +#error Platform does not support set of HWPF attr ATTR_SCRATCH_UINT8_2 +#endif +#ifndef ATTR_SCRATCH_UINT8_2_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_UINT8_2 +#endif + +#ifndef ATTR_SCRATCH_UINT32_1_SETMACRO +#error Platform does not support set of HWPF attr ATTR_SCRATCH_UINT32_1 +#endif +#ifndef ATTR_SCRATCH_UINT32_1_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_UINT32_1 +#endif + +#ifndef ATTR_SCRATCH_UINT32_2_SETMACRO +#error Platform does not support set of HWPF attr ATTR_SCRATCH_UINT32_2 +#endif +#ifndef ATTR_SCRATCH_UINT32_2_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_UINT32_2 +#endif + +#ifndef ATTR_SCRATCH_UINT64_1_SETMACRO +#error Platform does not support set of HWPF attr ATTR_SCRATCH_UINT64_1 +#endif +#ifndef ATTR_SCRATCH_UINT64_1_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_UINT64_1 +#endif + +#ifndef ATTR_SCRATCH_UINT64_2_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_UINT64_2 +#endif + +#ifndef ATTR_SCRATCH_INT8_1_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_INT8_1 +#endif + +#ifndef ATTR_SCRATCH_INT8_2_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_INT8_2 +#endif + +#ifndef ATTR_SCRATCH_INT32_1_SETMACRO +#error Platform does not support set of HWPF attr ATTR_SCRATCH_INT32_1 +#endif +#ifndef ATTR_SCRATCH_INT32_1_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_INT32_1 +#endif + +#ifndef ATTR_SCRATCH_INT32_2_SETMACRO +#error Platform does not support set of HWPF attr ATTR_SCRATCH_INT32_2 +#endif +#ifndef ATTR_SCRATCH_INT32_2_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_INT32_2 +#endif + +#ifndef ATTR_SCRATCH_INT64_1_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_INT64_1 +#endif + +#ifndef ATTR_SCRATCH_INT64_2_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_INT64_2 +#endif + +#ifndef ATTR_SCRATCH_UINT32_ARRAY_SETMACRO +#error Platform does not support set of HWPF attr ATTR_SCRATCH_UINT32_ARRAY +#endif +#ifndef ATTR_SCRATCH_UINT32_ARRAY_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_UINT32_ARRAY +#endif + +#ifndef ATTR_SCRATCH_UINT32_PERV_ARRAY_SETMACRO +#error Platform does not support set of HWPF attr ATTR_SCRATCH_UINT32_PERV_ARRAY +#endif +#ifndef ATTR_SCRATCH_UINT32_PERV_ARRAY_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SCRATCH_UINT32_PERV_ARRAY +#endif + +#ifndef ATTR_REPR_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_REPR_RING +#endif + +#ifndef ATTR_TIME_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_TIME_RING +#endif + +#ifndef ATTR_GPTR_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_GPTR_RING +#endif + +#ifndef ATTR_PLL_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PLL_RING +#endif + +#ifndef ATTR_CORE_REPR_RING_SETMACRO +#error Platform does not support set of HWPF attr ATTR_CORE_REPR_RING +#endif +#ifndef ATTR_CORE_REPR_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_CORE_REPR_RING +#endif + +#ifndef ATTR_CORE_TIME_RING_SETMACRO +#error Platform does not support set of HWPF attr ATTR_CORE_TIME_RING +#endif +#ifndef ATTR_CORE_TIME_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_CORE_TIME_RING +#endif + +#ifndef ATTR_CORE_GPTR_RING_SETMACRO +#error Platform does not support set of HWPF attr ATTR_CORE_GPTR_RING +#endif +#ifndef ATTR_CORE_GPTR_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_CORE_GPTR_RING +#endif + +#ifndef ATTR_L2_REPR_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_L2_REPR_RING +#endif + +#ifndef ATTR_L2_TIME_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_L2_TIME_RING +#endif + +#ifndef ATTR_L2_GPTR_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_L2_GPTR_RING +#endif + +#ifndef ATTR_L3_REPR_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_L3_REPR_RING +#endif + +#ifndef ATTR_L3_TIME_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_L3_TIME_RING +#endif + +#ifndef ATTR_L3_GPTR_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_L3_GPTR_RING +#endif + +#ifndef ATTR_DPLL_RING_GETMACRO +#error Platform does not support get of HWPF attr ATTR_DPLL_RING +#endif + +#ifndef ATTR_PG_FSI_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_FSI +#endif + +#ifndef ATTR_PG_PRV_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_PRV +#endif + +#ifndef ATTR_PG_N0_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_N0 +#endif + +#ifndef ATTR_PG_N1_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_N1 +#endif + +#ifndef ATTR_PG_N2_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_N2 +#endif + +#ifndef ATTR_PG_N3_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_N3 +#endif + +#ifndef ATTR_PG_XB_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_XB +#endif + +#ifndef ATTR_PG_MC01_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_MC01 +#endif + +#ifndef ATTR_PG_MC23_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_MC23 +#endif + +#ifndef ATTR_PG_OB0_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_OB0 +#endif + +#ifndef ATTR_PG_OB1_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_OB1 +#endif + +#ifndef ATTR_PG_OB2_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_OB2 +#endif + +#ifndef ATTR_PG_OB3_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_OB3 +#endif + +#ifndef ATTR_PG_PCI0_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_PCI0 +#endif + +#ifndef ATTR_PG_PCI1_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_PCI1 +#endif + +#ifndef ATTR_PG_PCI2_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_PCI2 +#endif + +#ifndef ATTR_PG_EQ0_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EQ0 +#endif + +#ifndef ATTR_PG_EQ1_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EQ1 +#endif + +#ifndef ATTR_PG_EQ2_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EQ2 +#endif + +#ifndef ATTR_PG_EQ3_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EQ3 +#endif + +#ifndef ATTR_PG_EQ4_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EQ4 +#endif + +#ifndef ATTR_PG_EQ5_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EQ5 +#endif + +#ifndef ATTR_PG_EC00_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC00 +#endif + +#ifndef ATTR_PG_EC01_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC01 +#endif + +#ifndef ATTR_PG_EC02_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC02 +#endif + +#ifndef ATTR_PG_EC03_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC03 +#endif + +#ifndef ATTR_PG_EC04_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC04 +#endif + +#ifndef ATTR_PG_EC05_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC05 +#endif + +#ifndef ATTR_PG_EC06_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC06 +#endif + +#ifndef ATTR_PG_EC07_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC07 +#endif + +#ifndef ATTR_PG_EC08_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC08 +#endif + +#ifndef ATTR_PG_EC09_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC09 +#endif + +#ifndef ATTR_PG_EC10_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC10 +#endif + +#ifndef ATTR_PG_EC11_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC11 +#endif + +#ifndef ATTR_PG_EC12_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC12 +#endif + +#ifndef ATTR_PG_EC13_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC13 +#endif + +#ifndef ATTR_PG_EC14_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC14 +#endif + +#ifndef ATTR_PG_EC15_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC15 +#endif + +#ifndef ATTR_PG_EC16_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC16 +#endif + +#ifndef ATTR_PG_EC17_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC17 +#endif + +#ifndef ATTR_PG_EC18_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC18 +#endif + +#ifndef ATTR_PG_EC19_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC19 +#endif + +#ifndef ATTR_PG_EC20_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC20 +#endif + +#ifndef ATTR_PG_EC21_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC21 +#endif + +#ifndef ATTR_PG_EC22_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC22 +#endif + +#ifndef ATTR_PG_EC23_GETMACRO +#error Platform does not support get of HWPF attr ATTR_PG_EC23 +#endif + +#ifndef ATTR_CHIP_UNIT_POS_GETMACRO +#error Platform does not support get of HWPF attr ATTR_CHIP_UNIT_POS +#endif + +#ifndef ATTR_FABRIC_SYSTEM_ID_GETMACRO +#error Platform does not support get of HWPF attr ATTR_FABRIC_SYSTEM_ID +#endif + +#ifndef ATTR_SYSTEM_IPL_PHASE_GETMACRO +#error Platform does not support get of HWPF attr ATTR_SYSTEM_IPL_PHASE +#endif + +#ifndef ATTR_BACKUP_SEEPROM_SELECT_GETMACRO +#error Platform does not support get of HWPF attr ATTR_BACKUP_SEEPROM_SELECT +#endif + +#ifndef ATTR_MC_SYNC_MODE_GETMACRO +#error Platform does not support get of HWPF attr ATTR_MC_SYNC_MODE +#endif + +#endif diff --git a/hwpf/include/fapi2AttributeService.C b/hwpf/include/fapi2AttributeService.C new file mode 100644 index 00000000..c58e7a62 --- /dev/null +++ b/hwpf/include/fapi2AttributeService.C @@ -0,0 +1,519 @@ +// fapi2AttributeService.C +// This file is generated by perl script fapi2CreateIfAttrService.pl + +#include <fapi2AttributeService.H> +//#include <fapi2ChipEcFeature.H> +//#include <fapi2PlatTrace.H> + +namespace fapi2 +{ + +ReturnCode fapiGetInitFileAttr(const AttributeId i_id, + const Target * i_pTarget, + uint64_t & o_val, + const uint32_t i_arrayIndex1, + const uint32_t i_arrayIndex2, + const uint32_t i_arrayIndex3, + const uint32_t i_arrayIndex4) +{ + ReturnCode l_rc; + + if (i_id == ATTR_SCRATCH_UINT8_1) + { + ATTR_SCRATCH_UINT8_1_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_1, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_UINT8_2) + { + ATTR_SCRATCH_UINT8_2_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_2, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_UINT32_1) + { + ATTR_SCRATCH_UINT32_1_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_1, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_UINT32_2) + { + ATTR_SCRATCH_UINT32_2_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_2, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_UINT64_1) + { + ATTR_SCRATCH_UINT64_1_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_1, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_UINT64_2) + { + ATTR_SCRATCH_UINT64_2_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_2, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_INT8_1) + { + ATTR_SCRATCH_INT8_1_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_INT8_1, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_INT8_2) + { + ATTR_SCRATCH_INT8_2_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_INT8_2, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_INT32_1) + { + ATTR_SCRATCH_INT32_1_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_INT32_1, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_INT32_2) + { + ATTR_SCRATCH_INT32_2_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_INT32_2, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_INT64_1) + { + ATTR_SCRATCH_INT64_1_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_INT64_1, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_INT64_2) + { + ATTR_SCRATCH_INT64_2_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_INT64_2, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SCRATCH_UINT32_ARRAY) + { + ATTR_SCRATCH_UINT32_ARRAY_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_ARRAY, i_pTarget, l_attr); + o_val = l_attr[i_arrayIndex1]; + } + else if (i_id == ATTR_SCRATCH_UINT32_PERV_ARRAY) + { + ATTR_SCRATCH_UINT32_PERV_ARRAY_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_PERV_ARRAY, i_pTarget, l_attr); + o_val = l_attr[i_arrayIndex1]; + } + else if (i_id == ATTR_REPR_RING) + { + ATTR_REPR_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_REPR_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_TIME_RING) + { + ATTR_TIME_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_TIME_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_GPTR_RING) + { + ATTR_GPTR_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_GPTR_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PLL_RING) + { + ATTR_PLL_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PLL_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_CORE_REPR_RING) + { + ATTR_CORE_REPR_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_CORE_REPR_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_CORE_TIME_RING) + { + ATTR_CORE_TIME_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_CORE_TIME_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_CORE_GPTR_RING) + { + ATTR_CORE_GPTR_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_CORE_GPTR_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_L2_REPR_RING) + { + ATTR_L2_REPR_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_L2_REPR_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_L2_TIME_RING) + { + ATTR_L2_TIME_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_L2_TIME_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_L2_GPTR_RING) + { + ATTR_L2_GPTR_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_L2_GPTR_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_L3_REPR_RING) + { + ATTR_L3_REPR_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_L3_REPR_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_L3_TIME_RING) + { + ATTR_L3_TIME_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_L3_TIME_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_L3_GPTR_RING) + { + ATTR_L3_GPTR_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_L3_GPTR_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_DPLL_RING) + { + ATTR_DPLL_RING_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_DPLL_RING, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_FSI) + { + ATTR_PG_FSI_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_FSI, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_PRV) + { + ATTR_PG_PRV_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_PRV, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_N0) + { + ATTR_PG_N0_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_N0, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_N1) + { + ATTR_PG_N1_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_N1, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_N2) + { + ATTR_PG_N2_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_N2, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_N3) + { + ATTR_PG_N3_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_N3, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_XB) + { + ATTR_PG_XB_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_XB, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_MC01) + { + ATTR_PG_MC01_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_MC01, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_MC23) + { + ATTR_PG_MC23_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_MC23, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_OB0) + { + ATTR_PG_OB0_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_OB0, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_OB1) + { + ATTR_PG_OB1_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_OB1, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_OB2) + { + ATTR_PG_OB2_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_OB2, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_OB3) + { + ATTR_PG_OB3_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_OB3, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_PCI0) + { + ATTR_PG_PCI0_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_PCI0, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_PCI1) + { + ATTR_PG_PCI1_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_PCI1, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_PCI2) + { + ATTR_PG_PCI2_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_PCI2, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EQ0) + { + ATTR_PG_EQ0_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EQ0, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EQ1) + { + ATTR_PG_EQ1_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EQ1, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EQ2) + { + ATTR_PG_EQ2_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EQ2, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EQ3) + { + ATTR_PG_EQ3_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EQ3, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EQ4) + { + ATTR_PG_EQ4_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EQ4, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EQ5) + { + ATTR_PG_EQ5_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EQ5, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC00) + { + ATTR_PG_EC00_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC00, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC01) + { + ATTR_PG_EC01_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC01, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC02) + { + ATTR_PG_EC02_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC02, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC03) + { + ATTR_PG_EC03_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC03, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC04) + { + ATTR_PG_EC04_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC04, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC05) + { + ATTR_PG_EC05_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC05, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC06) + { + ATTR_PG_EC06_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC06, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC07) + { + ATTR_PG_EC07_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC07, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC08) + { + ATTR_PG_EC08_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC08, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC09) + { + ATTR_PG_EC09_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC09, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC10) + { + ATTR_PG_EC10_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC10, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC11) + { + ATTR_PG_EC11_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC11, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC12) + { + ATTR_PG_EC12_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC12, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC13) + { + ATTR_PG_EC13_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC13, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC14) + { + ATTR_PG_EC14_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC14, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC15) + { + ATTR_PG_EC15_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC15, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC16) + { + ATTR_PG_EC16_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC16, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC17) + { + ATTR_PG_EC17_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC17, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC18) + { + ATTR_PG_EC18_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC18, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC19) + { + ATTR_PG_EC19_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC19, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC20) + { + ATTR_PG_EC20_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC20, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC21) + { + ATTR_PG_EC21_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC21, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC22) + { + ATTR_PG_EC22_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC22, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_PG_EC23) + { + ATTR_PG_EC23_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_PG_EC23, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_CHIP_UNIT_POS) + { + ATTR_CHIP_UNIT_POS_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_FABRIC_SYSTEM_ID) + { + ATTR_FABRIC_SYSTEM_ID_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_FABRIC_SYSTEM_ID, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_SYSTEM_IPL_PHASE) + { + ATTR_SYSTEM_IPL_PHASE_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_SYSTEM_IPL_PHASE, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_BACKUP_SEEPROM_SELECT) + { + ATTR_BACKUP_SEEPROM_SELECT_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_BACKUP_SEEPROM_SELECT, i_pTarget, l_attr); + o_val = l_attr; + } + else if (i_id == ATTR_MC_SYNC_MODE) + { + ATTR_MC_SYNC_MODE_Type l_attr; + l_rc = FAPI_ATTR_GET(ATTR_MC_SYNC_MODE, i_pTarget, l_attr); + o_val = l_attr; + } + else + { + FAPI_ERR("fapiGetInitFileAttr: Unrecognized attr ID: 0x%x", i_id); + l_rc.setFapiError(FAPI_RC_INVALID_ATTR_GET); + l_rc.addEIFfdc(0, &i_id, sizeof(i_id)); + } + + if (l_rc) + { + if (i_pTarget) + { + FAPI_ERR("fapiGetInitFileAttr: Error getting attr ID 0x%x from targType 0x%x", + i_id, i_pTarget->getType()); + } + else + { + FAPI_ERR("fapiGetInitFileAttr: Error getting attr ID 0x%x from system target", + i_id); + } + } + + return l_rc; +} + +} diff --git a/hwpf/include/fapi2AttributeService.H b/hwpf/include/fapi2AttributeService.H new file mode 100644 index 00000000..ab49c9ab --- /dev/null +++ b/hwpf/include/fapi2AttributeService.H @@ -0,0 +1,127 @@ +/// +/// @file fapi2AttributeService.H +/// +/// @brief Defines the FAPI_ATTR_GET and FAPI_ATTR_SET macros that a user +/// calls to get/set attributes and a check function that the macros use to +/// verify correct usage +/// + +#ifndef FAPI2ATTRIBUTESERVICE_H_ +#define FAPI2ATTRIBUTESERVICE_H_ +#include <stdint.h> +//#include <attribute_ids.H> +#include <fapi2AttributeIds.H> +#include <target.H> +#include <target_types.H> +//#include <plat_attribute_service.H> +#include <fapi2PlatAttributeService.H> + +/// @brief Macros called by user to get/set attributes for FAPI2 targets +/// +/// Code must have a reference to a FAPI2 Target and an attribute ID (from +/// XML file): +/// fapi2::ReturnCode l_rc; +/// fapi2::Target<target type>& l_target = ????; +/// Ex: Target<TARGET_TYPE_PROC_CHIP>& l_target = ????; +/// +/// To get a copy of an integer attribute and set the attribute +/// uint64_t l_val = 0; +/// l_rc = FAPI_ATTR_GET(<ID>, l_target, l_val); +/// l_rc = FAPI_ATTR_SET(<ID>, l_target, l_val); +/// +/// To get a copy of an integer array attribute and set the attribute +/// uint32_t l_pVal[4] = {0}; +/// l_rc = FAPI_ATTR_GET(<ID>, l_target, l_pVal); +/// l_rc = FAPI_ATTR_SET(<ID>, l_target, l_pVal); +/// +/// A priveleged attribute is one that a HWP should not generally access, +/// examples include ATTR_NAME and ATTR_EC, where usage can lead to a non +/// data-driven design. A privileged attribute can be accessed with +/// FAPI_ATTR_GET_PRIVILEGED and FAPI_ATTR_SET_PRIVILEGED +/// +/// The non-PRIVILEGED macros first call a template function (compiler will +/// optimize out) that will cause a compile failure if the attribute is +/// privileged, they then call a PRIVILEGED macro to get/set the attribute +/// +/// The PRIVILEGED macros call a template function (compiler will optimize out) +/// that will cause a compile failure if the ID is not valid or VAL is not the +/// correct type. +// + +#define FAPI_ATTR_GET(ID, TARGET, VAL) \ + (fapi2::failIfPrivileged<ID##_Privileged>(), \ + fapi2::checkIdType<ID##_Type>(ID, VAL), \ + ID##_GETMACRO(ID, TARGET, VAL)) + +#define FAPI_ATTR_SET(ID, TARGET, VAL) \ + (fapi2::failIfPrivileged<ID##_Privileged>(), \ + fapi2::checkIdType<ID##_Type>(ID, VAL), \ + ID##_SETMACRO(ID, TARGET, VAL)) + +#define FAPI_ATTR_GET_PRIVILEGED(ID, TARGET, VAL) \ + (fapi2::checkIdType<ID##_Type>(ID, VAL), \ + ID##_GETMACRO(ID, TARGET, VAL)) + +#define FAPI_ATTR_SET_PRIVILEGED(ID, TARGET, VAL) \ + (fapi2::checkIdType<ID##_Type>(ID, VAL), \ + ID##_SETMACRO(ID, TARGET, VAL)) + +namespace fapi2 +{ + +/// +/// @brief Get an InitFile attribute for FAPI2 +/// +/// This function gets a copy of an attribute. In the case of an array attribute, +/// The value in the specified index is retrieved. This should be used by the +/// InitFile HWP only, that HWP processes a binary InitFile and therefore needs +/// to read a variable ID of a variable data type. Standard HWPs should use the +/// FAPI2_ATTR_GET macro which automatically checks the type for correct usage. +/// +/// If there are ever attributes with more than 4 dimensions then this function +/// will need to be updated. +/// +/// @Tparam K template parameter, passed in target. +/// @param[in] i_id AttributeID +/// @param[in] i_target Reference to fapi2::Target (can be NULL for system) +/// @param[out] o_val Reference to uint64_t where attribute value is set +/// @param[in] i_arrayIndex1 If array attribute then index1 +/// @param[in] i_arrayIndex2 If at least 2D array attribute then index2 +/// @param[in] i_arrayIndex3 If at least 3D array attribute then index3 +/// @param[in] i_arrayIndex4 If at least 4D array attribute then index4 +/// +/// @return ReturnCode. Zero if success +/// +template< TargetType K > +ReturnCode getInitFileAttr(const AttributeId i_id, + const Target<K>& i_target, + uint64_t & o_val, + const uint32_t i_arrayIndex1 = 0, + const uint32_t i_arrayIndex2 = 0, + const uint32_t i_arrayIndex3 = 0, + const uint32_t i_arrayIndex4 = 0); + +/** + * @brief Check the ID and TYPE + * + * This is called by FAPI code to check at compile time that a FAPI attribute + * access is using the correct data type and a valid AttributeId + */ +template<typename T> inline void checkIdType(AttributeId, T &) {} + +/** + * @brief Fail if attribute privileged + * + * This is called by FAPI code to check at compile time that a standard FAPI + * attribute access (FAPI_ATTR_GET) is not accessing a privileged attribute + */ +class ErrorAccessingPrivilegedAttribute; +template<const bool PRIVILEGED> void failIfPrivileged() +{ + ErrorAccessingPrivilegedAttribute(); +} +template <> inline void failIfPrivileged<false>() {} + +} + +#endif // FAPI2ATTRIBUTESERVICE_H_ diff --git a/hwpf/include/fapi2AttributesSupported.html b/hwpf/include/fapi2AttributesSupported.html new file mode 100644 index 00000000..e07a7874 --- /dev/null +++ b/hwpf/include/fapi2AttributesSupported.html @@ -0,0 +1,13 @@ +<html> +<body> + +<!-- fapiAttributesSupported.html --> +<!-- This file is generated by perl script fapiParseAttributeInfo.pl --> +<!-- It lists all HWPF attributes supported --> + +<h4>HWPF Attributes supported by this build.</h4> +<table border="4"> +<tr><th>Attribute ID</th><th>Attribute Description</th></tr></table> + +</body> +</html> diff --git a/hwpf/include/fapi2ChipEcFeature.C b/hwpf/include/fapi2ChipEcFeature.C new file mode 100644 index 00000000..820cf775 --- /dev/null +++ b/hwpf/include/fapi2ChipEcFeature.C @@ -0,0 +1,75 @@ +// fapiChipEcFeature.C +// This file is generated by perl script fapiParseAttributeInfo.pl +// It implements the fapiQueryChipEcFeature function + +#include <fapiChipEcFeature.H> +#include <fapiAttributeService.H> +#include <fapiSystemConfig.H> +#include <fapiPlatTrace.H> + +namespace fapi2 +{ + +fapi::ReturnCode fapiQueryChipEcFeature(fapi::AttributeId i_id, + const fapi::Target * i_pTarget, + uint8_t & o_hasFeature) +{ + o_hasFeature = false; + fapi::ReturnCode l_rc; + uint8_t l_chipName = 0; + uint8_t l_chipEc = 0; + fapi::Target l_target = *i_pTarget; + + if (i_pTarget->isChiplet()) + { + l_rc = fapiGetParentChip(*i_pTarget, l_target); + + if (l_rc) + { + FAPI_ERR("fapiQueryChipEcFeature: error getting parent chip"); + } + } + + if (!l_rc) + { + l_rc = FAPI_ATTR_GET_PRIVILEGED(ATTR_NAME, &l_target, l_chipName); + + if (l_rc) + { + FAPI_ERR("fapiQueryChipEcFeature: error getting chip name"); + } + else + { + l_rc = FAPI_ATTR_GET_PRIVILEGED(ATTR_EC, &l_target, l_chipEc); + + if (l_rc) + { + FAPI_ERR("fapiQueryChipEcFeature: error getting chip ec"); + } + else + { + switch (i_id) + { + default: + FAPI_ERR("fapiQueryChipEcFeature: Unknown feature 0x%x", + i_id); + l_rc.setFapiError(FAPI_RC_INVALID_CHIP_EC_FEATURE_GET); + l_rc.addEIFfdc(0, &i_id, sizeof(i_id)); + break; + } + + if (o_hasFeature) + { + FAPI_INF("fapiQueryChipEcFeature: Chip (0x%x:0x%x) has feature (0x%x)", l_chipName, l_chipEc, i_id); + } + else + { + FAPI_INF("fapiQueryChipEcFeature: Chip (0x%x:0x%x) does not have feature (0x%x)", l_chipName, l_chipEc, i_id); + } + } + } + } + return l_rc; +} + +} diff --git a/hwpf/include/fapi2PlatAttributeService.H b/hwpf/include/fapi2PlatAttributeService.H new file mode 100644 index 00000000..ae21a5f7 --- /dev/null +++ b/hwpf/include/fapi2PlatAttributeService.H @@ -0,0 +1,1575 @@ +/** + * @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 <fapi2AttributeIds.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 */ + +#define ATTR_BACKUP_SEEPROM_SELECT_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_CHIP_UNIT_POS_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_CORE_GPTR_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_CORE_GPTR_RING_SETMACRO PLAT_ATTR_SET_GLOBAL_INT +#define ATTR_CORE_REPR_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_CORE_REPR_RING_SETMACRO PLAT_ATTR_SET_GLOBAL_INT +#define ATTR_CORE_TIME_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_CORE_TIME_RING_SETMACRO PLAT_ATTR_SET_GLOBAL_INT +#define ATTR_DPLL_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_FABRIC_SYSTEM_ID_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_GPTR_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_L2_GPTR_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_L2_REPR_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_L2_TIME_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_L3_GPTR_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_L3_REPR_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_L3_TIME_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_MC_SYNC_MODE_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC00_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC01_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC02_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC03_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC04_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC05_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC06_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC07_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC08_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC09_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC10_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC11_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC12_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC13_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC14_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC15_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC16_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC17_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC18_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC19_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC20_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC21_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC22_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EC23_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EQ0_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EQ1_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EQ2_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EQ3_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EQ4_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_EQ5_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_FSI_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_MC01_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_MC23_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_N0_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_N1_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_N2_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_N3_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_OB0_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_OB1_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_OB2_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_OB3_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_PCI0_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_PCI1_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_PCI2_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_PRV_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PG_XB_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_PLL_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_REPR_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_INT32_1_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_INT32_1_SETMACRO PLAT_ATTR_SET_GLOBAL_INT +#define ATTR_SCRATCH_INT32_2_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_INT32_2_SETMACRO PLAT_ATTR_SET_GLOBAL_INT +#define ATTR_SCRATCH_INT64_1_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_INT64_2_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_INT8_1_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_INT8_2_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_UINT32_1_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_UINT32_1_SETMACRO PLAT_ATTR_SET_GLOBAL_INT +#define ATTR_SCRATCH_UINT32_2_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_UINT32_2_SETMACRO PLAT_ATTR_SET_GLOBAL_INT +#define ATTR_SCRATCH_UINT32_ARRAY_GETMACRO PLAT_ATTR_GET_UINT32_1D_ARRAY +#define ATTR_SCRATCH_UINT32_ARRAY_SETMACRO PLAT_ATTR_SET_UINT32_1D_ARRAY +#define ATTR_SCRATCH_UINT32_PERV_ARRAY_GETMACRO PLAT_ATTR_GET_UINT32_1D_ARRAY +#define ATTR_SCRATCH_UINT32_PERV_ARRAY_SETMACRO PLAT_ATTR_SET_UINT32_1D_ARRAY +#define ATTR_SCRATCH_UINT64_1_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_UINT64_1_SETMACRO PLAT_ATTR_SET_GLOBAL_INT +#define ATTR_SCRATCH_UINT64_2_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_UINT8_1_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_UINT8_1_SETMACRO PLAT_ATTR_SET_GLOBAL_INT +#define ATTR_SCRATCH_UINT8_2_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_SCRATCH_UINT8_2_SETMACRO PLAT_ATTR_SET_GLOBAL_INT +#define ATTR_SYSTEM_IPL_PHASE_GETMACRO PLAT_ATTR_GET_GLOBAL_INT +#define ATTR_TIME_RING_GETMACRO PLAT_ATTR_GET_GLOBAL_INT + + +/******************************************************************************/ +/* * 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 */ + +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint8_t, fapi2::ATTR_BACKUP_SEEPROM_SELECT> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint8_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PERV, fapi2attr::PervAttributes_t, uint8_t, fapi2::ATTR_CHIP_UNIT_POS> ( const fapi2::Target<fapi2::TARGET_TYPE_PERV>& i_ptarget, const fapi2attr::PervAttributes_t* object, const fapi2::AttributeId attrid, uint8_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_CORE, fapi2attr::CoreAttributes_t, uint32_t, fapi2::ATTR_CORE_GPTR_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_ptarget, const fapi2attr::CoreAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_CORE, fapi2attr::CoreAttributes_t, uint32_t, fapi2::ATTR_CORE_GPTR_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_ptarget, fapi2attr::CoreAttributes_t* object, const fapi2::AttributeId attrid, const uint32_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_CORE, fapi2attr::CoreAttributes_t, uint32_t, fapi2::ATTR_CORE_REPR_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_ptarget, const fapi2attr::CoreAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_CORE, fapi2attr::CoreAttributes_t, uint32_t, fapi2::ATTR_CORE_REPR_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_ptarget, fapi2attr::CoreAttributes_t* object, const fapi2::AttributeId attrid, const uint32_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_CORE, fapi2attr::CoreAttributes_t, uint32_t, fapi2::ATTR_CORE_TIME_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_ptarget, const fapi2attr::CoreAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_CORE, fapi2attr::CoreAttributes_t, uint32_t, fapi2::ATTR_CORE_TIME_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_ptarget, fapi2attr::CoreAttributes_t* object, const fapi2::AttributeId attrid, const uint32_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_EQ, fapi2attr::EQAttributes_t, uint32_t, fapi2::ATTR_DPLL_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_EQ>& i_ptarget, const fapi2attr::EQAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint8_t, fapi2::ATTR_FABRIC_SYSTEM_ID> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint8_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PERV, fapi2attr::PervAttributes_t, uint32_t, fapi2::ATTR_GPTR_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_PERV>& i_ptarget, const fapi2attr::PervAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_EX, fapi2attr::EXAttributes_t, uint32_t, fapi2::ATTR_L2_GPTR_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_ptarget, const fapi2attr::EXAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_EX, fapi2attr::EXAttributes_t, uint32_t, fapi2::ATTR_L2_REPR_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_ptarget, const fapi2attr::EXAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_EX, fapi2attr::EXAttributes_t, uint32_t, fapi2::ATTR_L2_TIME_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_ptarget, const fapi2attr::EXAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_EX, fapi2attr::EXAttributes_t, uint32_t, fapi2::ATTR_L3_GPTR_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_ptarget, const fapi2attr::EXAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_EX, fapi2attr::EXAttributes_t, uint32_t, fapi2::ATTR_L3_REPR_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_ptarget, const fapi2attr::EXAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_EX, fapi2attr::EXAttributes_t, uint32_t, fapi2::ATTR_L3_TIME_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_ptarget, const fapi2attr::EXAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint8_t, fapi2::ATTR_MC_SYNC_MODE> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint8_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC00> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC01> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC02> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC03> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC04> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC05> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC06> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC07> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC08> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC09> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC10> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC11> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC12> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC13> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC14> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC15> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC16> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC17> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC18> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC19> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC20> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC21> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC22> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EC23> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EQ0> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EQ1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EQ2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EQ3> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EQ4> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_EQ5> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_FSI> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_MC01> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_MC23> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_N0> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_N1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_N2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_N3> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_OB0> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_OB1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_OB2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_OB3> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_PCI0> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_PCI1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_PCI2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_PRV> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint16_t, fapi2::ATTR_PG_XB> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint16_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PERV, fapi2attr::PervAttributes_t, uint32_t, fapi2::ATTR_PLL_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_PERV>& i_ptarget, const fapi2attr::PervAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PERV, fapi2attr::PervAttributes_t, uint32_t, fapi2::ATTR_REPR_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_PERV>& i_ptarget, const fapi2attr::PervAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, int32_t, fapi2::ATTR_SCRATCH_INT32_1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, int32_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, int32_t, fapi2::ATTR_SCRATCH_INT32_1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, const int32_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, int32_t, fapi2::ATTR_SCRATCH_INT32_2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, int32_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, int32_t, fapi2::ATTR_SCRATCH_INT32_2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, const int32_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, int64_t, fapi2::ATTR_SCRATCH_INT64_1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, int64_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, int64_t, fapi2::ATTR_SCRATCH_INT64_2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, int64_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, int8_t, fapi2::ATTR_SCRATCH_INT8_1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, int8_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, int8_t, fapi2::ATTR_SCRATCH_INT8_2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, int8_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint32_t, fapi2::ATTR_SCRATCH_UINT32_1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint32_t, fapi2::ATTR_SCRATCH_UINT32_1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, const uint32_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint32_t, fapi2::ATTR_SCRATCH_UINT32_2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint32_t, fapi2::ATTR_SCRATCH_UINT32_2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, const uint32_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint32_t, fapi2::ATTR_SCRATCH_UINT32_ARRAY> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint32_t, fapi2::ATTR_SCRATCH_UINT32_ARRAY> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, const uint32_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PERV, fapi2attr::PervAttributes_t, uint32_t, fapi2::ATTR_SCRATCH_UINT32_PERV_ARRAY> ( const fapi2::Target<fapi2::TARGET_TYPE_PERV>& i_ptarget, const fapi2attr::PervAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_PERV, fapi2attr::PervAttributes_t, uint32_t, fapi2::ATTR_SCRATCH_UINT32_PERV_ARRAY> ( const fapi2::Target<fapi2::TARGET_TYPE_PERV>& i_ptarget, fapi2attr::PervAttributes_t* object, const fapi2::AttributeId attrid, const uint32_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint64_t, fapi2::ATTR_SCRATCH_UINT64_1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint64_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint64_t, fapi2::ATTR_SCRATCH_UINT64_1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, const uint64_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint64_t, fapi2::ATTR_SCRATCH_UINT64_2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint64_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint8_t, fapi2::ATTR_SCRATCH_UINT8_1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint8_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint8_t, fapi2::ATTR_SCRATCH_UINT8_1> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, const uint8_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint8_t, fapi2::ATTR_SCRATCH_UINT8_2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, const fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, uint8_t* o_pvalue ); +template<> void __set<fapi2::TARGET_TYPE_PROC_CHIP, fapi2attr::ProcChipAttributes_t, uint8_t, fapi2::ATTR_SCRATCH_UINT8_2> ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ptarget, fapi2attr::ProcChipAttributes_t* object, const fapi2::AttributeId attrid, const uint8_t& i_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_SYSTEM, fapi2attr::SystemAttributes_t, uint8_t, fapi2::ATTR_SYSTEM_IPL_PHASE> ( const fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>& i_ptarget, const fapi2attr::SystemAttributes_t* object, const fapi2::AttributeId attrid, uint8_t* o_pvalue ); +template<> void __get<fapi2::TARGET_TYPE_PERV, fapi2attr::PervAttributes_t, uint32_t, fapi2::ATTR_TIME_RING> ( const fapi2::Target<fapi2::TARGET_TYPE_PERV>& i_ptarget, const fapi2attr::PervAttributes_t* object, const fapi2::AttributeId attrid, uint32_t* o_pvalue ); + + + +//****************************************************************************** +// 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, AttributeId A> +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/hwpf/include/fapi2Structs.H b/hwpf/include/fapi2Structs.H new file mode 100644 index 00000000..48d8062e --- /dev/null +++ b/hwpf/include/fapi2Structs.H @@ -0,0 +1,109 @@ +#ifndef fapiStructs_h +#define fapiStructs_h +// Copyright ********************************************************** +// +// File fapiStructs.H +// +// IBM Confidential +// OCO Source Materials +// 9400 Licensed Internal Code +// (C) COPYRIGHT IBM CORP. 1996 +// +// 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. +// +// End Copyright ****************************************************** + +/** + * @file fapiStructs.H + * @brief fapi eCMD Extension Structures + + * Extension Owner : John Farrugia +*/ + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#include <string> + + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +#define ECMD_FAPI_CAPI_VERSION "1.0" ///< eCMD FAPI Extension version + + + +#ifndef ECMD_PERLAPI + +namespace fapi +{ + +/** + * @brief Enumeration of fapi file types + */ +typedef enum { + FAPI_FILE_UNKNOWN, ///< Default for not initialized + FAPI_FILE_HWP +} FileType_t; + + +enum AttributeSource +{ + FAPI_ATTRIBUTE_SOURCE_UNKNOWN = 0x00000000, + FAPI_ATTRIBUTE_SOURCE_PLAT = 0x00000001, + FAPI_ATTRIBUTE_SOURCE_HWP = 0x00000002, +}; + + +#define FAPI_ATTRIBUTE_TYPE_STRING 0x80000000 +#define FAPI_ATTRIBUTE_TYPE_UINT8 0x40000000 +#define FAPI_ATTRIBUTE_TYPE_UINT32 0x20000000 +#define FAPI_ATTRIBUTE_TYPE_UINT64 0x10000000 +#define FAPI_ATTRIBUTE_TYPE_UINT8ARY 0x04000000 +#define FAPI_ATTRIBUTE_TYPE_UINT32ARY 0x02000000 +#define FAPI_ATTRIBUTE_TYPE_UINT64ARY 0x01000000 + +#define FAPI_ATTRIBUTE_MODE_CONST 0x80000000 +/** + @brief Used by the get/set configuration functions to return the data +*/ +template<typename T> +class Attribute +{ +public: + // Constructor + Attribute(); + + // Destructor + ~Attribute(); + + // + /// @brief Assignment Operator. + /// @param[in] i_right Reference to Value to assign from. + /// @return Reference to 'this' Target + /// + Attribute<T>& operator=(const T& i_right) + { + this->value = i_right->value; + } + +private: + T value; + +}; + +inline AttributeData::AttributeData() {} + +inline AttributeData::~AttributeData() {} + +} //namespace +#endif // #ifndef ECMD_PERLAPI +#endif + + + + + diff --git a/hwpf/include/fapi2_hw_access.H b/hwpf/include/fapi2_hw_access.H new file mode 100644 index 00000000..44a592f8 --- /dev/null +++ b/hwpf/include/fapi2_hw_access.H @@ -0,0 +1,464 @@ +/* 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 fapi2_hw_access.H +/// @brief Common file that defines the hardware access functions that +/// platform code must implement. +/// + +#ifndef _FAPI2_COMMON_HWACCESS_H_ +#define _FAPI2_COMMON_HWACCESS_H_ + +#ifdef FAPI_SUPPORT_SPY_AS_ENUM +#include <spy_ids.H> +typedef uint64_t spyId_t; +#endif + +#include <stdint.h> +//#include <thread> +#include <buffer.H> + +// variable_buffer isn't supported on PPE +#ifndef __PPE__ +#include <variable_buffer.H> +#endif + +#include <return_code.H> +#include <target.H> +#include <hw_access_def.H> +#include <plat_hw_access.H> + +#ifdef FAPI_SUPPORT_MULTI_SCOM +#include <multi_scom.H> +#endif + +namespace fapi2 +{ + //-------------------------------------------------------------------------- + // PIB Error Functions + //-------------------------------------------------------------------------- + + /// @brief Sets the PIB error mask - platform dependant + /// @param[in] i_mask The new error mask + inline void setPIBErrorMask(uint8_t i_mask); + + /// @brief Gets the PIB error mask - platform dependant + /// @return uint8_t The current PIB error mask + inline uint8_t getPIBErrorMask(void); + + //-------------------------------------------------------------------------- + // Operational Mode Error Functions + //-------------------------------------------------------------------------- + + /// @brief Sets the operational mode + /// @param[in] i_mode The new mode + inline void setOpMode(const OpModes i_mode); + + /// @brief Gets the operational mode + /// @return the operational mode + inline OpModes getOpMode(void); + + //-------------------------------------------------------------------------- + // HW Communication Functions + //-------------------------------------------------------------------------- + + /// @brief Reads a SCOM register from a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address SCOM register address to read from. + /// @param[out] o_data Buffer that holds data read from HW target. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline void getScom(const Target<K>& i_target, const uint64_t i_address, + buffer<uint64_t>& o_data); + + /// @brief Writes a SCOM register on a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address SCOM register address to write to. + /// @param[in] i_data Buffer that holds data to write into address. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline void putScom(const Target<K>& i_target, const uint64_t i_address, + const buffer<uint64_t> i_data); + + /// @brief Writes a SCOM register under mask on a chip + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address SCOM register address to write to. + /// @param[in] i_data Buffer that holds data to write into address. + /// @param[in] i_mask Buffer that holds the mask value. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline void putScomUnderMask(const Target<K>& i_target, + const uint64_t i_address, + const buffer<uint64_t> i_data, + const buffer<uint64_t> i_mask); + + /// @brief Reads a CFAM register from a chip. + /// CFAM register is 32-bit wide. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address CFAM register address to read from. + /// @param[out] o_data Buffer that holds data read from HW target. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode getCfamRegister(const Target<K>& i_target, + const uint32_t i_address, + buffer<uint32_t>& o_data); + + /// @brief Writes a CFAM register on a chip. + /// CFAM register is 32-bit wide. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address CFAM register address to write to. + /// @param[in] i_data Buffer that holds data to write into address. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode putCfamRegister(const Target<K>& i_target, + const uint32_t i_address, + const buffer<uint32_t> i_data); + + /// @brief Read-modify-write a CFAM register on a chip. + /// CFAM register is 32-bit wide. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address CFAM register address to modify. + /// @param[in] i_data Buffer that holds data to be modified. + /// @param[in] i_modifyMode The modify mode (or/and/xor). + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode modifyCfamRegister(const Target<K>& i_target, + const uint32_t i_address, + const buffer<uint32_t> i_data, + const ChipOpModifyMode i_modifyMode); + + // variable_buffer isn't supported on PPE +#ifndef __PPE__ + /// @brief Reads a ring from a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_address Ring address to read from. + /// @param[out] o_data Buffer that holds data read from HW target. + /// @param[in] i_ringMode Ring operation mode. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode getRing(const Target<K>& i_target, + const scanRingId_t i_address, + variable_buffer& o_data, + const RingMode i_ringMode = 0); + + /// @brief Writes a ring to a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_address Ring address to write to. + /// @param[in] i_data Buffer that contains RS4 compressed ring data + /// to write into address + /// @param[in] i_ringMode Ring operation mode. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode putRing(const Target<K>& i_target, + const scanRingId_t i_address, + const variable_buffer& i_data, + const RingMode i_ringMode = 0); + + + /// @brief Read-modify-write a ring on a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_address Ring address to modify. + /// @param[in] i_data Buffer that contains RS4 compressed ring data + /// to be modified. + /// @param[in] i_modifyMode The modify mode (or/and/xor) + /// @param[in] i_ringMode Ring operation mode. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode modifyRing(const Target<K>& i_target, + const scanRingId_t i_address, + const variable_buffer& i_data, + const ChipOpModifyMode i_modifyMode, + const RingMode i_ringMode = 0); +#endif + +#ifdef FAPI_SUPPORT_MULTI_SCOM + /// @brief Performs a multiple SCOM operation + /// This interface performs multiple SCOM operations on a chip in the + /// order specified by the input MultiScom object. + /// See fapiMultiScom.H for details of how to populate the MultiScom + /// object with SCOM operations. + /// + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in,out] io_multiScomObj Reference to a MultiScom object, + /// pre-populated with SingleScomInfo entries + /// to perform multiple SCOMs on input target + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// + /// @note This is a synchronous interface and would return after all the + /// SCOM operations are completed or on the first failed operation + /// + /// @note SCOMs will be performed in the order they were added to the + /// input MultiScom object + /// + /// @note In case of errors, the platform code is responsible to collect + /// and add all the required error info and FFDC into the error data + /// for debugging + /// + /// @note If the SCOM operations added are specific to a processor chip, + /// then the FSI Shift Engine configured in scatter-gather DMA mode + /// extension would be used to execute the SCOM operations in a + /// performance optimize mode. In this mode, the special + /// SCOM_BULK_READ_MODE and SCOM_BULK_WRITE_MODE operations are + /// supported that allow a large bulk of SCOM access (in multiple of + /// 64 bits) for targets that support auto-increment. The + /// SCOM_WRITE_UNDER_MASK operation is not supported in this mode + /// + /// @note If the SCOM operations added are specific to a memory buffer + /// chip, then the regular SCOM engine is used to execute the SCOM + /// operations. SCOM_WRITE_UNDER_MASK operation is supported in + /// this mode, but the special SCOM_BULK_READ_MODE and + /// SCOM_BULK_WRITE_MODE operations are not supported due to + /// hardware limitations. + /// + template< TargetType K > + fapi2::ReturnCode multiScom (const Target<K>& i_target, + MultiScom& io_multiScomObj); +#endif + + // -------------------------------------------------------------------------- + // NOTE: + // Implement platform Spy access functions if platform supports them. + // -------------------------------------------------------------------------- + + // variable_buffer isn't supported on PPE +#ifndef __PPE__ + /// @brief Reads a spy from a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_spyId Id of the spy whose data to be read. + /// @param[out] o_data Buffer that holds data read from HW target. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// + /// @note: The string version is only supported for cronus. + /// + /// The fapi design to support both FSP and cronus use of get and + /// put spy functions is dependant on the SPY names being expanded + /// to resemble a valid C identifier. This design places some + /// restrictions on the SPY names which can be used. + /// + /// 1. if the spy name contains a # procedure writers should replace + /// it with an __P__ for example - + /// + /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + /// becomes + /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS + /// + /// 2. if the spy name has a number following a "." it must have an + /// underscore prepended to the number. + /// + /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY + /// becomes + /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY + /// + /// Example SPY name: + /// The hardware procedure should call the function like: + /// + /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + /// + /// fapi2::ReturnCode rc = fapiGetSpy( targ, + /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data ); + /// + /// @note The ID is not in quotes the fapi code will handle adding + /// the quotes for the cronus environment +#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(DOXYGEN) + +#define FAPI_GET_SPY(TARGET, ID, DATA) fapi2::getSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA) + + template< TargetType K > + inline ReturnCode getSpy(const Target<K>& i_target, + const spyId_t i_spyId, + variable_buffer& o_data); +#endif + +#if defined(FAPI_SUPPORT_SPY_AS_STRING) || defined(DOXYGEN) + +#define FAPI_GET_SPY(TARGET, ID, DATA) fapi2::getSpy(TARGET, #ID, DATA) + + template< TargetType K > + inline ReturnCode getSpy(const Target<K>& i_target, + const char * const i_spyId, + variable_buffer& o_data); +#endif + + /// @brief Writes a spy on a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_spyId Id of the spy to write data to. + /// @param[out] i_data Buffer that holds data to write into spy. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// + /// @note: The string version is only supported for cronus. + /// + /// The fapi design to support both FSP and cronus use of get and + /// put spy functions is dependent on the SPY names being expanded + /// to resemble a valid C identifier. This design places some + /// restrictions on the SPY names which can be used. + /// + /// 1. if the spy name contains a # procedure writers should replace + /// is with an __P__ for example - + /// + /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + /// becomes + /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS + /// + /// 2. if the spy name has a number following a "." it must have an + /// underscore prepended to the number. + /// + /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY + /// becomes + /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY + /// + /// Example SPY name: + /// The hardware procedure should call the function like: + /// + /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + /// + /// fapi2::ReturnCode rc = fapiPutSpy( targ, + /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data ); + /// + /// @note The ID is not in quotes the fapi code will handle adding + /// the quotes for the cronus environment + /// +#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(DOXYGEN) + +#define FAPI_PUT_SPY(TARGET, ID, DATA) fapi2::putSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA) + + template< TargetType K > + inline ReturnCode putSpy(const Target<K>& i_target, + const spyId_t i_spyId, + variable_buffer& i_data); +#endif + +#if defined(FAPI_SUPPORT_SPY_AS_STRING) || defined(DOXYGEN) + +#define FAPI_PUT_SPY(TARGET, ID, DATA) fapi2::putSpy(TARGET, #ID, DATA) + + template< TargetType K > + inline ReturnCode putSpy(const Target<K>& i_target, + const char* const i_spyId, + variable_buffer& i_data); +#endif + + /// @brief Writes spy data into a buffer holding ring data image + /// This API is used by L2/L3 repair to put column repair data + /// into a ring buffer image. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_spyId Id of the spy. + /// @param[in] i_data Buffer that holds spy data to write into ring + /// image. + /// @param[out] o_data Buffer that holds updated ring image. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// + /// @note: The string version is only supported for cronus. + /// + /// The fapi design to support both FSP and cronus use of get and + /// put spy functions is dependent on the SPY names being expanded + /// to resemble a valid C identifier. This design places some + /// restrictions on the SPY names which can be used. + /// + /// See fapiPutSpy for details on spy id specifics. + /// +#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(DOXYGEN) + +#define FAPI_PUT_SPY_IMAGE(TARGET, ID, DATA1, DATA2) \ + fapi2::putSpyImage(TARGET, FAPI_SPY_NAMES::ID.value, \ + DATA1, DATA2) + + template< TargetType K > + inline ReturnCode putSpyImage(const Target<K>& i_target, + const spyId_t i_spyId, + const variable_buffer& i_data, + variable_buffer& o_imageData); +#endif + +#if defined(FAPI_SUPPORT_SPY_AS_STRING) || defined(DOXYGEN) + +#define FAPI_PUT_SPY_IMAGE(TARGET, ID, DATA1, DATA2) \ + fapi2::putSpyImage(TARGET, #ID, DATA1,DATA2) + + template< TargetType K > + inline ReturnCode putSpyImage(const Target<K>& i_target, + const char* const i_spyId, + const variable_buffer& i_data, + variable_buffer& o_imageData); +#endif + + /// @brief Reads spy data from a ring image buffer + /// @param[in] i_target Target to operate on + /// @param[in] i_spyId The spy's id + /// @param[out] o_data Buffer that holds data read from ring image. + /// @param[in] i_imageData Buffer that holds ring image to read data + /// from. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// + /// @note: The string version is only supported for cronus. + /// + /// The fapi design to support both FSP and cronus use of get and + /// put spy functions is dependent on the SPY names being expanded + /// to resemble a valid C identifier. This design places some + /// restrictions on the SPY names which can be used. + /// + /// See fapiPutSpy for details on spy id specifics. + /// +#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(DOXYGEN) + +#define FAPI_GET_SPY_IMAGE(TARGET, ID, DATA1, DATA2) \ + fapi2:getSpyImage(TARGET, FAPI_SPY_NAMES::ID.value, \ + DATA1, DATA2) + + template< TargetType K > + inline ReturnCode getSpyImage(const Target<K>& i_target, + const spyId_t i_spyId, + variable_buffer& o_data, + const variable_buffer& i_imageData); +#endif + +#if defined(FAPI_SUPPORT_SPY_AS_STRING) || defined(DOXYGEN) + +#define FAPI_GET_SPY_IMAGE(TARGET, ID, DATA1, DATA2) \ + fapi2::getSpyImage(TARGET, #ID, DATA1,DATA2) + + template< TargetType K > + inline ReturnCode getSpyImage(const Target<K>& i_target, + const char * const i_spyId, + variable_buffer& o_data, + const variable_buffer& i_imageData); +#endif + +#endif // PPE +}; + +#endif // _FAPI2_HWACCESS_H_ diff --git a/hwpf/include/fapi2_target.H b/hwpf/include/fapi2_target.H new file mode 100644 index 00000000..32b68618 --- /dev/null +++ b/hwpf/include/fapi2_target.H @@ -0,0 +1,562 @@ +/// +/// @file fapi2_target.H +/// @brief Common definitions for fapi2 targets +/// + +#ifndef __FAPI2_COMMON_TARGET__ +#define __FAPI2_COMMON_TARGET__ + +#include <stdint.h> +#include <vector> +#include <target_types.H> +#include <target_states.H> +#include <plat_target.H> + +namespace fapi2 +{ + + + /// + /// @brief Typedef for chiplet number values + /// + typedef uint8_t ChipletNumber_t; + + /// + /// @brief Class representing a FAPI2 Target + /// @tparam K the type (Kind) of target + /// @tparam V the type of the target's Value + /// @remark TargetLite targets are uint64_t, Targets + /// are uintptr_t (void*). + /// + /// Assuming there are representations of a processor, + /// a membuf and a system here are some examples: + /// @code + /// #define PROCESSOR_CHIP_A 0xFFFF0000 + /// #define MEMBUF_CHIP_B 0x0000FFFF + /// #define SYSTEM_C 0x0000AAAA + /// @endcode + /// + /// * To define a target: + /// @code + /// fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> A(PROCESSOR_CHIP_A); + /// fapi2::Target<fapi2::TARGET_TYPE_SYSTEM> C(SYSTEM_C); + /// fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> B(MEMBUF_CHIP_B); + /// @endcode + /// + /// * Functions which take composite target types + /// @code + /// void takesProcOrMembuf( + /// const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP | + /// fapi2::TARGET_TYPE_MEMBUF_CHIP>& V ); + /// + /// void takesAny(const fapi2::Target<fapi2::TARGET_TYPE_ALL>& V ); + /// + /// @endcode + /// + /// * Traversing the target "tree" + /// @code + /// fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> A(PROCESSOR_CHIP_A); + /// + /// // Get A's parent + /// A.getParent<fapi2::TARGET_TYPE_SYSTEM>(); + /// + /// // Get the 0x53'd core + /// fapi2::getTarget<fapi2::TARGET_TYPE_CORE>(0x53); + /// + /// // Get all *my* present/functional children which are cores + /// A.getChildren<fapi2::TARGET_TYPE_CORE>(); + /// + /// // Get all of the the cores relative to my base target + /// fapi2::getChildren<fapi2::TARGET_TYPE_CORE>(); + /// @endcode + /// + /// * Invalid casts + /// @code + /// // Can't cast to a specialized target + /// fapi2::Target<fapi2::TARGET_TYPE_NONE> D(MEMBUF_CHIP_B); + /// takesProcOrMembuf( D ); + /// + /// // Not one of the shared types + /// fapi2::Target<fapi2::TARGET_TYPE_ABUS_ENDPOINT> E; + /// takesProcOrMembuf( E ); + /// @endcode + template<TargetType K, typename V = plat_target_handle_t> + class Target + { + public: + + /// + /// @brief Create a Target, with a value + /// @param[in] Value the value (i.e., specific element this + /// target represents, or pointer) + /// @note Platforms can mangle the value and K to get a + /// single uint64_t in value which represents all the information + /// they might need. value( K | V ), for example + /// + Target(V Value); + +// Target(V Value): +// iv_handle(Value) +// {} + + /// + /// @brief Assignment Operator. + /// @param[in] i_right Reference to Target to assign from. + /// @return Reference to 'this' Target + /// + Target& operator=(const Target& i_right); + + /// + /// @brief Equality Comparison Operator + /// @param[in] i_right Reference to Target to compare. + /// @return bool. True if equal. + /// @note Platforms need to define this so that the physical + /// targets are determined to be equivilent rather than just the handles + /// + bool operator==(const Target& i_right) const; + + /// + /// @brief Inquality Comparison Operator + /// @param[in] i_right Reference to Target to compare. + /// @return bool. True if not equal. + /// @note Platforms need to define this so that the physical + /// targets are determined to be equivilent rather than just the handles + /// + bool operator!=(const Target& i_right) const; + + /// + /// @brief Get the handle. + /// @return V The target's handle, or value + /// + V get(void) const + { + return this->iv_handle.value; + } + + /// + /// @brief Get the handle as a V + /// @return V The target's handle, or value + /// + inline operator V() const + { + return this->iv_handle.value; + } + + /// + /// @brief Get a target's value + /// @return V The target's handle, or value + /// + inline V& operator()(void) + { + return this->iv_handle.value; + } + + /// + /// @brief Get the target type + /// @return The type of target represented by this target + /// + inline TargetType getType(void) const + { + return iv_type; + } + + /// + /// @brief Get this target's immediate parent + /// @tparam T The type of the parent + /// @return Target<T> a target representing the parent + /// + template< TargetType T > + inline Target<T> getParent(void) const; + + /// + /// @brief Is this target a chip? + /// @return Return true if this target is a chip, false otherwise + /// + inline constexpr bool isChip(void) const + { +// return ( (K == TARGET_TYPE_PROC_CHIP) || +// (K == TARGET_TYPE_MEMBUF_CHIP) ); + + return ( (K == TARGET_TYPE_PROC_CHIP) ); + } + + /// + /// @brief Is this target a chiplet? + /// @return Return true if this target is a chiplet, false otherwise + /// + inline constexpr bool isChiplet(void) const + { + return ( (K == TARGET_TYPE_EX) || +// (K == TARGET_TYPE_MBA) || + (K == TARGET_TYPE_MCS) || +// (K == TARGET_TYPE_XBUS) || +// (K == TARGET_TYPE_ABUS) || +// (K == TARGET_TYPE_L4) || + (K == TARGET_TYPE_CORE) || + (K == TARGET_TYPE_EQ) || +// (K == TARGET_TYPE_MCA) || +// (K == TARGET_TYPE_MCBIST) || +// (K == TARGET_TYPE_MI) || +// (K == TARGET_TYPE_DMI) || +// (K == TARGET_TYPE_OBUS) || +// (K == TARGET_TYPE_NV) || +// (K == TARGET_TYPE_SBE) || +// (K == TARGET_TYPE_PPE) || +// (K == TARGET_TYPE_PERV) || + (K == TARGET_TYPE_PERV) ); +// (K == TARGET_TYPE_PEC) || +// (K == TARGET_TYPE_PHB) ); + } + + /// + /// @brief Get this target's children + /// @tparam T The type of the parent + /// @param[in] i_state The desired TargetState of the children + /// @return std::vector<Target<T> > a vector of present/functional + /// children + /// @warning The children of EX's (cores) are expected to be returned + /// in order. That is, core 0 is std::vector[0]. + /// + template< TargetType T> + inline std::vector<Target<T> > + getChildren(const TargetState i_state = TARGET_STATE_FUNCTIONAL) const; + + /// + /// @brief Get the target at the other end of a bus - dimm included + /// @tparam T The type of the parent + /// @param[in] i_state The desired TargetState of the children + /// @return Target<T> a target representing the thing on the other end + /// @note Can be easily changed to a vector if needed + /// + template<TargetType T> + inline Target<T> + getOtherEnd(const TargetState i_state = TARGET_STATE_FUNCTIONAL) const; + + /// + /// @brief Copy from a Target<O> to a Target<K> + /// @tparam O the target type of the other + /// + template<TargetType O> + inline Target( const Target<O>& Other ): + Target<K, V>(Other.get()) + { + // In case of recursion depth failure, use -ftemplate-depth= + static_assert( (K & O) != 0, + "unable to cast Target, no shared types"); + + static_assert( bitCount<K>::count >= bitCount<O>::count, + "unable to cast to specialized Target"); + } + +#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) + { + 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 + /// Brian: not sure if the this is the place for this as + /// this is plaform specific. + + /// + /// @brief Get address overlay to reduce runtime processing + /// @return Overlay as a type V + /// + inline V getAddressOverlay(void) const + { + return this->iv_handle.fields.address_overlay; + } + + /// + /// @brief Get target number + /// @return Overlay as a type V + /// + inline uint32_t getTargetNumber(void) const + { + 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 + /// + inline TargetTypes_t getTargetType(void) const + { + return static_cast<TargetTypes_t>(this->iv_handle.fields.type); + } + + /// + /// @brief Get chiplet number from the handle + /// @return ChipletNumber_t Chiplet Number + /// + inline ChipletNumber_t getChipletNumber(void) const + { + return static_cast<ChipletNumber_t>(this->iv_handle.fields.chiplet_num); + } + +#endif + + + private: + // Don't use enums here as it makes it hard to assign + // in the platform target cast constructor. + static const TargetType iv_type = K; + + union iv_handle { + V value; + struct { +#ifdef _BIG_ENDIAN + V chiplet_num : 8; + V type_target_num : 8; + V type : 8; + V _reserved_b6 : 6; + V present : 1; + V functional : 1; + V address_overlay : 32; +#else + V address_overlay : 32; + V functional : 1; + V present : 1; + V _reserved_b6 : 6; + V type : 8; + V type_target_num : 8; + V chiplet_num : 8; +#endif + } fields; + // Union Constructor +// 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) + // So when splitting the EX, we need to map from EX threads + // to CORE threads. + + /// + /// @brief Given a normal core thread id, translate this to + /// a fused core thread id. (normal to fused) + /// @param[in] the ordinal number of the normal core this thread belongs to + /// @param[in] a normal core thread id - 0, ..., 3 + /// @return the fused core thread id + /// + inline uint8_t thread_id_n2f(const uint8_t i_ordinal, const uint8_t i_thread_id) + { + return (i_thread_id << 1) | i_ordinal; + } + + /// + /// @brief Given a fused core thread id, translate this to + /// a normal core thread id. (fused to normal) + /// @param[in] a fused core thread id - 0, ..., 7 + /// @return the normal core thread id + /// + inline uint8_t thread_id_f2n(const uint8_t i_thread_id) + { + return i_thread_id >> 1; + } + + /// + /// @brief Given a normal core thread id, translate this to a + /// normal core bitset. + /// @param[in] a normal core thread id - 0, ..., 3 + /// @return the normal core bitset + /// @note to got from a fused core id to a normal core bitset, + /// translate from a fused core thread id first. + /// + inline uint8_t thread_id2bitset(const uint8_t i_thread_id) + { + // 0xff means "set all bits" + static const uint8_t all_threads = 0xff; + static const uint8_t all_normal_threads_bitset = 0x0f; + + if (i_thread_id == all_threads) + { + return all_normal_threads_bitset; + } + + // A thread_id is really just bit index. + return (1 << (4 - i_thread_id - 1)); + } + + /// + /// @brief Given a bitset of normal core thread ids, translate this to + /// a bit mask of fused core thread id. (normal to fused) + /// @param[in] the ordinal number of the normal core this thread belongs to + /// @param[in] a normal core thread bitset - b0000, ..., b1111 + /// @return the corresponding fused core bitset + /// + inline uint8_t thread_bitset_n2f(const uint8_t i_ordinal, const uint8_t i_threads) + { + // Since we only have 4 bits I think this is better than a shift-type solution + // for interleaving bits + static uint8_t core_map[] = { + 0b00000000, // b0000 + 0b00000010, // b0001 + 0b00001000, // b0010 + 0b00001010, // b0011 + 0b00100000, // b0100 + 0b00100010, // b0101 + 0b00101000, // b0110 + 0b00101010, // b0111 + 0b10000000, // b1000 + 0b10000010, // b1001 + 0b10001000, // b1010 + 0b10001010, // b1011 + 0b10100000, // b1100 + 0b10100010, // b1101 + 0b10101000, // b1110 + 0b10101010, // b1111 + }; + + return core_map[i_threads] >> i_ordinal; + } + + /// + /// @brief Given a fused core thread bitset, translate this to + /// a normal core thread bitset. (fused to normal) + /// @param[in] the ordinal number of the normal core this thread belongs to + /// @param[in] a fused core thread bitset - b00000000, ..., b11111111 + /// @return the corresponding normal core bitset + /// + inline uint8_t thread_bitset_f2n(const uint8_t i_ordinal, const uint8_t i_threads) + { + uint8_t normal_set = 0; + + // core 0 is the left-most bit in the pair + uint8_t pair_mask = (i_ordinal == 0) ? 0x2 : 0x1; + + // For each bit which can be set in the normal core bit_set ... + for( auto i = 0; i <= 3; ++i ) + { + // ... grab the two fused bits which represent it ... + // ... and mask off the bit in the pair which represents this normal core ... + // (the << 1 shifts the masks over as we walk the pairs of bits) + uint8_t bits = (((3 << (i << 1)) & i_threads) & (pair_mask << (i << 1))); + + // ... if either bit is set, set the corresponding bit in + // the normal core bitset. + normal_set |= (bits != 0) << i; + } + return normal_set; + } + + /// + /// @brief Return the string interpretation of this target + /// @tparam T The type of the target + /// @param[in] i_target Target<T> + /// @param[in] i_buffer buffer to write in to + /// @param[in] i_bsize size of the buffer + /// @return void + /// @post The contents of the buffer is replaced with the string + /// representation of the target + /// + template< TargetType T > + inline void toString(const Target<T>& i_target, char* i_buffer, size_t i_bsize); + + /// + /// @brief Return the string interpretation of this target + /// @tparam T The type of the target + /// @tparam B The type of the buffer + /// @param[in] A pointer to the Target<T> + /// @param[in] i_buffer buffer to write in to + /// @param[in] i_bsize size of the buffer + /// @return void + /// @post The contents of the buffer is replaced with the string + /// representation of the target + /// + template< TargetType T > + inline void toString(const Target<T>* i_target, char* i_buffer, size_t i_bsize); + + /// + /// @brief Get an enumerated target of a specific type + /// @tparam T The type of the target + /// @param[in] Ordinal representing the ordinal number of + /// the desired target + /// @return Target<T> the target requested + /// + template<TargetType T> + inline Target<T> getTarget(uint64_t Ordinal); + + // Why has the been removed? For starters, the API name + // is probably wrong as it's already been confused with + // Target::getChildren(). And if I'm going to change it + // I really want to see if we need it. I'm still not + // clear on whether we're alloing this traversal or not. +#if 0 + /// + /// @brief Get the base target's children + /// @tparam T The type of the target + /// @return std::vector<Target<T> > a vector of present/functional + /// children + /// + template<TargetType T> + inline std::vector<Target<T> > getChildren() + { + // For testing + return {Target<T>(), Target<T>()}; + } +#endif + + /// + /// @brief Return the string interpretation of this target + /// @tparam T The type of the target + /// @tparam B The type of the buffer + /// @param[in] i_target Target<T> + /// @param[in] i_buffer buffer + /// @return void + /// @post The contents of the buffer is replaced with the string + /// representation of the target + /// + template<TargetType T, typename B> + inline void toString(const Target<T>& i_target, B& i_buffer); + + /// + /// @brief Check if the target is of a type, or in a type subset. + /// @tparam K the TargetType to check + /// @tparam T TargetType or TargetType composite to check against + /// @return True, iff K is a proper T + /// + template< TargetType K, TargetType T > + inline constexpr bool is_same(void) + { return (K & T) != 0; } + + +} +#endif diff --git a/hwpf/include/hwp_ffdc_classes.H b/hwpf/include/hwp_ffdc_classes.H new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/hwpf/include/hwp_ffdc_classes.H diff --git a/hwpf/include/plat/hw_access.H b/hwpf/include/plat/hw_access.H new file mode 100644 index 00000000..047176a7 --- /dev/null +++ b/hwpf/include/plat/hw_access.H @@ -0,0 +1,606 @@ +/* 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 hw_access.H + * + * @brief Defines the hardware access functions for PPE platforms that + * don't leverage FAPI2 return codes. + */ + +#ifndef FAPI2_HWACCESS_H_ +#define FAPI2_HWACCESS_H_ + + +// variable_buffer isn't supported on PPE +#ifndef __PPE__ +#include <variable_buffer.H> +#endif + +#include <utils.H> +#include <plat_hw_access.H> +#include <fapi2_hw_access.H> + +namespace fapi2 +{ + + //-------------------------------------------------------------------------- + // PIB Error Functions + //-------------------------------------------------------------------------- + + /// @brief Sets the PIB error mask - platform dependant + /// @param[in] i_mask The new error mask + void setPIBErrorMask(uint8_t i_mask) + { + PLAT_SET_PIB_ERROR_MASK(i_mask); + } + + /// @brief Gets the PIB error mask - platform dependant + /// @return uint8_t The current PIB error mask + uint8_t getPIBErrorMask(void) + { + PLAT_GET_PIB_ERROR_MASK(o_pib_mask); + return o_pib_mask; + } + + //-------------------------------------------------------------------------- + // Operational Mode Error Functions + //-------------------------------------------------------------------------- + + /// @brief Sets the operational mode + /// @param[in] i_mode The new mode + // note: this can be moved to a C file if desired + inline void setOpMode(const OpModes i_mode) + { + // Keeps the compiler from complaining about the unused i_mode + static_cast<void>(i_mode); + + // No-op for now. Should set thread-local operational mode + return; + } + + /// @brief Gets the operational mode + /// @return the operational mode + // note: this can be moved to a C file if desired + inline OpModes getOpMode(void) + { + // No-op for now. Should read thread-local operational mode + return NORMAL; + } + + //-------------------------------------------------------------------------- + // HW Communication Functions + //-------------------------------------------------------------------------- + + /// @brief Reads a SCOM register from a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address SCOM register address to read from. + /// @param[out] o_data Buffer that holds data read from HW target. + /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline void getScom(const Target<K>& i_target, const uint64_t i_address, + buffer<uint64_t>& o_data) + { + + PLAT_GETSCOM(current_err, + i_target, + (uint32_t)(i_address ), + &(o_data())); + } + + + /// @brief Writes a SCOM register on a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address SCOM register address to write to. + /// @param[in] i_data Buffer that holds data to write into address. + /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline void putScom(const Target<K>& i_target, const uint64_t i_address, + buffer<uint64_t> i_data) + { + + PLAT_PUTSCOM(current_err, + i_target, + (uint32_t)(i_address ), + i_data()); + } + + /// @brief Read-modify-write a SCOM register on a chip + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address SCOM register address to write to. + /// @param[in] i_data Buffer that holds data to be modified. + /// @param[in] i_modifyMode The modify mode (or/and/xor). + /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline void modifyScom( const Target<K>& i_target, + const uint64_t i_address, + const buffer<uint64_t> i_data, + const ChipOpModifyMode i_modifyMode) + { + fapi2::buffer<uint64_t> l_modifyDataBuffer; + + PLAT_GETSCOM(current_err, + i_target, + (uint32_t)(i_address ), + &(l_modifyDataBuffer())); + + if ( i_modifyMode == CHIP_OP_MODIFY_MODE_OR) + { + l_modifyDataBuffer |= i_data; + } + + if ( i_modifyMode == CHIP_OP_MODIFY_MODE_AND) + { + l_modifyDataBuffer &= i_data; + } + + if ( i_modifyMode == CHIP_OP_MODIFY_MODE_XOR) + { + l_modifyDataBuffer ^= i_data; + } + + PLAT_PUTSCOM(current_err, + i_target, + (uint32_t)(i_address ), + l_modifyDataBuffer()); + return; + } + + /// @brief Writes a SCOM register under mask on a chip + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address SCOM register address to write to. + /// @param[in] i_data Buffer that holds data to write into address. + /// @param[in] i_mask Buffer that holds the mask value. + /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline void putScomUnderMask(const Target<K>& i_target, + const uint64_t i_address, + buffer<uint64_t> i_data, + buffer<uint64_t> i_mask) + { + fapi2::buffer<uint64_t> l_modifyDataBuffer = i_data; + + l_modifyDataBuffer &= i_mask; + + PLAT_PUTSCOM(current_err, + i_target, + (uint32_t)(i_address ), + l_modifyDataBuffer()); + return; + } + + + /// @brief Reads a CFAM register from a chip. + /// CFAM register is 32-bit wide. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address CFAM register address to read from. + /// @param[out] o_data Buffer that holds data read from HW target. + /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode getCfamRegister(const Target<K>& i_target, + const uint32_t i_address, + buffer<uint32_t>& o_data) + { + PLAT_GETCFAM(i_target.get(), + (uint32_t)(i_address & BITS(40,24)), + &(o_data())); + + return FAPI2_RC_SUCCESS; + } + + /// @brief Writes a CFAM register on a chip. + /// CFAM register is 32-bit wide. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address CFAM register address to write to. + /// @param[in] i_data Buffer that holds data to write into address. + /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode putCfamRegister(const Target<K>& i_target, + const uint32_t i_address, + buffer<uint32_t>& i_data) + { + PLAT_PUTCFAM(i_target.get(), + (uint32_t)(i_address & BITS(40,24)), + &(i_data())); + + return FAPI2_RC_SUCCESS; + } + + /// @brief Read-modify-write a CFAM register on a chip. + /// CFAM register is 32-bit wide. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target HW target to operate on. + /// @param[in] i_address CFAM register address to modify. + /// @param[in] i_data Buffer that holds data to be modified. + /// @param[in] i_modifyMode The modify mode (or/and/xor). + /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode modifyCfamRegister(const Target<K>& i_target, + const uint32_t i_address, + const buffer<uint32_t>& i_data, + const ChipOpModifyMode i_modifyMode) + { + PLAT_MODCFAM(i_target.get(), + (uint32_t)(i_address & BITS(40,24)), + &(i_data()), + i_modifyMode); + + return FAPI2_RC_SUCCESS; + } + + // variable_buffer isn't supported on PPE +#ifndef __PPE__ + /// @brief Reads a ring from a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_address Ring address to read from. + /// @param[out] o_data Buffer that holds data read from HW target. + /// @param[in] i_ringMode Ring operation mode. + /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode getRing(const Target<K>& i_target, + const scanRingId_t i_address, + variable_buffer& o_data, + const RingMode i_ringMode = 0) + { + o_data.setBit(0); + o_data.setBit(3); +#ifndef __PPE__ + std::cout << std::hex << " getRing " + << "target: {" << i_target.getType() << "," + << uint64_t(i_target) << "}; " + << "ring address: " << i_address << "; " + << "ring mode: " << i_ringMode << "; " + << "output data:"; + o_data.print(); +#endif + + return FAPI2_RC_SUCCESS; + } + + /// @brief Writes a ring to a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_address Ring address to write to. + /// @param[in] i_data Buffer that contains RS4 compressed ring data + /// to write into address + /// @param[in] i_ringMode Ring operation mode. + /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode putRing(const Target<K>& i_target, + const scanRingId_t i_address, + variable_buffer& i_data, + const RingMode i_ringMode = 0) + { + + return FAPI2_RC_SUCCESS; + } + + + /// @brief Writes a ring to a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_address Ring address to write to. + /// @param[in] i_data Pointer to location that contains RS4 compressed + // ring data to write into address + /// @param[in] i_ringMode Ring operation mode. + /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode putRing(const Target<K>& i_target, + const scanRingId_t i_address, + const void* i_data, + const RingMode i_ringMode = 0) + { + uint64_t* dataPtr = reinterpret_cast<uint64_t*>(const_cast<void*>(i_data)); + + return FAPI2_RC_SUCCESS; + } + + /// @brief Read-modify-write a ring on a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_address Ring address to modify. + /// @param[in] i_data Buffer that contains RS4 compressed ring data + /// to be modified. + /// @param[in] i_modifyMode The modify mode (or/and/xor) + /// @param[in] i_ringMode Ring operation mode. + /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + template< TargetType K > + inline ReturnCode modifyRing(const Target<K>& i_target, + const scanRingId_t i_address, + variable_buffer& i_data, + const ChipOpModifyMode i_modifyMode, + const RingMode i_ringMode = 0) + { + + return FAPI2_RC_SUCCESS; + } +#endif + + +#ifdef FAPI_SUPPORT_MULTI_SCOM + /// @brief Performs a multiple SCOM operation + /// This interface performs multiple SCOM operations on a chip in the + /// order specified by the input MultiScom object. + /// See fapiMultiScom.H for details of how to populate the MultiScom + /// object with SCOM operations. + /// + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in,out] io_multiScomObj Reference to a MultiScom object, + /// pre-populated with SingleScomInfo entries + /// to perform multiple SCOMs on input target + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// + /// @note This is a synchronous interface and would return after all the + /// SCOM operations are completed or on the first failed operation + /// + /// @note SCOMs will be performed in the order they were added to the + /// input MultiScom object + /// + /// @note In case of errors, the platform code is responsible to collect + /// and add all the required error info and FFDC into the error data + /// for debugging + /// + /// @note If the SCOM operations added are specific to a processor chip, + /// then the FSI Shift Engine configured in scatter-gather DMA mode + /// extension would be used to execute the SCOM operations in a + /// performance optimize mode. In this mode, the special + /// SCOM_BULK_READ_MODE and SCOM_BULK_WRITE_MODE operations are + /// supported that allow a large bulk of SCOM access (in multiple of + /// 64 bits) for targets that support auto-increment. The + /// SCOM_WRITE_UNDER_MASK operation is not supported in this mode + /// + /// @note If the SCOM operations added are specific to a memory buffer + /// chip, then the regular SCOM engine is used to execute the SCOM + /// operations. SCOM_WRITE_UNDER_MASK operation is supported in + /// this mode, but the special SCOM_BULK_READ_MODE and + /// SCOM_BULK_WRITE_MODE operations are not supported due to + /// hardware limitations. + /// + template< TargetType K > + fapi2::ReturnCode multiScom (const Target<K>& i_target, + MultiScom& io_multiScomObj) + { + } +#endif + + // -------------------------------------------------------------------------- + // NOTE: + // Implement platform Spy access functions if platform supports them. + // -------------------------------------------------------------------------- + + // variable_buffer isn't supported on PPE +#ifndef __PPE__ + /// @brief Reads a spy from a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_spyId Id of the spy whose data to be read. + /// @param[out] o_data Buffer that holds data read from HW target. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// + /// @note: The string version is only supported for cronus. + /// + /// The fapi design to support both FSP and cronus use of get and + /// put spy functions is dependant on the SPY names being expanded + /// to resemble a valid C identifier. This design places some + /// restrictions on the SPY names which can be used. + /// + /// 1. if the spy name contains a # procedure writers should replace + /// it with an __P__ for example - + /// + /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + /// becomes + /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS + /// + /// 2. if the spy name has a number following a "." it must have an + /// underscore prepended to the number. + /// + /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY + /// becomes + /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY + /// + /// Example SPY name: + /// The hardware procedure should call the function like: + /// + /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + /// + /// fapi2::ReturnCode rc = fapiGetSpy( targ, + /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data ); + /// + /// @note The ID is not in quotes the fapi code will handle adding + /// the quotes for the cronus environment + /// +#ifdef FAPI_SUPPORT_SPY_AS_ENUM + template< TargetType K > + inline ReturnCode getSpy(const Target<K>& i_target, + const spyId_t i_spyId, + variable_buffer& o_data) + { + static_assert(K == 0, "implement getSpy (string)"); + return ~FAPI2_RC_SUCCESS; + } +#endif +#ifdef FAPI_SUPPORT_SPY_AS_STRING + template< TargetType K > + inline ReturnCode getSpy(const Target<K>& i_target, + const char * const i_spyId, + variable_buffer& o_data) + { + static_assert(K == 0, "implement getSpy (string)"); + return ~FAPI2_RC_SUCCESS; + } +#endif + /// @brief Writes a spy on a chip. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_spyId Id of the spy to write data to. + /// @param[out] i_data Buffer that holds data to write into spy. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// + /// @note: The string version is only supported for cronus. + /// + /// The fapi design to support both FSP and cronus use of get and + /// put spy functions is dependent on the SPY names being expanded + /// to resemble a valid C identifier. This design places some + /// restrictions on the SPY names which can be used. + /// + /// 1. if the spy name contains a # procedure writers should replace + /// is with an __P__ for example - + /// + /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + /// becomes + /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS + /// + /// 2. if the spy name has a number following a "." it must have an + /// underscore prepended to the number. + /// + /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY + /// becomes + /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY + /// + /// Example SPY name: + /// The hardware procedure should call the function like: + /// + /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + /// + /// fapi2::ReturnCode rc = fapiPutSpy( targ, + /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data ); + /// + /// @note The ID is not in quotes the fapi code will handle adding + /// the quotes for the cronus environment + /// +#ifdef FAPI_SUPPORT_SPY_AS_ENUM + template< TargetType K > + inline ReturnCode putSpy(const Target<K>& i_target, + const spyId_t i_spyId, + variable_buffer& i_data) + { + static_assert(K == 0, "implement putSpy (enum)"); + return ~FAPI2_RC_SUCCESS; + } +#endif +#ifdef FAPI_SUPPORT_SPY_AS_STRING + template< TargetType K > + inline ReturnCode putSpy(const Target<K>& i_target, + const char* const i_spyId, + variable_buffer& i_data) + { + static_assert(K == 0, "implement putSpy (string)"); + return ~FAPI2_RC_SUCCESS; + } +#endif + /// @brief Writes spy data into a buffer holding ring data image + /// This API is used by L2/L3 repair to put column repair data + /// into a ring buffer image. + /// @tparam K template parameter, passed in target. + /// @param[in] i_target Target to operate on. + /// @param[in] i_spyId Id of the spy. + /// @param[in] i_data Buffer that holds spy data to write into ring + /// image. + /// @param[out] o_data Buffer that holds updated ring image. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// + /// @note: The string version is only supported for cronus. + /// + /// The fapi design to support both FSP and cronus use of get and + /// put spy functions is dependent on the SPY names being expanded + /// to resemble a valid C identifier. This design places some + /// restrictions on the SPY names which can be used. + /// + /// See fapiPutSpy for details on spy id specifics. + /// +#ifdef FAPI_SUPPORT_SPY_AS_ENUM + template< TargetType K > + inline ReturnCode putSpyImage(const Target<K>& i_target, + const spyId_t i_spyId, + const variable_buffer& i_data, + variable_buffer& o_imageData) + { + static_assert(K == 0, "implement putSpyImage (enum)"); + return ~FAPI2_RC_SUCCESS; + } +#endif +#ifdef FAPI_SUPPORT_SPY_AS_STRING + template< TargetType K > + inline ReturnCode putSpyImage(const Target<K>& i_target, + const char* const i_spyId, + const variable_buffer& i_data, + variable_buffer& o_imageData) + { + static_assert(K == 0, "implement putSpyImage (string)"); + return ~FAPI2_RC_SUCCESS; + } +#endif + /// @brief Reads spy data from a ring image buffer + /// @param[in] i_target Target to operate on + /// @param[in] i_spyId The spy's id + /// @param[out] o_data Buffer that holds data read from ring image. + /// @param[in] i_imageData Buffer that holds ring image to read data + /// from. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// + /// @note: The string version is only supported for cronus. + /// + /// The fapi design to support both FSP and cronus use of get and + /// put spy functions is dependent on the SPY names being expanded + /// to resemble a valid C identifier. This design places some + /// restrictions on the SPY names which can be used. + /// + /// See fapiPutSpy for details on spy id specifics. + /// +#ifdef FAPI_SUPPORT_SPY_AS_ENUM + template< TargetType K > + inline ReturnCode getSpyImage(const Target<K>& i_target, + const spyId_t i_spyId, + variable_buffer& o_data, + const variable_buffer& i_imageData) + { + static_assert(K == 0, "implement getSpyImage (enum)"); + return ~FAPI2_RC_SUCCESS; + } +#endif +#ifdef FAPI_SUPPORT_SPY_AS_STRING + template< TargetType K > + inline ReturnCode getSpyImage(const Target<K>& i_target, + const char * const i_spyId, + variable_buffer& o_data, + const variable_buffer& i_imageData) + { + static_assert(K == 0, "implement getSpyImage (string)"); + return ~FAPI2_RC_SUCCESS; + } +#endif + +#endif // PPE + +}; + +#endif // _FAPI2_HWACCESS_H_ diff --git a/hwpf/include/plat/hwp_executor.H b/hwpf/include/plat/hwp_executor.H new file mode 100644 index 00000000..5a451081 --- /dev/null +++ b/hwpf/include/plat/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/include/plat/plat_attributes.H b/hwpf/include/plat/plat_attributes.H new file mode 100644 index 00000000..894d516d --- /dev/null +++ b/hwpf/include/plat/plat_attributes.H @@ -0,0 +1,37 @@ +/* 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_attributes.H + * @brief Platform specific attribute headers + */ + +#ifndef __PLAT_ATTTRIBUTE_H__ +#define __PLAT_ATTTRIBUTE_H__ + +#include <fapi2AttributeService.H> +#include <fapi2AttributeIds.H> // Generated file +//#include <plat_target_pg_attributes.H> + +#endif // __PLAT_ATTTRIBUTE_H__ diff --git a/hwpf/include/plat/plat_error_scope.H b/hwpf/include/plat/plat_error_scope.H new file mode 100644 index 00000000..a2de6bd5 --- /dev/null +++ b/hwpf/include/plat/plat_error_scope.H @@ -0,0 +1,65 @@ +/* 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_error_scope.H + * @brief platform definitions which create a scope for automatic error handling + */ + +#ifndef __FAPI2_PLAT_ERROR_SCOPE__ +#define __FAPI2_PLAT_ERROR_SCOPE__ + +/// @cond +#define PLAT_FAPI_TRY_NO_TRACE( __operation__ ) \ + (__operation__) + +#define PLAT_FAPI_TRY_TRACE( __operation__, ... ) \ + FAPI_DBG(__VA_ARGS)); \ + (__operation__) + +/// +/// @brief Assert a conditional is true. +/// If it is not, the FFDC gathering function is called and the +/// trace is output as a FAPI error trace. +/// @param[in] __conditional__ the condition to assert +/// @param[in] __ffdc__ the FFDC gathering function +/// @param[in] ... varargs, as input to FAPI_ERR +/// +#define PLAT_FAPI_ASSERT( __conditional__, __ffdc__, ... ) \ + if (! (__conditional__)) \ + { \ + (__ffdc__).execute(); \ + FAPI_ERR(__VA_ARGS__); \ + goto fapi_try_exit; \ + } + + +/// +/// @brief Temporary macro for error label until all are removed. +/// @todo REMOVE this in time. +#define FAPI_CLEANUP() \ +fapi_try_exit: +/// @endcond + +#endif diff --git a/hwpf/include/plat/plat_hw_access.H b/hwpf/include/plat/plat_hw_access.H new file mode 100644 index 00000000..7d8e3c86 --- /dev/null +++ b/hwpf/include/plat/plat_hw_access.H @@ -0,0 +1,78 @@ +/** + * @file plat_hw_access.H + * + * @brief Define platform specific calls for PPE Platforms that use the machine + * check function of the PPE to deal with errors (eg no explicit return codes + * returned) + */ + +#ifndef PLATHWACCESS_H_ +#define PLATHWACCESS_H_ + +#include <plat_includes.H> + +/// PIB Error Mask + +#define PLAT_SET_PIB_ERROR_MASK(_m_mask) \ + { /* Read MSR */ \ + uint32_t msr_data = mfmsr(); \ + /* Set SEM field */ \ + msr_data &= ~(BITS(0,8)); \ + msr_data |= (uint32_t)(i_mask << 24); \ + /* Write MSR */ \ + mtmsr(msr_data); \ + }; + +#define PLAT_GET_PIB_ERROR_MASK(_m_mask) \ + uint8_t _m_mask; \ + uint32_t _sem = mfmsr(); \ + _m_mask = (uint8_t)((_sem & MSR_SEM) >> (32-(MSR_SEM_START_BIT + MSR_SEM_LEN))); + +// Building block PPE instructions +#define PPE_MFMSR(_m_data) \ +asm volatile \ + ( \ + "mfmsr %[data] \n" \ + : [data]"=&r"(*_m_data) \ + : "[data]"(*_m_data) \ + ); + +#define PPE_MTMSR(_m_data) \ +asm volatile \ + ( \ + "mtmsr %[data] \n" \ + : [data]"=&r"(*_m_data) \ + : "[data]"(*_m_data) \ + ); + + +/// GetScom +#define PLAT_GETSCOM(_m_rc, _m_base, _m_offset, _m_data) \ + PPE_LVDX(_m_base.getAddressOverlay(), (uint32_t)(_m_offset & BITS(40,24)), _m_data) + +/// PutScom +#define PLAT_PUTSCOM(_m_rc, _m_base, _m_offset, _m_data) \ + PPE_STVDX(_m_base.getAddressOverlay(), (uint32_t)(_m_offset & BITS(40,24)), _m_data) + +/// ModifyScom +#define PLAT_MODSCOM(_m_base, _m_offset, _m_data, _m_mode) \ + PPE_STVDX(_m_base.getAddressOverlay(), _m_offset, _m_data) + + +/// GetCFAM +#define PLAT_GETCFAM(_m_base, _m_offset, _m_data) \ + static_assert( K == TARGET_TYPE_NONE, \ + "getCfamRegister is not supported by PPE platforms") + +/// PutCFAM +#define PLAT_PUTCFAM(_m_base, _m_offset, _m_data) \ + static_assert( K == TARGET_TYPE_NONE, \ + "putCfamRegister is not supported by PPE platforms") + +/// ModifyCFAM +#define PLAT_MODCFAM(_m_base, _m_offset, _m_data, _m_mode) \ + static_assert( K == TARGET_TYPE_NONE, \ + "modifyCfamRegister is not supported by PPE platforms") + +#endif // PLATHWACCESS_H_ + diff --git a/hwpf/include/plat/plat_includes.H b/hwpf/include/plat/plat_includes.H new file mode 100644 index 00000000..97074b67 --- /dev/null +++ b/hwpf/include/plat/plat_includes.H @@ -0,0 +1,40 @@ +/* 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_includes.H + * @brief Platform specific include to implement FAPI2 APIs + */ + +#ifndef __PLAT_INCLUDES_H__ +#define __PLAT_INCLUDES_H__ + +#include <plat_hw_access.H> + +#include <ppe42_scom.h> +#include <ppe42_msr.h> +//#include <pk.h> + + +#endif // __PLAT_INCLUDES_H__ diff --git a/hwpf/include/plat/plat_target.H b/hwpf/include/plat/plat_target.H new file mode 100644 index 00000000..3e28c1da --- /dev/null +++ b/hwpf/include/plat/plat_target.H @@ -0,0 +1,39 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: hwpf/fapi2/include/plat_target.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* EKB Project */ +/* */ +/* COPYRIGHT 2012,2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* 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 plat_target.H + * @brief platform definitions for fapi2 targets + */ + +#ifndef __FAPI2_PLAT_TARGET__ +#define __FAPI2_PLAT_TARGET__ + +#include <stdint.h> + +// +// Define what a platform handle looks like. For Hostboot, +// for example, this might be a void*. For the SBE, this +// will be a uint64_t ... +// +namespace fapi2 +{ +typedef uint64_t plat_target_handle_t; +} + +#endif diff --git a/hwpf/include/plat/plat_target_definitions.H b/hwpf/include/plat/plat_target_definitions.H new file mode 100644 index 00000000..c2ec0518 --- /dev/null +++ b/hwpf/include/plat/plat_target_definitions.H @@ -0,0 +1,112 @@ +/* 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_ppe_target.H + * @brief Definitions for fapi2 PPE targets + */ + +#ifndef __FAPI2_PPE_TARGET__ +#define __FAPI2_PPE_TARGET__ + +#define TARGET_CHIP(_name, _index) \ + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP > _name((uint64_t)_index); + +#define TARGET_CHIP_PERV(_name, _index) \ + fapi2::Target<fapi2::TARGET_TYPE_PERV> _name((uint64_t)_index); + +#define TARGET_EQ(_name, _index) \ + fapi2::Target<fapi2::TARGET_TYPE_EQ> _name((uint64_t)_index); + +#define TARGET_CORE(_name, _index) \ + fapi2::Target<fapi2::TARGET_TYPE_CORE> _name((uint64_t)_index); + +#define TARGET_EX(_name, _index) \ + fapi2::Target<fapi2::TARGET_TYPE_EX> _name((uint64_t)_index); + +namespace fapi2 +{ + + TARGET_CHIP (chip_target, 0); + TARGET_CHIP_PERV (perv_target, 1); + TARGET_CHIP_PERV (n0_target, 2); + TARGET_CHIP_PERV (n1_target, 3); + TARGET_CHIP_PERV (n2_target, 4); + TARGET_CHIP_PERV (n3_target, 5); + TARGET_CHIP_PERV (xb_target, 6); + TARGET_CHIP_PERV (mc0_target, 7); + TARGET_CHIP_PERV (mc1_target, 8); + TARGET_CHIP_PERV (ob0_target, 9); + TARGET_CHIP_PERV (ob1_target, 10); + TARGET_CHIP_PERV (ob2_target, 11); + TARGET_CHIP_PERV (ob3_target, 12); + TARGET_CHIP_PERV (pci0_target, 13); + TARGET_CHIP_PERV (pci1_target, 14); + TARGET_CHIP_PERV (pci2_target, 15); + TARGET_EQ (eq0_target, 0); + TARGET_EQ (eq1_target, 1); + TARGET_EQ (eq2_target, 2); + TARGET_EQ (eq3_target, 3); + TARGET_EQ (eq4_target, 4); + TARGET_EQ (eq5_target, 5); + TARGET_EX (ex0_target, 0); + TARGET_EX (ex1_target, 1); + TARGET_EX (ex2_target, 2); + TARGET_EX (ex3_target, 3); + TARGET_EX (ex4_target, 4); + TARGET_EX (ex5_target, 5); + TARGET_EX (ex6_target, 6); + TARGET_EX (ex7_target, 7); + TARGET_EX (ex8_target, 8); + TARGET_EX (ex9_target, 9); + TARGET_EX (ex10_target, 10); + TARGET_EX (ex11_target, 11); + TARGET_CORE (core0_target, 0); + TARGET_CORE (core1_target, 1); + TARGET_CORE (core2_target, 2); + TARGET_CORE (core3_target, 3); + TARGET_CORE (core4_target, 4); + TARGET_CORE (core5_target, 5); + TARGET_CORE (core6_target, 6); + TARGET_CORE (core7_target, 7); + TARGET_CORE (core8_target, 8); + TARGET_CORE (core9_target, 9); + TARGET_CORE (core10_target,10); + TARGET_CORE (core11_target,11); + TARGET_CORE (core12_target,12); + TARGET_CORE (core13_target,13); + TARGET_CORE (core14_target,14); + TARGET_CORE (core15_target,15); + TARGET_CORE (core16_target,16); + TARGET_CORE (core17_target,17); + TARGET_CORE (core18_target,18); + TARGET_CORE (core19_target,19); + TARGET_CORE (core20_target,20); + TARGET_CORE (core21_target,21); + TARGET_CORE (core22_target,22); + TARGET_CORE (core23_target,23); + +}; // fapi2 namespace + +#endif // __FAPI2_PPE_TARGET__ diff --git a/hwpf/include/plat/plat_target_parms.H b/hwpf/include/plat/plat_target_parms.H new file mode 100644 index 00000000..0c6c5c67 --- /dev/null +++ b/hwpf/include/plat/plat_target_parms.H @@ -0,0 +1,133 @@ +/* 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_ppe_target.H + * @brief Definitions for fapi2 PPE targets + */ + +#ifndef __FAPI2_PPE_TARGET_PARMS__ +#define __FAPI2_PPE_TARGET_PARMS__ + +#include "fapi_sbe_common.H" + + +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 Pervasive 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); + +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(SYSTEM_TARGET_OFFSET, EX_TARGET_OFFSET + EX_TARGET_COUNT); +CONST_UINT32_T(SYSTEM_TARGET_COUNT, 1); + +CONST_UINT32_T(MCAST_TARGET_OFFSET, SYSTEM_TARGET_OFFSET + SYSTEM_TARGET_COUNT); +CONST_UINT32_T(MCAST_CHIPLET_OFFSET, 0); +CONST_UINT32_T(MCAST_TARGET_COUNT, 7); // 0 - 6 + +// Total Target Count +CONST_UINT32_T(TARGET_COUNT, CHIP_TARGET_COUNT + + PERV_TARGET_COUNT + + EQ_TARGET_COUNT + + CORE_TARGET_COUNT + + MCS_TARGET_COUNT + + EX_TARGET_COUNT + + SYSTEM_TARGET_COUNT + + MCAST_TARGET_COUNT); + +/* +enum TargetFilter +{ + TARGET_FILTER_ALL_NEST , + TARGET_FILTER_NEST_NORTH , + TARGET_FILTER_NEST_SOUTH , + TARGET_FILTER_NEST_EAST , + TARGET_FILTER_NEST_WEST , + TARGET_FILTER_XBUS , + TARGET_FILTER_ALL_OBUS , + TARGET_FILTER_OBUS0 , + TARGET_FILTER_OBUS1 , + TARGET_FILTER_OBUS2 , + TARGET_FILTER_OBUS3 , + TARGET_FILTER_ALL_PCI , + TARGET_FILTER_PCI0 , + TARGET_FILTER_PCI1 , + TARGET_FILTER_PCI2 , + TARGET_FILTER_ALL_EC , + TARGET_FILTER_ALL_EP , + TARGET_FILTER_ALL_MC , + TARGET_FILTER_MC_WEST , + TARGET_FILTER_MC_EAST , + TARGET_FILTER_TP , +}; + +// The order of this MUST match the order of the TargetFilter enum above +// The bit vectors represent +const uint64_t TargetFilters[] = +{ + BITS(2,4), // TARGET_FILTER_ALL_NEST + BIT(2), // TARGET_FILTER_NEST_NORTH + BIT(3), // TARGET_FILTER_NEST_SOUTH + BIT(4), // TARGET_FILTER_NEST_EAST + BIT(5), // TARGET_FILTER_NEST_WEST + BIT(6), // TARGET_FILTER_XBUS + BITS(9,4), // TARGET_FILTER_ALL_OBUS + BIT(9), // TARGET_FILTER_OBUS0 + BIT(10), // TARGET_FILTER_OBUS1 + BIT(11), // TARGET_FILTER_OBUS2 + BIT(12), // TARGET_FILTER_OBUS3 + BITS(13,3), // TARGET_FILTER_ALL_PCI + BIT(12), // TARGET_FILTER_PCI0 + BIT(13), // TARGET_FILTER_PCI1 + BIT(14), // TARGET_FILTER_PCI2 + BITS(32,24), // TARGET_FILTER_ALL_EC + BITS(16,6), // TARGET_FILTER_ALL_EP + BITS(7,2), // TARGET_FILTER_ALL_MC + BIT(7), // TARGET_FILTER_MC_WEST + BIT(8), // TARGET_FILTER_MC_EAST + BIT(1), // TARGET_FILTER_TP +}; +*/ +#endif // __FAPI2_PPE_TARGET_PARMS__ diff --git a/hwpf/include/plat/plat_target_pg_attributes.H b/hwpf/include/plat/plat_target_pg_attributes.H new file mode 100644 index 00000000..e27a1784 --- /dev/null +++ b/hwpf/include/plat/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/include/plat/plat_target_utils.H b/hwpf/include/plat/plat_target_utils.H new file mode 100644 index 00000000..e1e360c0 --- /dev/null +++ b/hwpf/include/plat/plat_target_utils.H @@ -0,0 +1,48 @@ +/* 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_util.H + * @brief platform utility definitions for fapi2 targets + */ + +#ifndef __FAPI2_PLAT_TARGET_UTIL__ +#define __FAPI2_PLAT_TARGET_UTIL__ + +// +// Platform Utility functions.. +// +namespace fapi2 +{ + + /// @brief Function to initialize the G_targets vector based on partial good + /// attributes + ReturnCode plat_TargetsInit(); + + /// @brief Function to initialize the G_targets vector based on partial good + /// attributes + Target<TARGET_TYPE_PROC_CHIP> plat_getChipTarget(); + +} +#endif diff --git a/hwpf/include/plat/plat_trace.H b/hwpf/include/plat/plat_trace.H new file mode 100644 index 00000000..423ef6ea --- /dev/null +++ b/hwpf/include/plat/plat_trace.H @@ -0,0 +1,86 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] 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_trace.H + * @brief Defines the FAPI2 trace macros. + * + * Note that platform code must provide the implementation. + * + * FAPI has provided a default implementation. Platform code must + * provide an alternate implementation if needed. + */ + +#ifndef FAPI2_PLATTRACE_H_ +#define FAPI2_PLATTRACE_H_ + +#include <stdio.h> +#include <stdint.h> + +// @todo update these headers with extern "C" in a future commit +// or not and leave this just as it is. +extern "C" +{ +#include "pk.h" +#include <pk_trace.h> +#include "trac_interface.h" +} + +// Why not a #define, why is this in the fapi2 namespace? +// To prevent problems with Cronus and the fapi1 definitions. +namespace fapi2 +{ + static const uint32_t MAX_ECMD_STRING_LEN = 64; +}; + +// Information traces (go into fast trace buffer that can wrap often) +#define FAPI_TRACE(_id_, _fmt_, _args_...) \ + PK_TRACE(_fmt_, ##_args_); + + +/* The following is a desirous trace entry but the second line has a + compilation issue that is unresolved + +#define FAPI_TRACE(_id_, _fmt_, _args_...) \ + PK_TRACE("%s: %s:%d ", _id_, __FUNCTION__, __LINE__); \ + PK_TRACE(_fmt_, ##_args_); +*/ + +#define FAPI_INF(_fmt_, _args_...) FAPI_TRACE("inf", _fmt_, ##_args_) + +// Important traces (go into slow trace buffer that should not wrap often) +#define FAPI_IMP(_fmt_, _args_...) FAPI_TRACE("imp", _fmt_, ##_args_) + +// Error traces (go into slow trace buffer that should not wrap often) +#define FAPI_ERR(_fmt_, _args_...) FAPI_TRACE("err", _fmt_, ##_args_) + +// Debug traces (go into fast trace buffer that can wrap often) +#define FAPI_DBG(_fmt_, _args_...) FAPI_TRACE("dbg", _fmt_, ##_args_) + +// Scan traces +#define FAPI_SCAN(_fmt_, _args_...) FAPI_TRACE("scan", _fmt_, ##_args_) + +#define FAPI_MFG(_fmt_, _args_...) FAPI_TRACE("mfg", _fmt_, ##_args_) + +#endif // FAPI2_PLATTRACE_H_ diff --git a/hwpf/include/plat/target.H b/hwpf/include/plat/target.H new file mode 100644 index 00000000..0c40642b --- /dev/null +++ b/hwpf/include/plat/target.H @@ -0,0 +1,342 @@ +/* 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 target.H + * @brief platform specializations for fapi2 targets + */ + +#ifndef __FAPI2_TARGET__ +#define __FAPI2_TARGET__ + +#include <plat_target.H> +#include <plat_target_parms.H> +#include <fapi2_target.H> +#include <plat_trace.H> +#include <utils.H> +#include <stdio.h> +#include <stdint.h> +#include <vector> + +extern "C" +{ + extern std::vector<fapi2::plat_target_handle_t> G_vec_targets; +} + +namespace fapi2 +{ + /// @brief Create a Target, with a value + /// @param[in] Value the value (i.e., specific element this + /// target represents, or pointer) + /// @note Platforms can mangle the value and K to get a + /// single uint64_t in value which represents all the information + /// they might need. value( K | V ), for example + /// + template<TargetType K, typename V> + Target<K, V>::Target(V Value) + { + static_assert( ((K == TARGET_TYPE_CORE) & + (K == TARGET_TYPE_EQ) ) != true, + "TARGET_TYPE_CORE and TARGET_TYPE_EQ cannot be specified at the same time"); + + this->iv_handle.value = 0; + if(K & TARGET_TYPE_PROC_CHIP) + { + this->iv_handle.fields.chiplet_num = 0; + this->iv_handle.fields.type = TARGET_TYPE_PROC_CHIP; + this->iv_handle.fields.type_target_num = 0; + } + + if(K & TARGET_TYPE_PERV) + { + this->iv_handle.fields.chiplet_num = Value; + this->iv_handle.fields.type = TARGET_TYPE_PERV; + this->iv_handle.fields.type_target_num = Value; + } + + if(K & TARGET_TYPE_CORE) + { + 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; + } + + if(K & TARGET_TYPE_EQ) + { + this->iv_handle.fields.chiplet_num = Value + EQ_CHIPLET_OFFSET; + this->iv_handle.fields.type = TARGET_TYPE_EQ | TARGET_TYPE_PERV; + this->iv_handle.fields.type_target_num = Value; + } + + if(K & TARGET_TYPE_EX) + { + + this->iv_handle.fields.chiplet_num = (Value / 2) + EX_CHIPLET_OFFSET; + this->iv_handle.fields.type = TARGET_TYPE_EX | TARGET_TYPE_PERV; + this->iv_handle.fields.type_target_num = Value; + } + + if(K & TARGET_TYPE_MCS) + { + + this->iv_handle.fields.chiplet_num = Value + MCS_CHIPLET_OFFSET; + this->iv_handle.fields.type = TARGET_TYPE_MCS | TARGET_TYPE_PERV; + this->iv_handle.fields.type_target_num = Value; + } + + if(K == TARGET_TYPE_ALL) + { + this->iv_handle.fields.chiplet_num = Value; + this->iv_handle.fields.type = TARGET_TYPE_ALL; + } + this->iv_handle.fields.address_overlay = + (this->iv_handle.fields.chiplet_num << 24); + + } + + /// + /// @brief Assignment Operator. + /// @param[in] i_right Reference to Target to assign from. + /// @return Reference to 'this' Target + /// + template<TargetType K, typename V> + Target<K, V>& Target<K, V>::operator=(const Target& i_right) + { + this->iv_handle.value = i_right->iv_handle.value; + return *this; + } + /// + /// @brief Equality Comparison Operator + /// @param[in] i_right Reference to Target to compare. + /// @return bool. True if equal. + /// @note Platforms need to define this so that the physical + /// targets are determined to be equivilent rather than just the handles + /// + template<TargetType K, typename V> + bool Target<K, V>::operator==(const Target& i_right) const + { + if (this->iv_handle.value == i_right->iv_handle.value) + return true; + else + return false; + } + + /// + /// @brief Inquality Comparison Operator + /// @param[in] i_right Reference to Target to compare. + /// @return bool. True if not equal. + /// @note Platforms need to define this so that the physical + /// targets are determined to be equivilent rather than just the handles + /// + template<TargetType K, typename V> + bool Target<K, V>::operator!=(const Target& i_right) const + { + if (this->iv_handle.value != i_right->iv_handle.value) + return true; + else + return false; + } + + /// + /// @brief Get this target's immediate parent + /// @tparam T The type of the parent + /// @return Target<T> a target representing the parent + /// + template<TargetType K, typename V> + template<TargetType T> + inline Target<T> Target<K, V>::getParent(void) const + { + return this->iv_handle.value; + } + + /// + /// @brief Get this target's children + /// @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 + /// @warning The children of EX's (cores) are expected to be returned + /// in order. That is, core 0 is std::vector[0]. + /// + template<TargetType K, typename V> + template< TargetType T> + inline std::vector<Target<T> > + Target<K, V>::getChildren(const TargetState i_state) const + { +#define INVALID_CHILD(PARENT, CHILD) \ + static_assert(!((K == PARENT) && (T == CHILD)), \ + #CHILD " is not a child of " #PARENT ); + + // invalid children for proc +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_NONE) +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_SYSTEM) +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_DIMM) +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_PROC_CHIP) +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_MEMBUF_CHIP) +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_MBA) +#undef INVALID_CHILD + +#define INVALID_PARENT(PARENT) \ + static_assert(!((K == PARENT)), \ + #PARENT "is not supported on PPE platforms"); + + // invalid parents +// INVALID_PARENT(fapi2::TARGET_TYPE_SYSTEM) +// INVALID_PARENT(fapi2::TARGET_TYPE_MEMBUF_CHIP) +// INVALID_PARENT(fapi2::TARGET_TYPE_L4) +// INVALID_PARENT(fapi2::TARGET_TYPE_DIMM) +// INVALID_PARENT(fapi2::TARGET_TYPE_MCA) +// INVALID_PARENT(fapi2::TARGET_TYPE_MBA) +// INVALID_PARENT(fapi2::TARGET_TYPE_MI) +// INVALID_PARENT(fapi2::TARGET_TYPE_MCBIST) +// INVALID_PARENT(fapi2::TARGET_TYPE_DMI) +#undef INVALID_PARENT + + // valid children for EQ + // EQ -> CORE + // EQ -> EX + static_assert(!((K == fapi2::TARGET_TYPE_EQ) && + (T != fapi2::TARGET_TYPE_CORE) && + (T != fapi2::TARGET_TYPE_EX)), + "improper child of fapi2::TARGET_TYPE_EQ"); + + // valid children for EX + // EX -> CORE + static_assert(!((K == fapi2::TARGET_TYPE_EX) && + (T != fapi2::TARGET_TYPE_CORE)), + "improper child of fapi2::TARGET_TYPE_EX"); + + // Nimbus Memory + // valid children for MCS + // MCS -> MCA +// static_assert(!((K == fapi2::TARGET_TYPE_MCS) && +// (T != fapi2::TARGET_TYPE_MCA)), +// "improper child of fapi2::TARGET_TYPE_MCS"); + + + std::vector<fapi2::plat_target_handle_t>::iterator l_iter; + FAPI_DBG("getChildren: initializing children vector"); + std::vector<Target<T> > l_children; + + + + uint32_t c = 0; + for (l_iter = G_vec_targets.begin(); l_iter != G_vec_targets.end(); ++l_iter) + { + + Target<T> * l_temp = reinterpret_cast< Target<T>* >(l_iter); + if (((*l_temp).getTargetType() & T) == T) + { + switch (i_state) + { + case TARGET_STATE_PRESENT: + if ((*l_temp).getPresent()) + { + l_children.push_back((*l_temp)); +// FAPI_DBG("Pushing getChildren present 0x%08X", (uint32_t)(((*l_temp)).get()>>32)); + } + break; + case TARGET_STATE_FUNCTIONAL: + if ((*l_temp).getFunctional()) + { + l_children.push_back((*l_temp)); +// FAPI_DBG("Pushing getChildren functional 0x%08X", (uint32_t)(((*l_temp)).get()>>32)); + } + break; + default: + FAPI_ERR("Coming error ASSERT for illegal i_state = %u", i_state); + } + } + ++c; + } + + return l_children; + } + + /// + /// @brief Get the target at the other end of a bus - dimm included + /// @tparam T The type of the parent + /// @param[in] i_state The desired TargetState of the children + /// @return Target<T> a target representing the thing on the other end + /// @note Can be easily changed to a vector if needed + /// + template<TargetType K, typename V> + template<TargetType T> + inline Target<T> + Target<K, V>::getOtherEnd(const TargetState i_state) const + { +// static_assert( false, "getOtherEnd() is not supported on PPE platforms"); + } + + + /// + /// @brief Return the string interpretation of this target + /// @tparam T The type of the target + /// @param[in] i_target Target<T> + /// @param[in] i_buffer buffer to write in to + /// @param[in] i_bsize size of the buffer + /// @return void + /// @post The contents of the buffer is replaced with the string + /// representation of the target + /// + template< TargetType T > + inline void toString(const Target<T>& i_target, char* i_buffer, size_t i_bsize) + { + snprintf(i_buffer, i_bsize, "Target 0x%lx/0x%x", i_target.get(), T); + } + + /// + /// @brief Return the string interpretation of this target + /// @tparam T The type of the target + /// @tparam B The type of the buffer + /// @param[in] A pointer to the Target<T> + /// @param[in] i_buffer buffer to write in to + /// @param[in] i_bsize size of the buffer + /// @return void + /// @post The contents of the buffer is replaced with the string + /// representation of the target + /// + template< TargetType T > + inline void toString(const Target<T>* i_target, char* i_buffer, size_t i_bsize) + { + snprintf(i_buffer, i_bsize, "Target 0x%lx/0x%x", i_target->get(), T); + } + + /// + /// @brief Get an enumerated target of a specific type + /// @tparam T The type of the target + /// @param[in] Ordinal representing the ordinal number of + /// the desired target + /// @return Target<T> the target requested + /// + template<TargetType T> + inline Target<T> getTarget(uint64_t Ordinal) + { + // For testing + return Target<T>(Ordinal); + } +} + +#endif diff --git a/hwpf/include/plat/target.apis b/hwpf/include/plat/target.apis new file mode 100644 index 00000000..3490c05e --- /dev/null +++ b/hwpf/include/plat/target.apis @@ -0,0 +1,11 @@ + +inline Target<T> Target<K, V>::getParent(void) const + +Target<K, V>::getChildren(const TargetState i_state) const + +Target<K, V>::getOtherEnd(const TargetState i_state) const + +inline void toString(const Target<T>& i_target, char* i_buffer, size_t i_bsize) + +inline Target<T> getTarget(uint64_t Ordinal) + diff --git a/hwpf/include/return_code.H b/hwpf/include/return_code.H new file mode 100644 index 00000000..fd2f7c29 --- /dev/null +++ b/hwpf/include/return_code.H @@ -0,0 +1,108 @@ +/* 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 return_code.H + * @brief definitions for fapi2 return codes + */ + +#ifndef __FAPI2_RETURN_CODE__ +#define __FAPI2_RETURN_CODE__ + +#include <stdint.h> +#include <return_code_defs.H> + +#ifndef FAPI2_NO_FFDC + #include <ffdc.H> +#endif + +namespace fapi2 +{ + /// + /// @brief Class representing a FAPI2 ReturnCode + /// + // Remove the inheritance relationship with FirstFailureData if + // the platform doesn't support FFDC. +#ifdef FAPI2_NO_FFDC + class ReturnCode +#else + class ReturnCode : public FirstFailureData<ReturnCode> +#endif + { + public: + + /// + /// @brief Constructor. + /// @param[in] i_rc the rc to set + /// + ReturnCode(const uint64_t i_rc = FAPI2_RC_SUCCESS): + iv_rc(i_rc) + {}; + + /// + /// @brief integral type conversion function. Returns the error code + /// @return The error code + /// + inline operator uint64_t() const { return iv_rc; } + + /// + /// @brief Returns true iff iv_rc == SUCCESS + /// @return true or false + /// + inline operator bool() const { return iv_rc == FAPI2_RC_SUCCESS; } + + /// + /// @brief Assignement operator + /// +#ifdef DOXYGEN + inline ReturnCode& operator=(const uint64_t& rhs) + inline ReturnCode& operator=(const ReturnCodes& rhs) +#endif + + inline bool operator==(const uint64_t& rhs) const + { return rhs == iv_rc; } + + inline bool operator==(const ReturnCodes& rhs) const + { return rhs == iv_rc; } + + inline bool operator!=(const uint64_t& rhs) const + { return rhs != iv_rc; } + + inline bool operator!=(const ReturnCodes& rhs) const + { return rhs != iv_rc; } + + private: + uint64_t iv_rc; + }; + + /// This implementation assumes no exception handling and leverages thread-local + /// storage. For platforms without thread support, a global variable will + /// suffice for the error state. +// extern thread_local ReturnCode current_err; /// the current error state + extern ReturnCode current_err; /// the current error state + extern thread_local uint64_t pib_error_mask; /// the pib mask + extern thread_local uint64_t operational_state; /// the operational mode +} + +#endif diff --git a/hwpf/include/set_sbe_error.H b/hwpf/include/set_sbe_error.H new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/hwpf/include/set_sbe_error.H diff --git a/hwpf/include/target_types.H b/hwpf/include/target_types.H new file mode 100644 index 00000000..56470cd0 --- /dev/null +++ b/hwpf/include/target_types.H @@ -0,0 +1,119 @@ +/* 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 target_types.H + * @brief definitions for fapi2 target types + */ + +#ifndef __FAPI2_TARGET_TYPES__ +#define __FAPI2_TARGET_TYPES__ + +#ifndef __ASSEMBLER__ + + +/// FAPI namespace +namespace fapi2 +{ + + /// + /// @enum fapi::TargetType + /// @brief Types, kinds, of targets + /// @note TYPE_NONE is used to represent empty/NULL targets in lists + /// or tables. TYPE_ALL is used to pass targets to methods which + /// can act generally on any type of target + /// + /// Target Kind + enum TargetType + { + TARGET_TYPE_NONE = 0x00, ///< No type + TARGET_TYPE_PROC_CHIP = 0x01, ///< Processor type + TARGET_TYPE_EX = 0x02, ///< Ex type + TARGET_TYPE_CORE = 0x04, ///< Core type + TARGET_TYPE_EQ = 0x08, ///< EQ type + TARGET_TYPE_MCS = 0x10, ///< MCS type + TARGET_TYPE_PERV = 0x20, ///< Pervasive type + TARGET_TYPE_MCAST = 0x40, ///< Multicast type + TARGET_TYPE_SYSTEM = 0x80, ///< System type + + TARGET_TYPE_ALL = 0xFF, ///< Any/All types + + // The following are actually illegal targets on PPE platforms +// TARGET_TYPE_SYSTEM = 0xFE, ///< System type +// TARGET_TYPE_DIMM = 0xFD, ///< DIMM type +// TARGET_TYPE_MEMBUF_CHIP = 0xFC, ///< Membuf type +// TARGET_TYPE_MBA = 0xFB, ///< MBA type +// TARGET_TYPE_XBUS = 0xFA, ///< XBUS type +// TARGET_TYPE_ABUS = 0xF9, ///< ABUS type +// TARGET_TYPE_L4 = 0xF8, ///< L4 type +// TARGET_TYPE_MCA = 0xF7, ///< MCA type +// TARGET_TYPE_MCBIST = 0xF6, ///< MCBIST type +// TARGET_TYPE_MIA = 0xF5, ///< MIA type +// TARGET_TYPE_MIS = 0xF4, ///< MIS type +// TARGET_TYPE_DMI = 0xF3, ///< DMI type +// TARGET_TYPE_OBUS = 0xF2, ///< OBUS type +// TARGET_TYPE_NV = 0xF1, ///< NV bus type +// TARGET_TYPE_SBE = 0xF0, ///< SBE type +// TARGET_TYPE_PPE = 0xEF, ///< PPE type +// TARGET_TYPE_PEC = 0xEE, ///< PEC type +// TARGET_TYPE_PHB = 0xED, ///< PHB type +// TARGET_TYPE_MI = 0xEC, ///< MI type + + // Mappings to target types found in the error xml files + TARGET_TYPE_EX_CHIPLET = TARGET_TYPE_EX, +// TARGET_TYPE_MBA_CHIPLET = TARGET_TYPE_MBA, + TARGET_TYPE_MCS_CHIPLET = TARGET_TYPE_MCS, +// TARGET_TYPE_XBUS_ENDPOINT = TARGET_TYPE_XBUS, +// TARGET_TYPE_ABUS_ENDPOINT = TARGET_TYPE_ABUS, + }; + + /// + /// @brief Typedef used when passing multiple TargetType values + /// + typedef uint8_t TargetTypes_t; + + /// @cond + constexpr TargetType operator|(TargetType x, TargetType y) + { + return static_cast<TargetType>(static_cast<int>(x) | + static_cast<int>(y)); + } + + template<uint64_t V> + class bitCount { + public: + // Don't use enums, too hard to compare + static const uint8_t count = bitCount<(V >> 1)>::count + (V & 1); + }; + + template<> + class bitCount<0> { + public: + static const uint8_t count = 0; + }; + /// @endcond +}; + +#endif // __ASSEMBLER__ +#endif // __FAPI2_TARGET_TYPES__ diff --git a/hwpf/include/utils.H b/hwpf/include/utils.H new file mode 100644 index 00000000..69dc5838 --- /dev/null +++ b/hwpf/include/utils.H @@ -0,0 +1,83 @@ +/* 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 utils.H + * + * @brief Defines common utility elements for FAPI2 use. + */ + +#ifndef FAPI2_UTILS_H_ +#define FAPI2_UTILS_H_ + +#include <return_code.H> + +#ifdef __ASSEMBLER__ + +#ifndef ULL +#define ULL(x) x +#endif + +#else + +#ifndef ULL +#define ULL(x) x##ull + +#endif + +#endif // __ASSEMBLER + +/// Create a multi-bit mask of \a n bits starting at bit \a b +#define BITS(b, n) ((ULL(0xffffffffffffffff) << (64 - (n))) >> (b)) + +/// Create a single bit mask at bit \a b +#define BIT(b) BITS((b), 1) + +#ifdef _BIG_ENDIAN + +#define revle16(x) x +#define revle32(x) x +#define revle64(x) x + +#else + +uint16_t revle16(uint16_t i_x); +uint32_t revle32(uint32_t i_x); +uint64_t revle64(uint64_t i_x); + +#endif + +namespace fapi2 +{ + /// @brief Delay this thread. + /// @param[in] i_nanoSeconds nanoseconds to sleep + /// @param[in] i_simCycles count of Awan cycles to advance + /// @return ReturnCode. Zero on success, else platform specified error. + inline ReturnCode delay(uint64_t i_nanoSeconds, uint64_t i_simCycles) + { + return FAPI2_RC_SUCCESS; + } +} + +#endif // FAPI2_UTILS_H_ diff --git a/hwpf/include/vector.H b/hwpf/include/vector.H new file mode 100644 index 00000000..c5b3e410 --- /dev/null +++ b/hwpf/include/vector.H @@ -0,0 +1,849 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/vector $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* */ +/* 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 */ +#ifndef stl_vector +#define stl_vector + +/** + * @file vector + * @brief simple stl vector template class declaration. + */ + +#include <stddef.h> + +#if !defined( __STDC_LIMIT_MACROS) +#define __STDC_LIMIT_MACROS +#endif +#include <stdint.h> +//#include <new> +#include <algorithm> +#include <assert.h> + +namespace std +{ + + /** + * @class vector + * subset of stl vector + * @note Does not support allocators, reverse iterators. + */ + template <class T> + class vector + { + public: + + typedef T * iterator; + typedef const T * const_iterator; + typedef T & reference; + typedef const T & const_reference; + typedef size_t size_type; + typedef size_t difference_type; + // typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T * pointer; + typedef const T * const_pointer; + + + protected: + + pointer iv_start; + pointer iv_finish; + pointer iv_end_of_storage; + + public: + + /** + * Constructor default + * @post The vector is created with no elements. size() == 0, capacity() == 0 + */ + __attribute__ ((always_inline)) + explicit vector(void) + : + iv_start(NULL), + iv_finish(NULL), + iv_end_of_storage(NULL) + {} + + + /** + * Constructor to create a vector of size n elements of value. + * @param[in] n number of elements to create + * @param[in] value used to create the n elements + * @post The vector is created with n elements of value. + * Storage allocated. size() == n, capacity() == n + */ + explicit vector(size_type n, const T& value = T()) + : + iv_start(NULL), + iv_finish(NULL), + iv_end_of_storage(NULL) + { + reserve(n); + iv_finish = iv_start+n; + ctor_fill(iv_start,iv_finish,value); + } + + + /** + * COPY CTOR create a vector from another vector + * @param[in] x source vector + * @post vector of x.size() is created from x with same # nodes + * size() == capacity() == x.size() + */ + vector(const vector<T>& x) + : + iv_start(NULL), + iv_finish(NULL), + iv_end_of_storage(NULL) + { + reserve(x.size()); + iv_finish = ctor_copy(x.iv_start, x.iv_finish, iv_start); + } + + /** + * CTOR create a vector from a container slice + * @param[in] first iterator first in source sequence + * @param[in] last iterator one past end of source sequence + * @returns None. + * @pre last > first; first,last contained within source vector + * @post vector is created from slice given + */ + template<typename InputIterator> + vector(InputIterator first, InputIterator last) + : + iv_start(NULL), + iv_finish(NULL), + iv_end_of_storage(NULL) + { + // assert(last >= first); + // input iterators only support operator ( ++i, i++,==,!=,*,->,=) + size_type n = 0; + for(InputIterator i = first; i != last; ++i) ++n; + reserve(n); + iv_finish = ctor_copy(first,last,iv_start); + } + + /** + * DTOR + * @post Storage released + */ + __attribute__ ((always_inline)) + ~vector() + { + clear(); // call dtors + free_storage(iv_start); + } + + /** + * Assignment operator. + * @param[in] x A vector. + * @return A vector (for the purpose of multiple assigns). + * @pre None. + * @post *this == x, this->capacity() == x.size(). + * All previously obtained iterators are invalid. + */ + vector<T>& operator=(const vector<T>& x) + { + clear(); + reserve(x.size()); + iv_finish = ctor_copy(x.iv_start, x.iv_finish, iv_start); + return(*this); + } + + // Iterators -------------------- + + /** + * Get iterator to the first vector element + * @return iterator of rist vector element + * @pre None. + * @post None. + */ + __attribute__ ((always_inline)) + iterator begin() + { + return (iv_start); + } + + /** + * Get const_iterator to the first vector element + * @return const_iterator of rist vector element + * @pre None. + * @post None. + */ + __attribute__ ((always_inline)) + const_iterator begin() const + { + return (iv_start); + } + + /** + * Get iterator to the last vector element + 1 + * @return iterator + * @pre None. + * @post None. + */ + __attribute__ ((always_inline)) + iterator end() + { + return (iv_finish); + } + + /** + * Get const_iterator to the last vector element + 1 + * @return const_iterator + * @pre None. + * @post None. + */ + __attribute__ ((always_inline)) + const_iterator end() const + { + return (iv_finish); + } + + /* TODO - Implement only if needed + reverse_iterator rbegin() + { + return(iv_finish -1); + } + + const_reverse_iterator rend() + { + return (iv_start - 1); + } + */ + + // Capacity ----------------------------------------------- + + /** + * Get the number of elements in the container + * @return number of elements in the container + */ + __attribute__ ((always_inline)) + size_type size() const + { + return(iv_finish - iv_start); + } + + /** + * Return the maximum potential size the container could reach. + * @return number of the maximum element count this container could reach + */ + __attribute__ ((always_inline)) + size_type max_size() const + { + return UINT64_MAX/sizeof(T); + } + + /** + * Resize the vector to contain n elements + * @param[in] n new size + * @param[in] x object used to copy to any added elements if size() is increased + * @post All previously obtained iterators are invalid. + * @node if n < size(), vector is truncated. + * if n > size(), vector is padded with copies of x + */ + void resize( size_type n, T x = T()); + + /** + * Get the number of elements the vector can hold before needing to reallocate storage. + * @return element capacity of the vector + * @pre None. + * @post None. + */ + __attribute__ ((always_inline)) + size_type capacity() const + { + return(iv_end_of_storage - iv_start); + } + + /** + * Query for empty container + * @return bool, true if size()==0 else false. + * @pre none + * @post none + */ + __attribute__ ((always_inline)) + bool empty() const + { + return(size() == 0); + } + + /** + * Reserve storage for a given number of elements + * @param[in] n The requested capacity of the vector + * @pre None + * @post If current cpacity() < n then new capcity == n; else no change. + * All previously obtained iterators are invalid + */ + void reserve(size_type n); + + // - Element Access ----------------------------------- + + /** + * Access a mutable reference to an element in the container + * @param An index into the vector + * @return A reference to an element + * @pre 0 <= n < size() + * @post None. + */ + __attribute__ ((always_inline)) + reference operator[](size_type n) + { + return(*(iv_start + n)); + } + + /** + * Access a mutable reference to an element in the container + * @param[in] index An index into the vector + * @return A reference to an element + * @pre 0 <= n < size() + * @post None. + * @note no exception handling + */ + __attribute__ ((always_inline)) + reference at(size_type index) + { + assert(index < size()); + return(*(iv_start + index)); + } + + /** + * Get an immutable reference to an element in the container + * @param[in] index An index into the vector + * @return A const_reference to an object or type T + * @pre 0 <= n < size() + * @post None. + */ + __attribute__ ((always_inline)) + const_reference operator[](size_type index) const + { + assert(index < size()); + return(*(iv_start + index)); + } + + /** + * Get an immutable reference to an element in the container + * @param[in] index An index into the vector + * @return A const_reference to an object or type T + * @pre 0 <= n < size() + * @post None. + * @note no exception handling + */ + __attribute__ ((always_inline)) + const_reference at(size_type index) const + { + assert(index < size()); + return(*(iv_start + index)); + } + + /** + * Get a mutable reference to the first element in the container + * @return reference to first element + * @pre none + * @post None + */ + __attribute__ ((always_inline)) + reference front() + { + return *iv_start; + } + + /** + * Get an Immutable reference to the first element in the container + * @return const_reference to first element + * @pre none + * @post None + */ + __attribute__ ((always_inline)) + const_reference front() const + { + return *iv_start; + } + + /** + * Get a mutable reference to the last element in the container + * @return reference to last element + * @pre none + * @post None + */ + __attribute__ ((always_inline)) + reference back() + { + return *(iv_finish-1); + } + + /** + * Get an Immutable reference to the last element in the container + * @return reference to last element + * @pre none + * @post None + */ + __attribute__ ((always_inline)) + const_reference back() const + { + return *(iv_finish-1); + } + + // -- Modifiers ----------------------------- + + /* + * Assign new content to the vector object + * @param[n] first iterator to first element to copy in + * @param[n] last iterator to last element + 1 to copy in + */ + template <class InputIterator> + void assign (InputIterator first, InputIterator last) + { + clear(); + size_type n = 0; + for(InputIterator i = first; i != last; ++i) ++n; + reserve(n); + iv_finish = ctor_copy(first,last,iv_start); + } + + + /* + * Assign new content to the vector object + * @param[in] n number of elements to assign + * @param[in] x reference to element to copy in + */ + void assign ( size_type n, const T& x) + { + clear(); + reserve(n); + ctor_fill_n(iv_start,n,x); + iv_finish = iv_start + n; + } + + + /** + * Add element to the back of the container + * @param[in] x reference to object used to create new element + * @pre none + * @post All previously obtained iterators are invalid. + */ + __attribute__ ((always_inline)) + void push_back(const T& x) + { + reserve(size() + 1); + new (iv_finish++) T(x); + } + + /** + * Remove the last element in the container + * @return nothing + * @pre size() > 0 + * @post size() decreased by one + */ + __attribute__ ((always_inline)) + void pop_back() + { + erase(iv_finish-1,iv_finish); + } + + /** + * Insert an element into the container at a given position + * @param[in] position iterator to position to insert + * @param[in] x reference of element to insert + * @pre begin() <= position < end() + * @post Element inserted at position, storage adjusted as needed. + * All previously obtained iterators are invalid. + */ + iterator insert(iterator position, const T& x) + { + // iv_start will change if the vector gets resized - so save the offset for + // return. + difference_type offset = position - iv_start; + insert(position, 1, x); + return (iv_start + offset); + } + + /** + * Insert a number of copies of a given elements at a given position + * @param[in] postion iterator, postion to insert elements + * @param[in] n number of elements to insert + * @param[in] x A reference to the object to uses to create the new elements + * @pre begin() <= postion < end() + * @post All previously obtained iterators are invalid. + */ + void insert (iterator position, size_type n, const T& x); + + /** + * Insert a slice into the current container at a given position + * @param[in] position iterator, position to insert slice + * @param[in] first iterator to first element of slice insert + * @param[in] last iterator to last element + 1 of slice to insert + * @pre begin() <= postion <= end(), first < last. + * @post Elements inserted at postition. Storage adjusted as needed. + * All previously obtained iterators are invalid. + * @note element pointed to by last is not inserted. + */ + template <class InputIterator> + void insert (iterator position, InputIterator first, + InputIterator last); + + + /** + * Remove an element from the container + * @param[in] position iterator, position of element to remove + * @return new location of the element that followed the last + * element erased, or end() if the operation erased + * the last element in the sequence. + * @pre begin() <= position < end() + * @post All previously obtained iterators are invalid. + */ + __attribute__ ((always_inline)) + iterator erase(iterator position) + { + return erase(position,position+1); + } + + /** + * Remove a slice of elements from the container + * @param[in] first iterator, postion of the first element to remove + * @param[in] last iterator, postion of the last element + 1 to remove + * @return new location of the element that followed the last + * element erased, or end() if the operation erased + * the last element in the sequence. + * @pre begin() <= first,last <= end(), first <= last. + * @post All previously obtained iterators are invalid. + * @note The element pointed to be last is not deleted. + */ + iterator erase(iterator first, iterator last) + { + assert(last >= first); + assert(first >= iv_start); + assert(first <= iv_finish); + assert(last >= iv_start); + assert(last <= iv_finish); + + last = copy(last,iv_finish,first); + while(last != iv_finish) + { + --iv_finish; + iv_finish->~T(); + } + return first; + } + + + /** + * Swap this vector with another + * @param reference to another vector of this type + */ + void swap(vector<T>& x) + { + std::swap(iv_start,x.iv_start); + std::swap(iv_finish,x.iv_finish); + std::swap(iv_end_of_storage,x.iv_end_of_storage); + } + + /** + * Clear the vector + * @pre none. + * @post size() = 0, All previously obtained iterators are invalid + * @note capacity unchanged + */ + void clear () + { + while(iv_finish != iv_start) + { + --iv_finish; + (iv_finish)->~T(); + } + } + + private: + + /** + * Copy constructs elements into raw storage + * @param[in] first iterator of first element to copy + * @pararm[in] last iterator of last element + 1 to copy + * @param[in] destination iterator of destination + * @post elements moved + */ + template <class InputIterator, class OutputIterator> + OutputIterator + ctor_copy(InputIterator first, + InputIterator last, + OutputIterator destination) + { + while(first != last) + { + new (destination) T(*first); + ++destination; + ++first; + } + return(destination); + } + + /** + * Copy constructs elements into raw storage + * @param[in] first iterator of first element to copy + * @param[in] last iterator of last element + 1 to copy + * @param[in] destination iterator to end of destination + 1 + * @post elements moved + */ + template <class BidirectionalIterator1, class BidirectionalIterator2> + BidirectionalIterator2 + ctor_copy_backward ( BidirectionalIterator1 first, + BidirectionalIterator1 last, + BidirectionalIterator2 destination) + { + while(last != first) + { + --destination; + --last; + new(destination) T(*last); + } + return destination; + } + + /** + * fill by copy construct ino raw storage + * @param[in] first itertor fo first element + * @param[in] last iterator to last element + 1 + * @param[in] value to use to fill + */ + template < class ForwardIterator, class Tp > + void + ctor_fill (ForwardIterator first, ForwardIterator last, const Tp& value ) + { + while (first != last) + { + new (first) T(value); + ++first; + } + } + + /** + * fill by copy construct into raw storage + * @param[in] first iterator first location to fill + * @param[in] n number of elements to fill + * @param[in] value to use to fill + */ + template < class OutputIterator, class Size, class Tp > + void + ctor_fill_n( OutputIterator first, Size n, const Tp& value ) + { + for(; n>0; --n) + { + new (first) T(value); + ++first; + } + } + + + /** + * Free all the storage allocated to this vector + * @param[in] i_start iterator to start of storage block + */ + __attribute__ ((always_inline)) + void free_storage(iterator i_start) + { + delete [] (uint8_t *)i_start; + } + + /** + * Allocate storage for this vector + * @param[in] n, number of elements required + */ + __attribute__ ((always_inline)) + iterator allocate_storage(size_type n) + { + return (iterator) new uint8_t[n * sizeof(T)]; + } + + /** + * debug dump + */ + //void dump(const char * msg = "") + //{ + // puts(msg); + // printf("vector_dump::start 0x%016lx finish 0x%016lx eos 0x%016lx\n", + // (uint64_t)iv_start, (uint64_t)iv_finish, (uint64_t)iv_end_of_storage); + //} + }; + +}; // end namespace std + +// ------------------------------------------------------------------------------------------------ + +template <class T> +void std::vector<T>::reserve(size_type n) +{ + size_type c = capacity(); + if(n > c) + { + // if requested new capacity < 10% of current capacity then increase by 10% + size_type dif = n - c; + size_type inc = 1 + (c/size_type(10)); + if(dif < inc) + { + n += inc; + } + + iterator newStart = allocate_storage(n); + if(NULL == iv_start) + { + iv_finish = newStart; + } + else + { + iterator newFinish = ctor_copy(iv_start, iv_finish, newStart); + clear(); + iv_finish = newFinish; + free_storage(iv_start); + } + iv_end_of_storage = newStart + n; + iv_start = newStart; + } +} + + +// ------------------------------------------------------------------------------------------------ + +template <class T> +void std::vector<T>::insert (iterator position, size_type n, const T& x) +{ + //assert (position >= iv_start); + //assert (position <= iv_finish); + size_type new_size = size() + n; + if(position == end()) + { + reserve(new_size); + while(n--) new (iv_finish++) T(x); + } + else if(new_size > capacity()) + { + vector<T> new_vec; + new_vec.reserve(new_size); + for(const_iterator i = begin(); i != end(); ++i) + { + if(i == position) + { + while(n--) new_vec.push_back(x); + } + new_vec.push_back(*i); + } + swap(new_vec); // swap this with new_vec + } + else // already have enough space + { + size_type m = iv_finish - position; // # of existing elements to move + pointer new_finish = iv_finish + n; + if(m < n) + { + ctor_copy_backward(position,iv_finish,new_finish); + while(n--) + { + if(position < iv_finish) *position = x; + else new (position) T(x); + ++position; + } + } + else // n <= m + { + ctor_copy_backward(iv_finish-n,iv_finish,new_finish); // raw storage copy + copy_backward(position, iv_finish-n, iv_finish); // operator= copy + fill_n(position,n,x); + } + iv_finish = new_finish; + } +} + +// ------------------------------------------------------------------------------------------------ + +template <class T> +template <class InputIterator> +void std::vector<T>::insert (iterator position, + InputIterator first, + InputIterator last) +// Should only move storage if there is not room +// InputIterators are not random access (eg. can't do diff = last - first) +{ + size_type n = 0; + for(InputIterator i = first; i != last; ++i) ++n; + size_type new_size = size() + n; + + if(position == end()) + { + reserve(new_size); + iv_finish = ctor_copy(first,last,iv_finish); + } + else if(new_size > capacity()) // make a new vector + { + vector<T> new_vec; + new_vec.reserve(new_size); + for(const_iterator i = begin(); i != end(); ++i) + { + if(i == position) + { + while(n--) new_vec.push_back(*first++); + } + new_vec.push_back(*i); + } + swap(new_vec); + } + else // already have enough space + { + size_type m = iv_finish - position; // # of exising elements to adjust + if(m < n) + { + ctor_copy_backward(position,iv_finish,iv_finish+n); // cp all existing elements to raw storage + while(first != last) + { + if(position < iv_finish) *position = *first; // cp new elements to existing element locations + else new (position) T(*first); // cp remaining new elements to raw storage + ++position; + ++first; + } + } + else // n <= m + { + ctor_copy_backward(iv_finish-n, iv_finish, iv_finish+n); // cp existing elements to raw storage + copy_backward(position, iv_finish-n, iv_finish); // cp rest of existing elements to existing locations + copy(first,last,position); // cp in new elements to existing locations + } + iv_finish += n; + } +} + +// ------------------------------------------------------------------------------------------------ + +template <class T> +void std::vector<T>::resize(size_type n, T x) +{ + size_type sz = size(); + if(n < sz) + { + erase(iv_start + n,iv_finish); + } + else if(n > sz) + { + insert(iv_finish,n-sz,x); + } + // else n == size() do nothing +} + +#endif +/* vim: set filetype=cpp : */ |