* [PATCH] PNPACPI: proper handling ACPI IO/Memory resources
@ 2014-03-11 14:40 Zhang Rui
2014-03-11 14:50 ` Zhang, Rui
2014-03-11 23:38 ` Rafael J. Wysocki
0 siblings, 2 replies; 6+ messages in thread
From: Zhang Rui @ 2014-03-11 14:40 UTC (permalink / raw)
To: linux-acpi, linux-kernel
Cc: rafael.j.wysocki, jwollrath, markus, pebolle, Zhang Rui
Before commit b355cee88e3b1a193f0e9a81db810f6f83ad728b,
if acpi_dev_resource_memory()/acpi_dev_resource_io() returns false,
it means the the resource is not a memeory/IO resource.
But after commit b355cee88e3b1a193f0e9a81db810f6f83ad728b,
if the memory/IO resource is invalid (the length of the resource is zero),
acpi_dev_resource_memory()/acpi_dev_resource_io() returns false as well.
This breaks pnpacpi_allocated_resource(), because the current code would
recognize the invalid memory/io resource as unknown resource type.
Thus users will get warning messages on machines with zero length
ACPI memeory/IO resources.
This patch fixes the problem by invoking acpi_dev_resource_memory()/
acpi_dev_resource_io() for ACPI memory/IO resources only.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
drivers/pnp/pnpacpi/rsparser.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 167f3d0..66977eb 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -183,9 +183,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
struct resource r = {0};
int i, flags;
- if (acpi_dev_resource_memory(res, &r)
- || acpi_dev_resource_io(res, &r)
- || acpi_dev_resource_address_space(res, &r)
+ if (acpi_dev_resource_address_space(res, &r)
|| acpi_dev_resource_ext_address_space(res, &r)) {
pnp_add_resource(dev, &r);
return AE_OK;
@@ -217,6 +215,17 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
}
switch (res->type) {
+ case ACPI_RESOURCE_TYPE_MEMORY24:
+ case ACPI_RESOURCE_TYPE_MEMORY32:
+ case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
+ if (acpi_dev_resource_memory(res, &r))
+ pnp_add_resource(dev, &r);
+ break;
+ case ACPI_RESOURCE_TYPE_IO:
+ case ACPI_RESOURCE_TYPE_FIXED_IO:
+ if (acpi_dev_resource_io(res, &r))
+ pnp_add_resource(dev, &r);
+ break;
case ACPI_RESOURCE_TYPE_DMA:
dma = &res->data.dma;
if (dma->channel_count > 0 && dma->channels[0] != (u8) -1)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH] PNPACPI: proper handling ACPI IO/Memory resources
2014-03-11 14:40 [PATCH] PNPACPI: proper handling ACPI IO/Memory resources Zhang Rui
@ 2014-03-11 14:50 ` Zhang, Rui
2014-03-11 15:07 ` markus
` (2 more replies)
2014-03-11 23:38 ` Rafael J. Wysocki
1 sibling, 3 replies; 6+ messages in thread
From: Zhang, Rui @ 2014-03-11 14:50 UTC (permalink / raw)
To: Zhang, Rui, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Wysocki, Rafael J, jwollrath@web.de, markus@trippelsdorf.de,
pebolle@tiscali.nl
Julian, Markus and Paul,
Can you please check if this patch fixes the problem for you or not?
Thanks,
rui
> -----Original Message-----
> From: Zhang, Rui
> Sent: Tuesday, March 11, 2014 10:40 PM
> To: linux-acpi@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: Wysocki, Rafael J; jwollrath@web.de; markus@trippelsdorf.de;
> pebolle@tiscali.nl; Zhang, Rui
> Subject: [PATCH] PNPACPI: proper handling ACPI IO/Memory resources
> Importance: High
>
> Before commit b355cee88e3b1a193f0e9a81db810f6f83ad728b,
> if acpi_dev_resource_memory()/acpi_dev_resource_io() returns false, it
> means the the resource is not a memeory/IO resource.
>
> But after commit b355cee88e3b1a193f0e9a81db810f6f83ad728b,
> if the memory/IO resource is invalid (the length of the resource is
> zero),
> acpi_dev_resource_memory()/acpi_dev_resource_io() returns false as well.
>
> This breaks pnpacpi_allocated_resource(), because the current code
> would recognize the invalid memory/io resource as unknown resource type.
> Thus users will get warning messages on machines with zero length ACPI
> memeory/IO resources.
>
> This patch fixes the problem by invoking acpi_dev_resource_memory()/
> acpi_dev_resource_io() for ACPI memory/IO resources only.
>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> ---
> drivers/pnp/pnpacpi/rsparser.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pnp/pnpacpi/rsparser.c
> b/drivers/pnp/pnpacpi/rsparser.c index 167f3d0..66977eb 100644
> --- a/drivers/pnp/pnpacpi/rsparser.c
> +++ b/drivers/pnp/pnpacpi/rsparser.c
> @@ -183,9 +183,7 @@ static acpi_status
> pnpacpi_allocated_resource(struct acpi_resource *res,
> struct resource r = {0};
> int i, flags;
>
> - if (acpi_dev_resource_memory(res, &r)
> - || acpi_dev_resource_io(res, &r)
> - || acpi_dev_resource_address_space(res, &r)
> + if (acpi_dev_resource_address_space(res, &r)
> || acpi_dev_resource_ext_address_space(res, &r)) {
> pnp_add_resource(dev, &r);
> return AE_OK;
> @@ -217,6 +215,17 @@ static acpi_status
> pnpacpi_allocated_resource(struct acpi_resource *res,
> }
>
> switch (res->type) {
> + case ACPI_RESOURCE_TYPE_MEMORY24:
> + case ACPI_RESOURCE_TYPE_MEMORY32:
> + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
> + if (acpi_dev_resource_memory(res, &r))
> + pnp_add_resource(dev, &r);
> + break;
> + case ACPI_RESOURCE_TYPE_IO:
> + case ACPI_RESOURCE_TYPE_FIXED_IO:
> + if (acpi_dev_resource_io(res, &r))
> + pnp_add_resource(dev, &r);
> + break;
> case ACPI_RESOURCE_TYPE_DMA:
> dma = &res->data.dma;
> if (dma->channel_count > 0 && dma->channels[0] != (u8) -1)
> --
> 1.7.9.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PNPACPI: proper handling ACPI IO/Memory resources
2014-03-11 14:50 ` Zhang, Rui
@ 2014-03-11 15:07 ` markus
2014-03-11 15:37 ` Julian Wollrath
2014-03-11 19:15 ` Paul Bolle
2 siblings, 0 replies; 6+ messages in thread
From: markus @ 2014-03-11 15:07 UTC (permalink / raw)
To: Zhang, Rui
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Wysocki, Rafael J, jwollrath@web.de, pebolle@tiscali.nl
On 2014.03.11 at 14:50 +0000, Zhang, Rui wrote:
> Julian, Markus and Paul,
>
> Can you please check if this patch fixes the problem for you or not?
Your patch fixes the issue for me.
Thanks.
--
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PNPACPI: proper handling ACPI IO/Memory resources
2014-03-11 14:50 ` Zhang, Rui
2014-03-11 15:07 ` markus
@ 2014-03-11 15:37 ` Julian Wollrath
2014-03-11 19:15 ` Paul Bolle
2 siblings, 0 replies; 6+ messages in thread
From: Julian Wollrath @ 2014-03-11 15:37 UTC (permalink / raw)
To: Zhang, Rui
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Wysocki, Rafael J, markus@trippelsdorf.de, pebolle@tiscali.nl
Am Tue, 11 Mar 2014 14:50:42 +0000
schrieb "Zhang, Rui" <rui.zhang@intel.com>:
> Can you please check if this patch fixes the problem for you or not?
That patch fixes the problem, thank you. Feel free to add a
Tested-by: Julian Wollrath <jwollrath@web.de>
Cheers,
Julian Wollrath
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PNPACPI: proper handling ACPI IO/Memory resources
2014-03-11 14:50 ` Zhang, Rui
2014-03-11 15:07 ` markus
2014-03-11 15:37 ` Julian Wollrath
@ 2014-03-11 19:15 ` Paul Bolle
2 siblings, 0 replies; 6+ messages in thread
From: Paul Bolle @ 2014-03-11 19:15 UTC (permalink / raw)
To: Zhang, Rui
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Wysocki, Rafael J, jwollrath@web.de, markus@trippelsdorf.de
Rui,
Zhang, Rui schreef op di 11-03-2014 om 14:50 [+0000]:
> Can you please check if this patch fixes the problem for you or not?
Yes, the two messages (one error and one warning) about "_CRS" are gone
with this patch applied on top of v3.14-rc6.
> > Before commit b355cee88e3b1a193f0e9a81db810f6f83ad728b,
> > if acpi_dev_resource_memory()/acpi_dev_resource_io() returns false, it
> > means the the resource is not a memeory/IO resource.
memeory?
> > But after commit b355cee88e3b1a193f0e9a81db810f6f83ad728b,
> > if the memory/IO resource is invalid (the length of the resource is
> > zero),
> > acpi_dev_resource_memory()/acpi_dev_resource_io() returns false as well.
> >
> > This breaks pnpacpi_allocated_resource(), because the current code
> > would recognize the invalid memory/io resource as unknown resource type.
> > Thus users will get warning messages on machines with zero length ACPI
> > memeory/IO resources.
Ditto.
> > This patch fixes the problem by invoking acpi_dev_resource_memory()/
> > acpi_dev_resource_io() for ACPI memory/IO resources only.
> >
> > Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Thanks,
Paul Bolle
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PNPACPI: proper handling ACPI IO/Memory resources
2014-03-11 14:40 [PATCH] PNPACPI: proper handling ACPI IO/Memory resources Zhang Rui
2014-03-11 14:50 ` Zhang, Rui
@ 2014-03-11 23:38 ` Rafael J. Wysocki
1 sibling, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2014-03-11 23:38 UTC (permalink / raw)
To: Zhang Rui
Cc: linux-acpi, linux-kernel, rafael.j.wysocki, jwollrath, markus,
pebolle
On Tuesday, March 11, 2014 10:40:27 PM Zhang Rui wrote:
> Before commit b355cee88e3b1a193f0e9a81db810f6f83ad728b,
> if acpi_dev_resource_memory()/acpi_dev_resource_io() returns false,
> it means the the resource is not a memeory/IO resource.
>
> But after commit b355cee88e3b1a193f0e9a81db810f6f83ad728b,
> if the memory/IO resource is invalid (the length of the resource is zero),
> acpi_dev_resource_memory()/acpi_dev_resource_io() returns false as well.
>
> This breaks pnpacpi_allocated_resource(), because the current code would
> recognize the invalid memory/io resource as unknown resource type.
> Thus users will get warning messages on machines with zero length
> ACPI memeory/IO resources.
>
> This patch fixes the problem by invoking acpi_dev_resource_memory()/
> acpi_dev_resource_io() for ACPI memory/IO resources only.
>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Applied, thanks Rui!
> ---
> drivers/pnp/pnpacpi/rsparser.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
> index 167f3d0..66977eb 100644
> --- a/drivers/pnp/pnpacpi/rsparser.c
> +++ b/drivers/pnp/pnpacpi/rsparser.c
> @@ -183,9 +183,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
> struct resource r = {0};
> int i, flags;
>
> - if (acpi_dev_resource_memory(res, &r)
> - || acpi_dev_resource_io(res, &r)
> - || acpi_dev_resource_address_space(res, &r)
> + if (acpi_dev_resource_address_space(res, &r)
> || acpi_dev_resource_ext_address_space(res, &r)) {
> pnp_add_resource(dev, &r);
> return AE_OK;
> @@ -217,6 +215,17 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
> }
>
> switch (res->type) {
> + case ACPI_RESOURCE_TYPE_MEMORY24:
> + case ACPI_RESOURCE_TYPE_MEMORY32:
> + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
> + if (acpi_dev_resource_memory(res, &r))
> + pnp_add_resource(dev, &r);
> + break;
> + case ACPI_RESOURCE_TYPE_IO:
> + case ACPI_RESOURCE_TYPE_FIXED_IO:
> + if (acpi_dev_resource_io(res, &r))
> + pnp_add_resource(dev, &r);
> + break;
> case ACPI_RESOURCE_TYPE_DMA:
> dma = &res->data.dma;
> if (dma->channel_count > 0 && dma->channels[0] != (u8) -1)
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-03-11 23:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-11 14:40 [PATCH] PNPACPI: proper handling ACPI IO/Memory resources Zhang Rui
2014-03-11 14:50 ` Zhang, Rui
2014-03-11 15:07 ` markus
2014-03-11 15:37 ` Julian Wollrath
2014-03-11 19:15 ` Paul Bolle
2014-03-11 23:38 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox