aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpacpi/rsparser.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/pnpacpi/rsparser.c')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c49
1 files changed, 34 insertions, 15 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 5702b2c8691f..54514aa35b09 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,15 +259,26 @@ 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}
262 267
268static void pnpacpi_parse_allocated_busresource(struct pnp_dev *dev,
269 u64 start, u64 len)
270{
271 u64 end = start + len - 1;
272
273 pnp_add_bus_resource(dev, start, end);
274}
275
263static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, 276static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
264 struct acpi_resource *res) 277 struct acpi_resource *res)
265{ 278{
266 struct acpi_resource_address64 addr, *p = &addr; 279 struct acpi_resource_address64 addr, *p = &addr;
267 acpi_status status; 280 acpi_status status;
281 int window;
268 282
269 status = acpi_resource_to_address64(res, p); 283 status = acpi_resource_to_address64(res, p);
270 if (!ACPI_SUCCESS(status)) { 284 if (!ACPI_SUCCESS(status)) {
@@ -273,37 +287,42 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
273 return; 287 return;
274 } 288 }
275 289
276 if (p->producer_consumer == ACPI_PRODUCER) 290 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0;
277 return;
278 291
279 if (p->resource_type == ACPI_MEMORY_RANGE) 292 if (p->resource_type == ACPI_MEMORY_RANGE)
280 pnpacpi_parse_allocated_memresource(dev, 293 pnpacpi_parse_allocated_memresource(dev,
281 p->minimum, p->address_length, 294 p->minimum, p->address_length,
282 p->info.mem.write_protect); 295 p->info.mem.write_protect, window);
283 else if (p->resource_type == ACPI_IO_RANGE) 296 else if (p->resource_type == ACPI_IO_RANGE)
284 pnpacpi_parse_allocated_ioresource(dev, 297 pnpacpi_parse_allocated_ioresource(dev,
285 p->minimum, p->address_length, 298 p->minimum, p->address_length,
286 p->granularity == 0xfff ? ACPI_DECODE_10 : 299 p->granularity == 0xfff ? ACPI_DECODE_10 :
287 ACPI_DECODE_16); 300 ACPI_DECODE_16, window);
301 else if (p->resource_type == ACPI_BUS_NUMBER_RANGE)
302 pnpacpi_parse_allocated_busresource(dev, p->minimum,
303 p->address_length);
288} 304}
289 305
290static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, 306static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev,
291 struct acpi_resource *res) 307 struct acpi_resource *res)
292{ 308{
293 struct acpi_resource_extended_address64 *p = &res->data.ext_address64; 309 struct acpi_resource_extended_address64 *p = &res->data.ext_address64;
310 int window;
294 311
295 if (p->producer_consumer == ACPI_PRODUCER) 312 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0;
296 return;
297 313
298 if (p->resource_type == ACPI_MEMORY_RANGE) 314 if (p->resource_type == ACPI_MEMORY_RANGE)
299 pnpacpi_parse_allocated_memresource(dev, 315 pnpacpi_parse_allocated_memresource(dev,
300 p->minimum, p->address_length, 316 p->minimum, p->address_length,
301 p->info.mem.write_protect); 317 p->info.mem.write_protect, window);
302 else if (p->resource_type == ACPI_IO_RANGE) 318 else if (p->resource_type == ACPI_IO_RANGE)
303 pnpacpi_parse_allocated_ioresource(dev, 319 pnpacpi_parse_allocated_ioresource(dev,
304 p->minimum, p->address_length, 320 p->minimum, p->address_length,
305 p->granularity == 0xfff ? ACPI_DECODE_10 : 321 p->granularity == 0xfff ? ACPI_DECODE_10 :
306 ACPI_DECODE_16); 322 ACPI_DECODE_16, window);
323 else if (p->resource_type == ACPI_BUS_NUMBER_RANGE)
324 pnpacpi_parse_allocated_busresource(dev, p->minimum,
325 p->address_length);
307} 326}
308 327
309static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, 328static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
@@ -368,7 +387,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
368 pnpacpi_parse_allocated_ioresource(dev, 387 pnpacpi_parse_allocated_ioresource(dev,
369 io->minimum, 388 io->minimum,
370 io->address_length, 389 io->address_length,
371 io->io_decode); 390 io->io_decode, 0);
372 break; 391 break;
373 392
374 case ACPI_RESOURCE_TYPE_START_DEPENDENT: 393 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
@@ -380,7 +399,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
380 pnpacpi_parse_allocated_ioresource(dev, 399 pnpacpi_parse_allocated_ioresource(dev,
381 fixed_io->address, 400 fixed_io->address,
382 fixed_io->address_length, 401 fixed_io->address_length,
383 ACPI_DECODE_10); 402 ACPI_DECODE_10, 0);
384 break; 403 break;
385 404
386 case ACPI_RESOURCE_TYPE_VENDOR: 405 case ACPI_RESOURCE_TYPE_VENDOR:
@@ -396,21 +415,21 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
396 pnpacpi_parse_allocated_memresource(dev, 415 pnpacpi_parse_allocated_memresource(dev,
397 memory24->minimum, 416 memory24->minimum,
398 memory24->address_length, 417 memory24->address_length,
399 memory24->write_protect); 418 memory24->write_protect, 0);
400 break; 419 break;
401 case ACPI_RESOURCE_TYPE_MEMORY32: 420 case ACPI_RESOURCE_TYPE_MEMORY32:
402 memory32 = &res->data.memory32; 421 memory32 = &res->data.memory32;
403 pnpacpi_parse_allocated_memresource(dev, 422 pnpacpi_parse_allocated_memresource(dev,
404 memory32->minimum, 423 memory32->minimum,
405 memory32->address_length, 424 memory32->address_length,
406 memory32->write_protect); 425 memory32->write_protect, 0);
407 break; 426 break;
408 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: 427 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
409 fixed_memory32 = &res->data.fixed_memory32; 428 fixed_memory32 = &res->data.fixed_memory32;
410 pnpacpi_parse_allocated_memresource(dev, 429 pnpacpi_parse_allocated_memresource(dev,
411 fixed_memory32->address, 430 fixed_memory32->address,
412 fixed_memory32->address_length, 431 fixed_memory32->address_length,
413 fixed_memory32->write_protect); 432 fixed_memory32->write_protect, 0);
414 break; 433 break;
415 case ACPI_RESOURCE_TYPE_ADDRESS16: 434 case ACPI_RESOURCE_TYPE_ADDRESS16:
416 case ACPI_RESOURCE_TYPE_ADDRESS32: 435 case ACPI_RESOURCE_TYPE_ADDRESS32: