	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atiixp_set_dma_mode
_atiixp_set_dma_mode:                   ## @atiixp_set_dma_mode
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	%rdi, %r15
	movq	8(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %r14
	movl	(%r15), %r12d
	movl	$0, -44(%rbp)
	movq	_atiixp_lock@GOTPCREL(%rip), %rdi
	callq	_spin_lock_irqsave
	movq	_ATIIXP_IDE_UDMA_CONTROL@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	leaq	-44(%rbp), %rdx
	movq	%r14, %rdi
	callq	_pci_read_config_word
	movq	_XFER_UDMA_0@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jle	LBB0_1
## %bb.2:
	movq	_XFER_MW_DMA_0@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jle	LBB0_4
## %bb.3:
	movl	-44(%rbp), %edx
	jmp	LBB0_6
LBB0_1:
	movq	_ATIIXP_IDE_UDMA_MODE@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	leaq	-52(%rbp), %rdx
	movq	%r14, %rdi
	callq	_pci_read_config_word
	movb	(%r15), %cl
	shlb	$2, %cl
	movl	$7, %eax
	shll	%cl, %eax
	notl	%eax
	andl	-52(%rbp), %eax
	andl	$7, %ebx
	shll	%cl, %ebx
	orl	%eax, %ebx
	movl	%ebx, -52(%rbp)
	movl	(%r12), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_pci_write_config_word
	movb	(%r15), %al
	movl	-44(%rbp), %edx
	btsl	%eax, %edx
	jmp	LBB0_5
LBB0_4:
	shll	$3, %r12d
	xorl	$8, %r12d
	andl	$3, %ebx
	movq	_ATIIXP_IDE_MDMA_TIMING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r14, %rdi
	callq	_pci_read_config_dword
	movl	$255, %eax
	movl	%r12d, %ecx
	shll	%cl, %eax
	notl	%eax
	andl	-48(%rbp), %eax
	movl	%eax, -48(%rbp)
	movq	_mdma_timing@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rcx,%rbx,8), %edx
	movl	4(%rcx,%rbx,8), %esi
	movl	%r12d, %ecx
	shll	%cl, %edx
	orb	$4, %r12b
	movl	%r12d, %ecx
	shll	%cl, %esi
	orl	%eax, %edx
	orl	%esi, %edx
	movl	%edx, -48(%rbp)
	movq	_ATIIXP_IDE_MDMA_TIMING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_pci_write_config_dword
	movb	(%r15), %al
	movl	-44(%rbp), %edx
	btrl	%eax, %edx
LBB0_5:
	movl	%edx, -44(%rbp)
LBB0_6:
	movl	(%r13), %esi
	movq	%r14, %rdi
	callq	_pci_write_config_word
	movq	_atiixp_lock@GOTPCREL(%rip), %rdi
	callq	_spin_unlock_irqrestore
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_atiixp_lock,4,2                ## @atiixp_lock
	.comm	_ATIIXP_IDE_UDMA_CONTROL,4,2    ## @ATIIXP_IDE_UDMA_CONTROL
	.comm	_XFER_UDMA_0,4,2                ## @XFER_UDMA_0
	.comm	_ATIIXP_IDE_UDMA_MODE,4,2       ## @ATIIXP_IDE_UDMA_MODE
	.comm	_XFER_MW_DMA_0,4,2              ## @XFER_MW_DMA_0
	.comm	_ATIIXP_IDE_MDMA_TIMING,4,2     ## @ATIIXP_IDE_MDMA_TIMING
	.comm	_mdma_timing,8,3                ## @mdma_timing
	.no_dead_strip	_atiixp_set_dma_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atiixp_set_dma_mode
