	.file	"extr_lpfc_bsg.c_lpfc_sli4_bsg_diag_mode_end.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"3139 Failed to bring link to diagnostic state, rc:x%x\n"
	.align 8
.LC1:
	.string	"3140 Timeout waiting for link to diagnostic mode_end, timeout:%d ms\n"
	.text
	.p2align 4
	.type	lpfc_sli4_bsg_diag_mode_end, @function
lpfc_sli4_bsg_diag_mode_end:
.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
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 8
	.cfi_def_cfa_offset 64
	mov	r12, QWORD PTR 8[rdi]
	mov	rbx, QWORD PTR [rdi]
	call	fc_bsg_to_shost@PLT
	test	rax, rax
	je	.L21
	mov	rdi, rax
	call	shost_priv@PLT
	test	rax, rax
	je	.L21
	mov	r13, QWORD PTR [rax]
	test	r13, r13
	je	.L21
	mov	rax, QWORD PTR LPFC_SLI_REV4[rip]
	cmp	QWORD PTR 0[r13], rax
	jl	.L21
	mov	edi, DWORD PTR lpfc_sli_intf_if_type[rip]
	lea	rsi, 32[r13]
	call	bf_get@PLT
	cmp	rax, QWORD PTR LPFC_SLI_INTF_IF_TYPE_2[rip]
	jge	.L6
	.p2align 4,,10
	.p2align 3
.L21:
	mov	r12d, DWORD PTR ENODEV[rip]
	neg	r12d
.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
.L6:
	.cfi_restore_state
	lea	r14, 24[r13]
	mov	rdi, r14
	call	spin_lock_irq@PLT
	mov	eax, DWORD PTR LS_LOOPBACK_MODE[rip]
	mov	rdi, r14
	not	eax
	and	DWORD PTR 28[r13], eax
	call	spin_unlock_irq@PLT
	mov	rax, QWORD PTR [r12]
	xor	esi, esi
	mov	rdi, r13
	mov	r14d, DWORD PTR [rax]
	call	lpfc_sli4_bsg_set_link_diag_state@PLT
	imul	r15d, r14d, 100
	mov	r12d, eax
	test	eax, eax
	jne	.L7
	mov	rax, QWORD PTR 8[r13]
	cmp	QWORD PTR LPFC_LINK_DOWN[rip], rax
	je	.L9
	test	r15d, r15d
	js	.L10
	add	r15d, 2
	mov	r12d, 1
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L13:
	add	r12d, 1
	cmp	r12d, r15d
	je	.L10
.L12:
	mov	edi, 10
	call	msleep@PLT
	mov	rax, QWORD PTR LPFC_LINK_DOWN[rip]
	cmp	QWORD PTR 8[r13], rax
	jne	.L13
.L9:
	mov	rdi, r13
	call	lpfc_selective_reset@PLT
	mov	r12d, eax
	mov	rax, QWORD PTR 16[r13]
	mov	QWORD PTR [rax], 0
	mov	DWORD PTR [rbx], r12d
	test	r12d, r12d
	jne	.L1
	mov	edx, DWORD PTR 4[rbx]
	xor	esi, esi
	mov	rdi, rbp
	call	bsg_job_done@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L10:
	imul	r8d, r14d, 1000
	mov	edx, DWORD PTR LOG_LIBDFC[rip]
	mov	esi, DWORD PTR KERN_INFO[rip]
	mov	rdi, r13
	lea	rcx, .LC1[rip]
	call	lpfc_printf_log@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	mov	edx, DWORD PTR LOG_LIBDFC[rip]
	mov	esi, DWORD PTR KERN_WARNING[rip]
	mov	r8d, eax
	mov	rdi, r13
	lea	rcx, .LC0[rip]
	call	lpfc_printf_log@PLT
	mov	DWORD PTR [rbx], r12d
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	lpfc_sli4_bsg_diag_mode_end, .-lpfc_sli4_bsg_diag_mode_end
	.comm	lpfc_sli_intf_if_type,4,4
	.comm	LS_LOOPBACK_MODE,4,4
	.comm	LPFC_SLI_REV4,8,8
	.comm	LPFC_SLI_INTF_IF_TYPE_2,8,8
	.comm	LPFC_LINK_DOWN,8,8
	.comm	LOG_LIBDFC,4,4
	.comm	KERN_WARNING,4,4
	.comm	KERN_INFO,4,4
	.comm	ENODEV,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_lpfc_bsg.c_lpfc_sli4_bsg_diag_mode_end.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"3139 Failed to bring link to diagnostic state, rc:x"
	.ascii	"%x\012\000"
	.align	2
