diff options
author | Len Brown <len.brown@intel.com> | 2011-03-23 02:34:54 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2011-03-23 02:34:54 -0400 |
commit | 02e2407858fd62053bf60349c0e72cd1c7a4a60e (patch) | |
tree | 0ebdbddc97d3abbc675916010e7771065b70c137 /drivers/acpi | |
parent | 96e1c408ea8a556c5b51e0e7d56bd2afbfbf5fe9 (diff) | |
parent | 6447f55da90b77faec1697d499ed7986bb4f6de6 (diff) |
Merge branch 'linus' into release
Conflicts:
arch/x86/kernel/acpi/sleep.c
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/Kconfig | 1 | ||||
-rw-r--r-- | drivers/acpi/apei/Kconfig | 1 | ||||
-rw-r--r-- | drivers/acpi/apei/erst.c | 136 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 23 | ||||
-rw-r--r-- | drivers/acpi/numa.c | 9 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 6 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 5 | ||||
-rw-r--r-- | drivers/acpi/video.c | 16 |
8 files changed, 170 insertions, 27 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 2aa042a5da6d..3a17ca5fff6f 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -7,7 +7,6 @@ menuconfig ACPI | |||
7 | depends on !IA64_HP_SIM | 7 | depends on !IA64_HP_SIM |
8 | depends on IA64 || X86 | 8 | depends on IA64 || X86 |
9 | depends on PCI | 9 | depends on PCI |
10 | depends on PM | ||
11 | select PNP | 10 | select PNP |
12 | default y | 11 | default y |
13 | help | 12 | help |
diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index 9ecf6feae830..66a03caa2ad9 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | config ACPI_APEI | 1 | config ACPI_APEI |
2 | bool "ACPI Platform Error Interface (APEI)" | 2 | bool "ACPI Platform Error Interface (APEI)" |
3 | select PSTORE | ||
3 | depends on X86 | 4 | depends on X86 |
4 | help | 5 | help |
5 | APEI allows to report errors (for example from the chipset) | 6 | APEI allows to report errors (for example from the chipset) |
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 8ff8c32fef58..d6cb0ff6988e 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/cper.h> | 34 | #include <linux/cper.h> |
35 | #include <linux/nmi.h> | 35 | #include <linux/nmi.h> |
36 | #include <linux/hardirq.h> | 36 | #include <linux/hardirq.h> |
37 | #include <linux/pstore.h> | ||
37 | #include <acpi/apei.h> | 38 | #include <acpi/apei.h> |
38 | 39 | ||
39 | #include "apei-internal.h" | 40 | #include "apei-internal.h" |
@@ -928,6 +929,128 @@ static int erst_check_table(struct acpi_table_erst *erst_tab) | |||
928 | return 0; | 929 | return 0; |
929 | } | 930 | } |
930 | 931 | ||
932 | static size_t erst_reader(u64 *id, enum pstore_type_id *type, | ||
933 | struct timespec *time); | ||
934 | static u64 erst_writer(enum pstore_type_id type, size_t size); | ||
935 | |||
936 | static struct pstore_info erst_info = { | ||
937 | .owner = THIS_MODULE, | ||
938 | .name = "erst", | ||
939 | .read = erst_reader, | ||
940 | .write = erst_writer, | ||
941 | .erase = erst_clear | ||
942 | }; | ||
943 | |||
944 | #define CPER_CREATOR_PSTORE \ | ||
945 | UUID_LE(0x75a574e3, 0x5052, 0x4b29, 0x8a, 0x8e, 0xbe, 0x2c, \ | ||
946 | 0x64, 0x90, 0xb8, 0x9d) | ||
947 | #define CPER_SECTION_TYPE_DMESG \ | ||
948 | UUID_LE(0xc197e04e, 0xd545, 0x4a70, 0x9c, 0x17, 0xa5, 0x54, \ | ||
949 | 0x94, 0x19, 0xeb, 0x12) | ||
950 | #define CPER_SECTION_TYPE_MCE \ | ||
951 | UUID_LE(0xfe08ffbe, 0x95e4, 0x4be7, 0xbc, 0x73, 0x40, 0x96, \ | ||
952 | 0x04, 0x4a, 0x38, 0xfc) | ||
953 | |||
954 | struct cper_pstore_record { | ||
955 | struct cper_record_header hdr; | ||
956 | struct cper_section_descriptor sec_hdr; | ||
957 | char data[]; | ||
958 | } __packed; | ||
959 | |||
960 | static size_t erst_reader(u64 *id, enum pstore_type_id *type, | ||
961 | struct timespec *time) | ||
962 | { | ||
963 | int rc; | ||
964 | ssize_t len; | ||
965 | unsigned long flags; | ||
966 | u64 record_id; | ||
967 | struct cper_pstore_record *rcd = (struct cper_pstore_record *) | ||
968 | (erst_info.buf - sizeof(*rcd)); | ||
969 | |||
970 | if (erst_disable) | ||
971 | return -ENODEV; | ||
972 | |||
973 | raw_spin_lock_irqsave(&erst_lock, flags); | ||
974 | skip: | ||
975 | rc = __erst_get_next_record_id(&record_id); | ||
976 | if (rc) { | ||
977 | raw_spin_unlock_irqrestore(&erst_lock, flags); | ||
978 | return rc; | ||
979 | } | ||
980 | /* no more record */ | ||
981 | if (record_id == APEI_ERST_INVALID_RECORD_ID) { | ||
982 | raw_spin_unlock_irqrestore(&erst_lock, flags); | ||
983 | return 0; | ||
984 | } | ||
985 | |||
986 | len = __erst_read(record_id, &rcd->hdr, sizeof(*rcd) + | ||
987 | erst_erange.size); | ||
988 | if (uuid_le_cmp(rcd->hdr.creator_id, CPER_CREATOR_PSTORE) != 0) | ||
989 | goto skip; | ||
990 | raw_spin_unlock_irqrestore(&erst_lock, flags); | ||
991 | |||
992 | *id = record_id; | ||
993 | if (uuid_le_cmp(rcd->sec_hdr.section_type, | ||
994 | CPER_SECTION_TYPE_DMESG) == 0) | ||
995 | *type = PSTORE_TYPE_DMESG; | ||
996 | else if (uuid_le_cmp(rcd->sec_hdr.section_type, | ||
997 | CPER_SECTION_TYPE_MCE) == 0) | ||
998 | *type = PSTORE_TYPE_MCE; | ||
999 | else | ||
1000 | *type = PSTORE_TYPE_UNKNOWN; | ||
1001 | |||
1002 | if (rcd->hdr.validation_bits & CPER_VALID_TIMESTAMP) | ||
1003 | time->tv_sec = rcd->hdr.timestamp; | ||
1004 | else | ||
1005 | time->tv_sec = 0; | ||
1006 | time->tv_nsec = 0; | ||
1007 | |||
1008 | return len - sizeof(*rcd); | ||
1009 | } | ||
1010 | |||
1011 | static u64 erst_writer(enum pstore_type_id type, size_t size) | ||
1012 | { | ||
1013 | struct cper_pstore_record *rcd = (struct cper_pstore_record *) | ||
1014 | (erst_info.buf - sizeof(*rcd)); | ||
1015 | |||
1016 | memset(rcd, 0, sizeof(*rcd)); | ||
1017 | memcpy(rcd->hdr.signature, CPER_SIG_RECORD, CPER_SIG_SIZE); | ||
1018 | rcd->hdr.revision = CPER_RECORD_REV; | ||
1019 | rcd->hdr.signature_end = CPER_SIG_END; | ||
1020 | rcd->hdr.section_count = 1; | ||
1021 | rcd->hdr.error_severity = CPER_SEV_FATAL; | ||
1022 | /* timestamp valid. platform_id, partition_id are invalid */ | ||
1023 | rcd->hdr.validation_bits = CPER_VALID_TIMESTAMP; | ||
1024 | rcd->hdr.timestamp = get_seconds(); | ||
1025 | rcd->hdr.record_length = sizeof(*rcd) + size; | ||
1026 | rcd->hdr.creator_id = CPER_CREATOR_PSTORE; | ||
1027 | rcd->hdr.notification_type = CPER_NOTIFY_MCE; | ||
1028 | rcd->hdr.record_id = cper_next_record_id(); | ||
1029 | rcd->hdr.flags = CPER_HW_ERROR_FLAGS_PREVERR; | ||
1030 | |||
1031 | rcd->sec_hdr.section_offset = sizeof(*rcd); | ||
1032 | rcd->sec_hdr.section_length = size; | ||
1033 | rcd->sec_hdr.revision = CPER_SEC_REV; | ||
1034 | /* fru_id and fru_text is invalid */ | ||
1035 | rcd->sec_hdr.validation_bits = 0; | ||
1036 | rcd->sec_hdr.flags = CPER_SEC_PRIMARY; | ||
1037 | switch (type) { | ||
1038 | case PSTORE_TYPE_DMESG: | ||
1039 | rcd->sec_hdr.section_type = CPER_SECTION_TYPE_DMESG; | ||
1040 | break; | ||
1041 | case PSTORE_TYPE_MCE: | ||
1042 | rcd->sec_hdr.section_type = CPER_SECTION_TYPE_MCE; | ||
1043 | break; | ||
1044 | default: | ||
1045 | return -EINVAL; | ||
1046 | } | ||
1047 | rcd->sec_hdr.section_severity = CPER_SEV_FATAL; | ||
1048 | |||
1049 | erst_write(&rcd->hdr); | ||
1050 | |||
1051 | return rcd->hdr.record_id; | ||
1052 | } | ||
1053 | |||
931 | static int __init erst_init(void) | 1054 | static int __init erst_init(void) |
932 | { | 1055 | { |
933 | int rc = 0; | 1056 | int rc = 0; |
@@ -935,6 +1058,7 @@ static int __init erst_init(void) | |||
935 | struct apei_exec_context ctx; | 1058 | struct apei_exec_context ctx; |
936 | struct apei_resources erst_resources; | 1059 | struct apei_resources erst_resources; |
937 | struct resource *r; | 1060 | struct resource *r; |
1061 | char *buf; | ||
938 | 1062 | ||
939 | if (acpi_disabled) | 1063 | if (acpi_disabled) |
940 | goto err; | 1064 | goto err; |
@@ -1001,6 +1125,18 @@ static int __init erst_init(void) | |||
1001 | if (!erst_erange.vaddr) | 1125 | if (!erst_erange.vaddr) |
1002 | goto err_release_erange; | 1126 | goto err_release_erange; |
1003 | 1127 | ||
1128 | buf = kmalloc(erst_erange.size, GFP_KERNEL); | ||
1129 | mutex_init(&erst_info.buf_mutex); | ||
1130 | if (buf) { | ||
1131 | erst_info.buf = buf + sizeof(struct cper_pstore_record); | ||
1132 | erst_info.bufsize = erst_erange.size - | ||
1133 | sizeof(struct cper_pstore_record); | ||
1134 | if (pstore_register(&erst_info)) { | ||
1135 | pr_info(ERST_PFX "Could not register with persistent store\n"); | ||
1136 | kfree(buf); | ||
1137 | } | ||
1138 | } | ||
1139 | |||
1004 | pr_info(ERST_PFX | 1140 | pr_info(ERST_PFX |
1005 | "Error Record Serialization Table (ERST) support is initialized.\n"); | 1141 | "Error Record Serialization Table (ERST) support is initialized.\n"); |
1006 | 1142 | ||
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 7ced61f39492..9749980ca6ca 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <acpi/acpi_bus.h> | 40 | #include <acpi/acpi_bus.h> |
41 | #include <acpi/acpi_drivers.h> | 41 | #include <acpi/acpi_drivers.h> |
42 | #include <linux/dmi.h> | 42 | #include <linux/dmi.h> |
43 | #include <linux/suspend.h> | ||
43 | 44 | ||
44 | #include "internal.h" | 45 | #include "internal.h" |
45 | 46 | ||
@@ -1006,8 +1007,7 @@ struct kobject *acpi_kobj; | |||
1006 | 1007 | ||
1007 | static int __init acpi_init(void) | 1008 | static int __init acpi_init(void) |
1008 | { | 1009 | { |
1009 | int result = 0; | 1010 | int result; |
1010 | |||
1011 | 1011 | ||
1012 | if (acpi_disabled) { | 1012 | if (acpi_disabled) { |
1013 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); | 1013 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); |
@@ -1022,29 +1022,18 @@ static int __init acpi_init(void) | |||
1022 | 1022 | ||
1023 | init_acpi_device_notify(); | 1023 | init_acpi_device_notify(); |
1024 | result = acpi_bus_init(); | 1024 | result = acpi_bus_init(); |
1025 | 1025 | if (result) { | |
1026 | if (!result) { | ||
1027 | pci_mmcfg_late_init(); | ||
1028 | if (!(pm_flags & PM_APM)) | ||
1029 | pm_flags |= PM_ACPI; | ||
1030 | else { | ||
1031 | printk(KERN_INFO PREFIX | ||
1032 | "APM is already active, exiting\n"); | ||
1033 | disable_acpi(); | ||
1034 | result = -ENODEV; | ||
1035 | } | ||
1036 | } else | ||
1037 | disable_acpi(); | 1026 | disable_acpi(); |
1038 | |||
1039 | if (acpi_disabled) | ||
1040 | return result; | 1027 | return result; |
1028 | } | ||
1041 | 1029 | ||
1030 | pci_mmcfg_late_init(); | ||
1042 | acpi_scan_init(); | 1031 | acpi_scan_init(); |
1043 | acpi_ec_init(); | 1032 | acpi_ec_init(); |
1044 | acpi_debugfs_init(); | 1033 | acpi_debugfs_init(); |
1045 | acpi_sleep_proc_init(); | 1034 | acpi_sleep_proc_init(); |
1046 | acpi_wakeup_device_init(); | 1035 | acpi_wakeup_device_init(); |
1047 | return result; | 1036 | return 0; |
1048 | } | 1037 | } |
1049 | 1038 | ||
1050 | subsys_initcall(acpi_init); | 1039 | subsys_initcall(acpi_init); |
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 5eb25eb3ea48..3b5c3189fd99 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
@@ -274,7 +274,7 @@ acpi_table_parse_srat(enum acpi_srat_type id, | |||
274 | 274 | ||
275 | int __init acpi_numa_init(void) | 275 | int __init acpi_numa_init(void) |
276 | { | 276 | { |
277 | int ret = 0; | 277 | int cnt = 0; |
278 | 278 | ||
279 | /* | 279 | /* |
280 | * Should not limit number with cpu num that is from NR_CPUS or nr_cpus= | 280 | * Should not limit number with cpu num that is from NR_CPUS or nr_cpus= |
@@ -288,7 +288,7 @@ int __init acpi_numa_init(void) | |||
288 | acpi_parse_x2apic_affinity, 0); | 288 | acpi_parse_x2apic_affinity, 0); |
289 | acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, | 289 | acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, |
290 | acpi_parse_processor_affinity, 0); | 290 | acpi_parse_processor_affinity, 0); |
291 | ret = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, | 291 | cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, |
292 | acpi_parse_memory_affinity, | 292 | acpi_parse_memory_affinity, |
293 | NR_NODE_MEMBLKS); | 293 | NR_NODE_MEMBLKS); |
294 | } | 294 | } |
@@ -297,7 +297,10 @@ int __init acpi_numa_init(void) | |||
297 | acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit); | 297 | acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit); |
298 | 298 | ||
299 | acpi_numa_arch_fixup(); | 299 | acpi_numa_arch_fixup(); |
300 | return ret; | 300 | |
301 | if (cnt <= 0) | ||
302 | return cnt ?: -ENOENT; | ||
303 | return 0; | ||
301 | } | 304 | } |
302 | 305 | ||
303 | int acpi_get_pxm(acpi_handle h) | 306 | int acpi_get_pxm(acpi_handle h) |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 45c6ac8790d7..45ad4ffef533 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -1608,9 +1608,9 @@ acpi_status __init acpi_os_initialize(void) | |||
1608 | 1608 | ||
1609 | acpi_status __init acpi_os_initialize1(void) | 1609 | acpi_status __init acpi_os_initialize1(void) |
1610 | { | 1610 | { |
1611 | kacpid_wq = create_workqueue("kacpid"); | 1611 | kacpid_wq = alloc_workqueue("kacpid", 0, 1); |
1612 | kacpi_notify_wq = create_workqueue("kacpi_notify"); | 1612 | kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1); |
1613 | kacpi_hotplug_wq = create_workqueue("kacpi_hotplug"); | 1613 | kacpi_hotplug_wq = alloc_workqueue("kacpi_hotplug", 0, 1); |
1614 | BUG_ON(!kacpid_wq); | 1614 | BUG_ON(!kacpid_wq); |
1615 | BUG_ON(!kacpi_notify_wq); | 1615 | BUG_ON(!kacpi_notify_wq); |
1616 | BUG_ON(!kacpi_hotplug_wq); | 1616 | BUG_ON(!kacpi_hotplug_wq); |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 84f57143ad7c..6c949602cbd1 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/suspend.h> | 17 | #include <linux/suspend.h> |
18 | #include <linux/reboot.h> | 18 | #include <linux/reboot.h> |
19 | #include <linux/acpi.h> | ||
19 | 20 | ||
20 | #include <asm/io.h> | 21 | #include <asm/io.h> |
21 | 22 | ||
@@ -567,7 +568,7 @@ int acpi_suspend(u32 acpi_state) | |||
567 | return -EINVAL; | 568 | return -EINVAL; |
568 | } | 569 | } |
569 | 570 | ||
570 | #ifdef CONFIG_PM_OPS | 571 | #ifdef CONFIG_PM |
571 | /** | 572 | /** |
572 | * acpi_pm_device_sleep_state - return preferred power state of ACPI device | 573 | * acpi_pm_device_sleep_state - return preferred power state of ACPI device |
573 | * in the system sleep state given by %acpi_target_sleep_state | 574 | * in the system sleep state given by %acpi_target_sleep_state |
@@ -653,7 +654,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p) | |||
653 | *d_min_p = d_min; | 654 | *d_min_p = d_min; |
654 | return d_max; | 655 | return d_max; |
655 | } | 656 | } |
656 | #endif /* CONFIG_PM_OPS */ | 657 | #endif /* CONFIG_PM */ |
657 | 658 | ||
658 | #ifdef CONFIG_PM_SLEEP | 659 | #ifdef CONFIG_PM_SLEEP |
659 | /** | 660 | /** |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 90f8f7676d1f..a18e497f1c3c 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -782,6 +782,9 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
782 | 782 | ||
783 | if (acpi_video_backlight_support()) { | 783 | if (acpi_video_backlight_support()) { |
784 | struct backlight_properties props; | 784 | struct backlight_properties props; |
785 | struct pci_dev *pdev; | ||
786 | acpi_handle acpi_parent; | ||
787 | struct device *parent = NULL; | ||
785 | int result; | 788 | int result; |
786 | static int count = 0; | 789 | static int count = 0; |
787 | char *name; | 790 | char *name; |
@@ -794,9 +797,20 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
794 | return; | 797 | return; |
795 | count++; | 798 | count++; |
796 | 799 | ||
800 | acpi_get_parent(device->dev->handle, &acpi_parent); | ||
801 | |||
802 | pdev = acpi_get_pci_dev(acpi_parent); | ||
803 | if (pdev) { | ||
804 | parent = &pdev->dev; | ||
805 | pci_dev_put(pdev); | ||
806 | } | ||
807 | |||
797 | memset(&props, 0, sizeof(struct backlight_properties)); | 808 | memset(&props, 0, sizeof(struct backlight_properties)); |
809 | props.type = BACKLIGHT_FIRMWARE; | ||
798 | props.max_brightness = device->brightness->count - 3; | 810 | props.max_brightness = device->brightness->count - 3; |
799 | device->backlight = backlight_device_register(name, NULL, device, | 811 | device->backlight = backlight_device_register(name, |
812 | parent, | ||
813 | device, | ||
800 | &acpi_backlight_ops, | 814 | &acpi_backlight_ops, |
801 | &props); | 815 | &props); |
802 | kfree(name); | 816 | kfree(name); |