	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kvaser_pciefd_setup_dma
_kvaser_pciefd_setup_dma:               ## @kvaser_pciefd_setup_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_KVASER_PCIEFD_DMA_COUNT@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, -56(%rbp)                 ## 8-byte Spill
	movq	_KVASER_PCIEFD_SRB_CTRL_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r15), %rsi
	xorl	%ebx, %ebx
	xorl	%edi, %edi
	callq	_iowrite32
	cmpl	$0, (%r14)
	jle	LBB0_5
## %bb.1:
	xorl	%r12d, %r12d
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	_KVASER_PCIEFD_DMA_MAP_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	addl	%ebx, %r13d
	movq	8(%r15), %rdi
	movq	_KVASER_PCIEFD_DMA_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rbx
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%r12), %r15
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r15, %rdx
	callq	_dmam_alloc_coherent
	movq	%rbx, %rdx
	movq	16(%rbx), %rcx
	movl	%eax, (%rcx,%r12)
	testl	%eax, %eax
	je	LBB0_7
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r15), %esi
	testl	%esi, %esi
	je	LBB0_7
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rdx, %r15
	movq	%rdx, %rdi
	movl	%r13d, %edx
	callq	_kvaser_pciefd_write_dma_map
	incq	%r14
	movq	_KVASER_PCIEFD_DMA_COUNT@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	addl	$8, %ebx
	addq	$4, %r12
	cmpq	%rax, %r14
	jl	LBB0_2
LBB0_5:
	movq	_KVASER_PCIEFD_SRB_CMD_FOR@GOTPCREL(%rip), %rax
	movq	_KVASER_PCIEFD_SRB_CMD_RDB0@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	movq	_KVASER_PCIEFD_SRB_CMD_RDB1@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_KVASER_PCIEFD_SRB_CMD_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r15), %rsi
	callq	_iowrite32
	movq	_KVASER_PCIEFD_SRB_STAT_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	(%r15), %rdi
	callq	_ioread32
	movq	_KVASER_PCIEFD_SRB_STAT_DI@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_8
## %bb.6:
	movq	_KVASER_PCIEFD_SRB_CTRL_DMA_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_KVASER_PCIEFD_SRB_CTRL_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r15), %rsi
	callq	_iowrite32
	xorl	%ebx, %ebx
	jmp	LBB0_10
LBB0_7:
	movq	8(%rdx), %rdi
	movq	_KVASER_PCIEFD_DMA_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_8:
	movq	8(%r15), %rdi
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_9:
	subl	(%rax), %ebx
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_12
## %bb.11:
	movl	%ebx, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_KVASER_PCIEFD_DMA_COUNT,4,2    ## @KVASER_PCIEFD_DMA_COUNT
	.comm	_KVASER_PCIEFD_SRB_CTRL_REG,8,3 ## @KVASER_PCIEFD_SRB_CTRL_REG
	.comm	_KVASER_PCIEFD_DMA_MAP_BASE,4,2 ## @KVASER_PCIEFD_DMA_MAP_BASE
	.comm	_KVASER_PCIEFD_DMA_SIZE,4,2     ## @KVASER_PCIEFD_DMA_SIZE
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Rx dma_alloc(%u) failure\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_KVASER_PCIEFD_SRB_CMD_FOR,4,2  ## @KVASER_PCIEFD_SRB_CMD_FOR
	.comm	_KVASER_PCIEFD_SRB_CMD_RDB0,4,2 ## @KVASER_PCIEFD_SRB_CMD_RDB0
	.comm	_KVASER_PCIEFD_SRB_CMD_RDB1,4,2 ## @KVASER_PCIEFD_SRB_CMD_RDB1
	.comm	_KVASER_PCIEFD_SRB_CMD_REG,8,3  ## @KVASER_PCIEFD_SRB_CMD_REG
	.comm	_KVASER_PCIEFD_SRB_STAT_REG,8,3 ## @KVASER_PCIEFD_SRB_STAT_REG
	.comm	_KVASER_PCIEFD_SRB_STAT_DI,4,2  ## @KVASER_PCIEFD_SRB_STAT_DI
