Add hardware access support HardwareRegister class

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: Id0ff5a3c06e02ae5dc2c9ca5096fe636391daa56
diff --git a/src/isolator/hei_isolator.cpp b/src/isolator/hei_isolator.cpp
index cbb6652..1ff52a4 100644
--- a/src/isolator/hei_isolator.cpp
+++ b/src/isolator/hei_isolator.cpp
@@ -1,5 +1,6 @@
 
 #include <isolator/hei_isolator.hpp>
+#include <register/hei_hardware_register.hpp>
 
 namespace libhei
 {
@@ -32,13 +33,22 @@
     // Flush the isolation data to ensure a clean slate.
     o_isoData.clear();
 
-    // BEGIN temporary code
+    // Analyze active error on each chip.
     for ( auto const & chip : i_chipList )
     {
+        // In order to access hardware, we must tell the HardwareRegisters which
+        // chip to access.
+        HardwareRegister::setAccessor( chip );
+
+        // BEGIN temporary code
         HEI_INF( "Isolator::isolate(%p,%u)", chip.getChip(),
                  chip.getType() );
+        // END temporary code
+
+        // Clean up the hardware accessor chip to prevent accidental hardware
+        // access.
+        HardwareRegister::clearAccessor();
     }
-    // END temporary code
 
     return rc;
 }
diff --git a/src/register/hei_hardware_register.cpp b/src/register/hei_hardware_register.cpp
index 177bbd0..5663f3b 100755
--- a/src/register/hei_hardware_register.cpp
+++ b/src/register/hei_hardware_register.cpp
@@ -10,6 +10,7 @@
 //----------------------------------------------------------------------
 
 #include <hei_includes.hpp>
+#include <hei_user_interface.hpp>
 #include <register/hei_hardware_register.hpp>
 #include <util/hei_bit_string.hpp>
 
@@ -18,7 +19,6 @@
 #include <prdfMain.H>
 #include <prdfRasServices.H>
 #include <prdfRegisterCache.H>
-#include <prdfHomRegisterAccess.H>
 #include <prdfPlatServices.H>
 #include <prdfExtensibleChip.H>
 
@@ -96,128 +96,96 @@
 
     return readCache();
 }
+#endif
 
 //------------------------------------------------------------------------------
 
-uint32_t HardwareRegister::Read() const
+ReturnCode HardwareRegister::read( bool i_force ) const
 {
-    uint32_t o_rc = SUCCESS;
+    ReturnCode rc;
 
-    // First query the cache for an existing entry.
-    if ( !queryCache() )
+#if 0
+    // Read from hardware only if the read is forced or the entry for this
+    // instance does not exist in the cache.
+    if ( i_force || !queryCache() )
     {
-        // There was not a previous entry in the cache, so do a ForceRead() to
-        // sync the cache with hardware.
-        o_rc = ForceRead();
+        // This register must be readable.
+        HEI_ASSERT( ( ACCESS_NONE != iv_operationType ) &&
+                    ( ACCESS_WO   != iv_operationType ) );
+
+        // Get the buffer from the register cache.
+        BitString & bs = readCache();
+
+        // Get the byte size of the buffer.
+        size_t sz_buffer = BitString::getMinBytes( bs.getBitLen() );
+
+        // Read this register from hardware.
+        rc = registerRead( getAccessorChip().getChip(), bs.getBufAddr(),
+                           sz_buffer, getRegisterType(), getAddress() );
+        if ( RC_SUCCESS != rc )
+        {
+            // The read failed and we can't trust what was put in the register
+            // cache. So remove this instance's entry from the cache.
+            flushCache( getAccessorChip() );
+        }
+        else
+        {
+            // Sanity check. The returned size of the data written to the buffer
+            // should match the register size.
+            HEI_ASSERT( getSize() == sz_buffer );
+        }
     }
+#endif
 
-    return o_rc;
+    return rc;
 }
 
 //------------------------------------------------------------------------------
 
