Skip to contentSkip to conversation

Introduction of HP-BIOSCFG driver

PATCH Superseded Jorge Lopez 2 participants 9 messages Oct 18, 2022 – Oct 19, 2022

Subsystems (6)

v3 of 17 Superseded Latest is v17 →

lore
Share & tools
lore
#0 lore raw

v3 cover Introduction of HP-BIOSCFG driver

Version 2 -> Version 3
------------------------------------------------------

Introduction of HP-BIOSCFG driver (1/6)
- No new changes

Update pending_reboot state value (2/6)
- No new changes

Set current_value permissions appropriate to read-only attributes (3/6)
- No new changes

Improve friendly display name values (4/6)
- No new changes

Moving existing HP drivers to a central location (5/6)

The purpose of this patch is to provide a central location where all HP related drivers are found. HP drivers will recide under hp directory with exception of hp-bioscfg. hp-bioscfg is found under hp/hp-bioscfg/ directory.

Introduced changes to Kconfig file to list all HP driver under "HP X86 Platform Specific Device Drivers" menu option.

Changes needed to relocate hp-bioscfg driver

Relocation of the driver requires minor changes such updating the path for a local include file. Additional changes include update MAINTAINERS file to indicated support status, reviewer, and maintainer of hp-bioscfg driver. Lastly, removal of 'stddef' include file from the source.

Clarify how elements order list impacts priority (6/6)

This patch provides additional clarification and describes how priority is determined according to the order. Elements listed first are given higher priority to those listed last.

Version 1 -> Version 2
------------------------------------------------------

Introduction of HP-BIOSCFG driver (1/4)
- No new changes

Update pending_reboot state value (2/4)

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.

Set current_value permissions appropriate to read-only attributes (3/4)

This patch updates ‘current_value’ permissions to match the value reported by ‘is_readonly’ value associated with the attribute. ‘current_value’ permissions are set to read-only if ‘is_readonly’ value is 1. ‘current_value’ permissions are set to read-write if
‘is_readonly’ value is zero. Other read-only and write-only
permissions will remain unchanged.

Improve friendly display name values (4/4)

The purpose of this patch is to improve the friendly display name for few numbers of attributes associated with ‘Schedule Power-ON.’ BIOS assign names such ‘Tuesday’ to an attribute. The name is correct, but it is not descriptive enough for the user. It is under those conditions a portion of the path data value is append to the attribute name to create a user-friendly name.

For instance, the attribute name is ‘Tuesday,’ and the display name value is ‘Schedule Power-ON – Tuesday’

------------------------------------------------------
Version: 1

Introduction of HP-BIOSCFG driver (1/4)

The purpose for this patch is submit HP BIOSCFG driver to be list of HP Linux kernel drivers. HP BIOS Configuration driver purpose is to provide a driver supporting the latest sysfs class firmware attributes framework allowing the user to change BIOS settings and security solutions on HP Inc.’s commercial notebooks.

Many features of HP Commercial PC’s can be managed using Windows Management Instrumentation (WMI). WMI is an implementation of Web-Based Enterprise Management (WBEM) that provides a standards-based interface for changing and monitoring system settings. HP BISOCFG driver provides a native Linux solution and the exposed features facilitates the migration to Linux environments.

The Linux security features to be provided in hp-bioscfg driver enables managing the BIOS settings and security solutions via sysfs, a virtual
filesystem that can be used by user-mode applications. The new
documentation cover features such Secure Platform Management, Sure Admin, and Sure Start. Each section provides security feature description and identifies sysfs directories and files exposed by the driver.

Many HP Commercial PC’s include a feature called Secure Platform Management (SPM), which replaces older password-based BIOS settings management with public key cryptography. PC secure product management begins when a target system is provisioned with cryptographic keys that are used to ensure the integrity of communications between system management utilities and the BIOS.

HP Commercial PC’s have several BIOS settings that control its behaviour and capabilities, many of which are related to security. To prevent unauthorized changes to these settings, the system can be configured to use a Sure Admin cryptographic signature-based authorization string that the BIOS will use to verify authorization to modify the setting.

Jorge Lopez (6):
Introduction of HP-BIOSCFG driver
Update pending_reboot state value
Set current_value permissions appropriate to read-only attributes Improve friendly display name values
Moving existing HP drivers to a central location Clarify how elements order list impacts priority

 .../testing/sysfs-class-firmware-attributes   |  181 ++-
 MAINTAINERS                                   |   15 +-
 drivers/platform/x86/Kconfig                  |    1 +
 drivers/platform/x86/Makefile                 |    4 +-
 drivers/platform/x86/hp/Kconfig               |   84 ++
 drivers/platform/x86/hp/Makefile              |   11 +
 drivers/platform/x86/hp/hp-bioscfg/Makefile   |   19 +
 .../x86/hp/hp-bioscfg/biosattr-interface.c    |  285 +++++
 drivers/platform/x86/hp/hp-bioscfg/bioscfg.c  | 1064 +++++++++++++++++
 drivers/platform/x86/hp/hp-bioscfg/bioscfg.h  |  671 +++++++++++
 .../x86/hp/hp-bioscfg/enum-attributes.c       |  521 ++++++++
 .../x86/hp/hp-bioscfg/int-attributes.c        |  478 ++++++++
 .../x86/hp/hp-bioscfg/ordered-attributes.c    |  586 +++++++++
 .../x86/hp/hp-bioscfg/passwdattr-interface.c  |   50 +
 .../x86/hp/hp-bioscfg/passwdobj-attributes.c  |  647 ++++++++++
 .../x86/hp/hp-bioscfg/spmobj-attributes.c     |  408 +++++++
 .../x86/hp/hp-bioscfg/string-attributes.c     |  457 +++++++
 .../x86/hp/hp-bioscfg/sureadmin-attributes.c  | 1014 ++++++++++++++++
 .../x86/hp/hp-bioscfg/surestart-attributes.c  |  145 +++
 drivers/platform/x86/{ => hp}/hp-wmi.c        |    0
 drivers/platform/x86/{ => hp}/hp_accel.c      |    0
 drivers/platform/x86/{ => hp}/tc1100-wmi.c    |    0
 22 files changed, 6631 insertions(+), 10 deletions(-)
 create mode 100644 drivers/platform/x86/hp/Kconfig
 create mode 100644 drivers/platform/x86/hp/Makefile
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/Makefile
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/biosattr-interface.c
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/bioscfg.h
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/int-attributes.c
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/ordered-attributes.c
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/string-attributes.c
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/sureadmin-attributes.c
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c
 rename drivers/platform/x86/{ => hp}/hp-wmi.c (100%)
 rename drivers/platform/x86/{ => hp}/hp_accel.c (100%)
 rename drivers/platform/x86/{ => hp}/tc1100-wmi.c (100%)

--
2.34.1

#1 lore raw

PATCH v3 1/6 Introduction of HP-BIOSCFG driver

The purpose for this patch is submit HP BIOSCFG driver to be list of HP Linux kernel drivers. HP BIOS Configuration driver purpose is to provide a driver supporting the latest sysfs class firmware attributes framework allowing the user to change BIOS settings and security solutions on HP Inc.’s commercial notebooks.

Many features of HP Commercial PC’s can be managed using Windows Management Instrumentation (WMI). WMI is an implementation of Web-Based Enterprise Management (WBEM) that provides a standards-based interface for changing and monitoring system settings. HP BISOCFG driver provides a native Linux solution and the exposed features facilitates the migration to Linux environments.

The Linux security features to be provided in hp-bioscfg driver enables managing the BIOS settings and security solutions via sysfs, a virtual
filesystem that can be used by user-mode applications. The new
documentation cover features such Secure Platform Management, Sure Admin, and Sure Start. Each section provides security feature description and identifies sysfs directories and files exposed by the driver.

Many HP Commercial PC’s include a feature called Secure Platform Management (SPM), which replaces older password-based BIOS settings management with public key cryptography. PC secure product management begins when a target system is provisioned with cryptographic keys that are used to ensure the integrity of communications between system management utilities and the BIOS.

