diff options
author | Brian Horton <brianh@linux.ibm.com> | 2012-12-10 17:35:07 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-01-02 16:44:16 -0600 |
commit | d6dd563c5b0ed676757d6ab4dc916df073f44564 (patch) | |
tree | 79a72937f5c382c682940ff58a0e870faeae1d5f /src/include | |
parent | 48d9ff25aa0886aaba13b3fde521aaeb87f2eea6 (diff) | |
download | blackbird-hostboot-d6dd563c5b0ed676757d6ab4dc916df073f44564.tar.gz blackbird-hostboot-d6dd563c5b0ed676757d6ab4dc916df073f44564.zip |
deconfigGard - enable reading GARD records from PNOR
update common and platform interface so that both hostboot
and FSP can access GARD records in PNOR.
Change-Id: I1eb36238076bcbb421cf1d149538eba1c7faeda6
RTC: 33551
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2628
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/usr/hwas/common/deconfigGard.H | 80 | ||||
-rw-r--r-- | src/include/usr/hwas/hwasPlatDeconfigGard.H | 34 | ||||
-rw-r--r-- | src/include/usr/hwas/hwasPlatThread.H | 10 |
3 files changed, 75 insertions, 49 deletions
diff --git a/src/include/usr/hwas/common/deconfigGard.H b/src/include/usr/hwas/common/deconfigGard.H index 77c2f21bd..01493ecb9 100644 --- a/src/include/usr/hwas/common/deconfigGard.H +++ b/src/include/usr/hwas/common/deconfigGard.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* COPYRIGHT International Business Machines Corp. 2011,2013 */ /* */ /* p1 */ /* */ @@ -66,6 +66,10 @@ DeconfigGard & theDeconfigGard(); */ class DeconfigGard { + + // allow GardAddress to access private methods. + friend class GardAddress; + public: /** @@ -80,6 +84,12 @@ public: DECONFIG_CAUSE_DECONFIG_BY_ASSOC = 3, // Deconfigure by Association }; + enum + { + CLEAR_ALL_GARD_RECORDS = EMPTY_GARD_RECORDID, + GET_ALL_GARD_RECORDS = EMPTY_GARD_RECORDID, + }; + /** * @struct GardRecord * @@ -222,8 +232,8 @@ public: * only errors returned are usage errors and errors accessing the GARD * Records. * - * @param[in] i_recordId RecordId to clear. If zero then all GARD Records - * are cleared. + * @param[in] i_recordId RecordId to clear. If zero (CLEAR_ALL_GARD_RECORDS) + * then all GARD Records cleared. * * @return errlHndl_t. Error log handle. */ @@ -380,8 +390,8 @@ private: /** * @brief Clears the specified GARD Records. * - * @param[in] i_recordId RecordId to clear. If zero then all GARD Records - * are cleared. + * @param[in] i_recordId RecordId to clear. If zero (CLEAR_ALL_GARD_RECORDS) + * then all GARD Records cleared. * * @return errlHndl_t. Error log handle. */ @@ -423,15 +433,15 @@ private: GardRecords_t & o_records); /** - * @brief Ensures that the GARD Record data is setup + * @brief sets the maxGardRecords and nextGardRecordId variables * - * @return errlHndl_t. Error log handle. + * @param[in] i_size size of GARD area in PNOR/memory */ - errlHndl_t _ensureGardRecordDataSetup(); - + void _GardRecordIdSetup(uint32_t i_size); + // Mutex for thread safety HWAS_MUTEX_TYPE iv_mutex; - + // GARD Record Data uint32_t iv_nextGardRecordId; // Next GARD Record ID to use uint32_t iv_maxGardRecords; // Maximum number of GARD Records @@ -439,9 +449,57 @@ private: // The Deconfigure Records DeconfigureRecords_t iv_deconfigureRecords; -}; + +}; // DeconfigGard HWAS_DECLARE_SINGLETON(HWAS::DeconfigGard,theDeconfigGardSingleton); + +// The HWAS Common code needs to allow for the fact that the platforms +// may need to know when the DeconfigGard functions are done using the +// PNOR area for GARD record access. To this end, GardAddress is an +// object that the common code will create when it needs to use the +// address to the GARD records data (iv_pGardRecords). When this object +// goes out of scope, the destructor will get called, and the platform +// code will know that access to the PNOR area is complete. +class GardAddress +{ +public: + + /** + * @brief Constructor. + * PLATFORM must implement this function + * + * @param[in] o_gardEnabled boolean returned: + * true - reading/writing of gard records is enabled; + * false - not enabled + */ + GardAddress(bool &o_gardEnabled); + + /** + * @brief Destructor. + * PLATFORM must implement this function + */ + ~GardAddress(); + + /** + * @brief writeRecord. Add the indicated address to a vector, so + * that the destructor knows which GARD records were updated. + * + * @param[in] i_addr address of GARD record that was updated. + */ + void writeRecord(void *i_addr) + { + if (i_addr !=NULL) + { + iv_addr.push_back(i_addr); + } + } + +protected: + + std::vector<void *>iv_addr; + +}; // GardAddress } #endif diff --git a/src/include/usr/hwas/hwasPlatDeconfigGard.H b/src/include/usr/hwas/hwasPlatDeconfigGard.H index 3cddf8dd5..2f229c164 100644 --- a/src/include/usr/hwas/hwasPlatDeconfigGard.H +++ b/src/include/usr/hwas/hwasPlatDeconfigGard.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012 */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ /* */ /* p1 */ /* */ @@ -30,38 +30,6 @@ #ifndef HWASPLATDECONFIGGARD_H_ #define HWASPLATDECONFIGGARD_H_ -#include <sys/mm.h> -#include <trace/interface.H> -#include <errl/errlentry.H> -#include <hwas/hwasPlatError.H> - -//****************************************************************************** -// Trace descriptors that are defined in a C file -//****************************************************************************** -namespace HWAS -{ - -#if 0 -//TODO: RTC 37739: flush PNOR -// questions -- what address and what size do it need to use? the section -// starting address and section size? or the address and size of the -// gard record that is being flushed? - -/** - * @brief function to push GARD records 'out' to PNOR - */ -inline void pushGardRecords(void *i_pAddr, uint64_t i_size) -{ - int l_rc = mm_remove_pages(FLUSH, i_pAddr, i_size); - if (l_rc ) - { // mm_remove_pages returns none zero for error - HWAS_ERR("Fail to flush the page"); - } -} -#endif - -} - /** * @brief Adapt common singleton declaration to specific platform * diff --git a/src/include/usr/hwas/hwasPlatThread.H b/src/include/usr/hwas/hwasPlatThread.H index b68b9e1a3..ff3a75de2 100644 --- a/src/include/usr/hwas/hwasPlatThread.H +++ b/src/include/usr/hwas/hwasPlatThread.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012 */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ /* */ /* p1 */ /* */ @@ -37,15 +37,15 @@ mutable mutex_t #define HWAS_MUTEX_INIT(_t) \ - mutex_init(_t) + mutex_init(&(_t)) #define HWAS_MUTEX_DESTROY(_t) \ - mutex_destroy(_t) + mutex_destroy(&(_t)) #define HWAS_MUTEX_LOCK(_t) \ - mutex_lock(_t) + mutex_lock(&(_t)) #define HWAS_MUTEX_UNLOCK(_t) \ - mutex_unlock(_t) + mutex_unlock(&(_t)) #endif // __HWAS_PLAT_THREAD_H |