	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_iommu_tlb_flush_range
_mtk_iommu_tlb_flush_range:             ## @mtk_iommu_tlb_flush_range
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	_F_INVLD_EN1@GOTPCREL(%rip), %rax
	movq	_F_INVLD_EN0@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdi
	orq	(%rax), %rdi
	movq	_REG_MMU_INV_SEL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	callq	_writel_relaxed
	movq	_F_MMU_FAULT_VA_MSK@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	andq	%r15, %rdi
	movq	_REG_MMU_INVLD_START_A@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	callq	_writel_relaxed
	leaq	(%r15,%r14), %rdi
	decq	%rdi
	andq	(%r12), %rdi
	movq	_REG_MMU_INVLD_END_A@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	callq	_writel_relaxed
	movq	_F_MMU_INV_RANGE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	_REG_MMU_INVALIDATE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	callq	_writel_relaxed
	movq	_REG_MMU_CPE_DONE@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	addq	(%rbx), %rdi
	xorl	%edx, %edx
	movl	$10, %ecx
	movl	$100000, %r8d                   ## imm = 0x186A0
	callq	_readl_poll_timeout_atomic
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	8(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_warn
	movq	%rbx, %rdi
	callq	_mtk_iommu_tlb_flush_all
LBB0_2:
	movq	(%r14), %rsi
	addq	(%rbx), %rsi
	xorl	%edi, %edi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_writel_relaxed                 ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_F_INVLD_EN1,8,3                ## @F_INVLD_EN1
	.comm	_F_INVLD_EN0,8,3                ## @F_INVLD_EN0
	.comm	_REG_MMU_INV_SEL,8,3            ## @REG_MMU_INV_SEL
	.comm	_F_MMU_FAULT_VA_MSK,8,3         ## @F_MMU_FAULT_VA_MSK
	.comm	_REG_MMU_INVLD_START_A,8,3      ## @REG_MMU_INVLD_START_A
	.comm	_REG_MMU_INVLD_END_A,8,3        ## @REG_MMU_INVLD_END_A
	.comm	_F_MMU_INV_RANGE,8,3            ## @F_MMU_INV_RANGE
	.comm	_REG_MMU_INVALIDATE,8,3         ## @REG_MMU_INVALIDATE
	.comm	_REG_MMU_CPE_DONE,8,3           ## @REG_MMU_CPE_DONE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Partial TLB flush timed out, falling back to full flush\n"

	.no_dead_strip	_mtk_iommu_tlb_flush_range
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_iommu_tlb_flush_range
_mtk_iommu_tlb_flush_range:             ; @mtk_iommu_tlb_flush_range
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _F_INVLD_EN1@GOTPAGE
Lloh1:
	ldr	x8, [x8, _F_INVLD_EN1@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x9, _F_INVLD_EN0@GOTPAGE
Lloh4:
	ldr	x9, [x9, _F_INVLD_EN0@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	orr	x0, x9, x8
	ldr	x8, [x19]
Lloh6:
	adrp	x9, _REG_MMU_INV_SEL@GOTPAGE
Lloh7:
	ldr	x9, [x9, _REG_MMU_INV_SEL@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel_relaxed
Lloh9:
	adrp	x22, _F_MMU_FAULT_VA_MSK@GOTPAGE
Lloh10:
	ldr	x22, [x22, _F_MMU_FAULT_VA_MSK@GOTPAGEOFF]
	ldr	x8, [x22]
	and	x0, x8, x21
	ldr	x8, [x19]
Lloh11:
	adrp	x9, _REG_MMU_INVLD_START_A@GOTPAGE
Lloh12:
	ldr	x9, [x9, _REG_MMU_INVLD_START_A@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel_relaxed
	add	x8, x21, x20
	sub	x8, x8, #1
	ldr	x9, [x22]
	and	x0, x9, x8
	ldr	x8, [x19]
Lloh14:
	adrp	x9, _REG_MMU_INVLD_END_A@GOTPAGE
Lloh15:
	ldr	x9, [x9, _REG_MMU_INVLD_END_A@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel_relaxed
Lloh17:
	adrp	x8, _F_MMU_INV_RANGE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _F_MMU_INV_RANGE@GOTPAGEOFF]
Lloh19:
	ldr	x0, [x8]
	ldr	x8, [x19]
Lloh20:
	adrp	x9, _REG_MMU_INVALIDATE@GOTPAGE
Lloh21:
	ldr	x9, [x9, _REG_MMU_INVALIDATE@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel_relaxed
	ldr	x8, [x19]
Lloh23:
	adrp	x20, _REG_MMU_CPE_DONE@GOTPAGE
Lloh24:
	ldr	x20, [x20, _REG_MMU_CPE_DONE@GOTPAGEOFF]
	ldr	x9, [x20]
	add	x0, x9, x8
	mov	w2, #0
	mov	w3, #10
	mov	w4, #34464
	movk	w4, #1, lsl #16
	bl	_readl_poll_timeout_atomic
	cbz	w0, LBB0_2
; %bb.1:
	ldr	w0, [x19, #8]
Lloh25:
	adrp	x1, l_.str@PAGE
Lloh26:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_warn
	mov	x0, x19
	bl	_mtk_iommu_tlb_flush_all
LBB0_2:
	ldr	x8, [x19]
	ldr	x9, [x20]
	add	x1, x9, x8
	mov	x0, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_writel_relaxed
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_F_INVLD_EN1,8,3                ; @F_INVLD_EN1
	.comm	_F_INVLD_EN0,8,3                ; @F_INVLD_EN0
	.comm	_REG_MMU_INV_SEL,8,3            ; @REG_MMU_INV_SEL
	.comm	_F_MMU_FAULT_VA_MSK,8,3         ; @F_MMU_FAULT_VA_MSK
	.comm	_REG_MMU_INVLD_START_A,8,3      ; @REG_MMU_INVLD_START_A
	.comm	_REG_MMU_INVLD_END_A,8,3        ; @REG_MMU_INVLD_END_A
	.comm	_F_MMU_INV_RANGE,8,3            ; @F_MMU_INV_RANGE
	.comm	_REG_MMU_INVALIDATE,8,3         ; @REG_MMU_INVALIDATE
	.comm	_REG_MMU_CPE_DONE,8,3           ; @REG_MMU_CPE_DONE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Partial TLB flush timed out, falling back to full flush\n"

	.no_dead_strip	_mtk_iommu_tlb_flush_range
.subsections_via_symbols
