	.file	"extr_al_hal_pcie.c_al_pcie_link_retrain.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"PCIe %d: link-retrain is applicable only for RC mode\n"
	.align 8
.LC1:
	.string	"PCIe %d: link not started, cannot link-retrain\n"
	.text
	.p2align 4
	.globl	al_pcie_link_retrain
	.type	al_pcie_link_retrain, @function
al_pcie_link_retrain:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	push	rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	mov	rbx, rdi
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	mov	rbp, QWORD PTR 8[rdi]
	call	al_pcie_operating_mode_get@PLT
	cmp	eax, DWORD PTR AL_PCIE_OPERATING_MODE_RC[rip]
	je	.L2
	mov	esi, DWORD PTR [rbx]
	lea	rdi, .LC0[rip]
	call	al_err@PLT
	mov	eax, DWORD PTR EINVAL[rip]
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	rbp
	.cfi_def_cfa_offset 8
	neg	eax
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	rdi, rbx
	call	al_pcie_is_link_started@PLT
	test	eax, eax
	je	.L7
	mov	edi, DWORD PTR AL_PCI_EXP_LNKCTL[rip]
	mov	rax, QWORD PTR 0[rbp]
	mov	esi, DWORD PTR AL_PCI_EXP_LNKCTL_LNK_RTRN[rip]
	sar	edi
	movsx	rdi, edi
	mov	edx, esi
	add	rdi, QWORD PTR [rax]
	call	al_reg_write32_masked@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xor	eax, eax
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	mov	esi, DWORD PTR [rbx]
	lea	rdi, .LC1[rip]
	call	al_err@PLT
	mov	eax, DWORD PTR EINVAL[rip]
	add	rsp, 8
	.cfi_def_cfa_offset 24
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	rbp
	.cfi_def_cfa_offset 8
	neg	eax
	ret
	.cfi_endproc
.LFE0:
	.size	al_pcie_link_retrain, .-al_pcie_link_retrain
	.comm	EINVAL,4,4
	.comm	AL_PCI_EXP_LNKCTL_LNK_RTRN,4,4
	.comm	AL_PCI_EXP_LNKCTL,4,4
	.comm	AL_PCIE_OPERATING_MODE_RC,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_al_hal_pcie.c_al_pcie_link_retrain.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"PCIe %d: link-retrain is applicable only for RC mod"
	.ascii	"e\012\000"
	.align	2
.LC1:
	.ascii	"PCIe %d: link not started, cannot link-retrain\012\000"
	.text
	.align	2
	.global	al_pcie_link_retrain
	.syntax unified
	.arm
	.fpu softvfp
	.type	al_pcie_link_retrain, %function
al_pcie_link_retrain:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r4, r0
	ldr	r5, [r0, #4]
	bl	al_pcie_operating_mode_get
	ldr	r3, .L8
	ldr	r3, [r3]
	cmp	r0, r3
	beq	.L2
	ldr	r1, [r4]
	ldr	r0, .L8+4
	bl	al_err
	ldr	r3, .L8+8
	ldr	r0, [r3]
	rsb	r0, r0, #0
	pop	{r4, r5, r6, pc}
.L2:
	mov	r0, r4
	bl	al_pcie_is_link_started
	cmp	r0, #0
	beq	.L7
	ldr	r3, [r5]
	ldr	r1, .L8+12
	ldr	r2, .L8+16
	ldr	r3, [r3]
	ldr	r0, [r1]
	ldr	r2, [r2]
	add	r0, r3, r0, asr #1
	mov	r1, r2
	bl	al_reg_write32_masked
	mov	r0, #0
	pop	{r4, r5, r6, pc}
.L7:
	ldr	r1, [r4]
	ldr	r0, .L8+20
	bl	al_err
	ldr	r3, .L8+8
	ldr	r0, [r3]
	rsb	r0, r0, #0
	pop	{r4, r5, r6, pc}
.L9:
	.align	2
.L8:
	.word	AL_PCIE_OPERATING_MODE_RC
	.word	.LC0
	.word	EINVAL
	.word	AL_PCI_EXP_LNKCTL
	.word	AL_PCI_EXP_LNKCTL_LNK_RTRN
	.word	.LC1
	.size	al_pcie_link_retrain, .-al_pcie_link_retrain
	.comm	EINVAL,4,4
	.comm	AL_PCI_EXP_LNKCTL_LNK_RTRN,4,4
	.comm	AL_PCI_EXP_LNKCTL,4,4
	.comm	AL_PCIE_OPERATING_MODE_RC,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
