Remove Legacy code from P10 and future code

Remove Occ control code that supports older hardware models P8 and P9.
This is in preparation for occ control taking over occ poll handling.

Change-Id: Iff99ac8ff3a3fe6e9a6af994b20b06793ead50fc
Signed-off-by: Sheldon Bailey <baileysh@us.ibm.com>
diff --git a/app.cpp b/app.cpp
index 5598177..f0929d7 100644
--- a/app.cpp
+++ b/app.cpp
@@ -2,11 +2,8 @@
 
 #include "occ_events.hpp"
 #include "occ_manager.hpp"
-#include "utils.hpp"
-
-#ifdef POWER10
 #include "powermode.hpp"
-#endif
+#include "utils.hpp"
 
 #include <org/open_power/OCC/Device/error.hpp>
 #include <phosphor-logging/lg2.hpp>
@@ -36,13 +33,12 @@
 
     // Add object manager interfaces (for mapper)
     sdbusplus::server::manager_t objManager(bus, OCC_CONTROL_ROOT);
-#ifdef READ_OCC_SENSORS
+
     sdbusplus::server::manager_t objManagerXyz(bus, OCC_SENSORS_ROOT);
-#endif
-#ifdef POWER10
+
     sdbusplus::server::manager_t objManagerXyzControl(
         bus, "/xyz/openbmc_project/control");
-#endif
+
     sdbusplus::server::manager_t objManagerXyzInventory(
         bus, "/xyz/openbmc_project/inventory");
     open_power::occ::Manager mgr(eventP);
diff --git a/i2c_occ.cpp b/i2c_occ.cpp
deleted file mode 100644
index a9d55fe..0000000
--- a/i2c_occ.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "config.h"
-
-#include "i2c_occ.hpp"
-
-#include <algorithm>
-#include <cassert>
-#include <fstream>
-
-#ifdef I2C_OCC
-
-namespace i2c_occ
-{
-
-namespace fs = std::filesystem;
-
-// The occ_master sysfs file
-constexpr auto OCC_MASTER_FILE = "occ_master";
-// The device name's length, e.g. "p8-occ-hwmon"
-constexpr auto DEVICE_NAME_LENGTH = 12;
-// The occ name's length, e.g. "occ"
-constexpr auto OCC_NAME_LENGTH = 3;
-
-// static assert to make sure the i2c occ device name is expected
-static_assert(sizeof(I2C_OCC_DEVICE_NAME) - 1 == DEVICE_NAME_LENGTH);
-static_assert(sizeof(OCC_NAME) - 1 == OCC_NAME_LENGTH);
-
-static bool isMasterOcc(const fs::directory_entry& p)
-{
-    auto f = p / fs::path{OCC_MASTER_FILE};
-    auto str = getFileContent(f);
-    return (!str.empty()) && (str[0] == '1');
-}
-
-std::string getFileContent(const fs::path& f)
-{
-    std::string ret(DEVICE_NAME_LENGTH, 0);
-    std::ifstream ifs(f.c_str(), std::ios::binary);
-    if (ifs.is_open())
-    {
-        ifs.read(&ret[0], DEVICE_NAME_LENGTH);
-        ret.resize(ifs.gcount());
-    }
-    return ret;
-}
-
-std::vector<std::string> getOccHwmonDevices(const char* path)
-{
-    std::vector<std::string> result{};
-
-    if (fs::is_directory(path))
-    {
-        for (auto& p : fs::directory_iterator(path))
-        {
-            // Check if a device's name is "p8-occ-hwmon"
-            auto f = p / fs::path{"name"};
-            auto str = getFileContent(f);
-            if (str == I2C_OCC_DEVICE_NAME)
-            {
-                if (isMasterOcc(p))
-                {
-                    // Insert master occ at the beginning
-                    result.emplace(result.begin(), p.path().filename());
-                }
-                else
-                {
-                    result.emplace_back(p.path().filename());
-                }
-            }
-        }
-    }
-    if (!result.empty())
-    {
-        // Sort the occ devices except for master
-        std::sort(result.begin() + 1, result.end());
-    }
-    return result;
-}
-
-void i2cToDbus(std::string& path)
-{
-    std::replace(path.begin(), path.end(), '-', '_');
-}
-
-void dbusToI2c(std::string& path)
-{
-    std::replace(path.begin(), path.end(), '_', '-');
-}
-
-std::string getI2cDeviceName(const std::string& dbusPath)
-{
-    auto name = fs::path(dbusPath).filename().string();
-
-    // Need to make sure the name starts with "occ"
-    assert(name.compare(0, OCC_NAME_LENGTH, OCC_NAME) == 0);
-
-    // Change name like occ_3_0050 to 3_0050
-    name.erase(0, OCC_NAME_LENGTH + 1);
-
-    dbusToI2c(name);
-    return name;
-}
-
-} // namespace i2c_occ
-
-#endif
diff --git a/i2c_occ.hpp b/i2c_occ.hpp
deleted file mode 100644
index 9ef814b..0000000
--- a/i2c_occ.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#pragma once
-
-#include <filesystem>
-#include <vector>
-
-#ifdef I2C_OCC
-
-namespace i2c_occ
-{
-
-namespace fs = std::filesystem;
-
-/** @brief Get file content
- *
- * Get at most NAME_LENGTH bytes of content from file. If the file is smaller
- * than NAME_LENGTH bytes, return the valid parts.
- *
- * @param[in] f - The path of file
- *
- * @return The string of file content
- */
-std::string getFileContent(const fs::path& f);
-
-/** @brief Find all devices of occ hwmon
- *
- * It iterates in path, finds all occ hwmon devices
- *
- * E.g. If "path/3-0050/name" exists and its content is "p8-occ-hwmon",
- * "3-0050" is returned.
- *
- * @param[in] path - The path to search
- *
- * @return A vector of strings containing the occ hwmon device path
-           where the first device is master occ
- */
-std::vector<std::string> getOccHwmonDevices(const char* path);
-
-/** @brief Convert i2c name to DBus path
- *
- * It converts '-' to '_' so that it becomes a valid DBus path.
- * E.g. 3-0050 converts to 3_0050
- *
- * @param[in,out] path - The i2c name to convert
- */
-void i2cToDbus(std::string& name);
-
-/** @brief Convert DBus path to i2c name
- *
- * It converts '_' to '_' so that it becomes a valid i2c name
- * E.g. 3_0050 converts to 3-0050
- *
- * @param[in,out] path - The DBus path to convert
- */
-void dbusToI2c(std::string& path);
-
-/** @brief Get i2c name from full DBus path
- *
- * It extract the i2c name from the full DBus path.
- * E.g. /org/open_power/control/3_0050 returns "3-0050"
- *
- * @param[in] dbusPath - The full DBus path
- *
- * @return The i2c name
- */
-std::string getI2cDeviceName(const std::string& dbusPath);
-
-} // namespace i2c_occ
-
-#endif
diff --git a/meson.build b/meson.build
index ef6feed..7d1b06e 100644
--- a/meson.build
+++ b/meson.build
@@ -36,22 +36,9 @@
 conf_data.set('OCC_DIMM_TEMP_SENSOR_TYPE', 0xD0)
 conf_data.set('PS_DERATING_FACTOR', get_option('ps-derating-factor'))
 
