acpi.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  23. */
  24. #ifndef _LINUX_ACPI_H
  25. #define _LINUX_ACPI_H
  26. #ifdef CONFIG_ACPI
  27. #ifndef _LINUX
  28. #define _LINUX
  29. #endif
  30. #include <linux/list.h>
  31. #include <acpi/acpi.h>
  32. #include <acpi/acpi_bus.h>
  33. #include <acpi/acpi_drivers.h>
  34. #include <acpi/acpi_numa.h>
  35. #include <asm/acpi.h>
  36. #ifdef CONFIG_ACPI
  37. enum acpi_irq_model_id {
  38. ACPI_IRQ_MODEL_PIC = 0,
  39. ACPI_IRQ_MODEL_IOAPIC,
  40. ACPI_IRQ_MODEL_IOSAPIC,
  41. ACPI_IRQ_MODEL_PLATFORM,
  42. ACPI_IRQ_MODEL_COUNT
  43. };
  44. extern enum acpi_irq_model_id acpi_irq_model;
  45. enum acpi_interrupt_id {
  46. ACPI_INTERRUPT_PMI = 1,
  47. ACPI_INTERRUPT_INIT,
  48. ACPI_INTERRUPT_CPEI,
  49. ACPI_INTERRUPT_COUNT
  50. };
  51. #define ACPI_SPACE_MEM 0
  52. enum acpi_address_range_id {
  53. ACPI_ADDRESS_RANGE_MEMORY = 1,
  54. ACPI_ADDRESS_RANGE_RESERVED = 2,
  55. ACPI_ADDRESS_RANGE_ACPI = 3,
  56. ACPI_ADDRESS_RANGE_NVS = 4,
  57. ACPI_ADDRESS_RANGE_COUNT
  58. };
  59. /* Table Handlers */
  60. typedef int (*acpi_table_handler) (struct acpi_table_header *table);
  61. typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
  62. char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
  63. unsigned long acpi_find_rsdp (void);
  64. int acpi_boot_init (void);
  65. int acpi_boot_table_init (void);
  66. int acpi_numa_init (void);
  67. int acpi_table_init (void);
  68. int acpi_table_parse (char *id, acpi_table_handler handler);
  69. int __init acpi_table_parse_entries(char *id, unsigned long table_size,
  70. int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
  71. int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
  72. int acpi_table_parse_srat (enum acpi_srat_type id, acpi_table_entry_handler handler, unsigned int max_entries);
  73. int acpi_parse_mcfg (struct acpi_table_header *header);
  74. void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
  75. void acpi_table_print_srat_entry (struct acpi_subtable_header *srat);
  76. /* the following four functions are architecture-dependent */
  77. #ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
  78. #define NR_NODE_MEMBLKS MAX_NUMNODES
  79. #define acpi_numa_slit_init(slit) do {} while (0)
  80. #define acpi_numa_processor_affinity_init(pa) do {} while (0)
  81. #define acpi_numa_memory_affinity_init(ma) do {} while (0)
  82. #define acpi_numa_arch_fixup() do {} while (0)
  83. #else
  84. void acpi_numa_slit_init (struct acpi_table_slit *slit);
  85. void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
  86. void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
  87. void acpi_numa_arch_fixup(void);
  88. #endif
  89. #ifdef CONFIG_ACPI_HOTPLUG_CPU
  90. /* Arch dependent functions for cpu hotplug support */
  91. int acpi_map_lsapic(acpi_handle handle, int *pcpu);
  92. int acpi_unmap_lsapic(int cpu);
  93. #endif /* CONFIG_ACPI_HOTPLUG_CPU */
  94. int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
  95. int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
  96. extern int acpi_mp_config;
  97. extern struct acpi_mcfg_allocation *pci_mmcfg_config;
  98. extern int pci_mmcfg_config_num;
  99. extern int sbf_port;
  100. extern unsigned long acpi_video_flags;
  101. #else /* !CONFIG_ACPI */
  102. #define acpi_mp_config 0
  103. #endif /* !CONFIG_ACPI */
  104. int acpi_register_gsi (u32 gsi, int triggering, int polarity);
  105. int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
  106. /*
  107. * This function undoes the effect of one call to acpi_register_gsi().
  108. * If this matches the last registration, any IRQ resources for gsi
  109. * are freed.
  110. */
  111. void acpi_unregister_gsi (u32 gsi);
  112. #ifdef CONFIG_ACPI
  113. struct acpi_prt_entry {
  114. struct list_head node;
  115. struct acpi_pci_id id;
  116. u8 pin;
  117. struct {
  118. acpi_handle handle;
  119. u32 index;
  120. } link;
  121. u32 irq;
  122. };
  123. struct acpi_prt_list {
  124. int count;
  125. struct list_head entries;
  126. };
  127. struct pci_dev;
  128. int acpi_pci_irq_enable (struct pci_dev *dev);
  129. void acpi_penalize_isa_irq(int irq, int active);
  130. void acpi_pci_irq_disable (struct pci_dev *dev);
  131. struct acpi_pci_driver {
  132. struct acpi_pci_driver *next;
  133. int (*add)(acpi_handle handle);
  134. void (*remove)(acpi_handle handle);
  135. };
  136. int acpi_pci_register_driver(struct acpi_pci_driver *driver);
  137. void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
  138. #endif /* CONFIG_ACPI */
  139. #ifdef CONFIG_ACPI_EC
  140. extern int ec_read(u8 addr, u8 *val);
  141. extern int ec_write(u8 addr, u8 val);
  142. extern int ec_transaction(u8 command,
  143. const u8 *wdata, unsigned wdata_len,
  144. u8 *rdata, unsigned rdata_len);
  145. #endif /*CONFIG_ACPI_EC*/
  146. extern int acpi_blacklisted(void);
  147. extern void acpi_bios_year(char *s);
  148. #define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */
  149. #ifdef CONFIG_ACPI
  150. /*
  151. * Set highest legal C-state
  152. * 0: C0 okay, but not C1
  153. * 1: C1 okay, but not C2
  154. * 2: C2 okay, but not C3 etc.
  155. */
  156. extern unsigned int max_cstate;
  157. static inline unsigned int acpi_get_cstate_limit(void)
  158. {
  159. return max_cstate;
  160. }
  161. static inline void acpi_set_cstate_limit(unsigned int new_limit)
  162. {
  163. max_cstate = new_limit;
  164. return;
  165. }
  166. #else
  167. static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
  168. static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
  169. #endif
  170. #ifdef CONFIG_ACPI_NUMA
  171. int acpi_get_pxm(acpi_handle handle);
  172. int acpi_get_node(acpi_handle *handle);
  173. #else
  174. static inline int acpi_get_pxm(acpi_handle handle)
  175. {
  176. return 0;
  177. }
  178. static inline int acpi_get_node(acpi_handle *handle)
  179. {
  180. return 0;
  181. }
  182. #endif
  183. extern int acpi_paddr_to_node(u64 start_addr, u64 size);
  184. extern int pnpacpi_disabled;
  185. #else /* CONFIG_ACPI */
  186. static inline int acpi_boot_init(void)
  187. {
  188. return 0;
  189. }
  190. static inline int acpi_boot_table_init(void)
  191. {
  192. return 0;
  193. }
  194. #endif /* CONFIG_ACPI */
  195. #endif /*_LINUX_ACPI_H*/