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-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef _ASM_POWERPC_PROBES_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define _ASM_POWERPC_PROBES_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #ifdef __KERNEL__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Definitions common to probes files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * Copyright IBM Corporation, 2012
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) typedef u32 ppc_opcode_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define BREAKPOINT_INSTRUCTION	0x7fe00008	/* trap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) /* Trap definitions per ISA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define IS_TW(instr)		(((instr) & 0xfc0007fe) == 0x7c000008)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define IS_TD(instr)		(((instr) & 0xfc0007fe) == 0x7c000088)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define IS_TDI(instr)		(((instr) & 0xfc000000) == 0x08000000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define IS_TWI(instr)		(((instr) & 0xfc000000) == 0x0c000000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #ifdef CONFIG_PPC64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define is_trap(instr)		(IS_TW(instr) || IS_TD(instr) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 				IS_TWI(instr) || IS_TDI(instr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define is_trap(instr)		(IS_TW(instr) || IS_TWI(instr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #endif /* CONFIG_PPC64 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #ifdef CONFIG_PPC_ADV_DEBUG_REGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define MSR_SINGLESTEP	(MSR_DE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define MSR_SINGLESTEP	(MSR_SE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* Enable single stepping for the current task */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) static inline void enable_single_step(struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	regs->msr |= MSR_SINGLESTEP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #ifdef CONFIG_PPC_ADV_DEBUG_REGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	 * We turn off Critical Input Exception(CE) to ensure that the single
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	 * step will be for the instruction we have the probe on; if we don't,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	 * it is possible we'd get the single step reported for CE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	regs->msr &= ~MSR_CE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #ifdef CONFIG_PPC_47x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	isync();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #endif /* __KERNEL__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #endif	/* _ASM_POWERPC_PROBES_H */