acpi.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Copyright (C) 2013-2014, Linaro Ltd.
  3. * Author: Al Stone <al.stone@linaro.org>
  4. * Author: Graeme Gregory <graeme.gregory@linaro.org>
  5. * Author: Hanjun Guo <hanjun.guo@linaro.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation;
  10. */
  11. #ifndef _ASM_ACPI_H
  12. #define _ASM_ACPI_H
  13. #include <linux/mm.h>
  14. #include <linux/psci.h>
  15. #include <asm/cputype.h>
  16. #include <asm/smp_plat.h>
  17. /* Macros for consistency checks of the GICC subtable of MADT */
  18. #define ACPI_MADT_GICC_LENGTH \
  19. (acpi_gbl_FADT.header.revision < 6 ? 76 : 80)
  20. #define BAD_MADT_GICC_ENTRY(entry, end) \
  21. (!(entry) || (entry)->header.length != ACPI_MADT_GICC_LENGTH || \
  22. (unsigned long)(entry) + ACPI_MADT_GICC_LENGTH > (end))
  23. /* Basic configuration for ACPI */
  24. #ifdef CONFIG_ACPI
  25. /* ACPI table mapping after acpi_gbl_permanent_mmap is set */
  26. static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
  27. acpi_size size)
  28. {
  29. if (!page_is_ram(phys >> PAGE_SHIFT))
  30. return ioremap(phys, size);
  31. return ioremap_cache(phys, size);
  32. }
  33. #define acpi_os_ioremap acpi_os_ioremap
  34. typedef u64 phys_cpuid_t;
  35. #define PHYS_CPUID_INVALID INVALID_HWID
  36. #define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */
  37. extern int acpi_disabled;
  38. extern int acpi_noirq;
  39. extern int acpi_pci_disabled;
  40. static inline void disable_acpi(void)
  41. {
  42. acpi_disabled = 1;
  43. acpi_pci_disabled = 1;
  44. acpi_noirq = 1;
  45. }
  46. static inline void enable_acpi(void)
  47. {
  48. acpi_disabled = 0;
  49. acpi_pci_disabled = 0;
  50. acpi_noirq = 0;
  51. }
  52. /*
  53. * The ACPI processor driver for ACPI core code needs this macro
  54. * to find out this cpu was already mapped (mapping from CPU hardware
  55. * ID to CPU logical ID) or not.
  56. */
  57. #define cpu_physical_id(cpu) cpu_logical_map(cpu)
  58. /*
  59. * It's used from ACPI core in kdump to boot UP system with SMP kernel,
  60. * with this check the ACPI core will not override the CPU index
  61. * obtained from GICC with 0 and not print some error message as well.
  62. * Since MADT must provide at least one GICC structure for GIC
  63. * initialization, CPU will be always available in MADT on ARM64.
  64. */
  65. static inline bool acpi_has_cpu_in_madt(void)
  66. {
  67. return true;
  68. }
  69. static inline void arch_fix_phys_package_id(int num, u32 slot) { }
  70. void __init acpi_init_cpus(void);
  71. #else
  72. static inline void acpi_init_cpus(void) { }
  73. #endif /* CONFIG_ACPI */
  74. static inline const char *acpi_get_enable_method(int cpu)
  75. {
  76. return acpi_psci_present() ? "psci" : NULL;
  77. }
  78. #ifdef CONFIG_ACPI_APEI
  79. pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr);
  80. #endif
  81. #endif /*_ASM_ACPI_H*/