	.file	"extr_if_cgem.c_cgem_setup_descs.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	cgem_setup_descs, @function
cgem_setup_descs:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	lea	rbp, 124[rdi]
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdi
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	QWORD PTR 24[rdi], 0
	mov	r12d, DWORD PTR MAX_DESC_RING_SIZE[rip]
	mov	QWORD PTR 88[rdi], 0
	mov	edi, DWORD PTR 128[rdi]
	mov	r15d, DWORD PTR busdma_lock_mutex[rip]
	mov	r14d, DWORD PTR BUS_SPACE_MAXADDR[rip]
	mov	r13d, DWORD PTR BUS_SPACE_MAXADDR_32BIT[rip]
	call	bus_get_dma_tag@PLT
	xor	r9d, r9d
	mov	r8d, r14d
	xor	edx, edx
	mov	edi, eax
	lea	rax, 56[rbx]
	mov	ecx, r13d
	mov	esi, 1
	push	rax
	.cfi_def_cfa_offset 88
	push	rbp
	.cfi_def_cfa_offset 96
	push	r15
	.cfi_def_cfa_offset 104
	push	0
	.cfi_def_cfa_offset 112
	push	r12
	.cfi_def_cfa_offset 120
	push	1
	.cfi_def_cfa_offset 128
	push	r12
	.cfi_def_cfa_offset 136
	push	0
	.cfi_def_cfa_offset 144
	call	bus_dma_tag_create@PLT
	add	rsp, 64
	.cfi_def_cfa_offset 80
	test	eax, eax
	je	.L15
.L1:
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	mov	edx, DWORD PTR busdma_lock_mutex[rip]
	mov	edi, DWORD PTR 128[rbx]
	mov	r12d, DWORD PTR MCLBYTES[rip]
	mov	r15d, DWORD PTR TX_MAX_DMA_SEGS[rip]
	mov	DWORD PTR 12[rsp], edx
	mov	r14d, DWORD PTR BUS_SPACE_MAXADDR[rip]
	mov	r13d, DWORD PTR BUS_SPACE_MAXADDR_32BIT[rip]
	call	bus_get_dma_tag@PLT
	xor	r9d, r9d
	mov	r8d, r14d
	mov	esi, 1
	mov	edi, eax
	lea	rax, 120[rbx]
	mov	ecx, r13d
	push	rax
	.cfi_def_cfa_offset 88
	push	rbp
	.cfi_def_cfa_offset 96
	mov	edx, DWORD PTR 28[rsp]
	push	rdx
	.cfi_def_cfa_offset 104
	xor	edx, edx
	push	0
	.cfi_def_cfa_offset 112
	push	r12
	.cfi_def_cfa_offset 120
	push	r15
	.cfi_def_cfa_offset 128
	push	r12
	.cfi_def_cfa_offset 136
	push	0
	.cfi_def_cfa_offset 144
	call	bus_dma_tag_create@PLT
	add	rsp, 64
	.cfi_def_cfa_offset 80
	test	eax, eax
	jne	.L1
	mov	edi, DWORD PTR 56[rbx]
	mov	edx, DWORD PTR BUS_DMA_NOWAIT[rip]
	lea	rcx, 116[rbx]
	lea	rsi, 88[rbx]
	or	edx, DWORD PTR BUS_DMA_COHERENT[rip]
	call	bus_dmamem_alloc@PLT
	test	eax, eax
	jne	.L1
	sub	rsp, 8
	.cfi_def_cfa_offset 88
	mov	esi, DWORD PTR 116[rbx]
	mov	edi, DWORD PTR 56[rbx]
	lea	r9, 112[rbx]
	mov	eax, DWORD PTR CGEM_NUM_RX_DESCS[rip]
	mov	rdx, QWORD PTR 88[rbx]
	mov	r8d, DWORD PTR cgem_getaddr[rip]
	lea	ecx, 0[0+rax*4]
	mov	eax, DWORD PTR BUS_DMA_NOWAIT[rip]
	push	rax
	.cfi_def_cfa_offset 96
	call	bus_dmamap_load@PLT
	pop	rsi
	.cfi_def_cfa_offset 88
	pop	rdi
	.cfi_def_cfa_offset 80
	test	eax, eax
	jne	.L1
	movsx	r9, DWORD PTR CGEM_NUM_RX_DESCS[rip]
	mov	rdx, QWORD PTR 88[rbx]
	test	r9d, r9d
	jle	.L6
	lea	eax, -1[r9]
	mov	r8d, DWORD PTR CGEM_RXDESC_OWN[rip]
	mov	rdi, QWORD PTR 104[rbx]
	mov	rsi, QWORD PTR 96[rbx]
	lea	rcx, 8[0+rax*8]
	xor	eax, eax
	.p2align 4,,10
	.p2align 3
