acpi.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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/irqchip/arm-gic-acpi.h>
  14. #include <linux/mm.h>
  15. #include <linux/psci.h>
  16. #include <asm/cputype.h>
  17. #include <asm/smp_plat.h>
  18. /* Macros for consistency checks of the GICC subtable of MADT */
  19. #define ACPI_MADT_GICC_LENGTH \
  20. (acpi_gbl_FADT.header.revision < 6 ? 76 : 80)
  21. #define BAD_MADT_GICC_ENTRY(entry, end) \
  22. (!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) || \
  23. (entry)->header.length != ACPI_MADT_GICC_LENGTH)
  24. /* Basic configuration for ACPI */
  25. #ifdef CONFIG_ACPI
  26. /* ACPI table mapping after acpi_gbl_permanent_mmap is set */
  27. static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
  28. acpi_size size)
  29. {
  30. if (!page_is_ram(phys >> PAGE_SHIFT))
  31. return ioremap(phys, size);
  32. return ioremap_cache(phys, size);
  33. }
  34. #define acpi_os_ioremap acpi_os_ioremap
  35. typedef u64 phys_cpuid_t;
  36. #define PHYS_CPUID_INVALID INVALID_HWID
  37. #define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */
  38. extern int acpi_disabled;
  39. extern int acpi_noirq;
  40. extern int acpi_pci_disabled;
  41. static inline void disable_acpi(void)
  42. {
  43. acpi_disabled = 1;
  44. acpi_pci_disabled = 1;
  45. acpi_noirq = 1;
  46. }
  47. static inline void enable_acpi(void)
  48. {
  49. acpi_disabled = 0;
  50. acpi_pci_disabled = 0;
  51. acpi_noirq = 0;
  52. }
  53. /*
  54. * The ACPI processor driver for ACPI core code needs this macro
  55. * to find out this cpu was already mapped (mapping from CPU hardware
  56. * ID to CPU logical ID) or not.
  57. */
  58. #define cpu_physical_id(cpu) cpu_logical_map(cpu)
  59. /*
  60. * It's used from ACPI core in kdump to boot UP system with SMP kernel,
  61. * with this check the ACPI core will not override the CPU index
  62. * obtained from GICC with 0 and not print some error message as well.
  63. * Since MADT must provide at least one GICC structure for GIC
  64. * initialization, CPU will be always available in MADT on ARM64.
  65. */
  66. static inline bool acpi_has_cpu_in_madt(void)
  67. {
  68. return true;
  69. }
  70. static inline void arch_fix_phys_package_id(int num, u32 slot) { }
  71. void __init acpi_init_cpus(void);
  72. #else
  73. static inline void acpi_init_cpus(void) { }
  74. #endif /* CONFIG_ACPI */
  75. static inline const char *acpi_get_enable_method(int cpu)
  76. {
  77. return acpi_psci_present() ? "psci" : NULL;
  78. }
  79. #endif /*_ASM_ACPI_H*/