xref: /linux/include/linux/acpi.h (revision bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * acpi.h - ACPI Interface
4  *
5  * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6  */
7 
8 #ifndef _LINUX_ACPI_H
9 #define _LINUX_ACPI_H
10 
11 #include <linux/cleanup.h>
12 #include <linux/errno.h>
13 #include <linux/ioport.h>	/* for struct resource */
14 #include <linux/resource_ext.h>
15 #include <linux/device.h>
16 #include <linux/mod_devicetable.h>
17 #include <linux/property.h>
18 #include <linux/uuid.h>
19 #include <linux/node.h>
20 
21 struct irq_domain;
22 struct irq_domain_ops;
23 
24 #ifndef _LINUX
25 #define _LINUX
26 #endif
27 #include <acpi/acpi.h>
28 #include <acpi/acpi_numa.h>
29 
30 #ifdef	CONFIG_ACPI
31 
32 #include <linux/list.h>
33 #include <linux/dynamic_debug.h>
34 #include <linux/module.h>
35 #include <linux/mutex.h>
36 #include <linux/fw_table.h>
37 
38 #include <acpi/acpi_bus.h>
39 #include <acpi/acpi_drivers.h>
40 #include <acpi/acpi_io.h>
41 #include <asm/acpi.h>
42 
43 #ifdef CONFIG_ACPI_TABLE_LIB
44 #define EXPORT_SYMBOL_ACPI_LIB(x) EXPORT_SYMBOL_NS_GPL(x, "ACPI")
45 #define __init_or_acpilib
46 #define __initdata_or_acpilib
47 #else
48 #define EXPORT_SYMBOL_ACPI_LIB(x)
49 #define __init_or_acpilib __init
50 #define __initdata_or_acpilib __initdata
51 #endif
52 
acpi_device_handle(struct acpi_device * adev)53 static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
54 {
55 	return adev ? adev->handle : NULL;
56 }
57 
58 #define ACPI_COMPANION(dev)		to_acpi_device_node((dev)->fwnode)
59 #define ACPI_COMPANION_SET(dev, adev)	set_primary_fwnode(dev, (adev) ? \
60 	acpi_fwnode_handle(adev) : NULL)
61 #define ACPI_HANDLE(dev)		acpi_device_handle(ACPI_COMPANION(dev))
62 #define ACPI_HANDLE_FWNODE(fwnode)	\
63 				acpi_device_handle(to_acpi_device_node(fwnode))
64 
acpi_alloc_fwnode_static(void)65 static inline struct fwnode_handle *acpi_alloc_fwnode_static(void)
66 {
67 	struct fwnode_handle *fwnode;
68 
69 	fwnode = kzalloc_obj(struct fwnode_handle);
70 	if (!fwnode)
71 		return NULL;
72 
73 	fwnode_init(fwnode, &acpi_static_fwnode_ops);
74 
75 	return fwnode;
76 }
77 
acpi_free_fwnode_static(struct fwnode_handle * fwnode)78 static inline void acpi_free_fwnode_static(struct fwnode_handle *fwnode)
79 {
80 	if (WARN_ON(!is_acpi_static_node(fwnode)))
81 		return;
82 
83 	kfree(fwnode);
84 }
85 
has_acpi_companion(struct device * dev)86 static inline bool has_acpi_companion(struct device *dev)
87 {
88 	return is_acpi_device_node(dev->fwnode);
89 }
90 
acpi_preset_companion(struct device * dev,struct acpi_device * parent,u64 addr)91 static inline void acpi_preset_companion(struct device *dev,
92 					 struct acpi_device *parent, u64 addr)
93 {
94 	ACPI_COMPANION_SET(dev, acpi_find_child_device(parent, addr, false));
95 }
96 
acpi_dev_name(struct acpi_device * adev)97 static inline const char *acpi_dev_name(struct acpi_device *adev)
98 {
99 	return dev_name(&adev->dev);
100 }
101 
102 struct device *acpi_get_first_physical_node(struct acpi_device *adev);
103 
104 enum acpi_irq_model_id {
105 	ACPI_IRQ_MODEL_PIC = 0,
106 	ACPI_IRQ_MODEL_IOAPIC,
107 	ACPI_IRQ_MODEL_IOSAPIC,
108 	ACPI_IRQ_MODEL_PLATFORM,
109 	ACPI_IRQ_MODEL_GIC,
110 	ACPI_IRQ_MODEL_GIC_V5,
111 	ACPI_IRQ_MODEL_LPIC,
112 	ACPI_IRQ_MODEL_RINTC,
113 	ACPI_IRQ_MODEL_COUNT
114 };
115 
116 extern enum acpi_irq_model_id	acpi_irq_model;
117 
118 enum acpi_interrupt_id {
119 	ACPI_INTERRUPT_PMI	= 1,
120 	ACPI_INTERRUPT_INIT,
121 	ACPI_INTERRUPT_CPEI,
122 	ACPI_INTERRUPT_COUNT
123 };
124 
125 #define	ACPI_SPACE_MEM		0
126 
127 enum acpi_address_range_id {
128 	ACPI_ADDRESS_RANGE_MEMORY = 1,
129 	ACPI_ADDRESS_RANGE_RESERVED = 2,
130 	ACPI_ADDRESS_RANGE_ACPI = 3,
131 	ACPI_ADDRESS_RANGE_NVS	= 4,
132 	ACPI_ADDRESS_RANGE_COUNT
133 };
134 
135 
136 /* Table Handlers */
137 typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *table);
138 
139 /* Debugger support */
140 
141 struct acpi_debugger_ops {
142 	int (*create_thread)(acpi_osd_exec_callback function, void *context);
143 	ssize_t (*write_log)(const char *msg);
144 	ssize_t (*read_cmd)(char *buffer, size_t length);
145 	int (*wait_command_ready)(bool single_step, char *buffer, size_t length);
146 	int (*notify_command_complete)(void);
147 };
148 
149 struct acpi_debugger {
150 	const struct acpi_debugger_ops *ops;
151 	struct module *owner;
152 	struct mutex lock;
153 };
154 
155 #ifdef CONFIG_ACPI_DEBUGGER
156 int __init acpi_debugger_init(void);
157 int acpi_register_debugger(struct module *owner,
158 			   const struct acpi_debugger_ops *ops);
159 void acpi_unregister_debugger(const struct acpi_debugger_ops *ops);
160 int acpi_debugger_create_thread(acpi_osd_exec_callback function, void *context);
161 ssize_t acpi_debugger_write_log(const char *msg);
162 ssize_t acpi_debugger_read_cmd(char *buffer, size_t buffer_length);
163 int acpi_debugger_wait_command_ready(void);
164 int acpi_debugger_notify_command_complete(void);
165 #else
acpi_debugger_init(void)166 static inline int acpi_debugger_init(void)
167 {
168 	return -ENODEV;
169 }
170 
acpi_register_debugger(struct module * owner,const struct acpi_debugger_ops * ops)171 static inline int acpi_register_debugger(struct module *owner,
172 					 const struct acpi_debugger_ops *ops)
173 {
174 	return -ENODEV;
175 }
176 
acpi_unregister_debugger(const struct acpi_debugger_ops * ops)177 static inline void acpi_unregister_debugger(const struct acpi_debugger_ops *ops)
178 {
179 }
180 
acpi_debugger_create_thread(acpi_osd_exec_callback function,void * context)181 static inline int acpi_debugger_create_thread(acpi_osd_exec_callback function,
182 					      void *context)
183 {
184 	return -ENODEV;
185 }
186 
acpi_debugger_write_log(const char * msg)187 static inline int acpi_debugger_write_log(const char *msg)
188 {
189 	return -ENODEV;
190 }
191 
acpi_debugger_read_cmd(char * buffer,u32 buffer_length)192 static inline int acpi_debugger_read_cmd(char *buffer, u32 buffer_length)
193 {
194 	return -ENODEV;
195 }
196 
acpi_debugger_wait_command_ready(void)197 static inline int acpi_debugger_wait_command_ready(void)
198 {
199 	return -ENODEV;
200 }
201 
acpi_debugger_notify_command_complete(void)202 static inline int acpi_debugger_notify_command_complete(void)
203 {
204 	return -ENODEV;
205 }
206 #endif
207 
208 #define BAD_MADT_ENTRY(entry, end) (					    \
209 		(!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
210 		((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
211 
212 void __iomem *__acpi_map_table(unsigned long phys, unsigned long size);
213 void __acpi_unmap_table(void __iomem *map, unsigned long size);
214 int early_acpi_boot_init(void);
215 int acpi_boot_init (void);
216 void acpi_boot_table_prepare (void);
217 void acpi_boot_table_init (void);
218 int acpi_mps_check (void);
219 int acpi_numa_init (void);
220 
221 int acpi_locate_initial_tables (void);
222 void acpi_reserve_initial_tables (void);
223 void acpi_table_init_complete (void);
224 int acpi_table_init (void);
225 
acpi_get_table_pointer(char * signature,u32 instance)226 static inline struct acpi_table_header *acpi_get_table_pointer(char *signature, u32 instance)
227 {
228 	struct acpi_table_header *table;
229 	int status = acpi_get_table(signature, instance, &table);
230 
231 	if (ACPI_FAILURE(status))
232 		return ERR_PTR(-ENOENT);
233 	return table;
234 }
235 DEFINE_FREE(acpi_put_table, struct acpi_table_header *, if (!IS_ERR_OR_NULL(_T)) acpi_put_table(_T))
236 
237 int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
238 int __init_or_acpilib acpi_table_parse_entries(char *id,
239 		unsigned long table_size, int entry_id,
240 		acpi_tbl_entry_handler handler, unsigned int max_entries);
241 int __init_or_acpilib acpi_table_parse_entries_array(char *id,
242 		unsigned long table_size, struct acpi_subtable_proc *proc,
243 		int proc_num, unsigned int max_entries);
244 int acpi_table_parse_madt(enum acpi_madt_type id,
245 			  acpi_tbl_entry_handler handler,
246 			  unsigned int max_entries);
247 int __init_or_acpilib
248 acpi_table_parse_cedt(enum acpi_cedt_type id,
249 		      acpi_tbl_entry_handler_arg handler_arg, void *arg);
250 
251 int acpi_parse_mcfg (struct acpi_table_header *header);
252 void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
253 
254 #if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH)
255 void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
256 #else
257 static inline void
acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity * pa)258 acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) { }
259 #endif
260 
261 void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
262 
263 #if defined(CONFIG_ARM64) || defined(CONFIG_LOONGARCH)
264 void acpi_arch_dma_setup(struct device *dev);
265 #else
acpi_arch_dma_setup(struct device * dev)266 static inline void acpi_arch_dma_setup(struct device *dev) { }
267 #endif
268 
269 #ifdef CONFIG_ARM64
270 void acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa);
271 #else
272 static inline void
acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity * pa)273 acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { }
274 #endif
275 
276 #ifdef CONFIG_RISCV
277 void acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa);
278 #else
acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity * pa)279 static inline void acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa) { }
280 #endif
281 
282 #ifndef PHYS_CPUID_INVALID
283 typedef u32 phys_cpuid_t;
284 #define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
285 #endif
286 
invalid_logical_cpuid(u32 cpuid)287 static inline bool invalid_logical_cpuid(u32 cpuid)
288 {
289 	return (int)cpuid < 0;
290 }
291 
invalid_phys_cpuid(phys_cpuid_t phys_id)292 static inline bool invalid_phys_cpuid(phys_cpuid_t phys_id)
293 {
294 	return phys_id == PHYS_CPUID_INVALID;
295 }
296 
297 
298 int __init acpi_get_madt_revision(void);
299 
300 /* Validate the processor object's proc_id */
301 bool acpi_duplicate_processor_id(int proc_id);
302 /* Processor _CTS control */
303 struct acpi_processor_power;
304 
305 #ifdef CONFIG_ACPI_PROCESSOR_CSTATE
306 bool acpi_processor_claim_cst_control(void);
307 int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu,
308 				struct acpi_processor_power *info);
309 #else
acpi_processor_claim_cst_control(void)310 static inline bool acpi_processor_claim_cst_control(void) { return false; }
acpi_processor_evaluate_cst(acpi_handle handle,u32 cpu,struct acpi_processor_power * info)311 static inline int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu,
312 					      struct acpi_processor_power *info)
313 {
314 	return -ENODEV;
315 }
316 #endif
317 
318 #ifdef CONFIG_ACPI_HOTPLUG_CPU
319 /* Arch dependent functions for cpu hotplug support */
320 int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
321 		 int *pcpu);
322 int acpi_unmap_cpu(int cpu);
323 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
324 
325 acpi_handle acpi_get_processor_handle(int cpu);
326 
327 #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
328 int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr);
329 #endif
330 
331 int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
332 int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
333 int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base);
334 void acpi_irq_stats_init(void);
335 extern u32 acpi_irq_handled;
336 extern u32 acpi_irq_not_handled;
337 extern unsigned int acpi_sci_irq;
338 extern bool acpi_no_s5;
339 #define INVALID_ACPI_IRQ	((unsigned)-1)
acpi_sci_irq_valid(void)340 static inline bool acpi_sci_irq_valid(void)
341 {
342 	return acpi_sci_irq != INVALID_ACPI_IRQ;
343 }
344 
345 extern int sbf_port;
346 
347 int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity);
348 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
349 int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi);
350 
351 typedef struct fwnode_handle *(*acpi_gsi_domain_disp_fn)(u32);
352 
353 void acpi_set_irq_model(enum acpi_irq_model_id model,
354 			acpi_gsi_domain_disp_fn fn);
355 acpi_gsi_domain_disp_fn acpi_get_gsi_dispatcher(void);
356 void acpi_set_gsi_to_irq_fallback(u32 (*)(u32));
357 
358 struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags,
359 					     unsigned int size,
360 					     struct fwnode_handle *fwnode,
361 					     const struct irq_domain_ops *ops,
362 					     void *host_data);
363 
364 #ifdef CONFIG_X86_IO_APIC
365 extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity);
366 #else
acpi_get_override_irq(u32 gsi,int * trigger,int * polarity)367 static inline int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity)
368 {
369 	return -1;
370 }
371 #endif
372 /*
373  * This function undoes the effect of one call to acpi_register_gsi().
374  * If this matches the last registration, any IRQ resources for gsi
375  * are freed.
376  */
377 void acpi_unregister_gsi (u32 gsi);
378 
379 struct pci_dev;
380 
381 struct acpi_prt_entry *acpi_pci_irq_lookup(struct pci_dev *dev, int pin);
382 int acpi_pci_irq_enable (struct pci_dev *dev);
383 void acpi_penalize_isa_irq(int irq, int active);
384 bool acpi_isa_irq_available(int irq);
385 #ifdef CONFIG_PCI
386 void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
387 #else
acpi_penalize_sci_irq(int irq,int trigger,int polarity)388 static inline void acpi_penalize_sci_irq(int irq, int trigger,
389 					int polarity)
390 {
391 }
392 #endif
393 void acpi_pci_irq_disable (struct pci_dev *dev);
394 
395 extern int ec_read(u8 addr, u8 *val);
396 extern int ec_write(u8 addr, u8 val);
397 extern int ec_transaction(u8 command,
398                           const u8 *wdata, unsigned wdata_len,
399                           u8 *rdata, unsigned rdata_len);
400 extern acpi_handle ec_get_handle(void);
401 
402 extern bool acpi_is_pnp_device(struct acpi_device *);
403 
404 #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE)
405 
406 typedef void (*wmi_notify_handler) (union acpi_object *data, void *context);
407 
408 int wmi_instance_count(const char *guid);
409 
410 extern acpi_status wmi_evaluate_method(const char *guid, u8 instance,
411 					u32 method_id,
412 					const struct acpi_buffer *in,
413 					struct acpi_buffer *out);
414 extern acpi_status wmi_query_block(const char *guid, u8 instance,
415 					struct acpi_buffer *out);
416 extern acpi_status wmi_set_block(const char *guid, u8 instance,
417 					const struct acpi_buffer *in);
418 extern acpi_status wmi_install_notify_handler(const char *guid,
419 					wmi_notify_handler handler, void *data);
420 extern acpi_status wmi_remove_notify_handler(const char *guid);
421 extern bool wmi_has_guid(const char *guid);
422 extern char *wmi_get_acpi_device_uid(const char *guid);
423 
424 #endif	/* CONFIG_ACPI_WMI */
425 
426 #define ACPI_VIDEO_OUTPUT_SWITCHING			0x0001
427 #define ACPI_VIDEO_DEVICE_POSTING			0x0002
428 #define ACPI_VIDEO_ROM_AVAILABLE			0x0004
429 #define ACPI_VIDEO_BACKLIGHT				0x0008
430 #define ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR		0x0010
431 #define ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO		0x0020
432 #define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR	0x0040
433 #define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO		0x0080
434 #define ACPI_VIDEO_BACKLIGHT_DMI_VENDOR			0x0100
435 #define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO			0x0200
436 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR		0x0400
437 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO		0x0800
438 
439 extern char acpi_video_backlight_string[];
440 extern long acpi_is_video_device(acpi_handle handle);
441 
442 extern void acpi_osi_setup(char *str);
443 extern bool acpi_osi_is_win8(void);
444 
445 #ifdef CONFIG_ACPI_THERMAL_LIB
446 int thermal_acpi_active_trip_temp(struct acpi_device *adev, int id, int *ret_temp);
447 int thermal_acpi_passive_trip_temp(struct acpi_device *adev, int *ret_temp);
448 int thermal_acpi_hot_trip_temp(struct acpi_device *adev, int *ret_temp);
449 int thermal_acpi_critical_trip_temp(struct acpi_device *adev, int *ret_temp);
450 #endif
451 
452 #ifdef CONFIG_ACPI_HMAT
453 int acpi_get_genport_coordinates(u32 uid, struct access_coordinate *coord);
454 #else
acpi_get_genport_coordinates(u32 uid,struct access_coordinate * coord)455 static inline int acpi_get_genport_coordinates(u32 uid,
456 					       struct access_coordinate *coord)
457 {
458 	return -EOPNOTSUPP;
459 }
460 #endif
461 
462 #ifdef CONFIG_ACPI_NUMA
463 int acpi_map_pxm_to_node(int pxm);
464 int acpi_get_node(acpi_handle handle);
465 
466 /**
467  * pxm_to_online_node - Map proximity ID to online node
468  * @pxm: ACPI proximity ID
469  *
470  * This is similar to pxm_to_node(), but always returns an online
471  * node.  When the mapped node from a given proximity ID is offline, it
472  * looks up the node distance table and returns the nearest online node.
473  *
474  * ACPI device drivers, which are called after the NUMA initialization has
475  * completed in the kernel, can call this interface to obtain their device
476  * NUMA topology from ACPI tables.  Such drivers do not have to deal with
477  * offline nodes.  A node may be offline when SRAT memory entry does not exist,
478  * or NUMA is disabled, ex. "numa=off" on x86.
479  */
pxm_to_online_node(int pxm)480 static inline int pxm_to_online_node(int pxm)
481 {
482 	int node = pxm_to_node(pxm);
483 
484 	return numa_map_to_online_node(node);
485 }
486 #else
pxm_to_online_node(int pxm)487 static inline int pxm_to_online_node(int pxm)
488 {
489 	return 0;
490 }
acpi_map_pxm_to_node(int pxm)491 static inline int acpi_map_pxm_to_node(int pxm)
492 {
493 	return 0;
494 }
acpi_get_node(acpi_handle handle)495 static inline int acpi_get_node(acpi_handle handle)
496 {
497 	return 0;
498 }
499 #endif
500 extern int pnpacpi_disabled;
501 
502 #define PXM_INVAL	(-1)
503 
504 bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res);
505 bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res);
506 bool acpi_dev_resource_address_space(struct acpi_resource *ares,
507 				     struct resource_win *win);
508 bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares,
509 					 struct resource_win *win);
510 unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable, u8 wake_capable);
511 unsigned int acpi_dev_get_irq_type(int triggering, int polarity);
512 bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
513 				 struct resource *res);
514 
515 void acpi_dev_free_resource_list(struct list_head *list);
516 int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list,
517 			   int (*preproc)(struct acpi_resource *, void *),
518 			   void *preproc_data);
519 int acpi_dev_get_dma_resources(struct acpi_device *adev,
520 			       struct list_head *list);
521 int acpi_dev_get_memory_resources(struct acpi_device *adev, struct list_head *list);
522 int acpi_dev_filter_resource_type(struct acpi_resource *ares,
523 				  unsigned long types);
524 
acpi_dev_filter_resource_type_cb(struct acpi_resource * ares,void * arg)525 static inline int acpi_dev_filter_resource_type_cb(struct acpi_resource *ares,
526 						   void *arg)
527 {
528 	return acpi_dev_filter_resource_type(ares, (unsigned long)arg);
529 }
530 
531 struct acpi_device *acpi_resource_consumer(struct resource *res);
532 
533 int acpi_check_resource_conflict(const struct resource *res);
534 
535 int acpi_check_region(resource_size_t start, resource_size_t n,
536 		      const char *name);
537 
538 int acpi_resources_are_enforced(void);
539 
540 #ifdef CONFIG_HIBERNATION
541 extern int acpi_check_s4_hw_signature;
542 #endif
543 
544 #ifdef CONFIG_PM_SLEEP
545 void __init acpi_old_suspend_ordering(void);
546 void __init acpi_nvs_nosave(void);
547 void __init acpi_nvs_nosave_s3(void);
548 void __init acpi_sleep_no_blacklist(void);
549 #endif /* CONFIG_PM_SLEEP */
550 
551 int acpi_register_wakeup_handler(
552 	int wake_irq, bool (*wakeup)(void *context), void *context);
553 void acpi_unregister_wakeup_handler(
554 	bool (*wakeup)(void *context), void *context);
555 
556 struct acpi_osc_context {
557 	char *uuid_str;			/* UUID string */
558 	int rev;
559 	struct acpi_buffer cap;		/* list of DWORD capabilities */
560 	struct acpi_buffer ret;		/* free by caller if success */
561 };
562 
563 acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
564 
565 /* Number of _OSC capability DWORDS depends on bridge type */
566 #define OSC_PCI_CAPABILITY_DWORDS		3
567 #define OSC_CXL_CAPABILITY_DWORDS		5
568 
569 /* Indexes into _OSC Capabilities Buffer (DWORDs 2 to 5 are device-specific) */
570 #define OSC_QUERY_DWORD				0	/* DWORD 1 */
571 #define OSC_SUPPORT_DWORD			1	/* DWORD 2 */
572 #define OSC_CONTROL_DWORD			2	/* DWORD 3 */
573 #define OSC_EXT_SUPPORT_DWORD			3	/* DWORD 4 */
574 #define OSC_EXT_CONTROL_DWORD			4	/* DWORD 5 */
575 
576 /* _OSC Capabilities DWORD 1: Query/Control and Error Returns (generic) */
577 #define OSC_QUERY_ENABLE			0x00000001  /* input */
578 #define OSC_REQUEST_ERROR			0x00000002  /* return */
579 #define OSC_INVALID_UUID_ERROR			0x00000004  /* return */
580 #define OSC_INVALID_REVISION_ERROR		0x00000008  /* return */
581 #define OSC_CAPABILITIES_MASK_ERROR		0x00000010  /* return */
582 
583 /* Platform-Wide Capabilities _OSC: Capabilities DWORD 2: Support Field */
584 #define OSC_SB_PAD_SUPPORT			0x00000001
585 #define OSC_SB_PPC_OST_SUPPORT			0x00000002
586 #define OSC_SB_PR3_SUPPORT			0x00000004
587 #define OSC_SB_HOTPLUG_OST_SUPPORT		0x00000008
588 #define OSC_SB_APEI_SUPPORT			0x00000010
589 #define OSC_SB_CPC_SUPPORT			0x00000020
590 #define OSC_SB_CPCV2_SUPPORT			0x00000040
591 #define OSC_SB_PCLPI_SUPPORT			0x00000080
592 #define OSC_SB_OSLPI_SUPPORT			0x00000100
593 #define OSC_SB_FAST_THERMAL_SAMPLING_SUPPORT	0x00000200
594 #define OSC_SB_OVER_16_PSTATES_SUPPORT		0x00000400
595 #define OSC_SB_GED_SUPPORT			0x00000800
596 #define OSC_SB_CPC_DIVERSE_HIGH_SUPPORT		0x00001000
597 #define OSC_SB_IRQ_RESOURCE_SOURCE_SUPPORT	0x00002000
598 #define OSC_SB_CPC_FLEXIBLE_ADR_SPACE		0x00004000
599 #define OSC_SB_GENERIC_INITIATOR_SUPPORT	0x00020000
600 #define OSC_SB_NATIVE_USB4_SUPPORT		0x00040000
601 #define OSC_SB_BATTERY_CHARGE_LIMITING_SUPPORT	0x00080000
602 #define OSC_SB_PRM_SUPPORT			0x00200000
603 #define OSC_SB_FFH_OPR_SUPPORT			0x00400000
604 
605 extern bool osc_sb_apei_support_acked;
606 extern bool osc_pc_lpi_support_confirmed;
607 extern bool osc_sb_native_usb4_support_confirmed;
608 extern bool osc_sb_cppc2_support_acked;
609 extern bool osc_cpc_flexible_adr_space_confirmed;
610 
611 /* USB4 Capabilities */
612 #define OSC_USB_USB3_TUNNELING			0x00000001
613 #define OSC_USB_DP_TUNNELING			0x00000002
614 #define OSC_USB_PCIE_TUNNELING			0x00000004
615 #define OSC_USB_XDOMAIN				0x00000008
616 
617 extern u32 osc_sb_native_usb4_control;
618 
619 /* PCI Host Bridge _OSC: Capabilities DWORD 2: Support Field */
620 #define OSC_PCI_EXT_CONFIG_SUPPORT		0x00000001
621 #define OSC_PCI_ASPM_SUPPORT			0x00000002
622 #define OSC_PCI_CLOCK_PM_SUPPORT		0x00000004
623 #define OSC_PCI_SEGMENT_GROUPS_SUPPORT		0x00000008
624 #define OSC_PCI_MSI_SUPPORT			0x00000010
625 #define OSC_PCI_EDR_SUPPORT			0x00000080
626 #define OSC_PCI_HPX_TYPE_3_SUPPORT		0x00000100
627 
628 /* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */
629 #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL	0x00000001
630 #define OSC_PCI_SHPC_NATIVE_HP_CONTROL		0x00000002
631 #define OSC_PCI_EXPRESS_PME_CONTROL		0x00000004
632 #define OSC_PCI_EXPRESS_AER_CONTROL		0x00000008
633 #define OSC_PCI_EXPRESS_CAPABILITY_CONTROL	0x00000010
634 #define OSC_PCI_EXPRESS_LTR_CONTROL		0x00000020
635 #define OSC_PCI_EXPRESS_DPC_CONTROL		0x00000080
636 
637 /* CXL _OSC: Capabilities DWORD 4: Support Field */
638 #define OSC_CXL_1_1_PORT_REG_ACCESS_SUPPORT	0x00000001
639 #define OSC_CXL_2_0_PORT_DEV_REG_ACCESS_SUPPORT	0x00000002
640 #define OSC_CXL_PROTOCOL_ERR_REPORTING_SUPPORT	0x00000004
641 #define OSC_CXL_NATIVE_HP_SUPPORT		0x00000008
642 
643 /* CXL _OSC: Capabilities DWORD 5: Control Field */
644 #define OSC_CXL_ERROR_REPORTING_CONTROL		0x00000001
645 
acpi_osc_ctx_get_pci_control(struct acpi_osc_context * context)646 static inline u32 acpi_osc_ctx_get_pci_control(struct acpi_osc_context *context)
647 {
648 	u32 *ret = context->ret.pointer;
649 
650 	return ret[OSC_CONTROL_DWORD];
651 }
652 
acpi_osc_ctx_get_cxl_control(struct acpi_osc_context * context)653 static inline u32 acpi_osc_ctx_get_cxl_control(struct acpi_osc_context *context)
654 {
655 	u32 *ret = context->ret.pointer;
656 
657 	return ret[OSC_EXT_CONTROL_DWORD];
658 }
659 
660 #define ACPI_GSB_ACCESS_ATTRIB_QUICK		0x00000002
661 #define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV         0x00000004
662 #define ACPI_GSB_ACCESS_ATTRIB_BYTE		0x00000006
663 #define ACPI_GSB_ACCESS_ATTRIB_WORD		0x00000008
664 #define ACPI_GSB_ACCESS_ATTRIB_BLOCK		0x0000000A
665 #define ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE	0x0000000B
666 #define ACPI_GSB_ACCESS_ATTRIB_WORD_CALL	0x0000000C
667 #define ACPI_GSB_ACCESS_ATTRIB_BLOCK_CALL	0x0000000D
668 #define ACPI_GSB_ACCESS_ATTRIB_RAW_BYTES	0x0000000E
669 #define ACPI_GSB_ACCESS_ATTRIB_RAW_PROCESS	0x0000000F
670 
671 /* Enable _OST when all relevant hotplug operations are enabled */
672 #if defined(CONFIG_ACPI_HOTPLUG_CPU) &&			\
673 	defined(CONFIG_ACPI_HOTPLUG_MEMORY) &&		\
674 	defined(CONFIG_ACPI_CONTAINER)
675 #define ACPI_HOTPLUG_OST
676 #endif
677 
678 /* _OST Source Event Code (OSPM Action) */
679 #define ACPI_OST_EC_OSPM_SHUTDOWN		0x100
680 #define ACPI_OST_EC_OSPM_EJECT			0x103
681 #define ACPI_OST_EC_OSPM_INSERTION		0x200
682 
683 /* _OST General Processing Status Code */
684 #define ACPI_OST_SC_SUCCESS			0x0
685 #define ACPI_OST_SC_NON_SPECIFIC_FAILURE	0x1
686 #define ACPI_OST_SC_UNRECOGNIZED_NOTIFY		0x2
687 
688 /* _OST OS Shutdown Processing (0x100) Status Code */
689 #define ACPI_OST_SC_OS_SHUTDOWN_DENIED		0x80
690 #define ACPI_OST_SC_OS_SHUTDOWN_IN_PROGRESS	0x81
691 #define ACPI_OST_SC_OS_SHUTDOWN_COMPLETED	0x82
692 #define ACPI_OST_SC_OS_SHUTDOWN_NOT_SUPPORTED	0x83
693 
694 /* _OST Ejection Request (0x3, 0x103) Status Code */
695 #define ACPI_OST_SC_EJECT_NOT_SUPPORTED		0x80
696 #define ACPI_OST_SC_DEVICE_IN_USE		0x81
697 #define ACPI_OST_SC_DEVICE_BUSY			0x82
698 #define ACPI_OST_SC_EJECT_DEPENDENCY_BUSY	0x83
699 #define ACPI_OST_SC_EJECT_IN_PROGRESS		0x84
700 
701 /* _OST Insertion Request (0x200) Status Code */
702 #define ACPI_OST_SC_INSERT_IN_PROGRESS		0x80
703 #define ACPI_OST_SC_DRIVER_LOAD_FAILURE		0x81
704 #define ACPI_OST_SC_INSERT_NOT_SUPPORTED	0x82
705 
706 enum acpi_predicate {
707 	all_versions,
708 	less_than_or_equal,
709 	equal,
710 	greater_than_or_equal,
711 };
712 
713 /* Table must be terminted by a NULL entry */
714 struct acpi_platform_list {
715 	char	oem_id[ACPI_OEM_ID_SIZE+1];
716 	char	oem_table_id[ACPI_OEM_TABLE_ID_SIZE+1];
717 	u32	oem_revision;
718 	char	*table;
719 	enum acpi_predicate pred;
720 	char	*reason;
721 	u32	data;
722 };
723 int acpi_match_platform_list(const struct acpi_platform_list *plat);
724 
725 extern void acpi_early_init(void);
726 extern void acpi_subsystem_init(void);
727 
728 extern int acpi_nvs_register(__u64 start, __u64 size);
729 
730 extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
731 				    void *data);
732 
733 const struct acpi_device_id *acpi_match_acpi_device(const struct acpi_device_id *ids,
734 						    const struct acpi_device *adev);
735 
736 const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
737 					       const struct device *dev);
738 
739 const void *acpi_device_get_match_data(const struct device *dev);
740 extern bool acpi_driver_match_device(struct device *dev,
741 				     const struct device_driver *drv);
742 int acpi_device_uevent_modalias(const struct device *, struct kobj_uevent_env *);
743 int acpi_device_modalias(struct device *, char *, int);
744 
745 struct platform_device *acpi_create_platform_device(struct acpi_device *,
746 						    const struct property_entry *);
747 #define ACPI_PTR(_ptr)	(_ptr)
748 
acpi_device_set_enumerated(struct acpi_device * adev)749 static inline void acpi_device_set_enumerated(struct acpi_device *adev)
750 {
751 	adev->flags.visited = true;
752 }
753 
acpi_device_clear_enumerated(struct acpi_device * adev)754 static inline void acpi_device_clear_enumerated(struct acpi_device *adev)
755 {
756 	adev->flags.visited = false;
757 }
758 
759 enum acpi_reconfig_event  {
760 	ACPI_RECONFIG_DEVICE_ADD = 0,
761 	ACPI_RECONFIG_DEVICE_REMOVE,
762 };
763 
764 int acpi_reconfig_notifier_register(struct notifier_block *nb);
765 int acpi_reconfig_notifier_unregister(struct notifier_block *nb);
766 
767 #ifdef CONFIG_ACPI_GTDT
768 int acpi_gtdt_init(struct acpi_table_header *table, int *platform_timer_count);
769 int acpi_gtdt_map_ppi(int type);
770 bool acpi_gtdt_c3stop(int type);
771 #endif
772 
773 #ifndef ACPI_HAVE_ARCH_SET_ROOT_POINTER
acpi_arch_set_root_pointer(u64 addr)774 static __always_inline void acpi_arch_set_root_pointer(u64 addr)
775 {
776 }
777 #endif
778 
779 #ifndef ACPI_HAVE_ARCH_GET_ROOT_POINTER
acpi_arch_get_root_pointer(void)780 static __always_inline u64 acpi_arch_get_root_pointer(void)
781 {
782 	return 0;
783 }
784 #endif
785 
786 int acpi_get_local_u64_address(acpi_handle handle, u64 *addr);
787 int acpi_get_local_address(acpi_handle handle, u32 *addr);
788 const char *acpi_get_subsystem_id(acpi_handle handle);
789 
790 #ifdef CONFIG_ACPI_MRRM
791 int acpi_mrrm_max_mem_region(void);
792 #endif
793 
794 #else	/* !CONFIG_ACPI */
795 
796 #define acpi_disabled 1
797 
798 #define ACPI_COMPANION(dev)		(NULL)
799 #define ACPI_COMPANION_SET(dev, adev)	do { } while (0)
800 #define ACPI_HANDLE(dev)		(NULL)
801 #define ACPI_HANDLE_FWNODE(fwnode)	(NULL)
802 
803 /* Get rid of the -Wunused-variable for adev */
804 #define acpi_dev_uid_match(adev, uid2)			(adev && false)
805 #define acpi_dev_hid_uid_match(adev, hid2, uid2)	(adev && false)
806 
807 struct fwnode_handle;
808 
acpi_dev_found(const char * hid)809 static inline bool acpi_dev_found(const char *hid)
810 {
811 	return false;
812 }
813 
acpi_dev_present(const char * hid,const char * uid,s64 hrv)814 static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
815 {
816 	return false;
817 }
818 
819 struct acpi_device;
820 
acpi_dev_uid_to_integer(struct acpi_device * adev,u64 * integer)821 static inline int acpi_dev_uid_to_integer(struct acpi_device *adev, u64 *integer)
822 {
823 	return -ENODEV;
824 }
825 
826 static inline struct acpi_device *
acpi_dev_get_first_match_dev(const char * hid,const char * uid,s64 hrv)827 acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
828 {
829 	return NULL;
830 }
831 
acpi_reduced_hardware(void)832 static inline bool acpi_reduced_hardware(void)
833 {
834 	return false;
835 }
836 
acpi_dev_put(struct acpi_device * adev)837 static inline void acpi_dev_put(struct acpi_device *adev) {}
838 
is_acpi_node(const struct fwnode_handle * fwnode)839 static inline bool is_acpi_node(const struct fwnode_handle *fwnode)
840 {
841 	return false;
842 }
843 
is_acpi_device_node(const struct fwnode_handle * fwnode)844 static inline bool is_acpi_device_node(const struct fwnode_handle *fwnode)
845 {
846 	return false;
847 }
848 
to_acpi_device_node(const struct fwnode_handle * fwnode)849 static inline struct acpi_device *to_acpi_device_node(const struct fwnode_handle *fwnode)
850 {
851 	return NULL;
852 }
853 
is_acpi_data_node(const struct fwnode_handle * fwnode)854 static inline bool is_acpi_data_node(const struct fwnode_handle *fwnode)
855 {
856 	return false;
857 }
858 
to_acpi_data_node(const struct fwnode_handle * fwnode)859 static inline struct acpi_data_node *to_acpi_data_node(const struct fwnode_handle *fwnode)
860 {
861 	return NULL;
862 }
863 
acpi_data_node_match(const struct fwnode_handle * fwnode,const char * name)864 static inline bool acpi_data_node_match(const struct fwnode_handle *fwnode,
865 					const char *name)
866 {
867 	return false;
868 }
869 
acpi_fwnode_handle(struct acpi_device * adev)870 static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
871 {
872 	return NULL;
873 }
874 
acpi_device_handle(struct acpi_device * adev)875 static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
876 {
877 	return NULL;
878 }
879 
has_acpi_companion(struct device * dev)880 static inline bool has_acpi_companion(struct device *dev)
881 {
882 	return false;
883 }
884 
acpi_preset_companion(struct device * dev,struct acpi_device * parent,u64 addr)885 static inline void acpi_preset_companion(struct device *dev,
886 					 struct acpi_device *parent, u64 addr)
887 {
888 }
889 
acpi_dev_name(struct acpi_device * adev)890 static inline const char *acpi_dev_name(struct acpi_device *adev)
891 {
892 	return NULL;
893 }
894 
acpi_get_first_physical_node(struct acpi_device * adev)895 static inline struct device *acpi_get_first_physical_node(struct acpi_device *adev)
896 {
897 	return NULL;
898 }
899 
acpi_early_init(void)900 static inline void acpi_early_init(void) { }
acpi_subsystem_init(void)901 static inline void acpi_subsystem_init(void) { }
902 
early_acpi_boot_init(void)903 static inline int early_acpi_boot_init(void)
904 {
905 	return 0;
906 }
acpi_boot_init(void)907 static inline int acpi_boot_init(void)
908 {
909 	return 0;
910 }
911 
acpi_boot_table_prepare(void)912 static inline void acpi_boot_table_prepare(void)
913 {
914 }
915 
acpi_boot_table_init(void)916 static inline void acpi_boot_table_init(void)
917 {
918 }
919 
acpi_mps_check(void)920 static inline int acpi_mps_check(void)
921 {
922 	return 0;
923 }
924 
acpi_check_resource_conflict(struct resource * res)925 static inline int acpi_check_resource_conflict(struct resource *res)
926 {
927 	return 0;
928 }
929 
acpi_check_region(resource_size_t start,resource_size_t n,const char * name)930 static inline int acpi_check_region(resource_size_t start, resource_size_t n,
931 				    const char *name)
932 {
933 	return 0;
934 }
935 
936 struct acpi_table_header;
acpi_table_parse(char * id,int (* handler)(struct acpi_table_header *))937 static inline int acpi_table_parse(char *id,
938 				int (*handler)(struct acpi_table_header *))
939 {
940 	return -ENODEV;
941 }
942 
acpi_nvs_register(__u64 start,__u64 size)943 static inline int acpi_nvs_register(__u64 start, __u64 size)
944 {
945 	return 0;
946 }
947 
acpi_nvs_for_each_region(int (* func)(__u64,__u64,void *),void * data)948 static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
949 					   void *data)
950 {
951 	return 0;
952 }
953 
954 struct acpi_device_id;
955 
acpi_match_acpi_device(const struct acpi_device_id * ids,const struct acpi_device * adev)956 static inline const struct acpi_device_id *acpi_match_acpi_device(
957 	const struct acpi_device_id *ids, const struct acpi_device *adev)
958 {
959 	return NULL;
960 }
961 
acpi_match_device(const struct acpi_device_id * ids,const struct device * dev)962 static inline const struct acpi_device_id *acpi_match_device(
963 	const struct acpi_device_id *ids, const struct device *dev)
964 {
965 	return NULL;
966 }
967 
acpi_device_get_match_data(const struct device * dev)968 static inline const void *acpi_device_get_match_data(const struct device *dev)
969 {
970 	return NULL;
971 }
972 
acpi_driver_match_device(struct device * dev,const struct device_driver * drv)973 static inline bool acpi_driver_match_device(struct device *dev,
974 					    const struct device_driver *drv)
975 {
976 	return false;
977 }
978 
acpi_check_dsm(acpi_handle handle,const guid_t * guid,u64 rev,u64 funcs)979 static inline bool acpi_check_dsm(acpi_handle handle, const guid_t *guid,
980 				  u64 rev, u64 funcs)
981 {
982 	return false;
983 }
984 
acpi_evaluate_dsm(acpi_handle handle,const guid_t * guid,u64 rev,u64 func,union acpi_object * argv4)985 static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
986 						   const guid_t *guid,
987 						   u64 rev, u64 func,
988 						   union acpi_object *argv4)
989 {
990 	return NULL;
991 }
992 
acpi_evaluate_dsm_typed(acpi_handle handle,const guid_t * guid,u64 rev,u64 func,union acpi_object * argv4,acpi_object_type type)993 static inline union acpi_object *acpi_evaluate_dsm_typed(acpi_handle handle,
994 							 const guid_t *guid,
995 							 u64 rev, u64 func,
996 							 union acpi_object *argv4,
997 							 acpi_object_type type)
998 {
999 	return NULL;
1000 }
1001 
acpi_device_uevent_modalias(const struct device * dev,struct kobj_uevent_env * env)1002 static inline int acpi_device_uevent_modalias(const struct device *dev,
1003 				struct kobj_uevent_env *env)
1004 {
1005 	return -ENODEV;
1006 }
1007 
acpi_device_modalias(struct device * dev,char * buf,int size)1008 static inline int acpi_device_modalias(struct device *dev,
1009 				char *buf, int size)
1010 {
1011 	return -ENODEV;
1012 }
1013 
1014 static inline struct platform_device *
acpi_create_platform_device(struct acpi_device * adev,const struct property_entry * properties)1015 acpi_create_platform_device(struct acpi_device *adev,
1016 			    const struct property_entry *properties)
1017 {
1018 	return NULL;
1019 }
1020 
acpi_dma_supported(const struct acpi_device * adev)1021 static inline bool acpi_dma_supported(const struct acpi_device *adev)
1022 {
1023 	return false;
1024 }
1025 
acpi_get_dma_attr(struct acpi_device * adev)1026 static inline enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev)
1027 {
1028 	return DEV_DMA_NOT_SUPPORTED;
1029 }
1030 
acpi_dma_get_range(struct device * dev,const struct bus_dma_region ** map)1031 static inline int acpi_dma_get_range(struct device *dev, const struct bus_dma_region **map)
1032 {
1033 	return -ENODEV;
1034 }
1035 
acpi_dma_configure(struct device * dev,enum dev_dma_attr attr)1036 static inline int acpi_dma_configure(struct device *dev,
1037 				     enum dev_dma_attr attr)
1038 {
1039 	return 0;
1040 }
1041 
acpi_dma_configure_id(struct device * dev,enum dev_dma_attr attr,const u32 * input_id)1042 static inline int acpi_dma_configure_id(struct device *dev,
1043 					enum dev_dma_attr attr,
1044 					const u32 *input_id)
1045 {
1046 	return 0;
1047 }
1048 
1049 #define ACPI_PTR(_ptr)	(NULL)
1050 
acpi_device_set_enumerated(struct acpi_device * adev)1051 static inline void acpi_device_set_enumerated(struct acpi_device *adev)
1052 {
1053 }
1054 
acpi_device_clear_enumerated(struct acpi_device * adev)1055 static inline void acpi_device_clear_enumerated(struct acpi_device *adev)
1056 {
1057 }
1058 
acpi_reconfig_notifier_register(struct notifier_block * nb)1059 static inline int acpi_reconfig_notifier_register(struct notifier_block *nb)
1060 {
1061 	return -EINVAL;
1062 }
1063 
acpi_reconfig_notifier_unregister(struct notifier_block * nb)1064 static inline int acpi_reconfig_notifier_unregister(struct notifier_block *nb)
1065 {
1066 	return -EINVAL;
1067 }
1068 
acpi_resource_consumer(struct resource * res)1069 static inline struct acpi_device *acpi_resource_consumer(struct resource *res)
1070 {
1071 	return NULL;
1072 }
1073 
acpi_get_local_address(acpi_handle handle,u32 * addr)1074 static inline int acpi_get_local_address(acpi_handle handle, u32 *addr)
1075 {
1076 	return -ENODEV;
1077 }
1078 
acpi_get_subsystem_id(acpi_handle handle)1079 static inline const char *acpi_get_subsystem_id(acpi_handle handle)
1080 {
1081 	return ERR_PTR(-ENODEV);
1082 }
1083 
acpi_register_wakeup_handler(int wake_irq,bool (* wakeup)(void * context),void * context)1084 static inline int acpi_register_wakeup_handler(int wake_irq,
1085 	bool (*wakeup)(void *context), void *context)
1086 {
1087 	return -ENXIO;
1088 }
1089 
acpi_unregister_wakeup_handler(bool (* wakeup)(void * context),void * context)1090 static inline void acpi_unregister_wakeup_handler(
1091 	bool (*wakeup)(void *context), void *context) { }
1092 
1093 struct acpi_osc_context;
acpi_osc_ctx_get_pci_control(struct acpi_osc_context * context)1094 static inline u32 acpi_osc_ctx_get_pci_control(struct acpi_osc_context *context)
1095 {
1096 	return 0;
1097 }
1098 
acpi_osc_ctx_get_cxl_control(struct acpi_osc_context * context)1099 static inline u32 acpi_osc_ctx_get_cxl_control(struct acpi_osc_context *context)
1100 {
1101 	return 0;
1102 }
1103 
acpi_sleep_state_supported(u8 sleep_state)1104 static inline bool acpi_sleep_state_supported(u8 sleep_state)
1105 {
1106 	return false;
1107 }
1108 
acpi_get_processor_handle(int cpu)1109 static inline acpi_handle acpi_get_processor_handle(int cpu)
1110 {
1111 	return NULL;
1112 }
1113 
acpi_mrrm_max_mem_region(void)1114 static inline int acpi_mrrm_max_mem_region(void)
1115 {
1116 	return 1;
1117 }
1118 
1119 #endif	/* !CONFIG_ACPI */
1120 
1121 #ifdef CONFIG_ACPI_HMAT
1122 int hmat_get_extended_linear_cache_size(struct resource *backing_res, int nid,
1123 					resource_size_t *size);
1124 #else
hmat_get_extended_linear_cache_size(struct resource * backing_res,int nid,resource_size_t * size)1125 static inline int hmat_get_extended_linear_cache_size(struct resource *backing_res,
1126 						      int nid, resource_size_t *size)
1127 {
1128 	return -EOPNOTSUPP;
1129 }
1130 #endif
1131 
1132 extern void arch_post_acpi_subsys_init(void);
1133 
1134 #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
1135 int acpi_ioapic_add(acpi_handle root);
1136 #else
acpi_ioapic_add(acpi_handle root)1137 static inline int acpi_ioapic_add(acpi_handle root) { return 0; }
1138 #endif
1139 
1140 #ifdef CONFIG_ACPI
1141 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
1142 			       u32 pm1a_ctrl,  u32 pm1b_ctrl));
1143 
1144 acpi_status acpi_os_prepare_sleep(u8 sleep_state,
1145 				  u32 pm1a_control, u32 pm1b_control);
1146 
1147 void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
1148 				        u32 val_a,  u32 val_b));
1149 
1150 acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
1151 					   u32 val_a, u32 val_b);
1152 struct acpi_s2idle_dev_ops {
1153 	struct list_head list_node;
1154 	void (*prepare)(void);
1155 	void (*check)(void);
1156 	void (*restore)(void);
1157 };
1158 #if defined(CONFIG_SUSPEND) && defined(CONFIG_X86)
1159 int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg);
1160 void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg);
1161 #else /* CONFIG_SUSPEND && CONFIG_X86 */
acpi_register_lps0_dev(struct acpi_s2idle_dev_ops * arg)1162 static inline int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg)
1163 {
1164 	return -ENODEV;
1165 }
acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops * arg)1166 static inline void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg)
1167 {
1168 }
1169 #endif /* CONFIG_SUSPEND && CONFIG_X86 */
1170 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
1171 #else
1172 #define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
1173 #endif
1174 
1175 #if defined(CONFIG_ACPI) && defined(CONFIG_PM)
1176 int acpi_dev_suspend(struct device *dev, bool wakeup);
1177 int acpi_dev_resume(struct device *dev);
1178 int acpi_subsys_runtime_suspend(struct device *dev);
1179 int acpi_subsys_runtime_resume(struct device *dev);
1180 int acpi_dev_pm_attach(struct device *dev, bool power_on);
1181 bool acpi_storage_d3(struct device *dev);
1182 bool acpi_dev_state_d0(struct device *dev);
1183 #else
acpi_subsys_runtime_suspend(struct device * dev)1184 static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
acpi_subsys_runtime_resume(struct device * dev)1185 static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
acpi_dev_pm_attach(struct device * dev,bool power_on)1186 static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
1187 {
1188 	return 0;
1189 }
acpi_storage_d3(struct device * dev)1190 static inline bool acpi_storage_d3(struct device *dev)
1191 {
1192 	return false;
1193 }
acpi_dev_state_d0(struct device * dev)1194 static inline bool acpi_dev_state_d0(struct device *dev)
1195 {
1196 	return true;
1197 }
1198 #endif
1199 
1200 #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)
1201 int acpi_subsys_prepare(struct device *dev);
1202 void acpi_subsys_complete(struct device *dev);
1203 int acpi_subsys_suspend_late(struct device *dev);
1204 int acpi_subsys_suspend_noirq(struct device *dev);
1205 int acpi_subsys_suspend(struct device *dev);
1206 int acpi_subsys_freeze(struct device *dev);
1207 int acpi_subsys_poweroff(struct device *dev);
1208 int acpi_subsys_restore_early(struct device *dev);
1209 #else
acpi_subsys_prepare(struct device * dev)1210 static inline int acpi_subsys_prepare(struct device *dev) { return 0; }
acpi_subsys_complete(struct device * dev)1211 static inline void acpi_subsys_complete(struct device *dev) {}
acpi_subsys_suspend_late(struct device * dev)1212 static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; }
acpi_subsys_suspend_noirq(struct device * dev)1213 static inline int acpi_subsys_suspend_noirq(struct device *dev) { return 0; }
acpi_subsys_suspend(struct device * dev)1214 static inline int acpi_subsys_suspend(struct device *dev) { return 0; }
acpi_subsys_freeze(struct device * dev)1215 static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
acpi_subsys_poweroff(struct device * dev)1216 static inline int acpi_subsys_poweroff(struct device *dev) { return 0; }
acpi_subsys_restore_early(struct device * dev)1217 static inline int acpi_subsys_restore_early(struct device *dev) { return 0; }
1218 #endif
1219 
1220 #if defined(CONFIG_ACPI_EC) && defined(CONFIG_PM_SLEEP)
1221 void acpi_ec_mark_gpe_for_wake(void);
1222 void acpi_ec_set_gpe_wake_mask(u8 action);
1223 #else
acpi_ec_mark_gpe_for_wake(void)1224 static inline void acpi_ec_mark_gpe_for_wake(void) {}
acpi_ec_set_gpe_wake_mask(u8 action)1225 static inline void acpi_ec_set_gpe_wake_mask(u8 action) {}
1226 #endif
1227 
1228 #ifdef CONFIG_ACPI
1229 char *acpi_handle_path(acpi_handle handle);
1230 __printf(3, 4)
1231 void acpi_handle_printk(const char *level, acpi_handle handle,
1232 			const char *fmt, ...);
1233 void acpi_evaluation_failure_warn(acpi_handle handle, const char *name,
1234 				  acpi_status status);
1235 #else	/* !CONFIG_ACPI */
1236 static inline __printf(3, 4) void
acpi_handle_printk(const char * level,void * handle,const char * fmt,...)1237 acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
acpi_evaluation_failure_warn(acpi_handle handle,const char * name,acpi_status status)1238 static inline void acpi_evaluation_failure_warn(acpi_handle handle,
1239 						const char *name,
1240 						acpi_status status) {}
1241 #endif	/* !CONFIG_ACPI */
1242 
1243 #if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG)
1244 __printf(3, 4)
1245 void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const char *fmt, ...);
1246 #endif
1247 
1248 /*
1249  * acpi_handle_<level>: Print message with ACPI prefix and object path
1250  *
1251  * These interfaces acquire the global namespace mutex to obtain an object
1252  * path.  In interrupt context, it shows the object path as <n/a>.
1253  */
1254 #define acpi_handle_emerg(handle, fmt, ...)				\
1255 	acpi_handle_printk(KERN_EMERG, handle, fmt, ##__VA_ARGS__)
1256 #define acpi_handle_alert(handle, fmt, ...)				\
1257 	acpi_handle_printk(KERN_ALERT, handle, fmt, ##__VA_ARGS__)
1258 #define acpi_handle_crit(handle, fmt, ...)				\
1259 	acpi_handle_printk(KERN_CRIT, handle, fmt, ##__VA_ARGS__)
1260 #define acpi_handle_err(handle, fmt, ...)				\
1261 	acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__)
1262 #define acpi_handle_warn(handle, fmt, ...)				\
1263 	acpi_handle_printk(KERN_WARNING, handle, fmt, ##__VA_ARGS__)
1264 #define acpi_handle_notice(handle, fmt, ...)				\
1265 	acpi_handle_printk(KERN_NOTICE, handle, fmt, ##__VA_ARGS__)
1266 #define acpi_handle_info(handle, fmt, ...)				\
1267 	acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__)
1268 
1269 #if defined(DEBUG)
1270 #define acpi_handle_debug(handle, fmt, ...)				\
1271 	acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__)
1272 #else
1273 #if defined(CONFIG_DYNAMIC_DEBUG)
1274 #define acpi_handle_debug(handle, fmt, ...)				\
1275 	_dynamic_func_call(fmt, __acpi_handle_debug,			\
1276 			   handle, pr_fmt(fmt), ##__VA_ARGS__)
1277 #else
1278 #define acpi_handle_debug(handle, fmt, ...)				\
1279 ({									\
1280 	if (0)								\
1281 		acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); \
1282 	0;								\
1283 })
1284 #endif
1285 #endif
1286 
1287 #if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
1288 bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
1289 				struct acpi_resource_gpio **agpio);
1290 bool acpi_gpio_get_io_resource(struct acpi_resource *ares,
1291 			       struct acpi_resource_gpio **agpio);
1292 int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id, int index,
1293 				  bool *wake_capable);
1294 #else
acpi_gpio_get_irq_resource(struct acpi_resource * ares,struct acpi_resource_gpio ** agpio)1295 static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
1296 					      struct acpi_resource_gpio **agpio)
1297 {
1298 	return false;
1299 }
acpi_gpio_get_io_resource(struct acpi_resource * ares,struct acpi_resource_gpio ** agpio)1300 static inline bool acpi_gpio_get_io_resource(struct acpi_resource *ares,
1301 					     struct acpi_resource_gpio **agpio)
1302 {
1303 	return false;
1304 }
acpi_dev_gpio_irq_wake_get_by(struct acpi_device * adev,const char * con_id,int index,bool * wake_capable)1305 static inline int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,
1306 						int index, bool *wake_capable)
1307 {
1308 	return -ENXIO;
1309 }
1310 #endif
1311 
acpi_dev_gpio_irq_wake_get(struct acpi_device * adev,int index,bool * wake_capable)1312 static inline int acpi_dev_gpio_irq_wake_get(struct acpi_device *adev, int index,
1313 					     bool *wake_capable)
1314 {
1315 	return acpi_dev_gpio_irq_wake_get_by(adev, NULL, index, wake_capable);
1316 }
1317 
acpi_dev_gpio_irq_get_by(struct acpi_device * adev,const char * con_id,int index)1318 static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *con_id,
1319 					   int index)
1320 {
1321 	return acpi_dev_gpio_irq_wake_get_by(adev, con_id, index, NULL);
1322 }
1323 
acpi_dev_gpio_irq_get(struct acpi_device * adev,int index)1324 static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
1325 {
1326 	return acpi_dev_gpio_irq_wake_get_by(adev, NULL, index, NULL);
1327 }
1328 
1329 /* Device properties */
1330 
1331 #ifdef CONFIG_ACPI
1332 int acpi_dev_get_property(const struct acpi_device *adev, const char *name,
1333 			  acpi_object_type type, const union acpi_object **obj);
1334 int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
1335 				const char *name, size_t index, size_t num_args,
1336 				struct fwnode_reference_args *args);
1337 
acpi_node_get_property_reference(const struct fwnode_handle * fwnode,const char * name,size_t index,struct fwnode_reference_args * args)1338 static inline int acpi_node_get_property_reference(
1339 				const struct fwnode_handle *fwnode,
1340 				const char *name, size_t index,
1341 				struct fwnode_reference_args *args)
1342 {
1343 	return __acpi_node_get_property_reference(fwnode, name, index,
1344 		NR_FWNODE_REFERENCE_ARGS, args);
1345 }
1346 
acpi_dev_has_props(const struct acpi_device * adev)1347 static inline bool acpi_dev_has_props(const struct acpi_device *adev)
1348 {
1349 	return !list_empty(&adev->data.properties);
1350 }
1351 
1352 struct acpi_device_properties *
1353 acpi_data_add_props(struct acpi_device_data *data, const guid_t *guid,
1354 		    union acpi_object *properties);
1355 
1356 int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname,
1357 		       void **valptr);
1358 
1359 struct acpi_probe_entry;
1360 typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *,
1361 						 struct acpi_probe_entry *);
1362 
1363 #define ACPI_TABLE_ID_LEN	5
1364 
1365 /**
1366  * struct acpi_probe_entry - boot-time probing entry
1367  * @id:			ACPI table name
1368  * @type:		Optional subtable type to match
1369  *			(if @id contains subtables)
1370  * @subtable_valid:	Optional callback to check the validity of
1371  *			the subtable
1372  * @probe_table:	Callback to the driver being probed when table
1373  *			match is successful
1374  * @probe_subtbl:	Callback to the driver being probed when table and
1375  *			subtable match (and optional callback is successful)
1376  * @driver_data:	Sideband data provided back to the driver
1377  */
1378 struct acpi_probe_entry {
1379 	__u8 id[ACPI_TABLE_ID_LEN];
1380 	__u8 type;
1381 	acpi_probe_entry_validate_subtbl subtable_valid;
1382 	union {
1383 		acpi_tbl_table_handler probe_table;
1384 		acpi_tbl_entry_handler probe_subtbl;
1385 	};
1386 	kernel_ulong_t driver_data;
1387 };
1388 
1389 void arch_sort_irqchip_probe(struct acpi_probe_entry *ap_head, int nr);
1390 
1391 #define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable,	\
1392 				 valid, data, fn)			\
1393 	static const struct acpi_probe_entry __acpi_probe_##name	\
1394 		__used __section("__" #table "_acpi_probe_table") = {	\
1395 			.id = table_id,					\
1396 			.type = subtable,				\
1397 			.subtable_valid = valid,			\
1398 			.probe_table = fn,				\
1399 			.driver_data = data,				\
1400 		}
1401 
1402 #define ACPI_DECLARE_SUBTABLE_PROBE_ENTRY(table, name, table_id,	\
1403 					  subtable, valid, data, fn)	\
1404 	static const struct acpi_probe_entry __acpi_probe_##name	\
1405 		__used __section("__" #table "_acpi_probe_table") = {	\
1406 			.id = table_id,					\
1407 			.type = subtable,				\
1408 			.subtable_valid = valid,			\
1409 			.probe_subtbl = fn,				\
1410 			.driver_data = data,				\
1411 		}
1412 
1413 #define ACPI_PROBE_TABLE(name)		__##name##_acpi_probe_table
1414 #define ACPI_PROBE_TABLE_END(name)	__##name##_acpi_probe_table_end
1415 
1416 int __acpi_probe_device_table(struct acpi_probe_entry *start, int nr);
1417 
1418 #define acpi_probe_device_table(t)					\
1419 	({ 								\
1420 		extern struct acpi_probe_entry ACPI_PROBE_TABLE(t),	\
1421 			                       ACPI_PROBE_TABLE_END(t);	\
1422 		__acpi_probe_device_table(&ACPI_PROBE_TABLE(t),		\
1423 					  (&ACPI_PROBE_TABLE_END(t) -	\
1424 					   &ACPI_PROBE_TABLE(t)));	\
1425 	})
1426 #else
acpi_dev_get_property(struct acpi_device * adev,const char * name,acpi_object_type type,const union acpi_object ** obj)1427 static inline int acpi_dev_get_property(struct acpi_device *adev,
1428 					const char *name, acpi_object_type type,
1429 					const union acpi_object **obj)
1430 {
1431 	return -ENXIO;
1432 }
1433 
1434 static inline int
__acpi_node_get_property_reference(const struct fwnode_handle * fwnode,const char * name,size_t index,size_t num_args,struct fwnode_reference_args * args)1435 __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
1436 				const char *name, size_t index, size_t num_args,
1437 				struct fwnode_reference_args *args)
1438 {
1439 	return -ENXIO;
1440 }
1441 
1442 static inline int
acpi_node_get_property_reference(const struct fwnode_handle * fwnode,const char * name,size_t index,struct fwnode_reference_args * args)1443 acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
1444 				 const char *name, size_t index,
1445 				 struct fwnode_reference_args *args)
1446 {
1447 	return -ENXIO;
1448 }
1449 
acpi_node_prop_get(const struct fwnode_handle * fwnode,const char * propname,void ** valptr)1450 static inline int acpi_node_prop_get(const struct fwnode_handle *fwnode,
1451 				     const char *propname,
1452 				     void **valptr)
1453 {
1454 	return -ENXIO;
1455 }
1456 
1457 static inline struct fwnode_handle *
acpi_graph_get_next_endpoint(const struct fwnode_handle * fwnode,struct fwnode_handle * prev)1458 acpi_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
1459 			     struct fwnode_handle *prev)
1460 {
1461 	return ERR_PTR(-ENXIO);
1462 }
1463 
1464 static inline int
acpi_graph_get_remote_endpoint(const struct fwnode_handle * fwnode,struct fwnode_handle ** remote,struct fwnode_handle ** port,struct fwnode_handle ** endpoint)1465 acpi_graph_get_remote_endpoint(const struct fwnode_handle *fwnode,
1466 			       struct fwnode_handle **remote,
1467 			       struct fwnode_handle **port,
1468 			       struct fwnode_handle **endpoint)
1469 {
1470 	return -ENXIO;
1471 }
1472 
1473 #define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn) \
1474 	static const void * __acpi_table_##name[]			\
1475 		__attribute__((unused))					\
1476 		 = { (void *) table_id,					\
1477 		     (void *) subtable,					\
1478 		     (void *) valid,					\
1479 		     (void *) fn,					\
1480 		     (void *) data }
1481 
1482 #define acpi_probe_device_table(t)	({ int __r = 0; __r;})
1483 #endif
1484 
1485 #ifdef CONFIG_ACPI_TABLE_UPGRADE
1486 void acpi_table_upgrade(void);
1487 #else
acpi_table_upgrade(void)1488 static inline void acpi_table_upgrade(void) { }
1489 #endif
1490 
1491 #if defined(CONFIG_ACPI) && defined(CONFIG_ACPI_WATCHDOG)
1492 extern bool acpi_has_watchdog(void);
1493 #else
acpi_has_watchdog(void)1494 static inline bool acpi_has_watchdog(void) { return false; }
1495 #endif
1496 
1497 #ifdef CONFIG_ACPI_SPCR_TABLE
1498 extern bool qdf2400_e44_present;
1499 int acpi_parse_spcr(bool enable_earlycon, bool enable_console);
1500 #else
acpi_parse_spcr(bool enable_earlycon,bool enable_console)1501 static inline int acpi_parse_spcr(bool enable_earlycon, bool enable_console)
1502 {
1503 	return -ENODEV;
1504 }
1505 #endif
1506 
1507 #if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)
1508 int acpi_irq_get(acpi_handle handle, unsigned int index, struct resource *res);
1509 const struct cpumask *acpi_irq_get_affinity(acpi_handle handle,
1510 					    unsigned int index);
1511 #else
1512 static inline
acpi_irq_get(acpi_handle handle,unsigned int index,struct resource * res)1513 int acpi_irq_get(acpi_handle handle, unsigned int index, struct resource *res)
1514 {
1515 	return -EINVAL;
1516 }
acpi_irq_get_affinity(acpi_handle handle,unsigned int index)1517 static inline const struct cpumask *acpi_irq_get_affinity(acpi_handle handle,
1518 							  unsigned int index)
1519 {
1520 	return NULL;
1521 }
1522 #endif
1523 
1524 #ifdef CONFIG_ACPI_LPIT
1525 int lpit_read_residency_count_address(u64 *address);
1526 #else
lpit_read_residency_count_address(u64 * address)1527 static inline int lpit_read_residency_count_address(u64 *address)
1528 {
1529 	return -EINVAL;
1530 }
1531 #endif
1532 
1533 #ifdef CONFIG_ACPI_PROCESSOR_IDLE
1534 #ifndef arch_get_idle_state_flags
arch_get_idle_state_flags(u32 arch_flags)1535 static inline unsigned int arch_get_idle_state_flags(u32 arch_flags)
1536 {
1537 	return 0;
1538 }
1539 #endif
1540 #endif /* CONFIG_ACPI_PROCESSOR_IDLE */
1541 
1542 #ifdef CONFIG_ACPI_PPTT
1543 int acpi_pptt_cpu_is_thread(unsigned int cpu);
1544 int find_acpi_cpu_topology(unsigned int cpu, int level);
1545 int find_acpi_cpu_topology_cluster(unsigned int cpu);
1546 int find_acpi_cpu_topology_package(unsigned int cpu);
1547 int find_acpi_cpu_topology_hetero_id(unsigned int cpu);
1548 void acpi_pptt_get_cpus_from_container(u32 acpi_cpu_id, cpumask_t *cpus);
1549 int find_acpi_cache_level_from_id(u32 cache_id);
1550 int acpi_pptt_get_cpumask_from_cache_id(u32 cache_id, cpumask_t *cpus);
1551 #else
acpi_pptt_cpu_is_thread(unsigned int cpu)1552 static inline int acpi_pptt_cpu_is_thread(unsigned int cpu)
1553 {
1554 	return -EINVAL;
1555 }
find_acpi_cpu_topology(unsigned int cpu,int level)1556 static inline int find_acpi_cpu_topology(unsigned int cpu, int level)
1557 {
1558 	return -EINVAL;
1559 }
find_acpi_cpu_topology_cluster(unsigned int cpu)1560 static inline int find_acpi_cpu_topology_cluster(unsigned int cpu)
1561 {
1562 	return -EINVAL;
1563 }
find_acpi_cpu_topology_package(unsigned int cpu)1564 static inline int find_acpi_cpu_topology_package(unsigned int cpu)
1565 {
1566 	return -EINVAL;
1567 }
find_acpi_cpu_topology_hetero_id(unsigned int cpu)1568 static inline int find_acpi_cpu_topology_hetero_id(unsigned int cpu)
1569 {
1570 	return -EINVAL;
1571 }
acpi_pptt_get_cpus_from_container(u32 acpi_cpu_id,cpumask_t * cpus)1572 static inline void acpi_pptt_get_cpus_from_container(u32 acpi_cpu_id,
1573 						     cpumask_t *cpus) { }
find_acpi_cache_level_from_id(u32 cache_id)1574 static inline int find_acpi_cache_level_from_id(u32 cache_id)
1575 {
1576 	return -ENOENT;
1577 }
acpi_pptt_get_cpumask_from_cache_id(u32 cache_id,cpumask_t * cpus)1578 static inline int acpi_pptt_get_cpumask_from_cache_id(u32 cache_id,
1579 						      cpumask_t *cpus)
1580 {
1581 	return -ENOENT;
1582 }
1583 #endif
1584 
1585 void acpi_arch_init(void);
1586 
1587 #ifdef CONFIG_ACPI_PCC
1588 void acpi_init_pcc(void);
1589 #else
acpi_init_pcc(void)1590 static inline void acpi_init_pcc(void) { }
1591 #endif
1592 
1593 #ifdef CONFIG_ACPI_FFH
1594 void acpi_init_ffh(void);
1595 extern int acpi_ffh_address_space_arch_setup(void *handler_ctxt,
1596 					     void **region_ctxt);
1597 extern int acpi_ffh_address_space_arch_handler(acpi_integer *value,
1598 					       void *region_context);
1599 #else
acpi_init_ffh(void)1600 static inline void acpi_init_ffh(void) { }
1601 #endif
1602 
1603 #ifdef CONFIG_ACPI
1604 extern void acpi_device_notify(struct device *dev);
1605 extern void acpi_device_notify_remove(struct device *dev);
1606 #else
acpi_device_notify(struct device * dev)1607 static inline void acpi_device_notify(struct device *dev) { }
acpi_device_notify_remove(struct device * dev)1608 static inline void acpi_device_notify_remove(struct device *dev) { }
1609 #endif
1610 
acpi_use_parent_companion(struct device * dev)1611 static inline void acpi_use_parent_companion(struct device *dev)
1612 {
1613 	ACPI_COMPANION_SET(dev, ACPI_COMPANION(dev->parent));
1614 }
1615 
1616 #ifdef CONFIG_ACPI_NUMA
1617 bool acpi_node_backed_by_real_pxm(int nid);
1618 #else
acpi_node_backed_by_real_pxm(int nid)1619 static inline bool acpi_node_backed_by_real_pxm(int nid)
1620 {
1621 	return false;
1622 }
1623 #endif
1624 
1625 #endif	/*_LINUX_ACPI_H*/
1626