discover/platform-powerpc: Use IPMI on BMC-based machines only
diff mbox

Message ID 20160713045642.28709-1-sam@mendozajonas.com
State Accepted
Headers show

Commit Message

Samuel Mendoza-Jonas July 13, 2016, 4:56 a.m. UTC
With a kernel that has IPMI support Petitboot will try to use direct
IPMI, however on FSP machines this is not fully functional. Use direct
IPMI only on BMC-based machines, and use sysparams otherwise.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 discover/platform-powerpc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Patch
diff mbox

diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index eb54c6d..8fca5bd 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -1348,6 +1348,7 @@  static bool probe(struct platform *p, void *ctx)
 {
 	struct platform_powerpc *platform;
 	struct stat statbuf;
+	bool bmc_present;
 	int rc;
 
 	/* we need a device tree */
@@ -1363,7 +1364,9 @@  static bool probe(struct platform *p, void *ctx)
 
 	p->platform_data = platform;
 
-	if (ipmi_present()) {
+	bmc_present = stat("/proc/device-tree/bmc", &statbuf) == 0;
+
+	if (ipmi_present() && bmc_present) {
 		pb_debug("platform: using direct IPMI for IPMI paramters\n");
 		platform->ipmi = ipmi_open(platform);
 		platform->get_ipmi_bootdev = get_ipmi_bootdev_ipmi;
@@ -1378,8 +1381,7 @@  static bool probe(struct platform *p, void *ctx)
 		pb_log("platform: no IPMI parameter support\n");
 	}
 
-	rc = stat("/proc/device-tree/bmc", &statbuf);
-	if (!rc)
+	if (bmc_present)
 		platform->get_platform_versions = hostboot_load_versions;
 
 	return true;