#ifndef ERRLMANAGER_H #define ERRLMANAGER_H /** * @file errlmanager.H * * @brief Error Log management for Host Boot environment. * */ /*****************************************************************************/ // I n c l u d e s /*****************************************************************************/ #include #include #include #include #include #include #include namespace ERRORLOG { /** * @brief Global function to log an error * Writes the log to PNOR where committed logs are kept. * If there's not enough room, remove the latest log(s) to make * enough room to commit this log. * The error log will be automatically deleted after the * commit. The input handle will be set to NULL. * For Host Boot environment, there's no individual committer * (i.e. committer = Host Boot), so no component ID of * committer is specified. * This function is global in order to workaround the singleton * linker issue in HostBoot (linker can't find singleton outside of * a module). * * @param[in,out] io_err Error log handle to be committed * * @return None */ void errlCommit(errlHndl_t& io_err); /*****************************************************************************/ // Forward class declarations /*****************************************************************************/ class ErrlEntry; class ErrlManager; // Singleton - Use "theErrlManager::instance()" to access the singleton typedef Singleton theErrlManager; /** * @brief Error log manager * This class provides interfaces to perform some specific tasks * on existing error objects such as committing a log, sending the * log to the SP, etc.. */ class ErrlManager { public: /** * @brief Commit an error log by sending it to the repository * Writes the log to PNOR where committed logs are kept. * If there's not enough room, remove the latest log(s) to make * enough room to commit this log. * The error log will be automatically deleted after the * commit. The input handle will be set to NULL. * For Host Boot environment, there's no individual committer * (i.e. committer = Host Boot), so no component ID of * committer is specified. * * @param[in,out] io_err Error log handle to be committed * * @return None */ void commitErrLog(errlHndl_t& io_err); /** * @brief Returns a unique error log ID * * This routine generates a unique Error ID and assign it to * the input error log. Mutates iv_currLogId. * * @return Unique generated error log ID */ uint32_t getUniqueErrId(); protected: /** * @brief Destructor * * Releases all resources owned by the handle. If the log has not * been committed, it effectively aborts the log. * All logs (committed or not) must be deleted to avoid a resource leak. * * @return None * */ ~ErrlManager(); /** * @brief Default constructor * Protected so only SingletonHolder can call */ ErrlManager(); private: /** * @brief Disabled copy constructor and assignment operator */ ErrlManager(const ErrlManager& i_right); ErrlManager& operator=(const ErrlManager& i_right); /** * @brief * Current log ID: increment this when assigning log ID to a new errlog * as it is being committed. */ uint32_t iv_currLogId; /** * @brief * Pointer to the header that preceeds the error log storage buffer * in L3 RAM. This may go away when we adopt PNOR, or else become * instance variables instead of a pointer pointing within the * storage buffer. */ storage_header_t * iv_pStorage; /** * @brief Serialization for error log commits. */ mutex_t iv_mutex; }; } // End namespace #endif //ERRLMANAGER_H