resource.c (e98bdb3059cbf2b1cd4261e126b08429f64466c3) resource.c (03671057c3b769c0adbf9212bf695481d3f59279)
1/*
2 * drivers/acpi/resource.c - ACPI device resources interpretation.
3 *
4 * Copyright (C) 2012, Intel Corp.
5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *

--- 29 unchanged lines hidden (view full) ---

38 * ACPI IO descriptors on arches other than X86 contain MMIO CPU physical
39 * addresses mapping IO space in CPU physical address space, IO space
40 * resources can be placed anywhere in the 64-bit physical address space.
41 */
42static inline bool
43acpi_iospace_resource_valid(struct resource *res) { return true; }
44#endif
45
1/*
2 * drivers/acpi/resource.c - ACPI device resources interpretation.
3 *
4 * Copyright (C) 2012, Intel Corp.
5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *

--- 29 unchanged lines hidden (view full) ---

38 * ACPI IO descriptors on arches other than X86 contain MMIO CPU physical
39 * addresses mapping IO space in CPU physical address space, IO space
40 * resources can be placed anywhere in the 64-bit physical address space.
41 */
42static inline bool
43acpi_iospace_resource_valid(struct resource *res) { return true; }
44#endif
45
46#if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)
47static inline bool is_gsi(struct acpi_resource_extended_irq *ext_irq)
48{
49 return ext_irq->resource_source.string_length == 0 &&
50 ext_irq->producer_consumer == ACPI_CONSUMER;
51}
52#else
53static inline bool is_gsi(struct acpi_resource_extended_irq *ext_irq)
54{
55 return true;
56}
57#endif
58
46static bool acpi_dev_resource_len_valid(u64 start, u64 end, u64 len, bool io)
47{
48 u64 reslen = end - start + 1;
49
50 /*
51 * CHECKME: len might be required to check versus a minimum
52 * length as well. 1 for io is fine, but for memory it does
53 * not make any sense at all.

--- 334 unchanged lines hidden (view full) ---

388 int irq, p, t;
389
390 if (!valid_IRQ(gsi)) {
391 acpi_dev_irqresource_disabled(res, gsi);
392 return;
393 }
394
395 /*
59static bool acpi_dev_resource_len_valid(u64 start, u64 end, u64 len, bool io)
60{
61 u64 reslen = end - start + 1;
62
63 /*
64 * CHECKME: len might be required to check versus a minimum
65 * length as well. 1 for io is fine, but for memory it does
66 * not make any sense at all.

--- 334 unchanged lines hidden (view full) ---

401 int irq, p, t;
402
403 if (!valid_IRQ(gsi)) {
404 acpi_dev_irqresource_disabled(res, gsi);
405 return;
406 }
407
408 /*
396 * In IO-APIC mode, use overrided attribute. Two reasons:
409 * In IO-APIC mode, use overridden attribute. Two reasons:
397 * 1. BIOS bug in DSDT
398 * 2. BIOS uses IO-APIC mode Interrupt Source Override
399 *
400 * We do this only if we are dealing with IRQ() or IRQNoFlags()
401 * resource (the legacy ISA resources). With modern ACPI 5 devices
402 * using extended IRQ descriptors we take the IRQ configuration
403 * from _CRS directly.
404 */

--- 60 unchanged lines hidden (view full) ---

465 irq->sharable, true);
466 break;
467 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
468 ext_irq = &ares->data.extended_irq;
469 if (index >= ext_irq->interrupt_count) {
470 acpi_dev_irqresource_disabled(res, 0);
471 return false;
472 }
410 * 1. BIOS bug in DSDT
411 * 2. BIOS uses IO-APIC mode Interrupt Source Override
412 *
413 * We do this only if we are dealing with IRQ() or IRQNoFlags()
414 * resource (the legacy ISA resources). With modern ACPI 5 devices
415 * using extended IRQ descriptors we take the IRQ configuration
416 * from _CRS directly.
417 */

--- 60 unchanged lines hidden (view full) ---

478 irq->sharable, true);
479 break;
480 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
481 ext_irq = &ares->data.extended_irq;
482 if (index >= ext_irq->interrupt_count) {
483 acpi_dev_irqresource_disabled(res, 0);
484 return false;
485 }
473 acpi_dev_get_irqresource(res, ext_irq->interrupts[index],
486 if (is_gsi(ext_irq))
487 acpi_dev_get_irqresource(res, ext_irq->interrupts[index],
474 ext_irq->triggering, ext_irq->polarity,
475 ext_irq->sharable, false);
488 ext_irq->triggering, ext_irq->polarity,
489 ext_irq->sharable, false);
490 else
491 acpi_dev_irqresource_disabled(res, 0);
476 break;
477 default:
478 res->flags = 0;
479 return false;
480 }
481
482 return true;
483}

--- 240 unchanged lines hidden ---
492 break;
493 default:
494 res->flags = 0;
495 return false;
496 }
497
498 return true;
499}

--- 240 unchanged lines hidden ---