	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function txx9dmac_alloc_chan_resources
_txx9dmac_alloc_chan_resources:         ## @txx9dmac_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, %r15
	callq	_to_txx9dmac_chan
	movq	%rax, %r14
	movq	8(%r15), %rbx
	movq	%r15, %rdi
	callq	_chan2dev
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	callq	_dev_vdbg
	movq	_CSR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_channel_readl
	movq	_TXX9_DMA_CSR_XFACT@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_2
## %bb.1:
	movq	%r15, %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_20
LBB0_2:
	movq	%r14, %r12
	movq	%r15, %rdi
	callq	_dma_cookie_init
	movq	_TXX9_DMA_CCR_IMMCHN@GOTPCREL(%rip), %rax
	movq	_TXX9_DMA_CCR_INTENE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_CCR_LE@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, (%r14)
	movq	%r14, %rdi
	callq	_txx9dmac_chan_set_SMPCHN
	xorl	%eax, %eax
	callq	_txx9_dma_have_SMPCHN
	movl	(%r14), %ecx
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movq	_TXX9_DMA_CCR_SMPCHN@GOTPCREL(%rip), %rax
	testl	%ecx, (%rax)
	je	LBB0_5
LBB0_4:
	movq	_TXX9_DMA_CCR_INTENC@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, (%r12)
LBB0_5:
	movq	(%r15), %rax
	cmpq	$0, (%rax)
	je	LBB0_9
## %bb.6:
	testq	%rbx, %rbx
	jne	LBB0_7
## %bb.8:
	movq	_TXX9_DMA_CCR_XFSZ_X8@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, (%r12)
	jmp	LBB0_14
LBB0_9:
	testq	%rbx, %rbx
	je	LBB0_7
## %bb.10:
	cmpq	$0, 16(%rbx)
	movq	8(%rbx), %rax
	je	LBB0_12
## %bb.11:
	testq	%rax, %rax
	je	LBB0_13
LBB0_7:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_20
LBB0_12:
	testq	%rax, %rax
	je	LBB0_7
LBB0_13:
	movq	_TXX9_DMA_CCR_EXTRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movl	(%rbx), %edi
	callq	___ffs
	movl	%eax, %edi
	callq	_TXX9_DMA_CCR_XFSZ
	orl	%r13d, %eax
	orl	%eax, (%r12)
	movq	%r12, %rdi
	callq	_txx9dmac_chan_set_INTENT
LBB0_14:
	addq	$8, %r14
	movq	%r14, %rdi
	callq	_spin_lock_bh
	movl	4(%r12), %ebx
	movq	_TXX9_DMA_INITIAL_DESC_COUNT@GOTPCREL(%rip), %r13
	cmpl	(%r13), %ebx
	jge	LBB0_19
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	callq	_spin_unlock_bh
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_txx9dmac_desc_alloc
	testq	%rax, %rax
	je	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	%r12, %rdi
	movq	%rax, %rsi
	callq	_txx9dmac_desc_put
	movq	%r14, %rdi
	callq	_spin_lock_bh
	movl	4(%r12), %ebx
	incl	%ebx
	movl	%ebx, 4(%r12)
	cmpl	(%r13), %ebx
	jl	LBB0_16
	jmp	LBB0_19
LBB0_18:
	movq	%r15, %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_19:
	movq	%r14, %rdi
	callq	_spin_unlock_bh
	movq	%r15, %rdi
	callq	_chan2dev
	leaq	L_.str.3(%rip), %rsi
	movl	%eax, %edi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
LBB0_20:
	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	_CSR,4,2                        ## @CSR
	.comm	_TXX9_DMA_CSR_XFACT,4,2         ## @TXX9_DMA_CSR_XFACT
