aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/acpi.h4
-rw-r--r--include/acpi/acpi_bus.h9
-rw-r--r--include/acpi/acpi_drivers.h5
-rw-r--r--include/acpi/acpi_io.h3
-rw-r--r--include/acpi/acpixf.h838
-rw-r--r--include/acpi/actbl.h11
-rw-r--r--include/acpi/actbl1.h4
-rw-r--r--include/acpi/actbl2.h71
-rw-r--r--include/acpi/actypes.h21
-rw-r--r--include/acpi/platform/acenvex.h63
-rw-r--r--include/acpi/platform/acgcc.h11
-rw-r--r--include/acpi/platform/aclinux.h209
-rw-r--r--include/acpi/platform/aclinuxex.h112
-rw-r--r--include/acpi/video.h2
14 files changed, 935 insertions, 428 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(
131struct acpi_scan_handler { 131struct 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 {
232struct acpi_pnp_type { 233struct 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
238struct acpi_device_pnp { 240struct 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
267struct acpi_device_power_state { 270struct acpi_device_power_state {
@@ -406,6 +409,8 @@ extern struct kobject *acpi_kobj;
406extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); 409extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
407void acpi_bus_private_data_handler(acpi_handle, void *); 410void acpi_bus_private_data_handler(acpi_handle, void *);
408int acpi_bus_get_private_data(acpi_handle, void **); 411int acpi_bus_get_private_data(acpi_handle, void **);
412int acpi_bus_attach_private_data(acpi_handle, void *);
413void acpi_bus_detach_private_data(acpi_handle);
409void acpi_bus_no_hotplug(acpi_handle handle); 414void acpi_bus_no_hotplug(acpi_handle handle);
410extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); 415extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
411extern int register_acpi_notifier(struct notifier_block *); 416extern 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
98struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root); 98struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root);
99
100#ifdef CONFIG_X86
99void pci_acpi_crs_quirks(void); 101void pci_acpi_crs_quirks(void);
102#else
103static 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
12void __iomem *__init_refok
13acpi_os_map_iomem(acpi_physical_address phys, acpi_size size);
14void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size);
12void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); 15void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
13 16
14int acpi_os_map_generic_address(struct acpi_generic_address *addr); 17int 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
56extern u8 acpi_gbl_permanent_mmap; 56extern 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 */
61extern u32 acpi_current_gpe_count; 70#ifdef DEFINE_ACPI_GLOBALS
62extern struct acpi_table_fadt acpi_gbl_FADT; 71#define ACPI_GLOBAL(type,name) \
63extern u8 acpi_gbl_system_awake_and_running; 72 extern type name; \
64extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */ 73 type name
65extern 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
69extern u32 acpi_dbg_level; 78#else
70extern 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
74extern u8 acpi_gbl_auto_serialize_methods; 84#ifndef ACPI_INIT_GLOBAL
75extern u8 acpi_gbl_copy_dsdt_locally; 85#define ACPI_INIT_GLOBAL(type,name,value) \
76extern u8 acpi_gbl_create_osi_method; 86 extern type name
77extern u8 acpi_gbl_disable_auto_repair; 87#endif
78extern u8 acpi_gbl_disable_ssdt_table_load; 88#endif
79extern u8 acpi_gbl_do_not_use_xsdt;
80extern u8 acpi_gbl_enable_aml_debug_object;
81extern u8 acpi_gbl_enable_interpreter_slack;
82extern u32 acpi_gbl_trace_flags;
83extern acpi_name acpi_gbl_trace_method_name;
84extern u8 acpi_gbl_truncate_io_addresses;
85extern u8 acpi_gbl_use32_bit_fadt_addresses;
86extern 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 */
118acpi_status __init 140ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE);
119acpi_initialize_tables(struct acpi_table_desc *initial_storage,
120 u32 initial_table_count, u8 allow_resize);
121
122acpi_status __init acpi_initialize_subsystem(void);
123 141
124acpi_status __init acpi_enable_subsystem(u32 flags); 142/*
125 143 * Automatically serialize all methods that create named objects? Default
126acpi_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 */
149ACPI_INIT_GLOBAL(u8, acpi_gbl_auto_serialize_methods, TRUE);
127 150
128acpi_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 */
156ACPI_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 */
133ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void)) 162ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE);
134ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
135#ifdef ACPI_FUTURE_USAGE
136acpi_status acpi_subsystem_status(void);
137#endif
138 163
139#ifdef ACPI_FUTURE_USAGE 164/*
140acpi_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 */
171ACPI_INIT_GLOBAL(u8, acpi_gbl_verify_table_checksum, TRUE);
142 172
143acpi_status acpi_get_statistics(struct acpi_statistics *stats); 173/*
174 * Optionally enable output from the AML Debug Object.
175 */
176ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_aml_debug_object, FALSE);
144 177
145const 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 */
184ACPI_INIT_GLOBAL(u8, acpi_gbl_copy_dsdt_locally, FALSE);
146 185
147acpi_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 */
192ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
148 193
149acpi_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 */
202ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
150 203
151acpi_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 */
210ACPI_INIT_GLOBAL(u8, acpi_gbl_truncate_io_addresses, FALSE);
152 211
153acpi_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 */
216ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_auto_repair, FALSE);
154 217
155u32 218/*
156acpi_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 */
222ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE);
159 223
160acpi_status 224/*
161acpi_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 */
228ACPI_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 */
167acpi_status acpi_load_table(struct acpi_table_header *table); 235ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE);
168 236
169acpi_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 */
241ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_flags, 0);
242ACPI_INIT_GLOBAL(acpi_name, acpi_gbl_trace_method_name, 0);
170 243
171acpi_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 */
249ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_DEBUG_DEFAULT);
250ACPI_INIT_GLOBAL(u32, acpi_dbg_layer, 0);
172 251
173/* 252/*
174 * ACPI table manipulation interfaces 253 * Other miscellaneous globals
175 */ 254 */
176acpi_status __init acpi_reallocate_root_table(void); 255ACPI_GLOBAL(struct acpi_table_fadt, acpi_gbl_FADT);
256ACPI_GLOBAL(u32, acpi_current_gpe_count);
257ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running);
177 258
178acpi_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
180acpi_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
182acpi_status 286#define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
183acpi_get_table_header(acpi_string signature, 287 ACPI_EXTERNAL_RETURN_OK(prototype)
184 u32 instance, struct acpi_table_header *out_table_header);
185 288
186acpi_status 289#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
187acpi_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
191acpi_status 292#else
192acpi_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
195acpi_status 296#define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
196acpi_get_table_by_index(u32 table_index, struct acpi_table_header **out_table); 297 static ACPI_INLINE prototype {return(AE_OK);}
197 298
198acpi_status 299#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
199acpi_install_table_handler(acpi_table_handler handler, void *context); 300 static ACPI_INLINE prototype {return;}
200 301
201acpi_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 */
206acpi_status 311#ifndef ACPI_NO_ERROR_MESSAGES
207acpi_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
214acpi_status 315#else
215acpi_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
219acpi_status 319#endif /* ACPI_NO_ERROR_MESSAGES */
220acpi_get_name(acpi_handle object,
221 u32 name_type, struct acpi_buffer *ret_path_ptr);
222 320
223acpi_status 321/*
224acpi_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
227acpi_status 332#else
228acpi_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
230acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler); 336#endif /* ACPI_DEBUG_OUTPUT */
231 337
232acpi_status 338/*****************************************************************************
233acpi_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
236acpi_status 344/*
237acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data); 345 * Initialization
346 */
347ACPI_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))
352ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_initialize_subsystem(void))
238 353
239acpi_status 354ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_enable_subsystem(u32 flags))
240acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags); 355
356ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
357 acpi_initialize_objects(u32 flags))
358ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_terminate(void))
241 359
242/* 360/*
243 * Object manipulation and enumeration 361 * Miscellaneous global interfaces
244 */ 362 */
245acpi_status 363ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void))
246acpi_evaluate_object(acpi_handle object, 364ACPI_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, 366ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_subsystem_status(void))
249 struct acpi_buffer *return_object_buffer); 367#endif
250 368
251acpi_status 369#ifdef ACPI_FUTURE_USAGE
252acpi_evaluate_object_typed(acpi_handle object, 370ACPI_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); 374ACPI_EXTERNAL_RETURN_STATUS(acpi_status
375 acpi_get_statistics(struct acpi_statistics *stats))
376ACPI_EXTERNAL_RETURN_PTR(const char
377 *acpi_format_exception(acpi_status exception))
378ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_purge_cached_objects(void))
379
380ACPI_EXTERNAL_RETURN_STATUS(acpi_status
381 acpi_install_interface(acpi_string interface_name))
382
383ACPI_EXTERNAL_RETURN_STATUS(acpi_status
384 acpi_remove_interface(acpi_string interface_name))
385ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_update_interfaces(u8 action))
386
387ACPI_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))
393ACPI_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
258acpi_status 399/*
259acpi_get_object_info(acpi_handle object, 400 * ACPI table load/unload interfaces
260 struct acpi_device_info **return_buffer); 401 */
402ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
403 acpi_install_table(acpi_physical_address address,
404 u8 physical))
261 405
262acpi_status acpi_install_method(u8 *buffer); 406ACPI_EXTERNAL_RETURN_STATUS(acpi_status
407 acpi_load_table(struct acpi_table_header *table))
263 408
264acpi_status 409ACPI_EXTERNAL_RETURN_STATUS(acpi_status
265acpi_get_next_object(acpi_object_type type, 410 acpi_unload_parent_table(acpi_handle object))
266 acpi_handle parent, 411ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_load_tables(void))
267 acpi_handle child, acpi_handle * out_handle);
268 412
269acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type); 413/*
414 * ACPI table manipulation interfaces
415 */
416ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void))
417
418ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
419 acpi_find_root_pointer(acpi_size * rsdp_address))
420
421ACPI_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))
426ACPI_EXTERNAL_RETURN_STATUS(acpi_status
427 acpi_get_table(acpi_string signature, u32 instance,
428 struct acpi_table_header
429 **out_table))
430ACPI_EXTERNAL_RETURN_STATUS(acpi_status
431 acpi_get_table_by_index(u32 table_index,
432 struct acpi_table_header
433 **out_table))
434ACPI_EXTERNAL_RETURN_STATUS(acpi_status
435 acpi_install_table_handler(acpi_table_handler
436 handler, void *context))
437ACPI_EXTERNAL_RETURN_STATUS(acpi_status
438 acpi_remove_table_handler(acpi_table_handler
439 handler))
270 440
271acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type); 441/*
442 * Namespace and name interfaces
443 */
444ACPI_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))
454ACPI_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))
459ACPI_EXTERNAL_RETURN_STATUS(acpi_status
460 acpi_get_name(acpi_handle object, u32 name_type,
461 struct acpi_buffer *ret_path_ptr))
462ACPI_EXTERNAL_RETURN_STATUS(acpi_status
463 acpi_get_handle(acpi_handle parent,
464 acpi_string pathname,
465 acpi_handle * ret_handle))
466ACPI_EXTERNAL_RETURN_STATUS(acpi_status
467 acpi_attach_data(acpi_handle object,
468 acpi_object_handler handler,
469 void *data))
470ACPI_EXTERNAL_RETURN_STATUS(acpi_status
471 acpi_detach_data(acpi_handle object,
472 acpi_object_handler handler))
473ACPI_EXTERNAL_RETURN_STATUS(acpi_status
474 acpi_get_data(acpi_handle object,
475 acpi_object_handler handler,
476 void **data))
477ACPI_EXTERNAL_RETURN_STATUS(acpi_status
478 acpi_debug_trace(char *name, u32 debug_level,
479 u32 debug_layer, u32 flags))
272 480
273acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle); 481/*
482 * Object manipulation and enumeration
483 */
484ACPI_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))
491ACPI_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))
500ACPI_EXTERNAL_RETURN_STATUS(acpi_status
501 acpi_get_object_info(acpi_handle object,
502 struct acpi_device_info
503 **return_buffer))
504ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_install_method(u8 *buffer))
505
506ACPI_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
512ACPI_EXTERNAL_RETURN_STATUS(acpi_status
513 acpi_get_type(acpi_handle object,
514 acpi_object_type * out_type))
515
516ACPI_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 */
278acpi_status 523ACPI_EXTERNAL_RETURN_STATUS(acpi_status
279acpi_install_initialization_handler(acpi_init_handler handler, u32 function); 524 acpi_install_initialization_handler
280 525 (acpi_init_handler handler, u32 function))
281ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 526ACPI_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))
285ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 530ACPI_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))
316acpi_status acpi_install_notify_handler(acpi_handle device, u32 handler_type, 561ACPI_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
320acpi_status 565 handler,
321acpi_remove_notify_handler(acpi_handle device, 566 void *context))
322 u32 handler_type, acpi_notify_handler handler); 567ACPI_EXTERNAL_RETURN_STATUS(acpi_status
323 568 acpi_remove_notify_handler(acpi_handle device,
324acpi_status 569 u32 handler_type,
325acpi_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, 572ACPI_EXTERNAL_RETURN_STATUS(acpi_status
328 acpi_adr_space_setup setup, void *context); 573 acpi_install_address_space_handler(acpi_handle
329 574 device,
330acpi_status 575 acpi_adr_space_type
331acpi_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))
582ACPI_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
336acpi_status acpi_install_exception_handler(acpi_exception_handler handler); 590ACPI_EXTERNAL_RETURN_STATUS(acpi_status
591 acpi_install_exception_handler
592 (acpi_exception_handler handler))
337#endif 593#endif
338 594ACPI_EXTERNAL_RETURN_STATUS(acpi_status
339acpi_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 */
354acpi_status 611ACPI_EXTERNAL_RETURN_STATUS(acpi_status
355acpi_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
357acpi_status acpi_release_mutex(acpi_handle handle, acpi_string pathname); 616ACPI_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
434acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource, 695acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
435 void *context); 696 void *context);
436 697
437acpi_status 698ACPI_EXTERNAL_RETURN_STATUS(acpi_status
438acpi_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
443acpi_status 704 *ret_buffer))
444acpi_get_current_resources(acpi_handle device, struct acpi_buffer *ret_buffer); 705ACPI_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
447acpi_status 710ACPI_EXTERNAL_RETURN_STATUS(acpi_status
448acpi_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 715ACPI_EXTERNAL_RETURN_STATUS(acpi_status
451acpi_status 716 acpi_get_event_resources(acpi_handle device_handle,
452acpi_get_event_resources(acpi_handle device_handle, 717 struct acpi_buffer
453 struct acpi_buffer *ret_buffer); 718 *ret_buffer))
454 719ACPI_EXTERNAL_RETURN_STATUS(acpi_status
455acpi_status 720 acpi_walk_resource_buffer(struct acpi_buffer
456acpi_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))
460acpi_status 725ACPI_EXTERNAL_RETURN_STATUS(acpi_status
461acpi_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 729ACPI_EXTERNAL_RETURN_STATUS(acpi_status
465acpi_status 730 acpi_set_current_resources(acpi_handle device,
466acpi_set_current_resources(acpi_handle device, struct acpi_buffer *in_buffer); 731 struct acpi_buffer
467 732 *in_buffer))
468acpi_status 733ACPI_EXTERNAL_RETURN_STATUS(acpi_status
469acpi_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
471acpi_status 736 *ret_buffer))
472acpi_resource_to_address64(struct acpi_resource *resource, 737ACPI_EXTERNAL_RETURN_STATUS(acpi_status
473 struct acpi_resource_address64 *out); 738 acpi_resource_to_address64(struct acpi_resource
474 739 *resource,
475acpi_status 740 struct
476acpi_buffer_to_resource(u8 *aml_buffer, 741 acpi_resource_address64
477 u16 aml_buffer_length, 742 *out))
478 struct acpi_resource **resource_ptr); 743ACPI_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 */
483acpi_status acpi_reset(void); 752ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_reset(void))
484 753
485acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg); 754ACPI_EXTERNAL_RETURN_STATUS(acpi_status
755 acpi_read(u64 *value,
756 struct acpi_generic_address *reg))
486 757
487acpi_status acpi_write(u64 value, struct acpi_generic_address *reg); 758ACPI_EXTERNAL_RETURN_STATUS(acpi_status
759 acpi_write(u64 value,
760 struct acpi_generic_address *reg))
488 761
489ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 762ACPI_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 */
500acpi_status 773ACPI_EXTERNAL_RETURN_STATUS(acpi_status
501acpi_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,
503acpi_status acpi_enter_sleep_state_prep(u8 sleep_state); 776 u8 *slp_typ_b))
504 777
505acpi_status acpi_enter_sleep_state(u8 sleep_state); 778ACPI_EXTERNAL_RETURN_STATUS(acpi_status
779 acpi_enter_sleep_state_prep(u8 sleep_state))
780ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_enter_sleep_state(u8 sleep_state))
506 781
507ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enter_sleep_state_s4bios(void)) 782ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enter_sleep_state_s4bios(void))
508 783
509acpi_status acpi_leave_sleep_state_prep(u8 sleep_state); 784ACPI_EXTERNAL_RETURN_STATUS(acpi_status
510 785 acpi_leave_sleep_state_prep(u8 sleep_state))
511acpi_status acpi_leave_sleep_state(u8 sleep_state); 786ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state))
512 787
513ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 788ACPI_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 */
538ACPI_PRINTF_LIKE(3) 813ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
539void ACPI_INTERNAL_VAR_XFACE 814 void ACPI_INTERNAL_VAR_XFACE
540acpi_error(const char *module_name, u32 line_number, const char *format, ...); 815 acpi_error(const char *module_name,
541 816 u32 line_number,
542ACPI_PRINTF_LIKE(4) 817 const char *format, ...))
543void ACPI_INTERNAL_VAR_XFACE 818ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(4)
544acpi_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,
547ACPI_PRINTF_LIKE(3) 822 acpi_status status,
548void ACPI_INTERNAL_VAR_XFACE 823 const char *format, ...))
549acpi_warning(const char *module_name, u32 line_number, const char *format, ...); 824ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
550 825 void ACPI_INTERNAL_VAR_XFACE
551ACPI_PRINTF_LIKE(3) 826 acpi_warning(const char *module_name,
552void ACPI_INTERNAL_VAR_XFACE 827 u32 line_number,
553acpi_info(const char *module_name, u32 line_number, const char *format, ...); 828 const char *format, ...))
554 829ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
555ACPI_PRINTF_LIKE(3) 830 void ACPI_INTERNAL_VAR_XFACE
556void ACPI_INTERNAL_VAR_XFACE 831 acpi_info(const char *module_name,
557acpi_bios_error(const char *module_name, 832 u32 line_number,
558 u32 line_number, const char *format, ...); 833 const char *format, ...))
559 834ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
560ACPI_PRINTF_LIKE(3) 835 void ACPI_INTERNAL_VAR_XFACE
561void ACPI_INTERNAL_VAR_XFACE 836 acpi_bios_error(const char *module_name,
562acpi_bios_warning(const char *module_name, 837 u32 line_number,
563 u32 line_number, const char *format, ...); 838 const char *format, ...))
839ACPI_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 848ACPI_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, ...))
856ACPI_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
570ACPI_PRINTF_LIKE(6) 865/*
571void ACPI_INTERNAL_VAR_XFACE 866 * Divergences
572acpi_debug_print(u32 requested_debug_level, 867 */
573 u32 line_number, 868acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type);
574 const char *function_name, 869
575 const char *module_name, 870acpi_status acpi_unload_table_id(acpi_owner_id id);
576 u32 component_id, const char *format, ...); 871
577 872acpi_status
578ACPI_PRINTF_LIKE(6) 873acpi_get_table_with_size(acpi_string signature,
579void ACPI_INTERNAL_VAR_XFACE 874 u32 instance, struct acpi_table_header **out_table,
580acpi_debug_print_raw(u32 requested_debug_level, 875 acpi_size *tbl_size);
581 u32 line_number, 876
582 const char *function_name, 877acpi_status
583 const char *module_name, 878acpi_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
830struct acpi_table_lpit {
831 struct acpi_table_header header; /* Common ACPI table header */
832};
833
834/* LPIT subtable header */
835
836struct 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
846enum 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
862struct 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
873struct 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
934struct acpi_buffer { 955struct 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 */
144acpi_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
147acpi_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 */
160static 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
169static 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
177static 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
184static 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
192static 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
231void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
232#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
233
234void 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>
258void 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 */
52acpi_status __init acpi_os_initialize(void);
53
54acpi_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 */
62static inline void *acpi_os_allocate(acpi_size size)
63{
64 return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
65}
66
67static inline void *acpi_os_allocate_zeroed(acpi_size size)
68{
69 return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
70}
71
72static inline void acpi_os_free(void *memory)
73{
74 kfree(memory);
75}
76
77static 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
83static 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 */
108void 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)
20extern int acpi_video_register(void); 20extern int acpi_video_register(void);
21extern void acpi_video_unregister(void); 21extern void acpi_video_unregister(void);
22extern void acpi_video_unregister_backlight(void);
22extern int acpi_video_get_edid(struct acpi_device *device, int type, 23extern 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
25static inline int acpi_video_register(void) { return 0; } 26static inline int acpi_video_register(void) { return 0; }
26static inline void acpi_video_unregister(void) { return; } 27static inline void acpi_video_unregister(void) { return; }
28static inline void acpi_video_unregister_backlight(void) { return; }
27static inline int acpi_video_get_edid(struct acpi_device *device, int type, 29static 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{