18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2020 Loongson Technology Corporation Limited
48c2ecf20Sopenharmony_ci * Author: Jianmin Lv <lvjianmin@loongson.cn>
58c2ecf20Sopenharmony_ci *         Huacai Chen <chenhuacai@loongson.cn>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
88c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License version 2 as
98c2ecf20Sopenharmony_ci * published by the Free Software Foundation.
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifndef _ASM_LOONGARCH_ACPI_H
138c2ecf20Sopenharmony_ci#define _ASM_LOONGARCH_ACPI_H
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#ifdef CONFIG_ACPI
168c2ecf20Sopenharmony_ciextern int acpi_strict;
178c2ecf20Sopenharmony_ciextern int acpi_disabled;
188c2ecf20Sopenharmony_ciextern int acpi_pci_disabled;
198c2ecf20Sopenharmony_ciextern int acpi_noirq;
208c2ecf20Sopenharmony_ciextern int pptt_enabled;
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define acpi_os_ioremap acpi_os_ioremap
238c2ecf20Sopenharmony_civoid __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistatic inline void disable_acpi(void)
268c2ecf20Sopenharmony_ci{
278c2ecf20Sopenharmony_ci	acpi_disabled = 1;
288c2ecf20Sopenharmony_ci	acpi_pci_disabled = 1;
298c2ecf20Sopenharmony_ci	acpi_noirq = 1;
308c2ecf20Sopenharmony_ci}
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_cistatic inline bool acpi_has_cpu_in_madt(void)
338c2ecf20Sopenharmony_ci{
348c2ecf20Sopenharmony_ci	return true;
358c2ecf20Sopenharmony_ci}
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define MAX_CORE_PIC 256
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciextern struct list_head acpi_wakeup_device_list;
408c2ecf20Sopenharmony_ciextern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC];
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciextern int __init parse_acpi_topology(void);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistatic inline u32 get_acpi_id_for_cpu(unsigned int cpu)
458c2ecf20Sopenharmony_ci{
468c2ecf20Sopenharmony_ci	return acpi_core_pic[cpu_logical_map(cpu)].processor_id;
478c2ecf20Sopenharmony_ci}
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#endif /* !CONFIG_ACPI */
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciextern int loongarch_acpi_suspend(void);
548c2ecf20Sopenharmony_ciextern int (*acpi_suspend_lowlevel)(void);
558c2ecf20Sopenharmony_ciextern void loongarch_suspend_enter(void);
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cistatic inline unsigned long acpi_get_wakeup_address(void)
588c2ecf20Sopenharmony_ci{
598c2ecf20Sopenharmony_ci#ifdef CONFIG_SUSPEND
608c2ecf20Sopenharmony_ci	extern void loongarch_wakeup_start(void);
618c2ecf20Sopenharmony_ci	return (unsigned long)loongarch_wakeup_start;
628c2ecf20Sopenharmony_ci#endif
638c2ecf20Sopenharmony_ci	return 0UL;
648c2ecf20Sopenharmony_ci}
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#endif /* _ASM_LOONGARCH_ACPI_H */
67