	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dw_mci_edmac_start_dma
_dw_mci_edmac_start_dma:                ## @dw_mci_edmac_start_dma
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r12d
	movq	%rdi, %rbx
	movq	32(%rdi), %rax
	movq	8(%rax), %r14
	movl	(%rax), %r15d
	movl	(%rdi), %eax
	subl	4(%rdi), %eax
	addl	8(%rdi), %eax
	movl	%eax, -80(%rbp)
	movl	%eax, -76(%rbp)
	movq	_DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	%rax, -56(%rbp)
	movq	_FIFOTH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_mci_readl
                                        ## kill: def $eax killed $eax def $rax
	shrl	$28, %eax
	andl	$7, %eax
	leaq	_dw_mci_edmac_start_dma.mszs(%rip), %rcx
	movl	(%rcx,%rax,4), %eax
	movl	%eax, -72(%rbp)
	movl	%eax, -68(%rbp)
	movq	32(%rbx), %rax
	movq	_MMC_DATA_WRITE@GOTPCREL(%rip), %r13
	movl	(%r13), %ecx
	andl	4(%rax), %ecx
	jne	LBB0_1
## %bb.2:
	movq	_DMA_DEV_TO_MEM@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %eax
	movl	%eax, -64(%rbp)
	movq	16(%rbx), %rax
	movl	(%rax), %edi
	leaq	-80(%rbp), %rsi
	callq	_dmaengine_slave_config
	testl	%eax, %eax
	je	LBB0_6
## %bb.4:
	movl	40(%rbx), %edi
	leaq	L_.str(%rip), %rsi
LBB0_5:
	callq	_dev_err
	movq	_EBUSY@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_11
LBB0_6:
	movq	16(%rbx), %rax
	movl	(%rax), %edi
	movl	-64(%rbp), %ecx
	movq	_DMA_PREP_INTERRUPT@GOTPCREL(%rip), %rax
	movq	_DMA_CTRL_ACK@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r8d
	orl	(%rax), %r8d
	movq	%r14, %rsi
	movl	%r12d, %edx
	callq	_dmaengine_prep_slave_sg
	testq	%rax, %rax
	je	LBB0_7
## %bb.8:
	movq	_dw_mci_dmac_complete_dma@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 8(%rax)
	movq	%rbx, (%rax)
	movq	%rax, %rdi
	callq	_dmaengine_submit
	movq	32(%rbx), %rax
	movl	(%r13), %ecx
	testl	%ecx, 4(%rax)
	je	LBB0_10
## %bb.9:
	movq	24(%rbx), %rax
	movl	(%rax), %edi
	callq	_mmc_dev
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%eax, %edi
	movq	%r14, %rsi
	movl	%r15d, %edx
	callq	_dma_sync_sg_for_device
LBB0_10:
	movq	16(%rbx), %rax
	movl	(%rax), %edi
	callq	_dma_async_issue_pending
	xorl	%eax, %eax
LBB0_11:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movl	40(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	4                               ## @dw_mci_edmac_start_dma.mszs
_dw_mci_edmac_start_dma.mszs:
	.long	1                               ## 0x1
	.long	4                               ## 0x4
	.long	8                               ## 0x8
	.long	16                              ## 0x10
	.long	32                              ## 0x20
	.long	64                              ## 0x40
	.long	128                             ## 0x80
	.long	256                             ## 0x100

	.comm	_DMA_SLAVE_BUSWIDTH_4_BYTES,8,3 ## @DMA_SLAVE_BUSWIDTH_4_BYTES
	.comm	_FIFOTH,4,2                     ## @FIFOTH
	.comm	_MMC_DATA_WRITE,4,2             ## @MMC_DATA_WRITE
	.comm	_DMA_MEM_TO_DEV,4,2             ## @DMA_MEM_TO_DEV
	.comm	_DMA_DEV_TO_MEM,4,2             ## @DMA_DEV_TO_MEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to config edmac.\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_DMA_PREP_INTERRUPT,4,2         ## @DMA_PREP_INTERRUPT
	.comm	_DMA_CTRL_ACK,4,2               ## @DMA_CTRL_ACK
L_.str.1:                               ## @.str.1
	.asciz	"Can't prepare slave sg.\n"

	.comm	_dw_mci_dmac_complete_dma,4,2   ## @dw_mci_dmac_complete_dma
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.no_dead_strip	_dw_mci_edmac_start_dma
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dw_mci_edmac_start_dma
_dw_mci_edmac_start_dma:                ; @dw_mci_edmac_start_dma
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x22, x1
	mov	x19, x0
	ldr	x8, [x0, #32]
	ldr	x20, [x8, #8]
	ldr	w21, [x8]
	ldp	w8, w9, [x0]
	ldr	w10, [x0, #8]
	sub	w8, w8, w9
	add	w8, w10, w8
	stp	w8, w8, [sp, #8]
Lloh0:
	adrp	x8, _DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stp	x8, x8, [sp, #32]
Lloh3:
	adrp	x8, _FIFOTH@GOTPAGE
Lloh4:
	ldr	x8, [x8, _FIFOTH@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_mci_readl
	ubfx	w8, w0, #28, #3
Lloh6:
	adrp	x9, _dw_mci_edmac_start_dma.mszs@PAGE
Lloh7:
	add	x9, x9, _dw_mci_edmac_start_dma.mszs@PAGEOFF
	ldr	w8, [x9, w8, uxtw #2]
	stp	w8, w8, [sp, #16]
	ldr	x8, [x19, #32]
Lloh8:
	adrp	x23, _MMC_DATA_WRITE@GOTPAGE
Lloh9:
	ldr	x23, [x23, _MMC_DATA_WRITE@GOTPAGEOFF]
	ldr	w8, [x8, #4]
	ldr	w9, [x23]
Lloh10:
	adrp	x10, _DMA_DEV_TO_MEM@GOTPAGE
Lloh11:
	ldr	x10, [x10, _DMA_DEV_TO_MEM@GOTPAGEOFF]
Lloh12:
	adrp	x11, _DMA_MEM_TO_DEV@GOTPAGE
Lloh13:
	ldr	x11, [x11, _DMA_MEM_TO_DEV@GOTPAGEOFF]
	tst	w9, w8
	csel	x8, x10, x11, eq
	ldr	w8, [x8]
	str	w8, [sp, #24]
	ldr	x8, [x19, #16]
	ldr	w0, [x8]
	add	x1, sp, #8
	bl	_dmaengine_slave_config
	cbz	w0, LBB0_3
; %bb.1:
	ldr	w0, [x19, #40]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
LBB0_2:
	bl	_dev_err
Lloh16:
	adrp	x8, _EBUSY@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_7
LBB0_3:
	ldr	x8, [x19, #16]
	ldr	w0, [x8]
Lloh19:
	adrp	x8, _DMA_PREP_INTERRUPT@GOTPAGE
Lloh20:
	ldr	x8, [x8, _DMA_PREP_INTERRUPT@GOTPAGEOFF]
	ldr	w3, [sp, #24]
Lloh21:
	ldr	w8, [x8]
Lloh22:
	adrp	x9, _DMA_CTRL_ACK@GOTPAGE
Lloh23:
	ldr	x9, [x9, _DMA_CTRL_ACK@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	orr	w4, w9, w8
	mov	x1, x20
	mov	x2, x22
	bl	_dmaengine_prep_slave_sg
	cbz	x0, LBB0_8
; %bb.4:
Lloh25:
	adrp	x8, _dw_mci_dmac_complete_dma@GOTPAGE
Lloh26:
	ldr	x8, [x8, _dw_mci_dmac_complete_dma@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	str	w8, [x0, #8]
	str	x19, [x0]
	bl	_dmaengine_submit
	ldr	x8, [x19, #32]
	ldr	w8, [x8, #4]
	ldr	w9, [x23]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.5:
	ldr	x8, [x19, #24]
	ldr	w0, [x8]
	bl	_mmc_dev
Lloh28:
	adrp	x8, _DMA_TO_DEVICE@GOTPAGE
Lloh29:
	ldr	x8, [x8, _DMA_TO_DEVICE@GOTPAGEOFF]
Lloh30:
	ldr	w3, [x8]
	mov	x1, x20
	mov	x2, x21
	bl	_dma_sync_sg_for_device
LBB0_6:
	ldr	x8, [x19, #16]
	ldr	w0, [x8]
	bl	_dma_async_issue_pending
	mov	w0, #0
LBB0_7:
	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
	add	sp, sp, #112
	ret
LBB0_8:
	ldr	w0, [x19, #40]
Lloh31:
	adrp	x1, l_.str.1@PAGE
Lloh32:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_2
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @dw_mci_edmac_start_dma.mszs
_dw_mci_edmac_start_dma.mszs:
	.long	1                               ; 0x1
	.long	4                               ; 0x4
	.long	8                               ; 0x8
	.long	16                              ; 0x10
	.long	32                              ; 0x20
	.long	64                              ; 0x40
	.long	128                             ; 0x80
	.long	256                             ; 0x100

	.comm	_DMA_SLAVE_BUSWIDTH_4_BYTES,8,3 ; @DMA_SLAVE_BUSWIDTH_4_BYTES
	.comm	_FIFOTH,4,2                     ; @FIFOTH
	.comm	_MMC_DATA_WRITE,4,2             ; @MMC_DATA_WRITE
	.comm	_DMA_MEM_TO_DEV,4,2             ; @DMA_MEM_TO_DEV
	.comm	_DMA_DEV_TO_MEM,4,2             ; @DMA_DEV_TO_MEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to config edmac.\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_DMA_PREP_INTERRUPT,4,2         ; @DMA_PREP_INTERRUPT
	.comm	_DMA_CTRL_ACK,4,2               ; @DMA_CTRL_ACK
l_.str.1:                               ; @.str.1
	.asciz	"Can't prepare slave sg.\n"

	.comm	_dw_mci_dmac_complete_dma,4,2   ; @dw_mci_dmac_complete_dma
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.no_dead_strip	_dw_mci_edmac_start_dma
.subsections_via_symbols
