acpi.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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_parse_mcfg (struct acpi_table_header *header);
  73. void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
  74. /* the following four functions are architecture-dependent */
  75. #ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
  76. #define NR_NODE_MEMBLKS MAX_NUMNODES
  77. #define acpi_numa_slit_init(slit) do {} while (0)
  78. #define acpi_numa_processor_affinity_init(pa) do {} while (0)
  79. #define acpi_numa_memory_affinity_init(ma) do {} while (0)
  80. #define acpi_numa_arch_fixup() do {} while (0)
  81. #else
  82. void acpi_numa_slit_init (struct acpi_table_slit *slit);
  83. void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
  84. void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
  85. void acpi_numa_arch_fixup(void);
  86. #endif
  87. #ifdef CONFIG_ACPI_HOTPLUG_CPU
  88. /* Arch dependent functions for cpu hotplug support */
  89. int acpi_map_lsapic(acpi_handle handle, int *pcpu);
  90. int acpi_unmap_lsapic(int cpu);
  91. #endif /* CONFIG_ACPI_HOTPLUG_CPU */
  92. int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
  93. int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
  94. extern int acpi_mp_config;
  95. extern struct acpi_mcfg_allocation *pci_mmcfg_config;
  96. extern int pci_mmcfg_config_num;
  97. extern int sbf_port;
  98. extern unsigned long acpi_realmode_flags;
  99. #else /* !CONFIG_ACPI */
  100. #define acpi_mp_config 0
  101. #endif /* !CONFIG_ACPI */
  102. int acpi_register_gsi (u32 gsi, int triggering, int polarity);
  103. int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
  104. /*
  105. * This function undoes the effect of one call to acpi_register_gsi().
  106. * If this matches the last registration, any IRQ resources for gsi
  107. * are freed.
  108. */
  109. void acpi_unregister_gsi (u32 gsi);
  110. #ifdef CONFIG_ACPI
  111. struct acpi_prt_entry {
  112. struct list_head node;
  113. struct acpi_pci_id id;
  114. u8 pin;
  115. struct {
  116. acpi_handle handle;
  117. u32 index;
  118. } link;
  119. u32 irq;
  120. };
  121. struct acpi_prt_list {
  122. int count;
  123. struct list_head entries;
  124. };
  125. struct pci_dev;
  126. int acpi_pci_irq_enable (struct pci_dev *dev);
  127. void acpi_penalize_isa_irq(int irq, int active);
  128. void acpi_pci_irq_disable (struct pci_dev *dev);
  129. struct acpi_pci_driver {
  130. struct acpi_pci_driver *next;
  131. int (*add)(acpi_handle handle);
  132. void (*remove)(acpi_handle handle);
  133. };
  134. int acpi_pci_register_driver(struct acpi_pci_driver *driver);
  135. void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
  136. #endif /* CONFIG_ACPI */
  137. #ifdef CONFIG_ACPI_EC
  138. extern int ec_read(u8 addr, u8 *val);
  139. extern int ec_write(u8 addr, u8 val);
  140. extern int ec_transaction(u8 command,
  141. const u8 *wdata, unsigned wdata_len,
  142. u8 *rdata, unsigned rdata_len,
  143. int force_poll);
  144. #endif /*CONFIG_ACPI_EC*/
  145. extern int acpi_blacklisted(void);
  146. extern void acpi_bios_year(char *s);
  147. #define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */
  148. #ifdef CONFIG_ACPI
  149. /*
  150. * Set highest legal C-state
  151. * 0: C0 okay, but not C1
  152. * 1: C1 okay, but not C2
  153. * 2: C2 okay, but not C3 etc.
  154. */
  155. extern unsigned int max_cstate;
  156. static inline unsigned int acpi_get_cstate_limit(void)
  157. {
  158. return max_cstate;
  159. }
  160. static inline void acpi_set_cstate_limit(unsigned int new_limit)
  161. {
  162. max_cstate = new_limit;
  163. return;
  164. }
  165. #else
  166. static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
  167. static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
  168. #endif
  169. #ifdef CONFIG_ACPI_NUMA
  170. int acpi_get_pxm(acpi_handle handle);
  171. int acpi_get_node(acpi_handle *handle);
  172. #else
  173. static inline int acpi_get_pxm(acpi_handle handle)
  174. {
  175. return 0;
  176. }
  177. static inline int acpi_get_node(acpi_handle *handle)
  178. {
  179. return 0;
  180. }
  181. #endif
  182. extern int acpi_paddr_to_node(u64 start_addr, u64 size);
  183. extern int pnpacpi_disabled;
  184. #else /* CONFIG_ACPI */
  185. static inline int acpi_boot_init(void)
  186. {
  187. return 0;
  188. }
  189. static inline int acpi_boot_table_init(void)
  190. {
  191. return 0;
  192. }
  193. #endif /* CONFIG_ACPI */
  194. #endif /*_LINUX_ACPI_H*/