	.file	"extr_megaraid.c_mega_setup_mailbox.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	mega_setup_mailbox, @function
mega_setup_mailbox:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rdi
	mov	edi, DWORD PTR 48[rdi]
	mov	esi, 4
	mov	rdx, rbp
	call	pci_alloc_consistent@PLT
	mov	QWORD PTR 24[rbp], rax
	test	rax, rax
	je	.L3
	lea	rdx, 15[rax]
	and	rdx, -16
	lea	rcx, -8[rdx]
	mov	QWORD PTR 32[rbp], rdx
	sub	rdx, rax
	mov	eax, DWORD PTR 8[rbp]
	mov	QWORD PTR 40[rbp], rcx
	mov	ecx, DWORD PTR 0[rbp]
	lea	edi, 8[rcx+rdx]
	mov	DWORD PTR 4[rbp], edi
	and	eax, DWORD PTR BOARD_IOMAP[rip]
	jne	.L9
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	mov	rax, QWORD PTR 16[rbp]
	mov	rsi, QWORD PTR MBOX_PORT0[rip]
	movzx	edi, dil
	add	rsi, QWORD PTR [rax]
	call	outb@PLT
	mov	rax, QWORD PTR 16[rbp]
	movzx	edi, BYTE PTR 5[rbp]
	mov	rsi, QWORD PTR MBOX_PORT1[rip]
	add	rsi, QWORD PTR [rax]
	call	outb@PLT
	mov	rax, QWORD PTR 16[rbp]
	movzx	edi, BYTE PTR 6[rbp]
	mov	rsi, QWORD PTR MBOX_PORT2[rip]
	add	rsi, QWORD PTR [rax]
	call	outb@PLT
	mov	rax, QWORD PTR 16[rbp]
	movzx	edi, BYTE PTR 7[rbp]
	mov	rsi, QWORD PTR MBOX_PORT3[rip]
	add	rsi, QWORD PTR [rax]
	call	outb@PLT
	mov	rax, QWORD PTR 16[rbp]
	mov	edi, DWORD PTR ENABLE_MBOX_BYTE[rip]
	mov	rsi, QWORD PTR ENABLE_MBOX_REGION[rip]
	add	rsi, QWORD PTR [rax]
	call	outb@PLT
	mov	rdi, rbp
	call	irq_ack@PLT
	mov	rdi, rbp
	call	irq_enable@PLT
	xor	eax, eax
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L3:
	.cfi_restore_state
	mov	eax, -1
	pop	rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	mega_setup_mailbox, .-mega_setup_mailbox
	.comm	MBOX_PORT3,8,8
	.comm	MBOX_PORT2,8,8
	.comm	MBOX_PORT1,8,8
	.comm	MBOX_PORT0,8,8
	.comm	ENABLE_MBOX_REGION,8,8
	.comm	ENABLE_MBOX_BYTE,4,4
	.comm	BOARD_IOMAP,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_megaraid.c_mega_setup_mailbox.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	mega_setup_mailbox, %function
mega_setup_mailbox:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	mov	r2, r0
	push	{r4, lr}
	mov	r1, #4
	mov	r4, r0
	ldr	r0, [r0, #28]
	bl	pci_alloc_consistent
	cmp	r0, #0
	str	r0, [r4, #16]
	beq	.L3
	ldr	r1, .L9
	add	r2, r0, #15
	ldr	r3, [r4]
	bic	r2, r2, #15
	ldr	ip, [r1]
	ldr	r1, [r4, #8]
	sub	r0, r2, r0
	add	r3, r3, #8
	add	r3, r3, r0
	ands	r0, r1, ip
	sub	r1, r2, #8
	str	r2, [r4, #20]
	str	r1, [r4, #24]
	str	r3, [r4, #4]
	popeq	{r4, pc}
	ldr	r1, [r4, #12]
	ldr	r2, .L9+4
	ldr	r1, [r1]
	ldr	r2, [r2]
	and	r0, r3, #255
	add	r1, r1, r2
	bl	outb
	ldr	r2, [r4, #12]
	ldr	r3, .L9+8
	ldr	r1, [r2]
	ldr	r3, [r3]
	ldrb	r0, [r4, #5]	@ zero_extendqisi2
	add	r1, r1, r3
	bl	outb
	ldr	r2, [r4, #12]
	ldr	r3, .L9+12
	ldr	r1, [r2]
	ldr	r3, [r3]
	ldrb	r0, [r4, #6]	@ zero_extendqisi2
	add	r1, r1, r3
	bl	outb
	ldr	r2, [r4, #12]
	ldr	r3, .L9+16
	ldr	r1, [r2]
	ldr	r3, [r3]
	ldrb	r0, [r4, #7]	@ zero_extendqisi2
	add	r1, r1, r3
	bl	outb
	ldr	r2, [r4, #12]
	ldr	r3, .L9+20
	ldr	r1, [r2]
	ldr	r2, [r3]
	ldr	r3, .L9+24
	add	r1, r1, r2
	ldr	r0, [r3]
	bl	outb
	mov	r0, r4
	bl	irq_ack
	mov	r0, r4
	bl	irq_enable
	mov	r0, #0
	pop	{r4, pc}
.L3:
	mvn	r0, #0
	pop	{r4, pc}
.L10:
	.align	2
.L9:
	.word	BOARD_IOMAP
	.word	MBOX_PORT0
	.word	MBOX_PORT1
	.word	MBOX_PORT2
	.word	MBOX_PORT3
	.word	ENABLE_MBOX_REGION
	.word	ENABLE_MBOX_BYTE
	.size	mega_setup_mailbox, .-mega_setup_mailbox
	.comm	MBOX_PORT3,4,4
	.comm	MBOX_PORT2,4,4
	.comm	MBOX_PORT1,4,4
	.comm	MBOX_PORT0,4,4
	.comm	ENABLE_MBOX_REGION,4,4
	.comm	ENABLE_MBOX_BYTE,4,4
	.comm	BOARD_IOMAP,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
