diff options
author | Stephen Cprek <smcprek@us.ibm.com> | 2018-01-12 17:29:06 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-01-17 11:45:08 -0500 |
commit | 329b81443b43d3fd0ea2218e72f5c0139e47d184 (patch) | |
tree | 758550e56b2ef619ec0e572bcbf15d532d5e921e /src/usr/sbeio/sbe_memRegionMgr.H | |
parent | d1c569251281f56eadd25f1c81d82da1b3c242d9 (diff) | |
download | talos-hostboot-329b81443b43d3fd0ea2218e72f5c0139e47d184.tar.gz talos-hostboot-329b81443b43d3fd0ea2218e72f5c0139e47d184.zip |
Make the MemRegionMgr class target aware
Creates a map of target,region map lists to allow the opening of
the same regions against different targets
Change-Id: Ieb2235765da99b25c018a5e9546ac2f8ca252a39
CQ:SW412793
Backport:release-fips910
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/51923
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/sbeio/sbe_memRegionMgr.H')
-rw-r--r-- | src/usr/sbeio/sbe_memRegionMgr.H | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/src/usr/sbeio/sbe_memRegionMgr.H b/src/usr/sbeio/sbe_memRegionMgr.H index 0fc9f27bf..c886c28c6 100644 --- a/src/usr/sbeio/sbe_memRegionMgr.H +++ b/src/usr/sbeio/sbe_memRegionMgr.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017 */ +/* Contributors Listed Below - COPYRIGHT 2017,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -27,8 +27,10 @@ #include <stdint.h> #include <errl/errlentry.H> -#include <vector> +#include <list> #include <sbeio/sbeioif.H> +#include <targeting/common/target.H> +#include <map> namespace SBEIO { @@ -52,11 +54,15 @@ struct regionData // Target associated with the SBE // - If tgt == nullptr it will eventually be updated to the Master Proc - TARGETING::Target* tgt; + TARGETING::TargetHandle_t tgt; regionData() : start_addr(0), size(0), flags(0), tgt(nullptr) {} }; +typedef std::list<regionData> RegionDataList; +typedef std::pair<TARGETING::TargetHandle_t, RegionDataList> MemRegionMapPair; +typedef std::map<TARGETING::TargetHandle_t, RegionDataList> MemRegionMap; + /** @class MemRegionMgr * @brief Responsible for managing the SBE Unsecure Memory Regions * @@ -66,12 +72,17 @@ class MemRegionMgr private: - /** Cache of Unsecure Memory Regions that are currently open */ - std::list< regionData > iv_memRegions; + /** Cache of Unsecure Memory Regions that are currently open + * Key = Target Pointer, Value = List of Memory Regions + */ + MemRegionMap iv_memRegionMap; - /* For Debug purposes: Pring Out Vector of iv_memRegions */ + /* For Debug purposes: Print out memory region map */ void printIvMemRegions() const; + /* Cache master proc */ + TARGETING::TargetHandle_t iv_masterProc; + /** * @brief Local Function To Open/Close Unsecure Memory Regions * @@ -94,6 +105,35 @@ class MemRegionMgr */ errlHndl_t checkNumberOfMemRegions(uint8_t i_count) const; + /** + * @brief Append region data to region list of specified target + * + * @param[in] i_target Proc target to apply region data to + * Note: nullptr assumed to be acting master proc + * @param[in] i_region Region data + * + * @return N/A + */ + void addToTargetRegionList(TARGETING::TargetHandle_t i_target, + const regionData& i_region); + + /** + * @brief Get region data list of specified target + * + * @param[in] i_target Proc target to obtain region data list from + * Note: nullptr assumed to be acting master proc + * + * @return N/A + */ + RegionDataList* getTargetRegionList(TARGETING::TargetHandle_t i_target); + + /** + * @brief Get number of all memory regions amongst all targets + * + * @return N/A + */ + uint8_t getTotalNumOfRegions() const; + public: /** * @brief Constructor. Initializes instance variables. |