diff options
author | Donald Washburn <dwashbur@us.ibm.com> | 2017-08-17 10:28:05 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-11-01 17:06:39 -0400 |
commit | 5e731ccc76d458e752e465471e27a40dd6011e5b (patch) | |
tree | 33792894597adf1c3073d3ed522bc6ab253ea4d1 /src/usr/scom/DmiScomWorkaround.H | |
parent | 89c19d7e3a5b6f2781636ca5373672f38d8f0a13 (diff) | |
download | talos-hostboot-5e731ccc76d458e752e465471e27a40dd6011e5b.tar.gz talos-hostboot-5e731ccc76d458e752e465471e27a40dd6011e5b.zip |
Work around for SCOM DMI bug on Cumulus.
Work-around for HW415185. On a cumulus system reads from
the first 6 DMI SCOM registers need to be read twice to
obtain correct values. It is desired to implement a
workaround in the SCOM driver that will force a retry
for any reads from these registers until a hardware
fix is in place.
*Implemented a framework for executing post operation
actions following a scom device operation. Currently
the only post operation action defined is the retry
request operation. The purpose of the framework is
to remove workaround logic from the device operation
code and place it in easily removable individual source
files as work-arounds are expected to be temporary in
nature.
*Move existing retry request for IBSCOM retries to
a new class IbScomRetry.
*Created the PostOpRetryCheck base class for the
workaround framework.
*Created a top-level composite pattern class used for
invoking request logic - PostOpChecks.
*Created a workaround class - DmiSomWorkaround
for querying DMI retry requests.
*Modified the doScomOp method to invoke the framework
to test for retries. Removed retry recursion.
*Created Unit Tests.
*Created integration test.
RTC: 177025
Change-Id: If4a1ecc57dd5978e5d1717a42c63cdc1698f4563
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/45104
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: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/scom/DmiScomWorkaround.H')
-rw-r--r-- | src/usr/scom/DmiScomWorkaround.H | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/src/usr/scom/DmiScomWorkaround.H b/src/usr/scom/DmiScomWorkaround.H new file mode 100644 index 000000000..7c7428985 --- /dev/null +++ b/src/usr/scom/DmiScomWorkaround.H @@ -0,0 +1,152 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/scom/DmiScomWorkaround.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] 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 */ +#ifndef __SCOM_DMI_SCOM_WORKAROUND_H +#define __SCOM_DMI_SCOM_WORKAROUND_H + +#include "postopchecks.H" +#include <targeting/common/target.H> + +#include <memory> + +namespace SCOM +{ + +/** + * @brief Workaround for SCOM Bug. The workaround + * requires a retry of read operations for certain sets + * of DMI SCOM registers. + */ +class DmiScomWorkaround: public PostOpRetryCheck +{ + +public: + //only one instance is allowed. + DmiScomWorkaround(const DmiScomWorkaround&)=delete; + DmiScomWorkaround(DmiScomWorkaround&&)=delete; + DmiScomWorkaround& operator=(const DmiScomWorkaround&)=delete; + DmiScomWorkaround& operator=(DmiScomWorkaround&&)=delete; + + virtual ~DmiScomWorkaround() = default; + + /** + * @brief Determine if a retry is needed given a device + * operation and previous results. + * + * @param[in] i_errl. The error associated with the previous + * scom operation. Not Used for this workaround. + * @param[in] i_retryCount. How many retries were made prior + * to this call. This workaround will only + * support 1 retry. + * @param[in] i_opType. The scom operation being attempted. + * This workaround is only applicable + * for read operations. + * @param[in] i_target. The target of the scom operation. + * The workaround is valid only for + * PROC and DMI targets. + * @param[in] i_buffer. The buffer for the scom operation. + * Not used for this workaround. + * @param[in] i_buflen. The length of the buffer for the scom + * operation. Not used for this workaround. + * @param[in] i_accessType. The access type for the scom operation. + * Not used for this workaround. + * @param[in] i_addr. The address for the scom operation. The address + * is used to determine if we need to retry a SCOM + * read. + * + * @return True if a retry should be attempted, False otherwise. + */ + bool requestRetry(errlHndl_t i_errl, + uint32_t i_retryCount, + DeviceFW::OperationType i_opType, + TARGETING::Target* i_target, + void* i_buffer, + size_t i_buflen, + int64_t i_accessType, + uint64_t i_addr + ) const override; + + /** + * @brief Access the single instance of this class. + */ + static std::shared_ptr<const PostOpRetryCheck> theInstance(); + +protected: + DmiScomWorkaround()=default; + + //Unit Test Method Injection Seams. + + /** + * @brief Obtain the type of the passed in target. + * + * @param[in] i_target. The target whose type we are trying to determine. + * @param[out] o_type. The type of i_target. + * + * @return True if successful, False otherwise. + */ + virtual bool getTargetType(TARGETING::Target* i_target, + TARGETING::TYPE& o_type) const; + + /** + * @brief Obtain the processor model if the passed in target is a + * PROC target. + * + * @param[in] i_target. The target from which we would like to determine + * the processor model. + * @param[out] o_model. The processor model if successful. + * + * @return True if successful, False otherwise. + */ + virtual bool getTargetModel(TARGETING::Target* i_target, + TARGETING::MODEL& o_model) const; + + /** + * @brief Obtain the processor EC Level if the passed in target is a + * PROC target. + * + * @param[in] i_target. The target from which we would like to determine + * the processor model. + * @param[out] o_ecLevel. The processor model if successful. + * + * @return True if successful, False otherwise. + */ + virtual bool getTargetECLevel(TARGETING::Target* i_target, + uint8_t& o_ecLevel) const; + + /** + * @brief - Allows us to create tests where the model is obtained + * for every call. The proc model should not be cached for + * unit tests in order to allow mocked targets of various + * models. In non-test code this method always returns true. + */ + virtual bool useCachedProcModel() const {return true;} + +private: + + static uint64_t cv_model_cumulus; +}; + +} + +#endif |