aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpica/acconfig.h2
-rw-r--r--drivers/acpi/acpica/evxface.c1
-rw-r--r--drivers/acpi/acpica/evxfevnt.c1
-rw-r--r--drivers/acpi/acpica/evxfgpe.c1
-rw-r--r--drivers/acpi/acpica/evxfregn.c1
-rw-r--r--drivers/acpi/acpica/hwregs.c11
-rw-r--r--drivers/acpi/acpica/hwsleep.c1
-rw-r--r--drivers/acpi/acpica/hwtimer.c1
-rw-r--r--drivers/acpi/acpica/hwxface.c1
-rw-r--r--drivers/acpi/acpica/nsxfeval.c1
-rw-r--r--drivers/acpi/acpica/nsxfname.c1
-rw-r--r--drivers/acpi/acpica/nsxfobj.c1
-rw-r--r--drivers/acpi/acpica/rsxface.c1
-rw-r--r--drivers/acpi/acpica/tbxface.c1
-rw-r--r--drivers/acpi/acpica/utdebug.c1
-rw-r--r--drivers/acpi/acpica/utdecode.c1
-rw-r--r--drivers/acpi/acpica/utglobal.c1
-rw-r--r--drivers/acpi/acpica/utxface.c1
-rw-r--r--drivers/acpi/acpica/utxferror.c1
-rw-r--r--drivers/acpi/apei/Kconfig2
-rw-r--r--drivers/acpi/apei/apei-base.c2
-rw-r--r--drivers/acpi/apei/erst.c12
-rw-r--r--drivers/acpi/apei/ghes.c22
-rw-r--r--drivers/acpi/atomicio.c4
-rw-r--r--drivers/acpi/blacklist.c1
-rw-r--r--drivers/acpi/bus.c8
-rw-r--r--drivers/acpi/debugfs.c1
-rw-r--r--drivers/acpi/ec_sys.c1
-rw-r--r--drivers/acpi/event.c1
-rw-r--r--drivers/acpi/glue.c1
-rw-r--r--drivers/acpi/osl.c3
-rw-r--r--drivers/acpi/proc.c1
-rw-r--r--drivers/acpi/processor_core.c1
-rw-r--r--drivers/acpi/processor_driver.c20
-rw-r--r--drivers/acpi/processor_idle.c266
-rw-r--r--drivers/acpi/sbshc.c1
-rw-r--r--drivers/acpi/scan.c3
-rw-r--r--drivers/acpi/sleep.c32
-rw-r--r--drivers/acpi/sysfs.c14
-rw-r--r--drivers/acpi/video_detect.c1
40 files changed, 304 insertions, 123 deletions
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h
index bc533dde16c4..f895a244ca7e 100644
--- a/drivers/acpi/acpica/acconfig.h
+++ b/drivers/acpi/acpica/acconfig.h
@@ -121,7 +121,7 @@
121 121
122/* Maximum sleep allowed via Sleep() operator */ 122/* Maximum sleep allowed via Sleep() operator */
123 123
124#define ACPI_MAX_SLEEP 20000 /* Two seconds */ 124#define ACPI_MAX_SLEEP 2000 /* Two seconds */
125 125
126/****************************************************************************** 126/******************************************************************************
127 * 127 *
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c
index e1141402dbed..f4f523bf5939 100644
--- a/drivers/acpi/acpica/evxface.c
+++ b/drivers/acpi/acpica/evxface.c
@@ -41,6 +41,7 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/export.h>
44#include <acpi/acpi.h> 45#include <acpi/acpi.h>
45#include "accommon.h" 46#include "accommon.h"
46#include "acnamesp.h" 47#include "acnamesp.h"
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index c57b5c707a77..20516e599476 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -41,6 +41,7 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/export.h>
44#include <acpi/acpi.h> 45#include <acpi/acpi.h>
45#include "accommon.h" 46#include "accommon.h"
46#include "actables.h" 47#include "actables.h"
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c
index 52aaff3df562..f06a3ee356ba 100644
--- a/drivers/acpi/acpica/evxfgpe.c
+++ b/drivers/acpi/acpica/evxfgpe.c
@@ -41,6 +41,7 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/export.h>
44#include <acpi/acpi.h> 45#include <acpi/acpi.h>
45#include "accommon.h" 46#include "accommon.h"
46#include "acevents.h" 47#include "acevents.h"
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c
index 00cd95692a91..aee887e3ca5c 100644
--- a/drivers/acpi/acpica/evxfregn.c
+++ b/drivers/acpi/acpica/evxfregn.c
@@ -42,6 +42,7 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45#include <linux/export.h>
45#include <acpi/acpi.h> 46#include <acpi/acpi.h>
46#include "accommon.h" 47#include "accommon.h"
47#include "acnamesp.h" 48#include "acnamesp.h"
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 55accb7018bb..cc70f3fdcdd1 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -269,16 +269,17 @@ acpi_status acpi_hw_clear_acpi_status(void)
269 269
270 status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, 270 status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
271 ACPI_BITMASK_ALL_FIXED_STATUS); 271 ACPI_BITMASK_ALL_FIXED_STATUS);
272 if (ACPI_FAILURE(status)) { 272
273 goto unlock_and_exit; 273 acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
274 } 274
275 if (ACPI_FAILURE(status))
276 goto exit;
275 277
276 /* Clear the GPE Bits in all GPE registers in all GPE blocks */ 278 /* Clear the GPE Bits in all GPE registers in all GPE blocks */
277 279
278 status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL); 280 status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL);
279 281
280 unlock_and_exit: 282exit:
281 acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
282 return_ACPI_STATUS(status); 283 return_ACPI_STATUS(status);
283} 284}
284 285
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 2ac28bbe8827..d52da3073650 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -46,6 +46,7 @@
46#include "accommon.h" 46#include "accommon.h"
47#include "actables.h" 47#include "actables.h"
48#include <linux/tboot.h> 48#include <linux/tboot.h>
49#include <linux/module.h>
49 50
50#define _COMPONENT ACPI_HARDWARE 51#define _COMPONENT ACPI_HARDWARE
51ACPI_MODULE_NAME("hwsleep") 52ACPI_MODULE_NAME("hwsleep")
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c
index 9c8eb71a12fb..50d21c40b5c1 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -42,6 +42,7 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45#include <linux/export.h>
45#include <acpi/acpi.h> 46#include <acpi/acpi.h>
46#include "accommon.h" 47#include "accommon.h"
47 48
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index f75f81ad15c9..c2793a82f120 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -42,6 +42,7 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45#include <linux/export.h>
45#include <acpi/acpi.h> 46#include <acpi/acpi.h>
46#include "accommon.h" 47#include "accommon.h"
47#include "acnamesp.h" 48#include "acnamesp.h"
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index c53f0040e490..e7f016d1b226 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -42,6 +42,7 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45#include <linux/export.h>
45#include <acpi/acpi.h> 46#include <acpi/acpi.h>
46#include "accommon.h" 47#include "accommon.h"
47#include "acnamesp.h" 48#include "acnamesp.h"
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index 3fd4526f3dba..83bf93024303 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -42,6 +42,7 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45#include <linux/export.h>
45#include <acpi/acpi.h> 46#include <acpi/acpi.h>
46#include "accommon.h" 47#include "accommon.h"
47#include "acnamesp.h" 48#include "acnamesp.h"
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c
index db7660f8b869..57e6d825ed84 100644
--- a/drivers/acpi/acpica/nsxfobj.c
+++ b/drivers/acpi/acpica/nsxfobj.c
@@ -42,6 +42,7 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45#include <linux/export.h>
45#include <acpi/acpi.h> 46#include <acpi/acpi.h>
46#include "accommon.h" 47#include "accommon.h"
47#include "acnamesp.h" 48#include "acnamesp.h"
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c
index 2ff657a28f26..fe86b37b16ce 100644
--- a/drivers/acpi/acpica/rsxface.c
+++ b/drivers/acpi/acpica/rsxface.c
@@ -41,6 +41,7 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/export.h>
44#include <acpi/acpi.h> 45#include <acpi/acpi.h>
45#include "accommon.h" 46#include "accommon.h"
46#include "acresrc.h" 47#include "acresrc.h"
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 4b7085dfc683..e7d13f5d3f2d 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -42,6 +42,7 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45#include <linux/export.h>
45#include <acpi/acpi.h> 46#include <acpi/acpi.h>
46#include "accommon.h" 47#include "accommon.h"
47#include "acnamesp.h" 48#include "acnamesp.h"
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index a9bcd816dc29..a1f8d7509e66 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -41,6 +41,7 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/export.h>
44#include <acpi/acpi.h> 45#include <acpi/acpi.h>
45#include "accommon.h" 46#include "accommon.h"
46 47
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index 97cb36f85ce9..8b087e2d64f4 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -41,6 +41,7 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/export.h>
44#include <acpi/acpi.h> 45#include <acpi/acpi.h>
45#include "accommon.h" 46#include "accommon.h"
46#include "acnamesp.h" 47#include "acnamesp.h"
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index 833a38a9c905..ffba0a39c3e8 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -43,6 +43,7 @@
43 43
44#define DEFINE_ACPI_GLOBALS 44#define DEFINE_ACPI_GLOBALS
45 45
46#include <linux/export.h>
46#include <acpi/acpi.h> 47#include <acpi/acpi.h>
47#include "accommon.h" 48#include "accommon.h"
48 49
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index 98ad125e14ff..420ebfe08c72 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -41,6 +41,7 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/export.h>
44#include <acpi/acpi.h> 45#include <acpi/acpi.h>
45#include "accommon.h" 46#include "accommon.h"
46#include "acevents.h" 47#include "acevents.h"
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index 916ae097c43c..8d0245ec4315 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -41,6 +41,7 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/export.h>
44#include <acpi/acpi.h> 45#include <acpi/acpi.h>
45#include "accommon.h" 46#include "accommon.h"
46#include "acnamesp.h" 47#include "acnamesp.h"
diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig
index c34aa51af4ee..f0c1ce95a0ec 100644
--- a/drivers/acpi/apei/Kconfig
+++ b/drivers/acpi/apei/Kconfig
@@ -13,7 +13,7 @@ config ACPI_APEI_GHES
13 bool "APEI Generic Hardware Error Source" 13 bool "APEI Generic Hardware Error Source"
14 depends on ACPI_APEI && X86 14 depends on ACPI_APEI && X86
15 select ACPI_HED 15 select ACPI_HED
16 select LLIST 16 select IRQ_WORK
17 select GENERIC_ALLOCATOR 17 select GENERIC_ALLOCATOR
18 help 18 help
19 Generic Hardware Error Source provides a way to report 19 Generic Hardware Error Source provides a way to report
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 8041248fce9b..61540360d5ce 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -618,7 +618,7 @@ int apei_osc_setup(void)
618 }; 618 };
619 619
620 capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; 620 capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE;
621 capbuf[OSC_SUPPORT_TYPE] = 0; 621 capbuf[OSC_SUPPORT_TYPE] = 1;
622 capbuf[OSC_CONTROL_TYPE] = 0; 622 capbuf[OSC_CONTROL_TYPE] = 0;
623 623
624 if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)) 624 if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 2ca59dc69f7f..127408069ca7 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -933,7 +933,7 @@ static int erst_open_pstore(struct pstore_info *psi);
933static int erst_close_pstore(struct pstore_info *psi); 933static int erst_close_pstore(struct pstore_info *psi);
934static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, 934static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
935 struct timespec *time, struct pstore_info *psi); 935 struct timespec *time, struct pstore_info *psi);
936static u64 erst_writer(enum pstore_type_id type, unsigned int part, 936static int erst_writer(enum pstore_type_id type, u64 *id, unsigned int part,
937 size_t size, struct pstore_info *psi); 937 size_t size, struct pstore_info *psi);
938static int erst_clearer(enum pstore_type_id type, u64 id, 938static int erst_clearer(enum pstore_type_id type, u64 id,
939 struct pstore_info *psi); 939 struct pstore_info *psi);
@@ -1040,11 +1040,12 @@ out:
1040 return (rc < 0) ? rc : (len - sizeof(*rcd)); 1040 return (rc < 0) ? rc : (len - sizeof(*rcd));
1041} 1041}
1042 1042
1043static u64 erst_writer(enum pstore_type_id type, unsigned int part, 1043static int erst_writer(enum pstore_type_id type, u64 *id, unsigned int part,
1044 size_t size, struct pstore_info *psi) 1044 size_t size, struct pstore_info *psi)
1045{ 1045{
1046 struct cper_pstore_record *rcd = (struct cper_pstore_record *) 1046 struct cper_pstore_record *rcd = (struct cper_pstore_record *)
1047 (erst_info.buf - sizeof(*rcd)); 1047 (erst_info.buf - sizeof(*rcd));
1048 int ret;
1048 1049
1049 memset(rcd, 0, sizeof(*rcd)); 1050 memset(rcd, 0, sizeof(*rcd));
1050 memcpy(rcd->hdr.signature, CPER_SIG_RECORD, CPER_SIG_SIZE); 1051 memcpy(rcd->hdr.signature, CPER_SIG_RECORD, CPER_SIG_SIZE);
@@ -1079,9 +1080,10 @@ static u64 erst_writer(enum pstore_type_id type, unsigned int part,
1079 } 1080 }
1080 rcd->sec_hdr.section_severity = CPER_SEV_FATAL; 1081 rcd->sec_hdr.section_severity = CPER_SEV_FATAL;
1081 1082
1082 erst_write(&rcd->hdr); 1083 ret = erst_write(&rcd->hdr);
1084 *id = rcd->hdr.record_id;
1083 1085
1084 return rcd->hdr.record_id; 1086 return ret;
1085} 1087}
1086 1088
1087static int erst_clearer(enum pstore_type_id type, u64 id, 1089static int erst_clearer(enum pstore_type_id type, u64 id,
@@ -1165,7 +1167,7 @@ static int __init erst_init(void)
1165 goto err_release_erange; 1167 goto err_release_erange;
1166 1168
1167 buf = kmalloc(erst_erange.size, GFP_KERNEL); 1169 buf = kmalloc(erst_erange.size, GFP_KERNEL);
1168 mutex_init(&erst_info.buf_mutex); 1170 spin_lock_init(&erst_info.buf_lock);
1169 if (buf) { 1171 if (buf) {
1170 erst_info.buf = buf + sizeof(struct cper_pstore_record); 1172 erst_info.buf = buf + sizeof(struct cper_pstore_record);
1171 erst_info.bufsize = erst_erange.size - 1173 erst_info.bufsize = erst_erange.size -
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 0784f99a4665..b8e08cb67a18 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -50,6 +50,7 @@
50#include <acpi/hed.h> 50#include <acpi/hed.h>
51#include <asm/mce.h> 51#include <asm/mce.h>
52#include <asm/tlbflush.h> 52#include <asm/tlbflush.h>
53#include <asm/nmi.h>
53 54
54#include "apei-internal.h" 55#include "apei-internal.h"
55 56
@@ -749,15 +750,11 @@ static void ghes_proc_in_irq(struct irq_work *irq_work)
749 } 750 }
750} 751}
751 752
752static int ghes_notify_nmi(struct notifier_block *this, 753static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs)
753 unsigned long cmd, void *data)
754{ 754{
755 struct ghes *ghes, *ghes_global = NULL; 755 struct ghes *ghes, *ghes_global = NULL;
756 int sev, sev_global = -1; 756 int sev, sev_global = -1;
757 int ret = NOTIFY_DONE; 757 int ret = NMI_DONE;
758
759 if (cmd != DIE_NMI)
760 return ret;
761 758
762 raw_spin_lock(&ghes_nmi_lock); 759 raw_spin_lock(&ghes_nmi_lock);
763 list_for_each_entry_rcu(ghes, &ghes_nmi, list) { 760 list_for_each_entry_rcu(ghes, &ghes_nmi, list) {
@@ -770,10 +767,10 @@ static int ghes_notify_nmi(struct notifier_block *this,
770 sev_global = sev; 767 sev_global = sev;
771 ghes_global = ghes; 768 ghes_global = ghes;
772 } 769 }
773 ret = NOTIFY_STOP; 770 ret = NMI_HANDLED;
774 } 771 }
775 772
776 if (ret == NOTIFY_DONE) 773 if (ret == NMI_DONE)
777 goto out; 774 goto out;
778 775
779 if (sev_global >= GHES_SEV_PANIC) { 776 if (sev_global >= GHES_SEV_PANIC) {
@@ -825,10 +822,6 @@ static struct notifier_block ghes_notifier_sci = {
825 .notifier_call = ghes_notify_sci, 822 .notifier_call = ghes_notify_sci,
826}; 823};
827 824
828static struct notifier_block ghes_notifier_nmi = {
829 .notifier_call = ghes_notify_nmi,
830};
831
832static unsigned long ghes_esource_prealloc_size( 825static unsigned long ghes_esource_prealloc_size(
833 const struct acpi_hest_generic *generic) 826 const struct acpi_hest_generic *generic)
834{ 827{
@@ -918,7 +911,8 @@ static int __devinit ghes_probe(struct platform_device *ghes_dev)
918 ghes_estatus_pool_expand(len); 911 ghes_estatus_pool_expand(len);
919 mutex_lock(&ghes_list_mutex); 912 mutex_lock(&ghes_list_mutex);
920 if (list_empty(&ghes_nmi)) 913 if (list_empty(&ghes_nmi))
921 register_die_notifier(&ghes_notifier_nmi); 914 register_nmi_handler(NMI_LOCAL, ghes_notify_nmi, 0,
915 "ghes");
922 list_add_rcu(&ghes->list, &ghes_nmi); 916 list_add_rcu(&ghes->list, &ghes_nmi);
923 mutex_unlock(&ghes_list_mutex); 917 mutex_unlock(&ghes_list_mutex);
924 break; 918 break;
@@ -964,7 +958,7 @@ static int __devexit ghes_remove(struct platform_device *ghes_dev)
964 mutex_lock(&ghes_list_mutex); 958 mutex_lock(&ghes_list_mutex);
965 list_del_rcu(&ghes->list); 959 list_del_rcu(&ghes->list);
966 if (list_empty(&ghes_nmi)) 960 if (list_empty(&ghes_nmi))
967 unregister_die_notifier(&ghes_notifier_nmi); 961 unregister_nmi_handler(NMI_LOCAL, "ghes");
968 mutex_unlock(&ghes_list_mutex); 962 mutex_unlock(&ghes_list_mutex);
969 /* 963 /*
970 * To synchronize with NMI handler, ghes can only be 964 * To synchronize with NMI handler, ghes can only be
diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c
index 7489b89c300f..cfc0cc10af39 100644
--- a/drivers/acpi/atomicio.c
+++ b/drivers/acpi/atomicio.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/module.h> 27#include <linux/export.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/acpi.h> 29#include <linux/acpi.h>
30#include <linux/io.h> 30#include <linux/io.h>
@@ -76,7 +76,7 @@ static void __iomem *__acpi_ioremap_fast(phys_addr_t paddr,
76{ 76{
77 struct acpi_iomap *map; 77 struct acpi_iomap *map;
78 78
79 map = __acpi_find_iomap(paddr, size); 79 map = __acpi_find_iomap(paddr, size/8);
80 if (map) 80 if (map)
81 return map->vaddr + (paddr - map->paddr); 81 return map->vaddr + (paddr - map->paddr);
82 else 82 else
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
index af308d03f492..cb9629638def 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -28,7 +28,6 @@
28 */ 28 */
29 29
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/module.h>
32#include <linux/init.h> 31#include <linux/init.h>
33#include <linux/acpi.h> 32#include <linux/acpi.h>
34#include <acpi/acpi_bus.h> 33#include <acpi/acpi_bus.h>
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 437ddbf0c49a..9ecec98bc76e 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -911,10 +911,7 @@ void __init acpi_early_init(void)
911 } 911 }
912#endif 912#endif
913 913
914 status = 914 status = acpi_enable_subsystem(~ACPI_NO_ACPI_ENABLE);
915 acpi_enable_subsystem(~
916 (ACPI_NO_HARDWARE_INIT |
917 ACPI_NO_ACPI_ENABLE));
918 if (ACPI_FAILURE(status)) { 915 if (ACPI_FAILURE(status)) {
919 printk(KERN_ERR PREFIX "Unable to enable ACPI\n"); 916 printk(KERN_ERR PREFIX "Unable to enable ACPI\n");
920 goto error0; 917 goto error0;
@@ -935,8 +932,7 @@ static int __init acpi_bus_init(void)
935 932
936 acpi_os_initialize1(); 933 acpi_os_initialize1();
937 934
938 status = 935 status = acpi_enable_subsystem(ACPI_NO_ACPI_ENABLE);
939 acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
940 if (ACPI_FAILURE(status)) { 936 if (ACPI_FAILURE(status)) {
941 printk(KERN_ERR PREFIX 937 printk(KERN_ERR PREFIX
942 "Unable to start the ACPI Interpreter\n"); 938 "Unable to start the ACPI Interpreter\n");
diff --git a/drivers/acpi/debugfs.c b/drivers/acpi/debugfs.c
index 182a9fc36355..b55d6a20dc0e 100644
--- a/drivers/acpi/debugfs.c
+++ b/drivers/acpi/debugfs.c
@@ -2,6 +2,7 @@
2 * debugfs.c - ACPI debugfs interface to userspace. 2 * debugfs.c - ACPI debugfs interface to userspace.
3 */ 3 */
4 4
5#include <linux/export.h>
5#include <linux/init.h> 6#include <linux/init.h>
6#include <linux/debugfs.h> 7#include <linux/debugfs.h>
7#include <acpi/acpi_drivers.h> 8#include <acpi/acpi_drivers.h>
diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
index 22f918bacd35..6c47ae9793a7 100644
--- a/drivers/acpi/ec_sys.c
+++ b/drivers/acpi/ec_sys.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/acpi.h> 12#include <linux/acpi.h>
13#include <linux/debugfs.h> 13#include <linux/debugfs.h>
14#include <linux/module.h>
14#include "internal.h" 15#include "internal.h"
15 16
16MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>"); 17MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>");
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c
index 85d908993809..1442737cedec 100644
--- a/drivers/acpi/event.c
+++ b/drivers/acpi/event.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <linux/export.h>
10#include <linux/proc_fs.h> 11#include <linux/proc_fs.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/poll.h> 13#include <linux/poll.h>
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 7c47ed55e528..29a4a5c8ee00 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -6,6 +6,7 @@
6 * 6 *
7 * This file is released under the GPLv2. 7 * This file is released under the GPLv2.
8 */ 8 */
9#include <linux/export.h>
9#include <linux/init.h> 10#include <linux/init.h>
10#include <linux/list.h> 11#include <linux/list.h>
11#include <linux/device.h> 12#include <linux/device.h>
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index fa32f584229f..f31c5c5f1b7e 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -80,7 +80,8 @@ static acpi_osd_handler acpi_irq_handler;
80static void *acpi_irq_context; 80static void *acpi_irq_context;
81static struct workqueue_struct *kacpid_wq; 81static struct workqueue_struct *kacpid_wq;
82static struct workqueue_struct *kacpi_notify_wq; 82static struct workqueue_struct *kacpi_notify_wq;
83static struct workqueue_struct *kacpi_hotplug_wq; 83struct workqueue_struct *kacpi_hotplug_wq;
84EXPORT_SYMBOL(kacpi_hotplug_wq);
84 85
85struct acpi_res_list { 86struct acpi_res_list {
86 resource_size_t start; 87 resource_size_t start;
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index f5f986991b52..251c7b6273a9 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
@@ -1,5 +1,6 @@
1#include <linux/proc_fs.h> 1#include <linux/proc_fs.h>
2#include <linux/seq_file.h> 2#include <linux/seq_file.h>
3#include <linux/export.h>
3#include <linux/suspend.h> 4#include <linux/suspend.h>
4#include <linux/bcd.h> 5#include <linux/bcd.h>
5#include <asm/uaccess.h> 6#include <asm/uaccess.h>
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 02d2a4c9084d..3a0428e8435c 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -7,6 +7,7 @@
7 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> 7 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
8 * - Added _PDC for platforms with Intel CPUs 8 * - Added _PDC for platforms with Intel CPUs
9 */ 9 */
10#include <linux/export.h>
10#include <linux/dmi.h> 11#include <linux/dmi.h>
11#include <linux/slab.h> 12#include <linux/slab.h>
12 13
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index a4e0f1ba6040..9d7bc9f6b6cc 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -426,7 +426,7 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
426 426
427 if (action == CPU_ONLINE && pr) { 427 if (action == CPU_ONLINE && pr) {
428 acpi_processor_ppc_has_changed(pr, 0); 428 acpi_processor_ppc_has_changed(pr, 0);
429 acpi_processor_cst_has_changed(pr); 429 acpi_processor_hotplug(pr);
430 acpi_processor_reevaluate_tstate(pr, action); 430 acpi_processor_reevaluate_tstate(pr, action);
431 acpi_processor_tstate_has_changed(pr); 431 acpi_processor_tstate_has_changed(pr);
432 } 432 }
@@ -503,8 +503,7 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
503 acpi_processor_get_throttling_info(pr); 503 acpi_processor_get_throttling_info(pr);
504 acpi_processor_get_limit_info(pr); 504 acpi_processor_get_limit_info(pr);
505 505
506 506 if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver)
507 if (cpuidle_get_driver() == &acpi_idle_driver)
508 acpi_processor_power_init(pr, device); 507 acpi_processor_power_init(pr, device);
509 508
510 pr->cdev = thermal_cooling_device_register("Processor", device, 509 pr->cdev = thermal_cooling_device_register("Processor", device,
@@ -800,17 +799,9 @@ static int __init acpi_processor_init(void)
800 799
801 memset(&errata, 0, sizeof(errata)); 800 memset(&errata, 0, sizeof(errata));
802 801
803 if (!cpuidle_register_driver(&acpi_idle_driver)) {
804 printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n",
805 acpi_idle_driver.name);
806 } else {
807 printk(KERN_DEBUG "ACPI: acpi_idle yielding to %s\n",
808 cpuidle_get_driver()->name);
809 }
810
811 result = acpi_bus_register_driver(&acpi_processor_driver); 802 result = acpi_bus_register_driver(&acpi_processor_driver);
812 if (result < 0) 803 if (result < 0)
813 goto out_cpuidle; 804 return result;
814 805
815 acpi_processor_install_hotplug_notify(); 806 acpi_processor_install_hotplug_notify();
816 807
@@ -821,11 +812,6 @@ static int __init acpi_processor_init(void)
821 acpi_processor_throttling_init(); 812 acpi_processor_throttling_init();
822 813
823 return 0; 814 return 0;
824
825out_cpuidle:
826 cpuidle_unregister_driver(&acpi_idle_driver);
827
828 return result;
829} 815}
830 816
831static void __exit acpi_processor_exit(void) 817static void __exit acpi_processor_exit(void)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 431ab11c8c1b..0e8e2de2ed3e 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -37,7 +37,7 @@
37#include <linux/dmi.h> 37#include <linux/dmi.h>
38#include <linux/moduleparam.h> 38#include <linux/moduleparam.h>
39#include <linux/sched.h> /* need_resched() */ 39#include <linux/sched.h> /* need_resched() */
40#include <linux/pm_qos_params.h> 40#include <linux/pm_qos.h>
41#include <linux/clockchips.h> 41#include <linux/clockchips.h>
42#include <linux/cpuidle.h> 42#include <linux/cpuidle.h>
43#include <linux/irqflags.h> 43#include <linux/irqflags.h>
@@ -224,7 +224,6 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr,
224/* 224/*
225 * Suspend / resume control 225 * Suspend / resume control
226 */ 226 */
227static int acpi_idle_suspend;
228static u32 saved_bm_rld; 227static u32 saved_bm_rld;
229 228
230static void acpi_idle_bm_rld_save(void) 229static void acpi_idle_bm_rld_save(void)
@@ -243,21 +242,13 @@ static void acpi_idle_bm_rld_restore(void)
243 242
244int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) 243int acpi_processor_suspend(struct acpi_device * device, pm_message_t state)
245{ 244{
246 if (acpi_idle_suspend == 1)
247 return 0;
248
249 acpi_idle_bm_rld_save(); 245 acpi_idle_bm_rld_save();
250 acpi_idle_suspend = 1;
251 return 0; 246 return 0;
252} 247}
253 248
254int acpi_processor_resume(struct acpi_device * device) 249int acpi_processor_resume(struct acpi_device * device)
255{ 250{
256 if (acpi_idle_suspend == 0)
257 return 0;
258
259 acpi_idle_bm_rld_restore(); 251 acpi_idle_bm_rld_restore();
260 acpi_idle_suspend = 0;
261 return 0; 252 return 0;
262} 253}
263 254
@@ -741,66 +732,65 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
741/** 732/**
742 * acpi_idle_enter_c1 - enters an ACPI C1 state-type 733 * acpi_idle_enter_c1 - enters an ACPI C1 state-type
743 * @dev: the target CPU 734 * @dev: the target CPU
744 * @state: the state data 735 * @drv: cpuidle driver containing cpuidle state info
736 * @index: index of target state
745 * 737 *
746 * This is equivalent to the HALT instruction. 738 * This is equivalent to the HALT instruction.
747 */ 739 */
748static int acpi_idle_enter_c1(struct cpuidle_device *dev, 740static int acpi_idle_enter_c1(struct cpuidle_device *dev,
749 struct cpuidle_state *state) 741 struct cpuidle_driver *drv, int index)
750{ 742{
751 ktime_t kt1, kt2; 743 ktime_t kt1, kt2;
752 s64 idle_time; 744 s64 idle_time;
753 struct acpi_processor *pr; 745 struct acpi_processor *pr;
754 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 746 struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
747 struct acpi_processor_cx *cx = cpuidle_get_statedata(state_usage);
755 748
756 pr = __this_cpu_read(processors); 749 pr = __this_cpu_read(processors);
750 dev->last_residency = 0;
757 751
758 if (unlikely(!pr)) 752 if (unlikely(!pr))
759 return 0; 753 return -EINVAL;
760 754
761 local_irq_disable(); 755 local_irq_disable();
762 756
763 /* Do not access any ACPI IO ports in suspend path */
764 if (acpi_idle_suspend) {
765 local_irq_enable();
766 cpu_relax();
767 return 0;
768 }
769
770 lapic_timer_state_broadcast(pr, cx, 1); 757 lapic_timer_state_broadcast(pr, cx, 1);
771 kt1 = ktime_get_real(); 758 kt1 = ktime_get_real();
772 acpi_idle_do_entry(cx); 759 acpi_idle_do_entry(cx);
773 kt2 = ktime_get_real(); 760 kt2 = ktime_get_real();
774 idle_time = ktime_to_us(ktime_sub(kt2, kt1)); 761 idle_time = ktime_to_us(ktime_sub(kt2, kt1));
775 762
763 /* Update device last_residency*/
764 dev->last_residency = (int)idle_time;
765
776 local_irq_enable(); 766 local_irq_enable();
777 cx->usage++; 767 cx->usage++;
778 lapic_timer_state_broadcast(pr, cx, 0); 768 lapic_timer_state_broadcast(pr, cx, 0);
779 769
780 return idle_time; 770 return index;
781} 771}
782 772
783/** 773/**
784 * acpi_idle_enter_simple - enters an ACPI state without BM handling 774 * acpi_idle_enter_simple - enters an ACPI state without BM handling
785 * @dev: the target CPU 775 * @dev: the target CPU
786 * @state: the state data 776 * @drv: cpuidle driver with cpuidle state information
777 * @index: the index of suggested state
787 */ 778 */
788static int acpi_idle_enter_simple(struct cpuidle_device *dev, 779static int acpi_idle_enter_simple(struct cpuidle_device *dev,
789 struct cpuidle_state *state) 780 struct cpuidle_driver *drv, int index)
790{ 781{
791 struct acpi_processor *pr; 782 struct acpi_processor *pr;
792 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 783 struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
784 struct acpi_processor_cx *cx = cpuidle_get_statedata(state_usage);
793 ktime_t kt1, kt2; 785 ktime_t kt1, kt2;
794 s64 idle_time_ns; 786 s64 idle_time_ns;
795 s64 idle_time; 787 s64 idle_time;
796 788
797 pr = __this_cpu_read(processors); 789 pr = __this_cpu_read(processors);
790 dev->last_residency = 0;
798 791
799 if (unlikely(!pr)) 792 if (unlikely(!pr))
800 return 0; 793 return -EINVAL;
801
802 if (acpi_idle_suspend)
803 return(acpi_idle_enter_c1(dev, state));
804 794
805 local_irq_disable(); 795 local_irq_disable();
806 796
@@ -815,7 +805,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
815 if (unlikely(need_resched())) { 805 if (unlikely(need_resched())) {
816 current_thread_info()->status |= TS_POLLING; 806 current_thread_info()->status |= TS_POLLING;
817 local_irq_enable(); 807 local_irq_enable();
818 return 0; 808 return -EINVAL;
819 } 809 }
820 } 810 }
821 811
@@ -837,6 +827,9 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
837 idle_time = idle_time_ns; 827 idle_time = idle_time_ns;
838 do_div(idle_time, NSEC_PER_USEC); 828 do_div(idle_time, NSEC_PER_USEC);
839 829
830 /* Update device last_residency*/
831 dev->last_residency = (int)idle_time;
832
840 /* Tell the scheduler how much we idled: */ 833 /* Tell the scheduler how much we idled: */
841 sched_clock_idle_wakeup_event(idle_time_ns); 834 sched_clock_idle_wakeup_event(idle_time_ns);
842 835
@@ -848,46 +841,46 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
848 841
849 lapic_timer_state_broadcast(pr, cx, 0); 842 lapic_timer_state_broadcast(pr, cx, 0);
850 cx->time += idle_time; 843 cx->time += idle_time;
851 return idle_time; 844 return index;
852} 845}
853 846
854static int c3_cpu_count; 847static int c3_cpu_count;
855static DEFINE_SPINLOCK(c3_lock); 848static DEFINE_RAW_SPINLOCK(c3_lock);
856 849
857/** 850/**
858 * acpi_idle_enter_bm - enters C3 with proper BM handling 851 * acpi_idle_enter_bm - enters C3 with proper BM handling
859 * @dev: the target CPU 852 * @dev: the target CPU
860 * @state: the state data 853 * @drv: cpuidle driver containing state data
854 * @index: the index of suggested state
861 * 855 *
862 * If BM is detected, the deepest non-C3 idle state is entered instead. 856 * If BM is detected, the deepest non-C3 idle state is entered instead.
863 */ 857 */
864static int acpi_idle_enter_bm(struct cpuidle_device *dev, 858static int acpi_idle_enter_bm(struct cpuidle_device *dev,
865 struct cpuidle_state *state) 859 struct cpuidle_driver *drv, int index)
866{ 860{
867 struct acpi_processor *pr; 861 struct acpi_processor *pr;
868 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 862 struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
863 struct acpi_processor_cx *cx = cpuidle_get_statedata(state_usage);
869 ktime_t kt1, kt2; 864 ktime_t kt1, kt2;
870 s64 idle_time_ns; 865 s64 idle_time_ns;
871 s64 idle_time; 866 s64 idle_time;
872 867
873 868
874 pr = __this_cpu_read(processors); 869 pr = __this_cpu_read(processors);
870 dev->last_residency = 0;
875 871
876 if (unlikely(!pr)) 872 if (unlikely(!pr))
877 return 0; 873 return -EINVAL;
878
879 if (acpi_idle_suspend)
880 return(acpi_idle_enter_c1(dev, state));
881 874
882 if (!cx->bm_sts_skip && acpi_idle_bm_check()) { 875 if (!cx->bm_sts_skip && acpi_idle_bm_check()) {
883 if (dev->safe_state) { 876 if (drv->safe_state_index >= 0) {
884 dev->last_state = dev->safe_state; 877 return drv->states[drv->safe_state_index].enter(dev,
885 return dev->safe_state->enter(dev, dev->safe_state); 878 drv, drv->safe_state_index);
886 } else { 879 } else {
887 local_irq_disable(); 880 local_irq_disable();
888 acpi_safe_halt(); 881 acpi_safe_halt();
889 local_irq_enable(); 882 local_irq_enable();
890 return 0; 883 return -EINVAL;
891 } 884 }
892 } 885 }
893 886
@@ -904,7 +897,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
904 if (unlikely(need_resched())) { 897 if (unlikely(need_resched())) {
905 current_thread_info()->status |= TS_POLLING; 898 current_thread_info()->status |= TS_POLLING;
906 local_irq_enable(); 899 local_irq_enable();
907 return 0; 900 return -EINVAL;
908 } 901 }
909 } 902 }
910 903
@@ -930,12 +923,12 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
930 * without doing anything. 923 * without doing anything.
931 */ 924 */
932 if (pr->flags.bm_check && pr->flags.bm_control) { 925 if (pr->flags.bm_check && pr->flags.bm_control) {
933 spin_lock(&c3_lock); 926 raw_spin_lock(&c3_lock);
934 c3_cpu_count++; 927 c3_cpu_count++;
935 /* Disable bus master arbitration when all CPUs are in C3 */ 928 /* Disable bus master arbitration when all CPUs are in C3 */
936 if (c3_cpu_count == num_online_cpus()) 929 if (c3_cpu_count == num_online_cpus())
937 acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1); 930 acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1);
938 spin_unlock(&c3_lock); 931 raw_spin_unlock(&c3_lock);
939 } else if (!pr->flags.bm_check) { 932 } else if (!pr->flags.bm_check) {
940 ACPI_FLUSH_CPU_CACHE(); 933 ACPI_FLUSH_CPU_CACHE();
941 } 934 }
@@ -944,16 +937,19 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
944 937
945 /* Re-enable bus master arbitration */ 938 /* Re-enable bus master arbitration */
946 if (pr->flags.bm_check && pr->flags.bm_control) { 939 if (pr->flags.bm_check && pr->flags.bm_control) {
947 spin_lock(&c3_lock); 940 raw_spin_lock(&c3_lock);
948 acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0); 941 acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0);
949 c3_cpu_count--; 942 c3_cpu_count--;
950 spin_unlock(&c3_lock); 943 raw_spin_unlock(&c3_lock);
951 } 944 }
952 kt2 = ktime_get_real(); 945 kt2 = ktime_get_real();
953 idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1)); 946 idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
954 idle_time = idle_time_ns; 947 idle_time = idle_time_ns;
955 do_div(idle_time, NSEC_PER_USEC); 948 do_div(idle_time, NSEC_PER_USEC);
956 949
950 /* Update device last_residency*/
951 dev->last_residency = (int)idle_time;
952
957 /* Tell the scheduler how much we idled: */ 953 /* Tell the scheduler how much we idled: */
958 sched_clock_idle_wakeup_event(idle_time_ns); 954 sched_clock_idle_wakeup_event(idle_time_ns);
959 955
@@ -965,7 +961,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
965 961
966 lapic_timer_state_broadcast(pr, cx, 0); 962 lapic_timer_state_broadcast(pr, cx, 0);
967 cx->time += idle_time; 963 cx->time += idle_time;
968 return idle_time; 964 return index;
969} 965}
970 966
971struct cpuidle_driver acpi_idle_driver = { 967struct cpuidle_driver acpi_idle_driver = {
@@ -974,14 +970,16 @@ struct cpuidle_driver acpi_idle_driver = {
974}; 970};
975 971
976/** 972/**
977 * acpi_processor_setup_cpuidle - prepares and configures CPUIDLE 973 * acpi_processor_setup_cpuidle_cx - prepares and configures CPUIDLE
974 * device i.e. per-cpu data
975 *
978 * @pr: the ACPI processor 976 * @pr: the ACPI processor
979 */ 977 */
980static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) 978static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr)
981{ 979{
982 int i, count = CPUIDLE_DRIVER_STATE_START; 980 int i, count = CPUIDLE_DRIVER_STATE_START;
983 struct acpi_processor_cx *cx; 981 struct acpi_processor_cx *cx;
984 struct cpuidle_state *state; 982 struct cpuidle_state_usage *state_usage;
985 struct cpuidle_device *dev = &pr->power.dev; 983 struct cpuidle_device *dev = &pr->power.dev;
986 984
987 if (!pr->flags.power_setup_done) 985 if (!pr->flags.power_setup_done)
@@ -992,9 +990,62 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
992 } 990 }
993 991
994 dev->cpu = pr->id; 992 dev->cpu = pr->id;
993
994 if (max_cstate == 0)
995 max_cstate = 1;
996
997 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
998 cx = &pr->power.states[i];
999 state_usage = &dev->states_usage[count];
1000
1001 if (!cx->valid)
1002 continue;
1003
1004#ifdef CONFIG_HOTPLUG_CPU
1005 if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
1006 !pr->flags.has_cst &&
1007 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
1008 continue;
1009#endif
1010
1011 cpuidle_set_statedata(state_usage, cx);
1012
1013 count++;
1014 if (count == CPUIDLE_STATE_MAX)
1015 break;
1016 }
1017
1018 dev->state_count = count;
1019
1020 if (!count)
1021 return -EINVAL;
1022
1023 return 0;
1024}
1025
1026/**
1027 * acpi_processor_setup_cpuidle states- prepares and configures cpuidle
1028 * global state data i.e. idle routines
1029 *
1030 * @pr: the ACPI processor
1031 */
1032static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
1033{
1034 int i, count = CPUIDLE_DRIVER_STATE_START;
1035 struct acpi_processor_cx *cx;
1036 struct cpuidle_state *state;
1037 struct cpuidle_driver *drv = &acpi_idle_driver;
1038
1039 if (!pr->flags.power_setup_done)
1040 return -EINVAL;
1041
1042 if (pr->flags.power == 0)
1043 return -EINVAL;
1044
1045 drv->safe_state_index = -1;
995 for (i = 0; i < CPUIDLE_STATE_MAX; i++) { 1046 for (i = 0; i < CPUIDLE_STATE_MAX; i++) {
996 dev->states[i].name[0] = '\0'; 1047 drv->states[i].name[0] = '\0';
997 dev->states[i].desc[0] = '\0'; 1048 drv->states[i].desc[0] = '\0';
998 } 1049 }
999 1050
1000 if (max_cstate == 0) 1051 if (max_cstate == 0)
@@ -1002,7 +1053,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1002 1053
1003 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { 1054 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
1004 cx = &pr->power.states[i]; 1055 cx = &pr->power.states[i];
1005 state = &dev->states[count];
1006 1056
1007 if (!cx->valid) 1057 if (!cx->valid)
1008 continue; 1058 continue;
@@ -1013,8 +1063,8 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1013 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) 1063 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
1014 continue; 1064 continue;
1015#endif 1065#endif
1016 cpuidle_set_statedata(state, cx);
1017 1066
1067 state = &drv->states[count];
1018 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i); 1068 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);
1019 strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); 1069 strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
1020 state->exit_latency = cx->latency; 1070 state->exit_latency = cx->latency;
@@ -1027,13 +1077,13 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1027 state->flags |= CPUIDLE_FLAG_TIME_VALID; 1077 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1028 1078
1029 state->enter = acpi_idle_enter_c1; 1079 state->enter = acpi_idle_enter_c1;
1030 dev->safe_state = state; 1080 drv->safe_state_index = count;
1031 break; 1081 break;
1032 1082
1033 case ACPI_STATE_C2: 1083 case ACPI_STATE_C2:
1034 state->flags |= CPUIDLE_FLAG_TIME_VALID; 1084 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1035 state->enter = acpi_idle_enter_simple; 1085 state->enter = acpi_idle_enter_simple;
1036 dev->safe_state = state; 1086 drv->safe_state_index = count;
1037 break; 1087 break;
1038 1088
1039 case ACPI_STATE_C3: 1089 case ACPI_STATE_C3:
@@ -1049,7 +1099,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1049 break; 1099 break;
1050 } 1100 }
1051 1101
1052 dev->state_count = count; 1102 drv->state_count = count;
1053 1103
1054 if (!count) 1104 if (!count)
1055 return -EINVAL; 1105 return -EINVAL;
@@ -1057,7 +1107,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1057 return 0; 1107 return 0;
1058} 1108}
1059 1109
1060int acpi_processor_cst_has_changed(struct acpi_processor *pr) 1110int acpi_processor_hotplug(struct acpi_processor *pr)
1061{ 1111{
1062 int ret = 0; 1112 int ret = 0;
1063 1113
@@ -1078,7 +1128,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1078 cpuidle_disable_device(&pr->power.dev); 1128 cpuidle_disable_device(&pr->power.dev);
1079 acpi_processor_get_power_info(pr); 1129 acpi_processor_get_power_info(pr);
1080 if (pr->flags.power) { 1130 if (pr->flags.power) {
1081 acpi_processor_setup_cpuidle(pr); 1131 acpi_processor_setup_cpuidle_cx(pr);
1082 ret = cpuidle_enable_device(&pr->power.dev); 1132 ret = cpuidle_enable_device(&pr->power.dev);
1083 } 1133 }
1084 cpuidle_resume_and_unlock(); 1134 cpuidle_resume_and_unlock();
@@ -1086,10 +1136,72 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1086 return ret; 1136 return ret;
1087} 1137}
1088 1138
1139int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1140{
1141 int cpu;
1142 struct acpi_processor *_pr;
1143
1144 if (disabled_by_idle_boot_param())
1145 return 0;
1146
1147 if (!pr)
1148 return -EINVAL;
1149
1150 if (nocst)
1151 return -ENODEV;
1152
1153 if (!pr->flags.power_setup_done)
1154 return -ENODEV;
1155
1156 /*
1157 * FIXME: Design the ACPI notification to make it once per
1158 * system instead of once per-cpu. This condition is a hack
1159 * to make the code that updates C-States be called once.
1160 */
1161
1162 if (smp_processor_id() == 0 &&
1163 cpuidle_get_driver() == &acpi_idle_driver) {
1164
1165 cpuidle_pause_and_lock();
1166 /* Protect against cpu-hotplug */
1167 get_online_cpus();
1168
1169 /* Disable all cpuidle devices */
1170 for_each_online_cpu(cpu) {
1171 _pr = per_cpu(processors, cpu);
1172 if (!_pr || !_pr->flags.power_setup_done)
1173 continue;
1174 cpuidle_disable_device(&_pr->power.dev);
1175 }
1176
1177 /* Populate Updated C-state information */
1178 acpi_processor_setup_cpuidle_states(pr);
1179
1180 /* Enable all cpuidle devices */
1181 for_each_online_cpu(cpu) {
1182 _pr = per_cpu(processors, cpu);
1183 if (!_pr || !_pr->flags.power_setup_done)
1184 continue;
1185 acpi_processor_get_power_info(_pr);
1186 if (_pr->flags.power) {
1187 acpi_processor_setup_cpuidle_cx(_pr);
1188 cpuidle_enable_device(&_pr->power.dev);
1189 }
1190 }
1191 put_online_cpus();
1192 cpuidle_resume_and_unlock();
1193 }
1194
1195 return 0;
1196}
1197
1198static int acpi_processor_registered;
1199
1089int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, 1200int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1090 struct acpi_device *device) 1201 struct acpi_device *device)
1091{ 1202{
1092 acpi_status status = 0; 1203 acpi_status status = 0;
1204 int retval;
1093 static int first_run; 1205 static int first_run;
1094 1206
1095 if (disabled_by_idle_boot_param()) 1207 if (disabled_by_idle_boot_param())
@@ -1126,9 +1238,26 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1126 * platforms that only support C1. 1238 * platforms that only support C1.
1127 */ 1239 */
1128 if (pr->flags.power) { 1240 if (pr->flags.power) {
1129 acpi_processor_setup_cpuidle(pr); 1241 /* Register acpi_idle_driver if not already registered */
1130 if (cpuidle_register_device(&pr->power.dev)) 1242 if (!acpi_processor_registered) {
1131 return -EIO; 1243 acpi_processor_setup_cpuidle_states(pr);
1244 retval = cpuidle_register_driver(&acpi_idle_driver);
1245 if (retval)
1246 return retval;
1247 printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n",
1248 acpi_idle_driver.name);
1249 }
1250 /* Register per-cpu cpuidle_device. Cpuidle driver
1251 * must already be registered before registering device
1252 */
1253 acpi_processor_setup_cpuidle_cx(pr);
1254 retval = cpuidle_register_device(&pr->power.dev);
1255 if (retval) {
1256 if (acpi_processor_registered == 0)
1257 cpuidle_unregister_driver(&acpi_idle_driver);
1258 return retval;
1259 }
1260 acpi_processor_registered++;
1132 } 1261 }
1133 return 0; 1262 return 0;
1134} 1263}
@@ -1139,8 +1268,13 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
1139 if (disabled_by_idle_boot_param()) 1268 if (disabled_by_idle_boot_param())
1140 return 0; 1269 return 0;
1141 1270
1142 cpuidle_unregister_device(&pr->power.dev); 1271 if (pr->flags.power) {
1143 pr->flags.power_setup_done = 0; 1272 cpuidle_unregister_device(&pr->power.dev);
1273 acpi_processor_registered--;
1274 if (acpi_processor_registered == 0)
1275 cpuidle_unregister_driver(&acpi_idle_driver);
1276 }
1144 1277
1278 pr->flags.power_setup_done = 0;
1145 return 0; 1279 return 0;
1146} 1280}
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c
index f8be23b6c129..f8d2a472795c 100644
--- a/drivers/acpi/sbshc.c
+++ b/drivers/acpi/sbshc.c
@@ -13,6 +13,7 @@
13#include <linux/wait.h> 13#include <linux/wait.h>
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/module.h>
16#include <linux/interrupt.h> 17#include <linux/interrupt.h>
17#include "sbshc.h" 18#include "sbshc.h"
18 19
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 449c556274c0..8ab80bafe3f1 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1062,13 +1062,12 @@ static void acpi_add_id(struct acpi_device *device, const char *dev_id)
1062 if (!id) 1062 if (!id)
1063 return; 1063 return;
1064 1064
1065 id->id = kmalloc(strlen(dev_id) + 1, GFP_KERNEL); 1065 id->id = kstrdup(dev_id, GFP_KERNEL);
1066 if (!id->id) { 1066 if (!id->id) {
1067 kfree(id); 1067 kfree(id);
1068 return; 1068 return;
1069 } 1069 }
1070 1070
1071 strcpy(id->id, dev_id);
1072 list_add_tail(&id->list, &device->pnp.ids); 1071 list_add_tail(&id->list, &device->pnp.ids);
1073} 1072}
1074 1073
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 3ed80b2ca907..6d9a3ab58db2 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -390,6 +390,22 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
390 }, 390 },
391 { 391 {
392 .callback = init_nvs_nosave, 392 .callback = init_nvs_nosave,
393 .ident = "Sony Vaio VGN-FW21E",
394 .matches = {
395 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
396 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW21E"),
397 },
398 },
399 {
400 .callback = init_nvs_nosave,
401 .ident = "Sony Vaio VPCEB17FX",
402 .matches = {
403 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
404 DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB17FX"),
405 },
406 },
407 {
408 .callback = init_nvs_nosave,
393 .ident = "Sony Vaio VGN-SR11M", 409 .ident = "Sony Vaio VGN-SR11M",
394 .matches = { 410 .matches = {
395 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 411 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
@@ -444,6 +460,22 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
444 DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI Premium"), 460 DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI Premium"),
445 }, 461 },
446 }, 462 },
463 {
464 .callback = init_nvs_nosave,
465 .ident = "Sony Vaio VGN-SR26GN_P",
466 .matches = {
467 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
468 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR26GN_P"),
469 },
470 },
471 {
472 .callback = init_nvs_nosave,
473 .ident = "Sony Vaio VGN-FW520F",
474 .matches = {
475 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
476 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW520F"),
477 },
478 },
447 {}, 479 {},
448}; 480};
449#endif /* CONFIG_SUSPEND */ 481#endif /* CONFIG_SUSPEND */
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index c538d0ef10ff..9f66181c814e 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -706,11 +706,23 @@ static void __exit interrupt_stats_exit(void)
706 return; 706 return;
707} 707}
708 708
709static ssize_t
710acpi_show_profile(struct device *dev, struct device_attribute *attr,
711 char *buf)
712{
713 return sprintf(buf, "%d\n", acpi_gbl_FADT.preferred_profile);
714}
715
716static const struct device_attribute pm_profile_attr =
717 __ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL);
718
709int __init acpi_sysfs_init(void) 719int __init acpi_sysfs_init(void)
710{ 720{
711 int result; 721 int result;
712 722
713 result = acpi_tables_sysfs_init(); 723 result = acpi_tables_sysfs_init();
714 724 if (result)
725 return result;
726 result = sysfs_create_file(acpi_kobj, &pm_profile_attr.attr);
715 return result; 727 return result;
716} 728}
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index 5af3479714f6..f3f0fe7e255a 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -33,6 +33,7 @@
33 * 33 *
34 */ 34 */
35 35
36#include <linux/export.h>
36#include <linux/acpi.h> 37#include <linux/acpi.h>
37#include <linux/dmi.h> 38#include <linux/dmi.h>
38#include <linux/pci.h> 39#include <linux/pci.h>