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