HP Commercial PC’s have several BIOS settings that control its behaviour and capabilities, many of which are related to security. To prevent unauthorized changes to these settings, the system can be configured to use a Sure Admin cryptographic signature-based authorization string that the BIOS will use to verify authorization to modify the setting.

---
 .../testing/sysfs-class-firmware-attributes   |  175 ++-
 drivers/platform/x86/Kconfig                  |    1 +
 drivers/platform/x86/Makefile                 |    1 +
 drivers/platform/x86/hp/Kconfig               |   35 +
 drivers/platform/x86/hp/Makefile              |   19 +
 drivers/platform/x86/hp/biosattr-interface.c  |  286 +++++
 drivers/platform/x86/hp/bioscfg.c             | 1029 +++++++++++++++++
 drivers/platform/x86/hp/bioscfg.h             |  667 +++++++++++
 drivers/platform/x86/hp/enum-attributes.c     |  504 ++++++++
 drivers/platform/x86/hp/int-attributes.c      |  461 ++++++++
 drivers/platform/x86/hp/ordered-attributes.c  |  568 +++++++++
 .../platform/x86/hp/passwdattr-interface.c    |   50 +
 .../platform/x86/hp/passwdobj-attributes.c    |  640 ++++++++++
 drivers/platform/x86/hp/spmobj-attributes.c   |  408 +++++++
 drivers/platform/x86/hp/string-attributes.c   |  447 +++++++
 .../platform/x86/hp/sureadmin-attributes.c    |  984 ++++++++++++++++
 .../platform/x86/hp/surestart-attributes.c    |  145 +++
 17 files changed, 6419 insertions(+), 1 deletion(-)
 create mode 100644 drivers/platform/x86/hp/Kconfig
 create mode 100644 drivers/platform/x86/hp/Makefile
 create mode 100644 drivers/platform/x86/hp/biosattr-interface.c
 create mode 100644 drivers/platform/x86/hp/bioscfg.c
 create mode 100644 drivers/platform/x86/hp/bioscfg.h
 create mode 100644 drivers/platform/x86/hp/enum-attributes.c
 create mode 100644 drivers/platform/x86/hp/int-attributes.c
 create mode 100644 drivers/platform/x86/hp/ordered-attributes.c
 create mode 100644 drivers/platform/x86/hp/passwdattr-interface.c
 create mode 100644 drivers/platform/x86/hp/passwdobj-attributes.c
 create mode 100644 drivers/platform/x86/hp/spmobj-attributes.c
 create mode 100644 drivers/platform/x86/hp/string-attributes.c
 create mode 100644 drivers/platform/x86/hp/sureadmin-attributes.c
 create mode 100644 drivers/platform/x86/hp/surestart-attributes.c
Documentation/ABI/testing/sysfs-class-firmware-attributes +174 -1
index 4cdba3477176..d3830b8a398f 100644
@@ -22,6 +22,13 @@ Description:
 			- integer: a range of numerical values
 			- string
 
+		HP specific types
+		-----------------
+			- ordered-list - a set of ordered list valid values
+			- sure-admin
+			- sure-start
+
+
 		All attribute types support the following values:
 
 		current_value:
@@ -126,6 +133,63 @@ Description:
 					value will not be effective through sysfs until this rule is
 					met.
 
+		HP specific class extensions
+		------------------------------
+
+		On HP systems the following additional attributes are available:
+
+		"ordered-list"-type specific properties:
+
+		elements:
+					A file that can be read to obtain the possible
+					list of values of the <attr>. Values are separated using
+					semi-colon (``;``)
+
+		"sure-admin"-type specific properties:
+
+		settings:
+					A file associated with Sure Admin. BIOS settings can
+					be read or written through the Sure Admin settings file in sysfs.
+
+					[BIOS setting],[new value],[auth token]
+
+					Sample settings reported data
+
+					{
+						"Class": "HPBIOS_BIOSEnumeration",
+						"Name": "USB Storage Boot",
+						"Path": "\\Advanced\\Boot Options",
+						"IsReadOnly": 0,
+						...
+						"Value": "Enable",
+						"Size": 2,
+						"PossibleValues": [
+							"Disable",
+							"Enable"
+							]
+					}
+
+					This file can also be written to in order to update
+					the value sof a <attr> using a CMSL generated payload.
+					For example:
+
+					<attr>,[value],[CMSL generated payload]
+
+		"sure-start"-type specific properties:
+
+		audit_log_entries:
+					A read-only file that returns the events in the log.
+
+					Audit log entry format
+
+					Byte 0-15:   Requested Audit Log entry  (Each Audit log is 16 bytes)
+					Byte 16-127: Unused
+
+		audit_log_entry_count:
+					A read-only file that returns the number of existing audit log events available to be read.
+
+					[No of entries],[log entry size],[Max number of entries supported]
+
 What:		/sys/class/firmware-attributes/*/authentication/
 Date:		February 2021
 KernelVersion:	5.11
@@ -206,7 +270,7 @@ Description:
 		Drivers may emit a CHANGE uevent when a password is set or unset
 		userspace may check it again.
 
-		On Dell and Lenovo systems, if Admin password is set, then all BIOS attributes
+		On Dell, Lenovo, and HP systems, if Admin password is set, then all BIOS attributes
 		require password validation.
 		On Lenovo systems if you change the Admin password the new password is not active until
 		the next boot.
@@ -296,6 +360,15 @@ Description:
 						echo "signature" > authentication/Admin/signature
 						echo "password" > authentication/Admin/certificate_to_password
 
+		HP specific class extensions
+		--------------------------------
+
+		On HP systems the following additional settings are available:
+
+		role: enhanced-bios-auth:
+					This role is specific to Secure Platform Management (SPM) attribute.
+					It requires configuring an endorsement (kek) and signing certificate (sk).
+
 
 What:		/sys/class/firmware-attributes/*/attributes/pending_reboot
 Date:		February 2021
@@ -364,3 +437,103 @@ Description:
 		use it to enable extra debug attributes or BIOS features for testing purposes.
 
 		Note that any changes to this attribute requires a reboot for changes to take effect.