-if get_option('i2c-occ').allowed()
-    conf_data.set_quoted('OCC_HWMON_PATH', '/sys/bus/i2c/drivers/occ-hwmon/')
-    conf_data.set_quoted('DEV_PATH', '/sys/bus/i2c/devices')
-    conf_data.set_quoted('I2C_OCC_DEVICE_NAME', 'p8-occ-hwmon')
-else
-    conf_data.set_quoted(
-        'OCC_HWMON_PATH',
-        '/sys/bus/platform/drivers/occ-hwmon/',
-    )
-    conf_data.set_quoted('DEV_PATH', '/sys/bus/platform/devices/')
-endif
+conf_data.set_quoted('OCC_HWMON_PATH', '/sys/bus/platform/drivers/occ-hwmon/')
+conf_data.set_quoted('DEV_PATH', '/sys/bus/platform/devices/')
 
-conf_data.set('I2C_OCC', get_option('i2c-occ').allowed())
-conf_data.set('READ_OCC_SENSORS', get_option('read-occ-sensors').allowed())
-conf_data.set('PLDM', get_option('with-host-communication-protocol') == 'pldm')
-conf_data.set('POWER10', get_option('power10-support').allowed())
 conf_data.set('PHAL_SUPPORT', get_option('phal-support').allowed())
 
 if get_option('transport-implementation') == 'mctp-demux'
@@ -106,6 +93,7 @@
 phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
 phosphor_logging_dep = dependency('phosphor-logging')
 sdeventplus_dep = dependency('sdeventplus')
+libpldm_dep = dependency('libpldm')
 
 deps += [
     cereal_dep,
@@ -114,6 +102,7 @@
     phosphor_logging_dep,
     sdbusplus_dep,
     sdeventplus_dep,
+    libpldm_dep,
 ]
 
 sources += [
@@ -128,22 +117,11 @@
     'occ_command.cpp',
     'occ_dbus.cpp',
     'powercap.cpp',
-    'i2c_occ.cpp',
+    'powermode.cpp',
+    'pldm.cpp',
     'utils.cpp',
 ]
 
-if get_option('with-host-communication-protocol') == 'pldm'
-    libpldm_dep = dependency('libpldm')
-    deps += [libpldm_dep]
-    sources += ['pldm.cpp']
-endif
-
-if get_option('power10-support').allowed()
-    libpldm_dep = dependency('libpldm')
-    deps += [libpldm_dep]
-    sources += ['pldm.cpp', 'powermode.cpp']
-endif
-
 if get_option('phal-support').allowed()
     deps += [cxx.find_library('pdbg'), cxx.find_library('phal')]
 endif
diff --git a/meson.options b/meson.options
index c20db63..4d75390 100644
--- a/meson.options
+++ b/meson.options
@@ -1,20 +1,6 @@
 option('tests', type: 'feature', description: 'Build tests')
 
 option(
-    'i2c-occ',
-    type: 'feature',
-    description: 'Enable I2C OCC support',
-    value: 'disabled',
-)
-
-option(
-    'read-occ-sensors',
-    type: 'feature',
-    description: 'Enable read occ sensors support',
-    value: 'enabled',
-)
-
-option(
     'max-cpus',
     type: 'integer',
     min: 0,
@@ -33,20 +19,6 @@
 )
 
 option(
-    'with-host-communication-protocol',
-    type: 'string',
-    description: 'To specify the host communication protocol',
-    value: 'pldm',
-)
-
-option(
-    'power10-support',
-    type: 'feature',
-    description: 'Enable Power10 support',
-    value: 'enabled',
-)
-
-option(
     'yamldir',
     type: 'string',
     description: 'The path to the yaml config files',
diff --git a/occ_device.cpp b/occ_device.cpp
index 98eeab7..676c7e1 100644
--- a/occ_device.cpp
+++ b/occ_device.cpp
@@ -103,7 +103,6 @@
     statusObject.deviceError(Error::Descriptor(PRESENCE_ERROR_PATH));
 }
 
-#ifdef PLDM
 void Device::timeoutCallback(int error)
 {
     if (error)
@@ -111,7 +110,6 @@
         managerObject.sbeTimeout(instance);
     }
 }
-#endif
 
 void Device::throttleProcTempCallback(int error)
 {
diff --git a/occ_device.hpp b/occ_device.hpp
index d44409b..3e9761f 100644
--- a/occ_device.hpp
+++ b/occ_device.hpp
@@ -47,9 +47,9 @@
      */
     Device(EventPtr& event, const fs::path& path, Manager& manager,
            Status& status,
-#ifdef POWER10
+
            std::unique_ptr<powermode::PowerMode>& powerModeRef,
-#endif
+
            unsigned int instance = 0) :
         devPath(path), instance(instance), statusObject(status),
         managerObject(manager),
@@ -60,13 +60,8 @@
                 path /
                     fs::path("../../sbefifo" + std::to_string(instance + 1)) /
                     "timeout",
-#ifdef PLDM
                 std::bind(std::mem_fn(&Device::timeoutCallback), this,
-                          std::placeholders::_1)
-#else
-                nullptr
-#endif
-                    ),
+                          std::placeholders::_1)),
         ffdc(event, path / "ffdc", instance),
         presence(event, path / "occs_present", manager,
                  std::bind(std::mem_fn(&Device::errorCallback), this,
@@ -81,11 +76,8 @@
                       std::placeholders::_1)),
         throttleMemTemp(event, path / "occ_mem_throttle",
                         std::bind(std::mem_fn(&Device::throttleMemTempCallback),
-                                  this, std::placeholders::_1))
-#ifdef POWER10
-        ,
+                                  this, std::placeholders::_1)),
         pmode(powerModeRef)
-#endif
     {
         // Nothing to do here
     }
@@ -105,27 +97,12 @@
      */
     inline void addErrorWatch(bool poll = true)
     {
-#ifdef POWER10
         throttleProcTemp.addWatch(poll);
-#else
-        try
-        {
-            throttleProcTemp.addWatch(poll);
-        }
-        catch (const OpenFailure& e)
-        {
-            // try the old kernel version
-            throttleProcTemp.setFile(devPath / "occ_dvfs_ot");
-            throttleProcTemp.addWatch(poll);
-        }
-#endif
 
-#ifdef POWER10
         if (master())
         {
             pmode->addIpsWatch(poll);
         }
-#endif
 
         throttleProcPower.addWatch(poll);
         throttleMemTemp.addWatch(poll);
@@ -162,12 +139,11 @@
         throttleMemTemp.removeWatch();
         throttleProcPower.removeWatch();
         throttleProcTemp.removeWatch();
-#ifdef POWER10
+
         if (master())
         {
             pmode->removeIpsWatch();
         }
-#endif
     }
 
     /** @brief Starts to watch how many OCCs are present on the master */