-uint32_t HardwareRegister::ForceRead() const
+#ifndef __HEI_READ_ONLY
+
+ReturnCode HardwareRegister::write() const
 {
-    #define PRDF_FUNC "[HardwareRegister::ForceRead] "
+    ReturnCode rc;
 
-    uint32_t o_rc = FAIL;
+#if 0
+    // This register must be writable.
+    HEI_ASSERT( ( ACCESS_NONE != iv_operationType ) &&
+                ( ACCESS_RO   != iv_operationType ) );
 
-    do
+    // An entry for this register must exist in the cache.
+    HEI_ASSERT( queryCache() );
+
+    // Get the buffer from the register cache.
+    BitString & bs = readCache();
+
+    // Get the byte size of the buffer.
+    size_t sz_buffer = BitString::getMinBytes( bs.getBitLen() );
+
+    // Write to this register to hardware.
+    rc = registerWrite( getAccessorChip().getChip(), bs.getBufAddr(),
+                        sz_buffer, getRegisterType(), getAddress() );
+
+    if ( RC_SUCCESS == rc )
     {
-        // No read allowed if register access attribute is write-only or no
-        // access.
-        if ( ( ACCESS_NONE == iv_operationType ) &&
-                ( ACCESS_WO == iv_operationType ) )
-        {
-            HEI_ERR( PRDF_FUNC "Write-only register: 0x%08x 0x%016llx",
-                      getChip()->GetId(), iv_scomAddress );
-            break;
-        }
+        // Sanity check. The returned size of the data written to the buffer
+        // should match the register size.
+        HEI_ASSERT( getSize() == sz_buffer );
+    }
+#endif
 
-        // Read hardware.
-        o_rc = Access( readCache(), RegisterAccess::READ );
-        if ( SUCCESS != o_rc )
-        {
-            // The read failed. Remove the entry from the cache so a subsequent
-            // Read() will attempt to read from hardware again.
-            flushCache( getChip() );
-        }
-
-    } while (0);
-
-    return o_rc;
-
-    #undef PRDF_FUNC
+    return rc;
 }
 
-//------------------------------------------------------------------------------
+#endif // __HEI_READ_ONLY
 
-uint32_t HardwareRegister::Write()
-{
-    #define PRDF_FUNC "[HardwareRegister::Write] "
-
-    uint32_t o_rc = FAIL;
-
-    do
-    {
-        // No write allowed if register access attribute is read-only or no
-        // access.
-        if ( ( ACCESS_NONE == iv_operationType ) &&
-                 ( ACCESS_RO == iv_operationType ) )
-        {
-            HEI_ERR( PRDF_FUNC "Read-only register: 0x%08x 0x%016llx",
-                      getChip()->GetId(), iv_scomAddress );
-            break;
-        }
-
-        // Query the cache for an existing entry.
-        if ( !queryCache() )
-        {
-            // Something bad happened and there was nothing in the cache to
-            // write to hardware.
-            HEI_ERR( PRDF_FUNC "No entry found in cache: 0x%08x 0x%016llx",
-                      getChip()->GetId(), iv_scomAddress );
-            break;
-        }
-
-        // Write hardware.
-        o_rc = Access( readCache(), RegisterAccess::WRITE );
-
-    } while (0);
-
-    return o_rc;
-
-    #undef PRDF_FUNC
-}
-
-//------------------------------------------------------------------------------
-
-uint32_t HardwareRegister::Access( BitString & bs,
-                               RegisterAccess::Operation op ) const
-{
-    int32_t l_rc = SCR_ACCESS_FAILED;
-    TARGETING::TargetHandle_t i_pchipTarget = getChip()->GetChipHandle();
-    l_rc = getScomService().Access( i_pchipTarget,bs,iv_scomAddress,op );
-
-    return(l_rc);
-}
-//-----------------------------------------------------------------------------
-ExtensibleChip* HardwareRegister::getChip( )const
-{
-    ExtensibleChip* l_pchip = nullptr;
-    l_pchip = ServiceDataCollector::getChipAnalyzed();
-    TARGETING::TYPE l_type = PlatServices::getTargetType(
-                                                l_pchip->GetChipHandle() );
-    HEI_ASSERT( iv_chipType == l_type )
-    return l_pchip;
-}
-
+#if 0
 //------------------------------------------------------------------------------
 
 bool HardwareRegister::queryCache() const
 {
     RegDataCache & cache = RegDataCache::getCachedRegisters();
-    BitString * bs = cache.queryCache( getChip(), this );
+    BitString * bs = cache.queryCache( getAccessorChip(), this );
     return ( nullptr != bs );
 }
 
