aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt5
-rw-r--r--arch/ia64/kernel/acpi.c10
-rw-r--r--arch/x86/kernel/e820.c4
-rw-r--r--arch/x86/mm/srat.c4
-rw-r--r--drivers/acpi/Makefile3
-rw-r--r--drivers/acpi/acpica/Makefile158
-rw-r--r--drivers/acpi/acpica/accommon.h2
-rw-r--r--drivers/acpi/acpica/acconfig.h9
-rw-r--r--drivers/acpi/acpica/acdebug.h2
-rw-r--r--drivers/acpi/acpica/acdispat.h2
-rw-r--r--drivers/acpi/acpica/acevents.h3
-rw-r--r--drivers/acpi/acpica/acglobal.h17
-rw-r--r--drivers/acpi/acpica/achware.h2
-rw-r--r--drivers/acpi/acpica/acinterp.h4
-rw-r--r--drivers/acpi/acpica/aclocal.h26
-rw-r--r--drivers/acpi/acpica/acmacros.h2
-rw-r--r--drivers/acpi/acpica/acnamesp.h2
-rw-r--r--drivers/acpi/acpica/acobject.h8
-rw-r--r--drivers/acpi/acpica/acopcode.h6
-rw-r--r--drivers/acpi/acpica/acparser.h2
-rw-r--r--drivers/acpi/acpica/acpredef.h41
-rw-r--r--drivers/acpi/acpica/acresrc.h115
-rw-r--r--drivers/acpi/acpica/acstruct.h2
-rw-r--r--drivers/acpi/acpica/actables.h2
-rw-r--r--drivers/acpi/acpica/acutils.h21
-rw-r--r--drivers/acpi/acpica/amlcode.h29
-rw-r--r--drivers/acpi/acpica/amlresrc.h138
-rw-r--r--drivers/acpi/acpica/dsargs.c18
-rw-r--r--drivers/acpi/acpica/dscontrol.c2
-rw-r--r--drivers/acpi/acpica/dsfield.c83
-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.c14
-rw-r--r--drivers/acpi/acpica/evglock.c8
-rw-r--r--drivers/acpi/acpica/evgpe.c2
-rw-r--r--drivers/acpi/acpica/evgpeblk.c2
-rw-r--r--drivers/acpi/acpica/evgpeinit.c2
-rw-r--r--drivers/acpi/acpica/evgpeutil.c2
-rw-r--r--drivers/acpi/acpica/evmisc.c2
-rw-r--r--drivers/acpi/acpica/evregion.c31
-rw-r--r--drivers/acpi/acpica/evrgnini.c2
-rw-r--r--drivers/acpi/acpica/evsci.c2
-rw-r--r--drivers/acpi/acpica/evxface.c2
-rw-r--r--drivers/acpi/acpica/evxfevnt.c2
-rw-r--r--drivers/acpi/acpica/evxfgpe.c2
-rw-r--r--drivers/acpi/acpica/evxfregn.c2
-rw-r--r--drivers/acpi/acpica/exconfig.c8
-rw-r--r--drivers/acpi/acpica/exconvrt.c2
-rw-r--r--drivers/acpi/acpica/excreate.c31
-rw-r--r--drivers/acpi/acpica/exdebug.c2
-rw-r--r--drivers/acpi/acpica/exdump.c9
-rw-r--r--drivers/acpi/acpica/exfield.c30
-rw-r--r--drivers/acpi/acpica/exfldio.c38
-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.c27
-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.c27
-rw-r--r--drivers/acpi/acpica/hwacpi.c2
-rw-r--r--drivers/acpi/acpica/hwgpe.c2
-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.c4
-rw-r--r--drivers/acpi/acpica/hwxface.c2
-rw-r--r--drivers/acpi/acpica/nsaccess.c2
-rw-r--r--drivers/acpi/acpica/nsalloc.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.c31
-rw-r--r--drivers/acpi/acpica/nsrepair.c3
-rw-r--r--drivers/acpi/acpica/nsrepair2.c7
-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.c2
-rw-r--r--drivers/acpi/acpica/psargs.c143
-rw-r--r--drivers/acpi/acpica/psloop.c2
-rw-r--r--drivers/acpi/acpica/psopcode.c15
-rw-r--r--drivers/acpi/acpica/psparse.c2
-rw-r--r--drivers/acpi/acpica/psscope.c2
-rw-r--r--drivers/acpi/acpica/pstree.c8
-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.c2
-rw-r--r--drivers/acpi/acpica/rscalc.c89
-rw-r--r--drivers/acpi/acpica/rscreate.c69
-rw-r--r--drivers/acpi/acpica/rsdump.c196
-rw-r--r--drivers/acpi/acpica/rsinfo.c58
-rw-r--r--drivers/acpi/acpica/rsio.c2
-rw-r--r--drivers/acpi/acpica/rsirq.c33
-rw-r--r--drivers/acpi/acpica/rslist.c77
-rw-r--r--drivers/acpi/acpica/rsmemory.c2
-rw-r--r--drivers/acpi/acpica/rsmisc.c269
-rw-r--r--drivers/acpi/acpica/rsserial.c441
-rw-r--r--drivers/acpi/acpica/rsutils.c56
-rw-r--r--drivers/acpi/acpica/rsxface.c52
-rw-r--r--drivers/acpi/acpica/tbfadt.c41
-rw-r--r--drivers/acpi/acpica/tbfind.c2
-rw-r--r--drivers/acpi/acpica/tbinstal.c2
-rw-r--r--drivers/acpi/acpica/tbutils.c9
-rw-r--r--drivers/acpi/acpica/tbxface.c2
-rw-r--r--drivers/acpi/acpica/tbxfroot.c2
-rw-r--r--drivers/acpi/acpica/utaddress.c294
-rw-r--r--drivers/acpi/acpica/utalloc.c2
-rw-r--r--drivers/acpi/acpica/utcopy.c2
-rw-r--r--drivers/acpi/acpica/utdebug.c2
-rw-r--r--drivers/acpi/acpica/utdecode.c6
-rw-r--r--drivers/acpi/acpica/utdelete.c15
-rw-r--r--drivers/acpi/acpica/uteval.c2
-rw-r--r--drivers/acpi/acpica/utglobal.c8
-rw-r--r--drivers/acpi/acpica/utids.c2
-rw-r--r--drivers/acpi/acpica/utinit.c3
-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.c11
-rw-r--r--drivers/acpi/acpica/utobject.c2
-rw-r--r--drivers/acpi/acpica/utosi.c2
-rw-r--r--drivers/acpi/acpica/utresrc.c278
-rw-r--r--drivers/acpi/acpica/utstate.c2
-rw-r--r--drivers/acpi/acpica/utxface.c40
-rw-r--r--drivers/acpi/acpica/utxferror.c2
-rw-r--r--drivers/acpi/acpica/utxfmutex.c187
-rw-r--r--drivers/acpi/apei/apei-base.c150
-rw-r--r--drivers/acpi/apei/apei-internal.h6
-rw-r--r--drivers/acpi/apei/einj.c66
-rw-r--r--drivers/acpi/apei/erst.c5
-rw-r--r--drivers/acpi/apei/ghes.c102
-rw-r--r--drivers/acpi/apei/hest.c5
-rw-r--r--drivers/acpi/atomicio.c77
-rw-r--r--drivers/acpi/numa.c6
-rw-r--r--drivers/acpi/nvs.c53
-rw-r--r--drivers/acpi/osl.c242
-rw-r--r--drivers/acpi/processor_core.c26
-rw-r--r--drivers/acpi/processor_driver.c20
-rw-r--r--drivers/idle/intel_idle.c96
-rw-r--r--include/acpi/acnames.h1
-rw-r--r--include/acpi/acpi_numa.h1
-rw-r--r--include/acpi/acpiosxf.h7
-rw-r--r--include/acpi/acpixf.h32
-rw-r--r--include/acpi/acrestyp.h207
-rw-r--r--include/acpi/actbl.h23
-rw-r--r--include/acpi/actbl1.h54
-rw-r--r--include/acpi/actbl3.h552
-rw-r--r--include/acpi/actypes.h12
-rw-r--r--include/linux/acpi.h20
-rw-r--r--include/linux/acpi_io.h3
-rw-r--r--include/linux/cpuidle.h7
-rw-r--r--tools/power/x86/turbostat/turbostat.c2
181 files changed, 4590 insertions, 747 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 81c287fad79d..c6a56d8b901c 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1035,6 +1035,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
1035 By default, super page will be supported if Intel IOMMU 1035 By default, super page will be supported if Intel IOMMU
1036 has the capability. With this option, super page will 1036 has the capability. With this option, super page will
1037 not be supported. 1037 not be supported.
1038
1039 intel_idle.max_cstate= [KNL,HW,ACPI,X86]
1040 0 disables intel_idle and fall back on acpi_idle.
1041 1 to 6 specify maximum depth of C-state.
1042
1038 intremap= [X86-64, Intel-IOMMU] 1043 intremap= [X86-64, Intel-IOMMU]
1039 on enable Interrupt Remapping (default) 1044 on enable Interrupt Remapping (default)
1040 off disable Interrupt Remapping 1045 off disable Interrupt Remapping
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index bfb4d01e0e51..5207035dc061 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -429,22 +429,24 @@ static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
429static struct acpi_table_slit __initdata *slit_table; 429static struct acpi_table_slit __initdata *slit_table;
430cpumask_t early_cpu_possible_map = CPU_MASK_NONE; 430cpumask_t early_cpu_possible_map = CPU_MASK_NONE;
431 431
432static int get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa) 432static int __init
433get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa)
433{ 434{
434 int pxm; 435 int pxm;
435 436
436 pxm = pa->proximity_domain_lo; 437 pxm = pa->proximity_domain_lo;
437 if (ia64_platform_is("sn2")) 438 if (ia64_platform_is("sn2") || acpi_srat_revision >= 2)
438 pxm += pa->proximity_domain_hi[0] << 8; 439 pxm += pa->proximity_domain_hi[0] << 8;
439 return pxm; 440 return pxm;
440} 441}
441 442
442static int get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma) 443static int __init
444get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma)
443{ 445{
444 int pxm; 446 int pxm;
445 447
446 pxm = ma->proximity_domain; 448 pxm = ma->proximity_domain;
447 if (!ia64_platform_is("sn2")) 449 if (!ia64_platform_is("sn2") && acpi_srat_revision <= 1)
448 pxm &= 0xff; 450 pxm &= 0xff;
449 451
450 return pxm; 452 return pxm;
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 303a0e48f076..51c3b186e5b9 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -714,7 +714,7 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn)
714} 714}
715#endif 715#endif
716 716
717#ifdef CONFIG_HIBERNATION 717#ifdef CONFIG_ACPI
718/** 718/**
719 * Mark ACPI NVS memory region, so that we can save/restore it during 719 * Mark ACPI NVS memory region, so that we can save/restore it during
720 * hibernation and the subsequent resume. 720 * hibernation and the subsequent resume.
@@ -727,7 +727,7 @@ static int __init e820_mark_nvs_memory(void)
727 struct e820entry *ei = &e820.map[i]; 727 struct e820entry *ei = &e820.map[i];
728 728
729 if (ei->type == E820_NVS) 729 if (ei->type == E820_NVS)
730 suspend_nvs_register(ei->addr, ei->size); 730 acpi_nvs_register(ei->addr, ei->size);
731 } 731 }
732 732
733 return 0; 733 return 0;
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index 81dbfdeb080d..7efd0c615d58 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -104,6 +104,8 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
104 if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0) 104 if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
105 return; 105 return;
106 pxm = pa->proximity_domain_lo; 106 pxm = pa->proximity_domain_lo;
107 if (acpi_srat_revision >= 2)
108 pxm |= *((unsigned int*)pa->proximity_domain_hi) << 8;
107 node = setup_node(pxm); 109 node = setup_node(pxm);
108 if (node < 0) { 110 if (node < 0) {
109 printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm); 111 printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
@@ -155,6 +157,8 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
155 start = ma->base_address; 157 start = ma->base_address;
156 end = start + ma->length; 158 end = start + ma->length;
157 pxm = ma->proximity_domain; 159 pxm = ma->proximity_domain;
160 if (acpi_srat_revision <= 1)
161 pxm &= 0xff;
158 node = setup_node(pxm); 162 node = setup_node(pxm);
159 if (node < 0) { 163 if (node < 0) {
160 printk(KERN_ERR "SRAT: Too many proximity domains.\n"); 164 printk(KERN_ERR "SRAT: Too many proximity domains.\n");
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index ecb26b4f29a0..c07f44f05f9d 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -20,11 +20,12 @@ obj-y += acpi.o \
20# All the builtin files are in the "acpi." module_param namespace. 20# All the builtin files are in the "acpi." module_param namespace.
21acpi-y += osl.o utils.o reboot.o 21acpi-y += osl.o utils.o reboot.o
22acpi-y += atomicio.o 22acpi-y += atomicio.o
23acpi-y += nvs.o
23 24
24# sleep related files 25# sleep related files
25acpi-y += wakeup.o 26acpi-y += wakeup.o
26acpi-y += sleep.o 27acpi-y += sleep.o
27acpi-$(CONFIG_ACPI_SLEEP) += proc.o nvs.o 28acpi-$(CONFIG_ACPI_SLEEP) += proc.o
28 29
29 30
30# 31#
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 301bd2d388ad..0ca208b6dcf0 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -8,41 +8,151 @@ ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT
8# use acpi.o to put all files here into acpi.o modparam namespace 8# use acpi.o to put all files here into acpi.o modparam namespace
9obj-y += acpi.o 9obj-y += acpi.o
10 10
11acpi-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \ 11acpi-y := \
12 dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \ 12 dsargs.o \
13 dsinit.o dsargs.o dscontrol.o dswload2.o 13 dscontrol.o \
14 dsfield.o \
15 dsinit.o \
16 dsmethod.o \
17 dsmthdat.o \
18 dsobject.o \
19 dsopcode.o \
20 dsutils.o \
21 dswexec.o \
22 dswload.o \
23 dswload2.o \
24 dswscope.o \
25 dswstate.o
14 26
15acpi-y += evevent.o evregion.o evsci.o evxfevnt.o \ 27acpi-y += \
16 evmisc.o evrgnini.o evxface.o evxfregn.o \ 28 evevent.o \
17 evgpe.o evgpeblk.o evgpeinit.o evgpeutil.o evxfgpe.o evglock.o 29 evgpe.o \
30 evgpeblk.o \
31 evgpeinit.o \
32 evgpeutil.o \
33 evglock.o \
34 evmisc.o \
35 evregion.o \
36 evrgnini.o \
37 evsci.o \
38 evxface.o \
39 evxfevnt.o \
40 evxfgpe.o \
41 evxfregn.o
18 42
19acpi-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ 43acpi-y += \
20 exconvrt.o exfldio.o exoparg1.o exprep.o exresop.o exsystem.o\ 44 exconfig.o \
21 excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ 45 exconvrt.o \
22 exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o exdebug.o 46 excreate.o \
47 exdebug.o \
48 exdump.o \
49 exfield.o \
50 exfldio.o \
51 exmutex.o \
52 exnames.o \
53 exoparg1.o \
54 exoparg2.o \
55 exoparg3.o \
56 exoparg6.o \
57 exprep.o \
58 exmisc.o \
59 exregion.o \
60 exresnte.o \
61 exresolv.o \
62 exresop.o \
63 exstore.o \
64 exstoren.o \
65 exstorob.o \
66 exsystem.o \
67 exutils.o
23 68
24acpi-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o hwpci.o 69acpi-y += \
70 hwacpi.o \
71 hwgpe.o \
72 hwpci.o \
73 hwregs.o \
74 hwsleep.o \
75 hwvalid.o \
76 hwxface.o
25 77
26acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o 78acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
27 79
28acpi-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \ 80acpi-y += \
29 nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ 81 nsaccess.o \
30 nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ 82 nsalloc.o \
31 nsparse.o nspredef.o nsrepair.o nsrepair2.o 83 nsdump.o \
84 nseval.o \
85 nsinit.o \
86 nsload.o \
87 nsnames.o \
88 nsobject.o \
89 nsparse.o \
90 nspredef.o \
91 nsrepair.o \
92 nsrepair2.o \
93 nssearch.o \
94 nsutils.o \
95 nswalk.o \
96 nsxfeval.o \
97 nsxfname.o \
98 nsxfobj.o
32 99
33acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o 100acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o
34 101
35acpi-y += psargs.o psparse.o psloop.o pstree.o pswalk.o \ 102acpi-y += \
36 psopcode.o psscope.o psutils.o psxface.o 103 psargs.o \
104 psloop.o \
105 psopcode.o \
106 psparse.o \
107 psscope.o \
108 pstree.o \
109 psutils.o \
110 pswalk.o \
111 psxface.o
37 112
38acpi-y += rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ 113acpi-y += \
39 rscalc.o rsirq.o rsmemory.o rsutils.o 114 rsaddr.o \
115 rscalc.o \
116 rscreate.o \
117 rsinfo.o \
118 rsio.o \
119 rsirq.o \
120 rslist.o \
121 rsmemory.o \
122 rsmisc.o \
123 rsserial.o \
124 rsutils.o \
125 rsxface.o
40 126
41acpi-$(ACPI_FUTURE_USAGE) += rsdump.o 127acpi-$(ACPI_FUTURE_USAGE) += rsdump.o
42 128
43acpi-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o 129acpi-y += \
130 tbfadt.o \
131 tbfind.o \
132 tbinstal.o \
133 tbutils.o \
134 tbxface.o \
135 tbxfroot.o
44 136
45acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ 137acpi-y += \
46 utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ 138 utaddress.o \
47 utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o \ 139 utalloc.o \
48 utosi.o utxferror.o utdecode.o 140 utcopy.o \
141 utdebug.o \
142 utdecode.o \
143 utdelete.o \
144 uteval.o \
145 utglobal.o \
146 utids.o \
147 utinit.o \
148 utlock.o \
149 utmath.o \
150 utmisc.o \
151 utmutex.o \
152 utobject.o \
153 utosi.o \
154 utresrc.o \
155 utstate.o \
156 utxface.o \
157 utxferror.o \
158 utxfmutex.o
diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h
index e0ba17f0a7c8..a44bd424f9f4 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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/acconfig.h b/drivers/acpi/acpica/acconfig.h
index f895a244ca7e..1f30af613e87 100644
--- a/drivers/acpi/acpica/acconfig.h
+++ b/drivers/acpi/acpica/acconfig.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -123,6 +123,10 @@
123 123
124#define ACPI_MAX_SLEEP 2000 /* Two seconds */ 124#define ACPI_MAX_SLEEP 2000 /* Two seconds */
125 125
126/* Address Range lists are per-space_id (Memory and I/O only) */
127
128#define ACPI_ADDRESS_RANGE_MAX 2
129
126/****************************************************************************** 130/******************************************************************************
127 * 131 *
128 * ACPI Specification constants (Do not change unless the specification changes) 132 * ACPI Specification constants (Do not change unless the specification changes)
@@ -202,9 +206,10 @@
202#define ACPI_RSDP_CHECKSUM_LENGTH 20 206#define ACPI_RSDP_CHECKSUM_LENGTH 20
203#define ACPI_RSDP_XCHECKSUM_LENGTH 36 207#define ACPI_RSDP_XCHECKSUM_LENGTH 36
204 208
205/* SMBus and IPMI bidirectional buffer size */ 209/* SMBus, GSBus and IPMI bidirectional buffer size */
206 210
207#define ACPI_SMBUS_BUFFER_SIZE 34 211#define ACPI_SMBUS_BUFFER_SIZE 34
212#define ACPI_GSBUS_BUFFER_SIZE 34
208#define ACPI_IPMI_BUFFER_SIZE 66 213#define ACPI_IPMI_BUFFER_SIZE 66
209 214
210/* _sx_d and _sx_w control methods */ 215/* _sx_d and _sx_w control methods */
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index eb0b1f8dee6d..deaa81979561 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 2d1b7ffa377a..5935ba6707e2 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 bea3b4899183..c53caa521a30 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -162,6 +162,7 @@ acpi_status acpi_ev_initialize_op_regions(void);
162 162
163acpi_status 163acpi_status
164acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, 164acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
165 union acpi_operand_object *field_obj,
165 u32 function, 166 u32 function,
166 u32 region_offset, u32 bit_width, u64 *value); 167 u32 region_offset, u32 bit_width, u64 *value);
167 168
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 76dc02f15574..261fd5eb2b68 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -140,8 +140,19 @@ u32 acpi_gbl_trace_flags;
140acpi_name acpi_gbl_trace_method_name; 140acpi_name acpi_gbl_trace_method_name;
141u8 acpi_gbl_system_awake_and_running; 141u8 acpi_gbl_system_awake_and_running;
142 142
143/*
144 * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning
145 * that the ACPI hardware is no longer required. A flag in the FADT indicates
146 * a reduced HW machine, and that flag is duplicated here for convenience.
147 */
148u8 acpi_gbl_reduced_hardware;
149
143#endif 150#endif
144 151
152/* Do not disassemble buffers to resource descriptors */
153
154ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_no_resource_disassembly, FALSE);
155
145/***************************************************************************** 156/*****************************************************************************
146 * 157 *
147 * Debug support 158 * Debug support
@@ -207,7 +218,7 @@ ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock;
207 218
208/***************************************************************************** 219/*****************************************************************************
209 * 220 *
210 * Mutual exlusion within ACPICA subsystem 221 * Mutual exclusion within ACPICA subsystem
211 * 222 *
212 ****************************************************************************/ 223 ****************************************************************************/
213 224
@@ -295,6 +306,8 @@ ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present;
295ACPI_EXTERN u8 acpi_gbl_events_initialized; 306ACPI_EXTERN u8 acpi_gbl_events_initialized;
296ACPI_EXTERN u8 acpi_gbl_osi_data; 307ACPI_EXTERN u8 acpi_gbl_osi_data;
297ACPI_EXTERN struct acpi_interface_info *acpi_gbl_supported_interfaces; 308ACPI_EXTERN struct acpi_interface_info *acpi_gbl_supported_interfaces;
309ACPI_EXTERN struct acpi_address_range
310 *acpi_gbl_address_range_list[ACPI_ADDRESS_RANGE_MAX];
298 311
299#ifndef DEFINE_ACPI_GLOBALS 312#ifndef DEFINE_ACPI_GLOBALS
300 313
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h
index e7213beaafc7..677793e938f5 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 3731e1c34b83..eb308635da72 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -468,6 +468,8 @@ void acpi_ex_eisa_id_to_string(char *dest, u64 compressed_id);
468 468
469void acpi_ex_integer_to_string(char *dest, u64 value); 469void acpi_ex_integer_to_string(char *dest, u64 value);
470 470
471u8 acpi_is_valid_space_id(u8 space_id);
472
471/* 473/*
472 * exregion - default op_region handlers 474 * exregion - default op_region handlers
473 */ 475 */
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 5552125d8340..3f24068837d5 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -53,7 +53,7 @@ typedef u32 acpi_mutex_handle;
53 53
54/* Total number of aml opcodes defined */ 54/* Total number of aml opcodes defined */
55 55
56#define AML_NUM_OPCODES 0x7F 56#define AML_NUM_OPCODES 0x81
57 57
58/* Forward declarations */ 58/* Forward declarations */
59 59
@@ -249,12 +249,16 @@ struct acpi_create_field_info {
249 struct acpi_namespace_node *field_node; 249 struct acpi_namespace_node *field_node;
250 struct acpi_namespace_node *register_node; 250 struct acpi_namespace_node *register_node;
251 struct acpi_namespace_node *data_register_node; 251 struct acpi_namespace_node *data_register_node;
252 struct acpi_namespace_node *connection_node;
253 u8 *resource_buffer;
252 u32 bank_value; 254 u32 bank_value;
253 u32 field_bit_position; 255 u32 field_bit_position;
254 u32 field_bit_length; 256 u32 field_bit_length;
257 u16 resource_length;
255 u8 field_flags; 258 u8 field_flags;
256 u8 attribute; 259 u8 attribute;
257 u8 field_type; 260 u8 field_type;
261 u8 access_length;
258}; 262};
259 263
260typedef 264typedef
@@ -315,7 +319,8 @@ struct acpi_name_info {
315 319
316/* 320/*
317 * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2, 321 * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
318 * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT 322 * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
323 * ACPI_PTYPE2_FIX_VAR
319 */ 324 */
320struct acpi_package_info { 325struct acpi_package_info {
321 u8 type; 326 u8 type;
@@ -625,6 +630,15 @@ union acpi_generic_state {
625 630
626typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state); 631typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
627 632
633/* Address Range info block */
634
635struct acpi_address_range {
636 struct acpi_address_range *next;
637 struct acpi_namespace_node *region_node;
638 acpi_physical_address start_address;
639 acpi_physical_address end_address;
640};
641
628/***************************************************************************** 642/*****************************************************************************
629 * 643 *
630 * Parser typedefs and structs 644 * Parser typedefs and structs
@@ -951,7 +965,7 @@ struct acpi_port_info {
951#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 965#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
952#define ACPI_RESOURCE_NAME_IO 0x40 966#define ACPI_RESOURCE_NAME_IO 0x40
953#define ACPI_RESOURCE_NAME_FIXED_IO 0x48 967#define ACPI_RESOURCE_NAME_FIXED_IO 0x48
954#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50 968#define ACPI_RESOURCE_NAME_FIXED_DMA 0x50
955#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 969#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
956#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 970#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
957#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 971#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
@@ -973,7 +987,9 @@ struct acpi_port_info {
973#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 987#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
974#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A 988#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
975#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B 989#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
976#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B 990#define ACPI_RESOURCE_NAME_GPIO 0x8C
991#define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E
992#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8E
977 993
978/***************************************************************************** 994/*****************************************************************************
979 * 995 *
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index b7491ee1fba6..ef338a96f5b2 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 79a598c67fe3..2c9e0f049523 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 1055769f2f01..c065078ca83b 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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
@@ -254,6 +254,7 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
254 u32 base_byte_offset; /* Byte offset within containing object */\ 254 u32 base_byte_offset; /* Byte offset within containing object */\
255 u32 value; /* Value to store into the Bank or Index register */\ 255 u32 value; /* Value to store into the Bank or Index register */\
256 u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ 256 u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
257 u8 access_length; /* For serial regions/fields */
257 258
258 259
259struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ 260struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
@@ -261,7 +262,9 @@ struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and
261}; 262};
262 263
263struct acpi_object_region_field { 264struct acpi_object_region_field {
264 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */ 265 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length;
266 union acpi_operand_object *region_obj; /* Containing op_region object */
267 u8 *resource_buffer; /* resource_template for serial regions/fields */
265}; 268};
266 269
267struct acpi_object_bank_field { 270struct acpi_object_bank_field {
@@ -358,6 +361,7 @@ typedef enum {
358 */ 361 */
359struct acpi_object_extra { 362struct acpi_object_extra {
360 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ 363 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
364 struct acpi_namespace_node *scope_node;
361 void *region_context; /* Region-specific data */ 365 void *region_context; /* Region-specific data */
362 u8 *aml_start; 366 u8 *aml_start;
363 u32 aml_length; 367 u32 aml_length;
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h
index bb2ccfad7376..9440d053fbb3 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -93,6 +93,7 @@
93#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) 93#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
94#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) 94#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
95#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) 95#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
96#define ARGP_CONNECTFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
96#define ARGP_CONTINUE_OP ARG_NONE 97#define ARGP_CONTINUE_OP ARG_NONE
97#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME) 98#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME)
98#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) 99#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
@@ -164,6 +165,7 @@
164#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG) 165#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
165#define ARGP_REVISION_OP ARG_NONE 166#define ARGP_REVISION_OP ARG_NONE
166#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST) 167#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
168#define ARGP_SERIALFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
167#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) 169#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
168#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) 170#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
169#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME) 171#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
@@ -223,6 +225,7 @@
223#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF) 225#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
224#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) 226#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
225#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) 227#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
228#define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE
226#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE 229#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
227#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET) 230#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
228#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) 231#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
@@ -294,6 +297,7 @@
294#define ARGI_RETURN_OP ARGI_INVALID_OPCODE 297#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
295#define ARGI_REVISION_OP ARG_NONE 298#define ARGI_REVISION_OP ARG_NONE
296#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE 299#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
300#define ARGI_SERIALFIELD_OP ARGI_INVALID_OPCODE
297#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) 301#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
298#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) 302#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
299#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT) 303#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h
index 5ea1e06afa20..b725d780d34d 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 c445cca490ea..bbb34c9be4e8 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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
@@ -94,6 +94,14 @@
94 * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length 94 * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length
95 * (Used for _ART, _FPS) 95 * (Used for _ART, _FPS)
96 * 96 *
97 * ACPI_PTYPE2_FIX_VAR: Each subpackage consists of some fixed-length elements
98 * followed by an optional element
99 * object type
100 * count
101 * object type
102 * count = 0 (optional)
103 * (Used for _DLM)
104 *
97 *****************************************************************************/ 105 *****************************************************************************/
98 106
99enum acpi_return_package_types { 107enum acpi_return_package_types {
@@ -105,7 +113,8 @@ enum acpi_return_package_types {
105 ACPI_PTYPE2_PKG_COUNT = 6, 113 ACPI_PTYPE2_PKG_COUNT = 6,
106 ACPI_PTYPE2_FIXED = 7, 114 ACPI_PTYPE2_FIXED = 7,
107 ACPI_PTYPE2_MIN = 8, 115 ACPI_PTYPE2_MIN = 8,
108 ACPI_PTYPE2_REV_FIXED = 9 116 ACPI_PTYPE2_REV_FIXED = 9,
117 ACPI_PTYPE2_FIX_VAR = 10
109}; 118};
110 119
111#ifdef ACPI_CREATE_PREDEFINED_TABLE 120#ifdef ACPI_CREATE_PREDEFINED_TABLE
@@ -154,6 +163,7 @@ static const union acpi_predefined_info predefined_names[] =
154 {{"_AC8", 0, ACPI_RTYPE_INTEGER}}, 163 {{"_AC8", 0, ACPI_RTYPE_INTEGER}},
155 {{"_AC9", 0, ACPI_RTYPE_INTEGER}}, 164 {{"_AC9", 0, ACPI_RTYPE_INTEGER}},
156 {{"_ADR", 0, ACPI_RTYPE_INTEGER}}, 165 {{"_ADR", 0, ACPI_RTYPE_INTEGER}},
166 {{"_AEI", 0, ACPI_RTYPE_BUFFER}},
157 {{"_AL0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 167 {{"_AL0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
158 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 168 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
159 169
@@ -229,6 +239,13 @@ static const union acpi_predefined_info predefined_names[] =
229 {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */ 239 {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */
230 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}}, 240 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}},
231 241
242 {{"_CLS", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */
243 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}},
244
245 {{"_CPC", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Bufs) */
246 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0, 0}, 0,
247 0}},
248
232 {{"_CRS", 0, ACPI_RTYPE_BUFFER}}, 249 {{"_CRS", 0, ACPI_RTYPE_BUFFER}},
233 {{"_CRT", 0, ACPI_RTYPE_INTEGER}}, 250 {{"_CRT", 0, ACPI_RTYPE_INTEGER}},
234 {{"_CSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n-1 Int) */ 251 {{"_CSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n-1 Int) */
@@ -237,12 +254,21 @@ static const union acpi_predefined_info predefined_names[] =
237 {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ 254 {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */
238 {{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}}, 255 {{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}},
239 256
257 {{"_CWS", 1, ACPI_RTYPE_INTEGER}},
240 {{"_DCK", 1, ACPI_RTYPE_INTEGER}}, 258 {{"_DCK", 1, ACPI_RTYPE_INTEGER}},
241 {{"_DCS", 0, ACPI_RTYPE_INTEGER}}, 259 {{"_DCS", 0, ACPI_RTYPE_INTEGER}},
242 {{"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}}, 260 {{"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}},
243 {{"_DDN", 0, ACPI_RTYPE_STRING}}, 261 {{"_DDN", 0, ACPI_RTYPE_STRING}},
262 {{"_DEP", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
263 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}},
264
244 {{"_DGS", 0, ACPI_RTYPE_INTEGER}}, 265 {{"_DGS", 0, ACPI_RTYPE_INTEGER}},
245 {{"_DIS", 0, 0}}, 266 {{"_DIS", 0, 0}},
267
268 {{"_DLM", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (1 Ref, 0/1 Optional Buf/Ref) */
269 {{{ACPI_PTYPE2_FIX_VAR, ACPI_RTYPE_REFERENCE, 1,
270 ACPI_RTYPE_REFERENCE | ACPI_RTYPE_BUFFER}, 0, 0}},
271
246 {{"_DMA", 0, ACPI_RTYPE_BUFFER}}, 272 {{"_DMA", 0, ACPI_RTYPE_BUFFER}},
247 {{"_DOD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ 273 {{"_DOD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */
248 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, 274 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
@@ -262,6 +288,7 @@ static const union acpi_predefined_info predefined_names[] =
262 {{"_EJ3", 1, 0}}, 288 {{"_EJ3", 1, 0}},
263 {{"_EJ4", 1, 0}}, 289 {{"_EJ4", 1, 0}},
264 {{"_EJD", 0, ACPI_RTYPE_STRING}}, 290 {{"_EJD", 0, ACPI_RTYPE_STRING}},
291 {{"_EVT", 1, 0}},
265 {{"_FDE", 0, ACPI_RTYPE_BUFFER}}, 292 {{"_FDE", 0, ACPI_RTYPE_BUFFER}},
266 {{"_FDI", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int) */ 293 {{"_FDI", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int) */
267 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}}, 294 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}},
@@ -281,14 +308,17 @@ static const union acpi_predefined_info predefined_names[] =
281 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}}, 308 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}},
282 309
283 {{"_GAI", 0, ACPI_RTYPE_INTEGER}}, 310 {{"_GAI", 0, ACPI_RTYPE_INTEGER}},
311 {{"_GCP", 0, ACPI_RTYPE_INTEGER}},
284 {{"_GHL", 0, ACPI_RTYPE_INTEGER}}, 312 {{"_GHL", 0, ACPI_RTYPE_INTEGER}},
285 {{"_GLK", 0, ACPI_RTYPE_INTEGER}}, 313 {{"_GLK", 0, ACPI_RTYPE_INTEGER}},
286 {{"_GPD", 0, ACPI_RTYPE_INTEGER}}, 314 {{"_GPD", 0, ACPI_RTYPE_INTEGER}},
287 {{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */ 315 {{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */
316 {{"_GRT", 0, ACPI_RTYPE_BUFFER}},
288 {{"_GSB", 0, ACPI_RTYPE_INTEGER}}, 317 {{"_GSB", 0, ACPI_RTYPE_INTEGER}},
289 {{"_GTF", 0, ACPI_RTYPE_BUFFER}}, 318 {{"_GTF", 0, ACPI_RTYPE_BUFFER}},
290 {{"_GTM", 0, ACPI_RTYPE_BUFFER}}, 319 {{"_GTM", 0, ACPI_RTYPE_BUFFER}},
291 {{"_GTS", 1, 0}}, 320 {{"_GTS", 1, 0}},
321 {{"_GWS", 1, ACPI_RTYPE_INTEGER}},
292 {{"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, 322 {{"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
293 {{"_HOT", 0, ACPI_RTYPE_INTEGER}}, 323 {{"_HOT", 0, ACPI_RTYPE_INTEGER}},
294 {{"_HPP", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ 324 {{"_HPP", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
@@ -303,6 +333,7 @@ static const union acpi_predefined_info predefined_names[] =
303 {{"_HPX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (var Ints) */ 333 {{"_HPX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (var Ints) */
304 {{{ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, 334 {{{ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
305 335
336 {{"_HRV", 0, ACPI_RTYPE_INTEGER}},
306 {{"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ 337 {{"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */
307 {{"_INI", 0, 0}}, 338 {{"_INI", 0, 0}},
308 {{"_IRC", 0, 0}}, 339 {{"_IRC", 0, 0}},
@@ -361,6 +392,9 @@ static const union acpi_predefined_info predefined_names[] =
361 {{"_PR3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 392 {{"_PR3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
362 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}}, 393 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}},
363 394
395 {{"_PRE", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
396 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}},
397
364 {{"_PRL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 398 {{"_PRL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
365 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}}, 399 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}},
366 400
@@ -391,6 +425,7 @@ static const union acpi_predefined_info predefined_names[] =
391 {{"_PSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (5 Int) with count */ 425 {{"_PSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (5 Int) with count */
392 {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER,0,0}, 0,0}}, 426 {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER,0,0}, 0,0}},
393 427
428 {{"_PSE", 1, 0}},
394 {{"_PSL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 429 {{"_PSL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
395 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 430 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
396 431
@@ -457,6 +492,7 @@ static const union acpi_predefined_info predefined_names[] =
457 {{"_SLI", 0, ACPI_RTYPE_BUFFER}}, 492 {{"_SLI", 0, ACPI_RTYPE_BUFFER}},
458 {{"_SPD", 1, ACPI_RTYPE_INTEGER}}, 493 {{"_SPD", 1, ACPI_RTYPE_INTEGER}},
459 {{"_SRS", 1, 0}}, 494 {{"_SRS", 1, 0}},
495 {{"_SRT", 1, ACPI_RTYPE_INTEGER}},
460 {{"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ 496 {{"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */
461 {{"_SST", 1, 0}}, 497 {{"_SST", 1, 0}},
462 {{"_STA", 0, ACPI_RTYPE_INTEGER}}, 498 {{"_STA", 0, ACPI_RTYPE_INTEGER}},
@@ -464,6 +500,7 @@ static const union acpi_predefined_info predefined_names[] =
464 {{"_STP", 2, ACPI_RTYPE_INTEGER}}, 500 {{"_STP", 2, ACPI_RTYPE_INTEGER}},
465 {{"_STR", 0, ACPI_RTYPE_BUFFER}}, 501 {{"_STR", 0, ACPI_RTYPE_BUFFER}},
466 {{"_STV", 2, ACPI_RTYPE_INTEGER}}, 502 {{"_STV", 2, ACPI_RTYPE_INTEGER}},
503 {{"_SUB", 0, ACPI_RTYPE_STRING}},
467 {{"_SUN", 0, ACPI_RTYPE_INTEGER}}, 504 {{"_SUN", 0, ACPI_RTYPE_INTEGER}},
468 {{"_SWS", 0, ACPI_RTYPE_INTEGER}}, 505 {{"_SWS", 0, ACPI_RTYPE_INTEGER}},
469 {{"_TC1", 0, ACPI_RTYPE_INTEGER}}, 506 {{"_TC1", 0, ACPI_RTYPE_INTEGER}},
diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h
index f08b55b7f3a0..0347d0993497 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -73,28 +73,40 @@ typedef const struct acpi_rsconvert_info {
73 73
74/* Resource conversion opcodes */ 74/* Resource conversion opcodes */
75 75
76#define ACPI_RSC_INITGET 0 76typedef enum {
77#define ACPI_RSC_INITSET 1 77 ACPI_RSC_INITGET = 0,
78#define ACPI_RSC_FLAGINIT 2 78 ACPI_RSC_INITSET,
79#define ACPI_RSC_1BITFLAG 3 79 ACPI_RSC_FLAGINIT,
80#define ACPI_RSC_2BITFLAG 4 80 ACPI_RSC_1BITFLAG,
81#define ACPI_RSC_COUNT 5 81 ACPI_RSC_2BITFLAG,
82#define ACPI_RSC_COUNT16 6 82 ACPI_RSC_3BITFLAG,
83#define ACPI_RSC_LENGTH 7 83 ACPI_RSC_ADDRESS,
84#define ACPI_RSC_MOVE8 8 84 ACPI_RSC_BITMASK,
85#define ACPI_RSC_MOVE16 9 85 ACPI_RSC_BITMASK16,
86#define ACPI_RSC_MOVE32 10 86 ACPI_RSC_COUNT,
87#define ACPI_RSC_MOVE64 11 87 ACPI_RSC_COUNT16,
88#define ACPI_RSC_SET8 12 88 ACPI_RSC_COUNT_GPIO_PIN,
89#define ACPI_RSC_DATA8 13 89 ACPI_RSC_COUNT_GPIO_RES,
90#define ACPI_RSC_ADDRESS 14 90 ACPI_RSC_COUNT_GPIO_VEN,
91#define ACPI_RSC_SOURCE 15 91 ACPI_RSC_COUNT_SERIAL_RES,
92#define ACPI_RSC_SOURCEX 16 92 ACPI_RSC_COUNT_SERIAL_VEN,
93#define ACPI_RSC_BITMASK 17 93 ACPI_RSC_DATA8,
94#define ACPI_RSC_BITMASK16 18 94 ACPI_RSC_EXIT_EQ,
95#define ACPI_RSC_EXIT_NE 19 95 ACPI_RSC_EXIT_LE,
96#define ACPI_RSC_EXIT_LE 20 96 ACPI_RSC_EXIT_NE,
97#define ACPI_RSC_EXIT_EQ 21 97 ACPI_RSC_LENGTH,
98 ACPI_RSC_MOVE_GPIO_PIN,
99 ACPI_RSC_MOVE_GPIO_RES,
100 ACPI_RSC_MOVE_SERIAL_RES,
101 ACPI_RSC_MOVE_SERIAL_VEN,
102 ACPI_RSC_MOVE8,
103 ACPI_RSC_MOVE16,
104 ACPI_RSC_MOVE32,
105 ACPI_RSC_MOVE64,
106 ACPI_RSC_SET8,
107 ACPI_RSC_SOURCE,
108 ACPI_RSC_SOURCEX
109} ACPI_RSCONVERT_OPCODES;
98 110
99/* Resource Conversion sub-opcodes */ 111/* Resource Conversion sub-opcodes */
100 112
@@ -106,6 +118,9 @@ typedef const struct acpi_rsconvert_info {
106#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f) 118#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f)
107#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f) 119#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f)
108 120
121/*
122 * Individual entry for the resource dump tables
123 */
109typedef const struct acpi_rsdump_info { 124typedef const struct acpi_rsdump_info {
110 u8 opcode; 125 u8 opcode;
111 u8 offset; 126 u8 offset;
@@ -116,20 +131,25 @@ typedef const struct acpi_rsdump_info {
116 131
117/* Values for the Opcode field above */ 132/* Values for the Opcode field above */
118 133
119#define ACPI_RSD_TITLE 0 134typedef enum {
120#define ACPI_RSD_LITERAL 1 135 ACPI_RSD_TITLE = 0,
121#define ACPI_RSD_STRING 2 136 ACPI_RSD_1BITFLAG,
122#define ACPI_RSD_UINT8 3 137 ACPI_RSD_2BITFLAG,
123#define ACPI_RSD_UINT16 4 138 ACPI_RSD_3BITFLAG,
124#define ACPI_RSD_UINT32 5 139 ACPI_RSD_ADDRESS,
125#define ACPI_RSD_UINT64 6 140 ACPI_RSD_DWORDLIST,
126#define ACPI_RSD_1BITFLAG 7 141 ACPI_RSD_LITERAL,
127#define ACPI_RSD_2BITFLAG 8 142 ACPI_RSD_LONGLIST,
128#define ACPI_RSD_SHORTLIST 9 143 ACPI_RSD_SHORTLIST,
129#define ACPI_RSD_LONGLIST 10 144 ACPI_RSD_SHORTLISTX,
130#define ACPI_RSD_DWORDLIST 11 145 ACPI_RSD_SOURCE,
131#define ACPI_RSD_ADDRESS 12 146 ACPI_RSD_STRING,
132#define ACPI_RSD_SOURCE 13 147 ACPI_RSD_UINT8,
148 ACPI_RSD_UINT16,
149 ACPI_RSD_UINT32,
150 ACPI_RSD_UINT64,
151 ACPI_RSD_WORDLIST
152} ACPI_RSDUMP_OPCODES;
133 153
134/* restore default alignment */ 154/* restore default alignment */
135 155
@@ -138,13 +158,18 @@ typedef const struct acpi_rsdump_info {
138/* Resource tables indexed by internal resource type */ 158/* Resource tables indexed by internal resource type */
139 159
140extern const u8 acpi_gbl_aml_resource_sizes[]; 160extern const u8 acpi_gbl_aml_resource_sizes[];
161extern const u8 acpi_gbl_aml_resource_serial_bus_sizes[];
141extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; 162extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[];
142 163
143/* Resource tables indexed by raw AML resource descriptor type */ 164/* Resource tables indexed by raw AML resource descriptor type */
144 165
145extern const u8 acpi_gbl_resource_struct_sizes[]; 166extern const u8 acpi_gbl_resource_struct_sizes[];
167extern const u8 acpi_gbl_resource_struct_serial_bus_sizes[];
146extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[]; 168extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[];
147 169
170extern struct acpi_rsconvert_info
171 *acpi_gbl_convert_resource_serial_bus_dispatch[];
172
148struct acpi_vendor_walk_info { 173struct acpi_vendor_walk_info {
149 struct acpi_vendor_uuid *uuid; 174 struct acpi_vendor_uuid *uuid;
150 struct acpi_buffer *buffer; 175 struct acpi_buffer *buffer;
@@ -190,6 +215,10 @@ acpi_status
190acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, 215acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
191 struct acpi_buffer *ret_buffer); 216 struct acpi_buffer *ret_buffer);
192 217
218acpi_status
219acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
220 struct acpi_buffer *ret_buffer);
221
193/* 222/*
194 * rscalc 223 * rscalc
195 */ 224 */
@@ -293,6 +322,11 @@ extern struct acpi_rsconvert_info acpi_rs_convert_address16[];
293extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[]; 322extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[];
294extern struct acpi_rsconvert_info acpi_rs_convert_address64[]; 323extern struct acpi_rsconvert_info acpi_rs_convert_address64[];
295extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[]; 324extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[];
325extern struct acpi_rsconvert_info acpi_rs_convert_gpio[];
326extern struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[];
327extern struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[];
328extern struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[];
329extern struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[];
296 330
297/* These resources require separate get/set tables */ 331/* These resources require separate get/set tables */
298 332
@@ -310,6 +344,7 @@ extern struct acpi_rsconvert_info acpi_rs_set_vendor[];
310 * rsinfo 344 * rsinfo
311 */ 345 */
312extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[]; 346extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
347extern struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[];
313 348
314/* 349/*
315 * rsdump 350 * rsdump
@@ -331,6 +366,12 @@ extern struct acpi_rsdump_info acpi_rs_dump_address64[];
331extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[]; 366extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[];
332extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[]; 367extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[];
333extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[]; 368extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[];
369extern struct acpi_rsdump_info acpi_rs_dump_gpio[];
370extern struct acpi_rsdump_info acpi_rs_dump_fixed_dma[];
371extern struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[];
372extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[];
373extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[];
374extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[];
334#endif 375#endif
335 376
336#endif /* __ACRESRC_H__ */ 377#endif /* __ACRESRC_H__ */
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h
index 1623b245dde2..0404df605bc1 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 967f08124eba..d5bec304c823 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 99c140d8e348..925ccf22101b 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -45,6 +45,7 @@
45#define _ACUTILS_H 45#define _ACUTILS_H
46 46
47extern const u8 acpi_gbl_resource_aml_sizes[]; 47extern const u8 acpi_gbl_resource_aml_sizes[];
48extern const u8 acpi_gbl_resource_aml_serial_bus_sizes[];
48 49
49/* Strings used by the disassembler and debugger resource dump routines */ 50/* Strings used by the disassembler and debugger resource dump routines */
50 51
@@ -579,6 +580,24 @@ acpi_ut_create_list(char *list_name,
579#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 580#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
580 581
581/* 582/*
583 * utaddress - address range check
584 */
585acpi_status
586acpi_ut_add_address_range(acpi_adr_space_type space_id,
587 acpi_physical_address address,
588 u32 length, struct acpi_namespace_node *region_node);
589
590void
591acpi_ut_remove_address_range(acpi_adr_space_type space_id,
592 struct acpi_namespace_node *region_node);
593
594u32
595acpi_ut_check_address_range(acpi_adr_space_type space_id,
596 acpi_physical_address address, u32 length, u8 warn);
597
598void acpi_ut_delete_address_lists(void);
599
600/*
582 * utxferror - various error/warning output functions 601 * utxferror - various error/warning output functions
583 */ 602 */
584void ACPI_INTERNAL_VAR_XFACE 603void ACPI_INTERNAL_VAR_XFACE
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h
index 1077f17859ed..905280fec0fa 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 - 2011, Intel Corp. 10 * Copyright (C) 2000 - 2012, 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
@@ -189,6 +189,14 @@
189#define AML_LNOTEQUAL_OP (u16) 0x9293 189#define AML_LNOTEQUAL_OP (u16) 0x9293
190 190
191/* 191/*
192 * Opcodes for "Field" operators
193 */
194#define AML_FIELD_OFFSET_OP (u8) 0x00
195#define AML_FIELD_ACCESS_OP (u8) 0x01
196#define AML_FIELD_CONNECTION_OP (u8) 0x02 /* ACPI 5.0 */
197#define AML_FIELD_EXT_ACCESS_OP (u8) 0x03 /* ACPI 5.0 */
198
199/*
192 * Internal opcodes 200 * Internal opcodes
193 * Use only "Unknown" AML opcodes, don't attempt to use 201 * Use only "Unknown" AML opcodes, don't attempt to use
194 * any valid ACPI ASCII values (A-Z, 0-9, '-') 202 * any valid ACPI ASCII values (A-Z, 0-9, '-')
@@ -202,6 +210,8 @@
202#define AML_INT_METHODCALL_OP (u16) 0x0035 210#define AML_INT_METHODCALL_OP (u16) 0x0035
203#define AML_INT_RETURN_VALUE_OP (u16) 0x0036 211#define AML_INT_RETURN_VALUE_OP (u16) 0x0036
204#define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037 212#define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037
213#define AML_INT_CONNECTION_OP (u16) 0x0038
214#define AML_INT_EXTACCESSFIELD_OP (u16) 0x0039
205 215
206#define ARG_NONE 0x0 216#define ARG_NONE 0x0
207 217
@@ -456,13 +466,16 @@ typedef enum {
456 * access_as keyword 466 * access_as keyword
457 */ 467 */
458typedef enum { 468typedef enum {
459 AML_FIELD_ATTRIB_SMB_QUICK = 0x02, 469 AML_FIELD_ATTRIB_QUICK = 0x02,
460 AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, 470 AML_FIELD_ATTRIB_SEND_RCV = 0x04,
461 AML_FIELD_ATTRIB_SMB_BYTE = 0x06, 471 AML_FIELD_ATTRIB_BYTE = 0x06,
462 AML_FIELD_ATTRIB_SMB_WORD = 0x08, 472 AML_FIELD_ATTRIB_WORD = 0x08,
463 AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, 473 AML_FIELD_ATTRIB_BLOCK = 0x0A,
464 AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C, 474 AML_FIELD_ATTRIB_MULTIBYTE = 0x0B,
465 AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D 475 AML_FIELD_ATTRIB_WORD_CALL = 0x0C,
476 AML_FIELD_ATTRIB_BLOCK_CALL = 0x0D,
477 AML_FIELD_ATTRIB_RAW_BYTES = 0x0E,
478 AML_FIELD_ATTRIB_RAW_PROCESS = 0x0F
466} AML_ACCESS_ATTRIBUTE; 479} AML_ACCESS_ATTRIBUTE;
467 480
468/* Bit fields in the AML method_flags byte */ 481/* Bit fields in the AML method_flags byte */
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h
index 59122cde247c..7b2128f274e7 100644
--- a/drivers/acpi/acpica/amlresrc.h
+++ b/drivers/acpi/acpica/amlresrc.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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
@@ -58,29 +58,48 @@
58#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT" 58#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
59#define ACPI_RESTAG_BASEADDRESS "_BAS" 59#define ACPI_RESTAG_BASEADDRESS "_BAS"
60#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */ 60#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
61#define ACPI_RESTAG_DEBOUNCETIME "_DBT"
61#define ACPI_RESTAG_DECODE "_DEC" 62#define ACPI_RESTAG_DECODE "_DEC"
63#define ACPI_RESTAG_DEVICEPOLARITY "_DPL"
62#define ACPI_RESTAG_DMA "_DMA" 64#define ACPI_RESTAG_DMA "_DMA"
63#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ 65#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
66#define ACPI_RESTAG_DRIVESTRENGTH "_DRS"
67#define ACPI_RESTAG_ENDIANNESS "_END"
68#define ACPI_RESTAG_FLOWCONTROL "_FLC"
64#define ACPI_RESTAG_GRANULARITY "_GRA" 69#define ACPI_RESTAG_GRANULARITY "_GRA"
65#define ACPI_RESTAG_INTERRUPT "_INT" 70#define ACPI_RESTAG_INTERRUPT "_INT"
66#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ 71#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
67#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ 72#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
68#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ 73#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
74#define ACPI_RESTAG_IORESTRICTION "_IOR"
69#define ACPI_RESTAG_LENGTH "_LEN" 75#define ACPI_RESTAG_LENGTH "_LEN"
76#define ACPI_RESTAG_LINE "_LIN"
70#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ 77#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
71#define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ 78#define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
72#define ACPI_RESTAG_MAXADDR "_MAX" 79#define ACPI_RESTAG_MAXADDR "_MAX"
73#define ACPI_RESTAG_MINADDR "_MIN" 80#define ACPI_RESTAG_MINADDR "_MIN"
74#define ACPI_RESTAG_MAXTYPE "_MAF" 81#define ACPI_RESTAG_MAXTYPE "_MAF"
75#define ACPI_RESTAG_MINTYPE "_MIF" 82#define ACPI_RESTAG_MINTYPE "_MIF"
83#define ACPI_RESTAG_MODE "_MOD"
84#define ACPI_RESTAG_PARITY "_PAR"
85#define ACPI_RESTAG_PHASE "_PHA"
86#define ACPI_RESTAG_PIN "_PIN"
87#define ACPI_RESTAG_PINCONFIG "_PPI"
88#define ACPI_RESTAG_POLARITY "_POL"
76#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" 89#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
77#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" 90#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
78#define ACPI_RESTAG_RANGETYPE "_RNG" 91#define ACPI_RESTAG_RANGETYPE "_RNG"
79#define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ 92#define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
93#define ACPI_RESTAG_LENGTH_RX "_RXL"
94#define ACPI_RESTAG_LENGTH_TX "_TXL"
95#define ACPI_RESTAG_SLAVEMODE "_SLV"
96#define ACPI_RESTAG_SPEED "_SPE"
97#define ACPI_RESTAG_STOPBITS "_STB"
80#define ACPI_RESTAG_TRANSLATION "_TRA" 98#define ACPI_RESTAG_TRANSLATION "_TRA"
81#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ 99#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
82#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ 100#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
83#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */ 101#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */
102#define ACPI_RESTAG_VENDORDATA "_VEN"
84 103
85/* Default sizes for "small" resource descriptors */ 104/* Default sizes for "small" resource descriptors */
86 105
@@ -90,6 +109,7 @@
90#define ASL_RDESC_END_DEPEND_SIZE 0x00 109#define ASL_RDESC_END_DEPEND_SIZE 0x00
91#define ASL_RDESC_IO_SIZE 0x07 110#define ASL_RDESC_IO_SIZE 0x07
92#define ASL_RDESC_FIXED_IO_SIZE 0x03 111#define ASL_RDESC_FIXED_IO_SIZE 0x03
112#define ASL_RDESC_FIXED_DMA_SIZE 0x05
93#define ASL_RDESC_END_TAG_SIZE 0x01 113#define ASL_RDESC_END_TAG_SIZE 0x01
94 114
95struct asl_resource_node { 115struct asl_resource_node {
@@ -164,6 +184,12 @@ struct aml_resource_end_tag {
164 AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum; 184 AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum;
165}; 185};
166 186
187struct aml_resource_fixed_dma {
188 AML_RESOURCE_SMALL_HEADER_COMMON u16 request_lines;
189 u16 channels;
190 u8 width;
191};
192
167/* 193/*
168 * LARGE descriptors 194 * LARGE descriptors
169 */ 195 */
@@ -263,6 +289,110 @@ struct aml_resource_generic_register {
263 u64 address; 289 u64 address;
264}; 290};
265 291
292/* Common descriptor for gpio_int and gpio_io (ACPI 5.0) */
293
294struct aml_resource_gpio {
295 AML_RESOURCE_LARGE_HEADER_COMMON u8 revision_id;
296 u8 connection_type;
297 u16 flags;
298 u16 int_flags;
299 u8 pin_config;
300 u16 drive_strength;
301 u16 debounce_timeout;
302 u16 pin_table_offset;
303 u8 res_source_index;
304 u16 res_source_offset;
305 u16 vendor_offset;
306 u16 vendor_length;
307 /*
308 * Optional fields follow immediately:
309 * 1) PIN list (Words)
310 * 2) Resource Source String
311 * 3) Vendor Data bytes
312 */
313};
314
315#define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */
316
317/* Values for connection_type above */
318
319#define AML_RESOURCE_GPIO_TYPE_INT 0
320#define AML_RESOURCE_GPIO_TYPE_IO 1
321#define AML_RESOURCE_MAX_GPIOTYPE 1
322
323/* Common preamble for all serial descriptors (ACPI 5.0) */
324
325#define AML_RESOURCE_SERIAL_COMMON \
326 u8 revision_id; \
327 u8 res_source_index; \
328 u8 type; \
329 u8 flags; \
330 u16 type_specific_flags; \
331 u8 type_revision_id; \
332 u16 type_data_length; \
333
334/* Values for the type field above */
335
336#define AML_RESOURCE_I2C_SERIALBUSTYPE 1
337#define AML_RESOURCE_SPI_SERIALBUSTYPE 2
338#define AML_RESOURCE_UART_SERIALBUSTYPE 3
339#define AML_RESOURCE_MAX_SERIALBUSTYPE 3
340#define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */
341
342struct aml_resource_common_serialbus {
343AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_SERIAL_COMMON};
344
345struct aml_resource_i2c_serialbus {
346 AML_RESOURCE_LARGE_HEADER_COMMON
347 AML_RESOURCE_SERIAL_COMMON u32 connection_speed;
348 u16 slave_address;
349 /*
350 * Optional fields follow immediately:
351 * 1) Vendor Data bytes
352 * 2) Resource Source String
353 */
354};
355
356#define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */
357#define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */
358#define AML_RESOURCE_I2C_MIN_DATA_LEN 6
359
360struct aml_resource_spi_serialbus {
361 AML_RESOURCE_LARGE_HEADER_COMMON
362 AML_RESOURCE_SERIAL_COMMON u32 connection_speed;
363 u8 data_bit_length;
364 u8 clock_phase;
365 u8 clock_polarity;
366 u16 device_selection;
367 /*
368 * Optional fields follow immediately:
369 * 1) Vendor Data bytes
370 * 2) Resource Source String
371 */
372};
373
374#define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */
375#define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */
376#define AML_RESOURCE_SPI_MIN_DATA_LEN 9
377
378struct aml_resource_uart_serialbus {
379 AML_RESOURCE_LARGE_HEADER_COMMON
380 AML_RESOURCE_SERIAL_COMMON u32 default_baud_rate;
381 u16 rx_fifo_size;
382 u16 tx_fifo_size;
383 u8 parity;
384 u8 lines_enabled;
385 /*
386 * Optional fields follow immediately:
387 * 1) Vendor Data bytes
388 * 2) Resource Source String
389 */
390};
391
392#define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */
393#define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */
394#define AML_RESOURCE_UART_MIN_DATA_LEN 10
395
266/* restore default alignment */ 396/* restore default alignment */
267 397
268#pragma pack() 398#pragma pack()
@@ -284,6 +414,7 @@ union aml_resource {
284 struct aml_resource_end_dependent end_dpf; 414 struct aml_resource_end_dependent end_dpf;
285 struct aml_resource_io io; 415 struct aml_resource_io io;
286 struct aml_resource_fixed_io fixed_io; 416 struct aml_resource_fixed_io fixed_io;
417 struct aml_resource_fixed_dma fixed_dma;
287 struct aml_resource_vendor_small vendor_small; 418 struct aml_resource_vendor_small vendor_small;
288 struct aml_resource_end_tag end_tag; 419 struct aml_resource_end_tag end_tag;
289 420
@@ -299,6 +430,11 @@ union aml_resource {
299 struct aml_resource_address64 address64; 430 struct aml_resource_address64 address64;
300 struct aml_resource_extended_address64 ext_address64; 431 struct aml_resource_extended_address64 ext_address64;
301 struct aml_resource_extended_irq extended_irq; 432 struct aml_resource_extended_irq extended_irq;
433 struct aml_resource_gpio gpio;
434 struct aml_resource_i2c_serialbus i2c_serial_bus;
435 struct aml_resource_spi_serialbus spi_serial_bus;
436 struct aml_resource_uart_serialbus uart_serial_bus;
437 struct aml_resource_common_serialbus common_serial_bus;
302 438
303 /* Utility overlays */ 439 /* Utility overlays */
304 440
diff --git a/drivers/acpi/acpica/dsargs.c b/drivers/acpi/acpica/dsargs.c
index 8c7b99728aa2..80eb1900297f 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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
@@ -250,6 +250,13 @@ acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc)
250 status = acpi_ds_execute_arguments(node, node->parent, 250 status = acpi_ds_execute_arguments(node, node->parent,
251 extra_desc->extra.aml_length, 251 extra_desc->extra.aml_length,
252 extra_desc->extra.aml_start); 252 extra_desc->extra.aml_start);
253 if (ACPI_FAILURE(status)) {
254 return_ACPI_STATUS(status);
255 }
256
257 status = acpi_ut_add_address_range(obj_desc->region.space_id,
258 obj_desc->region.address,
259 obj_desc->region.length, node);
253 return_ACPI_STATUS(status); 260 return_ACPI_STATUS(status);
254} 261}
255 262
@@ -384,8 +391,15 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
384 391
385 /* Execute the argument AML */ 392 /* Execute the argument AML */
386 393
387 status = acpi_ds_execute_arguments(node, node->parent, 394 status = acpi_ds_execute_arguments(node, extra_desc->extra.scope_node,
388 extra_desc->extra.aml_length, 395 extra_desc->extra.aml_length,
389 extra_desc->extra.aml_start); 396 extra_desc->extra.aml_start);
397 if (ACPI_FAILURE(status)) {
398 return_ACPI_STATUS(status);
399 }
400
401 status = acpi_ut_add_address_range(obj_desc->region.space_id,
402 obj_desc->region.address,
403 obj_desc->region.length, node);
390 return_ACPI_STATUS(status); 404 return_ACPI_STATUS(status);
391} 405}
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c
index 26c49fff58da..effe4ca1133f 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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 34be60c0e448..cd243cf2cab2 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -221,6 +221,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
221{ 221{
222 acpi_status status; 222 acpi_status status;
223 u64 position; 223 u64 position;
224 union acpi_parse_object *child;
224 225
225 ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info); 226 ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info);
226 227
@@ -232,10 +233,11 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
232 233
233 while (arg) { 234 while (arg) {
234 /* 235 /*
235 * Three types of field elements are handled: 236 * Four types of field elements are handled:
236 * 1) Offset - specifies a bit offset 237 * 1) Name - Enters a new named field into the namespace
237 * 2) access_as - changes the access mode 238 * 2) Offset - specifies a bit offset
238 * 3) Name - Enters a new named field into the namespace 239 * 3) access_as - changes the access mode/attributes
240 * 4) Connection - Associate a resource template with the field
239 */ 241 */
240 switch (arg->common.aml_opcode) { 242 switch (arg->common.aml_opcode) {
241 case AML_INT_RESERVEDFIELD_OP: 243 case AML_INT_RESERVEDFIELD_OP:
@@ -253,21 +255,70 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
253 break; 255 break;
254 256
255 case AML_INT_ACCESSFIELD_OP: 257 case AML_INT_ACCESSFIELD_OP:
256 258 case AML_INT_EXTACCESSFIELD_OP:
257 /* 259 /*
258 * Get a new access_type and access_attribute -- to be used for all 260 * Get new access_type, access_attribute, and access_length fields
259 * field units that follow, until field end or another access_as 261 * -- to be used for all field units that follow, until the
260 * keyword. 262 * end-of-field or another access_as keyword is encountered.
263 * NOTE. These three bytes are encoded in the integer value
264 * of the parseop for convenience.
261 * 265 *
262 * In field_flags, preserve the flag bits other than the 266 * In field_flags, preserve the flag bits other than the
263 * ACCESS_TYPE bits 267 * ACCESS_TYPE bits.
264 */ 268 */
269
270 /* access_type (byte_acc, word_acc, etc.) */
271
265 info->field_flags = (u8) 272 info->field_flags = (u8)
266 ((info-> 273 ((info->
267 field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | 274 field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
268 ((u8) ((u32) arg->common.value.integer >> 8))); 275 ((u8)((u32)(arg->common.value.integer & 0x07))));
276
277 /* access_attribute (attrib_quick, attrib_byte, etc.) */
278
279 info->attribute =
280 (u8)((arg->common.value.integer >> 8) & 0xFF);
281
282 /* access_length (for serial/buffer protocols) */
283
284 info->access_length =
285 (u8)((arg->common.value.integer >> 16) & 0xFF);
286 break;
287
288 case AML_INT_CONNECTION_OP:
289 /*
290 * Clear any previous connection. New connection is used for all
291 * fields that follow, similar to access_as
292 */
293 info->resource_buffer = NULL;
294 info->connection_node = NULL;
269 295
270 info->attribute = (u8) (arg->common.value.integer); 296 /*
297 * A Connection() is either an actual resource descriptor (buffer)
298 * or a named reference to a resource template
299 */
300 child = arg->common.value.arg;
301 if (child->common.aml_opcode == AML_INT_BYTELIST_OP) {
302 info->resource_buffer = child->named.data;
303 info->resource_length =
304 (u16)child->named.value.integer;
305 } else {
306 /* Lookup the Connection() namepath, it should already exist */
307
308 status = acpi_ns_lookup(walk_state->scope_info,
309 child->common.value.
310 name, ACPI_TYPE_ANY,
311 ACPI_IMODE_EXECUTE,
312 ACPI_NS_DONT_OPEN_SCOPE,
313 walk_state,
314 &info->connection_node);
315 if (ACPI_FAILURE(status)) {
316 ACPI_ERROR_NAMESPACE(child->common.
317 value.name,
318 status);
319 return_ACPI_STATUS(status);
320 }
321 }
271 break; 322 break;
272 323
273 case AML_INT_NAMEDFIELD_OP: 324 case AML_INT_NAMEDFIELD_OP:
@@ -374,6 +425,8 @@ acpi_ds_create_field(union acpi_parse_object *op,
374 } 425 }
375 } 426 }
376 427
428 ACPI_MEMSET(&info, 0, sizeof(struct acpi_create_field_info));
429
377 /* Second arg is the field flags */ 430 /* Second arg is the field flags */
378 431
379 arg = arg->common.next; 432 arg = arg->common.next;
@@ -386,7 +439,6 @@ acpi_ds_create_field(union acpi_parse_object *op,
386 info.region_node = region_node; 439 info.region_node = region_node;
387 440
388 status = acpi_ds_get_field_names(&info, walk_state, arg->common.next); 441 status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
389
390 return_ACPI_STATUS(status); 442 return_ACPI_STATUS(status);
391} 443}
392 444
@@ -474,8 +526,8 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
474 */ 526 */
475 while (arg) { 527 while (arg) {
476 /* 528 /*
477 * Ignore OFFSET and ACCESSAS terms here; we are only interested in the 529 * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
478 * field names in order to enter them into the namespace. 530 * in the field names in order to enter them into the namespace.
479 */ 531 */
480 if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { 532 if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
481 status = acpi_ns_lookup(walk_state->scope_info, 533 status = acpi_ns_lookup(walk_state->scope_info,
@@ -651,6 +703,5 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
651 info.region_node = region_node; 703 info.region_node = region_node;
652 704
653 status = acpi_ds_get_field_names(&info, walk_state, arg->common.next); 705 status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
654
655 return_ACPI_STATUS(status); 706 return_ACPI_STATUS(status);
656} 707}
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c
index a7718bf2b9a1..9e5ac7f780a7 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 5d797751e205..00f5dab5bcc0 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 905ce29a92e1..b40bd507be5d 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 f42e17e5c252..d7045ca3e32a 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 c627a288e027..e5eff7585102 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 2c477ce172fa..1abcda31037f 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 fe40e4c6554f..642f3c053e87 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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 324acec1179a..552aa3a50c84 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 976318138c56..ae7147724763 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 76a661fc1e09..9e9490a9cbf0 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 a6c374ef9914..c9c2ac13e7cc 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 d458b041e651..6729ebe2f1e6 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -71,6 +71,12 @@ acpi_status acpi_ev_initialize_events(void)
71 71
72 ACPI_FUNCTION_TRACE(ev_initialize_events); 72 ACPI_FUNCTION_TRACE(ev_initialize_events);
73 73
74 /* If Hardware Reduced flag is set, there are no fixed events */
75
76 if (acpi_gbl_reduced_hardware) {
77 return_ACPI_STATUS(AE_OK);
78 }
79
74 /* 80 /*
75 * Initialize the Fixed and General Purpose Events. This is done prior to 81 * Initialize the Fixed and General Purpose Events. This is done prior to
76 * enabling SCIs to prevent interrupts from occurring before the handlers 82 * enabling SCIs to prevent interrupts from occurring before the handlers
@@ -111,6 +117,12 @@ acpi_status acpi_ev_install_xrupt_handlers(void)
111 117
112 ACPI_FUNCTION_TRACE(ev_install_xrupt_handlers); 118 ACPI_FUNCTION_TRACE(ev_install_xrupt_handlers);
113 119
120 /* If Hardware Reduced flag is set, there is no ACPI h/w */
121
122 if (acpi_gbl_reduced_hardware) {
123 return_ACPI_STATUS(AE_OK);
124 }
125
114 /* Install the SCI handler */ 126 /* Install the SCI handler */
115 127
116 status = acpi_ev_install_sci_handler(); 128 status = acpi_ev_install_sci_handler();
diff --git a/drivers/acpi/acpica/evglock.c b/drivers/acpi/acpica/evglock.c
index 56a562a1e5d7..5e5683cb1f0d 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -70,6 +70,12 @@ acpi_status acpi_ev_init_global_lock_handler(void)
70 70
71 ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); 71 ACPI_FUNCTION_TRACE(ev_init_global_lock_handler);
72 72
73 /* If Hardware Reduced flag is set, there is no global lock */
74
75 if (acpi_gbl_reduced_hardware) {
76 return_ACPI_STATUS(AE_OK);
77 }
78
73 /* Attempt installation of the global lock handler */ 79 /* Attempt installation of the global lock handler */
74 80
75 status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, 81 status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index 65c79add3b19..9e88cb6fb25e 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index ca2c41a53311..be75339cd5dd 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c
index ce9aa9f9a972..adf7494da9db 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c
index 80a81d0c4a80..25073932aa10 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 d0b331844427..84966f416463 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 f0edf5c43c03..1b0180a1b798 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -329,6 +329,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
329 * FUNCTION: acpi_ev_address_space_dispatch 329 * FUNCTION: acpi_ev_address_space_dispatch
330 * 330 *
331 * PARAMETERS: region_obj - Internal region object 331 * PARAMETERS: region_obj - Internal region object
332 * field_obj - Corresponding field. Can be NULL.
332 * Function - Read or Write operation 333 * Function - Read or Write operation
333 * region_offset - Where in the region to read or write 334 * region_offset - Where in the region to read or write
334 * bit_width - Field width in bits (8, 16, 32, or 64) 335 * bit_width - Field width in bits (8, 16, 32, or 64)
@@ -344,6 +345,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
344 345
345acpi_status 346acpi_status
346acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, 347acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
348 union acpi_operand_object *field_obj,
347 u32 function, 349 u32 function,
348 u32 region_offset, u32 bit_width, u64 *value) 350 u32 region_offset, u32 bit_width, u64 *value)
349{ 351{
@@ -353,6 +355,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
353 union acpi_operand_object *handler_desc; 355 union acpi_operand_object *handler_desc;
354 union acpi_operand_object *region_obj2; 356 union acpi_operand_object *region_obj2;
355 void *region_context = NULL; 357 void *region_context = NULL;
358 struct acpi_connection_info *context;
356 359
357 ACPI_FUNCTION_TRACE(ev_address_space_dispatch); 360 ACPI_FUNCTION_TRACE(ev_address_space_dispatch);
358 361
@@ -375,6 +378,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
375 return_ACPI_STATUS(AE_NOT_EXIST); 378 return_ACPI_STATUS(AE_NOT_EXIST);
376 } 379 }
377 380
381 context = handler_desc->address_space.context;
382
378 /* 383 /*
379 * It may be the case that the region has never been initialized. 384 * It may be the case that the region has never been initialized.
380 * Some types of regions require special init code 385 * Some types of regions require special init code
@@ -404,8 +409,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
404 acpi_ex_exit_interpreter(); 409 acpi_ex_exit_interpreter();
405 410
406 status = region_setup(region_obj, ACPI_REGION_ACTIVATE, 411 status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
407 handler_desc->address_space.context, 412 context, &region_context);
408 &region_context);
409 413
410 /* Re-enter the interpreter */ 414 /* Re-enter the interpreter */
411 415
@@ -455,6 +459,25 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
455 acpi_ut_get_region_name(region_obj->region. 459 acpi_ut_get_region_name(region_obj->region.
456 space_id))); 460 space_id)));
457 461
462 /*
463 * Special handling for generic_serial_bus and general_purpose_io:
464 * There are three extra parameters that must be passed to the
465 * handler via the context:
466 * 1) Connection buffer, a resource template from Connection() op.
467 * 2) Length of the above buffer.
468 * 3) Actual access length from the access_as() op.
469 */
470 if (((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) ||
471 (region_obj->region.space_id == ACPI_ADR_SPACE_GPIO)) &&
472 context && field_obj) {
473
474 /* Get the Connection (resource_template) buffer */
475
476 context->connection = field_obj->field.resource_buffer;
477 context->length = field_obj->field.resource_length;
478 context->access_length = field_obj->field.access_length;
479 }
480
458 if (!(handler_desc->address_space.handler_flags & 481 if (!(handler_desc->address_space.handler_flags &
459 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { 482 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
460 /* 483 /*
@@ -469,7 +492,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
469 492
470 status = handler(function, 493 status = handler(function,
471 (region_obj->region.address + region_offset), 494 (region_obj->region.address + region_offset),
472 bit_width, value, handler_desc->address_space.context, 495 bit_width, value, context,
473 region_obj2->extra.region_context); 496 region_obj2->extra.region_context);
474 497
475 if (ACPI_FAILURE(status)) { 498 if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 55a5d35ef34a..819c17f5897a 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 2ebd40e1a3ef..26065c612e76 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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 f4f523bf5939..61944e89565a 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index 20516e599476..1768bbec1002 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 f06a3ee356ba..33388fd69df4 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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/evxfregn.c b/drivers/acpi/acpica/evxfregn.c
index aee887e3ca5c..6019208cd4b6 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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 745a42b401f5..c86d44e41bc8 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -297,9 +297,9 @@ acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer)
297 /* Bytewise reads */ 297 /* Bytewise reads */
298 298
299 for (i = 0; i < length; i++) { 299 for (i = 0; i < length; i++) {
300 status = acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, 300 status =
301 region_offset, 8, 301 acpi_ev_address_space_dispatch(obj_desc, NULL, ACPI_READ,
302 &value); 302 region_offset, 8, &value);
303 if (ACPI_FAILURE(status)) { 303 if (ACPI_FAILURE(status)) {
304 return status; 304 return status;
305 } 305 }
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index 74162a11817d..e385436bd424 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 110711afada8..3f5bc998c1cb 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -267,7 +267,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
267 * 267 *
268 * PARAMETERS: aml_start - Pointer to the region declaration AML 268 * PARAMETERS: aml_start - Pointer to the region declaration AML
269 * aml_length - Max length of the declaration AML 269 * aml_length - Max length of the declaration AML
270 * region_space - space_iD for the region 270 * space_id - Address space ID for the region
271 * walk_state - Current state 271 * walk_state - Current state
272 * 272 *
273 * RETURN: Status 273 * RETURN: Status
@@ -279,7 +279,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
279acpi_status 279acpi_status
280acpi_ex_create_region(u8 * aml_start, 280acpi_ex_create_region(u8 * aml_start,
281 u32 aml_length, 281 u32 aml_length,
282 u8 region_space, struct acpi_walk_state *walk_state) 282 u8 space_id, struct acpi_walk_state *walk_state)
283{ 283{
284 acpi_status status; 284 acpi_status status;
285 union acpi_operand_object *obj_desc; 285 union acpi_operand_object *obj_desc;
@@ -304,16 +304,19 @@ acpi_ex_create_region(u8 * aml_start,
304 * Space ID must be one of the predefined IDs, or in the user-defined 304 * Space ID must be one of the predefined IDs, or in the user-defined
305 * range 305 * range
306 */ 306 */
307 if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && 307 if (!acpi_is_valid_space_id(space_id)) {
308 (region_space < ACPI_USER_REGION_BEGIN) && 308 /*
309 (region_space != ACPI_ADR_SPACE_DATA_TABLE)) { 309 * Print an error message, but continue. We don't want to abort
310 ACPI_ERROR((AE_INFO, "Invalid AddressSpace type 0x%X", 310 * a table load for this exception. Instead, if the region is
311 region_space)); 311 * actually used at runtime, abort the executing method.
312 return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); 312 */
313 ACPI_ERROR((AE_INFO,
314 "Invalid/unknown Address Space ID: 0x%2.2X",
315 space_id));
313 } 316 }
314 317
315 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n", 318 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n",
316 acpi_ut_get_region_name(region_space), region_space)); 319 acpi_ut_get_region_name(space_id), space_id));
317 320
318 /* Create the region descriptor */ 321 /* Create the region descriptor */
319 322
@@ -330,10 +333,16 @@ acpi_ex_create_region(u8 * aml_start,
330 region_obj2 = obj_desc->common.next_object; 333 region_obj2 = obj_desc->common.next_object;
331 region_obj2->extra.aml_start = aml_start; 334 region_obj2->extra.aml_start = aml_start;
332 region_obj2->extra.aml_length = aml_length; 335 region_obj2->extra.aml_length = aml_length;
336 if (walk_state->scope_info) {
337 region_obj2->extra.scope_node =
338 walk_state->scope_info->scope.node;
339 } else {
340 region_obj2->extra.scope_node = node;
341 }
333 342
334 /* Init the region from the operands */ 343 /* Init the region from the operands */
335 344
336 obj_desc->region.space_id = region_space; 345 obj_desc->region.space_id = space_id;
337 obj_desc->region.address = 0; 346 obj_desc->region.address = 0;
338 obj_desc->region.length = 0; 347 obj_desc->region.length = 0;
339 obj_desc->region.node = node; 348 obj_desc->region.node = node;
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c
index c7a2f1edd282..e211e9c19215 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 61b8c0e8b74d..2a6ac0a3bc1e 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -192,10 +192,13 @@ static struct acpi_exdump_info acpi_ex_dump_buffer_field[3] = {
192 "Buffer Object"} 192 "Buffer Object"}
193}; 193};
194 194
195static struct acpi_exdump_info acpi_ex_dump_region_field[3] = { 195static struct acpi_exdump_info acpi_ex_dump_region_field[5] = {
196 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region_field), NULL}, 196 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region_field), NULL},
197 {ACPI_EXD_FIELD, 0, NULL}, 197 {ACPI_EXD_FIELD, 0, NULL},
198 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"} 198 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(field.access_length), "AccessLength"},
199 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"},
200 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.resource_buffer),
201 "ResourceBuffer"}
199}; 202};
200 203
201static struct acpi_exdump_info acpi_ex_dump_bank_field[5] = { 204static struct acpi_exdump_info acpi_ex_dump_bank_field[5] = {
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index 0bde2230c028..dc092f5b35d6 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -100,18 +100,25 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
100 (obj_desc->field.region_obj->region.space_id == 100 (obj_desc->field.region_obj->region.space_id ==
101 ACPI_ADR_SPACE_SMBUS 101 ACPI_ADR_SPACE_SMBUS
102 || obj_desc->field.region_obj->region.space_id == 102 || obj_desc->field.region_obj->region.space_id ==
103 ACPI_ADR_SPACE_GSBUS
104 || obj_desc->field.region_obj->region.space_id ==
103 ACPI_ADR_SPACE_IPMI)) { 105 ACPI_ADR_SPACE_IPMI)) {
104 /* 106 /*
105 * This is an SMBus or IPMI read. We must create a buffer to hold 107 * This is an SMBus, GSBus or IPMI read. We must create a buffer to hold
106 * the data and then directly access the region handler. 108 * the data and then directly access the region handler.
107 * 109 *
108 * Note: Smbus protocol value is passed in upper 16-bits of Function 110 * Note: SMBus and GSBus protocol value is passed in upper 16-bits of Function
109 */ 111 */
110 if (obj_desc->field.region_obj->region.space_id == 112 if (obj_desc->field.region_obj->region.space_id ==
111 ACPI_ADR_SPACE_SMBUS) { 113 ACPI_ADR_SPACE_SMBUS) {
112 length = ACPI_SMBUS_BUFFER_SIZE; 114 length = ACPI_SMBUS_BUFFER_SIZE;
113 function = 115 function =
114 ACPI_READ | (obj_desc->field.attribute << 16); 116 ACPI_READ | (obj_desc->field.attribute << 16);
117 } else if (obj_desc->field.region_obj->region.space_id ==
118 ACPI_ADR_SPACE_GSBUS) {
119 length = ACPI_GSBUS_BUFFER_SIZE;
120 function =
121 ACPI_READ | (obj_desc->field.attribute << 16);
115 } else { /* IPMI */ 122 } else { /* IPMI */
116 123
117 length = ACPI_IPMI_BUFFER_SIZE; 124 length = ACPI_IPMI_BUFFER_SIZE;
@@ -248,21 +255,23 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
248 (obj_desc->field.region_obj->region.space_id == 255 (obj_desc->field.region_obj->region.space_id ==
249 ACPI_ADR_SPACE_SMBUS 256 ACPI_ADR_SPACE_SMBUS
250 || obj_desc->field.region_obj->region.space_id == 257 || obj_desc->field.region_obj->region.space_id ==
258 ACPI_ADR_SPACE_GSBUS
259 || obj_desc->field.region_obj->region.space_id ==
251 ACPI_ADR_SPACE_IPMI)) { 260 ACPI_ADR_SPACE_IPMI)) {
252 /* 261 /*
253 * This is an SMBus or IPMI write. We will bypass the entire field 262 * This is an SMBus, GSBus or IPMI write. We will bypass the entire field
254 * mechanism and handoff the buffer directly to the handler. For 263 * mechanism and handoff the buffer directly to the handler. For
255 * these address spaces, the buffer is bi-directional; on a write, 264 * these address spaces, the buffer is bi-directional; on a write,
256 * return data is returned in the same buffer. 265 * return data is returned in the same buffer.
257 * 266 *
258 * Source must be a buffer of sufficient size: 267 * Source must be a buffer of sufficient size:
259 * ACPI_SMBUS_BUFFER_SIZE or ACPI_IPMI_BUFFER_SIZE. 268 * ACPI_SMBUS_BUFFER_SIZE, ACPI_GSBUS_BUFFER_SIZE, or ACPI_IPMI_BUFFER_SIZE.
260 * 269 *
261 * Note: SMBus protocol type is passed in upper 16-bits of Function 270 * Note: SMBus and GSBus protocol type is passed in upper 16-bits of Function
262 */ 271 */
263 if (source_desc->common.type != ACPI_TYPE_BUFFER) { 272 if (source_desc->common.type != ACPI_TYPE_BUFFER) {
264 ACPI_ERROR((AE_INFO, 273 ACPI_ERROR((AE_INFO,
265 "SMBus or IPMI write requires Buffer, found type %s", 274 "SMBus/IPMI/GenericSerialBus write requires Buffer, found type %s",
266 acpi_ut_get_object_type_name(source_desc))); 275 acpi_ut_get_object_type_name(source_desc)));
267 276
268 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 277 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
@@ -273,6 +282,11 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
273 length = ACPI_SMBUS_BUFFER_SIZE; 282 length = ACPI_SMBUS_BUFFER_SIZE;
274 function = 283 function =
275 ACPI_WRITE | (obj_desc->field.attribute << 16); 284 ACPI_WRITE | (obj_desc->field.attribute << 16);
285 } else if (obj_desc->field.region_obj->region.space_id ==
286 ACPI_ADR_SPACE_GSBUS) {
287 length = ACPI_GSBUS_BUFFER_SIZE;
288 function =
289 ACPI_WRITE | (obj_desc->field.attribute << 16);
276 } else { /* IPMI */ 290 } else { /* IPMI */
277 291
278 length = ACPI_IPMI_BUFFER_SIZE; 292 length = ACPI_IPMI_BUFFER_SIZE;
@@ -281,7 +295,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
281 295
282 if (source_desc->buffer.length < length) { 296 if (source_desc->buffer.length < length) {
283 ACPI_ERROR((AE_INFO, 297 ACPI_ERROR((AE_INFO,
284 "SMBus or IPMI write requires Buffer of length %u, found length %u", 298 "SMBus/IPMI/GenericSerialBus write requires Buffer of length %u, found length %u",
285 length, source_desc->buffer.length)); 299 length, source_desc->buffer.length));
286 300
287 return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); 301 return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index f915a7f3f921..149de45fdadd 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -86,6 +86,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
86{ 86{
87 acpi_status status = AE_OK; 87 acpi_status status = AE_OK;
88 union acpi_operand_object *rgn_desc; 88 union acpi_operand_object *rgn_desc;
89 u8 space_id;
89 90
90 ACPI_FUNCTION_TRACE_U32(ex_setup_region, field_datum_byte_offset); 91 ACPI_FUNCTION_TRACE_U32(ex_setup_region, field_datum_byte_offset);
91 92
@@ -101,6 +102,17 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
101 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 102 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
102 } 103 }
103 104
105 space_id = rgn_desc->region.space_id;
106
107 /* Validate the Space ID */
108
109 if (!acpi_is_valid_space_id(space_id)) {
110 ACPI_ERROR((AE_INFO,
111 "Invalid/unknown Address Space ID: 0x%2.2X",
112 space_id));
113 return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
114 }
115
104 /* 116 /*
105 * If the Region Address and Length have not been previously evaluated, 117 * If the Region Address and Length have not been previously evaluated,
106 * evaluate them now and save the results. 118 * evaluate them now and save the results.
@@ -119,11 +131,12 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
119 } 131 }
120 132
121 /* 133 /*
122 * Exit now for SMBus or IPMI address space, it has a non-linear 134 * Exit now for SMBus, GSBus or IPMI address space, it has a non-linear
123 * address space and the request cannot be directly validated 135 * address space and the request cannot be directly validated
124 */ 136 */
125 if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS || 137 if (space_id == ACPI_ADR_SPACE_SMBUS ||
126 rgn_desc->region.space_id == ACPI_ADR_SPACE_IPMI) { 138 space_id == ACPI_ADR_SPACE_GSBUS ||
139 space_id == ACPI_ADR_SPACE_IPMI) {
127 140
128 /* SMBus or IPMI has a non-linear address space */ 141 /* SMBus or IPMI has a non-linear address space */
129 142
@@ -271,11 +284,12 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
271 284
272 /* Invoke the appropriate address_space/op_region handler */ 285 /* Invoke the appropriate address_space/op_region handler */
273 286
274 status = 287 status = acpi_ev_address_space_dispatch(rgn_desc, obj_desc,
275 acpi_ev_address_space_dispatch(rgn_desc, function, region_offset, 288 function, region_offset,
276 ACPI_MUL_8(obj_desc->common_field. 289 ACPI_MUL_8(obj_desc->
277 access_byte_width), 290 common_field.
278 value); 291 access_byte_width),
292 value);
279 293
280 if (ACPI_FAILURE(status)) { 294 if (ACPI_FAILURE(status)) {
281 if (status == AE_NOT_IMPLEMENTED) { 295 if (status == AE_NOT_IMPLEMENTED) {
@@ -316,6 +330,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
316static u8 330static u8
317acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value) 331acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value)
318{ 332{
333 ACPI_FUNCTION_NAME(ex_register_overflow);
319 334
320 if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { 335 if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) {
321 /* 336 /*
@@ -330,6 +345,11 @@ acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value)
330 * The Value is larger than the maximum value that can fit into 345 * The Value is larger than the maximum value that can fit into
331 * the register. 346 * the register.
332 */ 347 */
348 ACPI_ERROR((AE_INFO,
349 "Index value 0x%8.8X%8.8X overflows field width 0x%X",
350 ACPI_FORMAT_UINT64(value),
351 obj_desc->common_field.bit_length));
352
333 return (TRUE); 353 return (TRUE);
334 } 354 }
335 355
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c
index 703d88ed0b3d..0a0893310348 100644
--- a/drivers/acpi/acpica/exmisc.c
+++ b/drivers/acpi/acpica/exmisc.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exmutex.c b/drivers/acpi/acpica/exmutex.c
index be1c56ead653..60933e9dc3c0 100644
--- a/drivers/acpi/acpica/exmutex.c
+++ b/drivers/acpi/acpica/exmutex.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exnames.c b/drivers/acpi/acpica/exnames.c
index 49ec049c157e..fcc75fa27d32 100644
--- a/drivers/acpi/acpica/exnames.c
+++ b/drivers/acpi/acpica/exnames.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exoparg1.c b/drivers/acpi/acpica/exoparg1.c
index 236ead14b7f7..9ba8c73cea16 100644
--- a/drivers/acpi/acpica/exoparg1.c
+++ b/drivers/acpi/acpica/exoparg1.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exoparg2.c b/drivers/acpi/acpica/exoparg2.c
index 2571b4a310f4..879e8a277b94 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 1b48d9d28c9a..71fcc65c9ffa 100644
--- a/drivers/acpi/acpica/exoparg3.c
+++ b/drivers/acpi/acpica/exoparg3.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exoparg6.c b/drivers/acpi/acpica/exoparg6.c
index f4a2787e8e92..0786b8659061 100644
--- a/drivers/acpi/acpica/exoparg6.c
+++ b/drivers/acpi/acpica/exoparg6.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exprep.c b/drivers/acpi/acpica/exprep.c
index cc95e2000406..30157f5a12d7 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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
@@ -47,6 +47,7 @@
47#include "acinterp.h" 47#include "acinterp.h"
48#include "amlcode.h" 48#include "amlcode.h"
49#include "acnamesp.h" 49#include "acnamesp.h"
50#include "acdispat.h"
50 51
51#define _COMPONENT ACPI_EXECUTER 52#define _COMPONENT ACPI_EXECUTER
52ACPI_MODULE_NAME("exprep") 53ACPI_MODULE_NAME("exprep")
@@ -455,6 +456,30 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
455 obj_desc->field.region_obj = 456 obj_desc->field.region_obj =
456 acpi_ns_get_attached_object(info->region_node); 457 acpi_ns_get_attached_object(info->region_node);
457 458
459 /* Fields specific to generic_serial_bus fields */
460
461 obj_desc->field.access_length = info->access_length;
462
463 if (info->connection_node) {
464 second_desc = info->connection_node->object;
465 if (!(second_desc->common.flags & AOPOBJ_DATA_VALID)) {
466 status =
467 acpi_ds_get_buffer_arguments(second_desc);
468 if (ACPI_FAILURE(status)) {
469 acpi_ut_delete_object_desc(obj_desc);
470 return_ACPI_STATUS(status);
471 }
472 }
473
474 obj_desc->field.resource_buffer =
475 second_desc->buffer.pointer;
476 obj_desc->field.resource_length =
477 (u16)second_desc->buffer.length;
478 } else if (info->resource_buffer) {
479 obj_desc->field.resource_buffer = info->resource_buffer;
480 obj_desc->field.resource_length = info->resource_length;
481 }
482
458 /* Allow full data read from EC address space */ 483 /* Allow full data read from EC address space */
459 484
460 if ((obj_desc->field.region_obj->region.space_id == 485 if ((obj_desc->field.region_obj->region.space_id ==
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c
index f0d5e14f1f2c..12d51df6d3bf 100644
--- a/drivers/acpi/acpica/exregion.c
+++ b/drivers/acpi/acpica/exregion.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exresnte.c b/drivers/acpi/acpica/exresnte.c
index 55997e46948b..fa50e77e64a8 100644
--- a/drivers/acpi/acpica/exresnte.c
+++ b/drivers/acpi/acpica/exresnte.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exresolv.c b/drivers/acpi/acpica/exresolv.c
index db502cd7d934..6e335dc34528 100644
--- a/drivers/acpi/acpica/exresolv.c
+++ b/drivers/acpi/acpica/exresolv.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exresop.c b/drivers/acpi/acpica/exresop.c
index e3bb00ccdff5..a67b1d925ddd 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exstore.c b/drivers/acpi/acpica/exstore.c
index c0c8842dd344..c6cf843cc4c9 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 a979017d56b8..b35bed52e061 100644
--- a/drivers/acpi/acpica/exstoren.c
+++ b/drivers/acpi/acpica/exstoren.c
@@ -7,7 +7,7 @@
7 *****************************************************************************/ 7 *****************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2011, Intel Corp. 10 * Copyright (C) 2000 - 2012, 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/exstorob.c b/drivers/acpi/acpica/exstorob.c
index dc665cc554de..65a45d8335c8 100644
--- a/drivers/acpi/acpica/exstorob.c
+++ b/drivers/acpi/acpica/exstorob.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exsystem.c b/drivers/acpi/acpica/exsystem.c
index df66e7b686be..191a12945226 100644
--- a/drivers/acpi/acpica/exsystem.c
+++ b/drivers/acpi/acpica/exsystem.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/exutils.c b/drivers/acpi/acpica/exutils.c
index 8ad93146dd32..eb6798ba8b59 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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
@@ -435,4 +435,29 @@ void acpi_ex_integer_to_string(char *out_string, u64 value)
435 } 435 }
436} 436}
437 437
438/*******************************************************************************
439 *
440 * FUNCTION: acpi_is_valid_space_id
441 *
442 * PARAMETERS: space_id - ID to be validated
443 *
444 * RETURN: TRUE if valid/supported ID.
445 *
446 * DESCRIPTION: Validate an operation region space_iD.
447 *
448 ******************************************************************************/
449
450u8 acpi_is_valid_space_id(u8 space_id)
451{
452
453 if ((space_id >= ACPI_NUM_PREDEFINED_REGIONS) &&
454 (space_id < ACPI_USER_REGION_BEGIN) &&
455 (space_id != ACPI_ADR_SPACE_DATA_TABLE) &&
456 (space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) {
457 return (FALSE);
458 }
459
460 return (TRUE);
461}
462
438#endif 463#endif
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c
index fc380d3d45ab..d21ec5f0b3a9 100644
--- a/drivers/acpi/acpica/hwacpi.c
+++ b/drivers/acpi/acpica/hwacpi.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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 f610d88a66be..1a6894afef79 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/hwpci.c b/drivers/acpi/acpica/hwpci.c
index 050fd227951b..1455ddcdc32c 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 cc70f3fdcdd1..4ea4eeb51bfd 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -7,7 +7,7 @@
7 ******************************************************************************/ 7 ******************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2011, Intel Corp. 10 * Copyright (C) 2000 - 2012, 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/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index d52da3073650..3c4a922a9fc2 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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 50d21c40b5c1..d4973d9da9f1 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/hwvalid.c b/drivers/acpi/acpica/hwvalid.c
index 5f1605874655..6e5c43a60bb7 100644
--- a/drivers/acpi/acpica/hwvalid.c
+++ b/drivers/acpi/acpica/hwvalid.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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
@@ -134,6 +134,8 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
134 /* Supported widths are 8/16/32 */ 134 /* Supported widths are 8/16/32 */
135 135
136 if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) { 136 if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) {
137 ACPI_ERROR((AE_INFO,
138 "Bad BitWidth parameter: %8.8X", bit_width));
137 return AE_BAD_PARAMETER; 139 return AE_BAD_PARAMETER;
138 } 140 }
139 141
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index c2793a82f120..7bdbbcf35f85 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index d93172fd15a8..61623f3f6826 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 1d0ef15d158f..7c3d3ceb98b3 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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/nsdump.c b/drivers/acpi/acpica/nsdump.c
index b683cc2ff9d3..b7f2b3be79ac 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 2ed294b7a4db..30ea5bc53a78 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 c1bd02b1a058..f375cb82e321 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 fd7c6380e294..9d84ec2f0211 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 5f7dc691c183..5cbf15ffe7d8 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 d5fa520c3de5..b20e7c8c3ffb 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 3bb8bf105ea2..dd77a3ce6e50 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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 b3234fa795b8..ec7ba2d3463c 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 c845c8089f39..bbe46a447d34 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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
@@ -620,6 +620,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
620 case ACPI_PTYPE2_FIXED: 620 case ACPI_PTYPE2_FIXED:
621 case ACPI_PTYPE2_MIN: 621 case ACPI_PTYPE2_MIN:
622 case ACPI_PTYPE2_COUNT: 622 case ACPI_PTYPE2_COUNT:
623 case ACPI_PTYPE2_FIX_VAR:
623 624
624 /* 625 /*
625 * These types all return a single Package that consists of a 626 * These types all return a single Package that consists of a
@@ -759,6 +760,34 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
759 } 760 }
760 break; 761 break;
761 762
763 case ACPI_PTYPE2_FIX_VAR:
764 /*
765 * Each subpackage has a fixed number of elements and an
766 * optional element
767 */
768 expected_count =
769 package->ret_info.count1 + package->ret_info.count2;
770 if (sub_package->package.count < expected_count) {
771 goto package_too_small;
772 }
773
774 status =
775 acpi_ns_check_package_elements(data, sub_elements,
776 package->ret_info.
777 object_type1,
778 package->ret_info.
779 count1,
780 package->ret_info.
781 object_type2,
782 sub_package->package.
783 count -
784 package->ret_info.
785 count1, 0);
786 if (ACPI_FAILURE(status)) {
787 return (status);
788 }
789 break;
790
762 case ACPI_PTYPE2_FIXED: 791 case ACPI_PTYPE2_FIXED:
763 792
764 /* Each sub-package has a fixed length */ 793 /* Each sub-package has a fixed length */
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
index ac7b854b0bd7..9c35d20eb52b 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -634,6 +634,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
634 case ACPI_PTYPE2_FIXED: 634 case ACPI_PTYPE2_FIXED:
635 case ACPI_PTYPE2_MIN: 635 case ACPI_PTYPE2_MIN:
636 case ACPI_PTYPE2_REV_FIXED: 636 case ACPI_PTYPE2_REV_FIXED:
637 case ACPI_PTYPE2_FIX_VAR:
637 break; 638 break;
638 639
639 default: 640 default:
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index 024c4f263f87..726bc8e687f7 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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
@@ -467,11 +467,12 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
467 } 467 }
468 468
469 /* 469 /*
470 * Copy and uppercase the string. From the ACPI specification: 470 * Copy and uppercase the string. From the ACPI 5.0 specification:
471 * 471 *
472 * A valid PNP ID must be of the form "AAA####" where A is an uppercase 472 * A valid PNP ID must be of the form "AAA####" where A is an uppercase
473 * letter and # is a hex digit. A valid ACPI ID must be of the form 473 * letter and # is a hex digit. A valid ACPI ID must be of the form
474 * "ACPI####" where # is a hex digit. 474 * "NNNN####" where N is an uppercase letter or decimal digit, and
475 * # is a hex digit.
475 */ 476 */
476 for (dest = new_string->string.pointer; *source; dest++, source++) { 477 for (dest = new_string->string.pointer; *source; dest++, source++) {
477 *dest = (char)ACPI_TOUPPER(*source); 478 *dest = (char)ACPI_TOUPPER(*source);
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index 28b0d7a62b99..507043d66114 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 cb1b104a69a2..a535b7afda5c 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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 345f0c3c6ad2..f69895a54895 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 e7f016d1b226..71d15f61807b 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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 83bf93024303..af401c9c4dfc 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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 57e6d825ed84..880a605cee20 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 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/psargs.c b/drivers/acpi/acpica/psargs.c
index e1fad0ee0136..5ac36aba507c 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -484,34 +484,54 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
484static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state 484static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
485 *parser_state) 485 *parser_state)
486{ 486{
487 u32 aml_offset = (u32) 487 u32 aml_offset;
488 ACPI_PTR_DIFF(parser_state->aml,
489 parser_state->aml_start);
490 union acpi_parse_object *field; 488 union acpi_parse_object *field;
489 union acpi_parse_object *arg = NULL;
491 u16 opcode; 490 u16 opcode;
492 u32 name; 491 u32 name;
492 u8 access_type;
493 u8 access_attribute;
494 u8 access_length;
495 u32 pkg_length;
496 u8 *pkg_end;
497 u32 buffer_length;
493 498
494 ACPI_FUNCTION_TRACE(ps_get_next_field); 499 ACPI_FUNCTION_TRACE(ps_get_next_field);
495 500
501 aml_offset =
502 (u32)ACPI_PTR_DIFF(parser_state->aml, parser_state->aml_start);
503
496 /* Determine field type */ 504 /* Determine field type */
497 505
498 switch (ACPI_GET8(parser_state->aml)) { 506 switch (ACPI_GET8(parser_state->aml)) {
499 default: 507 case AML_FIELD_OFFSET_OP:
500 508
501 opcode = AML_INT_NAMEDFIELD_OP; 509 opcode = AML_INT_RESERVEDFIELD_OP;
510 parser_state->aml++;
502 break; 511 break;
503 512
504 case 0x00: 513 case AML_FIELD_ACCESS_OP:
505 514
506 opcode = AML_INT_RESERVEDFIELD_OP; 515 opcode = AML_INT_ACCESSFIELD_OP;
507 parser_state->aml++; 516 parser_state->aml++;
508 break; 517 break;
509 518
510 case 0x01: 519 case AML_FIELD_CONNECTION_OP:
511 520
512 opcode = AML_INT_ACCESSFIELD_OP; 521 opcode = AML_INT_CONNECTION_OP;
522 parser_state->aml++;
523 break;
524
525 case AML_FIELD_EXT_ACCESS_OP:
526
527 opcode = AML_INT_EXTACCESSFIELD_OP;
513 parser_state->aml++; 528 parser_state->aml++;
514 break; 529 break;
530
531 default:
532
533 opcode = AML_INT_NAMEDFIELD_OP;
534 break;
515 } 535 }
516 536
517 /* Allocate a new field op */ 537 /* Allocate a new field op */
@@ -549,16 +569,111 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
549 break; 569 break;
550 570
551 case AML_INT_ACCESSFIELD_OP: 571 case AML_INT_ACCESSFIELD_OP:
572 case AML_INT_EXTACCESSFIELD_OP:
552 573
553 /* 574 /*
554 * Get access_type and access_attrib and merge into the field Op 575 * Get access_type and access_attrib and merge into the field Op
555 * access_type is first operand, access_attribute is second 576 * access_type is first operand, access_attribute is second. stuff
577 * these bytes into the node integer value for convenience.
556 */ 578 */
557 field->common.value.integer = 579
558 (((u32) ACPI_GET8(parser_state->aml) << 8)); 580 /* Get the two bytes (Type/Attribute) */
581
582 access_type = ACPI_GET8(parser_state->aml);
559 parser_state->aml++; 583 parser_state->aml++;
560 field->common.value.integer |= ACPI_GET8(parser_state->aml); 584 access_attribute = ACPI_GET8(parser_state->aml);
561 parser_state->aml++; 585 parser_state->aml++;
586
587 field->common.value.integer = (u8)access_type;
588 field->common.value.integer |= (u16)(access_attribute << 8);
589
590 /* This opcode has a third byte, access_length */
591
592 if (opcode == AML_INT_EXTACCESSFIELD_OP) {
593 access_length = ACPI_GET8(parser_state->aml);
594 parser_state->aml++;
595
596 field->common.value.integer |=
597 (u32)(access_length << 16);
598 }
599 break;
600
601 case AML_INT_CONNECTION_OP:
602
603 /*
604 * Argument for Connection operator can be either a Buffer
605 * (resource descriptor), or a name_string.
606 */
607 if (ACPI_GET8(parser_state->aml) == AML_BUFFER_OP) {
608 parser_state->aml++;
609
610 pkg_end = parser_state->aml;
611 pkg_length =
612 acpi_ps_get_next_package_length(parser_state);
613 pkg_end += pkg_length;
614
615 if (parser_state->aml < pkg_end) {
616
617 /* Non-empty list */
618
619 arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
620 if (!arg) {
621 return_PTR(NULL);
622 }
623
624 /* Get the actual buffer length argument */
625
626 opcode = ACPI_GET8(parser_state->aml);
627 parser_state->aml++;
628
629 switch (opcode) {
630 case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
631 buffer_length =
632 ACPI_GET8(parser_state->aml);
633 parser_state->aml += 1;
634 break;
635
636 case AML_WORD_OP: /* AML_WORDDATA_ARG */
637 buffer_length =
638 ACPI_GET16(parser_state->aml);
639 parser_state->aml += 2;
640 break;
641
642 case AML_DWORD_OP: /* AML_DWORDATA_ARG */
643 buffer_length =
644 ACPI_GET32(parser_state->aml);
645 parser_state->aml += 4;
646 break;
647
648 default:
649 buffer_length = 0;
650 break;
651 }
652
653 /* Fill in bytelist data */
654
655 arg->named.value.size = buffer_length;
656 arg->named.data = parser_state->aml;
657 }
658
659 /* Skip to End of byte data */
660
661 parser_state->aml = pkg_end;
662 } else {
663 arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
664 if (!arg) {
665 return_PTR(NULL);
666 }
667
668 /* Get the Namestring argument */
669
670 arg->common.value.name =
671 acpi_ps_get_next_namestring(parser_state);
672 }
673
674 /* Link the buffer/namestring to parent (CONNECTION_OP) */
675
676 acpi_ps_append_arg(field, arg);
562 break; 677 break;
563 678
564 default: 679 default:
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c
index 01dd70d1de51..9547ad8a620b 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 bed08de7528c..a0226fdcf75c 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -638,7 +638,16 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
638 638
639/* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, 639/* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY,
640 AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, 640 AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R,
641 AML_FLAGS_EXEC_0A_0T_1R) 641 AML_FLAGS_EXEC_0A_0T_1R),
642
643/* ACPI 5.0 opcodes */
644
645/* 7F */ ACPI_OP("-ConnectField-", ARGP_CONNECTFIELD_OP,
646 ARGI_CONNECTFIELD_OP, ACPI_TYPE_ANY,
647 AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS),
648/* 80 */ ACPI_OP("-ExtAccessField-", ARGP_CONNECTFIELD_OP,
649 ARGI_CONNECTFIELD_OP, ACPI_TYPE_ANY,
650 AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0)
642 651
643/*! [End] no source code translation !*/ 652/*! [End] no source code translation !*/
644}; 653};
@@ -657,7 +666,7 @@ static const u8 acpi_gbl_short_op_index[256] = {
657/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 666/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
658/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX, 667/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
659/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D, 668/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
660/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 669/* 0x38 */ 0x7F, 0x80, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
661/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, 670/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
662/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, 671/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
663/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, 672/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c
index 9bb0cbd37b5e..2ff9c35a1968 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 a5faa1323a02..c872aa4b926e 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 f1464c03aa42..2b03cdbbe1c0 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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,6 +74,12 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
74 74
75 ACPI_FUNCTION_ENTRY(); 75 ACPI_FUNCTION_ENTRY();
76 76
77/*
78 if (Op->Common.aml_opcode == AML_INT_CONNECTION_OP)
79 {
80 return (Op->Common.Value.Arg);
81 }
82*/
77 /* Get the info structure for this opcode */ 83 /* Get the info structure for this opcode */
78 84
79 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); 85 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index 7eda78503422..13bb131ae125 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 3312d6368bf1..ab96cf47896d 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 8086805d4494..9d98c5ff66a5 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 9e66f9078426..a0305652394f 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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/rscalc.c b/drivers/acpi/acpica/rscalc.c
index 3a8a89ec2ca4..3c6df4b7eb2d 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -313,6 +313,38 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
313 resource_source)); 313 resource_source));
314 break; 314 break;
315 315
316 case ACPI_RESOURCE_TYPE_GPIO:
317
318 total_size =
319 (acpi_rs_length) (total_size +
320 (resource->data.gpio.
321 pin_table_length * 2) +
322 resource->data.gpio.
323 resource_source.string_length +
324 resource->data.gpio.
325 vendor_length);
326
327 break;
328
329 case ACPI_RESOURCE_TYPE_SERIAL_BUS:
330
331 total_size =
332 acpi_gbl_aml_resource_serial_bus_sizes[resource->
333 data.
334 common_serial_bus.
335 type];
336
337 total_size = (acpi_rs_length) (total_size +
338 resource->data.
339 i2c_serial_bus.
340 resource_source.
341 string_length +
342 resource->data.
343 i2c_serial_bus.
344 vendor_length);
345
346 break;
347
316 default: 348 default:
317 break; 349 break;
318 } 350 }
@@ -362,10 +394,11 @@ acpi_rs_get_list_length(u8 * aml_buffer,
362 u32 extra_struct_bytes; 394 u32 extra_struct_bytes;
363 u8 resource_index; 395 u8 resource_index;
364 u8 minimum_aml_resource_length; 396 u8 minimum_aml_resource_length;
397 union aml_resource *aml_resource;
365 398
366 ACPI_FUNCTION_TRACE(rs_get_list_length); 399 ACPI_FUNCTION_TRACE(rs_get_list_length);
367 400
368 *size_needed = 0; 401 *size_needed = ACPI_RS_SIZE_MIN; /* Minimum size is one end_tag */
369 end_aml = aml_buffer + aml_buffer_length; 402 end_aml = aml_buffer + aml_buffer_length;
370 403
371 /* Walk the list of AML resource descriptors */ 404 /* Walk the list of AML resource descriptors */
@@ -376,9 +409,15 @@ acpi_rs_get_list_length(u8 * aml_buffer,
376 409
377 status = acpi_ut_validate_resource(aml_buffer, &resource_index); 410 status = acpi_ut_validate_resource(aml_buffer, &resource_index);
378 if (ACPI_FAILURE(status)) { 411 if (ACPI_FAILURE(status)) {
412 /*
413 * Exit on failure. Cannot continue because the descriptor length
414 * may be bogus also.
415 */
379 return_ACPI_STATUS(status); 416 return_ACPI_STATUS(status);
380 } 417 }
381 418
419 aml_resource = (void *)aml_buffer;
420
382 /* Get the resource length and base (minimum) AML size */ 421 /* Get the resource length and base (minimum) AML size */
383 422
384 resource_length = acpi_ut_get_resource_length(aml_buffer); 423 resource_length = acpi_ut_get_resource_length(aml_buffer);
@@ -422,10 +461,8 @@ acpi_rs_get_list_length(u8 * aml_buffer,
422 461
423 case ACPI_RESOURCE_NAME_END_TAG: 462 case ACPI_RESOURCE_NAME_END_TAG:
424 /* 463 /*
425 * End Tag: 464 * End Tag: This is the normal exit
426 * This is the normal exit, add size of end_tag
427 */ 465 */
428 *size_needed += ACPI_RS_SIZE_MIN;
429 return_ACPI_STATUS(AE_OK); 466 return_ACPI_STATUS(AE_OK);
430 467
431 case ACPI_RESOURCE_NAME_ADDRESS32: 468 case ACPI_RESOURCE_NAME_ADDRESS32:
@@ -457,6 +494,33 @@ acpi_rs_get_list_length(u8 * aml_buffer,
457 minimum_aml_resource_length); 494 minimum_aml_resource_length);
458 break; 495 break;
459 496
497 case ACPI_RESOURCE_NAME_GPIO:
498
499 /* Vendor data is optional */
500
501 if (aml_resource->gpio.vendor_length) {
502 extra_struct_bytes +=
503 aml_resource->gpio.vendor_offset -
504 aml_resource->gpio.pin_table_offset +
505 aml_resource->gpio.vendor_length;
506 } else {
507 extra_struct_bytes +=
508 aml_resource->large_header.resource_length +
509 sizeof(struct aml_resource_large_header) -
510 aml_resource->gpio.pin_table_offset;
511 }
512 break;
513
514 case ACPI_RESOURCE_NAME_SERIAL_BUS:
515
516 minimum_aml_resource_length =
517 acpi_gbl_resource_aml_serial_bus_sizes
518 [aml_resource->common_serial_bus.type];
519 extra_struct_bytes +=
520 aml_resource->common_serial_bus.resource_length -
521 minimum_aml_resource_length;
522 break;
523
460 default: 524 default:
461 break; 525 break;
462 } 526 }
@@ -467,9 +531,18 @@ acpi_rs_get_list_length(u8 * aml_buffer,
467 * Important: Round the size up for the appropriate alignment. This 531 * Important: Round the size up for the appropriate alignment. This
468 * is a requirement on IA64. 532 * is a requirement on IA64.
469 */ 533 */
470 buffer_size = acpi_gbl_resource_struct_sizes[resource_index] + 534 if (acpi_ut_get_resource_type(aml_buffer) ==
471 extra_struct_bytes; 535 ACPI_RESOURCE_NAME_SERIAL_BUS) {
472 buffer_size = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); 536 buffer_size =
537 acpi_gbl_resource_struct_serial_bus_sizes
538 [aml_resource->common_serial_bus.type] +
539 extra_struct_bytes;
540 } else {
541 buffer_size =
542 acpi_gbl_resource_struct_sizes[resource_index] +
543 extra_struct_bytes;
544 }
545 buffer_size = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size);
473 546
474 *size_needed += buffer_size; 547 *size_needed += buffer_size;
475 548
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index 4ce6e1147e80..46d6eb38ae66 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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,70 @@ ACPI_MODULE_NAME("rscreate")
51 51
52/******************************************************************************* 52/*******************************************************************************
53 * 53 *
54 * FUNCTION: acpi_buffer_to_resource
55 *
56 * PARAMETERS: aml_buffer - Pointer to the resource byte stream
57 * aml_buffer_length - Length of the aml_buffer
58 * resource_ptr - Where the converted resource is returned
59 *
60 * RETURN: Status
61 *
62 * DESCRIPTION: Convert a raw AML buffer to a resource list
63 *
64 ******************************************************************************/
65acpi_status
66acpi_buffer_to_resource(u8 *aml_buffer,
67 u16 aml_buffer_length,
68 struct acpi_resource **resource_ptr)
69{
70 acpi_status status;
71 acpi_size list_size_needed;
72 void *resource;
73 void *current_resource_ptr;
74
75 /*
76 * Note: we allow AE_AML_NO_RESOURCE_END_TAG, since an end tag
77 * is not required here.
78 */
79
80 /* Get the required length for the converted resource */
81
82 status = acpi_rs_get_list_length(aml_buffer, aml_buffer_length,
83 &list_size_needed);
84 if (status == AE_AML_NO_RESOURCE_END_TAG) {
85 status = AE_OK;
86 }
87 if (ACPI_FAILURE(status)) {
88 return (status);
89 }
90
91 /* Allocate a buffer for the converted resource */
92
93 resource = ACPI_ALLOCATE_ZEROED(list_size_needed);
94 current_resource_ptr = resource;
95 if (!resource) {
96 return (AE_NO_MEMORY);
97 }
98
99 /* Perform the AML-to-Resource conversion */
100
101 status = acpi_ut_walk_aml_resources(aml_buffer, aml_buffer_length,
102 acpi_rs_convert_aml_to_resources,
103 &current_resource_ptr);
104 if (status == AE_AML_NO_RESOURCE_END_TAG) {
105 status = AE_OK;
106 }
107 if (ACPI_FAILURE(status)) {
108 ACPI_FREE(resource);
109 } else {
110 *resource_ptr = resource;
111 }
112
113 return (status);
114}
115
116/*******************************************************************************
117 *
54 * FUNCTION: acpi_rs_create_resource_list 118 * FUNCTION: acpi_rs_create_resource_list
55 * 119 *
56 * PARAMETERS: aml_buffer - Pointer to the resource byte stream 120 * PARAMETERS: aml_buffer - Pointer to the resource byte stream
@@ -66,9 +130,10 @@ ACPI_MODULE_NAME("rscreate")
66 * of device resources. 130 * of device resources.
67 * 131 *
68 ******************************************************************************/ 132 ******************************************************************************/
133
69acpi_status 134acpi_status
70acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, 135acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
71 struct acpi_buffer *output_buffer) 136 struct acpi_buffer * output_buffer)
72{ 137{
73 138
74 acpi_status status; 139 acpi_status status;
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c
index 33db7520c74b..b4c581132393 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -61,11 +61,13 @@ static void acpi_rs_out_integer64(char *title, u64 value);
61 61
62static void acpi_rs_out_title(char *title); 62static void acpi_rs_out_title(char *title);
63 63
64static void acpi_rs_dump_byte_list(u16 length, u8 * data); 64static void acpi_rs_dump_byte_list(u16 length, u8 *data);
65 65
66static void acpi_rs_dump_dword_list(u8 length, u32 * data); 66static void acpi_rs_dump_word_list(u16 length, u16 *data);
67 67
68static void acpi_rs_dump_short_byte_list(u8 length, u8 * data); 68static void acpi_rs_dump_dword_list(u8 length, u32 *data);
69
70static void acpi_rs_dump_short_byte_list(u8 length, u8 *data);
69 71
70static void 72static void
71acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); 73acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source);
@@ -309,6 +311,125 @@ struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = {
309 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL} 311 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL}
310}; 312};
311 313
314struct acpi_rsdump_info acpi_rs_dump_gpio[16] = {
315 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_gpio), "GPIO", NULL},
316 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.revision_id), "RevisionId", NULL},
317 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.connection_type),
318 "ConnectionType", acpi_gbl_ct_decode},
319 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.producer_consumer),
320 "ProducerConsumer", acpi_gbl_consume_decode},
321 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.pin_config), "PinConfig",
322 acpi_gbl_ppc_decode},
323 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.sharable), "Sharable",
324 acpi_gbl_shr_decode},
325 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.io_restriction),
326 "IoRestriction", acpi_gbl_ior_decode},
327 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.triggering), "Triggering",
328 acpi_gbl_he_decode},
329 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.polarity), "Polarity",
330 acpi_gbl_ll_decode},
331 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.drive_strength), "DriveStrength",
332 NULL},
333 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.debounce_timeout),
334 "DebounceTimeout", NULL},
335 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(gpio.resource_source),
336 "ResourceSource", NULL},
337 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.pin_table_length),
338 "PinTableLength", NULL},
339 {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET(gpio.pin_table), "PinTable", NULL},
340 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.vendor_length), "VendorLength",
341 NULL},
342 {ACPI_RSD_SHORTLISTX, ACPI_RSD_OFFSET(gpio.vendor_data), "VendorData",
343 NULL},
344};
345
346struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = {
347 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_dma),
348 "FixedDma", NULL},
349 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.request_lines),
350 "RequestLines", NULL},
351 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.channels), "Channels",
352 NULL},
353 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_dma.width), "TransferWidth",
354 acpi_gbl_dts_decode},
355};
356
357#define ACPI_RS_DUMP_COMMON_SERIAL_BUS \
358 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.revision_id), "RevisionId", NULL}, \
359 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \
360 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer", acpi_gbl_consume_decode}, \
361 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \
362 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \
363 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \
364 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \
365 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \
366 {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL},
367
368struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[10] = {
369 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus),
370 "Common Serial Bus", NULL},
371 ACPI_RS_DUMP_COMMON_SERIAL_BUS
372};
373
374struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = {
375 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus),
376 "I2C Serial Bus", NULL},
377 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
378 ACPI_RSD_OFFSET(i2c_serial_bus.
379 access_mode),
380 "AccessMode", acpi_gbl_am_decode},
381 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(i2c_serial_bus.connection_speed),
382 "ConnectionSpeed", NULL},
383 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(i2c_serial_bus.slave_address),
384 "SlaveAddress", NULL},
385};
386
387struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = {
388 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus),
389 "Spi Serial Bus", NULL},
390 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
391 ACPI_RSD_OFFSET(spi_serial_bus.
392 wire_mode), "WireMode",
393 acpi_gbl_wm_decode},
394 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(spi_serial_bus.device_polarity),
395 "DevicePolarity", acpi_gbl_dp_decode},
396 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.data_bit_length),
397 "DataBitLength", NULL},
398 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_phase),
399 "ClockPhase", acpi_gbl_cph_decode},
400 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_polarity),
401 "ClockPolarity", acpi_gbl_cpo_decode},
402 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(spi_serial_bus.device_selection),
403 "DeviceSelection", NULL},
404 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(spi_serial_bus.connection_speed),
405 "ConnectionSpeed", NULL},
406};
407
408struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[19] = {
409 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus),
410 "Uart Serial Bus", NULL},
411 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG,
412 ACPI_RSD_OFFSET(uart_serial_bus.
413 flow_control),
414 "FlowControl", acpi_gbl_fc_decode},
415 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.stop_bits),
416 "StopBits", acpi_gbl_sb_decode},
417 {ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.data_bits),
418 "DataBits", acpi_gbl_bpb_decode},
419 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.endian), "Endian",
420 acpi_gbl_ed_decode},
421 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.parity), "Parity",
422 acpi_gbl_pt_decode},
423 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.lines_enabled),
424 "LinesEnabled", NULL},
425 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.rx_fifo_size),
426 "RxFifoSize", NULL},
427 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.tx_fifo_size),
428 "TxFifoSize", NULL},
429 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(uart_serial_bus.default_baud_rate),
430 "ConnectionSpeed", NULL},
431};
432
312/* 433/*
313 * Tables used for common address descriptor flag fields 434 * Tables used for common address descriptor flag fields
314 */ 435 */
@@ -413,7 +534,14 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
413 /* Data items, 8/16/32/64 bit */ 534 /* Data items, 8/16/32/64 bit */
414 535
415 case ACPI_RSD_UINT8: 536 case ACPI_RSD_UINT8:
416 acpi_rs_out_integer8(name, ACPI_GET8(target)); 537 if (table->pointer) {
538 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
539 table->
540 pointer
541 [*target]));
542 } else {
543 acpi_rs_out_integer8(name, ACPI_GET8(target));
544 }
417 break; 545 break;
418 546
419 case ACPI_RSD_UINT16: 547 case ACPI_RSD_UINT16:
@@ -444,6 +572,13 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
444 0x03])); 572 0x03]));
445 break; 573 break;
446 574
575 case ACPI_RSD_3BITFLAG:
576 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
577 table->
578 pointer[*target &
579 0x07]));
580 break;
581
447 case ACPI_RSD_SHORTLIST: 582 case ACPI_RSD_SHORTLIST:
448 /* 583 /*
449 * Short byte list (single line output) for DMA and IRQ resources 584 * Short byte list (single line output) for DMA and IRQ resources
@@ -456,6 +591,20 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
456 } 591 }
457 break; 592 break;
458 593
594 case ACPI_RSD_SHORTLISTX:
595 /*
596 * Short byte list (single line output) for GPIO vendor data
597 * Note: The list length is obtained from the previous table entry
598 */
599 if (previous_target) {
600 acpi_rs_out_title(name);
601 acpi_rs_dump_short_byte_list(*previous_target,
602 *
603 (ACPI_CAST_INDIRECT_PTR
604 (u8, target)));
605 }
606 break;
607
459 case ACPI_RSD_LONGLIST: 608 case ACPI_RSD_LONGLIST:
460 /* 609 /*
461 * Long byte list for Vendor resource data 610 * Long byte list for Vendor resource data
@@ -480,6 +629,18 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
480 } 629 }
481 break; 630 break;
482 631
632 case ACPI_RSD_WORDLIST:
633 /*
634 * Word list for GPIO Pin Table
635 * Note: The list length is obtained from the previous table entry
636 */
637 if (previous_target) {
638 acpi_rs_dump_word_list(*previous_target,
639 *(ACPI_CAST_INDIRECT_PTR
640 (u16, target)));
641 }
642 break;
643
483 case ACPI_RSD_ADDRESS: 644 case ACPI_RSD_ADDRESS:
484 /* 645 /*
485 * Common flags for all Address resources 646 * Common flags for all Address resources
@@ -627,14 +788,20 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
627 788
628 /* Dump the resource descriptor */ 789 /* Dump the resource descriptor */
629 790
630 acpi_rs_dump_descriptor(&resource_list->data, 791 if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
631 acpi_gbl_dump_resource_dispatch[type]); 792 acpi_rs_dump_descriptor(&resource_list->data,
793 acpi_gbl_dump_serial_bus_dispatch
794 [resource_list->data.
795 common_serial_bus.type]);
796 } else {
797 acpi_rs_dump_descriptor(&resource_list->data,
798 acpi_gbl_dump_resource_dispatch
799 [type]);
800 }
632 801
633 /* Point to the next resource structure */ 802 /* Point to the next resource structure */
634 803
635 resource_list = 804 resource_list = ACPI_NEXT_RESOURCE(resource_list);
636 ACPI_ADD_PTR(struct acpi_resource, resource_list,
637 resource_list->length);
638 805
639 /* Exit when END_TAG descriptor is reached */ 806 /* Exit when END_TAG descriptor is reached */
640 807
@@ -768,4 +935,13 @@ static void acpi_rs_dump_dword_list(u8 length, u32 * data)
768 } 935 }
769} 936}
770 937
938static void acpi_rs_dump_word_list(u16 length, u16 *data)
939{
940 u16 i;
941
942 for (i = 0; i < length; i++) {
943 acpi_os_printf("%25s%2.2X : %4.4X\n", "Word", i, data[i]);
944 }
945}
946
771#endif 947#endif
diff --git a/drivers/acpi/acpica/rsinfo.c b/drivers/acpi/acpica/rsinfo.c
index f9ea60872aa4..a9fa5158200b 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -76,7 +76,10 @@ struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = {
76 acpi_rs_convert_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ 76 acpi_rs_convert_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */
77 acpi_rs_convert_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 77 acpi_rs_convert_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
78 acpi_rs_convert_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 78 acpi_rs_convert_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
79 acpi_rs_convert_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 79 acpi_rs_convert_generic_reg, /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
80 acpi_rs_convert_gpio, /* 0x11, ACPI_RESOURCE_TYPE_GPIO */
81 acpi_rs_convert_fixed_dma, /* 0x12, ACPI_RESOURCE_TYPE_FIXED_DMA */
82 NULL, /* 0x13, ACPI_RESOURCE_TYPE_SERIAL_BUS - Use subtype table below */
80}; 83};
81 84
82/* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ 85/* Dispatch tables for AML-to-resource (Get Resource) conversion functions */
@@ -94,7 +97,7 @@ struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[] = {
94 acpi_rs_convert_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ 97 acpi_rs_convert_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
95 acpi_rs_convert_io, /* 0x08, ACPI_RESOURCE_NAME_IO */ 98 acpi_rs_convert_io, /* 0x08, ACPI_RESOURCE_NAME_IO */
96 acpi_rs_convert_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ 99 acpi_rs_convert_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */
97 NULL, /* 0x0A, Reserved */ 100 acpi_rs_convert_fixed_dma, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */
98 NULL, /* 0x0B, Reserved */ 101 NULL, /* 0x0B, Reserved */
99 NULL, /* 0x0C, Reserved */ 102 NULL, /* 0x0C, Reserved */
100 NULL, /* 0x0D, Reserved */ 103 NULL, /* 0x0D, Reserved */
@@ -114,7 +117,19 @@ struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[] = {
114 acpi_rs_convert_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ 117 acpi_rs_convert_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */
115 acpi_rs_convert_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ 118 acpi_rs_convert_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */
116 acpi_rs_convert_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ 119 acpi_rs_convert_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */
117 acpi_rs_convert_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ 120 acpi_rs_convert_ext_address64, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */
121 acpi_rs_convert_gpio, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */
122 NULL, /* 0x0D, Reserved */
123 NULL, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use subtype table below */
124};
125
126/* Subtype table for serial_bus -- I2C, SPI, and UART */
127
128struct acpi_rsconvert_info *acpi_gbl_convert_resource_serial_bus_dispatch[] = {
129 NULL,
130 acpi_rs_convert_i2c_serial_bus,
131 acpi_rs_convert_spi_serial_bus,
132 acpi_rs_convert_uart_serial_bus,
118}; 133};
119 134
120#ifdef ACPI_FUTURE_USAGE 135#ifdef ACPI_FUTURE_USAGE
@@ -140,6 +155,16 @@ struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = {
140 acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 155 acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
141 acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 156 acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
142 acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 157 acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
158 acpi_rs_dump_gpio, /* ACPI_RESOURCE_TYPE_GPIO */
159 acpi_rs_dump_fixed_dma, /* ACPI_RESOURCE_TYPE_FIXED_DMA */
160 NULL, /* ACPI_RESOURCE_TYPE_SERIAL_BUS */
161};
162
163struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[] = {
164 NULL,
165 acpi_rs_dump_i2c_serial_bus, /* AML_RESOURCE_I2C_BUS_TYPE */
166 acpi_rs_dump_spi_serial_bus, /* AML_RESOURCE_SPI_BUS_TYPE */
167 acpi_rs_dump_uart_serial_bus, /* AML_RESOURCE_UART_BUS_TYPE */
143}; 168};
144#endif 169#endif
145 170
@@ -166,7 +191,10 @@ const u8 acpi_gbl_aml_resource_sizes[] = {
166 sizeof(struct aml_resource_address64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */ 191 sizeof(struct aml_resource_address64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */
167 sizeof(struct aml_resource_extended_address64), /*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 192 sizeof(struct aml_resource_extended_address64), /*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
168 sizeof(struct aml_resource_extended_irq), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 193 sizeof(struct aml_resource_extended_irq), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
169 sizeof(struct aml_resource_generic_register) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 194 sizeof(struct aml_resource_generic_register), /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
195 sizeof(struct aml_resource_gpio), /* ACPI_RESOURCE_TYPE_GPIO */
196 sizeof(struct aml_resource_fixed_dma), /* ACPI_RESOURCE_TYPE_FIXED_DMA */
197 sizeof(struct aml_resource_common_serialbus), /* ACPI_RESOURCE_TYPE_SERIAL_BUS */
170}; 198};
171 199
172const u8 acpi_gbl_resource_struct_sizes[] = { 200const u8 acpi_gbl_resource_struct_sizes[] = {
@@ -182,7 +210,7 @@ const u8 acpi_gbl_resource_struct_sizes[] = {
182 ACPI_RS_SIZE_MIN, 210 ACPI_RS_SIZE_MIN,
183 ACPI_RS_SIZE(struct acpi_resource_io), 211 ACPI_RS_SIZE(struct acpi_resource_io),
184 ACPI_RS_SIZE(struct acpi_resource_fixed_io), 212 ACPI_RS_SIZE(struct acpi_resource_fixed_io),
185 0, 213 ACPI_RS_SIZE(struct acpi_resource_fixed_dma),
186 0, 214 0,
187 0, 215 0,
188 0, 216 0,
@@ -202,5 +230,21 @@ const u8 acpi_gbl_resource_struct_sizes[] = {
202 ACPI_RS_SIZE(struct acpi_resource_address16), 230 ACPI_RS_SIZE(struct acpi_resource_address16),
203 ACPI_RS_SIZE(struct acpi_resource_extended_irq), 231 ACPI_RS_SIZE(struct acpi_resource_extended_irq),
204 ACPI_RS_SIZE(struct acpi_resource_address64), 232 ACPI_RS_SIZE(struct acpi_resource_address64),
205 ACPI_RS_SIZE(struct acpi_resource_extended_address64) 233 ACPI_RS_SIZE(struct acpi_resource_extended_address64),
234 ACPI_RS_SIZE(struct acpi_resource_gpio),
235 ACPI_RS_SIZE(struct acpi_resource_common_serialbus)
236};
237
238const u8 acpi_gbl_aml_resource_serial_bus_sizes[] = {
239 0,
240 sizeof(struct aml_resource_i2c_serialbus),
241 sizeof(struct aml_resource_spi_serialbus),
242 sizeof(struct aml_resource_uart_serialbus),
243};
244
245const u8 acpi_gbl_resource_struct_serial_bus_sizes[] = {
246 0,
247 ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus),
248 ACPI_RS_SIZE(struct acpi_resource_spi_serialbus),
249 ACPI_RS_SIZE(struct acpi_resource_uart_serialbus),
206}; 250};
diff --git a/drivers/acpi/acpica/rsio.c b/drivers/acpi/acpica/rsio.c
index 0c7efef008be..f6a081057a22 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 50b8ad211167..e23a9ec248cb 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -264,3 +264,34 @@ struct acpi_rsconvert_info acpi_rs_convert_dma[6] = {
264 AML_OFFSET(dma.dma_channel_mask), 264 AML_OFFSET(dma.dma_channel_mask),
265 ACPI_RS_OFFSET(data.dma.channel_count)} 265 ACPI_RS_OFFSET(data.dma.channel_count)}
266}; 266};
267
268/*******************************************************************************
269 *
270 * acpi_rs_convert_fixed_dma
271 *
272 ******************************************************************************/
273
274struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[4] = {
275 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_DMA,
276 ACPI_RS_SIZE(struct acpi_resource_fixed_dma),
277 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_dma)},
278
279 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_DMA,
280 sizeof(struct aml_resource_fixed_dma),
281 0},
282
283 /*
284 * These fields are contiguous in both the source and destination:
285 * request_lines
286 * Channels
287 */
288
289 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_dma.request_lines),
290 AML_OFFSET(fixed_dma.request_lines),
291 2},
292
293 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_dma.width),
294 AML_OFFSET(fixed_dma.width),
295 1},
296
297};
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c
index 1bfcef736c50..9be129f5d6f4 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -70,6 +70,8 @@ acpi_rs_convert_aml_to_resources(u8 * aml,
70 struct acpi_resource **resource_ptr = 70 struct acpi_resource **resource_ptr =
71 ACPI_CAST_INDIRECT_PTR(struct acpi_resource, context); 71 ACPI_CAST_INDIRECT_PTR(struct acpi_resource, context);
72 struct acpi_resource *resource; 72 struct acpi_resource *resource;
73 union aml_resource *aml_resource;
74 struct acpi_rsconvert_info *conversion_table;
73 acpi_status status; 75 acpi_status status;
74 76
75 ACPI_FUNCTION_TRACE(rs_convert_aml_to_resources); 77 ACPI_FUNCTION_TRACE(rs_convert_aml_to_resources);
@@ -84,14 +86,37 @@ acpi_rs_convert_aml_to_resources(u8 * aml,
84 "Misaligned resource pointer %p", resource)); 86 "Misaligned resource pointer %p", resource));
85 } 87 }
86 88
89 /* Get the appropriate conversion info table */
90
91 aml_resource = ACPI_CAST_PTR(union aml_resource, aml);
92 if (acpi_ut_get_resource_type(aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) {
93 if (aml_resource->common_serial_bus.type >
94 AML_RESOURCE_MAX_SERIALBUSTYPE) {
95 conversion_table = NULL;
96 } else {
97 /* This is an I2C, SPI, or UART serial_bus descriptor */
98
99 conversion_table =
100 acpi_gbl_convert_resource_serial_bus_dispatch
101 [aml_resource->common_serial_bus.type];
102 }
103 } else {
104 conversion_table =
105 acpi_gbl_get_resource_dispatch[resource_index];
106 }
107
108 if (!conversion_table) {
109 ACPI_ERROR((AE_INFO,
110 "Invalid/unsupported resource descriptor: Type 0x%2.2X",
111 resource_index));
112 return (AE_AML_INVALID_RESOURCE_TYPE);
113 }
114
87 /* Convert the AML byte stream resource to a local resource struct */ 115 /* Convert the AML byte stream resource to a local resource struct */
88 116
89 status = 117 status =
90 acpi_rs_convert_aml_to_resource(resource, 118 acpi_rs_convert_aml_to_resource(resource, aml_resource,
91 ACPI_CAST_PTR(union aml_resource, 119 conversion_table);
92 aml),
93 acpi_gbl_get_resource_dispatch
94 [resource_index]);
95 if (ACPI_FAILURE(status)) { 120 if (ACPI_FAILURE(status)) {
96 ACPI_EXCEPTION((AE_INFO, status, 121 ACPI_EXCEPTION((AE_INFO, status,
97 "Could not convert AML resource (Type 0x%X)", 122 "Could not convert AML resource (Type 0x%X)",
@@ -106,7 +131,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml,
106 131
107 /* Point to the next structure in the output buffer */ 132 /* Point to the next structure in the output buffer */
108 133
109 *resource_ptr = ACPI_ADD_PTR(void, resource, resource->length); 134 *resource_ptr = ACPI_NEXT_RESOURCE(resource);
110 return_ACPI_STATUS(AE_OK); 135 return_ACPI_STATUS(AE_OK);
111} 136}
112 137
@@ -135,6 +160,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
135{ 160{
136 u8 *aml = output_buffer; 161 u8 *aml = output_buffer;
137 u8 *end_aml = output_buffer + aml_size_needed; 162 u8 *end_aml = output_buffer + aml_size_needed;
163 struct acpi_rsconvert_info *conversion_table;
138 acpi_status status; 164 acpi_status status;
139 165
140 ACPI_FUNCTION_TRACE(rs_convert_resources_to_aml); 166 ACPI_FUNCTION_TRACE(rs_convert_resources_to_aml);
@@ -154,11 +180,34 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
154 180
155 /* Perform the conversion */ 181 /* Perform the conversion */
156 182
157 status = acpi_rs_convert_resource_to_aml(resource, ACPI_CAST_PTR(union 183 if (resource->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
158 aml_resource, 184 if (resource->data.common_serial_bus.type >
159 aml), 185 AML_RESOURCE_MAX_SERIALBUSTYPE) {
160 acpi_gbl_set_resource_dispatch 186 conversion_table = NULL;
161 [resource->type]); 187 } else {
188 /* This is an I2C, SPI, or UART serial_bus descriptor */
189
190 conversion_table =
191 acpi_gbl_convert_resource_serial_bus_dispatch
192 [resource->data.common_serial_bus.type];
193 }
194 } else {
195 conversion_table =
196 acpi_gbl_set_resource_dispatch[resource->type];
197 }
198
199 if (!conversion_table) {
200 ACPI_ERROR((AE_INFO,
201 "Invalid/unsupported resource descriptor: Type 0x%2.2X",
202 resource->type));
203 return (AE_AML_INVALID_RESOURCE_TYPE);
204 }
205
206 status = acpi_rs_convert_resource_to_aml(resource,
207 ACPI_CAST_PTR(union
208 aml_resource,
209 aml),
210 conversion_table);
162 if (ACPI_FAILURE(status)) { 211 if (ACPI_FAILURE(status)) {
163 ACPI_EXCEPTION((AE_INFO, status, 212 ACPI_EXCEPTION((AE_INFO, status,
164 "Could not convert resource (type 0x%X) to AML", 213 "Could not convert resource (type 0x%X) to AML",
@@ -192,9 +241,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
192 241
193 /* Point to the next input resource descriptor */ 242 /* Point to the next input resource descriptor */
194 243
195 resource = 244 resource = ACPI_NEXT_RESOURCE(resource);
196 ACPI_ADD_PTR(struct acpi_resource, resource,
197 resource->length);
198 } 245 }
199 246
200 /* Completed buffer, but did not find an end_tag resource descriptor */ 247 /* Completed buffer, but did not find an end_tag resource descriptor */
diff --git a/drivers/acpi/acpica/rsmemory.c b/drivers/acpi/acpica/rsmemory.c
index 7cc6d8625f1e..4fd611ad02b4 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 410264b22a29..8073b371cc7c 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -83,6 +83,10 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
83 83
84 ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource); 84 ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource);
85 85
86 if (!info) {
87 return_ACPI_STATUS(AE_BAD_PARAMETER);
88 }
89
86 if (((acpi_size) resource) & 0x3) { 90 if (((acpi_size) resource) & 0x3) {
87 91
88 /* Each internal resource struct is expected to be 32-bit aligned */ 92 /* Each internal resource struct is expected to be 32-bit aligned */
@@ -101,7 +105,6 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
101 * table length (# of table entries) 105 * table length (# of table entries)
102 */ 106 */
103 count = INIT_TABLE_LENGTH(info); 107 count = INIT_TABLE_LENGTH(info);
104
105 while (count) { 108 while (count) {
106 /* 109 /*
107 * Source is the external AML byte stream buffer, 110 * Source is the external AML byte stream buffer,
@@ -145,6 +148,14 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
145 ((ACPI_GET8(source) >> info->value) & 0x03); 148 ((ACPI_GET8(source) >> info->value) & 0x03);
146 break; 149 break;
147 150
151 case ACPI_RSC_3BITFLAG:
152 /*
153 * Mask and shift the flag bits
154 */
155 ACPI_SET8(destination) = (u8)
156 ((ACPI_GET8(source) >> info->value) & 0x07);
157 break;
158
148 case ACPI_RSC_COUNT: 159 case ACPI_RSC_COUNT:
149 160
150 item_count = ACPI_GET8(source); 161 item_count = ACPI_GET8(source);
@@ -163,6 +174,69 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
163 (info->value * (item_count - 1)); 174 (info->value * (item_count - 1));
164 break; 175 break;
165 176
177 case ACPI_RSC_COUNT_GPIO_PIN:
178
179 target = ACPI_ADD_PTR(void, aml, info->value);
180 item_count = ACPI_GET16(target) - ACPI_GET16(source);
181
182 resource->length = resource->length + item_count;
183 item_count = item_count / 2;
184 ACPI_SET16(destination) = item_count;
185 break;
186
187 case ACPI_RSC_COUNT_GPIO_VEN:
188
189 item_count = ACPI_GET8(source);
190 ACPI_SET8(destination) = (u8)item_count;
191
192 resource->length = resource->length +
193 (info->value * item_count);
194 break;
195
196 case ACPI_RSC_COUNT_GPIO_RES:
197
198 /*
199 * Vendor data is optional (length/offset may both be zero)
200 * Examine vendor data length field first
201 */
202 target = ACPI_ADD_PTR(void, aml, (info->value + 2));
203 if (ACPI_GET16(target)) {
204
205 /* Use vendor offset to get resource source length */
206
207 target = ACPI_ADD_PTR(void, aml, info->value);
208 item_count =
209 ACPI_GET16(target) - ACPI_GET16(source);
210 } else {
211 /* No vendor data to worry about */
212
213 item_count = aml->large_header.resource_length +
214 sizeof(struct aml_resource_large_header) -
215 ACPI_GET16(source);
216 }
217
218 resource->length = resource->length + item_count;
219 ACPI_SET16(destination) = item_count;
220 break;
221
222 case ACPI_RSC_COUNT_SERIAL_VEN:
223
224 item_count = ACPI_GET16(source) - info->value;
225
226 resource->length = resource->length + item_count;
227 ACPI_SET16(destination) = item_count;
228 break;
229
230 case ACPI_RSC_COUNT_SERIAL_RES:
231
232 item_count = (aml_resource_length +
233 sizeof(struct aml_resource_large_header))
234 - ACPI_GET16(source) - info->value;
235
236 resource->length = resource->length + item_count;
237 ACPI_SET16(destination) = item_count;
238 break;
239
166 case ACPI_RSC_LENGTH: 240 case ACPI_RSC_LENGTH:
167 241
168 resource->length = resource->length + info->value; 242 resource->length = resource->length + info->value;
@@ -183,6 +257,72 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
183 info->opcode); 257 info->opcode);
184 break; 258 break;
185 259
260 case ACPI_RSC_MOVE_GPIO_PIN:
261
262 /* Generate and set the PIN data pointer */
263
264 target = (char *)ACPI_ADD_PTR(void, resource,
265 (resource->length -
266 item_count * 2));
267 *(u16 **)destination = ACPI_CAST_PTR(u16, target);
268
269 /* Copy the PIN data */
270
271 source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source));
272 acpi_rs_move_data(target, source, item_count,
273 info->opcode);
274 break;
275
276 case ACPI_RSC_MOVE_GPIO_RES:
277
278 /* Generate and set the resource_source string pointer */
279
280 target = (char *)ACPI_ADD_PTR(void, resource,
281 (resource->length -
282 item_count));
283 *(u8 **)destination = ACPI_CAST_PTR(u8, target);
284
285 /* Copy the resource_source string */
286
287 source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source));
288 acpi_rs_move_data(target, source, item_count,
289 info->opcode);
290 break;
291
292 case ACPI_RSC_MOVE_SERIAL_VEN:
293
294 /* Generate and set the Vendor Data pointer */
295
296 target = (char *)ACPI_ADD_PTR(void, resource,
297 (resource->length -
298 item_count));
299 *(u8 **)destination = ACPI_CAST_PTR(u8, target);
300
301 /* Copy the Vendor Data */
302
303 source = ACPI_ADD_PTR(void, aml, info->value);
304 acpi_rs_move_data(target, source, item_count,
305 info->opcode);
306 break;
307
308 case ACPI_RSC_MOVE_SERIAL_RES:
309
310 /* Generate and set the resource_source string pointer */
311
312 target = (char *)ACPI_ADD_PTR(void, resource,
313 (resource->length -
314 item_count));
315 *(u8 **)destination = ACPI_CAST_PTR(u8, target);
316
317 /* Copy the resource_source string */
318
319 source =
320 ACPI_ADD_PTR(void, aml,
321 (ACPI_GET16(source) + info->value));
322 acpi_rs_move_data(target, source, item_count,
323 info->opcode);
324 break;
325
186 case ACPI_RSC_SET8: 326 case ACPI_RSC_SET8:
187 327
188 ACPI_MEMSET(destination, info->aml_offset, info->value); 328 ACPI_MEMSET(destination, info->aml_offset, info->value);
@@ -219,13 +359,18 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
219 * Optional resource_source (Index and String). This is the more 359 * Optional resource_source (Index and String). This is the more
220 * complicated case used by the Interrupt() macro 360 * complicated case used by the Interrupt() macro
221 */ 361 */
222 target = 362 target = ACPI_ADD_PTR(char, resource,
223 ACPI_ADD_PTR(char, resource, 363 info->aml_offset +
224 info->aml_offset + (item_count * 4)); 364 (item_count * 4));
225 365
226 resource->length += 366 resource->length +=
227 acpi_rs_get_resource_source(aml_resource_length, 367 acpi_rs_get_resource_source(aml_resource_length,
228 (acpi_rs_length) (((item_count - 1) * sizeof(u32)) + info->value), destination, aml, target); 368 (acpi_rs_length)
369 (((item_count -
370 1) * sizeof(u32)) +
371 info->value),
372 destination, aml,
373 target);
229 break; 374 break;
230 375
231 case ACPI_RSC_BITMASK: 376 case ACPI_RSC_BITMASK:
@@ -327,6 +472,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
327{ 472{
328 void *source = NULL; 473 void *source = NULL;
329 void *destination; 474 void *destination;
475 char *target;
330 acpi_rsdesc_size aml_length = 0; 476 acpi_rsdesc_size aml_length = 0;
331 u8 count; 477 u8 count;
332 u16 temp16 = 0; 478 u16 temp16 = 0;
@@ -334,6 +480,10 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
334 480
335 ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml); 481 ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml);
336 482
483 if (!info) {
484 return_ACPI_STATUS(AE_BAD_PARAMETER);
485 }
486
337 /* 487 /*
338 * First table entry must be ACPI_RSC_INITxxx and must contain the 488 * First table entry must be ACPI_RSC_INITxxx and must contain the
339 * table length (# of table entries) 489 * table length (# of table entries)
@@ -383,6 +533,14 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
383 ((ACPI_GET8(source) & 0x03) << info->value); 533 ((ACPI_GET8(source) & 0x03) << info->value);
384 break; 534 break;
385 535
536 case ACPI_RSC_3BITFLAG:
537 /*
538 * Mask and shift the flag bits
539 */
540 ACPI_SET8(destination) |= (u8)
541 ((ACPI_GET8(source) & 0x07) << info->value);
542 break;
543
386 case ACPI_RSC_COUNT: 544 case ACPI_RSC_COUNT:
387 545
388 item_count = ACPI_GET8(source); 546 item_count = ACPI_GET8(source);
@@ -400,6 +558,63 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
400 acpi_rs_set_resource_length(aml_length, aml); 558 acpi_rs_set_resource_length(aml_length, aml);
401 break; 559 break;
402 560
561 case ACPI_RSC_COUNT_GPIO_PIN:
562
563 item_count = ACPI_GET16(source);
564 ACPI_SET16(destination) = (u16)aml_length;
565
566 aml_length = (u16)(aml_length + item_count * 2);
567 target = ACPI_ADD_PTR(void, aml, info->value);
568 ACPI_SET16(target) = (u16)aml_length;
569 acpi_rs_set_resource_length(aml_length, aml);
570 break;
571
572 case ACPI_RSC_COUNT_GPIO_VEN:
573
574 item_count = ACPI_GET16(source);
575 ACPI_SET16(destination) = (u16)item_count;
576
577 aml_length =
578 (u16)(aml_length + (info->value * item_count));
579 acpi_rs_set_resource_length(aml_length, aml);
580 break;
581
582 case ACPI_RSC_COUNT_GPIO_RES:
583
584 /* Set resource source string length */
585
586 item_count = ACPI_GET16(source);
587 ACPI_SET16(destination) = (u16)aml_length;
588
589 /* Compute offset for the Vendor Data */
590
591 aml_length = (u16)(aml_length + item_count);
592 target = ACPI_ADD_PTR(void, aml, info->value);
593
594 /* Set vendor offset only if there is vendor data */
595
596 if (resource->data.gpio.vendor_length) {
597 ACPI_SET16(target) = (u16)aml_length;
598 }
599
600 acpi_rs_set_resource_length(aml_length, aml);
601 break;
602
603 case ACPI_RSC_COUNT_SERIAL_VEN:
604
605 item_count = ACPI_GET16(source);
606 ACPI_SET16(destination) = item_count + info->value;
607 aml_length = (u16)(aml_length + item_count);
608 acpi_rs_set_resource_length(aml_length, aml);
609 break;
610
611 case ACPI_RSC_COUNT_SERIAL_RES:
612
613 item_count = ACPI_GET16(source);
614 aml_length = (u16)(aml_length + item_count);
615 acpi_rs_set_resource_length(aml_length, aml);
616 break;
617
403 case ACPI_RSC_LENGTH: 618 case ACPI_RSC_LENGTH:
404 619
405 acpi_rs_set_resource_length(info->value, aml); 620 acpi_rs_set_resource_length(info->value, aml);
@@ -417,6 +632,48 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
417 info->opcode); 632 info->opcode);
418 break; 633 break;
419 634
635 case ACPI_RSC_MOVE_GPIO_PIN:
636
637 destination = (char *)ACPI_ADD_PTR(void, aml,
638 ACPI_GET16
639 (destination));
640 source = *(u16 **)source;
641 acpi_rs_move_data(destination, source, item_count,
642 info->opcode);
643 break;
644
645 case ACPI_RSC_MOVE_GPIO_RES:
646
647 /* Used for both resource_source string and vendor_data */
648
649 destination = (char *)ACPI_ADD_PTR(void, aml,
650 ACPI_GET16
651 (destination));
652 source = *(u8 **)source;
653 acpi_rs_move_data(destination, source, item_count,
654 info->opcode);
655 break;
656
657 case ACPI_RSC_MOVE_SERIAL_VEN:
658
659 destination = (char *)ACPI_ADD_PTR(void, aml,
660 (aml_length -
661 item_count));
662 source = *(u8 **)source;
663 acpi_rs_move_data(destination, source, item_count,
664 info->opcode);
665 break;
666
667 case ACPI_RSC_MOVE_SERIAL_RES:
668
669 destination = (char *)ACPI_ADD_PTR(void, aml,
670 (aml_length -
671 item_count));
672 source = *(u8 **)source;
673 acpi_rs_move_data(destination, source, item_count,
674 info->opcode);
675 break;
676
420 case ACPI_RSC_ADDRESS: 677 case ACPI_RSC_ADDRESS:
421 678
422 /* Set the Resource Type, General Flags, and Type-Specific Flags */ 679 /* Set the Resource Type, General Flags, and Type-Specific Flags */
diff --git a/drivers/acpi/acpica/rsserial.c b/drivers/acpi/acpica/rsserial.c
new file mode 100644
index 000000000000..9aa5e689b444
--- /dev/null
+++ b/drivers/acpi/acpica/rsserial.c
@@ -0,0 +1,441 @@
1/*******************************************************************************
2 *
3 * Module Name: rsserial - GPIO/serial_bus resource descriptors
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acresrc.h"
47
48#define _COMPONENT ACPI_RESOURCES
49ACPI_MODULE_NAME("rsserial")
50
51/*******************************************************************************
52 *
53 * acpi_rs_convert_gpio
54 *
55 ******************************************************************************/
56struct acpi_rsconvert_info acpi_rs_convert_gpio[17] = {
57 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO,
58 ACPI_RS_SIZE(struct acpi_resource_gpio),
59 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_gpio)},
60
61 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GPIO,
62 sizeof(struct aml_resource_gpio),
63 0},
64
65 /*
66 * These fields are contiguous in both the source and destination:
67 * revision_id
68 * connection_type
69 */
70 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.revision_id),
71 AML_OFFSET(gpio.revision_id),
72 2},
73
74 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.producer_consumer),
75 AML_OFFSET(gpio.flags),
76 0},
77
78 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.sharable),
79 AML_OFFSET(gpio.int_flags),
80 3},
81
82 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.io_restriction),
83 AML_OFFSET(gpio.int_flags),
84 0},
85
86 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.triggering),
87 AML_OFFSET(gpio.int_flags),
88 0},
89
90 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.polarity),
91 AML_OFFSET(gpio.int_flags),
92 1},
93
94 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.pin_config),
95 AML_OFFSET(gpio.pin_config),
96 1},
97
98 /*
99 * These fields are contiguous in both the source and destination:
100 * drive_strength
101 * debounce_timeout
102 */
103 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.gpio.drive_strength),
104 AML_OFFSET(gpio.drive_strength),
105 2},
106
107 /* Pin Table */
108
109 {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET(data.gpio.pin_table_length),
110 AML_OFFSET(gpio.pin_table_offset),
111 AML_OFFSET(gpio.res_source_offset)},
112
113 {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.gpio.pin_table),
114 AML_OFFSET(gpio.pin_table_offset),
115 0},
116
117 /* Resource Source */
118
119 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.resource_source.index),
120 AML_OFFSET(gpio.res_source_index),
121 1},
122
123 {ACPI_RSC_COUNT_GPIO_RES,
124 ACPI_RS_OFFSET(data.gpio.resource_source.string_length),
125 AML_OFFSET(gpio.res_source_offset),
126 AML_OFFSET(gpio.vendor_offset)},
127
128 {ACPI_RSC_MOVE_GPIO_RES,
129 ACPI_RS_OFFSET(data.gpio.resource_source.string_ptr),
130 AML_OFFSET(gpio.res_source_offset),
131 0},
132
133 /* Vendor Data */
134
135 {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.gpio.vendor_length),
136 AML_OFFSET(gpio.vendor_length),
137 1},
138
139 {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.gpio.vendor_data),
140 AML_OFFSET(gpio.vendor_offset),
141 0},
142};
143
144/*******************************************************************************
145 *
146 * acpi_rs_convert_i2c_serial_bus
147 *
148 ******************************************************************************/
149
150struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[16] = {
151 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
152 ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus),
153 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)},
154
155 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
156 sizeof(struct aml_resource_i2c_serialbus),
157 0},
158
159 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
160 AML_OFFSET(common_serial_bus.revision_id),
161 1},
162
163 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
164 AML_OFFSET(common_serial_bus.type),
165 1},
166
167 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
168 AML_OFFSET(common_serial_bus.flags),
169 0},
170
171 {ACPI_RSC_1BITFLAG,
172 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
173 AML_OFFSET(common_serial_bus.flags),
174 1},
175
176 {ACPI_RSC_MOVE8,
177 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
178 AML_OFFSET(common_serial_bus.type_revision_id),
179 1},
180
181 {ACPI_RSC_MOVE16,
182 ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
183 AML_OFFSET(common_serial_bus.type_data_length),
184 1},
185
186 /* Vendor data */
187
188 {ACPI_RSC_COUNT_SERIAL_VEN,
189 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
190 AML_OFFSET(common_serial_bus.type_data_length),
191 AML_RESOURCE_I2C_MIN_DATA_LEN},
192
193 {ACPI_RSC_MOVE_SERIAL_VEN,
194 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
195 0,
196 sizeof(struct aml_resource_i2c_serialbus)},
197
198 /* Resource Source */
199
200 {ACPI_RSC_MOVE8,
201 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
202 AML_OFFSET(common_serial_bus.res_source_index),
203 1},
204
205 {ACPI_RSC_COUNT_SERIAL_RES,
206 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
207 AML_OFFSET(common_serial_bus.type_data_length),
208 sizeof(struct aml_resource_common_serialbus)},
209
210 {ACPI_RSC_MOVE_SERIAL_RES,
211 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
212 AML_OFFSET(common_serial_bus.type_data_length),
213 sizeof(struct aml_resource_common_serialbus)},
214
215 /* I2C bus type specific */
216
217 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.i2c_serial_bus.access_mode),
218 AML_OFFSET(i2c_serial_bus.type_specific_flags),
219 0},
220
221 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.i2c_serial_bus.connection_speed),
222 AML_OFFSET(i2c_serial_bus.connection_speed),
223 1},
224
225 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.i2c_serial_bus.slave_address),
226 AML_OFFSET(i2c_serial_bus.slave_address),
227 1},
228};
229
230/*******************************************************************************
231 *
232 * acpi_rs_convert_spi_serial_bus
233 *
234 ******************************************************************************/
235
236struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[20] = {
237 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
238 ACPI_RS_SIZE(struct acpi_resource_spi_serialbus),
239 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)},
240
241 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
242 sizeof(struct aml_resource_spi_serialbus),
243 0},
244
245 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
246 AML_OFFSET(common_serial_bus.revision_id),
247 1},
248
249 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
250 AML_OFFSET(common_serial_bus.type),
251 1},
252
253 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
254 AML_OFFSET(common_serial_bus.flags),
255 0},
256
257 {ACPI_RSC_1BITFLAG,
258 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
259 AML_OFFSET(common_serial_bus.flags),
260 1},
261
262 {ACPI_RSC_MOVE8,
263 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
264 AML_OFFSET(common_serial_bus.type_revision_id),
265 1},
266
267 {ACPI_RSC_MOVE16,
268 ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
269 AML_OFFSET(common_serial_bus.type_data_length),
270 1},
271
272 /* Vendor data */
273
274 {ACPI_RSC_COUNT_SERIAL_VEN,
275 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
276 AML_OFFSET(common_serial_bus.type_data_length),
277 AML_RESOURCE_SPI_MIN_DATA_LEN},
278
279 {ACPI_RSC_MOVE_SERIAL_VEN,
280 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
281 0,
282 sizeof(struct aml_resource_spi_serialbus)},
283
284 /* Resource Source */
285
286 {ACPI_RSC_MOVE8,
287 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
288 AML_OFFSET(common_serial_bus.res_source_index),
289 1},
290
291 {ACPI_RSC_COUNT_SERIAL_RES,
292 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
293 AML_OFFSET(common_serial_bus.type_data_length),
294 sizeof(struct aml_resource_common_serialbus)},
295
296 {ACPI_RSC_MOVE_SERIAL_RES,
297 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
298 AML_OFFSET(common_serial_bus.type_data_length),
299 sizeof(struct aml_resource_common_serialbus)},
300
301 /* Spi bus type specific */
302
303 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.wire_mode),
304 AML_OFFSET(spi_serial_bus.type_specific_flags),
305 0},
306
307 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.device_polarity),
308 AML_OFFSET(spi_serial_bus.type_specific_flags),
309 1},
310
311 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.data_bit_length),
312 AML_OFFSET(spi_serial_bus.data_bit_length),
313 1},
314
315 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_phase),
316 AML_OFFSET(spi_serial_bus.clock_phase),
317 1},
318
319 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_polarity),
320 AML_OFFSET(spi_serial_bus.clock_polarity),
321 1},
322
323 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.spi_serial_bus.device_selection),
324 AML_OFFSET(spi_serial_bus.device_selection),
325 1},
326
327 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.spi_serial_bus.connection_speed),
328 AML_OFFSET(spi_serial_bus.connection_speed),
329 1},
330};
331
332/*******************************************************************************
333 *
334 * acpi_rs_convert_uart_serial_bus
335 *
336 ******************************************************************************/
337
338struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[22] = {
339 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
340 ACPI_RS_SIZE(struct acpi_resource_uart_serialbus),
341 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)},
342
343 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
344 sizeof(struct aml_resource_uart_serialbus),
345 0},
346
347 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id),
348 AML_OFFSET(common_serial_bus.revision_id),
349 1},
350
351 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type),
352 AML_OFFSET(common_serial_bus.type),
353 1},
354
355 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode),
356 AML_OFFSET(common_serial_bus.flags),
357 0},
358
359 {ACPI_RSC_1BITFLAG,
360 ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer),
361 AML_OFFSET(common_serial_bus.flags),
362 1},
363
364 {ACPI_RSC_MOVE8,
365 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
366 AML_OFFSET(common_serial_bus.type_revision_id),
367 1},
368
369 {ACPI_RSC_MOVE16,
370 ACPI_RS_OFFSET(data.common_serial_bus.type_data_length),
371 AML_OFFSET(common_serial_bus.type_data_length),
372 1},
373
374 /* Vendor data */
375
376 {ACPI_RSC_COUNT_SERIAL_VEN,
377 ACPI_RS_OFFSET(data.common_serial_bus.vendor_length),
378 AML_OFFSET(common_serial_bus.type_data_length),
379 AML_RESOURCE_UART_MIN_DATA_LEN},
380
381 {ACPI_RSC_MOVE_SERIAL_VEN,
382 ACPI_RS_OFFSET(data.common_serial_bus.vendor_data),
383 0,
384 sizeof(struct aml_resource_uart_serialbus)},
385
386 /* Resource Source */
387
388 {ACPI_RSC_MOVE8,
389 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index),
390 AML_OFFSET(common_serial_bus.res_source_index),
391 1},
392
393 {ACPI_RSC_COUNT_SERIAL_RES,
394 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length),
395 AML_OFFSET(common_serial_bus.type_data_length),
396 sizeof(struct aml_resource_common_serialbus)},
397
398 {ACPI_RSC_MOVE_SERIAL_RES,
399 ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr),
400 AML_OFFSET(common_serial_bus.type_data_length),
401 sizeof(struct aml_resource_common_serialbus)},
402
403 /* Uart bus type specific */
404
405 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.flow_control),
406 AML_OFFSET(uart_serial_bus.type_specific_flags),
407 0},
408
409 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.stop_bits),
410 AML_OFFSET(uart_serial_bus.type_specific_flags),
411 2},
412
413 {ACPI_RSC_3BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.data_bits),
414 AML_OFFSET(uart_serial_bus.type_specific_flags),
415 4},
416
417 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.endian),
418 AML_OFFSET(uart_serial_bus.type_specific_flags),
419 7},
420
421 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.parity),
422 AML_OFFSET(uart_serial_bus.parity),
423 1},
424
425 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.lines_enabled),
426 AML_OFFSET(uart_serial_bus.lines_enabled),
427 1},
428
429 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.rx_fifo_size),
430 AML_OFFSET(uart_serial_bus.rx_fifo_size),
431 1},
432
433 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.tx_fifo_size),
434 AML_OFFSET(uart_serial_bus.tx_fifo_size),
435 1},
436
437 {ACPI_RSC_MOVE32,
438 ACPI_RS_OFFSET(data.uart_serial_bus.default_baud_rate),
439 AML_OFFSET(uart_serial_bus.default_baud_rate),
440 1},
441};
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index 231811e56939..433a375deb93 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -144,6 +144,9 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
144 * since there are no alignment or endian issues 144 * since there are no alignment or endian issues
145 */ 145 */
146 case ACPI_RSC_MOVE8: 146 case ACPI_RSC_MOVE8:
147 case ACPI_RSC_MOVE_GPIO_RES:
148 case ACPI_RSC_MOVE_SERIAL_VEN:
149 case ACPI_RSC_MOVE_SERIAL_RES:
147 ACPI_MEMCPY(destination, source, item_count); 150 ACPI_MEMCPY(destination, source, item_count);
148 return; 151 return;
149 152
@@ -153,6 +156,7 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
153 * misaligned memory transfers 156 * misaligned memory transfers
154 */ 157 */
155 case ACPI_RSC_MOVE16: 158 case ACPI_RSC_MOVE16:
159 case ACPI_RSC_MOVE_GPIO_PIN:
156 ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i], 160 ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i],
157 &ACPI_CAST_PTR(u16, source)[i]); 161 &ACPI_CAST_PTR(u16, source)[i]);
158 break; 162 break;
@@ -590,6 +594,56 @@ acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
590 594
591/******************************************************************************* 595/*******************************************************************************
592 * 596 *
597 * FUNCTION: acpi_rs_get_aei_method_data
598 *
599 * PARAMETERS: Node - Device node
600 * ret_buffer - Pointer to a buffer structure for the
601 * results
602 *
603 * RETURN: Status
604 *
605 * DESCRIPTION: This function is called to get the _AEI value of an object
606 * contained in an object specified by the handle passed in
607 *
608 * If the function fails an appropriate status will be returned
609 * and the contents of the callers buffer is undefined.
610 *
611 ******************************************************************************/
612
613acpi_status
614acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
615 struct acpi_buffer *ret_buffer)
616{
617 union acpi_operand_object *obj_desc;
618 acpi_status status;
619
620 ACPI_FUNCTION_TRACE(rs_get_aei_method_data);
621
622 /* Parameters guaranteed valid by caller */
623
624 /* Execute the method, no parameters */
625
626 status = acpi_ut_evaluate_object(node, METHOD_NAME__AEI,
627 ACPI_BTYPE_BUFFER, &obj_desc);
628 if (ACPI_FAILURE(status)) {
629 return_ACPI_STATUS(status);
630 }
631
632 /*
633 * Make the call to create a resource linked list from the
634 * byte stream buffer that comes back from the _CRS method
635 * execution.
636 */
637 status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
638
639 /* On exit, we must delete the object returned by evaluate_object */
640
641 acpi_ut_remove_reference(obj_desc);
642 return_ACPI_STATUS(status);
643}
644
645/*******************************************************************************
646 *
593 * FUNCTION: acpi_rs_get_method_data 647 * FUNCTION: acpi_rs_get_method_data
594 * 648 *
595 * PARAMETERS: Handle - Handle to the containing object 649 * PARAMETERS: Handle - Handle to the containing object
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c
index fe86b37b16ce..f58c098c7aeb 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -307,6 +307,46 @@ acpi_set_current_resources(acpi_handle device_handle,
307 307
308ACPI_EXPORT_SYMBOL(acpi_set_current_resources) 308ACPI_EXPORT_SYMBOL(acpi_set_current_resources)
309 309
310/*******************************************************************************
311 *
312 * FUNCTION: acpi_get_event_resources
313 *
314 * PARAMETERS: device_handle - Handle to the device object for the
315 * device we are getting resources
316 * in_buffer - Pointer to a buffer containing the
317 * resources to be set for the device
318 *
319 * RETURN: Status
320 *
321 * DESCRIPTION: This function is called to get the event resources for a
322 * specific device. The caller must first acquire a handle for
323 * the desired device. The resource data is passed to the routine
324 * the buffer pointed to by the in_buffer variable. Uses the
325 * _AEI method.
326 *
327 ******************************************************************************/
328acpi_status
329acpi_get_event_resources(acpi_handle device_handle,
330 struct acpi_buffer *ret_buffer)
331{
332 acpi_status status;
333 struct acpi_namespace_node *node;
334
335 ACPI_FUNCTION_TRACE(acpi_get_event_resources);
336
337 /* Validate parameters then dispatch to internal routine */
338
339 status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node);
340 if (ACPI_FAILURE(status)) {
341 return_ACPI_STATUS(status);
342 }
343
344 status = acpi_rs_get_aei_method_data(node, ret_buffer);
345 return_ACPI_STATUS(status);
346}
347
348ACPI_EXPORT_SYMBOL(acpi_get_event_resources)
349
310/****************************************************************************** 350/******************************************************************************
311 * 351 *
312 * FUNCTION: acpi_resource_to_address64 352 * FUNCTION: acpi_resource_to_address64
@@ -486,8 +526,9 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
486 * 526 *
487 * PARAMETERS: device_handle - Handle to the device object for the 527 * PARAMETERS: device_handle - Handle to the device object for the
488 * device we are querying 528 * device we are querying
489 * Name - Method name of the resources we want 529 * Name - Method name of the resources we want.
490 * (METHOD_NAME__CRS or METHOD_NAME__PRS) 530 * (METHOD_NAME__CRS, METHOD_NAME__PRS, or
531 * METHOD_NAME__AEI)
491 * user_function - Called for each resource 532 * user_function - Called for each resource
492 * Context - Passed to user_function 533 * Context - Passed to user_function
493 * 534 *
@@ -514,11 +555,12 @@ acpi_walk_resources(acpi_handle device_handle,
514 555
515 if (!device_handle || !user_function || !name || 556 if (!device_handle || !user_function || !name ||
516 (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) && 557 (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) &&
517 !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS))) { 558 !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS) &&
559 !ACPI_COMPARE_NAME(name, METHOD_NAME__AEI))) {
518 return_ACPI_STATUS(AE_BAD_PARAMETER); 560 return_ACPI_STATUS(AE_BAD_PARAMETER);
519 } 561 }
520 562
521 /* Get the _CRS or _PRS resource list */ 563 /* Get the _CRS/_PRS/_AEI resource list */
522 564
523 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; 565 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
524 status = acpi_rs_get_method_data(device_handle, name, &buffer); 566 status = acpi_rs_get_method_data(device_handle, name, &buffer);
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 6f5588e62c0a..c5d870406f41 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -63,14 +63,15 @@ static void acpi_tb_setup_fadt_registers(void);
63 63
64typedef struct acpi_fadt_info { 64typedef struct acpi_fadt_info {
65 char *name; 65 char *name;
66 u8 address64; 66 u16 address64;
67 u8 address32; 67 u16 address32;
68 u8 length; 68 u16 length;
69 u8 default_length; 69 u8 default_length;
70 u8 type; 70 u8 type;
71 71
72} acpi_fadt_info; 72} acpi_fadt_info;
73 73
74#define ACPI_FADT_OPTIONAL 0
74#define ACPI_FADT_REQUIRED 1 75#define ACPI_FADT_REQUIRED 1
75#define ACPI_FADT_SEPARATE_LENGTH 2 76#define ACPI_FADT_SEPARATE_LENGTH 2
76 77
@@ -87,7 +88,7 @@ static struct acpi_fadt_info fadt_info_table[] = {
87 ACPI_FADT_OFFSET(pm1b_event_block), 88 ACPI_FADT_OFFSET(pm1b_event_block),
88 ACPI_FADT_OFFSET(pm1_event_length), 89 ACPI_FADT_OFFSET(pm1_event_length),
89 ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ 90 ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */
90 0}, 91 ACPI_FADT_OPTIONAL},
91 92
92 {"Pm1aControlBlock", 93 {"Pm1aControlBlock",
93 ACPI_FADT_OFFSET(xpm1a_control_block), 94 ACPI_FADT_OFFSET(xpm1a_control_block),
@@ -101,7 +102,7 @@ static struct acpi_fadt_info fadt_info_table[] = {
101 ACPI_FADT_OFFSET(pm1b_control_block), 102 ACPI_FADT_OFFSET(pm1b_control_block),
102 ACPI_FADT_OFFSET(pm1_control_length), 103 ACPI_FADT_OFFSET(pm1_control_length),
103 ACPI_PM1_REGISTER_WIDTH, 104 ACPI_PM1_REGISTER_WIDTH,
104 0}, 105 ACPI_FADT_OPTIONAL},
105 106
106 {"Pm2ControlBlock", 107 {"Pm2ControlBlock",
107 ACPI_FADT_OFFSET(xpm2_control_block), 108 ACPI_FADT_OFFSET(xpm2_control_block),
@@ -139,7 +140,7 @@ static struct acpi_fadt_info fadt_info_table[] = {
139 140
140typedef struct acpi_fadt_pm_info { 141typedef struct acpi_fadt_pm_info {
141 struct acpi_generic_address *target; 142 struct acpi_generic_address *target;
142 u8 source; 143 u16 source;
143 u8 register_num; 144 u8 register_num;
144 145
145} acpi_fadt_pm_info; 146} acpi_fadt_pm_info;
@@ -253,8 +254,13 @@ void acpi_tb_parse_fadt(u32 table_index)
253 acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt, 254 acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt,
254 ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); 255 ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT);
255 256
256 acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xfacs, 257 /* If Hardware Reduced flag is set, there is no FACS */
257 ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); 258
259 if (!acpi_gbl_reduced_hardware) {
260 acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.
261 Xfacs, ACPI_SIG_FACS,
262 ACPI_TABLE_INDEX_FACS);
263 }
258} 264}
259 265
260/******************************************************************************* 266/*******************************************************************************
@@ -277,12 +283,12 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
277{ 283{
278 /* 284 /*
279 * Check if the FADT is larger than the largest table that we expect 285 * Check if the FADT is larger than the largest table that we expect
280 * (the ACPI 2.0/3.0 version). If so, truncate the table, and issue 286 * (the ACPI 5.0 version). If so, truncate the table, and issue
281 * a warning. 287 * a warning.
282 */ 288 */
283 if (length > sizeof(struct acpi_table_fadt)) { 289 if (length > sizeof(struct acpi_table_fadt)) {
284 ACPI_WARNING((AE_INFO, 290 ACPI_WARNING((AE_INFO,
285 "FADT (revision %u) is longer than ACPI 2.0 version, " 291 "FADT (revision %u) is longer than ACPI 5.0 version, "
286 "truncating length %u to %u", 292 "truncating length %u to %u",
287 table->revision, length, 293 table->revision, length,
288 (u32)sizeof(struct acpi_table_fadt))); 294 (u32)sizeof(struct acpi_table_fadt)));
@@ -297,6 +303,13 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
297 ACPI_MEMCPY(&acpi_gbl_FADT, table, 303 ACPI_MEMCPY(&acpi_gbl_FADT, table,
298 ACPI_MIN(length, sizeof(struct acpi_table_fadt))); 304 ACPI_MIN(length, sizeof(struct acpi_table_fadt)));
299 305
306 /* Take a copy of the Hardware Reduced flag */
307
308 acpi_gbl_reduced_hardware = FALSE;
309 if (acpi_gbl_FADT.flags & ACPI_FADT_HW_REDUCED) {
310 acpi_gbl_reduced_hardware = TRUE;
311 }
312
300 /* Convert the local copy of the FADT to the common internal format */ 313 /* Convert the local copy of the FADT to the common internal format */
301 314
302 acpi_tb_convert_fadt(); 315 acpi_tb_convert_fadt();
@@ -502,6 +515,12 @@ static void acpi_tb_validate_fadt(void)
502 acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt; 515 acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt;
503 } 516 }
504 517
518 /* If Hardware Reduced flag is set, we are all done */
519
520 if (acpi_gbl_reduced_hardware) {
521 return;
522 }
523
505 /* Examine all of the 64-bit extended address fields (X fields) */ 524 /* Examine all of the 64-bit extended address fields (X fields) */
506 525
507 for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { 526 for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) {
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c
index a55cb2bb5abb..4903e36ea75a 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 62365f6075dd..1aecf7baa4e0 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 0f2d395feaba..09ca39e14337 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -135,6 +135,13 @@ acpi_status acpi_tb_initialize_facs(void)
135{ 135{
136 acpi_status status; 136 acpi_status status;
137 137
138 /* If Hardware Reduced flag is set, there is no FACS */
139
140 if (acpi_gbl_reduced_hardware) {
141 acpi_gbl_FACS = NULL;
142 return (AE_OK);
143 }
144
138 status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, 145 status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
139 ACPI_CAST_INDIRECT_PTR(struct 146 ACPI_CAST_INDIRECT_PTR(struct
140 acpi_table_header, 147 acpi_table_header,
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index e7d13f5d3f2d..abcc6412c244 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c
index 7eb6c6cc1edf..4258f647ca3d 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
new file mode 100644
index 000000000000..67932aebe6dd
--- /dev/null
+++ b/drivers/acpi/acpica/utaddress.c
@@ -0,0 +1,294 @@
1/******************************************************************************
2 *
3 * Module Name: utaddress - op_region address range check
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acnamesp.h"
47
48#define _COMPONENT ACPI_UTILITIES
49ACPI_MODULE_NAME("utaddress")
50
51/*******************************************************************************
52 *
53 * FUNCTION: acpi_ut_add_address_range
54 *
55 * PARAMETERS: space_id - Address space ID
56 * Address - op_region start address
57 * Length - op_region length
58 * region_node - op_region namespace node
59 *
60 * RETURN: Status
61 *
62 * DESCRIPTION: Add the Operation Region address range to the global list.
63 * The only supported Space IDs are Memory and I/O. Called when
64 * the op_region address/length operands are fully evaluated.
65 *
66 * MUTEX: Locks the namespace
67 *
68 * NOTE: Because this interface is only called when an op_region argument
69 * list is evaluated, there cannot be any duplicate region_nodes.
70 * Duplicate Address/Length values are allowed, however, so that multiple
71 * address conflicts can be detected.
72 *
73 ******************************************************************************/
74acpi_status
75acpi_ut_add_address_range(acpi_adr_space_type space_id,
76 acpi_physical_address address,
77 u32 length, struct acpi_namespace_node *region_node)
78{
79 struct acpi_address_range *range_info;
80 acpi_status status;
81
82 ACPI_FUNCTION_TRACE(ut_add_address_range);
83
84 if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
85 (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
86 return_ACPI_STATUS(AE_OK);
87 }
88
89 /* Allocate/init a new info block, add it to the appropriate list */
90
91 range_info = ACPI_ALLOCATE(sizeof(struct acpi_address_range));
92 if (!range_info) {
93 return_ACPI_STATUS(AE_NO_MEMORY);
94 }
95
96 range_info->start_address = address;
97 range_info->end_address = (address + length - 1);
98 range_info->region_node = region_node;
99
100 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
101 if (ACPI_FAILURE(status)) {
102 ACPI_FREE(range_info);
103 return_ACPI_STATUS(status);
104 }
105
106 range_info->next = acpi_gbl_address_range_list[space_id];
107 acpi_gbl_address_range_list[space_id] = range_info;
108
109 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
110 "\nAdded [%4.4s] address range: 0x%p-0x%p\n",
111 acpi_ut_get_node_name(range_info->region_node),
112 ACPI_CAST_PTR(void, address),
113 ACPI_CAST_PTR(void, range_info->end_address)));
114
115 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
116 return_ACPI_STATUS(AE_OK);
117}
118
119/*******************************************************************************
120 *
121 * FUNCTION: acpi_ut_remove_address_range
122 *
123 * PARAMETERS: space_id - Address space ID
124 * region_node - op_region namespace node
125 *
126 * RETURN: None
127 *
128 * DESCRIPTION: Remove the Operation Region from the global list. The only
129 * supported Space IDs are Memory and I/O. Called when an
130 * op_region is deleted.
131 *
132 * MUTEX: Assumes the namespace is locked
133 *
134 ******************************************************************************/
135
136void
137acpi_ut_remove_address_range(acpi_adr_space_type space_id,
138 struct acpi_namespace_node *region_node)
139{
140 struct acpi_address_range *range_info;
141 struct acpi_address_range *prev;
142
143 ACPI_FUNCTION_TRACE(ut_remove_address_range);
144
145 if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
146 (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
147 return_VOID;
148 }
149
150 /* Get the appropriate list head and check the list */
151
152 range_info = prev = acpi_gbl_address_range_list[space_id];
153 while (range_info) {
154 if (range_info->region_node == region_node) {
155 if (range_info == prev) { /* Found at list head */
156 acpi_gbl_address_range_list[space_id] =
157 range_info->next;
158 } else {
159 prev->next = range_info->next;
160 }
161
162 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
163 "\nRemoved [%4.4s] address range: 0x%p-0x%p\n",
164 acpi_ut_get_node_name(range_info->
165 region_node),
166 ACPI_CAST_PTR(void,
167 range_info->
168 start_address),
169 ACPI_CAST_PTR(void,
170 range_info->
171 end_address)));
172
173 ACPI_FREE(range_info);
174 return_VOID;
175 }
176
177 prev = range_info;
178 range_info = range_info->next;
179 }
180
181 return_VOID;
182}
183
184/*******************************************************************************
185 *
186 * FUNCTION: acpi_ut_check_address_range
187 *
188 * PARAMETERS: space_id - Address space ID
189 * Address - Start address
190 * Length - Length of address range
191 * Warn - TRUE if warning on overlap desired
192 *
193 * RETURN: Count of the number of conflicts detected. Zero is always
194 * returned for Space IDs other than Memory or I/O.
195 *
196 * DESCRIPTION: Check if the input address range overlaps any of the
197 * ASL operation region address ranges. The only supported
198 * Space IDs are Memory and I/O.
199 *
200 * MUTEX: Assumes the namespace is locked.
201 *
202 ******************************************************************************/
203
204u32
205acpi_ut_check_address_range(acpi_adr_space_type space_id,
206 acpi_physical_address address, u32 length, u8 warn)
207{
208 struct acpi_address_range *range_info;
209 acpi_physical_address end_address;
210 char *pathname;
211 u32 overlap_count = 0;
212
213 ACPI_FUNCTION_TRACE(ut_check_address_range);
214
215 if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
216 (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
217 return_UINT32(0);
218 }
219
220 range_info = acpi_gbl_address_range_list[space_id];
221 end_address = address + length - 1;
222
223 /* Check entire list for all possible conflicts */
224
225 while (range_info) {
226 /*
227 * Check if the requested Address/Length overlaps this address_range.
228 * Four cases to consider:
229 *
230 * 1) Input address/length is contained completely in the address range
231 * 2) Input address/length overlaps range at the range start
232 * 3) Input address/length overlaps range at the range end
233 * 4) Input address/length completely encompasses the range
234 */
235 if ((address <= range_info->end_address) &&
236 (end_address >= range_info->start_address)) {
237
238 /* Found an address range overlap */
239
240 overlap_count++;
241 if (warn) { /* Optional warning message */
242 pathname =
243 acpi_ns_get_external_pathname(range_info->
244 region_node);
245
246 ACPI_WARNING((AE_INFO,
247 "0x%p-0x%p %s conflicts with Region %s %d",
248 ACPI_CAST_PTR(void, address),
249 ACPI_CAST_PTR(void, end_address),
250 acpi_ut_get_region_name(space_id),
251 pathname, overlap_count));
252 ACPI_FREE(pathname);
253 }
254 }
255
256 range_info = range_info->next;
257 }
258
259 return_UINT32(overlap_count);
260}
261
262/*******************************************************************************
263 *
264 * FUNCTION: acpi_ut_delete_address_lists
265 *
266 * PARAMETERS: None
267 *
268 * RETURN: None
269 *
270 * DESCRIPTION: Delete all global address range lists (called during
271 * subsystem shutdown).
272 *
273 ******************************************************************************/
274
275void acpi_ut_delete_address_lists(void)
276{
277 struct acpi_address_range *next;
278 struct acpi_address_range *range_info;
279 int i;
280
281 /* Delete all elements in all address range lists */
282
283 for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) {
284 next = acpi_gbl_address_range_list[i];
285
286 while (next) {
287 range_info = next;
288 next = range_info->next;
289 ACPI_FREE(range_info);
290 }
291
292 acpi_gbl_address_range_list[i] = NULL;
293 }
294}
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c
index 0a697351cf69..9982d2ea66fb 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 aded299a2fa8..3317c0a406ee 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 a1f8d7509e66..a0998a886318 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 8b087e2d64f4..d42ede5260c7 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -171,7 +171,9 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
171 "SMBus", 171 "SMBus",
172 "SystemCMOS", 172 "SystemCMOS",
173 "PCIBARTarget", 173 "PCIBARTarget",
174 "IPMI" 174 "IPMI",
175 "GeneralPurposeIo",
176 "GenericSerialBus"
175}; 177};
176 178
177char *acpi_ut_get_region_name(u8 space_id) 179char *acpi_ut_get_region_name(u8 space_id)
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c
index 31f5a7832ef1..2a6c3e183697 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -215,11 +215,14 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
215 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 215 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
216 "***** Region %p\n", object)); 216 "***** Region %p\n", object));
217 217
218 /* Invalidate the region address/length via the host OS */ 218 /*
219 219 * Update address_range list. However, only permanent regions
220 acpi_os_invalidate_address(object->region.space_id, 220 * are installed in this list. (Not created within a method)
221 object->region.address, 221 */
222 (acpi_size) object->region.length); 222 if (!(object->region.node->flags & ANOBJ_TEMPORARY)) {
223 acpi_ut_remove_address_range(object->region.space_id,
224 object->region.node);
225 }
223 226
224 second_desc = acpi_ns_get_secondary_object(object); 227 second_desc = acpi_ns_get_secondary_object(object);
225 if (second_desc) { 228 if (second_desc) {
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c
index 18f73c9d10bc..479f32b33415 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 ffba0a39c3e8..4153584cf526 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -264,6 +264,12 @@ acpi_status acpi_ut_init_globals(void)
264 return_ACPI_STATUS(status); 264 return_ACPI_STATUS(status);
265 } 265 }
266 266
267 /* Address Range lists */
268
269 for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) {
270 acpi_gbl_address_range_list[i] = NULL;
271 }
272
267 /* Mutex locked flags */ 273 /* Mutex locked flags */
268 274
269 for (i = 0; i < ACPI_NUM_MUTEX; i++) { 275 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c
index b679ea693545..c92eb1d93785 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 191b6828cce9..8359c0c5dc98 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -92,6 +92,7 @@ static void acpi_ut_terminate(void)
92 gpe_xrupt_info = next_gpe_xrupt_info; 92 gpe_xrupt_info = next_gpe_xrupt_info;
93 } 93 }
94 94
95 acpi_ut_delete_address_lists();
95 return_VOID; 96 return_VOID;
96} 97}
97 98
diff --git a/drivers/acpi/acpica/utlock.c b/drivers/acpi/acpica/utlock.c
index f6bb75c6faf5..155fd786d0f2 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 ce481da9bb45..2491a552b0e6 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 c33a852d4f42..86f19db74e05 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 7d797e2baecd..43174df33121 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -293,14 +293,10 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
293 293
294acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) 294acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
295{ 295{
296 acpi_thread_id this_thread_id;
297
298 ACPI_FUNCTION_NAME(ut_release_mutex); 296 ACPI_FUNCTION_NAME(ut_release_mutex);
299 297
300 this_thread_id = acpi_os_get_thread_id();
301
302 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n", 298 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n",
303 (u32)this_thread_id, 299 (u32)acpi_os_get_thread_id(),
304 acpi_ut_get_mutex_name(mutex_id))); 300 acpi_ut_get_mutex_name(mutex_id)));
305 301
306 if (mutex_id > ACPI_MAX_MUTEX) { 302 if (mutex_id > ACPI_MAX_MUTEX) {
@@ -329,7 +325,8 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
329 * the ACPI subsystem code. 325 * the ACPI subsystem code.
330 */ 326 */
331 for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) { 327 for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) {
332 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { 328 if (acpi_gbl_mutex_info[i].thread_id ==
329 acpi_os_get_thread_id()) {
333 if (i == mutex_id) { 330 if (i == mutex_id) {
334 continue; 331 continue;
335 } 332 }
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index 188340a017b4..b112744fc9ae 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 1fb10cb8f11d..2360cf70c18c 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 6ffd3a8bdaa5..9d441ea70305 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -43,7 +43,7 @@
43 43
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include "accommon.h" 45#include "accommon.h"
46#include "amlresrc.h" 46#include "acresrc.h"
47 47
48#define _COMPONENT ACPI_UTILITIES 48#define _COMPONENT ACPI_UTILITIES
49ACPI_MODULE_NAME("utresrc") 49ACPI_MODULE_NAME("utresrc")
@@ -154,6 +154,138 @@ const char *acpi_gbl_typ_decode[] = {
154 "TypeF" 154 "TypeF"
155}; 155};
156 156
157const char *acpi_gbl_ppc_decode[] = {
158 "PullDefault",
159 "PullUp",
160 "PullDown",
161 "PullNone"
162};
163
164const char *acpi_gbl_ior_decode[] = {
165 "IoRestrictionNone",
166 "IoRestrictionInputOnly",
167 "IoRestrictionOutputOnly",
168 "IoRestrictionNoneAndPreserve"
169};
170
171const char *acpi_gbl_dts_decode[] = {
172 "Width8bit",
173 "Width16bit",
174 "Width32bit",
175 "Width64bit",
176 "Width128bit",
177 "Width256bit",
178};
179
180/* GPIO connection type */
181
182const char *acpi_gbl_ct_decode[] = {
183 "Interrupt",
184 "I/O"
185};
186
187/* Serial bus type */
188
189const char *acpi_gbl_sbt_decode[] = {
190 "/* UNKNOWN serial bus type */",
191 "I2C",
192 "SPI",
193 "UART"
194};
195
196/* I2C serial bus access mode */
197
198const char *acpi_gbl_am_decode[] = {
199 "AddressingMode7Bit",
200 "AddressingMode10Bit"
201};
202
203/* I2C serial bus slave mode */
204
205const char *acpi_gbl_sm_decode[] = {
206 "ControllerInitiated",
207 "DeviceInitiated"
208};
209
210/* SPI serial bus wire mode */
211
212const char *acpi_gbl_wm_decode[] = {
213 "FourWireMode",
214 "ThreeWireMode"
215};
216
217/* SPI serial clock phase */
218
219const char *acpi_gbl_cph_decode[] = {
220 "ClockPhaseFirst",
221 "ClockPhaseSecond"
222};
223
224/* SPI serial bus clock polarity */
225
226const char *acpi_gbl_cpo_decode[] = {
227 "ClockPolarityLow",
228 "ClockPolarityHigh"
229};
230
231/* SPI serial bus device polarity */
232
233const char *acpi_gbl_dp_decode[] = {
234 "PolarityLow",
235 "PolarityHigh"
236};
237
238/* UART serial bus endian */
239
240const char *acpi_gbl_ed_decode[] = {
241 "LittleEndian",
242 "BigEndian"
243};
244
245/* UART serial bus bits per byte */
246
247const char *acpi_gbl_bpb_decode[] = {
248 "DataBitsFive",
249 "DataBitsSix",
250 "DataBitsSeven",
251 "DataBitsEight",
252 "DataBitsNine",
253 "/* UNKNOWN Bits per byte */",
254 "/* UNKNOWN Bits per byte */",
255 "/* UNKNOWN Bits per byte */"
256};
257
258/* UART serial bus stop bits */
259
260const char *acpi_gbl_sb_decode[] = {
261 "StopBitsNone",
262 "StopBitsOne",
263 "StopBitsOnePlusHalf",
264 "StopBitsTwo"
265};
266
267/* UART serial bus flow control */
268
269const char *acpi_gbl_fc_decode[] = {
270 "FlowControlNone",
271 "FlowControlHardware",
272 "FlowControlXON",
273 "/* UNKNOWN flow control keyword */"
274};
275
276/* UART serial bus parity type */
277
278const char *acpi_gbl_pt_decode[] = {
279 "ParityTypeNone",
280 "ParityTypeEven",
281 "ParityTypeOdd",
282 "ParityTypeMark",
283 "ParityTypeSpace",
284 "/* UNKNOWN parity keyword */",
285 "/* UNKNOWN parity keyword */",
286 "/* UNKNOWN parity keyword */"
287};
288
157#endif 289#endif
158 290
159/* 291/*
@@ -173,7 +305,7 @@ const u8 acpi_gbl_resource_aml_sizes[] = {
173 ACPI_AML_SIZE_SMALL(struct aml_resource_end_dependent), 305 ACPI_AML_SIZE_SMALL(struct aml_resource_end_dependent),
174 ACPI_AML_SIZE_SMALL(struct aml_resource_io), 306 ACPI_AML_SIZE_SMALL(struct aml_resource_io),
175 ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_io), 307 ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_io),
176 0, 308 ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_dma),
177 0, 309 0,
178 0, 310 0,
179 0, 311 0,
@@ -193,7 +325,17 @@ const u8 acpi_gbl_resource_aml_sizes[] = {
193 ACPI_AML_SIZE_LARGE(struct aml_resource_address16), 325 ACPI_AML_SIZE_LARGE(struct aml_resource_address16),
194 ACPI_AML_SIZE_LARGE(struct aml_resource_extended_irq), 326 ACPI_AML_SIZE_LARGE(struct aml_resource_extended_irq),
195 ACPI_AML_SIZE_LARGE(struct aml_resource_address64), 327 ACPI_AML_SIZE_LARGE(struct aml_resource_address64),
196 ACPI_AML_SIZE_LARGE(struct aml_resource_extended_address64) 328 ACPI_AML_SIZE_LARGE(struct aml_resource_extended_address64),
329 ACPI_AML_SIZE_LARGE(struct aml_resource_gpio),
330 0,
331 ACPI_AML_SIZE_LARGE(struct aml_resource_common_serialbus),
332};
333
334const u8 acpi_gbl_resource_aml_serial_bus_sizes[] = {
335 0,
336 ACPI_AML_SIZE_LARGE(struct aml_resource_i2c_serialbus),
337 ACPI_AML_SIZE_LARGE(struct aml_resource_spi_serialbus),
338 ACPI_AML_SIZE_LARGE(struct aml_resource_uart_serialbus),
197}; 339};
198 340
199/* 341/*
@@ -209,35 +351,49 @@ static const u8 acpi_gbl_resource_types[] = {
209 0, 351 0,
210 0, 352 0,
211 0, 353 0,
212 ACPI_SMALL_VARIABLE_LENGTH, 354 ACPI_SMALL_VARIABLE_LENGTH, /* 04 IRQ */
213 ACPI_FIXED_LENGTH, 355 ACPI_FIXED_LENGTH, /* 05 DMA */
214 ACPI_SMALL_VARIABLE_LENGTH, 356 ACPI_SMALL_VARIABLE_LENGTH, /* 06 start_dependent_functions */
215 ACPI_FIXED_LENGTH, 357 ACPI_FIXED_LENGTH, /* 07 end_dependent_functions */
216 ACPI_FIXED_LENGTH, 358 ACPI_FIXED_LENGTH, /* 08 IO */
217 ACPI_FIXED_LENGTH, 359 ACPI_FIXED_LENGTH, /* 09 fixed_iO */
218 0, 360 ACPI_FIXED_LENGTH, /* 0_a fixed_dMA */
219 0, 361 0,
220 0, 362 0,
221 0, 363 0,
222 ACPI_VARIABLE_LENGTH, 364 ACPI_VARIABLE_LENGTH, /* 0_e vendor_short */
223 ACPI_FIXED_LENGTH, 365 ACPI_FIXED_LENGTH, /* 0_f end_tag */
224 366
225 /* Large descriptors */ 367 /* Large descriptors */
226 368
227 0, 369 0,
228 ACPI_FIXED_LENGTH, 370 ACPI_FIXED_LENGTH, /* 01 Memory24 */
229 ACPI_FIXED_LENGTH, 371 ACPI_FIXED_LENGTH, /* 02 generic_register */
230 0, 372 0,
231 ACPI_VARIABLE_LENGTH, 373 ACPI_VARIABLE_LENGTH, /* 04 vendor_long */
232 ACPI_FIXED_LENGTH, 374 ACPI_FIXED_LENGTH, /* 05 Memory32 */
233 ACPI_FIXED_LENGTH, 375 ACPI_FIXED_LENGTH, /* 06 memory32_fixed */
234 ACPI_VARIABLE_LENGTH, 376 ACPI_VARIABLE_LENGTH, /* 07 Dword* address */
235 ACPI_VARIABLE_LENGTH, 377 ACPI_VARIABLE_LENGTH, /* 08 Word* address */
236 ACPI_VARIABLE_LENGTH, 378 ACPI_VARIABLE_LENGTH, /* 09 extended_iRQ */
237 ACPI_VARIABLE_LENGTH, 379 ACPI_VARIABLE_LENGTH, /* 0_a Qword* address */
238 ACPI_FIXED_LENGTH 380 ACPI_FIXED_LENGTH, /* 0_b Extended* address */
381 ACPI_VARIABLE_LENGTH, /* 0_c Gpio* */
382 0,
383 ACPI_VARIABLE_LENGTH /* 0_e *serial_bus */
239}; 384};
240 385
386/*
387 * For the i_aSL compiler/disassembler, we don't want any error messages
388 * because the disassembler uses the resource validation code to determine
389 * if Buffer objects are actually Resource Templates.
390 */
391#ifdef ACPI_ASL_COMPILER
392#define ACPI_RESOURCE_ERROR(plist)
393#else
394#define ACPI_RESOURCE_ERROR(plist) ACPI_ERROR(plist)
395#endif
396
241/******************************************************************************* 397/*******************************************************************************
242 * 398 *
243 * FUNCTION: acpi_ut_walk_aml_resources 399 * FUNCTION: acpi_ut_walk_aml_resources
@@ -265,6 +421,7 @@ acpi_ut_walk_aml_resources(u8 * aml,
265 u8 resource_index; 421 u8 resource_index;
266 u32 length; 422 u32 length;
267 u32 offset = 0; 423 u32 offset = 0;
424 u8 end_tag[2] = { 0x79, 0x00 };
268 425
269 ACPI_FUNCTION_TRACE(ut_walk_aml_resources); 426 ACPI_FUNCTION_TRACE(ut_walk_aml_resources);
270 427
@@ -286,6 +443,10 @@ acpi_ut_walk_aml_resources(u8 * aml,
286 443
287 status = acpi_ut_validate_resource(aml, &resource_index); 444 status = acpi_ut_validate_resource(aml, &resource_index);
288 if (ACPI_FAILURE(status)) { 445 if (ACPI_FAILURE(status)) {
446 /*
447 * Exit on failure. Cannot continue because the descriptor length
448 * may be bogus also.
449 */
289 return_ACPI_STATUS(status); 450 return_ACPI_STATUS(status);
290 } 451 }
291 452
@@ -300,7 +461,7 @@ acpi_ut_walk_aml_resources(u8 * aml,
300 user_function(aml, length, offset, resource_index, 461 user_function(aml, length, offset, resource_index,
301 context); 462 context);
302 if (ACPI_FAILURE(status)) { 463 if (ACPI_FAILURE(status)) {
303 return (status); 464 return_ACPI_STATUS(status);
304 } 465 }
305 } 466 }
306 467
@@ -333,7 +494,19 @@ acpi_ut_walk_aml_resources(u8 * aml,
333 494
334 /* Did not find an end_tag descriptor */ 495 /* Did not find an end_tag descriptor */
335 496
336 return (AE_AML_NO_RESOURCE_END_TAG); 497 if (user_function) {
498
499 /* Insert an end_tag anyway. acpi_rs_get_list_length always leaves room */
500
501 (void)acpi_ut_validate_resource(end_tag, &resource_index);
502 status =
503 user_function(end_tag, 2, offset, resource_index, context);
504 if (ACPI_FAILURE(status)) {
505 return_ACPI_STATUS(status);
506 }
507 }
508
509 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
337} 510}
338 511
339/******************************************************************************* 512/*******************************************************************************
@@ -354,6 +527,7 @@ acpi_ut_walk_aml_resources(u8 * aml,
354 527
355acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) 528acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
356{ 529{
530 union aml_resource *aml_resource;
357 u8 resource_type; 531 u8 resource_type;
358 u8 resource_index; 532 u8 resource_index;
359 acpi_rs_length resource_length; 533 acpi_rs_length resource_length;
@@ -375,7 +549,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
375 /* Verify the large resource type (name) against the max */ 549 /* Verify the large resource type (name) against the max */
376 550
377 if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { 551 if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
378 return (AE_AML_INVALID_RESOURCE_TYPE); 552 goto invalid_resource;
379 } 553 }
380 554
381 /* 555 /*
@@ -392,15 +566,17 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
392 ((resource_type & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3); 566 ((resource_type & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3);
393 } 567 }
394 568
395 /* Check validity of the resource type, zero indicates name is invalid */ 569 /*
396 570 * Check validity of the resource type, via acpi_gbl_resource_types. Zero
571 * indicates an invalid resource.
572 */
397 if (!acpi_gbl_resource_types[resource_index]) { 573 if (!acpi_gbl_resource_types[resource_index]) {
398 return (AE_AML_INVALID_RESOURCE_TYPE); 574 goto invalid_resource;
399 } 575 }
400 576
401 /* 577 /*
402 * 2) Validate the resource_length field. This ensures that the length 578 * Validate the resource_length field. This ensures that the length
403 * is at least reasonable, and guarantees that it is non-zero. 579 * is at least reasonable, and guarantees that it is non-zero.
404 */ 580 */
405 resource_length = acpi_ut_get_resource_length(aml); 581 resource_length = acpi_ut_get_resource_length(aml);
406 minimum_resource_length = acpi_gbl_resource_aml_sizes[resource_index]; 582 minimum_resource_length = acpi_gbl_resource_aml_sizes[resource_index];
@@ -413,7 +589,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
413 /* Fixed length resource, length must match exactly */ 589 /* Fixed length resource, length must match exactly */
414 590
415 if (resource_length != minimum_resource_length) { 591 if (resource_length != minimum_resource_length) {
416 return (AE_AML_BAD_RESOURCE_LENGTH); 592 goto bad_resource_length;
417 } 593 }
418 break; 594 break;
419 595
@@ -422,7 +598,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
422 /* Variable length resource, length must be at least the minimum */ 598 /* Variable length resource, length must be at least the minimum */
423 599
424 if (resource_length < minimum_resource_length) { 600 if (resource_length < minimum_resource_length) {
425 return (AE_AML_BAD_RESOURCE_LENGTH); 601 goto bad_resource_length;
426 } 602 }
427 break; 603 break;
428 604
@@ -432,7 +608,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
432 608
433 if ((resource_length > minimum_resource_length) || 609 if ((resource_length > minimum_resource_length) ||
434 (resource_length < (minimum_resource_length - 1))) { 610 (resource_length < (minimum_resource_length - 1))) {
435 return (AE_AML_BAD_RESOURCE_LENGTH); 611 goto bad_resource_length;
436 } 612 }
437 break; 613 break;
438 614
@@ -440,7 +616,23 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
440 616
441 /* Shouldn't happen (because of validation earlier), but be sure */ 617 /* Shouldn't happen (because of validation earlier), but be sure */
442 618
443 return (AE_AML_INVALID_RESOURCE_TYPE); 619 goto invalid_resource;
620 }
621
622 aml_resource = ACPI_CAST_PTR(union aml_resource, aml);
623 if (resource_type == ACPI_RESOURCE_NAME_SERIAL_BUS) {
624
625 /* Validate the bus_type field */
626
627 if ((aml_resource->common_serial_bus.type == 0) ||
628 (aml_resource->common_serial_bus.type >
629 AML_RESOURCE_MAX_SERIALBUSTYPE)) {
630 ACPI_RESOURCE_ERROR((AE_INFO,
631 "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X",
632 aml_resource->common_serial_bus.
633 type));
634 return (AE_AML_INVALID_RESOURCE_TYPE);
635 }
444 } 636 }
445 637
446 /* Optionally return the resource table index */ 638 /* Optionally return the resource table index */
@@ -450,6 +642,22 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
450 } 642 }
451 643
452 return (AE_OK); 644 return (AE_OK);
645
646 invalid_resource:
647
648 ACPI_RESOURCE_ERROR((AE_INFO,
649 "Invalid/unsupported resource descriptor: Type 0x%2.2X",
650 resource_type));
651 return (AE_AML_INVALID_RESOURCE_TYPE);
652
653 bad_resource_length:
654
655 ACPI_RESOURCE_ERROR((AE_INFO,
656 "Invalid resource descriptor length: Type "
657 "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X",
658 resource_type, resource_length,
659 minimum_resource_length));
660 return (AE_AML_BAD_RESOURCE_LENGTH);
453} 661}
454 662
455/******************************************************************************* 663/*******************************************************************************
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c
index 30c21e1a9360..4267477c2797 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 420ebfe08c72..644e8c8ebc4b 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -48,6 +48,7 @@
48#include "acnamesp.h" 48#include "acnamesp.h"
49#include "acdebug.h" 49#include "acdebug.h"
50#include "actables.h" 50#include "actables.h"
51#include "acinterp.h"
51 52
52#define _COMPONENT ACPI_UTILITIES 53#define _COMPONENT ACPI_UTILITIES
53ACPI_MODULE_NAME("utxface") 54ACPI_MODULE_NAME("utxface")
@@ -640,4 +641,41 @@ acpi_status acpi_install_interface_handler(acpi_interface_handler handler)
640} 641}
641 642
642ACPI_EXPORT_SYMBOL(acpi_install_interface_handler) 643ACPI_EXPORT_SYMBOL(acpi_install_interface_handler)
644
645/*****************************************************************************
646 *
647 * FUNCTION: acpi_check_address_range
648 *
649 * PARAMETERS: space_id - Address space ID
650 * Address - Start address
651 * Length - Length
652 * Warn - TRUE if warning on overlap desired
653 *
654 * RETURN: Count of the number of conflicts detected.
655 *
656 * DESCRIPTION: Check if the input address range overlaps any of the
657 * ASL operation region address ranges.
658 *
659 ****************************************************************************/
660u32
661acpi_check_address_range(acpi_adr_space_type space_id,
662 acpi_physical_address address,
663 acpi_size length, u8 warn)
664{
665 u32 overlaps;
666 acpi_status status;
667
668 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
669 if (ACPI_FAILURE(status)) {
670 return (0);
671 }
672
673 overlaps = acpi_ut_check_address_range(space_id, address,
674 (u32)length, warn);
675
676 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
677 return (overlaps);
678}
679
680ACPI_EXPORT_SYMBOL(acpi_check_address_range)
643#endif /* !ACPI_ASL_COMPILER */ 681#endif /* !ACPI_ASL_COMPILER */
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index 8d0245ec4315..52b568af1819 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
new file mode 100644
index 000000000000..1427d191d15a
--- /dev/null
+++ b/drivers/acpi/acpica/utxfmutex.c
@@ -0,0 +1,187 @@
1/*******************************************************************************
2 *
3 * Module Name: utxfmutex - external AML mutex access functions
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acnamesp.h"
47
48#define _COMPONENT ACPI_UTILITIES
49ACPI_MODULE_NAME("utxfmutex")
50
51/* Local prototypes */
52static acpi_status
53acpi_ut_get_mutex_object(acpi_handle handle,
54 acpi_string pathname,
55 union acpi_operand_object **ret_obj);
56
57/*******************************************************************************
58 *
59 * FUNCTION: acpi_ut_get_mutex_object
60 *
61 * PARAMETERS: Handle - Mutex or prefix handle (optional)
62 * Pathname - Mutex pathname (optional)
63 * ret_obj - Where the mutex object is returned
64 *
65 * RETURN: Status
66 *
67 * DESCRIPTION: Get an AML mutex object. The mutex node is pointed to by
68 * Handle:Pathname. Either Handle or Pathname can be NULL, but
69 * not both.
70 *
71 ******************************************************************************/
72
73static acpi_status
74acpi_ut_get_mutex_object(acpi_handle handle,
75 acpi_string pathname,
76 union acpi_operand_object **ret_obj)
77{
78 struct acpi_namespace_node *mutex_node;
79 union acpi_operand_object *mutex_obj;
80 acpi_status status;
81
82 /* Parameter validation */
83
84 if (!ret_obj || (!handle && !pathname)) {
85 return (AE_BAD_PARAMETER);
86 }
87
88 /* Get a the namespace node for the mutex */
89
90 mutex_node = handle;
91 if (pathname != NULL) {
92 status = acpi_get_handle(handle, pathname,
93 ACPI_CAST_PTR(acpi_handle,
94 &mutex_node));
95 if (ACPI_FAILURE(status)) {
96 return (status);
97 }
98 }
99
100 /* Ensure that we actually have a Mutex object */
101
102 if (!mutex_node || (mutex_node->type != ACPI_TYPE_MUTEX)) {
103 return (AE_TYPE);
104 }
105
106 /* Get the low-level mutex object */
107
108 mutex_obj = acpi_ns_get_attached_object(mutex_node);
109 if (!mutex_obj) {
110 return (AE_NULL_OBJECT);
111 }
112
113 *ret_obj = mutex_obj;
114 return (AE_OK);
115}
116
117/*******************************************************************************
118 *
119 * FUNCTION: acpi_acquire_mutex
120 *
121 * PARAMETERS: Handle - Mutex or prefix handle (optional)
122 * Pathname - Mutex pathname (optional)
123 * Timeout - Max time to wait for the lock (millisec)
124 *
125 * RETURN: Status
126 *
127 * DESCRIPTION: Acquire an AML mutex. This is a device driver interface to
128 * AML mutex objects, and allows for transaction locking between
129 * drivers and AML code. The mutex node is pointed to by
130 * Handle:Pathname. Either Handle or Pathname can be NULL, but
131 * not both.
132 *
133 ******************************************************************************/
134
135acpi_status
136acpi_acquire_mutex(acpi_handle handle, acpi_string pathname, u16 timeout)
137{
138 acpi_status status;
139 union acpi_operand_object *mutex_obj;
140
141 /* Get the low-level mutex associated with Handle:Pathname */
142
143 status = acpi_ut_get_mutex_object(handle, pathname, &mutex_obj);
144 if (ACPI_FAILURE(status)) {
145 return (status);
146 }
147
148 /* Acquire the OS mutex */
149
150 status = acpi_os_acquire_mutex(mutex_obj->mutex.os_mutex, timeout);
151 return (status);
152}
153
154/*******************************************************************************
155 *
156 * FUNCTION: acpi_release_mutex
157 *
158 * PARAMETERS: Handle - Mutex or prefix handle (optional)
159 * Pathname - Mutex pathname (optional)
160 *
161 * RETURN: Status
162 *
163 * DESCRIPTION: Release an AML mutex. This is a device driver interface to
164 * AML mutex objects, and allows for transaction locking between
165 * drivers and AML code. The mutex node is pointed to by
166 * Handle:Pathname. Either Handle or Pathname can be NULL, but
167 * not both.
168 *
169 ******************************************************************************/
170
171acpi_status acpi_release_mutex(acpi_handle handle, acpi_string pathname)
172{
173 acpi_status status;
174 union acpi_operand_object *mutex_obj;
175
176 /* Get the low-level mutex associated with Handle:Pathname */
177
178 status = acpi_ut_get_mutex_object(handle, pathname, &mutex_obj);
179 if (ACPI_FAILURE(status)) {
180 return (status);
181 }
182
183 /* Release the OS mutex */
184
185 acpi_os_release_mutex(mutex_obj->mutex.os_mutex);
186 return (AE_OK);
187}
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 61540360d5ce..e45350cb6ac8 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -34,13 +34,13 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/acpi.h> 36#include <linux/acpi.h>
37#include <linux/acpi_io.h>
37#include <linux/slab.h> 38#include <linux/slab.h>
38#include <linux/io.h> 39#include <linux/io.h>
39#include <linux/kref.h> 40#include <linux/kref.h>
40#include <linux/rculist.h> 41#include <linux/rculist.h>
41#include <linux/interrupt.h> 42#include <linux/interrupt.h>
42#include <linux/debugfs.h> 43#include <linux/debugfs.h>
43#include <acpi/atomicio.h>
44 44
45#include "apei-internal.h" 45#include "apei-internal.h"
46 46
@@ -70,7 +70,7 @@ int __apei_exec_read_register(struct acpi_whea_header *entry, u64 *val)
70{ 70{
71 int rc; 71 int rc;
72 72
73 rc = acpi_atomic_read(val, &entry->register_region); 73 rc = apei_read(val, &entry->register_region);
74 if (rc) 74 if (rc)
75 return rc; 75 return rc;
76 *val >>= entry->register_region.bit_offset; 76 *val >>= entry->register_region.bit_offset;
@@ -116,13 +116,13 @@ int __apei_exec_write_register(struct acpi_whea_header *entry, u64 val)
116 val <<= entry->register_region.bit_offset; 116 val <<= entry->register_region.bit_offset;
117 if (entry->flags & APEI_EXEC_PRESERVE_REGISTER) { 117 if (entry->flags & APEI_EXEC_PRESERVE_REGISTER) {
118 u64 valr = 0; 118 u64 valr = 0;
119 rc = acpi_atomic_read(&valr, &entry->register_region); 119 rc = apei_read(&valr, &entry->register_region);
120 if (rc) 120 if (rc)
121 return rc; 121 return rc;
122 valr &= ~(entry->mask << entry->register_region.bit_offset); 122 valr &= ~(entry->mask << entry->register_region.bit_offset);
123 val |= valr; 123 val |= valr;
124 } 124 }
125 rc = acpi_atomic_write(val, &entry->register_region); 125 rc = apei_write(val, &entry->register_region);
126 126
127 return rc; 127 return rc;
128} 128}
@@ -243,7 +243,7 @@ static int pre_map_gar_callback(struct apei_exec_context *ctx,
243 u8 ins = entry->instruction; 243 u8 ins = entry->instruction;
244 244
245 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) 245 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
246 return acpi_pre_map_gar(&entry->register_region); 246 return acpi_os_map_generic_address(&entry->register_region);
247 247
248 return 0; 248 return 0;
249} 249}
@@ -276,7 +276,7 @@ static int post_unmap_gar_callback(struct apei_exec_context *ctx,
276 u8 ins = entry->instruction; 276 u8 ins = entry->instruction;
277 277
278 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) 278 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
279 acpi_post_unmap_gar(&entry->register_region); 279 acpi_os_unmap_generic_address(&entry->register_region);
280 280
281 return 0; 281 return 0;
282} 282}
@@ -421,6 +421,17 @@ static int apei_resources_merge(struct apei_resources *resources1,
421 return 0; 421 return 0;
422} 422}
423 423
424int apei_resources_add(struct apei_resources *resources,
425 unsigned long start, unsigned long size,
426 bool iomem)
427{
428 if (iomem)
429 return apei_res_add(&resources->iomem, start, size);
430 else
431 return apei_res_add(&resources->ioport, start, size);
432}
433EXPORT_SYMBOL_GPL(apei_resources_add);
434
424/* 435/*
425 * EINJ has two groups of GARs (EINJ table entry and trigger table 436 * EINJ has two groups of GARs (EINJ table entry and trigger table
426 * entry), so common resources are subtracted from the trigger table 437 * entry), so common resources are subtracted from the trigger table
@@ -438,8 +449,19 @@ int apei_resources_sub(struct apei_resources *resources1,
438} 449}
439EXPORT_SYMBOL_GPL(apei_resources_sub); 450EXPORT_SYMBOL_GPL(apei_resources_sub);
440 451
452static int apei_get_nvs_callback(__u64 start, __u64 size, void *data)
453{
454 struct apei_resources *resources = data;
455 return apei_res_add(&resources->iomem, start, size);
456}
457
458static int apei_get_nvs_resources(struct apei_resources *resources)
459{
460 return acpi_nvs_for_each_region(apei_get_nvs_callback, resources);
461}
462
441/* 463/*
442 * IO memory/port rersource management mechanism is used to check 464 * IO memory/port resource management mechanism is used to check
443 * whether memory/port area used by GARs conflicts with normal memory 465 * whether memory/port area used by GARs conflicts with normal memory
444 * or IO memory/port of devices. 466 * or IO memory/port of devices.
445 */ 467 */
@@ -448,21 +470,35 @@ int apei_resources_request(struct apei_resources *resources,
448{ 470{
449 struct apei_res *res, *res_bak = NULL; 471 struct apei_res *res, *res_bak = NULL;
450 struct resource *r; 472 struct resource *r;
473 struct apei_resources nvs_resources;
451 int rc; 474 int rc;
452 475
453 rc = apei_resources_sub(resources, &apei_resources_all); 476 rc = apei_resources_sub(resources, &apei_resources_all);
454 if (rc) 477 if (rc)
455 return rc; 478 return rc;
456 479
480 /*
481 * Some firmware uses ACPI NVS region, that has been marked as
482 * busy, so exclude it from APEI resources to avoid false
483 * conflict.
484 */
485 apei_resources_init(&nvs_resources);
486 rc = apei_get_nvs_resources(&nvs_resources);
487 if (rc)
488 goto res_fini;
489 rc = apei_resources_sub(resources, &nvs_resources);
490 if (rc)
491 goto res_fini;
492
457 rc = -EINVAL; 493 rc = -EINVAL;
458 list_for_each_entry(res, &resources->iomem, list) { 494 list_for_each_entry(res, &resources->iomem, list) {
459 r = request_mem_region(res->start, res->end - res->start, 495 r = request_mem_region(res->start, res->end - res->start,
460 desc); 496 desc);
461 if (!r) { 497 if (!r) {
462 pr_err(APEI_PFX 498 pr_err(APEI_PFX
463 "Can not request iomem region <%016llx-%016llx> for GARs.\n", 499 "Can not request [mem %#010llx-%#010llx] for %s registers\n",
464 (unsigned long long)res->start, 500 (unsigned long long)res->start,
465 (unsigned long long)res->end); 501 (unsigned long long)res->end - 1, desc);
466 res_bak = res; 502 res_bak = res;
467 goto err_unmap_iomem; 503 goto err_unmap_iomem;
468 } 504 }
@@ -472,9 +508,9 @@ int apei_resources_request(struct apei_resources *resources,
472 r = request_region(res->start, res->end - res->start, desc); 508 r = request_region(res->start, res->end - res->start, desc);
473 if (!r) { 509 if (!r) {
474 pr_err(APEI_PFX 510 pr_err(APEI_PFX
475 "Can not request ioport region <%016llx-%016llx> for GARs.\n", 511 "Can not request [io %#06llx-%#06llx] for %s registers\n",
476 (unsigned long long)res->start, 512 (unsigned long long)res->start,
477 (unsigned long long)res->end); 513 (unsigned long long)res->end - 1, desc);
478 res_bak = res; 514 res_bak = res;
479 goto err_unmap_ioport; 515 goto err_unmap_ioport;
480 } 516 }
@@ -500,6 +536,8 @@ err_unmap_iomem:
500 break; 536 break;
501 release_mem_region(res->start, res->end - res->start); 537 release_mem_region(res->start, res->end - res->start);
502 } 538 }
539res_fini:
540 apei_resources_fini(&nvs_resources);
503 return rc; 541 return rc;
504} 542}
505EXPORT_SYMBOL_GPL(apei_resources_request); 543EXPORT_SYMBOL_GPL(apei_resources_request);
@@ -553,6 +591,96 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr)
553 return 0; 591 return 0;
554} 592}
555 593
594/* read GAR in interrupt (including NMI) or process context */
595int apei_read(u64 *val, struct acpi_generic_address *reg)
596{
597 int rc;
598 u64 address;
599 u32 tmp, width = reg->bit_width;
600 acpi_status status;
601
602 rc = apei_check_gar(reg, &address);
603 if (rc)
604 return rc;
605
606 if (width == 64)
607 width = 32; /* Break into two 32-bit transfers */
608
609 *val = 0;
610 switch(reg->space_id) {
611 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
612 status = acpi_os_read_memory((acpi_physical_address)
613 address, &tmp, width);
614 if (ACPI_FAILURE(status))
615 return -EIO;
616 *val = tmp;
617
618 if (reg->bit_width == 64) {
619 /* Read the top 32 bits */
620 status = acpi_os_read_memory((acpi_physical_address)
621 (address + 4), &tmp, 32);
622 if (ACPI_FAILURE(status))
623 return -EIO;
624 *val |= ((u64)tmp << 32);
625 }
626 break;
627 case ACPI_ADR_SPACE_SYSTEM_IO:
628 status = acpi_os_read_port(address, (u32 *)val, reg->bit_width);
629 if (ACPI_FAILURE(status))
630 return -EIO;
631 break;
632 default:
633 return -EINVAL;
634 }
635
636 return 0;
637}
638EXPORT_SYMBOL_GPL(apei_read);
639
640/* write GAR in interrupt (including NMI) or process context */
641int apei_write(u64 val, struct acpi_generic_address *reg)
642{
643 int rc;
644 u64 address;
645 u32 width = reg->bit_width;
646 acpi_status status;
647
648 rc = apei_check_gar(reg, &address);
649 if (rc)
650 return rc;
651
652 if (width == 64)
653 width = 32; /* Break into two 32-bit transfers */
654
655 switch (reg->space_id) {
656 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
657 status = acpi_os_write_memory((acpi_physical_address)
658 address, ACPI_LODWORD(val),
659 width);
660 if (ACPI_FAILURE(status))
661 return -EIO;
662
663 if (reg->bit_width == 64) {
664 status = acpi_os_write_memory((acpi_physical_address)
665 (address + 4),
666 ACPI_HIDWORD(val), 32);
667 if (ACPI_FAILURE(status))
668 return -EIO;
669 }
670 break;
671 case ACPI_ADR_SPACE_SYSTEM_IO:
672 status = acpi_os_write_port(address, val, reg->bit_width);
673 if (ACPI_FAILURE(status))
674 return -EIO;
675 break;
676 default:
677 return -EINVAL;
678 }
679
680 return 0;
681}
682EXPORT_SYMBOL_GPL(apei_write);
683
556static int collect_res_callback(struct apei_exec_context *ctx, 684static int collect_res_callback(struct apei_exec_context *ctx,
557 struct acpi_whea_header *entry, 685 struct acpi_whea_header *entry,
558 void *data) 686 void *data)
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h
index f57050e7a5e7..cca240a33038 100644
--- a/drivers/acpi/apei/apei-internal.h
+++ b/drivers/acpi/apei/apei-internal.h
@@ -68,6 +68,9 @@ static inline int apei_exec_run_optional(struct apei_exec_context *ctx, u8 actio
68/* IP has been set in instruction function */ 68/* IP has been set in instruction function */
69#define APEI_EXEC_SET_IP 1 69#define APEI_EXEC_SET_IP 1
70 70
71int apei_read(u64 *val, struct acpi_generic_address *reg);
72int apei_write(u64 val, struct acpi_generic_address *reg);
73
71int __apei_exec_read_register(struct acpi_whea_header *entry, u64 *val); 74int __apei_exec_read_register(struct acpi_whea_header *entry, u64 *val);
72int __apei_exec_write_register(struct acpi_whea_header *entry, u64 val); 75int __apei_exec_write_register(struct acpi_whea_header *entry, u64 val);
73int apei_exec_read_register(struct apei_exec_context *ctx, 76int apei_exec_read_register(struct apei_exec_context *ctx,
@@ -95,6 +98,9 @@ static inline void apei_resources_init(struct apei_resources *resources)
95} 98}
96 99
97void apei_resources_fini(struct apei_resources *resources); 100void apei_resources_fini(struct apei_resources *resources);
101int apei_resources_add(struct apei_resources *resources,
102 unsigned long start, unsigned long size,
103 bool iomem);
98int apei_resources_sub(struct apei_resources *resources1, 104int apei_resources_sub(struct apei_resources *resources1,
99 struct apei_resources *resources2); 105 struct apei_resources *resources2);
100int apei_resources_request(struct apei_resources *resources, 106int apei_resources_request(struct apei_resources *resources,
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 31546fd21029..5b898d4dda99 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -286,8 +286,29 @@ static int einj_check_trigger_header(struct acpi_einj_trigger *trigger_tab)
286 return 0; 286 return 0;
287} 287}
288 288
289static struct acpi_generic_address *einj_get_trigger_parameter_region(
290 struct acpi_einj_trigger *trigger_tab, u64 param1, u64 param2)
291{
292 int i;
293 struct acpi_whea_header *entry;
294
295 entry = (struct acpi_whea_header *)
296 ((char *)trigger_tab + sizeof(struct acpi_einj_trigger));
297 for (i = 0; i < trigger_tab->entry_count; i++) {
298 if (entry->action == ACPI_EINJ_TRIGGER_ERROR &&
299 entry->instruction == ACPI_EINJ_WRITE_REGISTER_VALUE &&
300 entry->register_region.space_id ==
301 ACPI_ADR_SPACE_SYSTEM_MEMORY &&
302 (entry->register_region.address & param2) == (param1 & param2))
303 return &entry->register_region;
304 entry++;
305 }
306
307 return NULL;
308}
289/* Execute instructions in trigger error action table */ 309/* Execute instructions in trigger error action table */
290static int __einj_error_trigger(u64 trigger_paddr) 310static int __einj_error_trigger(u64 trigger_paddr, u32 type,
311 u64 param1, u64 param2)
291{ 312{
292 struct acpi_einj_trigger *trigger_tab = NULL; 313 struct acpi_einj_trigger *trigger_tab = NULL;
293 struct apei_exec_context trigger_ctx; 314 struct apei_exec_context trigger_ctx;
@@ -296,14 +317,16 @@ static int __einj_error_trigger(u64 trigger_paddr)
296 struct resource *r; 317 struct resource *r;
297 u32 table_size; 318 u32 table_size;
298 int rc = -EIO; 319 int rc = -EIO;
320 struct acpi_generic_address *trigger_param_region = NULL;
299 321
300 r = request_mem_region(trigger_paddr, sizeof(*trigger_tab), 322 r = request_mem_region(trigger_paddr, sizeof(*trigger_tab),
301 "APEI EINJ Trigger Table"); 323 "APEI EINJ Trigger Table");
302 if (!r) { 324 if (!r) {
303 pr_err(EINJ_PFX 325 pr_err(EINJ_PFX
304 "Can not request iomem region <%016llx-%016llx> for Trigger table.\n", 326 "Can not request [mem %#010llx-%#010llx] for Trigger table\n",
305 (unsigned long long)trigger_paddr, 327 (unsigned long long)trigger_paddr,
306 (unsigned long long)trigger_paddr+sizeof(*trigger_tab)); 328 (unsigned long long)trigger_paddr +
329 sizeof(*trigger_tab) - 1);
307 goto out; 330 goto out;
308 } 331 }
309 trigger_tab = ioremap_cache(trigger_paddr, sizeof(*trigger_tab)); 332 trigger_tab = ioremap_cache(trigger_paddr, sizeof(*trigger_tab));
@@ -324,9 +347,9 @@ static int __einj_error_trigger(u64 trigger_paddr)
324 "APEI EINJ Trigger Table"); 347 "APEI EINJ Trigger Table");
325 if (!r) { 348 if (!r) {
326 pr_err(EINJ_PFX 349 pr_err(EINJ_PFX
327"Can not request iomem region <%016llx-%016llx> for Trigger Table Entry.\n", 350"Can not request [mem %#010llx-%#010llx] for Trigger Table Entry\n",
328 (unsigned long long)trigger_paddr+sizeof(*trigger_tab), 351 (unsigned long long)trigger_paddr + sizeof(*trigger_tab),
329 (unsigned long long)trigger_paddr + table_size); 352 (unsigned long long)trigger_paddr + table_size - 1);
330 goto out_rel_header; 353 goto out_rel_header;
331 } 354 }
332 iounmap(trigger_tab); 355 iounmap(trigger_tab);
@@ -347,6 +370,30 @@ static int __einj_error_trigger(u64 trigger_paddr)
347 rc = apei_resources_sub(&trigger_resources, &einj_resources); 370 rc = apei_resources_sub(&trigger_resources, &einj_resources);
348 if (rc) 371 if (rc)
349 goto out_fini; 372 goto out_fini;
373 /*
374 * Some firmware will access target address specified in
375 * param1 to trigger the error when injecting memory error.
376 * This will cause resource conflict with regular memory. So
377 * remove it from trigger table resources.
378 */
379 if (param_extension && (type & 0x0038) && param2) {
380 struct apei_resources addr_resources;
381 apei_resources_init(&addr_resources);
382 trigger_param_region = einj_get_trigger_parameter_region(
383 trigger_tab, param1, param2);
384 if (trigger_param_region) {
385 rc = apei_resources_add(&addr_resources,
386 trigger_param_region->address,
387 trigger_param_region->bit_width/8, true);
388 if (rc)
389 goto out_fini;
390 rc = apei_resources_sub(&trigger_resources,
391 &addr_resources);
392 }
393 apei_resources_fini(&addr_resources);
394 if (rc)
395 goto out_fini;
396 }
350 rc = apei_resources_request(&trigger_resources, "APEI EINJ Trigger"); 397 rc = apei_resources_request(&trigger_resources, "APEI EINJ Trigger");
351 if (rc) 398 if (rc)
352 goto out_fini; 399 goto out_fini;
@@ -460,7 +507,7 @@ static int __einj_error_inject(u32 type, u64 param1, u64 param2)
460 if (rc) 507 if (rc)
461 return rc; 508 return rc;
462 trigger_paddr = apei_exec_ctx_get_output(&ctx); 509 trigger_paddr = apei_exec_ctx_get_output(&ctx);
463 rc = __einj_error_trigger(trigger_paddr); 510 rc = __einj_error_trigger(trigger_paddr, type, param1, param2);
464 if (rc) 511 if (rc)
465 return rc; 512 return rc;
466 rc = apei_exec_run_optional(&ctx, ACPI_EINJ_END_OPERATION); 513 rc = apei_exec_run_optional(&ctx, ACPI_EINJ_END_OPERATION);
@@ -610,10 +657,9 @@ static int __init einj_init(void)
610 657
611 status = acpi_get_table(ACPI_SIG_EINJ, 0, 658 status = acpi_get_table(ACPI_SIG_EINJ, 0,
612 (struct acpi_table_header **)&einj_tab); 659 (struct acpi_table_header **)&einj_tab);
613 if (status == AE_NOT_FOUND) { 660 if (status == AE_NOT_FOUND)
614 pr_info(EINJ_PFX "Table is not found!\n");
615 return -ENODEV; 661 return -ENODEV;
616 } else if (ACPI_FAILURE(status)) { 662 else if (ACPI_FAILURE(status)) {
617 const char *msg = acpi_format_exception(status); 663 const char *msg = acpi_format_exception(status);
618 pr_err(EINJ_PFX "Failed to get table, %s\n", msg); 664 pr_err(EINJ_PFX "Failed to get table, %s\n", msg);
619 return -EINVAL; 665 return -EINVAL;
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 631b9477b99c..8e8d786c5d23 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -1125,10 +1125,9 @@ static int __init erst_init(void)
1125 1125
1126 status = acpi_get_table(ACPI_SIG_ERST, 0, 1126 status = acpi_get_table(ACPI_SIG_ERST, 0,
1127 (struct acpi_table_header **)&erst_tab); 1127 (struct acpi_table_header **)&erst_tab);
1128 if (status == AE_NOT_FOUND) { 1128 if (status == AE_NOT_FOUND)
1129 pr_info(ERST_PFX "Table is not found!\n");
1130 goto err; 1129 goto err;
1131 } else if (ACPI_FAILURE(status)) { 1130 else if (ACPI_FAILURE(status)) {
1132 const char *msg = acpi_format_exception(status); 1131 const char *msg = acpi_format_exception(status);
1133 pr_err(ERST_PFX "Failed to get table, %s\n", msg); 1132 pr_err(ERST_PFX "Failed to get table, %s\n", msg);
1134 rc = -EINVAL; 1133 rc = -EINVAL;
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index b8e08cb67a18..b3207e16670e 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -33,6 +33,7 @@
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/acpi.h> 35#include <linux/acpi.h>
36#include <linux/acpi_io.h>
36#include <linux/io.h> 37#include <linux/io.h>
37#include <linux/interrupt.h> 38#include <linux/interrupt.h>
38#include <linux/timer.h> 39#include <linux/timer.h>
@@ -45,8 +46,9 @@
45#include <linux/irq_work.h> 46#include <linux/irq_work.h>
46#include <linux/llist.h> 47#include <linux/llist.h>
47#include <linux/genalloc.h> 48#include <linux/genalloc.h>
49#include <linux/pci.h>
50#include <linux/aer.h>
48#include <acpi/apei.h> 51#include <acpi/apei.h>
49#include <acpi/atomicio.h>
50#include <acpi/hed.h> 52#include <acpi/hed.h>
51#include <asm/mce.h> 53#include <asm/mce.h>
52#include <asm/tlbflush.h> 54#include <asm/tlbflush.h>
@@ -299,7 +301,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic)
299 if (!ghes) 301 if (!ghes)
300 return ERR_PTR(-ENOMEM); 302 return ERR_PTR(-ENOMEM);
301 ghes->generic = generic; 303 ghes->generic = generic;
302 rc = acpi_pre_map_gar(&generic->error_status_address); 304 rc = acpi_os_map_generic_address(&generic->error_status_address);
303 if (rc) 305 if (rc)
304 goto err_free; 306 goto err_free;
305 error_block_length = generic->error_block_length; 307 error_block_length = generic->error_block_length;
@@ -319,7 +321,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic)
319 return ghes; 321 return ghes;
320 322
321err_unmap: 323err_unmap:
322 acpi_post_unmap_gar(&generic->error_status_address); 324 acpi_os_unmap_generic_address(&generic->error_status_address);
323err_free: 325err_free:
324 kfree(ghes); 326 kfree(ghes);
325 return ERR_PTR(rc); 327 return ERR_PTR(rc);
@@ -328,7 +330,7 @@ err_free:
328static void ghes_fini(struct ghes *ghes) 330static void ghes_fini(struct ghes *ghes)
329{ 331{
330 kfree(ghes->estatus); 332 kfree(ghes->estatus);
331 acpi_post_unmap_gar(&ghes->generic->error_status_address); 333 acpi_os_unmap_generic_address(&ghes->generic->error_status_address);
332} 334}
333 335
334enum { 336enum {
@@ -399,7 +401,7 @@ static int ghes_read_estatus(struct ghes *ghes, int silent)
399 u32 len; 401 u32 len;
400 int rc; 402 int rc;
401 403
402 rc = acpi_atomic_read(&buf_paddr, &g->error_status_address); 404 rc = apei_read(&buf_paddr, &g->error_status_address);
403 if (rc) { 405 if (rc) {
404 if (!silent && printk_ratelimit()) 406 if (!silent && printk_ratelimit())
405 pr_warning(FW_WARN GHES_PFX 407 pr_warning(FW_WARN GHES_PFX
@@ -476,6 +478,27 @@ static void ghes_do_proc(const struct acpi_hest_generic_status *estatus)
476 } 478 }
477#endif 479#endif
478 } 480 }
481#ifdef CONFIG_ACPI_APEI_PCIEAER
482 else if (!uuid_le_cmp(*(uuid_le *)gdata->section_type,
483 CPER_SEC_PCIE)) {
484 struct cper_sec_pcie *pcie_err;
485 pcie_err = (struct cper_sec_pcie *)(gdata+1);
486 if (sev == GHES_SEV_RECOVERABLE &&
487 sec_sev == GHES_SEV_RECOVERABLE &&
488 pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID &&
489 pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) {
490 unsigned int devfn;
491 int aer_severity;
492 devfn = PCI_DEVFN(pcie_err->device_id.device,
493 pcie_err->device_id.function);
494 aer_severity = cper_severity_to_aer(sev);
495 aer_recover_queue(pcie_err->device_id.segment,
496 pcie_err->device_id.bus,
497 devfn, aer_severity);
498 }
499
500 }
501#endif
479 } 502 }
480} 503}
481 504
@@ -483,16 +506,22 @@ static void __ghes_print_estatus(const char *pfx,
483 const struct acpi_hest_generic *generic, 506 const struct acpi_hest_generic *generic,
484 const struct acpi_hest_generic_status *estatus) 507 const struct acpi_hest_generic_status *estatus)
485{ 508{
509 static atomic_t seqno;
510 unsigned int curr_seqno;
511 char pfx_seq[64];
512
486 if (pfx == NULL) { 513 if (pfx == NULL) {
487 if (ghes_severity(estatus->error_severity) <= 514 if (ghes_severity(estatus->error_severity) <=
488 GHES_SEV_CORRECTED) 515 GHES_SEV_CORRECTED)
489 pfx = KERN_WARNING HW_ERR; 516 pfx = KERN_WARNING;
490 else 517 else
491 pfx = KERN_ERR HW_ERR; 518 pfx = KERN_ERR;
492 } 519 }
520 curr_seqno = atomic_inc_return(&seqno);
521 snprintf(pfx_seq, sizeof(pfx_seq), "%s{%u}" HW_ERR, pfx, curr_seqno);
493 printk("%s""Hardware error from APEI Generic Hardware Error Source: %d\n", 522 printk("%s""Hardware error from APEI Generic Hardware Error Source: %d\n",
494 pfx, generic->header.source_id); 523 pfx_seq, generic->header.source_id);
495 apei_estatus_print(pfx, estatus); 524 apei_estatus_print(pfx_seq, estatus);
496} 525}
497 526
498static int ghes_print_estatus(const char *pfx, 527static int ghes_print_estatus(const char *pfx,
@@ -711,26 +740,34 @@ static int ghes_notify_sci(struct notifier_block *this,
711 return ret; 740 return ret;
712} 741}
713 742
743static struct llist_node *llist_nodes_reverse(struct llist_node *llnode)
744{
745 struct llist_node *next, *tail = NULL;
746
747 while (llnode) {
748 next = llnode->next;
749 llnode->next = tail;
750 tail = llnode;
751 llnode = next;
752 }
753
754 return tail;
755}
756
714static void ghes_proc_in_irq(struct irq_work *irq_work) 757static void ghes_proc_in_irq(struct irq_work *irq_work)
715{ 758{
716 struct llist_node *llnode, *next, *tail = NULL; 759 struct llist_node *llnode, *next;
717 struct ghes_estatus_node *estatus_node; 760 struct ghes_estatus_node *estatus_node;
718 struct acpi_hest_generic *generic; 761 struct acpi_hest_generic *generic;
719 struct acpi_hest_generic_status *estatus; 762 struct acpi_hest_generic_status *estatus;
720 u32 len, node_len; 763 u32 len, node_len;
721 764
765 llnode = llist_del_all(&ghes_estatus_llist);
722 /* 766 /*
723 * Because the time order of estatus in list is reversed, 767 * Because the time order of estatus in list is reversed,
724 * revert it back to proper order. 768 * revert it back to proper order.
725 */ 769 */
726 llnode = llist_del_all(&ghes_estatus_llist); 770 llnode = llist_nodes_reverse(llnode);
727 while (llnode) {
728 next = llnode->next;
729 llnode->next = tail;
730 tail = llnode;
731 llnode = next;
732 }
733 llnode = tail;
734 while (llnode) { 771 while (llnode) {
735 next = llnode->next; 772 next = llnode->next;
736 estatus_node = llist_entry(llnode, struct ghes_estatus_node, 773 estatus_node = llist_entry(llnode, struct ghes_estatus_node,
@@ -750,6 +787,32 @@ static void ghes_proc_in_irq(struct irq_work *irq_work)
750 } 787 }
751} 788}
752 789
790static void ghes_print_queued_estatus(void)
791{
792 struct llist_node *llnode;
793 struct ghes_estatus_node *estatus_node;
794 struct acpi_hest_generic *generic;
795 struct acpi_hest_generic_status *estatus;
796 u32 len, node_len;
797
798 llnode = llist_del_all(&ghes_estatus_llist);
799 /*
800 * Because the time order of estatus in list is reversed,
801 * revert it back to proper order.
802 */
803 llnode = llist_nodes_reverse(llnode);
804 while (llnode) {
805 estatus_node = llist_entry(llnode, struct ghes_estatus_node,
806 llnode);
807 estatus = GHES_ESTATUS_FROM_NODE(estatus_node);
808 len = apei_estatus_len(estatus);
809 node_len = GHES_ESTATUS_NODE_LEN(len);
810 generic = estatus_node->generic;
811 ghes_print_estatus(NULL, generic, estatus);
812 llnode = llnode->next;
813 }
814}
815
753static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs) 816static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs)
754{ 817{
755 struct ghes *ghes, *ghes_global = NULL; 818 struct ghes *ghes, *ghes_global = NULL;
@@ -775,7 +838,8 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs)
775 838
776 if (sev_global >= GHES_SEV_PANIC) { 839 if (sev_global >= GHES_SEV_PANIC) {
777 oops_begin(); 840 oops_begin();
778 __ghes_print_estatus(KERN_EMERG HW_ERR, ghes_global->generic, 841 ghes_print_queued_estatus();
842 __ghes_print_estatus(KERN_EMERG, ghes_global->generic,
779 ghes_global->estatus); 843 ghes_global->estatus);
780 /* reboot to log the error! */ 844 /* reboot to log the error! */
781 if (panic_timeout == 0) 845 if (panic_timeout == 0)
diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
index 05fee06f4d6e..f709269d4932 100644
--- a/drivers/acpi/apei/hest.c
+++ b/drivers/acpi/apei/hest.c
@@ -221,10 +221,9 @@ void __init acpi_hest_init(void)
221 221
222 status = acpi_get_table(ACPI_SIG_HEST, 0, 222 status = acpi_get_table(ACPI_SIG_HEST, 0,
223 (struct acpi_table_header **)&hest_tab); 223 (struct acpi_table_header **)&hest_tab);
224 if (status == AE_NOT_FOUND) { 224 if (status == AE_NOT_FOUND)
225 pr_info(HEST_PFX "Table not found.\n");
226 goto err; 225 goto err;
227 } else if (ACPI_FAILURE(status)) { 226 else if (ACPI_FAILURE(status)) {
228 const char *msg = acpi_format_exception(status); 227 const char *msg = acpi_format_exception(status);
229 pr_err(HEST_PFX "Failed to get table, %s\n", msg); 228 pr_err(HEST_PFX "Failed to get table, %s\n", msg);
230 rc = -EINVAL; 229 rc = -EINVAL;
diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c
index cfc0cc10af39..d4a5b3d3657b 100644
--- a/drivers/acpi/atomicio.c
+++ b/drivers/acpi/atomicio.c
@@ -32,6 +32,8 @@
32#include <linux/rculist.h> 32#include <linux/rculist.h>
33#include <linux/interrupt.h> 33#include <linux/interrupt.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/mm.h>
36#include <linux/highmem.h>
35#include <acpi/atomicio.h> 37#include <acpi/atomicio.h>
36 38
37#define ACPI_PFX "ACPI: " 39#define ACPI_PFX "ACPI: "
@@ -97,6 +99,37 @@ static void __iomem *__acpi_try_ioremap(phys_addr_t paddr,
97 return NULL; 99 return NULL;
98} 100}
99 101
102#ifndef CONFIG_IA64
103#define should_use_kmap(pfn) page_is_ram(pfn)
104#else
105/* ioremap will take care of cache attributes */
106#define should_use_kmap(pfn) 0
107#endif
108
109static void __iomem *acpi_map(phys_addr_t pg_off, unsigned long pg_sz)
110{
111 unsigned long pfn;
112
113 pfn = pg_off >> PAGE_SHIFT;
114 if (should_use_kmap(pfn)) {
115 if (pg_sz > PAGE_SIZE)
116 return NULL;
117 return (void __iomem __force *)kmap(pfn_to_page(pfn));
118 } else
119 return ioremap(pg_off, pg_sz);
120}
121
122static void acpi_unmap(phys_addr_t pg_off, void __iomem *vaddr)
123{
124 unsigned long pfn;
125
126 pfn = pg_off >> PAGE_SHIFT;
127 if (page_is_ram(pfn))
128 kunmap(pfn_to_page(pfn));
129 else
130 iounmap(vaddr);
131}
132
100/* 133/*
101 * Used to pre-map the specified IO memory area. First try to find 134 * Used to pre-map the specified IO memory area. First try to find
102 * whether the area is already pre-mapped, if it is, increase the 135 * whether the area is already pre-mapped, if it is, increase the
@@ -119,7 +152,7 @@ static void __iomem *acpi_pre_map(phys_addr_t paddr,
119 152
120 pg_off = paddr & PAGE_MASK; 153 pg_off = paddr & PAGE_MASK;
121 pg_sz = ((paddr + size + PAGE_SIZE - 1) & PAGE_MASK) - pg_off; 154 pg_sz = ((paddr + size + PAGE_SIZE - 1) & PAGE_MASK) - pg_off;
122 vaddr = ioremap(pg_off, pg_sz); 155 vaddr = acpi_map(pg_off, pg_sz);
123 if (!vaddr) 156 if (!vaddr)
124 return NULL; 157 return NULL;
125 map = kmalloc(sizeof(*map), GFP_KERNEL); 158 map = kmalloc(sizeof(*map), GFP_KERNEL);
@@ -135,7 +168,7 @@ static void __iomem *acpi_pre_map(phys_addr_t paddr,
135 vaddr = __acpi_try_ioremap(paddr, size); 168 vaddr = __acpi_try_ioremap(paddr, size);
136 if (vaddr) { 169 if (vaddr) {
137 spin_unlock_irqrestore(&acpi_iomaps_lock, flags); 170 spin_unlock_irqrestore(&acpi_iomaps_lock, flags);
138 iounmap(map->vaddr); 171 acpi_unmap(pg_off, map->vaddr);
139 kfree(map); 172 kfree(map);
140 return vaddr; 173 return vaddr;
141 } 174 }
@@ -144,7 +177,7 @@ static void __iomem *acpi_pre_map(phys_addr_t paddr,
144 177
145 return map->vaddr + (paddr - map->paddr); 178 return map->vaddr + (paddr - map->paddr);
146err_unmap: 179err_unmap:
147 iounmap(vaddr); 180 acpi_unmap(pg_off, vaddr);
148 return NULL; 181 return NULL;
149} 182}
150 183
@@ -177,7 +210,7 @@ static void acpi_post_unmap(phys_addr_t paddr, unsigned long size)
177 return; 210 return;
178 211
179 synchronize_rcu(); 212 synchronize_rcu();
180 iounmap(map->vaddr); 213 acpi_unmap(map->paddr, map->vaddr);
181 kfree(map); 214 kfree(map);
182} 215}
183 216
@@ -260,6 +293,21 @@ int acpi_post_unmap_gar(struct acpi_generic_address *reg)
260} 293}
261EXPORT_SYMBOL_GPL(acpi_post_unmap_gar); 294EXPORT_SYMBOL_GPL(acpi_post_unmap_gar);
262 295
296#ifdef readq
297static inline u64 read64(const volatile void __iomem *addr)
298{
299 return readq(addr);
300}
301#else
302static inline u64 read64(const volatile void __iomem *addr)
303{
304 u64 l, h;
305 l = readl(addr);
306 h = readl(addr+4);
307 return l | (h << 32);
308}
309#endif
310
263/* 311/*
264 * Can be used in atomic (including NMI) or process context. RCU read 312 * Can be used in atomic (including NMI) or process context. RCU read
265 * lock can only be released after the IO memory area accessing. 313 * lock can only be released after the IO memory area accessing.
@@ -280,11 +328,9 @@ static int acpi_atomic_read_mem(u64 paddr, u64 *val, u32 width)
280 case 32: 328 case 32:
281 *val = readl(addr); 329 *val = readl(addr);
282 break; 330 break;
283#ifdef readq
284 case 64: 331 case 64:
285 *val = readq(addr); 332 *val = read64(addr);
286 break; 333 break;
287#endif
288 default: 334 default:
289 return -EINVAL; 335 return -EINVAL;
290 } 336 }
@@ -293,6 +339,19 @@ static int acpi_atomic_read_mem(u64 paddr, u64 *val, u32 width)
293 return 0; 339 return 0;
294} 340}
295 341
342#ifdef writeq
343static inline void write64(u64 val, volatile void __iomem *addr)
344{
345 writeq(val, addr);
346}
347#else
348static inline void write64(u64 val, volatile void __iomem *addr)
349{
350 writel(val, addr);
351 writel(val>>32, addr+4);
352}
353#endif
354
296static int acpi_atomic_write_mem(u64 paddr, u64 val, u32 width) 355static int acpi_atomic_write_mem(u64 paddr, u64 val, u32 width)
297{ 356{
298 void __iomem *addr; 357 void __iomem *addr;
@@ -309,11 +368,9 @@ static int acpi_atomic_write_mem(u64 paddr, u64 val, u32 width)
309 case 32: 368 case 32:
310 writel(val, addr); 369 writel(val, addr);
311 break; 370 break;
312#ifdef writeq
313 case 64: 371 case 64:
314 writeq(val, addr); 372 write64(val, addr);
315 break; 373 break;
316#endif
317 default: 374 default:
318 return -EINVAL; 375 return -EINVAL;
319 } 376 }
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 3b5c3189fd99..e56f3be7b07d 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -45,6 +45,8 @@ static int pxm_to_node_map[MAX_PXM_DOMAINS]
45static int node_to_pxm_map[MAX_NUMNODES] 45static int node_to_pxm_map[MAX_NUMNODES]
46 = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; 46 = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };
47 47
48unsigned char acpi_srat_revision __initdata;
49
48int pxm_to_node(int pxm) 50int pxm_to_node(int pxm)
49{ 51{
50 if (pxm < 0) 52 if (pxm < 0)
@@ -255,9 +257,13 @@ acpi_parse_memory_affinity(struct acpi_subtable_header * header,
255 257
256static int __init acpi_parse_srat(struct acpi_table_header *table) 258static int __init acpi_parse_srat(struct acpi_table_header *table)
257{ 259{
260 struct acpi_table_srat *srat;
258 if (!table) 261 if (!table)
259 return -EINVAL; 262 return -EINVAL;
260 263
264 srat = (struct acpi_table_srat *)table;
265 acpi_srat_revision = srat->header.revision;
266
261 /* Real work done in acpi_table_parse_srat below. */ 267 /* Real work done in acpi_table_parse_srat below. */
262 268
263 return 0; 269 return 0;
diff --git a/drivers/acpi/nvs.c b/drivers/acpi/nvs.c
index 096787b43c96..7a2035fa8c71 100644
--- a/drivers/acpi/nvs.c
+++ b/drivers/acpi/nvs.c
@@ -15,6 +15,56 @@
15#include <linux/acpi_io.h> 15#include <linux/acpi_io.h>
16#include <acpi/acpiosxf.h> 16#include <acpi/acpiosxf.h>
17 17
18/* ACPI NVS regions, APEI may use it */
19
20struct nvs_region {
21 __u64 phys_start;
22 __u64 size;
23 struct list_head node;
24};
25
26static LIST_HEAD(nvs_region_list);
27
28#ifdef CONFIG_ACPI_SLEEP
29static int suspend_nvs_register(unsigned long start, unsigned long size);
30#else
31static inline int suspend_nvs_register(unsigned long a, unsigned long b)
32{
33 return 0;
34}
35#endif
36
37int acpi_nvs_register(__u64 start, __u64 size)
38{
39 struct nvs_region *region;
40
41 region = kmalloc(sizeof(*region), GFP_KERNEL);
42 if (!region)
43 return -ENOMEM;
44 region->phys_start = start;
45 region->size = size;
46 list_add_tail(&region->node, &nvs_region_list);
47
48 return suspend_nvs_register(start, size);
49}
50
51int acpi_nvs_for_each_region(int (*func)(__u64 start, __u64 size, void *data),
52 void *data)
53{
54 int rc;
55 struct nvs_region *region;
56
57 list_for_each_entry(region, &nvs_region_list, node) {
58 rc = func(region->phys_start, region->size, data);
59 if (rc)
60 return rc;
61 }
62
63 return 0;
64}
65
66
67#ifdef CONFIG_ACPI_SLEEP
18/* 68/*
19 * Platforms, like ACPI, may want us to save some memory used by them during 69 * Platforms, like ACPI, may want us to save some memory used by them during
20 * suspend and to restore the contents of this memory during the subsequent 70 * suspend and to restore the contents of this memory during the subsequent
@@ -41,7 +91,7 @@ static LIST_HEAD(nvs_list);
41 * things so that the data from page-aligned addresses in this region will 91 * things so that the data from page-aligned addresses in this region will
42 * be copied into separate RAM pages. 92 * be copied into separate RAM pages.
43 */ 93 */
44int suspend_nvs_register(unsigned long start, unsigned long size) 94static int suspend_nvs_register(unsigned long start, unsigned long size)
45{ 95{
46 struct nvs_page *entry, *next; 96 struct nvs_page *entry, *next;
47 97
@@ -159,3 +209,4 @@ void suspend_nvs_restore(void)
159 if (entry->data) 209 if (entry->data)
160 memcpy(entry->kaddr, entry->data, entry->size); 210 memcpy(entry->kaddr, entry->data, entry->size);
161} 211}
212#endif
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index f31c5c5f1b7e..fcc12d842bcc 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -83,19 +83,6 @@ static struct workqueue_struct *kacpi_notify_wq;
83struct workqueue_struct *kacpi_hotplug_wq; 83struct workqueue_struct *kacpi_hotplug_wq;
84EXPORT_SYMBOL(kacpi_hotplug_wq); 84EXPORT_SYMBOL(kacpi_hotplug_wq);
85 85
86struct acpi_res_list {
87 resource_size_t start;
88 resource_size_t end;
89 acpi_adr_space_type resource_type; /* IO port, System memory, ...*/
90 char name[5]; /* only can have a length of 4 chars, make use of this
91 one instead of res->name, no need to kalloc then */
92 struct list_head resource_list;
93 int count;
94};
95
96static LIST_HEAD(resource_list_head);
97static DEFINE_SPINLOCK(acpi_res_lock);
98
99/* 86/*
100 * This list of permanent mappings is for memory that may be accessed from 87 * This list of permanent mappings is for memory that may be accessed from
101 * interrupt context, where we can't do the ioremap(). 88 * interrupt context, where we can't do the ioremap().
@@ -166,17 +153,21 @@ static u32 acpi_osi_handler(acpi_string interface, u32 supported)
166 return supported; 153 return supported;
167} 154}
168 155
169static void __init acpi_request_region (struct acpi_generic_address *addr, 156static void __init acpi_request_region (struct acpi_generic_address *gas,
170 unsigned int length, char *desc) 157 unsigned int length, char *desc)
171{ 158{
172 if (!addr->address || !length) 159 u64 addr;
160
161 /* Handle possible alignment issues */
162 memcpy(&addr, &gas->address, sizeof(addr));
163 if (!addr || !length)
173 return; 164 return;
174 165
175 /* Resources are never freed */ 166 /* Resources are never freed */
176 if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO) 167 if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
177 request_region(addr->address, length, desc); 168 request_region(addr, length, desc);
178 else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) 169 else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
179 request_mem_region(addr->address, length, desc); 170 request_mem_region(addr, length, desc);
180} 171}
181 172
182static int __init acpi_reserve_resources(void) 173static int __init acpi_reserve_resources(void)
@@ -427,35 +418,42 @@ void __init early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size)
427 __acpi_unmap_table(virt, size); 418 __acpi_unmap_table(virt, size);
428} 419}
429 420
430static int acpi_os_map_generic_address(struct acpi_generic_address *addr) 421int acpi_os_map_generic_address(struct acpi_generic_address *gas)
431{ 422{
423 u64 addr;
432 void __iomem *virt; 424 void __iomem *virt;
433 425
434 if (addr->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) 426 if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
435 return 0; 427 return 0;
436 428
437 if (!addr->address || !addr->bit_width) 429 /* Handle possible alignment issues */
430 memcpy(&addr, &gas->address, sizeof(addr));
431 if (!addr || !gas->bit_width)
438 return -EINVAL; 432 return -EINVAL;
439 433
440 virt = acpi_os_map_memory(addr->address, addr->bit_width / 8); 434 virt = acpi_os_map_memory(addr, gas->bit_width / 8);
441 if (!virt) 435 if (!virt)
442 return -EIO; 436 return -EIO;
443 437
444 return 0; 438 return 0;
445} 439}
440EXPORT_SYMBOL(acpi_os_map_generic_address);
446 441
447static void acpi_os_unmap_generic_address(struct acpi_generic_address *addr) 442void acpi_os_unmap_generic_address(struct acpi_generic_address *gas)
448{ 443{
444 u64 addr;
449 struct acpi_ioremap *map; 445 struct acpi_ioremap *map;
450 446
451 if (addr->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) 447 if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
452 return; 448 return;
453 449
454 if (!addr->address || !addr->bit_width) 450 /* Handle possible alignment issues */
451 memcpy(&addr, &gas->address, sizeof(addr));
452 if (!addr || !gas->bit_width)
455 return; 453 return;
456 454
457 mutex_lock(&acpi_ioremap_lock); 455 mutex_lock(&acpi_ioremap_lock);
458 map = acpi_map_lookup(addr->address, addr->bit_width / 8); 456 map = acpi_map_lookup(addr, gas->bit_width / 8);
459 if (!map) { 457 if (!map) {
460 mutex_unlock(&acpi_ioremap_lock); 458 mutex_unlock(&acpi_ioremap_lock);
461 return; 459 return;
@@ -465,6 +463,7 @@ static void acpi_os_unmap_generic_address(struct acpi_generic_address *addr)
465 463
466 acpi_os_map_cleanup(map); 464 acpi_os_map_cleanup(map);
467} 465}
466EXPORT_SYMBOL(acpi_os_unmap_generic_address);
468 467
469#ifdef ACPI_FUTURE_USAGE 468#ifdef ACPI_FUTURE_USAGE
470acpi_status 469acpi_status
@@ -1278,44 +1277,28 @@ __setup("acpi_enforce_resources=", acpi_enforce_resources_setup);
1278 * drivers */ 1277 * drivers */
1279int acpi_check_resource_conflict(const struct resource *res) 1278int acpi_check_resource_conflict(const struct resource *res)
1280{ 1279{
1281 struct acpi_res_list *res_list_elem; 1280 acpi_adr_space_type space_id;
1282 int ioport = 0, clash = 0; 1281 acpi_size length;
1282 u8 warn = 0;
1283 int clash = 0;
1283 1284
1284 if (acpi_enforce_resources == ENFORCE_RESOURCES_NO) 1285 if (acpi_enforce_resources == ENFORCE_RESOURCES_NO)
1285 return 0; 1286 return 0;
1286 if (!(res->flags & IORESOURCE_IO) && !(res->flags & IORESOURCE_MEM)) 1287 if (!(res->flags & IORESOURCE_IO) && !(res->flags & IORESOURCE_MEM))
1287 return 0; 1288 return 0;
1288 1289
1289 ioport = res->flags & IORESOURCE_IO; 1290 if (res->flags & IORESOURCE_IO)
1290 1291 space_id = ACPI_ADR_SPACE_SYSTEM_IO;
1291 spin_lock(&acpi_res_lock); 1292 else
1292 list_for_each_entry(res_list_elem, &resource_list_head, 1293 space_id = ACPI_ADR_SPACE_SYSTEM_MEMORY;
1293 resource_list) {
1294 if (ioport && (res_list_elem->resource_type
1295 != ACPI_ADR_SPACE_SYSTEM_IO))
1296 continue;
1297 if (!ioport && (res_list_elem->resource_type
1298 != ACPI_ADR_SPACE_SYSTEM_MEMORY))
1299 continue;
1300 1294
1301 if (res->end < res_list_elem->start 1295 length = res->end - res->start + 1;
1302 || res_list_elem->end < res->start) 1296 if (acpi_enforce_resources != ENFORCE_RESOURCES_NO)
1303 continue; 1297 warn = 1;
1304 clash = 1; 1298 clash = acpi_check_address_range(space_id, res->start, length, warn);
1305 break;
1306 }
1307 spin_unlock(&acpi_res_lock);
1308 1299
1309 if (clash) { 1300 if (clash) {
1310 if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { 1301 if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) {
1311 printk(KERN_WARNING "ACPI: resource %s %pR"
1312 " conflicts with ACPI region %s "
1313 "[%s 0x%zx-0x%zx]\n",
1314 res->name, res, res_list_elem->name,
1315 (res_list_elem->resource_type ==
1316 ACPI_ADR_SPACE_SYSTEM_IO) ? "io" : "mem",
1317 (size_t) res_list_elem->start,
1318 (size_t) res_list_elem->end);
1319 if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX) 1302 if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX)
1320 printk(KERN_NOTICE "ACPI: This conflict may" 1303 printk(KERN_NOTICE "ACPI: This conflict may"
1321 " cause random problems and system" 1304 " cause random problems and system"
@@ -1467,155 +1450,6 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
1467 kmem_cache_free(cache, object); 1450 kmem_cache_free(cache, object);
1468 return (AE_OK); 1451 return (AE_OK);
1469} 1452}
1470
1471static inline int acpi_res_list_add(struct acpi_res_list *res)
1472{
1473 struct acpi_res_list *res_list_elem;
1474
1475 list_for_each_entry(res_list_elem, &resource_list_head,
1476 resource_list) {
1477
1478 if (res->resource_type == res_list_elem->resource_type &&
1479 res->start == res_list_elem->start &&
1480 res->end == res_list_elem->end) {
1481
1482 /*
1483 * The Region(addr,len) already exist in the list,
1484 * just increase the count
1485 */
1486
1487 res_list_elem->count++;
1488 return 0;
1489 }
1490 }
1491
1492 res->count = 1;
1493 list_add(&res->resource_list, &resource_list_head);
1494 return 1;
1495}
1496
1497static inline void acpi_res_list_del(struct acpi_res_list *res)
1498{
1499 struct acpi_res_list *res_list_elem;
1500
1501 list_for_each_entry(res_list_elem, &resource_list_head,
1502 resource_list) {
1503
1504 if (res->resource_type == res_list_elem->resource_type &&
1505 res->start == res_list_elem->start &&
1506 res->end == res_list_elem->end) {
1507
1508 /*
1509 * If the res count is decreased to 0,
1510 * remove and free it
1511 */
1512
1513 if (--res_list_elem->count == 0) {
1514 list_del(&res_list_elem->resource_list);
1515 kfree(res_list_elem);
1516 }
1517 return;
1518 }
1519 }
1520}
1521
1522acpi_status
1523acpi_os_invalidate_address(
1524 u8 space_id,
1525 acpi_physical_address address,
1526 acpi_size length)
1527{
1528 struct acpi_res_list res;
1529
1530 switch (space_id) {
1531 case ACPI_ADR_SPACE_SYSTEM_IO:
1532 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
1533 /* Only interference checks against SystemIO and SystemMemory
1534 are needed */
1535 res.start = address;
1536 res.end = address + length - 1;
1537 res.resource_type = space_id;
1538 spin_lock(&acpi_res_lock);
1539 acpi_res_list_del(&res);
1540 spin_unlock(&acpi_res_lock);
1541 break;
1542 case ACPI_ADR_SPACE_PCI_CONFIG:
1543 case ACPI_ADR_SPACE_EC:
1544 case ACPI_ADR_SPACE_SMBUS:
1545 case ACPI_ADR_SPACE_CMOS:
1546 case ACPI_ADR_SPACE_PCI_BAR_TARGET:
1547 case ACPI_ADR_SPACE_DATA_TABLE:
1548 case ACPI_ADR_SPACE_FIXED_HARDWARE:
1549 break;
1550 }
1551 return AE_OK;
1552}
1553
1554/******************************************************************************
1555 *
1556 * FUNCTION: acpi_os_validate_address
1557 *
1558 * PARAMETERS: space_id - ACPI space ID
1559 * address - Physical address
1560 * length - Address length
1561 *
1562 * RETURN: AE_OK if address/length is valid for the space_id. Otherwise,
1563 * should return AE_AML_ILLEGAL_ADDRESS.
1564 *
1565 * DESCRIPTION: Validate a system address via the host OS. Used to validate
1566 * the addresses accessed by AML operation regions.
1567 *
1568 *****************************************************************************/
1569
1570acpi_status
1571acpi_os_validate_address (
1572 u8 space_id,
1573 acpi_physical_address address,
1574 acpi_size length,
1575 char *name)
1576{
1577 struct acpi_res_list *res;
1578 int added;
1579 if (acpi_enforce_resources == ENFORCE_RESOURCES_NO)
1580 return AE_OK;
1581
1582 switch (space_id) {
1583 case ACPI_ADR_SPACE_SYSTEM_IO:
1584 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
1585 /* Only interference checks against SystemIO and SystemMemory
1586 are needed */
1587 res = kzalloc(sizeof(struct acpi_res_list), GFP_KERNEL);
1588 if (!res)
1589 return AE_OK;
1590 /* ACPI names are fixed to 4 bytes, still better use strlcpy */
1591 strlcpy(res->name, name, 5);
1592 res->start = address;
1593 res->end = address + length - 1;
1594 res->resource_type = space_id;
1595 spin_lock(&acpi_res_lock);
1596 added = acpi_res_list_add(res);
1597 spin_unlock(&acpi_res_lock);
1598 pr_debug("%s %s resource: start: 0x%llx, end: 0x%llx, "
1599 "name: %s\n", added ? "Added" : "Already exist",
1600 (space_id == ACPI_ADR_SPACE_SYSTEM_IO)
1601 ? "SystemIO" : "System Memory",
1602 (unsigned long long)res->start,
1603 (unsigned long long)res->end,
1604 res->name);
1605 if (!added)
1606 kfree(res);
1607 break;
1608 case ACPI_ADR_SPACE_PCI_CONFIG:
1609 case ACPI_ADR_SPACE_EC:
1610 case ACPI_ADR_SPACE_SMBUS:
1611 case ACPI_ADR_SPACE_CMOS:
1612 case ACPI_ADR_SPACE_PCI_BAR_TARGET:
1613 case ACPI_ADR_SPACE_DATA_TABLE:
1614 case ACPI_ADR_SPACE_FIXED_HARDWARE:
1615 break;
1616 }
1617 return AE_OK;
1618}
1619#endif 1453#endif
1620 1454
1621acpi_status __init acpi_os_initialize(void) 1455acpi_status __init acpi_os_initialize(void)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 3a0428e8435c..c850de4c9a14 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -173,8 +173,30 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
173 apic_id = map_mat_entry(handle, type, acpi_id); 173 apic_id = map_mat_entry(handle, type, acpi_id);
174 if (apic_id == -1) 174 if (apic_id == -1)
175 apic_id = map_madt_entry(type, acpi_id); 175 apic_id = map_madt_entry(type, acpi_id);
176 if (apic_id == -1) 176 if (apic_id == -1) {
177 return apic_id; 177 /*
178 * On UP processor, there is no _MAT or MADT table.
179 * So above apic_id is always set to -1.
180 *
181 * BIOS may define multiple CPU handles even for UP processor.
182 * For example,
183 *
184 * Scope (_PR)
185 * {
186 * Processor (CPU0, 0x00, 0x00000410, 0x06) {}
187 * Processor (CPU1, 0x01, 0x00000410, 0x06) {}
188 * Processor (CPU2, 0x02, 0x00000410, 0x06) {}
189 * Processor (CPU3, 0x03, 0x00000410, 0x06) {}
190 * }
191 *
192 * Ignores apic_id and always return 0 for CPU0's handle.
193 * Return -1 for other CPU's handle.
194 */
195 if (acpi_id == 0)
196 return acpi_id;
197 else
198 return apic_id;
199 }
178 200
179#ifdef CONFIG_SMP 201#ifdef CONFIG_SMP
180 for_each_possible_cpu(i) { 202 for_each_possible_cpu(i) {
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 9d7bc9f6b6cc..b9cbd9b09450 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -82,7 +82,7 @@ MODULE_LICENSE("GPL");
82static int acpi_processor_add(struct acpi_device *device); 82static int acpi_processor_add(struct acpi_device *device);
83static int acpi_processor_remove(struct acpi_device *device, int type); 83static int acpi_processor_remove(struct acpi_device *device, int type);
84static void acpi_processor_notify(struct acpi_device *device, u32 event); 84static void acpi_processor_notify(struct acpi_device *device, u32 event);
85static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); 85static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr);
86static int acpi_processor_handle_eject(struct acpi_processor *pr); 86static int acpi_processor_handle_eject(struct acpi_processor *pr);
87 87
88 88
@@ -324,10 +324,8 @@ static int acpi_processor_get_info(struct acpi_device *device)
324 * they are physically not present. 324 * they are physically not present.
325 */ 325 */
326 if (pr->id == -1) { 326 if (pr->id == -1) {
327 if (ACPI_FAILURE 327 if (ACPI_FAILURE(acpi_processor_hotadd_init(pr)))
328 (acpi_processor_hotadd_init(pr->handle, &pr->id))) {
329 return -ENODEV; 328 return -ENODEV;
330 }
331 } 329 }
332 /* 330 /*
333 * On some boxes several processors use the same processor bus id. 331 * On some boxes several processors use the same processor bus id.
@@ -539,6 +537,7 @@ err_thermal_unregister:
539 thermal_cooling_device_unregister(pr->cdev); 537 thermal_cooling_device_unregister(pr->cdev);
540err_power_exit: 538err_power_exit:
541 acpi_processor_power_exit(pr, device); 539 acpi_processor_power_exit(pr, device);
540 sysfs_remove_link(&device->dev.kobj, "sysdev");
542err_free_cpumask: 541err_free_cpumask:
543 free_cpumask_var(pr->throttling.shared_cpu_map); 542 free_cpumask_var(pr->throttling.shared_cpu_map);
544 543
@@ -720,18 +719,19 @@ processor_walk_namespace_cb(acpi_handle handle,
720 return (AE_OK); 719 return (AE_OK);
721} 720}
722 721
723static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) 722static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)
724{ 723{
724 acpi_handle handle = pr->handle;
725 725
726 if (!is_processor_present(handle)) { 726 if (!is_processor_present(handle)) {
727 return AE_ERROR; 727 return AE_ERROR;
728 } 728 }
729 729
730 if (acpi_map_lsapic(handle, p_cpu)) 730 if (acpi_map_lsapic(handle, &pr->id))
731 return AE_ERROR; 731 return AE_ERROR;
732 732
733 if (arch_register_cpu(*p_cpu)) { 733 if (arch_register_cpu(pr->id)) {
734 acpi_unmap_lsapic(*p_cpu); 734 acpi_unmap_lsapic(pr->id);
735 return AE_ERROR; 735 return AE_ERROR;
736 } 736 }
737 737
@@ -748,7 +748,7 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr)
748 return (0); 748 return (0);
749} 749}
750#else 750#else
751static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) 751static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)
752{ 752{
753 return AE_ERROR; 753 return AE_ERROR;
754} 754}
@@ -827,8 +827,6 @@ static void __exit acpi_processor_exit(void)
827 827
828 acpi_bus_unregister_driver(&acpi_processor_driver); 828 acpi_bus_unregister_driver(&acpi_processor_driver);
829 829
830 cpuidle_unregister_driver(&acpi_idle_driver);
831
832 return; 830 return;
833} 831}
834 832
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 5d2f8e13cf0e..20bce51c2e82 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -197,7 +197,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
197 .enter = &intel_idle }, 197 .enter = &intel_idle },
198}; 198};
199 199
200static int get_driver_data(int cstate) 200static long get_driver_data(int cstate)
201{ 201{
202 int driver_data; 202 int driver_data;
203 switch (cstate) { 203 switch (cstate) {
@@ -232,6 +232,7 @@ static int get_driver_data(int cstate)
232 * @drv: cpuidle driver 232 * @drv: cpuidle driver
233 * @index: index of cpuidle state 233 * @index: index of cpuidle state
234 * 234 *
235 * Must be called under local_irq_disable().
235 */ 236 */
236static int intel_idle(struct cpuidle_device *dev, 237static int intel_idle(struct cpuidle_device *dev,
237 struct cpuidle_driver *drv, int index) 238 struct cpuidle_driver *drv, int index)
@@ -247,8 +248,6 @@ static int intel_idle(struct cpuidle_device *dev,
247 248
248 cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1; 249 cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
249 250
250 local_irq_disable();
251
252 /* 251 /*
253 * leave_mm() to avoid costly and often unnecessary wakeups 252 * leave_mm() to avoid costly and often unnecessary wakeups
254 * for flushing the user TLB's associated with the active mm. 253 * for flushing the user TLB's associated with the active mm.
@@ -348,7 +347,8 @@ static int intel_idle_probe(void)
348 cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &mwait_substates); 347 cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &mwait_substates);
349 348
350 if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || 349 if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||
351 !(ecx & CPUID5_ECX_INTERRUPT_BREAK)) 350 !(ecx & CPUID5_ECX_INTERRUPT_BREAK) ||
351 !mwait_substates)
352 return -ENODEV; 352 return -ENODEV;
353 353
354 pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates); 354 pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates);
@@ -394,7 +394,7 @@ static int intel_idle_probe(void)
394 if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */ 394 if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */
395 lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE; 395 lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
396 else { 396 else {
397 smp_call_function(__setup_broadcast_timer, (void *)true, 1); 397 on_each_cpu(__setup_broadcast_timer, (void *)true, 1);
398 register_cpu_notifier(&setup_broadcast_notifier); 398 register_cpu_notifier(&setup_broadcast_notifier);
399 } 399 }
400 400
@@ -471,71 +471,67 @@ static int intel_idle_cpuidle_driver_init(void)
471 } 471 }
472 472
473 if (auto_demotion_disable_flags) 473 if (auto_demotion_disable_flags)
474 smp_call_function(auto_demotion_disable, NULL, 1); 474 on_each_cpu(auto_demotion_disable, NULL, 1);
475 475
476 return 0; 476 return 0;
477} 477}
478 478
479 479
480/* 480/*
481 * intel_idle_cpuidle_devices_init() 481 * intel_idle_cpu_init()
482 * allocate, initialize, register cpuidle_devices 482 * allocate, initialize, register cpuidle_devices
483 * @cpu: cpu/core to initialize
483 */ 484 */
484static int intel_idle_cpuidle_devices_init(void) 485int intel_idle_cpu_init(int cpu)
485{ 486{
486 int i, cstate; 487 int cstate;
487 struct cpuidle_device *dev; 488 struct cpuidle_device *dev;
488 489
489 intel_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device); 490 dev = per_cpu_ptr(intel_idle_cpuidle_devices, cpu);
490 if (intel_idle_cpuidle_devices == NULL)
491 return -ENOMEM;
492
493 for_each_online_cpu(i) {
494 dev = per_cpu_ptr(intel_idle_cpuidle_devices, i);
495 491
496 dev->state_count = 1; 492 dev->state_count = 1;
497 493
498 for (cstate = 1; cstate < MWAIT_MAX_NUM_CSTATES; ++cstate) { 494 for (cstate = 1; cstate < MWAIT_MAX_NUM_CSTATES; ++cstate) {
499 int num_substates; 495 int num_substates;
500 496
501 if (cstate > max_cstate) { 497 if (cstate > max_cstate) {
502 printk(PREFIX "max_cstate %d reached\n", 498 printk(PREFIX "max_cstate %d reached\n",
503 max_cstate); 499 max_cstate);
504 break; 500 break;
505 } 501 }
506 502
507 /* does the state exist in CPUID.MWAIT? */ 503 /* does the state exist in CPUID.MWAIT? */
508 num_substates = (mwait_substates >> ((cstate) * 4)) 504 num_substates = (mwait_substates >> ((cstate) * 4))
509 & MWAIT_SUBSTATE_MASK; 505 & MWAIT_SUBSTATE_MASK;
510 if (num_substates == 0) 506 if (num_substates == 0)
511 continue; 507 continue;
512 /* is the state not enabled? */ 508 /* is the state not enabled? */
513 if (cpuidle_state_table[cstate].enter == NULL) { 509 if (cpuidle_state_table[cstate].enter == NULL)
514 continue; 510 continue;
515 }
516 511
517 dev->states_usage[dev->state_count].driver_data = 512 dev->states_usage[dev->state_count].driver_data =
518 (void *)get_driver_data(cstate); 513 (void *)get_driver_data(cstate);
519 514
520 dev->state_count += 1; 515 dev->state_count += 1;
521 } 516 }
517 dev->cpu = cpu;
522 518
523 dev->cpu = i; 519 if (cpuidle_register_device(dev)) {
524 if (cpuidle_register_device(dev)) { 520 pr_debug(PREFIX "cpuidle_register_device %d failed!\n", cpu);
525 pr_debug(PREFIX "cpuidle_register_device %d failed!\n", 521 intel_idle_cpuidle_devices_uninit();
526 i); 522 return -EIO;
527 intel_idle_cpuidle_devices_uninit();
528 return -EIO;
529 }
530 } 523 }
531 524
525 if (auto_demotion_disable_flags)
526 smp_call_function_single(cpu, auto_demotion_disable, NULL, 1);
527
532 return 0; 528 return 0;
533} 529}
534 530
535 531
536static int __init intel_idle_init(void) 532static int __init intel_idle_init(void)
537{ 533{
538 int retval; 534 int retval, i;
539 535
540 /* Do not load intel_idle at all for now if idle= is passed */ 536 /* Do not load intel_idle at all for now if idle= is passed */
541 if (boot_option_idle_override != IDLE_NO_OVERRIDE) 537 if (boot_option_idle_override != IDLE_NO_OVERRIDE)
@@ -553,10 +549,16 @@ static int __init intel_idle_init(void)
553 return retval; 549 return retval;
554 } 550 }
555 551
556 retval = intel_idle_cpuidle_devices_init(); 552 intel_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device);
557 if (retval) { 553 if (intel_idle_cpuidle_devices == NULL)
558 cpuidle_unregister_driver(&intel_idle_driver); 554 return -ENOMEM;
559 return retval; 555
556 for_each_online_cpu(i) {
557 retval = intel_idle_cpu_init(i);
558 if (retval) {
559 cpuidle_unregister_driver(&intel_idle_driver);
560 return retval;
561 }
560 } 562 }
561 563
562 return 0; 564 return 0;
@@ -568,7 +570,7 @@ static void __exit intel_idle_exit(void)
568 cpuidle_unregister_driver(&intel_idle_driver); 570 cpuidle_unregister_driver(&intel_idle_driver);
569 571
570 if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) { 572 if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) {
571 smp_call_function(__setup_broadcast_timer, (void *)false, 1); 573 on_each_cpu(__setup_broadcast_timer, (void *)false, 1);
572 unregister_cpu_notifier(&setup_broadcast_notifier); 574 unregister_cpu_notifier(&setup_broadcast_notifier);
573 } 575 }
574 576
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index fc1575fd4596..5b5af0d30a97 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -58,6 +58,7 @@
58#define METHOD_NAME__PRT "_PRT" 58#define METHOD_NAME__PRT "_PRT"
59#define METHOD_NAME__CRS "_CRS" 59#define METHOD_NAME__CRS "_CRS"
60#define METHOD_NAME__PRS "_PRS" 60#define METHOD_NAME__PRS "_PRS"
61#define METHOD_NAME__AEI "_AEI"
61#define METHOD_NAME__PRW "_PRW" 62#define METHOD_NAME__PRW "_PRW"
62#define METHOD_NAME__SRS "_SRS" 63#define METHOD_NAME__SRS "_SRS"
63 64
diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h
index 173972672175..451823cb8837 100644
--- a/include/acpi/acpi_numa.h
+++ b/include/acpi/acpi_numa.h
@@ -15,6 +15,7 @@ extern int pxm_to_node(int);
15extern int node_to_pxm(int); 15extern int node_to_pxm(int);
16extern void __acpi_map_pxm_to_node(int, int); 16extern void __acpi_map_pxm_to_node(int, int);
17extern int acpi_map_pxm_to_node(int); 17extern int acpi_map_pxm_to_node(int);
18extern unsigned char acpi_srat_revision;
18 19
19#endif /* CONFIG_ACPI_NUMA */ 20#endif /* CONFIG_ACPI_NUMA */
20#endif /* __ACP_NUMA_H */ 21#endif /* __ACP_NUMA_H */
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 83062ed0ef2f..2fe8639b3ae7 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -238,13 +238,6 @@ acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
238/* 238/*
239 * Miscellaneous 239 * Miscellaneous
240 */ 240 */
241acpi_status
242acpi_os_validate_address(u8 space_id, acpi_physical_address address,
243 acpi_size length, char *name);
244acpi_status
245acpi_os_invalidate_address(u8 space_id, acpi_physical_address address,
246 acpi_size length);
247
248u64 acpi_os_get_timer(void); 241u64 acpi_os_get_timer(void);
249 242
250acpi_status acpi_os_signal(u32 function, void *info); 243acpi_status acpi_os_signal(u32 function, void *info);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index f554a9313b43..dceeaf51d706 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20110623 50#define ACPI_CA_VERSION 0x20120111
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -74,6 +74,7 @@ extern u8 acpi_gbl_disable_auto_repair;
74extern u32 acpi_current_gpe_count; 74extern u32 acpi_current_gpe_count;
75extern struct acpi_table_fadt acpi_gbl_FADT; 75extern struct acpi_table_fadt acpi_gbl_FADT;
76extern u8 acpi_gbl_system_awake_and_running; 76extern u8 acpi_gbl_system_awake_and_running;
77extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */
77 78
78extern u32 acpi_rsdt_forced; 79extern u32 acpi_rsdt_forced;
79/* 80/*
@@ -111,6 +112,11 @@ acpi_status acpi_install_interface(acpi_string interface_name);
111 112
112acpi_status acpi_remove_interface(acpi_string interface_name); 113acpi_status acpi_remove_interface(acpi_string interface_name);
113 114
115u32
116acpi_check_address_range(acpi_adr_space_type space_id,
117 acpi_physical_address address,
118 acpi_size length, u8 warn);
119
114/* 120/*
115 * ACPI Memory management 121 * ACPI Memory management
116 */ 122 */
@@ -276,12 +282,23 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler);
276acpi_status acpi_install_interface_handler(acpi_interface_handler handler); 282acpi_status acpi_install_interface_handler(acpi_interface_handler handler);
277 283
278/* 284/*
279 * Event interfaces 285 * Global Lock interfaces
280 */ 286 */
281acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle); 287acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle);
282 288
283acpi_status acpi_release_global_lock(u32 handle); 289acpi_status acpi_release_global_lock(u32 handle);
284 290
291/*
292 * Interfaces to AML mutex objects
293 */
294acpi_status
295acpi_acquire_mutex(acpi_handle handle, acpi_string pathname, u16 timeout);
296
297acpi_status acpi_release_mutex(acpi_handle handle, acpi_string pathname);
298
299/*
300 * Fixed Event interfaces
301 */
285acpi_status acpi_enable_event(u32 event, u32 flags); 302acpi_status acpi_enable_event(u32 event, u32 flags);
286 303
287acpi_status acpi_disable_event(u32 event, u32 flags); 304acpi_status acpi_disable_event(u32 event, u32 flags);
@@ -291,7 +308,7 @@ acpi_status acpi_clear_event(u32 event);
291acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); 308acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status);
292 309
293/* 310/*
294 * GPE Interfaces 311 * General Purpose Event (GPE) Interfaces
295 */ 312 */
296acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); 313acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number);
297 314
@@ -346,6 +363,10 @@ acpi_get_possible_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
346#endif 363#endif
347 364
348acpi_status 365acpi_status
366acpi_get_event_resources(acpi_handle device_handle,
367 struct acpi_buffer *ret_buffer);
368
369acpi_status
349acpi_walk_resources(acpi_handle device, 370acpi_walk_resources(acpi_handle device,
350 char *name, 371 char *name,
351 acpi_walk_resource_callback user_function, void *context); 372 acpi_walk_resource_callback user_function, void *context);
@@ -360,6 +381,11 @@ acpi_status
360acpi_resource_to_address64(struct acpi_resource *resource, 381acpi_resource_to_address64(struct acpi_resource *resource,
361 struct acpi_resource_address64 *out); 382 struct acpi_resource_address64 *out);
362 383
384acpi_status
385acpi_buffer_to_resource(u8 *aml_buffer,
386 u16 aml_buffer_length,
387 struct acpi_resource **resource_ptr);
388
363/* 389/*
364 * Hardware (ACPI device) interfaces 390 * Hardware (ACPI device) interfaces
365 */ 391 */
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index 0a66cc45dd6b..3506e39a66b1 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -61,11 +61,14 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (6
61#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02 61#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
62#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03 62#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
63 63
64/*! [Begin] no source code translation */
64/* 65/*
65 * IO Attributes 66 * IO Attributes
66 * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh. 67 * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh.
67 * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh. 68 * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
68 */ 69 */
70/*! [End] no source code translation !*/
71
69#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 72#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
70#define ACPI_ISA_ONLY_RANGES (u8) 0x02 73#define ACPI_ISA_ONLY_RANGES (u8) 0x02
71#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) 74#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
@@ -81,16 +84,26 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (6
81#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ 84#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
82 85
83/* 86/*
84 * IRQ Attributes 87 * Interrupt attributes - used in multiple descriptors
85 */ 88 */
89
90/* Triggering */
91
86#define ACPI_LEVEL_SENSITIVE (u8) 0x00 92#define ACPI_LEVEL_SENSITIVE (u8) 0x00
87#define ACPI_EDGE_SENSITIVE (u8) 0x01 93#define ACPI_EDGE_SENSITIVE (u8) 0x01
88 94
95/* Polarity */
96
89#define ACPI_ACTIVE_HIGH (u8) 0x00 97#define ACPI_ACTIVE_HIGH (u8) 0x00
90#define ACPI_ACTIVE_LOW (u8) 0x01 98#define ACPI_ACTIVE_LOW (u8) 0x01
99#define ACPI_ACTIVE_BOTH (u8) 0x02
100
101/* Sharing */
91 102
92#define ACPI_EXCLUSIVE (u8) 0x00 103#define ACPI_EXCLUSIVE (u8) 0x00
93#define ACPI_SHARED (u8) 0x01 104#define ACPI_SHARED (u8) 0x01
105#define ACPI_EXCLUSIVE_AND_WAKE (u8) 0x02
106#define ACPI_SHARED_AND_WAKE (u8) 0x03
94 107
95/* 108/*
96 * DMA Attributes 109 * DMA Attributes
@@ -127,6 +140,8 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (6
127#define ACPI_POS_DECODE (u8) 0x00 140#define ACPI_POS_DECODE (u8) 0x00
128#define ACPI_SUB_DECODE (u8) 0x01 141#define ACPI_SUB_DECODE (u8) 0x01
129 142
143/* Producer/Consumer */
144
130#define ACPI_PRODUCER (u8) 0x00 145#define ACPI_PRODUCER (u8) 0x00
131#define ACPI_CONSUMER (u8) 0x01 146#define ACPI_CONSUMER (u8) 0x01
132 147
@@ -192,6 +207,21 @@ struct acpi_resource_fixed_io {
192 u8 address_length; 207 u8 address_length;
193}; 208};
194 209
210struct acpi_resource_fixed_dma {
211 u16 request_lines;
212 u16 channels;
213 u8 width;
214};
215
216/* Values for Width field above */
217
218#define ACPI_DMA_WIDTH8 0
219#define ACPI_DMA_WIDTH16 1
220#define ACPI_DMA_WIDTH32 2
221#define ACPI_DMA_WIDTH64 3
222#define ACPI_DMA_WIDTH128 4
223#define ACPI_DMA_WIDTH256 5
224
195struct acpi_resource_vendor { 225struct acpi_resource_vendor {
196 u16 byte_length; 226 u16 byte_length;
197 u8 byte_data[1]; 227 u8 byte_data[1];
@@ -329,6 +359,166 @@ struct acpi_resource_generic_register {
329 u64 address; 359 u64 address;
330}; 360};
331 361
362struct acpi_resource_gpio {
363 u8 revision_id;
364 u8 connection_type;
365 u8 producer_consumer; /* For values, see Producer/Consumer above */
366 u8 pin_config;
367 u8 sharable; /* For values, see Interrupt Attributes above */
368 u8 io_restriction;
369 u8 triggering; /* For values, see Interrupt Attributes above */
370 u8 polarity; /* For values, see Interrupt Attributes above */
371 u16 drive_strength;
372 u16 debounce_timeout;
373 u16 pin_table_length;
374 u16 vendor_length;
375 struct acpi_resource_source resource_source;
376 u16 *pin_table;
377 u8 *vendor_data;
378};
379
380/* Values for GPIO connection_type field above */
381
382#define ACPI_RESOURCE_GPIO_TYPE_INT 0
383#define ACPI_RESOURCE_GPIO_TYPE_IO 1
384
385/* Values for pin_config field above */
386
387#define ACPI_PIN_CONFIG_DEFAULT 0
388#define ACPI_PIN_CONFIG_PULLUP 1
389#define ACPI_PIN_CONFIG_PULLDOWN 2
390#define ACPI_PIN_CONFIG_NOPULL 3
391
392/* Values for io_restriction field above */
393
394#define ACPI_IO_RESTRICT_NONE 0
395#define ACPI_IO_RESTRICT_INPUT 1
396#define ACPI_IO_RESTRICT_OUTPUT 2
397#define ACPI_IO_RESTRICT_NONE_PRESERVE 3
398
399/* Common structure for I2C, SPI, and UART serial descriptors */
400
401#define ACPI_RESOURCE_SERIAL_COMMON \
402 u8 revision_id; \
403 u8 type; \
404 u8 producer_consumer; /* For values, see Producer/Consumer above */\
405 u8 slave_mode; \
406 u8 type_revision_id; \
407 u16 type_data_length; \
408 u16 vendor_length; \
409 struct acpi_resource_source resource_source; \
410 u8 *vendor_data;
411
412struct acpi_resource_common_serialbus {
413ACPI_RESOURCE_SERIAL_COMMON};
414
415/* Values for the Type field above */
416
417#define ACPI_RESOURCE_SERIAL_TYPE_I2C 1
418#define ACPI_RESOURCE_SERIAL_TYPE_SPI 2
419#define ACPI_RESOURCE_SERIAL_TYPE_UART 3
420
421/* Values for slave_mode field above */
422
423#define ACPI_CONTROLLER_INITIATED 0
424#define ACPI_DEVICE_INITIATED 1
425
426struct acpi_resource_i2c_serialbus {
427 ACPI_RESOURCE_SERIAL_COMMON u8 access_mode;
428 u16 slave_address;
429 u32 connection_speed;
430};
431
432/* Values for access_mode field above */
433
434#define ACPI_I2C_7BIT_MODE 0
435#define ACPI_I2C_10BIT_MODE 1
436
437struct acpi_resource_spi_serialbus {
438 ACPI_RESOURCE_SERIAL_COMMON u8 wire_mode;
439 u8 device_polarity;
440 u8 data_bit_length;
441 u8 clock_phase;
442 u8 clock_polarity;
443 u16 device_selection;
444 u32 connection_speed;
445};
446
447/* Values for wire_mode field above */
448
449#define ACPI_SPI_4WIRE_MODE 0
450#define ACPI_SPI_3WIRE_MODE 1
451
452/* Values for device_polarity field above */
453
454#define ACPI_SPI_ACTIVE_LOW 0
455#define ACPI_SPI_ACTIVE_HIGH 1
456
457/* Values for clock_phase field above */
458
459#define ACPI_SPI_FIRST_PHASE 0
460#define ACPI_SPI_SECOND_PHASE 1
461
462/* Values for clock_polarity field above */
463
464#define ACPI_SPI_START_LOW 0
465#define ACPI_SPI_START_HIGH 1
466
467struct acpi_resource_uart_serialbus {
468 ACPI_RESOURCE_SERIAL_COMMON u8 endian;
469 u8 data_bits;
470 u8 stop_bits;
471 u8 flow_control;
472 u8 parity;
473 u8 lines_enabled;
474 u16 rx_fifo_size;
475 u16 tx_fifo_size;
476 u32 default_baud_rate;
477};
478
479/* Values for Endian field above */
480
481#define ACPI_UART_LITTLE_ENDIAN 0
482#define ACPI_UART_BIG_ENDIAN 1
483
484/* Values for data_bits field above */
485
486#define ACPI_UART_5_DATA_BITS 0
487#define ACPI_UART_6_DATA_BITS 1
488#define ACPI_UART_7_DATA_BITS 2
489#define ACPI_UART_8_DATA_BITS 3
490#define ACPI_UART_9_DATA_BITS 4
491
492/* Values for stop_bits field above */
493
494#define ACPI_UART_NO_STOP_BITS 0
495#define ACPI_UART_1_STOP_BIT 1
496#define ACPI_UART_1P5_STOP_BITS 2
497#define ACPI_UART_2_STOP_BITS 3
498
499/* Values for flow_control field above */
500
501#define ACPI_UART_FLOW_CONTROL_NONE 0
502#define ACPI_UART_FLOW_CONTROL_HW 1
503#define ACPI_UART_FLOW_CONTROL_XON_XOFF 2
504
505/* Values for Parity field above */
506
507#define ACPI_UART_PARITY_NONE 0
508#define ACPI_UART_PARITY_EVEN 1
509#define ACPI_UART_PARITY_ODD 2
510#define ACPI_UART_PARITY_MARK 3
511#define ACPI_UART_PARITY_SPACE 4
512
513/* Values for lines_enabled bitfield above */
514
515#define ACPI_UART_CARRIER_DETECT (1<<2)
516#define ACPI_UART_RING_INDICATOR (1<<3)
517#define ACPI_UART_DATA_SET_READY (1<<4)
518#define ACPI_UART_DATA_TERMINAL_READY (1<<5)
519#define ACPI_UART_CLEAR_TO_SEND (1<<6)
520#define ACPI_UART_REQUEST_TO_SEND (1<<7)
521
332/* ACPI_RESOURCE_TYPEs */ 522/* ACPI_RESOURCE_TYPEs */
333 523
334#define ACPI_RESOURCE_TYPE_IRQ 0 524#define ACPI_RESOURCE_TYPE_IRQ 0
@@ -348,7 +538,10 @@ struct acpi_resource_generic_register {
348#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ 538#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
349#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 539#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
350#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 540#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
351#define ACPI_RESOURCE_TYPE_MAX 16 541#define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */
542#define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */
543#define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */
544#define ACPI_RESOURCE_TYPE_MAX 19
352 545
353/* Master union for resource descriptors */ 546/* Master union for resource descriptors */
354 547
@@ -358,6 +551,7 @@ union acpi_resource_data {
358 struct acpi_resource_start_dependent start_dpf; 551 struct acpi_resource_start_dependent start_dpf;
359 struct acpi_resource_io io; 552 struct acpi_resource_io io;
360 struct acpi_resource_fixed_io fixed_io; 553 struct acpi_resource_fixed_io fixed_io;
554 struct acpi_resource_fixed_dma fixed_dma;
361 struct acpi_resource_vendor vendor; 555 struct acpi_resource_vendor vendor;
362 struct acpi_resource_vendor_typed vendor_typed; 556 struct acpi_resource_vendor_typed vendor_typed;
363 struct acpi_resource_end_tag end_tag; 557 struct acpi_resource_end_tag end_tag;
@@ -370,6 +564,11 @@ union acpi_resource_data {
370 struct acpi_resource_extended_address64 ext_address64; 564 struct acpi_resource_extended_address64 ext_address64;
371 struct acpi_resource_extended_irq extended_irq; 565 struct acpi_resource_extended_irq extended_irq;
372 struct acpi_resource_generic_register generic_reg; 566 struct acpi_resource_generic_register generic_reg;
567 struct acpi_resource_gpio gpio;
568 struct acpi_resource_i2c_serialbus i2c_serial_bus;
569 struct acpi_resource_spi_serialbus spi_serial_bus;
570 struct acpi_resource_uart_serialbus uart_serial_bus;
571 struct acpi_resource_common_serialbus common_serial_bus;
373 572
374 /* Common fields */ 573 /* Common fields */
375 574
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index f1380287ed4d..8e1b92f6f650 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -255,6 +255,8 @@ struct acpi_table_fadt {
255 struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ 255 struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
256 struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */ 256 struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */
257 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ 257 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
258 struct acpi_generic_address sleep_control; /* 64-bit Sleep Control register */
259 struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register */
258}; 260};
259 261
260/* Masks for FADT Boot Architecture Flags (boot_flags) */ 262/* Masks for FADT Boot Architecture Flags (boot_flags) */
@@ -264,6 +266,7 @@ struct acpi_table_fadt {
264#define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */ 266#define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */
265#define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */ 267#define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */
266#define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */ 268#define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */
269#define ACPI_FADT_NO_CMOS_RTC (1<<5) /* 05: [V5] No CMOS real-time clock present */
267 270
268#define FADT2_REVISION_ID 3 271#define FADT2_REVISION_ID 3
269 272
@@ -289,6 +292,8 @@ struct acpi_table_fadt {
289#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */ 292#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */
290#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */ 293#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */
291#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */ 294#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */
295#define ACPI_FADT_HW_REDUCED (1<<20) /* 20: [V5] ACPI hardware is not implemented (ACPI 5.0) */
296#define ACPI_FADT_LOW_POWER_S0 (1<<21) /* 21: [V5] S0 power savings are equal or better than S3 (ACPI 5.0) */
292 297
293/* Values for preferred_profile (Preferred Power Management Profiles) */ 298/* Values for preferred_profile (Preferred Power Management Profiles) */
294 299
@@ -299,14 +304,16 @@ enum acpi_prefered_pm_profiles {
299 PM_WORKSTATION = 3, 304 PM_WORKSTATION = 3,
300 PM_ENTERPRISE_SERVER = 4, 305 PM_ENTERPRISE_SERVER = 4,
301 PM_SOHO_SERVER = 5, 306 PM_SOHO_SERVER = 5,
302 PM_APPLIANCE_PC = 6 307 PM_APPLIANCE_PC = 6,
308 PM_PERFORMANCE_SERVER = 7,
309 PM_TABLET = 8
303}; 310};
304 311
305/* Reset to default packing */ 312/* Reset to default packing */
306 313
307#pragma pack() 314#pragma pack()
308 315
309#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f) 316#define ACPI_FADT_OFFSET(f) (u16) ACPI_OFFSET (struct acpi_table_fadt, f)
310 317
311/* 318/*
312 * Internal table-related structures 319 * Internal table-related structures
@@ -342,6 +349,7 @@ struct acpi_table_desc {
342 349
343#include <acpi/actbl1.h> 350#include <acpi/actbl1.h>
344#include <acpi/actbl2.h> 351#include <acpi/actbl2.h>
352#include <acpi/actbl3.h>
345 353
346/* 354/*
347 * Sizes of the various flavors of FADT. We need to look closely 355 * Sizes of the various flavors of FADT. We need to look closely
@@ -351,12 +359,15 @@ struct acpi_table_desc {
351 * FADT is the bottom line as to what the version really is. 359 * FADT is the bottom line as to what the version really is.
352 * 360 *
353 * For reference, the values below are as follows: 361 * For reference, the values below are as follows:
354 * FADT V1 size: 0x74 362 * FADT V1 size: 0x074
355 * FADT V2 size: 0x84 363 * FADT V2 size: 0x084
356 * FADT V3+ size: 0xF4 364 * FADT V3 size: 0x0F4
365 * FADT V4 size: 0x0F4
366 * FADT V5 size: 0x10C
357 */ 367 */
358#define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4) 368#define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4)
359#define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (reserved4[0]) + 3) 369#define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (reserved4[0]) + 3)
360#define ACPI_FADT_V3_SIZE (u32) (sizeof (struct acpi_table_fadt)) 370#define ACPI_FADT_V3_SIZE (u32) (ACPI_FADT_OFFSET (sleep_control))
371#define ACPI_FADT_V5_SIZE (u32) (sizeof (struct acpi_table_fadt))
361 372
362#endif /* __ACTBL_H__ */ 373#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index f25d7efee630..71e747beac8f 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -241,7 +241,27 @@ enum acpi_einj_instructions {
241 ACPI_EINJ_WRITE_REGISTER = 2, 241 ACPI_EINJ_WRITE_REGISTER = 2,
242 ACPI_EINJ_WRITE_REGISTER_VALUE = 3, 242 ACPI_EINJ_WRITE_REGISTER_VALUE = 3,
243 ACPI_EINJ_NOOP = 4, 243 ACPI_EINJ_NOOP = 4,
244 ACPI_EINJ_INSTRUCTION_RESERVED = 5 /* 5 and greater are reserved */ 244 ACPI_EINJ_FLUSH_CACHELINE = 5,
245 ACPI_EINJ_INSTRUCTION_RESERVED = 6 /* 6 and greater are reserved */
246};
247
248struct acpi_einj_error_type_with_addr {
249 u32 error_type;
250 u32 vendor_struct_offset;
251 u32 flags;
252 u32 apic_id;
253 u64 address;
254 u64 range;
255 u32 pcie_id;
256};
257
258struct acpi_einj_vendor {
259 u32 length;
260 u32 pcie_id;
261 u16 vendor_id;
262 u16 device_id;
263 u8 revision_id;
264 u8 reserved[3];
245}; 265};
246 266
247/* EINJ Trigger Error Action Table */ 267/* EINJ Trigger Error Action Table */
@@ -276,6 +296,7 @@ enum acpi_einj_command_status {
276#define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9) 296#define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9)
277#define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10) 297#define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10)
278#define ACPI_EINJ_PLATFORM_FATAL (1<<11) 298#define ACPI_EINJ_PLATFORM_FATAL (1<<11)
299#define ACPI_EINJ_VENDOR_DEFINED (1<<31)
279 300
280/******************************************************************************* 301/*******************************************************************************
281 * 302 *
@@ -632,7 +653,9 @@ enum acpi_madt_type {
632 ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, 653 ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
633 ACPI_MADT_TYPE_LOCAL_X2APIC = 9, 654 ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
634 ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, 655 ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
635 ACPI_MADT_TYPE_RESERVED = 11 /* 11 and greater are reserved */ 656 ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11,
657 ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12,
658 ACPI_MADT_TYPE_RESERVED = 13 /* 13 and greater are reserved */
636}; 659};
637 660
638/* 661/*
@@ -753,11 +776,36 @@ struct acpi_madt_local_x2apic_nmi {
753 u8 reserved[3]; 776 u8 reserved[3];
754}; 777};
755 778
779/* 11: Generic Interrupt (ACPI 5.0) */
780
781struct acpi_madt_generic_interrupt {
782 struct acpi_subtable_header header;
783 u16 reserved; /* Reserved - must be zero */
784 u32 gic_id;
785 u32 uid;
786 u32 flags;
787 u32 parking_version;
788 u32 performance_interrupt;
789 u64 parked_address;
790 u64 base_address;
791};
792
793/* 12: Generic Distributor (ACPI 5.0) */
794
795struct acpi_madt_generic_distributor {
796 struct acpi_subtable_header header;
797 u16 reserved; /* Reserved - must be zero */
798 u32 gic_id;
799 u64 base_address;
800 u32 global_irq_base;
801 u32 reserved2; /* Reserved - must be zero */
802};
803
756/* 804/*
757 * Common flags fields for MADT subtables 805 * Common flags fields for MADT subtables
758 */ 806 */
759 807
760/* MADT Local APIC flags (lapic_flags) */ 808/* MADT Local APIC flags (lapic_flags) and GIC flags */
761 809
762#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */ 810#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
763 811
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
new file mode 100644
index 000000000000..c22ce80e9535
--- /dev/null
+++ b/include/acpi/actbl3.h
@@ -0,0 +1,552 @@
1/******************************************************************************
2 *
3 * Name: actbl3.h - ACPI Table Definitions
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACTBL3_H__
45#define __ACTBL3_H__
46
47/*******************************************************************************
48 *
49 * Additional ACPI Tables (3)
50 *
51 * These tables are not consumed directly by the ACPICA subsystem, but are
52 * included here to support device drivers and the AML disassembler.
53 *
54 * The tables in this file are fully defined within the ACPI specification.
55 *
56 ******************************************************************************/
57
58/*
59 * Values for description table header signatures for tables defined in this
60 * file. Useful because they make it more difficult to inadvertently type in
61 * the wrong signature.
62 */
63#define ACPI_SIG_BGRT "BGRT" /* Boot Graphics Resource Table */
64#define ACPI_SIG_DRTM "DRTM" /* Dynamic Root of Trust for Measurement table */
65#define ACPI_SIG_FPDT "FPDT" /* Firmware Performance Data Table */
66#define ACPI_SIG_GTDT "GTDT" /* Generic Timer Description Table */
67#define ACPI_SIG_MPST "MPST" /* Memory Power State Table */
68#define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */
69#define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */
70#define ACPI_SIG_RASF "RASF" /* RAS Feature table */
71
72#define ACPI_SIG_S3PT "S3PT" /* S3 Performance (sub)Table */
73#define ACPI_SIG_PCCS "PCC" /* PCC Shared Memory Region */
74
75/* Reserved table signatures */
76
77#define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */
78#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table 2 */
79#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */
80#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */
81#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */
82
83/*
84 * All tables must be byte-packed to match the ACPI specification, since
85 * the tables are provided by the system BIOS.
86 */
87#pragma pack(1)
88
89/*
90 * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
91 * This is the only type that is even remotely portable. Anything else is not
92 * portable, so do not use any other bitfield types.
93 */
94
95/*******************************************************************************
96 *
97 * BGRT - Boot Graphics Resource Table (ACPI 5.0)
98 * Version 1
99 *
100 ******************************************************************************/
101
102struct acpi_table_bgrt {
103 struct acpi_table_header header; /* Common ACPI table header */
104 u16 version;
105 u8 status;
106 u8 image_type;
107 u64 image_address;
108 u32 image_offset_x;
109 u32 image_offset_y;
110};
111
112/*******************************************************************************
113 *
114 * DRTM - Dynamic Root of Trust for Measurement table
115 *
116 ******************************************************************************/
117
118struct acpi_table_drtm {
119 struct acpi_table_header header; /* Common ACPI table header */
120 u64 entry_base_address;
121 u64 entry_length;
122 u32 entry_address32;
123 u64 entry_address64;
124 u64 exit_address;
125 u64 log_area_address;
126 u32 log_area_length;
127 u64 arch_dependent_address;
128 u32 flags;
129};
130
131/* 1) Validated Tables List */
132
133struct acpi_drtm_vtl_list {
134 u32 validated_table_list_count;
135};
136
137/* 2) Resources List */
138
139struct acpi_drtm_resource_list {
140 u32 resource_list_count;
141};
142
143/* 3) Platform-specific Identifiers List */
144
145struct acpi_drtm_id_list {
146 u32 id_list_count;
147};
148
149/*******************************************************************************
150 *
151 * FPDT - Firmware Performance Data Table (ACPI 5.0)
152 * Version 1
153 *
154 ******************************************************************************/
155
156struct acpi_table_fpdt {
157 struct acpi_table_header header; /* Common ACPI table header */
158};
159
160/* FPDT subtable header */
161
162struct acpi_fpdt_header {
163 u16 type;
164 u8 length;
165 u8 revision;
166};
167
168/* Values for Type field above */
169
170enum acpi_fpdt_type {
171 ACPI_FPDT_TYPE_BOOT = 0,
172 ACPI_FPDT_TYPE_S3PERF = 1,
173};
174
175/*
176 * FPDT subtables
177 */
178
179/* 0: Firmware Basic Boot Performance Record */
180
181struct acpi_fpdt_boot {
182 struct acpi_fpdt_header header;
183 u8 reserved[4];
184 u64 reset_end;
185 u64 load_start;
186 u64 startup_start;
187 u64 exit_services_entry;
188 u64 exit_services_exit;
189};
190
191/* 1: S3 Performance Table Pointer Record */
192
193struct acpi_fpdt_s3pt_ptr {
194 struct acpi_fpdt_header header;
195 u8 reserved[4];
196 u64 address;
197};
198
199/*
200 * S3PT - S3 Performance Table. This table is pointed to by the
201 * FPDT S3 Pointer Record above.
202 */
203struct acpi_table_s3pt {
204 u8 signature[4]; /* "S3PT" */
205 u32 length;
206};
207
208/*
209 * S3PT Subtables
210 */
211struct acpi_s3pt_header {
212 u16 type;
213 u8 length;
214 u8 revision;
215};
216
217/* Values for Type field above */
218
219enum acpi_s3pt_type {
220 ACPI_S3PT_TYPE_RESUME = 0,
221 ACPI_S3PT_TYPE_SUSPEND = 1,
222};
223
224struct acpi_s3pt_resume {
225 struct acpi_s3pt_header header;
226 u32 resume_count;
227 u64 full_resume;
228 u64 average_resume;
229};
230
231struct acpi_s3pt_suspend {
232 struct acpi_s3pt_header header;
233 u64 suspend_start;
234 u64 suspend_end;
235};
236
237/*******************************************************************************
238 *
239 * GTDT - Generic Timer Description Table (ACPI 5.0)
240 * Version 1
241 *
242 ******************************************************************************/
243
244struct acpi_table_gtdt {
245 struct acpi_table_header header; /* Common ACPI table header */
246 u64 address;
247 u32 flags;
248 u32 secure_pl1_interrupt;
249 u32 secure_pl1_flags;
250 u32 non_secure_pl1_interrupt;
251 u32 non_secure_pl1_flags;
252 u32 virtual_timer_interrupt;
253 u32 virtual_timer_flags;
254 u32 non_secure_pl2_interrupt;
255 u32 non_secure_pl2_flags;
256};
257
258/* Values for Flags field above */
259
260#define ACPI_GTDT_MAPPED_BLOCK_PRESENT 1
261
262/* Values for all "TimerFlags" fields above */
263
264#define ACPI_GTDT_INTERRUPT_MODE 1
265#define ACPI_GTDT_INTERRUPT_POLARITY 2
266
267/*******************************************************************************
268 *
269 * MPST - Memory Power State Table (ACPI 5.0)
270 * Version 1
271 *
272 ******************************************************************************/
273
274#define ACPI_MPST_CHANNEL_INFO \
275 u16 reserved1; \
276 u8 channel_id; \
277 u8 reserved2; \
278 u16 power_node_count;
279
280/* Main table */
281
282struct acpi_table_mpst {
283 struct acpi_table_header header; /* Common ACPI table header */
284 ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
285};
286
287/* Memory Platform Communication Channel Info */
288
289struct acpi_mpst_channel {
290 ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
291};
292
293/* Memory Power Node Structure */
294
295struct acpi_mpst_power_node {
296 u8 flags;
297 u8 reserved1;
298 u16 node_id;
299 u32 length;
300 u64 range_address;
301 u64 range_length;
302 u8 num_power_states;
303 u8 num_physical_components;
304 u16 reserved2;
305};
306
307/* Values for Flags field above */
308
309#define ACPI_MPST_ENABLED 1
310#define ACPI_MPST_POWER_MANAGED 2
311#define ACPI_MPST_HOT_PLUG_CAPABLE 4
312
313/* Memory Power State Structure (follows POWER_NODE above) */
314
315struct acpi_mpst_power_state {
316 u8 power_state;
317 u8 info_index;
318};
319
320/* Physical Component ID Structure (follows POWER_STATE above) */
321
322struct acpi_mpst_component {
323 u16 component_id;
324};
325
326/* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
327
328struct acpi_mpst_data_hdr {
329 u16 characteristics_count;
330};
331
332struct acpi_mpst_power_data {
333 u8 revision;
334 u8 flags;
335 u16 reserved1;
336 u32 average_power;
337 u32 power_saving;
338 u64 exit_latency;
339 u64 reserved2;
340};
341
342/* Values for Flags field above */
343
344#define ACPI_MPST_PRESERVE 1
345#define ACPI_MPST_AUTOENTRY 2
346#define ACPI_MPST_AUTOEXIT 4
347
348/* Shared Memory Region (not part of an ACPI table) */
349
350struct acpi_mpst_shared {
351 u32 signature;
352 u16 pcc_command;
353 u16 pcc_status;
354 u16 command_register;
355 u16 status_register;
356 u16 power_state_id;
357 u16 power_node_id;
358 u64 energy_consumed;
359 u64 average_power;
360};
361
362/*******************************************************************************
363 *
364 * PCCT - Platform Communications Channel Table (ACPI 5.0)
365 * Version 1
366 *
367 ******************************************************************************/
368
369struct acpi_table_pcct {
370 struct acpi_table_header header; /* Common ACPI table header */
371 u32 flags;
372 u32 latency;
373 u32 reserved;
374};
375
376/* Values for Flags field above */
377
378#define ACPI_PCCT_DOORBELL 1
379
380/*
381 * PCCT subtables
382 */
383
384/* 0: Generic Communications Subspace */
385
386struct acpi_pcct_subspace {
387 struct acpi_subtable_header header;
388 u8 reserved[6];
389 u64 base_address;
390 u64 length;
391 struct acpi_generic_address doorbell_register;
392 u64 preserve_mask;
393 u64 write_mask;
394};
395
396/*
397 * PCC memory structures (not part of the ACPI table)
398 */
399
400/* Shared Memory Region */
401
402struct acpi_pcct_shared_memory {
403 u32 signature;
404 u16 command;
405 u16 status;
406};
407
408/*******************************************************************************
409 *
410 * PMTT - Platform Memory Topology Table (ACPI 5.0)
411 * Version 1
412 *
413 ******************************************************************************/
414
415struct acpi_table_pmtt {
416 struct acpi_table_header header; /* Common ACPI table header */
417 u32 reserved;
418};
419
420/* Common header for PMTT subtables that follow main table */
421
422struct acpi_pmtt_header {
423 u8 type;
424 u8 reserved1;
425 u16 length;
426 u16 flags;
427 u16 reserved2;
428};
429
430/* Values for Type field above */
431
432#define ACPI_PMTT_TYPE_SOCKET 0
433#define ACPI_PMTT_TYPE_CONTROLLER 1
434#define ACPI_PMTT_TYPE_DIMM 2
435#define ACPI_PMTT_TYPE_RESERVED 3 /* 0x03-0xFF are reserved */
436
437/* Values for Flags field above */
438
439#define ACPI_PMTT_TOP_LEVEL 0x0001
440#define ACPI_PMTT_PHYSICAL 0x0002
441#define ACPI_PMTT_MEMORY_TYPE 0x000C
442
443/*
444 * PMTT subtables, correspond to Type in struct acpi_pmtt_header
445 */
446
447/* 0: Socket Structure */
448
449struct acpi_pmtt_socket {
450 struct acpi_pmtt_header header;
451 u16 socket_id;
452 u16 reserved;
453};
454
455/* 1: Memory Controller subtable */
456
457struct acpi_pmtt_controller {
458 struct acpi_pmtt_header header;
459 u32 read_latency;
460 u32 write_latency;
461 u32 read_bandwidth;
462 u32 write_bandwidth;
463 u16 access_width;
464 u16 alignment;
465 u16 reserved;
466 u16 domain_count;
467};
468
469/* 1a: Proximity Domain substructure */
470
471struct acpi_pmtt_domain {
472 u32 proximity_domain;
473};
474
475/* 2: Physical Component Identifier (DIMM) */
476
477struct acpi_pmtt_physical_component {
478 struct acpi_pmtt_header header;
479 u16 component_id;
480 u16 reserved;
481 u32 memory_size;
482 u32 bios_handle;
483};
484
485/*******************************************************************************
486 *
487 * RASF - RAS Feature Table (ACPI 5.0)
488 * Version 1
489 *
490 ******************************************************************************/
491
492struct acpi_table_rasf {
493 struct acpi_table_header header; /* Common ACPI table header */
494 u8 channel_id[12];
495};
496
497/* RASF Platform Communication Channel Shared Memory Region */
498
499struct acpi_rasf_shared_memory {
500 u32 signature;
501 u16 command;
502 u16 status;
503 u64 requested_address;
504 u64 requested_length;
505 u64 actual_address;
506 u64 actual_length;
507 u16 flags;
508 u8 speed;
509};
510
511/* Masks for Flags and Speed fields above */
512
513#define ACPI_RASF_SCRUBBER_RUNNING 1
514#define ACPI_RASF_SPEED (7<<1)
515
516/* Channel Commands */
517
518enum acpi_rasf_commands {
519 ACPI_RASF_GET_RAS_CAPABILITIES = 1,
520 ACPI_RASF_GET_PATROL_PARAMETERS = 2,
521 ACPI_RASF_START_PATROL_SCRUBBER = 3,
522 ACPI_RASF_STOP_PATROL_SCRUBBER = 4
523};
524
525/* Channel Command flags */
526
527#define ACPI_RASF_GENERATE_SCI (1<<15)
528
529/* Status values */
530
531enum acpi_rasf_status {
532 ACPI_RASF_SUCCESS = 0,
533 ACPI_RASF_NOT_VALID = 1,
534 ACPI_RASF_NOT_SUPPORTED = 2,
535 ACPI_RASF_BUSY = 3,
536 ACPI_RASF_FAILED = 4,
537 ACPI_RASF_ABORTED = 5,
538 ACPI_RASF_INVALID_DATA = 6
539};
540
541/* Status flags */
542
543#define ACPI_RASF_COMMAND_COMPLETE (1)
544#define ACPI_RASF_SCI_DOORBELL (1<<1)
545#define ACPI_RASF_ERROR (1<<2)
546#define ACPI_RASF_STATUS (0x1F<<3)
547
548/* Reset to default packing */
549
550#pragma pack()
551
552#endif /* __ACTBL3_H__ */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index ed73f6705c86..d5dee7ce9474 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -712,8 +712,10 @@ typedef u8 acpi_adr_space_type;
712#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5 712#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5
713#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6 713#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6
714#define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7 714#define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7
715#define ACPI_ADR_SPACE_GPIO (acpi_adr_space_type) 8
716#define ACPI_ADR_SPACE_GSBUS (acpi_adr_space_type) 9
715 717
716#define ACPI_NUM_PREDEFINED_REGIONS 8 718#define ACPI_NUM_PREDEFINED_REGIONS 10
717 719
718/* 720/*
719 * Special Address Spaces 721 * Special Address Spaces
@@ -957,6 +959,14 @@ acpi_status(*acpi_adr_space_handler) (u32 function,
957 959
958#define ACPI_DEFAULT_HANDLER NULL 960#define ACPI_DEFAULT_HANDLER NULL
959 961
962/* Special Context data for generic_serial_bus/general_purpose_io (ACPI 5.0) */
963
964struct acpi_connection_info {
965 u8 *connection;
966 u16 length;
967 u8 access_length;
968};
969
960typedef 970typedef
961acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, 971acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
962 u32 function, 972 u32 function,
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 6001b4da39dd..26b75442ff7a 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -306,6 +306,11 @@ extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
306 u32 *mask, u32 req); 306 u32 *mask, u32 req);
307extern void acpi_early_init(void); 307extern void acpi_early_init(void);
308 308
309extern int acpi_nvs_register(__u64 start, __u64 size);
310
311extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
312 void *data);
313
309#else /* !CONFIG_ACPI */ 314#else /* !CONFIG_ACPI */
310 315
311#define acpi_disabled 1 316#define acpi_disabled 1
@@ -348,15 +353,18 @@ static inline int acpi_table_parse(char *id,
348{ 353{
349 return -1; 354 return -1;
350} 355}
351#endif /* !CONFIG_ACPI */
352 356
353#ifdef CONFIG_ACPI_SLEEP 357static inline int acpi_nvs_register(__u64 start, __u64 size)
354int suspend_nvs_register(unsigned long start, unsigned long size);
355#else
356static inline int suspend_nvs_register(unsigned long a, unsigned long b)
357{ 358{
358 return 0; 359 return 0;
359} 360}
360#endif 361
362static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
363 void *data)
364{
365 return 0;
366}
367
368#endif /* !CONFIG_ACPI */
361 369
362#endif /*_LINUX_ACPI_H*/ 370#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/acpi_io.h b/include/linux/acpi_io.h
index 4afd7102459d..b0ffa219993e 100644
--- a/include/linux/acpi_io.h
+++ b/include/linux/acpi_io.h
@@ -12,4 +12,7 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
12 12
13void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); 13void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
14 14
15int acpi_os_map_generic_address(struct acpi_generic_address *addr);
16void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
17
15#endif 18#endif
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 7408af843b8a..93df66ea794a 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -188,7 +188,14 @@ struct cpuidle_governor {
188extern int cpuidle_register_governor(struct cpuidle_governor *gov); 188extern int cpuidle_register_governor(struct cpuidle_governor *gov);
189extern void cpuidle_unregister_governor(struct cpuidle_governor *gov); 189extern void cpuidle_unregister_governor(struct cpuidle_governor *gov);
190 190
191#ifdef CONFIG_INTEL_IDLE
192extern int intel_idle_cpu_init(int cpu);
191#else 193#else
194static inline int intel_idle_cpu_init(int cpu) { return -1; }
195#endif
196
197#else
198static inline int intel_idle_cpu_init(int cpu) { return -1; }
192 199
193static inline int cpuidle_register_governor(struct cpuidle_governor *gov) 200static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
194{return 0;} 201{return 0;}
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 3c6f7808efae..310d3dd5e547 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -811,6 +811,8 @@ int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model)
811 case 0x2C: /* Westmere EP - Gulftown */ 811 case 0x2C: /* Westmere EP - Gulftown */
812 case 0x2A: /* SNB */ 812 case 0x2A: /* SNB */
813 case 0x2D: /* SNB Xeon */ 813 case 0x2D: /* SNB Xeon */
814 case 0x3A: /* IVB */
815 case 0x3D: /* IVB Xeon */
814 return 1; 816 return 1;
815 case 0x2E: /* Nehalem-EX Xeon - Beckton */ 817 case 0x2E: /* Nehalem-EX Xeon - Beckton */
816 case 0x2F: /* Westmere-EX Xeon - Eagleton */ 818 case 0x2F: /* Westmere-EX Xeon - Eagleton */