summaryrefslogtreecommitdiffstats
path: root/discover/platform-powerpc.c
diff options
context:
space:
mode:
authorJack Miller <jack@codezen.org>2015-12-09 12:03:24 -0600
committerJack Miller <jack@codezen.org>2015-12-15 12:33:48 -0600
commitcecbe53013e9ed85fd5b2429c230759d59025644 (patch)
tree06e2cab4d15486b4fbd663411228d80d4d71989c /discover/platform-powerpc.c
parent2983a122b09ace8de8be19a3e3566aa5deb09b81 (diff)
downloadpetitboot-cecbe53013e9ed85fd5b2429c230759d59025644.zip
petitboot-cecbe53013e9ed85fd5b2429c230759d59025644.tar.gz
Add BMC interface MAC to system info output
Useful for identifying the initial BMC traffic on the network. Signed-off-by: Jack Miller <jack@codezen.org>
Diffstat (limited to 'discover/platform-powerpc.c')
-rw-r--r--discover/platform-powerpc.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index 23e63c1..2807934 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -989,6 +989,31 @@ static int set_ipmi_os_boot_sensor(struct platform_powerpc *platform)
return 0;
}
+static void get_ipmi_bmc_mac(struct platform *p, uint8_t *buf)
+{
+ struct platform_powerpc *platform = p->platform_data;
+ uint16_t resp_len = 8;
+ uint8_t resp[8];
+ uint8_t req[] = { 0x1, 0x5, 0x0, 0x0 };
+ int i, rc;
+
+ rc = ipmi_transaction(platform->ipmi, IPMI_NETFN_TRANSPORT,
+ IPMI_CMD_TRANSPORT_GET_LAN_PARAMS,
+ req, sizeof(req),
+ resp, &resp_len,
+ ipmi_timeout);
+
+ pb_debug("BMC MAC resp [%d][%d]:\n", rc, resp_len);
+
+ if (rc == 0 && resp_len > 0) {
+ for (i = 2; i < resp_len; i++) {
+ pb_debug(" %x", resp[i]);
+ buf[i - 2] = resp[i];
+ }
+ pb_debug("\n");
+ }
+}
+
static int load_config(struct platform *p, struct config *config)
{
struct platform_powerpc *platform = to_platform_powerpc(p);
@@ -1057,6 +1082,10 @@ static int get_sysinfo(struct platform *p, struct system_info *sysinfo)
sysinfo->identifier = talloc_steal(sysinfo, buf);
talloc_free(filename);
+ sysinfo->bmc_mac = talloc_zero_size(sysinfo, HWADDR_SIZE);
+ if (platform->ipmi)
+ get_ipmi_bmc_mac(p, sysinfo->bmc_mac);
+
return 0;
}
@@ -1085,7 +1114,6 @@ static bool probe(struct platform *p, void *ctx)
platform->get_ipmi_bootdev = get_ipmi_bootdev_ipmi;
platform->clear_ipmi_bootdev = clear_ipmi_bootdev_ipmi;
platform->set_os_boot_sensor = set_ipmi_os_boot_sensor;
-
} else if (!stat(sysparams_dir, &statbuf)) {
pb_debug("platform: using sysparams for IPMI paramters\n");
platform->get_ipmi_bootdev = get_ipmi_bootdev_sysparams;
OpenPOWER on IntegriCloud