aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2010-03-05 12:47:52 -0500
committerLen Brown <len.brown@intel.com>2010-03-14 20:08:37 -0400
commitfa35b49260b615d634bfa1f767aa315fa323c2e9 (patch)
treebb518f40386f4118d0fab130c28209201a0f24e9 /drivers/pnp
parent9d7cca04211d4eb104eaaa424b98f650bc29c730 (diff)
PNPACPI: add window support
Add support for resource windows. This is for bridge resources, i.e., regions where a bridge forwards transactions from the primary to the secondary side. This does not add support for *setting* windows via the /proc interface. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/interface.c6
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c35
2 files changed, 24 insertions, 17 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index 68b0c04987e4..ba437b704de8 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -278,9 +278,11 @@ static ssize_t pnp_show_current_resources(struct device *dmdev,
278 switch (pnp_resource_type(res)) { 278 switch (pnp_resource_type(res)) {
279 case IORESOURCE_IO: 279 case IORESOURCE_IO:
280 case IORESOURCE_MEM: 280 case IORESOURCE_MEM:
281 pnp_printf(buffer, " %#llx-%#llx\n", 281 pnp_printf(buffer, " %#llx-%#llx%s\n",
282 (unsigned long long) res->start, 282 (unsigned long long) res->start,
283 (unsigned long long) res->end); 283 (unsigned long long) res->end,
284 res->flags & IORESOURCE_WINDOW ?
285 " window" : "");
284 break; 286 break;
285 case IORESOURCE_IRQ: 287 case IORESOURCE_IRQ:
286 case IORESOURCE_DMA: 288 case IORESOURCE_DMA:
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 5702b2c8691f..0d7d61da63fc 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -177,7 +177,8 @@ static int dma_flags(struct pnp_dev *dev, int type, int bus_master,
177} 177}
178 178
179static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, u64 start, 179static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, u64 start,
180 u64 len, int io_decode) 180 u64 len, int io_decode,
181 int window)
181{ 182{
182 int flags = 0; 183 int flags = 0;
183 u64 end = start + len - 1; 184 u64 end = start + len - 1;
@@ -186,6 +187,8 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, u64 start,
186 flags |= IORESOURCE_IO_16BIT_ADDR; 187 flags |= IORESOURCE_IO_16BIT_ADDR;
187 if (len == 0 || end >= 0x10003) 188 if (len == 0 || end >= 0x10003)
188 flags |= IORESOURCE_DISABLED; 189 flags |= IORESOURCE_DISABLED;
190 if (window)
191 flags |= IORESOURCE_WINDOW;
189 192
190 pnp_add_io_resource(dev, start, end, flags); 193 pnp_add_io_resource(dev, start, end, flags);
191} 194}
@@ -247,7 +250,7 @@ static void pnpacpi_parse_allocated_vendor(struct pnp_dev *dev,
247 250
248static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev, 251static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev,
249 u64 start, u64 len, 252 u64 start, u64 len,
250 int write_protect) 253 int write_protect, int window)
251{ 254{
252 int flags = 0; 255 int flags = 0;
253 u64 end = start + len - 1; 256 u64 end = start + len - 1;
@@ -256,6 +259,8 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev,
256 flags |= IORESOURCE_DISABLED; 259 flags |= IORESOURCE_DISABLED;
257 if (write_protect == ACPI_READ_WRITE_MEMORY) 260 if (write_protect == ACPI_READ_WRITE_MEMORY)
258 flags |= IORESOURCE_MEM_WRITEABLE; 261 flags |= IORESOURCE_MEM_WRITEABLE;
262 if (window)
263 flags |= IORESOURCE_WINDOW;
259 264
260 pnp_add_mem_resource(dev, start, end, flags); 265 pnp_add_mem_resource(dev, start, end, flags);
261} 266}
@@ -265,6 +270,7 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
265{ 270{
266 struct acpi_resource_address64 addr, *p = &addr; 271 struct acpi_resource_address64 addr, *p = &addr;
267 acpi_status status; 272 acpi_status status;
273 int window;
268 274
269 status = acpi_resource_to_address64(res, p); 275 status = acpi_resource_to_address64(res, p);
270 if (!ACPI_SUCCESS(status)) { 276 if (!ACPI_SUCCESS(status)) {
@@ -273,37 +279,36 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
273 return; 279 return;
274 } 280 }
275 281
276 if (p->producer_consumer == ACPI_PRODUCER) 282 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0;
277 return;
278 283
279 if (p->resource_type == ACPI_MEMORY_RANGE) 284 if (p->resource_type == ACPI_MEMORY_RANGE)
280 pnpacpi_parse_allocated_memresource(dev, 285 pnpacpi_parse_allocated_memresource(dev,
281 p->minimum, p->address_length, 286 p->minimum, p->address_length,
282 p->info.mem.write_protect); 287 p->info.mem.write_protect, window);
283 else if (p->resource_type == ACPI_IO_RANGE) 288 else if (p->resource_type == ACPI_IO_RANGE)
284 pnpacpi_parse_allocated_ioresource(dev, 289 pnpacpi_parse_allocated_ioresource(dev,
285 p->minimum, p->address_length, 290 p->minimum, p->address_length,
286 p->granularity == 0xfff ? ACPI_DECODE_10 : 291 p->granularity == 0xfff ? ACPI_DECODE_10 :
287 ACPI_DECODE_16); 292 ACPI_DECODE_16, window);
288} 293}
289 294
290static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, 295static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev,
291 struct acpi_resource *res) 296 struct acpi_resource *res)
292{ 297{
293 struct acpi_resource_extended_address64 *p = &res->data.ext_address64; 298 struct acpi_resource_extended_address64 *p = &res->data.ext_address64;
299 int window;
294 300
295 if (p->producer_consumer == ACPI_PRODUCER) 301 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0;
296 return;
297 302
298 if (p->resource_type == ACPI_MEMORY_RANGE) 303 if (p->resource_type == ACPI_MEMORY_RANGE)
299 pnpacpi_parse_allocated_memresource(dev, 304 pnpacpi_parse_allocated_memresource(dev,
300 p->minimum, p->address_length, 305 p->minimum, p->address_length,
301 p->info.mem.write_protect); 306 p->info.mem.write_protect, window);
302 else if (p->resource_type == ACPI_IO_RANGE) 307 else if (p->resource_type == ACPI_IO_RANGE)
303 pnpacpi_parse_allocated_ioresource(dev, 308 pnpacpi_parse_allocated_ioresource(dev,
304 p->minimum, p->address_length, 309 p->minimum, p->address_length,
305 p->granularity == 0xfff ? ACPI_DECODE_10 : 310 p->granularity == 0xfff ? ACPI_DECODE_10 :
306 ACPI_DECODE_16); 311 ACPI_DECODE_16, window);
307} 312}
308 313
309static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, 314static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
@@ -368,7 +373,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
368 pnpacpi_parse_allocated_ioresource(dev, 373 pnpacpi_parse_allocated_ioresource(dev,
369 io->minimum, 374 io->minimum,
370 io->address_length, 375 io->address_length,
371 io->io_decode); 376 io->io_decode, 0);
372 break; 377 break;
373 378
374 case ACPI_RESOURCE_TYPE_START_DEPENDENT: 379 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
@@ -380,7 +385,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
380 pnpacpi_parse_allocated_ioresource(dev, 385 pnpacpi_parse_allocated_ioresource(dev,
381 fixed_io->address, 386 fixed_io->address,
382 fixed_io->address_length, 387 fixed_io->address_length,
383 ACPI_DECODE_10); 388 ACPI_DECODE_10, 0);
384 break; 389 break;
385 390
386 case ACPI_RESOURCE_TYPE_VENDOR: 391 case ACPI_RESOURCE_TYPE_VENDOR:
@@ -396,21 +401,21 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
396 pnpacpi_parse_allocated_memresource(dev, 401 pnpacpi_parse_allocated_memresource(dev,
397 memory24->minimum, 402 memory24->minimum,
398 memory24->address_length, 403 memory24->address_length,
399 memory24->write_protect); 404 memory24->write_protect, 0);
400 break; 405 break;
401 case ACPI_RESOURCE_TYPE_MEMORY32: 406 case ACPI_RESOURCE_TYPE_MEMORY32:
402 memory32 = &res->data.memory32; 407 memory32 = &res->data.memory32;
403 pnpacpi_parse_allocated_memresource(dev, 408 pnpacpi_parse_allocated_memresource(dev,
404 memory32->minimum, 409 memory32->minimum,
405 memory32->address_length, 410 memory32->address_length,
406 memory32->write_protect); 411 memory32->write_protect, 0);
407 break; 412 break;
408 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: 413 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
409 fixed_memory32 = &res->data.fixed_memory32; 414 fixed_memory32 = &res->data.fixed_memory32;
410 pnpacpi_parse_allocated_memresource(dev, 415 pnpacpi_parse_allocated_memresource(dev,
411 fixed_memory32->address, 416 fixed_memory32->address,
412 fixed_memory32->address_length, 417 fixed_memory32->address_length,
413 fixed_memory32->write_protect); 418 fixed_memory32->write_protect, 0);
414 break; 419 break;
415 case ACPI_RESOURCE_TYPE_ADDRESS16: 420 case ACPI_RESOURCE_TYPE_ADDRESS16:
416 case ACPI_RESOURCE_TYPE_ADDRESS32: 421 case ACPI_RESOURCE_TYPE_ADDRESS32: