Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 336688
b: refs/heads/master
c: bb74ac2
h: refs/heads/master
v: v3
  • Loading branch information
Yasuaki Ishimatsu authored and Rafael J. Wysocki committed Nov 16, 2012
1 parent 515484d commit 758e39e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 61d8eff14417fb6d6c5d57e4f0f7925e9e99fce3
refs/heads/master: bb74ac23b10820d8722c3e1f4add9ef59e703f63
14 changes: 14 additions & 0 deletions trunk/Documentation/ABI/testing/sysfs-devices-sun
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Whatt: /sys/devices/.../sun
Date: October 2012
Contact: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Description:
The file contains a Slot-unique ID which provided by the _SUN
method in the ACPI namespace. The value is written in Advanced
Configuration and Power Interface Specification as follows:

"The _SUN value is required to be unique among the slots of
the same type. It is also recommended that this number match
the slot number printed on the physical slot whenever possible."

So reading the sysfs file, we can identify a physical position
of the slot in the system.
24 changes: 24 additions & 0 deletions trunk/drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,21 @@ static ssize_t description_show(struct device *dev,
}
static DEVICE_ATTR(description, 0444, description_show, NULL);

static ssize_t
acpi_device_sun_show(struct device *dev, struct device_attribute *attr,
char *buf) {
struct acpi_device *acpi_dev = to_acpi_device(dev);

return sprintf(buf, "%lu\n", acpi_dev->pnp.sun);
}
static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);

static int acpi_device_setup_files(struct acpi_device *dev)
{
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
acpi_status status;
acpi_handle temp;
unsigned long long sun;
int result = 0;

/*
Expand Down Expand Up @@ -329,6 +339,16 @@ static int acpi_device_setup_files(struct acpi_device *dev)
if (dev->pnp.unique_id)
result = device_create_file(&dev->dev, &dev_attr_uid);

status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun);
if (ACPI_SUCCESS(status)) {
dev->pnp.sun = (unsigned long)sun;
result = device_create_file(&dev->dev, &dev_attr_sun);
if (result)
goto end;
} else {
dev->pnp.sun = (unsigned long)-1;
}

/*
* If device has _EJ0, 'eject' file is created that is used to trigger
* hot-removal function from userland.
Expand Down Expand Up @@ -360,6 +380,10 @@ static void acpi_device_remove_files(struct acpi_device *dev)
if (ACPI_SUCCESS(status))
device_remove_file(&dev->dev, &dev_attr_eject);

status = acpi_get_handle(dev->handle, "_SUN", &temp);
if (ACPI_SUCCESS(status))
device_remove_file(&dev->dev, &dev_attr_sun);

if (dev->pnp.unique_id)
device_remove_file(&dev->dev, &dev_attr_uid);
if (dev->flags.bus_address)
Expand Down
1 change: 1 addition & 0 deletions trunk/include/acpi/acpi_bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ struct acpi_device_pnp {
acpi_device_name device_name; /* Driver-determined */
acpi_device_class device_class; /* " */
union acpi_object *str_obj; /* unicode string for _STR method */
unsigned long sun; /* _SUN */
};

#define acpi_device_bid(d) ((d)->pnp.bus_id)
Expand Down

0 comments on commit 758e39e

Please sign in to comment.