L_.str.1:                               ## @.str.1
	.asciz	"DMA channel not idle?\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_TXX9_DMA_CCR_IMMCHN,4,2        ## @TXX9_DMA_CCR_IMMCHN
	.comm	_TXX9_DMA_CCR_INTENE,4,2        ## @TXX9_DMA_CCR_INTENE
	.comm	_CCR_LE,4,2                     ## @CCR_LE
	.comm	_TXX9_DMA_CCR_SMPCHN,4,2        ## @TXX9_DMA_CCR_SMPCHN
	.comm	_TXX9_DMA_CCR_INTENC,4,2        ## @TXX9_DMA_CCR_INTENC
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_TXX9_DMA_CCR_XFSZ_X8,4,2       ## @TXX9_DMA_CCR_XFSZ_X8
	.comm	_TXX9_DMA_CCR_EXTRQ,4,2         ## @TXX9_DMA_CCR_EXTRQ
	.comm	_TXX9_DMA_INITIAL_DESC_COUNT,4,2 ## @TXX9_DMA_INITIAL_DESC_COUNT
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.2:                               ## @.str.2
	.asciz	"only allocated %d descriptors\n"

L_.str.3:                               ## @.str.3
	.asciz	"alloc_chan_resources allocated %d descriptors\n"

	.no_dead_strip	_txx9dmac_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 txx9dmac_alloc_chan_resources
