summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSam Mendoza-Jonas <sam@mendozajonas.com>2016-01-29 15:16:34 +1100
committerSam Mendoza-Jonas <sam@mendozajonas.com>2016-02-10 16:21:08 +1100
commitd531395a3ff60730238854b127925978f6eab289 (patch)
treee2dcc3ec892e43c0a3a2f5f03020a85f7fda7a31 /lib
parentd974c3c39237c8e94bb3a51d3511d18dea01043e (diff)
downloadtalos-petitboot-d531395a3ff60730238854b127925978f6eab289.tar.gz
talos-petitboot-d531395a3ff60730238854b127925978f6eab289.zip
Retrieve BMC version info via IPMI
On BMC machines the "Get Device ID" and "Get BMC Golden Side Version" IPMI commands are available. If possible retrieve some interesting version numbers and display them in the System Information screen. Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/pb-protocol/pb-protocol.c40
-rw-r--r--lib/types/types.h4
2 files changed, 43 insertions, 1 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index e99ce86..3953ee1 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -232,6 +232,13 @@ int pb_protocol_system_info_len(const struct system_info *sysinfo)
for (i = 0; i < sysinfo->n_other; i++)
len += 4 + optional_strlen(sysinfo->platform_other[i]);
+ len += 4;
+ for (i = 0; i < sysinfo->n_bmc_current; i++)
+ len += 4 + optional_strlen(sysinfo->bmc_current[i]);
+ len += 4;
+ for (i = 0; i < sysinfo->n_bmc_golden; i++)
+ len += 4 + optional_strlen(sysinfo->bmc_golden[i]);
+
for (i = 0; i < sysinfo->n_interfaces; i++) {
struct interface_info *if_info = sysinfo->interfaces[i];
len += 4 + if_info->hwaddr_size +
@@ -412,6 +419,16 @@ int pb_protocol_serialise_system_info(const struct system_info *sysinfo,
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_bmc_current);
+ pos += sizeof(uint32_t);
+ for (i = 0; i < sysinfo->n_bmc_current; i++)
+ pos += pb_protocol_serialise_string(pos, sysinfo->bmc_current[i]);
+
+ *(uint32_t *)pos = __cpu_to_be32(sysinfo->n_bmc_golden);
+ pos += sizeof(uint32_t);
+ for (i = 0; i < sysinfo->n_bmc_golden; i++)
+ pos += pb_protocol_serialise_string(pos, sysinfo->bmc_golden[i]);
+
*(uint32_t *)pos = __cpu_to_be32(sysinfo->n_interfaces);
pos += sizeof(uint32_t);
@@ -827,7 +844,7 @@ 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 */
+ /* Platform version strings for openpower platforms */
if (read_u32(&pos, &len, &sysinfo->n_current))
goto out;
sysinfo->platform_current = talloc_array(sysinfo, char *,
@@ -848,6 +865,27 @@ int pb_protocol_deserialise_system_info(struct system_info *sysinfo,
sysinfo->platform_other[i] = talloc_strdup(sysinfo, tmp);
}
+ /* BMC version strings for openpower platforms */
+ if (read_u32(&pos, &len, &sysinfo->n_bmc_current))
+ goto out;
+ sysinfo->bmc_current = talloc_array(sysinfo, char *,
+ sysinfo->n_bmc_current);
+ for (i = 0; i < sysinfo->n_bmc_current; i++) {
+ if (read_string(sysinfo, &pos, &len, &tmp))
+ goto out;
+ sysinfo->bmc_current[i] = talloc_strdup(sysinfo, tmp);
+ }
+
+ if (read_u32(&pos, &len, &sysinfo->n_bmc_golden))
+ goto out;
+ sysinfo->bmc_golden = talloc_array(sysinfo, char *,
+ sysinfo->n_bmc_golden);
+ for (i = 0; i < sysinfo->n_bmc_golden; i++) {
+ if (read_string(sysinfo, &pos, &len, &tmp))
+ goto out;
+ sysinfo->bmc_golden[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 db4d892..63c1c7c 100644
--- a/lib/types/types.h
+++ b/lib/types/types.h
@@ -97,6 +97,10 @@ struct system_info {
char **platform_other;
unsigned int n_current;
unsigned int n_other;
+ char **bmc_current;
+ char **bmc_golden;
+ unsigned int n_bmc_current;
+ unsigned int n_bmc_golden;
uint8_t *bmc_mac;
struct interface_info **interfaces;
unsigned int n_interfaces;
OpenPOWER on IntegriCloud