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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * relocate_kernel.S - put the kernel image in place to boot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/linkage.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <asm/assembler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <asm/asm-offsets.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <asm/kexec.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	.align	3	/* not needed for this code, but keeps fncpy() happy */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) ENTRY(relocate_new_kernel)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	adr	r7, relocate_new_kernel_end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	ldr	r0, [r7, #KEXEC_INDIR_PAGE]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	ldr	r1, [r7, #KEXEC_START_ADDR]
^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) 	 * If there is no indirection page (we are doing crashdumps)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	 * skip any relocation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	cmp	r0, #0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	beq	2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 0:	/* top, read another word for the indirection page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	ldr	r3, [r0],#4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	/* Is it a destination page. Put destination address to r4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	tst	r3,#1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	beq	1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	bic	r4,r3,#1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	b	0b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	/* Is it an indirection page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	tst	r3,#2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	beq	1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	bic	r0,r3,#2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	b	0b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	/* are we done ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	tst	r3,#4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	beq	1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	b	2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	/* is it source ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	tst	r3,#8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	beq	0b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	bic r3,r3,#8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	mov r6,#1024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 9:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	ldr r5,[r3],#4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	str r5,[r4],#4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	subs r6,r6,#1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	bne 9b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	b 0b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	/* Jump to relocated kernel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	mov	lr, r1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	mov	r0, #0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	ldr	r1, [r7, #KEXEC_MACH_TYPE]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	ldr	r2, [r7, #KEXEC_R2]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)  ARM(	ret	lr	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)  THUMB(	bx	lr	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) ENDPROC(relocate_new_kernel)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	.align	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) relocate_new_kernel_end:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	.globl relocate_new_kernel_size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) relocate_new_kernel_size:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 	.long relocate_new_kernel_end - relocate_new_kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)