Skip to content

Commit ca6f998

Browse files
plbossartrafaeljw
authored andcommitted
ACPI: bus: change _ADR representation to 64 bits
Standards such as the MIPI DisCo for SoundWire 1.0 specification assume the _ADR field is 64 bits. _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0 released in 2002. The low levels already use _ADR as 64 bits, e.g. in struct acpi_device_info. This patch bumps the representation used for sysfs to 64 bits. To avoid any compatibility/ABI issues, the printf format is only extended to 16 characters when the actual _ADR value exceeds the 32 bit maximum. Example with a SoundWire device, the results show the complete vendorID and linkID which were omitted before: Before: $ more /sys/bus/acpi/devices/device\:38/adr 0x5d070000 After: $ more /sys/bus/acpi/devices/device\:38/adr 0x000010025d070000 Signed-off-by: Pierre-Louis Bossart <[email protected]> [ rjw: Replace 0xFFFFFFFF with U32_MAX, clean up subject ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 59df1c2 commit ca6f998

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

drivers/acpi/device_sysfs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device *dev,
428428
{
429429
struct acpi_device *acpi_dev = to_acpi_device(dev);
430430

431-
return sprintf(buf, "0x%08x\n",
432-
(unsigned int)(acpi_dev->pnp.bus_address));
431+
if (acpi_dev->pnp.bus_address > U32_MAX)
432+
return sprintf(buf, "0x%016llx\n", acpi_dev->pnp.bus_address);
433+
else
434+
return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address);
433435
}
434436
static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
435437

include/acpi/acpi_bus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ struct acpi_device_dir {
230230
/* Plug and Play */
231231

232232
typedef char acpi_bus_id[8];
233-
typedef unsigned long acpi_bus_address;
233+
typedef u64 acpi_bus_address;
234234
typedef char acpi_device_name[40];
235235
typedef char acpi_device_class[20];
236236

0 commit comments

Comments
 (0)