	.file	"extr_3w-9xxx.c_twa_post_command_packet.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	twa_post_command_packet, @function
twa_post_command_packet:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movsx	r15, esi
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13d, edx
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, r15
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 8
	.cfi_def_cfa_offset 64
	mov	rax, QWORD PTR [rdi]
	mov	r14d, DWORD PTR [rax+r15*4]
	mov	rax, QWORD PTR 64[rdi]
	mov	rax, QWORD PTR [rax]
	cmp	rax, QWORD PTR PCI_DEVICE_ID_3WARE_9650SE[rip]
	je	.L2
	cmp	rax, QWORD PTR PCI_DEVICE_ID_3WARE_9690SA[rip]
	je	.L2
.L3:
	mov	rdi, rbp
	call	TW_STATUS_REG_ADDR@PLT
	mov	edi, eax
	call	readl@PLT
	mov	edi, eax
	mov	ebx, eax
	call	twa_check_bits@PLT
	test	rax, rax
	jne	.L22
.L4:
	cmp	QWORD PTR 8[rbp], 0
	jle	.L5
	mov	rax, QWORD PTR 16[rbp]
	mov	rdx, QWORD PTR TW_S_PENDING[rip]
	lea	rax, [rax+r15*8]
	cmp	QWORD PTR [rax], rdx
	je	.L5
	test	r13b, r13b
	jne	.L16
.L15:
	mov	ebx, DWORD PTR SCSI_MLQUEUE_HOST_BUSY[rip]
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, ebx
	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
.L5:
	.cfi_restore_state
	and	ebx, DWORD PTR TW_STATUS_COMMAND_QUEUE_FULL[rip]
	jne	.L23
	mov	rax, QWORD PTR 64[rbp]
	mov	rdi, rbp
	mov	rax, QWORD PTR [rax]
	cmp	rax, QWORD PTR PCI_DEVICE_ID_3WARE_9650SE[rip]
	je	.L12
	cmp	rax, QWORD PTR PCI_DEVICE_ID_3WARE_9690SA[rip]
	jne	.L13
.L12:
	call	TW_COMMAND_QUEUE_REG_ADDR_LARGE@PLT
	mov	edi, r14d
	mov	ecx, 32
	lea	rsi, 4[rax]
	sar	edi, cl
	call	writel@PLT
.L14:
	mov	rax, QWORD PTR 16[rbp]
	mov	rdx, QWORD PTR TW_S_POSTED[rip]
	mov	QWORD PTR [rax+r15*8], rdx
	mov	rax, QWORD PTR 48[rbp]
	add	rax, 1
	mov	QWORD PTR 48[rbp], rax
	cmp	rax, QWORD PTR 56[rbp]
	jle	.L1
.L9:
	endbr64
	mov	QWORD PTR 56[rbp], rax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L23:
	test	r13b, r13b
	je	.L15
	mov	rax, QWORD PTR 16[rbp]
	mov	rdx, QWORD PTR TW_S_PENDING[rip]
	lea	rax, [rax+r15*8]
	cmp	QWORD PTR [rax], rdx
	je	.L10
	.p2align 4,,10
	.p2align 3
.L16:
	mov	QWORD PTR [rax], rdx
	mov	rax, QWORD PTR 8[rbp]
	add	rax, 1
	mov	QWORD PTR 8[rbp], rax
	cmp	rax, QWORD PTR 24[rbp]
	jg	.L24
.L11:
	mov	rax, QWORD PTR 40[rbp]
	mov	rdx, QWORD PTR 32[rbp]
	mov	DWORD PTR [rdx+rax*4], r12d
	movsx	rcx, DWORD PTR TW_Q_LENGTH[rip]
	add	rax, 1
	xor	edx, edx
	div	rcx
	mov	QWORD PTR 40[rbp], rdx
.L10:
	mov	rdi, rbp
	mov	ebx, 1
	call	TW_UNMASK_COMMAND_INTERRUPT@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	mov	rdi, rbp
	add	r14d, DWORD PTR TW_COMMAND_OFFSET[rip]
	call	TW_COMMAND_QUEUE_REG_ADDR_LARGE@PLT
	mov	edi, r14d
	mov	rsi, rax
	call	writel@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L22:
	mov	esi, ebx
	mov	rdi, rbp
	call	twa_decode_bits@PLT
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L13:
	call	TW_COMMAND_QUEUE_REG_ADDR@PLT
	mov	edi, DWORD PTR TW_COMMAND_OFFSET[rip]
	mov	rsi, rax
	add	edi, r14d
	call	writel@PLT
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L24:
	mov	QWORD PTR 24[rbp], rax
	jmp	.L11
	.cfi_endproc
