Add compile flag for chassis system reset

Not every platform has complete chassis reset supported, so added
this feature under a compile flag, one can enable this flag to use
this feature.

Tested: Verified this by enabling CHASSIS_SYSTEM_RESET compile
otions via bbappend and checked the system reset interface
/xyz/openbmc_project/state/chassis_system0 created in dbus node

Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
Change-Id: Ia834f0af309c0cd357f8e988794aa10f9b78248c
diff --git a/power-control-x86/CMakeLists.txt b/power-control-x86/CMakeLists.txt
index 252d619..2a94f78 100644
--- a/power-control-x86/CMakeLists.txt
+++ b/power-control-x86/CMakeLists.txt
@@ -3,6 +3,13 @@
 set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
+option (
+    CHASSIS_SYSTEM_RESET
+    "Enable chassis system power reset to allow removing
+     power and restoring back"
+    OFF
+)
+
 add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
 add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
 add_definitions(-DBOOST_ALL_NO_LIB)
@@ -20,6 +27,11 @@
 target_link_libraries(${PROJECT_NAME} systemd)
 target_link_libraries(${PROJECT_NAME} sdbusplus)
 
+target_compile_definitions (
+    ${PROJECT_NAME} PRIVATE $<$<BOOL:${CHASSIS_SYSTEM_RESET}>:
+    -DCHASSIS_SYSTEM_RESET>
+)
+
 install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 # Temporarily disable rtti
diff --git a/power-control-x86/src/power_control.cpp b/power-control-x86/src/power_control.cpp
index 30844d3..2f04885 100644
--- a/power-control-x86/src/power_control.cpp
+++ b/power-control-x86/src/power_control.cpp
@@ -55,7 +55,9 @@
 
 static std::shared_ptr<sdbusplus::asio::dbus_interface> hostIface;
 static std::shared_ptr<sdbusplus::asio::dbus_interface> chassisIface;
+#ifdef CHASSIS_SYSTEM_RESET
 static std::shared_ptr<sdbusplus::asio::dbus_interface> chassisSysIface;
+#endif
 static std::shared_ptr<sdbusplus::asio::dbus_interface> powerButtonIface;
 static std::shared_ptr<sdbusplus::asio::dbus_interface> resetButtonIface;
 static std::shared_ptr<sdbusplus::asio::dbus_interface> nmiButtonIface;
@@ -1818,6 +1820,7 @@
         });
 }
 
+#ifdef CHASSIS_SYSTEM_RESET
 static constexpr auto systemdBusname = "org.freedesktop.systemd1";
 static constexpr auto systemdPath = "/org/freedesktop/systemd1";
 static constexpr auto systemdInterface = "org.freedesktop.systemd1.Manager";
@@ -1837,6 +1840,7 @@
         systemdBusname, systemdPath, systemdInterface, "StartUnit",
         systemTargetName, "replace");
 }
+#endif
 
 static void nmiSetEnablePorperty(bool value)
 {
@@ -2429,6 +2433,7 @@
 
     power_control::chassisIface->initialize();
 
+#ifdef CHASSIS_SYSTEM_RESET
     // Chassis System Service
     sdbusplus::asio::object_server chassisSysServer =
         sdbusplus::asio::object_server(power_control::conn);
@@ -2465,6 +2470,7 @@
         "LastStateChangeTime", power_control::getCurrentTimeMs());
 
     power_control::chassisSysIface->initialize();
+#endif
 
     // Buttons Service
     sdbusplus::asio::object_server buttonsServer =