	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function flexrm_shutdown
_flexrm_shutdown:                       ## @flexrm_shutdown
	.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, -48(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %r15
	movq	_RING_CONTROL@GOTPCREL(%rip), %r13
	movq	(%r13), %rsi
	addq	72(%r15), %rsi
	xorl	%edi, %edi
	callq	_writel_relaxed
	movq	_CONTROL_FLUSH_SHIFT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_BIT
	movq	(%r13), %rsi
	addq	72(%r15), %rsi
	movl	%eax, %edi
	callq	_writel_relaxed
	movl	$-1000, %ebx                    ## imm = 0xFC18
	movq	_RING_FLUSH_DONE@GOTPCREL(%rip), %r12
	movq	_FLUSH_DONE_MASK@GOTPCREL(%rip), %r14
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rdi
	addq	72(%r15), %rdi
	callq	_readl_relaxed
	testl	%eax, (%r14)
	jne	LBB0_4
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$1, %edi
	callq	_mdelay
	incl	%ebx
	jne	LBB0_1
## %bb.3:
	movq	24(%r15), %rax
	movl	8(%rax), %edi
	movl	64(%r15), %edx
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
LBB0_4:
	movq	(%r13), %rsi
	addq	72(%r15), %rsi
	xorl	%edi, %edi
	callq	_writel_relaxed
	movl	$-1000, %ebx                    ## imm = 0xFC18
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rdi
	addq	72(%r15), %rdi
	callq	_readl_relaxed
	testl	%eax, (%r14)
	je	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	$1, %edi
	callq	_mdelay
	incl	%ebx
	jne	LBB0_5
## %bb.7:
	movq	24(%r15), %rax
	movl	8(%rax), %edi
	movl	64(%r15), %edx
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
LBB0_8:
	movq	_RING_MAX_REQ_COUNT@GOTPCREL(%rip), %r12
	movq	(%r12), %rsi
	xorl	%ebx, %ebx
	testq	%rsi, %rsi
	je	LBB0_9
## %bb.10:
	movq	_EIO@GOTPCREL(%rip), %r14
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_11 Depth=1
	incq	%rbx
	cmpq	%rsi, %rbx
	jae	LBB0_14
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	56(%r15), %rax
	movq	(%rax,%rbx,8), %r13
	testq	%r13, %r13
	je	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	$0, (%rax,%rbx,8)
	movq	24(%r15), %rax
	movl	8(%rax), %edi
	movq	%r13, %rsi
	callq	_flexrm_dma_unmap
	xorl	%eax, %eax
	subl	(%r14), %eax
	movl	%eax, (%r13)
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	callq	_mbox_chan_received_data
	movq	(%r12), %rsi
	jmp	LBB0_13
LBB0_9:
	xorl	%esi, %esi
LBB0_14:
	movl	48(%r15), %edi
	callq	_bitmap_zero
	cmpl	$0, (%r15)
	je	LBB0_16
## %bb.15:
	movl	44(%r15), %edi
	xorl	%esi, %esi
	callq	_irq_set_affinity_hint
	movl	44(%r15), %edi
	movq	%r15, %rsi
	callq	_free_irq
	movl	$0, (%r15)
LBB0_16:
	movq	32(%r15), %rsi
	testq	%rsi, %rsi
	je	LBB0_18
## %bb.17:
	movq	24(%r15), %rax
	movl	4(%rax), %edi
	movl	40(%r15), %edx
	callq	_dma_pool_free
	movq	$0, 32(%r15)
LBB0_18:
	movq	8(%r15), %rsi
	testq	%rsi, %rsi
	je	LBB0_20
## %bb.19:
	movq	24(%r15), %rax
	movl	(%rax), %edi
	movl	16(%r15), %edx
	callq	_dma_pool_free
	movq	$0, 8(%r15)
LBB0_20:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RING_CONTROL,8,3               ## @RING_CONTROL
	.comm	_CONTROL_FLUSH_SHIFT,4,2        ## @CONTROL_FLUSH_SHIFT
	.comm	_RING_FLUSH_DONE,8,3            ## @RING_FLUSH_DONE
	.comm	_FLUSH_DONE_MASK,4,2            ## @FLUSH_DONE_MASK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"setting ring%d flush state timedout\n"

L_.str.1:                               ## @.str.1
	.asciz	"clearing ring%d flush state timedout\n"

	.comm	_RING_MAX_REQ_COUNT,8,3         ## @RING_MAX_REQ_COUNT
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_flexrm_shutdown
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function flexrm_shutdown
_flexrm_shutdown:                       ; @flexrm_shutdown
	.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	x20, x0
	ldr	x19, [x0]
	ldr	x8, [x19, #72]
Lloh0:
	adrp	x23, _RING_CONTROL@GOTPAGE
Lloh1:
	ldr	x23, [x23, _RING_CONTROL@GOTPAGEOFF]
	ldr	x9, [x23]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writel_relaxed
Lloh2:
	adrp	x8, _CONTROL_FLUSH_SHIFT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _CONTROL_FLUSH_SHIFT@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	bl	_BIT
	ldr	x8, [x19, #72]
	ldr	x9, [x23]
	add	x1, x9, x8
	bl	_writel_relaxed
	mov	w24, #-1000
Lloh5:
	adrp	x21, _RING_FLUSH_DONE@GOTPAGE
Lloh6:
	ldr	x21, [x21, _RING_FLUSH_DONE@GOTPAGEOFF]
Lloh7:
	adrp	x22, _FLUSH_DONE_MASK@GOTPAGE
Lloh8:
	ldr	x22, [x22, _FLUSH_DONE_MASK@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #72]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl_relaxed
	ldr	w8, [x22]
	tst	w8, w0
	b.ne	LBB0_4
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w0, #1
	bl	_mdelay
	adds	w24, w24, #1
	b.lo	LBB0_1
; %bb.3:
	ldr	x8, [x19, #24]
	ldr	w0, [x8, #8]
	ldr	w2, [x19, #64]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_4:
	ldr	x8, [x19, #72]
	ldr	x9, [x23]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writel_relaxed
	mov	w23, #-1000
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #72]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl_relaxed
	ldr	w8, [x22]
	tst	w8, w0
	b.eq	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	w0, #1
	bl	_mdelay
	adds	w23, w23, #1
	b.lo	LBB0_5
; %bb.7:
	ldr	x8, [x19, #24]
	ldr	w0, [x8, #8]
	ldr	w2, [x19, #64]
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
LBB0_8:
Lloh13:
	adrp	x22, _RING_MAX_REQ_COUNT@GOTPAGE
Lloh14:
	ldr	x22, [x22, _RING_MAX_REQ_COUNT@GOTPAGEOFF]
	ldr	x1, [x22]
	cbz	x1, LBB0_13
; %bb.9:
	mov	x23, #0
Lloh15:
	adrp	x24, _EIO@GOTPAGE
Lloh16:
	ldr	x24, [x24, _EIO@GOTPAGEOFF]
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	x23, x23, #1
	cmp	x23, x1
	b.hs	LBB0_13
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #56]
	ldr	x21, [x8, x23, lsl #3]
	cbz	x21, LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	str	xzr, [x8, x23, lsl #3]
	ldr	x8, [x19, #24]
	ldr	w0, [x8, #8]
	mov	x1, x21
	bl	_flexrm_dma_unmap
	ldr	w8, [x24]
	neg	w8, w8
	str	w8, [x21]
	mov	x0, x20
	mov	x1, x21
	bl	_mbox_chan_received_data
	ldr	x1, [x22]
	b	LBB0_10
LBB0_13:
	ldr	w0, [x19, #48]
	bl	_bitmap_zero
	ldr	w8, [x19]
	cbz	w8, LBB0_15
; %bb.14:
	ldr	w0, [x19, #44]
	mov	x1, #0
	bl	_irq_set_affinity_hint
	ldr	w0, [x19, #44]
	mov	x1, x19
	bl	_free_irq
	str	wzr, [x19]
LBB0_15:
	ldr	x1, [x19, #32]
	cbz	x1, LBB0_17
; %bb.16:
	ldr	x8, [x19, #24]
	ldr	w0, [x8, #4]
	ldr	w2, [x19, #40]
	bl	_dma_pool_free
	str	xzr, [x19, #32]
LBB0_17:
	ldr	x1, [x19, #8]
	cbz	x1, LBB0_19
; %bb.18:
	ldr	x8, [x19, #24]
	ldr	w0, [x8]
	ldr	w2, [x19, #16]
	bl	_dma_pool_free
	str	xzr, [x19, #8]
LBB0_19:
	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
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_RING_CONTROL,8,3               ; @RING_CONTROL
	.comm	_CONTROL_FLUSH_SHIFT,4,2        ; @CONTROL_FLUSH_SHIFT
	.comm	_RING_FLUSH_DONE,8,3            ; @RING_FLUSH_DONE
	.comm	_FLUSH_DONE_MASK,4,2            ; @FLUSH_DONE_MASK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"setting ring%d flush state timedout\n"

l_.str.1:                               ; @.str.1
	.asciz	"clearing ring%d flush state timedout\n"

	.comm	_RING_MAX_REQ_COUNT,8,3         ; @RING_MAX_REQ_COUNT
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_flexrm_shutdown
.subsections_via_symbols