.L5:
	mov	DWORD PTR [rdx+rax*2], r8d
	mov	QWORD PTR 8[rdx+rax*2], 0
	mov	QWORD PTR [rdi+rax], 0
	mov	QWORD PTR [rsi+rax], 0
	add	rax, 8
	cmp	rax, rcx
	jne	.L5
.L6:
	sal	r9, 4
	mov	edi, DWORD PTR 56[rbx]
	lea	rcx, 52[rbx]
	lea	rsi, 24[rbx]
	mov	eax, DWORD PTR CGEM_RXDESC_WRAP[rip]
	or	DWORD PTR -16[rdx+r9], eax
	mov	QWORD PTR 80[rbx], 0
	mov	edx, DWORD PTR BUS_DMA_NOWAIT[rip]
	mov	QWORD PTR 72[rbx], 0
	or	edx, DWORD PTR BUS_DMA_COHERENT[rip]
	mov	QWORD PTR 64[rbx], 0
	call	bus_dmamem_alloc@PLT
	test	eax, eax
	jne	.L1
	sub	rsp, 8
	.cfi_def_cfa_offset 88
	mov	rdx, QWORD PTR 24[rbx]
	mov	esi, DWORD PTR 52[rbx]
	lea	r9, 48[rbx]
	mov	eax, DWORD PTR CGEM_NUM_TX_DESCS[rip]
	mov	edi, DWORD PTR 56[rbx]
	mov	r8d, DWORD PTR cgem_getaddr[rip]
	lea	ecx, 0[0+rax*4]
	mov	eax, DWORD PTR BUS_DMA_NOWAIT[rip]
	push	rax
	.cfi_def_cfa_offset 96
	call	bus_dmamap_load@PLT
	pop	rdx
	.cfi_def_cfa_offset 88
	pop	rcx
	.cfi_def_cfa_offset 80
	test	eax, eax
	jne	.L1
	movsx	r10, DWORD PTR CGEM_NUM_TX_DESCS[rip]
	mov	rcx, QWORD PTR 24[rbx]
	test	r10d, r10d
	jle	.L9
	lea	edx, -1[r10]
	mov	r9d, DWORD PTR CGEM_TXDESC_USED[rip]
	mov	r8, QWORD PTR 40[rbx]
	mov	rdi, QWORD PTR 32[rbx]
	lea	rsi, 8[0+rdx*8]
	xor	edx, edx
	.p2align 4,,10
	.p2align 3
.L8:
	mov	QWORD PTR 8[rcx+rdx*2], 0
	mov	DWORD PTR [rcx+rdx*2], r9d
	mov	QWORD PTR [r8+rdx], 0
	mov	QWORD PTR [rdi+rdx], 0
	add	rdx, 8
	cmp	rsi, rdx
	jne	.L8
.L9:
	sal	r10, 4
	mov	edx, DWORD PTR CGEM_TXDESC_WRAP[rip]
	or	DWORD PTR -16[rcx+r10], edx
	mov	QWORD PTR 16[rbx], 0
	mov	QWORD PTR 8[rbx], 0
	mov	QWORD PTR [rbx], 0
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	cgem_setup_descs, .-cgem_setup_descs
	.comm	cgem_getaddr,4,4
	.comm	busdma_lock_mutex,4,4
	.comm	TX_MAX_DMA_SEGS,4,4
	.comm	MCLBYTES,4,4
	.comm	MAX_DESC_RING_SIZE,4,4
	.comm	CGEM_TXDESC_WRAP,4,4
	.comm	CGEM_TXDESC_USED,4,4
	.comm	CGEM_RXDESC_WRAP,4,4
	.comm	CGEM_RXDESC_OWN,4,4
	.comm	CGEM_NUM_TX_DESCS,4,4
	.comm	CGEM_NUM_RX_DESCS,4,4
	.comm	BUS_SPACE_MAXADDR_32BIT,4,4
	.comm	BUS_SPACE_MAXADDR,4,4
	.comm	BUS_DMA_NOWAIT,4,4
	.comm	BUS_DMA_COHERENT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_if_cgem.c_cgem_setup_descs.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	cgem_setup_descs, %function
cgem_setup_descs:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r4, #0
	mov	r5, r0
	mov	r6, #1
	sub	sp, sp, #40
	str	r4, [r0, #12]
	str	r4, [r0, #48]
	ldr	r0, [r0, #76]
	bl	bus_get_dma_tag
	ldr	r9, .L16
	ldr	r3, .L16+4
	ldr	r8, .L16+8
	ldr	r3, [r3]
	ldr	r1, [r8]
	ldr	ip, [r9]
	ldr	r10, .L16+12
	add	lr, r5, #32
	add	r7, r5, #72
	mov	r2, r4
	str	r4, [sp, #24]
	str	r4, [sp, #8]
	str	r4, [sp, #4]
	str	r3, [sp, #20]
	str	r3, [sp, #12]
	str	r1, [sp]
	ldr	r3, [r10]
	mov	r1, r6
	str	r7, [sp, #32]
	str	lr, [sp, #36]
	str	ip, [sp, #28]
	str	r6, [sp, #16]
	bl	bus_dma_tag_create
	subs	r4, r0, #0
	beq	.L15
.L1:
	mov	r0, r4
	add	sp, sp, #40
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L15:
	ldr	r0, [r5, #76]
	bl	bus_get_dma_tag
	ldr	ip, .L16+16
	ldr	r1, .L16+20
	ldr	r3, [r8]
	ldr	r2, [r9]
	ldr	lr, [ip]
	ldr	r8, [r1]
	add	ip, r5, #68
	str	r2, [sp, #28]
	str	r3, [sp]
	mov	r2, r4
	str	r4, [sp, #24]
	str	r4, [sp, #8]
	str	r4, [sp, #4]
	mov	r1, r6
	ldr	r3, [r10]
	str	r7, [sp, #32]
	str	lr, [sp, #20]
	str	lr, [sp, #12]
	str	r8, [sp, #16]
	str	ip, [sp, #36]
	bl	bus_dma_tag_create
	subs	r4, r0, #0
	bne	.L1
	ldr	r6, .L16+24
	ldr	r7, .L16+28
	ldr	r1, [r6]
	ldr	r2, [r7]
	ldr	r0, [r5, #32]
	orr	r2, r1, r2
	add	r3, r5, #64
	add	r1, r5, #48
	bl	bus_dmamem_alloc
	subs	r4, r0, #0
	bne	.L1
	ldr	r8, .L16+32
	ldr	r9, .L16+36
	ldr	r0, [r8]
	ldr	r1, [r6]
	ldr	r3, [r9]
	add	r2, r5, #60
	str	r0, [sp]
	str	r1, [sp, #8]
	str	r2, [sp, #4]
	ldr	r2, [r5, #48]
	ldr	r1, [r5, #64]
	ldr	r0, [r5, #32]
	lsl	r3, r3, #2
	bl	bus_dmamap_load
	subs	r4, r0, #0
	bne	.L1
	ldr	lr, [r9]
	ldr	r9, [r5, #48]
	cmp	lr, #0
	ble	.L6
	mov	r3, r9
	ldr	ip, .L16+40
	ldr	r1, [r5, #56]
	ldr	r2, [r5, #52]
	mov	r0, r4
	sub	r1, r1, #4
	ldr	r4, [ip]
	sub	r2, r2, #4
	add	ip, r9, lr, lsl #3
.L5:
	str	r4, [r3]
	str	r0, [r3, #4]
	add	r3, r3, #8
	cmp	r3, ip
	str	r0, [r1, #4]!
	str	r0, [r2, #4]!
	bne	.L5
.L6:
	mov	r3, #0
	ldr	r2, .L16+44
	sub	lr, lr, #-536870911
	ldr	r1, [r9, lr, lsl #3]
	ldr	r0, [r2]
	ldr	r2, [r7]
	orr	r1, r1, r0
	ldr	r0, [r6]
	str	r1, [r9, lr, lsl #3]
	orr	r2, r0, r2
	str	r3, [r5, #44]
	str	r3, [r5, #40]
	str	r3, [r5, #36]
	ldr	r0, [r5, #32]
	add	r3, r5, #28
	add	r1, r5, #12
	bl	bus_dmamem_alloc
	subs	r4, r0, #0
	bne	.L1
	ldr	r7, .L16+48
	ldr	r0, [r6]
	ldr	r1, [r8]
	ldr	r3, [r7]
	add	r2, r5, #24
	str	r0, [sp, #8]
	str	r1, [sp]
	str	r2, [sp, #4]
	ldr	r2, [r5, #12]
	ldr	r1, [r5, #28]
	ldr	r0, [r5, #32]
	lsl	r3, r3, #2
	bl	bus_dmamap_load
	subs	r4, r0, #0
	bne	.L1
	ldr	r6, [r7]
	ldr	r7, [r5, #12]
	cmp	r6, #0
	ble	.L9
	mov	r3, r7
	mov	r2, r4
	ldr	ip, .L16+52
	ldr	r0, [r5, #20]
	ldr	r1, [r5, #16]
	ldr	lr, [ip]
	sub	r0, r0, #4
	sub	r1, r1, #4
	add	ip, r7, r6, lsl #3
.L8:
	str	r2, [r3, #4]
	str	lr, [r3], #8
	cmp	ip, r3
	str	r2, [r0, #4]!
	str	r2, [r1, #4]!
	bne	.L8
.L9:
	mov	r3, #0
	ldr	r1, .L16+56
	sub	r6, r6, #-536870911
	ldr	r2, [r7, r6, lsl #3]
	ldr	r1, [r1]
	orr	r2, r2, r1
	str	r2, [r7, r6, lsl #3]
	str	r3, [r5, #8]
	str	r3, [r5, #4]
	str	r3, [r5]
	b	.L1
.L17:
	.align	2
.L16:
	.word	busdma_lock_mutex
	.word	MAX_DESC_RING_SIZE
	.word	BUS_SPACE_MAXADDR
	.word	BUS_SPACE_MAXADDR_32BIT
	.word	MCLBYTES
	.word	TX_MAX_DMA_SEGS
	.word	BUS_DMA_NOWAIT
	.word	BUS_DMA_COHERENT
	.word	cgem_getaddr
	.word	CGEM_NUM_RX_DESCS
	.word	CGEM_RXDESC_OWN
	.word	CGEM_RXDESC_WRAP
	.word	CGEM_NUM_TX_DESCS
	.word	CGEM_TXDESC_USED
	.word	CGEM_TXDESC_WRAP
	.size	cgem_setup_descs, .-cgem_setup_descs
	.comm	cgem_getaddr,4,4
	.comm	busdma_lock_mutex,4,4
	.comm	TX_MAX_DMA_SEGS,4,4
	.comm	MCLBYTES,4,4
	.comm	MAX_DESC_RING_SIZE,4,4
	.comm	CGEM_TXDESC_WRAP,4,4
	.comm	CGEM_TXDESC_USED,4,4
	.comm	CGEM_RXDESC_WRAP,4,4
	.comm	CGEM_RXDESC_OWN,4,4
	.comm	CGEM_NUM_TX_DESCS,4,4
	.comm	CGEM_NUM_RX_DESCS,4,4
	.comm	BUS_SPACE_MAXADDR_32BIT,4,4
	.comm	BUS_SPACE_MAXADDR,4,4
	.comm	BUS_DMA_NOWAIT,4,4
	.comm	BUS_DMA_COHERENT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
