	.file	"extr_mlx5fpga_sdk.c_mlx5_fpga_device_reload.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Loading from flash\n"
.LC1:
	.string	"Failed to request load: %d\n"
.LC2:
	.string	"Resetting\n"
.LC3:
	.string	"Failed to request reset: %d\n"
.LC4:
	.string	"Unknown command: %d\n"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC5:
	.string	"Failed waiting for FPGA load: %d\n"
	.section	.rodata.str1.1
.LC6:
	.string	"fpga device start failed %d\n"
	.section	.rodata.str1.8
	.align 8
.LC7:
	.string	"mlx5_register_device failed %d\n"
	.text
	.p2align 4
	.globl	mlx5_fpga_device_reload
	.type	mlx5_fpga_device_reload, @function
mlx5_fpga_device_reload:
.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
	lea	r14, 8[rdi]
	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
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	ebx, esi
	xor	esi, esi
	sub	rsp, 8
	.cfi_def_cfa_offset 64
	mov	r13, QWORD PTR 16[rdi]
	mov	rdi, r14
	call	spin_lock_irqsave@PLT
	mov	eax, DWORD PTR 0[rbp]
	cmp	eax, 129
	je	.L2
	cmp	eax, 130
	je	.L3
	xor	esi, esi
	mov	rdi, r14
	call	spin_unlock_irqrestore@PLT
.L4:
	mov	rdi, r13
	call	mutex_lock@PLT
	cmp	DWORD PTR MLX5_FPGA_IMAGE_RELOAD[rip], ebx
	je	.L23
	mov	edi, DWORD PTR MLX5_INTERFACE_STATE_UP[rip]
	lea	r14, 4[r13]
	lea	r15, 4[rbp]
	mov	rsi, r14
	call	clear_bit@PLT
	mov	rdi, r13
	call	mlx5_unregister_device@PLT
	mov	rdi, r13
	call	mlx5_fpga_device_stop@PLT
	mov	DWORD PTR 0[rbp], 130
	mov	rdi, r15
	call	reinit_completion@PLT
	cmp	DWORD PTR MLX5_FPGA_IMAGE_FACTORY[rip], ebx
	jnb	.L24
	cmp	DWORD PTR MLX5_FPGA_IMAGE_RESET[rip], ebx
	jne	.L11
	lea	rsi, .LC2[rip]
	mov	rdi, rbp
	call	mlx5_fpga_info@PLT
	mov	esi, DWORD PTR MLX5_FPGA_CTRL_OPERATION_RESET[rip]
	mov	rdi, r13
	call	mlx5_fpga_ctrl_op@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L25
.L10:
	mov	edi, DWORD PTR MLX5_FPGA_LOAD_TIMEOUT[rip]
	call	msecs_to_jiffies@PLT
	mov	rdi, r15
	mov	rsi, rax
	call	wait_for_completion_timeout@PLT
	mov	r12d, eax
	test	eax, eax
	js	.L26
	mov	rdi, r13
	call	mlx5_fpga_device_start@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L27
	mov	rdi, r13
	call	mlx5_register_device@PLT
	mov	r12d, eax
	test	eax, eax
	je	.L14
	mov	rdi, r13
	mov	edx, eax
	lea	rsi, .LC7[rip]
	call	mlx5_core_err@PLT
	mov	DWORD PTR 0[rbp], 131
	mov	rdi, r13
	call	mlx5_fpga_device_stop@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	mov	r12d, DWORD PTR ENODEV[rip]
	neg	r12d
.L5:
	xor	esi, esi
	mov	rdi, r14
	call	spin_unlock_irqrestore@PLT
	test	r12d, r12d
	je	.L4
.L1:
	add	rsp, 8
	.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
.L3:
	.cfi_restore_state
	mov	r12d, DWORD PTR EBUSY[rip]
	neg	r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L11:
	mov	edx, ebx
	lea	rsi, .LC4[rip]
	mov	rdi, rbp
	xor	r12d, r12d
	call	mlx5_fpga_err@PLT
