	.file	"extr_mtk_vpu.c_vpu_alloc_ext_mem.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Data"
.LC1:
	.string	"Program"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC2:
	.string	"Failed to allocate the extended program memory\n"
	.align 8
.LC3:
	.string	"%s extend memory phy=0x%llx virt=0x%p\n"
	.text
	.p2align 4
	.type	vpu_alloc_ext_mem, @function
vpu_alloc_ext_mem:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	ebp, esi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdi
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	r14, QWORD PTR 16[rdi]
	test	esi, esi
	je	.L2
	mov	eax, DWORD PTR VPU_DMEM_EXT1_ADDR[rip]
	mov	rsi, QWORD PTR VPU_EXT_D_SIZE[rip]
	mov	r8d, DWORD PTR VPU_DMEM_EXT0_ADDR[rip]
	mov	DWORD PTR 12[rsp], eax
.L3:
	mov	rdx, QWORD PTR [rbx]
	movsx	r15, ebp
	xor	r13d, r13d
	mov	ecx, DWORD PTR GFP_KERNEL[rip]
	cmp	QWORD PTR 8[rbx], 0
	lea	r12, 0[0+r15*8]
	mov	rdi, r14
	mov	DWORD PTR 8[rsp], r8d
	setne	r13b
	add	rdx, r12
	mov	QWORD PTR [rsp], rdx
	sal	r13d, 30
	call	dma_alloc_coherent@PLT
	mov	rdx, QWORD PTR [rsp]
	mov	r8d, DWORD PTR 8[rsp]
	mov	DWORD PTR 4[rdx], eax
	mov	rax, QWORD PTR [rbx]
	mov	eax, DWORD PTR 4[rax+r12]
	test	eax, eax
	je	.L12
	mov	edx, r8d
	mov	rdi, rbx
	mov	esi, 1
	call	vpu_cfg_writel@PLT
	mov	rax, QWORD PTR [rbx]
	mov	edx, DWORD PTR 12[rsp]
	mov	rdi, rbx
	mov	esi, DWORD PTR [rax+r15*8]
	and	esi, -4096
	add	esi, r13d
	call	vpu_cfg_writel@PLT
	add	r12, QWORD PTR [rbx]
	test	ebp, ebp
	mov	rdi, r14
	lea	rax, .LC1[rip]
	lea	rdx, .LC0[rip]
	movsx	rcx, DWORD PTR [r12]
	mov	r8d, DWORD PTR 4[r12]
	cmove	rdx, rax
	lea	rsi, .LC3[rip]
	call	dev_info@PLT
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xor	eax, eax
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	eax, DWORD PTR VPU_PMEM_EXT1_ADDR[rip]
	mov	rsi, QWORD PTR VPU_EXT_P_SIZE[rip]
	mov	r8d, DWORD PTR VPU_PMEM_EXT0_ADDR[rip]
	mov	DWORD PTR 12[rsp], eax
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L12:
	mov	rdi, r14
	lea	rsi, .LC2[rip]
	call	dev_err@PLT
	mov	eax, DWORD PTR ENOMEM[rip]
	add	rsp, 24
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	neg	eax
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	vpu_alloc_ext_mem, .-vpu_alloc_ext_mem
	.comm	VPU_PMEM_EXT1_ADDR,4,4
	.comm	VPU_PMEM_EXT0_ADDR,4,4
	.comm	VPU_EXT_P_SIZE,8,8
	.comm	VPU_EXT_D_SIZE,8,8
	.comm	VPU_DMEM_EXT1_ADDR,4,4
	.comm	VPU_DMEM_EXT0_ADDR,4,4
	.comm	GFP_KERNEL,4,4
	.comm	ENOMEM,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_mtk_vpu.c_vpu_alloc_ext_mem.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Data\000"
	.align	2
.LC1:
	.ascii	"Program\000"
	.align	2
.LC2:
	.ascii	"Failed to allocate the extended program memory\012\000"
	.align	2
.LC3:
	.ascii	"%s extend memory phy=0x%llx virt=0x%p\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	vpu_alloc_ext_mem, %function
vpu_alloc_ext_mem:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldm	r0, {r6, r7}
	subs	r5, r1, #0
	ldrne	r3, .L13
	ldreq	r3, .L13+4
	ldrne	r2, .L13+8
	ldreq	r2, .L13+12
	ldr	r8, [r0, #8]
	ldrne	r1, .L13+16
	ldreq	r1, .L13+20
	ldr	r9, [r3]
	ldr	r3, .L13+24
	mov	r4, r0
	add	r6, r6, r5, lsl #3
	cmp	r7, #0
	ldr	r10, [r2]
	ldr	r3, [r3]
	mov	r2, r6
	mov	r0, r8
	ldr	r1, [r1]
	sub	sp, sp, #20
	movne	r7, #1073741824
	bl	dma_alloc_coherent
	ldr	r3, [r4]
	lsl	fp, r5, #3
	str	r0, [r6, #4]
	add	r3, r3, fp
	ldr	r3, [r3, #4]
	cmp	r3, #0
	beq	.L12
	mov	r2, r10
	mov	r1, #1
	mov	r0, r4
	bl	vpu_cfg_writel
	ldr	r3, [r4]
	mov	r2, r9
	ldr	r1, [r3, r5, lsl #3]
	mov	r0, r4
	bic	r1, r1, #4080
	bic	r1, r1, #15
	add	r1, r1, r7
	bl	vpu_cfg_writel
	ldr	r3, [r4]
	ldr	r1, .L13+28
	add	fp, r3, fp
	ldr	r0, [fp, #4]
	cmp	r5, #0
	str	r0, [sp, #8]
	ldr	r6, [r3, r5, lsl #3]
	ldr	r2, .L13+32
	asr	r7, r6, #31
	movne	r2, r1
	mov	r0, r8
	stm	sp, {r6-r7}
	ldr	r1, .L13+36
	bl	dev_info
	mov	r0, #0
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L12:
	mov	r0, r8
	ldr	r1, .L13+40
	bl	dev_err
	ldr	r3, .L13+44
	ldr	r0, [r3]
	rsb	r0, r0, #0
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L14:
	.align	2
.L13:
	.word	VPU_DMEM_EXT1_ADDR
	.word	VPU_PMEM_EXT1_ADDR
	.word	VPU_DMEM_EXT0_ADDR
	.word	VPU_PMEM_EXT0_ADDR
	.word	VPU_EXT_D_SIZE
	.word	VPU_EXT_P_SIZE
	.word	GFP_KERNEL
	.word	.LC0
	.word	.LC1
	.word	.LC3
	.word	.LC2
	.word	ENOMEM
	.size	vpu_alloc_ext_mem, .-vpu_alloc_ext_mem
	.comm	VPU_PMEM_EXT1_ADDR,4,4
	.comm	VPU_PMEM_EXT0_ADDR,4,4
	.comm	VPU_EXT_P_SIZE,4,4
	.comm	VPU_EXT_D_SIZE,4,4
	.comm	VPU_DMEM_EXT1_ADDR,4,4
	.comm	VPU_DMEM_EXT0_ADDR,4,4
	.comm	GFP_KERNEL,4,4
	.comm	ENOMEM,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