@@ -226,7 +194,7 @@
 BitString & HardwareRegister::readCache() const
 {
     RegDataCache & cache = RegDataCache::getCachedRegisters();
-    return cache.read( getChip(), this );
+    return cache.read( getAccessorChip(), this );
 }
 
 //------------------------------------------------------------------------------
@@ -280,5 +248,11 @@
 }
 #endif
 
+//------------------------------------------------------------------------------
+
+HardwareRegister::Accessor * HardwareRegister::cv_accessor = nullptr;
+
+//------------------------------------------------------------------------------
+
 } // end namespace libhei
 
diff --git a/src/register/hei_hardware_register.hpp b/src/register/hei_hardware_register.hpp
index c6722fb..066f6db 100755
--- a/src/register/hei_hardware_register.hpp
+++ b/src/register/hei_hardware_register.hpp
@@ -14,10 +14,6 @@
 #include <register/hei_register.hpp>
 #include <util/hei_bit_string.hpp>
 
-#if 0
-#include <prdfHomRegisterAccess.H>
-#endif
-
 namespace libhei
 {
 
@@ -28,11 +24,28 @@
 class ExtensibleChip;
 #endif
 
+/**
+ * @brief Stores information (e.g. address, type, length, etc.) for an actual
+ *        hardware register.
+ *
+ * Hardware access:
+ *
+ *  Actual hardware access is defined by the user application via the user
+ *  interface APIs. In order to tell the user application which chip to target,
+ *  the user application gives the isolator pointers to its chip objects. As
+ *  each chip needs to be accessed, the isolator must store the chip in a
+ *  static variable defined in this class. The intended use is:
+ *
+ *   - Call HardwareRegister::setAccessor() with the target chip.
+ *   - Perform all necessary hardware accesses to that chip.
+ *   - Call HardwareRegister::clearAccessor() to remove the chip access. This
+ *     helps ensure we don't try to access the wrong chip.
+ */
 class HardwareRegister : public Register
 {
-#if 0
   public:
 
+#if 0
     /**
      * @brief     constructor
      * @param     i_address        address of the register
@@ -81,26 +94,31 @@
      * @return    length of bit string
      */
     uint32_t GetBitLength(void) const { return iv_bitLength ;}
+#endif
 
     /**
-     * @brief     Directly reads from hardware register
-     * @return    SUCCESS|FAIL
+     * @brief  Reads a register from hardware via the user interface APIs.
+     * @param  i_force When false, this function will only read from hardware if
+     *                 an entry for this instance does not already exist in the
+     *                 register cache. When true, the entry in the register
+     *                 cache is flushed, if it exists. Then this function will
+     *                 read from hardware and update the cache.
+     * @return See the return code from the registerRead() user interface API.
      */
-    virtual uint32_t ForceRead() const;
+    ReturnCode read( bool i_force = false ) const;
+
+    #ifndef __HEI_READ_ONLY
 
     /**
-     * @brief     Returns contents of register.If entry does not exist in cache
-     *            a  fresh entry is created and hardware is read.
-     * @return    SUCCESS|FAIL
-    */
-    virtual uint32_t Read() const;
-
-    /**
-     * @brief     Writes cache contents to register.
-     * @return    SUCCESS|FAIL
+     * @brief  Writes the value stored in the register cache to hardware via the
+     *         user interface APIs.
+     * @return See the return code from the registerWrite() user interface API.
      */
-    virtual uint32_t Write();
+    ReturnCode write() const;
 
+    #endif // __HEI_READ_ONLY
+
+#if 0
     /**
      * @brief     Returns the hash id of register
      * @return    returns  hash id of register
@@ -173,21 +191,6 @@
     * @return   Refer to function description
    */
     virtual BitString & AccessBitString( );
-    /**
-     * @brief     Gets the register read and write done by calling access
-     *            function of scom  accessor service.
-     * @param     reference to bit string maintained in caller  class
-     * @param     Read or write operation
-     * @return    [SUCCESS|FAIL]
-     */
-    uint32_t Access( BitString & bs,
-                     RegisterAccess::Operation op )const;
-
-    /**
-     * @brief  Returns rulechip pointer associated with the register
-     * @return Refer to function description
-     */
-    virtual ExtensibleChip * getChip() const;
 
 private: // functions
 
@@ -218,6 +221,90 @@
     AccessLevel     iv_operationType; // Operation supported (RO, WO, or RW)
 
 #endif
+
+  private: // Hardware accessor class variable
+
+    /** @brief A simple class that stores the chip used to access hardware. */
+    class Accessor
+    {
+      public:
+
+        /**
+         * @brief Constructor.
+         * @param i_chip The chip used to access hardware.
+         */
+        explicit Accessor( const Chip & i_chip ) :
+            iv_chip( i_chip )
+        {}
+
+        /** @brief Destructor. */
+        ~Accessor() = default;
+
+        /** @brief Copy constructor. */
+        Accessor( const Accessor & ) = delete;
+
+        /** @brief Assignment operator. */
+        Accessor & operator=( const Accessor & ) = delete;
+
+        /** @return The chip used to access hardware. */
+        const Chip & getChip() const { return iv_chip; }
+
+      private:
+
+        /**
+         * A Chip object provided by the user application. The isolator does not
+         * know anything about this object nor how to use it. Its only purpose
+         * is to get passed back to the user application for hardware access
+         * operations.
+         */
+        const Chip iv_chip;
+
+    }; // end class Accessor
+
+    /**
+     * This allows all HardwareRegister objects access to a chip via the user
+     * interface APIs. It is intentially defined as a pointer. It can be set to
+     * nullptr to signify that access is restricted at this time. This is useful
+     * to prevent users from accidentally accessing registers on the wrong chip.
+     * It is recommended to use setAccessor() and clearAccessor() to manage this
+     * variable.
+     */
+    static Accessor * cv_accessor;
+
+  public: // Hardware accessor management functions.
+
+    /**
+     * @brief Initializes a new hardware accessor.
+     * @param i_chip The chip used to access hardware.
+     */
+    static void setAccessor( const Chip & i_chip )
+    {
+        clearAccessor();
+        cv_accessor = new Accessor( i_chip );
+    }
+
+    /** @brief Deletes the current hardware accessor. */
+    static void clearAccessor()
+    {
+        delete cv_accessor;
+        cv_accessor = nullptr;
+    }
+
+  private: // Hardware accessor management functions.
+
+    /** @return The chip stored in cv_accessor. */
+    const Chip & getAccessorChip() const
+    {
+        HEI_ASSERT( nullptr != cv_accessor );
+
+#if 0
+        // Extra sanity check to verify this register belongs on the target
+        // accessor chip.
+        HEI_ASSERT( getChipType() != cv_accessor->getChip().getChipType() );
+#endif
+
+        return cv_accessor->getChip();
+    }
 };
 
 } // end namespace libhei
