Useful for identifying the initial BMC traffic on the network.
Signed-off-by: Jack Miller <jack@codezen.org>
enum ipmi_netfn {
IPMI_NETFN_CHASSIS = 0x0,
IPMI_NETFN_SE = 0x04,
+ IPMI_NETFN_TRANSPORT = 0x0c,
};
enum ipmi_cmd {
IPMI_CMD_CHASSIS_SET_SYSTEM_BOOT_OPTIONS = 0x08,
IPMI_CMD_CHASSIS_GET_SYSTEM_BOOT_OPTIONS = 0x09,
IPMI_CMD_SENSOR_SET = 0x30,
+ IPMI_CMD_TRANSPORT_GET_LAN_PARAMS = 0x02,
};
enum ipmi_sensor_ids {
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);
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;
}
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;
4 + optional_strlen(bd_info->mountpoint);
}
+ /* BMC MAC */
+ len += HWADDR_SIZE;
+
return len;
}
pos += pb_protocol_serialise_string(pos, bd_info->mountpoint);
}
+ memcpy(pos, sysinfo->bmc_mac, HWADDR_SIZE);
+ pos += HWADDR_SIZE;
+
assert(pos <= buf + buf_len);
(void)buf_len;
sysinfo->blockdevs[i] = bd_info;
}
- rc = 0;
+ for (i = 0; i < HWADDR_SIZE; i++) {
+ if (pos[i] != 0) {
+ sysinfo->bmc_mac = talloc_memdup(sysinfo, pos, HWADDR_SIZE);
+ break;
+ }
+ }
+
+ pos += HWADDR_SIZE;
+ len -= HWADDR_SIZE;
+
+ rc = 0;
out:
return rc;
}
struct system_info {
char *type;
char *identifier;
+ uint8_t *bmc_mac;
struct interface_info **interfaces;
unsigned int n_interfaces;
struct blockdev_info **blockdevs;
static void sysinfo_screen_populate(struct sysinfo_screen *screen,
const struct system_info *sysinfo)
{
+ char macbuf[32];
unsigned int i;
text_screen_clear(&screen->text_scr);
line(NULL);
}
+ if (sysinfo->bmc_mac) {
+ mac_str(sysinfo->bmc_mac, HWADDR_SIZE, macbuf, sizeof(macbuf));
+ line(_("Management (BMC) interface"));
+ line(_(" MAC: %s"), macbuf);
+ }
+
if (sysinfo->n_interfaces) {
line(NULL);
line(_("Network interfaces"));
for (i = 0; i < sysinfo->n_interfaces; i++) {
struct interface_info *info = sysinfo->interfaces[i];
- char macbuf[32];
if_info_mac_str(info, macbuf, sizeof(macbuf));