	.file	"extr_rt2661.c_rt2661_alloc_tx_ring.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"could not create desc DMA tag\n"
	.align 8
.LC1:
	.string	"could not allocate DMA memory\n"
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"could not load desc DMA map\n"
.LC3:
	.string	"could not allocate soft data\n"
	.section	.rodata.str1.8
	.align 8
.LC4:
	.string	"could not create data DMA tag\n"
	.section	.rodata.str1.1
.LC5:
	.string	"could not create DMA map\n"
	.text
	.p2align 4
	.type	rt2661_alloc_tx_ring, @function
rt2661_alloc_tx_ring:
.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
	mov	r13, rdi
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rsi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	ebx, edx
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	DWORD PTR [rsi], edx
	mov	edi, DWORD PTR [rdi]
	mov	QWORD PTR 64[rsi], 0
	mov	r12d, DWORD PTR RT2661_TX_DESC_SIZE[rip]
	mov	QWORD PTR 40[rsi], 0
	mov	r15d, DWORD PTR BUS_SPACE_MAXADDR[rip]
	mov	QWORD PTR 48[rsi], 0
	imul	r12d, edx
	mov	r14d, DWORD PTR BUS_SPACE_MAXADDR_32BIT[rip]
	mov	QWORD PTR 56[rsi], 0
	call	bus_get_dma_tag@PLT
	xor	r9d, r9d
	mov	r8d, r15d
	mov	ecx, r14d
	mov	edi, eax
	lea	rax, 32[rbp]
	xor	edx, edx
	mov	esi, 4
	push	rax
	.cfi_def_cfa_offset 88
	push	0
	.cfi_def_cfa_offset 96
	push	0
	.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
	jne	.L16
	mov	edi, DWORD PTR 32[rbp]
	mov	edx, DWORD PTR BUS_DMA_NOWAIT[rip]
	lea	rcx, 28[rbp]
	lea	rsi, 24[rbp]
	or	edx, DWORD PTR BUS_DMA_ZERO[rip]
	call	bus_dmamem_alloc@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L17
	sub	rsp, 8
	.cfi_def_cfa_offset 88
	mov	edx, DWORD PTR 24[rbp]
	mov	esi, DWORD PTR 28[rbp]
	lea	r9, 20[rbp]
	mov	ecx, DWORD PTR RT2661_TX_DESC_SIZE[rip]
	mov	edi, DWORD PTR 32[rbp]
	push	0
	.cfi_def_cfa_offset 96
	mov	r8d, DWORD PTR rt2661_dma_map_addr[rip]
	imul	ecx, ebx
	call	bus_dmamap_load@PLT
	mov	r12d, eax
	pop	rax
	.cfi_def_cfa_offset 88
	pop	rdx
	.cfi_def_cfa_offset 80
	test	r12d, r12d
	jne	.L18
	mov	esi, DWORD PTR M_DEVBUF[rip]
	mov	edx, DWORD PTR M_NOWAIT[rip]
	lea	edi, 0[0+rbx*4]
	or	edx, DWORD PTR M_ZERO[rip]
	call	malloc@PLT
	mov	QWORD PTR 8[rbp], rax
	test	rax, rax
	je	.L19
	mov	edx, DWORD PTR RT2661_MAX_SCATTER[rip]
	mov	edi, DWORD PTR 0[r13]
	mov	r12d, DWORD PTR MCLBYTES[rip]
	mov	r15d, DWORD PTR BUS_SPACE_MAXADDR[rip]
	mov	DWORD PTR 12[rsp], edx
	mov	r14d, DWORD PTR BUS_SPACE_MAXADDR_32BIT[rip]
	call	bus_get_dma_tag@PLT
	xor	r9d, r9d
	mov	r8d, r15d
	mov	esi, 1
	mov	edi, eax
	lea	rax, 16[rbp]
	mov	ecx, r14d
	push	rax
	.cfi_def_cfa_offset 88
	push	0
	.cfi_def_cfa_offset 96
	push	0
	.cfi_def_cfa_offset 104
	push	0
	.cfi_def_cfa_offset 112
	push	r12
	.cfi_def_cfa_offset 120
	mov	edx, DWORD PTR 52[rsp]
	push	rdx
	.cfi_def_cfa_offset 128
	xor	edx, edx
	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
	mov	r12d, eax
	test	eax, eax
	jne	.L7
	test	ebx, ebx
	jle	.L1
	lea	eax, -1[rbx]
	xor	r15d, r15d
	lea	r14, 4[0+rax*4]
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L10:
	add	r15, 4
	cmp	r15, r14
	je	.L1