@@ -222,10 +198,8 @@
     Error throttleProcPower;
     Error throttleMemTemp;
 
-#ifdef POWER10
     /** @brief OCC PowerMode object */
     std::unique_ptr<powermode::PowerMode>& pmode;
-#endif
 
     /** @brief file reader to read a binary string ("1" or "0")
      *
@@ -262,13 +236,11 @@
      */
     void presenceCallback(int occsPresent);
 
-#ifdef PLDM
     /** @brief callback for SBE timeout monitoring
      *
      * @param[in] error - True if an error is reported, false otherwise
      */
     void timeoutCallback(int error);
-#endif
 
     /** @brief callback for the proc temp throttle event
      *
diff --git a/occ_manager.cpp b/occ_manager.cpp
index 3ae11f6..302a733 100644
--- a/occ_manager.cpp
+++ b/occ_manager.cpp
@@ -2,7 +2,6 @@
 
 #include "occ_manager.hpp"
 
-#include "i2c_occ.hpp"
 #include "occ_dbus.hpp"
 #include "occ_errors.hpp"
 #include "utils.hpp"
@@ -58,7 +57,6 @@
 
 void Manager::createPldmHandle()
 {
-#ifdef PLDM
     pldmHandle = std::make_unique<pldm::Interface>(
         std::bind(std::mem_fn(&Manager::updateOCCActive), this,
                   std::placeholders::_1, std::placeholders::_2),
@@ -67,7 +65,6 @@
         std::bind(std::mem_fn(&Manager::updateOccSafeMode), this,
                   std::placeholders::_1),
         std::bind(std::mem_fn(&Manager::hostPoweredOff), this), event);
-#endif
 }
 
 // findAndCreateObjects():
@@ -80,14 +77,6 @@
 // - restart discoverTimer if all data is not available yet
 void Manager::findAndCreateObjects()
 {
-#ifndef POWER10
-    for (auto id = 0; id < MAX_CPUS; ++id)
-    {
-        // Create one occ per cpu
-        auto occ = std::string(OCC_NAME) + std::to_string(id);
-        createObjects(occ);
-    }
-#else
     if (!pmode)
     {
         // Create the power mode object
@@ -164,7 +153,7 @@
                     tracedHostWait = true;
                 }
                 discoverTimer->restartOnce(30s);
-#ifdef PLDM
+
                 if (throttlePldmTraceTimer->isEnabled())
                 {
                     // Host is no longer running, disable throttle timer and
@@ -173,7 +162,6 @@
                     throttlePldmTraceTimer->setEnabled(false);
                     pldmHandle->setTraceThrottle(false);
                 }
-#endif
             }
         }
     }
@@ -184,10 +172,8 @@
             "FILE", HOST_ON_FILE);
         discoverTimer->restartOnce(10s);
     }
-#endif
 }
 
-#ifdef POWER10
 // Check if all occActive sensors are available
 void Manager::checkAllActiveSensors()
 {
@@ -229,22 +215,18 @@
                             "checkAllActiveSensors(): Waiting on OCC{INST} Active sensor",
                             "INST", instance);
                         tracedSensorWait = true;
-#ifdef PLDM
                         // Make sure PLDM traces are not throttled
                         pldmHandle->setTraceThrottle(false);
                         // Start timer to throttle PLDM traces when timer
                         // expires
                         onPldmTimeoutCreatePel = false;
                         throttlePldmTraceTimer->restartOnce(5min);
-#endif
                     }
-#ifdef PLDM
                     // Ignore active sensor check if the OCCs are being reset
                     if (!resetInProgress)
                     {
                         pldmHandle->checkActiveSensor(obj->getOccInstanceID());
                     }
-#endif
                     break;
                 }
             }
@@ -256,7 +238,6 @@
         {
             waitingForHost = true;
             lg2::info("checkAllActiveSensors(): Waiting for host to start");
-#ifdef PLDM
             if (throttlePldmTraceTimer->isEnabled())
             {
                 // Host is no longer running, disable throttle timer and
@@ -265,7 +246,6 @@
                 throttlePldmTraceTimer->setEnabled(false);
                 pldmHandle->setTraceThrottle(false);
             }
-#endif
         }
     }
 
@@ -276,14 +256,12 @@
         {
             discoverTimer->setEnabled(false);
         }
-#ifdef PLDM
         if (throttlePldmTraceTimer->isEnabled())
         {
             // Disable throttle timer and make sure traces are not throttled
             throttlePldmTraceTimer->setEnabled(false);
             pldmHandle->setTraceThrottle(false);
         }
-#endif
         if (waitingForAllOccActiveSensors)
         {
             lg2::info(
@@ -319,7 +297,6 @@
         discoverTimer->restartOnce(10s);
     }
 }
-#endif
 
 std::vector<int> Manager::findOCCsInDev()
 {
@@ -364,20 +341,13 @@
     auto path = fs::path(OCC_CONTROL_ROOT) / occ;
 
     statusObjects.emplace_back(std::make_unique<Status>(
-        event, path.c_str(), *this,
-#ifdef POWER10
-        pmode,
-#endif
+        event, path.c_str(), *this, pmode,
         std::bind(std::mem_fn(&Manager::statusCallBack), this,
-                  std::placeholders::_1, std::placeholders::_2)
-#ifdef PLDM
-            ,
+                  std::placeholders::_1, std::placeholders::_2),
         // Callback will set flag indicating reset needs to be done
         // instead of immediately issuing a reset via PLDM.
         std::bind(std::mem_fn(&Manager::resetOccRequest), this,
-                  std::placeholders::_1)
-#endif
-            ));
+                  std::placeholders::_1)));
 
     // Create the power cap monitor object
     if (!pcap)
@@ -392,19 +362,12 @@
                   statusObjects.back()->getOccInstanceID());
         _pollTimer->setEnabled(false);
 
-#ifdef POWER10
         // Set the master OCC on the PowerMode object
         pmode->setMasterOcc(path);
-#endif
     }
 
-    passThroughObjects.emplace_back(std::make_unique<PassThrough>(
-        path.c_str()
-#ifdef POWER10
-            ,
-        pmode
-#endif
-        ));
+    passThroughObjects.emplace_back(
+        std::make_unique<PassThrough>(path.c_str(), pmode));
 }
 
 // If a reset is not already outstanding, set a flag to indicate that a reset is
@@ -447,9 +410,7 @@
             }
         }
 
-#ifdef PLDM
         pldmHandle->resetOCC(instance);
-#endif
         resetRequired = false;
     }
     else
@@ -475,17 +436,14 @@
         // OCC went active
         ++activeCount;
 
-#ifdef POWER10
         if (activeCount == 1)
         {
             // First OCC went active (allow some time for all OCCs to go active)
             waitForAllOccsTimer->restartOnce(60s);
         }
-#endif
 
         if (activeCount == statusObjects.size())
         {
-#ifdef POWER10
             // All OCCs are now running
             if (waitForAllOccsTimer->isEnabled())
             {
@@ -511,10 +469,6 @@
                 // Verify master OCC and start presence monitor
                 validateOccMaster();
             }
-#else
-            // Verify master OCC and start presence monitor
-            validateOccMaster();
-#endif
         }
 
         // Start poll timer if not already started (since at least one OCC is
@@ -574,13 +528,11 @@
                 _pollTimer->setEnabled(false);
             }
 
-#ifdef POWER10
             // stop wait timer
             if (waitForAllOccsTimer->isEnabled())
             {
                 waitForAllOccsTimer->setEnabled(false);
             }
-#endif
         }
         else if (resetInProgress)
         {
@@ -588,13 +540,10 @@
                 "statusCallBack: Skipping clear of resetInProgress (activeCount={COUNT}, OCC{INST}, status={STATUS})",
                 "COUNT", activeCount, "INST", instance, "STATUS", status);
         }
-#ifdef READ_OCC_SENSORS
         // Clear OCC sensors
         setSensorValueToNaN(instance);
-#endif
     }
 
-#ifdef POWER10
     if (waitingForAllOccActiveSensors)
     {
         if (utils::isHostRunning())
@@ -602,37 +551,8 @@
             checkAllActiveSensors();
         }
     }
-#endif
 }
 
-#ifdef I2C_OCC
-void Manager::initStatusObjects()
-{
-    // Make sure we have a valid path string
-    static_assert(sizeof(DEV_PATH) != 0);
-
-    auto deviceNames = i2c_occ::getOccHwmonDevices(DEV_PATH);
-    for (auto& name : deviceNames)
-    {
-        i2c_occ::i2cToDbus(name);
-        name = std::string(OCC_NAME) + '_' + name;
-        auto path = fs::path(OCC_CONTROL_ROOT) / name;
-        statusObjects.emplace_back(
-            std::make_unique<Status>(event, path.c_str(), *this));
-    }
-    // The first device is master occ
-    pcap = std::make_unique<open_power::occ::powercap::PowerCap>(
-        *statusObjects.front());
-#ifdef POWER10
-    pmode = std::make_unique<powermode::PowerMode>(*this, powermode::PMODE_PATH,
-                                                   powermode::PIPS_PATH);
-    // Set the master OCC on the PowerMode object
-    pmode->setMasterOcc(path);
-#endif
-}
-#endif
-
-#ifdef PLDM
 void Manager::sbeTimeout(unsigned int instance)
 {
     auto obj = std::find_if(statusObjects.begin(), statusObjects.end(),
@@ -678,9 +598,7 @@
                     "updateOCCActive: Waiting for Host and all OCC Active Sensors");
                 waitingForAllOccActiveSensors = true;
             }
-#ifdef POWER10
             discoverTimer->restartOnce(30s);
-#endif
             return false;
         }
         else
@@ -727,9 +645,7 @@
 // Called upon pldm event To set powermode Safe Mode State for system.
 void Manager::updateOccSafeMode(bool safeMode)
 {
-#ifdef POWER10
     pmode->updateDbusSafeMode(safeMode);
-#endif
     // Update the processor throttle status on dbus
     for (auto& obj : statusObjects)
     {
@@ -899,7 +815,6 @@
     return nullptr;
 }
 #endif
-#endif
 
 void Manager::pollerTimerExpired()
 {
@@ -909,7 +824,6 @@
         return;
     }
 
-#ifdef POWER10
     if (resetRequired)
     {
         lg2::error("pollerTimerExpired() - Initiating PM Complex reset");
@@ -923,27 +837,22 @@
         }
         return;
     }
-#endif
 
     for (auto& obj : statusObjects)
     {
         if (!obj->occActive())
         {
             // OCC is not running yet
-#ifdef READ_OCC_SENSORS
             auto id = obj->getOccInstanceID();
             setSensorValueToNaN(id);
-#endif
             continue;
         }
 
         // Read sysfs to force kernel to poll OCC
         obj->readOccState();
 
-#ifdef READ_OCC_SENSORS
         // Read occ sensor values
         getSensorValues(obj);
-#endif
     }
 
     if (activeCount > 0)
@@ -959,7 +868,6 @@
     }
 }
 
-#ifdef READ_OCC_SENSORS
 void Manager::readTempSensors(const fs::path& path, uint32_t occInstance)
 {
     // There may be more than one sensor with the same FRU type
@@ -1475,7 +1383,6 @@
 
     return;
 }
-#endif
 
 // Read the altitude from DBus
 void Manager::readAltitude()
@@ -1571,7 +1478,7 @@
 
         lg2::debug("ambientCallback: Ambient: {TEMP}C, altitude: {ALT}m",
                    "TEMP", ambient, "ALT", altitude);
-#ifdef POWER10
+
         // Send ambient and altitude to all OCCs
         for (auto& obj : statusObjects)
         {
@@ -1580,7 +1487,6 @@
                 obj->sendAmbient(ambient, altitude);
             }
         }
-#endif // POWER10
     }
 }
 
@@ -1598,7 +1504,6 @@
     }
 }
 
-#ifdef POWER10
 // Called when waitForAllOccsTimer expires
 // After the first OCC goes active, this timer will be started (60 seconds)
 void Manager::occsNotAllRunning()
@@ -1635,7 +1540,6 @@
     }
 }
 
-#ifdef PLDM
 // Called when throttlePldmTraceTimer expires.
 // If this timer expires, that indicates there are no OCC active sensor PDRs
 // found which will trigger pldm traces to be throttled.
@@ -1712,8 +1616,6 @@
                    e.what());
     }
 }
-#endif // PLDM
-#endif // POWER10
 
 // Verify single master OCC and start presence monitor
 void Manager::validateOccMaster()
@@ -1722,7 +1624,7 @@
     for (auto& obj : statusObjects)
     {
         auto instance = obj->getOccInstanceID();
-#ifdef POWER10
+
         if (!obj->occActive())
         {
             if (utils::isHostRunning())
@@ -1739,9 +1641,7 @@
                 else
                 {
                     // OCC does not appear to be active yet, check active sensor
-#ifdef PLDM
                     pldmHandle->checkActiveSensor(instance);
-#endif
                     if (obj->occActive())
                     {
                         lg2::info(
@@ -1758,7 +1658,6 @@
                 return;
             }
         }
-#endif // POWER10
 
         if (obj->isMasterOcc())
         {
@@ -1791,9 +1690,8 @@
     {
         lg2::info("validateOccMaster: OCC{INST} is master of {COUNT} OCCs",
                   "INST", masterInstance, "COUNT", activeCount);
-#ifdef POWER10
+
         pmode->updateDbusSafeMode(false);
-#endif
     }
 }
 
diff --git a/occ_manager.hpp b/occ_manager.hpp
index b11756d..a2f1b8a 100644
--- a/occ_manager.hpp
+++ b/occ_manager.hpp
@@ -2,18 +2,14 @@
 
 #include "occ_pass_through.hpp"
 #include "occ_status.hpp"
-#ifdef PLDM
 #include "pldm.hpp"
 
 #ifdef PHAL_SUPPORT
 #include <libphal.H>
 #endif
-#endif
 #include "powercap.hpp"
-#include "utils.hpp"
-#ifdef POWER10
 #include "powermode.hpp"
-#endif
+#include "utils.hpp"
 
 #include <sdbusplus/bus.hpp>
 #include <sdeventplus/event.hpp>
@@ -29,7 +25,6 @@
 namespace occ
 {
 
-#ifdef READ_OCC_SENSORS
 enum occFruType
 {
     processorCore = 0,
@@ -41,14 +36,9 @@
     memCtlrExSensor = 8,
     processorIoRing = 9
 };
-#endif
 
 /** @brief Default time, in seconds, between OCC poll commands */
