diff options
author | Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> | 2015-04-09 15:27:01 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> | 2015-05-05 15:03:59 +1000 |
commit | 7946d9b12cec7b49334fc0db6bc23087f2cea8ad (patch) | |
tree | 6afef8eccd70479abb053cc952b15ca1bd141907 /discover/platform-powerpc.c | |
parent | f497317729e7b2823a953f00c8301d192cda8824 (diff) | |
download | petitboot-7946d9b12cec7b49334fc0db6bc23087f2cea8ad.zip petitboot-7946d9b12cec7b49334fc0db6bc23087f2cea8ad.tar.gz |
discover: Clear default-boot-device when invalidated
Update the clear_ipmi_bootdev functions to optionally invalidate the
next- or default-boot-device for their respective machines.
If a client invalidates the ipmi_bootdev in the config, invalidate the
respective bootdev.
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Diffstat (limited to 'discover/platform-powerpc.c')
-rw-r--r-- | discover/platform-powerpc.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index d777bc0..b4f2a77 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -39,7 +39,8 @@ struct platform_powerpc { struct platform_powerpc *platform, uint8_t *bootdev, bool *persistent); int (*clear_ipmi_bootdev)( - struct platform_powerpc *platform); + struct platform_powerpc *platform, + bool persistent); int (*set_os_boot_sensor)( struct platform_powerpc *platform); }; @@ -691,6 +692,14 @@ static int update_config(struct platform_powerpc *platform, val = tmp = talloc_asprintf(platform, "%d", config->autoboot_timeout_sec); + if (config->ipmi_bootdev == IPMI_BOOTDEV_INVALID && + platform->clear_ipmi_bootdev) { + platform->clear_ipmi_bootdev(platform, + config->ipmi_bootdev_persistent); + config->ipmi_bootdev = IPMI_BOOTDEV_NONE; + config->ipmi_bootdev_persistent = false; + } + update_string_config(platform, "petitboot,timeout", val); if (tmp) talloc_free(tmp); @@ -806,10 +815,16 @@ static int write_bootdev_sysparam(const char *name, uint8_t val) } static int clear_ipmi_bootdev_sysparams( - struct platform_powerpc *platform __attribute__((unused))) + struct platform_powerpc *platform __attribute__((unused)), + bool persistent) { - /* invalidate next-boot-device setting */ - write_bootdev_sysparam("next-boot-device", 0xff); + if (persistent) { + /* invalidate default-boot-device setting */ + write_bootdev_sysparam("default-boot-device", 0xff); + } else { + /* invalidate next-boot-device setting */ + write_bootdev_sysparam("next-boot-device", 0xff); + } return 0; } @@ -836,7 +851,8 @@ static int get_ipmi_bootdev_sysparams( return 0; } -static int clear_ipmi_bootdev_ipmi(struct platform_powerpc *platform) +static int clear_ipmi_bootdev_ipmi(struct platform_powerpc *platform, + bool persistent __attribute__((unused))) { uint16_t resp_len; uint8_t resp[1]; @@ -1001,7 +1017,7 @@ static void pre_boot(struct platform *p, const struct config *config) struct platform_powerpc *platform = to_platform_powerpc(p); if (!config->ipmi_bootdev_persistent && platform->clear_ipmi_bootdev) - platform->clear_ipmi_bootdev(platform); + platform->clear_ipmi_bootdev(platform, false); if (platform->set_os_boot_sensor) platform->set_os_boot_sensor(platform); |