1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Author: Jianmin Lv <lvjianmin@loongson.cn>
4  *         Huacai Chen <chenhuacai@loongson.cn>
5  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
6  */
7 
8 #ifndef _ASM_LOONGARCH_ACPI_H
9 #define _ASM_LOONGARCH_ACPI_H
10 
11 #include <asm/suspend.h>
12 
13 #ifdef CONFIG_ACPI
14 extern int acpi_strict;
15 extern int acpi_disabled;
16 extern int acpi_pci_disabled;
17 extern int acpi_noirq;
18 extern int pptt_enabled;
19 
20 #define acpi_os_ioremap acpi_os_ioremap
21 void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
22 
disable_acpi(void)23 static inline void disable_acpi(void)
24 {
25 	acpi_disabled = 1;
26 	acpi_pci_disabled = 1;
27 	acpi_noirq = 1;
28 }
29 
acpi_has_cpu_in_madt(void)30 static inline bool acpi_has_cpu_in_madt(void)
31 {
32 	return true;
33 }
34 
35 #define MAX_CORE_PIC 256
36 
37 extern struct list_head acpi_wakeup_device_list;
38 extern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC];
39 
40 extern int __init parse_acpi_topology(void);
41 
get_acpi_id_for_cpu(unsigned int cpu)42 static inline u32 get_acpi_id_for_cpu(unsigned int cpu)
43 {
44 	return acpi_core_pic[cpu_logical_map(cpu)].processor_id;
45 }
46 
47 #endif /* !CONFIG_ACPI */
48 
49 #define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT
50 
51 extern int loongarch_acpi_suspend(void);
52 extern int (*acpi_suspend_lowlevel)(void);
53 
acpi_get_wakeup_address(void)54 static inline unsigned long acpi_get_wakeup_address(void)
55 {
56 #ifdef CONFIG_SUSPEND
57 	return (unsigned long)loongarch_wakeup_start;
58 #endif
59 	return 0UL;
60 }
61 
62 #endif /* _ASM_LOONGARCH_ACPI_H */
63