	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_res_desc_ring_setup
_mtk_res_desc_ring_setup:               ## @mtk_res_desc_ring_setup
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r12d
	movq	%rdi, %r15
	movl	(%rdx), %edi
	callq	_MTK_RES_FIFO_SIZE
	movl	$1, %edx
	movl	%eax, %ecx
	shll	%cl, %edx
	movl	%edx, %r14d
	shrl	$31, %r14d
	addl	%edx, %r14d
	sarl	%r14d
	leal	-1(%r14), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	(%r15), %rbx
	movl	%r12d, %edi
	callq	_RDR_CFG
	addq	%rax, %rbx
	xorl	%edi, %edi
	movq	%rbx, %rsi
	callq	_writel
	movq	_MTK_CNT_RST@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	(%r15), %rbx
	movl	%r12d, %edi
	callq	_RDR_PREP_COUNT
	addq	%rax, %rbx
	movl	%r13d, %edi
	movq	%rbx, %rsi
	callq	_writel
	movq	_MTK_CNT_RST@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	(%r15), %rbx
	movl	%r12d, %edi
	callq	_RDR_PROC_COUNT
	addq	%rax, %rbx
	movl	%r13d, %edi
	movq	%rbx, %rsi
	callq	_writel
	movq	(%r15), %rbx
	movl	%r12d, %edi
	callq	_RDR_PREP_PNTR
	addq	%rax, %rbx
	xorl	%edi, %edi
	movq	%rbx, %rsi
	callq	_writel
	movq	(%r15), %rbx
	movl	%r12d, %edi
	callq	_RDR_PROC_PNTR
	addq	%rax, %rbx
	xorl	%edi, %edi
	movq	%rbx, %rsi
	callq	_writel
	movq	(%r15), %rbx
	movl	%r12d, %edi
	callq	_RDR_DMA_CFG
	addq	%rax, %rbx
	xorl	%edi, %edi
	movq	%rbx, %rsi
	callq	_writel
	movq	(%r15), %rbx
	movl	%r12d, %edi
	callq	_RDR_BASE_ADDR_HI
	addq	%rax, %rbx
	xorl	%edi, %edi
	movq	%rbx, %rsi
	callq	_writel
	movq	(%r15), %rbx
	movq	8(%r15), %rax
	movslq	%r12d, %r12
	movq	(%rax,%r12,8), %rax
	movl	(%rax), %r13d
	movl	%r12d, %edi
	callq	_RDR_BASE_ADDR_LO
	addq	%rax, %rbx
	movl	%r13d, %edi
	movq	%rbx, %rsi
	callq	_writel
	movq	_MTK_DESC_RING_SZ@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	(%r15), %rbx
	movl	%r12d, %edi
	callq	_RDR_RING_SIZE
	addq	%rax, %rbx
	movl	%r13d, %edi
	movq	%rbx, %rsi
	callq	_writel
	movq	_MTK_RDR_STAT_CLR@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	(%r15), %rbx
	movl	%r12d, %edi
	callq	_RDR_STAT
	addq	%rax, %rbx
	movl	%r13d, %edi
	movq	%rbx, %rsi
	callq	_writel
	movq	_MTK_RDR_PROC_THRESH@GOTPCREL(%rip), %rax
	movq	_MTK_RDR_PROC_MODE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r13d
	orl	(%rax), %r13d
	movq	(%r15), %rbx
	movl	%r12d, %edi
	callq	_RDR_THRESH
	addq	%rax, %rbx
	movl	%r13d, %edi
	movq	%rbx, %rsi
	callq	_writel
	movq	_MTK_DESC_SZ@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_MTK_DESC_SIZE
	movl	%eax, %r13d
	movq	_MTK_DESC_OFF@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_MTK_DESC_OFFSET
	orl	%eax, %r13d
	movq	(%r15), %rbx
	movl	%r12d, %edi
	callq	_RDR_DESC_SIZE
	addq	%rax, %rbx
	movl	%r13d, %edi
	movq	%rbx, %rsi
	callq	_writel
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movq	_MTK_DESC_OFF@GOTPCREL(%rip), %rax
	imull	(%rax), %edi
	callq	_MTK_DESC_FETCH_SIZE
	movl	%eax, %ebx
	leal	(%r14,%r14), %edi
	addl	$-2, %edi
	callq	_MTK_DESC_FETCH_THRESH
	orl	%eax, %ebx
	movq	_MTK_DESC_OVL_IRQ_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	(%r15), %r14
	movl	%r12d, %edi
	callq	_RDR_CFG
	addq	%rax, %r14
	movl	%ebx, %edi
	movq	%r14, %rsi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_writel                         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_MTK_CNT_RST,4,2                ## @MTK_CNT_RST
	.comm	_MTK_DESC_RING_SZ,4,2           ## @MTK_DESC_RING_SZ
	.comm	_MTK_RDR_STAT_CLR,4,2           ## @MTK_RDR_STAT_CLR
	.comm	_MTK_RDR_PROC_THRESH,4,2        ## @MTK_RDR_PROC_THRESH
	.comm	_MTK_RDR_PROC_MODE,4,2          ## @MTK_RDR_PROC_MODE
	.comm	_MTK_DESC_SZ,4,2                ## @MTK_DESC_SZ
	.comm	_MTK_DESC_OFF,4,2               ## @MTK_DESC_OFF
	.comm	_MTK_DESC_OVL_IRQ_EN,4,2        ## @MTK_DESC_OVL_IRQ_EN
	.no_dead_strip	_mtk_res_desc_ring_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_res_desc_ring_setup