.LFE0:
	.size	twa_post_command_packet, .-twa_post_command_packet
	.comm	TW_S_POSTED,8,8
	.comm	TW_S_PENDING,8,8
	.comm	TW_STATUS_COMMAND_QUEUE_FULL,4,4
	.comm	TW_Q_LENGTH,4,4
	.comm	TW_COMMAND_OFFSET,4,4
	.comm	SCSI_MLQUEUE_HOST_BUSY,4,4
	.comm	PCI_DEVICE_ID_3WARE_9690SA,8,8
	.comm	PCI_DEVICE_ID_3WARE_9650SE,8,8
	.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_3w-9xxx.c_twa_post_command_packet.c"
	.text
	.global	__aeabi_uidivmod
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	twa_post_command_packet, %function
twa_post_command_packet:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r4, r0
	mov	r5, r1
	ldr	r3, [r0, #32]
	ldr	r9, .L27
	ldr	r3, [r3]
	ldr	r0, [r9]
	ldr	r1, [r4]
	cmp	r3, r0
	mov	r7, r2
	ldr	r8, [r1, r5, lsl #2]
	lsl	r10, r5, #2
	beq	.L2
	ldr	r2, .L27+4
	ldr	r2, [r2]
	cmp	r3, r2
	beq	.L2
.L3:
	mov	r0, r4
	bl	TW_STATUS_REG_ADDR
	bl	readl
	mov	r6, r0
	bl	twa_check_bits
	cmp	r0, #0
	bne	.L25
.L4:
	ldr	r3, [r4, #4]
	cmp	r3, #0
	ble	.L5
	ldr	r3, [r4, #8]
	ldr	r2, .L27+8
	ldr	r1, [r3, r5, lsl #2]
	ldr	r2, [r2]
	add	r3, r3, r10
	cmp	r1, r2
	beq	.L5
	cmp	r7, #0
	bne	.L16
.L15:
	ldr	r3, .L27+12
	ldr	r6, [r3]
	mov	r0, r6
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L5:
	ldr	r3, .L27+16
	ldr	r0, [r3]
	ands	r6, r6, r0
	bne	.L26
	ldr	r3, [r4, #32]
	ldr	r2, [r9]
	ldr	r3, [r3]
	cmp	r3, r2
	beq	.L12
	ldr	r2, .L27+4
	ldr	r2, [r2]
	cmp	r3, r2
	bne	.L13
.L12:
	mov	r0, r4
	bl	TW_COMMAND_QUEUE_REG_ADDR_LARGE
	mov	r3, #32
	add	r1, r0, #4
	asr	r0, r8, r3
	bl	writel
.L14:
.L9:
	ldr	r2, .L27+20
	ldr	r3, [r4, #8]
	ldr	r2, [r2]
	mov	r0, r6
	str	r2, [r3, r5, lsl #2]
	ldr	r3, [r4, #24]
	ldr	r2, [r4, #28]
	add	r3, r3, #1
	cmp	r3, r2
	str	r3, [r4, #24]
	strgt	r3, [r4, #28]
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L26:
	cmp	r7, #0
	beq	.L15
	ldr	r3, [r4, #8]
	ldr	r2, .L27+8
	ldr	r1, [r3, r5, lsl #2]
	ldr	r2, [r2]
	add	r3, r3, r10
	cmp	r1, r2
	beq	.L10
.L16:
	str	r2, [r3]
	ldr	r3, [r4, #4]
	ldr	r2, [r4, #12]
	add	r3, r3, #1
	cmp	r3, r2
	ldr	r0, [r4, #20]
	ldr	r2, [r4, #16]
	str	r3, [r4, #4]
	strgt	r3, [r4, #12]
	ldr	r3, .L27+24
	str	r5, [r2, r0, lsl #2]
	ldr	r1, [r3]
	add	r0, r0, #1
	bl	__aeabi_uidivmod
	str	r1, [r4, #20]
.L10:
	mov	r6, #1
	mov	r0, r4
	bl	TW_UNMASK_COMMAND_INTERRUPT
	mov	r0, r6
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L2:
	ldr	r3, .L27+28
	mov	r0, r4
	ldr	r3, [r3]
	add	r8, r8, r3
	bl	TW_COMMAND_QUEUE_REG_ADDR_LARGE
	mov	r1, r0
	mov	r0, r8
	bl	writel
	b	.L3
.L25:
	mov	r1, r6
	mov	r0, r4
	bl	twa_decode_bits
	b	.L4
.L13:
	ldr	r3, .L27+28
	mov	r0, r4
	ldr	r3, [r3]
	add	r8, r8, r3
	bl	TW_COMMAND_QUEUE_REG_ADDR
	mov	r1, r0
	mov	r0, r8
	bl	writel
	b	.L14
.L28:
	.align	2
.L27:
	.word	PCI_DEVICE_ID_3WARE_9650SE
	.word	PCI_DEVICE_ID_3WARE_9690SA
	.word	TW_S_PENDING
	.word	SCSI_MLQUEUE_HOST_BUSY
	.word	TW_STATUS_COMMAND_QUEUE_FULL
	.word	TW_S_POSTED
	.word	TW_Q_LENGTH
	.word	TW_COMMAND_OFFSET
	.size	twa_post_command_packet, .-twa_post_command_packet
	.comm	TW_S_POSTED,4,4
	.comm	TW_S_PENDING,4,4
	.comm	TW_STATUS_COMMAND_QUEUE_FULL,4,4
	.comm	TW_Q_LENGTH,4,4
	.comm	TW_COMMAND_OFFSET,4,4
	.comm	SCSI_MLQUEUE_HOST_BUSY,4,4
	.comm	PCI_DEVICE_ID_3WARE_9690SA,4,4
	.comm	PCI_DEVICE_ID_3WARE_9650SE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
