"petitboot,debug?",
"petitboot,write?",
"petitboot,snapshots?",
+ "petitboot,tty",
NULL,
};
val = get_param(platform, "petitboot,snapshots?");
if (val)
config->disable_snapshots = !strcmp(val, "false");
+
+ val = get_param(platform, "petitboot,tty");
+ if (val)
+ config->boot_tty = talloc_strdup(config, val);
}
static char *iface_config_str(void *ctx, struct interface_config *config)
val = config->allow_writes ? "true" : "false";
update_string_config(platform, "petitboot,write?", val);
+ val = config->boot_tty ?: "";
+ update_string_config(platform, "petitboot,tty", val);
+
update_network_config(platform, config);
update_bootdev_config(platform, config);
/* check for valid flags */
if (!(resp[3] & 0x80)) {
pb_debug("platform: boot flags are invalid, ignoring\n");
- return 0;
+ return -1;
}
*persistent = resp[3] & 0x40;
bcd += 10 * (resp[4] >> 4);
memcpy(&aux_version, &resp[12], sizeof(aux_version));
info->bmc_current[2] = talloc_asprintf(info,
- "Firmware version: %u.%02u.%u",
+ "Firmware version: %u.%02u.%05u",
resp[3], bcd, aux_version);
bcd = resp[5] & 0x0f;
bcd += 10 * (resp[5] >> 4);
}
}
+static void get_active_consoles(struct config *config)
+{
+ struct stat sbuf;
+ char *fsp_prop = NULL;
+
+ config->n_tty = 2;
+ config->tty_list = talloc_array(config, char *, config->n_tty);
+ if (!config->tty_list)
+ goto err;
+
+ config->tty_list[0] = talloc_asprintf(config->tty_list,
+ "/dev/hvc0 [IPMI / Serial]");
+ config->tty_list[1] = talloc_asprintf(config->tty_list,
+ "/dev/tty1 [VGA]");
+
+ fsp_prop = talloc_asprintf(config, "%sfsps", devtree_dir);
+ if (stat(fsp_prop, &sbuf) == 0) {
+ /* FSP based machines also have a separate serial console */
+ config->tty_list = talloc_realloc(config, config->tty_list,
+ char *, config->n_tty + 1);
+ if (!config->tty_list)
+ goto err;
+ config->tty_list[config->n_tty++] = talloc_asprintf(
+ config->tty_list,
+ "/dev/hvc1 [Serial]");
+ }
+
+ return;
+err:
+ config->n_tty = 0;
+ pb_log("Failed to allocate memory for tty_list\n");
+}
+
static int load_config(struct platform *p, struct config *config)
{
struct platform_powerpc *platform = to_platform_powerpc(p);
if (platform->get_ipmi_bootdev) {
bool bootdev_persistent;
- uint8_t bootdev;
+ uint8_t bootdev = IPMI_BOOTDEV_INVALID;
rc = platform->get_ipmi_bootdev(platform, &bootdev,
&bootdev_persistent);
if (!rc && ipmi_bootdev_is_valid(bootdev)) {
if (platform->ipmi)
get_ipmi_network_override(platform, config);
+ get_active_consoles(config);
+
return 0;
}
{
struct platform_powerpc *platform;
struct stat statbuf;
+ bool bmc_present;
int rc;
/* we need a device tree */
p->platform_data = platform;
- if (ipmi_present()) {
+ bmc_present = stat("/proc/device-tree/bmc", &statbuf) == 0;
+
+ if (ipmi_present() && bmc_present) {
pb_debug("platform: using direct IPMI for IPMI paramters\n");
platform->ipmi = ipmi_open(platform);
platform->get_ipmi_bootdev = get_ipmi_bootdev_ipmi;
pb_log("platform: no IPMI parameter support\n");
}
- rc = stat("/proc/device-tree/bmc", &statbuf);
- if (!rc)
+ if (bmc_present)
platform->get_platform_versions = hostboot_load_versions;
return true;