+
+
+		HP specific class extensions
+		--------------------------------
+
+What:		/sys/class/firmware-attributes/*/authentication/SPM/kek
+Date:		March 29
+KernelVersion:	5.18
+Contact:	"Jorge Lopez" <[email protected]>
+Description:	'kek' is a write-only file that can be used to configure the
+		RSA public key that will be used by the BIOS to verify
+		signatures when setting the signing key.  When written,
+		the bytes should correspond to the KEK certificate
+		(x509 .DER format containing an OU).  The size of the
+		certificate must be less than or equal to 4095 bytes.
+
+
+What:		/sys/class/firmware-attributes/*/authentication/SPM/sk
+Date:		March 29
+KernelVersion:	5.18
+Contact:	"Jorge Lopez" <[email protected]>
+Description:	'sk' is a write-only file that can be used to configure the RSA
+		public key that will be used by the BIOS to verify signatures
+		when configuring BIOS settings and security features.  When
+		written, the bytes should correspond to the modulus of the
+		public key.  The exponent is assumed to be 0x10001.
+
+
+What:		/sys/class/firmware-attributes/*/authentication/SPM/status
+Date:		March 29
+KernelVersion:	5.18
+Contact:	"Jorge Lopez" <[email protected]>
+Description:	'status' is a read-only file that returns ASCII text reporting
+		the status information.
+
+		  State:  Not Provisioned / Provisioned / Provisioning in progress
+		  Version:  Major.   Minor
+		  Feature Bit Mask: <16-bit unsigned number display in hex>
+		  SPM Counter: <16-bit unsigned number display in base 10>
+		  Signing Key Public Key Modulus (base64):
+		  KEK Public Key Modulus (base64):
+
+
+What:		/sys/class/firmware-attributes/*/authentication/SPM/statusbin
+Date:		March 29
+KernelVersion:	5.18
+Contact:	"Jorge Lopez" <[email protected]>
+Description:	'statusbin' is a read-only file that returns identical status
+		information reported by 'status' file in binary format.
+
+
+What:		/sys/class/firmware-attributes/*/attributes/Sure_Admin/settings
+Date:		March 29
+KernelVersion:	5.18
+Contact:	"Jorge Lopez" <[email protected]>
+Description:	'settings' is a file associated with Sure Admin. BIOS settings can
+		be read or written through the Sure Admin settings file in sysfs.
+
+		Expected data format to update BIOS setting
+
+		  [BIOS setting],[new value],[auth token]
+
+		Sample settings reported data
+
+		  {
+			  "Class": "HPBIOS_BIOSEnumeration",
+			  "Name": "USB Storage Boot",
+			  "Path": "\\Advanced\\Boot Options",
+			  "IsReadOnly": 0,
+			  ...
+			  "Value": "Enable",
+			  "Size": 2,
+			  "PossibleValues": [
+				"Disable",
+				"Enable"
+				]
+		  }
+
+
+What:		/sys/class/firmware-attributes/*/attributes/Sure_Start/audit_log_entry_count
+Date:		March 29
+KernelVersion:	5.18
+Contact:	"Jorge Lopez" <[email protected]>
+Description:	audit_log_entry_count is a read-only file that returns the
+		number of existing audit log events available to be read.
+
+		  [No of entries],[log entry size],[Max number of entries supported]
+
+
+What:		/sys/class/firmware-attributes/*/attributes/Sure_Start/audit_log_entries
+Date:		March 29
+KernelVersion:	5.18
+Contact:	"Jorge Lopez" <[email protected]>
+Description:	audit_log_entries is a read-only file that returns the events
+		in the log.
+
+		Audit log entry format
+
+		  Byte 0-15:   Requested Audit Log entry  (Each Audit log is 16 bytes)
+		  Byte 16-127: Unused
drivers/platform/x86/Kconfig +1 -0
index f5312f51de19..013f5510b5f2 100644
@@ -366,6 +366,7 @@ config EEEPC_WMI
 	  here.
 
 source "drivers/platform/x86/dell/Kconfig"
+source "drivers/platform/x86/hp/Kconfig"
 
 config AMILO_RFKILL
 	tristate "Fujitsu-Siemens Amilo rfkill support"
drivers/platform/x86/Makefile +1 -0
index 5a428caa654a..7f4fdec482a5 100644
@@ -58,6 +58,7 @@ obj-$(CONFIG_GPD_POCKET_FAN)	+= gpd-pocket-fan.o
 obj-$(CONFIG_HP_ACCEL)		+= hp_accel.o
 obj-$(CONFIG_HP_WMI)		+= hp-wmi.o
 obj-$(CONFIG_TC1100_WMI)	+= tc1100-wmi.o
+obj-$(CONFIG_HP_BIOSCFG)        += hp/
 
 # Hewlett Packard Enterprise
 obj-$(CONFIG_UV_SYSFS)       += uv_sysfs.o
drivers/platform/x86/hp/Kconfig new file +35 -0
new file mode 100644
index 000000000000..b17b99449ee5
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# HP X86 Platform Specific Drivers
+#
+
+menuconfig X86_PLATFORM_DRIVERS_HP
+	bool "HP X86 Platform Specific Device Drivers"
+	depends on X86_PLATFORM_DEVICES
+	help
+	  Say Y here to get to see options for device drivers for various
+	  HP x86 platforms, including vendor-specific laptop extension drivers.
+	  This option alone does not add any kernel code.
+
+	  If you say N, all options in this submenu will be skipped and disabled.
+
+if X86_PLATFORM_DRIVERS_HP
+
+config HP_BIOSCFG
+	tristate "HP BIOS Configuration Driver"
+	default m
+	depends on ACPI_WMI
+	depends on DMI
+	select NLS
+	select FW_ATTR_CLASS
+	help
+	  This driver enables administrators to securely manage BIOS settings
+	  using digital certificates and public-key cryptography that eliminate
+	  the need for passwords for both remote and local management. It supports
+          changing BIOS settings on many HP machines from 2018 and newer without
+	  the use of any additional software.
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called hp-bioscfg.
+
+endif # X86_PLATFORM_DRIVERS_HP
drivers/platform/x86/hp/Makefile new file +19 -0
new file mode 100644
index 000000000000..e3790e223084
@@ -0,0 +1,19 @@
+obj-m           := hp-bioscfg.o
+
+hp-bioscfg-objs := bioscfg.o 	\
+	enum-attributes.o 	\
+	int-attributes.o 	\
+	string-attributes.o 	\
+	passwdobj-attributes.o 	\
+	biosattr-interface.o  	\
+	passwdattr-interface.o 	\
+	ordered-attributes.o 	\
+	surestart-attributes.o 	\
+	spmobj-attributes.o 	\
+	sureadmin-attributes.o
+
+default:
+	make -C /lib/modules/`uname -r`/build M=$(PWD) hp-bioscfg.ko
+
+clean:
+	make -C /lib/modules/`uname -r`/build M=$(PWD) clean
drivers/platform/x86/hp/biosattr-interface.c new file +286 -0

286 lines not on this page · raw message

drivers/platform/x86/hp/bioscfg.c new file +1029 -0

1,029 lines not on this page · raw message

drivers/platform/x86/hp/bioscfg.h new file +667 -0

667 lines not on this page · raw message

drivers/platform/x86/hp/enum-attributes.c new file +504 -0

504 lines not on this page · raw message

drivers/platform/x86/hp/int-attributes.c new file +461 -0

244 lines not on this page · raw message

drivers/platform/x86/hp/ordered-attributes.c new file +568 -0

568 lines not on this page · raw message

drivers/platform/x86/hp/passwdattr-interface.c new file +50 -0

50 lines not on this page · raw message

drivers/platform/x86/hp/passwdobj-attributes.c new file +640 -0

640 lines not on this page · raw message

drivers/platform/x86/hp/spmobj-attributes.c new file +408 -0

408 lines not on this page · raw message

drivers/platform/x86/hp/string-attributes.c new file +447 -0

447 lines not on this page · raw message

drivers/platform/x86/hp/sureadmin-attributes.c new file +984 -0

984 lines not on this page · raw message

drivers/platform/x86/hp/surestart-attributes.c new file +145 -0

145 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.34.1

Part of the diff is not shown here. View the raw message.

#2 lore raw

PATCH v3 2/6 Update pending_reboot state value

In reply to Jorge Lopez

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.

---
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(-)
drivers/platform/x86/hp/enum-attributes.c +6 -0
index 6ec02b61857c..9d4b6e97bd16 100644
@@ -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);
drivers/platform/x86/hp/int-attributes.c +6 -1
index 9a49a528fd9e..aa61497b44d5 100644
@@ -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;
 }
 
drivers/platform/x86/hp/ordered-attributes.c +6 -0
index a66d7f0b34d2..585abc3bd362 100644
@@ -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;
drivers/platform/x86/hp/passwdobj-attributes.c +8 -1
index 75d2f2c1e0e3..e69688e7d55e 100644
@@ -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);
drivers/platform/x86/hp/sureadmin-attributes.c +32 -2
index dba5f94e8c9a..5ad45cdddad9 100644
@@ -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;
 }
Signature · 1 line
2.34.1
#3 lore raw

PATCH v3 3/6 Set current_value permissions appropriate to read-only attributes

In reply to Jorge Lopez

This patch updates ‘current_value’ permissions to match the value reported by ‘is_readonly’ value associated with the attribute. ‘current_value’ permissions are set to read-only if ‘is_readonly’ value is 1. ‘current_value’ permissions are set to read-write if
‘is_readonly’ value is zero. Other read-only and write-only
permissions will remain unchanged.

---
 drivers/platform/x86/hp/bioscfg.c            | 17 +++++++++++++++++
 drivers/platform/x86/hp/bioscfg.h            |  1 +
 drivers/platform/x86/hp/enum-attributes.c    |  4 ++++
 drivers/platform/x86/hp/int-attributes.c     |  4 ++++
 drivers/platform/x86/hp/ordered-attributes.c |  6 +++++-
 drivers/platform/x86/hp/string-attributes.c  |  4 ++++
 6 files changed, 35 insertions(+), 1 deletion(-)
drivers/platform/x86/hp/bioscfg.c +17 -0
index f08bcae5752a..72dd963f29ae 100644
@@ -542,6 +542,23 @@ inline int encode_outsize_for_pvsz(int outsize)
 	return 1;
 }
 
+/**
+ * update_attribute_permissions() - Update attributes permissions when
+ * isReadOnly value is 1
+ *
+ * @isReadOnly:  ReadOnly value
+ * @current_val: kobj_attribute corresponding to attribute.
+ *
+ **/
+void update_attribute_permissions(u32 isReadOnly, struct kobj_attribute *current_val)
+{
+	if (isReadOnly)
+		current_val->attr.mode = (umode_t)0444;
+	else
+		current_val->attr.mode = (umode_t)0600;
+}
+
+
 /**
  * destroy_attribute_objs() - Free a kset of kobjects
  * @kset: The kset to destroy
drivers/platform/x86/hp/bioscfg.h +1 -0
index ac02c8c1e5f2..ff030399b3a2 100644
@@ -520,6 +520,7 @@ __BIN_ATTR(_name, 0444 | 0200, _group##_##_name##_read, _group##_##_name##_write
 union acpi_object *get_wmiobj_pointer(int instance_id, const char *guid_string);
 int get_instance_count(const char *guid_string);
 void strlcpy_attr(char *dest, char *src);
+void update_attribute_permissions(u32 isReadOnly, struct kobj_attribute *current_val);
 
 /* String attributes */
 int populate_string_buffer_data(union acpi_object *str_obj,
drivers/platform/x86/hp/enum-attributes.c +4 -0
index 9d4b6e97bd16..f4fe6a583ca4 100644
@@ -190,6 +190,8 @@ int populate_enumeration_package_data(union acpi_object *enum_obj, int instance_
 	str_value = NULL;
 
 	populate_enumeration_elements_from_package(enum_obj, instance_id, HPWMI_ENUMERATION_TYPE);
+	update_attribute_permissions(bioscfg_drv.enumeration_data[instance_id].is_readonly,
+				    &enumeration_current_val);
 
 	return sysfs_create_group(attr_name_kobj, &enumeration_attr_group);
 }
@@ -362,6 +364,8 @@ int populate_enumeration_buffer_data(union acpi_object *enum_obj, int instance_i
 
 	/* Populate enumeration elements */
 	populate_enumeration_elements_from_buffer(enum_obj, instance_id, HPWMI_ENUMERATION_TYPE);
+	update_attribute_permissions(bioscfg_drv.enumeration_data[instance_id].is_readonly,
+				    &enumeration_current_val);
 
 	return sysfs_create_group(attr_name_kobj, &enumeration_attr_group);
 }
drivers/platform/x86/hp/int-attributes.c +4 -0
index aa61497b44d5..eaae4b065098 100644
@@ -168,6 +168,8 @@ int populate_integer_package_data(union acpi_object *elements, int instance_id,
 	str_value = NULL;
 
 	populate_integer_elements_from_package(elements, instance_id, HPWMI_INTEGER_TYPE);
+	update_attribute_permissions(bioscfg_drv.integer_data[instance_id].is_readonly,
+				    &integer_current_val);
 	return sysfs_create_group(attr_name_kobj, &integer_attr_group);
 }
 
@@ -329,6 +331,8 @@ int populate_integer_buffer_data(union acpi_object *integer_obj, int instance_id
 
 	/* Populate integer elements */
 	populate_integer_elements_from_buffer(integer_obj, instance_id, HPWMI_INTEGER_TYPE);
+	update_attribute_permissions(bioscfg_drv.integer_data[instance_id].is_readonly,
+				    &integer_current_val);
 
 	return sysfs_create_group(attr_name_kobj, &integer_attr_group);
 }
drivers/platform/x86/hp/ordered-attributes.c +5 -1
index 585abc3bd362..723db9a0316d 100644
@@ -239,6 +239,9 @@ int populate_ordered_list_package_data(union acpi_object *order_obj, int instanc
 	str_value = NULL;
 
 	populate_ordered_list_elements_from_package(order_obj, instance_id, HPWMI_ORDERED_LIST_TYPE);
+	update_attribute_permissions(bioscfg_drv.ordered_list_data[instance_id].is_readonly,
+				    &ordered_list_current_val);
+
 	return sysfs_create_group(attr_name_kobj, &ordered_list_attr_group);
 }
 
@@ -426,7 +429,8 @@ int populate_ordered_list_buffer_data(union acpi_object *order_obj, int instance
 
 	/* Populate ordered list elements */
 	populate_ordered_list_elements_from_buffer(order_obj, instance_id, HPWMI_ORDERED_LIST_TYPE);
-
+	update_attribute_permissions(bioscfg_drv.ordered_list_data[instance_id].is_readonly,
+				    &ordered_list_current_val);
 	return sysfs_create_group(attr_name_kobj, &ordered_list_attr_group);
 }
 
drivers/platform/x86/hp/string-attributes.c +4 -0
index c85688cfbccc..a8e4f8b60dff 100644
@@ -164,6 +164,8 @@ int populate_string_package_data(union acpi_object *elements, int instance_id,
 	str_value = NULL;
 
 	populate_string_elements_from_package(elements, instance_id, HPWMI_STRING_TYPE);
+	update_attribute_permissions(bioscfg_drv.string_data[instance_id].is_readonly,
+				    &string_current_val);
 
 	return sysfs_create_group(attr_name_kobj, &string_attr_group);
 }
@@ -321,6 +323,8 @@ int populate_string_buffer_data(union acpi_object *string_obj, int instance_id,
 	/* Populate string elements */
 
 	populate_string_elements_from_buffer(string_obj, instance_id, HPWMI_STRING_TYPE);
+	update_attribute_permissions(bioscfg_drv.string_data[instance_id].is_readonly,
+				    &string_current_val);
 
 	return sysfs_create_group(attr_name_kobj, &string_attr_group);
 }
Signature · 1 line
2.34.1
#4 lore raw

PATCH v3 4/6 Improve friendly display name values

In reply to Jorge Lopez

The purpose of this patch is to improve the friendly display name for few numbers of attributes associated with ‘Schedule Power-ON.’ BIOS assign names such ‘Tuesday’ to an attribute. The name is correct, but it is not descriptive enough for the user. It is under those conditions a portion of the path data value is append to the attribute name to create a user-friendly display name.

For instance, the attribute name is ‘Tuesday,’ and the display name value is ‘Schedule Power-ON – Tuesday’

---
 drivers/platform/x86/hp/bioscfg.c            | 18 ++++++++++++++++++
 drivers/platform/x86/hp/bioscfg.h            |  5 ++++-
 drivers/platform/x86/hp/enum-attributes.c    |  9 ++++++++-
 drivers/platform/x86/hp/int-attributes.c     |  8 ++++++++
 drivers/platform/x86/hp/ordered-attributes.c | 10 +++++++++-
 drivers/platform/x86/hp/string-attributes.c  | 10 ++++++++--
 6 files changed, 55 insertions(+), 5 deletions(-)
drivers/platform/x86/hp/bioscfg.c +18 -0
index 72dd963f29ae..ce3226d79696 100644
@@ -542,6 +542,24 @@ inline int encode_outsize_for_pvsz(int outsize)
 	return 1;
 }
 
