summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--discover/Makefile.am14
-rw-r--r--discover/hostboot.c26
-rw-r--r--discover/hostboot.h15
-rw-r--r--discover/platform-powerpc.c10
-rw-r--r--lib/pb-protocol/pb-protocol.c39
-rw-r--r--lib/types/types.h4
-rw-r--r--ui/ncurses/nc-sysinfo.c16
7 files changed, 124 insertions, 0 deletions
diff --git a/discover/Makefile.am b/discover/Makefile.am
index 1672035..f55f1cd 100644
--- a/discover/Makefile.am
+++ b/discover/Makefile.am
@@ -79,7 +79,21 @@ discover_platform_ro_SOURCES = \
discover/ipmi.h \
discover/dt.c \
discover/dt.h \
+ discover/hostboot.h \
discover/platform-powerpc.c
+discover_platform_ro_CPPFLAGS = \
+ $(AM_CPPFLAGS)
+
+if ENABLE_MTD
+discover_platform_ro_SOURCES += \
+ discover/hostboot.c
+
+discover_platform_ro_LDFLAGS = \
+ $(core_lib) \
+ $(UDEV_LIBS)
+
+endif
+
discover_platform_ro_LINK = \
$(LD) -r -o $@
diff --git a/discover/hostboot.c b/discover/hostboot.c
new file mode 100644
index 0000000..9a27b0f
--- /dev/null
+++ b/discover/hostboot.c
@@ -0,0 +1,26 @@
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <log/log.h>
+#include <talloc/talloc.h>
+#include <flash/flash.h>
+
+#include "hostboot.h"
+
+void hostboot_load_versions(struct system_info *info)
+{
+ int n = 0;
+
+ n = flash_parse_version(info, &info->platform_current, true);
+ if (n < 0)
+ pb_log("Failed to read platform versions for current side\n");
+ else
+ info->n_current = n;
+
+ n = flash_parse_version(info, &info->platform_other, false);
+ if (n < 0)
+ pb_log("Failed to read platform versions for other side\n");
+ else
+ info->n_other = n;
+}
diff --git a/discover/hostboot.h b/discover/hostboot.h
new file mode 100644
index 0000000..cb1e497
--- /dev/null
+++ b/discover/hostboot.h
@@ -0,0 +1,15 @@
+#ifndef HOSTBOOT_H
+#define HOSTBOOT_H
+
+#include "config.h"
+#include <types/types.h>
+
+#ifdef MTD_SUPPORT
+void hostboot_load_versions(struct system_info *info);
+#else
+static inline void hostboot_load_versions(struct system_info *info)
+{
+ (void)info;
+}
+#endif
+#endif /* HOSTBOOT_H */
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index 992123e..46f81d2 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -14,7 +14,9 @@
#include <list/list.h>
#include <log/log.h>
#include <process/process.h>
+#include <types/types.h>
+#include "hostboot.h"
#include "platform.h"
#include "ipmi.h"
#include "dt.h"
@@ -43,6 +45,7 @@ struct platform_powerpc {
bool persistent);
int (*set_os_boot_sensor)(
struct platform_powerpc *platform);
+ void (*get_platform_versions)(struct system_info *info);
};
static const char *known_params[] = {
@@ -1094,6 +1097,9 @@ static int get_sysinfo(struct platform *p, struct system_info *sysinfo)
if (platform->ipmi)
get_ipmi_bmc_mac(p, sysinfo->bmc_mac);
+ if (platform->get_platform_versions)
+ platform->get_platform_versions(sysinfo);
+
return 0;
}
@@ -1131,6 +1137,10 @@ 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)
+ platform->get_platform_versions = hostboot_load_versions;
+
return true;
}
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index 42506e2..e99ce86 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -225,6 +225,13 @@ int pb_protocol_system_info_len(const struct system_info *sysinfo)
4 + optional_strlen(sysinfo->identifier) +
4 + 4;
+ len += 4;
+ for (i = 0; i < sysinfo->n_current; i++)
+ len += 4 + optional_strlen(sysinfo->platform_current[i]);
+ len += 4;
+ for (i = 0; i < sysinfo->n_other; i++)
+ len += 4 + optional_strlen(sysinfo->platform_other[i]);
+
for (i = 0; i < sysinfo->n_interfaces; i++) {
struct interface_info *if_info = sysinfo->interfaces[i];
len += 4 + if_info->hwaddr_size +
@@ -395,6 +402,16 @@ int pb_protocol_serialise_system_info(const struct system_info *sysinfo,
pos += pb_protocol_serialise_string(pos, sysinfo->type);
pos += pb_protocol_serialise_string(pos, sysinfo->identifier);
+ *(uint32_t *)pos = __cpu_to_be32(sysinfo->n_current);
+ pos += sizeof(uint32_t);
+ for (i = 0; i < sysinfo->n_current; i++)
+ pos += pb_protocol_serialise_string(pos, sysinfo->platform_current[i]);
+
+ *(uint32_t *)pos = __cpu_to_be32(sysinfo->n_other);
+ pos += sizeof(uint32_t);
+ for (i = 0; i < sysinfo->n_other; i++)
+ pos += pb_protocol_serialise_string(pos, sysinfo->platform_other[i]);
+
*(uint32_t *)pos = __cpu_to_be32(sysinfo->n_interfaces);
pos += sizeof(uint32_t);
@@ -798,6 +815,7 @@ int pb_protocol_deserialise_system_info(struct system_info *sysinfo,
unsigned int len, i;
const char *pos;
int rc = -1;
+ char *tmp;
len = message->payload_len;
pos = message->payload;
@@ -809,6 +827,27 @@ int pb_protocol_deserialise_system_info(struct system_info *sysinfo,
if (read_string(sysinfo, &pos, &len, &sysinfo->identifier))
goto out;
+ /* versions strings for openpower platforms */
+ if (read_u32(&pos, &len, &sysinfo->n_current))
+ goto out;
+ sysinfo->platform_current = talloc_array(sysinfo, char *,
+ sysinfo->n_current);
+ for (i = 0; i < sysinfo->n_current; i++) {
+ if (read_string(sysinfo, &pos, &len, &tmp))
+ goto out;
+ sysinfo->platform_current[i] = talloc_strdup(sysinfo, tmp);
+ }
+
+ if (read_u32(&pos, &len, &sysinfo->n_other))
+ goto out;
+ sysinfo->platform_other = talloc_array(sysinfo, char *,
+ sysinfo->n_other);
+ for (i = 0; i < sysinfo->n_other; i++) {
+ if (read_string(sysinfo, &pos, &len, &tmp))
+ goto out;
+ sysinfo->platform_other[i] = talloc_strdup(sysinfo, tmp);
+ }
+
/* number of interfaces */
if (read_u32(&pos, &len, &sysinfo->n_interfaces))
goto out;
diff --git a/lib/types/types.h b/lib/types/types.h
index c2de8a5..db4d892 100644
--- a/lib/types/types.h
+++ b/lib/types/types.h
@@ -93,6 +93,10 @@ struct blockdev_info {
struct system_info {
char *type;
char *identifier;
+ char **platform_current;
+ char **platform_other;
+ unsigned int n_current;
+ unsigned int n_other;
uint8_t *bmc_mac;
struct interface_info **interfaces;
unsigned int n_interfaces;
diff --git a/ui/ncurses/nc-sysinfo.c b/ui/ncurses/nc-sysinfo.c
index 5ced871..c01b352 100644
--- a/ui/ncurses/nc-sysinfo.c
+++ b/ui/ncurses/nc-sysinfo.c
@@ -65,6 +65,22 @@ static void sysinfo_screen_populate(struct sysinfo_screen *screen,
line("%-12s %s", _("System type:"), sysinfo->type ?: "");
line("%-12s %s", _("System id:"), sysinfo->identifier ?: "");
+ if (sysinfo->n_current) {
+ line(NULL);
+ line("%s", _("Current platform versions:"));
+ for (i = 0; i < sysinfo->n_current; i++) {
+ line("\t%s", sysinfo->platform_current[i] ?: "");
+ }
+ }
+
+ if (sysinfo->n_other) {
+ line(NULL);
+ line("%s", _("Alternate platform versions:"));
+ for (i = 0; i < sysinfo->n_other; i++) {
+ line("\t%s", sysinfo->platform_other[i] ?: "");
+ }
+ }
+
if (sysinfo->n_blockdevs) {
line(NULL);
line(_("Storage devices"));
OpenPOWER on IntegriCloud