acpi.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) 1999 VA Linux Systems
  4. * Copyright (C) 1999 Walt Drummond <[email protected]>
  5. * Copyright (C) 2000,2001 J.I. Lee <[email protected]>
  6. * Copyright (C) 2001,2002 Paul Diefenbaugh <[email protected]>
  7. */
  8. #ifndef _ASM_ACPI_H
  9. #define _ASM_ACPI_H
  10. #ifdef __KERNEL__
  11. #include <acpi/pdc_intel.h>
  12. #include <linux/init.h>
  13. #include <linux/numa.h>
  14. #include <asm/numa.h>
  15. extern int acpi_lapic;
  16. #define acpi_disabled 0 /* ACPI always enabled on IA64 */
  17. #define acpi_noirq 0 /* ACPI always enabled on IA64 */
  18. #define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */
  19. #define acpi_strict 1 /* no ACPI spec workarounds on IA64 */
  20. static inline bool acpi_has_cpu_in_madt(void)
  21. {
  22. return !!acpi_lapic;
  23. }
  24. #define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */
  25. static inline void disable_acpi(void) { }
  26. int acpi_request_vector (u32 int_type);
  27. int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
  28. /* Low-level suspend routine. */
  29. extern int acpi_suspend_lowlevel(void);
  30. static inline unsigned long acpi_get_wakeup_address(void)
  31. {
  32. return 0;
  33. }
  34. /*
  35. * Record the cpei override flag and current logical cpu. This is
  36. * useful for CPU removal.
  37. */
  38. extern unsigned int can_cpei_retarget(void);
  39. extern unsigned int is_cpu_cpei_target(unsigned int cpu);
  40. extern void set_cpei_target_cpu(unsigned int cpu);
  41. extern unsigned int get_cpei_target_cpu(void);
  42. extern void prefill_possible_map(void);
  43. #ifdef CONFIG_ACPI_HOTPLUG_CPU
  44. extern int additional_cpus;
  45. #else
  46. #define additional_cpus 0
  47. #endif
  48. #ifdef CONFIG_ACPI_NUMA
  49. #if MAX_NUMNODES > 256
  50. #define MAX_PXM_DOMAINS MAX_NUMNODES
  51. #else
  52. #define MAX_PXM_DOMAINS (256)
  53. #endif
  54. extern int pxm_to_nid_map[MAX_PXM_DOMAINS];
  55. extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
  56. #endif
  57. static inline bool arch_has_acpi_pdc(void) { return true; }
  58. static inline void arch_acpi_set_pdc_bits(u32 *buf)
  59. {
  60. buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
  61. }
  62. #ifdef CONFIG_ACPI_NUMA
  63. extern cpumask_t early_cpu_possible_map;
  64. #define for_each_possible_early_cpu(cpu) \
  65. for_each_cpu((cpu), &early_cpu_possible_map)
  66. static inline void per_cpu_scan_finalize(int min_cpus, int reserve_cpus)
  67. {
  68. int low_cpu, high_cpu;
  69. int cpu;
  70. int next_nid = 0;
  71. low_cpu = cpumask_weight(&early_cpu_possible_map);
  72. high_cpu = max(low_cpu, min_cpus);
  73. high_cpu = min(high_cpu + reserve_cpus, NR_CPUS);
  74. for (cpu = low_cpu; cpu < high_cpu; cpu++) {
  75. cpumask_set_cpu(cpu, &early_cpu_possible_map);
  76. if (node_cpuid[cpu].nid == NUMA_NO_NODE) {
  77. node_cpuid[cpu].nid = next_nid;
  78. next_nid++;
  79. if (next_nid >= num_online_nodes())
  80. next_nid = 0;
  81. }
  82. }
  83. }
  84. extern void acpi_numa_fixup(void);
  85. #endif /* CONFIG_ACPI_NUMA */
  86. #endif /*__KERNEL__*/
  87. #endif /*_ASM_ACPI_H*/