From: Jorge Lopez <jorgealtxwork@gmail.com>
To: hdegoede@redhat.com, platform-driver-x86@vger.kernel.org
Subject: [PATCH v2 2/4] Update pending_reboot state value
Date: Fri, 14 Oct 2022 18:27:24 -0500 [thread overview]
Message-ID: <20221014232726.31301-3-jorge.lopez2@hp.com> (raw)
In-Reply-To: <20221014232726.31301-1-jorge.lopez2@hp.com>
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@hp.com>
---
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
next prev parent reply other threads:[~2022-10-14 23:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-14 23:27 [PATCH v2 0/4] Introduction of HP-BIOSCFG driver Jorge Lopez
2022-10-14 23:27 ` [PATCH v2 1/4] " Jorge Lopez
2022-10-14 23:27 ` Jorge Lopez [this message]
2022-10-14 23:27 ` [PATCH v2 3/4] Set current_value permissions appropriate to read-only attributes Jorge Lopez
2022-10-14 23:27 ` [PATCH v2 4/4] Improve friendly display name values Jorge Lopez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221014232726.31301-3-jorge.lopez2@hp.com \
--to=jorgealtxwork@gmail.com \
--cc=hdegoede@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).