_mtk_res_desc_ring_setup:               ; @mtk_res_desc_ring_setup
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x1
	mov	x20, x0
	ldr	w0, [x2]
	bl	_MTK_RES_FIFO_SIZE
	mov	w8, #1
	lsl	w8, w8, w0
	cmp	w8, #0
	cinc	w8, w8, lt
	asr	w8, w8, #1
	sub	w22, w8, #1
	ldr	x21, [x20]
	mov	x0, x19
	bl	_RDR_CFG
	add	x1, x0, x21
	mov	w0, #0
	bl	_writel
Lloh0:
	adrp	x23, _MTK_CNT_RST@GOTPAGE
Lloh1:
	ldr	x23, [x23, _MTK_CNT_RST@GOTPAGEOFF]
	ldr	w21, [x23]
	ldr	x24, [x20]
	mov	x0, x19
	bl	_RDR_PREP_COUNT
	add	x1, x0, x24
	mov	x0, x21
	bl	_writel
	ldr	w21, [x23]
	ldr	x23, [x20]
	mov	x0, x19
	bl	_RDR_PROC_COUNT
	add	x1, x0, x23
	mov	x0, x21
	bl	_writel
	ldr	x21, [x20]
	mov	x0, x19
	bl	_RDR_PREP_PNTR
	add	x1, x0, x21
	mov	w0, #0
	bl	_writel
	ldr	x21, [x20]
	mov	x0, x19
	bl	_RDR_PROC_PNTR
	add	x1, x0, x21
	mov	w0, #0
	bl	_writel
	ldr	x21, [x20]
	mov	x0, x19
	bl	_RDR_DMA_CFG
	add	x1, x0, x21
	mov	w0, #0
	bl	_writel
	ldr	x21, [x20]
	mov	x0, x19
	bl	_RDR_BASE_ADDR_HI
	add	x1, x0, x21
	mov	w0, #0
	bl	_writel
	ldp	x23, x8, [x20]
	ldr	x8, [x8, w19, sxtw #3]
	ldr	w21, [x8]
	mov	x0, x19
	bl	_RDR_BASE_ADDR_LO
	add	x1, x0, x23
	mov	x0, x21
	bl	_writel
Lloh2:
	adrp	x8, _MTK_DESC_RING_SZ@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MTK_DESC_RING_SZ@GOTPAGEOFF]
Lloh4:
	ldr	w21, [x8]
	ldr	x23, [x20]
	mov	x0, x19
	bl	_RDR_RING_SIZE
	add	x1, x0, x23
	mov	x0, x21
	bl	_writel
Lloh5:
	adrp	x8, _MTK_RDR_STAT_CLR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MTK_RDR_STAT_CLR@GOTPAGEOFF]
Lloh7:
	ldr	w21, [x8]
	ldr	x23, [x20]
	mov	x0, x19
	bl	_RDR_STAT
	add	x1, x0, x23
	mov	x0, x21
	bl	_writel
Lloh8:
	adrp	x8, _MTK_RDR_PROC_THRESH@GOTPAGE
Lloh9:
	ldr	x8, [x8, _MTK_RDR_PROC_THRESH@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	adrp	x9, _MTK_RDR_PROC_MODE@GOTPAGE
Lloh12:
	ldr	x9, [x9, _MTK_RDR_PROC_MODE@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w21, w9, w8
	ldr	x23, [x20]
	mov	x0, x19
	bl	_RDR_THRESH
	add	x1, x0, x23
	mov	x0, x21
	bl	_writel
Lloh14:
	adrp	x8, _MTK_DESC_SZ@GOTPAGE
Lloh15:
	ldr	x8, [x8, _MTK_DESC_SZ@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	bl	_MTK_DESC_SIZE
	mov	x21, x0
Lloh17:
	adrp	x23, _MTK_DESC_OFF@GOTPAGE
Lloh18:
	ldr	x23, [x23, _MTK_DESC_OFF@GOTPAGEOFF]
	ldr	w0, [x23]
	bl	_MTK_DESC_OFFSET
	orr	w21, w0, w21
	ldr	x24, [x20]
	mov	x0, x19
	bl	_RDR_DESC_SIZE
	add	x1, x0, x24
	mov	x0, x21
	bl	_writel
	ldr	w8, [x23]
	mul	w0, w8, w22
	bl	_MTK_DESC_FETCH_SIZE
	mov	x21, x0
	lsl	w0, w22, #1
	bl	_MTK_DESC_FETCH_THRESH
	orr	w8, w0, w21
Lloh19:
	adrp	x9, _MTK_DESC_OVL_IRQ_EN@GOTPAGE
Lloh20:
	ldr	x9, [x9, _MTK_DESC_OVL_IRQ_EN@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	orr	w21, w8, w9
	ldr	x20, [x20]
	mov	x0, x19
	bl	_RDR_CFG
	add	x1, x0, x20
	mov	x0, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_writel
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_MTK_CNT_RST,4,2                ; @MTK_CNT_RST
	.comm	_MTK_DESC_RING_SZ,4,2           ; @MTK_DESC_RING_SZ
	.comm	_MTK_RDR_STAT_CLR,4,2           ; @MTK_RDR_STAT_CLR
	.comm	_MTK_RDR_PROC_THRESH,4,2        ; @MTK_RDR_PROC_THRESH
	.comm	_MTK_RDR_PROC_MODE,4,2          ; @MTK_RDR_PROC_MODE
	.comm	_MTK_DESC_SZ,4,2                ; @MTK_DESC_SZ
	.comm	_MTK_DESC_OFF,4,2               ; @MTK_DESC_OFF
	.comm	_MTK_DESC_OVL_IRQ_EN,4,2        ; @MTK_DESC_OVL_IRQ_EN
	.no_dead_strip	_mtk_res_desc_ring_setup
.subsections_via_symbols
