	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dwc_alloc_chan_resources
_dwc_alloc_chan_resources:              ## @dwc_alloc_chan_resources
	.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, %r12
	callq	_to_dw_dma_chan
	movq	%rax, %r14
	movl	16(%r12), %edi
	callq	_to_dw_dma
	movq	%rax, %r15
	movq	%r12, %rdi
	callq	_chan2dev
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	callq	_dev_vdbg
	movq	_CH_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_dma_readl
	testl	%eax, (%r14)
	je	LBB0_2
## %bb.1:
	movq	%r12, %rdi
	callq	_chan2dev
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movl	%eax, %edi
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_15
LBB0_2:
	movq	%r14, %r13
	movl	$1, (%r12)
	movl	$1, 4(%r14)
	movq	8(%r12), %rbx
	testq	%rbx, %rbx
	je	LBB0_3
## %bb.4:
	movq	(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	xorl	%edi, %edi
	cmpq	(%r15), %rax
	setne	%dil
	jmp	LBB0_7
LBB0_3:
	movq	_DWC_CFGH_FIFO_MODE@GOTPCREL(%rip), %rbx
	xorl	%edx, %edx
	jmp	LBB0_8
LBB0_5:
	movl	$1, %edi
LBB0_7:
	callq	_BUG_ON
	movq	8(%rbx), %rdx
	addq	$16, %rbx
LBB0_8:
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	movq	(%rbx), %rbx
	movq	_CFG_LO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_channel_writel
	movq	_CFG_HI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movq	%rbx, %rdx
	callq	_channel_writel
	addq	$12, %r14
	movq	%r14, %rdi
	callq	_spin_lock_bh
	movl	8(%r13), %ebx
	movq	_NR_DESCS_PER_CHANNEL@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jge	LBB0_14
## %bb.9:
	movq	%r14, %rdi
	callq	_spin_unlock_bh
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$20, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_13
## %bb.10:
	movq	%rax, %r15
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	leaq	16(%r15), %rdi
	callq	_INIT_LIST_HEAD
	leaq	4(%r15), %rdi
	movq	%r12, %rsi
	callq	_dma_async_tx_descriptor_init
	movq	_dwc_tx_submit@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%r15)
	movq	_DMA_CTRL_ACK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r15)
	movq	%r12, %rdi
	callq	_chan2parent
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%eax, %edi
	movq	%r15, %rsi
	movl	$4, %edx
	callq	_dma_map_single
	movl	%eax, 4(%r15)
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_dwc_desc_put
	movq	%r14, %rdi
	callq	_spin_lock_bh
	movl	8(%r13), %ebx
	incl	%ebx
	movl	%ebx, 8(%r13)
	movq	_NR_DESCS_PER_CHANNEL@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jge	LBB0_14
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	%r14, %rdi
	callq	_spin_unlock_bh
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$20, %edi
	callq	_kzalloc
	movq	%rax, %r15
	testq	%rax, %rax
	jne	LBB0_11
LBB0_13:
	movq	%r12, %rdi
	callq	_chan2dev
	leaq	L_.str.2(%rip), %rsi
	movl	%eax, %edi
	movl	%ebx, %edx
	callq	_dev_info
	movq	%r14, %rdi
	callq	_spin_lock_bh
LBB0_14:
	movq	_MASK@GOTPCREL(%rip), %rax
	movl	8(%rax), %esi
	movl	(%r13), %edx
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	callq	_channel_set_bit
	movq	_MASK@GOTPCREL(%rip), %rax
	movl	4(%rax), %esi
	movl	(%r13), %edx
	movq	%r15, %rdi
	callq	_channel_set_bit
	movq	_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r13), %edx
	movq	%r15, %rdi
	callq	_channel_set_bit
	movq	%r14, %rdi
	callq	_spin_unlock_bh
	movq	%r12, %rdi
	callq	_chan2dev
	leaq	L_.str.3(%rip), %rsi
	movl	%eax, %edi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
LBB0_15:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"alloc_chan_resources\n"

	.comm	_CH_EN,4,2                      ## @CH_EN