.L8:
	mov	rdi, r13
	call	mutex_unlock@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L23:
	mov	rdi, rbp
	call	mlx5_fpga_device_reload_cmd@PLT
	mov	r12d, eax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L24:
	lea	rsi, .LC0[rip]
	mov	rdi, rbp
	call	mlx5_fpga_info@PLT
	mov	esi, ebx
	mov	rdi, r13
	call	mlx5_fpga_load@PLT
	mov	r12d, eax
	test	eax, eax
	je	.L10
	mov	edx, eax
	lea	rsi, .LC1[rip]
	mov	rdi, rbp
	call	mlx5_fpga_err@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L26:
	mov	edx, eax
	lea	rsi, .LC5[rip]
	mov	rdi, rbp
	call	mlx5_fpga_err@PLT
	mov	DWORD PTR 0[rbp], 131
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L27:
	mov	edx, eax
	lea	rsi, .LC6[rip]
	mov	rdi, r13
	call	mlx5_core_err@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L14:
	mov	edi, DWORD PTR MLX5_INTERFACE_STATE_UP[rip]
	mov	rsi, r14
	call	set_bit@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L25:
	mov	edx, eax
	lea	rsi, .LC3[rip]
	mov	rdi, rbp
	call	mlx5_fpga_err@PLT
	jmp	.L8
	.cfi_endproc
.LFE0:
	.size	mlx5_fpga_device_reload, .-mlx5_fpga_device_reload
	.comm	jiffies,8,8
	.comm	MLX5_INTERFACE_STATE_UP,4,4
	.comm	MLX5_FPGA_LOAD_TIMEOUT,4,4
	.comm	MLX5_FPGA_IMAGE_RESET,4,4
	.comm	MLX5_FPGA_IMAGE_RELOAD,4,4
	.comm	MLX5_FPGA_IMAGE_FACTORY,4,4
	.comm	MLX5_FPGA_CTRL_OPERATION_RESET,4,4
	.comm	ENODEV,4,4
	.comm	EBUSY,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_mlx5fpga_sdk.c_mlx5_fpga_device_reload.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Loading from flash\012\000"
	.align	2
.LC1:
	.ascii	"Failed to request load: %d\012\000"
	.align	2
.LC2:
	.ascii	"Resetting\012\000"
	.align	2
.LC3:
	.ascii	"Failed to request reset: %d\012\000"
	.align	2
.LC4:
	.ascii	"Unknown command: %d\012\000"
	.align	2
.LC5:
	.ascii	"Failed waiting for FPGA load: %d\012\000"
	.align	2
.LC6:
	.ascii	"fpga device start failed %d\012\000"
	.align	2
.LC7:
	.ascii	"mlx5_register_device failed %d\012\000"
	.text
	.align	2
	.global	mlx5_fpga_device_reload
	.syntax unified
	.arm
	.fpu softvfp
	.type	mlx5_fpga_device_reload, %function
