There is not a reliable mechanism to programmatically determine which BIOS settings require a reboot to be updated. The latest changes leverages “RequiredPhysicalPresence” reported value to set pending_reboot. Signed-off-by: Jorge Lopez <jorge.lopez2@xxxxxx> --- Based on the latest platform-drivers-x86.git/for-next --- drivers/platform/x86/hp/enum-attributes.c | 6 ++++ drivers/platform/x86/hp/int-attributes.c | 7 +++- drivers/platform/x86/hp/ordered-attributes.c | 6 ++++ .../platform/x86/hp/passwdobj-attributes.c | 9 ++++- .../platform/x86/hp/sureadmin-attributes.c | 34 +++++++++++++++++-- 5 files changed, 58 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/hp/enum-attributes.c b/drivers/platform/x86/hp/enum-attributes.c index 6ec02b61857c..9d4b6e97bd16 100644 --- a/drivers/platform/x86/hp/enum-attributes.c +++ b/drivers/platform/x86/hp/enum-attributes.c @@ -78,6 +78,12 @@ static int validate_enumeration_input(int instance_id, const char *buf) strscpy(bioscfg_drv.enumeration_data[instance_id].new_value, buf, sizeof(bioscfg_drv.enumeration_data[instance_id].new_value)); + /* + * set pending reboot flag depending on + * "RequiresPhysicalPresence" value + */ + if (bioscfg_drv.enumeration_data[instance_id].requires_physical_presence) + bioscfg_drv.pending_reboot = TRUE; exit_validate_enum_input: kfree(options); diff --git a/drivers/platform/x86/hp/int-attributes.c b/drivers/platform/x86/hp/int-attributes.c index 9a49a528fd9e..aa61497b44d5 100644 --- a/drivers/platform/x86/hp/int-attributes.c +++ b/drivers/platform/x86/hp/int-attributes.c @@ -56,7 +56,12 @@ static int validate_integer_input(int instance_id, char *buf) return -EINVAL; bioscfg_drv.integer_data[instance_id].new_value = in_val; - + /* + * set pending reboot flag depending on + * "RequiresPhysicalPresence" value + */ + if (bioscfg_drv.integer_data[instance_id].requires_physical_presence) + bioscfg_drv.pending_reboot = TRUE; return 0; } diff --git a/drivers/platform/x86/hp/ordered-attributes.c b/drivers/platform/x86/hp/ordered-attributes.c index a66d7f0b34d2..585abc3bd362 100644 --- a/drivers/platform/x86/hp/ordered-attributes.c +++ b/drivers/platform/x86/hp/ordered-attributes.c @@ -127,6 +127,12 @@ static int validate_ordered_list_input(int instance_id, const char *buf) strscpy(bioscfg_drv.ordered_list_data[instance_id].new_value, buf, sizeof(bioscfg_drv.ordered_list_data[instance_id].new_value)); + /* + * set pending reboot flag depending on + * "RequiresPhysicalPresence" value + */ + if (bioscfg_drv.ordered_list_data[instance_id].requires_physical_presence) + bioscfg_drv.pending_reboot = TRUE; validate_ordered_list_exit: return ret; diff --git a/drivers/platform/x86/hp/passwdobj-attributes.c b/drivers/platform/x86/hp/passwdobj-attributes.c index 75d2f2c1e0e3..e69688e7d55e 100644 --- a/drivers/platform/x86/hp/passwdobj-attributes.c +++ b/drivers/platform/x86/hp/passwdobj-attributes.c @@ -100,10 +100,17 @@ static ssize_t current_password_store(struct kobject *kobj, if (id >= 0) ret = validate_password_input(id, buf_cp); - if (!ret) + if (!ret) { strscpy(bioscfg_drv.password_data[id].current_password, buf_cp, sizeof(bioscfg_drv.password_data[id].current_password)); + /* + * set pending reboot flag depending on + * "RequiresPhysicalPresence" value + */ + if (bioscfg_drv.password_data[id].requires_physical_presence) + bioscfg_drv.pending_reboot = TRUE; + } exit_current_password: kfree(buf_cp); diff --git a/drivers/platform/x86/hp/sureadmin-attributes.c b/drivers/platform/x86/hp/sureadmin-attributes.c index dba5f94e8c9a..5ad45cdddad9 100644 --- a/drivers/platform/x86/hp/sureadmin-attributes.c +++ b/drivers/platform/x86/hp/sureadmin-attributes.c @@ -158,14 +158,29 @@ int update_attribute_value(char *attr_name, char *attr_value) strscpy(bioscfg_drv.string_data[instance].current_value, attr_value, sizeof(bioscfg_drv.string_data[instance].current_value)); + + /* + * set pending reboot flag depending on + * "RequiresPhysicalPresence" value + */ + if (bioscfg_drv.string_data[instance].requires_physical_presence) + bioscfg_drv.pending_reboot = TRUE; goto exit_update_attribute; } instance = get_instance_id_for_integer(attr_name); if (instance >= 0) { ret = kstrtoint(attr_value, 10, &int_val); - if (!ret) + if (!ret) { bioscfg_drv.integer_data[instance].current_value = int_val; + /* + * set pending reboot flag depending on + * "RequiresPhysicalPresence" value + */ + if (bioscfg_drv.integer_data[instance].requires_physical_presence) + bioscfg_drv.pending_reboot = TRUE; + } + goto exit_update_attribute; } @@ -174,14 +189,29 @@ int update_attribute_value(char *attr_name, char *attr_value) strscpy(bioscfg_drv.enumeration_data[instance].current_value, attr_value, sizeof(bioscfg_drv.enumeration_data[instance].current_value)); + /* + * set pending reboot flag depending on + * "RequiresPhysicalPresence" value + */ + if (bioscfg_drv.enumeration_data[instance].requires_physical_presence) + bioscfg_drv.pending_reboot = TRUE; + goto exit_update_attribute; } instance = get_instance_id_for_ordered_list(attr_name); - if (instance >= 0) + if (instance >= 0) { strscpy(bioscfg_drv.ordered_list_data[instance].current_value, attr_value, sizeof(bioscfg_drv.ordered_list_data[instance].current_value)); + /* + * set pending reboot flag depending on + * "RequiresPhysicalPresence" value + */ + if (bioscfg_drv.ordered_list_data[instance].requires_physical_presence) + bioscfg_drv.pending_reboot = TRUE; + } + exit_update_attribute: return instance; } -- 2.34.1