_atiixp_set_dma_mode:                   ; @atiixp_set_dma_mode
	.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	x21, x1
	mov	x20, x0
	ldr	x8, [x0, #8]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x19, x0
	ldr	w23, [x20]
	str	wzr, [sp, #4]
Lloh0:
	adrp	x0, _atiixp_lock@GOTPAGE
Lloh1:
	ldr	x0, [x0, _atiixp_lock@GOTPAGEOFF]
	bl	_spin_lock_irqsave
Lloh2:
	adrp	x22, _ATIIXP_IDE_UDMA_CONTROL@GOTPAGE
Lloh3:
	ldr	x22, [x22, _ATIIXP_IDE_UDMA_CONTROL@GOTPAGEOFF]
	ldr	w1, [x22]
	add	x2, sp, #4
	mov	x0, x19
	bl	_pci_read_config_word
Lloh4:
	adrp	x8, _XFER_UDMA_0@GOTPAGE
Lloh5:
	ldr	x8, [x8, _XFER_UDMA_0@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cmp	w8, w21
	b.le	LBB0_3
; %bb.1:
Lloh7:
	adrp	x8, _XFER_MW_DMA_0@GOTPAGE
Lloh8:
	ldr	x8, [x8, _XFER_MW_DMA_0@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	cmp	w8, w21
	b.le	LBB0_4
; %bb.2:
	ldr	w2, [sp, #4]
	b	LBB0_6
LBB0_3:
Lloh10:
	adrp	x23, _ATIIXP_IDE_UDMA_MODE@GOTPAGE
Lloh11:
	ldr	x23, [x23, _ATIIXP_IDE_UDMA_MODE@GOTPAGEOFF]
	ldr	w1, [x23]
	add	x2, sp, #8
	mov	x0, x19
	bl	_pci_read_config_word
	ldr	w8, [x20]
	lsl	w8, w8, #2
	mov	w9, #7
	lsl	w9, w9, w8
	ldr	w10, [sp, #8]
	bic	w9, w10, w9
	and	w10, w21, #0x7
	lsl	w8, w10, w8
	orr	w2, w9, w8
	str	w2, [sp, #8]
	ldr	w1, [x23]
	mov	x0, x19
	bl	_pci_write_config_word
	ldr	w8, [x20]
	mov	w9, #1
	lsl	w8, w9, w8
	ldr	w9, [sp, #4]
	orr	w2, w9, w8
	b	LBB0_5
LBB0_4:
	lsl	w8, w23, #3
	eor	w23, w8, #0x8
	and	w21, w21, #0x3
Lloh12:
	adrp	x24, _ATIIXP_IDE_MDMA_TIMING@GOTPAGE
Lloh13:
	ldr	x24, [x24, _ATIIXP_IDE_MDMA_TIMING@GOTPAGEOFF]
	ldr	w1, [x24]
	add	x2, sp, #12
	mov	x0, x19
	bl	_pci_read_config_dword
	mov	w8, #255
	lsl	w8, w8, w23
	ldr	w9, [sp, #12]
	bic	w8, w9, w8
Lloh14:
	adrp	x9, _mdma_timing@GOTPAGE
Lloh15:
	ldr	x9, [x9, _mdma_timing@GOTPAGEOFF]
	str	w8, [sp, #12]
Lloh16:
	ldr	x9, [x9]
	add	x9, x9, w21, uxtw #3
	ldp	w10, w9, [x9]
	lsl	w10, w10, w23
	orr	w11, w23, #0x4
	lsl	w9, w9, w11
	orr	w8, w10, w8
	orr	w2, w8, w9
	str	w2, [sp, #12]
	ldr	w1, [x24]
	mov	x0, x19
	bl	_pci_write_config_dword
	ldr	w8, [x20]
	mov	w9, #1
	lsl	w8, w9, w8
	ldr	w9, [sp, #4]
	bic	w2, w9, w8
LBB0_5:
	str	w2, [sp, #4]
LBB0_6:
	ldr	w1, [x22]
	mov	x0, x19
	bl	_pci_write_config_word
Lloh17:
	adrp	x0, _atiixp_lock@GOTPAGE
Lloh18:
	ldr	x0, [x0, _atiixp_lock@GOTPAGEOFF]
	bl	_spin_unlock_irqrestore
	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
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_atiixp_lock,4,2                ; @atiixp_lock
	.comm	_ATIIXP_IDE_UDMA_CONTROL,4,2    ; @ATIIXP_IDE_UDMA_CONTROL
	.comm	_XFER_UDMA_0,4,2                ; @XFER_UDMA_0
	.comm	_ATIIXP_IDE_UDMA_MODE,4,2       ; @ATIIXP_IDE_UDMA_MODE
	.comm	_XFER_MW_DMA_0,4,2              ; @XFER_MW_DMA_0
	.comm	_ATIIXP_IDE_MDMA_TIMING,4,2     ; @ATIIXP_IDE_MDMA_TIMING
	.comm	_mdma_timing,8,3                ; @mdma_timing
	.no_dead_strip	_atiixp_set_dma_mode
.subsections_via_symbols
