From d974c3c39237c8e94bb3a51d3511d18dea01043e Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Wed, 9 Dec 2015 10:32:41 +1100 Subject: Display VERSION partition info on BMC machines On supported platforms read the VERSION partition on startup and display the available versions strings in the System Information screen. This adds a skeleton hostboot.c to support possible additional BMC platform support. Signed-off-by: Sam Mendoza-Jonas --- discover/Makefile.am | 14 ++++++++++++++ discover/hostboot.c | 26 ++++++++++++++++++++++++++ discover/hostboot.h | 15 +++++++++++++++ discover/platform-powerpc.c | 10 ++++++++++ 4 files changed, 65 insertions(+) create mode 100644 discover/hostboot.c create mode 100644 discover/hostboot.h (limited to 'discover') 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 +#include +#include + +#include +#include +#include + +#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 + +#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 #include #include +#include +#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; } -- cgit v1.2.1