aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-01-29 13:17:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-01-29 13:17:53 -0500
commit1a9a126b5098160ca934a352617e9e65dbfa679d (patch)
treeb9c611e2a7a98b9f54c14b0979864f5fab98fb1c
parent7f3fdd40a7dfaa7405185250974b0fabd08c1f8b (diff)
parenta7f2766ac7c359216da4e714dc117c881e39a74a (diff)
Merge tag 'acpi-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki: "The majority of this is an update of the ACPICA kernel code to upstream revision 20171215 with a cosmetic change and a maintainers information update on top of it. The rest is mostly some minor fixes and cleanups in the ACPI drivers and cleanups to initialization on x86. Specifics: - Update the ACPICA kernel code to upstream revision 20171215 including: * Support for ACPI 6.0A changes in the NFIT table (Bob Moore) * Local 64-bit divide in string conversions (Bob Moore) * Fix for a regression in acpi_evaluate_object_type() (Bob Moore) * Fixes for memory leaks during package object resolution (Bob Moore) * Deployment of safe version of strncpy() (Bob Moore) * Debug and messaging updates (Bob Moore) * Support for PDTT, SDEV, TPM2 tables in iASL and tools (Bob Moore) * Null pointer dereference avoidance in Op and cleanups (Colin Ian King) * Fix for memory leak from building prefixed pathname (Erik Schmauss) * Coding style fixes, disassembler and compiler updates (Hanjun Guo, Erik Schmauss) * Additional PPTT flags from ACPI 6.2 (Jeremy Linton) * Fix for an off-by-one error in acpi_get_timer_duration() (Jung-uk Kim) * Infinite loop detection timeout and utilities cleanups (Lv Zheng) * Windows 10 version 1607 and 1703 OSI strings (Mario Limonciello) - Update ACPICA information in MAINTAINERS to reflect the current status of ACPICA maintenance and rename a local variable in one function to match the corresponding upstream code (Rafael Wysocki) - Clean up ACPI-related initialization on x86 (Andy Shevchenko) - Add support for Intel Merrifield to the ACPI GPIO code (Andy Shevchenko) - Clean up ACPI PMIC drivers (Andy Shevchenko, Arvind Yadav) - Fix the ACPI Generic Event Device (GED) driver to free IRQs on shutdown and clean up the PCI IRQ Link driver (Sinan Kaya) - Make the GHES code call into the AER driver on all errors and clean up the ACPI APEI code (Colin Ian King, Tyler Baicar) - Make the IA64 ACPI NUMA code parse all SRAT entries (Ganapatrao Kulkarni) - Add a lid switch blacklist to the ACPI button driver and make it print extra debug messages on lid events (Hans de Goede) - Add quirks for Asus GL502VSK and UX305LA to the ACPI battery driver and clean it up somewhat (Bjørn Mork, Kai-Heng Feng) - Add device link for CHT SD card dependency on I2C to the ACPI LPSS (Intel SoCs) driver and make it avoid creating platform device objects for devices without MMIO resources (Adrian Hunter, Hans de Goede) - Fix the ACPI GPE mask kernel command line parameter handling (Prarit Bhargava) - Fix the handling of (incorrectly exposed) backlight interfaces without LCD (Hans de Goede) - Fix the usage of debugfs_create_*() in the ACPI EC driver (Geert Uytterhoeven)" * tag 'acpi-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (62 commits) ACPI/PCI: pci_link: reduce verbosity when IRQ is enabled ACPI / LPSS: Do not instiate platform_dev for devs without MMIO resources ACPI / PMIC: Convert to use builtin_platform_driver() macro ACPI / x86: boot: Propagate error code in acpi_gsi_to_irq() ACPICA: Update version to 20171215 ACPICA: trivial style fix, no functional change ACPICA: Fix a couple memory leaks during package object resolution ACPICA: Recognize the Windows 10 version 1607 and 1703 OSI strings ACPICA: DT compiler: prevent error if optional field at the end of table is not present ACPICA: Rename a global variable, no functional change ACPICA: Create and deploy safe version of strncpy ACPICA: Cleanup the global variables and update comments ACPICA: Debugger: fix slight indentation issue ACPICA: Fix a regression in the acpi_evaluate_object_type() interface ACPICA: Update for a few debug output statements ACPICA: Debug output, no functional change ACPI: EC: Fix debugfs_create_*() usage ACPI / video: Default lcd_only to true on Win8-ready and newer machines ACPI / x86: boot: Don't setup SCI on HW-reduced platforms ACPI / x86: boot: Use INVALID_ACPI_IRQ instead of 0 for acpi_sci_override_gsi ...
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt1
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/ia64/kernel/acpi.c5
-rw-r--r--arch/x86/include/asm/acpi.h2
-rw-r--r--arch/x86/kernel/acpi/boot.c35
-rw-r--r--drivers/acpi/acpi_lpss.c139
-rw-r--r--drivers/acpi/acpi_video.c14
-rw-r--r--drivers/acpi/acpica/acapps.h3
-rw-r--r--drivers/acpi/acpica/acdebug.h4
-rw-r--r--drivers/acpi/acpica/acglobal.h82
-rw-r--r--drivers/acpi/acpica/aclocal.h15
-rw-r--r--drivers/acpi/acpica/acmacros.h2
-rw-r--r--drivers/acpi/acpica/acnamesp.h3
-rw-r--r--drivers/acpi/acpica/acutils.h23
-rw-r--r--drivers/acpi/acpica/dbexec.c110
-rw-r--r--drivers/acpi/acpica/dbfileio.c4
-rw-r--r--drivers/acpi/acpica/dbinput.c145
-rw-r--r--drivers/acpi/acpica/dscontrol.c18
-rw-r--r--drivers/acpi/acpica/dsfield.c28
-rw-r--r--drivers/acpi/acpica/dsobject.c4
-rw-r--r--drivers/acpi/acpica/dspkginit.c21
-rw-r--r--drivers/acpi/acpica/dsutils.c3
-rw-r--r--drivers/acpi/acpica/dswload.c6
-rw-r--r--drivers/acpi/acpica/dswload2.c13
-rw-r--r--drivers/acpi/acpica/evregion.c10
-rw-r--r--drivers/acpi/acpica/exdump.c11
-rw-r--r--drivers/acpi/acpica/hwtimer.c29
-rw-r--r--drivers/acpi/acpica/hwvalid.c14
-rw-r--r--drivers/acpi/acpica/nsaccess.c13
-rw-r--r--drivers/acpi/acpica/nsconvert.c3
-rw-r--r--drivers/acpi/acpica/nsnames.c149
-rw-r--r--drivers/acpi/acpica/nssearch.c1
-rw-r--r--drivers/acpi/acpica/nsxfeval.c9
-rw-r--r--drivers/acpi/acpica/psargs.c2
-rw-r--r--drivers/acpi/acpica/psobject.c10
-rw-r--r--drivers/acpi/acpica/psutils.c14
-rw-r--r--drivers/acpi/acpica/utdebug.c18
-rw-r--r--drivers/acpi/acpica/utdecode.c11
-rw-r--r--drivers/acpi/acpica/uterror.c73
-rw-r--r--drivers/acpi/acpica/utinit.c1
-rw-r--r--drivers/acpi/acpica/utmath.c4
-rw-r--r--drivers/acpi/acpica/utmutex.c9
-rw-r--r--drivers/acpi/acpica/utnonansi.c11
-rw-r--r--drivers/acpi/acpica/utosi.c2
-rw-r--r--drivers/acpi/acpica/utstrsuppt.c42
-rw-r--r--drivers/acpi/acpica/uttrack.c6
-rw-r--r--drivers/acpi/acpica/utxferror.c8
-rw-r--r--drivers/acpi/apei/ghes.c79
-rw-r--r--drivers/acpi/battery.c36
-rw-r--r--drivers/acpi/button.c22
-rw-r--r--drivers/acpi/ec.c2
-rw-r--r--drivers/acpi/ec_sys.c2
-rw-r--r--drivers/acpi/evged.c47
-rw-r--r--drivers/acpi/internal.h2
-rw-r--r--drivers/acpi/numa.c3
-rw-r--r--drivers/acpi/pci_link.c2
-rw-r--r--drivers/acpi/pmic/intel_pmic_bxtwc.c9
-rw-r--r--drivers/acpi/pmic/intel_pmic_chtdc_ti.c5
-rw-r--r--drivers/acpi/pmic/intel_pmic_chtwc.c9
-rw-r--r--drivers/acpi/pmic/intel_pmic_crc.c7
-rw-r--r--drivers/acpi/pmic/intel_pmic_xpower.c7
-rw-r--r--drivers/acpi/sysfs.c26
-rw-r--r--include/acpi/acconfig.h4
-rw-r--r--include/acpi/acexcep.h12
-rw-r--r--include/acpi/acpixf.h6
-rw-r--r--include/acpi/actbl1.h159
-rw-r--r--include/acpi/actbl2.h15
-rw-r--r--include/acpi/actypes.h4
-rw-r--r--tools/power/acpi/tools/acpidump/apmain.c28
69 files changed, 1210 insertions, 408 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 281c85839c17..1bdcf572c2ac 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -114,7 +114,6 @@
114 This facility can be used to prevent such uncontrolled 114 This facility can be used to prevent such uncontrolled
115 GPE floodings. 115 GPE floodings.
116 Format: <int> 116 Format: <int>
117 Support masking of GPEs numbered from 0x00 to 0x7f.
118 117
119 acpi_no_auto_serialize [HW,ACPI] 118 acpi_no_auto_serialize [HW,ACPI]
120 Disable auto-serialization of AML methods 119 Disable auto-serialization of AML methods
diff --git a/MAINTAINERS b/MAINTAINERS
index cf729942f33d..2f0e8d927185 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -329,7 +329,7 @@ F: drivers/acpi/apei/
329 329
330ACPI COMPONENT ARCHITECTURE (ACPICA) 330ACPI COMPONENT ARCHITECTURE (ACPICA)
331M: Robert Moore <robert.moore@intel.com> 331M: Robert Moore <robert.moore@intel.com>
332M: Lv Zheng <lv.zheng@intel.com> 332M: Erik Schmauss <erik.schmauss@intel.com>
333M: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> 333M: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
334L: linux-acpi@vger.kernel.org 334L: linux-acpi@vger.kernel.org
335L: devel@acpica.org 335L: devel@acpica.org
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 1d29b2f8726b..1dacbf5e9e09 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -504,6 +504,11 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
504 if (!(ma->flags & ACPI_SRAT_MEM_ENABLED)) 504 if (!(ma->flags & ACPI_SRAT_MEM_ENABLED))
505 return -1; 505 return -1;
506 506
507 if (num_node_memblks >= NR_NODE_MEMBLKS) {
508 pr_err("NUMA: too many memblk ranges\n");
509 return -EINVAL;
510 }
511
507 /* record this node in proximity bitmap */ 512 /* record this node in proximity bitmap */
508 pxm_bit_set(pxm); 513 pxm_bit_set(pxm);
509 514
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 8d0ec9df1cbe..44f5d79d5105 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -49,7 +49,7 @@ extern int acpi_fix_pin2_polarity;
49extern int acpi_disable_cmcff; 49extern int acpi_disable_cmcff;
50 50
51extern u8 acpi_sci_flags; 51extern u8 acpi_sci_flags;
52extern int acpi_sci_override_gsi; 52extern u32 acpi_sci_override_gsi;
53void acpi_pic_sci_set_trigger(unsigned int, u16); 53void acpi_pic_sci_set_trigger(unsigned int, u16);
54 54
55struct device; 55struct device;
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index f4c463df8b08..ec3a286163c3 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -68,8 +68,9 @@ int acpi_ioapic;
68int acpi_strict; 68int acpi_strict;
69int acpi_disable_cmcff; 69int acpi_disable_cmcff;
70 70
71/* ACPI SCI override configuration */
71u8 acpi_sci_flags __initdata; 72u8 acpi_sci_flags __initdata;
72int acpi_sci_override_gsi __initdata; 73u32 acpi_sci_override_gsi __initdata = INVALID_ACPI_IRQ;
73int acpi_skip_timer_override __initdata; 74int acpi_skip_timer_override __initdata;
74int acpi_use_timer_override __initdata; 75int acpi_use_timer_override __initdata;
75int acpi_fix_pin2_polarity __initdata; 76int acpi_fix_pin2_polarity __initdata;
@@ -112,8 +113,6 @@ static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = {
112 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 113 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
113}; 114};
114 115
115#define ACPI_INVALID_GSI INT_MIN
116
117/* 116/*
118 * This is just a simple wrapper around early_memremap(), 117 * This is just a simple wrapper around early_memremap(),
119 * with sanity checks for phys == 0 and size == 0. 118 * with sanity checks for phys == 0 and size == 0.
@@ -372,7 +371,7 @@ static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
372 * and acpi_isa_irq_to_gsi() may give wrong result. 371 * and acpi_isa_irq_to_gsi() may give wrong result.
373 */ 372 */
374 if (gsi < nr_legacy_irqs() && isa_irq_to_gsi[gsi] == gsi) 373 if (gsi < nr_legacy_irqs() && isa_irq_to_gsi[gsi] == gsi)
375 isa_irq_to_gsi[gsi] = ACPI_INVALID_GSI; 374 isa_irq_to_gsi[gsi] = INVALID_ACPI_IRQ;
376 isa_irq_to_gsi[bus_irq] = gsi; 375 isa_irq_to_gsi[bus_irq] = gsi;
377} 376}
378 377
@@ -620,24 +619,24 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
620 } 619 }
621 620
622 rc = acpi_get_override_irq(gsi, &trigger, &polarity); 621 rc = acpi_get_override_irq(gsi, &trigger, &polarity);
623 if (rc == 0) { 622 if (rc)
624 trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; 623 return rc;
625 polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
626 irq = acpi_register_gsi(NULL, gsi, trigger, polarity);
627 if (irq >= 0) {
628 *irqp = irq;
629 return 0;
630 }
631 }
632 624
633 return -1; 625 trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
626 polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
627 irq = acpi_register_gsi(NULL, gsi, trigger, polarity);
628 if (irq < 0)
629 return irq;
630
631 *irqp = irq;
632 return 0;
634} 633}
635EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); 634EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
636 635
637int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi) 636int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
638{ 637{
639 if (isa_irq < nr_legacy_irqs() && 638 if (isa_irq < nr_legacy_irqs() &&
640 isa_irq_to_gsi[isa_irq] != ACPI_INVALID_GSI) { 639 isa_irq_to_gsi[isa_irq] != INVALID_ACPI_IRQ) {
641 *gsi = isa_irq_to_gsi[isa_irq]; 640 *gsi = isa_irq_to_gsi[isa_irq];
642 return 0; 641 return 0;
643 } 642 }
@@ -676,8 +675,7 @@ static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi,
676 mutex_lock(&acpi_ioapic_lock); 675 mutex_lock(&acpi_ioapic_lock);
677 irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info); 676 irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info);
678 /* Don't set up the ACPI SCI because it's already set up */ 677 /* Don't set up the ACPI SCI because it's already set up */
679 if (irq >= 0 && enable_update_mptable && 678 if (irq >= 0 && enable_update_mptable && gsi != acpi_gbl_FADT.sci_interrupt)
680 acpi_gbl_FADT.sci_interrupt != gsi)
681 mp_config_acpi_gsi(dev, gsi, trigger, polarity); 679 mp_config_acpi_gsi(dev, gsi, trigger, polarity);
682 mutex_unlock(&acpi_ioapic_lock); 680 mutex_unlock(&acpi_ioapic_lock);
683#endif 681#endif
@@ -1211,8 +1209,9 @@ static int __init acpi_parse_madt_ioapic_entries(void)
1211 /* 1209 /*
1212 * If BIOS did not supply an INT_SRC_OVR for the SCI 1210 * If BIOS did not supply an INT_SRC_OVR for the SCI
1213 * pretend we got one so we can set the SCI flags. 1211 * pretend we got one so we can set the SCI flags.
1212 * But ignore setting up SCI on hardware reduced platforms.
1214 */ 1213 */
1215 if (!acpi_sci_override_gsi) 1214 if (acpi_sci_override_gsi == INVALID_ACPI_IRQ && !acpi_gbl_reduced_hardware)
1216 acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0, 1215 acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0,
1217 acpi_gbl_FADT.sci_interrupt); 1216 acpi_gbl_FADT.sci_interrupt);
1218 1217
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 7f2b02cc8ea1..2bcffec8dbf0 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -427,6 +427,142 @@ out:
427 return 0; 427 return 0;
428} 428}
429 429
430struct lpss_device_links {
431 const char *supplier_hid;
432 const char *supplier_uid;
433 const char *consumer_hid;
434 const char *consumer_uid;
435 u32 flags;
436};
437
438/*
439 * The _DEP method is used to identify dependencies but instead of creating
440 * device links for every handle in _DEP, only links in the following list are
441 * created. That is necessary because, in the general case, _DEP can refer to
442 * devices that might not have drivers, or that are on different buses, or where
443 * the supplier is not enumerated until after the consumer is probed.
444 */
445static const struct lpss_device_links lpss_device_links[] = {
446 {"808622C1", "7", "80860F14", "3", DL_FLAG_PM_RUNTIME},
447};
448
449static bool hid_uid_match(const char *hid1, const char *uid1,
450 const char *hid2, const char *uid2)
451{
452 return !strcmp(hid1, hid2) && uid1 && uid2 && !strcmp(uid1, uid2);
453}
454
455static bool acpi_lpss_is_supplier(struct acpi_device *adev,
456 const struct lpss_device_links *link)
457{
458 return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
459 link->supplier_hid, link->supplier_uid);
460}
461
462static bool acpi_lpss_is_consumer(struct acpi_device *adev,
463 const struct lpss_device_links *link)
464{
465 return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
466 link->consumer_hid, link->consumer_uid);
467}
468
469struct hid_uid {
470 const char *hid;
471 const char *uid;
472};
473
474static int match_hid_uid(struct device *dev, void *data)
475{
476 struct acpi_device *adev = ACPI_COMPANION(dev);
477 struct hid_uid *id = data;
478
479 if (!adev)
480 return 0;
481
482 return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
483 id->hid, id->uid);
484}
485
486static struct device *acpi_lpss_find_device(const char *hid, const char *uid)
487{
488 struct hid_uid data = {
489 .hid = hid,
490 .uid = uid,
491 };
492
493 return bus_find_device(&platform_bus_type, NULL, &data, match_hid_uid);
494}
495
496static bool acpi_lpss_dep(struct acpi_device *adev, acpi_handle handle)
497{
498 struct acpi_handle_list dep_devices;
499 acpi_status status;
500 int i;
501
502 if (!acpi_has_method(adev->handle, "_DEP"))
503 return false;
504
505 status = acpi_evaluate_reference(adev->handle, "_DEP", NULL,
506 &dep_devices);
507 if (ACPI_FAILURE(status)) {
508 dev_dbg(&adev->dev, "Failed to evaluate _DEP.\n");
509 return false;
510 }
511
512 for (i = 0; i < dep_devices.count; i++) {
513 if (dep_devices.handles[i] == handle)
514 return true;
515 }
516
517 return false;
518}
519
520static void acpi_lpss_link_consumer(struct device *dev1,
521 const struct lpss_device_links *link)
522{
523 struct device *dev2;
524
525 dev2 = acpi_lpss_find_device(link->consumer_hid, link->consumer_uid);
526 if (!dev2)
527 return;
528
529 if (acpi_lpss_dep(ACPI_COMPANION(dev2), ACPI_HANDLE(dev1)))
530 device_link_add(dev2, dev1, link->flags);
531
532 put_device(dev2);
533}
534
535static void acpi_lpss_link_supplier(struct device *dev1,
536 const struct lpss_device_links *link)
537{
538 struct device *dev2;
539
540 dev2 = acpi_lpss_find_device(link->supplier_hid, link->supplier_uid);
541 if (!dev2)
542 return;
543
544 if (acpi_lpss_dep(ACPI_COMPANION(dev1), ACPI_HANDLE(dev2)))
545 device_link_add(dev1, dev2, link->flags);
546
547 put_device(dev2);
548}
549
550static void acpi_lpss_create_device_links(struct acpi_device *adev,
551 struct platform_device *pdev)
552{
553 int i;
554
555 for (i = 0; i < ARRAY_SIZE(lpss_device_links); i++) {
556 const struct lpss_device_links *link = &lpss_device_links[i];
557
558 if (acpi_lpss_is_supplier(adev, link))
559 acpi_lpss_link_consumer(&pdev->dev, link);
560
561 if (acpi_lpss_is_consumer(adev, link))
562 acpi_lpss_link_supplier(&pdev->dev, link);
563 }
564}
565
430static int acpi_lpss_create_device(struct acpi_device *adev, 566static int acpi_lpss_create_device(struct acpi_device *adev,
431 const struct acpi_device_id *id) 567 const struct acpi_device_id *id)
432{ 568{
@@ -465,6 +601,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
465 acpi_dev_free_resource_list(&resource_list); 601 acpi_dev_free_resource_list(&resource_list);
466 602
467 if (!pdata->mmio_base) { 603 if (!pdata->mmio_base) {
604 /* Avoid acpi_bus_attach() instantiating a pdev for this dev. */
605 adev->pnp.type.platform_id = 0;
468 /* Skip the device, but continue the namespace scan. */ 606 /* Skip the device, but continue the namespace scan. */
469 ret = 0; 607 ret = 0;
470 goto err_out; 608 goto err_out;
@@ -500,6 +638,7 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
500 adev->driver_data = pdata; 638 adev->driver_data = pdata;
501 pdev = acpi_create_platform_device(adev, dev_desc->properties); 639 pdev = acpi_create_platform_device(adev, dev_desc->properties);
502 if (!IS_ERR_OR_NULL(pdev)) { 640 if (!IS_ERR_OR_NULL(pdev)) {
641 acpi_lpss_create_device_links(adev, pdev);
503 return 1; 642 return 1;
504 } 643 }
505 644
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 0972ec0e2eb8..f53ccc680238 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -80,8 +80,8 @@ MODULE_PARM_DESC(report_key_events,
80static bool device_id_scheme = false; 80static bool device_id_scheme = false;
81module_param(device_id_scheme, bool, 0444); 81module_param(device_id_scheme, bool, 0444);
82 82
83static bool only_lcd = false; 83static int only_lcd = -1;
84module_param(only_lcd, bool, 0444); 84module_param(only_lcd, int, 0444);
85 85
86static int register_count; 86static int register_count;
87static DEFINE_MUTEX(register_count_mutex); 87static DEFINE_MUTEX(register_count_mutex);
@@ -2136,6 +2136,16 @@ int acpi_video_register(void)
2136 goto leave; 2136 goto leave;
2137 } 2137 }
2138 2138
2139 /*
2140 * We're seeing a lot of bogus backlight interfaces on newer machines
2141 * without a LCD such as desktops, servers and HDMI sticks. Checking
2142 * the lcd flag fixes this, so enable this on any machines which are
2143 * win8 ready (where we also prefer the native backlight driver, so
2144 * normally the acpi_video code should not register there anyways).
2145 */
2146 if (only_lcd == -1)
2147 only_lcd = acpi_osi_is_win8();
2148
2139 dmi_check_system(video_dmi_table); 2149 dmi_check_system(video_dmi_table);
2140 2150
2141 ret = acpi_bus_register_driver(&acpi_video_bus); 2151 ret = acpi_bus_register_driver(&acpi_video_bus);
diff --git a/drivers/acpi/acpica/acapps.h b/drivers/acpi/acpica/acapps.h
index 7a1a68b5ac5c..2243c8164b34 100644
--- a/drivers/acpi/acpica/acapps.h
+++ b/drivers/acpi/acpica/acapps.h
@@ -80,6 +80,9 @@
80 prefix, ACPICA_COPYRIGHT, \ 80 prefix, ACPICA_COPYRIGHT, \
81 prefix 81 prefix
82 82
83#define ACPI_COMMON_BUILD_TIME \
84 "Build date/time: %s %s\n", __DATE__, __TIME__
85
83/* Macros for usage messages */ 86/* Macros for usage messages */
84 87
85#define ACPI_USAGE_HEADER(usage) \ 88#define ACPI_USAGE_HEADER(usage) \
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 71743e5252f5..54b8d9df9423 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -223,6 +223,10 @@ void
223acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags); 223acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags);
224 224
225void 225void
226acpi_db_create_execution_thread(char *method_name_arg,
227 char **arguments, acpi_object_type *types);
228
229void
226acpi_db_create_execution_threads(char *num_threads_arg, 230acpi_db_create_execution_threads(char *num_threads_arg,
227 char *num_loops_arg, char *method_name_arg); 231 char *num_loops_arg, char *method_name_arg);
228 232
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 95eed442703f..45ef3f5dc9ad 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -46,7 +46,7 @@
46 46
47/***************************************************************************** 47/*****************************************************************************
48 * 48 *
49 * Globals related to the ACPI tables 49 * Globals related to the incoming ACPI tables
50 * 50 *
51 ****************************************************************************/ 51 ****************************************************************************/
52 52
@@ -87,7 +87,7 @@ ACPI_GLOBAL(u8, acpi_gbl_integer_nybble_width);
87 87
88/***************************************************************************** 88/*****************************************************************************
89 * 89 *
90 * Mutual exclusion within ACPICA subsystem 90 * Mutual exclusion within the ACPICA subsystem
91 * 91 *
92 ****************************************************************************/ 92 ****************************************************************************/
93 93
@@ -167,7 +167,7 @@ ACPI_GLOBAL(u8, acpi_gbl_next_owner_id_offset);
167 167
168ACPI_INIT_GLOBAL(u8, acpi_gbl_namespace_initialized, FALSE); 168ACPI_INIT_GLOBAL(u8, acpi_gbl_namespace_initialized, FALSE);
169 169
170/* Misc */ 170/* Miscellaneous */
171 171
172ACPI_GLOBAL(u32, acpi_gbl_original_mode); 172ACPI_GLOBAL(u32, acpi_gbl_original_mode);
173ACPI_GLOBAL(u32, acpi_gbl_ns_lookup_count); 173ACPI_GLOBAL(u32, acpi_gbl_ns_lookup_count);
@@ -191,10 +191,9 @@ extern const char acpi_gbl_lower_hex_digits[];
191extern const char acpi_gbl_upper_hex_digits[]; 191extern const char acpi_gbl_upper_hex_digits[];
192extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; 192extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
193 193
194#ifdef ACPI_DBG_TRACK_ALLOCATIONS
195
196/* Lists for tracking memory allocations (debug only) */ 194/* Lists for tracking memory allocations (debug only) */
197 195
196#ifdef ACPI_DBG_TRACK_ALLOCATIONS
198ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_global_list); 197ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_global_list);
199ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_ns_node_list); 198ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_ns_node_list);
200ACPI_GLOBAL(u8, acpi_gbl_display_final_mem_stats); 199ACPI_GLOBAL(u8, acpi_gbl_display_final_mem_stats);
@@ -203,7 +202,7 @@ ACPI_GLOBAL(u8, acpi_gbl_disable_mem_tracking);
203 202
204/***************************************************************************** 203/*****************************************************************************
205 * 204 *
206 * Namespace globals 205 * ACPI Namespace
207 * 206 *
208 ****************************************************************************/ 207 ****************************************************************************/
209 208
@@ -234,15 +233,20 @@ ACPI_INIT_GLOBAL(u32, acpi_gbl_nesting_level, 0);
234 233
235/***************************************************************************** 234/*****************************************************************************
236 * 235 *
237 * Interpreter globals 236 * Interpreter/Parser globals
238 * 237 *
239 ****************************************************************************/ 238 ****************************************************************************/
240 239
241ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list);
242
243/* Control method single step flag */ 240/* Control method single step flag */
244 241
245ACPI_GLOBAL(u8, acpi_gbl_cm_single_step); 242ACPI_GLOBAL(u8, acpi_gbl_cm_single_step);
243ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list);
244ACPI_INIT_GLOBAL(union acpi_parse_object, *acpi_gbl_current_scope, NULL);
245
246/* ASL/ASL+ converter */
247
248ACPI_INIT_GLOBAL(u8, acpi_gbl_capture_comments, FALSE);
249ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_last_list_head, NULL);
246 250
247/***************************************************************************** 251/*****************************************************************************
248 * 252 *
@@ -252,7 +256,6 @@ ACPI_GLOBAL(u8, acpi_gbl_cm_single_step);
252 256
253extern struct acpi_bit_register_info 257extern struct acpi_bit_register_info
254 acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; 258 acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
255
256ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a); 259ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a);
257ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b); 260ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b);
258 261
@@ -263,7 +266,6 @@ ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b);
263 ****************************************************************************/ 266 ****************************************************************************/
264 267
265#if (!ACPI_REDUCED_HARDWARE) 268#if (!ACPI_REDUCED_HARDWARE)
266
267ACPI_GLOBAL(u8, acpi_gbl_all_gpes_initialized); 269ACPI_GLOBAL(u8, acpi_gbl_all_gpes_initialized);
268ACPI_GLOBAL(struct acpi_gpe_xrupt_info *, acpi_gbl_gpe_xrupt_list_head); 270ACPI_GLOBAL(struct acpi_gpe_xrupt_info *, acpi_gbl_gpe_xrupt_list_head);
269ACPI_GLOBAL(struct acpi_gpe_block_info *, 271ACPI_GLOBAL(struct acpi_gpe_block_info *,
@@ -272,10 +274,8 @@ ACPI_GLOBAL(acpi_gbl_event_handler, acpi_gbl_global_event_handler);
272ACPI_GLOBAL(void *, acpi_gbl_global_event_handler_context); 274ACPI_GLOBAL(void *, acpi_gbl_global_event_handler_context);
273ACPI_GLOBAL(struct acpi_fixed_event_handler, 275ACPI_GLOBAL(struct acpi_fixed_event_handler,
274 acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]); 276 acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]);
275
276extern struct acpi_fixed_event_info 277extern struct acpi_fixed_event_info
277 acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; 278 acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
278
279#endif /* !ACPI_REDUCED_HARDWARE */ 279#endif /* !ACPI_REDUCED_HARDWARE */
280 280
281/***************************************************************************** 281/*****************************************************************************
@@ -291,14 +291,14 @@ ACPI_GLOBAL(u32, acpi_gpe_count);
291ACPI_GLOBAL(u32, acpi_sci_count); 291ACPI_GLOBAL(u32, acpi_sci_count);
292ACPI_GLOBAL(u32, acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]); 292ACPI_GLOBAL(u32, acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]);
293 293
294/* Support for dynamic control method tracing mechanism */ 294/* Dynamic control method tracing mechanism */
295 295
296ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level); 296ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level);
297ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer); 297ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer);
298 298
299/***************************************************************************** 299/*****************************************************************************
300 * 300 *
301 * Debugger and Disassembler globals 301 * Debugger and Disassembler
302 * 302 *
303 ****************************************************************************/ 303 ****************************************************************************/
304 304
@@ -326,7 +326,6 @@ ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list);
326#endif 326#endif
327 327
328#ifdef ACPI_DEBUGGER 328#ifdef ACPI_DEBUGGER
329
330ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE); 329ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE);
331ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID); 330ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID);
332 331
@@ -340,7 +339,6 @@ ACPI_GLOBAL(u32, acpi_gbl_db_console_debug_level);
340ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_db_scope_node); 339ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_db_scope_node);
341ACPI_GLOBAL(u8, acpi_gbl_db_terminate_loop); 340ACPI_GLOBAL(u8, acpi_gbl_db_terminate_loop);
342ACPI_GLOBAL(u8, acpi_gbl_db_threads_terminated); 341ACPI_GLOBAL(u8, acpi_gbl_db_threads_terminated);
343
344ACPI_GLOBAL(char *, acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]); 342ACPI_GLOBAL(char *, acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]);
345ACPI_GLOBAL(acpi_object_type, acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]); 343ACPI_GLOBAL(acpi_object_type, acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]);
346 344
@@ -350,32 +348,33 @@ ACPI_GLOBAL(char, acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE]);
350ACPI_GLOBAL(char, acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]); 348ACPI_GLOBAL(char, acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]);
351ACPI_GLOBAL(char, acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]); 349ACPI_GLOBAL(char, acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]);
352 350
353/* 351/* Statistics globals */
354 * Statistic globals 352
355 */
356ACPI_GLOBAL(u16, acpi_gbl_obj_type_count[ACPI_TOTAL_TYPES]); 353ACPI_GLOBAL(u16, acpi_gbl_obj_type_count[ACPI_TOTAL_TYPES]);
357ACPI_GLOBAL(u16, acpi_gbl_node_type_count[ACPI_TOTAL_TYPES]); 354ACPI_GLOBAL(u16, acpi_gbl_node_type_count[ACPI_TOTAL_TYPES]);
358ACPI_GLOBAL(u16, acpi_gbl_obj_type_count_misc); 355ACPI_GLOBAL(u16, acpi_gbl_obj_type_count_misc);
359ACPI_GLOBAL(u16, acpi_gbl_node_type_count_misc); 356ACPI_GLOBAL(u16, acpi_gbl_node_type_count_misc);
360ACPI_GLOBAL(u32, acpi_gbl_num_nodes); 357ACPI_GLOBAL(u32, acpi_gbl_num_nodes);
361ACPI_GLOBAL(u32, acpi_gbl_num_objects); 358ACPI_GLOBAL(u32, acpi_gbl_num_objects);
362
363#endif /* ACPI_DEBUGGER */ 359#endif /* ACPI_DEBUGGER */
364 360
365#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER) 361#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
366
367ACPI_GLOBAL(const char, *acpi_gbl_pld_panel_list[]); 362ACPI_GLOBAL(const char, *acpi_gbl_pld_panel_list[]);
368ACPI_GLOBAL(const char, *acpi_gbl_pld_vertical_position_list[]); 363ACPI_GLOBAL(const char, *acpi_gbl_pld_vertical_position_list[]);
369ACPI_GLOBAL(const char, *acpi_gbl_pld_horizontal_position_list[]); 364ACPI_GLOBAL(const char, *acpi_gbl_pld_horizontal_position_list[]);
370ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]); 365ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]);
371
372ACPI_INIT_GLOBAL(u8, acpi_gbl_disasm_flag, FALSE); 366ACPI_INIT_GLOBAL(u8, acpi_gbl_disasm_flag, FALSE);
373
374#endif 367#endif
375 368
376/* 369/*****************************************************************************
377 * Meant for the -ca option. 370 *
378 */ 371 * ACPICA application-specific globals
372 *
373 ****************************************************************************/
374
375/* ASL-to-ASL+ conversion utility (implemented within the iASL compiler) */
376
377#ifdef ACPI_ASL_COMPILER
379ACPI_INIT_GLOBAL(char *, acpi_gbl_current_inline_comment, NULL); 378ACPI_INIT_GLOBAL(char *, acpi_gbl_current_inline_comment, NULL);
380ACPI_INIT_GLOBAL(char *, acpi_gbl_current_end_node_comment, NULL); 379ACPI_INIT_GLOBAL(char *, acpi_gbl_current_end_node_comment, NULL);
381ACPI_INIT_GLOBAL(char *, acpi_gbl_current_open_brace_comment, NULL); 380ACPI_INIT_GLOBAL(char *, acpi_gbl_current_open_brace_comment, NULL);
@@ -386,23 +385,18 @@ ACPI_INIT_GLOBAL(char *, acpi_gbl_current_filename, NULL);
386ACPI_INIT_GLOBAL(char *, acpi_gbl_current_parent_filename, NULL); 385ACPI_INIT_GLOBAL(char *, acpi_gbl_current_parent_filename, NULL);
387ACPI_INIT_GLOBAL(char *, acpi_gbl_current_include_filename, NULL); 386ACPI_INIT_GLOBAL(char *, acpi_gbl_current_include_filename, NULL);
388 387
389ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_last_list_head, NULL);
390
391ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_head, 388ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_head,
392 NULL); 389 NULL);
393ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_tail, 390ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_tail,
394 NULL); 391 NULL);
395
396ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_head, 392ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_head,
397 NULL); 393 NULL);
398ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_tail, 394ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_tail,
399 NULL); 395 NULL);
400
401ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_head, 396ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_head,
402 NULL); 397 NULL);
403ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_tail, 398ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_tail,
404 NULL); 399 NULL);
405
406ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_head, 400ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_head,
407 NULL); 401 NULL);
408ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_tail, 402ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_tail,
@@ -410,30 +404,18 @@ ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_tail,
410 404
411ACPI_INIT_GLOBAL(struct acpi_comment_addr_node, 405ACPI_INIT_GLOBAL(struct acpi_comment_addr_node,
412 *acpi_gbl_comment_addr_list_head, NULL); 406 *acpi_gbl_comment_addr_list_head, NULL);
413
414ACPI_INIT_GLOBAL(union acpi_parse_object, *acpi_gbl_current_scope, NULL);
415
416ACPI_INIT_GLOBAL(struct acpi_file_node, *acpi_gbl_file_tree_root, NULL); 407ACPI_INIT_GLOBAL(struct acpi_file_node, *acpi_gbl_file_tree_root, NULL);
417 408
418ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_reg_comment_cache); 409ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_reg_comment_cache);
419ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_comment_addr_cache); 410ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_comment_addr_cache);
420ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_file_cache); 411ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_file_cache);
421 412
422ACPI_INIT_GLOBAL(u8, gbl_capture_comments, FALSE);
423
424ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_asl_conversion, FALSE); 413ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_asl_conversion, FALSE);
425ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_conv_debug_file, NULL); 414ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_conv_debug_file, NULL);
426
427ACPI_GLOBAL(char, acpi_gbl_table_sig[4]); 415ACPI_GLOBAL(char, acpi_gbl_table_sig[4]);
428 416#endif
429/*****************************************************************************
430 *
431 * Application globals
432 *
433 ****************************************************************************/
434 417
435#ifdef ACPI_APPLICATION 418#ifdef ACPI_APPLICATION
436
437ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL); 419ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL);
438ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_output_file, NULL); 420ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_output_file, NULL);
439ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_timeout, FALSE); 421ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_timeout, FALSE);
@@ -442,16 +424,6 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_timeout, FALSE);
442 424
443ACPI_GLOBAL(acpi_spinlock, acpi_gbl_print_lock); /* For print buffer */ 425ACPI_GLOBAL(acpi_spinlock, acpi_gbl_print_lock); /* For print buffer */
444ACPI_GLOBAL(char, acpi_gbl_print_buffer[1024]); 426ACPI_GLOBAL(char, acpi_gbl_print_buffer[1024]);
445
446#endif /* ACPI_APPLICATION */ 427#endif /* ACPI_APPLICATION */
447 428
448/*****************************************************************************
449 *
450 * Info/help support
451 *
452 ****************************************************************************/
453
454extern const struct ah_predefined_name asl_predefined_info[];
455extern const struct ah_device_id asl_device_ids[];
456
457#endif /* __ACGLOBAL_H__ */ 429#endif /* __ACGLOBAL_H__ */
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 0d45b8bb1678..a56675f0661e 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -622,7 +622,7 @@ struct acpi_control_state {
622 union acpi_parse_object *predicate_op; 622 union acpi_parse_object *predicate_op;
623 u8 *aml_predicate_start; /* Start of if/while predicate */ 623 u8 *aml_predicate_start; /* Start of if/while predicate */
624 u8 *package_end; /* End of if/while block */ 624 u8 *package_end; /* End of if/while block */
625 u32 loop_count; /* While() loop counter */ 625 u64 loop_timeout; /* While() loop timeout */
626}; 626};
627 627
628/* 628/*
@@ -1218,16 +1218,17 @@ struct acpi_db_method_info {
1218 acpi_object_type *types; 1218 acpi_object_type *types;
1219 1219
1220 /* 1220 /*
1221 * Arguments to be passed to method for the command 1221 * Arguments to be passed to method for the commands Threads and
1222 * Threads - 1222 * Background. Note, ACPI specifies a maximum of 7 arguments (0 - 6).
1223 * the Number of threads, ID of current thread and 1223 *
1224 * Index of current thread inside all them created. 1224 * For the Threads command, the Number of threads, ID of current
1225 * thread and Index of current thread inside all them created.
1225 */ 1226 */
1226 char init_args; 1227 char init_args;
1227#ifdef ACPI_DEBUGGER 1228#ifdef ACPI_DEBUGGER
1228 acpi_object_type arg_types[4]; 1229 acpi_object_type arg_types[ACPI_METHOD_NUM_ARGS];
1229#endif 1230#endif
1230 char *arguments[4]; 1231 char *arguments[ACPI_METHOD_NUM_ARGS];
1231 char num_threads_str[11]; 1232 char num_threads_str[11];
1232 char id_of_thread_str[11]; 1233 char id_of_thread_str[11];
1233 char index_of_thread_str[11]; 1234 char index_of_thread_str[11];
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index c7f0c96cc00f..128a3d71b598 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -455,7 +455,7 @@
455 * the plist contains a set of parens to allow variable-length lists. 455 * the plist contains a set of parens to allow variable-length lists.
456 * These macros are used for both the debug and non-debug versions of the code. 456 * These macros are used for both the debug and non-debug versions of the code.
457 */ 457 */
458#define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e); 458#define ACPI_ERROR_NAMESPACE(s, p, e) acpi_ut_prefixed_namespace_error (AE_INFO, s, p, e);
459#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e); 459#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e);
460#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist 460#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist
461#define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist 461#define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 54a0c51b3e37..2fb1bb78d85c 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -289,6 +289,9 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node,
289char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node, 289char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node,
290 u8 no_trailing); 290 u8 no_trailing);
291 291
292char *acpi_ns_build_prefixed_pathname(union acpi_generic_state *prefix_scope,
293 const char *internal_path);
294
292char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); 295char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
293 296
294acpi_status 297acpi_status
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 83b75e9db7ef..b6b29d717824 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -118,9 +118,6 @@ extern const char *acpi_gbl_ptyp_decode[];
118#ifndef ACPI_MSG_ERROR 118#ifndef ACPI_MSG_ERROR
119#define ACPI_MSG_ERROR "ACPI Error: " 119#define ACPI_MSG_ERROR "ACPI Error: "
120#endif 120#endif
121#ifndef ACPI_MSG_EXCEPTION
122#define ACPI_MSG_EXCEPTION "ACPI Exception: "
123#endif
124#ifndef ACPI_MSG_WARNING 121#ifndef ACPI_MSG_WARNING
125#define ACPI_MSG_WARNING "ACPI Warning: " 122#define ACPI_MSG_WARNING "ACPI Warning: "
126#endif 123#endif
@@ -129,10 +126,10 @@ extern const char *acpi_gbl_ptyp_decode[];
129#endif 126#endif
130 127
131#ifndef ACPI_MSG_BIOS_ERROR 128#ifndef ACPI_MSG_BIOS_ERROR
132#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): " 129#define ACPI_MSG_BIOS_ERROR "Firmware Error (ACPI): "
133#endif 130#endif
134#ifndef ACPI_MSG_BIOS_WARNING 131#ifndef ACPI_MSG_BIOS_WARNING
135#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): " 132#define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): "
136#endif 133#endif
137 134
138/* 135/*
@@ -233,10 +230,10 @@ u64 acpi_ut_implicit_strtoul64(char *string);
233 */ 230 */
234acpi_status acpi_ut_init_globals(void); 231acpi_status acpi_ut_init_globals(void);
235 232
236#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
237
238const char *acpi_ut_get_mutex_name(u32 mutex_id); 233const char *acpi_ut_get_mutex_name(u32 mutex_id);
239 234
235#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
236
240const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type); 237const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type);
241#endif 238#endif
242 239
@@ -641,9 +638,11 @@ void ut_convert_backslashes(char *pathname);
641 638
642void acpi_ut_repair_name(char *name); 639void acpi_ut_repair_name(char *name);
643 640
644#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) 641#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT)
645u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source); 642u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source);
646 643
644void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size);
645
647u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source); 646u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source);
648 647
649u8 648u8
@@ -737,9 +736,11 @@ acpi_ut_predefined_bios_error(const char *module_name,
737 u8 node_flags, const char *format, ...); 736 u8 node_flags, const char *format, ...);
738 737
739void 738void
740acpi_ut_namespace_error(const char *module_name, 739acpi_ut_prefixed_namespace_error(const char *module_name,
741 u32 line_number, 740 u32 line_number,
742 const char *internal_name, acpi_status lookup_status); 741 union acpi_generic_state *prefix_scope,
742 const char *internal_name,
743 acpi_status lookup_status);
743 744
744void 745void
745acpi_ut_method_error(const char *module_name, 746acpi_ut_method_error(const char *module_name,
diff --git a/drivers/acpi/acpica/dbexec.c b/drivers/acpi/acpica/dbexec.c
index 3b30319752f0..ed088fceb18d 100644
--- a/drivers/acpi/acpica/dbexec.c
+++ b/drivers/acpi/acpica/dbexec.c
@@ -67,6 +67,8 @@ static acpi_status
67acpi_db_execution_walk(acpi_handle obj_handle, 67acpi_db_execution_walk(acpi_handle obj_handle,
68 u32 nesting_level, void *context, void **return_value); 68 u32 nesting_level, void *context, void **return_value);
69 69
70static void ACPI_SYSTEM_XFACE acpi_db_single_execution_thread(void *context);
71
70/******************************************************************************* 72/*******************************************************************************
71 * 73 *
72 * FUNCTION: acpi_db_delete_objects 74 * FUNCTION: acpi_db_delete_objects
@@ -229,7 +231,7 @@ static acpi_status acpi_db_execute_setup(struct acpi_db_method_info *info)
229 231
230 ACPI_FUNCTION_NAME(db_execute_setup); 232 ACPI_FUNCTION_NAME(db_execute_setup);
231 233
232 /* Catenate the current scope to the supplied name */ 234 /* Concatenate the current scope to the supplied name */
233 235
234 info->pathname[0] = 0; 236 info->pathname[0] = 0;
235 if ((info->name[0] != '\\') && (info->name[0] != '/')) { 237 if ((info->name[0] != '\\') && (info->name[0] != '/')) {
@@ -611,6 +613,112 @@ static void ACPI_SYSTEM_XFACE acpi_db_method_thread(void *context)
611 613
612/******************************************************************************* 614/*******************************************************************************
613 * 615 *
616 * FUNCTION: acpi_db_single_execution_thread
617 *
618 * PARAMETERS: context - Method info struct
619 *
620 * RETURN: None
621 *
622 * DESCRIPTION: Create one thread and execute a method
623 *
624 ******************************************************************************/
625
626static void ACPI_SYSTEM_XFACE acpi_db_single_execution_thread(void *context)
627{
628 struct acpi_db_method_info *info = context;
629 acpi_status status;
630 struct acpi_buffer return_obj;
631
632 acpi_os_printf("\n");
633
634 status = acpi_db_execute_method(info, &return_obj);
635 if (ACPI_FAILURE(status)) {
636 acpi_os_printf("%s During evaluation of %s\n",
637 acpi_format_exception(status), info->pathname);
638 return;
639 }
640
641 /* Display a return object, if any */
642
643 if (return_obj.length) {
644 acpi_os_printf("Evaluation of %s returned object %p, "
645 "external buffer length %X\n",
646 acpi_gbl_db_method_info.pathname,
647 return_obj.pointer, (u32)return_obj.length);
648
649 acpi_db_dump_external_object(return_obj.pointer, 1);
650 }
651
652 acpi_os_printf("\nBackground thread completed\n%c ",
653 ACPI_DEBUGGER_COMMAND_PROMPT);
654}
655
656/*******************************************************************************
657 *
658 * FUNCTION: acpi_db_create_execution_thread
659 *
660 * PARAMETERS: method_name_arg - Control method to execute
661 * arguments - Array of arguments to the method
662 * types - Corresponding array of object types
663 *
664 * RETURN: None
665 *
666 * DESCRIPTION: Create a single thread to evaluate a namespace object. Handles
667 * arguments passed on command line for control methods.
668 *
669 ******************************************************************************/
670
671void
672acpi_db_create_execution_thread(char *method_name_arg,
673 char **arguments, acpi_object_type *types)
674{
675 acpi_status status;
676 u32 i;
677
678 memset(&acpi_gbl_db_method_info, 0, sizeof(struct acpi_db_method_info));
679 acpi_gbl_db_method_info.name = method_name_arg;
680 acpi_gbl_db_method_info.init_args = 1;
681 acpi_gbl_db_method_info.args = acpi_gbl_db_method_info.arguments;
682 acpi_gbl_db_method_info.types = acpi_gbl_db_method_info.arg_types;
683
684 /* Setup method arguments, up to 7 (0-6) */
685
686 for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && *arguments; i++) {
687 acpi_gbl_db_method_info.arguments[i] = *arguments;
688 arguments++;
689
690 acpi_gbl_db_method_info.arg_types[i] = *types;
691 types++;
692 }
693
694 status = acpi_db_execute_setup(&acpi_gbl_db_method_info);
695 if (ACPI_FAILURE(status)) {
696 return;
697 }
698
699 /* Get the NS node, determines existence also */
700
701 status = acpi_get_handle(NULL, acpi_gbl_db_method_info.pathname,
702 &acpi_gbl_db_method_info.method);
703 if (ACPI_FAILURE(status)) {
704 acpi_os_printf("%s Could not get handle for %s\n",
705 acpi_format_exception(status),
706 acpi_gbl_db_method_info.pathname);
707 return;
708 }
709
710 status = acpi_os_execute(OSL_DEBUGGER_EXEC_THREAD,
711 acpi_db_single_execution_thread,
712 &acpi_gbl_db_method_info);
713 if (ACPI_FAILURE(status)) {
714 return;
715 }
716
717 acpi_os_printf("\nBackground thread started\n");
718}
719
720/*******************************************************************************
721 *
614 * FUNCTION: acpi_db_create_execution_threads 722 * FUNCTION: acpi_db_create_execution_threads
615 * 723 *
616 * PARAMETERS: num_threads_arg - Number of threads to create 724 * PARAMETERS: num_threads_arg - Number of threads to create
diff --git a/drivers/acpi/acpica/dbfileio.c b/drivers/acpi/acpica/dbfileio.c
index 4d81ea291d93..cf9607945704 100644
--- a/drivers/acpi/acpica/dbfileio.c
+++ b/drivers/acpi/acpica/dbfileio.c
@@ -99,8 +99,8 @@ void acpi_db_open_debug_file(char *name)
99 } 99 }
100 100
101 acpi_os_printf("Debug output file %s opened\n", name); 101 acpi_os_printf("Debug output file %s opened\n", name);
102 strncpy(acpi_gbl_db_debug_filename, name, 102 acpi_ut_safe_strncpy(acpi_gbl_db_debug_filename, name,
103 sizeof(acpi_gbl_db_debug_filename)); 103 sizeof(acpi_gbl_db_debug_filename));
104 acpi_gbl_db_output_to_file = TRUE; 104 acpi_gbl_db_output_to_file = TRUE;
105} 105}
106#endif 106#endif
diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c
index 2626d79db064..954ca3b981a7 100644
--- a/drivers/acpi/acpica/dbinput.c
+++ b/drivers/acpi/acpica/dbinput.c
@@ -136,6 +136,7 @@ enum acpi_ex_debugger_commands {
136 CMD_UNLOAD, 136 CMD_UNLOAD,
137 137
138 CMD_TERMINATE, 138 CMD_TERMINATE,
139 CMD_BACKGROUND,
139 CMD_THREADS, 140 CMD_THREADS,
140 141
141 CMD_TEST, 142 CMD_TEST,
@@ -212,6 +213,7 @@ static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
212 {"UNLOAD", 1}, 213 {"UNLOAD", 1},
213 214
214 {"TERMINATE", 0}, 215 {"TERMINATE", 0},
216 {"BACKGROUND", 1},
215 {"THREADS", 3}, 217 {"THREADS", 3},
216 218
217 {"TEST", 1}, 219 {"TEST", 1},
@@ -222,9 +224,56 @@ static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
222/* 224/*
223 * Help for all debugger commands. First argument is the number of lines 225 * Help for all debugger commands. First argument is the number of lines
224 * of help to output for the command. 226 * of help to output for the command.
227 *
228 * Note: Some commands are not supported by the kernel-level version of
229 * the debugger.
225 */ 230 */
226static const struct acpi_db_command_help acpi_gbl_db_command_help[] = { 231static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
227 {0, "\nGeneral-Purpose Commands:", "\n"}, 232 {0, "\nNamespace Access:", "\n"},
233 {1, " Businfo", "Display system bus info\n"},
234 {1, " Disassemble <Method>", "Disassemble a control method\n"},
235 {1, " Find <AcpiName> (? is wildcard)",
236 "Find ACPI name(s) with wildcards\n"},
237 {1, " Integrity", "Validate namespace integrity\n"},
238 {1, " Methods", "Display list of loaded control methods\n"},
239 {1, " Namespace [Object] [Depth]",
240 "Display loaded namespace tree/subtree\n"},
241 {1, " Notify <Object> <Value>", "Send a notification on Object\n"},
242 {1, " Objects [ObjectType]",
243 "Display summary of all objects or just given type\n"},
244 {1, " Owner <OwnerId> [Depth]",
245 "Display loaded namespace by object owner\n"},
246 {1, " Paths", "Display full pathnames of namespace objects\n"},
247 {1, " Predefined", "Check all predefined names\n"},
248 {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
249 {1, " References <Addr>", "Find all references to object at addr\n"},
250 {1, " Resources [DeviceName]",
251 "Display Device resources (no arg = all devices)\n"},
252 {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
253 {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
254 {1, " Type <Object>", "Display object type\n"},
255
256 {0, "\nControl Method Execution:", "\n"},
257 {1, " Evaluate <Namepath> [Arguments]",
258 "Evaluate object or control method\n"},
259 {1, " Execute <Namepath> [Arguments]", "Synonym for Evaluate\n"},
260#ifdef ACPI_APPLICATION
261 {1, " Background <Namepath> [Arguments]",
262 "Evaluate object/method in a separate thread\n"},
263 {1, " Thread <Threads><Loops><NamePath>",
264 "Spawn threads to execute method(s)\n"},
265#endif
266 {1, " Debug <Namepath> [Arguments]", "Single-Step a control method\n"},
267 {7, " [Arguments] formats:", "Control method argument formats\n"},
268 {1, " Hex Integer", "Integer\n"},
269 {1, " \"Ascii String\"", "String\n"},
270 {1, " (Hex Byte List)", "Buffer\n"},
271 {1, " (01 42 7A BF)", "Buffer example (4 bytes)\n"},
272 {1, " [Package Element List]", "Package\n"},
273 {1, " [0x01 0x1234 \"string\"]",
274 "Package example (3 elements)\n"},
275
276 {0, "\nMiscellaneous:", "\n"},
228 {1, " Allocations", "Display list of current memory allocations\n"}, 277 {1, " Allocations", "Display list of current memory allocations\n"},
229 {2, " Dump <Address>|<Namepath>", "\n"}, 278 {2, " Dump <Address>|<Namepath>", "\n"},
230 {0, " [Byte|Word|Dword|Qword]", 279 {0, " [Byte|Word|Dword|Qword]",
@@ -248,46 +297,30 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
248 {1, " Stack", "Display CPU stack usage\n"}, 297 {1, " Stack", "Display CPU stack usage\n"},
249 {1, " Tables", "Info about current ACPI table(s)\n"}, 298 {1, " Tables", "Info about current ACPI table(s)\n"},
250 {1, " Tables", "Display info about loaded ACPI tables\n"}, 299 {1, " Tables", "Display info about loaded ACPI tables\n"},
300#ifdef ACPI_APPLICATION
301 {1, " Terminate", "Delete namespace and all internal objects\n"},
302#endif
251 {1, " ! <CommandNumber>", "Execute command from history buffer\n"}, 303 {1, " ! <CommandNumber>", "Execute command from history buffer\n"},
252 {1, " !!", "Execute last command again\n"}, 304 {1, " !!", "Execute last command again\n"},
253 305
254 {0, "\nNamespace Access Commands:", "\n"}, 306 {0, "\nMethod and Namespace Debugging:", "\n"},
255 {1, " Businfo", "Display system bus info\n"}, 307 {5, " Trace <State> [<Namepath>] [Once]",
256 {1, " Disassemble <Method>", "Disassemble a control method\n"}, 308 "Trace control method execution\n"},
257 {1, " Find <AcpiName> (? is wildcard)", 309 {1, " Enable", "Enable all messages\n"},
258 "Find ACPI name(s) with wildcards\n"}, 310 {1, " Disable", "Disable tracing\n"},
259 {1, " Integrity", "Validate namespace integrity\n"}, 311 {1, " Method", "Enable method execution messages\n"},
260 {1, " Methods", "Display list of loaded control methods\n"}, 312 {1, " Opcode", "Enable opcode execution messages\n"},
261 {1, " Namespace [Object] [Depth]", 313 {3, " Test <TestName>", "Invoke a debug test\n"},
262 "Display loaded namespace tree/subtree\n"}, 314 {1, " Objects", "Read/write/compare all namespace data objects\n"},
263 {1, " Notify <Object> <Value>", "Send a notification on Object\n"}, 315 {1, " Predefined",
264 {1, " Objects [ObjectType]", 316 "Validate all ACPI predefined names (_STA, etc.)\n"},
265 "Display summary of all objects or just given type\n"}, 317 {1, " Execute predefined",
266 {1, " Owner <OwnerId> [Depth]", 318 "Execute all predefined (public) methods\n"},
267 "Display loaded namespace by object owner\n"},
268 {1, " Paths", "Display full pathnames of namespace objects\n"},
269 {1, " Predefined", "Check all predefined names\n"},
270 {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
271 {1, " References <Addr>", "Find all references to object at addr\n"},
272 {1, " Resources [DeviceName]",
273 "Display Device resources (no arg = all devices)\n"},
274 {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
275 {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
276 {1, " Type <Object>", "Display object type\n"},
277 319
278 {0, "\nControl Method Execution Commands:", "\n"}, 320 {0, "\nControl Method Single-Step Execution:", "\n"},
279 {1, " Arguments (or Args)", "Display method arguments\n"}, 321 {1, " Arguments (or Args)", "Display method arguments\n"},
280 {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"}, 322 {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"},
281 {1, " Call", "Run to next control method invocation\n"}, 323 {1, " Call", "Run to next control method invocation\n"},
282 {1, " Debug <Namepath> [Arguments]", "Single Step a control method\n"},
283 {6, " Evaluate", "Synonym for Execute\n"},
284 {5, " Execute <Namepath> [Arguments]", "Execute control method\n"},
285 {1, " Hex Integer", "Integer method argument\n"},
286 {1, " \"Ascii String\"", "String method argument\n"},
287 {1, " (Hex Byte List)", "Buffer method argument\n"},
288 {1, " [Package Element List]", "Package method argument\n"},
289 {5, " Execute predefined",
290 "Execute all predefined (public) methods\n"},
291 {1, " Go", "Allow method to run to completion\n"}, 324 {1, " Go", "Allow method to run to completion\n"},
292 {1, " Information", "Display info about the current method\n"}, 325 {1, " Information", "Display info about the current method\n"},
293 {1, " Into", "Step into (not over) a method call\n"}, 326 {1, " Into", "Step into (not over) a method call\n"},
@@ -296,41 +329,24 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
296 {1, " Results", "Display method result stack\n"}, 329 {1, " Results", "Display method result stack\n"},
297 {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"}, 330 {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
298 {1, " Stop", "Terminate control method\n"}, 331 {1, " Stop", "Terminate control method\n"},
299 {5, " Trace <State> [<Namepath>] [Once]",
300 "Trace control method execution\n"},
301 {1, " Enable", "Enable all messages\n"},
302 {1, " Disable", "Disable tracing\n"},
303 {1, " Method", "Enable method execution messages\n"},
304 {1, " Opcode", "Enable opcode execution messages\n"},
305 {1, " Tree", "Display control method calling tree\n"}, 332 {1, " Tree", "Display control method calling tree\n"},
306 {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, 333 {1, " <Enter>", "Single step next AML opcode (over calls)\n"},
307 334
308#ifdef ACPI_APPLICATION 335#ifdef ACPI_APPLICATION
309 {0, "\nHardware Simulation Commands:", "\n"}, 336 {0, "\nFile Operations:", "\n"},
310 {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
311 {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
312 {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
313 {1, " Gpes", "Display info on all GPE devices\n"},
314 {1, " Sci", "Generate an SCI\n"},
315 {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
316
317 {0, "\nFile I/O Commands:", "\n"},
318 {1, " Close", "Close debug output file\n"}, 337 {1, " Close", "Close debug output file\n"},
319 {1, " Load <Input Filename>", "Load ACPI table from a file\n"}, 338 {1, " Load <Input Filename>", "Load ACPI table from a file\n"},
320 {1, " Open <Output Filename>", "Open a file for debug output\n"}, 339 {1, " Open <Output Filename>", "Open a file for debug output\n"},
321 {1, " Unload <Namepath>", 340 {1, " Unload <Namepath>",
322 "Unload an ACPI table via namespace object\n"}, 341 "Unload an ACPI table via namespace object\n"},
323 342
324 {0, "\nUser Space Commands:", "\n"}, 343 {0, "\nHardware Simulation:", "\n"},
325 {1, " Terminate", "Delete namespace and all internal objects\n"}, 344 {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
326 {1, " Thread <Threads><Loops><NamePath>", 345 {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
327 "Spawn threads to execute method(s)\n"}, 346 {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
328 347 {1, " Gpes", "Display info on all GPE devices\n"},
329 {0, "\nDebug Test Commands:", "\n"}, 348 {1, " Sci", "Generate an SCI\n"},
330 {3, " Test <TestName>", "Invoke a debug test\n"}, 349 {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
331 {1, " Objects", "Read/write/compare all namespace data objects\n"},
332 {1, " Predefined",
333 "Execute all ACPI predefined names (_STA, etc.)\n"},
334#endif 350#endif
335 {0, NULL, NULL} 351 {0, NULL, NULL}
336}; 352};
@@ -442,11 +458,15 @@ static void acpi_db_display_help(char *command)
442 458
443 /* No argument to help, display help for all commands */ 459 /* No argument to help, display help for all commands */
444 460
461 acpi_os_printf("\nSummary of AML Debugger Commands\n\n");
462
445 while (next->invocation) { 463 while (next->invocation) {
446 acpi_os_printf("%-38s%s", next->invocation, 464 acpi_os_printf("%-38s%s", next->invocation,
447 next->description); 465 next->description);
448 next++; 466 next++;
449 } 467 }
468 acpi_os_printf("\n");
469
450 } else { 470 } else {
451 /* Display help for all commands that match the subtring */ 471 /* Display help for all commands that match the subtring */
452 472
@@ -1087,6 +1107,13 @@ acpi_db_command_dispatch(char *input_buffer,
1087 /* acpi_initialize (NULL); */ 1107 /* acpi_initialize (NULL); */
1088 break; 1108 break;
1089 1109
1110 case CMD_BACKGROUND:
1111
1112 acpi_db_create_execution_thread(acpi_gbl_db_args[1],
1113 &acpi_gbl_db_args[2],
1114 &acpi_gbl_db_arg_types[2]);
1115 break;
1116
1090 case CMD_THREADS: 1117 case CMD_THREADS:
1091 1118
1092 acpi_db_create_execution_threads(acpi_gbl_db_args[1], 1119 acpi_db_create_execution_threads(acpi_gbl_db_args[1],
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c
index f470e81b0499..4b6ebc2a2851 100644
--- a/drivers/acpi/acpica/dscontrol.c
+++ b/drivers/acpi/acpica/dscontrol.c
@@ -118,6 +118,8 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
118 control_state->control.package_end = 118 control_state->control.package_end =
119 walk_state->parser_state.pkg_end; 119 walk_state->parser_state.pkg_end;
120 control_state->control.opcode = op->common.aml_opcode; 120 control_state->control.opcode = op->common.aml_opcode;
121 control_state->control.loop_timeout = acpi_os_get_timer() +
122 (u64)(acpi_gbl_max_loop_iterations * ACPI_100NSEC_PER_SEC);
121 123
122 /* Push the control state on this walk's control stack */ 124 /* Push the control state on this walk's control stack */
123 125
@@ -206,15 +208,15 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state,
206 /* Predicate was true, the body of the loop was just executed */ 208 /* Predicate was true, the body of the loop was just executed */
207 209
208 /* 210 /*
209 * This loop counter mechanism allows the interpreter to escape 211 * This infinite loop detection mechanism allows the interpreter
210 * possibly infinite loops. This can occur in poorly written AML 212 * to escape possibly infinite loops. This can occur in poorly
211 * when the hardware does not respond within a while loop and the 213 * written AML when the hardware does not respond within a while
212 * loop does not implement a timeout. 214 * loop and the loop does not implement a timeout.
213 */ 215 */
214 control_state->control.loop_count++; 216 if (ACPI_TIME_AFTER(acpi_os_get_timer(),
215 if (control_state->control.loop_count > 217 control_state->control.
216 acpi_gbl_max_loop_iterations) { 218 loop_timeout)) {
217 status = AE_AML_INFINITE_LOOP; 219 status = AE_AML_LOOP_TIMEOUT;
218 break; 220 break;
219 } 221 }
220 222
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index 7bcf5f5ea029..0cab34a593d5 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -209,7 +209,8 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
209 ACPI_IMODE_LOAD_PASS1, flags, 209 ACPI_IMODE_LOAD_PASS1, flags,
210 walk_state, &node); 210 walk_state, &node);
211 if (ACPI_FAILURE(status)) { 211 if (ACPI_FAILURE(status)) {
212 ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 212 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
213 arg->common.value.string, status);
213 return_ACPI_STATUS(status); 214 return_ACPI_STATUS(status);
214 } 215 }
215 } 216 }
@@ -383,7 +384,9 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
383 walk_state, 384 walk_state,
384 &info->connection_node); 385 &info->connection_node);
385 if (ACPI_FAILURE(status)) { 386 if (ACPI_FAILURE(status)) {
386 ACPI_ERROR_NAMESPACE(child->common. 387 ACPI_ERROR_NAMESPACE(walk_state->
388 scope_info,
389 child->common.
387 value.name, 390 value.name,
388 status); 391 status);
389 return_ACPI_STATUS(status); 392 return_ACPI_STATUS(status);
@@ -402,7 +405,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
402 ACPI_NS_DONT_OPEN_SCOPE, 405 ACPI_NS_DONT_OPEN_SCOPE,
403 walk_state, &info->field_node); 406 walk_state, &info->field_node);
404 if (ACPI_FAILURE(status)) { 407 if (ACPI_FAILURE(status)) {
405 ACPI_ERROR_NAMESPACE((char *)&arg->named.name, 408 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
409 (char *)&arg->named.name,
406 status); 410 status);
407 return_ACPI_STATUS(status); 411 return_ACPI_STATUS(status);
408 } else { 412 } else {
@@ -498,7 +502,8 @@ acpi_ds_create_field(union acpi_parse_object *op,
498 &region_node); 502 &region_node);
499#endif 503#endif
500 if (ACPI_FAILURE(status)) { 504 if (ACPI_FAILURE(status)) {
501 ACPI_ERROR_NAMESPACE(arg->common.value.name, status); 505 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
506 arg->common.value.name, status);
502 return_ACPI_STATUS(status); 507 return_ACPI_STATUS(status);
503 } 508 }
504 } 509 }
@@ -618,7 +623,8 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
618 ACPI_IMODE_LOAD_PASS1, flags, 623 ACPI_IMODE_LOAD_PASS1, flags,
619 walk_state, &node); 624 walk_state, &node);
620 if (ACPI_FAILURE(status)) { 625 if (ACPI_FAILURE(status)) {
621 ACPI_ERROR_NAMESPACE((char *)&arg->named.name, 626 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
627 (char *)&arg->named.name,
622 status); 628 status);
623 if (status != AE_ALREADY_EXISTS) { 629 if (status != AE_ALREADY_EXISTS) {
624 return_ACPI_STATUS(status); 630 return_ACPI_STATUS(status);
@@ -681,7 +687,8 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
681 &region_node); 687 &region_node);
682#endif 688#endif
683 if (ACPI_FAILURE(status)) { 689 if (ACPI_FAILURE(status)) {
684 ACPI_ERROR_NAMESPACE(arg->common.value.name, status); 690 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
691 arg->common.value.name, status);
685 return_ACPI_STATUS(status); 692 return_ACPI_STATUS(status);
686 } 693 }
687 } 694 }
@@ -695,7 +702,8 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
695 ACPI_NS_SEARCH_PARENT, walk_state, 702 ACPI_NS_SEARCH_PARENT, walk_state,
696 &info.register_node); 703 &info.register_node);
697 if (ACPI_FAILURE(status)) { 704 if (ACPI_FAILURE(status)) {
698 ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 705 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
706 arg->common.value.string, status);
699 return_ACPI_STATUS(status); 707 return_ACPI_STATUS(status);
700 } 708 }
701 709
@@ -765,7 +773,8 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
765 ACPI_NS_SEARCH_PARENT, walk_state, 773 ACPI_NS_SEARCH_PARENT, walk_state,
766 &info.register_node); 774 &info.register_node);
767 if (ACPI_FAILURE(status)) { 775 if (ACPI_FAILURE(status)) {
768 ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 776 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
777 arg->common.value.string, status);
769 return_ACPI_STATUS(status); 778 return_ACPI_STATUS(status);
770 } 779 }
771 780
@@ -778,7 +787,8 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
778 ACPI_NS_SEARCH_PARENT, walk_state, 787 ACPI_NS_SEARCH_PARENT, walk_state,
779 &info.data_register_node); 788 &info.data_register_node);
780 if (ACPI_FAILURE(status)) { 789 if (ACPI_FAILURE(status)) {
781 ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 790 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
791 arg->common.value.string, status);
782 return_ACPI_STATUS(status); 792 return_ACPI_STATUS(status);
783 } 793 }
784 794
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index 82448551781b..b21fe084ffc8 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -112,7 +112,9 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
112 acpi_namespace_node, 112 acpi_namespace_node,
113 &(op->common.node))); 113 &(op->common.node)));
114 if (ACPI_FAILURE(status)) { 114 if (ACPI_FAILURE(status)) {
115 ACPI_ERROR_NAMESPACE(op->common.value. 115 ACPI_ERROR_NAMESPACE(walk_state->
116 scope_info,
117 op->common.value.
116 string, status); 118 string, status);
117 return_ACPI_STATUS(status); 119 return_ACPI_STATUS(status);
118 } 120 }
diff --git a/drivers/acpi/acpica/dspkginit.c b/drivers/acpi/acpica/dspkginit.c
index 6d487edfe2de..5a602b75084e 100644
--- a/drivers/acpi/acpica/dspkginit.c
+++ b/drivers/acpi/acpica/dspkginit.c
@@ -297,8 +297,10 @@ acpi_ds_init_package_element(u8 object_type,
297{ 297{
298 union acpi_operand_object **element_ptr; 298 union acpi_operand_object **element_ptr;
299 299
300 ACPI_FUNCTION_TRACE(ds_init_package_element);
301
300 if (!source_object) { 302 if (!source_object) {
301 return (AE_OK); 303 return_ACPI_STATUS(AE_OK);
302 } 304 }
303 305
304 /* 306 /*
@@ -329,7 +331,7 @@ acpi_ds_init_package_element(u8 object_type,
329 source_object->package.flags |= AOPOBJ_DATA_VALID; 331 source_object->package.flags |= AOPOBJ_DATA_VALID;
330 } 332 }
331 333
332 return (AE_OK); 334 return_ACPI_STATUS(AE_OK);
333} 335}
334 336
335/******************************************************************************* 337/*******************************************************************************
@@ -352,6 +354,7 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
352 union acpi_generic_state scope_info; 354 union acpi_generic_state scope_info;
353 union acpi_operand_object *element = *element_ptr; 355 union acpi_operand_object *element = *element_ptr;
354 struct acpi_namespace_node *resolved_node; 356 struct acpi_namespace_node *resolved_node;
357 struct acpi_namespace_node *original_node;
355 char *external_path = NULL; 358 char *external_path = NULL;
356 acpi_object_type type; 359 acpi_object_type type;
357 360
@@ -441,6 +444,7 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
441 * will remain as named references. This behavior is not described 444 * will remain as named references. This behavior is not described
442 * in the ACPI spec, but it appears to be an oversight. 445 * in the ACPI spec, but it appears to be an oversight.
443 */ 446 */
447 original_node = resolved_node;
444 status = acpi_ex_resolve_node_to_value(&resolved_node, NULL); 448 status = acpi_ex_resolve_node_to_value(&resolved_node, NULL);
445 if (ACPI_FAILURE(status)) { 449 if (ACPI_FAILURE(status)) {
446 return_VOID; 450 return_VOID;
@@ -468,26 +472,27 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
468 */ 472 */
469 case ACPI_TYPE_DEVICE: 473 case ACPI_TYPE_DEVICE:
470 case ACPI_TYPE_THERMAL: 474 case ACPI_TYPE_THERMAL:
471 475 case ACPI_TYPE_METHOD:
472 /* TBD: This may not be necesssary */
473
474 acpi_ut_add_reference(resolved_node->object);
475 break; 476 break;
476 477
477 case ACPI_TYPE_MUTEX: 478 case ACPI_TYPE_MUTEX:
478 case ACPI_TYPE_METHOD:
479 case ACPI_TYPE_POWER: 479 case ACPI_TYPE_POWER:
480 case ACPI_TYPE_PROCESSOR: 480 case ACPI_TYPE_PROCESSOR:
481 case ACPI_TYPE_EVENT: 481 case ACPI_TYPE_EVENT:
482 case ACPI_TYPE_REGION: 482 case ACPI_TYPE_REGION:
483 483
484 /* acpi_ex_resolve_node_to_value gave these an extra reference */
485
486 acpi_ut_remove_reference(original_node->object);
484 break; 487 break;
485 488
486 default: 489 default:
487 /* 490 /*
488 * For all other types - the node was resolved to an actual 491 * For all other types - the node was resolved to an actual
489 * operand object with a value, return the object 492 * operand object with a value, return the object. Remove
493 * a reference on the existing object.
490 */ 494 */
495 acpi_ut_remove_reference(element);
491 *element_ptr = (union acpi_operand_object *)resolved_node; 496 *element_ptr = (union acpi_operand_object *)resolved_node;
492 break; 497 break;
493 } 498 }
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c
index 0dabd9b95684..4c5faf629a83 100644
--- a/drivers/acpi/acpica/dsutils.c
+++ b/drivers/acpi/acpica/dsutils.c
@@ -583,7 +583,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
583 } 583 }
584 584
585 if (ACPI_FAILURE(status)) { 585 if (ACPI_FAILURE(status)) {
586 ACPI_ERROR_NAMESPACE(name_string, status); 586 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
587 name_string, status);
587 } 588 }
588 } 589 }
589 590
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index eaa859a89702..5771e4e4a99a 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -207,7 +207,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
207 } 207 }
208#endif 208#endif
209 if (ACPI_FAILURE(status)) { 209 if (ACPI_FAILURE(status)) {
210 ACPI_ERROR_NAMESPACE(path, status); 210 ACPI_ERROR_NAMESPACE(walk_state->scope_info, path,
211 status);
211 return_ACPI_STATUS(status); 212 return_ACPI_STATUS(status);
212 } 213 }
213 214
@@ -375,7 +376,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
375 } 376 }
376 377
377 if (ACPI_FAILURE(status)) { 378 if (ACPI_FAILURE(status)) {
378 ACPI_ERROR_NAMESPACE(path, status); 379 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
380 path, status);
379 return_ACPI_STATUS(status); 381 return_ACPI_STATUS(status);
380 } 382 }
381 } 383 }
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c
index aad83ef5a4ec..b3d0aaec8203 100644
--- a/drivers/acpi/acpica/dswload2.c
+++ b/drivers/acpi/acpica/dswload2.c
@@ -184,11 +184,14 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
184 if (status == AE_NOT_FOUND) { 184 if (status == AE_NOT_FOUND) {
185 status = AE_OK; 185 status = AE_OK;
186 } else { 186 } else {
187 ACPI_ERROR_NAMESPACE(buffer_ptr, 187 ACPI_ERROR_NAMESPACE(walk_state->
188 scope_info,
189 buffer_ptr,
188 status); 190 status);
189 } 191 }
190#else 192#else
191 ACPI_ERROR_NAMESPACE(buffer_ptr, status); 193 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
194 buffer_ptr, status);
192#endif 195#endif
193 return_ACPI_STATUS(status); 196 return_ACPI_STATUS(status);
194 } 197 }
@@ -343,7 +346,8 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
343 } 346 }
344 347
345 if (ACPI_FAILURE(status)) { 348 if (ACPI_FAILURE(status)) {
346 ACPI_ERROR_NAMESPACE(buffer_ptr, status); 349 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
350 buffer_ptr, status);
347 return_ACPI_STATUS(status); 351 return_ACPI_STATUS(status);
348 } 352 }
349 353
@@ -719,7 +723,8 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
719 */ 723 */
720 op->common.node = new_node; 724 op->common.node = new_node;
721 } else { 725 } else {
722 ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 726 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
727 arg->common.value.string, status);
723 } 728 }
724 break; 729 break;
725 730
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 28b447ff92df..bb58419f0d61 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -298,6 +298,16 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
298 ACPI_EXCEPTION((AE_INFO, status, "Returned by Handler for [%s]", 298 ACPI_EXCEPTION((AE_INFO, status, "Returned by Handler for [%s]",
299 acpi_ut_get_region_name(region_obj->region. 299 acpi_ut_get_region_name(region_obj->region.
300 space_id))); 300 space_id)));
301
302 /*
303 * Special case for an EC timeout. These are seen so frequently
304 * that an additional error message is helpful
305 */
306 if ((region_obj->region.space_id == ACPI_ADR_SPACE_EC) &&
307 (status == AE_TIME)) {
308 ACPI_ERROR((AE_INFO,
309 "Timeout from EC hardware or EC device driver"));
310 }
301 } 311 }
302 312
303 if (!(handler_desc->address_space.handler_flags & 313 if (!(handler_desc->address_space.handler_flags &
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index 83398dc4b7c2..b2ff61bdb9a8 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -617,10 +617,11 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
617 u32 length; 617 u32 length;
618 u32 index; 618 u32 index;
619 619
620 ACPI_FUNCTION_NAME(ex_dump_operand) 620 ACPI_FUNCTION_NAME(ex_dump_operand);
621 621
622 /* Check if debug output enabled */ 622 /* Check if debug output enabled */
623 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) { 623
624 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) {
624 return; 625 return;
625 } 626 }
626 627
@@ -904,7 +905,7 @@ void
904acpi_ex_dump_operands(union acpi_operand_object **operands, 905acpi_ex_dump_operands(union acpi_operand_object **operands,
905 const char *opcode_name, u32 num_operands) 906 const char *opcode_name, u32 num_operands)
906{ 907{
907 ACPI_FUNCTION_NAME(ex_dump_operands); 908 ACPI_FUNCTION_TRACE(ex_dump_operands);
908 909
909 if (!opcode_name) { 910 if (!opcode_name) {
910 opcode_name = "UNKNOWN"; 911 opcode_name = "UNKNOWN";
@@ -928,7 +929,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
928 929
929 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 930 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
930 "**** End operand dump for [%s]\n", opcode_name)); 931 "**** End operand dump for [%s]\n", opcode_name));
931 return; 932 return_VOID;
932} 933}
933 934
934/******************************************************************************* 935/*******************************************************************************
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c
index a2f4e25d45b1..5b4282902a83 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -150,10 +150,10 @@ ACPI_EXPORT_SYMBOL(acpi_get_timer)
150 * 150 *
151 ******************************************************************************/ 151 ******************************************************************************/
152acpi_status 152acpi_status
153acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) 153acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 *time_elapsed)
154{ 154{
155 acpi_status status; 155 acpi_status status;
156 u32 delta_ticks; 156 u64 delta_ticks;
157 u64 quotient; 157 u64 quotient;
158 158
159 ACPI_FUNCTION_TRACE(acpi_get_timer_duration); 159 ACPI_FUNCTION_TRACE(acpi_get_timer_duration);
@@ -168,30 +168,29 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
168 return_ACPI_STATUS(AE_SUPPORT); 168 return_ACPI_STATUS(AE_SUPPORT);
169 } 169 }
170 170
171 if (start_ticks == end_ticks) {
172 *time_elapsed = 0;
173 return_ACPI_STATUS(AE_OK);
174 }
175
171 /* 176 /*
172 * Compute Tick Delta: 177 * Compute Tick Delta:
173 * Handle (max one) timer rollovers on 24-bit versus 32-bit timers. 178 * Handle (max one) timer rollovers on 24-bit versus 32-bit timers.
174 */ 179 */
175 if (start_ticks < end_ticks) { 180 delta_ticks = end_ticks;
176 delta_ticks = end_ticks - start_ticks; 181 if (start_ticks > end_ticks) {
177 } else if (start_ticks > end_ticks) {
178 if ((acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) == 0) { 182 if ((acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) == 0) {
179 183
180 /* 24-bit Timer */ 184 /* 24-bit Timer */
181 185
182 delta_ticks = 186 delta_ticks |= (u64)1 << 24;
183 (((0x00FFFFFF - start_ticks) +
184 end_ticks) & 0x00FFFFFF);
185 } else { 187 } else {
186 /* 32-bit Timer */ 188 /* 32-bit Timer */
187 189
188 delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks; 190 delta_ticks |= (u64)1 << 32;
189 } 191 }
190 } else { /* start_ticks == end_ticks */
191
192 *time_elapsed = 0;
193 return_ACPI_STATUS(AE_OK);
194 } 192 }
193 delta_ticks -= start_ticks;
195 194
196 /* 195 /*
197 * Compute Duration (Requires a 64-bit multiply and divide): 196 * Compute Duration (Requires a 64-bit multiply and divide):
@@ -199,10 +198,10 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
199 * time_elapsed (microseconds) = 198 * time_elapsed (microseconds) =
200 * (delta_ticks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY; 199 * (delta_ticks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY;
201 */ 200 */
202 status = acpi_ut_short_divide(((u64)delta_ticks) * ACPI_USEC_PER_SEC, 201 status = acpi_ut_short_divide(delta_ticks * ACPI_USEC_PER_SEC,
203 ACPI_PM_TIMER_FREQUENCY, &quotient, NULL); 202 ACPI_PM_TIMER_FREQUENCY, &quotient, NULL);
204 203
205 *time_elapsed = (u32) quotient; 204 *time_elapsed = (u32)quotient;
206 return_ACPI_STATUS(status); 205 return_ACPI_STATUS(status);
207} 206}
208 207
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c
index 3094cec4eab4..d1679035d5f3 100644
--- a/drivers/acpi/acpica/hwvalid.c
+++ b/drivers/acpi/acpica/hwvalid.c
@@ -128,14 +128,14 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
128 acpi_io_address last_address; 128 acpi_io_address last_address;
129 const struct acpi_port_info *port_info; 129 const struct acpi_port_info *port_info;
130 130
131 ACPI_FUNCTION_NAME(hw_validate_io_request); 131 ACPI_FUNCTION_TRACE(hw_validate_io_request);
132 132
133 /* Supported widths are 8/16/32 */ 133 /* Supported widths are 8/16/32 */
134 134
135 if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) { 135 if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) {
136 ACPI_ERROR((AE_INFO, 136 ACPI_ERROR((AE_INFO,
137 "Bad BitWidth parameter: %8.8X", bit_width)); 137 "Bad BitWidth parameter: %8.8X", bit_width));
138 return (AE_BAD_PARAMETER); 138 return_ACPI_STATUS(AE_BAD_PARAMETER);
139 } 139 }
140 140
141 port_info = acpi_protected_ports; 141 port_info = acpi_protected_ports;
@@ -153,13 +153,13 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
153 ACPI_ERROR((AE_INFO, 153 ACPI_ERROR((AE_INFO,
154 "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", 154 "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X",
155 ACPI_FORMAT_UINT64(address), byte_width)); 155 ACPI_FORMAT_UINT64(address), byte_width));
156 return (AE_LIMIT); 156 return_ACPI_STATUS(AE_LIMIT);
157 } 157 }
158 158
159 /* Exit if requested address is not within the protected port table */ 159 /* Exit if requested address is not within the protected port table */
160 160
161 if (address > acpi_protected_ports[ACPI_PORT_INFO_ENTRIES - 1].end) { 161 if (address > acpi_protected_ports[ACPI_PORT_INFO_ENTRIES - 1].end) {
162 return (AE_OK); 162 return_ACPI_STATUS(AE_OK);
163 } 163 }
164 164
165 /* Check request against the list of protected I/O ports */ 165 /* Check request against the list of protected I/O ports */
@@ -180,8 +180,8 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
180 /* Port illegality may depend on the _OSI calls made by the BIOS */ 180 /* Port illegality may depend on the _OSI calls made by the BIOS */
181 181
182 if (acpi_gbl_osi_data >= port_info->osi_dependency) { 182 if (acpi_gbl_osi_data >= port_info->osi_dependency) {
183 ACPI_DEBUG_PRINT((ACPI_DB_IO, 183 ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
184 "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)", 184 "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)\n",
185 ACPI_FORMAT_UINT64(address), 185 ACPI_FORMAT_UINT64(address),
186 byte_width, port_info->name, 186 byte_width, port_info->name,
187 port_info->start, 187 port_info->start,
@@ -198,7 +198,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
198 } 198 }
199 } 199 }
200 200
201 return (AE_OK); 201 return_ACPI_STATUS(AE_OK);
202} 202}
203 203
204/****************************************************************************** 204/******************************************************************************
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index f2733f51ca8d..33e652a12fca 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -644,17 +644,18 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
644 this_node->object; 644 this_node->object;
645 } 645 }
646 } 646 }
647#ifdef ACPI_ASL_COMPILER
648 if (!acpi_gbl_disasm_flag &&
649 (this_node->flags & ANOBJ_IS_EXTERNAL)) {
650 this_node->flags |= IMPLICIT_EXTERNAL;
651 }
652#endif
653 } 647 }
654 648
655 /* Special handling for the last segment (num_segments == 0) */ 649 /* Special handling for the last segment (num_segments == 0) */
656 650
657 else { 651 else {
652#ifdef ACPI_ASL_COMPILER
653 if (!acpi_gbl_disasm_flag
654 && (this_node->flags & ANOBJ_IS_EXTERNAL)) {
655 this_node->flags &= ~IMPLICIT_EXTERNAL;
656 }
657#endif
658
658 /* 659 /*
659 * Sanity typecheck of the target object: 660 * Sanity typecheck of the target object:
660 * 661 *
diff --git a/drivers/acpi/acpica/nsconvert.c b/drivers/acpi/acpica/nsconvert.c
index 539d775bbc92..d55dcc82f434 100644
--- a/drivers/acpi/acpica/nsconvert.c
+++ b/drivers/acpi/acpica/nsconvert.c
@@ -495,7 +495,8 @@ acpi_ns_convert_to_reference(struct acpi_namespace_node *scope,
495 495
496 /* Check if we are resolving a named reference within a package */ 496 /* Check if we are resolving a named reference within a package */
497 497
498 ACPI_ERROR_NAMESPACE(original_object->string.pointer, status); 498 ACPI_ERROR_NAMESPACE(&scope_info,
499 original_object->string.pointer, status);
499 goto error_exit; 500 goto error_exit;
500 } 501 }
501 502
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index a410760a0308..22c92d1a24d8 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -49,6 +49,9 @@
49#define _COMPONENT ACPI_NAMESPACE 49#define _COMPONENT ACPI_NAMESPACE
50ACPI_MODULE_NAME("nsnames") 50ACPI_MODULE_NAME("nsnames")
51 51
52/* Local Prototypes */
53static void acpi_ns_normalize_pathname(char *original_path);
54
52/******************************************************************************* 55/*******************************************************************************
53 * 56 *
54 * FUNCTION: acpi_ns_get_external_pathname 57 * FUNCTION: acpi_ns_get_external_pathname
@@ -63,6 +66,7 @@ ACPI_MODULE_NAME("nsnames")
63 * for error and debug statements. 66 * for error and debug statements.
64 * 67 *
65 ******************************************************************************/ 68 ******************************************************************************/
69
66char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) 70char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
67{ 71{
68 char *name_buffer; 72 char *name_buffer;
@@ -352,3 +356,148 @@ char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node,
352 356
353 return_PTR(name_buffer); 357 return_PTR(name_buffer);
354} 358}
359
360/*******************************************************************************
361 *
362 * FUNCTION: acpi_ns_build_prefixed_pathname
363 *
364 * PARAMETERS: prefix_scope - Scope/Path that prefixes the internal path
365 * internal_path - Name or path of the namespace node
366 *
367 * RETURN: None
368 *
369 * DESCRIPTION: Construct a fully qualified pathname from a concatenation of:
370 * 1) Path associated with the prefix_scope namespace node
371 * 2) External path representation of the Internal path
372 *
373 ******************************************************************************/
374
375char *acpi_ns_build_prefixed_pathname(union acpi_generic_state *prefix_scope,
376 const char *internal_path)
377{
378 acpi_status status;
379 char *full_path = NULL;
380 char *external_path = NULL;
381 char *prefix_path = NULL;
382 u32 prefix_path_length = 0;
383
384 /* If there is a prefix, get the pathname to it */
385
386 if (prefix_scope && prefix_scope->scope.node) {
387 prefix_path =
388 acpi_ns_get_normalized_pathname(prefix_scope->scope.node,
389 TRUE);
390 if (prefix_path) {
391 prefix_path_length = strlen(prefix_path);
392 }
393 }
394
395 status = acpi_ns_externalize_name(ACPI_UINT32_MAX, internal_path,
396 NULL, &external_path);
397 if (ACPI_FAILURE(status)) {
398 goto cleanup;
399 }
400
401 /* Merge the prefix path and the path. 2 is for one dot and trailing null */
402
403 full_path =
404 ACPI_ALLOCATE_ZEROED(prefix_path_length + strlen(external_path) +
405 2);
406 if (!full_path) {
407 goto cleanup;
408 }
409
410 /* Don't merge if the External path is already fully qualified */
411
412 if (prefix_path && (*external_path != '\\') && (*external_path != '^')) {
413 strcat(full_path, prefix_path);
414 if (prefix_path[1]) {
415 strcat(full_path, ".");
416 }
417 }
418
419 acpi_ns_normalize_pathname(external_path);
420 strcat(full_path, external_path);
421
422cleanup:
423 if (prefix_path) {
424 ACPI_FREE(prefix_path);
425 }
426 if (external_path) {
427 ACPI_FREE(external_path);
428 }
429
430 return (full_path);
431}
432
433/*******************************************************************************
434 *
435 * FUNCTION: acpi_ns_normalize_pathname
436 *
437 * PARAMETERS: original_path - Path to be normalized, in External format
438 *
439 * RETURN: The original path is processed in-place
440 *
441 * DESCRIPTION: Remove trailing underscores from each element of a path.
442 *
443 * For example: \A___.B___.C___ becomes \A.B.C
444 *
445 ******************************************************************************/
446
447static void acpi_ns_normalize_pathname(char *original_path)
448{
449 char *input_path = original_path;
450 char *new_path_buffer;
451 char *new_path;
452 u32 i;
453
454 /* Allocate a temp buffer in which to construct the new path */
455
456 new_path_buffer = ACPI_ALLOCATE_ZEROED(strlen(input_path) + 1);
457 new_path = new_path_buffer;
458 if (!new_path_buffer) {
459 return;
460 }
461
462 /* Special characters may appear at the beginning of the path */
463
464 if (*input_path == '\\') {
465 *new_path = *input_path;
466 new_path++;
467 input_path++;
468 }
469
470 while (*input_path == '^') {
471 *new_path = *input_path;
472 new_path++;
473 input_path++;
474 }
475
476 /* Remainder of the path */
477
478 while (*input_path) {
479
480 /* Do one nameseg at a time */
481
482 for (i = 0; (i < ACPI_NAME_SIZE) && *input_path; i++) {
483 if ((i == 0) || (*input_path != '_')) { /* First char is allowed to be underscore */
484 *new_path = *input_path;
485 new_path++;
486 }
487
488 input_path++;
489 }
490
491 /* Dot means that there are more namesegs to come */
492
493 if (*input_path == '.') {
494 *new_path = *input_path;
495 new_path++;
496 input_path++;
497 }
498 }
499
500 *new_path = 0;
501 strcpy(original_path, new_path_buffer);
502 ACPI_FREE(new_path_buffer);
503}
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index 5de8957f5ef0..e91dbee9235f 100644
--- a/drivers/acpi/acpica/nssearch.c
+++ b/drivers/acpi/acpica/nssearch.c
@@ -417,6 +417,7 @@ acpi_ns_search_and_enter(u32 target_name,
417 if (flags & ACPI_NS_EXTERNAL || 417 if (flags & ACPI_NS_EXTERNAL ||
418 (walk_state && walk_state->opcode == AML_SCOPE_OP)) { 418 (walk_state && walk_state->opcode == AML_SCOPE_OP)) {
419 new_node->flags |= ANOBJ_IS_EXTERNAL; 419 new_node->flags |= ANOBJ_IS_EXTERNAL;
420 new_node->flags |= IMPLICIT_EXTERNAL;
420 } 421 }
421#endif 422#endif
422 423
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index 783f4c838aee..9b51f65823b2 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -61,10 +61,10 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info);
61 * 61 *
62 * PARAMETERS: handle - Object handle (optional) 62 * PARAMETERS: handle - Object handle (optional)
63 * pathname - Object pathname (optional) 63 * pathname - Object pathname (optional)
64 * external_params - List of parameters to pass to method, 64 * external_params - List of parameters to pass to a method,
65 * terminated by NULL. May be NULL 65 * terminated by NULL. May be NULL
66 * if no parameters are being passed. 66 * if no parameters are being passed.
67 * return_buffer - Where to put method's return value (if 67 * return_buffer - Where to put the object's return value (if
68 * any). If NULL, no value is returned. 68 * any). If NULL, no value is returned.
69 * return_type - Expected type of return object 69 * return_type - Expected type of return object
70 * 70 *
@@ -100,13 +100,14 @@ acpi_evaluate_object_typed(acpi_handle handle,
100 free_buffer_on_error = TRUE; 100 free_buffer_on_error = TRUE;
101 } 101 }
102 102
103 /* Get a handle here, in order to build an error message if needed */
104
105 target_handle = handle;
103 if (pathname) { 106 if (pathname) {
104 status = acpi_get_handle(handle, pathname, &target_handle); 107 status = acpi_get_handle(handle, pathname, &target_handle);
105 if (ACPI_FAILURE(status)) { 108 if (ACPI_FAILURE(status)) {
106 return_ACPI_STATUS(status); 109 return_ACPI_STATUS(status);
107 } 110 }
108 } else {
109 target_handle = handle;
110 } 111 }
111 112
112 full_pathname = acpi_ns_get_external_pathname(target_handle); 113 full_pathname = acpi_ns_get_external_pathname(target_handle);
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index eb9dfaca555f..171e2faa7c50 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -361,7 +361,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
361 /* Final exception check (may have been changed from code above) */ 361 /* Final exception check (may have been changed from code above) */
362 362
363 if (ACPI_FAILURE(status)) { 363 if (ACPI_FAILURE(status)) {
364 ACPI_ERROR_NAMESPACE(path, status); 364 ACPI_ERROR_NAMESPACE(walk_state->scope_info, path, status);
365 365
366 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == 366 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
367 ACPI_PARSE_EXECUTE) { 367 ACPI_PARSE_EXECUTE) {
diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.c
index 0bef6df71bba..c0b179883ff2 100644
--- a/drivers/acpi/acpica/psobject.c
+++ b/drivers/acpi/acpica/psobject.c
@@ -372,16 +372,10 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state,
372 * external declaration opcode. Setting walk_state->Aml to 372 * external declaration opcode. Setting walk_state->Aml to
373 * walk_state->parser_state.Aml + 2 moves increments the 373 * walk_state->parser_state.Aml + 2 moves increments the
374 * walk_state->Aml past the object type and the paramcount of the 374 * walk_state->Aml past the object type and the paramcount of the
375 * external opcode. For the error message, only print the AML 375 * external opcode.
376 * offset. We could attempt to print the name but this may cause
377 * a segmentation fault when printing the namepath because the
378 * AML may be incorrect.
379 */ 376 */
380 acpi_os_printf
381 ("// Invalid external declaration at AML offset 0x%x.\n",
382 walk_state->aml -
383 walk_state->parser_state.aml_start);
384 walk_state->aml = walk_state->parser_state.aml + 2; 377 walk_state->aml = walk_state->parser_state.aml + 2;
378 walk_state->parser_state.aml = walk_state->aml;
385 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); 379 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
386 } 380 }
387#endif 381#endif
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index 02642760cb93..cd59dfe6a47d 100644
--- a/drivers/acpi/acpica/psutils.c
+++ b/drivers/acpi/acpica/psutils.c
@@ -94,9 +94,11 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
94 op->common.descriptor_type = ACPI_DESC_TYPE_PARSER; 94 op->common.descriptor_type = ACPI_DESC_TYPE_PARSER;
95 op->common.aml_opcode = opcode; 95 op->common.aml_opcode = opcode;
96 96
97 ACPI_DISASM_ONLY_MEMBERS(strncpy(op->common.aml_op_name, 97 ACPI_DISASM_ONLY_MEMBERS(acpi_ut_safe_strncpy(op->common.aml_op_name,
98 (acpi_ps_get_opcode_info(opcode))-> 98 (acpi_ps_get_opcode_info
99 name, sizeof(op->common.aml_op_name))); 99 (opcode))->name,
100 sizeof(op->common.
101 aml_op_name)));
100} 102}
101 103
102/******************************************************************************* 104/*******************************************************************************
@@ -158,10 +160,10 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode, u8 *aml)
158 if (opcode == AML_SCOPE_OP) { 160 if (opcode == AML_SCOPE_OP) {
159 acpi_gbl_current_scope = op; 161 acpi_gbl_current_scope = op;
160 } 162 }
161 }
162 163
163 if (gbl_capture_comments) { 164 if (acpi_gbl_capture_comments) {
164 ASL_CV_TRANSFER_COMMENTS(op); 165 ASL_CV_TRANSFER_COMMENTS(op);
166 }
165 } 167 }
166 168
167 return (op); 169 return (op);
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index 615a885e2ca3..cff7154b7fee 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -163,6 +163,9 @@ acpi_debug_print(u32 requested_debug_level,
163{ 163{
164 acpi_thread_id thread_id; 164 acpi_thread_id thread_id;
165 va_list args; 165 va_list args;
166#ifdef ACPI_APPLICATION
167 int fill_count;
168#endif
166 169
167 /* Check if debug output enabled */ 170 /* Check if debug output enabled */
168 171
@@ -202,10 +205,21 @@ acpi_debug_print(u32 requested_debug_level,
202 acpi_os_printf("[%u] ", (u32)thread_id); 205 acpi_os_printf("[%u] ", (u32)thread_id);
203 } 206 }
204 207
205 acpi_os_printf("[%02ld] ", acpi_gbl_nesting_level); 208 fill_count = 48 - acpi_gbl_nesting_level -
206#endif 209 strlen(acpi_ut_trim_function_name(function_name));
210 if (fill_count < 0) {
211 fill_count = 0;
212 }
213
214 acpi_os_printf("[%02ld] %*s",
215 acpi_gbl_nesting_level, acpi_gbl_nesting_level + 1, " ");
216 acpi_os_printf("%s%*s: ",
217 acpi_ut_trim_function_name(function_name), fill_count,
218 " ");
207 219
220#else
208 acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name)); 221 acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name));
222#endif
209 223
210 va_start(args, format); 224 va_start(args, format);
211 acpi_os_vprintf(format, args); 225 acpi_os_vprintf(format, args);
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index 02cd2c2d961a..55debbad487d 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -395,11 +395,6 @@ const char *acpi_ut_get_reference_name(union acpi_operand_object *object)
395 return (acpi_gbl_ref_class_names[object->reference.class]); 395 return (acpi_gbl_ref_class_names[object->reference.class]);
396} 396}
397 397
398#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
399/*
400 * Strings and procedures used for debug only
401 */
402
403/******************************************************************************* 398/*******************************************************************************
404 * 399 *
405 * FUNCTION: acpi_ut_get_mutex_name 400 * FUNCTION: acpi_ut_get_mutex_name
@@ -433,6 +428,12 @@ const char *acpi_ut_get_mutex_name(u32 mutex_id)
433 return (acpi_gbl_mutex_names[mutex_id]); 428 return (acpi_gbl_mutex_names[mutex_id]);
434} 429}
435 430
431#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
432
433/*
434 * Strings and procedures used for debug only
435 */
436
436/******************************************************************************* 437/*******************************************************************************
437 * 438 *
438 * FUNCTION: acpi_ut_get_notify_name 439 * FUNCTION: acpi_ut_get_notify_name
diff --git a/drivers/acpi/acpica/uterror.c b/drivers/acpi/acpica/uterror.c
index e3368186e1c1..42388dcb5ccc 100644
--- a/drivers/acpi/acpica/uterror.c
+++ b/drivers/acpi/acpica/uterror.c
@@ -182,6 +182,78 @@ acpi_ut_predefined_bios_error(const char *module_name,
182 182
183/******************************************************************************* 183/*******************************************************************************
184 * 184 *
185 * FUNCTION: acpi_ut_prefixed_namespace_error
186 *
187 * PARAMETERS: module_name - Caller's module name (for error output)
188 * line_number - Caller's line number (for error output)
189 * prefix_scope - Scope/Path that prefixes the internal path
190 * internal_path - Name or path of the namespace node
191 * lookup_status - Exception code from NS lookup
192 *
193 * RETURN: None
194 *
195 * DESCRIPTION: Print error message with the full pathname constructed this way:
196 *
197 * prefix_scope_node_full_path.externalized_internal_path
198 *
199 * NOTE: 10/2017: Treat the major ns_lookup errors as firmware errors
200 *
201 ******************************************************************************/
202
203void
204acpi_ut_prefixed_namespace_error(const char *module_name,
205 u32 line_number,
206 union acpi_generic_state *prefix_scope,
207 const char *internal_path,
208 acpi_status lookup_status)
209{
210 char *full_path;
211 const char *message;
212
213 /*
214 * Main cases:
215 * 1) Object creation, object must not already exist
216 * 2) Object lookup, object must exist
217 */
218 switch (lookup_status) {
219 case AE_ALREADY_EXISTS:
220
221 acpi_os_printf(ACPI_MSG_BIOS_ERROR);
222 message = "Failure creating";
223 break;
224
225 case AE_NOT_FOUND:
226
227 acpi_os_printf(ACPI_MSG_BIOS_ERROR);
228 message = "Failure looking up";
229 break;
230
231 default:
232
233 acpi_os_printf(ACPI_MSG_ERROR);
234 message = "Failure looking up";
235 break;
236 }
237
238 /* Concatenate the prefix path and the internal path */
239
240 full_path =
241 acpi_ns_build_prefixed_pathname(prefix_scope, internal_path);
242
243 acpi_os_printf("%s [%s], %s", message,
244 full_path ? full_path : "Could not get pathname",
245 acpi_format_exception(lookup_status));
246
247 if (full_path) {
248 ACPI_FREE(full_path);
249 }
250
251 ACPI_MSG_SUFFIX;
252}
253
254#ifdef __OBSOLETE_FUNCTION
255/*******************************************************************************
256 *
185 * FUNCTION: acpi_ut_namespace_error 257 * FUNCTION: acpi_ut_namespace_error
186 * 258 *
187 * PARAMETERS: module_name - Caller's module name (for error output) 259 * PARAMETERS: module_name - Caller's module name (for error output)
@@ -240,6 +312,7 @@ acpi_ut_namespace_error(const char *module_name,
240 ACPI_MSG_SUFFIX; 312 ACPI_MSG_SUFFIX;
241 ACPI_MSG_REDIRECT_END; 313 ACPI_MSG_REDIRECT_END;
242} 314}
315#endif
243 316
244/******************************************************************************* 317/*******************************************************************************
245 * 318 *
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c
index 23e766d1691d..45eeb0dcf283 100644
--- a/drivers/acpi/acpica/utinit.c
+++ b/drivers/acpi/acpica/utinit.c
@@ -206,7 +206,6 @@ acpi_status acpi_ut_init_globals(void)
206 acpi_gbl_next_owner_id_offset = 0; 206 acpi_gbl_next_owner_id_offset = 0;
207 acpi_gbl_debugger_configuration = DEBUGGER_THREADING; 207 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
208 acpi_gbl_osi_mutex = NULL; 208 acpi_gbl_osi_mutex = NULL;
209 acpi_gbl_max_loop_iterations = ACPI_MAX_LOOP_COUNT;
210 209
211 /* Hardware oriented */ 210 /* Hardware oriented */
212 211
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c
index 5f9c680076c4..2055a858e5f5 100644
--- a/drivers/acpi/acpica/utmath.c
+++ b/drivers/acpi/acpica/utmath.c
@@ -134,7 +134,7 @@ acpi_status acpi_ut_short_shift_left(u64 operand, u32 count, u64 *out_result)
134 134
135 if ((count & 63) >= 32) { 135 if ((count & 63) >= 32) {
136 operand_ovl.part.hi = operand_ovl.part.lo; 136 operand_ovl.part.hi = operand_ovl.part.lo;
137 operand_ovl.part.lo ^= operand_ovl.part.lo; 137 operand_ovl.part.lo = 0;
138 count = (count & 63) - 32; 138 count = (count & 63) - 32;
139 } 139 }
140 ACPI_SHIFT_LEFT_64_BY_32(operand_ovl.part.hi, 140 ACPI_SHIFT_LEFT_64_BY_32(operand_ovl.part.hi,
@@ -171,7 +171,7 @@ acpi_status acpi_ut_short_shift_right(u64 operand, u32 count, u64 *out_result)
171 171
172 if ((count & 63) >= 32) { 172 if ((count & 63) >= 32) {
173 operand_ovl.part.lo = operand_ovl.part.hi; 173 operand_ovl.part.lo = operand_ovl.part.hi;
174 operand_ovl.part.hi ^= operand_ovl.part.hi; 174 operand_ovl.part.hi = 0;
175 count = (count & 63) - 32; 175 count = (count & 63) - 32;
176 } 176 }
177 ACPI_SHIFT_RIGHT_64_BY_32(operand_ovl.part.hi, 177 ACPI_SHIFT_RIGHT_64_BY_32(operand_ovl.part.hi,
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c
index 586354788018..524ba931d5e8 100644
--- a/drivers/acpi/acpica/utmutex.c
+++ b/drivers/acpi/acpica/utmutex.c
@@ -286,8 +286,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
286 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; 286 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
287 } else { 287 } else {
288 ACPI_EXCEPTION((AE_INFO, status, 288 ACPI_EXCEPTION((AE_INFO, status,
289 "Thread %u could not acquire Mutex [0x%X]", 289 "Thread %u could not acquire Mutex [%s] (0x%X)",
290 (u32)this_thread_id, mutex_id)); 290 (u32)this_thread_id,
291 acpi_ut_get_mutex_name(mutex_id), mutex_id));
291 } 292 }
292 293
293 return (status); 294 return (status);
@@ -322,8 +323,8 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
322 */ 323 */
323 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) { 324 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
324 ACPI_ERROR((AE_INFO, 325 ACPI_ERROR((AE_INFO,
325 "Mutex [0x%X] is not acquired, cannot release", 326 "Mutex [%s] (0x%X) is not acquired, cannot release",
326 mutex_id)); 327 acpi_ut_get_mutex_name(mutex_id), mutex_id));
327 328
328 return (AE_NOT_ACQUIRED); 329 return (AE_NOT_ACQUIRED);
329 } 330 }
diff --git a/drivers/acpi/acpica/utnonansi.c b/drivers/acpi/acpica/utnonansi.c
index 792664982ea3..33a0970646df 100644
--- a/drivers/acpi/acpica/utnonansi.c
+++ b/drivers/acpi/acpica/utnonansi.c
@@ -140,7 +140,7 @@ int acpi_ut_stricmp(char *string1, char *string2)
140 return (c1 - c2); 140 return (c1 - c2);
141} 141}
142 142
143#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) 143#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT)
144/******************************************************************************* 144/*******************************************************************************
145 * 145 *
146 * FUNCTION: acpi_ut_safe_strcpy, acpi_ut_safe_strcat, acpi_ut_safe_strncat 146 * FUNCTION: acpi_ut_safe_strcpy, acpi_ut_safe_strcat, acpi_ut_safe_strncat
@@ -199,4 +199,13 @@ acpi_ut_safe_strncat(char *dest,
199 strncat(dest, source, max_transfer_length); 199 strncat(dest, source, max_transfer_length);
200 return (FALSE); 200 return (FALSE);
201} 201}
202
203void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size)
204{
205 /* Always terminate destination string */
206
207 strncpy(dest, source, dest_size);
208 dest[dest_size - 1] = 0;
209}
210
202#endif 211#endif
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c
index 3175b133c0e4..f6b8dd24b006 100644
--- a/drivers/acpi/acpica/utosi.c
+++ b/drivers/acpi/acpica/utosi.c
@@ -101,6 +101,8 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = {
101 {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ 101 {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */
102 {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */ 102 {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */
103 {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */ 103 {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */
104 {"Windows 2016", NULL, 0, ACPI_OSI_WIN_10_RS1}, /* Windows 10 version 1607 - Added 12/2017 */
105 {"Windows 2017", NULL, 0, ACPI_OSI_WIN_10_RS2}, /* Windows 10 version 1703 - Added 12/2017 */
104 106
105 /* Feature Group Strings */ 107 /* Feature Group Strings */
106 108
diff --git a/drivers/acpi/acpica/utstrsuppt.c b/drivers/acpi/acpica/utstrsuppt.c
index 965fb5cec94f..97f48d71f9e6 100644
--- a/drivers/acpi/acpica/utstrsuppt.c
+++ b/drivers/acpi/acpica/utstrsuppt.c
@@ -52,10 +52,9 @@ static acpi_status
52acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit); 52acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit);
53 53
54static acpi_status 54static acpi_status
55acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product); 55acpi_ut_strtoul_multiply64(u64 multiplicand, u32 base, u64 *out_product);
56 56
57static acpi_status 57static acpi_status acpi_ut_strtoul_add64(u64 addend1, u32 digit, u64 *out_sum);
58acpi_ut_strtoul_add64(u64 addend1, u64 addend2, u64 *out_sum);
59 58
60/******************************************************************************* 59/*******************************************************************************
61 * 60 *
@@ -357,7 +356,7 @@ acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit)
357 * FUNCTION: acpi_ut_strtoul_multiply64 356 * FUNCTION: acpi_ut_strtoul_multiply64
358 * 357 *
359 * PARAMETERS: multiplicand - Current accumulated converted integer 358 * PARAMETERS: multiplicand - Current accumulated converted integer
360 * multiplier - Base/Radix 359 * base - Base/Radix
361 * out_product - Where the product is returned 360 * out_product - Where the product is returned
362 * 361 *
363 * RETURN: Status and 64-bit product 362 * RETURN: Status and 64-bit product
@@ -369,33 +368,40 @@ acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit)
369 ******************************************************************************/ 368 ******************************************************************************/
370 369
371static acpi_status 370static acpi_status
372acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product) 371acpi_ut_strtoul_multiply64(u64 multiplicand, u32 base, u64 *out_product)
373{ 372{
374 u64 val; 373 u64 product;
374 u64 quotient;
375 375
376 /* Exit if either operand is zero */ 376 /* Exit if either operand is zero */
377 377
378 *out_product = 0; 378 *out_product = 0;
379 if (!multiplicand || !multiplier) { 379 if (!multiplicand || !base) {
380 return (AE_OK); 380 return (AE_OK);
381 } 381 }
382 382
383 /* Check for 64-bit overflow before the actual multiplication */ 383 /*
384 384 * Check for 64-bit overflow before the actual multiplication.
385 acpi_ut_short_divide(ACPI_UINT64_MAX, (u32)multiplier, &val, NULL); 385 *
386 if (multiplicand > val) { 386 * Notes: 64-bit division is often not supported on 32-bit platforms
387 * (it requires a library function), Therefore ACPICA has a local
388 * 64-bit divide function. Also, Multiplier is currently only used
389 * as the radix (8/10/16), to the 64/32 divide will always work.
390 */
391 acpi_ut_short_divide(ACPI_UINT64_MAX, base, &quotient, NULL);
392 if (multiplicand > quotient) {
387 return (AE_NUMERIC_OVERFLOW); 393 return (AE_NUMERIC_OVERFLOW);
388 } 394 }
389 395
390 val = multiplicand * multiplier; 396 product = multiplicand * base;
391 397
392 /* Check for 32-bit overflow if necessary */ 398 /* Check for 32-bit overflow if necessary */
393 399
394 if ((acpi_gbl_integer_bit_width == 32) && (val > ACPI_UINT32_MAX)) { 400 if ((acpi_gbl_integer_bit_width == 32) && (product > ACPI_UINT32_MAX)) {
395 return (AE_NUMERIC_OVERFLOW); 401 return (AE_NUMERIC_OVERFLOW);
396 } 402 }
397 403
398 *out_product = val; 404 *out_product = product;
399 return (AE_OK); 405 return (AE_OK);
400} 406}
401 407
@@ -404,7 +410,7 @@ acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product)
404 * FUNCTION: acpi_ut_strtoul_add64 410 * FUNCTION: acpi_ut_strtoul_add64
405 * 411 *
406 * PARAMETERS: addend1 - Current accumulated converted integer 412 * PARAMETERS: addend1 - Current accumulated converted integer
407 * addend2 - New hex value/char 413 * digit - New hex value/char
408 * out_sum - Where sum is returned (Accumulator) 414 * out_sum - Where sum is returned (Accumulator)
409 * 415 *
410 * RETURN: Status and 64-bit sum 416 * RETURN: Status and 64-bit sum
@@ -415,17 +421,17 @@ acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product)
415 * 421 *
416 ******************************************************************************/ 422 ******************************************************************************/
417 423
418static acpi_status acpi_ut_strtoul_add64(u64 addend1, u64 addend2, u64 *out_sum) 424static acpi_status acpi_ut_strtoul_add64(u64 addend1, u32 digit, u64 *out_sum)
419{ 425{
420 u64 sum; 426 u64 sum;
421 427
422 /* Check for 64-bit overflow before the actual addition */ 428 /* Check for 64-bit overflow before the actual addition */
423 429
424 if ((addend1 > 0) && (addend2 > (ACPI_UINT64_MAX - addend1))) { 430 if ((addend1 > 0) && (digit > (ACPI_UINT64_MAX - addend1))) {
425 return (AE_NUMERIC_OVERFLOW); 431 return (AE_NUMERIC_OVERFLOW);
426 } 432 }
427 433
428 sum = addend1 + addend2; 434 sum = addend1 + digit;
429 435
430 /* Check for 32-bit overflow if necessary */ 436 /* Check for 32-bit overflow if necessary */
431 437
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c
index 3c8de88ecbd5..633b4e2c669f 100644
--- a/drivers/acpi/acpica/uttrack.c
+++ b/drivers/acpi/acpica/uttrack.c
@@ -402,8 +402,8 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
402 allocation->component = component; 402 allocation->component = component;
403 allocation->line = line; 403 allocation->line = line;
404 404
405 strncpy(allocation->module, module, ACPI_MAX_MODULE_NAME); 405 acpi_ut_safe_strncpy(allocation->module, (char *)module,
406 allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; 406 ACPI_MAX_MODULE_NAME);
407 407
408 if (!element) { 408 if (!element) {
409 409
@@ -717,7 +717,7 @@ exit:
717 if (!num_outstanding) { 717 if (!num_outstanding) {
718 ACPI_INFO(("No outstanding allocations")); 718 ACPI_INFO(("No outstanding allocations"));
719 } else { 719 } else {
720 ACPI_ERROR((AE_INFO, "%u(0x%X) Outstanding allocations", 720 ACPI_ERROR((AE_INFO, "%u (0x%X) Outstanding cache allocations",
721 num_outstanding, num_outstanding)); 721 num_outstanding, num_outstanding));
722 } 722 }
723 723
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index 950a1e500bfa..9da4f8ef2e77 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -96,8 +96,8 @@ ACPI_EXPORT_SYMBOL(acpi_error)
96 * 96 *
97 * RETURN: None 97 * RETURN: None
98 * 98 *
99 * DESCRIPTION: Print "ACPI Exception" message with module/line/version info 99 * DESCRIPTION: Print an "ACPI Error" message with module/line/version
100 * and decoded acpi_status. 100 * info as well as decoded acpi_status.
101 * 101 *
102 ******************************************************************************/ 102 ******************************************************************************/
103void ACPI_INTERNAL_VAR_XFACE 103void ACPI_INTERNAL_VAR_XFACE
@@ -111,10 +111,10 @@ acpi_exception(const char *module_name,
111 /* For AE_OK, just print the message */ 111 /* For AE_OK, just print the message */
112 112
113 if (ACPI_SUCCESS(status)) { 113 if (ACPI_SUCCESS(status)) {
114 acpi_os_printf(ACPI_MSG_EXCEPTION); 114 acpi_os_printf(ACPI_MSG_ERROR);
115 115
116 } else { 116 } else {
117 acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", 117 acpi_os_printf(ACPI_MSG_ERROR "%s, ",
118 acpi_format_exception(status)); 118 acpi_format_exception(status));
119 } 119 }
120 120
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 6402f7fad3bb..16c4a10b7506 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -414,6 +414,51 @@ static void ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, int
414#endif 414#endif
415} 415}
416 416
417/*
418 * PCIe AER errors need to be sent to the AER driver for reporting and
419 * recovery. The GHES severities map to the following AER severities and
420 * require the following handling:
421 *
422 * GHES_SEV_CORRECTABLE -> AER_CORRECTABLE
423 * These need to be reported by the AER driver but no recovery is
424 * necessary.
425 * GHES_SEV_RECOVERABLE -> AER_NONFATAL
426 * GHES_SEV_RECOVERABLE && CPER_SEC_RESET -> AER_FATAL
427 * These both need to be reported and recovered from by the AER driver.
428 * GHES_SEV_PANIC does not make it to this handling since the kernel must
429 * panic.
430 */
431static void ghes_handle_aer(struct acpi_hest_generic_data *gdata)
432{
433#ifdef CONFIG_ACPI_APEI_PCIEAER
434 struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata);
435
436 if (pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID &&
437 pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) {
438 unsigned int devfn;
439 int aer_severity;
440
441 devfn = PCI_DEVFN(pcie_err->device_id.device,
442 pcie_err->device_id.function);
443 aer_severity = cper_severity_to_aer(gdata->error_severity);
444
445 /*
446 * If firmware reset the component to contain
447 * the error, we must reinitialize it before
448 * use, so treat it as a fatal AER error.
449 */
450 if (gdata->flags & CPER_SEC_RESET)
451 aer_severity = AER_FATAL;
452
453 aer_recover_queue(pcie_err->device_id.segment,
454 pcie_err->device_id.bus,
455 devfn, aer_severity,
456 (struct aer_capability_regs *)
457 pcie_err->aer_info);
458 }
459#endif
460}
461
417static void ghes_do_proc(struct ghes *ghes, 462static void ghes_do_proc(struct ghes *ghes,
418 const struct acpi_hest_generic_status *estatus) 463 const struct acpi_hest_generic_status *estatus)
419{ 464{
@@ -441,38 +486,9 @@ static void ghes_do_proc(struct ghes *ghes,
441 arch_apei_report_mem_error(sev, mem_err); 486 arch_apei_report_mem_error(sev, mem_err);
442 ghes_handle_memory_failure(gdata, sev); 487 ghes_handle_memory_failure(gdata, sev);
443 } 488 }
444#ifdef CONFIG_ACPI_APEI_PCIEAER
445 else if (guid_equal(sec_type, &CPER_SEC_PCIE)) { 489 else if (guid_equal(sec_type, &CPER_SEC_PCIE)) {
446 struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata); 490 ghes_handle_aer(gdata);
447
448 if (sev == GHES_SEV_RECOVERABLE &&
449 sec_sev == GHES_SEV_RECOVERABLE &&
450 pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID &&
451 pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) {
452 unsigned int devfn;
453 int aer_severity;
454
455 devfn = PCI_DEVFN(pcie_err->device_id.device,
456 pcie_err->device_id.function);
457 aer_severity = cper_severity_to_aer(gdata->error_severity);
458
459 /*
460 * If firmware reset the component to contain
461 * the error, we must reinitialize it before
462 * use, so treat it as a fatal AER error.
463 */
464 if (gdata->flags & CPER_SEC_RESET)
465 aer_severity = AER_FATAL;
466
467 aer_recover_queue(pcie_err->device_id.segment,
468 pcie_err->device_id.bus,
469 devfn, aer_severity,
470 (struct aer_capability_regs *)
471 pcie_err->aer_info);
472 }
473
474 } 491 }
475#endif
476 else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { 492 else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) {
477 struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata); 493 struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata);
478 494
@@ -870,7 +886,6 @@ static void ghes_print_queued_estatus(void)
870 struct ghes_estatus_node *estatus_node; 886 struct ghes_estatus_node *estatus_node;
871 struct acpi_hest_generic *generic; 887 struct acpi_hest_generic *generic;
872 struct acpi_hest_generic_status *estatus; 888 struct acpi_hest_generic_status *estatus;
873 u32 len, node_len;
874 889
875 llnode = llist_del_all(&ghes_estatus_llist); 890 llnode = llist_del_all(&ghes_estatus_llist);
876 /* 891 /*
@@ -882,8 +897,6 @@ static void ghes_print_queued_estatus(void)
882 estatus_node = llist_entry(llnode, struct ghes_estatus_node, 897 estatus_node = llist_entry(llnode, struct ghes_estatus_node,
883 llnode); 898 llnode);
884 estatus = GHES_ESTATUS_FROM_NODE(estatus_node); 899 estatus = GHES_ESTATUS_FROM_NODE(estatus_node);
885 len = cper_estatus_len(estatus);
886 node_len = GHES_ESTATUS_NODE_LEN(len);
887 generic = estatus_node->generic; 900 generic = estatus_node->generic;
888 ghes_print_estatus(NULL, generic, estatus); 901 ghes_print_estatus(NULL, generic, estatus);
889 llnode = llnode->next; 902 llnode = llnode->next;
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 13e7b56e33ae..19bc440820e6 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -70,6 +70,7 @@ static async_cookie_t async_cookie;
70static bool battery_driver_registered; 70static bool battery_driver_registered;
71static int battery_bix_broken_package; 71static int battery_bix_broken_package;
72static int battery_notification_delay_ms; 72static int battery_notification_delay_ms;
73static int battery_full_discharging;
73static unsigned int cache_time = 1000; 74static unsigned int cache_time = 1000;
74module_param(cache_time, uint, 0644); 75module_param(cache_time, uint, 0644);
75MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); 76MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@ -214,9 +215,12 @@ static int acpi_battery_get_property(struct power_supply *psy,
214 return -ENODEV; 215 return -ENODEV;
215 switch (psp) { 216 switch (psp) {
216 case POWER_SUPPLY_PROP_STATUS: 217 case POWER_SUPPLY_PROP_STATUS:
217 if (battery->state & ACPI_BATTERY_STATE_DISCHARGING) 218 if (battery->state & ACPI_BATTERY_STATE_DISCHARGING) {
218 val->intval = POWER_SUPPLY_STATUS_DISCHARGING; 219 if (battery_full_discharging && battery->rate_now == 0)
219 else if (battery->state & ACPI_BATTERY_STATE_CHARGING) 220 val->intval = POWER_SUPPLY_STATUS_FULL;
221 else
222 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
223 } else if (battery->state & ACPI_BATTERY_STATE_CHARGING)
220 val->intval = POWER_SUPPLY_STATUS_CHARGING; 224 val->intval = POWER_SUPPLY_STATUS_CHARGING;
221 else if (acpi_battery_is_charged(battery)) 225 else if (acpi_battery_is_charged(battery))
222 val->intval = POWER_SUPPLY_STATUS_FULL; 226 val->intval = POWER_SUPPLY_STATUS_FULL;
@@ -1166,6 +1170,12 @@ battery_notification_delay_quirk(const struct dmi_system_id *d)
1166 return 0; 1170 return 0;
1167} 1171}
1168 1172
1173static int __init battery_full_discharging_quirk(const struct dmi_system_id *d)
1174{
1175 battery_full_discharging = 1;
1176 return 0;
1177}
1178
1169static const struct dmi_system_id bat_dmi_table[] __initconst = { 1179static const struct dmi_system_id bat_dmi_table[] __initconst = {
1170 { 1180 {
1171 .callback = battery_bix_broken_package_quirk, 1181 .callback = battery_bix_broken_package_quirk,
@@ -1183,6 +1193,22 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
1183 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"), 1193 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"),
1184 }, 1194 },
1185 }, 1195 },
1196 {
1197 .callback = battery_full_discharging_quirk,
1198 .ident = "ASUS GL502VSK",
1199 .matches = {
1200 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1201 DMI_MATCH(DMI_PRODUCT_NAME, "GL502VSK"),
1202 },
1203 },
1204 {
1205 .callback = battery_full_discharging_quirk,
1206 .ident = "ASUS UX305LA",
1207 .matches = {
1208 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1209 DMI_MATCH(DMI_PRODUCT_NAME, "UX305LA"),
1210 },
1211 },
1186 {}, 1212 {},
1187}; 1213};
1188 1214
@@ -1237,13 +1263,11 @@ static int acpi_battery_add(struct acpi_device *device)
1237 1263
1238#ifdef CONFIG_ACPI_PROCFS_POWER 1264#ifdef CONFIG_ACPI_PROCFS_POWER
1239 result = acpi_battery_add_fs(device); 1265 result = acpi_battery_add_fs(device);
1240#endif
1241 if (result) { 1266 if (result) {
1242#ifdef CONFIG_ACPI_PROCFS_POWER
1243 acpi_battery_remove_fs(device); 1267 acpi_battery_remove_fs(device);
1244#endif
1245 goto fail; 1268 goto fail;
1246 } 1269 }
1270#endif
1247 1271
1248 printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n", 1272 printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
1249 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), 1273 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index bf8e4d371fa7..e1eee7a60fad 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -30,6 +30,7 @@
30#include <linux/input.h> 30#include <linux/input.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/acpi.h> 32#include <linux/acpi.h>
33#include <linux/dmi.h>
33#include <acpi/button.h> 34#include <acpi/button.h>
34 35
35#define PREFIX "ACPI: " 36#define PREFIX "ACPI: "
@@ -76,6 +77,22 @@ static const struct acpi_device_id button_device_ids[] = {
76}; 77};
77MODULE_DEVICE_TABLE(acpi, button_device_ids); 78MODULE_DEVICE_TABLE(acpi, button_device_ids);
78 79
80/*
81 * Some devices which don't even have a lid in anyway have a broken _LID
82 * method (e.g. pointing to a floating gpio pin) causing spurious LID events.
83 */
84static const struct dmi_system_id lid_blacklst[] = {
85 {
86 /* GP-electronic T701 */
87 .matches = {
88 DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
89 DMI_MATCH(DMI_PRODUCT_NAME, "T701"),
90 DMI_MATCH(DMI_BIOS_VERSION, "BYT70A.YNCHENG.WIN.007"),
91 },
92 },
93 {}
94};
95
79static int acpi_button_add(struct acpi_device *device); 96static int acpi_button_add(struct acpi_device *device);
80static int acpi_button_remove(struct acpi_device *device); 97static int acpi_button_remove(struct acpi_device *device);
81static void acpi_button_notify(struct acpi_device *device, u32 event); 98static void acpi_button_notify(struct acpi_device *device, u32 event);
@@ -210,6 +227,8 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state)
210 } 227 }
211 /* Send the platform triggered reliable event */ 228 /* Send the platform triggered reliable event */
212 if (do_update) { 229 if (do_update) {
230 acpi_handle_debug(device->handle, "ACPI LID %s\n",
231 state ? "open" : "closed");
213 input_report_switch(button->input, SW_LID, !state); 232 input_report_switch(button->input, SW_LID, !state);
214 input_sync(button->input); 233 input_sync(button->input);
215 button->last_state = !!state; 234 button->last_state = !!state;
@@ -473,6 +492,9 @@ static int acpi_button_add(struct acpi_device *device)
473 char *name, *class; 492 char *name, *class;
474 int error; 493 int error;
475 494
495 if (!strcmp(hid, ACPI_BUTTON_HID_LID) && dmi_check_system(lid_blacklst))
496 return -ENODEV;
497
476 button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); 498 button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
477 if (!button) 499 if (!button)
478 return -ENOMEM; 500 return -ENOMEM;
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 0252c9b9af3d..d9f38c645e4a 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1516,7 +1516,7 @@ static int acpi_ec_setup(struct acpi_ec *ec, bool handle_events)
1516 } 1516 }
1517 1517
1518 acpi_handle_info(ec->handle, 1518 acpi_handle_info(ec->handle,
1519 "GPE=0x%lx, EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n", 1519 "GPE=0x%x, EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n",
1520 ec->gpe, ec->command_addr, ec->data_addr); 1520 ec->gpe, ec->command_addr, ec->data_addr);
1521 return ret; 1521 return ret;
1522} 1522}
diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
index 6c7dd7af789e..dd70d6c2bca0 100644
--- a/drivers/acpi/ec_sys.c
+++ b/drivers/acpi/ec_sys.c
@@ -128,7 +128,7 @@ static int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count)
128 return -ENOMEM; 128 return -ENOMEM;
129 } 129 }
130 130
131 if (!debugfs_create_x32("gpe", 0444, dev_dir, (u32 *)&first_ec->gpe)) 131 if (!debugfs_create_x32("gpe", 0444, dev_dir, &first_ec->gpe))
132 goto error; 132 goto error;
133 if (!debugfs_create_bool("use_global_lock", 0444, dev_dir, 133 if (!debugfs_create_bool("use_global_lock", 0444, dev_dir,
134 &first_ec->global_lock)) 134 &first_ec->global_lock))
diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c
index 46f060356a22..f13ba2c07667 100644
--- a/drivers/acpi/evged.c
+++ b/drivers/acpi/evged.c
@@ -49,6 +49,11 @@
49 49
50#define MODULE_NAME "acpi-ged" 50#define MODULE_NAME "acpi-ged"
51 51
52struct acpi_ged_device {
53 struct device *dev;
54 struct list_head event_list;
55};
56
52struct acpi_ged_event { 57struct acpi_ged_event {
53 struct list_head node; 58 struct list_head node;
54 struct device *dev; 59 struct device *dev;
@@ -76,7 +81,8 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
76 unsigned int irq; 81 unsigned int irq;
77 unsigned int gsi; 82 unsigned int gsi;
78 unsigned int irqflags = IRQF_ONESHOT; 83 unsigned int irqflags = IRQF_ONESHOT;
79 struct device *dev = context; 84 struct acpi_ged_device *geddev = context;
85 struct device *dev = geddev->dev;
80 acpi_handle handle = ACPI_HANDLE(dev); 86 acpi_handle handle = ACPI_HANDLE(dev);
81 acpi_handle evt_handle; 87 acpi_handle evt_handle;
82 struct resource r; 88 struct resource r;
@@ -102,8 +108,6 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
102 return AE_ERROR; 108 return AE_ERROR;
103 } 109 }
104 110
105 dev_info(dev, "GED listening GSI %u @ IRQ %u\n", gsi, irq);
106
107 event = devm_kzalloc(dev, sizeof(*event), GFP_KERNEL); 111 event = devm_kzalloc(dev, sizeof(*event), GFP_KERNEL);
108 if (!event) 112 if (!event)
109 return AE_ERROR; 113 return AE_ERROR;
@@ -116,29 +120,58 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
116 if (r.flags & IORESOURCE_IRQ_SHAREABLE) 120 if (r.flags & IORESOURCE_IRQ_SHAREABLE)
117 irqflags |= IRQF_SHARED; 121 irqflags |= IRQF_SHARED;
118 122
119 if (devm_request_threaded_irq(dev, irq, NULL, acpi_ged_irq_handler, 123 if (request_threaded_irq(irq, NULL, acpi_ged_irq_handler,
120 irqflags, "ACPI:Ged", event)) { 124 irqflags, "ACPI:Ged", event)) {
121 dev_err(dev, "failed to setup event handler for irq %u\n", irq); 125 dev_err(dev, "failed to setup event handler for irq %u\n", irq);
122 return AE_ERROR; 126 return AE_ERROR;
123 } 127 }
124 128
129 dev_dbg(dev, "GED listening GSI %u @ IRQ %u\n", gsi, irq);
130 list_add_tail(&event->node, &geddev->event_list);
125 return AE_OK; 131 return AE_OK;
126} 132}
127 133
128static int ged_probe(struct platform_device *pdev) 134static int ged_probe(struct platform_device *pdev)
129{ 135{
136 struct acpi_ged_device *geddev;
130 acpi_status acpi_ret; 137 acpi_status acpi_ret;
131 138
139 geddev = devm_kzalloc(&pdev->dev, sizeof(*geddev), GFP_KERNEL);
140 if (!geddev)
141 return -ENOMEM;
142
143 geddev->dev = &pdev->dev;
144 INIT_LIST_HEAD(&geddev->event_list);
132 acpi_ret = acpi_walk_resources(ACPI_HANDLE(&pdev->dev), "_CRS", 145 acpi_ret = acpi_walk_resources(ACPI_HANDLE(&pdev->dev), "_CRS",
133 acpi_ged_request_interrupt, &pdev->dev); 146 acpi_ged_request_interrupt, geddev);
134 if (ACPI_FAILURE(acpi_ret)) { 147 if (ACPI_FAILURE(acpi_ret)) {
135 dev_err(&pdev->dev, "unable to parse the _CRS record\n"); 148 dev_err(&pdev->dev, "unable to parse the _CRS record\n");
136 return -EINVAL; 149 return -EINVAL;
137 } 150 }
151 platform_set_drvdata(pdev, geddev);
138 152
139 return 0; 153 return 0;
140} 154}
141 155
156static void ged_shutdown(struct platform_device *pdev)
157{
158 struct acpi_ged_device *geddev = platform_get_drvdata(pdev);
159 struct acpi_ged_event *event, *next;
160
161 list_for_each_entry_safe(event, next, &geddev->event_list, node) {
162 free_irq(event->irq, event);
163 list_del(&event->node);
164 dev_dbg(geddev->dev, "GED releasing GSI %u @ IRQ %u\n",
165 event->gsi, event->irq);
166 }
167}
168
169static int ged_remove(struct platform_device *pdev)
170{
171 ged_shutdown(pdev);
172 return 0;
173}
174
142static const struct acpi_device_id ged_acpi_ids[] = { 175static const struct acpi_device_id ged_acpi_ids[] = {
143 {"ACPI0013"}, 176 {"ACPI0013"},
144 {}, 177 {},
@@ -146,6 +179,8 @@ static const struct acpi_device_id ged_acpi_ids[] = {
146 179
147static struct platform_driver ged_driver = { 180static struct platform_driver ged_driver = {
148 .probe = ged_probe, 181 .probe = ged_probe,
182 .remove = ged_remove,
183 .shutdown = ged_shutdown,
149 .driver = { 184 .driver = {
150 .name = MODULE_NAME, 185 .name = MODULE_NAME,
151 .acpi_match_table = ACPI_PTR(ged_acpi_ids), 186 .acpi_match_table = ACPI_PTR(ged_acpi_ids),
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 7f43423de43c..1d0a501bc7f0 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -159,7 +159,7 @@ static inline void acpi_early_processor_osc(void) {}
159 -------------------------------------------------------------------------- */ 159 -------------------------------------------------------------------------- */
160struct acpi_ec { 160struct acpi_ec {
161 acpi_handle handle; 161 acpi_handle handle;
162 unsigned long gpe; 162 u32 gpe;
163 unsigned long command_addr; 163 unsigned long command_addr;
164 unsigned long data_addr; 164 unsigned long data_addr;
165 bool global_lock; 165 bool global_lock;
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 917f1cc0fda4..8ccaae3550d2 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -460,8 +460,7 @@ int __init acpi_numa_init(void)
460 srat_proc, ARRAY_SIZE(srat_proc), 0); 460 srat_proc, ARRAY_SIZE(srat_proc), 0);
461 461
462 cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, 462 cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
463 acpi_parse_memory_affinity, 463 acpi_parse_memory_affinity, 0);
464 NR_NODE_MEMBLKS);
465 } 464 }
466 465
467 /* SLIT: System Locality Information Table */ 466 /* SLIT: System Locality Information Table */
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index bc3d914dfc3e..85ad679390e3 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -612,7 +612,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
612 acpi_isa_irq_penalty[link->irq.active] += 612 acpi_isa_irq_penalty[link->irq.active] +=
613 PIRQ_PENALTY_PCI_USING; 613 PIRQ_PENALTY_PCI_USING;
614 614
615 printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n", 615 pr_info("%s [%s] enabled at IRQ %d\n",
616 acpi_device_name(link->device), 616 acpi_device_name(link->device),
617 acpi_device_bid(link->device), link->irq.active); 617 acpi_device_bid(link->device), link->irq.active);
618 } 618 }
diff --git a/drivers/acpi/pmic/intel_pmic_bxtwc.c b/drivers/acpi/pmic/intel_pmic_bxtwc.c
index 90011aad4d20..886ac8b93cd0 100644
--- a/drivers/acpi/pmic/intel_pmic_bxtwc.c
+++ b/drivers/acpi/pmic/intel_pmic_bxtwc.c
@@ -400,7 +400,7 @@ static int intel_bxtwc_pmic_opregion_probe(struct platform_device *pdev)
400 &intel_bxtwc_pmic_opregion_data); 400 &intel_bxtwc_pmic_opregion_data);
401} 401}
402 402
403static struct platform_device_id bxt_wc_opregion_id_table[] = { 403static const struct platform_device_id bxt_wc_opregion_id_table[] = {
404 { .name = "bxt_wcove_region" }, 404 { .name = "bxt_wcove_region" },
405 {}, 405 {},
406}; 406};
@@ -412,9 +412,4 @@ static struct platform_driver intel_bxtwc_pmic_opregion_driver = {
412 }, 412 },
413 .id_table = bxt_wc_opregion_id_table, 413 .id_table = bxt_wc_opregion_id_table,
414}; 414};
415 415builtin_platform_driver(intel_bxtwc_pmic_opregion_driver);
416static int __init intel_bxtwc_pmic_opregion_driver_init(void)
417{
418 return platform_driver_register(&intel_bxtwc_pmic_opregion_driver);
419}
420device_initcall(intel_bxtwc_pmic_opregion_driver_init);
diff --git a/drivers/acpi/pmic/intel_pmic_chtdc_ti.c b/drivers/acpi/pmic/intel_pmic_chtdc_ti.c
index 109c1e9c9c7a..f6d73a243d80 100644
--- a/drivers/acpi/pmic/intel_pmic_chtdc_ti.c
+++ b/drivers/acpi/pmic/intel_pmic_chtdc_ti.c
@@ -131,7 +131,4 @@ static struct platform_driver chtdc_ti_pmic_opregion_driver = {
131 }, 131 },
132 .id_table = chtdc_ti_pmic_opregion_id_table, 132 .id_table = chtdc_ti_pmic_opregion_id_table,
133}; 133};
134module_platform_driver(chtdc_ti_pmic_opregion_driver); 134builtin_platform_driver(chtdc_ti_pmic_opregion_driver);
135
136MODULE_DESCRIPTION("Dollar Cove TI PMIC opregion driver");
137MODULE_LICENSE("GPL v2");
diff --git a/drivers/acpi/pmic/intel_pmic_chtwc.c b/drivers/acpi/pmic/intel_pmic_chtwc.c
index 85636d7a9d39..9912422c8185 100644
--- a/drivers/acpi/pmic/intel_pmic_chtwc.c
+++ b/drivers/acpi/pmic/intel_pmic_chtwc.c
@@ -260,11 +260,10 @@ static int intel_cht_wc_pmic_opregion_probe(struct platform_device *pdev)
260 &intel_cht_wc_pmic_opregion_data); 260 &intel_cht_wc_pmic_opregion_data);
261} 261}
262 262
263static struct platform_device_id cht_wc_opregion_id_table[] = { 263static const struct platform_device_id cht_wc_opregion_id_table[] = {
264 { .name = "cht_wcove_region" }, 264 { .name = "cht_wcove_region" },
265 {}, 265 {},
266}; 266};
267MODULE_DEVICE_TABLE(platform, cht_wc_opregion_id_table);
268 267
269static struct platform_driver intel_cht_wc_pmic_opregion_driver = { 268static struct platform_driver intel_cht_wc_pmic_opregion_driver = {
270 .probe = intel_cht_wc_pmic_opregion_probe, 269 .probe = intel_cht_wc_pmic_opregion_probe,
@@ -273,8 +272,4 @@ static struct platform_driver intel_cht_wc_pmic_opregion_driver = {
273 }, 272 },
274 .id_table = cht_wc_opregion_id_table, 273 .id_table = cht_wc_opregion_id_table,
275}; 274};
276module_platform_driver(intel_cht_wc_pmic_opregion_driver); 275builtin_platform_driver(intel_cht_wc_pmic_opregion_driver);
277
278MODULE_DESCRIPTION("Intel CHT Whiskey Cove PMIC operation region driver");
279MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
280MODULE_LICENSE("GPL");
diff --git a/drivers/acpi/pmic/intel_pmic_crc.c b/drivers/acpi/pmic/intel_pmic_crc.c
index d7f1761ab1bc..7ffa74048107 100644
--- a/drivers/acpi/pmic/intel_pmic_crc.c
+++ b/drivers/acpi/pmic/intel_pmic_crc.c
@@ -201,9 +201,4 @@ static struct platform_driver intel_crc_pmic_opregion_driver = {
201 .name = "crystal_cove_pmic", 201 .name = "crystal_cove_pmic",
202 }, 202 },
203}; 203};
204 204builtin_platform_driver(intel_crc_pmic_opregion_driver);
205static int __init intel_crc_pmic_opregion_driver_init(void)
206{
207 return platform_driver_register(&intel_crc_pmic_opregion_driver);
208}
209device_initcall(intel_crc_pmic_opregion_driver_init);
diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c b/drivers/acpi/pmic/intel_pmic_xpower.c
index 6c99d3f81095..316e55174aa9 100644
--- a/drivers/acpi/pmic/intel_pmic_xpower.c
+++ b/drivers/acpi/pmic/intel_pmic_xpower.c
@@ -278,9 +278,4 @@ static struct platform_driver intel_xpower_pmic_opregion_driver = {
278 .name = "axp288_pmic_acpi", 278 .name = "axp288_pmic_acpi",
279 }, 279 },
280}; 280};
281 281builtin_platform_driver(intel_xpower_pmic_opregion_driver);
282static int __init intel_xpower_pmic_opregion_driver_init(void)
283{
284 return platform_driver_register(&intel_xpower_pmic_opregion_driver);
285}
286device_initcall(intel_xpower_pmic_opregion_driver_init);
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 06a150bb35bf..4fc59c3bc673 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -816,14 +816,8 @@ end:
816 * interface: 816 * interface:
817 * echo unmask > /sys/firmware/acpi/interrupts/gpe00 817 * echo unmask > /sys/firmware/acpi/interrupts/gpe00
818 */ 818 */
819 819#define ACPI_MASKABLE_GPE_MAX 0xFF
820/* 820static DECLARE_BITMAP(acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) __initdata;
821 * Currently, the GPE flooding prevention only supports to mask the GPEs
822 * numbered from 00 to 7f.
823 */
824#define ACPI_MASKABLE_GPE_MAX 0x80
825
826static u64 __initdata acpi_masked_gpes;
827 821
828static int __init acpi_gpe_set_masked_gpes(char *val) 822static int __init acpi_gpe_set_masked_gpes(char *val)
829{ 823{
@@ -831,7 +825,7 @@ static int __init acpi_gpe_set_masked_gpes(char *val)
831 825
832 if (kstrtou8(val, 0, &gpe) || gpe > ACPI_MASKABLE_GPE_MAX) 826 if (kstrtou8(val, 0, &gpe) || gpe > ACPI_MASKABLE_GPE_MAX)
833 return -EINVAL; 827 return -EINVAL;
834 acpi_masked_gpes |= ((u64)1<<gpe); 828 set_bit(gpe, acpi_masked_gpes_map);
835 829
836 return 1; 830 return 1;
837} 831}
@@ -843,15 +837,11 @@ void __init acpi_gpe_apply_masked_gpes(void)
843 acpi_status status; 837 acpi_status status;
844 u8 gpe; 838 u8 gpe;
845 839
846 for (gpe = 0; 840 for_each_set_bit(gpe, acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) {
847 gpe < min_t(u8, ACPI_MASKABLE_GPE_MAX, acpi_current_gpe_count); 841 status = acpi_get_gpe_device(gpe, &handle);
848 gpe++) { 842 if (ACPI_SUCCESS(status)) {
849 if (acpi_masked_gpes & ((u64)1<<gpe)) { 843 pr_info("Masking GPE 0x%x.\n", gpe);
850 status = acpi_get_gpe_device(gpe, &handle); 844 (void)acpi_mask_gpe(handle, gpe, TRUE);
851 if (ACPI_SUCCESS(status)) {
852 pr_info("Masking GPE 0x%x.\n", gpe);
853 (void)acpi_mask_gpe(handle, gpe, TRUE);
854 }
855 } 845 }
856 } 846 }
857} 847}
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 6db3b4668b1a..ffe364fa4040 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -145,9 +145,9 @@
145 145
146#define ACPI_ADDRESS_RANGE_MAX 2 146#define ACPI_ADDRESS_RANGE_MAX 2
147 147
148/* Maximum number of While() loops before abort */ 148/* Maximum time (default 30s) of While() loops before abort */
149 149
150#define ACPI_MAX_LOOP_COUNT 0x000FFFFF 150#define ACPI_MAX_LOOP_TIMEOUT 30
151 151
152/****************************************************************************** 152/******************************************************************************
153 * 153 *
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 17d61b1f2511..3c46f0ef5f7a 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -130,8 +130,9 @@ struct acpi_exception_info {
130#define AE_HEX_OVERFLOW EXCEP_ENV (0x0020) 130#define AE_HEX_OVERFLOW EXCEP_ENV (0x0020)
131#define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021) 131#define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021)
132#define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022) 132#define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022)
133#define AE_END_OF_TABLE EXCEP_ENV (0x0023)
133 134
134#define AE_CODE_ENV_MAX 0x0022 135#define AE_CODE_ENV_MAX 0x0023
135 136
136/* 137/*
137 * Programmer exceptions 138 * Programmer exceptions
@@ -195,7 +196,7 @@ struct acpi_exception_info {
195#define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E) 196#define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E)
196#define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F) 197#define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F)
197#define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020) 198#define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020)
198#define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021) 199#define AE_AML_LOOP_TIMEOUT EXCEP_AML (0x0021)
199#define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022) 200#define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022)
200#define AE_AML_TARGET_TYPE EXCEP_AML (0x0023) 201#define AE_AML_TARGET_TYPE EXCEP_AML (0x0023)
201 202
@@ -275,7 +276,8 @@ static const struct acpi_exception_info acpi_gbl_exception_names_env[] = {
275 EXCEP_TXT("AE_DECIMAL_OVERFLOW", 276 EXCEP_TXT("AE_DECIMAL_OVERFLOW",
276 "Overflow during ASCII decimal-to-binary conversion"), 277 "Overflow during ASCII decimal-to-binary conversion"),
277 EXCEP_TXT("AE_OCTAL_OVERFLOW", 278 EXCEP_TXT("AE_OCTAL_OVERFLOW",
278 "Overflow during ASCII octal-to-binary conversion") 279 "Overflow during ASCII octal-to-binary conversion"),
280 EXCEP_TXT("AE_END_OF_TABLE", "Reached the end of table")
279}; 281};
280 282
281static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = { 283static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = {
@@ -368,8 +370,8 @@ static const struct acpi_exception_info acpi_gbl_exception_names_aml[] = {
368 "The length of a Resource Descriptor in the AML is incorrect"), 370 "The length of a Resource Descriptor in the AML is incorrect"),
369 EXCEP_TXT("AE_AML_ILLEGAL_ADDRESS", 371 EXCEP_TXT("AE_AML_ILLEGAL_ADDRESS",
370 "A memory, I/O, or PCI configuration address is invalid"), 372 "A memory, I/O, or PCI configuration address is invalid"),
371 EXCEP_TXT("AE_AML_INFINITE_LOOP", 373 EXCEP_TXT("AE_AML_LOOP_TIMEOUT",
372 "An apparent infinite AML While loop, method was aborted"), 374 "An AML While loop exceeded the maximum execution time"),
373 EXCEP_TXT("AE_AML_UNINITIALIZED_NODE", 375 EXCEP_TXT("AE_AML_UNINITIALIZED_NODE",
374 "A namespace node is uninitialized or unresolved"), 376 "A namespace node is uninitialized or unresolved"),
375 EXCEP_TXT("AE_AML_TARGET_TYPE", 377 EXCEP_TXT("AE_AML_TARGET_TYPE",
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index e1dd1a8d42b6..c589c3e12d90 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,7 +46,7 @@
46 46
47/* Current ACPICA subsystem version in YYYYMMDD format */ 47/* Current ACPICA subsystem version in YYYYMMDD format */
48 48
49#define ACPI_CA_VERSION 0x20170831 49#define ACPI_CA_VERSION 0x20171215
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -260,11 +260,11 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0);
260ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE); 260ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE);
261 261
262/* 262/*
263 * Maximum number of While() loop iterations before forced method abort. 263 * Maximum timeout for While() loop iterations before forced method abort.
264 * This mechanism is intended to prevent infinite loops during interpreter 264 * This mechanism is intended to prevent infinite loops during interpreter
265 * execution within a host kernel. 265 * execution within a host kernel.
266 */ 266 */
267ACPI_INIT_GLOBAL(u32, acpi_gbl_max_loop_iterations, ACPI_MAX_LOOP_COUNT); 267ACPI_INIT_GLOBAL(u32, acpi_gbl_max_loop_iterations, ACPI_MAX_LOOP_TIMEOUT);
268 268
269/* 269/*
270 * This mechanism is used to trace a specified AML method. The method is 270 * This mechanism is used to trace a specified AML method. The method is
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 7a89e6de94da..4c304bf4d591 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -69,9 +69,10 @@
69#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ 69#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */
70#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ 70#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
71#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */ 71#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */
72#define ACPI_SIG_PDTT "PDTT" /* Processor Debug Trigger Table */ 72#define ACPI_SIG_PDTT "PDTT" /* Platform Debug Trigger Table */
73#define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */ 73#define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */
74#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ 74#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */
75#define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */
75#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ 76#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */
76#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ 77#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */
77#define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */ 78#define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */
@@ -1149,7 +1150,8 @@ enum acpi_nfit_type {
1149 ACPI_NFIT_TYPE_CONTROL_REGION = 4, 1150 ACPI_NFIT_TYPE_CONTROL_REGION = 4,
1150 ACPI_NFIT_TYPE_DATA_REGION = 5, 1151 ACPI_NFIT_TYPE_DATA_REGION = 5,
1151 ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6, 1152 ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6,
1152 ACPI_NFIT_TYPE_RESERVED = 7 /* 7 and greater are reserved */ 1153 ACPI_NFIT_TYPE_CAPABILITIES = 7,
1154 ACPI_NFIT_TYPE_RESERVED = 8 /* 8 and greater are reserved */
1153}; 1155};
1154 1156
1155/* 1157/*
@@ -1162,7 +1164,7 @@ struct acpi_nfit_system_address {
1162 struct acpi_nfit_header header; 1164 struct acpi_nfit_header header;
1163 u16 range_index; 1165 u16 range_index;
1164 u16 flags; 1166 u16 flags;
1165 u32 reserved; /* Reseved, must be zero */ 1167 u32 reserved; /* Reserved, must be zero */
1166 u32 proximity_domain; 1168 u32 proximity_domain;
1167 u8 range_guid[16]; 1169 u8 range_guid[16];
1168 u64 address; 1170 u64 address;
@@ -1281,9 +1283,72 @@ struct acpi_nfit_flush_address {
1281 u64 hint_address[1]; /* Variable length */ 1283 u64 hint_address[1]; /* Variable length */
1282}; 1284};
1283 1285
1286/* 7: Platform Capabilities Structure */
1287
1288struct acpi_nfit_capabilities {
1289 struct acpi_nfit_header header;
1290 u8 highest_capability;
1291 u8 reserved[3]; /* Reserved, must be zero */
1292 u32 capabilities;
1293 u32 reserved2;
1294};
1295
1296/* Capabilities Flags */
1297
1298#define ACPI_NFIT_CAPABILITY_CACHE_FLUSH (1) /* 00: Cache Flush to NVDIMM capable */
1299#define ACPI_NFIT_CAPABILITY_MEM_FLUSH (1<<1) /* 01: Memory Flush to NVDIMM capable */
1300#define ACPI_NFIT_CAPABILITY_MEM_MIRRORING (1<<2) /* 02: Memory Mirroring capable */
1301
1302/*
1303 * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
1304 */
1305struct nfit_device_handle {
1306 u32 handle;
1307};
1308
1309/* Device handle construction and extraction macros */
1310
1311#define ACPI_NFIT_DIMM_NUMBER_MASK 0x0000000F
1312#define ACPI_NFIT_CHANNEL_NUMBER_MASK 0x000000F0
1313#define ACPI_NFIT_MEMORY_ID_MASK 0x00000F00
1314#define ACPI_NFIT_SOCKET_ID_MASK 0x0000F000
1315#define ACPI_NFIT_NODE_ID_MASK 0x0FFF0000
1316
1317#define ACPI_NFIT_DIMM_NUMBER_OFFSET 0
1318#define ACPI_NFIT_CHANNEL_NUMBER_OFFSET 4
1319#define ACPI_NFIT_MEMORY_ID_OFFSET 8
1320#define ACPI_NFIT_SOCKET_ID_OFFSET 12
1321#define ACPI_NFIT_NODE_ID_OFFSET 16
1322
1323/* Macro to construct a NFIT/NVDIMM device handle */
1324
1325#define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
1326 ((dimm) | \
1327 ((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET) | \
1328 ((memory) << ACPI_NFIT_MEMORY_ID_OFFSET) | \
1329 ((socket) << ACPI_NFIT_SOCKET_ID_OFFSET) | \
1330 ((node) << ACPI_NFIT_NODE_ID_OFFSET))
1331
1332/* Macros to extract individual fields from a NFIT/NVDIMM device handle */
1333
1334#define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
1335 ((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
1336
1337#define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
1338 (((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
1339
1340#define ACPI_NFIT_GET_MEMORY_ID(handle) \
1341 (((handle) & ACPI_NFIT_MEMORY_ID_MASK) >> ACPI_NFIT_MEMORY_ID_OFFSET)
1342
1343#define ACPI_NFIT_GET_SOCKET_ID(handle) \
1344 (((handle) & ACPI_NFIT_SOCKET_ID_MASK) >> ACPI_NFIT_SOCKET_ID_OFFSET)
1345
1346#define ACPI_NFIT_GET_NODE_ID(handle) \
1347 (((handle) & ACPI_NFIT_NODE_ID_MASK) >> ACPI_NFIT_NODE_ID_OFFSET)
1348
1284/******************************************************************************* 1349/*******************************************************************************
1285 * 1350 *
1286 * PDTT - Processor Debug Trigger Table (ACPI 6.2) 1351 * PDTT - Platform Debug Trigger Table (ACPI 6.2)
1287 * Version 0 1352 * Version 0
1288 * 1353 *
1289 ******************************************************************************/ 1354 ******************************************************************************/
@@ -1301,14 +1366,14 @@ struct acpi_table_pdtt {
1301 * starting at array_offset. 1366 * starting at array_offset.
1302 */ 1367 */
1303struct acpi_pdtt_channel { 1368struct acpi_pdtt_channel {
1304 u16 sub_channel_id; 1369 u8 subchannel_id;
1370 u8 flags;
1305}; 1371};
1306 1372
1307/* Mask and Flags for above */ 1373/* Flags for above */
1308 1374
1309#define ACPI_PDTT_SUBCHANNEL_ID_MASK 0x00FF 1375#define ACPI_PDTT_RUNTIME_TRIGGER (1)
1310#define ACPI_PDTT_RUNTIME_TRIGGER (1<<8) 1376#define ACPI_PDTT_WAIT_COMPLETION (1<<1)
1311#define ACPI_PPTT_WAIT_COMPLETION (1<<9)
1312 1377
1313/******************************************************************************* 1378/*******************************************************************************
1314 * 1379 *
@@ -1376,6 +1441,20 @@ struct acpi_pptt_cache {
1376#define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */ 1441#define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */
1377#define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */ 1442#define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */
1378 1443
1444/* Attributes describing cache */
1445#define ACPI_PPTT_CACHE_READ_ALLOCATE (0x0) /* Cache line is allocated on read */
1446#define ACPI_PPTT_CACHE_WRITE_ALLOCATE (0x01) /* Cache line is allocated on write */
1447#define ACPI_PPTT_CACHE_RW_ALLOCATE (0x02) /* Cache line is allocated on read and write */
1448#define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT (0x03) /* Alternate representation of above */
1449
1450#define ACPI_PPTT_CACHE_TYPE_DATA (0x0) /* Data cache */
1451#define ACPI_PPTT_CACHE_TYPE_INSTR (1<<2) /* Instruction cache */
1452#define ACPI_PPTT_CACHE_TYPE_UNIFIED (2<<2) /* Unified I & D cache */
1453#define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT (3<<2) /* Alternate representation of above */
1454
1455#define ACPI_PPTT_CACHE_POLICY_WB (0x0) /* Cache is write back */
1456#define ACPI_PPTT_CACHE_POLICY_WT (1<<4) /* Cache is write through */
1457
1379/* 2: ID Structure */ 1458/* 2: ID Structure */
1380 1459
1381struct acpi_pptt_id { 1460struct acpi_pptt_id {
@@ -1405,6 +1484,68 @@ struct acpi_table_sbst {
1405 1484
1406/******************************************************************************* 1485/*******************************************************************************
1407 * 1486 *
1487 * SDEV - Secure Devices Table (ACPI 6.2)
1488 * Version 1
1489 *
1490 ******************************************************************************/
1491
1492struct acpi_table_sdev {
1493 struct acpi_table_header header; /* Common ACPI table header */
1494};
1495
1496struct acpi_sdev_header {
1497 u8 type;
1498 u8 flags;
1499 u16 length;
1500};
1501
1502/* Values for subtable type above */
1503
1504enum acpi_sdev_type {
1505 ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0,
1506 ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
1507 ACPI_SDEV_TYPE_RESERVED = 2 /* 2 and greater are reserved */
1508};
1509
1510/* Values for flags above */
1511
1512#define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS (1)
1513
1514/*
1515 * SDEV subtables
1516 */
1517
1518/* 0: Namespace Device Based Secure Device Structure */
1519
1520struct acpi_sdev_namespace {
1521 struct acpi_sdev_header header;
1522 u16 device_id_offset;
1523 u16 device_id_length;
1524 u16 vendor_data_offset;
1525 u16 vendor_data_length;
1526};
1527
1528/* 1: PCIe Endpoint Device Based Device Structure */
1529
1530struct acpi_sdev_pcie {
1531 struct acpi_sdev_header header;
1532 u16 segment;
1533 u16 start_bus;
1534 u16 path_offset;
1535 u16 path_length;
1536 u16 vendor_data_offset;
1537 u16 vendor_data_length;
1538};
1539
1540/* 1a: PCIe Endpoint path entry */
1541
1542struct acpi_sdev_pcie_path {
1543 u8 device;
1544 u8 function;
1545};
1546
1547/*******************************************************************************
1548 *
1408 * SLIT - System Locality Distance Information Table 1549 * SLIT - System Locality Distance Information Table
1409 * Version 1 1550 * Version 1
1410 * 1551 *
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 686b6f8c09dc..0d60d5df14f8 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -810,6 +810,7 @@ struct acpi_iort_smmu_v3 {
810 u8 pxm; 810 u8 pxm;
811 u8 reserved1; 811 u8 reserved1;
812 u16 reserved2; 812 u16 reserved2;
813 u32 id_mapping_index;
813}; 814};
814 815
815/* Values for Model field above */ 816/* Values for Model field above */
@@ -1246,6 +1247,8 @@ enum acpi_spmi_interface_types {
1246 * TCPA - Trusted Computing Platform Alliance table 1247 * TCPA - Trusted Computing Platform Alliance table
1247 * Version 2 1248 * Version 2
1248 * 1249 *
1250 * TCG Hardware Interface Table for TPM 1.2 Clients and Servers
1251 *
1249 * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", 1252 * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
1250 * Version 1.2, Revision 8 1253 * Version 1.2, Revision 8
1251 * February 27, 2017 1254 * February 27, 2017
@@ -1310,6 +1313,8 @@ struct acpi_table_tcpa_server {
1310 * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table 1313 * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
1311 * Version 4 1314 * Version 4
1312 * 1315 *
1316 * TCG Hardware Interface Table for TPM 2.0 Clients and Servers
1317 *
1313 * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", 1318 * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
1314 * Version 1.2, Revision 8 1319 * Version 1.2, Revision 8
1315 * February 27, 2017 1320 * February 27, 2017
@@ -1329,15 +1334,23 @@ struct acpi_table_tpm2 {
1329/* Values for start_method above */ 1334/* Values for start_method above */
1330 1335
1331#define ACPI_TPM2_NOT_ALLOWED 0 1336#define ACPI_TPM2_NOT_ALLOWED 0
1337#define ACPI_TPM2_RESERVED1 1
1332#define ACPI_TPM2_START_METHOD 2 1338#define ACPI_TPM2_START_METHOD 2
1339#define ACPI_TPM2_RESERVED3 3
1340#define ACPI_TPM2_RESERVED4 4
1341#define ACPI_TPM2_RESERVED5 5
1333#define ACPI_TPM2_MEMORY_MAPPED 6 1342#define ACPI_TPM2_MEMORY_MAPPED 6
1334#define ACPI_TPM2_COMMAND_BUFFER 7 1343#define ACPI_TPM2_COMMAND_BUFFER 7
1335#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8 1344#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8
1345#define ACPI_TPM2_RESERVED9 9
1346#define ACPI_TPM2_RESERVED10 10
1336#define ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC 11 /* V1.2 Rev 8 */ 1347#define ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC 11 /* V1.2 Rev 8 */
1348#define ACPI_TPM2_RESERVED 12
1337 1349
1338/* Trailer appears after any start_method subtables */ 1350/* Optional trailer appears after any start_method subtables */
1339 1351
1340struct acpi_tpm2_trailer { 1352struct acpi_tpm2_trailer {
1353 u8 method_parameters[12];
1341 u32 minimum_log_length; /* Minimum length for the event log area */ 1354 u32 minimum_log_length; /* Minimum length for the event log area */
1342 u64 log_address; /* Address of the event log area */ 1355 u64 log_address; /* Address of the event log area */
1343}; 1356};
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 4f077edb9b81..31f1be74dd16 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -468,6 +468,8 @@ typedef void *acpi_handle; /* Actually a ptr to a NS Node */
468#define ACPI_NSEC_PER_MSEC 1000000L 468#define ACPI_NSEC_PER_MSEC 1000000L
469#define ACPI_NSEC_PER_SEC 1000000000L 469#define ACPI_NSEC_PER_SEC 1000000000L
470 470
471#define ACPI_TIME_AFTER(a, b) ((s64)((b) - (a)) < 0)
472
471/* Owner IDs are used to track namespace nodes for selective deletion */ 473/* Owner IDs are used to track namespace nodes for selective deletion */
472 474
473typedef u8 acpi_owner_id; 475typedef u8 acpi_owner_id;
@@ -1299,6 +1301,8 @@ typedef enum {
1299#define ACPI_OSI_WIN_7 0x0B 1301#define ACPI_OSI_WIN_7 0x0B
1300#define ACPI_OSI_WIN_8 0x0C 1302#define ACPI_OSI_WIN_8 0x0C
1301#define ACPI_OSI_WIN_10 0x0D 1303#define ACPI_OSI_WIN_10 0x0D
1304#define ACPI_OSI_WIN_10_RS1 0x0E
1305#define ACPI_OSI_WIN_10_RS2 0x0F
1302 1306
1303/* Definitions of getopt */ 1307/* Definitions of getopt */
1304 1308
diff --git a/tools/power/acpi/tools/acpidump/apmain.c b/tools/power/acpi/tools/acpidump/apmain.c
index 22c3b4ee1617..be418fba9441 100644
--- a/tools/power/acpi/tools/acpidump/apmain.c
+++ b/tools/power/acpi/tools/acpidump/apmain.c
@@ -79,7 +79,7 @@ struct ap_dump_action action_table[AP_MAX_ACTIONS];
79u32 current_action = 0; 79u32 current_action = 0;
80 80
81#define AP_UTILITY_NAME "ACPI Binary Table Dump Utility" 81#define AP_UTILITY_NAME "ACPI Binary Table Dump Utility"
82#define AP_SUPPORTED_OPTIONS "?a:bc:f:hn:o:r:svxz" 82#define AP_SUPPORTED_OPTIONS "?a:bc:f:hn:o:r:sv^xz"
83 83
84/****************************************************************************** 84/******************************************************************************
85 * 85 *
@@ -100,6 +100,7 @@ static void ap_display_usage(void)
100 ACPI_OPTION("-r <Address>", "Dump tables from specified RSDP"); 100 ACPI_OPTION("-r <Address>", "Dump tables from specified RSDP");
101 ACPI_OPTION("-s", "Print table summaries only"); 101 ACPI_OPTION("-s", "Print table summaries only");
102 ACPI_OPTION("-v", "Display version information"); 102 ACPI_OPTION("-v", "Display version information");
103 ACPI_OPTION("-vd", "Display build date and time");
103 ACPI_OPTION("-z", "Verbose mode"); 104 ACPI_OPTION("-z", "Verbose mode");
104 105
105 ACPI_USAGE_TEXT("\nTable Options:\n"); 106 ACPI_USAGE_TEXT("\nTable Options:\n");
@@ -231,10 +232,29 @@ static int ap_do_options(int argc, char **argv)
231 } 232 }
232 continue; 233 continue;
233 234
234 case 'v': /* Revision/version */ 235 case 'v': /* -v: (Version): signon already emitted, just exit */
235 236
236 acpi_os_printf(ACPI_COMMON_SIGNON(AP_UTILITY_NAME)); 237 switch (acpi_gbl_optarg[0]) {
237 return (1); 238 case '^': /* -v: (Version) */
239
240 fprintf(stderr,
241 ACPI_COMMON_SIGNON(AP_UTILITY_NAME));
242 return (1);
243
244 case 'd':
245
246 fprintf(stderr,
247 ACPI_COMMON_SIGNON(AP_UTILITY_NAME));
248 printf(ACPI_COMMON_BUILD_TIME);
249 return (1);
250
251 default:
252
253 printf("Unknown option: -v%s\n",
254 acpi_gbl_optarg);
255 return (-1);
256 }
257 break;
238 258
239 case 'z': /* Verbose mode */ 259 case 'z': /* Verbose mode */
240 260