.L11:
	mov	rdx, QWORD PTR 8[rbp]
	mov	edi, DWORD PTR 16[rbp]
	xor	esi, esi
	add	rdx, r15
	call	bus_dmamap_create@PLT
	mov	ebx, eax
	test	eax, eax
	je	.L10
	mov	edi, DWORD PTR 0[r13]
	lea	rsi, .LC5[rip]
	mov	r12d, ebx
	call	device_printf@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L17:
	mov	edi, DWORD PTR 0[r13]
	lea	rsi, .LC1[rip]
	call	device_printf@PLT
.L3:
	mov	rsi, rbp
	mov	rdi, r13
	call	rt2661_free_tx_ring@PLT
.L1:
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r12d
	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
.L16:
	.cfi_restore_state
	mov	edi, DWORD PTR 0[r13]
	lea	rsi, .LC0[rip]
	mov	r12d, eax
	call	device_printf@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L18:
	mov	edi, DWORD PTR 0[r13]
	lea	rsi, .LC2[rip]
	call	device_printf@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L19:
	mov	edi, DWORD PTR 0[r13]
	lea	rsi, .LC3[rip]
	call	device_printf@PLT
	mov	r12d, DWORD PTR ENOMEM[rip]
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	mov	edi, DWORD PTR 0[r13]
	lea	rsi, .LC4[rip]
	call	device_printf@PLT
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	rt2661_alloc_tx_ring, .-rt2661_alloc_tx_ring
	.comm	rt2661_dma_map_addr,4,4
	.comm	RT2661_TX_DESC_SIZE,4,4
	.comm	RT2661_MAX_SCATTER,4,4
	.comm	M_ZERO,4,4
	.comm	M_NOWAIT,4,4
	.comm	M_DEVBUF,4,4
	.comm	MCLBYTES,4,4
	.comm	ENOMEM,4,4
	.comm	BUS_SPACE_MAXADDR_32BIT,4,4
	.comm	BUS_SPACE_MAXADDR,4,4
	.comm	BUS_DMA_ZERO,4,4
	.comm	BUS_DMA_NOWAIT,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_rt2661.c_rt2661_alloc_tx_ring.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"could not create desc DMA tag\012\000"
	.align	2
.LC1:
	.ascii	"could not allocate DMA memory\012\000"
	.align	2
.LC2:
	.ascii	"could not load desc DMA map\012\000"
	.align	2
.LC3:
	.ascii	"could not allocate soft data\012\000"
	.align	2
.LC4:
	.ascii	"could not create data DMA tag\012\000"
	.align	2
.LC5:
	.ascii	"could not create DMA map\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	rt2661_alloc_tx_ring, %function