+/*
+ * Update friendly display name for several attributes associated to
+ * 'Schedule Power-On'
+ */
+void friendly_user_name_update(char *path, const char *attr_name,
+				char *attr_display, int attr_size)
+{
+	char *found = NULL;
+
+	found = strstr(path, SCHEDULE_POWER_ON);
+	if (found)
+		snprintf(attr_display,
+			 attr_size,
+			 "%s - %s",
+			 SCHEDULE_POWER_ON,
+			 attr_name);
+}
+
 /**
  * update_attribute_permissions() - Update attributes permissions when
  * isReadOnly value is 1
drivers/platform/x86/hp/bioscfg.h +4 -1
index ff030399b3a2..4409481f84f2 100644
@@ -33,7 +33,8 @@
 #define SETUP_PASSWD	"Setup Password"
 #define POWER_ON_PASSWD	"Power-On Password"
 
-#define LANG_CODE_STR	"en_US.UTF-8"
+#define LANG_CODE_STR		"en_US.UTF-8"
+#define SCHEDULE_POWER_ON	"Scheduled Power-On"
 
 /* Sure Admin Functions */
 
@@ -521,6 +522,8 @@ union acpi_object *get_wmiobj_pointer(int instance_id, const char *guid_string);
 int get_instance_count(const char *guid_string);
 void strlcpy_attr(char *dest, char *src);
 void update_attribute_permissions(u32 isReadOnly, struct kobj_attribute *current_val);
