diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2006-03-28 17:03:00 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-04-01 21:24:49 -0500 |
commit | 1acfb7f2b0d460ee86bdb25ad0679070ec8a5f0d (patch) | |
tree | 2870bc143e40e0d7da477ff8e1b8df1a047bc52f /drivers/pnp/pnpacpi | |
parent | 683aa4012f53b2ada0f430487e05d37b0d94e90a (diff) |
PNPACPI: fix non-memory address space descriptor handling
Fix resource_type handling for QWORD, DWORD, and WORD Address Space
Descriptors. Previously we ignored the resource_type, so I/O ports and bus
number ranges were incorrectly parsed as memory ranges.
Sample PCI root bridge resources from HP rx2600 before this patch:
# cat /sys/bus/pnp/devices/00:02/resources
state = active
mem 0x0-0x1f
mem 0x0-0x3af
mem 0x3e0-0x1fff
mem 0x80000000-0x8fffffff
With this patch:
# cat /sys/bus/pnp/devices/00:02/resources
state = active
io 0x0-0x3af
io 0x3e0-0x1fff
mem 0x80000000-0x8fffffff
mem 0x80004000000-0x80103fffffe
Changes:
0x0-0x1f PCI bus number range was incorrectly reported as memory, now
not reported at all
0x0-0x3af I/O port range was incorrectly reported as memory
0x3e0-0x1fff I/O port range was incorrectly reported as memory
0x80004000000-0x80103fffffe memory range wasn't reported at all because
we only support PNP_MAX_MEM (4) memory resources
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/pnpacpi')
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 407b4eaddcb..522d697cff0 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -120,7 +120,7 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma) | |||
120 | 120 | ||
121 | static void | 121 | static void |
122 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, | 122 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, |
123 | u32 io, u32 len) | 123 | u64 io, u64 len) |
124 | { | 124 | { |
125 | int i = 0; | 125 | int i = 0; |
126 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && | 126 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && |
@@ -156,6 +156,27 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res, | |||
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | static void | ||
160 | pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, | ||
161 | struct acpi_resource *res) | ||
162 | { | ||
163 | struct acpi_resource_address64 addr, *p = &addr; | ||
164 | acpi_status status; | ||
165 | |||
166 | status = acpi_resource_to_address64(res, p); | ||
167 | if (!ACPI_SUCCESS(status)) { | ||
168 | pnp_warn("PnPACPI: failed to convert resource type %d", | ||
169 | res->type); | ||
170 | return; | ||
171 | } | ||
172 | |||
173 | if (p->resource_type == ACPI_MEMORY_RANGE) | ||
174 | pnpacpi_parse_allocated_memresource(res_table, | ||
175 | p->minimum, p->address_length); | ||
176 | else if (p->resource_type == ACPI_IO_RANGE) | ||
177 | pnpacpi_parse_allocated_ioresource(res_table, | ||
178 | p->minimum, p->address_length); | ||
179 | } | ||
159 | 180 | ||
160 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 181 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
161 | void *data) | 182 | void *data) |
@@ -221,19 +242,9 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
221 | res->data.fixed_memory32.address_length); | 242 | res->data.fixed_memory32.address_length); |
222 | break; | 243 | break; |
223 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 244 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
224 | pnpacpi_parse_allocated_memresource(res_table, | ||
225 | res->data.address16.minimum, | ||
226 | res->data.address16.address_length); | ||
227 | break; | ||
228 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 245 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
229 | pnpacpi_parse_allocated_memresource(res_table, | ||
230 | res->data.address32.minimum, | ||
231 | res->data.address32.address_length); | ||
232 | break; | ||
233 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 246 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
234 | pnpacpi_parse_allocated_memresource(res_table, | 247 | pnpacpi_parse_allocated_address_space(res_table, res); |
235 | res->data.address64.minimum, | ||
236 | res->data.address64.address_length); | ||
237 | break; | 248 | break; |
238 | 249 | ||
239 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: | 250 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: |