aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/disk.c10
-rw-r--r--kernel/power/main.c26
2 files changed, 23 insertions, 13 deletions
</* * acpi.h - ACPI Interface * * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */#ifndef _LINUX_ACPI_H#define _LINUX_ACPI_H#include <linux/ioport.h>/* for struct resource */#ifdef CONFIG_ACPI#ifndef _LINUX#define _LINUX#endif#include <linux/list.h>#include <linux/mod_devicetable.h>#include <acpi/acpi.h>#include <acpi/acpi_bus.h>#include <acpi/acpi_drivers.h>#include <acpi/acpi_numa.h>#include <asm/acpi.h>enum acpi_irq_model_id { ACPI_IRQ_MODEL_PIC =0, ACPI_IRQ_MODEL_IOAPIC, ACPI_IRQ_MODEL_IOSAPIC, ACPI_IRQ_MODEL_PLATFORM, ACPI_IRQ_MODEL_COUNT };externenum acpi_irq_model_id acpi_irq_model;enum acpi_interrupt_id { ACPI_INTERRUPT_PMI =1, ACPI_INTERRUPT_INIT, ACPI_INTERRUPT_CPEI, ACPI_INTERRUPT_COUNT };#define ACPI_SPACE_MEM 0enum acpi_address_range_id { ACPI_ADDRESS_RANGE_MEMORY =1, ACPI_ADDRESS_RANGE_RESERVED =2, ACPI_ADDRESS_RANGE_ACPI =3, ACPI_ADDRESS_RANGE_NVS =4, ACPI_ADDRESS_RANGE_COUNT };/* Table Handlers */typedefint(*acpi_table_handler) (struct acpi_table_header *table);typedefint(*acpi_table_entry_handler) (struct acpi_subtable_header *header,const unsigned long end);char*__acpi_map_table(unsigned long phys_addr,unsigned long size);void__acpi_unmap_table(char*map,unsigned long size);intearly_acpi_boot_init(void);intacpi_boot_init(void);voidacpi_boot_table_init(void);intacpi_mps_check(void);intacpi_numa_init(void);intacpi_table_init(void);intacpi_table_parse(char*id, acpi_table_handler handler);int __init acpi_table_parse_entries(char*id,unsigned long table_size,int entry_id, acpi_table_entry_handler handler,unsigned int max_entries);intacpi_table_parse_madt(enum acpi_madt_type id, acpi_table_entry_handler handler,unsigned int max_entries);intacpi_parse_mcfg(struct acpi_table_header *header);voidacpi_table_print_madt_entry(struct acpi_subtable_header *madt);/* the following four functions are architecture-dependent */voidacpi_numa_slit_init(struct acpi_table_slit *slit);voidacpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa);voidacpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);voidacpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma);voidacpi_numa_arch_fixup(void);#ifdef CONFIG_ACPI_HOTPLUG_CPU/* Arch dependent functions for cpu hotplug support */intacpi_map_lsapic(acpi_handle handle,int*pcpu);intacpi_unmap_lsapic(int cpu);#endif/* CONFIG_ACPI_HOTPLUG_CPU */intacpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);intacpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);voidacpi_irq_stats_init(void);extern u32 acpi_irq_handled;extern u32 acpi_irq_not_handled;externint sbf_port;externunsigned long acpi_realmode_flags;intacpi_register_gsi(struct device *dev, u32 gsi,int triggering,int polarity);intacpi_gsi_to_irq(u32 gsi,unsigned int*irq);intacpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi);#ifdef CONFIG_X86_IO_APICexternintacpi_get_override_irq(u32 gsi,int*trigger,int*polarity);#else#define acpi_get_override_irq(gsi, trigger, polarity) (-1)#endif/* * This function undoes the effect of one call to acpi_register_gsi(). * If this matches the last registration, any IRQ resources for gsi * are freed. */voidacpi_unregister_gsi(u32 gsi);struct pci_dev;intacpi_pci_irq_enable(struct pci_dev *dev);voidacpi_penalize_isa_irq(int irq,int active);voidacpi_pci_irq_disable(struct pci_dev *dev);struct acpi_pci_driver {struct acpi_pci_driver *next;int(*add)(acpi_handle handle);void(*remove)(acpi_handle handle);};intacpi_pci_register_driver(struct acpi_pci_driver *driver);voidacpi_pci_unregister_driver(struct acpi_pci_driver *driver);externintec_read(u8 addr, u8 *val);externintec_write(u8 addr, u8 val);externintec_transaction(u8 command,const u8 *wdata,unsigned wdata_len, u8 *rdata,unsigned rdata_len,int force_poll);#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE)typedefvoid(*wmi_notify_handler) (u32 value,void*context);extern acpi_status wmi_evaluate_method(const char*guid, u8 instance, u32 method_id,const struct acpi_buffer *in,struct acpi_buffer *out);extern acpi_status wmi_query_block(const char*guid, u8 instance,struct acpi_buffer *out);extern acpi_status wmi_set_block(const char*guid, u8 instance,const struct acpi_buffer *in);extern acpi_status wmi_install_notify_handler(const char*guid, wmi_notify_handler handler,void*data);extern acpi_status wmi_remove_notify_handler(const char*guid);extern acpi_status wmi_get_event_data(u32 event,struct acpi_buffer *out);externboolwmi_has_guid(const char*guid);#endif/* CONFIG_ACPI_WMI */#define ACPI_VIDEO_OUTPUT_SWITCHING 0x0001#define ACPI_VIDEO_DEVICE_POSTING 0x0002#define ACPI_VIDEO_ROM_AVAILABLE 0x0004#define ACPI_VIDEO_BACKLIGHT 0x0008#define ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR 0x0010#define ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO 0x0020#define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR 0x0040#define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO 0x0080#define ACPI_VIDEO_BACKLIGHT_DMI_VENDOR 0x0100#define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)externlongacpi_video_get_capabilities(acpi_handle graphics_dev_handle);externlongacpi_is_video_device(struct acpi_device *device);externintacpi_video_backlight_support(void);externintacpi_video_display_switch_support(void);#elsestaticinlinelongacpi_video_get_capabilities(acpi_handle graphics_dev_handle){return0;}staticinlinelongacpi_is_video_device(struct acpi_device *device){return0;}staticinlineintacpi_video_backlight_support(void){return0;}staticinlineintacpi_video_display_switch_support(void){return0;}#endif/* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */externintacpi_blacklisted(void);externvoidacpi_dmi_osi_linux(int enable,const struct dmi_system_id *d);externintacpi_osi_setup(char*str);#ifdef CONFIG_ACPI_NUMAintacpi_get_pxm(acpi_handle handle);intacpi_get_node(acpi_handle *handle);#elsestaticinlineintacpi_get_pxm(acpi_handle handle){return0;}staticinlineintacpi_get_node(acpi_handle *handle){return0;}#endifexternintacpi_paddr_to_node(u64 start_addr, u64 size);externint pnpacpi_disabled;#define PXM_INVAL (-1)#define NID_INVAL (-1)intacpi_check_resource_conflict(const struct resource *res);intacpi_check_region(resource_size_t start, resource_size_t n,const char*name);intacpi_check_mem_region(resource_size_t start, resource_size_t n,const char*name);intacpi_resources_are_enforced(void);#ifdef CONFIG_PM_SLEEPvoid __init acpi_no_s4_hw_signature(void);void __init acpi_old_suspend_ordering(void);void __init acpi_nvs_nosave(void);#endif/* CONFIG_PM_SLEEP */struct acpi_osc_context {char*uuid_str;/* uuid string */int rev;struct acpi_buffer cap;/* arg2/arg3 */struct acpi_buffer ret;/* free by caller if success */};#define OSC_QUERY_TYPE 0#define OSC_SUPPORT_TYPE 1#define OSC_CONTROL_TYPE 2/* _OSC DW0 Definition */#define OSC_QUERY_ENABLE 1#define OSC_REQUEST_ERROR 2#define OSC_INVALID_UUID_ERROR 4#define OSC_INVALID_REVISION_ERROR 8#define OSC_CAPABILITIES_MASK_ERROR 16 acpi_status acpi_run_osc(acpi_handle handle,struct acpi_osc_context *context);/* platform-wide _OSC bits */#define OSC_SB_PAD_SUPPORT 1#define OSC_SB_PPC_OST_SUPPORT 2#define OSC_SB_PR3_SUPPORT 4#define OSC_SB_CPUHP_OST_SUPPORT 8#define OSC_SB_APEI_SUPPORT 16/* PCI defined _OSC bits *//* _OSC DW1 Definition (OS Support Fields) */#define OSC_EXT_PCI_CONFIG_SUPPORT 1#define OSC_ACTIVE_STATE_PWR_SUPPORT 2#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8#define OSC_MSI_SUPPORT 16#define OSC_PCI_SUPPORT_MASKS 0x1f/* _OSC DW1 Definition (OS Control Fields) */#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1#define OSC_SHPC_NATIVE_HP_CONTROL 2#define OSC_PCI_EXPRESS_PME_CONTROL 4#define OSC_PCI_EXPRESS_AER_CONTROL 8#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16#define OSC_PCI_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \ OSC_SHPC_NATIVE_HP_CONTROL | \ OSC_PCI_EXPRESS_PME_CONTROL | \ OSC_PCI_EXPRESS_AER_CONTROL | \ OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req);externvoidacpi_early_init(void);#else/* !CONFIG_ACPI */#define acpi_disabled 1staticinlinevoidacpi_early_init(void) { }staticinlineintearly_acpi_boot_init(void){return0;}staticinlineintacpi_boot_init(void){return0;}staticinlinevoidacpi_boot_table_init(void){return;}staticinlineintacpi_mps_check(void){return0;}staticinlineintacpi_check_resource_conflict(struct resource *res){return0;}staticinlineintacpi_check_region(resource_size_t start, resource_size_t n,const char*name){return0;}staticinlineintacpi_check_mem_region(resource_size_t start, resource_size_t n,const char*name){return0;}struct acpi_table_header;staticinlineintacpi_table_parse(char*id,int(*handler)(struct acpi_table_header *)){return-1;}#endif/* !CONFIG_ACPI */#endif/*_LINUX_ACPI_H*/
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 45e8541ab7e3..432ee575c9ee 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -71,6 +71,14 @@ void hibernation_set_ops(struct platform_hibernation_ops *ops)
71 mutex_unlock(&pm_mutex); 71 mutex_unlock(&pm_mutex);
72} 72}
73 73
74static bool entering_platform_hibernation;
75
76bool system_entering_hibernation(void)
77{
78 return entering_platform_hibernation;
79}
80EXPORT_SYMBOL(system_entering_hibernation);
81
74#ifdef CONFIG_PM_DEBUG 82#ifdef CONFIG_PM_DEBUG
75static void hibernation_debug_sleep(void) 83static void hibernation_debug_sleep(void)
76{ 84{
@@ -411,6 +419,7 @@ int hibernation_platform_enter(void)
411 if (error) 419 if (error)
412 goto Close; 420 goto Close;
413 421
422 entering_platform_hibernation = true;
414 suspend_console(); 423 suspend_console();
415 error = device_suspend(PMSG_HIBERNATE); 424 error = device_suspend(PMSG_HIBERNATE);
416 if (error) { 425 if (error) {
@@ -445,6 +454,7 @@ int hibernation_platform_enter(void)
445 Finish: 454 Finish:
446 hibernation_ops->finish(); 455 hibernation_ops->finish();
447 Resume_devices: 456 Resume_devices:
457 entering_platform_hibernation = false;
448 device_resume(PMSG_RESTORE); 458 device_resume(PMSG_RESTORE);
449 resume_console(); 459 resume_console();
450 Close: 460 Close:
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 239988873971..b4d219016b6c 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -57,16 +57,6 @@ int pm_notifier_call_chain(unsigned long val)
57#ifdef CONFIG_PM_DEBUG 57#ifdef CONFIG_PM_DEBUG
58int pm_test_level = TEST_NONE; 58int pm_test_level = TEST_NONE;
59 59
60static int suspend_test(int level)
61{
62 if (pm_test_level == level) {
63 printk(KERN_INFO "suspend debug: Waiting for 5 seconds.\n");
64 mdelay(5000);
65 return 1;
66 }
67 return 0;
68}
69
70static const char * const pm_tests[__TEST_AFTER_LAST] = { 60static const char * const pm_tests[__TEST_AFTER_LAST] = {