acpi.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2013-2014, Linaro Ltd.
  4. * Author: Al Stone <al.stone@linaro.org>
  5. * Author: Graeme Gregory <graeme.gregory@linaro.org>
  6. * Author: Hanjun Guo <hanjun.guo@linaro.org>
  7. *
  8. * Copyright (C) 2021-2023, Ventana Micro Systems Inc.
  9. * Author: Sunil V L <sunilvl@ventanamicro.com>
  10. */
  11. #ifndef _ASM_ACPI_H
  12. #define _ASM_ACPI_H
  13. /* Basic configuration for ACPI */
  14. #ifdef CONFIG_ACPI
  15. typedef u64 phys_cpuid_t;
  16. #define PHYS_CPUID_INVALID INVALID_HARTID
  17. /* ACPI table mapping after acpi_permanent_mmap is set */
  18. void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
  19. #define acpi_os_ioremap acpi_os_ioremap
  20. #define acpi_strict 1 /* No out-of-spec workarounds on RISC-V */
  21. extern int acpi_disabled;
  22. extern int acpi_noirq;
  23. extern int acpi_pci_disabled;
  24. static inline void disable_acpi(void)
  25. {
  26. acpi_disabled = 1;
  27. acpi_pci_disabled = 1;
  28. acpi_noirq = 1;
  29. }
  30. static inline void enable_acpi(void)
  31. {
  32. acpi_disabled = 0;
  33. acpi_pci_disabled = 0;
  34. acpi_noirq = 0;
  35. }
  36. /*
  37. * The ACPI processor driver for ACPI core code needs this macro
  38. * to find out whether this cpu was already mapped (mapping from CPU hardware
  39. * ID to CPU logical ID) or not.
  40. */
  41. #define cpu_physical_id(cpu) cpuid_to_hartid_map(cpu)
  42. /*
  43. * Since MADT must provide at least one RINTC structure, the
  44. * CPU will be always available in MADT on RISC-V.
  45. */
  46. static inline bool acpi_has_cpu_in_madt(void)
  47. {
  48. return true;
  49. }
  50. static inline void arch_fix_phys_package_id(int num, u32 slot) { }
  51. void acpi_init_rintc_map(void);
  52. struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu);
  53. static inline u32 get_acpi_id_for_cpu(int cpu)
  54. {
  55. return acpi_cpu_get_madt_rintc(cpu)->uid;
  56. }
  57. int acpi_get_riscv_isa(struct acpi_table_header *table,
  58. unsigned int cpu, const char **isa);
  59. void acpi_get_cbo_block_size(struct acpi_table_header *table, u32 *cbom_size,
  60. u32 *cboz_size, u32 *cbop_size);
  61. #else
  62. static inline void acpi_init_rintc_map(void) { }
  63. static inline struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu)
  64. {
  65. return NULL;
  66. }
  67. static inline int acpi_get_riscv_isa(struct acpi_table_header *table,
  68. unsigned int cpu, const char **isa)
  69. {
  70. return -EINVAL;
  71. }
  72. static inline void acpi_get_cbo_block_size(struct acpi_table_header *table,
  73. u32 *cbom_size, u32 *cboz_size,
  74. u32 *cbop_size) { }
  75. #endif /* CONFIG_ACPI */
  76. #ifdef CONFIG_ACPI_NUMA
  77. void acpi_map_cpus_to_nodes(void);
  78. #else
  79. static inline void acpi_map_cpus_to_nodes(void) { }
  80. #endif /* CONFIG_ACPI_NUMA */
  81. #endif /*_ASM_ACPI_H*/