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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (C) 2004 Microtronix Datacom Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * License. See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #ifndef _ASM_NIOS2_ENTRY_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define _ASM_NIOS2_ENTRY_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #ifdef __ASSEMBLY__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <asm/processor.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <asm/registers.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <asm/asm-offsets.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * Standard Nios2 interrupt entry and exit macros.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * Must be called with interrupts disabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) .macro SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	rdctl	r24, estatus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	andi	r24, r24, ESTATUS_EU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	beq	r24, r0, 1f /* In supervisor mode, already on kernel stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	movia	r24, _current_thread	/* Switch to current kernel stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	ldw	r24, 0(r24)		/* using the thread_info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	addi	r24, r24, THREAD_SIZE-PT_REGS_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	stw	sp, PT_SP(r24)		/* Save user stack before changing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	mov	sp, r24
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	br	2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 1 :	mov	r24, sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	addi	sp, sp, -PT_REGS_SIZE	/* Backup the kernel stack pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	stw	r24, PT_SP(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 2 :	stw	r1, PT_R1(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	stw	r2, PT_R2(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	stw	r3, PT_R3(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	stw	r4, PT_R4(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	stw	r5, PT_R5(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	stw	r6, PT_R6(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	stw	r7, PT_R7(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	stw	r8, PT_R8(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	stw	r9, PT_R9(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	stw	r10, PT_R10(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	stw	r11, PT_R11(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	stw	r12, PT_R12(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	stw	r13, PT_R13(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	stw	r14, PT_R14(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	stw	r15, PT_R15(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	stw	r2, PT_ORIG_R2(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	stw	r7, PT_ORIG_R7(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	stw	ra, PT_RA(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	stw	fp, PT_FP(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	stw	gp, PT_GP(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	rdctl	r24, estatus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	stw	r24, PT_ESTATUS(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	stw	ea, PT_EA(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) .macro RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	ldw	r1, PT_R1(sp)		/* Restore registers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	ldw	r2, PT_R2(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	ldw	r3, PT_R3(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	ldw	r4, PT_R4(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	ldw	r5, PT_R5(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	ldw	r6, PT_R6(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	ldw	r7, PT_R7(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	ldw	r8, PT_R8(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	ldw	r9, PT_R9(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	ldw	r10, PT_R10(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	ldw	r11, PT_R11(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	ldw	r12, PT_R12(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	ldw	r13, PT_R13(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	ldw	r14, PT_R14(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	ldw	r15, PT_R15(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	ldw	ra, PT_RA(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	ldw	fp, PT_FP(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	ldw	gp, PT_GP(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	ldw	r24, PT_ESTATUS(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	wrctl	estatus, r24
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	ldw	ea, PT_EA(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	ldw	sp, PT_SP(sp)		/* Restore sp last */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) .macro	SAVE_SWITCH_STACK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	addi	sp, sp, -SWITCH_STACK_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	stw	r16, SW_R16(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	stw	r17, SW_R17(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	stw	r18, SW_R18(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	stw	r19, SW_R19(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	stw	r20, SW_R20(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	stw	r21, SW_R21(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	stw	r22, SW_R22(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	stw	r23, SW_R23(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	stw	fp, SW_FP(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	stw	gp, SW_GP(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	stw	ra, SW_RA(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) .macro	RESTORE_SWITCH_STACK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	ldw	r16, SW_R16(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	ldw	r17, SW_R17(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	ldw	r18, SW_R18(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	ldw	r19, SW_R19(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	ldw	r20, SW_R20(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	ldw	r21, SW_R21(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	ldw	r22, SW_R22(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	ldw	r23, SW_R23(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	ldw	fp, SW_FP(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	ldw	gp, SW_GP(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	ldw	ra, SW_RA(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	addi	sp, sp, SWITCH_STACK_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #endif /* __ASSEMBLY__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #endif /* _ASM_NIOS2_ENTRY_H */