mlx5_fpga_device_reload:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r5, r0
	add	r7, r0, #8
	mov	r9, r1
	mov	r0, r7
	mov	r1, #0
	ldr	r6, [r5, #12]
	bl	spin_lock_irqsave
	ldr	r3, [r5]
	cmp	r3, #129
	beq	.L2
	cmp	r3, #130
	beq	.L3
	mov	r0, r7
	mov	r1, #0
	bl	spin_unlock_irqrestore
.L4:
	mov	r0, r6
	bl	mutex_lock
	ldr	r3, .L28
	ldr	r3, [r3]
	cmp	r3, r9
	beq	.L23
	ldr	r7, .L28+4
	add	r8, r6, #4
	mov	r1, r8
	ldr	r0, [r7]
	bl	clear_bit
	mov	r0, r6
	bl	mlx5_unregister_device
	mov	r0, r6
	bl	mlx5_fpga_device_stop
	mov	r10, r5
	mov	r3, #130
	str	r3, [r10], #4
	mov	r0, r10
	bl	reinit_completion
	ldr	r3, .L28+8
	ldr	r3, [r3]
	cmp	r3, r9
	bcs	.L24
	ldr	r3, .L28+12
	ldr	r3, [r3]
	cmp	r3, r9
	bne	.L11
	ldr	r1, .L28+16
	mov	r0, r5
	bl	mlx5_fpga_info
	ldr	r3, .L28+20
	mov	r0, r6
	ldr	r1, [r3]
	bl	mlx5_fpga_ctrl_op
	subs	r4, r0, #0
	bne	.L25
.L10:
	ldr	r3, .L28+24
	ldr	r0, [r3]
	bl	msecs_to_jiffies
	mov	r1, r0
	mov	r0, r10
	bl	wait_for_completion_timeout
	subs	r4, r0, #0
	blt	.L26
	mov	r0, r6
	bl	mlx5_fpga_device_start
	subs	r4, r0, #0
	bne	.L27
	mov	r0, r6
	bl	mlx5_register_device
	subs	r4, r0, #0
	beq	.L14
	mov	r2, r4
	mov	r0, r6
	ldr	r1, .L28+28
	bl	mlx5_core_err
	mov	r3, #131
	mov	r0, r6
	str	r3, [r5]
	bl	mlx5_fpga_device_stop
	b	.L8
.L2:
	ldr	r3, .L28+32
	ldr	r4, [r3]
	rsb	r4, r4, #0
.L5:
	mov	r0, r7
	mov	r1, #0
	bl	spin_unlock_irqrestore
	cmp	r4, #0
	beq	.L4
	mov	r0, r4
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L3:
	ldr	r3, .L28+36
	ldr	r4, [r3]
	rsb	r4, r4, #0
	b	.L5
.L11:
	mov	r2, r9
	mov	r0, r5
	ldr	r1, .L28+40
	bl	mlx5_fpga_err
	mov	r4, #0
.L8:
	mov	r0, r6
	bl	mutex_unlock
	mov	r0, r4
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L23:
	mov	r0, r5
	bl	mlx5_fpga_device_reload_cmd
	mov	r4, r0
	b	.L8
.L24:
	ldr	r1, .L28+44
	mov	r0, r5
	bl	mlx5_fpga_info
	mov	r1, r9
	mov	r0, r6
	bl	mlx5_fpga_load
	subs	r4, r0, #0
	beq	.L10
	mov	r0, r5
	mov	r2, r4
	ldr	r1, .L28+48
	bl	mlx5_fpga_err
	b	.L8
.L26:
	mov	r2, r4
	mov	r0, r5
	ldr	r1, .L28+52
	bl	mlx5_fpga_err
	mov	r3, #131
	str	r3, [r5]
	b	.L8
.L27:
	mov	r2, r4
	mov	r0, r6
	ldr	r1, .L28+56
	bl	mlx5_core_err
	b	.L8
.L14:
	mov	r1, r8
	ldr	r0, [r7]
	bl	set_bit
	b	.L8
.L25:
	mov	r0, r5
	mov	r2, r4
	ldr	r1, .L28+60
	bl	mlx5_fpga_err
	b	.L8
.L29:
	.align	2
.L28:
	.word	MLX5_FPGA_IMAGE_RELOAD
	.word	MLX5_INTERFACE_STATE_UP
	.word	MLX5_FPGA_IMAGE_FACTORY
	.word	MLX5_FPGA_IMAGE_RESET
	.word	.LC2
	.word	MLX5_FPGA_CTRL_OPERATION_RESET
	.word	MLX5_FPGA_LOAD_TIMEOUT
	.word	.LC7
	.word	ENODEV
	.word	EBUSY
	.word	.LC4
	.word	.LC0
	.word	.LC1
	.word	.LC5
	.word	.LC6
	.word	.LC3
	.size	mlx5_fpga_device_reload, .-mlx5_fpga_device_reload
	.comm	jiffies,4,4
	.comm	MLX5_INTERFACE_STATE_UP,4,4
	.comm	MLX5_FPGA_LOAD_TIMEOUT,4,4
	.comm	MLX5_FPGA_IMAGE_RESET,4,4
	.comm	MLX5_FPGA_IMAGE_RELOAD,4,4
	.comm	MLX5_FPGA_IMAGE_FACTORY,4,4
	.comm	MLX5_FPGA_CTRL_OPERATION_RESET,4,4
	.comm	ENODEV,4,4
	.comm	EBUSY,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