L_.str.1:                               ## @.str.1
	.asciz	"DMA not idle before enabling\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_KVASER_PCIEFD_SRB_CTRL_DMA_ENABLE,4,2 ## @KVASER_PCIEFD_SRB_CTRL_DMA_ENABLE
	.no_dead_strip	_kvaser_pciefd_setup_dma
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kvaser_pciefd_setup_dma
_kvaser_pciefd_setup_dma:               ; @kvaser_pciefd_setup_dma
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	sub	sp, sp, #16
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
Lloh3:
	adrp	x20, _KVASER_PCIEFD_DMA_COUNT@GOTPAGE
Lloh4:
	ldr	x20, [x20, _KVASER_PCIEFD_DMA_COUNT@GOTPAGEOFF]
	ldr	w8, [x20]
	lsl	x8, x8, #2
	mov	x9, x8
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x7fffffff0
	sub	x23, x9, x8
	mov	sp, x23
	ldr	x8, [x0]
Lloh7:
	adrp	x9, _KVASER_PCIEFD_SRB_CTRL_REG@GOTPAGE
Lloh8:
	ldr	x9, [x9, _KVASER_PCIEFD_SRB_CTRL_REG@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #0
	bl	_iowrite32
	ldr	w8, [x20]
	cmp	w8, #1
	b.lt	LBB0_5
; %bb.1:
	mov	x24, #0
	mov	w25, #0
	mov	x26, #0
Lloh10:
	adrp	x28, _KVASER_PCIEFD_DMA_MAP_BASE@GOTPAGE
Lloh11:
	ldr	x28, [x28, _KVASER_PCIEFD_DMA_MAP_BASE@GOTPAGEOFF]
Lloh12:
	adrp	x27, _KVASER_PCIEFD_DMA_SIZE@GOTPAGE
Lloh13:
	ldr	x27, [x27, _KVASER_PCIEFD_DMA_SIZE@GOTPAGEOFF]
Lloh14:
	adrp	x21, _GFP_KERNEL@GOTPAGE
Lloh15:
	ldr	x21, [x21, _GFP_KERNEL@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w22, [x28]
	ldr	x0, [x19, #8]
	ldr	w1, [x27]
	add	x20, x23, x24
	ldr	w3, [x21]
	mov	x2, x20
	bl	_dmam_alloc_coherent
	ldr	x8, [x19, #16]
	str	w0, [x8, x24]
	cbz	w0, LBB0_7
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w1, [x20]
	cbz	w1, LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	add	w2, w25, w22
	mov	x0, x19
	bl	_kvaser_pciefd_write_dma_map
	add	x26, x26, #1
Lloh16:
	adrp	x8, _KVASER_PCIEFD_DMA_COUNT@GOTPAGE
Lloh17:
	ldr	x8, [x8, _KVASER_PCIEFD_DMA_COUNT@GOTPAGEOFF]
Lloh18:
	ldrsw	x8, [x8]
	add	w25, w25, #8
	add	x24, x24, #4
	cmp	x26, x8
	b.lt	LBB0_2
LBB0_5:
Lloh19:
	adrp	x8, _KVASER_PCIEFD_SRB_CMD_FOR@GOTPAGE
Lloh20:
	ldr	x8, [x8, _KVASER_PCIEFD_SRB_CMD_FOR@GOTPAGEOFF]
Lloh21:
	adrp	x9, _KVASER_PCIEFD_SRB_CMD_RDB0@GOTPAGE
Lloh22:
	ldr	x9, [x9, _KVASER_PCIEFD_SRB_CMD_RDB0@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
Lloh24:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh25:
	adrp	x9, _KVASER_PCIEFD_SRB_CMD_RDB1@GOTPAGE
Lloh26:
	ldr	x9, [x9, _KVASER_PCIEFD_SRB_CMD_RDB1@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	orr	w0, w8, w9
	ldr	x8, [x19]
Lloh28:
	adrp	x9, _KVASER_PCIEFD_SRB_CMD_REG@GOTPAGE
Lloh29:
	ldr	x9, [x9, _KVASER_PCIEFD_SRB_CMD_REG@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_iowrite32
	ldr	x8, [x19]
Lloh31:
	adrp	x9, _KVASER_PCIEFD_SRB_STAT_REG@GOTPAGE
Lloh32:
	ldr	x9, [x9, _KVASER_PCIEFD_SRB_STAT_REG@GOTPAGEOFF]
Lloh33:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_ioread32
Lloh34:
	adrp	x8, _KVASER_PCIEFD_SRB_STAT_DI@GOTPAGE
Lloh35:
	ldr	x8, [x8, _KVASER_PCIEFD_SRB_STAT_DI@GOTPAGEOFF]
Lloh36:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_8
; %bb.6:
Lloh37:
	adrp	x8, _KVASER_PCIEFD_SRB_CTRL_DMA_ENABLE@GOTPAGE
Lloh38:
	ldr	x8, [x8, _KVASER_PCIEFD_SRB_CTRL_DMA_ENABLE@GOTPAGEOFF]
Lloh39:
	ldr	w0, [x8]
	ldr	x8, [x19]
Lloh40:
	adrp	x9, _KVASER_PCIEFD_SRB_CTRL_REG@GOTPAGE
Lloh41:
	ldr	x9, [x9, _KVASER_PCIEFD_SRB_CTRL_REG@GOTPAGEOFF]
Lloh42:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_iowrite32
	mov	w0, #0
	b	LBB0_10
LBB0_7:
	ldr	x0, [x19, #8]
	ldr	w8, [x27]
	str	x8, [sp, #-16]!
Lloh43:
	adrp	x1, l_.str@PAGE
Lloh44:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	add	sp, sp, #16
Lloh45:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh46:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_9
LBB0_8:
	ldr	x0, [x19, #8]
Lloh47:
	adrp	x1, l_.str.1@PAGE
Lloh48:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
Lloh49:
	adrp	x8, _EIO@GOTPAGE
Lloh50:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	ldur	x8, [x29, #-88]
Lloh51:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh52:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh53:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_12
; %bb.11:
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_12:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh23
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh45, Lloh46
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpLdrGot	Lloh49, Lloh50
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.cfi_endproc
                                        ; -- End function
	.comm	_KVASER_PCIEFD_DMA_COUNT,4,2    ; @KVASER_PCIEFD_DMA_COUNT
	.comm	_KVASER_PCIEFD_SRB_CTRL_REG,8,3 ; @KVASER_PCIEFD_SRB_CTRL_REG
	.comm	_KVASER_PCIEFD_DMA_MAP_BASE,4,2 ; @KVASER_PCIEFD_DMA_MAP_BASE
	.comm	_KVASER_PCIEFD_DMA_SIZE,4,2     ; @KVASER_PCIEFD_DMA_SIZE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Rx dma_alloc(%u) failure\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_KVASER_PCIEFD_SRB_CMD_FOR,4,2  ; @KVASER_PCIEFD_SRB_CMD_FOR
	.comm	_KVASER_PCIEFD_SRB_CMD_RDB0,4,2 ; @KVASER_PCIEFD_SRB_CMD_RDB0
	.comm	_KVASER_PCIEFD_SRB_CMD_RDB1,4,2 ; @KVASER_PCIEFD_SRB_CMD_RDB1
	.comm	_KVASER_PCIEFD_SRB_CMD_REG,8,3  ; @KVASER_PCIEFD_SRB_CMD_REG
	.comm	_KVASER_PCIEFD_SRB_STAT_REG,8,3 ; @KVASER_PCIEFD_SRB_STAT_REG
	.comm	_KVASER_PCIEFD_SRB_STAT_DI,4,2  ; @KVASER_PCIEFD_SRB_STAT_DI
l_.str.1:                               ; @.str.1
	.asciz	"DMA not idle before enabling\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_KVASER_PCIEFD_SRB_CTRL_DMA_ENABLE,4,2 ; @KVASER_PCIEFD_SRB_CTRL_DMA_ENABLE
	.no_dead_strip	_kvaser_pciefd_setup_dma
.subsections_via_symbols
