Set default package to build for POWER10
Set default package to build for p10 (since that is latest code)
Add PLDM as requirement for building p10
Default build will not enable PHAL support by default because of current
build limitations of the PHAL code.
The pldm Interface class will no longer be created in the Manager object
constructor to prevent issues with unit test.
Tested on Rainier
Change-Id: I8060e70b5656bd0d762d52bf9fdff62f8720a5c6
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/app.cpp b/app.cpp
index 291d9cf..5598177 100644
--- a/app.cpp
+++ b/app.cpp
@@ -46,6 +46,7 @@
sdbusplus::server::manager_t objManagerXyzInventory(
bus, "/xyz/openbmc_project/inventory");
open_power::occ::Manager mgr(eventP);
+ mgr.createPldmHandle();
// Claim the bus since all the house keeping is done now
bus.request_name(OCC_CONTROL_BUSNAME);
diff --git a/meson.build b/meson.build
index 9cfe9e1..1be93b4 100644
--- a/meson.build
+++ b/meson.build
@@ -42,6 +42,7 @@
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'
conf_data.set('PLDM_TRANSPORT_WITH_MCTP_DEMUX', 1)
@@ -124,21 +125,31 @@
if get_option('with-host-communication-protocol')=='pldm'
libpldm_dep = dependency('libpldm')
deps += [
- libpldm_dep,
- cxx.find_library('pdbg'),
- cxx.find_library('phal'),
+ libpldm_dep
]
sources += [
- 'pldm.cpp',
+ '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
+
yamldir = get_option('yamldir')
if yamldir == ''
yamldir = meson.project_source_root() / 'example'
diff --git a/meson.options b/meson.options
index ddb3246..d7eab4a 100644
--- a/meson.options
+++ b/meson.options
@@ -15,7 +15,7 @@
'read-occ-sensors',
type : 'feature',
description : 'Enable read occ sensors support',
- value: 'disabled'
+ value: 'enabled'
)
option(
@@ -37,14 +37,15 @@
option(
'with-host-communication-protocol',
type : 'string',
- description : 'To specify the host communication protocol'
+ description : 'To specify the host communication protocol',
+ value: 'pldm'
)
option(
'power10-support',
type : 'feature',
description : 'Enable Power10 support',
- value: 'disabled'
+ value: 'enabled'
)
option(
@@ -66,3 +67,11 @@
choices: ['mctp-demux', 'af-mctp'],
description: 'transport via af-mctp or mctp-demux'
)
+
+option(
+ 'phal-support',
+ type : 'feature',
+ description : 'Enable PHAL support',
+ value: 'disabled'
+)
+
diff --git a/occ_manager.cpp b/occ_manager.cpp
index 62a2b38..36cacb9 100644
--- a/occ_manager.cpp
+++ b/occ_manager.cpp
@@ -56,6 +56,20 @@
return data;
}
+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),
+ std::bind(std::mem_fn(&Manager::sbeHRESETResult), this,
+ std::placeholders::_1, std::placeholders::_2),
+ std::bind(std::mem_fn(&Manager::updateOccSafeMode), this,
+ std::placeholders::_1),
+ event);
+#endif
+}
+
// findAndCreateObjects():
// Takes care of getting the required objects created and
// finds the available devices/processors.
@@ -610,7 +624,9 @@
lg2::info("SBE timeout, requesting HRESET (OCC{INST})", "INST",
instance);
+#ifdef PHAL_SUPPORT
setSBEState(instance, SBE_STATE_NOT_USABLE);
+#endif
pldmHandle->sendHRESET(instance);
}
@@ -703,11 +719,14 @@
{
lg2::info("HRESET succeeded (OCC{INST})", "INST", instance);
+#ifdef PHAL_SUPPORT
setSBEState(instance, SBE_STATE_BOOTED);
+#endif
return;
}
+#ifdef PHAL_SUPPORT
setSBEState(instance, SBE_STATE_FAILED);
if (sbeCanDump(instance))
@@ -759,12 +778,14 @@
}
}
}
+#endif
// SBE Reset failed, try PM Complex reset
lg2::error("sbeHRESETResult: Forcing PM Complex reset");
resetOccRequest(instance);
}
+#ifdef PHAL_SUPPORT
bool Manager::sbeCanDump(unsigned int instance)
{
struct pdbg_target* proc = getPdbgTarget(instance);
@@ -844,6 +865,7 @@
return nullptr;
}
#endif
+#endif
void Manager::pollerTimerExpired()
{
diff --git a/occ_manager.hpp b/occ_manager.hpp
index 0c573b6..640f21e 100644
--- a/occ_manager.hpp
+++ b/occ_manager.hpp
@@ -5,8 +5,10 @@
#ifdef PLDM
#include "pldm.hpp"
+#ifdef PHAL_SUPPORT
#include <libphal.H>
#endif
+#endif
#include "powercap.hpp"
#include "utils.hpp"
#ifdef POWER10
@@ -88,17 +90,6 @@
sdbusRule::argN(0, AMBIENT_INTERFACE) +
sdbusRule::interface("org.freedesktop.DBus.Properties"),
std::bind(&Manager::ambientCallback, this, std::placeholders::_1))
-#ifdef PLDM
- ,
- pldmHandle(std::make_unique<pldm::Interface>(
- std::bind(std::mem_fn(&Manager::updateOCCActive), this,
- std::placeholders::_1, std::placeholders::_2),
- std::bind(std::mem_fn(&Manager::sbeHRESETResult), this,
- std::placeholders::_1, std::placeholders::_2),
- std::bind(std::mem_fn(&Manager::updateOccSafeMode), this,
- std::placeholders::_1),
- event))
-#endif
#ifdef POWER10
,
discoverTimer(
@@ -127,6 +118,8 @@
readAltitude();
}
+ void createPldmHandle();
+
/** @brief Return the number of bound OCCs */
inline auto getNumOCCs() const
{
@@ -305,6 +298,7 @@
*/
void sbeHRESETResult(instanceID instance, bool success);
+#ifdef PHAL_SUPPORT
/** @brief Helper function to check whether an SBE dump should be collected
* now.
*
@@ -332,6 +326,7 @@
/** @brief Whether pdbg_targets_init has been called */
bool pdbgInitialized = false;
+#endif
std::unique_ptr<pldm::Interface> pldmHandle = nullptr;
#endif
diff --git a/test/error_files_tests.cpp b/test/error_files_tests.cpp
index 6f9f5de..d83bfe1 100644
--- a/test/error_files_tests.cpp
+++ b/test/error_files_tests.cpp
@@ -105,15 +105,13 @@
occDevice.removeErrorWatch();
}
+// legacy OCC devices not supported on POWER10
+#ifndef POWER10
TEST_F(ErrorFiles, AddLegacyDeviceErrorWatch)
{
- Device legacyOccDevice(pEvent, legacyDevicePath, manager, status
-#ifdef POWER10
- ,
- powerMode
-#endif
- );
+ Device legacyOccDevice(pEvent, legacyDevicePath, manager, status);
legacyOccDevice.addErrorWatch(false);
legacyOccDevice.removeErrorWatch();
}
+#endif