.LC1:
	.ascii	"3140 Timeout waiting for link to diagnostic mode_en"
	.ascii	"d, timeout:%d ms\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	lpfc_sli4_bsg_diag_mode_end, %function
lpfc_sli4_bsg_diag_mode_end:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	sub	sp, sp, #8
	mov	r4, r0
	ldr	r5, [r0, #4]
	ldr	r6, [r0]
	bl	fc_bsg_to_shost
	cmp	r0, #0
	beq	.L21
	bl	shost_priv
	cmp	r0, #0
	beq	.L21
	ldr	r7, [r0]
	cmp	r7, #0
	beq	.L21
	ldr	r3, .L23
	ldr	r2, [r7]
	ldr	r3, [r3]
	cmp	r2, r3
	blt	.L21
	ldr	r3, .L23+4
	add	r1, r7, #20
	ldr	r0, [r3]
	bl	bf_get
	ldr	r3, .L23+8
	ldr	r3, [r3]
	cmp	r0, r3
	bge	.L6
.L21:
	ldr	r3, .L23+12
	ldr	r5, [r3]
	rsb	r5, r5, #0
.L1:
	mov	r0, r5
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L6:
	add	r8, r7, #12
	mov	r0, r8
	bl	spin_lock_irq
	ldr	r2, .L23+16
	ldr	r3, [r7, #16]
	ldr	r2, [r2]
	mov	r0, r8
	bic	r3, r3, r2
	str	r3, [r7, #16]
	bl	spin_unlock_irq
	ldr	r3, [r5]
	mov	r1, #0
	ldr	r8, [r3]
	mov	r0, r7
	add	r3, r8, r8, lsl #2
	add	r3, r3, r3, lsl #2
	lsl	r9, r3, #2
	bl	lpfc_sli4_bsg_set_link_diag_state
	subs	r5, r0, #0
	bne	.L7
	ldr	r10, .L23+20
	ldr	r3, [r7, #4]
	ldr	r2, [r10]
	cmp	r2, r3
	beq	.L9
	cmp	r9, #0
	movge	r5, #1
	addge	r9, r9, #2
	bge	.L12
	b	.L10
.L13:
	cmp	r5, r9
	beq	.L10
.L12:
	mov	r0, #10
	bl	msleep
	ldr	r2, [r7, #4]
	ldr	r3, [r10]
	add	r5, r5, #1
	cmp	r2, r3
	bne	.L13
.L9:
	mov	r0, r7
	bl	lpfc_selective_reset
	mov	r2, #0
	ldr	r3, [r7, #8]
	cmp	r0, r2
	str	r2, [r3]
	mov	r5, r0
	str	r0, [r6]
	bne	.L1
	mov	r0, r4
	mov	r1, r5
	ldr	r2, [r6, #4]
	bl	bsg_job_done
	b	.L1
.L10:
	rsb	r3, r8, r8, lsl #5
	add	r8, r8, r3, lsl #2
	lsl	r8, r8, #3
	ldr	r3, .L23+24
	ldr	r2, .L23+28
	str	r8, [sp]
	ldr	r1, [r3]
	mov	r0, r7
	ldr	r2, [r2]
	ldr	r3, .L23+32
	bl	lpfc_printf_log
	b	.L9
.L7:
	ldr	r3, .L23+36
	ldr	r2, .L23+28
	str	r5, [sp]
	ldr	r1, [r3]
	mov	r0, r7
	ldr	r2, [r2]
	ldr	r3, .L23+40
	bl	lpfc_printf_log
	str	r5, [r6]
	b	.L1
.L24:
	.align	2
.L23:
	.word	LPFC_SLI_REV4
	.word	lpfc_sli_intf_if_type
	.word	LPFC_SLI_INTF_IF_TYPE_2
	.word	ENODEV
	.word	LS_LOOPBACK_MODE
	.word	LPFC_LINK_DOWN
	.word	KERN_INFO
	.word	LOG_LIBDFC
	.word	.LC1
	.word	KERN_WARNING
	.word	.LC0
	.size	lpfc_sli4_bsg_diag_mode_end, .-lpfc_sli4_bsg_diag_mode_end
	.comm	lpfc_sli_intf_if_type,4,4
	.comm	LS_LOOPBACK_MODE,4,4
	.comm	LPFC_SLI_REV4,4,4
	.comm	LPFC_SLI_INTF_IF_TYPE_2,4,4
	.comm	LPFC_LINK_DOWN,4,4
	.comm	LOG_LIBDFC,4,4
	.comm	KERN_WARNING,4,4
	.comm	KERN_INFO,4,4
	.comm	ENODEV,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
