Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) // Copyright (C) 2017 Arm Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #ifndef __ASM_SDEI_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #define __ASM_SDEI_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) /* Values for sdei_exit_mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #define SDEI_EXIT_HVC  0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #define SDEI_EXIT_SMC  1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define SDEI_STACK_SIZE		IRQ_STACK_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #ifndef __ASSEMBLY__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/linkage.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/preempt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <asm/virt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) extern unsigned long sdei_exit_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /* Software Delegated Exception entry point from firmware*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) asmlinkage void __sdei_asm_handler(unsigned long event_num, unsigned long arg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 				   unsigned long pc, unsigned long pstate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* and its CONFIG_UNMAP_KERNEL_AT_EL0 trampoline */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) asmlinkage void __sdei_asm_entry_trampoline(unsigned long event_num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 						   unsigned long arg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 						   unsigned long pc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 						   unsigned long pstate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)  * The above entry point does the minimum to call C code. This function does
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)  * anything else, before calling the driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct sdei_registered_event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) asmlinkage unsigned long __sdei_handler(struct pt_regs *regs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 					struct sdei_registered_event *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) unsigned long sdei_arch_get_entry_point(int conduit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define sdei_arch_get_entry_point(x)	sdei_arch_get_entry_point(x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct stack_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) bool _on_sdei_stack(unsigned long sp, struct stack_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) static inline bool on_sdei_stack(unsigned long sp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 				struct stack_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	if (!IS_ENABLED(CONFIG_VMAP_STACK))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 		return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	if (!IS_ENABLED(CONFIG_ARM_SDE_INTERFACE))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 		return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	if (in_nmi())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 		return _on_sdei_stack(sp, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #endif /* __ASSEMBLY__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #endif	/* __ASM_SDEI_H */