linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-05-01 12:53 Pierre-Louis Bossart
  2019-05-01 12:53 ` Pierre-Louis Bossart
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Pierre-Louis Bossart @ 2019-05-01 12:53 UTC (permalink / raw)
  To: alsa-devel
  Cc: linux-kernel, tiwai, broonie, vkoul, gregkh, liam.r.girdwood,
	jank, joe, srinivas.kandagatla, Pierre-Louis Bossart,
	Rafael J. Wysocki, Len Brown, Robert Moore, Erik Schmauss,
	open list:ACPI, open list:ACPI COMPONENT ARCHITECTURE ACPICA

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 <pierre-louis.bossart@linux.intel.com>
---
v2: only use 64 bits when required to avoid compatibility issues
(feedback from Vinod and Rafael)

 drivers/acpi/device_sysfs.c | 6 ++++--
 include/acpi/acpi_bus.h     | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
index 8940054d6250..7dda0ee05cd1 100644
--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device *dev,
 {
 	struct acpi_device *acpi_dev = to_acpi_device(dev);
 
-	return sprintf(buf, "0x%08x\n",
-		       (unsigned int)(acpi_dev->pnp.bus_address));
+	if (acpi_dev->pnp.bus_address > 0xFFFFFFFF)
+		return sprintf(buf, "0x%016llx\n", acpi_dev->pnp.bus_address);
+	else
+		return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address);
 }
 static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
 
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f7981751ac77..9075e28ea60a 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -230,7 +230,7 @@ struct acpi_device_dir {
 /* Plug and Play */
 
 typedef char acpi_bus_id[8];
-typedef unsigned long acpi_bus_address;
+typedef u64 acpi_bus_address;
 typedef char acpi_device_name[40];
 typedef char acpi_device_class[20];
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits
  2019-05-01 12:53 [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits Pierre-Louis Bossart
@ 2019-05-01 12:53 ` Pierre-Louis Bossart
  2019-05-02  4:58 ` Vinod Koul
  2019-05-03 19:54 ` Moore, Robert
  2 siblings, 0 replies; 10+ messages in thread
From: Pierre-Louis Bossart @ 2019-05-01 12:53 UTC (permalink / raw)
  To: alsa-devel
  Cc: linux-kernel, tiwai, broonie, vkoul, gregkh, liam.r.girdwood,
	jank, joe, srinivas.kandagatla, Pierre-Louis Bossart,
	Rafael J. Wysocki, Len Brown, Robert Moore, Erik Schmauss,
	open list:ACPI, open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

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 <pierre-louis.bossart@linux.intel.com>
---
v2: only use 64 bits when required to avoid compatibility issues
(feedback from Vinod and Rafael)

 drivers/acpi/device_sysfs.c | 6 ++++--
 include/acpi/acpi_bus.h     | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
