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 $@
--- /dev/null
+#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;
+}
--- /dev/null
+#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 */
#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"
bool persistent);
int (*set_os_boot_sensor)(
struct platform_powerpc *platform);
+ void (*get_platform_versions)(struct system_info *info);
};
static const char *known_params[] = {
if (platform->ipmi)
get_ipmi_bmc_mac(p, sysinfo->bmc_mac);
+ if (platform->get_platform_versions)
+ platform->get_platform_versions(sysinfo);
+
return 0;
}
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;
}
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 +
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);
unsigned int len, i;
const char *pos;
int rc = -1;
+ char *tmp;
len = message->payload_len;
pos = message->payload;
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;
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;
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"));