L_.str.1:                               ## @.str.1
	.asciz	"DMA channel not idle?\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_DWC_CFGH_FIFO_MODE,8,3         ## @DWC_CFGH_FIFO_MODE
	.comm	_CFG_LO,4,2                     ## @CFG_LO
	.comm	_CFG_HI,4,2                     ## @CFG_HI
	.comm	_NR_DESCS_PER_CHANNEL,4,2       ## @NR_DESCS_PER_CHANNEL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.2:                               ## @.str.2
	.asciz	"only allocated %d descriptors\n"

	.comm	_dwc_tx_submit,4,2              ## @dwc_tx_submit
	.comm	_DMA_CTRL_ACK,4,2               ## @DMA_CTRL_ACK
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.comm	_MASK,12,2                      ## @MASK
L_.str.3:                               ## @.str.3
	.asciz	"alloc_chan_resources allocated %d descriptors\n"

	.no_dead_strip	_dwc_alloc_chan_resources
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dwc_alloc_chan_resources
_dwc_alloc_chan_resources:              ; @dwc_alloc_chan_resources
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	bl	_to_dw_dma_chan
	mov	x20, x0
	ldr	w0, [x19, #16]
	bl	_to_dw_dma
	mov	x21, x0
	mov	x0, x19
	bl	_chan2dev
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_vdbg
Lloh2:
	adrp	x8, _CH_EN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _CH_EN@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_dma_readl
	ldr	w8, [x20]
	tst	w8, w0
	b.eq	LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_chan2dev
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
Lloh7:
	adrp	x8, _EIO@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_15
LBB0_2:
	mov	w8, #1
	str	w8, [x19]
	str	w8, [x20, #4]
	ldr	x22, [x19, #8]
	cbz	x22, LBB0_5
; %bb.3:
	ldr	x8, [x22]
	cbz	x8, LBB0_6
; %bb.4:
	ldr	x9, [x21]
	cmp	x8, x9
	cset	w0, ne
	b	LBB0_7
LBB0_5:
	mov	x2, #0
Lloh10:
	adrp	x8, _DWC_CFGH_FIFO_MODE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _DWC_CFGH_FIFO_MODE@GOTPAGEOFF]
	b	LBB0_8
LBB0_6:
	mov	w0, #1
LBB0_7:
	bl	_BUG_ON
	add	x8, x22, #16
	ldr	x2, [x22, #8]
LBB0_8:
	ldr	x22, [x8]
Lloh12:
	adrp	x8, _CFG_LO@GOTPAGE
Lloh13:
	ldr	x8, [x8, _CFG_LO@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_channel_writel
Lloh15:
	adrp	x8, _CFG_HI@GOTPAGE
Lloh16:
	ldr	x8, [x8, _CFG_HI@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x22
	bl	_channel_writel
	add	x22, x20, #12
	mov	x0, x22
	bl	_spin_lock_bh
	ldr	w23, [x20, #8]
Lloh18:
	adrp	x25, _NR_DESCS_PER_CHANNEL@GOTPAGE
Lloh19:
	ldr	x25, [x25, _NR_DESCS_PER_CHANNEL@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w23, w8
	b.ge	LBB0_14
; %bb.9:
	mov	x0, x22
	bl	_spin_unlock_bh
Lloh20:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	mov	w0, #20
	bl	_kzalloc
	cbz	x0, LBB0_13
; %bb.10:
	mov	x24, x0
Lloh23:
	adrp	x27, _dwc_tx_submit@GOTPAGE
Lloh24:
	ldr	x27, [x27, _dwc_tx_submit@GOTPAGEOFF]
Lloh25:
	adrp	x28, _DMA_CTRL_ACK@GOTPAGE
Lloh26:
	ldr	x28, [x28, _DMA_CTRL_ACK@GOTPAGEOFF]
Lloh27:
	adrp	x26, _DMA_TO_DEVICE@GOTPAGE
Lloh28:
	ldr	x26, [x26, _DMA_TO_DEVICE@GOTPAGEOFF]
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	add	x0, x24, #16
	bl	_INIT_LIST_HEAD
	add	x0, x24, #4
	mov	x1, x19
	bl	_dma_async_tx_descriptor_init
	ldr	w8, [x27]
	ldr	w9, [x28]
	stp	w9, w8, [x24, #8]
	mov	x0, x19
	bl	_chan2parent
	ldr	w3, [x26]
	mov	x1, x24
	mov	w2, #4
	bl	_dma_map_single
	str	w0, [x24, #4]
	mov	x0, x20
	mov	x1, x24
	bl	_dwc_desc_put
	mov	x0, x22
	bl	_spin_lock_bh
	ldr	w8, [x20, #8]
	add	w23, w8, #1
	str	w23, [x20, #8]
	ldr	w8, [x25]
	cmp	w23, w8
	b.ge	LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x0, x22
	bl	_spin_unlock_bh
Lloh29:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh30:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	mov	w0, #20
	bl	_kzalloc
	mov	x24, x0
	cbnz	x0, LBB0_11
LBB0_13:
	mov	x0, x19
	bl	_chan2dev
Lloh32:
	adrp	x1, l_.str.2@PAGE
Lloh33:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x23
	bl	_dev_info
	mov	x0, x22
	bl	_spin_lock_bh
LBB0_14:
Lloh34:
	adrp	x24, _MASK@GOTPAGE
Lloh35:
	ldr	x24, [x24, _MASK@GOTPAGEOFF]
	ldr	w1, [x24, #8]
	ldr	w2, [x20]
	mov	x0, x21
	bl	_channel_set_bit
	ldr	w1, [x24, #4]
	ldr	w2, [x20]
	mov	x0, x21
	bl	_channel_set_bit
	ldr	w1, [x24]
	ldr	w2, [x20]
	mov	x0, x21
	bl	_channel_set_bit
	mov	x0, x22
	bl	_spin_unlock_bh
	mov	x0, x19
	bl	_chan2dev
	str	x23, [sp]
Lloh36:
	adrp	x1, l_.str.3@PAGE
Lloh37:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_dbg
LBB0_15:
	mov	x0, x23
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpLdrGot	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"alloc_chan_resources\n"

	.comm	_CH_EN,4,2                      ; @CH_EN
l_.str.1:                               ; @.str.1
	.asciz	"DMA channel not idle?\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_DWC_CFGH_FIFO_MODE,8,3         ; @DWC_CFGH_FIFO_MODE
	.comm	_CFG_LO,4,2                     ; @CFG_LO
	.comm	_CFG_HI,4,2                     ; @CFG_HI
	.comm	_NR_DESCS_PER_CHANNEL,4,2       ; @NR_DESCS_PER_CHANNEL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.2:                               ; @.str.2
	.asciz	"only allocated %d descriptors\n"

	.comm	_dwc_tx_submit,4,2              ; @dwc_tx_submit
	.comm	_DMA_CTRL_ACK,4,2               ; @DMA_CTRL_ACK
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.comm	_MASK,12,2                      ; @MASK
l_.str.3:                               ; @.str.3
	.asciz	"alloc_chan_resources allocated %d descriptors\n"

	.no_dead_strip	_dwc_alloc_chan_resources
.subsections_via_symbols