-#ifndef POWER10
-constexpr unsigned int defaultPollingInterval = 1;
-#else
 constexpr unsigned int defaultPollingInterval = 5;
-#endif
 
 constexpr auto AMBIENT_PATH =
     "/xyz/openbmc_project/sensors/temperature/Ambient_Virtual_Temp";
@@ -92,9 +82,7 @@
                 sdbusRule::path(AMBIENT_PATH) +
                 sdbusRule::argN(0, AMBIENT_INTERFACE) +
                 sdbusRule::interface("org.freedesktop.DBus.Properties"),
-            std::bind(&Manager::ambientCallback, this, std::placeholders::_1))
-#ifdef POWER10
-        ,
+            std::bind(&Manager::ambientCallback, this, std::placeholders::_1)),
         discoverTimer(
             std::make_unique<
                 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
@@ -102,22 +90,14 @@
         waitForAllOccsTimer(
             std::make_unique<
                 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
-                sdpEvent, std::bind(&Manager::occsNotAllRunning, this)))
-#ifdef PLDM
-        ,
+                sdpEvent, std::bind(&Manager::occsNotAllRunning, this))),
         throttlePldmTraceTimer(
             std::make_unique<
                 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
                 sdpEvent, std::bind(&Manager::throttlePldmTraceExpired, this)))
