acpi.h 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216
  1. /*
  2. * acpi.h - ACPI Interface
  3. *
  4. * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
  5. *
  6. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  19. */
  20. #ifndef _LINUX_ACPI_H
  21. #define _LINUX_ACPI_H
  22. #include <linux/errno.h>
  23. #include <linux/ioport.h> /* for struct resource */
  24. #include <linux/resource_ext.h>
  25. #include <linux/device.h>
  26. #include <linux/property.h>
  27. #include <linux/uuid.h>
  28. #ifndef _LINUX
  29. #define _LINUX
  30. #endif
  31. #include <acpi/acpi.h>
  32. #ifdef CONFIG_ACPI
  33. #include <linux/list.h>
  34. #include <linux/mod_devicetable.h>
  35. #include <linux/dynamic_debug.h>
  36. #include <linux/module.h>
  37. #include <linux/mutex.h>
  38. #include <acpi/acpi_bus.h>
  39. #include <acpi/acpi_drivers.h>
  40. #include <acpi/acpi_numa.h>
  41. #include <acpi/acpi_io.h>
  42. #include <asm/acpi.h>
  43. static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
  44. {
  45. return adev ? adev->handle : NULL;
  46. }
  47. #define ACPI_COMPANION(dev) to_acpi_device_node((dev)->fwnode)
  48. #define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \
  49. acpi_fwnode_handle(adev) : NULL)
  50. #define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
  51. static inline struct fwnode_handle *acpi_alloc_fwnode_static(void)
  52. {
  53. struct fwnode_handle *fwnode;
  54. fwnode = kzalloc(sizeof(struct fwnode_handle), GFP_KERNEL);
  55. if (!fwnode)
  56. return NULL;
  57. fwnode->type = FWNODE_ACPI_STATIC;
  58. return fwnode;
  59. }
  60. static inline void acpi_free_fwnode_static(struct fwnode_handle *fwnode)
  61. {
  62. if (WARN_ON(!fwnode || fwnode->type != FWNODE_ACPI_STATIC))
  63. return;
  64. kfree(fwnode);
  65. }
  66. /**
  67. * ACPI_DEVICE_CLASS - macro used to describe an ACPI device with
  68. * the PCI-defined class-code information
  69. *
  70. * @_cls : the class, subclass, prog-if triple for this device
  71. * @_msk : the class mask for this device
  72. *
  73. * This macro is used to create a struct acpi_device_id that matches a
  74. * specific PCI class. The .id and .driver_data fields will be left
  75. * initialized with the default value.
  76. */
  77. #define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (_cls), .cls_msk = (_msk),
  78. static inline bool has_acpi_companion(struct device *dev)
  79. {
  80. return is_acpi_device_node(dev->fwnode);
  81. }
  82. static inline void acpi_preset_companion(struct device *dev,
  83. struct acpi_device *parent, u64 addr)
  84. {
  85. ACPI_COMPANION_SET(dev, acpi_find_child_device(parent, addr, NULL));
  86. }
  87. static inline const char *acpi_dev_name(struct acpi_device *adev)
  88. {
  89. return dev_name(&adev->dev);
  90. }
  91. struct device *acpi_get_first_physical_node(struct acpi_device *adev);
  92. enum acpi_irq_model_id {
  93. ACPI_IRQ_MODEL_PIC = 0,
  94. ACPI_IRQ_MODEL_IOAPIC,
  95. ACPI_IRQ_MODEL_IOSAPIC,
  96. ACPI_IRQ_MODEL_PLATFORM,
  97. ACPI_IRQ_MODEL_GIC,
  98. ACPI_IRQ_MODEL_COUNT
  99. };
  100. extern enum acpi_irq_model_id acpi_irq_model;
  101. enum acpi_interrupt_id {
  102. ACPI_INTERRUPT_PMI = 1,
  103. ACPI_INTERRUPT_INIT,
  104. ACPI_INTERRUPT_CPEI,
  105. ACPI_INTERRUPT_COUNT
  106. };
  107. #define ACPI_SPACE_MEM 0
  108. enum acpi_address_range_id {
  109. ACPI_ADDRESS_RANGE_MEMORY = 1,
  110. ACPI_ADDRESS_RANGE_RESERVED = 2,
  111. ACPI_ADDRESS_RANGE_ACPI = 3,
  112. ACPI_ADDRESS_RANGE_NVS = 4,
  113. ACPI_ADDRESS_RANGE_COUNT
  114. };
  115. /* Table Handlers */
  116. typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *table);
  117. typedef int (*acpi_tbl_entry_handler)(struct acpi_subtable_header *header,
  118. const unsigned long end);
  119. /* Debugger support */
  120. struct acpi_debugger_ops {
  121. int (*create_thread)(acpi_osd_exec_callback function, void *context);
  122. ssize_t (*write_log)(const char *msg);
  123. ssize_t (*read_cmd)(char *buffer, size_t length);
  124. int (*wait_command_ready)(bool single_step, char *buffer, size_t length);
  125. int (*notify_command_complete)(void);
  126. };
  127. struct acpi_debugger {
  128. const struct acpi_debugger_ops *ops;
  129. struct module *owner;
  130. struct mutex lock;
  131. };
  132. #ifdef CONFIG_ACPI_DEBUGGER
  133. int __init acpi_debugger_init(void);
  134. int acpi_register_debugger(struct module *owner,
  135. const struct acpi_debugger_ops *ops);
  136. void acpi_unregister_debugger(const struct acpi_debugger_ops *ops);
  137. int acpi_debugger_create_thread(acpi_osd_exec_callback function, void *context);
  138. ssize_t acpi_debugger_write_log(const char *msg);
  139. ssize_t acpi_debugger_read_cmd(char *buffer, size_t buffer_length);
  140. int acpi_debugger_wait_command_ready(void);
  141. int acpi_debugger_notify_command_complete(void);
  142. #else
  143. static inline int acpi_debugger_init(void)
  144. {
  145. return -ENODEV;
  146. }
  147. static inline int acpi_register_debugger(struct module *owner,
  148. const struct acpi_debugger_ops *ops)
  149. {
  150. return -ENODEV;
  151. }
  152. static inline void acpi_unregister_debugger(const struct acpi_debugger_ops *ops)
  153. {
  154. }
  155. static inline int acpi_debugger_create_thread(acpi_osd_exec_callback function,
  156. void *context)
  157. {
  158. return -ENODEV;
  159. }
  160. static inline int acpi_debugger_write_log(const char *msg)
  161. {
  162. return -ENODEV;
  163. }
  164. static inline int acpi_debugger_read_cmd(char *buffer, u32 buffer_length)
  165. {
  166. return -ENODEV;
  167. }
  168. static inline int acpi_debugger_wait_command_ready(void)
  169. {
  170. return -ENODEV;
  171. }
  172. static inline int acpi_debugger_notify_command_complete(void)
  173. {
  174. return -ENODEV;
  175. }
  176. #endif
  177. #define BAD_MADT_ENTRY(entry, end) ( \
  178. (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
  179. ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
  180. struct acpi_subtable_proc {
  181. int id;
  182. acpi_tbl_entry_handler handler;
  183. int count;
  184. };
  185. char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
  186. void __acpi_unmap_table(char *map, unsigned long size);
  187. int early_acpi_boot_init(void);
  188. int acpi_boot_init (void);
  189. void acpi_boot_table_init (void);
  190. int acpi_mps_check (void);
  191. int acpi_numa_init (void);
  192. int acpi_table_init (void);
  193. int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
  194. int __init acpi_table_parse_entries(char *id, unsigned long table_size,
  195. int entry_id,
  196. acpi_tbl_entry_handler handler,
  197. unsigned int max_entries);
  198. int __init acpi_table_parse_entries_array(char *id, unsigned long table_size,
  199. struct acpi_subtable_proc *proc, int proc_num,
  200. unsigned int max_entries);
  201. int acpi_table_parse_madt(enum acpi_madt_type id,
  202. acpi_tbl_entry_handler handler,
  203. unsigned int max_entries);
  204. int acpi_parse_mcfg (struct acpi_table_header *header);
  205. void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
  206. /* the following numa functions are architecture-dependent */
  207. void acpi_numa_slit_init (struct acpi_table_slit *slit);
  208. #if defined(CONFIG_X86) || defined(CONFIG_IA64)
  209. void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
  210. #else
  211. static inline void
  212. acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) { }
  213. #endif
  214. void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
  215. #ifdef CONFIG_ARM64
  216. void acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa);
  217. #else
  218. static inline void
  219. acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { }
  220. #endif
  221. int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
  222. #ifndef PHYS_CPUID_INVALID
  223. typedef u32 phys_cpuid_t;
  224. #define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
  225. #endif
  226. static inline bool invalid_logical_cpuid(u32 cpuid)
  227. {
  228. return (int)cpuid < 0;
  229. }
  230. static inline bool invalid_phys_cpuid(phys_cpuid_t phys_id)
  231. {
  232. return phys_id == PHYS_CPUID_INVALID;
  233. }
  234. /* Validate the processor object's proc_id */
  235. bool acpi_duplicate_processor_id(int proc_id);
  236. #ifdef CONFIG_ACPI_HOTPLUG_CPU
  237. /* Arch dependent functions for cpu hotplug support */
  238. int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
  239. int *pcpu);
  240. int acpi_unmap_cpu(int cpu);
  241. #endif /* CONFIG_ACPI_HOTPLUG_CPU */
  242. #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
  243. int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr);
  244. #endif
  245. int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
  246. int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
  247. int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base);
  248. void acpi_irq_stats_init(void);
  249. extern u32 acpi_irq_handled;
  250. extern u32 acpi_irq_not_handled;
  251. extern unsigned int acpi_sci_irq;
  252. extern bool acpi_no_s5;
  253. #define INVALID_ACPI_IRQ ((unsigned)-1)
  254. static inline bool acpi_sci_irq_valid(void)
  255. {
  256. return acpi_sci_irq != INVALID_ACPI_IRQ;
  257. }
  258. extern int sbf_port;
  259. extern unsigned long acpi_realmode_flags;
  260. int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity);
  261. int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
  262. int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi);
  263. void acpi_set_irq_model(enum acpi_irq_model_id model,
  264. struct fwnode_handle *fwnode);
  265. #ifdef CONFIG_X86_IO_APIC
  266. extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity);
  267. #else
  268. #define acpi_get_override_irq(gsi, trigger, polarity) (-1)
  269. #endif
  270. /*
  271. * This function undoes the effect of one call to acpi_register_gsi().
  272. * If this matches the last registration, any IRQ resources for gsi
  273. * are freed.
  274. */
  275. void acpi_unregister_gsi (u32 gsi);
  276. struct pci_dev;
  277. int acpi_pci_irq_enable (struct pci_dev *dev);
  278. void acpi_penalize_isa_irq(int irq, int active);
  279. bool acpi_isa_irq_available(int irq);
  280. void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
  281. void acpi_pci_irq_disable (struct pci_dev *dev);
  282. extern int ec_read(u8 addr, u8 *val);
  283. extern int ec_write(u8 addr, u8 val);
  284. extern int ec_transaction(u8 command,
  285. const u8 *wdata, unsigned wdata_len,
  286. u8 *rdata, unsigned rdata_len);
  287. extern acpi_handle ec_get_handle(void);
  288. extern bool acpi_is_pnp_device(struct acpi_device *);
  289. #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE)
  290. typedef void (*wmi_notify_handler) (u32 value, void *context);
  291. extern acpi_status wmi_evaluate_method(const char *guid, u8 instance,
  292. u32 method_id,
  293. const struct acpi_buffer *in,
  294. struct acpi_buffer *out);
  295. extern acpi_status wmi_query_block(const char *guid, u8 instance,
  296. struct acpi_buffer *out);
  297. extern acpi_status wmi_set_block(const char *guid, u8 instance,
  298. const struct acpi_buffer *in);
  299. extern acpi_status wmi_install_notify_handler(const char *guid,
  300. wmi_notify_handler handler, void *data);
  301. extern acpi_status wmi_remove_notify_handler(const char *guid);
  302. extern acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out);
  303. extern bool wmi_has_guid(const char *guid);
  304. #endif /* CONFIG_ACPI_WMI */
  305. #define ACPI_VIDEO_OUTPUT_SWITCHING 0x0001
  306. #define ACPI_VIDEO_DEVICE_POSTING 0x0002
  307. #define ACPI_VIDEO_ROM_AVAILABLE 0x0004
  308. #define ACPI_VIDEO_BACKLIGHT 0x0008
  309. #define ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR 0x0010
  310. #define ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO 0x0020
  311. #define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR 0x0040
  312. #define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO 0x0080
  313. #define ACPI_VIDEO_BACKLIGHT_DMI_VENDOR 0x0100
  314. #define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200
  315. #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400
  316. #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800
  317. extern char acpi_video_backlight_string[];
  318. extern long acpi_is_video_device(acpi_handle handle);
  319. extern int acpi_blacklisted(void);
  320. extern void acpi_osi_setup(char *str);
  321. extern bool acpi_osi_is_win8(void);
  322. #ifdef CONFIG_ACPI_NUMA
  323. int acpi_map_pxm_to_online_node(int pxm);
  324. int acpi_get_node(acpi_handle handle);
  325. #else
  326. static inline int acpi_map_pxm_to_online_node(int pxm)
  327. {
  328. return 0;
  329. }
  330. static inline int acpi_get_node(acpi_handle handle)
  331. {
  332. return 0;
  333. }
  334. #endif
  335. extern int acpi_paddr_to_node(u64 start_addr, u64 size);
  336. extern int pnpacpi_disabled;
  337. #define PXM_INVAL (-1)
  338. bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res);
  339. bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res);
  340. bool acpi_dev_resource_address_space(struct acpi_resource *ares,
  341. struct resource_win *win);
  342. bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares,
  343. struct resource_win *win);
  344. unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable);
  345. unsigned int acpi_dev_get_irq_type(int triggering, int polarity);
  346. bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
  347. struct resource *res);
  348. void acpi_dev_free_resource_list(struct list_head *list);
  349. int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list,
  350. int (*preproc)(struct acpi_resource *, void *),
  351. void *preproc_data);
  352. int acpi_dev_filter_resource_type(struct acpi_resource *ares,
  353. unsigned long types);
  354. static inline int acpi_dev_filter_resource_type_cb(struct acpi_resource *ares,
  355. void *arg)
  356. {
  357. return acpi_dev_filter_resource_type(ares, (unsigned long)arg);
  358. }
  359. struct acpi_device *acpi_resource_consumer(struct resource *res);
  360. int acpi_check_resource_conflict(const struct resource *res);
  361. int acpi_check_region(resource_size_t start, resource_size_t n,
  362. const char *name);
  363. int acpi_resources_are_enforced(void);
  364. #ifdef CONFIG_HIBERNATION
  365. void __init acpi_no_s4_hw_signature(void);
  366. #endif
  367. #ifdef CONFIG_PM_SLEEP
  368. void __init acpi_old_suspend_ordering(void);
  369. void __init acpi_nvs_nosave(void);
  370. void __init acpi_nvs_nosave_s3(void);
  371. #endif /* CONFIG_PM_SLEEP */
  372. struct acpi_osc_context {
  373. char *uuid_str; /* UUID string */
  374. int rev;
  375. struct acpi_buffer cap; /* list of DWORD capabilities */
  376. struct acpi_buffer ret; /* free by caller if success */
  377. };
  378. acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
  379. /* Indexes into _OSC Capabilities Buffer (DWORDs 2 & 3 are device-specific) */
  380. #define OSC_QUERY_DWORD 0 /* DWORD 1 */
  381. #define OSC_SUPPORT_DWORD 1 /* DWORD 2 */
  382. #define OSC_CONTROL_DWORD 2 /* DWORD 3 */
  383. /* _OSC Capabilities DWORD 1: Query/Control and Error Returns (generic) */
  384. #define OSC_QUERY_ENABLE 0x00000001 /* input */
  385. #define OSC_REQUEST_ERROR 0x00000002 /* return */
  386. #define OSC_INVALID_UUID_ERROR 0x00000004 /* return */
  387. #define OSC_INVALID_REVISION_ERROR 0x00000008 /* return */
  388. #define OSC_CAPABILITIES_MASK_ERROR 0x00000010 /* return */
  389. /* Platform-Wide Capabilities _OSC: Capabilities DWORD 2: Support Field */
  390. #define OSC_SB_PAD_SUPPORT 0x00000001
  391. #define OSC_SB_PPC_OST_SUPPORT 0x00000002
  392. #define OSC_SB_PR3_SUPPORT 0x00000004
  393. #define OSC_SB_HOTPLUG_OST_SUPPORT 0x00000008
  394. #define OSC_SB_APEI_SUPPORT 0x00000010
  395. #define OSC_SB_CPC_SUPPORT 0x00000020
  396. #define OSC_SB_CPCV2_SUPPORT 0x00000040
  397. #define OSC_SB_PCLPI_SUPPORT 0x00000080
  398. #define OSC_SB_OSLPI_SUPPORT 0x00000100
  399. #define OSC_SB_CPC_DIVERSE_HIGH_SUPPORT 0x00001000
  400. extern bool osc_sb_apei_support_acked;
  401. extern bool osc_pc_lpi_support_confirmed;
  402. /* PCI Host Bridge _OSC: Capabilities DWORD 2: Support Field */
  403. #define OSC_PCI_EXT_CONFIG_SUPPORT 0x00000001
  404. #define OSC_PCI_ASPM_SUPPORT 0x00000002
  405. #define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004
  406. #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008
  407. #define OSC_PCI_MSI_SUPPORT 0x00000010
  408. #define OSC_PCI_SUPPORT_MASKS 0x0000001f
  409. /* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */
  410. #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001
  411. #define OSC_PCI_SHPC_NATIVE_HP_CONTROL 0x00000002
  412. #define OSC_PCI_EXPRESS_PME_CONTROL 0x00000004
  413. #define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008
  414. #define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010
  415. #define OSC_PCI_CONTROL_MASKS 0x0000001f
  416. #define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002
  417. #define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004
  418. #define ACPI_GSB_ACCESS_ATTRIB_BYTE 0x00000006
  419. #define ACPI_GSB_ACCESS_ATTRIB_WORD 0x00000008
  420. #define ACPI_GSB_ACCESS_ATTRIB_BLOCK 0x0000000A
  421. #define ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE 0x0000000B
  422. #define ACPI_GSB_ACCESS_ATTRIB_WORD_CALL 0x0000000C
  423. #define ACPI_GSB_ACCESS_ATTRIB_BLOCK_CALL 0x0000000D
  424. #define ACPI_GSB_ACCESS_ATTRIB_RAW_BYTES 0x0000000E
  425. #define ACPI_GSB_ACCESS_ATTRIB_RAW_PROCESS 0x0000000F
  426. extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
  427. u32 *mask, u32 req);
  428. /* Enable _OST when all relevant hotplug operations are enabled */
  429. #if defined(CONFIG_ACPI_HOTPLUG_CPU) && \
  430. defined(CONFIG_ACPI_HOTPLUG_MEMORY) && \
  431. defined(CONFIG_ACPI_CONTAINER)
  432. #define ACPI_HOTPLUG_OST
  433. #endif
  434. /* _OST Source Event Code (OSPM Action) */
  435. #define ACPI_OST_EC_OSPM_SHUTDOWN 0x100
  436. #define ACPI_OST_EC_OSPM_EJECT 0x103
  437. #define ACPI_OST_EC_OSPM_INSERTION 0x200
  438. /* _OST General Processing Status Code */
  439. #define ACPI_OST_SC_SUCCESS 0x0
  440. #define ACPI_OST_SC_NON_SPECIFIC_FAILURE 0x1
  441. #define ACPI_OST_SC_UNRECOGNIZED_NOTIFY 0x2
  442. /* _OST OS Shutdown Processing (0x100) Status Code */
  443. #define ACPI_OST_SC_OS_SHUTDOWN_DENIED 0x80
  444. #define ACPI_OST_SC_OS_SHUTDOWN_IN_PROGRESS 0x81
  445. #define ACPI_OST_SC_OS_SHUTDOWN_COMPLETED 0x82
  446. #define ACPI_OST_SC_OS_SHUTDOWN_NOT_SUPPORTED 0x83
  447. /* _OST Ejection Request (0x3, 0x103) Status Code */
  448. #define ACPI_OST_SC_EJECT_NOT_SUPPORTED 0x80
  449. #define ACPI_OST_SC_DEVICE_IN_USE 0x81
  450. #define ACPI_OST_SC_DEVICE_BUSY 0x82
  451. #define ACPI_OST_SC_EJECT_DEPENDENCY_BUSY 0x83
  452. #define ACPI_OST_SC_EJECT_IN_PROGRESS 0x84
  453. /* _OST Insertion Request (0x200) Status Code */
  454. #define ACPI_OST_SC_INSERT_IN_PROGRESS 0x80
  455. #define ACPI_OST_SC_DRIVER_LOAD_FAILURE 0x81
  456. #define ACPI_OST_SC_INSERT_NOT_SUPPORTED 0x82
  457. extern void acpi_early_init(void);
  458. extern void acpi_subsystem_init(void);
  459. extern int acpi_nvs_register(__u64 start, __u64 size);
  460. extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
  461. void *data);
  462. const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
  463. const struct device *dev);
  464. extern bool acpi_driver_match_device(struct device *dev,
  465. const struct device_driver *drv);
  466. int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
  467. int acpi_device_modalias(struct device *, char *, int);
  468. void acpi_walk_dep_device_list(acpi_handle handle);
  469. struct platform_device *acpi_create_platform_device(struct acpi_device *,
  470. struct property_entry *);
  471. #define ACPI_PTR(_ptr) (_ptr)
  472. static inline void acpi_device_set_enumerated(struct acpi_device *adev)
  473. {
  474. adev->flags.visited = true;
  475. }
  476. static inline void acpi_device_clear_enumerated(struct acpi_device *adev)
  477. {
  478. adev->flags.visited = false;
  479. }
  480. enum acpi_reconfig_event {
  481. ACPI_RECONFIG_DEVICE_ADD = 0,
  482. ACPI_RECONFIG_DEVICE_REMOVE,
  483. };
  484. int acpi_reconfig_notifier_register(struct notifier_block *nb);
  485. int acpi_reconfig_notifier_unregister(struct notifier_block *nb);
  486. #ifdef CONFIG_ACPI_GTDT
  487. int acpi_gtdt_init(struct acpi_table_header *table, int *platform_timer_count);
  488. int acpi_gtdt_map_ppi(int type);
  489. bool acpi_gtdt_c3stop(int type);
  490. int acpi_arch_timer_mem_init(struct arch_timer_mem *timer_mem, int *timer_count);
  491. #endif
  492. #else /* !CONFIG_ACPI */
  493. #define acpi_disabled 1
  494. #define ACPI_COMPANION(dev) (NULL)
  495. #define ACPI_COMPANION_SET(dev, adev) do { } while (0)
  496. #define ACPI_HANDLE(dev) (NULL)
  497. #define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (0), .cls_msk = (0),
  498. struct fwnode_handle;
  499. static inline bool acpi_dev_found(const char *hid)
  500. {
  501. return false;
  502. }
  503. static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
  504. {
  505. return false;
  506. }
  507. static inline bool is_acpi_node(struct fwnode_handle *fwnode)
  508. {
  509. return false;
  510. }
  511. static inline bool is_acpi_device_node(struct fwnode_handle *fwnode)
  512. {
  513. return false;
  514. }
  515. static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwnode)
  516. {
  517. return NULL;
  518. }
  519. static inline bool is_acpi_data_node(struct fwnode_handle *fwnode)
  520. {
  521. return false;
  522. }
  523. static inline struct acpi_data_node *to_acpi_data_node(struct fwnode_handle *fwnode)
  524. {
  525. return NULL;
  526. }
  527. static inline bool acpi_data_node_match(struct fwnode_handle *fwnode,
  528. const char *name)
  529. {
  530. return false;
  531. }
  532. static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
  533. {
  534. return NULL;
  535. }
  536. static inline bool has_acpi_companion(struct device *dev)
  537. {
  538. return false;
  539. }
  540. static inline void acpi_preset_companion(struct device *dev,
  541. struct acpi_device *parent, u64 addr)
  542. {
  543. }
  544. static inline const char *acpi_dev_name(struct acpi_device *adev)
  545. {
  546. return NULL;
  547. }
  548. static inline struct device *acpi_get_first_physical_node(struct acpi_device *adev)
  549. {
  550. return NULL;
  551. }
  552. static inline void acpi_early_init(void) { }
  553. static inline void acpi_subsystem_init(void) { }
  554. static inline int early_acpi_boot_init(void)
  555. {
  556. return 0;
  557. }
  558. static inline int acpi_boot_init(void)
  559. {
  560. return 0;
  561. }
  562. static inline void acpi_boot_table_init(void)
  563. {
  564. return;
  565. }
  566. static inline int acpi_mps_check(void)
  567. {
  568. return 0;
  569. }
  570. static inline int acpi_check_resource_conflict(struct resource *res)
  571. {
  572. return 0;
  573. }
  574. static inline int acpi_check_region(resource_size_t start, resource_size_t n,
  575. const char *name)
  576. {
  577. return 0;
  578. }
  579. struct acpi_table_header;
  580. static inline int acpi_table_parse(char *id,
  581. int (*handler)(struct acpi_table_header *))
  582. {
  583. return -ENODEV;
  584. }
  585. static inline int acpi_nvs_register(__u64 start, __u64 size)
  586. {
  587. return 0;
  588. }
  589. static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
  590. void *data)
  591. {
  592. return 0;
  593. }
  594. struct acpi_device_id;
  595. static inline const struct acpi_device_id *acpi_match_device(
  596. const struct acpi_device_id *ids, const struct device *dev)
  597. {
  598. return NULL;
  599. }
  600. static inline bool acpi_driver_match_device(struct device *dev,
  601. const struct device_driver *drv)
  602. {
  603. return false;
  604. }
  605. static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
  606. const guid_t *guid,
  607. int rev, int func,
  608. union acpi_object *argv4)
  609. {
  610. return NULL;
  611. }
  612. static inline int acpi_device_uevent_modalias(struct device *dev,
  613. struct kobj_uevent_env *env)
  614. {
  615. return -ENODEV;
  616. }
  617. static inline int acpi_device_modalias(struct device *dev,
  618. char *buf, int size)
  619. {
  620. return -ENODEV;
  621. }
  622. static inline bool acpi_dma_supported(struct acpi_device *adev)
  623. {
  624. return false;
  625. }
  626. static inline enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev)
  627. {
  628. return DEV_DMA_NOT_SUPPORTED;
  629. }
  630. static inline int acpi_dma_configure(struct device *dev,
  631. enum dev_dma_attr attr)
  632. {
  633. return 0;
  634. }
  635. static inline void acpi_dma_deconfigure(struct device *dev) { }
  636. #define ACPI_PTR(_ptr) (NULL)
  637. static inline void acpi_device_set_enumerated(struct acpi_device *adev)
  638. {
  639. }
  640. static inline void acpi_device_clear_enumerated(struct acpi_device *adev)
  641. {
  642. }
  643. static inline int acpi_reconfig_notifier_register(struct notifier_block *nb)
  644. {
  645. return -EINVAL;
  646. }
  647. static inline int acpi_reconfig_notifier_unregister(struct notifier_block *nb)
  648. {
  649. return -EINVAL;
  650. }
  651. static inline struct acpi_device *acpi_resource_consumer(struct resource *res)
  652. {
  653. return NULL;
  654. }
  655. #endif /* !CONFIG_ACPI */
  656. #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
  657. int acpi_ioapic_add(acpi_handle root);
  658. #else
  659. static inline int acpi_ioapic_add(acpi_handle root) { return 0; }
  660. #endif
  661. #ifdef CONFIG_ACPI
  662. void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
  663. u32 pm1a_ctrl, u32 pm1b_ctrl));
  664. acpi_status acpi_os_prepare_sleep(u8 sleep_state,
  665. u32 pm1a_control, u32 pm1b_control);
  666. void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
  667. u32 val_a, u32 val_b));
  668. acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
  669. u32 val_a, u32 val_b);
  670. #ifdef CONFIG_X86
  671. void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
  672. #else
  673. static inline void arch_reserve_mem_area(acpi_physical_address addr,
  674. size_t size)
  675. {
  676. }
  677. #endif /* CONFIG_X86 */
  678. #else
  679. #define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
  680. #endif
  681. #if defined(CONFIG_ACPI) && defined(CONFIG_PM)
  682. int acpi_dev_runtime_suspend(struct device *dev);
  683. int acpi_dev_runtime_resume(struct device *dev);
  684. int acpi_subsys_runtime_suspend(struct device *dev);
  685. int acpi_subsys_runtime_resume(struct device *dev);
  686. struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
  687. int acpi_dev_pm_attach(struct device *dev, bool power_on);
  688. #else
  689. static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; }
  690. static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; }
  691. static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
  692. static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
  693. static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
  694. {
  695. return NULL;
  696. }
  697. static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
  698. {
  699. return -ENODEV;
  700. }
  701. #endif
  702. #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)
  703. int acpi_dev_suspend_late(struct device *dev);
  704. int acpi_dev_resume_early(struct device *dev);
  705. int acpi_subsys_prepare(struct device *dev);
  706. void acpi_subsys_complete(struct device *dev);
  707. int acpi_subsys_suspend_late(struct device *dev);
  708. int acpi_subsys_resume_early(struct device *dev);
  709. int acpi_subsys_suspend(struct device *dev);
  710. int acpi_subsys_freeze(struct device *dev);
  711. #else
  712. static inline int acpi_dev_suspend_late(struct device *dev) { return 0; }
  713. static inline int acpi_dev_resume_early(struct device *dev) { return 0; }
  714. static inline int acpi_subsys_prepare(struct device *dev) { return 0; }
  715. static inline void acpi_subsys_complete(struct device *dev) {}
  716. static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; }
  717. static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
  718. static inline int acpi_subsys_suspend(struct device *dev) { return 0; }
  719. static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
  720. #endif
  721. #ifdef CONFIG_ACPI
  722. __printf(3, 4)
  723. void acpi_handle_printk(const char *level, acpi_handle handle,
  724. const char *fmt, ...);
  725. #else /* !CONFIG_ACPI */
  726. static inline __printf(3, 4) void
  727. acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
  728. #endif /* !CONFIG_ACPI */
  729. #if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG)
  730. __printf(3, 4)
  731. void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const char *fmt, ...);
  732. #else
  733. #define __acpi_handle_debug(descriptor, handle, fmt, ...) \
  734. acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__);
  735. #endif
  736. /*
  737. * acpi_handle_<level>: Print message with ACPI prefix and object path
  738. *
  739. * These interfaces acquire the global namespace mutex to obtain an object
  740. * path. In interrupt context, it shows the object path as <n/a>.
  741. */
  742. #define acpi_handle_emerg(handle, fmt, ...) \
  743. acpi_handle_printk(KERN_EMERG, handle, fmt, ##__VA_ARGS__)
  744. #define acpi_handle_alert(handle, fmt, ...) \
  745. acpi_handle_printk(KERN_ALERT, handle, fmt, ##__VA_ARGS__)
  746. #define acpi_handle_crit(handle, fmt, ...) \
  747. acpi_handle_printk(KERN_CRIT, handle, fmt, ##__VA_ARGS__)
  748. #define acpi_handle_err(handle, fmt, ...) \
  749. acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__)
  750. #define acpi_handle_warn(handle, fmt, ...) \
  751. acpi_handle_printk(KERN_WARNING, handle, fmt, ##__VA_ARGS__)
  752. #define acpi_handle_notice(handle, fmt, ...) \
  753. acpi_handle_printk(KERN_NOTICE, handle, fmt, ##__VA_ARGS__)
  754. #define acpi_handle_info(handle, fmt, ...) \
  755. acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__)
  756. #if defined(DEBUG)
  757. #define acpi_handle_debug(handle, fmt, ...) \
  758. acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__)
  759. #else
  760. #if defined(CONFIG_DYNAMIC_DEBUG)
  761. #define acpi_handle_debug(handle, fmt, ...) \
  762. do { \
  763. DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
  764. if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
  765. __acpi_handle_debug(&descriptor, handle, pr_fmt(fmt), \
  766. ##__VA_ARGS__); \
  767. } while (0)
  768. #else
  769. #define acpi_handle_debug(handle, fmt, ...) \
  770. ({ \
  771. if (0) \
  772. acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); \
  773. 0; \
  774. })
  775. #endif
  776. #endif
  777. struct acpi_gpio_params {
  778. unsigned int crs_entry_index;
  779. unsigned int line_index;
  780. bool active_low;
  781. };
  782. struct acpi_gpio_mapping {
  783. const char *name;
  784. const struct acpi_gpio_params *data;
  785. unsigned int size;
  786. };
  787. #if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
  788. int acpi_dev_add_driver_gpios(struct acpi_device *adev,
  789. const struct acpi_gpio_mapping *gpios);
  790. static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev)
  791. {
  792. if (adev)
  793. adev->driver_gpios = NULL;
  794. }
  795. int devm_acpi_dev_add_driver_gpios(struct device *dev,
  796. const struct acpi_gpio_mapping *gpios);
  797. void devm_acpi_dev_remove_driver_gpios(struct device *dev);
  798. int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index);
  799. #else
  800. static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev,
  801. const struct acpi_gpio_mapping *gpios)
  802. {
  803. return -ENXIO;
  804. }
  805. static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {}
  806. static inline int devm_acpi_dev_add_driver_gpios(struct device *dev,
  807. const struct acpi_gpio_mapping *gpios)
  808. {
  809. return -ENXIO;
  810. }
  811. static inline void devm_acpi_dev_remove_driver_gpios(struct device *dev) {}
  812. static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
  813. {
  814. return -ENXIO;
  815. }
  816. #endif
  817. /* Device properties */
  818. #define MAX_ACPI_REFERENCE_ARGS 8
  819. struct acpi_reference_args {
  820. struct acpi_device *adev;
  821. size_t nargs;
  822. u64 args[MAX_ACPI_REFERENCE_ARGS];
  823. };
  824. #ifdef CONFIG_ACPI
  825. int acpi_dev_get_property(struct acpi_device *adev, const char *name,
  826. acpi_object_type type, const union acpi_object **obj);
  827. int __acpi_node_get_property_reference(struct fwnode_handle *fwnode,
  828. const char *name, size_t index, size_t num_args,
  829. struct acpi_reference_args *args);
  830. static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode,
  831. const char *name, size_t index,
  832. struct acpi_reference_args *args)
  833. {
  834. return __acpi_node_get_property_reference(fwnode, name, index,
  835. MAX_ACPI_REFERENCE_ARGS, args);
  836. }
  837. int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname,
  838. void **valptr);
  839. int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname,
  840. enum dev_prop_type proptype, void *val);
  841. int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname,
  842. enum dev_prop_type proptype, void *val, size_t nval);
  843. int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
  844. enum dev_prop_type proptype, void *val, size_t nval);
  845. struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode,
  846. struct fwnode_handle *child);
  847. struct fwnode_handle *acpi_node_get_parent(struct fwnode_handle *fwnode);
  848. struct fwnode_handle *acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode,
  849. struct fwnode_handle *prev);
  850. int acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode,
  851. struct fwnode_handle **remote,
  852. struct fwnode_handle **port,
  853. struct fwnode_handle **endpoint);
  854. struct acpi_probe_entry;
  855. typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *,
  856. struct acpi_probe_entry *);
  857. #define ACPI_TABLE_ID_LEN 5
  858. /**
  859. * struct acpi_probe_entry - boot-time probing entry
  860. * @id: ACPI table name
  861. * @type: Optional subtable type to match
  862. * (if @id contains subtables)
  863. * @subtable_valid: Optional callback to check the validity of
  864. * the subtable
  865. * @probe_table: Callback to the driver being probed when table
  866. * match is successful
  867. * @probe_subtbl: Callback to the driver being probed when table and
  868. * subtable match (and optional callback is successful)
  869. * @driver_data: Sideband data provided back to the driver
  870. */
  871. struct acpi_probe_entry {
  872. __u8 id[ACPI_TABLE_ID_LEN];
  873. __u8 type;
  874. acpi_probe_entry_validate_subtbl subtable_valid;
  875. union {
  876. acpi_tbl_table_handler probe_table;
  877. acpi_tbl_entry_handler probe_subtbl;
  878. };
  879. kernel_ulong_t driver_data;
  880. };
  881. #define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn) \
  882. static const struct acpi_probe_entry __acpi_probe_##name \
  883. __used __section(__##table##_acpi_probe_table) \
  884. = { \
  885. .id = table_id, \
  886. .type = subtable, \
  887. .subtable_valid = valid, \
  888. .probe_table = (acpi_tbl_table_handler)fn, \
  889. .driver_data = data, \
  890. }
  891. #define ACPI_PROBE_TABLE(name) __##name##_acpi_probe_table
  892. #define ACPI_PROBE_TABLE_END(name) __##name##_acpi_probe_table_end
  893. int __acpi_probe_device_table(struct acpi_probe_entry *start, int nr);
  894. #define acpi_probe_device_table(t) \
  895. ({ \
  896. extern struct acpi_probe_entry ACPI_PROBE_TABLE(t), \
  897. ACPI_PROBE_TABLE_END(t); \
  898. __acpi_probe_device_table(&ACPI_PROBE_TABLE(t), \
  899. (&ACPI_PROBE_TABLE_END(t) - \
  900. &ACPI_PROBE_TABLE(t))); \
  901. })
  902. #else
  903. static inline int acpi_dev_get_property(struct acpi_device *adev,
  904. const char *name, acpi_object_type type,
  905. const union acpi_object **obj)
  906. {
  907. return -ENXIO;
  908. }
  909. static inline int
  910. __acpi_node_get_property_reference(struct fwnode_handle *fwnode,
  911. const char *name, size_t index, size_t num_args,
  912. struct acpi_reference_args *args)
  913. {
  914. return -ENXIO;
  915. }
  916. static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode,
  917. const char *name, size_t index,
  918. struct acpi_reference_args *args)
  919. {
  920. return -ENXIO;
  921. }
  922. static inline int acpi_node_prop_get(struct fwnode_handle *fwnode,
  923. const char *propname,
  924. void **valptr)
  925. {
  926. return -ENXIO;
  927. }
  928. static inline int acpi_dev_prop_get(struct acpi_device *adev,
  929. const char *propname,
  930. void **valptr)
  931. {
  932. return -ENXIO;
  933. }
  934. static inline int acpi_dev_prop_read_single(struct acpi_device *adev,
  935. const char *propname,
  936. enum dev_prop_type proptype,
  937. void *val)
  938. {
  939. return -ENXIO;
  940. }
  941. static inline int acpi_node_prop_read(struct fwnode_handle *fwnode,
  942. const char *propname,
  943. enum dev_prop_type proptype,
  944. void *val, size_t nval)
  945. {
  946. return -ENXIO;
  947. }
  948. static inline int acpi_dev_prop_read(struct acpi_device *adev,
  949. const char *propname,
  950. enum dev_prop_type proptype,
  951. void *val, size_t nval)
  952. {
  953. return -ENXIO;
  954. }
  955. static inline struct fwnode_handle *
  956. acpi_get_next_subnode(struct fwnode_handle *fwnode, struct fwnode_handle *child)
  957. {
  958. return NULL;
  959. }
  960. static inline struct fwnode_handle *
  961. acpi_node_get_parent(struct fwnode_handle *fwnode)
  962. {
  963. return NULL;
  964. }
  965. static inline struct fwnode_handle *
  966. acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode,
  967. struct fwnode_handle *prev)
  968. {
  969. return ERR_PTR(-ENXIO);
  970. }
  971. static inline int
  972. acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode,
  973. struct fwnode_handle **remote,
  974. struct fwnode_handle **port,
  975. struct fwnode_handle **endpoint)
  976. {
  977. return -ENXIO;
  978. }
  979. #define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn) \
  980. static const void * __acpi_table_##name[] \
  981. __attribute__((unused)) \
  982. = { (void *) table_id, \
  983. (void *) subtable, \
  984. (void *) valid, \
  985. (void *) fn, \
  986. (void *) data }
  987. #define acpi_probe_device_table(t) ({ int __r = 0; __r;})
  988. #endif
  989. #ifdef CONFIG_ACPI_TABLE_UPGRADE
  990. void acpi_table_upgrade(void);
  991. #else
  992. static inline void acpi_table_upgrade(void) { }
  993. #endif
  994. #if defined(CONFIG_ACPI) && defined(CONFIG_ACPI_WATCHDOG)
  995. extern bool acpi_has_watchdog(void);
  996. #else
  997. static inline bool acpi_has_watchdog(void) { return false; }
  998. #endif
  999. #ifdef CONFIG_ACPI_SPCR_TABLE
  1000. int parse_spcr(bool earlycon);
  1001. #else
  1002. static inline int parse_spcr(bool earlycon) { return 0; }
  1003. #endif
  1004. #if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)
  1005. int acpi_irq_get(acpi_handle handle, unsigned int index, struct resource *res);
  1006. #else
  1007. static inline
  1008. int acpi_irq_get(acpi_handle handle, unsigned int index, struct resource *res)
  1009. {
  1010. return -EINVAL;
  1011. }
  1012. #endif
  1013. #endif /*_LINUX_ACPI_H*/