summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-10 18:09:41 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-10 18:09:41 -0500
commit872912352c5be930e9568e5f3b6d73107d9f278d (patch)
treeecc18608e200307588ac5130774518a54a292756 /drivers/acpi
parentc08f8467939e7d2eebcba7cf2330242c4f53f2f7 (diff)
parentb5e82233cab43c25fc0a1c28d9136a086db4aa52 (diff)
Merge tag 'pm+acpi-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management updates from Rafael Wysocki: "We have a few new features this time, including a new SFI-based cpufreq driver, a new devfreq driver for Tegra Activity Monitor, a new devfreq class for providing its governors with raw utilization data and a new ACPI driver for AMD SoCs. Still, the majority of changes here are reworks of existing code to make it more straightforward or to prepare it for implementing new features on top of it. The primary example is the rework of ACPI resources handling from Jiang Liu, Thomas Gleixner and Lv Zheng with support for IOAPIC hotplug implemented on top of it, but there is quite a number of changes of this kind in the cpufreq core, ACPICA, ACPI EC driver, ACPI processor driver and the generic power domains core code too. The most active developer is Viresh Kumar with his cpufreq changes. Specifics: - Rework of the core ACPI resources parsing code to fix issues in it and make using resource offsets more convenient and consolidation of some resource-handing code in a couple of places that have grown analagous data structures and code to cover the the same gap in the core (Jiang Liu, Thomas Gleixner, Lv Zheng). - ACPI-based IOAPIC hotplug support on top of the resources handling rework (Jiang Liu, Yinghai Lu). - ACPICA update to upstream release 20150204 including an interrupt handling rework that allows drivers to install raw handlers for ACPI GPEs which then become entirely responsible for the given GPE and the ACPICA core code won't touch it (Lv Zheng, David E Box, Octavian Purdila). - ACPI EC driver rework to fix several concurrency issues and other problems related to events handling on top of the ACPICA's new support for raw GPE handlers (Lv Zheng). - New ACPI driver for AMD SoCs analogous to the LPSS (Low-Power Subsystem) driver for Intel chips (Ken Xue). - Two minor fixes of the ACPI LPSS driver (Heikki Krogerus, Jarkko Nikula). - Two new blacklist entries for machines (Samsung 730U3E/740U3E and 510R) where the native backlight interface doesn't work correctly while the ACPI one does (Hans de Goede). - Rework of the ACPI processor driver's handling of idle states to make the code more straightforward and less bloated overall (Rafael J Wysocki). - Assorted minor fixes related to ACPI and SFI (Andreas Ruprecht, Andy Shevchenko, Hanjun Guo, Jan Beulich, Rafael J Wysocki, Yaowei Bai). - PCI core power management modification to avoid resuming (some) runtime-suspended devices during system suspend if they are in the right states already (Rafael J Wysocki). - New SFI-based cpufreq driver for Intel platforms using SFI (Srinidhi Kasagar). - cpufreq core fixes, cleanups and simplifications (Viresh Kumar, Doug Anderson, Wolfram Sang). - SkyLake CPU support and other updates for the intel_pstate driver (Kristen Carlson Accardi, Srinivas Pandruvada). - cpufreq-dt driver cleanup (Markus Elfring). - Init fix for the ARM big.LITTLE cpuidle driver (Sudeep Holla). - Generic power domains core code fixes and cleanups (Ulf Hansson). - Operating Performance Points (OPP) core code cleanups and kernel documentation update (Nishanth Menon). - New dabugfs interface to make the list of PM QoS constraints available to user space (Nishanth Menon). - New devfreq driver for Tegra Activity Monitor (Tomeu Vizoso). - New devfreq class (devfreq_event) to provide raw utilization data to devfreq governors (Chanwoo Choi). - Assorted minor fixes and cleanups related to power management (Andreas Ruprecht, Krzysztof Kozlowski, Rickard Strandqvist, Pavel Machek, Todd E Brandt, Wonhong Kwon). - turbostat updates (Len Brown) and cpupower Makefile improvement (Sriram Raghunathan)" * tag 'pm+acpi-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (151 commits) tools/power turbostat: relax dependency on APERF_MSR tools/power turbostat: relax dependency on invariant TSC Merge branch 'pci/host-generic' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci into acpi-resources tools/power turbostat: decode MSR_*_PERF_LIMIT_REASONS tools/power turbostat: relax dependency on root permission ACPI / video: Add disable_native_backlight quirk for Samsung 510R ACPI / PM: Remove unneeded nested #ifdef USB / PM: Remove unneeded #ifdef and associated dead code intel_pstate: provide option to only use intel_pstate with HWP ACPI / EC: Add GPE reference counting debugging messages ACPI / EC: Add query flushing support ACPI / EC: Refine command storm prevention support ACPI / EC: Add command flushing support. ACPI / EC: Introduce STARTED/STOPPED flags to replace BLOCKED flag ACPI: add AMD ACPI2Platform device support for x86 system ACPI / table: remove duplicate NULL check for the handler of acpi_table_parse() ACPI / EC: Update revision due to raw handler mode. ACPI / EC: Reduce ec_poll() by referencing the last register access timestamp. ACPI / EC: Fix several GPE handling issues by deploying ACPI_GPE_DISPATCH_RAW_HANDLER mode. ACPICA: Events: Enable APIs to allow interrupt/polling adaptive request based GPE handling model ...
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/Kconfig6
-rw-r--r--drivers/acpi/Makefile3
-rw-r--r--drivers/acpi/acpi_apd.c150
-rw-r--r--drivers/acpi/acpi_lpss.c12
-rw-r--r--drivers/acpi/acpi_memhotplug.c8
-rw-r--r--drivers/acpi/acpi_platform.c4
-rw-r--r--drivers/acpi/acpica/acapps.h4
-rw-r--r--drivers/acpi/acpica/accommon.h2
-rw-r--r--drivers/acpi/acpica/acdebug.h2
-rw-r--r--drivers/acpi/acpica/acdispat.h2
-rw-r--r--drivers/acpi/acpica/acevents.h4
-rw-r--r--drivers/acpi/acpica/acglobal.h2
-rw-r--r--drivers/acpi/acpica/achware.h2
-rw-r--r--drivers/acpi/acpica/acinterp.h2
-rw-r--r--drivers/acpi/acpica/aclocal.h2
-rw-r--r--drivers/acpi/acpica/acmacros.h2
-rw-r--r--drivers/acpi/acpica/acnamesp.h2
-rw-r--r--drivers/acpi/acpica/acobject.h2
-rw-r--r--drivers/acpi/acpica/acopcode.h2
-rw-r--r--drivers/acpi/acpica/acparser.h2
-rw-r--r--drivers/acpi/acpica/acpredef.h2
-rw-r--r--drivers/acpi/acpica/acresrc.h2
-rw-r--r--drivers/acpi/acpica/acstruct.h2
-rw-r--r--drivers/acpi/acpica/actables.h2
-rw-r--r--drivers/acpi/acpica/acutils.h2
-rw-r--r--drivers/acpi/acpica/amlcode.h2
-rw-r--r--drivers/acpi/acpica/amlresrc.h2
-rw-r--r--drivers/acpi/acpica/dsargs.c2
-rw-r--r--drivers/acpi/acpica/dscontrol.c2
-rw-r--r--drivers/acpi/acpica/dsfield.c2
-rw-r--r--drivers/acpi/acpica/dsinit.c2
-rw-r--r--drivers/acpi/acpica/dsmethod.c2
-rw-r--r--drivers/acpi/acpica/dsmthdat.c2
-rw-r--r--drivers/acpi/acpica/dsobject.c2
-rw-r--r--drivers/acpi/acpica/dsopcode.c2
-rw-r--r--drivers/acpi/acpica/dsutils.c2
-rw-r--r--drivers/acpi/acpica/dswexec.c2
-rw-r--r--drivers/acpi/acpica/dswload.c2
-rw-r--r--drivers/acpi/acpica/dswload2.c2
-rw-r--r--drivers/acpi/acpica/dswscope.c2
-rw-r--r--drivers/acpi/acpica/dswstate.c2
-rw-r--r--drivers/acpi/acpica/evevent.c2
-rw-r--r--drivers/acpi/acpica/evglock.c2
-rw-r--r--drivers/acpi/acpica/evgpe.c164
-rw-r--r--drivers/acpi/acpica/evgpeblk.c10
-rw-r--r--drivers/acpi/acpica/evgpeinit.c10
-rw-r--r--drivers/acpi/acpica/evgpeutil.c61
-rw-r--r--drivers/acpi/acpica/evhandler.c2
-rw-r--r--drivers/acpi/acpica/evmisc.c2
-rw-r--r--drivers/acpi/acpica/evregion.c2
-rw-r--r--drivers/acpi/acpica/evrgnini.c2
-rw-r--r--drivers/acpi/acpica/evsci.c2
-rw-r--r--drivers/acpi/acpica/evxface.c132
-rw-r--r--drivers/acpi/acpica/evxfevnt.c2
-rw-r--r--drivers/acpi/acpica/evxfgpe.c123
-rw-r--r--drivers/acpi/acpica/evxfregn.c2
-rw-r--r--drivers/acpi/acpica/exconfig.c2
-rw-r--r--drivers/acpi/acpica/exconvrt.c2
-rw-r--r--drivers/acpi/acpica/excreate.c2
-rw-r--r--drivers/acpi/acpica/exdebug.c2
-rw-r--r--drivers/acpi/acpica/exdump.c2
-rw-r--r--drivers/acpi/acpica/exfield.c2
-rw-r--r--drivers/acpi/acpica/exfldio.c2
-rw-r--r--drivers/acpi/acpica/exmisc.c2
-rw-r--r--drivers/acpi/acpica/exmutex.c2
-rw-r--r--drivers/acpi/acpica/exnames.c2
-rw-r--r--drivers/acpi/acpica/exoparg1.c2
-rw-r--r--drivers/acpi/acpica/exoparg2.c2
-rw-r--r--drivers/acpi/acpica/exoparg3.c2
-rw-r--r--drivers/acpi/acpica/exoparg6.c2
-rw-r--r--drivers/acpi/acpica/exprep.c2
-rw-r--r--drivers/acpi/acpica/exregion.c2
-rw-r--r--drivers/acpi/acpica/exresnte.c2
-rw-r--r--drivers/acpi/acpica/exresolv.c2
-rw-r--r--drivers/acpi/acpica/exresop.c2
-rw-r--r--drivers/acpi/acpica/exstore.c2
-rw-r--r--drivers/acpi/acpica/exstoren.c2
-rw-r--r--drivers/acpi/acpica/exstorob.c2
-rw-r--r--drivers/acpi/acpica/exsystem.c2
-rw-r--r--drivers/acpi/acpica/exutils.c2
-rw-r--r--drivers/acpi/acpica/hwacpi.c2
-rw-r--r--drivers/acpi/acpica/hwesleep.c2
-rw-r--r--drivers/acpi/acpica/hwgpe.c10
-rw-r--r--drivers/acpi/acpica/hwpci.c2
-rw-r--r--drivers/acpi/acpica/hwregs.c2
-rw-r--r--drivers/acpi/acpica/hwsleep.c2
-rw-r--r--drivers/acpi/acpica/hwtimer.c2
-rw-r--r--drivers/acpi/acpica/hwvalid.c2
-rw-r--r--drivers/acpi/acpica/hwxface.c2
-rw-r--r--drivers/acpi/acpica/hwxfsleep.c2
-rw-r--r--drivers/acpi/acpica/nsaccess.c2
-rw-r--r--drivers/acpi/acpica/nsalloc.c2
-rw-r--r--drivers/acpi/acpica/nsarguments.c2
-rw-r--r--drivers/acpi/acpica/nsconvert.c2
-rw-r--r--drivers/acpi/acpica/nsdump.c2
-rw-r--r--drivers/acpi/acpica/nsdumpdv.c2
-rw-r--r--drivers/acpi/acpica/nseval.c2
-rw-r--r--drivers/acpi/acpica/nsinit.c2
-rw-r--r--drivers/acpi/acpica/nsload.c2
-rw-r--r--drivers/acpi/acpica/nsnames.c2
-rw-r--r--drivers/acpi/acpica/nsobject.c2
-rw-r--r--drivers/acpi/acpica/nsparse.c2
-rw-r--r--drivers/acpi/acpica/nspredef.c2
-rw-r--r--drivers/acpi/acpica/nsprepkg.c2
-rw-r--r--drivers/acpi/acpica/nsrepair.c2
-rw-r--r--drivers/acpi/acpica/nsrepair2.c2
-rw-r--r--drivers/acpi/acpica/nssearch.c2
-rw-r--r--drivers/acpi/acpica/nsutils.c2
-rw-r--r--drivers/acpi/acpica/nswalk.c2
-rw-r--r--drivers/acpi/acpica/nsxfeval.c2
-rw-r--r--drivers/acpi/acpica/nsxfname.c2
-rw-r--r--drivers/acpi/acpica/nsxfobj.c46
-rw-r--r--drivers/acpi/acpica/psargs.c2
-rw-r--r--drivers/acpi/acpica/psloop.c2
-rw-r--r--drivers/acpi/acpica/psobject.c2
-rw-r--r--drivers/acpi/acpica/psopcode.c2
-rw-r--r--drivers/acpi/acpica/psopinfo.c2
-rw-r--r--drivers/acpi/acpica/psparse.c2
-rw-r--r--drivers/acpi/acpica/psscope.c2
-rw-r--r--drivers/acpi/acpica/pstree.c2
-rw-r--r--drivers/acpi/acpica/psutils.c2
-rw-r--r--drivers/acpi/acpica/pswalk.c2
-rw-r--r--drivers/acpi/acpica/psxface.c2
-rw-r--r--drivers/acpi/acpica/rsaddr.c11
-rw-r--r--drivers/acpi/acpica/rscalc.c2
-rw-r--r--drivers/acpi/acpica/rscreate.c2
-rw-r--r--drivers/acpi/acpica/rsdump.c2
-rw-r--r--drivers/acpi/acpica/rsdumpinfo.c61
-rw-r--r--drivers/acpi/acpica/rsinfo.c2
-rw-r--r--drivers/acpi/acpica/rsio.c2
-rw-r--r--drivers/acpi/acpica/rsirq.c2
-rw-r--r--drivers/acpi/acpica/rslist.c2
-rw-r--r--drivers/acpi/acpica/rsmemory.c2
-rw-r--r--drivers/acpi/acpica/rsmisc.c2
-rw-r--r--drivers/acpi/acpica/rsserial.c2
-rw-r--r--drivers/acpi/acpica/rsutils.c2
-rw-r--r--drivers/acpi/acpica/rsxface.c12
-rw-r--r--drivers/acpi/acpica/tbdata.c2
-rw-r--r--drivers/acpi/acpica/tbfadt.c2
-rw-r--r--drivers/acpi/acpica/tbfind.c2
-rw-r--r--drivers/acpi/acpica/tbinstal.c2
-rw-r--r--drivers/acpi/acpica/tbprint.c2
-rw-r--r--drivers/acpi/acpica/tbutils.c2
-rw-r--r--drivers/acpi/acpica/tbxface.c41
-rw-r--r--drivers/acpi/acpica/tbxfload.c2
-rw-r--r--drivers/acpi/acpica/tbxfroot.c2
-rw-r--r--drivers/acpi/acpica/utaddress.c2
-rw-r--r--drivers/acpi/acpica/utalloc.c2
-rw-r--r--drivers/acpi/acpica/utbuffer.c2
-rw-r--r--drivers/acpi/acpica/utcache.c2
-rw-r--r--drivers/acpi/acpica/utcopy.c2
-rw-r--r--drivers/acpi/acpica/utdebug.c2
-rw-r--r--drivers/acpi/acpica/utdecode.c2
-rw-r--r--drivers/acpi/acpica/utdelete.c2
-rw-r--r--drivers/acpi/acpica/uterror.c2
-rw-r--r--drivers/acpi/acpica/uteval.c2
-rw-r--r--drivers/acpi/acpica/utexcep.c2
-rw-r--r--drivers/acpi/acpica/utfileio.c2
-rw-r--r--drivers/acpi/acpica/utglobal.c2
-rw-r--r--drivers/acpi/acpica/uthex.c2
-rw-r--r--drivers/acpi/acpica/utids.c2
-rw-r--r--drivers/acpi/acpica/utinit.c2
-rw-r--r--drivers/acpi/acpica/utlock.c2
-rw-r--r--drivers/acpi/acpica/utmath.c2
-rw-r--r--drivers/acpi/acpica/utmisc.c2
-rw-r--r--drivers/acpi/acpica/utmutex.c2
-rw-r--r--drivers/acpi/acpica/utobject.c2
-rw-r--r--drivers/acpi/acpica/utosi.c2
-rw-r--r--drivers/acpi/acpica/utownerid.c2
-rw-r--r--drivers/acpi/acpica/utpredef.c2
-rw-r--r--drivers/acpi/acpica/utprint.c2
-rw-r--r--drivers/acpi/acpica/utresrc.c2
-rw-r--r--drivers/acpi/acpica/utstate.c2
-rw-r--r--drivers/acpi/acpica/utstring.c2
-rw-r--r--drivers/acpi/acpica/uttrack.c2
-rw-r--r--drivers/acpi/acpica/utuuid.c2
-rw-r--r--drivers/acpi/acpica/utxface.c2
-rw-r--r--drivers/acpi/acpica/utxferror.c2
-rw-r--r--drivers/acpi/acpica/utxfinit.c2
-rw-r--r--drivers/acpi/acpica/utxfmutex.c2
-rw-r--r--drivers/acpi/device_pm.c2
-rw-r--r--drivers/acpi/ec.c548
-rw-r--r--drivers/acpi/internal.h11
-rw-r--r--drivers/acpi/ioapic.c229
-rw-r--r--drivers/acpi/numa.c12
-rw-r--r--drivers/acpi/pci_irq.c9
-rw-r--r--drivers/acpi/pci_root.c9
-rw-r--r--drivers/acpi/processor_core.c123
-rw-r--r--drivers/acpi/processor_idle.c182
-rw-r--r--drivers/acpi/resource.c353
-rw-r--r--drivers/acpi/scan.c1
-rw-r--r--drivers/acpi/sleep.c2
-rw-r--r--drivers/acpi/video.c18
193 files changed, 1788 insertions, 903 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 8951cefb0a96..e6c3ddd92665 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -315,6 +315,12 @@ config ACPI_HOTPLUG_MEMORY
315 To compile this driver as a module, choose M here: 315 To compile this driver as a module, choose M here:
316 the module will be called acpi_memhotplug. 316 the module will be called acpi_memhotplug.
317 317
318config ACPI_HOTPLUG_IOAPIC
319 bool
320 depends on PCI
321 depends on X86_IO_APIC
322 default y
323
318config ACPI_SBS 324config ACPI_SBS
319 tristate "Smart Battery System" 325 tristate "Smart Battery System"
320 depends on X86 326 depends on X86
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index f74317cc1ca9..b18cd2151ddb 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -40,7 +40,7 @@ acpi-$(CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC) += processor_pdc.o
40acpi-y += ec.o 40acpi-y += ec.o
41acpi-$(CONFIG_ACPI_DOCK) += dock.o 41acpi-$(CONFIG_ACPI_DOCK) += dock.o
42acpi-y += pci_root.o pci_link.o pci_irq.o 42acpi-y += pci_root.o pci_link.o pci_irq.o
43acpi-y += acpi_lpss.o 43acpi-y += acpi_lpss.o acpi_apd.o
44acpi-y += acpi_platform.o 44acpi-y += acpi_platform.o
45acpi-y += acpi_pnp.o 45acpi-y += acpi_pnp.o
46acpi-y += int340x_thermal.o 46acpi-y += int340x_thermal.o
@@ -70,6 +70,7 @@ obj-$(CONFIG_ACPI_PROCESSOR) += processor.o
70obj-y += container.o 70obj-y += container.o
71obj-$(CONFIG_ACPI_THERMAL) += thermal.o 71obj-$(CONFIG_ACPI_THERMAL) += thermal.o
72obj-y += acpi_memhotplug.o 72obj-y += acpi_memhotplug.o
73obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o
73obj-$(CONFIG_ACPI_BATTERY) += battery.o 74obj-$(CONFIG_ACPI_BATTERY) += battery.o
74obj-$(CONFIG_ACPI_SBS) += sbshc.o 75obj-$(CONFIG_ACPI_SBS) += sbshc.o
75obj-$(CONFIG_ACPI_SBS) += sbs.o 76obj-$(CONFIG_ACPI_SBS) += sbs.o
diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
new file mode 100644
index 000000000000..3984ea96e5f7
--- /dev/null
+++ b/drivers/acpi/acpi_apd.c
@@ -0,0 +1,150 @@
1/*
2 * AMD ACPI support for ACPI2platform device.
3 *
4 * Copyright (c) 2014,2015 AMD Corporation.
5 * Authors: Ken Xue <Ken.Xue@amd.com>
6 * Wu, Jeff <Jeff.Wu@amd.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/clk-provider.h>
14#include <linux/platform_device.h>
15#include <linux/pm_domain.h>
16#include <linux/clkdev.h>
17#include <linux/acpi.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/pm.h>
21
22#include "internal.h"
23
24ACPI_MODULE_NAME("acpi_apd");
25struct apd_private_data;
26
27/**
28 * ACPI_APD_SYSFS : add device attributes in sysfs
29 * ACPI_APD_PM : attach power domain to device
30 */
31#define ACPI_APD_SYSFS BIT(0)
32#define ACPI_APD_PM BIT(1)
33
34/**
35 * struct apd_device_desc - a descriptor for apd device
36 * @flags: device flags like %ACPI_APD_SYSFS, %ACPI_APD_PM
37 * @fixed_clk_rate: fixed rate input clock source for acpi device;
38 * 0 means no fixed rate input clock source
39 * @setup: a hook routine to set device resource during create platform device
40 *
41 * Device description defined as acpi_device_id.driver_data
42 */
43struct apd_device_desc {
44 unsigned int flags;
45 unsigned int fixed_clk_rate;
46 int (*setup)(struct apd_private_data *pdata);
47};
48
49struct apd_private_data {
50 struct clk *clk;
51 struct acpi_device *adev;
52 const struct apd_device_desc *dev_desc;
53};
54
55#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
56#define APD_ADDR(desc) ((unsigned long)&desc)
57
58static int acpi_apd_setup(struct apd_private_data *pdata)
59{
60 const struct apd_device_desc *dev_desc = pdata->dev_desc;
61 struct clk *clk = ERR_PTR(-ENODEV);
62
63 if (dev_desc->fixed_clk_rate) {
64 clk = clk_register_fixed_rate(&pdata->adev->dev,
65 dev_name(&pdata->adev->dev),
66 NULL, CLK_IS_ROOT,
67 dev_desc->fixed_clk_rate);
68 clk_register_clkdev(clk, NULL, dev_name(&pdata->adev->dev));
69 pdata->clk = clk;
70 }
71
72 return 0;
73}
74
75static struct apd_device_desc cz_i2c_desc = {
76 .setup = acpi_apd_setup,
77 .fixed_clk_rate = 133000000,
78};
79
80static struct apd_device_desc cz_uart_desc = {
81 .setup = acpi_apd_setup,
82 .fixed_clk_rate = 48000000,
83};
84
85#else
86
87#define APD_ADDR(desc) (0UL)
88
89#endif /* CONFIG_X86_AMD_PLATFORM_DEVICE */
90
91/**
92* Create platform device during acpi scan attach handle.
93* Return value > 0 on success of creating device.
94*/
95static int acpi_apd_create_device(struct acpi_device *adev,
96 const struct acpi_device_id *id)
97{
98 const struct apd_device_desc *dev_desc = (void *)id->driver_data;
99 struct apd_private_data *pdata;
100 struct platform_device *pdev;
101 int ret;
102
103 if (!dev_desc) {
104 pdev = acpi_create_platform_device(adev);
105 return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1;
106 }
107
108 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
109 if (!pdata)
110 return -ENOMEM;
111
112 pdata->adev = adev;
113 pdata->dev_desc = dev_desc;
114
115 if (dev_desc->setup) {
116 ret = dev_desc->setup(pdata);
117 if (ret)
118 goto err_out;
119 }
120
121 adev->driver_data = pdata;
122 pdev = acpi_create_platform_device(adev);
123 if (!IS_ERR_OR_NULL(pdev))
124 return 1;
125
126 ret = PTR_ERR(pdev);
127 adev->driver_data = NULL;
128
129 err_out:
130 kfree(pdata);
131 return ret;
132}
133
134static const struct acpi_device_id acpi_apd_device_ids[] = {
135 /* Generic apd devices */
136 { "AMD0010", APD_ADDR(cz_i2c_desc) },
137 { "AMD0020", APD_ADDR(cz_uart_desc) },
138 { "AMD0030", },
139 { }
140};
141
142static struct acpi_scan_handler apd_handler = {
143 .ids = acpi_apd_device_ids,
144 .attach = acpi_apd_create_device,
145};
146
147void __init acpi_apd_init(void)
148{
149 acpi_scan_add_handler(&apd_handler);
150}
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index e75737fd7eef..02e835f3cf8a 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -125,7 +125,7 @@ static struct lpss_device_desc lpt_dev_desc = {
125}; 125};
126 126
127static struct lpss_device_desc lpt_i2c_dev_desc = { 127static struct lpss_device_desc lpt_i2c_dev_desc = {
128 .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_LTR, 128 .flags = LPSS_CLK | LPSS_LTR,
129 .prv_offset = 0x800, 129 .prv_offset = 0x800,
130}; 130};
131 131
@@ -307,7 +307,7 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
307{ 307{
308 struct lpss_device_desc *dev_desc; 308 struct lpss_device_desc *dev_desc;
309 struct lpss_private_data *pdata; 309 struct lpss_private_data *pdata;
310 struct resource_list_entry *rentry; 310 struct resource_entry *rentry;
311 struct list_head resource_list; 311 struct list_head resource_list;
312 struct platform_device *pdev; 312 struct platform_device *pdev;
313 int ret; 313 int ret;
@@ -327,13 +327,15 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
327 goto err_out; 327 goto err_out;
328 328
329 list_for_each_entry(rentry, &resource_list, node) 329 list_for_each_entry(rentry, &resource_list, node)
330 if (resource_type(&rentry->res) == IORESOURCE_MEM) { 330 if (resource_type(rentry->res) == IORESOURCE_MEM) {
331 if (dev_desc->prv_size_override) 331 if (dev_desc->prv_size_override)
332 pdata->mmio_size = dev_desc->prv_size_override; 332 pdata->mmio_size = dev_desc->prv_size_override;
333 else 333 else
334 pdata->mmio_size = resource_size(&rentry->res); 334 pdata->mmio_size = resource_size(rentry->res);
335 pdata->mmio_base = ioremap(rentry->res.start, 335 pdata->mmio_base = ioremap(rentry->res->start,
336 pdata->mmio_size); 336 pdata->mmio_size);
337 if (!pdata->mmio_base)
338 goto err_out;
337 break; 339 break;
338 } 340 }
339 341
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 23e2319ead41..ee28f4d15625 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -101,8 +101,8 @@ acpi_memory_get_resource(struct acpi_resource *resource, void *context)
101 /* Can we combine the resource range information? */ 101 /* Can we combine the resource range information? */
102 if ((info->caching == address64.info.mem.caching) && 102 if ((info->caching == address64.info.mem.caching) &&
103 (info->write_protect == address64.info.mem.write_protect) && 103 (info->write_protect == address64.info.mem.write_protect) &&
104 (info->start_addr + info->length == address64.minimum)) { 104 (info->start_addr + info->length == address64.address.minimum)) {
105 info->length += address64.address_length; 105 info->length += address64.address.address_length;
106 return AE_OK; 106 return AE_OK;
107 } 107 }
108 } 108 }
@@ -114,8 +114,8 @@ acpi_memory_get_resource(struct acpi_resource *resource, void *context)
114 INIT_LIST_HEAD(&new->list); 114 INIT_LIST_HEAD(&new->list);
115 new->caching = address64.info.mem.caching; 115 new->caching = address64.info.mem.caching;
116 new->write_protect = address64.info.mem.write_protect; 116 new->write_protect = address64.info.mem.write_protect;
117 new->start_addr = address64.minimum; 117 new->start_addr = address64.address.minimum;
118 new->length = address64.address_length; 118 new->length = address64.address.address_length;
119 list_add_tail(&new->list, &mem_device->res_list); 119 list_add_tail(&new->list, &mem_device->res_list);
120 120
121 return AE_OK; 121 return AE_OK;
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index 6ba8beb6b9d2..1284138e42ab 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -45,7 +45,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
45 struct platform_device *pdev = NULL; 45 struct platform_device *pdev = NULL;
46 struct acpi_device *acpi_parent; 46 struct acpi_device *acpi_parent;
47 struct platform_device_info pdevinfo; 47 struct platform_device_info pdevinfo;
48 struct resource_list_entry *rentry; 48 struct resource_entry *rentry;
49 struct list_head resource_list; 49 struct list_head resource_list;
50 struct resource *resources = NULL; 50 struct resource *resources = NULL;
51 int count; 51 int count;
@@ -71,7 +71,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
71 } 71 }
72 count = 0; 72 count = 0;
73 list_for_each_entry(rentry, &resource_list, node) 73 list_for_each_entry(rentry, &resource_list, node)
74 resources[count++] = rentry->res; 74 resources[count++] = *rentry->res;
75 75
76 acpi_dev_free_resource_list(&resource_list); 76 acpi_dev_free_resource_list(&resource_list);
77 } 77 }
diff --git a/drivers/acpi/acpica/acapps.h b/drivers/acpi/acpica/acapps.h
index 3d2c88289da9..d863016565b5 100644
--- a/drivers/acpi/acpica/acapps.h
+++ b/drivers/acpi/acpica/acapps.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@
47/* Common info for tool signons */ 47/* Common info for tool signons */
48 48
49#define ACPICA_NAME "Intel ACPI Component Architecture" 49#define ACPICA_NAME "Intel ACPI Component Architecture"
50#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2014 Intel Corporation" 50#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2015 Intel Corporation"
51 51
52#if ACPI_MACHINE_WIDTH == 64 52#if ACPI_MACHINE_WIDTH == 64
53#define ACPI_WIDTH "-64" 53#define ACPI_WIDTH "-64"
diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h
index 6f1c616910ac..853aa2dbdb61 100644
--- a/drivers/acpi/acpica/accommon.h
+++ b/drivers/acpi/acpica/accommon.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 1d026ff1683f..4169bb87a996 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h
index d3e2cc395d7f..408f04bcaab4 100644
--- a/drivers/acpi/acpica/acdispat.h
+++ b/drivers/acpi/acpica/acdispat.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
index 7a7811a9fc26..228704b78657 100644
--- a/drivers/acpi/acpica/acevents.h
+++ b/drivers/acpi/acpica/acevents.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -143,8 +143,6 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,
143acpi_status 143acpi_status
144acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context); 144acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context);
145 145
146u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info);
147
148acpi_status 146acpi_status
149acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, 147acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
150 struct acpi_gpe_block_info *gpe_block, void *context); 148 struct acpi_gpe_block_info *gpe_block, void *context);
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 7f60582d0c8c..a165d25343e8 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h
index c318d3e27893..196a55244559 100644
--- a/drivers/acpi/acpica/achware.h
+++ b/drivers/acpi/acpica/achware.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index b01f71ce0523..1886bde54b5d 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 680d23bbae7c..7add32e5d8c5 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index 4bceb11c7380..cf607fe69dbd 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index ee1c040f321c..952fbe0b7231 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index 8abb393dafab..3e9720e1f34f 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h
index dda0e6affcf1..a5f17de45ac6 100644
--- a/drivers/acpi/acpica/acopcode.h
+++ b/drivers/acpi/acpica/acopcode.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h
index 6168b85463ed..74a390c6db16 100644
--- a/drivers/acpi/acpica/acparser.h
+++ b/drivers/acpi/acpica/acparser.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index bd3908d26c4f..a972d11c97c9 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h
index 4b008e8884a1..efc4c7124ccc 100644
--- a/drivers/acpi/acpica/acresrc.h
+++ b/drivers/acpi/acpica/acresrc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h
index cf7346110bd8..d14b547b7cd5 100644
--- a/drivers/acpi/acpica/acstruct.h
+++ b/drivers/acpi/acpica/acstruct.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h
index 1afe46e44dac..1c127a43017b 100644
--- a/drivers/acpi/acpica/actables.h
+++ b/drivers/acpi/acpica/actables.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 486d342e74b6..c2f03e8774ad 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h
index 5908ccec6aea..3a95068fc119 100644
--- a/drivers/acpi/acpica/amlcode.h
+++ b/drivers/acpi/acpica/amlcode.h
@@ -7,7 +7,7 @@
7 *****************************************************************************/ 7 *****************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2014, Intel Corp. 10 * Copyright (C) 2000 - 2015, Intel Corp.
11 * All rights reserved. 11 * All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h
index 3a0beeb86ba5..ee0cdd60b93d 100644
--- a/drivers/acpi/acpica/amlresrc.h
+++ b/drivers/acpi/acpica/amlresrc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsargs.c b/drivers/acpi/acpica/dsargs.c
index 720b1cdda711..3e6989738e85 100644
--- a/drivers/acpi/acpica/dsargs.c
+++ b/drivers/acpi/acpica/dsargs.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c
index 8daf9de82b73..39da9da62bbf 100644
--- a/drivers/acpi/acpica/dscontrol.c
+++ b/drivers/acpi/acpica/dscontrol.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index c57666196672..43b40de90484 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c
index aee5e45f6d35..bbe74bcebbae 100644
--- a/drivers/acpi/acpica/dsinit.c
+++ b/drivers/acpi/acpica/dsinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index 3c7f7378b94d..d72565a3c646 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c
index b67522df01ac..2e4c42b377ec 100644
--- a/drivers/acpi/acpica/dsmthdat.c
+++ b/drivers/acpi/acpica/dsmthdat.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index a1e7e6b6fcf7..8a7b07b6adc8 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
index 6c0759c0db47..77244182ff02 100644
--- a/drivers/acpi/acpica/dsopcode.c
+++ b/drivers/acpi/acpica/dsopcode.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c
index 9f74795e2268..e5ff89bcb3f5 100644
--- a/drivers/acpi/acpica/dsutils.c
+++ b/drivers/acpi/acpica/dsutils.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c
index f7f5107e754d..df54d46225cd 100644
--- a/drivers/acpi/acpica/dswexec.c
+++ b/drivers/acpi/acpica/dswexec.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index 15623da26200..843942fb4be5 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c
index 2ac28d297305..fcaa30c611fb 100644
--- a/drivers/acpi/acpica/dswload2.c
+++ b/drivers/acpi/acpica/dswload2.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswscope.c b/drivers/acpi/acpica/dswscope.c
index 9d6e2c1de1f8..43b3ea40c0b6 100644
--- a/drivers/acpi/acpica/dswscope.c
+++ b/drivers/acpi/acpica/dswscope.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c
index 24f7d5ea678a..89ac2022465e 100644
--- a/drivers/acpi/acpica/dswstate.c
+++ b/drivers/acpi/acpica/dswstate.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c
index c7bffff9ed32..bf6873f95e72 100644
--- a/drivers/acpi/acpica/evevent.c
+++ b/drivers/acpi/acpica/evevent.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evglock.c b/drivers/acpi/acpica/evglock.c
index 3393a73ca0d6..b78dc7c6d5d7 100644
--- a/drivers/acpi/acpica/evglock.c
+++ b/drivers/acpi/acpica/evglock.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index aa70154cf4fa..5ed064e8673c 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -114,17 +114,6 @@ acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
114 114
115 ACPI_FUNCTION_TRACE(ev_enable_gpe); 115 ACPI_FUNCTION_TRACE(ev_enable_gpe);
116 116
117 /*
118 * We will only allow a GPE to be enabled if it has either an associated
119 * method (_Lxx/_Exx) or a handler, or is using the implicit notify
120 * feature. Otherwise, the GPE will be immediately disabled by
121 * acpi_ev_gpe_dispatch the first time it fires.
122 */
123 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
124 ACPI_GPE_DISPATCH_NONE) {
125 return_ACPI_STATUS(AE_NO_HANDLER);
126 }
127
128 /* Clear the GPE (of stale events) */ 117 /* Clear the GPE (of stale events) */
129 118
130 status = acpi_hw_clear_gpe(gpe_event_info); 119 status = acpi_hw_clear_gpe(gpe_event_info);
@@ -339,7 +328,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list)
339{ 328{
340 acpi_status status; 329 acpi_status status;
341 struct acpi_gpe_block_info *gpe_block; 330 struct acpi_gpe_block_info *gpe_block;
331 struct acpi_namespace_node *gpe_device;
342 struct acpi_gpe_register_info *gpe_register_info; 332 struct acpi_gpe_register_info *gpe_register_info;
333 struct acpi_gpe_event_info *gpe_event_info;
334 u32 gpe_number;
335 struct acpi_gpe_handler_info *gpe_handler_info;
343 u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; 336 u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
344 u8 enabled_status_byte; 337 u8 enabled_status_byte;
345 u32 status_reg; 338 u32 status_reg;
@@ -367,6 +360,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list)
367 360
368 gpe_block = gpe_xrupt_list->gpe_block_list_head; 361 gpe_block = gpe_xrupt_list->gpe_block_list_head;
369 while (gpe_block) { 362 while (gpe_block) {
363 gpe_device = gpe_block->node;
364
370 /* 365 /*
371 * Read all of the 8-bit GPE status and enable registers in this GPE 366 * Read all of the 8-bit GPE status and enable registers in this GPE
372 * block, saving all of them. Find all currently active GP events. 367 * block, saving all of them. Find all currently active GP events.
@@ -442,16 +437,68 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list)
442 437
443 /* Examine one GPE bit */ 438 /* Examine one GPE bit */
444 439
440 gpe_event_info =
441 &gpe_block->
442 event_info[((acpi_size) i *
443 ACPI_GPE_REGISTER_WIDTH) + j];
444 gpe_number =
445 j + gpe_register_info->base_gpe_number;
446
445 if (enabled_status_byte & (1 << j)) { 447 if (enabled_status_byte & (1 << j)) {
446 /* 448
447 * Found an active GPE. Dispatch the event to a handler 449 /* Invoke global event handler if present */
448 * or method. 450
449 */ 451 acpi_gpe_count++;
450 int_status |= 452 if (acpi_gbl_global_event_handler) {
451 acpi_ev_gpe_dispatch(gpe_block-> 453 acpi_gbl_global_event_handler
452 node, 454 (ACPI_EVENT_TYPE_GPE,
453 &gpe_block-> 455 gpe_device, gpe_number,
454 event_info[((acpi_size) i * ACPI_GPE_REGISTER_WIDTH) + j], j + gpe_register_info->base_gpe_number); 456 acpi_gbl_global_event_handler_context);
457 }
458
459 /* Found an active GPE */
460
461 if (ACPI_GPE_DISPATCH_TYPE
462 (gpe_event_info->flags) ==
463 ACPI_GPE_DISPATCH_RAW_HANDLER) {
464
465 /* Dispatch the event to a raw handler */
466
467 gpe_handler_info =
468 gpe_event_info->dispatch.
469 handler;
470
471 /*
472 * There is no protection around the namespace node
473 * and the GPE handler to ensure a safe destruction
474 * because:
475 * 1. The namespace node is expected to always
476 * exist after loading a table.
477 * 2. The GPE handler is expected to be flushed by
478 * acpi_os_wait_events_complete() before the
479 * destruction.
480 */
481 acpi_os_release_lock
482 (acpi_gbl_gpe_lock, flags);
483 int_status |=
484 gpe_handler_info->
485 address(gpe_device,
486 gpe_number,
487 gpe_handler_info->
488 context);
489 flags =
490 acpi_os_acquire_lock
491 (acpi_gbl_gpe_lock);
492 } else {
493 /*
494 * Dispatch the event to a standard handler or
495 * method.
496 */
497 int_status |=
498 acpi_ev_gpe_dispatch
499 (gpe_device, gpe_event_info,
500 gpe_number);
501 }
455 } 502 }
456 } 503 }
457 } 504 }
@@ -484,52 +531,15 @@ unlock_and_exit:
484static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) 531static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
485{ 532{
486 struct acpi_gpe_event_info *gpe_event_info = context; 533 struct acpi_gpe_event_info *gpe_event_info = context;
487 acpi_status status; 534 acpi_status status = AE_OK;
488 struct acpi_gpe_event_info *local_gpe_event_info;
489 struct acpi_evaluate_info *info; 535 struct acpi_evaluate_info *info;
490 struct acpi_gpe_notify_info *notify; 536 struct acpi_gpe_notify_info *notify;
491 537
492 ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method); 538 ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method);
493 539
494 /* Allocate a local GPE block */
495
496 local_gpe_event_info =
497 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_event_info));
498 if (!local_gpe_event_info) {
499 ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, "while handling a GPE"));
500 return_VOID;
501 }
502
503 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
504 if (ACPI_FAILURE(status)) {
505 ACPI_FREE(local_gpe_event_info);
506 return_VOID;
507 }
508
509 /* Must revalidate the gpe_number/gpe_block */
510
511 if (!acpi_ev_valid_gpe_event(gpe_event_info)) {
512 status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
513 ACPI_FREE(local_gpe_event_info);
514 return_VOID;
515 }
516
517 /*
518 * Take a snapshot of the GPE info for this level - we copy the info to
519 * prevent a race condition with remove_handler/remove_block.
520 */
521 ACPI_MEMCPY(local_gpe_event_info, gpe_event_info,
522 sizeof(struct acpi_gpe_event_info));
523
524 status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
525 if (ACPI_FAILURE(status)) {
526 ACPI_FREE(local_gpe_event_info);
527 return_VOID;
528 }
529
530 /* Do the correct dispatch - normal method or implicit notify */ 540 /* Do the correct dispatch - normal method or implicit notify */
531 541
532 switch (local_gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) { 542 switch (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags)) {
533 case ACPI_GPE_DISPATCH_NOTIFY: 543 case ACPI_GPE_DISPATCH_NOTIFY:
534 /* 544 /*
535 * Implicit notify. 545 * Implicit notify.
@@ -542,7 +552,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
542 * June 2012: Expand implicit notify mechanism to support 552 * June 2012: Expand implicit notify mechanism to support
543 * notifies on multiple device objects. 553 * notifies on multiple device objects.
544 */ 554 */
545 notify = local_gpe_event_info->dispatch.notify_list; 555 notify = gpe_event_info->dispatch.notify_list;
546 while (ACPI_SUCCESS(status) && notify) { 556 while (ACPI_SUCCESS(status) && notify) {
547 status = 557 status =
548 acpi_ev_queue_notify_request(notify->device_node, 558 acpi_ev_queue_notify_request(notify->device_node,
@@ -566,7 +576,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
566 * _Lxx/_Exx control method that corresponds to this GPE 576 * _Lxx/_Exx control method that corresponds to this GPE
567 */ 577 */
568 info->prefix_node = 578 info->prefix_node =
569 local_gpe_event_info->dispatch.method_node; 579 gpe_event_info->dispatch.method_node;
570 info->flags = ACPI_IGNORE_RETURN_VALUE; 580 info->flags = ACPI_IGNORE_RETURN_VALUE;
571 581
572 status = acpi_ns_evaluate(info); 582 status = acpi_ns_evaluate(info);
@@ -576,25 +586,27 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
576 if (ACPI_FAILURE(status)) { 586 if (ACPI_FAILURE(status)) {
577 ACPI_EXCEPTION((AE_INFO, status, 587 ACPI_EXCEPTION((AE_INFO, status,
578 "while evaluating GPE method [%4.4s]", 588 "while evaluating GPE method [%4.4s]",
579 acpi_ut_get_node_name 589 acpi_ut_get_node_name(gpe_event_info->
580 (local_gpe_event_info->dispatch. 590 dispatch.
581 method_node))); 591 method_node)));
582 } 592 }
583 break; 593 break;
584 594
585 default: 595 default:
586 596
587 return_VOID; /* Should never happen */ 597 goto error_exit; /* Should never happen */
588 } 598 }
589 599
590 /* Defer enabling of GPE until all notify handlers are done */ 600 /* Defer enabling of GPE until all notify handlers are done */
591 601
592 status = acpi_os_execute(OSL_NOTIFY_HANDLER, 602 status = acpi_os_execute(OSL_NOTIFY_HANDLER,
593 acpi_ev_asynch_enable_gpe, 603 acpi_ev_asynch_enable_gpe, gpe_event_info);
594 local_gpe_event_info); 604 if (ACPI_SUCCESS(status)) {
595 if (ACPI_FAILURE(status)) { 605 return_VOID;
596 ACPI_FREE(local_gpe_event_info);
597 } 606 }
607
608error_exit:
609 acpi_ev_asynch_enable_gpe(gpe_event_info);
598 return_VOID; 610 return_VOID;
599} 611}
600 612
@@ -622,7 +634,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_enable_gpe(void *context)
622 (void)acpi_ev_finish_gpe(gpe_event_info); 634 (void)acpi_ev_finish_gpe(gpe_event_info);
623 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 635 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
624 636
625 ACPI_FREE(gpe_event_info);
626 return; 637 return;
627} 638}
628 639
@@ -692,15 +703,6 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
692 703
693 ACPI_FUNCTION_TRACE(ev_gpe_dispatch); 704 ACPI_FUNCTION_TRACE(ev_gpe_dispatch);
694 705
695 /* Invoke global event handler if present */
696
697 acpi_gpe_count++;
698 if (acpi_gbl_global_event_handler) {
699 acpi_gbl_global_event_handler(ACPI_EVENT_TYPE_GPE, gpe_device,
700 gpe_number,
701 acpi_gbl_global_event_handler_context);
702 }
703
704 /* 706 /*
705 * Always disable the GPE so that it does not keep firing before 707 * Always disable the GPE so that it does not keep firing before
706 * any asynchronous activity completes (either from the execution 708 * any asynchronous activity completes (either from the execution
@@ -741,7 +743,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
741 * If there is neither a handler nor a method, leave the GPE 743 * If there is neither a handler nor a method, leave the GPE
742 * disabled. 744 * disabled.
743 */ 745 */
744 switch (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) { 746 switch (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags)) {
745 case ACPI_GPE_DISPATCH_HANDLER: 747 case ACPI_GPE_DISPATCH_HANDLER:
746 748
747 /* Invoke the installed handler (at interrupt level) */ 749 /* Invoke the installed handler (at interrupt level) */
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index d86699eea33c..e0f24c504513 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -474,10 +474,12 @@ acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
474 * Ignore GPEs that have no corresponding _Lxx/_Exx method 474 * Ignore GPEs that have no corresponding _Lxx/_Exx method
475 * and GPEs that are used to wake the system 475 * and GPEs that are used to wake the system
476 */ 476 */
477 if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 477 if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
478 ACPI_GPE_DISPATCH_NONE) 478 ACPI_GPE_DISPATCH_NONE)
479 || ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) 479 || (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
480 == ACPI_GPE_DISPATCH_HANDLER) 480 ACPI_GPE_DISPATCH_HANDLER)
481 || (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
482 ACPI_GPE_DISPATCH_RAW_HANDLER)
481 || (gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) { 483 || (gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
482 continue; 484 continue;
483 } 485 }
diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c
index 7be928379879..8840296d5b20 100644
--- a/drivers/acpi/acpica/evgpeinit.c
+++ b/drivers/acpi/acpica/evgpeinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -401,15 +401,17 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,
401 return_ACPI_STATUS(AE_OK); 401 return_ACPI_STATUS(AE_OK);
402 } 402 }
403 403
404 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 404 if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
405 ACPI_GPE_DISPATCH_HANDLER) { 405 ACPI_GPE_DISPATCH_HANDLER) ||
406 (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
407 ACPI_GPE_DISPATCH_RAW_HANDLER)) {
406 408
407 /* If there is already a handler, ignore this GPE method */ 409 /* If there is already a handler, ignore this GPE method */
408 410
409 return_ACPI_STATUS(AE_OK); 411 return_ACPI_STATUS(AE_OK);
410 } 412 }
411 413
412 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 414 if (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
413 ACPI_GPE_DISPATCH_METHOD) { 415 ACPI_GPE_DISPATCH_METHOD) {
414 /* 416 /*
415 * If there is already a method, ignore this method. But check 417 * If there is already a method, ignore this method. But check
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c
index 17e4bbfdb096..3a958f3612fe 100644
--- a/drivers/acpi/acpica/evgpeutil.c
+++ b/drivers/acpi/acpica/evgpeutil.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -108,53 +108,6 @@ unlock_and_exit:
108 108
109/******************************************************************************* 109/*******************************************************************************
110 * 110 *
111 * FUNCTION: acpi_ev_valid_gpe_event
112 *
113 * PARAMETERS: gpe_event_info - Info for this GPE
114 *
115 * RETURN: TRUE if the gpe_event is valid
116 *
117 * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
118 * Should be called only when the GPE lists are semaphore locked
119 * and not subject to change.
120 *
121 ******************************************************************************/
122
123u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
124{
125 struct acpi_gpe_xrupt_info *gpe_xrupt_block;
126 struct acpi_gpe_block_info *gpe_block;
127
128 ACPI_FUNCTION_ENTRY();
129
130 /* No need for spin lock since we are not changing any list elements */
131
132 /* Walk the GPE interrupt levels */
133
134 gpe_xrupt_block = acpi_gbl_gpe_xrupt_list_head;
135 while (gpe_xrupt_block) {
136 gpe_block = gpe_xrupt_block->gpe_block_list_head;
137
138 /* Walk the GPE blocks on this interrupt level */
139
140 while (gpe_block) {
141 if ((&gpe_block->event_info[0] <= gpe_event_info) &&
142 (&gpe_block->event_info[gpe_block->gpe_count] >
143 gpe_event_info)) {
144 return (TRUE);
145 }
146
147 gpe_block = gpe_block->next;
148 }
149
150 gpe_xrupt_block = gpe_xrupt_block->next;
151 }
152
153 return (FALSE);
154}
155
156/*******************************************************************************
157 *
158 * FUNCTION: acpi_ev_get_gpe_device 111 * FUNCTION: acpi_ev_get_gpe_device
159 * 112 *
160 * PARAMETERS: GPE_WALK_CALLBACK 113 * PARAMETERS: GPE_WALK_CALLBACK
@@ -371,8 +324,10 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
371 ACPI_GPE_REGISTER_WIDTH) 324 ACPI_GPE_REGISTER_WIDTH)
372 + j]; 325 + j];
373 326
374 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 327 if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
375 ACPI_GPE_DISPATCH_HANDLER) { 328 ACPI_GPE_DISPATCH_HANDLER) ||
329 (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
330 ACPI_GPE_DISPATCH_RAW_HANDLER)) {
376 331
377 /* Delete an installed handler block */ 332 /* Delete an installed handler block */
378 333
@@ -380,10 +335,8 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
380 gpe_event_info->dispatch.handler = NULL; 335 gpe_event_info->dispatch.handler = NULL;
381 gpe_event_info->flags &= 336 gpe_event_info->flags &=
382 ~ACPI_GPE_DISPATCH_MASK; 337 ~ACPI_GPE_DISPATCH_MASK;
383 } else 338 } else if (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags)
384 if ((gpe_event_info-> 339 == ACPI_GPE_DISPATCH_NOTIFY) {
385 flags & ACPI_GPE_DISPATCH_MASK) ==
386 ACPI_GPE_DISPATCH_NOTIFY) {
387 340
388 /* Delete the implicit notification device list */ 341 /* Delete the implicit notification device list */
389 342
diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c
index 78ac29351c9e..74e8595f5a2b 100644
--- a/drivers/acpi/acpica/evhandler.c
+++ b/drivers/acpi/acpica/evhandler.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c
index 24ea3424981b..f7c9dfe7b990 100644
--- a/drivers/acpi/acpica/evmisc.c
+++ b/drivers/acpi/acpica/evmisc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 8eb8575e8c16..9abace3401f9 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 1b148a440d67..da323390bb70 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c
index 29630e303829..0366703d2970 100644
--- a/drivers/acpi/acpica/evsci.c
+++ b/drivers/acpi/acpica/evsci.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c
index 55a58f3ec8df..81f2d9e87fad 100644
--- a/drivers/acpi/acpica/evxface.c
+++ b/drivers/acpi/acpica/evxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,16 @@
51 51
52#define _COMPONENT ACPI_EVENTS 52#define _COMPONENT ACPI_EVENTS
53ACPI_MODULE_NAME("evxface") 53ACPI_MODULE_NAME("evxface")
54#if (!ACPI_REDUCED_HARDWARE)
55/* Local prototypes */
56static acpi_status
57acpi_ev_install_gpe_handler(acpi_handle gpe_device,
58 u32 gpe_number,
59 u32 type,
60 u8 is_raw_handler,
61 acpi_gpe_handler address, void *context);
62
63#endif
54 64
55 65
56/******************************************************************************* 66/*******************************************************************************
@@ -76,6 +86,7 @@ ACPI_MODULE_NAME("evxface")
76 * handlers. 86 * handlers.
77 * 87 *
78 ******************************************************************************/ 88 ******************************************************************************/
89
79acpi_status 90acpi_status
80acpi_install_notify_handler(acpi_handle device, 91acpi_install_notify_handler(acpi_handle device,
81 u32 handler_type, 92 u32 handler_type,
@@ -717,32 +728,37 @@ ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler)
717 728
718/******************************************************************************* 729/*******************************************************************************
719 * 730 *
720 * FUNCTION: acpi_install_gpe_handler 731 * FUNCTION: acpi_ev_install_gpe_handler
721 * 732 *
722 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT 733 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
723 * defined GPEs) 734 * defined GPEs)
724 * gpe_number - The GPE number within the GPE block 735 * gpe_number - The GPE number within the GPE block
725 * type - Whether this GPE should be treated as an 736 * type - Whether this GPE should be treated as an
726 * edge- or level-triggered interrupt. 737 * edge- or level-triggered interrupt.
738 * is_raw_handler - Whether this GPE should be handled using
739 * the special GPE handler mode.
727 * address - Address of the handler 740 * address - Address of the handler
728 * context - Value passed to the handler on each GPE 741 * context - Value passed to the handler on each GPE
729 * 742 *
730 * RETURN: Status 743 * RETURN: Status
731 * 744 *
732 * DESCRIPTION: Install a handler for a General Purpose Event. 745 * DESCRIPTION: Internal function to install a handler for a General Purpose
746 * Event.
733 * 747 *
734 ******************************************************************************/ 748 ******************************************************************************/
735acpi_status 749static acpi_status
736acpi_install_gpe_handler(acpi_handle gpe_device, 750acpi_ev_install_gpe_handler(acpi_handle gpe_device,
737 u32 gpe_number, 751 u32 gpe_number,
738 u32 type, acpi_gpe_handler address, void *context) 752 u32 type,
753 u8 is_raw_handler,
754 acpi_gpe_handler address, void *context)
739{ 755{
740 struct acpi_gpe_event_info *gpe_event_info; 756 struct acpi_gpe_event_info *gpe_event_info;
741 struct acpi_gpe_handler_info *handler; 757 struct acpi_gpe_handler_info *handler;
742 acpi_status status; 758 acpi_status status;
743 acpi_cpu_flags flags; 759 acpi_cpu_flags flags;
744 760
745 ACPI_FUNCTION_TRACE(acpi_install_gpe_handler); 761 ACPI_FUNCTION_TRACE(ev_install_gpe_handler);
746 762
747 /* Parameter validation */ 763 /* Parameter validation */
748 764
@@ -775,8 +791,10 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
775 791
776 /* Make sure that there isn't a handler there already */ 792 /* Make sure that there isn't a handler there already */
777 793
778 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 794 if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
779 ACPI_GPE_DISPATCH_HANDLER) { 795 ACPI_GPE_DISPATCH_HANDLER) ||
796 (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
797 ACPI_GPE_DISPATCH_RAW_HANDLER)) {
780 status = AE_ALREADY_EXISTS; 798 status = AE_ALREADY_EXISTS;
781 goto free_and_exit; 799 goto free_and_exit;
782 } 800 }
@@ -793,9 +811,10 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
793 * automatically during initialization, in which case it has to be 811 * automatically during initialization, in which case it has to be
794 * disabled now to avoid spurious execution of the handler. 812 * disabled now to avoid spurious execution of the handler.
795 */ 813 */
796 if (((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) || 814 if (((ACPI_GPE_DISPATCH_TYPE(handler->original_flags) ==
797 (handler->original_flags & ACPI_GPE_DISPATCH_NOTIFY)) && 815 ACPI_GPE_DISPATCH_METHOD) ||
798 gpe_event_info->runtime_count) { 816 (ACPI_GPE_DISPATCH_TYPE(handler->original_flags) ==
817 ACPI_GPE_DISPATCH_NOTIFY)) && gpe_event_info->runtime_count) {
799 handler->originally_enabled = TRUE; 818 handler->originally_enabled = TRUE;
800 (void)acpi_ev_remove_gpe_reference(gpe_event_info); 819 (void)acpi_ev_remove_gpe_reference(gpe_event_info);
801 820
@@ -816,7 +835,10 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
816 835
817 gpe_event_info->flags &= 836 gpe_event_info->flags &=
818 ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); 837 ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
819 gpe_event_info->flags |= (u8)(type | ACPI_GPE_DISPATCH_HANDLER); 838 gpe_event_info->flags |=
839 (u8)(type |
840 (is_raw_handler ? ACPI_GPE_DISPATCH_RAW_HANDLER :
841 ACPI_GPE_DISPATCH_HANDLER));
820 842
821 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 843 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
822 844
@@ -830,10 +852,78 @@ free_and_exit:
830 goto unlock_and_exit; 852 goto unlock_and_exit;
831} 853}
832 854
855/*******************************************************************************
856 *
857 * FUNCTION: acpi_install_gpe_handler
858 *
859 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
860 * defined GPEs)
861 * gpe_number - The GPE number within the GPE block
862 * type - Whether this GPE should be treated as an
863 * edge- or level-triggered interrupt.
864 * address - Address of the handler
865 * context - Value passed to the handler on each GPE
866 *
867 * RETURN: Status
868 *
869 * DESCRIPTION: Install a handler for a General Purpose Event.
870 *
871 ******************************************************************************/
872
873acpi_status
874acpi_install_gpe_handler(acpi_handle gpe_device,
875 u32 gpe_number,
876 u32 type, acpi_gpe_handler address, void *context)
877{
878 acpi_status status;
879
880 ACPI_FUNCTION_TRACE(acpi_install_gpe_handler);
881
882 status =
883 acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, FALSE,
884 address, context);
885
886 return_ACPI_STATUS(status);
887}
888
833ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) 889ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler)
834 890
835/******************************************************************************* 891/*******************************************************************************
836 * 892 *
893 * FUNCTION: acpi_install_gpe_raw_handler
894 *
895 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
896 * defined GPEs)
897 * gpe_number - The GPE number within the GPE block
898 * type - Whether this GPE should be treated as an
899 * edge- or level-triggered interrupt.
900 * address - Address of the handler
901 * context - Value passed to the handler on each GPE
902 *
903 * RETURN: Status
904 *
905 * DESCRIPTION: Install a handler for a General Purpose Event.
906 *
907 ******************************************************************************/
908acpi_status
909acpi_install_gpe_raw_handler(acpi_handle gpe_device,
910 u32 gpe_number,
911 u32 type, acpi_gpe_handler address, void *context)
912{
913 acpi_status status;
914
915 ACPI_FUNCTION_TRACE(acpi_install_gpe_raw_handler);
916
917 status = acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, TRUE,
918 address, context);
919
920 return_ACPI_STATUS(status);
921}
922
923ACPI_EXPORT_SYMBOL(acpi_install_gpe_raw_handler)
924
925/*******************************************************************************
926 *
837 * FUNCTION: acpi_remove_gpe_handler 927 * FUNCTION: acpi_remove_gpe_handler
838 * 928 *
839 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT 929 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
@@ -880,8 +970,10 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
880 970
881 /* Make sure that a handler is indeed installed */ 971 /* Make sure that a handler is indeed installed */
882 972
883 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != 973 if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) !=
884 ACPI_GPE_DISPATCH_HANDLER) { 974 ACPI_GPE_DISPATCH_HANDLER) &&
975 (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) !=
976 ACPI_GPE_DISPATCH_RAW_HANDLER)) {
885 status = AE_NOT_EXIST; 977 status = AE_NOT_EXIST;
886 goto unlock_and_exit; 978 goto unlock_and_exit;
887 } 979 }
@@ -896,6 +988,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
896 /* Remove the handler */ 988 /* Remove the handler */
897 989
898 handler = gpe_event_info->dispatch.handler; 990 handler = gpe_event_info->dispatch.handler;
991 gpe_event_info->dispatch.handler = NULL;
899 992
900 /* Restore Method node (if any), set dispatch flags */ 993 /* Restore Method node (if any), set dispatch flags */
901 994
@@ -909,9 +1002,10 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
909 * enabled, it should be enabled at this point to restore the 1002 * enabled, it should be enabled at this point to restore the
910 * post-initialization configuration. 1003 * post-initialization configuration.
911 */ 1004 */
912 if (((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) || 1005 if (((ACPI_GPE_DISPATCH_TYPE(handler->original_flags) ==
913 (handler->original_flags & ACPI_GPE_DISPATCH_NOTIFY)) && 1006 ACPI_GPE_DISPATCH_METHOD) ||
914 handler->originally_enabled) { 1007 (ACPI_GPE_DISPATCH_TYPE(handler->original_flags) ==
1008 ACPI_GPE_DISPATCH_NOTIFY)) && handler->originally_enabled) {
915 (void)acpi_ev_add_gpe_reference(gpe_event_info); 1009 (void)acpi_ev_add_gpe_reference(gpe_event_info);
916 } 1010 }
917 1011
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index bb8cbf5961bf..df06a23c4197 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c
index e889a5304abd..70eb47e3d724 100644
--- a/drivers/acpi/acpica/evxfgpe.c
+++ b/drivers/acpi/acpica/evxfgpe.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -132,7 +132,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
132 */ 132 */
133 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); 133 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
134 if (gpe_event_info) { 134 if (gpe_event_info) {
135 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != 135 if (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) !=
136 ACPI_GPE_DISPATCH_NONE) { 136 ACPI_GPE_DISPATCH_NONE) {
137 status = acpi_ev_add_gpe_reference(gpe_event_info); 137 status = acpi_ev_add_gpe_reference(gpe_event_info);
138 } else { 138 } else {
@@ -183,6 +183,77 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
183 183
184ACPI_EXPORT_SYMBOL(acpi_disable_gpe) 184ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
185 185
186/*******************************************************************************
187 *
188 * FUNCTION: acpi_set_gpe
189 *
190 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
191 * gpe_number - GPE level within the GPE block
192 * action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE
193 *
194 * RETURN: Status
195 *
196 * DESCRIPTION: Enable or disable an individual GPE. This function bypasses
197 * the reference count mechanism used in the acpi_enable_gpe(),
198 * acpi_disable_gpe() interfaces.
199 * This API is typically used by the GPE raw handler mode driver
200 * to switch between the polling mode and the interrupt mode after
201 * the driver has enabled the GPE.
202 * The APIs should be invoked in this order:
203 * acpi_enable_gpe() <- Ensure the reference count > 0
204 * acpi_set_gpe(ACPI_GPE_DISABLE) <- Enter polling mode
205 * acpi_set_gpe(ACPI_GPE_ENABLE) <- Leave polling mode
206 * acpi_disable_gpe() <- Decrease the reference count
207 *
208 * Note: If a GPE is shared by 2 silicon components, then both the drivers
209 * should support GPE polling mode or disabling the GPE for long period
210 * for one driver may break the other. So use it with care since all
211 * firmware _Lxx/_Exx handlers currently rely on the GPE interrupt mode.
212 *
213 ******************************************************************************/
214acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action)
215{
216 struct acpi_gpe_event_info *gpe_event_info;
217 acpi_status status;
218 acpi_cpu_flags flags;
219
220 ACPI_FUNCTION_TRACE(acpi_set_gpe);
221
222 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
223
224 /* Ensure that we have a valid GPE number */
225
226 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
227 if (!gpe_event_info) {
228 status = AE_BAD_PARAMETER;
229 goto unlock_and_exit;
230 }
231
232 /* Perform the action */
233
234 switch (action) {
235 case ACPI_GPE_ENABLE:
236
237 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
238 break;
239
240 case ACPI_GPE_DISABLE:
241
242 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE);
243 break;
244
245 default:
246
247 status = AE_BAD_PARAMETER;
248 break;
249 }
250
251unlock_and_exit:
252 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
253 return_ACPI_STATUS(status);
254}
255
256ACPI_EXPORT_SYMBOL(acpi_set_gpe)
186 257
187/******************************************************************************* 258/*******************************************************************************
188 * 259 *
@@ -313,7 +384,7 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device,
313 * known as an "implicit notify". Note: The GPE is assumed to be 384 * known as an "implicit notify". Note: The GPE is assumed to be
314 * level-triggered (for windows compatibility). 385 * level-triggered (for windows compatibility).
315 */ 386 */
316 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 387 if (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
317 ACPI_GPE_DISPATCH_NONE) { 388 ACPI_GPE_DISPATCH_NONE) {
318 /* 389 /*
319 * This is the first device for implicit notify on this GPE. 390 * This is the first device for implicit notify on this GPE.
@@ -327,7 +398,7 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device,
327 * If we already have an implicit notify on this GPE, add 398 * If we already have an implicit notify on this GPE, add
328 * this device to the notify list. 399 * this device to the notify list.
329 */ 400 */
330 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 401 if (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
331 ACPI_GPE_DISPATCH_NOTIFY) { 402 ACPI_GPE_DISPATCH_NOTIFY) {
332 403
333 /* Ensure that the device is not already in the list */ 404 /* Ensure that the device is not already in the list */
@@ -530,6 +601,49 @@ unlock_and_exit:
530 601
531ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) 602ACPI_EXPORT_SYMBOL(acpi_get_gpe_status)
532 603
604/*******************************************************************************
605 *
606 * FUNCTION: acpi_finish_gpe
607 *
608 * PARAMETERS: gpe_device - Namespace node for the GPE Block
609 * (NULL for FADT defined GPEs)
610 * gpe_number - GPE level within the GPE block
611 *
612 * RETURN: Status
613 *
614 * DESCRIPTION: Clear and conditionally reenable a GPE. This completes the GPE
615 * processing. Intended for use by asynchronous host-installed
616 * GPE handlers. The GPE is only reenabled if the enable_for_run bit
617 * is set in the GPE info.
618 *
619 ******************************************************************************/
620acpi_status acpi_finish_gpe(acpi_handle gpe_device, u32 gpe_number)
621{
622 struct acpi_gpe_event_info *gpe_event_info;
623 acpi_status status;
624 acpi_cpu_flags flags;
625
626 ACPI_FUNCTION_TRACE(acpi_finish_gpe);
627
628 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
629
630 /* Ensure that we have a valid GPE number */
631
632 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
633 if (!gpe_event_info) {
634 status = AE_BAD_PARAMETER;
635 goto unlock_and_exit;
636 }
637
638 status = acpi_ev_finish_gpe(gpe_event_info);
639
640unlock_and_exit:
641 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
642 return_ACPI_STATUS(status);
643}
644
645ACPI_EXPORT_SYMBOL(acpi_finish_gpe)
646
533/****************************************************************************** 647/******************************************************************************
534 * 648 *
535 * FUNCTION: acpi_disable_all_gpes 649 * FUNCTION: acpi_disable_all_gpes
@@ -604,7 +718,6 @@ ACPI_EXPORT_SYMBOL(acpi_enable_all_runtime_gpes)
604 * all GPE blocks. 718 * all GPE blocks.
605 * 719 *
606 ******************************************************************************/ 720 ******************************************************************************/
607
608acpi_status acpi_enable_all_wakeup_gpes(void) 721acpi_status acpi_enable_all_wakeup_gpes(void)
609{ 722{
610 acpi_status status; 723 acpi_status status;
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c
index 2d6f187939c7..f21afbab03f7 100644
--- a/drivers/acpi/acpica/evxfregn.c
+++ b/drivers/acpi/acpica/evxfregn.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c
index 7d2949420db7..6e0df2b9d5a4 100644
--- a/drivers/acpi/acpica/exconfig.c
+++ b/drivers/acpi/acpica/exconfig.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index c545386fee96..89a976b4ccf2 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c
index 95d23dabcfbb..aaeea4840aaa 100644
--- a/drivers/acpi/acpica/excreate.c
+++ b/drivers/acpi/acpica/excreate.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c
index 6fbfad47518c..e67d0aca3fe6 100644
--- a/drivers/acpi/acpica/exdebug.c
+++ b/drivers/acpi/acpica/exdebug.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index 0f23c3f2678e..7c213b6b6472 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index b994845ed359..c161dd974f74 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index 1d1b27a96c5b..49479927e7f7 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c
index 2207e624f538..b56fc9d6f48e 100644
--- a/drivers/acpi/acpica/exmisc.c
+++ b/drivers/acpi/acpica/exmisc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c
index b49ea2a95f4f..472030f2b5bb 100644
--- a/drivers/acpi/acpica/exmutex.c
+++ b/drivers/acpi/acpica/exmutex.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exnames.c b/drivers/acpi/acpica/exnames.c
index dbb03b544e8c..453b00c30177 100644
--- a/drivers/acpi/acpica/exnames.c
+++ b/drivers/acpi/acpica/exnames.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c
index 1b8e94104407..77930683ab7d 100644
--- a/drivers/acpi/acpica/exoparg1.c
+++ b/drivers/acpi/acpica/exoparg1.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c
index 2ede656ee26a..fcc618aa2061 100644
--- a/drivers/acpi/acpica/exoparg2.c
+++ b/drivers/acpi/acpica/exoparg2.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c
index 363767cf01e5..b813fed95e56 100644
--- a/drivers/acpi/acpica/exoparg3.c
+++ b/drivers/acpi/acpica/exoparg3.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c
index 29e9e99f7fe3..c930edda3f65 100644
--- a/drivers/acpi/acpica/exoparg6.c
+++ b/drivers/acpi/acpica/exoparg6.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index 118e942005e5..4c2836dc825b 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c
index cd5288a257a9..0fe188e238ef 100644
--- a/drivers/acpi/acpica/exregion.c
+++ b/drivers/acpi/acpica/exregion.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c
index ab060261b43e..c7e3b929aa85 100644
--- a/drivers/acpi/acpica/exresnte.c
+++ b/drivers/acpi/acpica/exresnte.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c
index 3cde553bcbe1..b6b7f3af29e4 100644
--- a/drivers/acpi/acpica/exresolv.c
+++ b/drivers/acpi/acpica/exresolv.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c
index 3af8de3fcea4..d2964af9ad4d 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
index daf49f7ea311..a7eee2400ce0 100644
--- a/drivers/acpi/acpica/exstore.c
+++ b/drivers/acpi/acpica/exstore.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c
index 04bd16c08f9e..3101607b4efe 100644
--- a/drivers/acpi/acpica/exstoren.c
+++ b/drivers/acpi/acpica/exstoren.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c
index fd11018b0168..6fa3c8d8fc5f 100644
--- a/drivers/acpi/acpica/exstorob.c
+++ b/drivers/acpi/acpica/exstorob.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c
index f7da64123ed5..05450656fe3d 100644
--- a/drivers/acpi/acpica/exsystem.c
+++ b/drivers/acpi/acpica/exsystem.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index d9d72dff2a76..3f4225e95d93 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c
index 1e66d960fc11..e5c5949f9081 100644
--- a/drivers/acpi/acpica/hwacpi.c
+++ b/drivers/acpi/acpica/hwacpi.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 858fdd6be598..e5599f610808 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index 494027f5c067..84bc550f4f1d 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -54,6 +54,10 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
54 struct acpi_gpe_block_info *gpe_block, 54 struct acpi_gpe_block_info *gpe_block,
55 void *context); 55 void *context);
56 56
57static acpi_status
58acpi_hw_gpe_enable_write(u8 enable_mask,
59 struct acpi_gpe_register_info *gpe_register_info);
60
57/****************************************************************************** 61/******************************************************************************
58 * 62 *
59 * FUNCTION: acpi_hw_get_gpe_register_bit 63 * FUNCTION: acpi_hw_get_gpe_register_bit
@@ -146,7 +150,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
146 150
147 status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); 151 status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address);
148 if (ACPI_SUCCESS(status) && (action & ACPI_GPE_SAVE_MASK)) { 152 if (ACPI_SUCCESS(status) && (action & ACPI_GPE_SAVE_MASK)) {
149 gpe_register_info->enable_mask = enable_mask; 153 gpe_register_info->enable_mask = (u8)enable_mask;
150 } 154 }
151 return (status); 155 return (status);
152} 156}
@@ -221,7 +225,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
221 225
222 /* GPE currently handled? */ 226 /* GPE currently handled? */
223 227
224 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != 228 if (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) !=
225 ACPI_GPE_DISPATCH_NONE) { 229 ACPI_GPE_DISPATCH_NONE) {
226 local_event_status |= ACPI_EVENT_FLAG_HAS_HANDLER; 230 local_event_status |= ACPI_EVENT_FLAG_HAS_HANDLER;
227 } 231 }
diff --git a/drivers/acpi/acpica/hwpci.c b/drivers/acpi/acpica/hwpci.c
index 6aade8e1d2a1..c5214dec4988 100644
--- a/drivers/acpi/acpica/hwpci.c
+++ b/drivers/acpi/acpica/hwpci.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index a4c34d2c556b..3cf77afd142c 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index d590693eb54e..7d21cae6d602 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c
index 76ab5c1a814e..675c709a300b 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c
index 6b919127cd9d..2bd33fe56cb3 100644
--- a/drivers/acpi/acpica/hwvalid.c
+++ b/drivers/acpi/acpica/hwvalid.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index 96d007df65ec..5f97468df8ff 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index 6921c7f3d208..3b3767698827 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index f1249e3463be..24fa19a76d70 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index 607eb9e5150d..e107f929d9cf 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsarguments.c b/drivers/acpi/acpica/nsarguments.c
index 80fcfc8c9c1b..5d347a71bd0b 100644
--- a/drivers/acpi/acpica/nsarguments.c
+++ b/drivers/acpi/acpica/nsarguments.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsconvert.c b/drivers/acpi/acpica/nsconvert.c
index b55642c4ee58..1a8b39c8d969 100644
--- a/drivers/acpi/acpica/nsconvert.c
+++ b/drivers/acpi/acpica/nsconvert.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index 3d88ef4a3e0d..80f097eb7381 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c
index 42d37109aa5d..7dc367e6fe09 100644
--- a/drivers/acpi/acpica/nsdumpdv.c
+++ b/drivers/acpi/acpica/nsdumpdv.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c
index e634a05974db..7bcc68f57afa 100644
--- a/drivers/acpi/acpica/nseval.c
+++ b/drivers/acpi/acpica/nseval.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index a3fb7e4c0809..4a85c4517988 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c
index 7c9d0181f341..bd6cd4a81316 100644
--- a/drivers/acpi/acpica/nsload.c
+++ b/drivers/acpi/acpica/nsload.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index 7eee0a6f02f6..d293d9748036 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c
index a42ee9d6970d..677bc9330e64 100644
--- a/drivers/acpi/acpica/nsobject.c
+++ b/drivers/acpi/acpica/nsobject.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c
index e83cff31754b..c95a119767b5 100644
--- a/drivers/acpi/acpica/nsparse.c
+++ b/drivers/acpi/acpica/nsparse.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 392910ffbed9..0eb54315b4be 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c
index 1b13b921dda9..8b79958b7aca 100644
--- a/drivers/acpi/acpica/nsprepkg.c
+++ b/drivers/acpi/acpica/nsprepkg.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
index 7e417aa5c91e..151fcd95ba84 100644
--- a/drivers/acpi/acpica/nsrepair.c
+++ b/drivers/acpi/acpica/nsrepair.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index b09e6bef72b8..c30672d23878 100644
--- a/drivers/acpi/acpica/nsrepair2.c
+++ b/drivers/acpi/acpica/nsrepair2.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index af1cc42a8aa1..4a9d4a66016e 100644
--- a/drivers/acpi/acpica/nssearch.c
+++ b/drivers/acpi/acpica/nssearch.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index 4a5e3f5c0ff7..6ad02008c0c2 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c
index 4758a1f2ce22..c68609a2bc1b 100644
--- a/drivers/acpi/acpica/nswalk.c
+++ b/drivers/acpi/acpica/nswalk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index 4bd558bf10d2..b6030a2deee1 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index 8c6c11ce9760..d66c326485d8 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c
index dae9401be7a2..793383501f81 100644
--- a/drivers/acpi/acpica/nsxfobj.c
+++ b/drivers/acpi/acpica/nsxfobj.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2014, Intel Corp. 9 * Copyright (C) 2000 - 2015, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -53,50 +53,6 @@ ACPI_MODULE_NAME("nsxfobj")
53 53
54/******************************************************************************* 54/*******************************************************************************
55 * 55 *
56 * FUNCTION: acpi_get_id
57 *
58 * PARAMETERS: Handle - Handle of object whose id is desired
59 * ret_id - Where the id will be placed
60 *
61 * RETURN: Status
62 *
63 * DESCRIPTION: This routine returns the owner id associated with a handle
64 *
65 ******************************************************************************/
66acpi_status acpi_get_id(acpi_handle handle, acpi_owner_id * ret_id)
67{
68 struct acpi_namespace_node *node;
69 acpi_status status;
70
71 /* Parameter Validation */
72
73 if (!ret_id) {
74 return (AE_BAD_PARAMETER);
75 }
76
77 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
78 if (ACPI_FAILURE(status)) {
79 return (status);
80 }
81
82 /* Convert and validate the handle */
83
84 node = acpi_ns_validate_handle(handle);
85 if (!node) {
86 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
87 return (AE_BAD_PARAMETER);
88 }
89
90 *ret_id = node->owner_id;
91
92 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
93 return (status);
94}
95
96ACPI_EXPORT_SYMBOL(acpi_get_id)
97
98/*******************************************************************************
99 *
100 * FUNCTION: acpi_get_type 56 * FUNCTION: acpi_get_type
101 * 57 *
102 * PARAMETERS: handle - Handle of object whose type is desired 58 * PARAMETERS: handle - Handle of object whose type is desired
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index 314d314340ae..6d038770577b 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c
index b058e2390fdd..90437227d790 100644
--- a/drivers/acpi/acpica/psloop.c
+++ b/drivers/acpi/acpica/psloop.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.c
index a6885077d59e..2f5ddd806c58 100644
--- a/drivers/acpi/acpica/psobject.c
+++ b/drivers/acpi/acpica/psobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c
index 1755d2ac5656..1af4a405e351 100644
--- a/drivers/acpi/acpica/psopcode.c
+++ b/drivers/acpi/acpica/psopcode.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psopinfo.c b/drivers/acpi/acpica/psopinfo.c
index 0d8d37ffd04d..e18e7c47f482 100644
--- a/drivers/acpi/acpica/psopinfo.c
+++ b/drivers/acpi/acpica/psopinfo.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c
index 6d27b597394e..a555f7f7b9a2 100644
--- a/drivers/acpi/acpica/psparse.c
+++ b/drivers/acpi/acpica/psparse.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psscope.c b/drivers/acpi/acpica/psscope.c
index 32d250feea21..9d669cc6cb62 100644
--- a/drivers/acpi/acpica/psscope.c
+++ b/drivers/acpi/acpica/psscope.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/pstree.c b/drivers/acpi/acpica/pstree.c
index 0b64181e7720..89984f30addc 100644
--- a/drivers/acpi/acpica/pstree.c
+++ b/drivers/acpi/acpica/pstree.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index 3cd48802eede..960505ab409a 100644
--- a/drivers/acpi/acpica/psutils.c
+++ b/drivers/acpi/acpica/psutils.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c
index 9cb07e1e76d9..ba5f69171288 100644
--- a/drivers/acpi/acpica/pswalk.c
+++ b/drivers/acpi/acpica/pswalk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c
index e135acaa5e1c..841a5ea06094 100644
--- a/drivers/acpi/acpica/psxface.c
+++ b/drivers/acpi/acpica/psxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c
index 916fd095ff34..66d406e8fe36 100644
--- a/drivers/acpi/acpica/rsaddr.c
+++ b/drivers/acpi/acpica/rsaddr.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -74,7 +74,7 @@ struct acpi_rsconvert_info acpi_rs_convert_address16[5] = {
74 * Address Translation Offset 74 * Address Translation Offset
75 * Address Length 75 * Address Length
76 */ 76 */
77 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.address16.granularity), 77 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.address16.address.granularity),
78 AML_OFFSET(address16.granularity), 78 AML_OFFSET(address16.granularity),
79 5}, 79 5},
80 80
@@ -112,7 +112,7 @@ struct acpi_rsconvert_info acpi_rs_convert_address32[5] = {
112 * Address Translation Offset 112 * Address Translation Offset
113 * Address Length 113 * Address Length
114 */ 114 */
115 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.address32.granularity), 115 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.address32.address.granularity),
116 AML_OFFSET(address32.granularity), 116 AML_OFFSET(address32.granularity),
117 5}, 117 5},
118 118
@@ -150,7 +150,7 @@ struct acpi_rsconvert_info acpi_rs_convert_address64[5] = {
150 * Address Translation Offset 150 * Address Translation Offset
151 * Address Length 151 * Address Length
152 */ 152 */
153 {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.address64.granularity), 153 {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.address64.address.granularity),
154 AML_OFFSET(address64.granularity), 154 AML_OFFSET(address64.granularity),
155 5}, 155 5},
156 156
@@ -194,7 +194,8 @@ struct acpi_rsconvert_info acpi_rs_convert_ext_address64[5] = {
194 * Address Length 194 * Address Length
195 * Type-Specific Attribute 195 * Type-Specific Attribute
196 */ 196 */
197 {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.ext_address64.granularity), 197 {ACPI_RSC_MOVE64,
198 ACPI_RS_OFFSET(data.ext_address64.address.granularity),
198 AML_OFFSET(ext_address64.granularity), 199 AML_OFFSET(ext_address64.granularity),
199 6} 200 6}
200}; 201};
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c
index 689556744b03..cb739a694931 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index 049d9c22a0f9..15434e4c9b34 100644
--- a/drivers/acpi/acpica/rscreate.c
+++ b/drivers/acpi/acpica/rscreate.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c
index c3c56b5a9788..1539394c8c52 100644
--- a/drivers/acpi/acpica/rsdump.c
+++ b/drivers/acpi/acpica/rsdump.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsdumpinfo.c b/drivers/acpi/acpica/rsdumpinfo.c
index 2f9332d5c973..b29d9ec63d1b 100644
--- a/drivers/acpi/acpica/rsdumpinfo.c
+++ b/drivers/acpi/acpica/rsdumpinfo.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -183,15 +183,15 @@ struct acpi_rsdump_info acpi_rs_dump_address16[8] = {
183 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16), 183 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16),
184 "16-Bit WORD Address Space", NULL}, 184 "16-Bit WORD Address Space", NULL},
185 {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 185 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
186 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity", 186 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address.granularity),
187 NULL}, 187 "Granularity", NULL},
188 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum", 188 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address.minimum),
189 NULL}, 189 "Address Minimum", NULL},
190 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum", 190 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address.maximum),
191 NULL}, 191 "Address Maximum", NULL},
192 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset), 192 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address.translation_offset),
193 "Translation Offset", NULL}, 193 "Translation Offset", NULL},
194 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length), 194 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address.address_length),
195 "Address Length", NULL}, 195 "Address Length", NULL},
196 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL} 196 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL}
197}; 197};
@@ -200,15 +200,15 @@ struct acpi_rsdump_info acpi_rs_dump_address32[8] = {
200 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32), 200 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32),
201 "32-Bit DWORD Address Space", NULL}, 201 "32-Bit DWORD Address Space", NULL},
202 {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 202 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
203 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity", 203 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address.granularity),
204 NULL}, 204 "Granularity", NULL},
205 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum", 205 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address.minimum),
206 NULL}, 206 "Address Minimum", NULL},
207 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum", 207 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address.maximum),
208 NULL}, 208 "Address Maximum", NULL},
209 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset), 209 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address.translation_offset),
210 "Translation Offset", NULL}, 210 "Translation Offset", NULL},
211 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length), 211 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address.address_length),
212 "Address Length", NULL}, 212 "Address Length", NULL},
213 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL} 213 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL}
214}; 214};
@@ -217,15 +217,15 @@ struct acpi_rsdump_info acpi_rs_dump_address64[8] = {
217 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64), 217 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64),
218 "64-Bit QWORD Address Space", NULL}, 218 "64-Bit QWORD Address Space", NULL},
219 {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 219 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
220 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity", 220 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address.granularity),
221 NULL}, 221 "Granularity", NULL},
222 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum", 222 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address.minimum),
223 NULL}, 223 "Address Minimum", NULL},
224 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum", 224 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address.maximum),
225 NULL}, 225 "Address Maximum", NULL},
226 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset), 226 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address.translation_offset),
227 "Translation Offset", NULL}, 227 "Translation Offset", NULL},
228 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length), 228 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address.address_length),
229 "Address Length", NULL}, 229 "Address Length", NULL},
230 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL} 230 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL}
231}; 231};
@@ -234,15 +234,16 @@ struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = {
234 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64), 234 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64),
235 "64-Bit Extended Address Space", NULL}, 235 "64-Bit Extended Address Space", NULL},
236 {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 236 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
237 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity), 237 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address.granularity),
238 "Granularity", NULL}, 238 "Granularity", NULL},
239 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum), 239 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address.minimum),
240 "Address Minimum", NULL}, 240 "Address Minimum", NULL},
241 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum), 241 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address.maximum),
242 "Address Maximum", NULL}, 242 "Address Maximum", NULL},
243 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset), 243 {ACPI_RSD_UINT64,
244 ACPI_RSD_OFFSET(ext_address64.address.translation_offset),
244 "Translation Offset", NULL}, 245 "Translation Offset", NULL},
245 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length), 246 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address.address_length),
246 "Address Length", NULL}, 247 "Address Length", NULL},
247 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific), 248 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific),
248 "Type-Specific Attribute", NULL} 249 "Type-Specific Attribute", NULL}
diff --git a/drivers/acpi/acpica/rsinfo.c b/drivers/acpi/acpica/rsinfo.c
index 9d3f8a9a24bd..edecfc675979 100644
--- a/drivers/acpi/acpica/rsinfo.c
+++ b/drivers/acpi/acpica/rsinfo.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsio.c b/drivers/acpi/acpica/rsio.c
index 19d64873290a..5adba018bab0 100644
--- a/drivers/acpi/acpica/rsio.c
+++ b/drivers/acpi/acpica/rsio.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsirq.c b/drivers/acpi/acpica/rsirq.c
index 3461f7db26df..07cfa70a475b 100644
--- a/drivers/acpi/acpica/rsirq.c
+++ b/drivers/acpi/acpica/rsirq.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c
index 77291293af64..50d5be2ee062 100644
--- a/drivers/acpi/acpica/rslist.c
+++ b/drivers/acpi/acpica/rslist.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsmemory.c b/drivers/acpi/acpica/rsmemory.c
index eab4483ff5f8..c6b80862030e 100644
--- a/drivers/acpi/acpica/rsmemory.c
+++ b/drivers/acpi/acpica/rsmemory.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c
index 41eea4bc089c..1fe49d223663 100644
--- a/drivers/acpi/acpica/rsmisc.c
+++ b/drivers/acpi/acpica/rsmisc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsserial.c b/drivers/acpi/acpica/rsserial.c
index 9e8407223d95..4c8c6fe6ea74 100644
--- a/drivers/acpi/acpica/rsserial.c
+++ b/drivers/acpi/acpica/rsserial.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index 897a5ceb0420..ece3cd60cc6a 100644
--- a/drivers/acpi/acpica/rsutils.c
+++ b/drivers/acpi/acpica/rsutils.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c
index 877ab9202133..8e6276df0226 100644
--- a/drivers/acpi/acpica/rsxface.c
+++ b/drivers/acpi/acpica/rsxface.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -60,11 +60,11 @@ ACPI_MODULE_NAME("rsxface")
60 ACPI_COPY_FIELD(out, in, min_address_fixed); \ 60 ACPI_COPY_FIELD(out, in, min_address_fixed); \
61 ACPI_COPY_FIELD(out, in, max_address_fixed); \ 61 ACPI_COPY_FIELD(out, in, max_address_fixed); \
62 ACPI_COPY_FIELD(out, in, info); \ 62 ACPI_COPY_FIELD(out, in, info); \
63 ACPI_COPY_FIELD(out, in, granularity); \ 63 ACPI_COPY_FIELD(out, in, address.granularity); \
64 ACPI_COPY_FIELD(out, in, minimum); \ 64 ACPI_COPY_FIELD(out, in, address.minimum); \
65 ACPI_COPY_FIELD(out, in, maximum); \ 65 ACPI_COPY_FIELD(out, in, address.maximum); \
66 ACPI_COPY_FIELD(out, in, translation_offset); \ 66 ACPI_COPY_FIELD(out, in, address.translation_offset); \
67 ACPI_COPY_FIELD(out, in, address_length); \ 67 ACPI_COPY_FIELD(out, in, address.address_length); \
68 ACPI_COPY_FIELD(out, in, resource_source); 68 ACPI_COPY_FIELD(out, in, resource_source);
69/* Local prototypes */ 69/* Local prototypes */
70static acpi_status 70static acpi_status
diff --git a/drivers/acpi/acpica/tbdata.c b/drivers/acpi/acpica/tbdata.c
index f499c10ceb4a..6a144957aadd 100644
--- a/drivers/acpi/acpica/tbdata.c
+++ b/drivers/acpi/acpica/tbdata.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 41519a958083..7d2486005e3f 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c
index cb947700206c..0b879fcfef67 100644
--- a/drivers/acpi/acpica/tbfind.c
+++ b/drivers/acpi/acpica/tbfind.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 755b90c40ddf..9bad45e63a45 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c
index df3bb20ea325..ef16c06e5091 100644
--- a/drivers/acpi/acpica/tbprint.c
+++ b/drivers/acpi/acpica/tbprint.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 6b1ca9991b90..6559a58439c5 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 6482b0ded652..60e94f87f27a 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -265,45 +265,6 @@ ACPI_EXPORT_SYMBOL(acpi_get_table_header)
265 265
266/******************************************************************************* 266/*******************************************************************************
267 * 267 *
268 * FUNCTION: acpi_unload_table_id
269 *
270 * PARAMETERS: id - Owner ID of the table to be removed.
271 *
272 * RETURN: Status
273 *
274 * DESCRIPTION: This routine is used to force the unload of a table (by id)
275 *
276 ******************************************************************************/
277acpi_status acpi_unload_table_id(acpi_owner_id id)
278{
279 int i;
280 acpi_status status = AE_NOT_EXIST;
281
282 ACPI_FUNCTION_TRACE(acpi_unload_table_id);
283
284 /* Find table in the global table list */
285 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
286 if (id != acpi_gbl_root_table_list.tables[i].owner_id) {
287 continue;
288 }
289 /*
290 * Delete all namespace objects owned by this table. Note that these
291 * objects can appear anywhere in the namespace by virtue of the AML
292 * "Scope" operator. Thus, we need to track ownership by an ID, not
293 * simply a position within the hierarchy
294 */
295 acpi_tb_delete_namespace_by_owner(i);
296 status = acpi_tb_release_owner_id(i);
297 acpi_tb_set_table_loaded_flag(i, FALSE);
298 break;
299 }
300 return_ACPI_STATUS(status);
301}
302
303ACPI_EXPORT_SYMBOL(acpi_unload_table_id)
304
305/*******************************************************************************
306 *
307 * FUNCTION: acpi_get_table_with_size 268 * FUNCTION: acpi_get_table_with_size
308 * 269 *
309 * PARAMETERS: signature - ACPI signature of needed table 270 * PARAMETERS: signature - ACPI signature of needed table
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index ab5308b81aa8..aadb3002a2dd 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c
index 43a54af2b548..eac52cf14f1a 100644
--- a/drivers/acpi/acpica/tbxfroot.c
+++ b/drivers/acpi/acpica/tbxfroot.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c
index a1acec9d2ef3..1279f50da757 100644
--- a/drivers/acpi/acpica/utaddress.c
+++ b/drivers/acpi/acpica/utaddress.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c
index efac83c606dc..61d8f6d186d1 100644
--- a/drivers/acpi/acpica/utalloc.c
+++ b/drivers/acpi/acpica/utalloc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utbuffer.c b/drivers/acpi/acpica/utbuffer.c
index 038ea887f562..242bd071f007 100644
--- a/drivers/acpi/acpica/utbuffer.c
+++ b/drivers/acpi/acpica/utbuffer.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c
index 78fde0aac487..eacc5eee362e 100644
--- a/drivers/acpi/acpica/utcache.c
+++ b/drivers/acpi/acpica/utcache.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c
index ff601c0f7c7a..c37ec5035f4c 100644
--- a/drivers/acpi/acpica/utcopy.c
+++ b/drivers/acpi/acpica/utcopy.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index e516254c63b2..57078e3ea9b7 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index 40e923e675fc..988e23b7795c 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c
index a3516de213fa..71fce389fd48 100644
--- a/drivers/acpi/acpica/utdelete.c
+++ b/drivers/acpi/acpica/utdelete.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/uterror.c b/drivers/acpi/acpica/uterror.c
index 8e544d4688cd..9ef80f2828e3 100644
--- a/drivers/acpi/acpica/uterror.c
+++ b/drivers/acpi/acpica/uterror.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c
index 8fed1482d228..6c738fa0cd42 100644
--- a/drivers/acpi/acpica/uteval.c
+++ b/drivers/acpi/acpica/uteval.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utexcep.c b/drivers/acpi/acpica/utexcep.c
index 0403dcaabaf2..743a0ae9fb17 100644
--- a/drivers/acpi/acpica/utexcep.c
+++ b/drivers/acpi/acpica/utexcep.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utfileio.c b/drivers/acpi/acpica/utfileio.c
index 4e263a8cc6f0..7e1168be39fa 100644
--- a/drivers/acpi/acpica/utfileio.c
+++ b/drivers/acpi/acpica/utfileio.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index 77ceac715f28..5e8df9177da4 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/uthex.c b/drivers/acpi/acpica/uthex.c
index 9afa9441b183..aa448278ba28 100644
--- a/drivers/acpi/acpica/uthex.c
+++ b/drivers/acpi/acpica/uthex.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c
index 4b12880e5b11..27431cfc1c44 100644
--- a/drivers/acpi/acpica/utids.c
+++ b/drivers/acpi/acpica/utids.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c
index 77120ec9ea86..e402e07b4846 100644
--- a/drivers/acpi/acpica/utinit.c
+++ b/drivers/acpi/acpica/utinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utlock.c b/drivers/acpi/acpica/utlock.c
index dc6e96547f18..089f78bbd59b 100644
--- a/drivers/acpi/acpica/utlock.c
+++ b/drivers/acpi/acpica/utlock.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c
index d44dee6ee10a..f9ff100f0159 100644
--- a/drivers/acpi/acpica/utmath.c
+++ b/drivers/acpi/acpica/utmath.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index 2e2bb14e1099..56bbacd576f2 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c
index 82717fff9ffc..37b8b58fcd56 100644
--- a/drivers/acpi/acpica/utmutex.c
+++ b/drivers/acpi/acpica/utmutex.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index dfa9009bfc87..7d83efe1ea29 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c
index 685766fc6ca8..574cd3118313 100644
--- a/drivers/acpi/acpica/utosi.c
+++ b/drivers/acpi/acpica/utosi.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utownerid.c b/drivers/acpi/acpica/utownerid.c
index 36bec57ebd23..2959217067cb 100644
--- a/drivers/acpi/acpica/utownerid.c
+++ b/drivers/acpi/acpica/utownerid.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utpredef.c b/drivers/acpi/acpica/utpredef.c
index db30caff130a..29e449935a82 100644
--- a/drivers/acpi/acpica/utpredef.c
+++ b/drivers/acpi/acpica/utpredef.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utprint.c b/drivers/acpi/acpica/utprint.c
index 0ce3f5a0dd67..82ca9142e10d 100644
--- a/drivers/acpi/acpica/utprint.c
+++ b/drivers/acpi/acpica/utprint.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index bc1ff820c7dd..b3505dbc715e 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c
index 1cc97a752c15..8274cc16edc3 100644
--- a/drivers/acpi/acpica/utstate.c
+++ b/drivers/acpi/acpica/utstate.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utstring.c b/drivers/acpi/acpica/utstring.c
index 6dc54b3c28b0..83b6c52490dc 100644
--- a/drivers/acpi/acpica/utstring.c
+++ b/drivers/acpi/acpica/utstring.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c
index 7d0ee969d781..130dd9f96f0f 100644
--- a/drivers/acpi/acpica/uttrack.c
+++ b/drivers/acpi/acpica/uttrack.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utuuid.c b/drivers/acpi/acpica/utuuid.c
index 4dc33130f134..c6149a212149 100644
--- a/drivers/acpi/acpica/utuuid.c
+++ b/drivers/acpi/acpica/utuuid.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index 49c873c68756..0929187bdce0 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index 88ef77f3cf88..306e785f9418 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c
index b1fd6886e439..083a76891889 100644
--- a/drivers/acpi/acpica/utxfinit.c
+++ b/drivers/acpi/acpica/utxfinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utxfmutex.c b/drivers/acpi/acpica/utxfmutex.c
index 2a0f9e04d3a4..f2606af3364c 100644
--- a/drivers/acpi/acpica/utxfmutex.c
+++ b/drivers/acpi/acpica/utxfmutex.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2014, Intel Corp. 8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index c0d44d394ca3..735db11a9b00 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -1027,7 +1027,6 @@ EXPORT_SYMBOL_GPL(acpi_subsys_freeze);
1027 1027
1028static struct dev_pm_domain acpi_general_pm_domain = { 1028static struct dev_pm_domain acpi_general_pm_domain = {
1029 .ops = { 1029 .ops = {
1030#ifdef CONFIG_PM
1031 .runtime_suspend = acpi_subsys_runtime_suspend, 1030 .runtime_suspend = acpi_subsys_runtime_suspend,
1032 .runtime_resume = acpi_subsys_runtime_resume, 1031 .runtime_resume = acpi_subsys_runtime_resume,
1033#ifdef CONFIG_PM_SLEEP 1032#ifdef CONFIG_PM_SLEEP
@@ -1041,7 +1040,6 @@ static struct dev_pm_domain acpi_general_pm_domain = {
1041 .poweroff_late = acpi_subsys_suspend_late, 1040 .poweroff_late = acpi_subsys_suspend_late,
1042 .restore_early = acpi_subsys_resume_early, 1041 .restore_early = acpi_subsys_resume_early,
1043#endif 1042#endif
1044#endif
1045 }, 1043 },
1046}; 1044};
1047 1045
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 1b5853f384e2..14d0c89ada2a 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * ec.c - ACPI Embedded Controller Driver (v2.2) 2 * ec.c - ACPI Embedded Controller Driver (v3)
3 * 3 *
4 * Copyright (C) 2001-2014 Intel Corporation 4 * Copyright (C) 2001-2015 Intel Corporation
5 * Author: 2014 Lv Zheng <lv.zheng@intel.com> 5 * Author: 2014, 2015 Lv Zheng <lv.zheng@intel.com>
6 * 2006, 2007 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> 6 * 2006, 2007 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
7 * 2006 Denis Sadykov <denis.m.sadykov@intel.com> 7 * 2006 Denis Sadykov <denis.m.sadykov@intel.com>
8 * 2004 Luming Yu <luming.yu@intel.com> 8 * 2004 Luming Yu <luming.yu@intel.com>
@@ -31,6 +31,7 @@
31 31
32/* Uncomment next line to get verbose printout */ 32/* Uncomment next line to get verbose printout */
33/* #define DEBUG */ 33/* #define DEBUG */
34#define DEBUG_REF 0
34#define pr_fmt(fmt) "ACPI : EC: " fmt 35#define pr_fmt(fmt) "ACPI : EC: " fmt
35 36
36#include <linux/kernel.h> 37#include <linux/kernel.h>
@@ -71,20 +72,32 @@ enum ec_command {
71#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ 72#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
72#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ 73#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
73#define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */ 74#define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */
75#define ACPI_EC_UDELAY_POLL 1000 /* Wait 1ms for EC transaction polling */
74#define ACPI_EC_CLEAR_MAX 100 /* Maximum number of events to query 76#define ACPI_EC_CLEAR_MAX 100 /* Maximum number of events to query
75 * when trying to clear the EC */ 77 * when trying to clear the EC */
76 78
77enum { 79enum {
78 EC_FLAGS_QUERY_PENDING, /* Query is pending */ 80 EC_FLAGS_EVENT_ENABLED, /* Event is enabled */
79 EC_FLAGS_GPE_STORM, /* GPE storm detected */ 81 EC_FLAGS_EVENT_PENDING, /* Event is pending */
82 EC_FLAGS_EVENT_DETECTED, /* Event is detected */
80 EC_FLAGS_HANDLERS_INSTALLED, /* Handlers for GPE and 83 EC_FLAGS_HANDLERS_INSTALLED, /* Handlers for GPE and
81 * OpReg are installed */ 84 * OpReg are installed */
82 EC_FLAGS_BLOCKED, /* Transactions are blocked */ 85 EC_FLAGS_STARTED, /* Driver is started */
86 EC_FLAGS_STOPPED, /* Driver is stopped */
87 EC_FLAGS_COMMAND_STORM, /* GPE storms occurred to the
88 * current command processing */
83}; 89};
84 90
85#define ACPI_EC_COMMAND_POLL 0x01 /* Available for command byte */ 91#define ACPI_EC_COMMAND_POLL 0x01 /* Available for command byte */
86#define ACPI_EC_COMMAND_COMPLETE 0x02 /* Completed last byte */ 92#define ACPI_EC_COMMAND_COMPLETE 0x02 /* Completed last byte */
87 93
94#define ec_debug_ref(ec, fmt, ...) \
95 do { \
96 if (DEBUG_REF) \
97 pr_debug("%lu: " fmt, ec->reference_count, \
98 ## __VA_ARGS__); \
99 } while (0)
100
88/* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */ 101/* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */
89static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY; 102static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY;
90module_param(ec_delay, uint, 0644); 103module_param(ec_delay, uint, 0644);
@@ -105,6 +118,7 @@ struct acpi_ec_query_handler {
105 acpi_handle handle; 118 acpi_handle handle;
106 void *data; 119 void *data;
107 u8 query_bit; 120 u8 query_bit;
121 struct kref kref;
108}; 122};
109 123
110struct transaction { 124struct transaction {
@@ -117,8 +131,12 @@ struct transaction {
117 u8 wlen; 131 u8 wlen;
118 u8 rlen; 132 u8 rlen;
119 u8 flags; 133 u8 flags;
134 unsigned long timestamp;
120}; 135};
121 136
137static int acpi_ec_query(struct acpi_ec *ec, u8 *data);
138static void advance_transaction(struct acpi_ec *ec);
139
122struct acpi_ec *boot_ec, *first_ec; 140struct acpi_ec *boot_ec, *first_ec;
123EXPORT_SYMBOL(first_ec); 141EXPORT_SYMBOL(first_ec);
124 142
@@ -129,7 +147,28 @@ static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */
129static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */ 147static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */
130 148
131/* -------------------------------------------------------------------------- 149/* --------------------------------------------------------------------------
132 * Transaction Management 150 * Device Flags
151 * -------------------------------------------------------------------------- */
152
153static bool acpi_ec_started(struct acpi_ec *ec)
154{
155 return test_bit(EC_FLAGS_STARTED, &ec->flags) &&
156 !test_bit(EC_FLAGS_STOPPED, &ec->flags);
157}
158
159static bool acpi_ec_flushed(struct acpi_ec *ec)
160{
161 return ec->reference_count == 1;
162}
163
164static bool acpi_ec_has_pending_event(struct acpi_ec *ec)
165{
166 return test_bit(EC_FLAGS_EVENT_DETECTED, &ec->flags) ||
167 test_bit(EC_FLAGS_EVENT_PENDING, &ec->flags);
168}
169
170/* --------------------------------------------------------------------------
171 * EC Registers
133 * -------------------------------------------------------------------------- */ 172 * -------------------------------------------------------------------------- */
134 173
135static inline u8 acpi_ec_read_status(struct acpi_ec *ec) 174static inline u8 acpi_ec_read_status(struct acpi_ec *ec)
@@ -151,6 +190,7 @@ static inline u8 acpi_ec_read_data(struct acpi_ec *ec)
151{ 190{
152 u8 x = inb(ec->data_addr); 191 u8 x = inb(ec->data_addr);
153 192
193 ec->curr->timestamp = jiffies;
154 pr_debug("EC_DATA(R) = 0x%2.2x\n", x); 194 pr_debug("EC_DATA(R) = 0x%2.2x\n", x);
155 return x; 195 return x;
156} 196}
@@ -159,12 +199,14 @@ static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command)
159{ 199{
160 pr_debug("EC_SC(W) = 0x%2.2x\n", command); 200 pr_debug("EC_SC(W) = 0x%2.2x\n", command);
161 outb(command, ec->command_addr); 201 outb(command, ec->command_addr);
202 ec->curr->timestamp = jiffies;
162} 203}
163 204
164static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) 205static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
165{ 206{
166 pr_debug("EC_DATA(W) = 0x%2.2x\n", data); 207 pr_debug("EC_DATA(W) = 0x%2.2x\n", data);
167 outb(data, ec->data_addr); 208 outb(data, ec->data_addr);
209 ec->curr->timestamp = jiffies;
168} 210}
169 211
170#ifdef DEBUG 212#ifdef DEBUG
@@ -188,6 +230,203 @@ static const char *acpi_ec_cmd_string(u8 cmd)
188#define acpi_ec_cmd_string(cmd) "UNDEF" 230#define acpi_ec_cmd_string(cmd) "UNDEF"
189#endif 231#endif
190 232
233/* --------------------------------------------------------------------------
234 * GPE Registers
235 * -------------------------------------------------------------------------- */
236
237static inline bool acpi_ec_is_gpe_raised(struct acpi_ec *ec)
238{
239 acpi_event_status gpe_status = 0;
240
241 (void)acpi_get_gpe_status(NULL, ec->gpe, &gpe_status);
242 return (gpe_status & ACPI_EVENT_FLAG_SET) ? true : false;
243}
244
245static inline void acpi_ec_enable_gpe(struct acpi_ec *ec, bool open)
246{
247 if (open)
248 acpi_enable_gpe(NULL, ec->gpe);
249 else {
250 BUG_ON(ec->reference_count < 1);
251 acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE);
252 }
253 if (acpi_ec_is_gpe_raised(ec)) {
254 /*
255 * On some platforms, EN=1 writes cannot trigger GPE. So
256 * software need to manually trigger a pseudo GPE event on
257 * EN=1 writes.
258 */
259 pr_debug("***** Polling quirk *****\n");
260 advance_transaction(ec);
261 }
262}
263
264static inline void acpi_ec_disable_gpe(struct acpi_ec *ec, bool close)
265{
266 if (close)
267 acpi_disable_gpe(NULL, ec->gpe);
268 else {
269 BUG_ON(ec->reference_count < 1);
270 acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
271 }
272}
273
274static inline void acpi_ec_clear_gpe(struct acpi_ec *ec)
275{
276 /*
277 * GPE STS is a W1C register, which means:
278 * 1. Software can clear it without worrying about clearing other
279 * GPEs' STS bits when the hardware sets them in parallel.
280 * 2. As long as software can ensure only clearing it when it is
281 * set, hardware won't set it in parallel.
282 * So software can clear GPE in any contexts.
283 * Warning: do not move the check into advance_transaction() as the
284 * EC commands will be sent without GPE raised.
285 */
286 if (!acpi_ec_is_gpe_raised(ec))
287 return;
288 acpi_clear_gpe(NULL, ec->gpe);
289}
290
291/* --------------------------------------------------------------------------
292 * Transaction Management
293 * -------------------------------------------------------------------------- */
294
295static void acpi_ec_submit_request(struct acpi_ec *ec)
296{
297 ec->reference_count++;
298 if (ec->reference_count == 1)
299 acpi_ec_enable_gpe(ec, true);
300}
301
302static void acpi_ec_complete_request(struct acpi_ec *ec)
303{
304 bool flushed = false;
305
306 ec->reference_count--;
307 if (ec->reference_count == 0)
308 acpi_ec_disable_gpe(ec, true);
309 flushed = acpi_ec_flushed(ec);
310 if (flushed)
311 wake_up(&ec->wait);
312}
313
314static void acpi_ec_set_storm(struct acpi_ec *ec, u8 flag)
315{
316 if (!test_bit(flag, &ec->flags)) {
317 acpi_ec_disable_gpe(ec, false);
318 pr_debug("+++++ Polling enabled +++++\n");
319 set_bit(flag, &ec->flags);
320 }
321}
322
323static void acpi_ec_clear_storm(struct acpi_ec *ec, u8 flag)
324{
325 if (test_bit(flag, &ec->flags)) {
326 clear_bit(flag, &ec->flags);
327 acpi_ec_enable_gpe(ec, false);
328 pr_debug("+++++ Polling disabled +++++\n");
329 }
330}
331
332/*
333 * acpi_ec_submit_flushable_request() - Increase the reference count unless
334 * the flush operation is not in
335 * progress
336 * @ec: the EC device
337 * @allow_event: whether event should be handled
338 *
339 * This function must be used before taking a new action that should hold
340 * the reference count. If this function returns false, then the action
341 * must be discarded or it will prevent the flush operation from being
342 * completed.
343 *
344 * During flushing, QR_EC command need to pass this check when there is a
345 * pending event, so that the reference count held for the pending event
346 * can be decreased by the completion of the QR_EC command.
347 */
348static bool acpi_ec_submit_flushable_request(struct acpi_ec *ec,
349 bool allow_event)
350{
351 if (!acpi_ec_started(ec)) {
352 if (!allow_event || !acpi_ec_has_pending_event(ec))
353 return false;
354 }
355 acpi_ec_submit_request(ec);
356 return true;
357}
358
359static void acpi_ec_submit_event(struct acpi_ec *ec)
360{
361 if (!test_bit(EC_FLAGS_EVENT_DETECTED, &ec->flags) ||
362 !test_bit(EC_FLAGS_EVENT_ENABLED, &ec->flags))
363 return;
364 /* Hold reference for pending event */
365 if (!acpi_ec_submit_flushable_request(ec, true))
366 return;
367 ec_debug_ref(ec, "Increase event\n");
368 if (!test_and_set_bit(EC_FLAGS_EVENT_PENDING, &ec->flags)) {
369 pr_debug("***** Event query started *****\n");
370 schedule_work(&ec->work);
371 return;
372 }
373 acpi_ec_complete_request(ec);
374 ec_debug_ref(ec, "Decrease event\n");
375}
376
377static void acpi_ec_complete_event(struct acpi_ec *ec)
378{
379 if (ec->curr->command == ACPI_EC_COMMAND_QUERY) {
380 clear_bit(EC_FLAGS_EVENT_PENDING, &ec->flags);
381 pr_debug("***** Event query stopped *****\n");
382 /* Unhold reference for pending event */
383 acpi_ec_complete_request(ec);
384 ec_debug_ref(ec, "Decrease event\n");
385 /* Check if there is another SCI_EVT detected */
386 acpi_ec_submit_event(ec);
387 }
388}
389
390static void acpi_ec_submit_detection(struct acpi_ec *ec)
391{
392 /* Hold reference for query submission */
393 if (!acpi_ec_submit_flushable_request(ec, false))
394 return;
395 ec_debug_ref(ec, "Increase query\n");
396 if (!test_and_set_bit(EC_FLAGS_EVENT_DETECTED, &ec->flags)) {
397 pr_debug("***** Event detection blocked *****\n");
398 acpi_ec_submit_event(ec);
399 return;
400 }
401 acpi_ec_complete_request(ec);
402 ec_debug_ref(ec, "Decrease query\n");
403}
404
405static void acpi_ec_complete_detection(struct acpi_ec *ec)
406{
407 if (ec->curr->command == ACPI_EC_COMMAND_QUERY) {
408 clear_bit(EC_FLAGS_EVENT_DETECTED, &ec->flags);
409 pr_debug("***** Event detetion unblocked *****\n");
410 /* Unhold reference for query submission */
411 acpi_ec_complete_request(ec);
412 ec_debug_ref(ec, "Decrease query\n");
413 }
414}
415
416static void acpi_ec_enable_event(struct acpi_ec *ec)
417{
418 unsigned long flags;
419
420 spin_lock_irqsave(&ec->lock, flags);
421 set_bit(EC_FLAGS_EVENT_ENABLED, &ec->flags);
422 /*
423 * An event may be pending even with SCI_EVT=0, so QR_EC should
424 * always be issued right after started.
425 */
426 acpi_ec_submit_detection(ec);
427 spin_unlock_irqrestore(&ec->lock, flags);
428}
429
191static int ec_transaction_completed(struct acpi_ec *ec) 430static int ec_transaction_completed(struct acpi_ec *ec)
192{ 431{
193 unsigned long flags; 432 unsigned long flags;
@@ -200,7 +439,7 @@ static int ec_transaction_completed(struct acpi_ec *ec)
200 return ret; 439 return ret;
201} 440}
202 441
203static bool advance_transaction(struct acpi_ec *ec) 442static void advance_transaction(struct acpi_ec *ec)
204{ 443{
205 struct transaction *t; 444 struct transaction *t;
206 u8 status; 445 u8 status;
@@ -208,6 +447,12 @@ static bool advance_transaction(struct acpi_ec *ec)
208 447
209 pr_debug("===== %s (%d) =====\n", 448 pr_debug("===== %s (%d) =====\n",
210 in_interrupt() ? "IRQ" : "TASK", smp_processor_id()); 449 in_interrupt() ? "IRQ" : "TASK", smp_processor_id());
450 /*
451 * By always clearing STS before handling all indications, we can
452 * ensure a hardware STS 0->1 change after this clearing can always
453 * trigger a GPE interrupt.
454 */
455 acpi_ec_clear_gpe(ec);
211 status = acpi_ec_read_status(ec); 456 status = acpi_ec_read_status(ec);
212 t = ec->curr; 457 t = ec->curr;
213 if (!t) 458 if (!t)
@@ -223,6 +468,7 @@ static bool advance_transaction(struct acpi_ec *ec)
223 t->rdata[t->ri++] = acpi_ec_read_data(ec); 468 t->rdata[t->ri++] = acpi_ec_read_data(ec);
224 if (t->rlen == t->ri) { 469 if (t->rlen == t->ri) {
225 t->flags |= ACPI_EC_COMMAND_COMPLETE; 470 t->flags |= ACPI_EC_COMMAND_COMPLETE;
471 acpi_ec_complete_event(ec);
226 if (t->command == ACPI_EC_COMMAND_QUERY) 472 if (t->command == ACPI_EC_COMMAND_QUERY)
227 pr_debug("***** Command(%s) hardware completion *****\n", 473 pr_debug("***** Command(%s) hardware completion *****\n",
228 acpi_ec_cmd_string(t->command)); 474 acpi_ec_cmd_string(t->command));
@@ -233,25 +479,29 @@ static bool advance_transaction(struct acpi_ec *ec)
233 } else if (t->wlen == t->wi && 479 } else if (t->wlen == t->wi &&
234 (status & ACPI_EC_FLAG_IBF) == 0) { 480 (status & ACPI_EC_FLAG_IBF) == 0) {
235 t->flags |= ACPI_EC_COMMAND_COMPLETE; 481 t->flags |= ACPI_EC_COMMAND_COMPLETE;
482 acpi_ec_complete_event(ec);
236 wakeup = true; 483 wakeup = true;
237 } 484 }
238 return wakeup; 485 goto out;
239 } else { 486 } else {
240 if (EC_FLAGS_QUERY_HANDSHAKE && 487 if (EC_FLAGS_QUERY_HANDSHAKE &&
241 !(status & ACPI_EC_FLAG_SCI) && 488 !(status & ACPI_EC_FLAG_SCI) &&
242 (t->command == ACPI_EC_COMMAND_QUERY)) { 489 (t->command == ACPI_EC_COMMAND_QUERY)) {
243 t->flags |= ACPI_EC_COMMAND_POLL; 490 t->flags |= ACPI_EC_COMMAND_POLL;
491 acpi_ec_complete_detection(ec);
244 t->rdata[t->ri++] = 0x00; 492 t->rdata[t->ri++] = 0x00;
245 t->flags |= ACPI_EC_COMMAND_COMPLETE; 493 t->flags |= ACPI_EC_COMMAND_COMPLETE;
494 acpi_ec_complete_event(ec);
246 pr_debug("***** Command(%s) software completion *****\n", 495 pr_debug("***** Command(%s) software completion *****\n",
247 acpi_ec_cmd_string(t->command)); 496 acpi_ec_cmd_string(t->command));
248 wakeup = true; 497 wakeup = true;
249 } else if ((status & ACPI_EC_FLAG_IBF) == 0) { 498 } else if ((status & ACPI_EC_FLAG_IBF) == 0) {
250 acpi_ec_write_cmd(ec, t->command); 499 acpi_ec_write_cmd(ec, t->command);
251 t->flags |= ACPI_EC_COMMAND_POLL; 500 t->flags |= ACPI_EC_COMMAND_POLL;
501 acpi_ec_complete_detection(ec);
252 } else 502 } else
253 goto err; 503 goto err;
254 return wakeup; 504 goto out;
255 } 505 }
256err: 506err:
257 /* 507 /*
@@ -259,28 +509,27 @@ err:
259 * otherwise will take a not handled IRQ as a false one. 509 * otherwise will take a not handled IRQ as a false one.
260 */ 510 */
261 if (!(status & ACPI_EC_FLAG_SCI)) { 511 if (!(status & ACPI_EC_FLAG_SCI)) {
262 if (in_interrupt() && t) 512 if (in_interrupt() && t) {
263 ++t->irq_count; 513 if (t->irq_count < ec_storm_threshold)
514 ++t->irq_count;
515 /* Allow triggering on 0 threshold */
516 if (t->irq_count == ec_storm_threshold)
517 acpi_ec_set_storm(ec, EC_FLAGS_COMMAND_STORM);
518 }
264 } 519 }
265 return wakeup; 520out:
521 if (status & ACPI_EC_FLAG_SCI)
522 acpi_ec_submit_detection(ec);
523 if (wakeup && in_interrupt())
524 wake_up(&ec->wait);
266} 525}
267 526
268static void start_transaction(struct acpi_ec *ec) 527static void start_transaction(struct acpi_ec *ec)
269{ 528{
270 ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0; 529 ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0;
271 ec->curr->flags = 0; 530 ec->curr->flags = 0;
272 (void)advance_transaction(ec); 531 ec->curr->timestamp = jiffies;
273} 532 advance_transaction(ec);
274
275static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data);
276
277static int ec_check_sci_sync(struct acpi_ec *ec, u8 state)
278{
279 if (state & ACPI_EC_FLAG_SCI) {
280 if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
281 return acpi_ec_sync_query(ec, NULL);
282 }
283 return 0;
284} 533}
285 534
286static int ec_poll(struct acpi_ec *ec) 535static int ec_poll(struct acpi_ec *ec)
@@ -291,20 +540,25 @@ static int ec_poll(struct acpi_ec *ec)
291 while (repeat--) { 540 while (repeat--) {
292 unsigned long delay = jiffies + 541 unsigned long delay = jiffies +
293 msecs_to_jiffies(ec_delay); 542 msecs_to_jiffies(ec_delay);
543 unsigned long usecs = ACPI_EC_UDELAY_POLL;
294 do { 544 do {
295 /* don't sleep with disabled interrupts */ 545 /* don't sleep with disabled interrupts */
296 if (EC_FLAGS_MSI || irqs_disabled()) { 546 if (EC_FLAGS_MSI || irqs_disabled()) {
297 udelay(ACPI_EC_MSI_UDELAY); 547 usecs = ACPI_EC_MSI_UDELAY;
548 udelay(usecs);
298 if (ec_transaction_completed(ec)) 549 if (ec_transaction_completed(ec))
299 return 0; 550 return 0;
300 } else { 551 } else {
301 if (wait_event_timeout(ec->wait, 552 if (wait_event_timeout(ec->wait,
302 ec_transaction_completed(ec), 553 ec_transaction_completed(ec),
303 msecs_to_jiffies(1))) 554 usecs_to_jiffies(usecs)))
304 return 0; 555 return 0;
305 } 556 }
306 spin_lock_irqsave(&ec->lock, flags); 557 spin_lock_irqsave(&ec->lock, flags);
307 (void)advance_transaction(ec); 558 if (time_after(jiffies,
559 ec->curr->timestamp +
560 usecs_to_jiffies(usecs)))
561 advance_transaction(ec);
308 spin_unlock_irqrestore(&ec->lock, flags); 562 spin_unlock_irqrestore(&ec->lock, flags);
309 } while (time_before(jiffies, delay)); 563 } while (time_before(jiffies, delay));
310 pr_debug("controller reset, restart transaction\n"); 564 pr_debug("controller reset, restart transaction\n");
@@ -325,21 +579,29 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
325 udelay(ACPI_EC_MSI_UDELAY); 579 udelay(ACPI_EC_MSI_UDELAY);
326 /* start transaction */ 580 /* start transaction */
327 spin_lock_irqsave(&ec->lock, tmp); 581 spin_lock_irqsave(&ec->lock, tmp);
582 /* Enable GPE for command processing (IBF=0/OBF=1) */
583 if (!acpi_ec_submit_flushable_request(ec, true)) {
584 ret = -EINVAL;
585 goto unlock;
586 }
587 ec_debug_ref(ec, "Increase command\n");
328 /* following two actions should be kept atomic */ 588 /* following two actions should be kept atomic */
329 ec->curr = t; 589 ec->curr = t;
330 pr_debug("***** Command(%s) started *****\n", 590 pr_debug("***** Command(%s) started *****\n",
331 acpi_ec_cmd_string(t->command)); 591 acpi_ec_cmd_string(t->command));
332 start_transaction(ec); 592 start_transaction(ec);
333 if (ec->curr->command == ACPI_EC_COMMAND_QUERY) {
334 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
335 pr_debug("***** Event stopped *****\n");
336 }
337 spin_unlock_irqrestore(&ec->lock, tmp); 593 spin_unlock_irqrestore(&ec->lock, tmp);
338 ret = ec_poll(ec); 594 ret = ec_poll(ec);
339 spin_lock_irqsave(&ec->lock, tmp); 595 spin_lock_irqsave(&ec->lock, tmp);
596 if (t->irq_count == ec_storm_threshold)
597 acpi_ec_clear_storm(ec, EC_FLAGS_COMMAND_STORM);
340 pr_debug("***** Command(%s) stopped *****\n", 598 pr_debug("***** Command(%s) stopped *****\n",
341 acpi_ec_cmd_string(t->command)); 599 acpi_ec_cmd_string(t->command));
342 ec->curr = NULL; 600 ec->curr = NULL;
601 /* Disable GPE for command processing (IBF=0/OBF=1) */
602 acpi_ec_complete_request(ec);
603 ec_debug_ref(ec, "Decrease command\n");
604unlock:
343 spin_unlock_irqrestore(&ec->lock, tmp); 605 spin_unlock_irqrestore(&ec->lock, tmp);
344 return ret; 606 return ret;
345} 607}
@@ -354,10 +616,6 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
354 if (t->rdata) 616 if (t->rdata)
355 memset(t->rdata, 0, t->rlen); 617 memset(t->rdata, 0, t->rlen);
356 mutex_lock(&ec->mutex); 618 mutex_lock(&ec->mutex);
357 if (test_bit(EC_FLAGS_BLOCKED, &ec->flags)) {
358 status = -EINVAL;
359 goto unlock;
360 }
361 if (ec->global_lock) { 619 if (ec->global_lock) {
362 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); 620 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
363 if (ACPI_FAILURE(status)) { 621 if (ACPI_FAILURE(status)) {
@@ -365,26 +623,11 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
365 goto unlock; 623 goto unlock;
366 } 624 }
367 } 625 }
368 /* disable GPE during transaction if storm is detected */
369 if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
370 /* It has to be disabled, so that it doesn't trigger. */
371 acpi_disable_gpe(NULL, ec->gpe);
372 }
373 626
374 status = acpi_ec_transaction_unlocked(ec, t); 627 status = acpi_ec_transaction_unlocked(ec, t);
375 628
376 /* check if we received SCI during transaction */ 629 if (test_bit(EC_FLAGS_COMMAND_STORM, &ec->flags))
377 ec_check_sci_sync(ec, acpi_ec_read_status(ec));
378 if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
379 msleep(1); 630 msleep(1);
380 /* It is safe to enable the GPE outside of the transaction. */
381 acpi_enable_gpe(NULL, ec->gpe);
382 } else if (t->irq_count > ec_storm_threshold) {
383 pr_info("GPE storm detected(%d GPEs), "
384 "transactions will use polling mode\n",
385 t->irq_count);
386 set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
387 }
388 if (ec->global_lock) 631 if (ec->global_lock)
389 acpi_release_global_lock(glk); 632 acpi_release_global_lock(glk);
390unlock: 633unlock:
@@ -500,7 +743,7 @@ static void acpi_ec_clear(struct acpi_ec *ec)
500 u8 value = 0; 743 u8 value = 0;
501 744
502 for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) { 745 for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) {
503 status = acpi_ec_sync_query(ec, &value); 746 status = acpi_ec_query(ec, &value);
504 if (status || !value) 747 if (status || !value)
505 break; 748 break;
506 } 749 }
@@ -511,6 +754,57 @@ static void acpi_ec_clear(struct acpi_ec *ec)
511 pr_info("%d stale EC events cleared\n", i); 754 pr_info("%d stale EC events cleared\n", i);
512} 755}
513 756
757static void acpi_ec_start(struct acpi_ec *ec, bool resuming)
758{
759 unsigned long flags;
760
761 spin_lock_irqsave(&ec->lock, flags);
762 if (!test_and_set_bit(EC_FLAGS_STARTED, &ec->flags)) {
763 pr_debug("+++++ Starting EC +++++\n");
764 /* Enable GPE for event processing (SCI_EVT=1) */
765 if (!resuming) {
766 acpi_ec_submit_request(ec);
767 ec_debug_ref(ec, "Increase driver\n");
768 }
769 pr_info("+++++ EC started +++++\n");
770 }
771 spin_unlock_irqrestore(&ec->lock, flags);
772}
773
774static bool acpi_ec_stopped(struct acpi_ec *ec)
775{
776 unsigned long flags;
777 bool flushed;
778
779 spin_lock_irqsave(&ec->lock, flags);
780 flushed = acpi_ec_flushed(ec);
781 spin_unlock_irqrestore(&ec->lock, flags);
782 return flushed;
783}
784
785static void acpi_ec_stop(struct acpi_ec *ec, bool suspending)
786{
787 unsigned long flags;
788
789 spin_lock_irqsave(&ec->lock, flags);
790 if (acpi_ec_started(ec)) {
791 pr_debug("+++++ Stopping EC +++++\n");
792 set_bit(EC_FLAGS_STOPPED, &ec->flags);
793 spin_unlock_irqrestore(&ec->lock, flags);
794 wait_event(ec->wait, acpi_ec_stopped(ec));
795 spin_lock_irqsave(&ec->lock, flags);
796 /* Disable GPE for event processing (SCI_EVT=1) */
797 if (!suspending) {
798 acpi_ec_complete_request(ec);
799 ec_debug_ref(ec, "Decrease driver\n");
800 }
801 clear_bit(EC_FLAGS_STARTED, &ec->flags);
802 clear_bit(EC_FLAGS_STOPPED, &ec->flags);
803 pr_info("+++++ EC stopped +++++\n");
804 }
805 spin_unlock_irqrestore(&ec->lock, flags);
806}
807
514void acpi_ec_block_transactions(void) 808void acpi_ec_block_transactions(void)
515{ 809{
516 struct acpi_ec *ec = first_ec; 810 struct acpi_ec *ec = first_ec;
@@ -520,7 +814,7 @@ void acpi_ec_block_transactions(void)
520 814
521 mutex_lock(&ec->mutex); 815 mutex_lock(&ec->mutex);
522 /* Prevent transactions from being carried out */ 816 /* Prevent transactions from being carried out */
523 set_bit(EC_FLAGS_BLOCKED, &ec->flags); 817 acpi_ec_stop(ec, true);
524 mutex_unlock(&ec->mutex); 818 mutex_unlock(&ec->mutex);
525} 819}
526 820
@@ -531,14 +825,11 @@ void acpi_ec_unblock_transactions(void)
531 if (!ec) 825 if (!ec)
532 return; 826 return;
533 827
534 mutex_lock(&ec->mutex);
535 /* Allow transactions to be carried out again */ 828 /* Allow transactions to be carried out again */
536 clear_bit(EC_FLAGS_BLOCKED, &ec->flags); 829 acpi_ec_start(ec, true);
537 830
538 if (EC_FLAGS_CLEAR_ON_RESUME) 831 if (EC_FLAGS_CLEAR_ON_RESUME)
539 acpi_ec_clear(ec); 832 acpi_ec_clear(ec);
540
541 mutex_unlock(&ec->mutex);
542} 833}
543 834
544void acpi_ec_unblock_transactions_early(void) 835void acpi_ec_unblock_transactions_early(void)
@@ -548,36 +839,33 @@ void acpi_ec_unblock_transactions_early(void)
548 * atomic context during wakeup, so we don't need to acquire the mutex). 839 * atomic context during wakeup, so we don't need to acquire the mutex).
549 */ 840 */
550 if (first_ec) 841 if (first_ec)
551 clear_bit(EC_FLAGS_BLOCKED, &first_ec->flags); 842 acpi_ec_start(first_ec, true);
552} 843}
553 844
554static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 *data) 845/* --------------------------------------------------------------------------
846 Event Management
847 -------------------------------------------------------------------------- */
848static struct acpi_ec_query_handler *
849acpi_ec_get_query_handler(struct acpi_ec_query_handler *handler)
555{ 850{
556 int result; 851 if (handler)
557 u8 d; 852 kref_get(&handler->kref);
558 struct transaction t = {.command = ACPI_EC_COMMAND_QUERY, 853 return handler;
559 .wdata = NULL, .rdata = &d, 854}
560 .wlen = 0, .rlen = 1};
561 855
562 if (!ec || !data) 856static void acpi_ec_query_handler_release(struct kref *kref)
563 return -EINVAL; 857{
564 /* 858 struct acpi_ec_query_handler *handler =
565 * Query the EC to find out which _Qxx method we need to evaluate. 859 container_of(kref, struct acpi_ec_query_handler, kref);
566 * Note that successful completion of the query causes the ACPI_EC_SCI 860
567 * bit to be cleared (and thus clearing the interrupt source). 861 kfree(handler);
568 */ 862}
569 result = acpi_ec_transaction_unlocked(ec, &t); 863
570 if (result) 864static void acpi_ec_put_query_handler(struct acpi_ec_query_handler *handler)
571 return result; 865{
572 if (!d) 866 kref_put(&handler->kref, acpi_ec_query_handler_release);
573 return -ENODATA;
574 *data = d;
575 return 0;
576} 867}
577 868
578/* --------------------------------------------------------------------------
579 Event Management
580 -------------------------------------------------------------------------- */
581int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit, 869int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
582 acpi_handle handle, acpi_ec_query_func func, 870 acpi_handle handle, acpi_ec_query_func func,
583 void *data) 871 void *data)
@@ -593,6 +881,7 @@ int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
593 handler->func = func; 881 handler->func = func;
594 handler->data = data; 882 handler->data = data;
595 mutex_lock(&ec->mutex); 883 mutex_lock(&ec->mutex);
884 kref_init(&handler->kref);
596 list_add(&handler->node, &ec->list); 885 list_add(&handler->node, &ec->list);
597 mutex_unlock(&ec->mutex); 886 mutex_unlock(&ec->mutex);
598 return 0; 887 return 0;
@@ -602,15 +891,18 @@ EXPORT_SYMBOL_GPL(acpi_ec_add_query_handler);
602void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) 891void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
603{ 892{
604 struct acpi_ec_query_handler *handler, *tmp; 893 struct acpi_ec_query_handler *handler, *tmp;
894 LIST_HEAD(free_list);
605 895
606 mutex_lock(&ec->mutex); 896 mutex_lock(&ec->mutex);
607 list_for_each_entry_safe(handler, tmp, &ec->list, node) { 897 list_for_each_entry_safe(handler, tmp, &ec->list, node) {
608 if (query_bit == handler->query_bit) { 898 if (query_bit == handler->query_bit) {
609 list_del(&handler->node); 899 list_del_init(&handler->node);
610 kfree(handler); 900 list_add(&handler->node, &free_list);
611 } 901 }
612 } 902 }
613 mutex_unlock(&ec->mutex); 903 mutex_unlock(&ec->mutex);
904 list_for_each_entry(handler, &free_list, node)
905 acpi_ec_put_query_handler(handler);
614} 906}
615EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); 907EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler);
616 908
@@ -626,59 +918,58 @@ static void acpi_ec_run(void *cxt)
626 else if (handler->handle) 918 else if (handler->handle)
627 acpi_evaluate_object(handler->handle, NULL, NULL, NULL); 919 acpi_evaluate_object(handler->handle, NULL, NULL, NULL);
628 pr_debug("##### Query(0x%02x) stopped #####\n", handler->query_bit); 920 pr_debug("##### Query(0x%02x) stopped #####\n", handler->query_bit);
629 kfree(handler); 921 acpi_ec_put_query_handler(handler);
630} 922}
631 923
632static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data) 924static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
633{ 925{
634 u8 value = 0; 926 u8 value = 0;
635 int status; 927 int result;
636 struct acpi_ec_query_handler *handler, *copy; 928 acpi_status status;
929 struct acpi_ec_query_handler *handler;
930 struct transaction t = {.command = ACPI_EC_COMMAND_QUERY,
931 .wdata = NULL, .rdata = &value,
932 .wlen = 0, .rlen = 1};
637 933
638 status = acpi_ec_query_unlocked(ec, &value); 934 /*
935 * Query the EC to find out which _Qxx method we need to evaluate.
936 * Note that successful completion of the query causes the ACPI_EC_SCI
937 * bit to be cleared (and thus clearing the interrupt source).
938 */
939 result = acpi_ec_transaction(ec, &t);
940 if (result)
941 return result;
639 if (data) 942 if (data)
640 *data = value; 943 *data = value;
641 if (status) 944 if (!value)
642 return status; 945 return -ENODATA;
643 946
947 mutex_lock(&ec->mutex);
644 list_for_each_entry(handler, &ec->list, node) { 948 list_for_each_entry(handler, &ec->list, node) {
645 if (value == handler->query_bit) { 949 if (value == handler->query_bit) {
646 /* have custom handler for this bit */ 950 /* have custom handler for this bit */
647 copy = kmalloc(sizeof(*handler), GFP_KERNEL); 951 handler = acpi_ec_get_query_handler(handler);
648 if (!copy)
649 return -ENOMEM;
650 memcpy(copy, handler, sizeof(*copy));
651 pr_debug("##### Query(0x%02x) scheduled #####\n", 952 pr_debug("##### Query(0x%02x) scheduled #####\n",
652 handler->query_bit); 953 handler->query_bit);
653 return acpi_os_execute((copy->func) ? 954 status = acpi_os_execute((handler->func) ?
654 OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER, 955 OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER,
655 acpi_ec_run, copy); 956 acpi_ec_run, handler);
957 if (ACPI_FAILURE(status))
958 result = -EBUSY;
959 break;
656 } 960 }
657 } 961 }
658 return 0;
659}
660
661static void acpi_ec_gpe_query(void *ec_cxt)
662{
663 struct acpi_ec *ec = ec_cxt;
664
665 if (!ec)
666 return;
667 mutex_lock(&ec->mutex);
668 acpi_ec_sync_query(ec, NULL);
669 mutex_unlock(&ec->mutex); 962 mutex_unlock(&ec->mutex);
963 return result;
670} 964}
671 965
672static int ec_check_sci(struct acpi_ec *ec, u8 state) 966static void acpi_ec_gpe_poller(struct work_struct *work)
673{ 967{
674 if (state & ACPI_EC_FLAG_SCI) { 968 struct acpi_ec *ec = container_of(work, struct acpi_ec, work);
675 if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) { 969
676 pr_debug("***** Event started *****\n"); 970 pr_debug("***** Event poller started *****\n");
677 return acpi_os_execute(OSL_NOTIFY_HANDLER, 971 acpi_ec_query(ec, NULL);
678 acpi_ec_gpe_query, ec); 972 pr_debug("***** Event poller stopped *****\n");
679 }
680 }
681 return 0;
682} 973}
683 974
684static u32 acpi_ec_gpe_handler(acpi_handle gpe_device, 975static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
@@ -688,11 +979,9 @@ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
688 struct acpi_ec *ec = data; 979 struct acpi_ec *ec = data;
689 980
690 spin_lock_irqsave(&ec->lock, flags); 981 spin_lock_irqsave(&ec->lock, flags);
691 if (advance_transaction(ec)) 982 advance_transaction(ec);
692 wake_up(&ec->wait);
693 spin_unlock_irqrestore(&ec->lock, flags); 983 spin_unlock_irqrestore(&ec->lock, flags);
694 ec_check_sci(ec, acpi_ec_read_status(ec)); 984 return ACPI_INTERRUPT_HANDLED;
695 return ACPI_INTERRUPT_HANDLED | ACPI_REENABLE_GPE;
696} 985}
697 986
698/* -------------------------------------------------------------------------- 987/* --------------------------------------------------------------------------
@@ -750,11 +1039,11 @@ static struct acpi_ec *make_acpi_ec(void)
750 1039
751 if (!ec) 1040 if (!ec)
752 return NULL; 1041 return NULL;
753 ec->flags = 1 << EC_FLAGS_QUERY_PENDING;
754 mutex_init(&ec->mutex); 1042 mutex_init(&ec->mutex);
755 init_waitqueue_head(&ec->wait); 1043 init_waitqueue_head(&ec->wait);
756 INIT_LIST_HEAD(&ec->list); 1044 INIT_LIST_HEAD(&ec->list);
757 spin_lock_init(&ec->lock); 1045 spin_lock_init(&ec->lock);
1046 INIT_WORK(&ec->work, acpi_ec_gpe_poller);
758 return ec; 1047 return ec;
759} 1048}
760 1049
@@ -810,13 +1099,13 @@ static int ec_install_handlers(struct acpi_ec *ec)
810 1099
811 if (test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags)) 1100 if (test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags))
812 return 0; 1101 return 0;
813 status = acpi_install_gpe_handler(NULL, ec->gpe, 1102 status = acpi_install_gpe_raw_handler(NULL, ec->gpe,
814 ACPI_GPE_EDGE_TRIGGERED, 1103 ACPI_GPE_EDGE_TRIGGERED,
815 &acpi_ec_gpe_handler, ec); 1104 &acpi_ec_gpe_handler, ec);
816 if (ACPI_FAILURE(status)) 1105 if (ACPI_FAILURE(status))
817 return -ENODEV; 1106 return -ENODEV;
818 1107
819 acpi_enable_gpe(NULL, ec->gpe); 1108 acpi_ec_start(ec, false);
820 status = acpi_install_address_space_handler(ec->handle, 1109 status = acpi_install_address_space_handler(ec->handle,
821 ACPI_ADR_SPACE_EC, 1110 ACPI_ADR_SPACE_EC,
822 &acpi_ec_space_handler, 1111 &acpi_ec_space_handler,
@@ -831,7 +1120,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
831 pr_err("Fail in evaluating the _REG object" 1120 pr_err("Fail in evaluating the _REG object"
832 " of EC device. Broken bios is suspected.\n"); 1121 " of EC device. Broken bios is suspected.\n");
833 } else { 1122 } else {
834 acpi_disable_gpe(NULL, ec->gpe); 1123 acpi_ec_stop(ec, false);
835 acpi_remove_gpe_handler(NULL, ec->gpe, 1124 acpi_remove_gpe_handler(NULL, ec->gpe,
836 &acpi_ec_gpe_handler); 1125 &acpi_ec_gpe_handler);
837 return -ENODEV; 1126 return -ENODEV;
@@ -846,7 +1135,7 @@ static void ec_remove_handlers(struct acpi_ec *ec)
846{ 1135{
847 if (!test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags)) 1136 if (!test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags))
848 return; 1137 return;
849 acpi_disable_gpe(NULL, ec->gpe); 1138 acpi_ec_stop(ec, false);
850 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, 1139 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
851 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) 1140 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
852 pr_err("failed to remove space handler\n"); 1141 pr_err("failed to remove space handler\n");
@@ -900,14 +1189,11 @@ static int acpi_ec_add(struct acpi_device *device)
900 ret = ec_install_handlers(ec); 1189 ret = ec_install_handlers(ec);
901 1190
902 /* EC is fully operational, allow queries */ 1191 /* EC is fully operational, allow queries */
903 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); 1192 acpi_ec_enable_event(ec);
904 1193
905 /* Clear stale _Q events if hardware might require that */ 1194 /* Clear stale _Q events if hardware might require that */
906 if (EC_FLAGS_CLEAR_ON_RESUME) { 1195 if (EC_FLAGS_CLEAR_ON_RESUME)
907 mutex_lock(&ec->mutex);
908 acpi_ec_clear(ec); 1196 acpi_ec_clear(ec);
909 mutex_unlock(&ec->mutex);
910 }
911 return ret; 1197 return ret;
912} 1198}
913 1199
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 163e82f536fa..56b321aa2b1c 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -35,6 +35,13 @@ void acpi_int340x_thermal_init(void);
35int acpi_sysfs_init(void); 35int acpi_sysfs_init(void);
36void acpi_container_init(void); 36void acpi_container_init(void);
37void acpi_memory_hotplug_init(void); 37void acpi_memory_hotplug_init(void);
38#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
39int acpi_ioapic_add(struct acpi_pci_root *root);
40int acpi_ioapic_remove(struct acpi_pci_root *root);
41#else
42static inline int acpi_ioapic_add(struct acpi_pci_root *root) { return 0; }
43static inline int acpi_ioapic_remove(struct acpi_pci_root *root) { return 0; }
44#endif
38#ifdef CONFIG_ACPI_DOCK 45#ifdef CONFIG_ACPI_DOCK
39void register_dock_dependent_device(struct acpi_device *adev, 46void register_dock_dependent_device(struct acpi_device *adev,
40 acpi_handle dshandle); 47 acpi_handle dshandle);
@@ -68,6 +75,8 @@ static inline void acpi_debugfs_init(void) { return; }
68#endif 75#endif
69void acpi_lpss_init(void); 76void acpi_lpss_init(void);
70 77
78void acpi_apd_init(void);
79
71acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src); 80acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src);
72bool acpi_queue_hotplug_work(struct work_struct *work); 81bool acpi_queue_hotplug_work(struct work_struct *work);
73void acpi_device_hotplug(struct acpi_device *adev, u32 src); 82void acpi_device_hotplug(struct acpi_device *adev, u32 src);
@@ -122,11 +131,13 @@ struct acpi_ec {
122 unsigned long data_addr; 131 unsigned long data_addr;
123 unsigned long global_lock; 132 unsigned long global_lock;
124 unsigned long flags; 133 unsigned long flags;
134 unsigned long reference_count;
125 struct mutex mutex; 135 struct mutex mutex;
126 wait_queue_head_t wait; 136 wait_queue_head_t wait;
127 struct list_head list; 137 struct list_head list;
128 struct transaction *curr; 138 struct transaction *curr;
129 spinlock_t lock; 139 spinlock_t lock;
140 struct work_struct work;
130}; 141};
131 142
132extern struct acpi_ec *first_ec; 143extern struct acpi_ec *first_ec;
diff --git a/drivers/acpi/ioapic.c b/drivers/acpi/ioapic.c
new file mode 100644
index 000000000000..ccdc8db16bb8
--- /dev/null
+++ b/drivers/acpi/ioapic.c
@@ -0,0 +1,229 @@
1/*
2 * IOAPIC/IOxAPIC/IOSAPIC driver
3 *
4 * Copyright (C) 2009 Fujitsu Limited.
5 * (c) Copyright 2009 Hewlett-Packard Development Company, L.P.
6 *
7 * Copyright (C) 2014 Intel Corporation
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * Based on original drivers/pci/ioapic.c
14 * Yinghai Lu <yinghai@kernel.org>
15 * Jiang Liu <jiang.liu@intel.com>
16 */
17
18/*
19 * This driver manages I/O APICs added by hotplug after boot.
20 * We try to claim all I/O APIC devices, but those present at boot were
21 * registered when we parsed the ACPI MADT.
22 */
23
24#define pr_fmt(fmt) "ACPI : IOAPIC: " fmt
25
26#include <linux/slab.h>
27#include <linux/acpi.h>
28#include <linux/pci.h>
29#include <acpi/acpi.h>
30
31struct acpi_pci_ioapic {
32 acpi_handle root_handle;
33 acpi_handle handle;
34 u32 gsi_base;
35 struct resource res;
36 struct pci_dev *pdev;
37 struct list_head list;
38};
39
40static LIST_HEAD(ioapic_list);
41static DEFINE_MUTEX(ioapic_list_lock);
42
43static acpi_status setup_res(struct acpi_resource *acpi_res, void *data)
44{
45 struct resource *res = data;
46 struct resource_win win;
47
48 res->flags = 0;
49 if (acpi_dev_filter_resource_type(acpi_res, IORESOURCE_MEM) == 0)
50 return AE_OK;
51
52 if (!acpi_dev_resource_memory(acpi_res, res)) {
53 if (acpi_dev_resource_address_space(acpi_res, &win) ||
54 acpi_dev_resource_ext_address_space(acpi_res, &win))
55 *res = win.res;
56 }
57 if ((res->flags & IORESOURCE_PREFETCH) ||
58 (res->flags & IORESOURCE_DISABLED))
59 res->flags = 0;
60
61 return AE_CTRL_TERMINATE;
62}
63
64static bool acpi_is_ioapic(acpi_handle handle, char **type)
65{
66 acpi_status status;
67 struct acpi_device_info *info;
68 char *hid = NULL;
69 bool match = false;
70
71 if (!acpi_has_method(handle, "_GSB"))
72 return false;
73
74 status = acpi_get_object_info(handle, &info);
75 if (ACPI_SUCCESS(status)) {
76 if (info->valid & ACPI_VALID_HID)
77 hid = info->hardware_id.string;
78 if (hid) {
79 if (strcmp(hid, "ACPI0009") == 0) {
80 *type = "IOxAPIC";
81 match = true;
82 } else if (strcmp(hid, "ACPI000A") == 0) {
83 *type = "IOAPIC";
84 match = true;
85 }
86 }
87 kfree(info);
88 }
89
90 return match;
91}
92
93static acpi_status handle_ioapic_add(acpi_handle handle, u32 lvl,
94 void *context, void **rv)
95{
96 acpi_status status;
97 unsigned long long gsi_base;
98 struct acpi_pci_ioapic *ioapic;
99 struct pci_dev *dev = NULL;
100 struct resource *res = NULL;
101 char *type = NULL;
102
103 if (!acpi_is_ioapic(handle, &type))
104 return AE_OK;
105
106 mutex_lock(&ioapic_list_lock);
107 list_for_each_entry(ioapic, &ioapic_list, list)
108 if (ioapic->handle == handle) {
109 mutex_unlock(&ioapic_list_lock);
110 return AE_OK;
111 }
112
113 status = acpi_evaluate_integer(handle, "_GSB", NULL, &gsi_base);
114 if (ACPI_FAILURE(status)) {
115 acpi_handle_warn(handle, "failed to evaluate _GSB method\n");
116 goto exit;
117 }
118
119 ioapic = kzalloc(sizeof(*ioapic), GFP_KERNEL);
120 if (!ioapic) {
121 pr_err("cannot allocate memory for new IOAPIC\n");
122 goto exit;
123 } else {
124 ioapic->root_handle = (acpi_handle)context;
125 ioapic->handle = handle;
126 ioapic->gsi_base = (u32)gsi_base;
127 INIT_LIST_HEAD(&ioapic->list);
128 }
129
130 if (acpi_ioapic_registered(handle, (u32)gsi_base))
131 goto done;
132
133 dev = acpi_get_pci_dev(handle);
134 if (dev && pci_resource_len(dev, 0)) {
135 if (pci_enable_device(dev) < 0)
136 goto exit_put;
137 pci_set_master(dev);
138 if (pci_request_region(dev, 0, type))
139 goto exit_disable;
140 res = &dev->resource[0];
141 ioapic->pdev = dev;
142 } else {
143 pci_dev_put(dev);
144 dev = NULL;
145
146 res = &ioapic->res;
147 acpi_walk_resources(handle, METHOD_NAME__CRS, setup_res, res);
148 if (res->flags == 0) {
149 acpi_handle_warn(handle, "failed to get resource\n");
150 goto exit_free;
151 } else if (request_resource(&iomem_resource, res)) {
152 acpi_handle_warn(handle, "failed to insert resource\n");
153 goto exit_free;
154 }
155 }
156
157 if (acpi_register_ioapic(handle, res->start, (u32)gsi_base)) {
158 acpi_handle_warn(handle, "failed to register IOAPIC\n");
159 goto exit_release;
160 }
161done:
162 list_add(&ioapic->list, &ioapic_list);
163 mutex_unlock(&ioapic_list_lock);
164
165 if (dev)
166 dev_info(&dev->dev, "%s at %pR, GSI %u\n",
167 type, res, (u32)gsi_base);
168 else
169 acpi_handle_info(handle, "%s at %pR, GSI %u\n",
170 type, res, (u32)gsi_base);
171
172 return AE_OK;
173
174exit_release:
175 if (dev)
176 pci_release_region(dev, 0);
177 else
178 release_resource(res);
179exit_disable:
180 if (dev)
181 pci_disable_device(dev);
182exit_put:
183 pci_dev_put(dev);
184exit_free:
185 kfree(ioapic);
186exit:
187 mutex_unlock(&ioapic_list_lock);
188 *(acpi_status *)rv = AE_ERROR;
189 return AE_OK;
190}
191
192int acpi_ioapic_add(struct acpi_pci_root *root)
193{
194 acpi_status status, retval = AE_OK;
195
196 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, root->device->handle,
197 UINT_MAX, handle_ioapic_add, NULL,
198 root->device->handle, (void **)&retval);
199
200 return ACPI_SUCCESS(status) && ACPI_SUCCESS(retval) ? 0 : -ENODEV;
201}
202
203int acpi_ioapic_remove(struct acpi_pci_root *root)
204{
205 int retval = 0;
206 struct acpi_pci_ioapic *ioapic, *tmp;
207
208 mutex_lock(&ioapic_list_lock);
209 list_for_each_entry_safe(ioapic, tmp, &ioapic_list, list) {
210 if (root->device->handle != ioapic->root_handle)
211 continue;
212
213 if (acpi_unregister_ioapic(ioapic->handle, ioapic->gsi_base))
214 retval = -EBUSY;
215
216 if (ioapic->pdev) {
217 pci_release_region(ioapic->pdev, 0);
218 pci_disable_device(ioapic->pdev);
219 pci_dev_put(ioapic->pdev);
220 } else if (ioapic->res.flags && ioapic->res.parent) {
221 release_resource(&ioapic->res);
222 }
223 list_del(&ioapic->list);
224 kfree(ioapic);
225 }
226 mutex_unlock(&ioapic_list_lock);
227
228 return retval;
229}
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 24b5476449a1..1333cbdc3ea2 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -177,12 +177,7 @@ static int __init slit_valid(struct acpi_table_slit *slit)
177 177
178static int __init acpi_parse_slit(struct acpi_table_header *table) 178static int __init acpi_parse_slit(struct acpi_table_header *table)
179{ 179{
180 struct acpi_table_slit *slit; 180 struct acpi_table_slit *slit = (struct acpi_table_slit *)table;
181
182 if (!table)
183 return -EINVAL;
184
185 slit = (struct acpi_table_slit *)table;
186 181
187 if (!slit_valid(slit)) { 182 if (!slit_valid(slit)) {
188 printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n"); 183 printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n");
@@ -260,11 +255,8 @@ acpi_parse_memory_affinity(struct acpi_subtable_header * header,
260 255
261static int __init acpi_parse_srat(struct acpi_table_header *table) 256static int __init acpi_parse_srat(struct acpi_table_header *table)
262{ 257{
263 struct acpi_table_srat *srat; 258 struct acpi_table_srat *srat = (struct acpi_table_srat *)table;
264 if (!table)
265 return -EINVAL;
266 259
267 srat = (struct acpi_table_srat *)table;
268 acpi_srat_revision = srat->header.revision; 260 acpi_srat_revision = srat->header.revision;
269 261
270 /* Real work done in acpi_table_parse_srat below. */ 262 /* Real work done in acpi_table_parse_srat below. */
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index b1def411c0b8..e7f718d6918a 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -485,14 +485,6 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
485 if (!pin || !dev->irq_managed || dev->irq <= 0) 485 if (!pin || !dev->irq_managed || dev->irq <= 0)
486 return; 486 return;
487 487
488 /* Keep IOAPIC pin configuration when suspending */
489 if (dev->dev.power.is_prepared)
490 return;
491#ifdef CONFIG_PM
492 if (dev->dev.power.runtime_status == RPM_SUSPENDING)
493 return;
494#endif
495
496 entry = acpi_pci_irq_lookup(dev, pin); 488 entry = acpi_pci_irq_lookup(dev, pin);
497 if (!entry) 489 if (!entry)
498 return; 490 return;
@@ -513,5 +505,6 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
513 if (gsi >= 0) { 505 if (gsi >= 0) {
514 acpi_unregister_gsi(gsi); 506 acpi_unregister_gsi(gsi);
515 dev->irq_managed = 0; 507 dev->irq_managed = 0;
508 dev->irq = 0;
516 } 509 }
517} 510}
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index c6bcb8c719d8..68a5f712cd19 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -112,10 +112,10 @@ get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
112 if (ACPI_FAILURE(status)) 112 if (ACPI_FAILURE(status))
113 return AE_OK; 113 return AE_OK;
114 114
115 if ((address.address_length > 0) && 115 if ((address.address.address_length > 0) &&
116 (address.resource_type == ACPI_BUS_NUMBER_RANGE)) { 116 (address.resource_type == ACPI_BUS_NUMBER_RANGE)) {
117 res->start = address.minimum; 117 res->start = address.address.minimum;
118 res->end = address.minimum + address.address_length - 1; 118 res->end = address.address.minimum + address.address.address_length - 1;
119 } 119 }
120 120
121 return AE_OK; 121 return AE_OK;
@@ -621,6 +621,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
621 if (hotadd) { 621 if (hotadd) {
622 pcibios_resource_survey_bus(root->bus); 622 pcibios_resource_survey_bus(root->bus);
623 pci_assign_unassigned_root_bus_resources(root->bus); 623 pci_assign_unassigned_root_bus_resources(root->bus);
624 acpi_ioapic_add(root);
624 } 625 }
625 626
626 pci_lock_rescan_remove(); 627 pci_lock_rescan_remove();
@@ -644,6 +645,8 @@ static void acpi_pci_root_remove(struct acpi_device *device)
644 645
645 pci_stop_root_bus(root->bus); 646 pci_stop_root_bus(root->bus);
646 647
648 WARN_ON(acpi_ioapic_remove(root));
649
647 device_set_run_wake(root->bus->bridge, false); 650 device_set_run_wake(root->bus->bridge, false);
648 pci_acpi_remove_bus_pm_notifier(device); 651 pci_acpi_remove_bus_pm_notifier(device);
649 652
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 02e48394276c..7962651cdbd4 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -4,6 +4,10 @@
4 * 4 *
5 * Alex Chiang <achiang@hp.com> 5 * Alex Chiang <achiang@hp.com>
6 * - Unified x86/ia64 implementations 6 * - Unified x86/ia64 implementations
7 *
8 * I/O APIC hotplug support
9 * Yinghai Lu <yinghai@kernel.org>
10 * Jiang Liu <jiang.liu@intel.com>
7 */ 11 */
8#include <linux/export.h> 12#include <linux/export.h>
9#include <linux/acpi.h> 13#include <linux/acpi.h>
@@ -12,6 +16,21 @@
12#define _COMPONENT ACPI_PROCESSOR_COMPONENT 16#define _COMPONENT ACPI_PROCESSOR_COMPONENT
13ACPI_MODULE_NAME("processor_core"); 17ACPI_MODULE_NAME("processor_core");
14 18
19static struct acpi_table_madt *get_madt_table(void)
20{
21 static struct acpi_table_madt *madt;
22 static int read_madt;
23
24 if (!read_madt) {
25 if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0,
26 (struct acpi_table_header **)&madt)))
27 madt = NULL;
28 read_madt++;
29 }
30
31 return madt;
32}
33
15static int map_lapic_id(struct acpi_subtable_header *entry, 34static int map_lapic_id(struct acpi_subtable_header *entry,
16 u32 acpi_id, int *apic_id) 35 u32 acpi_id, int *apic_id)
17{ 36{
@@ -67,17 +86,10 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
67static int map_madt_entry(int type, u32 acpi_id) 86static int map_madt_entry(int type, u32 acpi_id)
68{ 87{
69 unsigned long madt_end, entry; 88 unsigned long madt_end, entry;
70 static struct acpi_table_madt *madt;
71 static int read_madt;
72 int phys_id = -1; /* CPU hardware ID */ 89 int phys_id = -1; /* CPU hardware ID */
90 struct acpi_table_madt *madt;
73 91
74 if (!read_madt) { 92 madt = get_madt_table();
75 if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0,
76 (struct acpi_table_header **)&madt)))
77 madt = NULL;
78 read_madt++;
79 }
80
81 if (!madt) 93 if (!madt)
82 return phys_id; 94 return phys_id;
83 95
@@ -203,3 +215,96 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
203 return acpi_map_cpuid(phys_id, acpi_id); 215 return acpi_map_cpuid(phys_id, acpi_id);
204} 216}
205EXPORT_SYMBOL_GPL(acpi_get_cpuid); 217EXPORT_SYMBOL_GPL(acpi_get_cpuid);
218
219#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
220static int get_ioapic_id(struct acpi_subtable_header *entry, u32 gsi_base,
221 u64 *phys_addr, int *ioapic_id)
222{
223 struct acpi_madt_io_apic *ioapic = (struct acpi_madt_io_apic *)entry;
224
225 if (ioapic->global_irq_base != gsi_base)
226 return 0;
227
228 *phys_addr = ioapic->address;
229 *ioapic_id = ioapic->id;
230 return 1;
231}
232
233static int parse_madt_ioapic_entry(u32 gsi_base, u64 *phys_addr)
234{
235 struct acpi_subtable_header *hdr;
236 unsigned long madt_end, entry;
237 struct acpi_table_madt *madt;
238 int apic_id = -1;
239
240 madt = get_madt_table();
241 if (!madt)
242 return apic_id;
243
244 entry = (unsigned long)madt;
245 madt_end = entry + madt->header.length;
246
247 /* Parse all entries looking for a match. */
248 entry += sizeof(struct acpi_table_madt);
249 while (entry + sizeof(struct acpi_subtable_header) < madt_end) {
250 hdr = (struct acpi_subtable_header *)entry;
251 if (hdr->type == ACPI_MADT_TYPE_IO_APIC &&
252 get_ioapic_id(hdr, gsi_base, phys_addr, &apic_id))
253 break;
254 else
255 entry += hdr->length;
256 }
257
258 return apic_id;
259}
260
261static int parse_mat_ioapic_entry(acpi_handle handle, u32 gsi_base,
262 u64 *phys_addr)
263{
264 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
265 struct acpi_subtable_header *header;
266 union acpi_object *obj;
267 int apic_id = -1;
268
269 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
270 goto exit;
271
272 if (!buffer.length || !buffer.pointer)
273 goto exit;
274
275 obj = buffer.pointer;
276 if (obj->type != ACPI_TYPE_BUFFER ||
277 obj->buffer.length < sizeof(struct acpi_subtable_header))
278 goto exit;
279
280 header = (struct acpi_subtable_header *)obj->buffer.pointer;
281 if (header->type == ACPI_MADT_TYPE_IO_APIC)
282 get_ioapic_id(header, gsi_base, phys_addr, &apic_id);
283
284exit:
285 kfree(buffer.pointer);
286 return apic_id;
287}
288
289/**
290 * acpi_get_ioapic_id - Get IOAPIC ID and physical address matching @gsi_base
291 * @handle: ACPI object for IOAPIC device
292 * @gsi_base: GSI base to match with
293 * @phys_addr: Pointer to store physical address of matching IOAPIC record
294 *
295 * Walk resources returned by ACPI_MAT method, then ACPI MADT table, to search
296 * for an ACPI IOAPIC record matching @gsi_base.
297 * Return IOAPIC id and store physical address in @phys_addr if found a match,
298 * otherwise return <0.
299 */
300int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr)
301{
302 int apic_id;
303
304 apic_id = parse_mat_ioapic_entry(handle, gsi_base, phys_addr);
305 if (apic_id == -1)
306 apic_id = parse_madt_ioapic_entry(gsi_base, phys_addr);
307
308 return apic_id;
309}
310#endif /* CONFIG_ACPI_HOTPLUG_IOAPIC */
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 87b704e41877..c256bd7fbd78 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -681,15 +681,13 @@ static int acpi_idle_bm_check(void)
681} 681}
682 682
683/** 683/**
684 * acpi_idle_do_entry - a helper function that does C2 and C3 type entry 684 * acpi_idle_do_entry - enter idle state using the appropriate method
685 * @cx: cstate data 685 * @cx: cstate data
686 * 686 *
687 * Caller disables interrupt before call and enables interrupt after return. 687 * Caller disables interrupt before call and enables interrupt after return.
688 */ 688 */
689static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx) 689static void acpi_idle_do_entry(struct acpi_processor_cx *cx)
690{ 690{
691 /* Don't trace irqs off for idle */
692 stop_critical_timings();
693 if (cx->entry_method == ACPI_CSTATE_FFH) { 691 if (cx->entry_method == ACPI_CSTATE_FFH) {
694 /* Call into architectural FFH based C-state */ 692 /* Call into architectural FFH based C-state */
695 acpi_processor_ffh_cstate_enter(cx); 693 acpi_processor_ffh_cstate_enter(cx);
@@ -703,38 +701,9 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
703 gets asserted in time to freeze execution properly. */ 701 gets asserted in time to freeze execution properly. */
704 inl(acpi_gbl_FADT.xpm_timer_block.address); 702 inl(acpi_gbl_FADT.xpm_timer_block.address);
705 } 703 }
706 start_critical_timings();
707} 704}
708 705
709/** 706/**
710 * acpi_idle_enter_c1 - enters an ACPI C1 state-type
711 * @dev: the target CPU
712 * @drv: cpuidle driver containing cpuidle state info
713 * @index: index of target state
714 *
715 * This is equivalent to the HALT instruction.
716 */
717static int acpi_idle_enter_c1(struct cpuidle_device *dev,
718 struct cpuidle_driver *drv, int index)
719{
720 struct acpi_processor *pr;
721 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
722
723 pr = __this_cpu_read(processors);
724
725 if (unlikely(!pr))
726 return -EINVAL;
727
728 lapic_timer_state_broadcast(pr, cx, 1);
729 acpi_idle_do_entry(cx);
730
731 lapic_timer_state_broadcast(pr, cx, 0);
732
733 return index;
734}
735
736
737/**
738 * acpi_idle_play_dead - enters an ACPI state for long-term idle (i.e. off-lining) 707 * acpi_idle_play_dead - enters an ACPI state for long-term idle (i.e. off-lining)
739 * @dev: the target CPU 708 * @dev: the target CPU
740 * @index: the index of suggested state 709 * @index: the index of suggested state
@@ -761,47 +730,11 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index)
761 return 0; 730 return 0;
762} 731}
763 732
764/** 733static bool acpi_idle_fallback_to_c1(struct acpi_processor *pr)
765 * acpi_idle_enter_simple - enters an ACPI state without BM handling
766 * @dev: the target CPU
767 * @drv: cpuidle driver with cpuidle state information
768 * @index: the index of suggested state
769 */
770static int acpi_idle_enter_simple(struct cpuidle_device *dev,
771 struct cpuidle_driver *drv, int index)
772{ 734{
773 struct acpi_processor *pr; 735 return IS_ENABLED(CONFIG_HOTPLUG_CPU) && num_online_cpus() > 1 &&
774 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); 736 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED) &&
775 737 !pr->flags.has_cst;
776 pr = __this_cpu_read(processors);
777
778 if (unlikely(!pr))
779 return -EINVAL;
780
781#ifdef CONFIG_HOTPLUG_CPU
782 if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
783 !pr->flags.has_cst &&
784 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
785 return acpi_idle_enter_c1(dev, drv, CPUIDLE_DRIVER_STATE_START);
786#endif
787
788 /*
789 * Must be done before busmaster disable as we might need to
790 * access HPET !
791 */
792 lapic_timer_state_broadcast(pr, cx, 1);
793
794 if (cx->type == ACPI_STATE_C3)
795 ACPI_FLUSH_CPU_CACHE();
796
797 /* Tell the scheduler that we are going deep-idle: */
798 sched_clock_idle_sleep_event();
799 acpi_idle_do_entry(cx);
800
801 sched_clock_idle_wakeup_event(0);
802
803 lapic_timer_state_broadcast(pr, cx, 0);
804 return index;
805} 738}
806 739
807static int c3_cpu_count; 740static int c3_cpu_count;
@@ -809,44 +742,14 @@ static DEFINE_RAW_SPINLOCK(c3_lock);
809 742
810/** 743/**
811 * acpi_idle_enter_bm - enters C3 with proper BM handling 744 * acpi_idle_enter_bm - enters C3 with proper BM handling
812 * @dev: the target CPU 745 * @pr: Target processor
813 * @drv: cpuidle driver containing state data 746 * @cx: Target state context
814 * @index: the index of suggested state
815 *
816 * If BM is detected, the deepest non-C3 idle state is entered instead.
817 */ 747 */
818static int acpi_idle_enter_bm(struct cpuidle_device *dev, 748static void acpi_idle_enter_bm(struct acpi_processor *pr,
819 struct cpuidle_driver *drv, int index) 749 struct acpi_processor_cx *cx)
820{ 750{
821 struct acpi_processor *pr;
822 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
823
824 pr = __this_cpu_read(processors);
825
826 if (unlikely(!pr))
827 return -EINVAL;
828
829#ifdef CONFIG_HOTPLUG_CPU
830 if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
831 !pr->flags.has_cst &&
832 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
833 return acpi_idle_enter_c1(dev, drv, CPUIDLE_DRIVER_STATE_START);
834#endif
835
836 if (!cx->bm_sts_skip && acpi_idle_bm_check()) {
837 if (drv->safe_state_index >= 0) {
838 return drv->states[drv->safe_state_index].enter(dev,
839 drv, drv->safe_state_index);
840 } else {
841 acpi_safe_halt();
842 return -EBUSY;
843 }
844 }
845
846 acpi_unlazy_tlb(smp_processor_id()); 751 acpi_unlazy_tlb(smp_processor_id());
847 752
848 /* Tell the scheduler that we are going deep-idle: */
849 sched_clock_idle_sleep_event();
850 /* 753 /*
851 * Must be done before busmaster disable as we might need to 754 * Must be done before busmaster disable as we might need to
852 * access HPET ! 755 * access HPET !
@@ -856,37 +759,71 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
856 /* 759 /*
857 * disable bus master 760 * disable bus master
858 * bm_check implies we need ARB_DIS 761 * bm_check implies we need ARB_DIS
859 * !bm_check implies we need cache flush
860 * bm_control implies whether we can do ARB_DIS 762 * bm_control implies whether we can do ARB_DIS
861 * 763 *
862 * That leaves a case where bm_check is set and bm_control is 764 * That leaves a case where bm_check is set and bm_control is
863 * not set. In that case we cannot do much, we enter C3 765 * not set. In that case we cannot do much, we enter C3
864 * without doing anything. 766 * without doing anything.
865 */ 767 */
866 if (pr->flags.bm_check && pr->flags.bm_control) { 768 if (pr->flags.bm_control) {
867 raw_spin_lock(&c3_lock); 769 raw_spin_lock(&c3_lock);
868 c3_cpu_count++; 770 c3_cpu_count++;
869 /* Disable bus master arbitration when all CPUs are in C3 */ 771 /* Disable bus master arbitration when all CPUs are in C3 */
870 if (c3_cpu_count == num_online_cpus()) 772 if (c3_cpu_count == num_online_cpus())
871 acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1); 773 acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1);
872 raw_spin_unlock(&c3_lock); 774 raw_spin_unlock(&c3_lock);
873 } else if (!pr->flags.bm_check) {
874 ACPI_FLUSH_CPU_CACHE();
875 } 775 }
876 776
877 acpi_idle_do_entry(cx); 777 acpi_idle_do_entry(cx);
878 778
879 /* Re-enable bus master arbitration */ 779 /* Re-enable bus master arbitration */
880 if (pr->flags.bm_check && pr->flags.bm_control) { 780 if (pr->flags.bm_control) {
881 raw_spin_lock(&c3_lock); 781 raw_spin_lock(&c3_lock);
882 acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0); 782 acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0);
883 c3_cpu_count--; 783 c3_cpu_count--;
884 raw_spin_unlock(&c3_lock); 784 raw_spin_unlock(&c3_lock);
885 } 785 }
886 786
887 sched_clock_idle_wakeup_event(0); 787 lapic_timer_state_broadcast(pr, cx, 0);
788}
789
790static int acpi_idle_enter(struct cpuidle_device *dev,
791 struct cpuidle_driver *drv, int index)
792{
793 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
794 struct acpi_processor *pr;
795
796 pr = __this_cpu_read(processors);
797 if (unlikely(!pr))
798 return -EINVAL;
799
800 if (cx->type != ACPI_STATE_C1) {
801 if (acpi_idle_fallback_to_c1(pr)) {
802 index = CPUIDLE_DRIVER_STATE_START;
803 cx = per_cpu(acpi_cstate[index], dev->cpu);
804 } else if (cx->type == ACPI_STATE_C3 && pr->flags.bm_check) {
805 if (cx->bm_sts_skip || !acpi_idle_bm_check()) {
806 acpi_idle_enter_bm(pr, cx);
807 return index;
808 } else if (drv->safe_state_index >= 0) {
809 index = drv->safe_state_index;
810 cx = per_cpu(acpi_cstate[index], dev->cpu);
811 } else {
812 acpi_safe_halt();
813 return -EBUSY;
814 }
815 }
816 }
817
818 lapic_timer_state_broadcast(pr, cx, 1);
819
820 if (cx->type == ACPI_STATE_C3)
821 ACPI_FLUSH_CPU_CACHE();
822
823 acpi_idle_do_entry(cx);
888 824
889 lapic_timer_state_broadcast(pr, cx, 0); 825 lapic_timer_state_broadcast(pr, cx, 0);
826
890 return index; 827 return index;
891} 828}
892 829
@@ -981,27 +918,12 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
981 strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); 918 strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
982 state->exit_latency = cx->latency; 919 state->exit_latency = cx->latency;
983 state->target_residency = cx->latency * latency_factor; 920 state->target_residency = cx->latency * latency_factor;
921 state->enter = acpi_idle_enter;
984 922
985 state->flags = 0; 923 state->flags = 0;
986 switch (cx->type) { 924 if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2) {
987 case ACPI_STATE_C1:
988
989 state->enter = acpi_idle_enter_c1;
990 state->enter_dead = acpi_idle_play_dead;
991 drv->safe_state_index = count;
992 break;
993
994 case ACPI_STATE_C2:
995 state->enter = acpi_idle_enter_simple;
996 state->enter_dead = acpi_idle_play_dead; 925 state->enter_dead = acpi_idle_play_dead;
997 drv->safe_state_index = count; 926 drv->safe_state_index = count;
998 break;
999
1000 case ACPI_STATE_C3:
1001 state->enter = pr->flags.bm_check ?
1002 acpi_idle_enter_bm :
1003 acpi_idle_enter_simple;
1004 break;
1005 } 927 }
1006 928
1007 count++; 929 count++;
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index 782a0d15c25f..4752b9939987 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -34,21 +34,34 @@
34#define valid_IRQ(i) (true) 34#define valid_IRQ(i) (true)
35#endif 35#endif
36 36
37static unsigned long acpi_dev_memresource_flags(u64 len, u8 write_protect, 37static bool acpi_dev_resource_len_valid(u64 start, u64 end, u64 len, bool io)
38 bool window)
39{ 38{
40 unsigned long flags = IORESOURCE_MEM; 39 u64 reslen = end - start + 1;
41 40
42 if (len == 0) 41 /*
43 flags |= IORESOURCE_DISABLED; 42 * CHECKME: len might be required to check versus a minimum
43 * length as well. 1 for io is fine, but for memory it does
44 * not make any sense at all.
45 */
46 if (len && reslen && reslen == len && start <= end)
47 return true;
44 48
45 if (write_protect == ACPI_READ_WRITE_MEMORY) 49 pr_info("ACPI: invalid or unassigned resource %s [%016llx - %016llx] length [%016llx]\n",
46 flags |= IORESOURCE_MEM_WRITEABLE; 50 io ? "io" : "mem", start, end, len);
51
52 return false;
53}
54
55static void acpi_dev_memresource_flags(struct resource *res, u64 len,
56 u8 write_protect)
57{
58 res->flags = IORESOURCE_MEM;
47 59
48 if (window) 60 if (!acpi_dev_resource_len_valid(res->start, res->end, len, false))
49 flags |= IORESOURCE_WINDOW; 61 res->flags |= IORESOURCE_DISABLED | IORESOURCE_UNSET;
50 62
51 return flags; 63 if (write_protect == ACPI_READ_WRITE_MEMORY)
64 res->flags |= IORESOURCE_MEM_WRITEABLE;
52} 65}
53 66
54static void acpi_dev_get_memresource(struct resource *res, u64 start, u64 len, 67static void acpi_dev_get_memresource(struct resource *res, u64 start, u64 len,
@@ -56,7 +69,7 @@ static void acpi_dev_get_memresource(struct resource *res, u64 start, u64 len,
56{ 69{
57 res->start = start; 70 res->start = start;
58 res->end = start + len - 1; 71 res->end = start + len - 1;
59 res->flags = acpi_dev_memresource_flags(len, write_protect, false); 72 acpi_dev_memresource_flags(res, len, write_protect);
60} 73}
61 74
62/** 75/**
@@ -67,6 +80,11 @@ static void acpi_dev_get_memresource(struct resource *res, u64 start, u64 len,
67 * Check if the given ACPI resource object represents a memory resource and 80 * Check if the given ACPI resource object represents a memory resource and
68 * if that's the case, use the information in it to populate the generic 81 * if that's the case, use the information in it to populate the generic
69 * resource object pointed to by @res. 82 * resource object pointed to by @res.
83 *
84 * Return:
85 * 1) false with res->flags setting to zero: not the expected resource type
86 * 2) false with IORESOURCE_DISABLED in res->flags: valid unassigned resource
87 * 3) true: valid assigned resource
70 */ 88 */
71bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res) 89bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res)
72{ 90{
@@ -77,60 +95,52 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res)
77 switch (ares->type) { 95 switch (ares->type) {
78 case ACPI_RESOURCE_TYPE_MEMORY24: 96 case ACPI_RESOURCE_TYPE_MEMORY24:
79 memory24 = &ares->data.memory24; 97 memory24 = &ares->data.memory24;
80 if (!memory24->minimum && !memory24->address_length) 98 acpi_dev_get_memresource(res, memory24->minimum << 8,
81 return false; 99 memory24->address_length << 8,
82 acpi_dev_get_memresource(res, memory24->minimum,
83 memory24->address_length,
84 memory24->write_protect); 100 memory24->write_protect);
85 break; 101 break;
86 case ACPI_RESOURCE_TYPE_MEMORY32: 102 case ACPI_RESOURCE_TYPE_MEMORY32:
87 memory32 = &ares->data.memory32; 103 memory32 = &ares->data.memory32;
88 if (!memory32->minimum && !memory32->address_length)
89 return false;
90 acpi_dev_get_memresource(res, memory32->minimum, 104 acpi_dev_get_memresource(res, memory32->minimum,
91 memory32->address_length, 105 memory32->address_length,
92 memory32->write_protect); 106 memory32->write_protect);
93 break; 107 break;
94 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: 108 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
95 fixed_memory32 = &ares->data.fixed_memory32; 109 fixed_memory32 = &ares->data.fixed_memory32;
96 if (!fixed_memory32->address && !fixed_memory32->address_length)
97 return false;
98 acpi_dev_get_memresource(res, fixed_memory32->address, 110 acpi_dev_get_memresource(res, fixed_memory32->address,
99 fixed_memory32->address_length, 111 fixed_memory32->address_length,
100 fixed_memory32->write_protect); 112 fixed_memory32->write_protect);
101 break; 113 break;
102 default: 114 default:
115 res->flags = 0;
103 return false; 116 return false;
104 } 117 }
105 return true; 118
119 return !(res->flags & IORESOURCE_DISABLED);
106} 120}
107EXPORT_SYMBOL_GPL(acpi_dev_resource_memory); 121EXPORT_SYMBOL_GPL(acpi_dev_resource_memory);
108 122
109static unsigned int acpi_dev_ioresource_flags(u64 start, u64 end, u8 io_decode, 123static void acpi_dev_ioresource_flags(struct resource *res, u64 len,
110 bool window) 124 u8 io_decode)
111{ 125{
112 int flags = IORESOURCE_IO; 126 res->flags = IORESOURCE_IO;
113 127
114 if (io_decode == ACPI_DECODE_16) 128 if (!acpi_dev_resource_len_valid(res->start, res->end, len, true))
115 flags |= IORESOURCE_IO_16BIT_ADDR; 129 res->flags |= IORESOURCE_DISABLED | IORESOURCE_UNSET;
116 130
117 if (start > end || end >= 0x10003) 131 if (res->end >= 0x10003)
118 flags |= IORESOURCE_DISABLED; 132 res->flags |= IORESOURCE_DISABLED | IORESOURCE_UNSET;
119 133
120 if (window) 134 if (io_decode == ACPI_DECODE_16)
121 flags |= IORESOURCE_WINDOW; 135 res->flags |= IORESOURCE_IO_16BIT_ADDR;
122
123 return flags;
124} 136}
125 137
126static void acpi_dev_get_ioresource(struct resource *res, u64 start, u64 len, 138static void acpi_dev_get_ioresource(struct resource *res, u64 start, u64 len,
127 u8 io_decode) 139 u8 io_decode)
128{ 140{
129 u64 end = start + len - 1;
130
131 res->start = start; 141 res->start = start;
132 res->end = end; 142 res->end = start + len - 1;
133 res->flags = acpi_dev_ioresource_flags(start, end, io_decode, false); 143 acpi_dev_ioresource_flags(res, len, io_decode);
134} 144}
135 145
136/** 146/**
@@ -141,6 +151,11 @@ static void acpi_dev_get_ioresource(struct resource *res, u64 start, u64 len,
141 * Check if the given ACPI resource object represents an I/O resource and 151 * Check if the given ACPI resource object represents an I/O resource and
142 * if that's the case, use the information in it to populate the generic 152 * if that's the case, use the information in it to populate the generic
143 * resource object pointed to by @res. 153 * resource object pointed to by @res.
154 *
155 * Return:
156 * 1) false with res->flags setting to zero: not the expected resource type
157 * 2) false with IORESOURCE_DISABLED in res->flags: valid unassigned resource
158 * 3) true: valid assigned resource
144 */ 159 */
145bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res) 160bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res)
146{ 161{
@@ -150,135 +165,143 @@ bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res)
150 switch (ares->type) { 165 switch (ares->type) {
151 case ACPI_RESOURCE_TYPE_IO: 166 case ACPI_RESOURCE_TYPE_IO:
152 io = &ares->data.io; 167 io = &ares->data.io;
153 if (!io->minimum && !io->address_length)
154 return false;
155 acpi_dev_get_ioresource(res, io->minimum, 168 acpi_dev_get_ioresource(res, io->minimum,
156 io->address_length, 169 io->address_length,
157 io->io_decode); 170 io->io_decode);
158 break; 171 break;
159 case ACPI_RESOURCE_TYPE_FIXED_IO: 172 case ACPI_RESOURCE_TYPE_FIXED_IO:
160 fixed_io = &ares->data.fixed_io; 173 fixed_io = &ares->data.fixed_io;
161 if (!fixed_io->address && !fixed_io->address_length)
162 return false;
163 acpi_dev_get_ioresource(res, fixed_io->address, 174 acpi_dev_get_ioresource(res, fixed_io->address,
164 fixed_io->address_length, 175 fixed_io->address_length,
165 ACPI_DECODE_10); 176 ACPI_DECODE_10);
166 break; 177 break;
167 default: 178 default:
179 res->flags = 0;
168 return false; 180 return false;
169 } 181 }
170 return true; 182
183 return !(res->flags & IORESOURCE_DISABLED);
171} 184}
172EXPORT_SYMBOL_GPL(acpi_dev_resource_io); 185EXPORT_SYMBOL_GPL(acpi_dev_resource_io);
173 186
174/** 187static bool acpi_decode_space(struct resource_win *win,
175 * acpi_dev_resource_address_space - Extract ACPI address space information. 188 struct acpi_resource_address *addr,
176 * @ares: Input ACPI resource object. 189 struct acpi_address64_attribute *attr)
177 * @res: Output generic resource object.
178 *
179 * Check if the given ACPI resource object represents an address space resource
180 * and if that's the case, use the information in it to populate the generic
181 * resource object pointed to by @res.
182 */
183bool acpi_dev_resource_address_space(struct acpi_resource *ares,
184 struct resource *res)
185{ 190{
186 acpi_status status; 191 u8 iodec = attr->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16;
187 struct acpi_resource_address64 addr; 192 bool wp = addr->info.mem.write_protect;
188 bool window; 193 u64 len = attr->address_length;
189 u64 len; 194 struct resource *res = &win->res;
190 u8 io_decode;
191 195
192 switch (ares->type) { 196 /*
193 case ACPI_RESOURCE_TYPE_ADDRESS16: 197 * Filter out invalid descriptor according to ACPI Spec 5.0, section
194 case ACPI_RESOURCE_TYPE_ADDRESS32: 198 * 6.4.3.5 Address Space Resource Descriptors.
195 case ACPI_RESOURCE_TYPE_ADDRESS64: 199 */
196 break; 200 if ((addr->min_address_fixed != addr->max_address_fixed && len) ||
197 default: 201 (addr->min_address_fixed && addr->max_address_fixed && !len))
198 return false; 202 pr_debug("ACPI: Invalid address space min_addr_fix %d, max_addr_fix %d, len %llx\n",
199 } 203 addr->min_address_fixed, addr->max_address_fixed, len);
200 204
201 status = acpi_resource_to_address64(ares, &addr); 205 res->start = attr->minimum;
202 if (ACPI_FAILURE(status)) 206 res->end = attr->maximum;
203 return false;
204 207
205 res->start = addr.minimum; 208 /*
206 res->end = addr.maximum; 209 * For bridges that translate addresses across the bridge,
207 window = addr.producer_consumer == ACPI_PRODUCER; 210 * translation_offset is the offset that must be added to the
211 * address on the secondary side to obtain the address on the
212 * primary side. Non-bridge devices must list 0 for all Address
213 * Translation offset bits.
214 */
215 if (addr->producer_consumer == ACPI_PRODUCER) {
216 res->start += attr->translation_offset;
217 res->end += attr->translation_offset;
218 } else if (attr->translation_offset) {
219 pr_debug("ACPI: translation_offset(%lld) is invalid for non-bridge device.\n",
220 attr->translation_offset);
221 }
208 222
209 switch(addr.resource_type) { 223 switch (addr->resource_type) {
210 case ACPI_MEMORY_RANGE: 224 case ACPI_MEMORY_RANGE:
211 len = addr.maximum - addr.minimum + 1; 225 acpi_dev_memresource_flags(res, len, wp);
212 res->flags = acpi_dev_memresource_flags(len,
213 addr.info.mem.write_protect,
214 window);
215 break; 226 break;
216 case ACPI_IO_RANGE: 227 case ACPI_IO_RANGE:
217 io_decode = addr.granularity == 0xfff ? 228 acpi_dev_ioresource_flags(res, len, iodec);
218 ACPI_DECODE_10 : ACPI_DECODE_16;
219 res->flags = acpi_dev_ioresource_flags(addr.minimum,
220 addr.maximum,
221 io_decode, window);
222 break; 229 break;
223 case ACPI_BUS_NUMBER_RANGE: 230 case ACPI_BUS_NUMBER_RANGE:
224 res->flags = IORESOURCE_BUS; 231 res->flags = IORESOURCE_BUS;
225 break; 232 break;
226 default: 233 default:
227 res->flags = 0; 234 return false;
228 } 235 }
229 236
230 return true; 237 win->offset = attr->translation_offset;
238
239 if (addr->producer_consumer == ACPI_PRODUCER)
240 res->flags |= IORESOURCE_WINDOW;
241
242 if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
243 res->flags |= IORESOURCE_PREFETCH;
244
245 return !(res->flags & IORESOURCE_DISABLED);
246}
247
248/**
249 * acpi_dev_resource_address_space - Extract ACPI address space information.
250 * @ares: Input ACPI resource object.
251 * @win: Output generic resource object.
252 *
253 * Check if the given ACPI resource object represents an address space resource
254 * and if that's the case, use the information in it to populate the generic
255 * resource object pointed to by @win.
256 *
257 * Return:
258 * 1) false with win->res.flags setting to zero: not the expected resource type
259 * 2) false with IORESOURCE_DISABLED in win->res.flags: valid unassigned
260 * resource
261 * 3) true: valid assigned resource
262 */
263bool acpi_dev_resource_address_space(struct acpi_resource *ares,
264 struct resource_win *win)
265{
266 struct acpi_resource_address64 addr;
267
268 win->res.flags = 0;
269 if (ACPI_FAILURE(acpi_resource_to_address64(ares, &addr)))
270 return false;
271
272 return acpi_decode_space(win, (struct acpi_resource_address *)&addr,
273 &addr.address);
231} 274}
232EXPORT_SYMBOL_GPL(acpi_dev_resource_address_space); 275EXPORT_SYMBOL_GPL(acpi_dev_resource_address_space);
233 276
234/** 277/**
235 * acpi_dev_resource_ext_address_space - Extract ACPI address space information. 278 * acpi_dev_resource_ext_address_space - Extract ACPI address space information.
236 * @ares: Input ACPI resource object. 279 * @ares: Input ACPI resource object.
237 * @res: Output generic resource object. 280 * @win: Output generic resource object.
238 * 281 *
239 * Check if the given ACPI resource object represents an extended address space 282 * Check if the given ACPI resource object represents an extended address space
240 * resource and if that's the case, use the information in it to populate the 283 * resource and if that's the case, use the information in it to populate the
241 * generic resource object pointed to by @res. 284 * generic resource object pointed to by @win.
285 *
286 * Return:
287 * 1) false with win->res.flags setting to zero: not the expected resource type
288 * 2) false with IORESOURCE_DISABLED in win->res.flags: valid unassigned
289 * resource
290 * 3) true: valid assigned resource
242 */ 291 */
243bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares, 292bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares,
244 struct resource *res) 293 struct resource_win *win)
245{ 294{
246 struct acpi_resource_extended_address64 *ext_addr; 295 struct acpi_resource_extended_address64 *ext_addr;
247 bool window;
248 u64 len;
249 u8 io_decode;
250 296
297 win->res.flags = 0;
251 if (ares->type != ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64) 298 if (ares->type != ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64)
252 return false; 299 return false;
253 300
254 ext_addr = &ares->data.ext_address64; 301 ext_addr = &ares->data.ext_address64;
255 302
256 res->start = ext_addr->minimum; 303 return acpi_decode_space(win, (struct acpi_resource_address *)ext_addr,
257 res->end = ext_addr->maximum; 304 &ext_addr->address);
258 window = ext_addr->producer_consumer == ACPI_PRODUCER;
259
260 switch(ext_addr->resource_type) {
261 case ACPI_MEMORY_RANGE:
262 len = ext_addr->maximum - ext_addr->minimum + 1;
263 res->flags = acpi_dev_memresource_flags(len,
264 ext_addr->info.mem.write_protect,
265 window);
266 break;
267 case ACPI_IO_RANGE:
268 io_decode = ext_addr->granularity == 0xfff ?
269 ACPI_DECODE_10 : ACPI_DECODE_16;
270 res->flags = acpi_dev_ioresource_flags(ext_addr->minimum,
271 ext_addr->maximum,
272 io_decode, window);
273 break;
274 case ACPI_BUS_NUMBER_RANGE:
275 res->flags = IORESOURCE_BUS;
276 break;
277 default:
278 res->flags = 0;
279 }
280
281 return true;
282} 305}
283EXPORT_SYMBOL_GPL(acpi_dev_resource_ext_address_space); 306EXPORT_SYMBOL_GPL(acpi_dev_resource_ext_address_space);
284 307
@@ -310,7 +333,7 @@ static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi)
310{ 333{
311 res->start = gsi; 334 res->start = gsi;
312 res->end = gsi; 335 res->end = gsi;
313 res->flags = IORESOURCE_IRQ | IORESOURCE_DISABLED; 336 res->flags = IORESOURCE_IRQ | IORESOURCE_DISABLED | IORESOURCE_UNSET;
314} 337}
315 338
316static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, 339static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
@@ -369,6 +392,11 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
369 * represented by the resource and populate the generic resource object pointed 392 * represented by the resource and populate the generic resource object pointed
370 * to by @res accordingly. If the registration of the GSI is not successful, 393 * to by @res accordingly. If the registration of the GSI is not successful,
371 * IORESOURCE_DISABLED will be set it that object's flags. 394 * IORESOURCE_DISABLED will be set it that object's flags.
395 *
396 * Return:
397 * 1) false with res->flags setting to zero: not the expected resource type
398 * 2) false with IORESOURCE_DISABLED in res->flags: valid unassigned resource
399 * 3) true: valid assigned resource
372 */ 400 */
373bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, 401bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
374 struct resource *res) 402 struct resource *res)
@@ -402,6 +430,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
402 ext_irq->sharable, false); 430 ext_irq->sharable, false);
403 break; 431 break;
404 default: 432 default:
433 res->flags = 0;
405 return false; 434 return false;
406 } 435 }
407 436
@@ -415,12 +444,7 @@ EXPORT_SYMBOL_GPL(acpi_dev_resource_interrupt);
415 */ 444 */
416void acpi_dev_free_resource_list(struct list_head *list) 445void acpi_dev_free_resource_list(struct list_head *list)
417{ 446{
418 struct resource_list_entry *rentry, *re; 447 resource_list_free(list);
419
420 list_for_each_entry_safe(rentry, re, list, node) {
421 list_del(&rentry->node);
422 kfree(rentry);
423 }
424} 448}
425EXPORT_SYMBOL_GPL(acpi_dev_free_resource_list); 449EXPORT_SYMBOL_GPL(acpi_dev_free_resource_list);
426 450
@@ -432,18 +456,19 @@ struct res_proc_context {
432 int error; 456 int error;
433}; 457};
434 458
435static acpi_status acpi_dev_new_resource_entry(struct resource *r, 459static acpi_status acpi_dev_new_resource_entry(struct resource_win *win,
436 struct res_proc_context *c) 460 struct res_proc_context *c)
437{ 461{
438 struct resource_list_entry *rentry; 462 struct resource_entry *rentry;
439 463
440 rentry = kmalloc(sizeof(*rentry), GFP_KERNEL); 464 rentry = resource_list_create_entry(NULL, 0);
441 if (!rentry) { 465 if (!rentry) {
442 c->error = -ENOMEM; 466 c->error = -ENOMEM;
443 return AE_NO_MEMORY; 467 return AE_NO_MEMORY;
444 } 468 }
445 rentry->res = *r; 469 *rentry->res = win->res;
446 list_add_tail(&rentry->node, c->list); 470 rentry->offset = win->offset;
471 resource_list_add_tail(rentry, c->list);
447 c->count++; 472 c->count++;
448 return AE_OK; 473 return AE_OK;
449} 474}
@@ -452,7 +477,8 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
452 void *context) 477 void *context)
453{ 478{
454 struct res_proc_context *c = context; 479 struct res_proc_context *c = context;
455 struct resource r; 480 struct resource_win win;
481 struct resource *res = &win.res;
456 int i; 482 int i;
457 483
458 if (c->preproc) { 484 if (c->preproc) {
@@ -467,18 +493,18 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
467 } 493 }
468 } 494 }
469 495
470 memset(&r, 0, sizeof(r)); 496 memset(&win, 0, sizeof(win));
471 497
472 if (acpi_dev_resource_memory(ares, &r) 498 if (acpi_dev_resource_memory(ares, res)
473 || acpi_dev_resource_io(ares, &r) 499 || acpi_dev_resource_io(ares, res)
474 || acpi_dev_resource_address_space(ares, &r) 500 || acpi_dev_resource_address_space(ares, &win)
475 || acpi_dev_resource_ext_address_space(ares, &r)) 501 || acpi_dev_resource_ext_address_space(ares, &win))
476 return acpi_dev_new_resource_entry(&r, c); 502 return acpi_dev_new_resource_entry(&win, c);
477 503
478 for (i = 0; acpi_dev_resource_interrupt(ares, i, &r); i++) { 504 for (i = 0; acpi_dev_resource_interrupt(ares, i, res); i++) {
479 acpi_status status; 505 acpi_status status;
480 506
481 status = acpi_dev_new_resource_entry(&r, c); 507 status = acpi_dev_new_resource_entry(&win, c);
482 if (ACPI_FAILURE(status)) 508 if (ACPI_FAILURE(status))
483 return status; 509 return status;
484 } 510 }
@@ -503,7 +529,7 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
503 * returned as the final error code. 529 * returned as the final error code.
504 * 530 *
505 * The resultant struct resource objects are put on the list pointed to by 531 * The resultant struct resource objects are put on the list pointed to by
506 * @list, that must be empty initially, as members of struct resource_list_entry 532 * @list, that must be empty initially, as members of struct resource_entry
507 * objects. Callers of this routine should use %acpi_dev_free_resource_list() to 533 * objects. Callers of this routine should use %acpi_dev_free_resource_list() to
508 * free that list. 534 * free that list.
509 * 535 *
@@ -538,3 +564,58 @@ int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list,
538 return c.count; 564 return c.count;
539} 565}
540EXPORT_SYMBOL_GPL(acpi_dev_get_resources); 566EXPORT_SYMBOL_GPL(acpi_dev_get_resources);
567
568/**
569 * acpi_dev_filter_resource_type - Filter ACPI resource according to resource
570 * types
571 * @ares: Input ACPI resource object.
572 * @types: Valid resource types of IORESOURCE_XXX
573 *
574 * This is a hepler function to support acpi_dev_get_resources(), which filters
575 * ACPI resource objects according to resource types.
576 */
577int acpi_dev_filter_resource_type(struct acpi_resource *ares,
578 unsigned long types)
579{
580 unsigned long type = 0;
581
582 switch (ares->type) {
583 case ACPI_RESOURCE_TYPE_MEMORY24:
584 case ACPI_RESOURCE_TYPE_MEMORY32:
585 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
586 type = IORESOURCE_MEM;
587 break;
588 case ACPI_RESOURCE_TYPE_IO:
589 case ACPI_RESOURCE_TYPE_FIXED_IO:
590 type = IORESOURCE_IO;
591 break;
592 case ACPI_RESOURCE_TYPE_IRQ:
593 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
594 type = IORESOURCE_IRQ;
595 break;
596 case ACPI_RESOURCE_TYPE_DMA:
597 case ACPI_RESOURCE_TYPE_FIXED_DMA:
598 type = IORESOURCE_DMA;
599 break;
600 case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
601 type = IORESOURCE_REG;
602 break;
603 case ACPI_RESOURCE_TYPE_ADDRESS16:
604 case ACPI_RESOURCE_TYPE_ADDRESS32:
605 case ACPI_RESOURCE_TYPE_ADDRESS64:
606 case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
607 if (ares->data.address.resource_type == ACPI_MEMORY_RANGE)
608 type = IORESOURCE_MEM;
609 else if (ares->data.address.resource_type == ACPI_IO_RANGE)
610 type = IORESOURCE_IO;
611 else if (ares->data.address.resource_type ==
612 ACPI_BUS_NUMBER_RANGE)
613 type = IORESOURCE_BUS;
614 break;
615 default:
616 break;
617 }
618
619 return (type & types) ? 0 : 1;
620}
621EXPORT_SYMBOL_GPL(acpi_dev_filter_resource_type);
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index dc4d8960684a..bbca7830e18a 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2544,6 +2544,7 @@ int __init acpi_scan_init(void)
2544 acpi_pci_link_init(); 2544 acpi_pci_link_init();
2545 acpi_processor_init(); 2545 acpi_processor_init();
2546 acpi_lpss_init(); 2546 acpi_lpss_init();
2547 acpi_apd_init();
2547 acpi_cmos_rtc_init(); 2548 acpi_cmos_rtc_init();
2548 acpi_container_init(); 2549 acpi_container_init();
2549 acpi_memory_hotplug_init(); 2550 acpi_memory_hotplug_init();
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 8aa9254a387f..7f251dd1a687 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -321,7 +321,7 @@ static struct dmi_system_id acpisleep_dmi_table[] __initdata = {
321 {}, 321 {},
322}; 322};
323 323
324static void acpi_sleep_dmi_check(void) 324static void __init acpi_sleep_dmi_check(void)
325{ 325{
326 int year; 326 int year;
327 327
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 032db459370f..88a4f99dd2a7 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -522,6 +522,24 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
522 DMI_MATCH(DMI_PRODUCT_NAME, "370R4E/370R4V/370R5E/3570RE/370R5V"), 522 DMI_MATCH(DMI_PRODUCT_NAME, "370R4E/370R4V/370R5E/3570RE/370R5V"),
523 }, 523 },
524 }, 524 },
525 {
526 /* https://bugzilla.redhat.com/show_bug.cgi?id=1186097 */
527 .callback = video_disable_native_backlight,
528 .ident = "SAMSUNG 3570R/370R/470R/450R/510R/4450RV",
529 .matches = {
530 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
531 DMI_MATCH(DMI_PRODUCT_NAME, "3570R/370R/470R/450R/510R/4450RV"),
532 },
533 },
534 {
535 /* https://bugzilla.redhat.com/show_bug.cgi?id=1094948 */
536 .callback = video_disable_native_backlight,
537 .ident = "SAMSUNG 730U3E/740U3E",
538 .matches = {
539 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
540 DMI_MATCH(DMI_PRODUCT_NAME, "730U3E/740U3E"),
541 },
542 },
525 543
526 { 544 {
527 /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */ 545 /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */