	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bgmac_dma_alloc
_bgmac_dma_alloc:                       ## @bgmac_dma_alloc
	.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, %r13
	movq	24(%rdi), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	_BGMAC_MAX_TX_RINGS@GOTPCREL(%rip), %rbx
	movl	(%rbx), %r15d
	leaq	_bgmac_dma_alloc.ring_base(%rip), %r14
	movq	%r14, %rdi
	callq	_ARRAY_SIZE
	xorl	%edi, %edi
	cmpl	%eax, %r15d
	setg	%dil
	callq	_BUILD_BUG_ON
	movq	_BGMAC_MAX_RX_RINGS@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	%r14, %rdi
	callq	_ARRAY_SIZE
	xorl	%edi, %edi
	cmpl	%eax, %r15d
	setg	%dil
	callq	_BUILD_BUG_ON
	movq	_BGMAC_FEAT_IDM_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r13)
	jne	LBB0_2
## %bb.1:
	movq	_BCMA_IOST@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_bgmac_idm_read
	movq	_BCMA_IOST_DMA64@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_21
LBB0_2:
	cmpl	$0, (%rbx)
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	jle	LBB0_9
## %bb.3:
	leaq	_bgmac_dma_alloc.ring_base(%rip), %rdx
	movl	$24, %r14d
	xorl	%r12d, %r12d
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_6 Depth=1
	movl	(%rbx), %edi
	callq	_lower_32_bits
LBB0_5:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	_BGMAC_MAX_TX_RINGS@GOTPCREL(%rip), %rcx
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movq	%rax, -24(%r13,%r14)
	incq	%r12
	movslq	(%rcx), %rax
	addq	$4, %rdx
	addq	$40, %r14
	cmpq	%rax, %r12
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	jge	LBB0_9
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %r15
	movq	16(%r13), %r13
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	movl	(%rdx), %eax
	movl	%eax, (%r13,%r14)
	movq	_BGMAC_TX_RING_SLOTS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	shll	$2, %esi
	leaq	(%r14,%r13), %rbx
	addq	$-16, %rbx
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_dma_alloc_coherent
	movq	%rax, 8(%r13,%r14)
	testq	%rax, %rax
	je	LBB0_16
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	leaq	(%r14,%r13), %rsi
	addq	$-24, %rsi
	movq	_BGMAC_DMA_RING_TX@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_bgmac_dma_unaligned
	movq	%rax, -8(%r13,%r14)
	testq	%rax, %rax
	jne	LBB0_4
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	xorl	%eax, %eax
	jmp	LBB0_5
LBB0_9:
	movq	_BGMAC_MAX_RX_RINGS@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_18
## %bb.10:
	movl	$24, %ebx
	xorl	%r15d, %r15d
	leaq	_bgmac_dma_alloc.ring_base(%rip), %rcx
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_13 Depth=1
	movl	(%r14), %edi
	callq	_lower_32_bits
LBB0_12:                                ##   in Loop: Header=BB0_13 Depth=1
	movq	%rax, -24(%r13,%rbx)
	incq	%r15
	movq	_BGMAC_MAX_RX_RINGS@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	addq	$4, %rcx
	addq	$40, %rbx
	cmpq	%rax, %r15
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	jge	LBB0_18
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	%r13, %r12
	movq	8(%r13), %r13
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movl	(%rcx), %eax
	movl	%eax, (%r13,%rbx)
	movq	_BGMAC_RX_RING_SLOTS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	shll	$2, %esi
	leaq	(%rbx,%r13), %r14
	addq	$-16, %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rdx
	callq	_dma_alloc_coherent
	movq	%rax, 8(%r13,%rbx)
	testq	%rax, %rax
	je	LBB0_19
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	leaq	(%rbx,%r13), %rsi
	addq	$-24, %rsi
	movq	_BGMAC_DMA_RING_RX@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_bgmac_dma_unaligned
	movq	%rax, -8(%r13,%rbx)
	testq	%rax, %rax
	jne	LBB0_11
## %bb.15:                              ##   in Loop: Header=BB0_13 Depth=1
	xorl	%eax, %eax
	jmp	LBB0_12
LBB0_18:
	xorl	%ebx, %ebx
	jmp	LBB0_23
LBB0_16:
	addq	%r14, %r13
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_20
LBB0_19:
	addq	%rbx, %r13
	leaq	L_.str.2(%rip), %rsi
LBB0_20:
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movl	4(%r14), %edi
	movl	(%r13), %edx
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r14, %rdi
	callq	_bgmac_dma_free
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_22
LBB0_21:
	movl	4(%r13), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_ENOTSUPP@GOTPCREL(%rip), %rax
LBB0_22:
	subl	(%rax), %ebx
LBB0_23:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	4                               ## @bgmac_dma_alloc.ring_base
_bgmac_dma_alloc.ring_base:
	.long	131                             ## 0x83
	.long	130                             ## 0x82
	.long	129                             ## 0x81
	.long	128                             ## 0x80

	.comm	_BGMAC_MAX_TX_RINGS,4,2         ## @BGMAC_MAX_TX_RINGS
	.comm	_BGMAC_MAX_RX_RINGS,4,2         ## @BGMAC_MAX_RX_RINGS
	.comm	_BGMAC_FEAT_IDM_MASK,4,2        ## @BGMAC_FEAT_IDM_MASK
	.comm	_BCMA_IOST,4,2                  ## @BCMA_IOST
	.comm	_BCMA_IOST_DMA64,4,2            ## @BCMA_IOST_DMA64
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Core does not report 64-bit DMA\n"

	.comm	_ENOTSUPP,4,2                   ## @ENOTSUPP
	.comm	_BGMAC_TX_RING_SLOTS,4,2        ## @BGMAC_TX_RING_SLOTS
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.1:                               ## @.str.1
	.asciz	"Allocation of TX ring 0x%X failed\n"

	.comm	_BGMAC_DMA_RING_TX,4,2          ## @BGMAC_DMA_RING_TX
	.comm	_BGMAC_RX_RING_SLOTS,4,2        ## @BGMAC_RX_RING_SLOTS
L_.str.2:                               ## @.str.2
	.asciz	"Allocation of RX ring 0x%X failed\n"

	.comm	_BGMAC_DMA_RING_RX,4,2          ## @BGMAC_DMA_RING_RX
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_bgmac_dma_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bgmac_dma_alloc
_bgmac_dma_alloc:                       ; @bgmac_dma_alloc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	ldr	x20, [x0, #24]
Lloh0:
	adrp	x25, _BGMAC_MAX_TX_RINGS@GOTPAGE
Lloh1:
	ldr	x25, [x25, _BGMAC_MAX_TX_RINGS@GOTPAGEOFF]
	ldr	w21, [x25]
Lloh2:
	adrp	x22, _bgmac_dma_alloc.ring_base@PAGE
Lloh3:
	add	x22, x22, _bgmac_dma_alloc.ring_base@PAGEOFF
	mov	x0, x22
	bl	_ARRAY_SIZE
	cmp	w21, w0
	cset	w0, gt
	bl	_BUILD_BUG_ON
Lloh4:
	adrp	x8, _BGMAC_MAX_RX_RINGS@GOTPAGE
Lloh5:
	ldr	x8, [x8, _BGMAC_MAX_RX_RINGS@GOTPAGEOFF]
Lloh6:
	ldr	w21, [x8]
	mov	x0, x22
	bl	_ARRAY_SIZE
	cmp	w21, w0
	cset	w0, gt
	bl	_BUILD_BUG_ON
	ldr	w8, [x19]
Lloh7:
	adrp	x9, _BGMAC_FEAT_IDM_MASK@GOTPAGE
Lloh8:
	ldr	x9, [x9, _BGMAC_FEAT_IDM_MASK@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_2
; %bb.1:
Lloh10:
	adrp	x8, _BCMA_IOST@GOTPAGE
Lloh11:
	ldr	x8, [x8, _BCMA_IOST@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_bgmac_idm_read
Lloh13:
	adrp	x8, _BCMA_IOST_DMA64@GOTPAGE
Lloh14:
	ldr	x8, [x8, _BCMA_IOST_DMA64@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_18
LBB0_2:
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_8
; %bb.3:
	mov	x27, #0
	mov	x28, #0
Lloh16:
	adrp	x24, _BGMAC_TX_RING_SLOTS@GOTPAGE
Lloh17:
	ldr	x24, [x24, _BGMAC_TX_RING_SLOTS@GOTPAGEOFF]
Lloh18:
	adrp	x26, _BGMAC_DMA_RING_TX@GOTPAGE
Lloh19:
	ldr	x26, [x26, _BGMAC_DMA_RING_TX@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	str	x0, [x21, x27]
	add	x28, x28, #1
	ldrsw	x8, [x25]
	add	x27, x27, #40
	cmp	x28, x8
	b.ge	LBB0_8
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x21, [x19, #16]
Lloh20:
	adrp	x8, _bgmac_dma_alloc.ring_base@PAGE
Lloh21:
	add	x8, x8, _bgmac_dma_alloc.ring_base@PAGEOFF
	ldr	w8, [x8, x28, lsl #2]
	add	x22, x21, x27
	str	w8, [x22, #24]
	ldr	w8, [x24]
	lsl	w1, w8, #2
	add	x23, x22, #8
Lloh22:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh23:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh24:
	ldr	w3, [x8]
	mov	x0, x20
	mov	x2, x23
	bl	_dma_alloc_coherent
	str	x0, [x22, #32]
	cbz	x0, LBB0_15
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w2, [x26]
	mov	x0, x19
	mov	x1, x22
	bl	_bgmac_dma_unaligned
	str	x0, [x22, #16]
	cbz	x0, LBB0_4
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w0, [x23]
	bl	_lower_32_bits
	b	LBB0_4
LBB0_8:
Lloh25:
	adrp	x8, _BGMAC_MAX_RX_RINGS@GOTPAGE
Lloh26:
	ldr	x8, [x8, _BGMAC_MAX_RX_RINGS@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.9:
	mov	x26, #0
	mov	x27, #0
Lloh28:
	adrp	x24, _BGMAC_RX_RING_SLOTS@GOTPAGE
Lloh29:
	ldr	x24, [x24, _BGMAC_RX_RING_SLOTS@GOTPAGEOFF]
Lloh30:
	adrp	x28, _BGMAC_DMA_RING_RX@GOTPAGE
Lloh31:
	ldr	x28, [x28, _BGMAC_DMA_RING_RX@GOTPAGEOFF]
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	str	x0, [x21, x26]
	add	x27, x27, #1
Lloh32:
	adrp	x8, _BGMAC_MAX_RX_RINGS@GOTPAGE
Lloh33:
	ldr	x8, [x8, _BGMAC_MAX_RX_RINGS@GOTPAGEOFF]
Lloh34:
	ldrsw	x8, [x8]
	add	x26, x26, #40
	cmp	x27, x8
	b.ge	LBB0_14
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x21, [x19, #8]
Lloh35:
	adrp	x8, _bgmac_dma_alloc.ring_base@PAGE
Lloh36:
	add	x8, x8, _bgmac_dma_alloc.ring_base@PAGEOFF
	ldr	w8, [x8, x27, lsl #2]
	add	x22, x21, x26
	str	w8, [x22, #24]
	ldr	w8, [x24]
	lsl	w1, w8, #2
	add	x23, x22, #8
Lloh37:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh38:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh39:
	ldr	w3, [x8]
	mov	x0, x20
	mov	x2, x23
	bl	_dma_alloc_coherent
	str	x0, [x22, #32]
	cbz	x0, LBB0_16
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	w2, [x28]
	mov	x0, x19
	mov	x1, x22
	bl	_bgmac_dma_unaligned
	str	x0, [x22, #16]
	cbz	x0, LBB0_10
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	w0, [x23]
	bl	_lower_32_bits
	b	LBB0_10
LBB0_14:
	mov	w0, #0
	b	LBB0_20
LBB0_15:
	add	x8, x22, #24
Lloh40:
	adrp	x1, l_.str.1@PAGE
Lloh41:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_17
LBB0_16:
	add	x8, x22, #24
Lloh42:
	adrp	x1, l_.str.2@PAGE
Lloh43:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_17:
	ldr	w0, [x19, #4]
	ldr	w8, [x8]
	str	x8, [sp]
	bl	_dev_err
	mov	x0, x19
	bl	_bgmac_dma_free
Lloh44:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh45:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_19
LBB0_18:
	ldr	w0, [x19, #4]
Lloh46:
	adrp	x1, l_.str@PAGE
Lloh47:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh48:
	adrp	x8, _ENOTSUPP@GOTPAGE
Lloh49:
	ldr	x8, [x8, _ENOTSUPP@GOTPAGEOFF]
LBB0_19:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_20:
	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
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpLdrGot	Lloh44, Lloh45
	.loh AdrpLdrGot	Lloh48, Lloh49
	.loh AdrpAdd	Lloh46, Lloh47
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @bgmac_dma_alloc.ring_base
_bgmac_dma_alloc.ring_base:
	.long	131                             ; 0x83
	.long	130                             ; 0x82
	.long	129                             ; 0x81
	.long	128                             ; 0x80

	.comm	_BGMAC_MAX_TX_RINGS,4,2         ; @BGMAC_MAX_TX_RINGS
	.comm	_BGMAC_MAX_RX_RINGS,4,2         ; @BGMAC_MAX_RX_RINGS
	.comm	_BGMAC_FEAT_IDM_MASK,4,2        ; @BGMAC_FEAT_IDM_MASK
	.comm	_BCMA_IOST,4,2                  ; @BCMA_IOST
	.comm	_BCMA_IOST_DMA64,4,2            ; @BCMA_IOST_DMA64
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Core does not report 64-bit DMA\n"

	.comm	_ENOTSUPP,4,2                   ; @ENOTSUPP
	.comm	_BGMAC_TX_RING_SLOTS,4,2        ; @BGMAC_TX_RING_SLOTS
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.1:                               ; @.str.1
	.asciz	"Allocation of TX ring 0x%X failed\n"

	.comm	_BGMAC_DMA_RING_TX,4,2          ; @BGMAC_DMA_RING_TX
	.comm	_BGMAC_RX_RING_SLOTS,4,2        ; @BGMAC_RX_RING_SLOTS
l_.str.2:                               ; @.str.2
	.asciz	"Allocation of RX ring 0x%X failed\n"

	.comm	_BGMAC_DMA_RING_RX,4,2          ; @BGMAC_DMA_RING_RX
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_bgmac_dma_alloc
.subsections_via_symbols