diff --git a/src/register/prdfCaptureData.C b/src/register/prdfCaptureData.C
index 7dac116..190de9d 100755
--- a/src/register/prdfCaptureData.C
+++ b/src/register/prdfCaptureData.C
@@ -34,7 +34,6 @@
 #include <register/hei_hardware_register.hpp>
 #include <util/hei_bit_string.hpp>
 
-#include <prdfHomRegisterAccess.H>  // dg06a
 #include <iipchip.h>
 #include <iipCaptureData.h>
 #include <string.h>
diff --git a/src/register/prdfHomRegisterAccess.C b/src/register/prdfHomRegisterAccess.C
deleted file mode 100755
index b1702bb..0000000
--- a/src/register/prdfHomRegisterAccess.C
+++ /dev/null
@@ -1,224 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG                                                   */
-/* This is an automatically generated prolog.                             */
-/*                                                                        */
-/* $Source: src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C $ */
-/*                                                                        */
-/* OpenPOWER HostBoot Project                                             */
-/*                                                                        */
-/* Contributors Listed Below - COPYRIGHT 2012,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                                                     */
-
-/**
-  @file prdfHomRegisterAccess.C
-  @brief definition of HomRegisterAccess
-*/
-//----------------------------------------------------------------------
-//  Includes
-//----------------------------------------------------------------------
-
-#include <hei_includes.hpp>
-#include <util/hei_bit_string.hpp>
-
-#include <prdfHomRegisterAccess.H>
-#include <prdf_service_codes.H>
-#include <prdfMain.H>
-#include <prdfPlatServices.H>
-#include <prdfGlobal.H>
-#include <prdfErrlUtil.H>
-
-#ifdef __HOSTBOOT_RUNTIME
-#include <pm_common_ext.H>
-#include <p9_stop_api.H>
-#endif
-
-using namespace TARGETING;
-
-namespace libhei
-{
-
-//----------------------------------------------------------------------
-//  User Types
-//----------------------------------------------------------------------
-
-//----------------------------------------------------------------------
-//  Constants
-//----------------------------------------------------------------------
-
-//----------------------------------------------------------------------
-//  Macros
-//----------------------------------------------------------------------
-
-//----------------------------------------------------------------------
-//  Internal Function Prototypes
-//----------------------------------------------------------------------
-
-//----------------------------------------------------------------------
-//  Global Variables
-//----------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-// Member Function Specifications
-//------------------------------------------------------------------------------
-
-ScomService& getScomService()
-{
-    return PRDF_GET_SINGLETON(theScomService);
-}
-
-ScomService::ScomService() :
-    iv_ScomAccessor(nullptr)
-{
-    PRDF_DTRAC("ScomService() initializing default iv_ScomAccessor");
-    iv_ScomAccessor = new ScomAccessor();
-}
-
-ScomService::~ScomService()
-{
-    if(nullptr != iv_ScomAccessor)
-    {
-        PRDF_DTRAC("~ScomService() deleting iv_ScomAccessor");
-        delete iv_ScomAccessor;
-        iv_ScomAccessor = nullptr;
-    }
-}
-
-void ScomService::setScomAccessor(ScomAccessor & i_ScomAccessor)
-{
-    PRDF_DTRAC("ScomService::setScomAccessor() setting new scom accessor");
-
-    if(nullptr != iv_ScomAccessor)
-    {
-        PRDF_TRAC("ScomService::setScomAccessor() deleting old iv_ScomAccessor");
-        delete iv_ScomAccessor;
-        iv_ScomAccessor = nullptr;
-    }
-
-    iv_ScomAccessor = &i_ScomAccessor;
-}
-
-uint32_t ScomService::Access(TargetHandle_t i_target,
-                             BitString & bs,
-                             uint64_t registerId,
-                             RegisterAccess::Operation operation) const
-{
-    PRDF_DENTER("ScomService::Access()");
-    uint32_t rc = SUCCESS;
-
-    rc = iv_ScomAccessor->Access( i_target,
-                                  bs,
-                                  registerId,
-                                  operation);
-
-    PRDF_DEXIT("ScomService::Access(): rc=%d", rc);
-
-    return rc;
-}
-
-
-uint32_t ScomAccessor::Access(TargetHandle_t i_target,
-                                BitString & bs,
-                                uint64_t registerId,
-                                RegisterAccess::Operation operation) const
-{
-    PRDF_DENTER("ScomAccessor::Access()");
-
-    uint32_t rc = SUCCESS;
-
-    if(i_target != nullptr)
-    {
-        switch (operation)
-        {
-            case RegisterAccess::WRITE:
-            {
-                rc = PRDF::PlatServices::putScom(i_target, bs, registerId);
-
-                #ifdef __HOSTBOOT_RUNTIME
-                using namespace stopImageSection;
-
-                // Update CORE/EQ/EX Fir masks in HCODE image
-                TARGETING::TYPE type = PlatServices::getTargetType(i_target);
-                if( TYPE_EX == type || TYPE_EQ == type || TYPE_CORE == type )
-                {
-                    uint32_t l_MaskReg[7] = {
-                                        0x2004000f,   // EC_LFIR_MASK_OR
-                                        0x20010a45,   // EC_COREFIR_MASK_OR
-                                        0x1004000f,   // EQ_LOCAL_FIR_MASK_OR
-                                        0x10010805,   // EX_L2FIR_MASK_OR
-                                        0x10011005,   // EX_NCUFIR_MASK_OR
-                                        0x10011805,   // EX_L3FIR_MASK_OR
-                                        0x10012005 }; // EX_CMEFIR_MASK_OR
-
-                    for(uint32_t l_count = 0; l_count < 7; l_count++)
-                    {
-                        if( l_MaskReg[l_count]  == registerId )
-                        {
-                            errlHndl_t err = nullptr;
-                            uint32_t sec = (TYPE_CORE == type) ?
-                                P9_STOP_SECTION_CORE_SCOM :
-                                P9_STOP_SECTION_EQ_SCOM;
-
-                            uint64_t scomVal =
-                                (((uint64_t)bs.getFieldJustify(0, 32)) << 32) |
-                                 ((uint64_t)bs.getFieldJustify(32, 32));
-
-                            err = RTPM::hcode_update(sec,
-                                                     P9_STOP_SCOM_OR_APPEND,
-                                                     i_target,
-                                                     registerId,
-                                                     scomVal);
-                            if( nullptr != err)
-                            {
-                                HEI_ERR("[ScomAccessor::Access()] Error in"
-                                         " hcode_update");
-                                PRDF_COMMIT_ERRL( err, ERRL_ACTION_REPORT );
-                            }
-                            break;
-                        }
-                    }
-                }
-                #endif
-                break;
-            }
-
-            case RegisterAccess::READ:
-                bs.clearAll(); // clear all bits
-
-                rc = PRDF::PlatServices::getScom(i_target, bs, registerId);
-
-                break;
-
-            default:
-                HEI_ERR("ScomAccessor::Access() unsuppported scom op: 0x%08X",
-                          operation);
-                break;
-
-        } // end switch operation
-
-    }
-    else // Invalid target
-    {
-        rc = PRD_SCANCOM_FAILURE;
-    }
-
-    PRDF_DEXIT("ScomAccessor::Access()");
-
-    return rc;
-}
-
-} // end namespace libhei
-
diff --git a/src/register/prdfHomRegisterAccess.H b/src/register/prdfHomRegisterAccess.H
deleted file mode 100755
index d382048..0000000
--- a/src/register/prdfHomRegisterAccess.H
+++ /dev/null
@@ -1,167 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG                                                   */
-/* This is an automatically generated prolog.                             */
-/*                                                                        */
-/* $Source: src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H $ */
-/*                                                                        */
-/* OpenPOWER HostBoot Project                                             */
-/*                                                                        */
-/* Contributors Listed Below - COPYRIGHT 2012,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 PRDFHOMREGISTERACCESS_H
-#define PRDFHOMREGISTERACCESS_H
-/**
-   @file prdfHomRegisterAccess.H
-   @brief Provide access to scan & scan com registers via the HOM
-*/
-
-
-//--------------------------------------------------------------------
-// Includes
-//--------------------------------------------------------------------
-
-#include <vector>
-#include <prdfPlatServices.H>
-#include <prdfErrlUtil.H>
-#include <prdfGlobal.H>
-//--------------------------------------------------------------------
-//  Forward References
-//--------------------------------------------------------------------
-
-namespace libhei
-{
-
-namespace RegisterAccess
-{
-    enum Operation
-    {
-        READ  = 0,
-        WRITE = 1,
-    };
-}
-
-class ScomAccessor
-{
-  public:
-
-    /**
-     * @brief ctor
-     */
-    inline ScomAccessor() {}
-
-    /**
-     * @brief dtor
-     */
-    inline virtual ~ScomAccessor() {}
-
-    /**
-     * @brief Access the scan com register
-     * @param i_target    Target to access the register
-     * @param bs holds    data read or to write
-     * @param registerId  register address
-     * @param operation   [READ|WRITE]
-     * @returns SUCCESS or PRD_SCANCOM_FAILURE
-     * @pre bs.Length() must be size of register data to read/write
-     * @post For read operation, bs is modified to reflect hardware
-     *       register state
-     */
-    virtual uint32_t Access( TARGETING::TargetHandle_t i_target,
-                             BitString & bs,
-                             uint64_t registerId,
-                             RegisterAccess::Operation operation) const;
-
-  private:
-
-    /**
-     * @brief disable copy
-     */
-    ScomAccessor(const ScomAccessor &);
-
-    /**
-     * @brief disable assignment
-     */
-    ScomAccessor & operator=(const ScomAccessor &);
-
-};
-
-/**
- *  @brief Singleton to access the only ScomService
- */
-class ScomService;
-PRDF_DECLARE_SINGLETON(ScomService, theScomService);
-
-/**
- *  @brief Returns a reference to the ScomService singleton
- *
- *  @return Reference to the ScomService
- */
-ScomService& getScomService();
-
-/**
- *  @brief ScomService class
- */
-class ScomService
-{
-  public:
-
-    /**
-     *  @brief Construct ScomService
-     */
-    ScomService();
-
-    /**
-     *  @brief Destroys ScomService
-     */
-    ~ScomService();
-
-    /**
-     * @brief set the scom accessor to be used
-     *
-     * @param[in] i_ScomAccessor new scom accessor
-     */
-    void setScomAccessor(ScomAccessor & i_ScomAccessor);
-
-    /**
-     Access the scan com register
-     @param i_target Target to access the register
-     @param BitString - holds data read or to write
-     @param register address
-     @param [READ|WRITE]
-     @returns [SUCCESS|FAIL]
-     @pre bs.Length() must be size of register data to read/write
-     @post For read operation, bs is modified to reflect hardware register state
-     @note
-     */
-    virtual uint32_t Access(TARGETING::TargetHandle_t i_target,
-                            BitString & bs,
-                            uint64_t registerId,
-                            RegisterAccess::Operation operation) const;
-
-  private:
-
-    // Disable copy constructor / assignment operator
-    ScomService(const ScomService& i_right);
-    ScomService& operator=(const ScomService& i_right);
-
-    // Scom access to actual HW or Sim
-    ScomAccessor * iv_ScomAccessor;
-};
-
-} // end namespace libhei
-
-#endif /* PRDFHOMREGISTERACCESS_H */
diff --git a/src/register/prdfRegisterCache.H b/src/register/prdfRegisterCache.H
index 8ef5159..9176b0e 100644
--- a/src/register/prdfRegisterCache.H
+++ b/src/register/prdfRegisterCache.H
@@ -34,7 +34,6 @@
 
 #include <prdfGlobal.H>
 #include <prdfScanFacility.H>
