PNPACPI: proper handling ACPI IO/Memory resources
Subsystems (2)
PATCH 1/1 PNPACPI: proper handling ACPI IO/Memory resources
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.
--- drivers/pnp/pnpacpi/rsparser.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/pnp/pnpacpi/rsparser.c +12 -3
@@ -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 )
Signature · 1 line
1.7.9.5
Julian, Markus and Paul,
Can you please check if this patch fixes the problem for you or not?
Thanks,
rui
Quoted 68 lines
-----Original Message-----
From: Zhang, Rui
Sent: Tuesday, March 11, 2014 10:40 PM
To: [email protected]; [email protected]
Cc: Wysocki, Rafael J; [email protected]; [email protected]; [email protected]; Zhang, Rui
Subject: [PATCH] PNPACPI: proper handling ACPI IO/Memory resources
Importance: HighBefore 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 <[email protected]>--- drivers/pnp/pnpacpi/rsparser.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/pnp/pnpacpi/rsparser.cindex 167f3d0..66977eb 100644drivers/pnp/pnpacpi/rsparser.c +1
-3@@ -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);drivers/pnp/pnpacpi/rsparser.c +11
-0return 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
Quoted 3 lines · Rui
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.
Signature · 1 line
Markus
Julian Wollrath
Tested-byAm Tue, 11 Mar 2014 14:50:42 +0000
schrieb "Zhang, Rui" <[email protected]>:
Quoted 1 line
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
Cheers,
Julian Wollrath
Rui,
Zhang, Rui schreef op di 11-03-2014 om 14:50 [+0000]:
Quoted 1 line
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.
Quoted 3 lines
Quoted 3 lines
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?
Quoted 9 lines
Quoted 9 lines
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.
Quoted 4 lines
Quoted 4 lines
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 <[email protected]>
Thanks,
Paul Bolle
Rafael J. Wysocki
AppliedQuoted 13 lines · 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.
Quoted 4 lines
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 <[email protected]>
Applied, thanks Rui!
Quoted 38 lines
--- drivers/pnp/pnpacpi/rsparser.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)drivers/pnp/pnpacpi/rsparser.c +12
-3@@ -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 )
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.