diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/acpi/acpi.h | 4 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 9 | ||||
-rw-r--r-- | include/acpi/acpi_drivers.h | 5 | ||||
-rw-r--r-- | include/acpi/acpi_io.h | 3 | ||||
-rw-r--r-- | include/acpi/acpixf.h | 838 | ||||
-rw-r--r-- | include/acpi/actbl.h | 11 | ||||
-rw-r--r-- | include/acpi/actbl1.h | 4 | ||||
-rw-r--r-- | include/acpi/actbl2.h | 71 | ||||
-rw-r--r-- | include/acpi/actypes.h | 21 | ||||
-rw-r--r-- | include/acpi/platform/acenvex.h | 63 | ||||
-rw-r--r-- | include/acpi/platform/acgcc.h | 11 | ||||
-rw-r--r-- | include/acpi/platform/aclinux.h | 209 | ||||
-rw-r--r-- | include/acpi/platform/aclinuxex.h | 112 | ||||
-rw-r--r-- | include/acpi/video.h | 2 | ||||
-rw-r--r-- | include/linux/acpi.h | 30 | ||||
-rw-r--r-- | include/linux/backlight.h | 7 | ||||
-rw-r--r-- | include/linux/clk-provider.h | 31 | ||||
-rw-r--r-- | include/linux/cpufreq.h | 50 | ||||
-rw-r--r-- | include/linux/devfreq.h | 35 | ||||
-rw-r--r-- | include/linux/pm.h | 36 | ||||
-rw-r--r-- | include/linux/pm_opp.h | 20 | ||||
-rw-r--r-- | include/linux/pm_runtime.h | 6 | ||||
-rw-r--r-- | include/linux/power_supply.h | 2 | ||||
-rw-r--r-- | include/linux/suspend.h | 7 |
24 files changed, 1128 insertions, 459 deletions
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h index ca0cb603b171..a08e55a263c9 100644 --- a/include/acpi/acpi.h +++ b/include/acpi/acpi.h | |||
@@ -62,8 +62,6 @@ | |||
62 | #include <acpi/acrestyp.h> /* Resource Descriptor structs */ | 62 | #include <acpi/acrestyp.h> /* Resource Descriptor structs */ |
63 | #include <acpi/acpiosxf.h> /* OSL interfaces (ACPICA-to-OS) */ | 63 | #include <acpi/acpiosxf.h> /* OSL interfaces (ACPICA-to-OS) */ |
64 | #include <acpi/acpixf.h> /* ACPI core subsystem external interfaces */ | 64 | #include <acpi/acpixf.h> /* ACPI core subsystem external interfaces */ |
65 | #ifdef ACPI_NATIVE_INTERFACE_HEADER | 65 | #include <acpi/platform/acenvex.h> /* Extra environment-specific items */ |
66 | #include ACPI_NATIVE_INTERFACE_HEADER | ||
67 | #endif | ||
68 | 66 | ||
69 | #endif /* __ACPI_H__ */ | 67 | #endif /* __ACPI_H__ */ |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 84a2e29a2314..b5714580801a 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -131,6 +131,7 @@ static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile( | |||
131 | struct acpi_scan_handler { | 131 | struct acpi_scan_handler { |
132 | const struct acpi_device_id *ids; | 132 | const struct acpi_device_id *ids; |
133 | struct list_head list_node; | 133 | struct list_head list_node; |
134 | bool (*match)(char *idstr, const struct acpi_device_id **matchid); | ||
134 | int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); | 135 | int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); |
135 | void (*detach)(struct acpi_device *dev); | 136 | void (*detach)(struct acpi_device *dev); |
136 | void (*bind)(struct device *phys_dev); | 137 | void (*bind)(struct device *phys_dev); |
@@ -232,7 +233,8 @@ struct acpi_hardware_id { | |||
232 | struct acpi_pnp_type { | 233 | struct acpi_pnp_type { |
233 | u32 hardware_id:1; | 234 | u32 hardware_id:1; |
234 | u32 bus_address:1; | 235 | u32 bus_address:1; |
235 | u32 reserved:30; | 236 | u32 platform_id:1; |
237 | u32 reserved:29; | ||
236 | }; | 238 | }; |
237 | 239 | ||
238 | struct acpi_device_pnp { | 240 | struct acpi_device_pnp { |
@@ -261,7 +263,8 @@ struct acpi_device_power_flags { | |||
261 | u32 inrush_current:1; /* Serialize Dx->D0 */ | 263 | u32 inrush_current:1; /* Serialize Dx->D0 */ |
262 | u32 power_removed:1; /* Optimize Dx->D0 */ | 264 | u32 power_removed:1; /* Optimize Dx->D0 */ |
263 | u32 ignore_parent:1; /* Power is independent of parent power state */ | 265 | u32 ignore_parent:1; /* Power is independent of parent power state */ |
264 | u32 reserved:27; | 266 | u32 dsw_present:1; /* _DSW present? */ |
267 | u32 reserved:26; | ||
265 | }; | 268 | }; |
266 | 269 | ||
267 | struct acpi_device_power_state { | 270 | struct acpi_device_power_state { |
@@ -406,6 +409,8 @@ extern struct kobject *acpi_kobj; | |||
406 | extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); | 409 | extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); |
407 | void acpi_bus_private_data_handler(acpi_handle, void *); | 410 | void acpi_bus_private_data_handler(acpi_handle, void *); |
408 | int acpi_bus_get_private_data(acpi_handle, void **); | 411 | int acpi_bus_get_private_data(acpi_handle, void **); |
412 | int acpi_bus_attach_private_data(acpi_handle, void *); | ||
413 | void acpi_bus_detach_private_data(acpi_handle); | ||
409 | void acpi_bus_no_hotplug(acpi_handle handle); | 414 | void acpi_bus_no_hotplug(acpi_handle handle); |
410 | extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); | 415 | extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); |
411 | extern int register_acpi_notifier(struct notifier_block *); | 416 | extern int register_acpi_notifier(struct notifier_block *); |
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index d504613bbf80..ea6428b7dacb 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
@@ -96,7 +96,12 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle); | |||
96 | /* Arch-defined function to add a bus to the system */ | 96 | /* Arch-defined function to add a bus to the system */ |
97 | 97 | ||
98 | struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root); | 98 | struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root); |
99 | |||
100 | #ifdef CONFIG_X86 | ||
99 | void pci_acpi_crs_quirks(void); | 101 | void pci_acpi_crs_quirks(void); |
102 | #else | ||
103 | static inline void pci_acpi_crs_quirks(void) { } | ||
104 | #endif | ||
100 | 105 | ||
101 | /* -------------------------------------------------------------------------- | 106 | /* -------------------------------------------------------------------------- |
102 | Processor | 107 | Processor |
diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h index 2be858018c7f..444671e9c65d 100644 --- a/include/acpi/acpi_io.h +++ b/include/acpi/acpi_io.h | |||
@@ -9,6 +9,9 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, | |||
9 | return ioremap_cache(phys, size); | 9 | return ioremap_cache(phys, size); |
10 | } | 10 | } |
11 | 11 | ||
12 | void __iomem *__init_refok | ||
13 | acpi_os_map_iomem(acpi_physical_address phys, acpi_size size); | ||
14 | void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size); | ||
12 | void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); | 15 | void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); |
13 | 16 | ||
14 | int acpi_os_map_generic_address(struct acpi_generic_address *addr); | 17 | int acpi_os_map_generic_address(struct acpi_generic_address *addr); |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 44f5e9749601..35b525c19711 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 47 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
48 | 48 | ||
49 | #define ACPI_CA_VERSION 0x20140214 | 49 | #define ACPI_CA_VERSION 0x20140424 |
50 | 50 | ||
51 | #include <acpi/acconfig.h> | 51 | #include <acpi/acconfig.h> |
52 | #include <acpi/actypes.h> | 52 | #include <acpi/actypes.h> |
@@ -55,233 +55,478 @@ | |||
55 | 55 | ||
56 | extern u8 acpi_gbl_permanent_mmap; | 56 | extern u8 acpi_gbl_permanent_mmap; |
57 | 57 | ||
58 | /***************************************************************************** | ||
59 | * | ||
60 | * Macros used for ACPICA globals and configuration | ||
61 | * | ||
62 | ****************************************************************************/ | ||
63 | |||
58 | /* | 64 | /* |
59 | * Globals that are publically available | 65 | * Ensure that global variables are defined and initialized only once. |
66 | * | ||
67 | * The use of these macros allows for a single list of globals (here) | ||
68 | * in order to simplify maintenance of the code. | ||
60 | */ | 69 | */ |
61 | extern u32 acpi_current_gpe_count; | 70 | #ifdef DEFINE_ACPI_GLOBALS |
62 | extern struct acpi_table_fadt acpi_gbl_FADT; | 71 | #define ACPI_GLOBAL(type,name) \ |
63 | extern u8 acpi_gbl_system_awake_and_running; | 72 | extern type name; \ |
64 | extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */ | 73 | type name |
65 | extern u8 acpi_gbl_osi_data; | ||
66 | 74 | ||
67 | /* Runtime configuration of debug print levels */ | 75 | #define ACPI_INIT_GLOBAL(type,name,value) \ |
76 | type name=value | ||
68 | 77 | ||
69 | extern u32 acpi_dbg_level; | 78 | #else |
70 | extern u32 acpi_dbg_layer; | 79 | #ifndef ACPI_GLOBAL |
71 | 80 | #define ACPI_GLOBAL(type,name) \ | |
72 | /* ACPICA runtime options */ | 81 | extern type name |
82 | #endif | ||
73 | 83 | ||
74 | extern u8 acpi_gbl_auto_serialize_methods; | 84 | #ifndef ACPI_INIT_GLOBAL |
75 | extern u8 acpi_gbl_copy_dsdt_locally; | 85 | #define ACPI_INIT_GLOBAL(type,name,value) \ |
76 | extern u8 acpi_gbl_create_osi_method; | 86 | extern type name |
77 | extern u8 acpi_gbl_disable_auto_repair; | 87 | #endif |
78 | extern u8 acpi_gbl_disable_ssdt_table_load; | 88 | #endif |
79 | extern u8 acpi_gbl_do_not_use_xsdt; | ||
80 | extern u8 acpi_gbl_enable_aml_debug_object; | ||
81 | extern u8 acpi_gbl_enable_interpreter_slack; | ||
82 | extern u32 acpi_gbl_trace_flags; | ||
83 | extern acpi_name acpi_gbl_trace_method_name; | ||
84 | extern u8 acpi_gbl_truncate_io_addresses; | ||
85 | extern u8 acpi_gbl_use32_bit_fadt_addresses; | ||
86 | extern u8 acpi_gbl_use_default_register_widths; | ||
87 | 89 | ||
88 | /* | 90 | /* |
89 | * Hardware-reduced prototypes. All interfaces that use these macros will | 91 | * These macros configure the various ACPICA interfaces. They are |
90 | * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag | 92 | * useful for generating stub inline functions for features that are |
91 | * is set to TRUE. | 93 | * configured out of the current kernel or ACPICA application. |
92 | */ | 94 | */ |
93 | #if (!ACPI_REDUCED_HARDWARE) | 95 | #ifndef ACPI_EXTERNAL_RETURN_STATUS |
94 | #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ | 96 | #define ACPI_EXTERNAL_RETURN_STATUS(prototype) \ |
95 | prototype; | 97 | prototype; |
98 | #endif | ||
96 | 99 | ||
97 | #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ | 100 | #ifndef ACPI_EXTERNAL_RETURN_OK |
101 | #define ACPI_EXTERNAL_RETURN_OK(prototype) \ | ||
98 | prototype; | 102 | prototype; |
103 | #endif | ||
99 | 104 | ||
100 | #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ | 105 | #ifndef ACPI_EXTERNAL_RETURN_VOID |
106 | #define ACPI_EXTERNAL_RETURN_VOID(prototype) \ | ||
101 | prototype; | 107 | prototype; |
108 | #endif | ||
102 | 109 | ||
103 | #else | 110 | #ifndef ACPI_EXTERNAL_RETURN_UINT32 |
104 | #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ | 111 | #define ACPI_EXTERNAL_RETURN_UINT32(prototype) \ |
105 | static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);} | 112 | prototype; |
106 | 113 | #endif | |
107 | #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ | ||
108 | static ACPI_INLINE prototype {return(AE_OK);} | ||
109 | 114 | ||
110 | #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ | 115 | #ifndef ACPI_EXTERNAL_RETURN_PTR |
111 | static ACPI_INLINE prototype {return;} | 116 | #define ACPI_EXTERNAL_RETURN_PTR(prototype) \ |
117 | prototype; | ||
118 | #endif | ||
112 | 119 | ||
113 | #endif /* !ACPI_REDUCED_HARDWARE */ | 120 | /***************************************************************************** |
121 | * | ||
122 | * Public globals and runtime configuration options | ||
123 | * | ||
124 | ****************************************************************************/ | ||
114 | 125 | ||
115 | /* | 126 | /* |
116 | * Initialization | 127 | * Enable "slack mode" of the AML interpreter? Default is FALSE, and the |
128 | * interpreter strictly follows the ACPI specification. Setting to TRUE | ||
129 | * allows the interpreter to ignore certain errors and/or bad AML constructs. | ||
130 | * | ||
131 | * Currently, these features are enabled by this flag: | ||
132 | * | ||
133 | * 1) Allow "implicit return" of last value in a control method | ||
134 | * 2) Allow access beyond the end of an operation region | ||
135 | * 3) Allow access to uninitialized locals/args (auto-init to integer 0) | ||
136 | * 4) Allow ANY object type to be a source operand for the Store() operator | ||
137 | * 5) Allow unresolved references (invalid target name) in package objects | ||
138 | * 6) Enable warning messages for behavior that is not ACPI spec compliant | ||
117 | */ | 139 | */ |
118 | acpi_status __init | 140 | ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE); |
119 | acpi_initialize_tables(struct acpi_table_desc *initial_storage, | ||
120 | u32 initial_table_count, u8 allow_resize); | ||
121 | |||
122 | acpi_status __init acpi_initialize_subsystem(void); | ||
123 | 141 | ||
124 | acpi_status __init acpi_enable_subsystem(u32 flags); | 142 | /* |
125 | 143 | * Automatically serialize all methods that create named objects? Default | |
126 | acpi_status __init acpi_initialize_objects(u32 flags); | 144 | * is TRUE, meaning that all non_serialized methods are scanned once at |
145 | * table load time to determine those that create named objects. Methods | ||
146 | * that create named objects are marked Serialized in order to prevent | ||
147 | * possible run-time problems if they are entered by more than one thread. | ||
148 | */ | ||
149 | ACPI_INIT_GLOBAL(u8, acpi_gbl_auto_serialize_methods, TRUE); | ||
127 | 150 | ||
128 | acpi_status __init acpi_terminate(void); | 151 | /* |
152 | * Create the predefined _OSI method in the namespace? Default is TRUE | ||
153 | * because ACPICA is fully compatible with other ACPI implementations. | ||
154 | * Changing this will revert ACPICA (and machine ASL) to pre-OSI behavior. | ||
155 | */ | ||
156 | ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE); | ||
129 | 157 | ||
130 | /* | 158 | /* |
131 | * Miscellaneous global interfaces | 159 | * Optionally use default values for the ACPI register widths. Set this to |
160 | * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. | ||
132 | */ | 161 | */ |
133 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void)) | 162 | ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE); |
134 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void)) | ||
135 | #ifdef ACPI_FUTURE_USAGE | ||
136 | acpi_status acpi_subsystem_status(void); | ||
137 | #endif | ||
138 | 163 | ||
139 | #ifdef ACPI_FUTURE_USAGE | 164 | /* |
140 | acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer); | 165 | * Whether or not to verify the table checksum before installation. Set |
141 | #endif | 166 | * this to TRUE to verify the table checksum before install it to the table |
167 | * manager. Note that enabling this option causes errors to happen in some | ||
168 | * OSPMs during early initialization stages. Default behavior is to do such | ||
169 | * verification. | ||
170 | */ | ||
171 | ACPI_INIT_GLOBAL(u8, acpi_gbl_verify_table_checksum, TRUE); | ||
142 | 172 | ||
143 | acpi_status acpi_get_statistics(struct acpi_statistics *stats); | 173 | /* |
174 | * Optionally enable output from the AML Debug Object. | ||
175 | */ | ||
176 | ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_aml_debug_object, FALSE); | ||
144 | 177 | ||
145 | const char *acpi_format_exception(acpi_status exception); | 178 | /* |
179 | * Optionally copy the entire DSDT to local memory (instead of simply | ||
180 | * mapping it.) There are some BIOSs that corrupt or replace the original | ||
181 | * DSDT, creating the need for this option. Default is FALSE, do not copy | ||
182 | * the DSDT. | ||
183 | */ | ||
184 | ACPI_INIT_GLOBAL(u8, acpi_gbl_copy_dsdt_locally, FALSE); | ||
146 | 185 | ||
147 | acpi_status acpi_purge_cached_objects(void); | 186 | /* |
187 | * Optionally ignore an XSDT if present and use the RSDT instead. | ||
188 | * Although the ACPI specification requires that an XSDT be used instead | ||
189 | * of the RSDT, the XSDT has been found to be corrupt or ill-formed on | ||
190 | * some machines. Default behavior is to use the XSDT if present. | ||
191 | */ | ||
192 | ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE); | ||
148 | 193 | ||
149 | acpi_status acpi_install_interface(acpi_string interface_name); | 194 | /* |
195 | * Optionally use 32-bit FADT addresses if and when there is a conflict | ||
196 | * (address mismatch) between the 32-bit and 64-bit versions of the | ||
197 | * address. Although ACPICA adheres to the ACPI specification which | ||
198 | * requires the use of the corresponding 64-bit address if it is non-zero, | ||
199 | * some machines have been found to have a corrupted non-zero 64-bit | ||
200 | * address. Default is TRUE, favor the 32-bit addresses. | ||
201 | */ | ||
202 | ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE); | ||
150 | 203 | ||
151 | acpi_status acpi_remove_interface(acpi_string interface_name); | 204 | /* |
205 | * Optionally truncate I/O addresses to 16 bits. Provides compatibility | ||
206 | * with other ACPI implementations. NOTE: During ACPICA initialization, | ||
207 | * this value is set to TRUE if any Windows OSI strings have been | ||
208 | * requested by the BIOS. | ||
209 | */ | ||
210 | ACPI_INIT_GLOBAL(u8, acpi_gbl_truncate_io_addresses, FALSE); | ||
152 | 211 | ||
153 | acpi_status acpi_update_interfaces(u8 action); | 212 | /* |
213 | * Disable runtime checking and repair of values returned by control methods. | ||
214 | * Use only if the repair is causing a problem on a particular machine. | ||
215 | */ | ||
216 | ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_auto_repair, FALSE); | ||
154 | 217 | ||
155 | u32 | 218 | /* |
156 | acpi_check_address_range(acpi_adr_space_type space_id, | 219 | * Optionally do not install any SSDTs from the RSDT/XSDT during initialization. |
157 | acpi_physical_address address, | 220 | * This can be useful for debugging ACPI problems on some machines. |
158 | acpi_size length, u8 warn); | 221 | */ |
222 | ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE); | ||
159 | 223 | ||
160 | acpi_status | 224 | /* |
161 | acpi_decode_pld_buffer(u8 *in_buffer, | 225 | * We keep track of the latest version of Windows that has been requested by |
162 | acpi_size length, struct acpi_pld_info **return_buffer); | 226 | * the BIOS. ACPI 5.0. |
227 | */ | ||
228 | ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0); | ||
163 | 229 | ||
164 | /* | 230 | /* |
165 | * ACPI table load/unload interfaces | 231 | * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning |
232 | * that the ACPI hardware is no longer required. A flag in the FADT indicates | ||
233 | * a reduced HW machine, and that flag is duplicated here for convenience. | ||
166 | */ | 234 | */ |
167 | acpi_status acpi_load_table(struct acpi_table_header *table); | 235 | ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE); |
168 | 236 | ||
169 | acpi_status acpi_unload_parent_table(acpi_handle object); | 237 | /* |
238 | * This mechanism is used to trace a specified AML method. The method is | ||
239 | * traced each time it is executed. | ||
240 | */ | ||
241 | ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_flags, 0); | ||
242 | ACPI_INIT_GLOBAL(acpi_name, acpi_gbl_trace_method_name, 0); | ||
170 | 243 | ||
171 | acpi_status __init acpi_load_tables(void); | 244 | /* |
245 | * Runtime configuration of debug output control masks. We want the debug | ||
246 | * switches statically initialized so they are already set when the debugger | ||
247 | * is entered. | ||
248 | */ | ||
249 | ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_DEBUG_DEFAULT); | ||
250 | ACPI_INIT_GLOBAL(u32, acpi_dbg_layer, 0); | ||
172 | 251 | ||
173 | /* | 252 | /* |
174 | * ACPI table manipulation interfaces | 253 | * Other miscellaneous globals |
175 | */ | 254 | */ |
176 | acpi_status __init acpi_reallocate_root_table(void); | 255 | ACPI_GLOBAL(struct acpi_table_fadt, acpi_gbl_FADT); |
256 | ACPI_GLOBAL(u32, acpi_current_gpe_count); | ||
257 | ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); | ||
177 | 258 | ||
178 | acpi_status __init acpi_find_root_pointer(acpi_size *rsdp_address); | 259 | /***************************************************************************** |
260 | * | ||
261 | * ACPICA public interface configuration. | ||
262 | * | ||
263 | * Interfaces that are configured out of the ACPICA build are replaced | ||
264 | * by inlined stubs by default. | ||
265 | * | ||
266 | ****************************************************************************/ | ||
179 | 267 | ||
180 | acpi_status acpi_unload_table_id(acpi_owner_id id); | 268 | /* |
269 | * Hardware-reduced prototypes (default: Not hardware reduced). | ||
270 | * | ||
271 | * All ACPICA hardware-related interfaces that use these macros will be | ||
272 | * configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag | ||
273 | * is set to TRUE. | ||
274 | * | ||
275 | * Note: This static build option for reduced hardware is intended to | ||
276 | * reduce ACPICA code size if desired or necessary. However, even if this | ||
277 | * option is not specified, the runtime behavior of ACPICA is dependent | ||
278 | * on the actual FADT reduced hardware flag (HW_REDUCED_ACPI). If set, | ||
279 | * the flag will enable similar behavior -- ACPICA will not attempt | ||
280 | * to access any ACPI-relate hardware (SCI, GPEs, Fixed Events, etc.) | ||
281 | */ | ||
282 | #if (!ACPI_REDUCED_HARDWARE) | ||
283 | #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ | ||
284 | ACPI_EXTERNAL_RETURN_STATUS(prototype) | ||
181 | 285 | ||
182 | acpi_status | 286 | #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ |
183 | acpi_get_table_header(acpi_string signature, | 287 | ACPI_EXTERNAL_RETURN_OK(prototype) |
184 | u32 instance, struct acpi_table_header *out_table_header); | ||
185 | 288 | ||
186 | acpi_status | 289 | #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ |
187 | acpi_get_table_with_size(acpi_string signature, | 290 | ACPI_EXTERNAL_RETURN_VOID(prototype) |
188 | u32 instance, struct acpi_table_header **out_table, | ||
189 | acpi_size *tbl_size); | ||
190 | 291 | ||
191 | acpi_status | 292 | #else |
192 | acpi_get_table(acpi_string signature, | 293 | #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ |
193 | u32 instance, struct acpi_table_header **out_table); | 294 | static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);} |
194 | 295 | ||
195 | acpi_status | 296 | #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ |
196 | acpi_get_table_by_index(u32 table_index, struct acpi_table_header **out_table); | 297 | static ACPI_INLINE prototype {return(AE_OK);} |
197 | 298 | ||
198 | acpi_status | 299 | #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ |
199 | acpi_install_table_handler(acpi_table_handler handler, void *context); | 300 | static ACPI_INLINE prototype {return;} |
200 | 301 | ||
201 | acpi_status acpi_remove_table_handler(acpi_table_handler handler); | 302 | #endif /* !ACPI_REDUCED_HARDWARE */ |
202 | 303 | ||
203 | /* | 304 | /* |
204 | * Namespace and name interfaces | 305 | * Error message prototypes (default: error messages enabled). |
306 | * | ||
307 | * All interfaces related to error and warning messages | ||
308 | * will be configured out of the ACPICA build if the | ||
309 | * ACPI_NO_ERROR_MESSAGE flag is defined. | ||
205 | */ | 310 | */ |
206 | acpi_status | 311 | #ifndef ACPI_NO_ERROR_MESSAGES |
207 | acpi_walk_namespace(acpi_object_type type, | 312 | #define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \ |
208 | acpi_handle start_object, | 313 | prototype; |
209 | u32 max_depth, | ||
210 | acpi_walk_callback descending_callback, | ||
211 | acpi_walk_callback ascending_callback, | ||
212 | void *context, void **return_value); | ||
213 | 314 | ||
214 | acpi_status | 315 | #else |
215 | acpi_get_devices(const char *HID, | 316 | #define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \ |
216 | acpi_walk_callback user_function, | 317 | static ACPI_INLINE prototype {return;} |
217 | void *context, void **return_value); | ||
218 | 318 | ||
219 | acpi_status | 319 | #endif /* ACPI_NO_ERROR_MESSAGES */ |
220 | acpi_get_name(acpi_handle object, | ||
221 | u32 name_type, struct acpi_buffer *ret_path_ptr); | ||
222 | 320 | ||
223 | acpi_status | 321 | /* |
224 | acpi_get_handle(acpi_handle parent, | 322 | * Debugging output prototypes (default: no debug output). |
225 | acpi_string pathname, acpi_handle * ret_handle); | 323 | * |
324 | * All interfaces related to debug output messages | ||
325 | * will be configured out of the ACPICA build unless the | ||
326 | * ACPI_DEBUG_OUTPUT flag is defined. | ||
327 | */ | ||
328 | #ifdef ACPI_DEBUG_OUTPUT | ||
329 | #define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \ | ||
330 | prototype; | ||
226 | 331 | ||
227 | acpi_status | 332 | #else |
228 | acpi_attach_data(acpi_handle object, acpi_object_handler handler, void *data); | 333 | #define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \ |
334 | static ACPI_INLINE prototype {return;} | ||
229 | 335 | ||
230 | acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler); | 336 | #endif /* ACPI_DEBUG_OUTPUT */ |
231 | 337 | ||
232 | acpi_status | 338 | /***************************************************************************** |
233 | acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data, | 339 | * |
234 | void (*callback)(void *)); | 340 | * ACPICA public interface prototypes |
341 | * | ||
342 | ****************************************************************************/ | ||
235 | 343 | ||
236 | acpi_status | 344 | /* |
237 | acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data); | 345 | * Initialization |
346 | */ | ||
347 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init | ||
348 | acpi_initialize_tables(struct acpi_table_desc | ||
349 | *initial_storage, | ||
350 | u32 initial_table_count, | ||
351 | u8 allow_resize)) | ||
352 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_initialize_subsystem(void)) | ||
238 | 353 | ||
239 | acpi_status | 354 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_enable_subsystem(u32 flags)) |
240 | acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags); | 355 | |
356 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init | ||
357 | acpi_initialize_objects(u32 flags)) | ||
358 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_terminate(void)) | ||
241 | 359 | ||
242 | /* | 360 | /* |
243 | * Object manipulation and enumeration | 361 | * Miscellaneous global interfaces |
244 | */ | 362 | */ |
245 | acpi_status | 363 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void)) |
246 | acpi_evaluate_object(acpi_handle object, | 364 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void)) |
247 | acpi_string pathname, | 365 | #ifdef ACPI_FUTURE_USAGE |
248 | struct acpi_object_list *parameter_objects, | 366 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_subsystem_status(void)) |
249 | struct acpi_buffer *return_object_buffer); | 367 | #endif |
250 | 368 | ||
251 | acpi_status | 369 | #ifdef ACPI_FUTURE_USAGE |
252 | acpi_evaluate_object_typed(acpi_handle object, | 370 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
253 | acpi_string pathname, | 371 | acpi_get_system_info(struct acpi_buffer |
254 | struct acpi_object_list *external_params, | 372 | *ret_buffer)) |
255 | struct acpi_buffer *return_buffer, | 373 | #endif |
256 | acpi_object_type return_type); | 374 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
375 | acpi_get_statistics(struct acpi_statistics *stats)) | ||
376 | ACPI_EXTERNAL_RETURN_PTR(const char | ||
377 | *acpi_format_exception(acpi_status exception)) | ||
378 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_purge_cached_objects(void)) | ||
379 | |||
380 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
381 | acpi_install_interface(acpi_string interface_name)) | ||
382 | |||
383 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
384 | acpi_remove_interface(acpi_string interface_name)) | ||
385 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_update_interfaces(u8 action)) | ||
386 | |||
387 | ACPI_EXTERNAL_RETURN_UINT32(u32 | ||
388 | acpi_check_address_range(acpi_adr_space_type | ||
389 | space_id, | ||
390 | acpi_physical_address | ||
391 | address, acpi_size length, | ||
392 | u8 warn)) | ||
393 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
394 | acpi_decode_pld_buffer(u8 *in_buffer, | ||
395 | acpi_size length, | ||
396 | struct acpi_pld_info | ||
397 | **return_buffer)) | ||
257 | 398 | ||
258 | acpi_status | 399 | /* |
259 | acpi_get_object_info(acpi_handle object, | 400 | * ACPI table load/unload interfaces |
260 | struct acpi_device_info **return_buffer); | 401 | */ |
402 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init | ||
403 | acpi_install_table(acpi_physical_address address, | ||
404 | u8 physical)) | ||
261 | 405 | ||
262 | acpi_status acpi_install_method(u8 *buffer); | 406 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
407 | acpi_load_table(struct acpi_table_header *table)) | ||
263 | 408 | ||
264 | acpi_status | 409 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
265 | acpi_get_next_object(acpi_object_type type, | 410 | acpi_unload_parent_table(acpi_handle object)) |
266 | acpi_handle parent, | 411 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_load_tables(void)) |
267 | acpi_handle child, acpi_handle * out_handle); | ||
268 | 412 | ||
269 | acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type); | 413 | /* |
414 | * ACPI table manipulation interfaces | ||
415 | */ | ||
416 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void)) | ||
417 | |||
418 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init | ||
419 | acpi_find_root_pointer(acpi_size * rsdp_address)) | ||
420 | |||
421 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
422 | acpi_get_table_header(acpi_string signature, | ||
423 | u32 instance, | ||
424 | struct acpi_table_header | ||
425 | *out_table_header)) | ||
426 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
427 | acpi_get_table(acpi_string signature, u32 instance, | ||
428 | struct acpi_table_header | ||
429 | **out_table)) | ||
430 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
431 | acpi_get_table_by_index(u32 table_index, | ||
432 | struct acpi_table_header | ||
433 | **out_table)) | ||
434 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
435 | acpi_install_table_handler(acpi_table_handler | ||
436 | handler, void *context)) | ||
437 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
438 | acpi_remove_table_handler(acpi_table_handler | ||
439 | handler)) | ||
270 | 440 | ||
271 | acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type); | 441 | /* |
442 | * Namespace and name interfaces | ||
443 | */ | ||
444 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
445 | acpi_walk_namespace(acpi_object_type type, | ||
446 | acpi_handle start_object, | ||
447 | u32 max_depth, | ||
448 | acpi_walk_callback | ||
449 | descending_callback, | ||
450 | acpi_walk_callback | ||
451 | ascending_callback, | ||
452 | void *context, | ||
453 | void **return_value)) | ||
454 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
455 | acpi_get_devices(const char *HID, | ||
456 | acpi_walk_callback user_function, | ||
457 | void *context, | ||
458 | void **return_value)) | ||
459 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
460 | acpi_get_name(acpi_handle object, u32 name_type, | ||
461 | struct acpi_buffer *ret_path_ptr)) | ||
462 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
463 | acpi_get_handle(acpi_handle parent, | ||
464 | acpi_string pathname, | ||
465 | acpi_handle * ret_handle)) | ||
466 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
467 | acpi_attach_data(acpi_handle object, | ||
468 | acpi_object_handler handler, | ||
469 | void *data)) | ||
470 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
471 | acpi_detach_data(acpi_handle object, | ||
472 | acpi_object_handler handler)) | ||
473 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
474 | acpi_get_data(acpi_handle object, | ||
475 | acpi_object_handler handler, | ||
476 | void **data)) | ||
477 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
478 | acpi_debug_trace(char *name, u32 debug_level, | ||
479 | u32 debug_layer, u32 flags)) | ||
272 | 480 | ||
273 | acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle); | 481 | /* |
482 | * Object manipulation and enumeration | ||
483 | */ | ||
484 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
485 | acpi_evaluate_object(acpi_handle object, | ||
486 | acpi_string pathname, | ||
487 | struct acpi_object_list | ||
488 | *parameter_objects, | ||
489 | struct acpi_buffer | ||
490 | *return_object_buffer)) | ||
491 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
492 | acpi_evaluate_object_typed(acpi_handle object, | ||
493 | acpi_string pathname, | ||
494 | struct acpi_object_list | ||
495 | *external_params, | ||
496 | struct acpi_buffer | ||
497 | *return_buffer, | ||
498 | acpi_object_type | ||
499 | return_type)) | ||
500 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
501 | acpi_get_object_info(acpi_handle object, | ||
502 | struct acpi_device_info | ||
503 | **return_buffer)) | ||
504 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_install_method(u8 *buffer)) | ||
505 | |||
506 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
507 | acpi_get_next_object(acpi_object_type type, | ||
508 | acpi_handle parent, | ||
509 | acpi_handle child, | ||
510 | acpi_handle * out_handle)) | ||
511 | |||
512 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
513 | acpi_get_type(acpi_handle object, | ||
514 | acpi_object_type * out_type)) | ||
515 | |||
516 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
517 | acpi_get_parent(acpi_handle object, | ||
518 | acpi_handle * out_handle)) | ||
274 | 519 | ||
275 | /* | 520 | /* |
276 | * Handler interfaces | 521 | * Handler interfaces |
277 | */ | 522 | */ |
278 | acpi_status | 523 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
279 | acpi_install_initialization_handler(acpi_init_handler handler, u32 function); | 524 | acpi_install_initialization_handler |
280 | 525 | (acpi_init_handler handler, u32 function)) | |
281 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | 526 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
282 | acpi_install_sci_handler(acpi_sci_handler | 527 | acpi_install_sci_handler(acpi_sci_handler |
283 | address, | 528 | address, |
284 | void *context)) | 529 | void *context)) |
285 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | 530 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
286 | acpi_remove_sci_handler(acpi_sci_handler | 531 | acpi_remove_sci_handler(acpi_sci_handler |
287 | address)) | 532 | address)) |
@@ -313,30 +558,42 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | |||
313 | u32 gpe_number, | 558 | u32 gpe_number, |
314 | acpi_gpe_handler | 559 | acpi_gpe_handler |
315 | address)) | 560 | address)) |
316 | acpi_status acpi_install_notify_handler(acpi_handle device, u32 handler_type, | 561 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
317 | acpi_notify_handler handler, | 562 | acpi_install_notify_handler(acpi_handle device, |
318 | void *context); | 563 | u32 handler_type, |
319 | 564 | acpi_notify_handler | |
320 | acpi_status | 565 | handler, |
321 | acpi_remove_notify_handler(acpi_handle device, | 566 | void *context)) |
322 | u32 handler_type, acpi_notify_handler handler); | 567 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
323 | 568 | acpi_remove_notify_handler(acpi_handle device, | |
324 | acpi_status | 569 | u32 handler_type, |
325 | acpi_install_address_space_handler(acpi_handle device, | 570 | acpi_notify_handler |
326 | acpi_adr_space_type space_id, | 571 | handler)) |
327 | acpi_adr_space_handler handler, | 572 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
328 | acpi_adr_space_setup setup, void *context); | 573 | acpi_install_address_space_handler(acpi_handle |
329 | 574 | device, | |
330 | acpi_status | 575 | acpi_adr_space_type |
331 | acpi_remove_address_space_handler(acpi_handle device, | 576 | space_id, |
332 | acpi_adr_space_type space_id, | 577 | acpi_adr_space_handler |
333 | acpi_adr_space_handler handler); | 578 | handler, |
334 | 579 | acpi_adr_space_setup | |
580 | setup, | ||
581 | void *context)) | ||
582 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | ||
583 | acpi_remove_address_space_handler(acpi_handle | ||
584 | device, | ||
585 | acpi_adr_space_type | ||
586 | space_id, | ||
587 | acpi_adr_space_handler | ||
588 | handler)) | ||
335 | #ifdef ACPI_FUTURE_USAGE | 589 | #ifdef ACPI_FUTURE_USAGE |
336 | acpi_status acpi_install_exception_handler(acpi_exception_handler handler); | 590 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
591 | acpi_install_exception_handler | ||
592 | (acpi_exception_handler handler)) | ||
337 | #endif | 593 | #endif |
338 | 594 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | |
339 | acpi_status acpi_install_interface_handler(acpi_interface_handler handler); | 595 | acpi_install_interface_handler |
596 | (acpi_interface_handler handler)) | ||
340 | 597 | ||
341 | /* | 598 | /* |
342 | * Global Lock interfaces | 599 | * Global Lock interfaces |
@@ -351,10 +608,14 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | |||
351 | /* | 608 | /* |
352 | * Interfaces to AML mutex objects | 609 | * Interfaces to AML mutex objects |
353 | */ | 610 | */ |
354 | acpi_status | 611 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
355 | acpi_acquire_mutex(acpi_handle handle, acpi_string pathname, u16 timeout); | 612 | acpi_acquire_mutex(acpi_handle handle, |
613 | acpi_string pathname, | ||
614 | u16 timeout)) | ||
356 | 615 | ||
357 | acpi_status acpi_release_mutex(acpi_handle handle, acpi_string pathname); | 616 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
617 | acpi_release_mutex(acpi_handle handle, | ||
618 | acpi_string pathname)) | ||
358 | 619 | ||
359 | /* | 620 | /* |
360 | * Fixed Event interfaces | 621 | * Fixed Event interfaces |
@@ -434,57 +695,69 @@ typedef | |||
434 | acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource, | 695 | acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource, |
435 | void *context); | 696 | void *context); |
436 | 697 | ||
437 | acpi_status | 698 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
438 | acpi_get_vendor_resource(acpi_handle device, | 699 | acpi_get_vendor_resource(acpi_handle device, |
439 | char *name, | 700 | char *name, |
440 | struct acpi_vendor_uuid *uuid, | 701 | struct acpi_vendor_uuid |
441 | struct acpi_buffer *ret_buffer); | 702 | *uuid, |
442 | 703 | struct acpi_buffer | |
443 | acpi_status | 704 | *ret_buffer)) |
444 | acpi_get_current_resources(acpi_handle device, struct acpi_buffer *ret_buffer); | 705 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
445 | 706 | acpi_get_current_resources(acpi_handle device, | |
707 | struct acpi_buffer | ||
708 | *ret_buffer)) | ||
446 | #ifdef ACPI_FUTURE_USAGE | 709 | #ifdef ACPI_FUTURE_USAGE |
447 | acpi_status | 710 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
448 | acpi_get_possible_resources(acpi_handle device, struct acpi_buffer *ret_buffer); | 711 | acpi_get_possible_resources(acpi_handle device, |
712 | struct acpi_buffer | ||
713 | *ret_buffer)) | ||
449 | #endif | 714 | #endif |
450 | 715 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | |
451 | acpi_status | 716 | acpi_get_event_resources(acpi_handle device_handle, |
452 | acpi_get_event_resources(acpi_handle device_handle, | 717 | struct acpi_buffer |
453 | struct acpi_buffer *ret_buffer); | 718 | *ret_buffer)) |
454 | 719 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | |
455 | acpi_status | 720 | acpi_walk_resource_buffer(struct acpi_buffer |
456 | acpi_walk_resource_buffer(struct acpi_buffer *buffer, | 721 | *buffer, |
457 | acpi_walk_resource_callback user_function, | 722 | acpi_walk_resource_callback |
458 | void *context); | 723 | user_function, |
459 | 724 | void *context)) | |
460 | acpi_status | 725 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
461 | acpi_walk_resources(acpi_handle device, | 726 | acpi_walk_resources(acpi_handle device, char *name, |
462 | char *name, | 727 | acpi_walk_resource_callback |
463 | acpi_walk_resource_callback user_function, void *context); | 728 | user_function, void *context)) |
464 | 729 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status | |
465 | acpi_status | 730 | acpi_set_current_resources(acpi_handle device, |
466 | acpi_set_current_resources(acpi_handle device, struct acpi_buffer *in_buffer); | 731 | struct acpi_buffer |
467 | 732 | *in_buffer)) | |
468 | acpi_status | 733 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
469 | acpi_get_irq_routing_table(acpi_handle device, struct acpi_buffer *ret_buffer); | 734 | acpi_get_irq_routing_table(acpi_handle device, |
470 | 735 | struct acpi_buffer | |
471 | acpi_status | 736 | *ret_buffer)) |
472 | acpi_resource_to_address64(struct acpi_resource *resource, | 737 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
473 | struct acpi_resource_address64 *out); | 738 | acpi_resource_to_address64(struct acpi_resource |
474 | 739 | *resource, | |
475 | acpi_status | 740 | struct |
476 | acpi_buffer_to_resource(u8 *aml_buffer, | 741 | acpi_resource_address64 |
477 | u16 aml_buffer_length, | 742 | *out)) |
478 | struct acpi_resource **resource_ptr); | 743 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
744 | acpi_buffer_to_resource(u8 *aml_buffer, | ||
745 | u16 aml_buffer_length, | ||
746 | struct acpi_resource | ||
747 | **resource_ptr)) | ||
479 | 748 | ||
480 | /* | 749 | /* |
481 | * Hardware (ACPI device) interfaces | 750 | * Hardware (ACPI device) interfaces |
482 | */ | 751 | */ |
483 | acpi_status acpi_reset(void); | 752 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_reset(void)) |
484 | 753 | ||
485 | acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg); | 754 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
755 | acpi_read(u64 *value, | ||
756 | struct acpi_generic_address *reg)) | ||
486 | 757 | ||
487 | acpi_status acpi_write(u64 value, struct acpi_generic_address *reg); | 758 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
759 | acpi_write(u64 value, | ||
760 | struct acpi_generic_address *reg)) | ||
488 | 761 | ||
489 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | 762 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
490 | acpi_read_bit_register(u32 register_id, | 763 | acpi_read_bit_register(u32 register_id, |
@@ -497,18 +770,20 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | |||
497 | /* | 770 | /* |
498 | * Sleep/Wake interfaces | 771 | * Sleep/Wake interfaces |
499 | */ | 772 | */ |
500 | acpi_status | 773 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
501 | acpi_get_sleep_type_data(u8 sleep_state, u8 *slp_typ_a, u8 *slp_typ_b); | 774 | acpi_get_sleep_type_data(u8 sleep_state, |
502 | 775 | u8 *slp_typ_a, | |
503 | acpi_status acpi_enter_sleep_state_prep(u8 sleep_state); | 776 | u8 *slp_typ_b)) |
504 | 777 | ||
505 | acpi_status acpi_enter_sleep_state(u8 sleep_state); | 778 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
779 | acpi_enter_sleep_state_prep(u8 sleep_state)) | ||
780 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_enter_sleep_state(u8 sleep_state)) | ||
506 | 781 | ||
507 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enter_sleep_state_s4bios(void)) | 782 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enter_sleep_state_s4bios(void)) |
508 | 783 | ||
509 | acpi_status acpi_leave_sleep_state_prep(u8 sleep_state); | 784 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
510 | 785 | acpi_leave_sleep_state_prep(u8 sleep_state)) | |
511 | acpi_status acpi_leave_sleep_state(u8 sleep_state); | 786 | ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state)) |
512 | 787 | ||
513 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | 788 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
514 | acpi_set_firmware_waking_vector(u32 | 789 | acpi_set_firmware_waking_vector(u32 |
@@ -535,53 +810,72 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | |||
535 | /* | 810 | /* |
536 | * Error/Warning output | 811 | * Error/Warning output |
537 | */ | 812 | */ |
538 | ACPI_PRINTF_LIKE(3) | 813 | ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) |
539 | void ACPI_INTERNAL_VAR_XFACE | 814 | void ACPI_INTERNAL_VAR_XFACE |
540 | acpi_error(const char *module_name, u32 line_number, const char *format, ...); | 815 | acpi_error(const char *module_name, |
541 | 816 | u32 line_number, | |
542 | ACPI_PRINTF_LIKE(4) | 817 | const char *format, ...)) |
543 | void ACPI_INTERNAL_VAR_XFACE | 818 | ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(4) |
544 | acpi_exception(const char *module_name, | 819 | void ACPI_INTERNAL_VAR_XFACE |
545 | u32 line_number, acpi_status status, const char *format, ...); | 820 | acpi_exception(const char *module_name, |
546 | 821 | u32 line_number, | |
547 | ACPI_PRINTF_LIKE(3) | 822 | acpi_status status, |
548 | void ACPI_INTERNAL_VAR_XFACE | 823 | const char *format, ...)) |
549 | acpi_warning(const char *module_name, u32 line_number, const char *format, ...); | 824 | ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) |
550 | 825 | void ACPI_INTERNAL_VAR_XFACE | |
551 | ACPI_PRINTF_LIKE(3) | 826 | acpi_warning(const char *module_name, |
552 | void ACPI_INTERNAL_VAR_XFACE | 827 | u32 line_number, |
553 | acpi_info(const char *module_name, u32 line_number, const char *format, ...); | 828 | const char *format, ...)) |
554 | 829 | ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) | |
555 | ACPI_PRINTF_LIKE(3) | 830 | void ACPI_INTERNAL_VAR_XFACE |
556 | void ACPI_INTERNAL_VAR_XFACE | 831 | acpi_info(const char *module_name, |
557 | acpi_bios_error(const char *module_name, | 832 | u32 line_number, |
558 | u32 line_number, const char *format, ...); | 833 | const char *format, ...)) |
559 | 834 | ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) | |
560 | ACPI_PRINTF_LIKE(3) | 835 | void ACPI_INTERNAL_VAR_XFACE |
561 | void ACPI_INTERNAL_VAR_XFACE | 836 | acpi_bios_error(const char *module_name, |
562 | acpi_bios_warning(const char *module_name, | 837 | u32 line_number, |
563 | u32 line_number, const char *format, ...); | 838 | const char *format, ...)) |
839 | ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) | ||
840 | void ACPI_INTERNAL_VAR_XFACE | ||
841 | acpi_bios_warning(const char *module_name, | ||
842 | u32 line_number, | ||
843 | const char *format, ...)) | ||
564 | 844 | ||
565 | /* | 845 | /* |
566 | * Debug output | 846 | * Debug output |
567 | */ | 847 | */ |
568 | #ifdef ACPI_DEBUG_OUTPUT | 848 | ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6) |
849 | void ACPI_INTERNAL_VAR_XFACE | ||
850 | acpi_debug_print(u32 requested_debug_level, | ||
851 | u32 line_number, | ||
852 | const char *function_name, | ||
853 | const char *module_name, | ||
854 | u32 component_id, | ||
855 | const char *format, ...)) | ||
856 | ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6) | ||
857 | void ACPI_INTERNAL_VAR_XFACE | ||
858 | acpi_debug_print_raw(u32 requested_debug_level, | ||
859 | u32 line_number, | ||
860 | const char *function_name, | ||
861 | const char *module_name, | ||
862 | u32 component_id, | ||
863 | const char *format, ...)) | ||
569 | 864 | ||
570 | ACPI_PRINTF_LIKE(6) | 865 | /* |
571 | void ACPI_INTERNAL_VAR_XFACE | 866 | * Divergences |
572 | acpi_debug_print(u32 requested_debug_level, | 867 | */ |
573 | u32 line_number, | 868 | acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type); |
574 | const char *function_name, | 869 | |
575 | const char *module_name, | 870 | acpi_status acpi_unload_table_id(acpi_owner_id id); |
576 | u32 component_id, const char *format, ...); | 871 | |
577 | 872 | acpi_status | |
578 | ACPI_PRINTF_LIKE(6) | 873 | acpi_get_table_with_size(acpi_string signature, |
579 | void ACPI_INTERNAL_VAR_XFACE | 874 | u32 instance, struct acpi_table_header **out_table, |
580 | acpi_debug_print_raw(u32 requested_debug_level, | 875 | acpi_size *tbl_size); |
581 | u32 line_number, | 876 | |
582 | const char *function_name, | 877 | acpi_status |
583 | const char *module_name, | 878 | acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data, |
584 | u32 component_id, const char *format, ...); | 879 | void (*callback)(void *)); |
585 | #endif | ||
586 | 880 | ||
587 | #endif /* __ACXFACE_H__ */ | 881 | #endif /* __ACXFACE_H__ */ |
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index 3b30e36b53b5..1cc7ef13c01a 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
@@ -367,12 +367,11 @@ struct acpi_table_desc { | |||
367 | 367 | ||
368 | /* Masks for Flags field above */ | 368 | /* Masks for Flags field above */ |
369 | 369 | ||
370 | #define ACPI_TABLE_ORIGIN_UNKNOWN (0) | 370 | #define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL (0) /* Virtual address, external maintained */ |
371 | #define ACPI_TABLE_ORIGIN_MAPPED (1) | 371 | #define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL (1) /* Physical address, internally mapped */ |
372 | #define ACPI_TABLE_ORIGIN_ALLOCATED (2) | 372 | #define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL (2) /* Virtual address, internallly allocated */ |
373 | #define ACPI_TABLE_ORIGIN_OVERRIDE (4) | 373 | #define ACPI_TABLE_ORIGIN_MASK (3) |
374 | #define ACPI_TABLE_ORIGIN_MASK (7) | 374 | #define ACPI_TABLE_IS_LOADED (8) |
375 | #define ACPI_TABLE_IS_LOADED (8) | ||
376 | 375 | ||
377 | /* | 376 | /* |
378 | * Get the remaining ACPI tables | 377 | * Get the remaining ACPI tables |
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 212c65de75df..4ad7da805180 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h | |||
@@ -675,7 +675,7 @@ enum acpi_madt_type { | |||
675 | }; | 675 | }; |
676 | 676 | ||
677 | /* | 677 | /* |
678 | * MADT Sub-tables, correspond to Type in struct acpi_subtable_header | 678 | * MADT Subtables, correspond to Type in struct acpi_subtable_header |
679 | */ | 679 | */ |
680 | 680 | ||
681 | /* 0: Processor Local APIC */ | 681 | /* 0: Processor Local APIC */ |
@@ -918,7 +918,7 @@ enum acpi_srat_type { | |||
918 | }; | 918 | }; |
919 | 919 | ||
920 | /* | 920 | /* |
921 | * SRAT Sub-tables, correspond to Type in struct acpi_subtable_header | 921 | * SRAT Subtables, correspond to Type in struct acpi_subtable_header |
922 | */ | 922 | */ |
923 | 923 | ||
924 | /* 0: Processor Local APIC/SAPIC Affinity */ | 924 | /* 0: Processor Local APIC/SAPIC Affinity */ |
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index c8adad9c6b6a..860e5c883eb3 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h | |||
@@ -70,6 +70,7 @@ | |||
70 | #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ | 70 | #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ |
71 | #define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ | 71 | #define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ |
72 | #define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ | 72 | #define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ |
73 | #define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */ | ||
73 | #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ | 74 | #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ |
74 | #define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ | 75 | #define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ |
75 | #define ACPI_SIG_MTMR "MTMR" /* MID Timer table */ | 76 | #define ACPI_SIG_MTMR "MTMR" /* MID Timer table */ |
@@ -456,7 +457,7 @@ struct acpi_dmar_pci_path { | |||
456 | }; | 457 | }; |
457 | 458 | ||
458 | /* | 459 | /* |
459 | * DMAR Sub-tables, correspond to Type in struct acpi_dmar_header | 460 | * DMAR Subtables, correspond to Type in struct acpi_dmar_header |
460 | */ | 461 | */ |
461 | 462 | ||
462 | /* 0: Hardware Unit Definition */ | 463 | /* 0: Hardware Unit Definition */ |
@@ -820,7 +821,71 @@ struct acpi_ivrs_memory { | |||
820 | 821 | ||
821 | /******************************************************************************* | 822 | /******************************************************************************* |
822 | * | 823 | * |
823 | * MCFG - PCI Memory Mapped Configuration table and sub-table | 824 | * LPIT - Low Power Idle Table |
825 | * | ||
826 | * Conforms to "ACPI Low Power Idle Table (LPIT) and _LPD Proposal (DRAFT)" | ||
827 | * | ||
828 | ******************************************************************************/ | ||
829 | |||
830 | struct acpi_table_lpit { | ||
831 | struct acpi_table_header header; /* Common ACPI table header */ | ||
832 | }; | ||
833 | |||
834 | /* LPIT subtable header */ | ||
835 | |||
836 | struct acpi_lpit_header { | ||
837 | u32 type; /* Subtable type */ | ||
838 | u32 length; /* Subtable length */ | ||
839 | u16 unique_id; | ||
840 | u16 reserved; | ||
841 | u32 flags; | ||
842 | }; | ||
843 | |||
844 | /* Values for subtable Type above */ | ||
845 | |||
846 | enum acpi_lpit_type { | ||
847 | ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00, | ||
848 | ACPI_LPIT_TYPE_SIMPLE_IO = 0x01 | ||
849 | }; | ||
850 | |||
851 | /* Masks for Flags field above */ | ||
852 | |||
853 | #define ACPI_LPIT_STATE_DISABLED (1) | ||
854 | #define ACPI_LPIT_NO_COUNTER (1<<1) | ||
855 | |||
856 | /* | ||
857 | * LPIT subtables, correspond to Type in struct acpi_lpit_header | ||
858 | */ | ||
859 | |||
860 | /* 0x00: Native C-state instruction based LPI structure */ | ||
861 | |||
862 | struct acpi_lpit_native { | ||
863 | struct acpi_lpit_header header; | ||
864 | struct acpi_generic_address entry_trigger; | ||
865 | u32 residency; | ||
866 | u32 latency; | ||
867 | struct acpi_generic_address residency_counter; | ||
868 | u64 counter_frequency; | ||
869 | }; | ||
870 | |||
871 | /* 0x01: Simple I/O based LPI structure */ | ||
872 | |||
873 | struct acpi_lpit_io { | ||
874 | struct acpi_lpit_header header; | ||
875 | struct acpi_generic_address entry_trigger; | ||
876 | u32 trigger_action; | ||
877 | u64 trigger_value; | ||
878 | u64 trigger_mask; | ||
879 | struct acpi_generic_address minimum_idle_state; | ||
880 | u32 residency; | ||
881 | u32 latency; | ||
882 | struct acpi_generic_address residency_counter; | ||
883 | u64 counter_frequency; | ||
884 | }; | ||
885 | |||
886 | /******************************************************************************* | ||
887 | * | ||
888 | * MCFG - PCI Memory Mapped Configuration table and subtable | ||
824 | * Version 1 | 889 | * Version 1 |
825 | * | 890 | * |
826 | * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005 | 891 | * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005 |
@@ -923,7 +988,7 @@ enum acpi_slic_type { | |||
923 | }; | 988 | }; |
924 | 989 | ||
925 | /* | 990 | /* |
926 | * SLIC Sub-tables, correspond to Type in struct acpi_slic_header | 991 | * SLIC Subtables, correspond to Type in struct acpi_slic_header |
927 | */ | 992 | */ |
928 | 993 | ||
929 | /* 0: Public Key Structure */ | 994 | /* 0: Public Key Structure */ |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index e76356574374..19b26bb69a70 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -329,6 +329,15 @@ typedef u32 acpi_physical_address; | |||
329 | * | 329 | * |
330 | ******************************************************************************/ | 330 | ******************************************************************************/ |
331 | 331 | ||
332 | #ifdef ACPI_NO_MEM_ALLOCATIONS | ||
333 | |||
334 | #define ACPI_ALLOCATE(a) NULL | ||
335 | #define ACPI_ALLOCATE_ZEROED(a) NULL | ||
336 | #define ACPI_FREE(a) | ||
337 | #define ACPI_MEM_TRACKING(a) | ||
338 | |||
339 | #else /* ACPI_NO_MEM_ALLOCATIONS */ | ||
340 | |||
332 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 341 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
333 | /* | 342 | /* |
334 | * Memory allocation tracking (used by acpi_exec to detect memory leaks) | 343 | * Memory allocation tracking (used by acpi_exec to detect memory leaks) |
@@ -350,6 +359,8 @@ typedef u32 acpi_physical_address; | |||
350 | 359 | ||
351 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | 360 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ |
352 | 361 | ||
362 | #endif /* ACPI_NO_MEM_ALLOCATIONS */ | ||
363 | |||
353 | /****************************************************************************** | 364 | /****************************************************************************** |
354 | * | 365 | * |
355 | * ACPI Specification constants (Do not change unless the specification changes) | 366 | * ACPI Specification constants (Do not change unless the specification changes) |
@@ -928,9 +939,19 @@ struct acpi_object_list { | |||
928 | * Miscellaneous common Data Structures used by the interfaces | 939 | * Miscellaneous common Data Structures used by the interfaces |
929 | */ | 940 | */ |
930 | #define ACPI_NO_BUFFER 0 | 941 | #define ACPI_NO_BUFFER 0 |
942 | |||
943 | #ifdef ACPI_NO_MEM_ALLOCATIONS | ||
944 | |||
945 | #define ACPI_ALLOCATE_BUFFER (acpi_size) (0) | ||
946 | #define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (0) | ||
947 | |||
948 | #else /* ACPI_NO_MEM_ALLOCATIONS */ | ||
949 | |||
931 | #define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) /* Let ACPICA allocate buffer */ | 950 | #define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) /* Let ACPICA allocate buffer */ |
932 | #define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) /* For internal use only (enables tracking) */ | 951 | #define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) /* For internal use only (enables tracking) */ |
933 | 952 | ||
953 | #endif /* ACPI_NO_MEM_ALLOCATIONS */ | ||
954 | |||
934 | struct acpi_buffer { | 955 | struct acpi_buffer { |
935 | acpi_size length; /* Length in bytes of the buffer */ | 956 | acpi_size length; /* Length in bytes of the buffer */ |
936 | void *pointer; /* pointer to buffer */ | 957 | void *pointer; /* pointer to buffer */ |
diff --git a/include/acpi/platform/acenvex.h b/include/acpi/platform/acenvex.h new file mode 100644 index 000000000000..2b612384c994 --- /dev/null +++ b/include/acpi/platform/acenvex.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acenvex.h - Extra host and compiler configuration | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2014, 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 __ACENVEX_H__ | ||
45 | #define __ACENVEX_H__ | ||
46 | |||
47 | /*! [Begin] no source code translation */ | ||
48 | |||
49 | /****************************************************************************** | ||
50 | * | ||
51 | * Extra host configuration files. All ACPICA headers are included before | ||
52 | * including these files. | ||
53 | * | ||
54 | *****************************************************************************/ | ||
55 | |||
56 | #if defined(_LINUX) || defined(__linux__) | ||
57 | #include <acpi/platform/aclinuxex.h> | ||
58 | |||
59 | #endif | ||
60 | |||
61 | /*! [End] no source code translation !*/ | ||
62 | |||
63 | #endif /* __ACENVEX_H__ */ | ||
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index a476b9118b49..384875da3713 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h | |||
@@ -64,4 +64,15 @@ | |||
64 | */ | 64 | */ |
65 | #define ACPI_UNUSED_VAR __attribute__ ((unused)) | 65 | #define ACPI_UNUSED_VAR __attribute__ ((unused)) |
66 | 66 | ||
67 | /* | ||
68 | * Some versions of gcc implement strchr() with a buggy macro. So, | ||
69 | * undef it here. Prevents error messages of this form (usually from the | ||
70 | * file getopt.c): | ||
71 | * | ||
72 | * error: logical '&&' with non-zero constant will always evaluate as true | ||
73 | */ | ||
74 | #ifdef strchr | ||
75 | #undef strchr | ||
76 | #endif | ||
77 | |||
67 | #endif /* __ACGCC_H__ */ | 78 | #endif /* __ACGCC_H__ */ |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 93c55ed7c53d..cd1f052d55bb 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
@@ -48,7 +48,6 @@ | |||
48 | 48 | ||
49 | #define ACPI_USE_SYSTEM_CLIBRARY | 49 | #define ACPI_USE_SYSTEM_CLIBRARY |
50 | #define ACPI_USE_DO_WHILE_0 | 50 | #define ACPI_USE_DO_WHILE_0 |
51 | #define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE | ||
52 | 51 | ||
53 | #ifdef __KERNEL__ | 52 | #ifdef __KERNEL__ |
54 | 53 | ||
@@ -71,169 +70,65 @@ | |||
71 | #ifdef EXPORT_ACPI_INTERFACES | 70 | #ifdef EXPORT_ACPI_INTERFACES |
72 | #include <linux/export.h> | 71 | #include <linux/export.h> |
73 | #endif | 72 | #endif |
74 | #include <asm/acpi.h> | 73 | #include <asm/acenv.h> |
75 | 74 | ||
76 | /* Host-dependent types and defines for in-kernel ACPICA */ | 75 | #ifndef CONFIG_ACPI |
77 | 76 | ||
78 | #define ACPI_MACHINE_WIDTH BITS_PER_LONG | 77 | /* External globals for __KERNEL__, stubs is needed */ |
79 | #define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); | ||
80 | #define strtoul simple_strtoul | ||
81 | 78 | ||
82 | #define acpi_cache_t struct kmem_cache | 79 | #define ACPI_GLOBAL(t,a) |
83 | #define acpi_spinlock spinlock_t * | 80 | #define ACPI_INIT_GLOBAL(t,a,b) |
84 | #define acpi_cpu_flags unsigned long | ||
85 | 81 | ||
86 | #else /* !__KERNEL__ */ | 82 | /* Generating stubs for configurable ACPICA macros */ |
87 | 83 | ||
88 | #include <stdarg.h> | 84 | #define ACPI_NO_MEM_ALLOCATIONS |
89 | #include <string.h> | ||
90 | #include <stdlib.h> | ||
91 | #include <ctype.h> | ||
92 | #include <unistd.h> | ||
93 | 85 | ||
94 | /* Disable kernel specific declarators */ | 86 | /* Generating stubs for configurable ACPICA functions */ |
95 | 87 | ||
96 | #ifndef __init | 88 | #define ACPI_NO_ERROR_MESSAGES |
97 | #define __init | 89 | #undef ACPI_DEBUG_OUTPUT |
98 | #endif | ||
99 | |||
100 | #ifndef __iomem | ||
101 | #define __iomem | ||
102 | #endif | ||
103 | 90 | ||
104 | /* Host-dependent types and defines for user-space ACPICA */ | 91 | /* External interface for __KERNEL__, stub is needed */ |
105 | |||
106 | #define ACPI_FLUSH_CPU_CACHE() | ||
107 | #define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread)) | ||
108 | 92 | ||
109 | #if defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__) | 93 | #define ACPI_EXTERNAL_RETURN_STATUS(prototype) \ |
110 | #define ACPI_MACHINE_WIDTH 64 | 94 | static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);} |
111 | #define COMPILER_DEPENDENT_INT64 long | 95 | #define ACPI_EXTERNAL_RETURN_OK(prototype) \ |
112 | #define COMPILER_DEPENDENT_UINT64 unsigned long | 96 | static ACPI_INLINE prototype {return(AE_OK);} |
113 | #else | 97 | #define ACPI_EXTERNAL_RETURN_VOID(prototype) \ |
114 | #define ACPI_MACHINE_WIDTH 32 | 98 | static ACPI_INLINE prototype {return;} |
115 | #define COMPILER_DEPENDENT_INT64 long long | 99 | #define ACPI_EXTERNAL_RETURN_UINT32(prototype) \ |
116 | #define COMPILER_DEPENDENT_UINT64 unsigned long long | 100 | static ACPI_INLINE prototype {return(0);} |
117 | #define ACPI_USE_NATIVE_DIVIDE | 101 | #define ACPI_EXTERNAL_RETURN_PTR(prototype) \ |
118 | #endif | 102 | static ACPI_INLINE prototype {return(NULL);} |
119 | 103 | ||
120 | #ifndef __cdecl | 104 | #endif /* CONFIG_ACPI */ |
121 | #define __cdecl | ||
122 | #endif | ||
123 | 105 | ||
124 | #endif /* __KERNEL__ */ | 106 | /* Host-dependent types and defines for in-kernel ACPICA */ |
125 | 107 | ||
126 | /* Linux uses GCC */ | 108 | #define ACPI_MACHINE_WIDTH BITS_PER_LONG |
109 | #define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); | ||
110 | #define strtoul simple_strtoul | ||
127 | 111 | ||
128 | #include <acpi/platform/acgcc.h> | 112 | #define acpi_cache_t struct kmem_cache |
113 | #define acpi_spinlock spinlock_t * | ||
114 | #define acpi_cpu_flags unsigned long | ||
129 | 115 | ||
130 | #ifdef __KERNEL__ | 116 | /* Use native linux version of acpi_os_allocate_zeroed */ |
131 | 117 | ||
132 | /* | 118 | #define USE_NATIVE_ALLOCATE_ZEROED |
133 | * FIXME: Inclusion of actypes.h | ||
134 | * Linux kernel need this before defining inline OSL interfaces as | ||
135 | * actypes.h need to be included to find ACPICA type definitions. | ||
136 | * Since from ACPICA's perspective, the actypes.h should be included after | ||
137 | * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue. | ||
138 | */ | ||
139 | #include <acpi/actypes.h> | ||
140 | 119 | ||
141 | /* | 120 | /* |
142 | * Overrides for in-kernel ACPICA | 121 | * Overrides for in-kernel ACPICA |
143 | */ | 122 | */ |
144 | acpi_status __init acpi_os_initialize(void); | ||
145 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize | 123 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize |
146 | |||
147 | acpi_status acpi_os_terminate(void); | ||
148 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate | 124 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate |
149 | |||
150 | /* | ||
151 | * Memory allocation/deallocation | ||
152 | */ | ||
153 | |||
154 | /* | ||
155 | * The irqs_disabled() check is for resume from RAM. | ||
156 | * Interrupts are off during resume, just like they are for boot. | ||
157 | * However, boot has (system_state != SYSTEM_RUNNING) | ||
158 | * to quiet __might_sleep() in kmalloc() and resume does not. | ||
159 | */ | ||
160 | static inline void *acpi_os_allocate(acpi_size size) | ||
161 | { | ||
162 | return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); | ||
163 | } | ||
164 | |||
165 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate | 125 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate |
166 | |||
167 | /* Use native linux version of acpi_os_allocate_zeroed */ | ||
168 | |||
169 | static inline void *acpi_os_allocate_zeroed(acpi_size size) | ||
170 | { | ||
171 | return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); | ||
172 | } | ||
173 | |||
174 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed | 126 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed |
175 | #define USE_NATIVE_ALLOCATE_ZEROED | ||
176 | |||
177 | static inline void acpi_os_free(void *memory) | ||
178 | { | ||
179 | kfree(memory); | ||
180 | } | ||
181 | |||
182 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free | 127 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free |
183 | |||
184 | static inline void *acpi_os_acquire_object(acpi_cache_t * cache) | ||
185 | { | ||
186 | return kmem_cache_zalloc(cache, | ||
187 | irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); | ||
188 | } | ||
189 | |||
190 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object | 128 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object |
191 | |||
192 | static inline acpi_thread_id acpi_os_get_thread_id(void) | ||
193 | { | ||
194 | return (acpi_thread_id) (unsigned long)current; | ||
195 | } | ||
196 | |||
197 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id | 129 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id |
198 | |||
199 | #ifndef CONFIG_PREEMPT | ||
200 | |||
201 | /* | ||
202 | * Used within ACPICA to show where it is safe to preempt execution | ||
203 | * when CONFIG_PREEMPT=n | ||
204 | */ | ||
205 | #define ACPI_PREEMPTION_POINT() \ | ||
206 | do { \ | ||
207 | if (!irqs_disabled()) \ | ||
208 | cond_resched(); \ | ||
209 | } while (0) | ||
210 | |||
211 | #endif | ||
212 | |||
213 | /* | ||
214 | * When lockdep is enabled, the spin_lock_init() macro stringifies it's | ||
215 | * argument and uses that as a name for the lock in debugging. | ||
216 | * By executing spin_lock_init() in a macro the key changes from "lock" for | ||
217 | * all locks to the name of the argument of acpi_os_create_lock(), which | ||
218 | * prevents lockdep from reporting false positives for ACPICA locks. | ||
219 | */ | ||
220 | #define acpi_os_create_lock(__handle) \ | ||
221 | ({ \ | ||
222 | spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \ | ||
223 | if (lock) { \ | ||
224 | *(__handle) = lock; \ | ||
225 | spin_lock_init(*(__handle)); \ | ||
226 | } \ | ||
227 | lock ? AE_OK : AE_NO_MEMORY; \ | ||
228 | }) | ||
229 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock | 130 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock |
230 | 131 | ||
231 | void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length); | ||
232 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory | ||
233 | |||
234 | void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); | ||
235 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory | ||
236 | |||
237 | /* | 132 | /* |
238 | * OSL interfaces used by debugger/disassembler | 133 | * OSL interfaces used by debugger/disassembler |
239 | */ | 134 | */ |
@@ -252,11 +147,45 @@ void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); | |||
252 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename | 147 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename |
253 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory | 148 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory |
254 | 149 | ||
255 | /* | 150 | #else /* !__KERNEL__ */ |
256 | * OSL interfaces added by Linux | 151 | |
257 | */ | 152 | #include <stdarg.h> |
258 | void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size); | 153 | #include <string.h> |
154 | #include <stdlib.h> | ||
155 | #include <ctype.h> | ||
156 | #include <unistd.h> | ||
157 | |||
158 | /* Define/disable kernel-specific declarators */ | ||
159 | |||
160 | #ifndef __init | ||
161 | #define __init | ||
162 | #endif | ||
163 | |||
164 | /* Host-dependent types and defines for user-space ACPICA */ | ||
165 | |||
166 | #define ACPI_FLUSH_CPU_CACHE() | ||
167 | #define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread)) | ||
168 | |||
169 | #if defined(__ia64__) || defined(__x86_64__) ||\ | ||
170 | defined(__aarch64__) || defined(__PPC64__) | ||
171 | #define ACPI_MACHINE_WIDTH 64 | ||
172 | #define COMPILER_DEPENDENT_INT64 long | ||
173 | #define COMPILER_DEPENDENT_UINT64 unsigned long | ||
174 | #else | ||
175 | #define ACPI_MACHINE_WIDTH 32 | ||
176 | #define COMPILER_DEPENDENT_INT64 long long | ||
177 | #define COMPILER_DEPENDENT_UINT64 unsigned long long | ||
178 | #define ACPI_USE_NATIVE_DIVIDE | ||
179 | #endif | ||
180 | |||
181 | #ifndef __cdecl | ||
182 | #define __cdecl | ||
183 | #endif | ||
259 | 184 | ||
260 | #endif /* __KERNEL__ */ | 185 | #endif /* __KERNEL__ */ |
261 | 186 | ||
187 | /* Linux uses GCC */ | ||
188 | |||
189 | #include <acpi/platform/acgcc.h> | ||
190 | |||
262 | #endif /* __ACLINUX_H__ */ | 191 | #endif /* __ACLINUX_H__ */ |
diff --git a/include/acpi/platform/aclinuxex.h b/include/acpi/platform/aclinuxex.h new file mode 100644 index 000000000000..191e741cfa0e --- /dev/null +++ b/include/acpi/platform/aclinuxex.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: aclinuxex.h - Extra OS specific defines, etc. for Linux | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2014, 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 __ACLINUXEX_H__ | ||
45 | #define __ACLINUXEX_H__ | ||
46 | |||
47 | #ifdef __KERNEL__ | ||
48 | |||
49 | /* | ||
50 | * Overrides for in-kernel ACPICA | ||
51 | */ | ||
52 | acpi_status __init acpi_os_initialize(void); | ||
53 | |||
54 | acpi_status acpi_os_terminate(void); | ||
55 | |||
56 | /* | ||
57 | * The irqs_disabled() check is for resume from RAM. | ||
58 | * Interrupts are off during resume, just like they are for boot. | ||
59 | * However, boot has (system_state != SYSTEM_RUNNING) | ||
60 | * to quiet __might_sleep() in kmalloc() and resume does not. | ||
61 | */ | ||
62 | static inline void *acpi_os_allocate(acpi_size size) | ||
63 | { | ||
64 | return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); | ||
65 | } | ||
66 | |||
67 | static inline void *acpi_os_allocate_zeroed(acpi_size size) | ||
68 | { | ||
69 | return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); | ||
70 | } | ||
71 | |||
72 | static inline void acpi_os_free(void *memory) | ||
73 | { | ||
74 | kfree(memory); | ||
75 | } | ||
76 | |||
77 | static inline void *acpi_os_acquire_object(acpi_cache_t * cache) | ||
78 | { | ||
79 | return kmem_cache_zalloc(cache, | ||
80 | irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); | ||
81 | } | ||
82 | |||
83 | static inline acpi_thread_id acpi_os_get_thread_id(void) | ||
84 | { | ||
85 | return (acpi_thread_id) (unsigned long)current; | ||
86 | } | ||
87 | |||
88 | /* | ||
89 | * When lockdep is enabled, the spin_lock_init() macro stringifies it's | ||
90 | * argument and uses that as a name for the lock in debugging. | ||
91 | * By executing spin_lock_init() in a macro the key changes from "lock" for | ||
92 | * all locks to the name of the argument of acpi_os_create_lock(), which | ||
93 | * prevents lockdep from reporting false positives for ACPICA locks. | ||
94 | */ | ||
95 | #define acpi_os_create_lock(__handle) \ | ||
96 | ({ \ | ||
97 | spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \ | ||
98 | if (lock) { \ | ||
99 | *(__handle) = lock; \ | ||
100 | spin_lock_init(*(__handle)); \ | ||
101 | } \ | ||
102 | lock ? AE_OK : AE_NO_MEMORY; \ | ||
103 | }) | ||
104 | |||
105 | /* | ||
106 | * OSL interfaces added by Linux | ||
107 | */ | ||
108 | void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size); | ||
109 | |||
110 | #endif /* __KERNEL__ */ | ||
111 | |||
112 | #endif /* __ACLINUXEX_H__ */ | ||
diff --git a/include/acpi/video.h b/include/acpi/video.h index 61109f2609fc..ea4c7bbded4d 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h | |||
@@ -19,11 +19,13 @@ struct acpi_device; | |||
19 | #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) | 19 | #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) |
20 | extern int acpi_video_register(void); | 20 | extern int acpi_video_register(void); |
21 | extern void acpi_video_unregister(void); | 21 | extern void acpi_video_unregister(void); |
22 | extern void acpi_video_unregister_backlight(void); | ||
22 | extern int acpi_video_get_edid(struct acpi_device *device, int type, | 23 | extern int acpi_video_get_edid(struct acpi_device *device, int type, |
23 | int device_id, void **edid); | 24 | int device_id, void **edid); |
24 | #else | 25 | #else |
25 | static inline int acpi_video_register(void) { return 0; } | 26 | static inline int acpi_video_register(void) { return 0; } |
26 | static inline void acpi_video_unregister(void) { return; } | 27 | static inline void acpi_video_unregister(void) { return; } |
28 | static inline void acpi_video_unregister_backlight(void) { return; } | ||
27 | static inline int acpi_video_get_edid(struct acpi_device *device, int type, | 29 | static inline int acpi_video_get_edid(struct acpi_device *device, int type, |
28 | int device_id, void **edid) | 30 | int device_id, void **edid) |
29 | { | 31 | { |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 7a8f2cd66c8b..358c01b971db 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #include <linux/list.h> | 38 | #include <linux/list.h> |
39 | #include <linux/mod_devicetable.h> | 39 | #include <linux/mod_devicetable.h> |
40 | #include <linux/dynamic_debug.h> | ||
40 | 41 | ||
41 | #include <acpi/acpi.h> | 42 | #include <acpi/acpi.h> |
42 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
@@ -184,6 +185,8 @@ extern int ec_transaction(u8 command, | |||
184 | u8 *rdata, unsigned rdata_len); | 185 | u8 *rdata, unsigned rdata_len); |
185 | extern acpi_handle ec_get_handle(void); | 186 | extern acpi_handle ec_get_handle(void); |
186 | 187 | ||
188 | extern bool acpi_is_pnp_device(struct acpi_device *); | ||
189 | |||
187 | #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) | 190 | #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) |
188 | 191 | ||
189 | typedef void (*wmi_notify_handler) (u32 value, void *context); | 192 | typedef void (*wmi_notify_handler) (u32 value, void *context); |
@@ -554,14 +557,20 @@ static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } | |||
554 | int acpi_dev_suspend_late(struct device *dev); | 557 | int acpi_dev_suspend_late(struct device *dev); |
555 | int acpi_dev_resume_early(struct device *dev); | 558 | int acpi_dev_resume_early(struct device *dev); |
556 | int acpi_subsys_prepare(struct device *dev); | 559 | int acpi_subsys_prepare(struct device *dev); |
560 | void acpi_subsys_complete(struct device *dev); | ||
557 | int acpi_subsys_suspend_late(struct device *dev); | 561 | int acpi_subsys_suspend_late(struct device *dev); |
558 | int acpi_subsys_resume_early(struct device *dev); | 562 | int acpi_subsys_resume_early(struct device *dev); |
563 | int acpi_subsys_suspend(struct device *dev); | ||
564 | int acpi_subsys_freeze(struct device *dev); | ||
559 | #else | 565 | #else |
560 | static inline int acpi_dev_suspend_late(struct device *dev) { return 0; } | 566 | static inline int acpi_dev_suspend_late(struct device *dev) { return 0; } |
561 | static inline int acpi_dev_resume_early(struct device *dev) { return 0; } | 567 | static inline int acpi_dev_resume_early(struct device *dev) { return 0; } |
562 | static inline int acpi_subsys_prepare(struct device *dev) { return 0; } | 568 | static inline int acpi_subsys_prepare(struct device *dev) { return 0; } |
569 | static inline void acpi_subsys_complete(struct device *dev) {} | ||
563 | static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } | 570 | static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } |
564 | static inline int acpi_subsys_resume_early(struct device *dev) { return 0; } | 571 | static inline int acpi_subsys_resume_early(struct device *dev) { return 0; } |
572 | static inline int acpi_subsys_suspend(struct device *dev) { return 0; } | ||
573 | static inline int acpi_subsys_freeze(struct device *dev) { return 0; } | ||
565 | #endif | 574 | #endif |
566 | 575 | ||
567 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM) | 576 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM) |
@@ -589,6 +598,14 @@ static inline __printf(3, 4) void | |||
589 | acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} | 598 | acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} |
590 | #endif /* !CONFIG_ACPI */ | 599 | #endif /* !CONFIG_ACPI */ |
591 | 600 | ||
601 | #if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG) | ||
602 | __printf(3, 4) | ||
603 | void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const char *fmt, ...); | ||
604 | #else | ||
605 | #define __acpi_handle_debug(descriptor, handle, fmt, ...) \ | ||
606 | acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); | ||
607 | #endif | ||
608 | |||
592 | /* | 609 | /* |
593 | * acpi_handle_<level>: Print message with ACPI prefix and object path | 610 | * acpi_handle_<level>: Print message with ACPI prefix and object path |
594 | * | 611 | * |
@@ -610,11 +627,19 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} | |||
610 | #define acpi_handle_info(handle, fmt, ...) \ | 627 | #define acpi_handle_info(handle, fmt, ...) \ |
611 | acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__) | 628 | acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__) |
612 | 629 | ||
613 | /* REVISIT: Support CONFIG_DYNAMIC_DEBUG when necessary */ | 630 | #if defined(DEBUG) |
614 | #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG) | ||
615 | #define acpi_handle_debug(handle, fmt, ...) \ | 631 | #define acpi_handle_debug(handle, fmt, ...) \ |
616 | acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__) | 632 | acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__) |
617 | #else | 633 | #else |
634 | #if defined(CONFIG_DYNAMIC_DEBUG) | ||
635 | #define acpi_handle_debug(handle, fmt, ...) \ | ||
636 | do { \ | ||
637 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | ||
638 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ | ||
639 | __acpi_handle_debug(&descriptor, handle, pr_fmt(fmt), \ | ||
640 | ##__VA_ARGS__); \ | ||
641 | } while (0) | ||
642 | #else | ||
618 | #define acpi_handle_debug(handle, fmt, ...) \ | 643 | #define acpi_handle_debug(handle, fmt, ...) \ |
619 | ({ \ | 644 | ({ \ |
620 | if (0) \ | 645 | if (0) \ |
@@ -622,5 +647,6 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} | |||
622 | 0; \ | 647 | 0; \ |
623 | }) | 648 | }) |
624 | #endif | 649 | #endif |
650 | #endif | ||
625 | 651 | ||
626 | #endif /*_LINUX_ACPI_H*/ | 652 | #endif /*_LINUX_ACPI_H*/ |
diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 72647429adf6..adb14a8616df 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h | |||
@@ -40,6 +40,11 @@ enum backlight_type { | |||
40 | BACKLIGHT_TYPE_MAX, | 40 | BACKLIGHT_TYPE_MAX, |
41 | }; | 41 | }; |
42 | 42 | ||
43 | enum backlight_notification { | ||
44 | BACKLIGHT_REGISTERED, | ||
45 | BACKLIGHT_UNREGISTERED, | ||
46 | }; | ||
47 | |||
43 | struct backlight_device; | 48 | struct backlight_device; |
44 | struct fb_info; | 49 | struct fb_info; |
45 | 50 | ||
@@ -133,6 +138,8 @@ extern void devm_backlight_device_unregister(struct device *dev, | |||
133 | extern void backlight_force_update(struct backlight_device *bd, | 138 | extern void backlight_force_update(struct backlight_device *bd, |
134 | enum backlight_update_reason reason); | 139 | enum backlight_update_reason reason); |
135 | extern bool backlight_device_registered(enum backlight_type type); | 140 | extern bool backlight_device_registered(enum backlight_type type); |
141 | extern int backlight_register_notifier(struct notifier_block *nb); | ||
142 | extern int backlight_unregister_notifier(struct notifier_block *nb); | ||
136 | 143 | ||
137 | #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) | 144 | #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) |
138 | 145 | ||
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 511917416fb0..fb4eca6907cd 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -413,6 +413,37 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name, | |||
413 | const char *parent_name, unsigned long flags, | 413 | const char *parent_name, unsigned long flags, |
414 | unsigned int mult, unsigned int div); | 414 | unsigned int mult, unsigned int div); |
415 | 415 | ||
416 | /** | ||
417 | * struct clk_fractional_divider - adjustable fractional divider clock | ||
418 | * | ||
419 | * @hw: handle between common and hardware-specific interfaces | ||
420 | * @reg: register containing the divider | ||
421 | * @mshift: shift to the numerator bit field | ||
422 | * @mwidth: width of the numerator bit field | ||
423 | * @nshift: shift to the denominator bit field | ||
424 | * @nwidth: width of the denominator bit field | ||
425 | * @lock: register lock | ||
426 | * | ||
427 | * Clock with adjustable fractional divider affecting its output frequency. | ||
428 | */ | ||
429 | |||
430 | struct clk_fractional_divider { | ||
431 | struct clk_hw hw; | ||
432 | void __iomem *reg; | ||
433 | u8 mshift; | ||
434 | u32 mmask; | ||
435 | u8 nshift; | ||
436 | u32 nmask; | ||
437 | u8 flags; | ||
438 | spinlock_t *lock; | ||
439 | }; | ||
440 | |||
441 | extern const struct clk_ops clk_fractional_divider_ops; | ||
442 | struct clk *clk_register_fractional_divider(struct device *dev, | ||
443 | const char *name, const char *parent_name, unsigned long flags, | ||
444 | void __iomem *reg, u8 mshift, u8 mwidth, u8 nshift, u8 nwidth, | ||
445 | u8 clk_divider_flags, spinlock_t *lock); | ||
446 | |||
416 | /*** | 447 | /*** |
417 | * struct clk_composite - aggregate clock of mux, divider and gate clocks | 448 | * struct clk_composite - aggregate clock of mux, divider and gate clocks |
418 | * | 449 | * |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 5ae5100c1f24..3f458896d45c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -110,6 +110,7 @@ struct cpufreq_policy { | |||
110 | bool transition_ongoing; /* Tracks transition status */ | 110 | bool transition_ongoing; /* Tracks transition status */ |
111 | spinlock_t transition_lock; | 111 | spinlock_t transition_lock; |
112 | wait_queue_head_t transition_wait; | 112 | wait_queue_head_t transition_wait; |
113 | struct task_struct *transition_task; /* Task which is doing the transition */ | ||
113 | }; | 114 | }; |
114 | 115 | ||
115 | /* Only for ACPI */ | 116 | /* Only for ACPI */ |
@@ -468,6 +469,55 @@ struct cpufreq_frequency_table { | |||
468 | * order */ | 469 | * order */ |
469 | }; | 470 | }; |
470 | 471 | ||
472 | #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) | ||
473 | int dev_pm_opp_init_cpufreq_table(struct device *dev, | ||
474 | struct cpufreq_frequency_table **table); | ||
475 | void dev_pm_opp_free_cpufreq_table(struct device *dev, | ||
476 | struct cpufreq_frequency_table **table); | ||
477 | #else | ||
478 | static inline int dev_pm_opp_init_cpufreq_table(struct device *dev, | ||
479 | struct cpufreq_frequency_table | ||
480 | **table) | ||
481 | { | ||
482 | return -EINVAL; | ||
483 | } | ||
484 | |||
485 | static inline void dev_pm_opp_free_cpufreq_table(struct device *dev, | ||
486 | struct cpufreq_frequency_table | ||
487 | **table) | ||
488 | { | ||
489 | } | ||
490 | #endif | ||
491 | |||
492 | static inline bool cpufreq_next_valid(struct cpufreq_frequency_table **pos) | ||
493 | { | ||
494 | while ((*pos)->frequency != CPUFREQ_TABLE_END) | ||
495 | if ((*pos)->frequency != CPUFREQ_ENTRY_INVALID) | ||
496 | return true; | ||
497 | else | ||
498 | (*pos)++; | ||
499 | return false; | ||
500 | } | ||
501 | |||
502 | /* | ||
503 | * cpufreq_for_each_entry - iterate over a cpufreq_frequency_table | ||
504 | * @pos: the cpufreq_frequency_table * to use as a loop cursor. | ||
505 | * @table: the cpufreq_frequency_table * to iterate over. | ||
506 | */ | ||
507 | |||
508 | #define cpufreq_for_each_entry(pos, table) \ | ||
509 | for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++) | ||
510 | |||
511 | /* | ||
512 | * cpufreq_for_each_valid_entry - iterate over a cpufreq_frequency_table | ||
513 | * excluding CPUFREQ_ENTRY_INVALID frequencies. | ||
514 | * @pos: the cpufreq_frequency_table * to use as a loop cursor. | ||
515 | * @table: the cpufreq_frequency_table * to iterate over. | ||
516 | */ | ||
517 | |||
518 | #define cpufreq_for_each_valid_entry(pos, table) \ | ||
519 | for (pos = table; cpufreq_next_valid(&pos); pos++) | ||
520 | |||
471 | int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, | 521 | int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, |
472 | struct cpufreq_frequency_table *table); | 522 | struct cpufreq_frequency_table *table); |
473 | 523 | ||
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index d48dc00232a4..f1863dcd83ea 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h | |||
@@ -181,6 +181,12 @@ extern struct devfreq *devfreq_add_device(struct device *dev, | |||
181 | const char *governor_name, | 181 | const char *governor_name, |
182 | void *data); | 182 | void *data); |
183 | extern int devfreq_remove_device(struct devfreq *devfreq); | 183 | extern int devfreq_remove_device(struct devfreq *devfreq); |
184 | extern struct devfreq *devm_devfreq_add_device(struct device *dev, | ||
185 | struct devfreq_dev_profile *profile, | ||
186 | const char *governor_name, | ||
187 | void *data); | ||
188 | extern void devm_devfreq_remove_device(struct device *dev, | ||
189 | struct devfreq *devfreq); | ||
184 | 190 | ||
185 | /* Supposed to be called by PM_SLEEP/PM_RUNTIME callbacks */ | 191 | /* Supposed to be called by PM_SLEEP/PM_RUNTIME callbacks */ |
186 | extern int devfreq_suspend_device(struct devfreq *devfreq); | 192 | extern int devfreq_suspend_device(struct devfreq *devfreq); |
@@ -193,6 +199,10 @@ extern int devfreq_register_opp_notifier(struct device *dev, | |||
193 | struct devfreq *devfreq); | 199 | struct devfreq *devfreq); |
194 | extern int devfreq_unregister_opp_notifier(struct device *dev, | 200 | extern int devfreq_unregister_opp_notifier(struct device *dev, |
195 | struct devfreq *devfreq); | 201 | struct devfreq *devfreq); |
202 | extern int devm_devfreq_register_opp_notifier(struct device *dev, | ||
203 | struct devfreq *devfreq); | ||
204 | extern void devm_devfreq_unregister_opp_notifier(struct device *dev, | ||
205 | struct devfreq *devfreq); | ||
196 | 206 | ||
197 | #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) | 207 | #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) |
198 | /** | 208 | /** |
@@ -220,7 +230,7 @@ static inline struct devfreq *devfreq_add_device(struct device *dev, | |||
220 | const char *governor_name, | 230 | const char *governor_name, |
221 | void *data) | 231 | void *data) |
222 | { | 232 | { |
223 | return NULL; | 233 | return ERR_PTR(-ENOSYS); |
224 | } | 234 | } |
225 | 235 | ||
226 | static inline int devfreq_remove_device(struct devfreq *devfreq) | 236 | static inline int devfreq_remove_device(struct devfreq *devfreq) |
@@ -228,6 +238,19 @@ static inline int devfreq_remove_device(struct devfreq *devfreq) | |||
228 | return 0; | 238 | return 0; |
229 | } | 239 | } |
230 | 240 | ||
241 | static inline struct devfreq *devm_devfreq_add_device(struct device *dev, | ||
242 | struct devfreq_dev_profile *profile, | ||
243 | const char *governor_name, | ||
244 | void *data) | ||
245 | { | ||
246 | return ERR_PTR(-ENOSYS); | ||
247 | } | ||
248 | |||
249 | static inline void devm_devfreq_remove_device(struct device *dev, | ||
250 | struct devfreq *devfreq) | ||
251 | { | ||
252 | } | ||
253 | |||
231 | static inline int devfreq_suspend_device(struct devfreq *devfreq) | 254 | static inline int devfreq_suspend_device(struct devfreq *devfreq) |
232 | { | 255 | { |
233 | return 0; | 256 | return 0; |
@@ -256,6 +279,16 @@ static inline int devfreq_unregister_opp_notifier(struct device *dev, | |||
256 | return -EINVAL; | 279 | return -EINVAL; |
257 | } | 280 | } |
258 | 281 | ||
282 | static inline int devm_devfreq_register_opp_notifier(struct device *dev, | ||
283 | struct devfreq *devfreq) | ||
284 | { | ||
285 | return -EINVAL; | ||
286 | } | ||
287 | |||
288 | static inline void devm_devfreq_unregister_opp_notifier(struct device *dev, | ||
289 | struct devfreq *devfreq) | ||
290 | { | ||
291 | } | ||
259 | #endif /* CONFIG_PM_DEVFREQ */ | 292 | #endif /* CONFIG_PM_DEVFREQ */ |
260 | 293 | ||
261 | #endif /* __LINUX_DEVFREQ_H__ */ | 294 | #endif /* __LINUX_DEVFREQ_H__ */ |
diff --git a/include/linux/pm.h b/include/linux/pm.h index d915d0345fa1..72c0fe098a27 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -93,13 +93,23 @@ typedef struct pm_message { | |||
93 | * been registered) to recover from the race condition. | 93 | * been registered) to recover from the race condition. |
94 | * This method is executed for all kinds of suspend transitions and is | 94 | * This method is executed for all kinds of suspend transitions and is |
95 | * followed by one of the suspend callbacks: @suspend(), @freeze(), or | 95 | * followed by one of the suspend callbacks: @suspend(), @freeze(), or |
96 | * @poweroff(). The PM core executes subsystem-level @prepare() for all | 96 | * @poweroff(). If the transition is a suspend to memory or standby (that |
97 | * devices before starting to invoke suspend callbacks for any of them, so | 97 | * is, not related to hibernation), the return value of @prepare() may be |
98 | * generally devices may be assumed to be functional or to respond to | 98 | * used to indicate to the PM core to leave the device in runtime suspend |
99 | * runtime resume requests while @prepare() is being executed. However, | 99 | * if applicable. Namely, if @prepare() returns a positive number, the PM |
100 | * device drivers may NOT assume anything about the availability of user | 100 | * core will understand that as a declaration that the device appears to be |
101 | * space at that time and it is NOT valid to request firmware from within | 101 | * runtime-suspended and it may be left in that state during the entire |
102 | * @prepare() (it's too late to do that). It also is NOT valid to allocate | 102 | * transition and during the subsequent resume if all of its descendants |
103 | * are left in runtime suspend too. If that happens, @complete() will be | ||
104 | * executed directly after @prepare() and it must ensure the proper | ||
105 | * functioning of the device after the system resume. | ||
106 | * The PM core executes subsystem-level @prepare() for all devices before | ||
107 | * starting to invoke suspend callbacks for any of them, so generally | ||
108 | * devices may be assumed to be functional or to respond to runtime resume | ||
109 | * requests while @prepare() is being executed. However, device drivers | ||
110 | * may NOT assume anything about the availability of user space at that | ||
111 | * time and it is NOT valid to request firmware from within @prepare() | ||
112 | * (it's too late to do that). It also is NOT valid to allocate | ||
103 | * substantial amounts of memory from @prepare() in the GFP_KERNEL mode. | 113 | * substantial amounts of memory from @prepare() in the GFP_KERNEL mode. |
104 | * [To work around these limitations, drivers may register suspend and | 114 | * [To work around these limitations, drivers may register suspend and |
105 | * hibernation notifiers to be executed before the freezing of tasks.] | 115 | * hibernation notifiers to be executed before the freezing of tasks.] |
@@ -112,7 +122,16 @@ typedef struct pm_message { | |||
112 | * of the other devices that the PM core has unsuccessfully attempted to | 122 | * of the other devices that the PM core has unsuccessfully attempted to |
113 | * suspend earlier). | 123 | * suspend earlier). |
114 | * The PM core executes subsystem-level @complete() after it has executed | 124 | * The PM core executes subsystem-level @complete() after it has executed |
115 | * the appropriate resume callbacks for all devices. | 125 | * the appropriate resume callbacks for all devices. If the corresponding |
126 | * @prepare() at the beginning of the suspend transition returned a | ||
127 | * positive number and the device was left in runtime suspend (without | ||
128 | * executing any suspend and resume callbacks for it), @complete() will be | ||
129 | * the only callback executed for the device during resume. In that case, | ||
130 | * @complete() must be prepared to do whatever is necessary to ensure the | ||
131 | * proper functioning of the device after the system resume. To this end, | ||
132 | * @complete() can check the power.direct_complete flag of the device to | ||
133 | * learn whether (unset) or not (set) the previous suspend and resume | ||
134 | * callbacks have been executed for it. | ||
116 | * | 135 | * |
117 | * @suspend: Executed before putting the system into a sleep state in which the | 136 | * @suspend: Executed before putting the system into a sleep state in which the |
118 | * contents of main memory are preserved. The exact action to perform | 137 | * contents of main memory are preserved. The exact action to perform |
@@ -546,6 +565,7 @@ struct dev_pm_info { | |||
546 | bool is_late_suspended:1; | 565 | bool is_late_suspended:1; |
547 | bool ignore_children:1; | 566 | bool ignore_children:1; |
548 | bool early_init:1; /* Owned by the PM core */ | 567 | bool early_init:1; /* Owned by the PM core */ |
568 | bool direct_complete:1; /* Owned by the PM core */ | ||
549 | spinlock_t lock; | 569 | spinlock_t lock; |
550 | #ifdef CONFIG_PM_SLEEP | 570 | #ifdef CONFIG_PM_SLEEP |
551 | struct list_head entry; | 571 | struct list_head entry; |
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 5151b0059585..0330217abfad 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h | |||
@@ -15,7 +15,6 @@ | |||
15 | #define __LINUX_OPP_H__ | 15 | #define __LINUX_OPP_H__ |
16 | 16 | ||
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/cpufreq.h> | ||
19 | #include <linux/notifier.h> | 18 | #include <linux/notifier.h> |
20 | 19 | ||
21 | struct dev_pm_opp; | 20 | struct dev_pm_opp; |
@@ -117,23 +116,4 @@ static inline int of_init_opp_table(struct device *dev) | |||
117 | } | 116 | } |
118 | #endif | 117 | #endif |
119 | 118 | ||
120 | #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) | ||
121 | int dev_pm_opp_init_cpufreq_table(struct device *dev, | ||
122 | struct cpufreq_frequency_table **table); | ||
123 | void dev_pm_opp_free_cpufreq_table(struct device *dev, | ||
124 | struct cpufreq_frequency_table **table); | ||
125 | #else | ||
126 | static inline int dev_pm_opp_init_cpufreq_table(struct device *dev, | ||
127 | struct cpufreq_frequency_table **table) | ||
128 | { | ||
129 | return -EINVAL; | ||
130 | } | ||
131 | |||
132 | static inline | ||
133 | void dev_pm_opp_free_cpufreq_table(struct device *dev, | ||
134 | struct cpufreq_frequency_table **table) | ||
135 | { | ||
136 | } | ||
137 | #endif /* CONFIG_CPU_FREQ */ | ||
138 | |||
139 | #endif /* __LINUX_OPP_H__ */ | 119 | #endif /* __LINUX_OPP_H__ */ |
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 2a5897a4afbc..43fd6716f662 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
@@ -101,6 +101,11 @@ static inline bool pm_runtime_status_suspended(struct device *dev) | |||
101 | return dev->power.runtime_status == RPM_SUSPENDED; | 101 | return dev->power.runtime_status == RPM_SUSPENDED; |
102 | } | 102 | } |
103 | 103 | ||
104 | static inline bool pm_runtime_suspended_if_enabled(struct device *dev) | ||
105 | { | ||
106 | return pm_runtime_status_suspended(dev) && dev->power.disable_depth == 1; | ||
107 | } | ||
108 | |||
104 | static inline bool pm_runtime_enabled(struct device *dev) | 109 | static inline bool pm_runtime_enabled(struct device *dev) |
105 | { | 110 | { |
106 | return !dev->power.disable_depth; | 111 | return !dev->power.disable_depth; |
@@ -150,6 +155,7 @@ static inline void device_set_run_wake(struct device *dev, bool enable) {} | |||
150 | static inline bool pm_runtime_suspended(struct device *dev) { return false; } | 155 | static inline bool pm_runtime_suspended(struct device *dev) { return false; } |
151 | static inline bool pm_runtime_active(struct device *dev) { return true; } | 156 | static inline bool pm_runtime_active(struct device *dev) { return true; } |
152 | static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } | 157 | static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } |
158 | static inline bool pm_runtime_suspended_if_enabled(struct device *dev) { return false; } | ||
153 | static inline bool pm_runtime_enabled(struct device *dev) { return false; } | 159 | static inline bool pm_runtime_enabled(struct device *dev) { return false; } |
154 | 160 | ||
155 | static inline void pm_runtime_no_callbacks(struct device *dev) {} | 161 | static inline void pm_runtime_no_callbacks(struct device *dev) {} |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index c9dc4e09854c..f2b76aeaf4e4 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -264,6 +264,8 @@ static inline int power_supply_is_system_supplied(void) { return -ENOSYS; } | |||
264 | 264 | ||
265 | extern int power_supply_register(struct device *parent, | 265 | extern int power_supply_register(struct device *parent, |
266 | struct power_supply *psy); | 266 | struct power_supply *psy); |
267 | extern int power_supply_register_no_ws(struct device *parent, | ||
268 | struct power_supply *psy); | ||
267 | extern void power_supply_unregister(struct power_supply *psy); | 269 | extern void power_supply_unregister(struct power_supply *psy); |
268 | extern int power_supply_powers(struct power_supply *psy, struct device *dev); | 270 | extern int power_supply_powers(struct power_supply *psy, struct device *dev); |
269 | 271 | ||
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index f73cabf59012..91d66fd8dce1 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -187,6 +187,11 @@ struct platform_suspend_ops { | |||
187 | void (*recover)(void); | 187 | void (*recover)(void); |
188 | }; | 188 | }; |
189 | 189 | ||
190 | struct platform_freeze_ops { | ||
191 | int (*begin)(void); | ||
192 | void (*end)(void); | ||
193 | }; | ||
194 | |||
190 | #ifdef CONFIG_SUSPEND | 195 | #ifdef CONFIG_SUSPEND |
191 | /** | 196 | /** |
192 | * suspend_set_ops - set platform dependent suspend operations | 197 | * suspend_set_ops - set platform dependent suspend operations |
@@ -194,6 +199,7 @@ struct platform_suspend_ops { | |||
194 | */ | 199 | */ |
195 | extern void suspend_set_ops(const struct platform_suspend_ops *ops); | 200 | extern void suspend_set_ops(const struct platform_suspend_ops *ops); |
196 | extern int suspend_valid_only_mem(suspend_state_t state); | 201 | extern int suspend_valid_only_mem(suspend_state_t state); |
202 | extern void freeze_set_ops(const struct platform_freeze_ops *ops); | ||
197 | extern void freeze_wake(void); | 203 | extern void freeze_wake(void); |
198 | 204 | ||
199 | /** | 205 | /** |
@@ -220,6 +226,7 @@ extern int pm_suspend(suspend_state_t state); | |||
220 | 226 | ||
221 | static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} | 227 | static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} |
222 | static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } | 228 | static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } |
229 | static inline void freeze_set_ops(const struct platform_freeze_ops *ops) {} | ||
223 | static inline void freeze_wake(void) {} | 230 | static inline void freeze_wake(void) {} |
224 | #endif /* !CONFIG_SUSPEND */ | 231 | #endif /* !CONFIG_SUSPEND */ |
225 | 232 | ||