	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function owl_dma_terminate_pchan
_owl_dma_terminate_pchan:               ## @owl_dma_terminate_pchan
	.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	%rsi, %rbx
	movq	%rdi, %r14
	movq	_OWL_DMAX_START@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_pchan_writel
	movq	_OWL_DMAX_INT_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$255, %edx
	xorl	%ecx, %ecx
	callq	_pchan_update
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movq	_OWL_DMA_IRQ_EN0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movb	(%rbx), %cl
	movl	$1, %r15d
	movl	$1, %edx
	shll	%cl, %edx
	movq	%r14, %rdi
	xorl	%ecx, %ecx
	callq	_dma_update
	movq	_OWL_DMA_IRQ_PD0@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r14, %rdi
	callq	_dma_readl
	movl	(%rbx), %edx
	btl	%edx, %eax
	jae	LBB0_2
## %bb.1:
	movl	4(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_warn
	movl	(%r12), %esi
	movb	(%rbx), %cl
	shll	%cl, %r15d
	movq	%r14, %rdi
	movl	%r15d, %edx
	callq	_dma_writel
LBB0_2:
	movq	$0, 8(%rbx)
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_OWL_DMAX_START,4,2             ## @OWL_DMAX_START
	.comm	_OWL_DMAX_INT_STATUS,4,2        ## @OWL_DMAX_INT_STATUS
	.comm	_OWL_DMA_IRQ_EN0,4,2            ## @OWL_DMA_IRQ_EN0
	.comm	_OWL_DMA_IRQ_PD0,4,2            ## @OWL_DMA_IRQ_PD0
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"terminating pchan %d that still has pending irq\n"

	.no_dead_strip	_owl_dma_terminate_pchan
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function owl_dma_terminate_pchan
_owl_dma_terminate_pchan:               ; @owl_dma_terminate_pchan
	.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, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _OWL_DMAX_START@GOTPAGE
Lloh1:
	ldr	x8, [x8, _OWL_DMAX_START@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_pchan_writel
Lloh3:
	adrp	x8, _OWL_DMAX_INT_STATUS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _OWL_DMAX_INT_STATUS@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #255
	mov	w3, #0
	bl	_pchan_update
	mov	x0, x19
	bl	_spin_lock_irqsave
Lloh6:
	adrp	x8, _OWL_DMA_IRQ_EN0@GOTPAGE
Lloh7:
	ldr	x8, [x8, _OWL_DMA_IRQ_EN0@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	ldr	w8, [x20]
	mov	w21, #1
	lsl	w2, w21, w8
	mov	x0, x19
	mov	w3, #0
	bl	_dma_update
Lloh9:
	adrp	x22, _OWL_DMA_IRQ_PD0@GOTPAGE
Lloh10:
	ldr	x22, [x22, _OWL_DMA_IRQ_PD0@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x19
	bl	_dma_readl
	ldr	w2, [x20]
	lsr	w8, w0, w2
	tbz	w8, #0, LBB0_2
; %bb.1:
	ldr	w0, [x19, #4]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_dev_warn
	ldr	w1, [x22]
	ldr	w8, [x20]
	lsl	w2, w21, w8
	mov	x0, x19
	bl	_dma_writel
LBB0_2:
	str	xzr, [x20, #8]
	mov	x0, x19
	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	_spin_unlock_irqrestore
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_OWL_DMAX_START,4,2             ; @OWL_DMAX_START
	.comm	_OWL_DMAX_INT_STATUS,4,2        ; @OWL_DMAX_INT_STATUS
	.comm	_OWL_DMA_IRQ_EN0,4,2            ; @OWL_DMA_IRQ_EN0
	.comm	_OWL_DMA_IRQ_PD0,4,2            ; @OWL_DMA_IRQ_PD0
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"terminating pchan %d that still has pending irq\n"

	.no_dead_strip	_owl_dma_terminate_pchan
.subsections_via_symbols