-#endif
-#endif // POWER10
     {
-#ifdef I2C_OCC
-        // I2C OCC status objects are initialized directly
-        initStatusObjects();
-#else
         findAndCreateObjects();
-#endif
+
         readAltitude();
     }
 
@@ -129,14 +109,12 @@
         return activeCount;
     }
 
-#ifdef PLDM
     /** @brief Called by a Device to report that the SBE timed out
      *         and appropriate action should be taken
      *
      * @param[in] instance - the OCC instance id
      */
     void sbeTimeout(unsigned int instance);
-#endif
 
     /** @brief Return the latest ambient and altitude readings
      *
@@ -219,10 +197,8 @@
     /** @brief Power cap monitor and occ notification object */
     std::unique_ptr<open_power::occ::powercap::PowerCap> pcap;
 
-#ifdef POWER10
     /** @brief Power mode monitor and notification object */
     std::unique_ptr<open_power::occ::powermode::PowerMode> pmode;
-#endif
 
     /** @brief sbdbusplus match objects */
     std::vector<sdbusplus::bus::match_t> cpuMatches;
@@ -269,16 +245,6 @@
      * requests) */
     bool resetInProgress = false;
 
-#ifdef I2C_OCC
-    /** @brief Init Status objects for I2C OCC devices
-     *
-     * It iterates in /sys/bus/i2c/devices, finds all occ hwmon devices
-     * and creates status objects.
-     */
-    void initStatusObjects();
-#endif
-
-#ifdef PLDM
     /** @brief Callback handler invoked by the PLDM event handler when state of
      *         the OCC is toggled by the host. The caller passes the instance
      *         of the OCC and state of the OCC.
@@ -336,9 +302,7 @@
 #endif
 
     std::unique_ptr<pldm::Interface> pldmHandle = nullptr;
-#endif
 
-#ifdef POWER10
     /**
      * @brief Timer used when discovering OCCs in /dev.
      */
@@ -359,7 +323,6 @@
         sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>
         waitForAllOccsTimer;
 
-#ifdef PLDM
     /**
      * @brief Timer used to throttle PLDM traces when there are problems
      determining the OCC status via pldm. Used to prevent excessive
@@ -386,7 +349,6 @@
      * via PLDM. This is called when the throttlePldmTraceTimer expires.
      */
     void createPldmSensorPEL();
-#endif
 
     /** @brief Called when code times out waiting for all OCCs to be running or
      *         after the app is restarted (Status does not callback into
@@ -398,7 +360,6 @@
      * restart the discoverTimer
      */
     void checkAllActiveSensors();
-#endif // POWER10
 
     /**
      * @brief Called when poll timer expires and forces a POLL command to the
@@ -413,7 +374,6 @@
      */
     std::vector<int> findOCCsInDev();
 
-#ifdef READ_OCC_SENSORS
     /**
      * @brief Gets the occ sensor values.
      * @param[in] occ - pointer to OCCs Status object
@@ -486,7 +446,6 @@
         {memCtrlAndDimm, "dimm_dram_extmb_dvfs_temp"},
         {PMIC, "dimm_pmic_dvfs_temp"},
         {memCtlrExSensor, "dimm_extmb_dvfs_temp"}};
-#endif
 
     /** @brief Read the altitude from DBus */
     void readAltitude();
diff --git a/occ_pass_through.cpp b/occ_pass_through.cpp
index 61e9ad3..48f58cb 100644
--- a/occ_pass_through.cpp
+++ b/occ_pass_through.cpp
@@ -22,16 +22,9 @@
 using namespace sdbusplus::org::open_power::OCC::Device::Error;
 
 PassThrough::PassThrough(
-    const char* path
-#ifdef POWER10
-    ,
-    std::unique_ptr<open_power::occ::powermode::PowerMode>& powerModeRef
-#endif
-    ) :
-    Iface(utils::getBus(), path), path(path),
-#ifdef POWER10
-    pmode(powerModeRef),
-#endif
+    const char* path,
+    std::unique_ptr<open_power::occ::powermode::PowerMode>& powerModeRef) :
+    Iface(utils::getBus(), path), path(path), pmode(powerModeRef),
     devicePath(OCC_DEV_PATH + std::to_string((this->path.back() - '0') + 1)),
     occInstance(this->path.back() - '0'),
     activeStatusSignal(
@@ -132,7 +125,6 @@
 
 bool PassThrough::setMode(const uint8_t mode, const uint16_t modeData)
 {
-#ifdef POWER10
     SysPwrMode newMode = SysPwrMode(mode);
 
     if (!pmode)
@@ -161,12 +153,6 @@
     lg2::info("PassThrough::setMode() Setting Power Mode {MODE} (data: {DATA})",
               "MODE", uint8_t(newMode), "DATA", modeData);
     return pmode->setMode(newMode, modeData);
-#else
-    lg2::debug(
-        "PassThrough::setMode() No support to setting Power Mode {MODE} (data: {DATA})",
-        "MODE", mode, "DATA", modeData);
-    return false;
-#endif
 }
 
 // Called at OCC Status change signal
diff --git a/occ_pass_through.hpp b/occ_pass_through.hpp
index 3cc462b..047d4ae 100644
--- a/occ_pass_through.hpp
+++ b/occ_pass_through.hpp
@@ -40,12 +40,8 @@
      *  @param[in] path - Path to attach at
      */
     explicit PassThrough(
-        const char* path
-#ifdef POWER10
-        ,
-        std::unique_ptr<open_power::occ::powermode::PowerMode>& powerModeRef
-#endif
-    );
+        const char* path,
+        std::unique_ptr<open_power::occ::powermode::PowerMode>& powerModeRef);
 
     /** @brief Pass through command to OCC from dbus
      *  @param[in] command - command to pass-through
@@ -72,10 +68,8 @@
     /** @brief Pass-through occ path on the bus */
     std::string path;
 
