Skip to contentSkip to conversation

ACPI: Add new sysfs interface to export device description

PATCH Applied Lance Ortiz 2 participants 2 messages Oct 2, 2012 – Oct 6, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ACPI: Add new sysfs interface to export device description

Add support to export the device description obtained from the ACPI _STR method, if one exists for a device, to user-space via a sysfs interface. This new interface provides a standard and platform neutral way for users to obtain the description text stored in the ACPI _STR method. If no _STR method exists for the device, no sysfs 'description' file will be created. The 'description' file will be located in the /sys/devices/ directory using the device's path.

/sys/device/<bus>/<bridge path>/<device path>.../firmware_node/description

Example:

/sys/devices/pci0000:00/0000:00.07.0/0000:0e:00.0/firmware_node/description

It can also be located using the ACPI device path, for example:

/sys/devices/LNXSYSTM:00/device:00/ACPI0004:00/PNP0A08:00/device:13/device:15/description /sys/devices/LNXSYSTM:00/device:00/ACPI0004:00/ACPI0004:01/ACPI0007:02/description

Execute the 'cat' command on the 'description' file to obtain the description string for that device.

This patch also includes documentation describing how the new sysfs interface works

Changes from v1-v2 based on comments by Len Brown and Fengguang Wu
* Removed output "No Description" and leaving a NULL attribute if the _STR method failed to evaluate.

* In acpi_device_remove_files() removed the redundent check of dev->pnp.str_obj before calling free. This check triggered a message from smatch.

---
 .../ABI/testing/sysfs-devices-firmware_node        |   17 ++++++
 drivers/acpi/scan.c                                |   54 +++++++++++++++++++-
 include/acpi/acpi_bus.h                            |    1 +
 3 files changed, 70 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-devices-firmware_node
Documentation/ABI/testing/sysfs-devices-firmware_node new file +17 -0
new file mode 100644
index 0000000..46badc9
@@ -0,0 +1,17 @@
+What:		/sys/devices/.../firmware_node/
+Date:		September 2012
+Contact:	<>
+Description:
+		The /sys/devices/.../firmware_node directory contains attributes
+		allowing the user space to check and modify some firmware
+		related properties of given device.
+
+What:		/sys/devices/.../firmware_node/description
+Date:		September 2012
+Contact:	Lance Ortiz <[email protected]>
+Description:
+		The /sys/devices/.../firmware/description attribute contains a string
+		that describes the device as provided by the _STR method in the ACPI
+		namespace.  This attribute is read-only.  If the device does not have
+		an _STR method associated with it in the ACPI namespace, this
+		attribute is not present.
drivers/acpi/scan.c +52 -2

80 lines not on this page · raw message

include/acpi/acpi_bus.h +1 -0
index 9e6e1c6..12172d5 100644
@@ -209,6 +209,7 @@ struct acpi_device_pnp {
 	struct list_head ids;		/* _HID and _CIDs */
 	acpi_device_name device_name;	/* Driver-determined */
 	acpi_device_class device_class;	/*        "          */
+	union acpi_object *str_obj;	/* unicode string for _STR method */
 };
 
 #define acpi_device_bid(d)	((d)->pnp.bus_id)
Signature · 1 line
1.7.7.6
reviewer Applied
#1 lore raw

Applied.

thanks for the refresh.

Len Brown, Intel Open Source Technology Center