rt2661_alloc_tx_ring:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r5, #0
	mov	r6, r2
	mov	r4, r1
	mov	r9, #1
	ldr	r8, .L20
	sub	sp, sp, #44
	str	r2, [r1]
	str	r5, [r1, #40]
	str	r5, [r1, #28]
	str	r5, [r1, #32]
	str	r5, [r1, #36]
	mov	r7, r0
	ldr	r0, [r0]
	bl	bus_get_dma_tag
	ldr	r3, [r8]
	ldr	fp, .L20+4
	mul	r3, r6, r3
	ldr	r1, [fp]
	ldr	r10, .L20+8
	add	ip, r4, #24
	mov	r2, r5
	str	r5, [sp, #32]
	str	r5, [sp, #28]
	str	r5, [sp, #24]
	str	r5, [sp, #8]
	str	r5, [sp, #4]
	str	r3, [sp, #20]
	str	r3, [sp, #12]
	str	r1, [sp]
	ldr	r3, [r10]
	mov	r1, #4
	str	ip, [sp, #36]
	str	r9, [sp, #16]
	bl	bus_dma_tag_create
	subs	r5, r0, #0
	bne	.L16
	ldr	r2, .L20+12
	ldr	r3, .L20+16
	ldr	r1, [r2]
	ldr	r2, [r3]
	ldr	r0, [r4, #24]
	orr	r2, r1, r2
	add	r3, r4, #20
	add	r1, r4, #16
	bl	bus_dmamem_alloc
	subs	r5, r0, #0
	bne	.L17
	ldr	r2, .L20+20
	ldr	r3, [r8]
	ldr	r1, [r2]
	add	r2, r4, #12
	stm	sp, {r1, r2, r5}
	mul	r3, r6, r3
	ldr	r2, [r4, #16]
	ldr	r1, [r4, #20]
	ldr	r0, [r4, #24]
	bl	bus_dmamap_load
	subs	r5, r0, #0
	bne	.L18
	ldr	r2, .L20+24
	ldr	r3, .L20+28
	ldr	r1, [r2]
	ldr	r2, [r3]
	ldr	r3, .L20+32
	orr	r2, r1, r2
	lsl	r0, r6, #2
	ldr	r1, [r3]
	bl	malloc
	cmp	r0, #0
	str	r0, [r4, #4]
	beq	.L19
	ldr	r0, [r7]
	bl	bus_get_dma_tag
	ldr	r1, .L20+36
	ldr	r2, .L20+40
	ldr	ip, [r1]
	ldr	lr, [r2]
	ldr	r3, [fp]
	str	ip, [sp, #20]
	str	ip, [sp, #12]
	add	ip, r4, #8
	mov	r2, r5
	str	r3, [sp]
	str	r5, [sp, #32]
	str	r5, [sp, #28]
	str	r5, [sp, #24]
	str	r5, [sp, #8]
	str	r5, [sp, #4]
	mov	r1, r9
	ldr	r3, [r10]
	str	lr, [sp, #16]
	str	ip, [sp, #36]
	bl	bus_dma_tag_create
	subs	r5, r0, #0
	bne	.L7
	cmp	r6, #0
	movgt	r8, r5
	bgt	.L8
	b	.L1
.L10:
	cmp	r6, r8
	beq	.L1
.L8:
	ldr	r2, [r4, #4]
	mov	r1, #0
	add	r2, r2, r8, lsl #2
	ldr	r0, [r4, #8]
	bl	bus_dmamap_create
	subs	r3, r0, #0
	add	r8, r8, #1
	beq	.L10
	ldr	r1, .L20+44
	ldr	r0, [r7]
	mov	r5, r3
	bl	device_printf
	b	.L3
.L17:
	ldr	r1, .L20+48
	ldr	r0, [r7]
	bl	device_printf
.L3:
	mov	r1, r4
	mov	r0, r7
	bl	rt2661_free_tx_ring
.L1:
	mov	r0, r5
	add	sp, sp, #44
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L16:
	ldr	r1, .L20+52
	ldr	r0, [r7]
	bl	device_printf
	b	.L3
.L18:
	ldr	r1, .L20+56
	ldr	r0, [r7]
	bl	device_printf
	b	.L3
.L19:
	ldr	r1, .L20+60
	ldr	r0, [r7]
	bl	device_printf
	ldr	r3, .L20+64
	ldr	r5, [r3]
	b	.L3
.L7:
	ldr	r1, .L20+68
	ldr	r0, [r7]
	bl	device_printf
	b	.L3
.L21:
	.align	2
.L20:
	.word	RT2661_TX_DESC_SIZE
	.word	BUS_SPACE_MAXADDR
	.word	BUS_SPACE_MAXADDR_32BIT
	.word	BUS_DMA_NOWAIT
	.word	BUS_DMA_ZERO
	.word	rt2661_dma_map_addr
	.word	M_NOWAIT
	.word	M_ZERO
	.word	M_DEVBUF
	.word	MCLBYTES
	.word	RT2661_MAX_SCATTER
	.word	.LC5
	.word	.LC1
	.word	.LC0
	.word	.LC2
	.word	.LC3
	.word	ENOMEM
	.word	.LC4
	.size	rt2661_alloc_tx_ring, .-rt2661_alloc_tx_ring
	.comm	rt2661_dma_map_addr,4,4
	.comm	RT2661_TX_DESC_SIZE,4,4
	.comm	RT2661_MAX_SCATTER,4,4
	.comm	M_ZERO,4,4
	.comm	M_NOWAIT,4,4
	.comm	M_DEVBUF,4,4
	.comm	MCLBYTES,4,4
	.comm	ENOMEM,4,4
	.comm	BUS_SPACE_MAXADDR_32BIT,4,4
	.comm	BUS_SPACE_MAXADDR,4,4
	.comm	BUS_DMA_ZERO,4,4
	.comm	BUS_DMA_NOWAIT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
