	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_dma_init
_mtk_dma_init:                          ## @mtk_dma_init
	.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
	movq	%rdi, %r14
	callq	_mtk_dma_busy_wait
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_18:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	(%r14), %rax
	movl	(%rax), %edi
	movq	_MTK_QDMA@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	callq	_MTK_HAS_CAPS
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	%r14, %rdi
	callq	_mtk_init_fq_dma
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_18
LBB0_4:
	movq	%r14, %rdi
	callq	_mtk_tx_alloc
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_18
## %bb.5:
	movq	(%r14), %rax
	movl	(%rax), %edi
	movl	(%r12), %esi
	callq	_MTK_HAS_CAPS
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movq	_MTK_RX_FLAGS_QDMA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_mtk_rx_alloc
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_18
LBB0_7:
	movq	_MTK_RX_FLAGS_NORMAL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_mtk_rx_alloc
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_18
## %bb.8:
	cmpq	$0, 8(%r14)
	je	LBB0_15
## %bb.9:
	movq	_MTK_MAX_RX_RING_NUM@GOTPCREL(%rip), %r13
	cmpl	$2, (%r13)
	jl	LBB0_14
## %bb.10:
	movl	$1, %r15d
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	_MTK_RX_FLAGS_HWLRO@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_mtk_rx_alloc
	testl	%eax, %eax
	jne	LBB0_13
## %bb.11:                              ##   in Loop: Header=BB0_12 Depth=1
	incl	%r15d
	cmpl	(%r13), %r15d
	jl	LBB0_12
LBB0_14:
	movq	%r14, %rdi
	callq	_mtk_hwlro_rx_init
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_18
LBB0_15:
	movq	(%r14), %rax
	movl	(%rax), %edi
	movl	(%r12), %esi
	callq	_MTK_HAS_CAPS
	testq	%rax, %rax
	je	LBB0_16
## %bb.17:
	movq	_FC_THRES_DROP_MODE@GOTPCREL(%rip), %rax
	movq	_FC_THRES_DROP_EN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	_FC_THRES_MIN@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_MTK_QDMA_FC_THRES@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_mtk_w32
	movq	_MTK_QDMA_HRED2@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_mtk_w32
	jmp	LBB0_18
LBB0_16:
	xorl	%ebx, %ebx
	jmp	LBB0_18
LBB0_13:
	movl	%eax, %ebx
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_MTK_QDMA,4,2                   ## @MTK_QDMA
	.comm	_MTK_RX_FLAGS_QDMA,4,2          ## @MTK_RX_FLAGS_QDMA
	.comm	_MTK_RX_FLAGS_NORMAL,4,2        ## @MTK_RX_FLAGS_NORMAL
	.comm	_MTK_MAX_RX_RING_NUM,4,2        ## @MTK_MAX_RX_RING_NUM
	.comm	_MTK_RX_FLAGS_HWLRO,4,2         ## @MTK_RX_FLAGS_HWLRO
	.comm	_FC_THRES_DROP_MODE,4,2         ## @FC_THRES_DROP_MODE
	.comm	_FC_THRES_DROP_EN,4,2           ## @FC_THRES_DROP_EN
	.comm	_FC_THRES_MIN,4,2               ## @FC_THRES_MIN
	.comm	_MTK_QDMA_FC_THRES,4,2          ## @MTK_QDMA_FC_THRES
	.comm	_MTK_QDMA_HRED2,4,2             ## @MTK_QDMA_HRED2
	.no_dead_strip	_mtk_dma_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_dma_init
_mtk_dma_init:                          ; @mtk_dma_init
	.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, x0
	bl	_mtk_dma_busy_wait
	cbz	x0, LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _EBUSY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_2:
	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
	ret
LBB0_3:
	ldr	x8, [x19]
	ldr	w0, [x8]
Lloh3:
	adrp	x21, _MTK_QDMA@GOTPAGE
Lloh4:
	ldr	x21, [x21, _MTK_QDMA@GOTPAGEOFF]
	ldr	w1, [x21]
	bl	_MTK_HAS_CAPS
	cbz	x0, LBB0_5
; %bb.4:
	mov	x0, x19
	bl	_mtk_init_fq_dma
	cbnz	w0, LBB0_2
LBB0_5:
	mov	x0, x19
	bl	_mtk_tx_alloc
	cbnz	w0, LBB0_2