+void friendly_user_name_update(char *path, const char *attr_name,
+				char *attr_display, int attr_size);
 
 /* String attributes */
 int populate_string_buffer_data(union acpi_object *str_obj,
drivers/platform/x86/hp/enum-attributes.c +8 -1
index f4fe6a583ca4..e67e7c397c12 100644
@@ -192,7 +192,10 @@ int populate_enumeration_package_data(union acpi_object *enum_obj, int instance_
 	populate_enumeration_elements_from_package(enum_obj, instance_id, HPWMI_ENUMERATION_TYPE);
 	update_attribute_permissions(bioscfg_drv.enumeration_data[instance_id].is_readonly,
 				    &enumeration_current_val);
-
+	friendly_user_name_update(bioscfg_drv.enumeration_data[instance_id].path,
+				  attr_name_kobj->name,
+				   bioscfg_drv.enumeration_data[instance_id].display_name,
+				   sizeof(bioscfg_drv.enumeration_data[instance_id].display_name));
 	return sysfs_create_group(attr_name_kobj, &enumeration_attr_group);
 }
 
@@ -366,6 +369,10 @@ int populate_enumeration_buffer_data(union acpi_object *enum_obj, int instance_i
 	populate_enumeration_elements_from_buffer(enum_obj, instance_id, HPWMI_ENUMERATION_TYPE);
 	update_attribute_permissions(bioscfg_drv.enumeration_data[instance_id].is_readonly,
 				    &enumeration_current_val);
+	friendly_user_name_update(bioscfg_drv.enumeration_data[instance_id].path,
+				  attr_name_kobj->name,
+				   bioscfg_drv.enumeration_data[instance_id].display_name,
+				   sizeof(bioscfg_drv.enumeration_data[instance_id].display_name));
 
 	return sysfs_create_group(attr_name_kobj, &enumeration_attr_group);
 }
drivers/platform/x86/hp/int-attributes.c +8 -0
index eaae4b065098..dc295ac4f83a 100644
@@ -170,6 +170,10 @@ int populate_integer_package_data(union acpi_object *elements, int instance_id,
 	populate_integer_elements_from_package(elements, instance_id, HPWMI_INTEGER_TYPE);
 	update_attribute_permissions(bioscfg_drv.integer_data[instance_id].is_readonly,
 				    &integer_current_val);
+	friendly_user_name_update(bioscfg_drv.integer_data[instance_id].path,
+				  attr_name_kobj->name,
+				   bioscfg_drv.integer_data[instance_id].display_name,
+				   sizeof(bioscfg_drv.integer_data[instance_id].display_name));
 	return sysfs_create_group(attr_name_kobj, &integer_attr_group);
 }
 
@@ -333,6 +337,10 @@ int populate_integer_buffer_data(union acpi_object *integer_obj, int instance_id
 	populate_integer_elements_from_buffer(integer_obj, instance_id, HPWMI_INTEGER_TYPE);
 	update_attribute_permissions(bioscfg_drv.integer_data[instance_id].is_readonly,
 				    &integer_current_val);
+	friendly_user_name_update(bioscfg_drv.integer_data[instance_id].path,
+				  attr_name_kobj->name,
+				   bioscfg_drv.integer_data[instance_id].display_name,
+				   sizeof(bioscfg_drv.integer_data[instance_id].display_name));
 
 	return sysfs_create_group(attr_name_kobj, &integer_attr_group);
 }
drivers/platform/x86/hp/ordered-attributes.c +9 -1
index 723db9a0316d..603222c086a7 100644
@@ -241,7 +241,10 @@ int populate_ordered_list_package_data(union acpi_object *order_obj, int instanc
 	populate_ordered_list_elements_from_package(order_obj, instance_id, HPWMI_ORDERED_LIST_TYPE);
 	update_attribute_permissions(bioscfg_drv.ordered_list_data[instance_id].is_readonly,
 				    &ordered_list_current_val);
-
+	friendly_user_name_update(bioscfg_drv.ordered_list_data[instance_id].path,
+				  attr_name_kobj->name,
+				   bioscfg_drv.ordered_list_data[instance_id].display_name,
+				  sizeof(bioscfg_drv.ordered_list_data[instance_id].display_name));
 	return sysfs_create_group(attr_name_kobj, &ordered_list_attr_group);
 }
 
@@ -431,6 +434,11 @@ int populate_ordered_list_buffer_data(union acpi_object *order_obj, int instance
 	populate_ordered_list_elements_from_buffer(order_obj, instance_id, HPWMI_ORDERED_LIST_TYPE);
 	update_attribute_permissions(bioscfg_drv.ordered_list_data[instance_id].is_readonly,
 				    &ordered_list_current_val);
+	friendly_user_name_update(bioscfg_drv.ordered_list_data[instance_id].path,
+				  attr_name_kobj->name,
+				   bioscfg_drv.ordered_list_data[instance_id].display_name,
+				  sizeof(bioscfg_drv.ordered_list_data[instance_id].display_name));
+
 	return sysfs_create_group(attr_name_kobj, &ordered_list_attr_group);
 }
 
drivers/platform/x86/hp/string-attributes.c +8 -2
index a8e4f8b60dff..56ca02b00d1d 100644
@@ -166,7 +166,10 @@ int populate_string_package_data(union acpi_object *elements, int instance_id,
 	populate_string_elements_from_package(elements, instance_id, HPWMI_STRING_TYPE);
 	update_attribute_permissions(bioscfg_drv.string_data[instance_id].is_readonly,
 				    &string_current_val);
-
+	friendly_user_name_update(bioscfg_drv.string_data[instance_id].path,
+				  attr_name_kobj->name,
+				   bioscfg_drv.string_data[instance_id].display_name,
+				   sizeof(bioscfg_drv.string_data[instance_id].display_name));
 	return sysfs_create_group(attr_name_kobj, &string_attr_group);
 }
 
@@ -325,7 +328,10 @@ int populate_string_buffer_data(union acpi_object *string_obj, int instance_id,
 	populate_string_elements_from_buffer(string_obj, instance_id, HPWMI_STRING_TYPE);
 	update_attribute_permissions(bioscfg_drv.string_data[instance_id].is_readonly,
 				    &string_current_val);
-
+	friendly_user_name_update(bioscfg_drv.string_data[instance_id].path,
+				  attr_name_kobj->name,
+				   bioscfg_drv.string_data[instance_id].display_name,
+				   sizeof(bioscfg_drv.string_data[instance_id].display_name));
 	return sysfs_create_group(attr_name_kobj, &string_attr_group);
 }
 
Signature · 1 line
2.34.1
#5 lore raw

PATCH v3 5/6 Moving existing HP drivers to a central location

In reply to Jorge Lopez

The purpose of this patch is to provide a central location where all HP related drivers are found. HP drivers will recide under hp directory with exception of hp-bioscfg. hp-bioscfg is found under hp/hp-bioscfg/ directory.

Introduced changes to Kconfig file to list all HP driver under "HP X86 Platform Specific Device Drivers" menu option.

Changes needed to relocate hp-bioscfg driver

Relocation of the driver requires minor changes such updating the path for a local include file. Additional changes include update MAINTAINERS file to indicated support status, reviewer, and maintainer of hp-bioscfg driver. Lastly, removal of 'stddef' include file from the source.

---
Based on the latest platform-drivers-x86.git/for-next

---
 MAINTAINERS                                   | 15 ++++--
 drivers/platform/x86/Makefile                 |  5 +-
 drivers/platform/x86/hp/Kconfig               | 51 ++++++++++++++++++-
 drivers/platform/x86/hp/Makefile              | 30 ++++-------
 drivers/platform/x86/hp/hp-bioscfg/Makefile   | 19 +++++++
 .../hp/{ => hp-bioscfg}/biosattr-interface.c  |  1 -
 .../x86/hp/{ => hp-bioscfg}/bioscfg.c         |  2 +-
 .../x86/hp/{ => hp-bioscfg}/bioscfg.h         |  0
 .../x86/hp/{ => hp-bioscfg}/enum-attributes.c |  0
 .../x86/hp/{ => hp-bioscfg}/int-attributes.c  |  0
 .../hp/{ => hp-bioscfg}/ordered-attributes.c  |  0
 .../{ => hp-bioscfg}/passwdattr-interface.c   |  0
 .../{ => hp-bioscfg}/passwdobj-attributes.c   |  0
 .../hp/{ => hp-bioscfg}/spmobj-attributes.c   |  0
 .../hp/{ => hp-bioscfg}/string-attributes.c   |  0
 .../{ => hp-bioscfg}/sureadmin-attributes.c   |  0
 .../{ => hp-bioscfg}/surestart-attributes.c   |  0
 drivers/platform/x86/{ => hp}/hp-wmi.c        |  0
 drivers/platform/x86/{ => hp}/hp_accel.c      |  0
 drivers/platform/x86/{ => hp}/tc1100-wmi.c    |  0
 20 files changed, 92 insertions(+), 31 deletions(-)
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/Makefile
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/biosattr-interface.c (99%)
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/bioscfg.c (99%)
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/bioscfg.h (100%)
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/enum-attributes.c (100%)
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/int-attributes.c (100%)
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/ordered-attributes.c (100%)
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/passwdattr-interface.c (100%)
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/passwdobj-attributes.c (100%)
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/spmobj-attributes.c (100%)
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/string-attributes.c (100%)
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/sureadmin-attributes.c (100%)
 rename drivers/platform/x86/hp/{ => hp-bioscfg}/surestart-attributes.c (100%)
 rename drivers/platform/x86/{ => hp}/hp-wmi.c (100%)
 rename drivers/platform/x86/{ => hp}/hp_accel.c (100%)
 rename drivers/platform/x86/{ => hp}/tc1100-wmi.c (100%)
MAINTAINERS +10 -5
index 5a918c703b63..9ad23364ae69 100644
@@ -120,7 +120,7 @@ Descriptions of section entries and preferred order
 	   matches all files in and below net excluding net/ipv6/
 	N: Files and directories *Regex* patterns.
 	   N:	[^a-z]tegra	all files whose path contains tegra
-	                        (not including files like integrator)
+				(not including files like integrator)
 	   One pattern per line.  Multiple N: lines acceptable.
 	   scripts/get_maintainer.pl has different behavior for files that
 	   match F: pattern and matches of N: patterns.  By default,
@@ -140,8 +140,8 @@ Maintainers List
 ----------------
 
 .. note:: When reading this list, please look for the most precise areas
-          first. When adding to this list, please keep the entries in
-          alphabetical order.
+	  first. When adding to this list, please keep the entries in
+	  alphabetical order.
 
 3C59X NETWORK DRIVER
 M:	Steffen Klassert <[email protected]>
@@ -9286,10 +9286,15 @@ S:	Obsolete
 W:	http://w1.fi/hostap-driver.html
 F:	drivers/net/wireless/intersil/hostap/
 
+HP BIOSCFG DRIVER
+M:	Jorge Lopez <[email protected]>
+S:	Maintained
+F:	drivers/platform/x86/hp/hp-bioscfg/
+
 HP COMPAQ TC1100 TABLET WMI EXTRAS DRIVER
 L:	[email protected]
 S:	Orphan
-F:	drivers/platform/x86/tc1100-wmi.c
+F:	drivers/platform/x86/hp/tc1100-wmi.c
 
 HPET:	High Precision Event Timers driver
 M:	Clemens Ladisch <[email protected]>
@@ -11747,7 +11752,7 @@ M:	Eric Piel <[email protected]>
 S:	Maintained
 F:	Documentation/misc-devices/lis3lv02d.rst
 F:	drivers/misc/lis3lv02d/
-F:	drivers/platform/x86/hp_accel.c
+F:	drivers/platform/x86/hp/hp_accel.c
 
 LIST KUNIT TEST
 M:	David Gow <[email protected]>
drivers/platform/x86/Makefile +1 -4
index 7f4fdec482a5..ade6d24b441d 100644
@@ -55,10 +55,7 @@ obj-$(CONFIG_FUJITSU_TABLET)	+= fujitsu-tablet.o
 obj-$(CONFIG_GPD_POCKET_FAN)	+= gpd-pocket-fan.o
 
 # Hewlett Packard
-obj-$(CONFIG_HP_ACCEL)		+= hp_accel.o
-obj-$(CONFIG_HP_WMI)		+= hp-wmi.o
-obj-$(CONFIG_TC1100_WMI)	+= tc1100-wmi.o
-obj-$(CONFIG_HP_BIOSCFG)        += hp/
++obj-y				+= hp/
 
 # Hewlett Packard Enterprise
 obj-$(CONFIG_UV_SYSFS)       += uv_sysfs.o
drivers/platform/x86/hp/Kconfig +50 -1

66 lines not on this page · raw message

drivers/platform/x86/hp/Makefile +11 -19
index e3790e223084..acffd5b32af0 100644
@@ -1,19 +1,11 @@
-obj-m           := hp-bioscfg.o
-
-hp-bioscfg-objs := bioscfg.o 	\
-	enum-attributes.o 	\
-	int-attributes.o 	\
-	string-attributes.o 	\
-	passwdobj-attributes.o 	\
-	biosattr-interface.o  	\
-	passwdattr-interface.o 	\
-	ordered-attributes.o 	\
-	surestart-attributes.o 	\
-	spmobj-attributes.o 	\
-	sureadmin-attributes.o
-
-default:
-	make -C /lib/modules/`uname -r`/build M=$(PWD) hp-bioscfg.ko
-
-clean:
-	make -C /lib/modules/`uname -r`/build M=$(PWD) clean
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for linux/drivers/platform/x86/hp
+# HP x86 Platform-Specific Drivers
+#
+# Hewlett Packard
+#
+obj-$(CONFIG_HP_ACCEL)		+= hp_accel.o
+obj-$(CONFIG_HP_WMI)		+= hp-wmi.o
+obj-$(CONFIG_TC1100_WMI)	+= tc1100-wmi.o
+obj-$(CONFIG_HP_BIOSCFG)        += hp-bioscfg/
drivers/platform/x86/hp/hp-bioscfg/Makefile new file +19 -0
new file mode 100644
index 000000000000..e3790e223084
@@ -0,0 +1,19 @@
+obj-m           := hp-bioscfg.o
+
+hp-bioscfg-objs := bioscfg.o 	\
+	enum-attributes.o 	\
+	int-attributes.o 	\
+	string-attributes.o 	\
+	passwdobj-attributes.o 	\
+	biosattr-interface.o  	\
+	passwdattr-interface.o 	\
+	ordered-attributes.o 	\
+	surestart-attributes.o 	\
+	spmobj-attributes.o 	\
+	sureadmin-attributes.o
+
+default:
+	make -C /lib/modules/`uname -r`/build M=$(PWD) hp-bioscfg.ko
+
+clean:
+	make -C /lib/modules/`uname -r`/build M=$(PWD) clean
drivers/platform/x86/hp/hp-bioscfg/biosattr-interface.c renamed from drivers/platform/x86/hp/biosattr-interface.c +0 -1
similarity index 99%
rename from drivers/platform/x86/hp/biosattr-interface.c
rename to drivers/platform/x86/hp/hp-bioscfg/biosattr-interface.c
index c983ef21a9ed..f0c919bf3ab0 100644
@@ -8,7 +8,6 @@
 
 #include <linux/wmi.h>
 #include "bioscfg.h"
-#include <stddef.h>
 
 #define SET_DEFAULT_VALUES_METHOD_ID	0x02
 #define SET_BIOS_DEFAULTS_METHOD_ID	0x03
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c renamed from drivers/platform/x86/hp/bioscfg.c +1 -1
similarity index 99%
rename from drivers/platform/x86/hp/bioscfg.c
rename to drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
index ce3226d79696..ef32223bd182 100644
@@ -14,7 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/wmi.h>
 #include "bioscfg.h"
-#include "../firmware_attributes_class.h"
+#include "../../firmware_attributes_class.h"
 #include <linux/nls.h>
 
 MODULE_AUTHOR("Jorge Lopez <[email protected]>");
drivers/platform/x86/hp/hp-bioscfg/bioscfg.h renamed from drivers/platform/x86/hp/bioscfg.h +0 -0
similarity index 100%
rename from drivers/platform/x86/hp/bioscfg.h
rename to drivers/platform/x86/hp/hp-bioscfg/bioscfg.h
drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c renamed from drivers/platform/x86/hp/enum-attributes.c +0 -0
similarity index 100%
rename from drivers/platform/x86/hp/enum-attributes.c
rename to drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
drivers/platform/x86/hp/hp-bioscfg/int-attributes.c renamed from drivers/platform/x86/hp/int-attributes.c +0 -0
similarity index 100%
rename from drivers/platform/x86/hp/int-attributes.c
rename to drivers/platform/x86/hp/hp-bioscfg/int-attributes.c
drivers/platform/x86/hp/hp-bioscfg/ordered-attributes.c renamed from drivers/platform/x86/hp/ordered-attributes.c +0 -0
similarity index 100%
rename from drivers/platform/x86/hp/ordered-attributes.c
rename to drivers/platform/x86/hp/hp-bioscfg/ordered-attributes.c
drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c renamed from drivers/platform/x86/hp/passwdattr-interface.c +0 -0
similarity index 100%
rename from drivers/platform/x86/hp/passwdattr-interface.c
rename to drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c renamed from drivers/platform/x86/hp/passwdobj-attributes.c +0 -0
similarity index 100%
rename from drivers/platform/x86/hp/passwdobj-attributes.c
rename to drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c renamed from drivers/platform/x86/hp/spmobj-attributes.c +0 -0
similarity index 100%
rename from drivers/platform/x86/hp/spmobj-attributes.c
rename to drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
drivers/platform/x86/hp/hp-bioscfg/string-attributes.c renamed from drivers/platform/x86/hp/string-attributes.c +0 -0
similarity index 100%
rename from drivers/platform/x86/hp/string-attributes.c
rename to drivers/platform/x86/hp/hp-bioscfg/string-attributes.c
drivers/platform/x86/hp/hp-bioscfg/sureadmin-attributes.c renamed from drivers/platform/x86/hp/sureadmin-attributes.c +0 -0
similarity index 100%
rename from drivers/platform/x86/hp/sureadmin-attributes.c
rename to drivers/platform/x86/hp/hp-bioscfg/sureadmin-attributes.c
drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c renamed from drivers/platform/x86/hp/surestart-attributes.c +0 -0
similarity index 100%
rename from drivers/platform/x86/hp/surestart-attributes.c
rename to drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c
drivers/platform/x86/hp/hp-wmi.c renamed from drivers/platform/x86/hp-wmi.c +0 -0
similarity index 100%
rename from drivers/platform/x86/hp-wmi.c
rename to drivers/platform/x86/hp/hp-wmi.c
drivers/platform/x86/hp/hp_accel.c renamed from drivers/platform/x86/hp_accel.c +0 -0
similarity index 100%
rename from drivers/platform/x86/hp_accel.c
rename to drivers/platform/x86/hp/hp_accel.c
drivers/platform/x86/hp/tc1100-wmi.c renamed from drivers/platform/x86/tc1100-wmi.c +0 -0
similarity index 100%
rename from drivers/platform/x86/tc1100-wmi.c
rename to drivers/platform/x86/hp/tc1100-wmi.c
Signature · 1 line
2.34.1
#6 lore raw

PATCH v3 6/6 Clarify how elements order list impacts priority

In reply to Jorge Lopez

This patch provides additional clarification and describes how priority is determined according to the order. Elements listed first are given higher priority to those listed last.

---
Based on the latest platform-drivers-x86.git/for-next

---
 Documentation/ABI/testing/sysfs-class-firmware-attributes | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Documentation/ABI/testing/sysfs-class-firmware-attributes +6 -2
index d3830b8a398f..ed2ff3a74163 100644
@@ -143,7 +143,11 @@ Description:
 		elements:
 					A file that can be read to obtain the possible
 					list of values of the <attr>. Values are separated using
-					semi-colon (``;``)
+					semi-colon (``;``). The order individual elements are listed
++					according to their priority.  An Element listed first has the
++					hightest priority. Writing the list in a different order to
++					current_value alters the priority order for the particular
++					attribute.
 
 		"sure-admin"-type specific properties:
 
@@ -384,7 +388,7 @@ Description:
 			==	=========================================
 			0	All BIOS attributes setting are current
 			1	A reboot is necessary to get pending BIOS
-			        attribute changes applied
+				attribute changes applied
 			==	=========================================
 
 		Note, userspace applications need to follow below steps for efficient
Signature · 1 line
2.34.1
#7 lore raw
In reply to Jorge Lopez

Hi Jorge,

Quoted 113 lines · Jorge Lopez

Version 2 -> Version 3
------------------------------------------------------

Introduction of HP-BIOSCFG driver (1/6)
- No new changes

Update pending_reboot state value (2/6)
- No new changes

Set current_value permissions appropriate to read-only attributes (3/6)
- No new changes

Improve friendly display name values (4/6)
- No new changes

Moving existing HP drivers to a central location (5/6)

The purpose of this patch is to provide a central location where all HP related drivers are found. HP drivers will recide under hp directory with exception of hp-bioscfg. hp-bioscfg is found under hp/hp-bioscfg/ directory.

Introduced changes to Kconfig file to list all HP driver under "HP X86 Platform Specific Device Drivers" menu option.

Changes needed to relocate hp-bioscfg driver

Relocation of the driver requires minor changes such updating the path for a local include file. Additional changes include update MAINTAINERS file to indicated support status, reviewer, and maintainer of hp-bioscfg driver. Lastly, removal of 'stddef' include file from the source.

Clarify how elements order list impacts priority (6/6)

This patch provides additional clarification and describes how priority is determined according to the order. Elements listed first are given higher priority to those listed last.

Version 1 -> Version 2
------------------------------------------------------

Introduction of HP-BIOSCFG driver (1/4)
- No new changes

Update pending_reboot state value (2/4)

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.

Set current_value permissions appropriate to read-only attributes (3/4)

This patch updates ‘current_value’ permissions to match the value reported by ‘is_readonly’ value associated with the attribute. ‘current_value’ permissions are set to read-only if ‘is_readonly’ value is 1. ‘current_value’ permissions are set to read-write if
‘is_readonly’ value is zero. Other read-only and write-only
permissions will remain unchanged.

Improve friendly display name values (4/4)

The purpose of this patch is to improve the friendly display name for few numbers of attributes associated with ‘Schedule Power-ON.’ BIOS assign names such ‘Tuesday’ to an attribute. The name is correct, but it is not descriptive enough for the user. It is under those conditions a portion of the path data value is append to the attribute name to create a user-friendly name.

For instance, the attribute name is ‘Tuesday,’ and the display name value is ‘Schedule Power-ON – Tuesday’

------------------------------------------------------
Version: 1

Introduction of HP-BIOSCFG driver (1/4)

The purpose for this patch is submit HP BIOSCFG driver to be list of HP Linux kernel drivers. HP BIOS Configuration driver purpose is to provide a driver supporting the latest sysfs class firmware attributes framework allowing the user to change BIOS settings and security solutions on HP Inc.’s commercial notebooks.

Many features of HP Commercial PC’s can be managed using Windows Management Instrumentation (WMI). WMI is an implementation of Web-Based Enterprise Management (WBEM) that provides a standards-based interface for changing and monitoring system settings. HP BISOCFG driver provides a native Linux solution and the exposed features facilitates the migration to Linux environments.

The Linux security features to be provided in hp-bioscfg driver enables managing the BIOS settings and security solutions via sysfs, a virtual
filesystem that can be used by user-mode applications. The new
documentation cover features such Secure Platform Management, Sure Admin, and Sure Start. Each section provides security feature description and identifies sysfs directories and files exposed by the driver.

Many HP Commercial PC’s include a feature called Secure Platform Management (SPM), which replaces older password-based BIOS settings management with public key cryptography. PC secure product management begins when a target system is provisioned with cryptographic keys that are used to ensure the integrity of communications between system management utilities and the BIOS.

HP Commercial PC’s have several BIOS settings that control its behaviour and capabilities, many of which are related to security. To prevent unauthorized changes to these settings, the system can be configured to use a Sure Admin cryptographic signature-based authorization string that the BIOS will use to verify authorization to modify the setting.

Quoted 7 lines

Jorge Lopez (6):
Introduction of HP-BIOSCFG driver
Update pending_reboot state value
Set current_value permissions appropriate to read-only attributes Improve friendly display name values
Moving existing HP drivers to a central location Clarify how elements order list impacts priority

Jorge, thank you for your continued work on this.

I will try to get a detailed review of this done next week (no time this week, sorry).

But before then can you please restructure the patch series to make it easier to review ? ATM the series seems to be the original v1 patch + patches on top addressing review comments. That is a somewhat unusual way to address review comments. Usually new versions include improvements from review directly in the patch introducing the change which got commented on.

What I would like to see for v4 of the series is a patch series like this (with all the hp-bioscfg patches squashed together before doing this new split):

[PATCH 1/x] Move the existing HP drivers to the new hp subdir (instead of doing this in 5/6) [PATCH 2/x] Introduce the main bioscfg.h file + *-attributes.c files, yes this won't
compile, but without a Makefile pointing to it that is fine
[PATCH 3/x] Add the main bioscfg.c + Makefile + Kconfig changes

Note feel free to split patch 2/x in maybe 2 or 3 patches adding a few *-attributes.c files at a time.

The idea here is to make the individual .patch files smaller because I personally find that reviewing big patch files does not work well (I tend to loose track of everything which is going on if the patch is too big / I loose my way because of too much scrolling).

Regards,

Hans

#8 lore raw

Hi Hans,

I will make the necessary changes by the end of the week. The new v4
will reorganize all patches as indicated. My intention was to keep
those fixes as small as possible. I apologize for the mess. Regards,

Jorge

Quoted 159 lines · Hans de Goede

Hi Jorge,

Quoted 113 lines · Jorge Lopez

Version 2 -> Version 3
------------------------------------------------------

Introduction of HP-BIOSCFG driver (1/6)
- No new changes

Update pending_reboot state value (2/6)
- No new changes

Set current_value permissions appropriate to read-only attributes (3/6)
- No new changes

Improve friendly display name values (4/6)
- No new changes

Moving existing HP drivers to a central location (5/6)

The purpose of this patch is to provide a central location where all HP related drivers are found. HP drivers will recide under hp directory with exception of hp-bioscfg. hp-bioscfg is found under hp/hp-bioscfg/ directory.

Introduced changes to Kconfig file to list all HP driver under "HP X86 Platform Specific Device Drivers" menu option.

Changes needed to relocate hp-bioscfg driver

Relocation of the driver requires minor changes such updating the path for a local include file. Additional changes include update MAINTAINERS file to indicated support status, reviewer, and maintainer of hp-bioscfg driver. Lastly, removal of 'stddef' include file from the source.

Clarify how elements order list impacts priority (6/6)

This patch provides additional clarification and describes how priority is determined according to the order. Elements listed first are given higher priority to those listed last.

Version 1 -> Version 2
------------------------------------------------------

Introduction of HP-BIOSCFG driver (1/4)
- No new changes

Update pending_reboot state value (2/4)

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.

Set current_value permissions appropriate to read-only attributes (3/4)

This patch updates ‘current_value’ permissions to match the value reported by ‘is_readonly’ value associated with the attribute. ‘current_value’ permissions are set to read-only if ‘is_readonly’ value is 1. ‘current_value’ permissions are set to read-write if
‘is_readonly’ value is zero. Other read-only and write-only
permissions will remain unchanged.

Improve friendly display name values (4/4)

The purpose of this patch is to improve the friendly display name for few numbers of attributes associated with ‘Schedule Power-ON.’ BIOS assign names such ‘Tuesday’ to an attribute. The name is correct, but it is not descriptive enough for the user. It is under those conditions a portion of the path data value is append to the attribute name to create a user-friendly name.

For instance, the attribute name is ‘Tuesday,’ and the display name value is ‘Schedule Power-ON – Tuesday’

------------------------------------------------------
Version: 1

Introduction of HP-BIOSCFG driver (1/4)

The purpose for this patch is submit HP BIOSCFG driver to be list of HP Linux kernel drivers. HP BIOS Configuration driver purpose is to provide a driver supporting the latest sysfs class firmware attributes framework allowing the user to change BIOS settings and security solutions on HP Inc.’s commercial notebooks.

Many features of HP Commercial PC’s can be managed using Windows Management Instrumentation (WMI). WMI is an implementation of Web-Based Enterprise Management (WBEM) that provides a standards-based interface for changing and monitoring system settings. HP BISOCFG driver provides a native Linux solution and the exposed features facilitates the migration to Linux environments.

The Linux security features to be provided in hp-bioscfg driver enables managing the BIOS settings and security solutions via sysfs, a virtual
filesystem that can be used by user-mode applications. The new
documentation cover features such Secure Platform Management, Sure Admin, and Sure Start. Each section provides security feature description and identifies sysfs directories and files exposed by the driver.

Many HP Commercial PC’s include a feature called Secure Platform Management (SPM), which replaces older password-based BIOS settings management with public key cryptography. PC secure product management begins when a target system is provisioned with cryptographic keys that are used to ensure the integrity of communications between system management utilities and the BIOS.

HP Commercial PC’s have several BIOS settings that control its behaviour and capabilities, many of which are related to security. To prevent unauthorized changes to these settings, the system can be configured to use a Sure Admin cryptographic signature-based authorization string that the BIOS will use to verify authorization to modify the setting.

Quoted 7 lines

Jorge Lopez (6):
Introduction of HP-BIOSCFG driver
Update pending_reboot state value
Set current_value permissions appropriate to read-only attributes Improve friendly display name values
Moving existing HP drivers to a central location Clarify how elements order list impacts priority

Jorge, thank you for your continued work on this.

I will try to get a detailed review of this done next week (no time this week, sorry).

But before then can you please restructure the patch series to make it easier to review ? ATM the series seems to be the original v1 patch + patches on top addressing review comments. That is a somewhat unusual way to address review comments. Usually new versions include improvements from review directly in the patch introducing the change which got commented on.

What I would like to see for v4 of the series is a patch series like this (with all the hp-bioscfg patches squashed together before doing this new split):

[PATCH 1/x] Move the existing HP drivers to the new hp subdir (instead of doing this in 5/6) [PATCH 2/x] Introduce the main bioscfg.h file + *-attributes.c files, yes this won't
compile, but without a Makefile pointing to it that is fine
[PATCH 3/x] Add the main bioscfg.c + Makefile + Kconfig changes

Note feel free to split patch 2/x in maybe 2 or 3 patches adding a few *-attributes.c files at a time.

The idea here is to make the individual .patch files smaller because I personally find that reviewing big patch files does not work well (I tend to loose track of everything which is going on if the patch is too big / I loose my way because of too much scrolling).

Regards,

Hans