_txx9dmac_alloc_chan_resources:         ; @txx9dmac_alloc_chan_resources
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	_to_txx9dmac_chan
	mov	x20, x0
	ldr	x21, [x19, #8]
	mov	x0, x19
	bl	_chan2dev
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_vdbg
Lloh2:
	adrp	x8, _CSR@GOTPAGE
Lloh3:
	ldr	x8, [x8, _CSR@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_channel_readl
Lloh5:
	adrp	x8, _TXX9_DMA_CSR_XFACT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _TXX9_DMA_CSR_XFACT@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_chan2dev
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
Lloh10:
	adrp	x8, _EIO@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_12
LBB0_2:
	mov	x0, x19
	bl	_dma_cookie_init
Lloh12:
	adrp	x8, _TXX9_DMA_CCR_IMMCHN@GOTPAGE
Lloh13:
	ldr	x8, [x8, _TXX9_DMA_CCR_IMMCHN@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
Lloh15:
	adrp	x9, _TXX9_DMA_CCR_INTENE@GOTPAGE
Lloh16:
	ldr	x9, [x9, _TXX9_DMA_CCR_INTENE@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh18:
	adrp	x9, _CCR_LE@GOTPAGE
Lloh19:
	ldr	x9, [x9, _CCR_LE@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [x20]
	mov	x0, x20
	bl	_txx9dmac_chan_set_SMPCHN
	bl	_txx9_dma_have_SMPCHN
	ldr	w8, [x20]
	cbz	w0, LBB0_4
; %bb.3:
Lloh21:
	adrp	x9, _TXX9_DMA_CCR_SMPCHN@GOTPAGE
Lloh22:
	ldr	x9, [x9, _TXX9_DMA_CCR_SMPCHN@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
LBB0_4:
Lloh24:
	adrp	x9, _TXX9_DMA_CCR_INTENC@GOTPAGE
Lloh25:
	ldr	x9, [x9, _TXX9_DMA_CCR_INTENC@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [x20]
LBB0_5:
	ldr	x9, [x19]
	ldr	x9, [x9]
	cbz	x9, LBB0_8
; %bb.6:
	cbnz	x21, LBB0_11
; %bb.7:
Lloh27:
	adrp	x9, _TXX9_DMA_CCR_XFSZ_X8@GOTPAGE
Lloh28:
	ldr	x9, [x9, _TXX9_DMA_CCR_XFSZ_X8@GOTPAGEOFF]
Lloh29:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [x20]
	b	LBB0_16
LBB0_8:
	cbz	x21, LBB0_11
; %bb.9:
	ldp	x8, x9, [x21, #8]
	cbz	x9, LBB0_14
; %bb.10:
	cbz	x8, LBB0_15
LBB0_11:
Lloh30:
	adrp	x8, _EINVAL@GOTPAGE
Lloh31:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_13:
	mov	x0, x21
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_14:
	cbz	x8, LBB0_11
LBB0_15:
Lloh32:
	adrp	x8, _TXX9_DMA_CCR_EXTRQ@GOTPAGE
Lloh33:
	ldr	x8, [x8, _TXX9_DMA_CCR_EXTRQ@GOTPAGEOFF]
Lloh34:
	ldr	w22, [x8]
	ldr	w0, [x21]
	bl	___ffs
	bl	_TXX9_DMA_CCR_XFSZ
	orr	w8, w0, w22
	ldr	w9, [x20]
	orr	w8, w8, w9
	str	w8, [x20]
	mov	x0, x20
	bl	_txx9dmac_chan_set_INTENT
LBB0_16:
	add	x22, x20, #8
	mov	x0, x22
	bl	_spin_lock_bh
	ldr	w21, [x20, #4]
Lloh35:
	adrp	x23, _TXX9_DMA_INITIAL_DESC_COUNT@GOTPAGE
Lloh36:
	ldr	x23, [x23, _TXX9_DMA_INITIAL_DESC_COUNT@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w21, w8
	b.ge	LBB0_22
; %bb.17:
	mov	x0, x22
	bl	_spin_unlock_bh
Lloh37:
	adrp	x24, _GFP_KERNEL@GOTPAGE
Lloh38:
	ldr	x24, [x24, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x24]
	mov	x0, x20
	bl	_txx9dmac_desc_alloc
	cbz	x0, LBB0_21
; %bb.18:
	mov	x1, x0
LBB0_19:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_txx9dmac_desc_put
	mov	x0, x22
	bl	_spin_lock_bh
	ldr	w8, [x20, #4]
	add	w21, w8, #1
	str	w21, [x20, #4]
	ldr	w8, [x23]
	cmp	w21, w8
	b.ge	LBB0_22
; %bb.20:                               ;   in Loop: Header=BB0_19 Depth=1
	mov	x0, x22
	bl	_spin_unlock_bh
	ldr	w1, [x24]
	mov	x0, x20
	bl	_txx9dmac_desc_alloc
	mov	x1, x0
	cbnz	x0, LBB0_19
LBB0_21:
	mov	x0, x19
	bl	_chan2dev
Lloh39:
	adrp	x1, l_.str.2@PAGE
Lloh40:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x21
	bl	_dev_info
	mov	x0, x22
	bl	_spin_lock_bh
LBB0_22:
	mov	x0, x22
	bl	_spin_unlock_bh
	mov	x0, x19
	bl	_chan2dev
	str	x21, [sp]
Lloh41:
	adrp	x1, l_.str.3@PAGE
Lloh42:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_dbg
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh35, Lloh36
	.loh AdrpLdrGot	Lloh37, Lloh38
	.loh AdrpAdd	Lloh39, Lloh40
	.loh AdrpAdd	Lloh41, Lloh42
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"alloc_chan_resources\n"

	.comm	_CSR,4,2                        ; @CSR
	.comm	_TXX9_DMA_CSR_XFACT,4,2         ; @TXX9_DMA_CSR_XFACT
l_.str.1:                               ; @.str.1
	.asciz	"DMA channel not idle?\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_TXX9_DMA_CCR_IMMCHN,4,2        ; @TXX9_DMA_CCR_IMMCHN
	.comm	_TXX9_DMA_CCR_INTENE,4,2        ; @TXX9_DMA_CCR_INTENE
	.comm	_CCR_LE,4,2                     ; @CCR_LE
	.comm	_TXX9_DMA_CCR_SMPCHN,4,2        ; @TXX9_DMA_CCR_SMPCHN
	.comm	_TXX9_DMA_CCR_INTENC,4,2        ; @TXX9_DMA_CCR_INTENC
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_TXX9_DMA_CCR_XFSZ_X8,4,2       ; @TXX9_DMA_CCR_XFSZ_X8
	.comm	_TXX9_DMA_CCR_EXTRQ,4,2         ; @TXX9_DMA_CCR_EXTRQ
	.comm	_TXX9_DMA_INITIAL_DESC_COUNT,4,2 ; @TXX9_DMA_INITIAL_DESC_COUNT
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.2:                               ; @.str.2
	.asciz	"only allocated %d descriptors\n"

l_.str.3:                               ; @.str.3
	.asciz	"alloc_chan_resources allocated %d descriptors\n"

	.no_dead_strip	_txx9dmac_alloc_chan_resources
.subsections_via_symbols