-#ifdef POWER10
     /** @brief OCC PowerMode object */
     std::unique_ptr<open_power::occ::powermode::PowerMode>& pmode;
-#endif
 
     /** @brief OCC device path
      *  For now, here is the hard-coded mapping until
diff --git a/occ_status.cpp b/occ_status.cpp
index ed44403..4be7c93 100644
--- a/occ_status.cpp
+++ b/occ_status.cpp
@@ -72,7 +72,6 @@
         else
         {
             // OCC is no longer active
-#ifdef POWER10
             if (sensorsValid)
             {
                 sensorsValid = false;
@@ -90,7 +89,7 @@
                 // stop safe delay timer
                 safeStateDelayTimer.setEnabled(false);
             }
-#endif
+
             // Call into Manager to let know that we will unbind.
             if (this->managerCallBack)
             {
@@ -156,13 +155,11 @@
 // Callback handler when a device error is reported.
 void Status::deviceError(Error::Descriptor d)
 {
-#ifdef POWER10
     if (pmode && device.master())
     {
         // Prevent mode changes
         pmode->setMasterActive(false);
     }
-#endif
 
     if (d.log)
     {
@@ -183,29 +180,10 @@
     lg2::info(">>Status::resetOCC() - requesting reset for OCC{INST}", "INST",
               instance);
     this->occActive(false);
-#ifdef PLDM
     if (resetCallBack)
     {
         this->resetCallBack(instance);
     }
-#else
-    constexpr auto CONTROL_HOST_PATH = "/org/open_power/control/host0";
-    constexpr auto CONTROL_HOST_INTF = "org.open_power.Control.Host";
-
-    // This will throw exception on failure
-    auto service = utils::getService(CONTROL_HOST_PATH, CONTROL_HOST_INTF);
-
-    auto& bus = utils::getBus();
-    auto method = bus.new_method_call(service.c_str(), CONTROL_HOST_PATH,
-                                      CONTROL_HOST_INTF, "Execute");
-    // OCC Reset control command
-    method.append(convertForMessage(Control::Host::Command::OCCReset).c_str());
-
-    // OCC Sensor ID for callout reasons
-    method.append(std::variant<uint8_t>(std::get<0>(sensorMap.at(instance))));
-    bus.call_noreply(method);
-    return;
-#endif
 }
 
 // Handler called by Host control command handler to convey the
@@ -246,7 +224,6 @@
     occReadStateNow();
 }
 
-#ifdef POWER10
 // Special processing that needs to happen once the OCCs change to ACTIVE state
 void Status::occsWentActive()
 {
@@ -351,7 +328,6 @@
         deviceError(Error::Descriptor(SAFE_ERROR_PATH));
     }
 }
-#endif // POWER10
 
 fs::path Status::getHwmonPath()
 {
@@ -468,7 +444,7 @@
                 "INST", instance, "STATE", lg2::hex, state, "PRIOR", lg2::hex,
                 lastState);
             lastState = state;
-#ifdef POWER10
+
             if (OccState(state) == OccState::ACTIVE)
             {
                 if (pmode && device.master())
@@ -527,31 +503,24 @@
                     manager.setSensorValueToNaN(instance);
                 }
             }
-#else
-            // Before P10 state not checked, only used good file open.
-            stateValid = true;
-#endif
         }
     }
-#ifdef POWER10
     else
     {
         // Unable to read state
         stateValid = false;
     }
-#endif
+
     file.close();
 
     // if failed to read the OCC state -> Attempt retry
     if (!stateWasRead)
     {
-#ifdef READ_OCC_SENSORS
         if (sensorsValid)
         {
             sensorsValid = false;
             manager.setSensorValueToNaN(instance);
         }
-#endif
 
         // If not able to read, OCC may be offline
         if (openErrno != lastOccReadStatus)
diff --git a/occ_status.hpp b/occ_status.hpp
index f7ea02c..606c65e 100644
--- a/occ_status.hpp
+++ b/occ_status.hpp
@@ -1,7 +1,6 @@
 #pragma once
 #include "config.h"
 
-#include "i2c_occ.hpp"
 #include "occ_command.hpp"
 #include "occ_device.hpp"
 #include "occ_events.hpp"
@@ -13,10 +12,8 @@
 #include <org/open_power/OCC/Status/server.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/object.hpp>
-#ifdef POWER10
 #include <sdeventplus/event.hpp>
 #include <sdeventplus/utility/timer.hpp>
-#endif
 #include <xyz/openbmc_project/Control/Power/Throttle/server.hpp>
 
 #include <functional>
@@ -86,35 +83,17 @@
      *                             protocol
      */
     Status(EventPtr& event, const char* path, Manager& managerRef,
-#ifdef POWER10
            std::unique_ptr<powermode::PowerMode>& powerModeRef,
-#endif
-           std::function<void(instanceID, bool)> callBack = nullptr
-#ifdef PLDM
-           ,
-           std::function<void(instanceID)> resetCallBack = nullptr
-#endif
-           ) :
-
+           std::function<void(instanceID, bool)> callBack = nullptr,
+           std::function<void(instanceID)> resetCallBack = nullptr) :
         Interface(utils::getBus(), getDbusPath(path).c_str(),
                   Interface::action::defer_emit),
         path(path), managerCallBack(callBack), instance(getInstance(path)),
