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