; %bb.6:
	ldr	x8, [x19]
	ldr	w0, [x8]
	ldr	w1, [x21]
	bl	_MTK_HAS_CAPS
	cbz	x0, LBB0_8
; %bb.7:
Lloh5:
	adrp	x8, _MTK_RX_FLAGS_QDMA@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MTK_RX_FLAGS_QDMA@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #0
	bl	_mtk_rx_alloc
	cbnz	w0, LBB0_2
LBB0_8:
Lloh8:
	adrp	x8, _MTK_RX_FLAGS_NORMAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _MTK_RX_FLAGS_NORMAL@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #0
	bl	_mtk_rx_alloc
	cbnz	w0, LBB0_2
; %bb.9:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_15
; %bb.10:
Lloh11:
	adrp	x22, _MTK_MAX_RX_RING_NUM@GOTPAGE
Lloh12:
	ldr	x22, [x22, _MTK_MAX_RX_RING_NUM@GOTPAGEOFF]
	ldr	w8, [x22]
	cmp	w8, #2
	b.lt	LBB0_14
; %bb.11:
	mov	w20, #1
Lloh13:
	adrp	x23, _MTK_RX_FLAGS_HWLRO@GOTPAGE
Lloh14:
	ldr	x23, [x23, _MTK_RX_FLAGS_HWLRO@GOTPAGEOFF]
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	w2, [x23]
	mov	x0, x19
	mov	x1, x20
	bl	_mtk_rx_alloc
	cbnz	w0, LBB0_2
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	add	w20, w20, #1
	ldr	w8, [x22]
	cmp	w20, w8
	b.lt	LBB0_12
LBB0_14:
	mov	x0, x19
	bl	_mtk_hwlro_rx_init
	cbnz	w0, LBB0_2
LBB0_15:
	ldr	x8, [x19]
	ldr	w0, [x8]
	ldr	w1, [x21]
	bl	_MTK_HAS_CAPS
	cbz	x0, LBB0_2
; %bb.16:
Lloh15:
	adrp	x8, _FC_THRES_DROP_MODE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _FC_THRES_DROP_MODE@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
Lloh18:
	adrp	x9, _FC_THRES_DROP_EN@GOTPAGE
Lloh19:
	ldr	x9, [x9, _FC_THRES_DROP_EN@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
Lloh21:
	adrp	x10, _FC_THRES_MIN@GOTPAGE
Lloh22:
	ldr	x10, [x10, _FC_THRES_MIN@GOTPAGEOFF]
	orr	w8, w9, w8
Lloh23:
	ldr	w9, [x10]
	orr	w1, w8, w9
Lloh24:
	adrp	x8, _MTK_QDMA_FC_THRES@GOTPAGE
Lloh25:
	ldr	x8, [x8, _MTK_QDMA_FC_THRES@GOTPAGEOFF]
Lloh26:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mtk_w32
Lloh27:
	adrp	x8, _MTK_QDMA_HRED2@GOTPAGE
Lloh28:
	ldr	x8, [x8, _MTK_QDMA_HRED2@GOTPAGEOFF]
Lloh29:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #0
	bl	_mtk_w32
	mov	w0, #0
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_MTK_QDMA,4,2                   ; @MTK_QDMA
	.comm	_MTK_RX_FLAGS_QDMA,4,2          ; @MTK_RX_FLAGS_QDMA
	.comm	_MTK_RX_FLAGS_NORMAL,4,2        ; @MTK_RX_FLAGS_NORMAL
	.comm	_MTK_MAX_RX_RING_NUM,4,2        ; @MTK_MAX_RX_RING_NUM
	.comm	_MTK_RX_FLAGS_HWLRO,4,2         ; @MTK_RX_FLAGS_HWLRO
	.comm	_FC_THRES_DROP_MODE,4,2         ; @FC_THRES_DROP_MODE
	.comm	_FC_THRES_DROP_EN,4,2           ; @FC_THRES_DROP_EN
	.comm	_FC_THRES_MIN,4,2               ; @FC_THRES_MIN
	.comm	_MTK_QDMA_FC_THRES,4,2          ; @MTK_QDMA_FC_THRES
	.comm	_MTK_QDMA_HRED2,4,2             ; @MTK_QDMA_HRED2
	.no_dead_strip	_mtk_dma_init
.subsections_via_symbols