-        manager(managerRef),
-#ifdef POWER10
-        pmode(powerModeRef),
-#endif
+        manager(managerRef), pmode(powerModeRef),
         device(event,
-#ifdef I2C_OCC
-               fs::path(DEV_PATH) / i2c_occ::getI2cDeviceName(path),
-#else
                fs::path(DEV_PATH) /
                    fs::path(sysfsName + "." + std::to_string(instance + 1)),
-#endif
-               managerRef, *this,
-#ifdef POWER10
-               powerModeRef,
-#endif
-               instance),
+               managerRef, *this, powerModeRef, instance),
         hostControlSignal(
             utils::getBus(),
             sdbusRule::type::signal() + sdbusRule::member("CommandComplete") +
@@ -126,19 +105,12 @@
                       std::placeholders::_1)),
         occCmd(instance, (fs::path(OCC_CONTROL_ROOT) /
                           (std::string(OCC_NAME) + std::to_string(instance)))
-                             .c_str())
-#ifdef POWER10
-        ,
+                             .c_str()),
         sdpEvent(sdeventplus::Event::get_default()),
         safeStateDelayTimer(
             sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>(
-                sdpEvent, std::bind(&Status::safeStateDelayExpired, this)))
-#endif
-
-#ifdef PLDM
-        ,
+                sdpEvent, std::bind(&Status::safeStateDelayExpired, this))),
         resetCallBack(resetCallBack)
-#endif
     {
         // Announce that we are ready
         this->emit_object_added();
@@ -197,7 +169,6 @@
      */
     void deviceError(Error::Descriptor d = Error::Descriptor());
 
-#ifdef POWER10
     /** @brief Handle additional tasks when the OCCs reach active state */
     void occsWentActive();
 
@@ -229,7 +200,6 @@
     {
         return pldmSensorStateReceived;
     }
-#endif // POWER10
 
     /** @brief Return the HWMON path for this OCC
      *
@@ -287,10 +257,8 @@
     /** @brief The Trigger to indicate OCC State is valid or not. */
     bool stateValid = false;
 
-#ifdef POWER10
     /** @brief The Trigger to indicate OCC sensors are valid or not. */
     bool sensorsValid = false;
-#endif
 
     /** @brief OCC instance to Sensor definitions mapping */
     static const std::map<instanceID, sensorDefs> sensorMap;
@@ -298,10 +266,8 @@
     /** @brief OCC manager object */
     const Manager& manager;
 
-#ifdef POWER10
     /** @brief OCC PowerMode object */
     std::unique_ptr<powermode::PowerMode>& pmode;
-#endif
 
     /** @brief OCC device object to do bind and unbind */
     Device device;
@@ -317,10 +283,8 @@
     /** @brief Command object to send commands to the OCC */
     OccCommand occCmd;
 
-#ifdef POWER10
     /** @brief timer event */
     sdeventplus::Event sdpEvent;
-#endif
 
     /** @brief hwmon path for this OCC */
     fs::path hwmonPath;
@@ -347,7 +311,6 @@
         return (path.empty() ? 0 : path.back() - '0');
     }
 
-#ifdef POWER10
     /**
      * @brief Timer that is started when OCC is detected to be in safe mode
      */
@@ -358,7 +321,6 @@
      * safe mode. Called to verify and then disable and reset the OCCs.
      */
     void safeStateDelayExpired();
-#endif // POWER10
 
     /** @brief Callback for timer that is started when OCC state
      * was not able to be read. Called to attempt another read when needed.
@@ -388,9 +350,8 @@
 
         return estimatedPath;
     }
-#ifdef PLDM
+
     std::function<void(instanceID)> resetCallBack = nullptr;
-#endif
 
     /** @brief Current throttle reason(s) for this processor */
     uint8_t throttleCause = THROTTLED_NONE;
diff --git a/powermode.hpp b/powermode.hpp
index 715499b..638c353 100644
--- a/powermode.hpp
+++ b/powermode.hpp
@@ -2,7 +2,6 @@
 
 #include "config.h"
 
-#ifdef POWER10
 #include "occ_command.hpp"
 
 #include <cereal/archives/json.hpp>
@@ -539,4 +538,3 @@
 } // namespace occ
 
 } // namespace open_power
