From 8a09d58df7aa0dedfbd6a3cfbac3b93f5f29e01c Mon Sep 17 00:00:00 2001 From: Joachim Fenkes Date: Wed, 28 Nov 2018 10:25:41 +0100 Subject: FAPI2: Multicast API 2/2: Introduce the actual multicast functions Chip targets gain a getMulticast() method to generate MC sub-targets. The meaning of getParent()/getChildren() is updated to reflect MC specialties. Add an API call to update the multicast group mapping table per chip. For details, please see hwpf/fapi2/docs/topics/multicast_doc.C Change-Id: I4cea561fd14324b1accedf4ffaae9943159caf71 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69457 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Tested-by: HWSV CI Reviewed-by: Daniel M. Crowell Reviewed-by: Matt K. Light Tested-by: Hostboot CI Tested-by: PPE CI Reviewed-by: Jennifer A. Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70945 Reviewed-by: RAJA DAS --- src/import/hwpf/fapi2/include/error_info.H | 14 +++--- src/import/hwpf/fapi2/include/fapi2_hw_access.H | 20 +++++++++ src/import/hwpf/fapi2/include/fapi2_target.H | 59 ++++++++++++++++++++++--- src/import/hwpf/fapi2/include/multicast_defs.H | 45 ++++++++++++++++++- src/import/hwpf/fapi2/include/target_types.H | 7 +++ 5 files changed, 131 insertions(+), 14 deletions(-) (limited to 'src/import/hwpf') diff --git a/src/import/hwpf/fapi2/include/error_info.H b/src/import/hwpf/fapi2/include/error_info.H index 7659e29b..e3640f5e 100644 --- a/src/import/hwpf/fapi2/include/error_info.H +++ b/src/import/hwpf/fapi2/include/error_info.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -53,14 +53,16 @@ inline uint64_t convertType( T& i_value ) }; // convert platform target handle to a uint64_t -template -inline uint64_t convertType( const fapi2::Target& i_value) +template +inline uint64_t convertType( const fapi2::Target& i_value) { // send the target type and instance as ffdc they will be used // to instantiate a target before logging the ffdc data - return static_cast((static_cast( - (i_value.get().getFapiTargetType())) << 32) | - i_value.get().getTargetInstance()); + return static_cast( + (static_cast( + (i_value.get().getFapiTargetType() | + (i_value.get().fields.is_multicast << 31)) + ) << 32) | i_value.get().getTargetInstance()); }; #endif diff --git a/src/import/hwpf/fapi2/include/fapi2_hw_access.H b/src/import/hwpf/fapi2/include/fapi2_hw_access.H index 9cb5b983..f824d30b 100644 --- a/src/import/hwpf/fapi2/include/fapi2_hw_access.H +++ b/src/import/hwpf/fapi2/include/fapi2_hw_access.H @@ -75,6 +75,26 @@ inline void setOpMode(const OpModes i_mode); /// @return the operational mode inline OpModes getOpMode(void); +//-------------------------------------------------------------------------- +// Multicast mapping functions +//-------------------------------------------------------------------------- + +/// @brief Set up or replace the multicast group mapping for a given chip +/// @param[in] i_chip The chip whose multicast map is to be replaced +/// @param[in] i_mappings A list of multicast group mappings +/// @return FAPI2_RC_SUCCESS if the map was updated, otherwise error code. +/// +/// This replaces the given chip's map of abstract multicast groups to chip +/// specific hardware values with a new map. Any abstract group not explicitly +/// mapped via i_mappings will be unmapped after this call returns success, +/// and attempting to create multicast targets targeting unmapped groups will +/// result in error. +/// i_mappings may contain an arbitrary amount of abstract/HW pairs, but the +/// function may return an error if too many mappings are specified. +template< MulticastType M, typename V > +inline ReturnCode setMulticastGroupMap(const Target& i_chip, + const std::vector< MulticastGroupMapping >& i_mappings); + //-------------------------------------------------------------------------- // HW Communication Functions //-------------------------------------------------------------------------- diff --git a/src/import/hwpf/fapi2/include/fapi2_target.H b/src/import/hwpf/fapi2/include/fapi2_target.H index 4d9f6963..8dd1cc13 100644 --- a/src/import/hwpf/fapi2/include/fapi2_target.H +++ b/src/import/hwpf/fapi2/include/fapi2_target.H @@ -139,8 +139,16 @@ class Target iv_handle(Value) { plat_apply_target_limits(); - }; + /* Iff this is a potential mcast target, update the handle. + * We can't know the mcast op of the V handed in, so we have + * to incur the cost of the update even if unnecessary. + */ + if (K & TARGET_TYPE_MULTICAST) + { + mcUpdateHandle(); + } + }; /// /// @brief Assignment Operator. @@ -308,6 +316,36 @@ class Target getChildren(const TargetFilter i_filter, const TargetState i_state = TARGET_STATE_FUNCTIONAL) const; + /// + /// @brief Get a multicast target for a given chip + /// @tparam T The type of target to return; TARGET_TYPE_MULTICAST is added automatically + /// @tparam O The type of multicast read operation for the target; defaults to OR + /// @param[in] i_group The abstract multicast group the target should point to + /// @return The multicast target + /// + /// This method is only applicable to chip-level targets. + /// If the requested multicast group cannot be mapped to an available HW multicast + /// group, a platform specific error will be thrown. + /// + template< TargetType T, MulticastType O = MULTICAST_OR > + inline Target < T | TARGET_TYPE_MULTICAST, O, V > + getMulticast(const MulticastGroup i_group) const; + + /// + /// @brief Get a multicast core target for a given chip + /// @tparam O The type of multicast read operation for the target; defaults to OR + /// @param[in] i_group The abstract multicast group (selecting EQs) the target should point to + /// @param[in] i_cores Which cores inside the selected EQ should be targeted + /// @return The multicast target + /// + /// This method is only applicable to chip-level targets. + /// If the requested multicast group cannot be mapped to an available HW multicast + /// group, a platform specific error will be thrown. + /// + template< MulticastType O = MULTICAST_OR > + inline Target < TARGET_TYPE_CORE | TARGET_TYPE_MULTICAST, O, V > + getMulticast(const MulticastGroup i_group, const MulticastCoreSelect i_cores) const; + /// /// @brief Get the target at the other end of a bus /// @tparam T The type of the target on the other end @@ -326,7 +364,6 @@ class Target /// @brief Is the target functional? /// @return true if target is functional, false if non-functional /// - inline bool isFunctional(void) const; @@ -335,18 +372,20 @@ class Target /// @return The chiplet number for the Target. 0 is returned if the /// Target does not have a chiplet number (for ex, the PROC_CHIP Target) /// @note For logical targets such as the EX, the chiplet number of - /// their immediate parent chiplet is returned + /// their immediate parent chiplet is returned. For multicast targets + /// getChipletNumber() is not supported. /// inline uint8_t getChipletNumber(void) const; /// - /// @brief Copy from a Target to a Target + /// @brief Copy from a Target to a Target /// @tparam O the target type of the other + /// @tparam MO the multicast type of the other /// - template - inline Target( const Target& Other ): - Target(Other.get()) + template + inline Target( const Target& Other ): + iv_handle(Other.get()) { plat_apply_target_limits(); @@ -356,6 +395,12 @@ class Target static_assert( bitCount::count >= bitCount::count, "unable to cast to specialized Target"); + + // Only need to update the handle if we're coming from a target that's already MULTICAST + if ((O & TARGET_TYPE_MULTICAST) && (MO != M)) + { + mcUpdateHandle(); + } } private: diff --git a/src/import/hwpf/fapi2/include/multicast_defs.H b/src/import/hwpf/fapi2/include/multicast_defs.H index 943625d7..dbed31f4 100644 --- a/src/import/hwpf/fapi2/include/multicast_defs.H +++ b/src/import/hwpf/fapi2/include/multicast_defs.H @@ -36,7 +36,50 @@ enum MulticastType MULTICAST_COMPARE = 4, }; -typedef uint32_t MulticastGroup; +/** + * @brief Abstract multicast group definitions + * + * These are abstract multicast groups that a procedure may want to talk to. + * They are being mapped to hardware MC group IDs by the platform layer. + * Due to the limited amount of hardware MC groups, the availability of + * certain abstract groups will be dependent on system state, for example + * the currently executing istep. + * + * The actual multicast group enumerations will be defined in a project specific header. + */ +enum MulticastGroup : uint32_t; + + /** + * @brief Single FAPI->HW multicast group mapping + * + * This is used to provide a mapping of an abstract MulticastGroup to a hardware dependent + * value. The calling HWP and platform layer must have the same understanding of the HW + * value (e.g. PCB multicast group ID), FAPI2 is only the conduit and imposes no restriction + * on hwValue. + */ + struct MulticastGroupMapping +{ + MulticastGroup abstractGroup; + uint32_t hwValue; +}; + +/** + * @brief Bit mask for selecting cores out of an EQ. + */ +enum MulticastCoreSelect +{ + MCCORE_0 = 0x8, + MCCORE_1 = 0x4, + MCCORE_2 = 0x2, + MCCORE_3 = 0x1, + MCCORE_ALL = 0xF, +}; + +inline MulticastCoreSelect operator|(const MulticastCoreSelect a, const MulticastCoreSelect b) +{ + return static_cast(a | b); +} + } #endif diff --git a/src/import/hwpf/fapi2/include/target_types.H b/src/import/hwpf/fapi2/include/target_types.H index e5198006..852d7846 100644 --- a/src/import/hwpf/fapi2/include/target_types.H +++ b/src/import/hwpf/fapi2/include/target_types.H @@ -123,6 +123,13 @@ enum TargetType : uint64_t TARGET_TYPE_IOHS | TARGET_TYPE_FC, + TARGET_TYPE_MULTICASTABLE = TARGET_TYPE_CORE | + TARGET_TYPE_EQ | + TARGET_TYPE_MCBIST | + TARGET_TYPE_OBUS | + TARGET_TYPE_PERV | + TARGET_TYPE_PEC, + // Mappings to target types found in the error xml files TARGET_TYPE_EX_CHIPLET = TARGET_TYPE_EX, TARGET_TYPE_MBA_CHIPLET = TARGET_TYPE_MBA, -- cgit v1.2.1