-#include <prdfScomRegisterAccess.H>
 #include <prdfTargetFwdRef.H>
 
 namespace libhei
diff --git a/src/register/prdfScanFacility.C b/src/register/prdfScanFacility.C
index 2ce591d..a0aadac 100755
--- a/src/register/prdfScanFacility.C
+++ b/src/register/prdfScanFacility.C
@@ -36,7 +36,6 @@
 #include <prdfScanFacility.H>
 #include <prdfFlyWeight.C>
 #include <prdfFlyWeightS.C>
-#include <prdfScomRegisterAccess.H>
 
 namespace libhei
 {
diff --git a/src/register/prdfScanFacility.H b/src/register/prdfScanFacility.H
index 4107c83..501f72b 100755
--- a/src/register/prdfScanFacility.H
+++ b/src/register/prdfScanFacility.H
@@ -41,8 +41,6 @@
 #include <prdfFlyWeight.H>
 #include <prdfFlyWeightS.H>
 #include <vector>
-#include <prdfHomRegisterAccess.H>
-#include <prdfScomRegisterAccess.H>
 #include <prdfPlatServices.H>
 
 namespace libhei
diff --git a/src/register/prdfScomRegisterAccess.C b/src/register/prdfScomRegisterAccess.C
deleted file mode 100644
index 3f3f271..0000000
--- a/src/register/prdfScomRegisterAccess.C
+++ /dev/null
@@ -1,86 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG                                                   */
-/* This is an automatically generated prolog.                             */
-/*                                                                        */
-/* $Source: src/usr/diag/prdf/common/framework/register/prdfScomRegisterAccess.C $ */
-/*                                                                        */
-/* OpenPOWER HostBoot Project                                             */
-/*                                                                        */
-/* COPYRIGHT International Business Machines Corp. 2012,2014              */
-/*                                                                        */
-/* 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                                                     */
-
-#include <prdfScomRegisterAccess.H>
-#include <prdfScanFacility.H>
-#include <prdfRegisterCache.H>
-#include <prdfExtensibleChip.H>
-
-namespace libhei
-{
-
-ScomRegisterAccess::ScomRegisterAccess(
-                    const Register & i_pRegister,
-                    ExtensibleChip * i_pRuleChip ) :
-    HardwareRegister( i_pRegister ),
-    iv_containerChip( i_pRuleChip )
-{}
-
-//----------------------------------------------------------------------
-
-ExtensibleChip* ScomRegisterAccess::getChip( )const
-{
-    return iv_containerChip;
-}
-
-//----------------------------------------------------------------------
-
-bool ScomRegisterAccess::operator == (
-                const ScomRegisterAccess & i_rightRegister ) const
-{
-    if( GetAddress() == i_rightRegister.GetAddress() )
-    {
-        return ( getChip() == i_rightRegister.getChip() );
-    }
-    else
-    {
-        return false ;
-    }
-
-}
-//----------------------------------------------------------------------
-
-bool ScomRegisterAccess::operator < (
-                const ScomRegisterAccess & i_rightRegister ) const
-{
-    if( GetAddress() == i_rightRegister.GetAddress() )
-    {
-        return ( getChip() < i_rightRegister.getChip() );
-    }
-    else
-    {
-        return ( GetAddress() < i_rightRegister.GetAddress() );
-    }
-}
-
-//----------------------------------------------------------------------
-bool ScomRegisterAccess::operator >= (
-                const ScomRegisterAccess & i_right ) const
-{
-    return !( *this < i_right );
-}
-
-//----------------------------------------------------------------------
-
-} // end namespace libhei
-
diff --git a/src/register/prdfScomRegisterAccess.H b/src/register/prdfScomRegisterAccess.H
deleted file mode 100644
index b99f8b6..0000000
--- a/src/register/prdfScomRegisterAccess.H
+++ /dev/null
@@ -1,111 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG                                                   */
-/* This is an automatically generated prolog.                             */
-/*                                                                        */
-/* $Source: src/usr/diag/prdf/common/framework/register/prdfScomRegisterAccess.H $ */
-/*                                                                        */
-/* OpenPOWER HostBoot Project                                             */
-/*                                                                        */
-/* COPYRIGHT International Business Machines Corp. 2012,2014              */
-/*                                                                        */
-/* 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 __PRDF_REGISTER_
-#define __PRDF_REGISTER_
-
-#include <register/hei_hardware_register.hpp>
-#include <util/hei_bit_string.hpp>
-
-#include <prdfPlatServices.H>
-
-/**
- * @brief Models register.This model of register has target info
- *
- * In order to reduce the register objects required by PRD to do attention
- * analysis, these are shared across all the  RuleChip objects associated with
- * target of same type.In order to realize this,target info is taken out of
- * register object .RuleChip contains target info.During Analysis ,pointer to
- * Rulechip under analysis is maintained in Service Data collector.During
- * register Read and Write,target info is obtained by register from service data
- * collector.This idea fails when getRegister is called for Register read and
- * write.It may be called from plugin code which may use a RuleChip different
- * from the one in SDC.We would like to avoid SDC getting updated from multiple
- * places.To simplify solution for this use case, a wrapper register is required
- * .This register model knows which rule chip it is associated with.When plugin
- * code calls getRegister ,instead of returning  targetless flyweight object,it
- * returns an object of class ScomRegisterAccess.Since register Read Write is
- * in parent class ,it's just a container for Rulechip pointer giving us a way
- * to do scom without having to look for associated target/rule chip somewhere
- * else.
- */
-
-namespace libhei
-{
-class ScomRegisterAccess : public HardwareRegister
-{
-    public :
-    /**
-     * @brief     constructor
-     * @param     i_Register     Reference to flyweight register
-     * @param     i_pchip        RuleChip associated with register
-     */
-    ScomRegisterAccess( const Register & i_Register,
-                        ExtensibleChip* i_pchip );
-    /**
-     * @brief     constructor
-     */
-    ScomRegisterAccess():HardwareRegister( ),iv_containerChip ( nullptr ){ };
-
-    /**
-     * @brief Destructor
-    */
-    ~ScomRegisterAccess(){ };
-    /**
-     * @brief     Returns pointer to rulechip associated with register
-     * @return    Returns rule chip pointer
-    */
-
-    virtual ExtensibleChip* getChip( ) const;
-    /**
-     * @brief     compares two ScomRegisterAccess register for equality
-     * @param     i_rightRegister   register to be compared against
-     * @return    Returns true if registers are equal false otherwise
-     */
-    bool operator == ( const ScomRegisterAccess & i_rightRegister ) const;
-    /**
-     * @brief     defines < operation for ScomRegisterAccess
-     * @param     i_rightRegister   register to be compared against
-     * @return    Returns false if i_rightRegisters is less and true otherwise
-     */
-    bool operator < ( const ScomRegisterAccess & i_rightRegister ) const;
-    /**
-     * @brief     defines >= operation for ScomRegisterAccess
-     * @param     i_right   register to be compared against
-     * @return    Returns true if registers is >= i_rightRegister false
-     *            otherwise
-     */
-    bool operator >= ( const ScomRegisterAccess & i_right ) const;
-
-
-    private://Data
-
-    ExtensibleChip* iv_containerChip;
-
-
-};
-
-} // end namespace libhei
-
-#endif
-