diff options
Diffstat (limited to 'hwpf/plat')
-rw-r--r-- | hwpf/plat/include/buffer_base.H | 347 | ||||
-rw-r--r-- | hwpf/plat/include/fapi2.H | 42 | ||||
-rw-r--r-- | hwpf/plat/include/hw_access.H | 372 | ||||
-rw-r--r-- | hwpf/plat/include/hwp_executor.H | 0 | ||||
-rw-r--r-- | hwpf/plat/include/hwp_ffdc_classes.H | 0 | ||||
-rw-r--r-- | hwpf/plat/include/plat_target.H | 43 | ||||
-rw-r--r-- | hwpf/plat/include/plat_trace.H | 70 | ||||
-rw-r--r-- | hwpf/plat/include/set_sbe_error.H | 0 | ||||
-rw-r--r-- | hwpf/plat/include/target.H | 21 | ||||
-rw-r--r-- | hwpf/plat/src/fapi2ppefiles.mk | 5 |
10 files changed, 294 insertions, 606 deletions
diff --git a/hwpf/plat/include/buffer_base.H b/hwpf/plat/include/buffer_base.H deleted file mode 100644 index 45297a06..00000000 --- a/hwpf/plat/include/buffer_base.H +++ /dev/null @@ -1,347 +0,0 @@ -/* 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_base.H - * @brief definitions for fapi2 buffer base class - */ - -#ifndef __FAPI2_BUFFER_BASE__ -#define __FAPI2_BUFFER_BASE__ - -#include <stdint.h> -#include <initializer_list> -#include <error_scope.H> -#include <buffer_parameters.H> -#include <buffer_traits.H> -#include <return_code.H> - -namespace fapi2 -{ - /// @brief Base class for buffers and variable buffers - /// @tparam T is the type of iv_data (std::vector, etc) - /// @tparam TT is the template trait, defaults to the trait for T - /// - /// Buffers can be of two styles; buffers made from an integral type and - /// buffers made from a container. Integral type buffers, while limited - /// in size, can be tightly controlled via the compiler by using c++ - /// templates. - /// - /// C++ templates allow for very explicit control, but yield a - /// syntax different than the FAPI 1.x functional interface. For example, - /// a fapi2::buffer is defined as having a type: - /// @code - /// fapi2::buffer<uint64_t> new_buffer; - /// @endcode - /// defines a buffer with exactly 64 bits, and can be manipulated by the - /// compiler as a single intrgral value. These implementations result - /// in concise instruction streams, and a platform may choose to implement - /// all or some or none of the integral buffer types. - /// - /// Buffers which have containers as their underlying implementation - /// are found in the class fapi2::variable_buffer. variable_buffer is little - /// more than - /// @code - /// fapi2::buffer<fapi2::bits_container> - /// @endcode - /// where bits_container is the typedef of the underlying container (a - /// vector of uint32_t, for example) - /// - /// Examples:<br> - /// - /// * Simple uint64_t buffer - /// @code - /// const uint32_t x = 2; - /// - /// // this data buffer will contain data in a uint64_t type - /// fapi2::buffer<uint64_t> data; - /// - /// // Set using the template and a constant - /// data.setBit<x>(); - /// - /// // Set using the template and a value - /// data.setBit<3>(); - /// - /// // Set using the function interface, and a value - /// data.setBit(1); - /// - /// // compiler gets smart. - /// // movabs $0x7000000000000000,%rsi - /// @endcode - /// - /// * variable_buffer, same thing - /// @code - /// - /// const uint32_t x = 2; - /// - /// // Note: only 15 bits long - /// fapi2::variable_buffer data(15); - /// - /// - /// data.setBit(x); - /// data.setBit(3); - /// data.setBit(1); - /// @endcode - /// - /// * method chaining - /// Buffers support method chaining. So, rather than - /// this - /// @code - /// buffer<T> mask; - /// mask.setBit<B>(); - /// mask.invert(); - /// my_buffer &= mask; - /// @endcode - /// You can do - /// @code - /// my_buffer &= buffer<T>().setBit<B>.invert(); - /// @endcode - /// - /// * buffer operations - /// @code - /// - /// // An 8 bit buffer, initialized with a value - /// fapi2::buffer<uint8_t> eight_bits = 0xAA; - /// fapi2::buffer<uint8_t> another_eight; - /// fapi2::buffer<uint16_t> sixteen_bits; - /// - /// // You can't assign an 8 bit buffer to a 16 bit buffer. - /// sixteen_bits = eight_bits; ERROR - /// - /// // But you can assign buffers of the same type - /// another_eight = eight_bits; - /// - /// // You can assign constants (or other known values) directly: - /// sixteen_bits = 0xAABB; - /// @endcode - /// - /// * Variable buffer operations - /// - /// @code - /// fapi2::variable_buffer data(16); - /// - /// // Very large buffers can be initialized rather than set bit by bit. - /// const fapi2::variable_buffer bit_settings_known( - /// {0xFFFF0000, 0xAABBF0F0, - /// 0xFFFF0000, 0xAABBF0F0, - /// 0xFFFF0000, 0xAABBF0F0,}); - /// - /// // Assignment will expand or shrink the size automatically. - /// data = bit_settings_known; - /// - /// // You can assign directly to the buffer: - /// fapi2::variable_buffer other_bits; - /// const fapi2::container_unit x = 0xFF00AA55; - /// other_bits = {x, 0xDEADBEEF}; - /// @endcode - /// - template <typename T, typename TT = bufferTraits<T> > - class buffer_base - { - - public: - - /// Shortcut typedef to get to our traits class - typedef typename TT::bits_type bits_type; - /// Shortcut typedef to get to our traits class - typedef typename TT::unit_type unit_type; - - /// - /// @brief Default constructor - /// @note iv_data will get the "default" construction, which is - /// correct - 0 for integral types, an empty container for the others. - /// - buffer_base(void): - iv_data() - {} - -// @todo doesn't work for PPE -// virtual ~buffer_base(void) - ~buffer_base(void) - {} - -#ifndef DOXYGEN - /// @brief Print the contents of the buffer to stdout - inline void print(void) const - { TT::print(iv_data); } -#endif - /// - /// @brief Get the contents of the buffer - /// @return The contents of the buffer - /// - inline operator T() const { return iv_data; } - - /// - /// @brief Get the contents of the buffer - /// @return The contents of the buffer - /// - inline operator T&() { return iv_data; } - - /// - /// @brief Get the contents of the buffer - /// @return The contents of the buffer - /// - inline T& operator()(void) { return iv_data; } - - /// - /// @brief Get the contents of the buffer - /// @return Reference to the contents of the buffer - /// - inline const T& operator()(void) const { return iv_data; } - - /// - /// @brief Get a pointer to the buffer bits - /// @return Pointer to the buffer itself - /// - inline T* pointer(void) { return &iv_data; } - - /// @name Buffer Manipulation Functions - ///@{ - - /// - /// @brief Set an OT of data in buffer - /// @param[in] i_value sizeof(OT) bits of data - /// @param[in] i_offset Start OT (start word, for example) in buffer - /// - defaults to 0 (will by default write the left most element) - /// @return FAPI2_RC_SUCCESS on success, FAPI2_RC_OVERFLOW otherwise - /// @note This is is only available for integral types. To set a - /// variable_buffer into a variable_buffer, use insert() - /// - template< typename OT> - inline fapi2::ReturnCode set(OT i_value, const bits_type i_offset = 0) - { - // Compile time check to make sure OT isn't a variable buffer - static_assert( !std::is_same<bits_container, OT>::value, - "Can't use a variable_buffer as input to set()" ); - - // - // There's a gotcha in here. size<OT>() returns the size in the buffer - // in OT units *rounded up*. This is the actual size of the buffer, not - // the perceived size of a variable_buffer. This should be OK however, - // as what we're trying to prevent is overflow, which this should do. - // - const uint32_t length = TT:: template size<OT>(iv_data); - static const bits_type bits_in_value = parameterTraits<OT>::bit_length; - const bits_type bit_length = TT::bit_length(iv_data); - - if (i_offset >= length) - { - return FAPI2_RC_OVERFLOW; - } - - // Create mask if part of this byte is not in the valid part of the buffer, - // Shift it left by the amount of unused bits, - // Clear the unused bits - if (((i_offset + 1) == length) && (bit_length % bits_in_value)) { - i_value &= parameterTraits<OT>::mask << ((bits_in_value * length) - bit_length); - } - - parameterTraits<OT>::template write_element<unit_type>(TT::get_address(iv_data), i_value, i_offset); - return FAPI2_RC_SUCCESS; - } - - /// - /// @brief Set and entire buffer to X's - /// @tparam X {0,1} depending if you want to clear (0) - /// or fill (1) a buffer - /// - template< uint8_t X > - inline void flush(void) - { - static_assert( (X == 1) || (X == 0), "bad argument to flush" ); - (0 == X) ? TT::clear(iv_data) : TT::set(iv_data); - } - - /// - /// @brief Invert entire buffer - /// @return buffer_base&, Useful for method chaining - /// - inline buffer_base& invert(void) - { TT::invert(iv_data); return *this; } - - /// - /// @brief Bit reverse entire buffer - /// @return buffer_base&, Useful for method chaining - /// - inline buffer_base& reverse(void) - { TT::reverse(iv_data); return *this; } - - //@} - protected: - - /// - /// @brief Variable buffer constructor - /// @param[in] i_value number of *bits* (sizeof(container_units) * 8) - /// needed. Meaningless for integral types and thus protected. - /// - buffer_base(bits_type i_value); - - /// - /// @brief Variable buffer construct from a list - /// @param[in] i_value an initializer list to initialize the container. - /// Meaningless for integral types and thus protected - /// - buffer_base(std::initializer_list<unit_type> i_value); - - /// - /// @brief Clear the buffer - /// - inline void clear(void) - { TT::clear(iv_data); } - - /// The contents of the buffer - T iv_data; - }; - -// /// -// /// @brief Set and entire buffer to X's -// /// @tparam X {0,1} depending if you want to clear (0) -// /// or fill (1) a buffer -// /// -// template< typename T, typename TT = bufferTraits<T>, uint8_t X > -// inline buffer_base<T, TT>& flush(void) -// { -// static_assert( (X == 1) || (X == 0), "bad argument to flush" ); -// (0 == X) ? TT::clear(iv_data) : TT::set(iv_data); -// return *this; -// } - - - template <typename T, typename TT> - inline buffer_base<T, TT>::buffer_base(bits_type i_value): - iv_data( std::max(bits_type(1), - bits_type(i_value / 8 / sizeof(bits_type)))) - { - } - - template <typename T, typename TT> - inline buffer_base<T, TT>::buffer_base(std::initializer_list<unit_type> i_value): - iv_data(i_value) - { - } -}; - - - -#endif diff --git a/hwpf/plat/include/fapi2.H b/hwpf/plat/include/fapi2.H index dcf2607b..5e614e1b 100644 --- a/hwpf/plat/include/fapi2.H +++ b/hwpf/plat/include/fapi2.H @@ -1,12 +1,10 @@ -/** - * @file fapi2.H - * - * @brief Includes all the header files necessary for the FAPI2 interface. - */ +/// +/// @file fapi2.H +/// @brief top level header for fapi2 +/// - -#ifndef FAPI2_H_ -#define FAPI2_H_ +#ifndef __FAPI2_TOP_LEVEL__ +#define __FAPI2_TOP_LEVEL__ // Define which platforms will not have FAPI Return Codes #undef __noRC__ @@ -21,22 +19,32 @@ #endif #endif +#include <plat_trace.H> +#include <target.H> +#include <return_code.H> #include <buffer.H> -#include <buffer_base.H> -#include <buffer_parameters.H> -#include <buffer_traits.H> -#include <error_scope.H> #include <hw_access.H> -#include <return_code.H> -#include <target.H> -#include <target_types.H> #include <utils.H> -//#include <variable_buffer.H> + + +// In turn includes the needed generated headers (hwp_ffd_classes, etc.) +#include <error_scope.H> +#include <set_sbe_error.H> // Generated file #include <fapi2AttributeService.H> #include <fapi2AttributeIds.H> // Generated file -#endif // FAPI2_H_ +#include <hwp_executor.H> + +// Block of headers not currently in fapi2 +#ifdef FAPI2_MISSING_HEADERS + #include <mvpdAccess.H> + #include <mbvpdAccess.H> +#endif + + +#endif // __FAPI2_TOP_LEVEL__ + diff --git a/hwpf/plat/include/hw_access.H b/hwpf/plat/include/hw_access.H index 90b567d0..1d27535f 100644 --- a/hwpf/plat/include/hw_access.H +++ b/hwpf/plat/include/hw_access.H @@ -32,58 +32,18 @@ #ifndef FAPI2_HWACCESS_H_ #define FAPI2_HWACCESS_H_ -#ifdef FAPI_SUPPORT_SPY_AS_ENUM -#include <fapiSpyIds.H> -#endif -#include <stdint.h> -#include <thread> -#include <buffer.H> +// variable_buffer isn't supported on PPE +#ifndef __PPE__ #include <variable_buffer.H> -#include <return_code.H> -#include <target.H> -#include <utils.H> -#include <plat_includes.H> - -//#include <fapi2Util.H> -//#include <fapi2PlatTrace.H> - -#ifdef FAPI_SUPPORT_MULTI_SCOM -#include <fapiMultiScom.H> #endif -/// @cond -typedef uint64_t spyId_t; -typedef uint64_t scanRingId_t; -/// @endcond +#include <plat_hw_access.H> +#include <fapi2_hw_access.H> namespace fapi2 { - /// - /// @enum fapi2::ChipOpModifyMode - /// @brief Enumeration of modify modes used in HW access modify operations - /// - enum ChipOpModifyMode - { - CHIP_OP_MODIFY_MODE_OR = 1, ///< Modify or mode - CHIP_OP_MODIFY_MODE_AND = 2, ///< Modify and mode - CHIP_OP_MODIFY_MODE_XOR = 3, ///< Modify xor mode - }; - - /// - /// @enum fapi2::RingMode - /// @brief Enumeration of Ring access operation modes - /// This is a bitmap to allow the user to specify multiple modes. - /// - enum RingMode - { - RING_MODE_SET_PULSE = 0x00000001, ///< Set pulse - RING_MODE_NO_HEADER_CHECK = 0x00000002, ///< Dont' check header - // FUTURE_MODE = 0x00000004, - // FUTURE_MODE = 0x00000008, - }; - //-------------------------------------------------------------------------- // PIB Error Functions //-------------------------------------------------------------------------- @@ -99,6 +59,7 @@ namespace fapi2 /// @return uint8_t The current PIB error mask uint8_t getPIBErrorMask(void) { + uint8_t o_pib_mask; PLAT_GET_PIB_ERROR_MASK(o_pib_mask); return o_pib_mask; } @@ -107,25 +68,21 @@ namespace fapi2 // Operational Mode Error Functions //-------------------------------------------------------------------------- - /// @enum OpModes operational Mode Error Functions - enum OpModes - { - // These are bit-masks in case they need to be or'd together - NORMAL = 0x00, - IGNORE_HW_ERROR = 0x01, - DO_NOT_DO_WAKEUP = 0x02, - }; - /// @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 @@ -298,6 +255,8 @@ namespace fapi2 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. @@ -363,7 +322,7 @@ namespace fapi2 return FAPI2_RC_SUCCESS; } -#ifndef __PPE__ + /// @brief Read-modify-write a ring on a chip. /// @tparam K template parameter, passed in target. /// @param[in] i_target Target to operate on. @@ -384,17 +343,68 @@ namespace fapi2 return FAPI2_RC_SUCCESS; } #endif - /// @note - /// These spy access interfaces are only used in FSP and cronus - /// HB does not allow spy access -#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING) + +#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 fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. /// /// @note: The string version is only supported for cronus. /// @@ -422,65 +432,38 @@ namespace fapi2 /// /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS /// - /// fapi::ReturnCode rc = fapiGetSpy( targ, + /// 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 /// -#endif - -// Set to 1 for fapi2 API test -#define FAPI_SUPPORT_SPY_AS_ENUM 1 - #ifdef FAPI_SUPPORT_SPY_AS_ENUM - -#ifndef DOCUMENTATION -#define fapiGetSpy(TARGET, ID, DATA) \ - _fapiGetSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA ) -#endif - -#ifndef __PPE__ template< TargetType K > - inline ReturnCode _fapiGetSpy(const Target<K>& i_target, - const spyId_t i_spyId, - variable_buffer& o_data) + inline ReturnCode getSpy(const Target<K>& i_target, + const spyId_t i_spyId, + variable_buffer& o_data) { - o_data.setBit(1); - o_data.setBit(4); -#ifndef __PPE__ - std::cout << std::hex << " _fapiGetSpy " - << "target: {" << i_target.getType() << "," - << uint64_t(i_target) << "}; " - << "Spy ID: " << i_spyId << "; " - << "output data:"; - o_data.print(); -#endif - return FAPI2_RC_SUCCESS; + static_assert(K == 0, "implement getSpy (string)"); + return ~FAPI2_RC_SUCCESS; } #endif -#endif - #ifdef FAPI_SUPPORT_SPY_AS_STRING - -#ifndef DOCUMENTATION -#define fapiGetSpy(TARGET, ID, DATA) _fapiGetSpy(TARGET, #ID, DATA) -#endif -#ifndef __PPE__ template< TargetType K > - inline ReturnCode _fapiGetSpy(const Target<K>& i_target, - const char * const i_spyId, - variable_buffer& o_data); -#endif + 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 - -#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING) /// @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 fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. /// /// @note: The string version is only supported for cronus. /// @@ -508,50 +491,32 @@ namespace fapi2 /// /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS /// - /// fapi::ReturnCode rc = fapiPutSpy( targ, + /// 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 /// -#endif - #ifdef FAPI_SUPPORT_SPY_AS_ENUM -#ifndef DOCUMENTATION -#define fapiPutSpy(TARGET, ID, DATA) \ - _fapiPutSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA) -#endif - template< TargetType K > - inline ReturnCode _fapiPutSpy(const Target<K>& i_target, - const spyId_t i_spyId, - variable_buffer& i_data) + inline ReturnCode putSpy(const Target<K>& i_target, + const spyId_t i_spyId, + variable_buffer& i_data) { -#ifndef __PPE__ - std::cout << std::hex << " _fapiPutSpy " - << "target: {" << i_target.getType() << "," - << uint64_t(i_target) << "}; " - << "Spy Id: " << i_spyId << "; " - << "input data:"; - i_data.print(); -#endif - return FAPI2_RC_SUCCESS; + static_assert(K == 0, "implement putSpy (enum)"); + return ~FAPI2_RC_SUCCESS; } - #endif - #ifdef FAPI_SUPPORT_SPY_AS_STRING -#ifndef DOCUMENTATION -#define fapiPutSpy(TARGET, ID, DATA) _fapiPutSpy(TARGET, #ID, DATA) -#endif template< TargetType K > - inline ReturnCode _fapiPutSpy(const Target<K>& i_target, - const spyId_t i_spyId, - variable_buffer& i_data) + 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 - -#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING) - /// @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. @@ -561,7 +526,7 @@ namespace fapi2 /// @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 fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. /// /// @note: The string version is only supported for cronus. /// @@ -572,59 +537,35 @@ namespace fapi2 /// /// See fapiPutSpy for details on spy id specifics. /// -#endif - #ifdef FAPI_SUPPORT_SPY_AS_ENUM -#ifndef DOCUMENTATION -#define fapiPutSpyImage(TARGET, ID, DATA1, DATA2) \ - _fapiPutSpyImage(TARGET, \ - FAPI_SPY_NAMES::ID.value, \ - DATA1, DATA2) -#endif template< TargetType K > - inline ReturnCode _fapiPutSpyImage(const Target<K>& i_target, - const spyId_t i_spyId, - variable_buffer& i_data, - variable_buffer& o_imageData) + inline ReturnCode putSpyImage(const Target<K>& i_target, + const spyId_t i_spyId, + const variable_buffer& i_data, + variable_buffer& o_imageData) { -#ifndef __PPE__ - std::cout << std::hex << " _fapiPutSpyImage " - << "target: {" << i_target.getType() << "," - << uint64_t(i_target) << "}; " - << "Spy Id: " << i_spyId << "; " - << "input data: "; - i_data.print(); -#endif - // Set fake output data - o_imageData.invert(); - - return FAPI2_RC_SUCCESS; + static_assert(K == 0, "implement putSpyImage (enum)"); + return ~FAPI2_RC_SUCCESS; } #endif - #ifdef FAPI_SUPPORT_SPY_AS_STRING -// fapiPutSpyImage function Cronus version -#ifndef DOCUMENTATION -#define fapiPutSpyImage(TARGET, ID, DATA1, DATA2) \ - _fapiPutSpyImage(TARGET, #ID, \ - DATA1,DATA2) -#endif - template< TargetType K > - inline ReturnCode _fapiPutSpyImage(const Target<K>& i_target, - const char* const i_spyId, - variable_buffer& i_data, - variable_buffer& o_imageData); + 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 - -#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING) /// @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 fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. + /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. /// /// @note: The string version is only supported for cronus. /// @@ -635,82 +576,31 @@ namespace fapi2 /// /// See fapiPutSpy for details on spy id specifics. /// -#endif - #ifdef FAPI_SUPPORT_SPY_AS_ENUM -#ifndef DOCUMENTATION -#define fapiGetSpyImage(TARGET, ID, DATA1, DATA2) \ - _fapiGetSpyImage(TARGET, \ - FAPI_SPY_NAMES::ID.value, \ - DATA1, DATA2) -#endif template< TargetType K > - inline ReturnCode _fapiGetSpyImage(const Target<K>& i_target, - const spyId_t i_spyId, - variable_buffer& o_data, - const variable_buffer& i_imageData); + 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 -// fapiGetSpyImage function Cronus version -#ifndef DOCUMENTATION -#define fapiGetSpyImage(TARGET, ID, DATA1, DATA2) \ - _fapiGetSpyImage(TARGET, \ - #ID, DATA1,DATA2) -#endif - - inline fapi::ReturnCode _fapiGetSpyImage( - const fapi::Target& i_target, - const char* const i_spyId, - fapi::buffer<fapi::bits_container> & o_data, - const fapi::buffer<fapi::bits_container> & i_imageData); + 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 -#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 fapi::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. - /// - inline fapi::ReturnCode fapiMultiScom (const Target<K>& i_target, - MultiScom& io_multiScomObj); -#endif // FAPI_SUPPORT_MULTI_SCOM +#endif // PPE }; -#endif // FAPI2HWACCESS_H_ +#endif // _FAPI2_HWACCESS_H_ diff --git a/hwpf/plat/include/hwp_executor.H b/hwpf/plat/include/hwp_executor.H new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/hwpf/plat/include/hwp_executor.H diff --git a/hwpf/plat/include/hwp_ffdc_classes.H b/hwpf/plat/include/hwp_ffdc_classes.H new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/hwpf/plat/include/hwp_ffdc_classes.H diff --git a/hwpf/plat/include/plat_target.H b/hwpf/plat/include/plat_target.H new file mode 100644 index 00000000..86c70465 --- /dev/null +++ b/hwpf/plat/include/plat_target.H @@ -0,0 +1,43 @@ +/* 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.H + * @brief platform definitions for fapi2 targets + */ + +#ifndef __FAPI2_PLAT_TARGET__ +#define __FAPI2_PLAT_TARGET__ + +// +// 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/plat/include/plat_trace.H b/hwpf/plat/include/plat_trace.H new file mode 100644 index 00000000..9104e767 --- /dev/null +++ b/hwpf/plat/include/plat_trace.H @@ -0,0 +1,70 @@ +/* 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> + +// 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_...) \ + printf("%s: %s:%d ", _id_, __func__, __LINE__); \ + printf(_fmt_, ##_args_); \ + printf("\n") + +#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/plat/include/set_sbe_error.H b/hwpf/plat/include/set_sbe_error.H new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/hwpf/plat/include/set_sbe_error.H diff --git a/hwpf/plat/include/target.H b/hwpf/plat/include/target.H index 1610069d..0d7832b5 100644 --- a/hwpf/plat/include/target.H +++ b/hwpf/plat/include/target.H @@ -43,6 +43,27 @@ #define EX_ADDRESS_MASK 0x0000FF00 +#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) + namespace fapi2 { diff --git a/hwpf/plat/src/fapi2ppefiles.mk b/hwpf/plat/src/fapi2ppefiles.mk index cc391157..968abb56 100644 --- a/hwpf/plat/src/fapi2ppefiles.mk +++ b/hwpf/plat/src/fapi2ppefiles.mk @@ -17,7 +17,10 @@ # Object Files ########################################################################## -FAPI2-C-SOURCES = fapi2PlatAttributeService.C + +FAPI2-C-SOURCES += fapi2PlatAttributeService.C \ + plat_utils.C + FAPI2-S-SOURCES = FAPI2LIB_OBJECTS += $(FAPI2-C-SOURCES:.C=.o) $(FAPI2-S-SOURCES:.S=.o) |