index 8940054d6250..7dda0ee05cd1 100644
--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device *dev,
 {
 	struct acpi_device *acpi_dev = to_acpi_device(dev);
 
-	return sprintf(buf, "0x%08x\n",
-		       (unsigned int)(acpi_dev->pnp.bus_address));
+	if (acpi_dev->pnp.bus_address > 0xFFFFFFFF)
+		return sprintf(buf, "0x%016llx\n", acpi_dev->pnp.bus_address);
+	else
+		return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address);
 }
 static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
 
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f7981751ac77..9075e28ea60a 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -230,7 +230,7 @@ struct acpi_device_dir {
 /* Plug and Play */
 
 typedef char acpi_bus_id[8];
-typedef unsigned long acpi_bus_address;
+typedef u64 acpi_bus_address;
 typedef char acpi_device_name[40];
 typedef char acpi_device_class[20];
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits
  2019-05-01 12:53 [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits Pierre-Louis Bossart
  2019-05-01 12:53 ` Pierre-Louis Bossart
@ 2019-05-02  4:58 ` Vinod Koul
  2019-05-02  4:58   ` Vinod Koul
  2019-05-06  8:36   ` Rafael J. Wysocki
  2019-05-03 19:54 ` Moore, Robert
  2 siblings, 2 replies; 10+ messages in thread
From: Vinod Koul @ 2019-05-02  4:58 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, linux-kernel, tiwai, broonie, gregkh,
	liam.r.girdwood, jank, joe, srinivas.kandagatla,
	Rafael J. Wysocki, Len Brown, Robert Moore, Erik Schmauss,
	open list:ACPI, open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

On 01-05-19, 07:53, Pierre-Louis Bossart wrote:
> 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 <pierre-louis.bossart@linux.intel.com>
> ---
> v2: only use 64 bits when required to avoid compatibility issues
> (feedback from Vinod and Rafael)
> 
>  drivers/acpi/device_sysfs.c | 6 ++++--
>  include/acpi/acpi_bus.h     | 2 +-
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
> index 8940054d6250..7dda0ee05cd1 100644
> --- a/drivers/acpi/device_sysfs.c
> +++ b/drivers/acpi/device_sysfs.c
> @@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device *dev,
>  {
>  	struct acpi_device *acpi_dev = to_acpi_device(dev);
>  
> -	return sprintf(buf, "0x%08x\n",
> -		       (unsigned int)(acpi_dev->pnp.bus_address));
> +	if (acpi_dev->pnp.bus_address > 0xFFFFFFFF)

Would prefer to use U32_MAX instead of 0xFFFFFFFF

> +		return sprintf(buf, "0x%016llx\n", acpi_dev->pnp.bus_address);
> +	else
> +		return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address);
>  }
>  static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
>  
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index f7981751ac77..9075e28ea60a 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -230,7 +230,7 @@ struct acpi_device_dir {
>  /* Plug and Play */
>  
>  typedef char acpi_bus_id[8];
> -typedef unsigned long acpi_bus_address;
> +typedef u64 acpi_bus_address;
>  typedef char acpi_device_name[40];
>  typedef char acpi_device_class[20];
>  
> -- 
> 2.17.1

-- 
~Vinod

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits
  2019-05-02  4:58 ` Vinod Koul
@ 2019-05-02  4:58   ` Vinod Koul
  2019-05-06  8:36   ` Rafael J. Wysocki
  1 sibling, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2019-05-02  4:58 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, linux-kernel, tiwai, broonie, gregkh,
	liam.r.girdwood, jank, joe, srinivas.kandagatla,
	Rafael J. Wysocki, Len Brown, Robert Moore, Erik Schmauss,
	open list:ACPI, open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

On 01-05-19, 07:53, Pierre-Louis Bossart wrote:
> 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 <pierre-louis.bossart@linux.intel.com>
> ---
> v2: only use 64 bits when required to avoid compatibility issues
> (feedback from Vinod and Rafael)
> 
>  drivers/acpi/device_sysfs.c | 6 ++++--
>  include/acpi/acpi_bus.h     | 2 +-
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
> index 8940054d6250..7dda0ee05cd1 100644
> --- a/drivers/acpi/device_sysfs.c
> +++ b/drivers/acpi/device_sysfs.c
> @@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device *dev,
>  {
>  	struct acpi_device *acpi_dev = to_acpi_device(dev);
>  
> -	return sprintf(buf, "0x%08x\n",
> -		       (unsigned int)(acpi_dev->pnp.bus_address));
> +	if (acpi_dev->pnp.bus_address > 0xFFFFFFFF)

Would prefer to use U32_MAX instead of 0xFFFFFFFF

> +		return sprintf(buf, "0x%016llx\n", acpi_dev->pnp.bus_address);
> +	else
> +		return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address);
>  }
>  static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
>  
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index f7981751ac77..9075e28ea60a 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -230,7 +230,7 @@ struct acpi_device_dir {
>  /* Plug and Play */
>  
>  typedef char acpi_bus_id[8];
> -typedef unsigned long acpi_bus_address;
> +typedef u64 acpi_bus_address;
>  typedef char acpi_device_name[40];
>  typedef char acpi_device_class[20];
>  
> -- 
> 2.17.1

-- 
~Vinod

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits
  2019-05-01 12:53 [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits Pierre-Louis Bossart
  2019-05-01 12:53 ` Pierre-Louis Bossart
  2019-05-02  4:58 ` Vinod Koul
@ 2019-05-03 19:54 ` Moore, Robert
  2019-05-03 19:54   ` Moore, Robert
  2 siblings, 1 reply; 10+ messages in thread
From: Moore, Robert @ 2019-05-03 19:54 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel
  Cc: linux-kernel, tiwai, broonie, vkoul, gregkh, liam.r.girdwood,
	jank, joe, srinivas.kandagatla, Rafael J. Wysocki, Len Brown,
	Schmauss, Erik, open list:ACPI,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA)



> -----Original Message-----
> From: Pierre-Louis Bossart [mailto:pierre-louis.bossart@linux.intel.com]
> Sent: Wednesday, May 1, 2019 5:53 AM
> To: alsa-devel@alsa-project.org
> Cc: linux-kernel@vger.kernel.org; tiwai@suse.de; broonie@kernel.org;
> vkoul@kernel.org; gregkh@linuxfoundation.org;
> liam.r.girdwood@linux.intel.com; jank@cadence.com; joe@perches.com;
> srinivas.kandagatla@linaro.org; Pierre-Louis Bossart <pierre-
> louis.bossart@linux.intel.com>; Rafael J. Wysocki <rjw@rjwysocki.net>;
> Len Brown <lenb@kernel.org>; Moore, Robert <robert.moore@intel.com>;
> Schmauss, Erik <erik.schmauss@intel.com>; open list:ACPI <linux-
> acpi@vger.kernel.org>; open list:ACPI COMPONENT ARCHITECTURE (ACPICA)
> <devel@acpica.org>
> Subject: [PATCH v2] ACPI / device_sysfs: 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.
> 
[Moore, Robert] 

Just to be precise: since acpi 2.0 the integer width is either 32 bits or 64 bits, depending on the version number of the DSDT (1-->32, 2 or greater --> 64).


> 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 <pierre-
> louis.bossart@linux.intel.com>
> ---
> v2: only use 64 bits when required to avoid compatibility issues
> (feedback from Vinod and Rafael)
> 
>  drivers/acpi/device_sysfs.c | 6 ++++--
>  include/acpi/acpi_bus.h     | 2 +-
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
> index 8940054d6250..7dda0ee05cd1 100644
> --- a/drivers/acpi/device_sysfs.c
> +++ b/drivers/acpi/device_sysfs.c
> @@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device
> *dev,  {
>  	struct acpi_device *acpi_dev = to_acpi_device(dev);
> 
> -	return sprintf(buf, "0x%08x\n",
> -		       (unsigned int)(acpi_dev->pnp.bus_address));
> +	if (acpi_dev->pnp.bus_address > 0xFFFFFFFF)
> +		return sprintf(buf, "0x%016llx\n", acpi_dev-
> >pnp.bus_address);
> +	else
> +		return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address);
>  }
>  static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
> 
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index
> f7981751ac77..9075e28ea60a 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -230,7 +230,7 @@ struct acpi_device_dir {
>  /* Plug and Play */
> 
>  typedef char acpi_bus_id[8];
> -typedef unsigned long acpi_bus_address;
> +typedef u64 acpi_bus_address;
>  typedef char acpi_device_name[40];
>  typedef char acpi_device_class[20];
> 
> --
> 2.17.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits
  2019-05-03 19:54 ` Moore, Robert
@ 2019-05-03 19:54   ` Moore, Robert
  0 siblings, 0 replies; 10+ messages in thread
From: Moore, Robert @ 2019-05-03 19:54 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel
  Cc: linux-kernel, tiwai, broonie, vkoul, gregkh, liam.r.girdwood,
	jank, joe, srinivas.kandagatla, Rafael J. Wysocki, Len Brown,
	Schmauss, Erik, open list:ACPI,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA)



> -----Original Message-----
> From: Pierre-Louis Bossart [mailto:pierre-louis.bossart@linux.intel.com]
> Sent: Wednesday, May 1, 2019 5:53 AM
> To: alsa-devel@alsa-project.org
> Cc: linux-kernel@vger.kernel.org; tiwai@suse.de; broonie@kernel.org;
> vkoul@kernel.org; gregkh@linuxfoundation.org;
> liam.r.girdwood@linux.intel.com; jank@cadence.com; joe@perches.com;
> srinivas.kandagatla@linaro.org; Pierre-Louis Bossart <pierre-
> louis.bossart@linux.intel.com>; Rafael J. Wysocki <rjw@rjwysocki.net>;
> Len Brown <lenb@kernel.org>; Moore, Robert <robert.moore@intel.com>;
> Schmauss, Erik <erik.schmauss@intel.com>; open list:ACPI <linux-
> acpi@vger.kernel.org>; open list:ACPI COMPONENT ARCHITECTURE (ACPICA)
> <devel@acpica.org>
> Subject: [PATCH v2] ACPI / device_sysfs: 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.
> 
[Moore, Robert] 

Just to be precise: since acpi 2.0 the integer width is either 32 bits or 64 bits, depending on the version number of the DSDT (1-->32, 2 or greater --> 64).


> 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 <pierre-
> louis.bossart@linux.intel.com>
> ---
> v2: only use 64 bits when required to avoid compatibility issues
> (feedback from Vinod and Rafael)
> 
>  drivers/acpi/device_sysfs.c | 6 ++++--
>  include/acpi/acpi_bus.h     | 2 +-
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
> index 8940054d6250..7dda0ee05cd1 100644
> --- a/drivers/acpi/device_sysfs.c
> +++ b/drivers/acpi/device_sysfs.c
> @@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device
> *dev,  {
>  	struct acpi_device *acpi_dev = to_acpi_device(dev);
> 
> -	return sprintf(buf, "0x%08x\n",
> -		       (unsigned int)(acpi_dev->pnp.bus_address));
> +	if (acpi_dev->pnp.bus_address > 0xFFFFFFFF)
> +		return sprintf(buf, "0x%016llx\n", acpi_dev-
> >pnp.bus_address);
> +	else
> +		return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address);
>  }
>  static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
> 
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index
> f7981751ac77..9075e28ea60a 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -230,7 +230,7 @@ struct acpi_device_dir {
>  /* Plug and Play */
> 
>  typedef char acpi_bus_id[8];
> -typedef unsigned long acpi_bus_address;
> +typedef u64 acpi_bus_address;
>  typedef char acpi_device_name[40];
>  typedef char acpi_device_class[20];
> 
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits
  2019-05-02  4:58 ` Vinod Koul
  2019-05-02  4:58   ` Vinod Koul
@ 2019-05-06  8:36   ` Rafael J. Wysocki
  2019-05-06  8:36     ` Rafael J. Wysocki
  2019-05-14 21:29     ` Rafael J. Wysocki
  1 sibling, 2 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2019-05-06  8:36 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Pierre-Louis Bossart,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linux Kernel Mailing List, Takashi Iwai, Mark Brown,
	Greg Kroah-Hartman, Liam Girdwood, jank, Joe Perches,
	Srini Kandagatla, Rafael J. Wysocki, Len Brown, Robert Moore,
	Erik Schmauss, open list:ACPI,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

On Thu, May 2, 2019 at 6:58 AM Vinod Koul <vkoul@kernel.org> wrote:
>
> On 01-05-19, 07:53, Pierre-Louis Bossart wrote:
> > 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 <pierre-louis.bossart@linux.intel.com>
> > ---
> > v2: only use 64 bits when required to avoid compatibility issues
> > (feedback from Vinod and Rafael)
> >
> >  drivers/acpi/device_sysfs.c | 6 ++++--
> >  include/acpi/acpi_bus.h     | 2 +-
> >  2 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
> > index 8940054d6250..7dda0ee05cd1 100644
> > --- a/drivers/acpi/device_sysfs.c
> > +++ b/drivers/acpi/device_sysfs.c
> > @@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device *dev,
> >  {
> >       struct acpi_device *acpi_dev = to_acpi_device(dev);
> >
> > -     return sprintf(buf, "0x%08x\n",
> > -                    (unsigned int)(acpi_dev->pnp.bus_address));
> > +     if (acpi_dev->pnp.bus_address > 0xFFFFFFFF)
>
> Would prefer to use U32_MAX instead of 0xFFFFFFFF

I would.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits
  2019-05-06  8:36   ` Rafael J. Wysocki
@ 2019-05-06  8:36     ` Rafael J. Wysocki
  2019-05-14 21:29     ` Rafael J. Wysocki
  1 sibling, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2019-05-06  8:36 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Pierre-Louis Bossart,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linux Kernel Mailing List, Takashi Iwai, Mark Brown,
	Greg Kroah-Hartman, Liam Girdwood, jank, Joe Perches,
	Srini Kandagatla, Rafael J. Wysocki, Len Brown, Robert Moore,
	Erik Schmauss, open list:ACPI,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

On Thu, May 2, 2019 at 6:58 AM Vinod Koul <vkoul@kernel.org> wrote:
>
> On 01-05-19, 07:53, Pierre-Louis Bossart wrote:
> > 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 <pierre-louis.bossart@linux.intel.com>
> > ---
> > v2: only use 64 bits when required to avoid compatibility issues
> > (feedback from Vinod and Rafael)
> >
> >  drivers/acpi/device_sysfs.c | 6 ++++--
> >  include/acpi/acpi_bus.h     | 2 +-
> >  2 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
> > index 8940054d6250..7dda0ee05cd1 100644
> > --- a/drivers/acpi/device_sysfs.c
> > +++ b/drivers/acpi/device_sysfs.c
> > @@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device *dev,
> >  {
> >       struct acpi_device *acpi_dev = to_acpi_device(dev);
> >
> > -     return sprintf(buf, "0x%08x\n",
> > -                    (unsigned int)(acpi_dev->pnp.bus_address));
> > +     if (acpi_dev->pnp.bus_address > 0xFFFFFFFF)
>
> Would prefer to use U32_MAX instead of 0xFFFFFFFF

I would.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits
  2019-05-06  8:36   ` Rafael J. Wysocki
  2019-05-06  8:36     ` Rafael J. Wysocki
@ 2019-05-14 21:29     ` Rafael J. Wysocki
  2019-05-14 21:37       ` [alsa-devel] " Pierre-Louis Bossart
  1 sibling, 1 reply; 10+ messages in thread
From: Rafael J. Wysocki @ 2019-05-14 21:29 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Vinod Koul,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linux Kernel Mailing List, Takashi Iwai, Mark Brown,
	Greg Kroah-Hartman, Liam Girdwood, jank, Joe Perches,
	Srini Kandagatla, Len Brown, Robert Moore, Erik Schmauss,
	open list:ACPI, open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

On Monday, May 6, 2019 10:36:22 AM CEST Rafael J. Wysocki wrote:
> On Thu, May 2, 2019 at 6:58 AM Vinod Koul <vkoul@kernel.org> wrote:
> >
> > On 01-05-19, 07:53, Pierre-Louis Bossart wrote:
> > > 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 <pierre-louis.bossart@linux.intel.com>
> > > ---
> > > v2: only use 64 bits when required to avoid compatibility issues
> > > (feedback from Vinod and Rafael)
> > >
> > >  drivers/acpi/device_sysfs.c | 6 ++++--
> > >  include/acpi/acpi_bus.h     | 2 +-
> > >  2 files changed, 5 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
> > > index 8940054d6250..7dda0ee05cd1 100644
> > > --- a/drivers/acpi/device_sysfs.c
> > > +++ b/drivers/acpi/device_sysfs.c
> > > @@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device *dev,
> > >  {
> > >       struct acpi_device *acpi_dev = to_acpi_device(dev);
> > >
> > > -     return sprintf(buf, "0x%08x\n",
> > > -                    (unsigned int)(acpi_dev->pnp.bus_address));
> > > +     if (acpi_dev->pnp.bus_address > 0xFFFFFFFF)
> >
> > Would prefer to use U32_MAX instead of 0xFFFFFFFF
> 
> I would.
> 

I have made that change manually and applied the patch.

Thanks!




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [alsa-devel] [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits
  2019-05-14 21:29     ` Rafael J. Wysocki
@ 2019-05-14 21:37       ` Pierre-Louis Bossart
  0 siblings, 0 replies; 10+ messages in thread
From: Pierre-Louis Bossart @ 2019-05-14 21:37 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Vinod Koul,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linux Kernel Mailing List, Takashi Iwai, Mark Brown,
	Greg Kroah-Hartman, Liam Girdwood, jank, Joe Perches,
	Srini Kandagatla, Len Brown, Robert Moore, Erik Schmauss,
	open list:ACPI, open list:ACPI COMPONENT ARCHITECTURE (ACPICA)


>>>> diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
>>>> index 8940054d6250..7dda0ee05cd1 100644
>>>> --- a/drivers/acpi/device_sysfs.c
>>>> +++ b/drivers/acpi/device_sysfs.c
>>>> @@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device *dev,
>>>>   {
>>>>        struct acpi_device *acpi_dev = to_acpi_device(dev);
>>>>
>>>> -     return sprintf(buf, "0x%08x\n",
>>>> -                    (unsigned int)(acpi_dev->pnp.bus_address));
>>>> +     if (acpi_dev->pnp.bus_address > 0xFFFFFFFF)
>>>
>>> Would prefer to use U32_MAX instead of 0xFFFFFFFF
>>
>> I would.
>>
> 
> I have made that change manually and applied the patch.
> 
> Thanks!

Thanks, much appreciated.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-05-14 21:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-01 12:53 [PATCH v2] ACPI / device_sysfs: change _ADR representation to 64 bits Pierre-Louis Bossart
2019-05-01 12:53 ` Pierre-Louis Bossart
2019-05-02  4:58 ` Vinod Koul
2019-05-02  4:58   ` Vinod Koul
2019-05-06  8:36   ` Rafael J. Wysocki
2019-05-06  8:36     ` Rafael J. Wysocki
2019-05-14 21:29     ` Rafael J. Wysocki
2019-05-14 21:37       ` [alsa-devel] " Pierre-Louis Bossart
2019-05-03 19:54 ` Moore, Robert
2019-05-03 19:54   ` Moore, Robert

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).