-#endif
diff --git a/test/TestI2cOcc.cpp b/test/TestI2cOcc.cpp
deleted file mode 100644
index c0fe979..0000000
--- a/test/TestI2cOcc.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-#include "i2c_occ.hpp"
-
-#include <filesystem>
-#include <fstream>
-#include <string>
-
-#include <gtest/gtest.h>
-
-#ifdef I2C_OCC
-namespace i2c_occ
-{
-
-namespace fs = std::filesystem;
-
-using namespace std::string_literals;
-const auto STR_4_0050 = "4-0050"s;
-const auto STR_5_0051 = "5-0051"s;
-const auto STR_6_0056 = "6-0056"s;
-const auto STR_7_0057 = "7-0057"s;
-
-const auto TEST_DIR = "test-dir/"s;
-const auto BASE = TEST_DIR + "sys/bus/i2c/devices/";
-const auto I2C_0 = BASE + "i2c-0";
-const auto I2C_1 = BASE + "i2c-1";
-const auto I2C_2 = BASE + "i2c-2";
-const auto I2C_0_0068 = BASE + "0-0068";
-const auto I2C_4_0050 = BASE + STR_4_0050;
-const auto I2C_5_0051 = BASE + STR_5_0051;
-const auto I2C_6_0056 = BASE + STR_6_0056;
-const auto I2C_7_0057 = BASE + STR_7_0057;
-const auto NAME = "/name";
-const auto OCC_MASTER_NAME = "/occ_master";
-const auto P8_OCC_HWMON = "p8-occ-hwmon";
-
-const auto OTHER_STRING = "SomeOtherString123"s;
-
-class TestUtilGetOccHwmonDevices : public testing::Test
-{
-  public:
-    TestUtilGetOccHwmonDevices()
-    {
-        // Prepare env for test case
-        fs::create_directories(I2C_0);
-        fs::create_directories(I2C_1);
-        fs::create_directories(I2C_2);
-        fs::create_directories(I2C_0_0068);
-        fs::create_directories(I2C_4_0050);
-        fs::create_directories(I2C_5_0051);
-        fs::create_directories(I2C_6_0056);
-        fs::create_directories(I2C_7_0057);
-
-        std::ofstream ofs;
-
-        ofs.open(I2C_0 + NAME); // i2c-0 has empty name
-        ofs.close();
-
-        ofs.open(I2C_1 + NAME);
-        ofs << "some text\n"; // i2c-1/name has some text
-        ofs.close();
-
-        ofs.open(I2C_2 + NAME);
-        ofs << "Aspped i2c"; // i2c-2/name is aspeed i2c
-        ofs.close();
-
-        ofs.open(I2C_0_0068 + NAME);
-        ofs << "other text"; // 0-0068/name is has other text
-        ofs.close();
-
-        ofs.open(I2C_4_0050 + NAME);
-        ofs << "p8-occ-hwmon\n"; // 4-0050/name is p8-occ-hwmon
-        ofs.close();
-
-        ofs.open(I2C_4_0050 + OCC_MASTER_NAME);
-        ofs << "0\n"; // Make 4-0050 the slave occ
-        ofs.close();
-
-        ofs.open(I2C_5_0051 + NAME);
-        ofs << "p8-occ-hwmon\n"; // 5-0051/name is p8-occ-hwmon
-        ofs.close();
-
-        ofs.open(I2C_5_0051 + OCC_MASTER_NAME);
-        ofs << "0\n"; // Make 5-0051 the slave occ
-        ofs.close();
-
-        ofs.open(I2C_6_0056 + NAME);
-        ofs << "p8-occ-hwmon\n"; // 6-0056/name is p8-occ-hwmon
-        ofs.close();
-
-        ofs.open(I2C_6_0056 + OCC_MASTER_NAME);
-        ofs << "1\n"; // Make 6-0056 the master occ
-        ofs.close();
-
-        ofs.open(I2C_7_0057 + NAME);
-        ofs << "p8-occ-hwmon\n"; // 7-0057/name is p8-occ-hwmon
-        ofs.close();
-    }
-
-    ~TestUtilGetOccHwmonDevices()
-    {
-        // Cleanup test env
-        fs::remove_all(TEST_DIR);
-    }
-};
-
-TEST_F(TestUtilGetOccHwmonDevices, getDevicesOK)
-{
-    // With test env, it shall find all the 4 p8-occ-hwmon devices
-    auto ret = getOccHwmonDevices(BASE.c_str());
-    EXPECT_EQ(4u, ret.size());
-    // The first one shall be master occ
-    EXPECT_EQ(STR_6_0056, ret[0]);
-    // The left is sorted
-    EXPECT_EQ(STR_4_0050, ret[1]);
-    EXPECT_EQ(STR_5_0051, ret[2]);
-    EXPECT_EQ(STR_7_0057, ret[3]);
-}
-
-TEST_F(TestUtilGetOccHwmonDevices, getDevicesValidDirNoDevices)
-{
-    // Giving a dir without valid devices,
-    // it shall return an empty vector
-    auto ret = getOccHwmonDevices(TEST_DIR.c_str());
-    EXPECT_TRUE(ret.empty());
-}
-
-TEST_F(TestUtilGetOccHwmonDevices, getDevicesDirNotExist)
-{
-    // Giving a dir that does not exist,
-    // it shall return an empty vector
-    auto ret = getOccHwmonDevices((TEST_DIR + "not-exist").c_str());
-    EXPECT_TRUE(ret.empty());
-}
-
-TEST(TestI2cDbusNames, i2cToDbus)
-{
-    // It shall convert 4-0050 to 4_0050
-    auto str = STR_4_0050;
-    i2cToDbus(str);
-    EXPECT_EQ("4_0050", str);
-
-    // It shall not modify for other strings without '-'
-    str = OTHER_STRING;
-    i2cToDbus(str);
-    EXPECT_EQ(OTHER_STRING, str);
-}
-
-TEST(TestI2cDbusNames, dbusToI2c)
-{
-    // It shall convert 4_0050 to 4-0050
-    auto str = "4_0050"s;
-    dbusToI2c(str);
-    EXPECT_EQ(STR_4_0050, str);
-
-    // It shall not modify for other strings without '-'
-    str = OTHER_STRING;
-    dbusToI2c(str);
-    EXPECT_EQ(OTHER_STRING, str);
-}
-
-TEST(TestI2cDbusNames, getI2cDeviceName)
-{
-    auto path = "/org/open_power/control/occ_4_0050"s;
-    auto name = getI2cDeviceName(path);
-    EXPECT_EQ(STR_4_0050, name);
-
-    // With invalid occ path, the code shall assert
-    path = "/org/open_power/control/SomeInvalidPath"s;
-    EXPECT_DEATH(getI2cDeviceName(path), "");
-}
-
-} // namespace i2c_occ
-
-#endif // I2C_OCC
diff --git a/test/error_files_tests.cpp b/test/error_files_tests.cpp
index d83bfe1..ef895fa 100644
--- a/test/error_files_tests.cpp
+++ b/test/error_files_tests.cpp
@@ -25,12 +25,7 @@
   public:
     ErrorFiles() :
         rc(sd_event_default(&event)), pEvent(event), manager(pEvent),
-        status(pEvent, "/dummy1", manager
-#ifdef POWER10
-               ,
-               powerMode
-#endif
-        )
+        status(pEvent, "/dummy1", manager, powerMode)
     {
         EXPECT_GE(rc, 0);
         event = nullptr;
@@ -80,9 +75,7 @@
     sd_event* event;
     int rc;
     open_power::occ::EventPtr pEvent;
-#ifdef POWER10
     std::unique_ptr<powermode::PowerMode> powerMode = nullptr;
-#endif
 
     Manager manager;
     Status status;
@@ -94,24 +87,8 @@
 
 TEST_F(ErrorFiles, AddDeviceErrorWatch)
 {
-    Device occDevice(pEvent, devicePath, manager, status
-#ifdef POWER10
-                     ,
-                     powerMode
-#endif
-    );
+    Device occDevice(pEvent, devicePath, manager, status, powerMode);
 
     occDevice.addErrorWatch(false);
     occDevice.removeErrorWatch();
 }
-
-// legacy OCC devices not supported on POWER10
-#ifndef POWER10
-TEST_F(ErrorFiles, AddLegacyDeviceErrorWatch)
-{
-    Device legacyOccDevice(pEvent, legacyDevicePath, manager, status);
-
-    legacyOccDevice.addErrorWatch(false);
-    legacyOccDevice.removeErrorWatch();
-}
-#endif
diff --git a/test/meson.build b/test/meson.build
index f54bbcc..d9cc977 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -29,26 +29,14 @@
     '../occ_presence.cpp',
     '../occ_command.cpp',
     '../occ_dbus.cpp',
+    '../pldm.cpp',
     '../powercap.cpp',
-    '../i2c_occ.cpp',
+    '../powermode.cpp',
     '../utils.cpp',
     occ_sensor_hpp,
 ]
 
-if get_option('with-host-communication-protocol') == 'pldm'
-    test_sources += ['../pldm.cpp']
-endif
-
-if get_option('power10-support').allowed()
-    test_sources += ['../powermode.cpp']
-endif
-
-tests = [
-    'error_files_tests.cpp',
-    'occ_dbus_test.cpp',
-    'TestI2cOcc.cpp',
-    'utest.cpp',
-]
+tests = ['error_files_tests.cpp', 'occ_dbus_test.cpp', 'utest.cpp']
 
 pthread_dep = dependency('threads')
 
diff --git a/test/utest.cpp b/test/utest.cpp
index f06ad7b..92a5fd5 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -16,12 +16,7 @@
   public:
     VerifyOccInput() :
         rc(sd_event_default(&event)), eventP(event), manager(eventP),
-        occStatus(eventP, "/test/path/occ1", manager
-#ifdef POWER10
-                  ,
-                  powerMode
-#endif
-                  ),
+        occStatus(eventP, "/test/path/occ1", manager, powerMode),
         pcap(occStatus)
     {
         EXPECT_GE(rc, 0);
@@ -35,9 +30,9 @@
 
     Manager manager;
     Status occStatus;
-#ifdef POWER10
+
     std::unique_ptr<powermode::PowerMode> powerMode = nullptr;
-#endif
+
     powercap::PowerCap pcap;
 };