	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function altera_wait_link_retrain
_altera_wait_link_retrain:              ## @altera_wait_link_retrain
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	16(%rdi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	movl	8(%rdi), %esi
	movq	_RP_DEVFN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_PCI_EXP_LNKSTA@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-44(%rbp), %r8
	callq	_altera_read_cap_word
	movq	_PCI_EXP_LNKSTA_LT@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	testl	%eax, -44(%rbp)
	je	LBB0_5
## %bb.1:
	movq	_LINK_RETRAIN_TIMEOUT@GOTPCREL(%rip), %r12
	leaq	-44(%rbp), %r15
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	(%r12), %rsi
	addq	%r13, %rsi
	callq	_time_after
	testq	%rax, %rax
	jne	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	$100, %edi
	callq	_udelay
	movl	8(%rbx), %esi
	movq	_RP_DEVFN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_PCI_EXP_LNKSTA@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movq	%r15, %r8
	callq	_altera_read_cap_word
	movl	(%r14), %eax
	testl	%eax, -44(%rbp)
	jne	LBB0_2
	jmp	LBB0_5
LBB0_3:
	leaq	L_.str(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
LBB0_5:
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movq	(%rbx), %rax
	movq	(%rax), %rax
	movq	%rbx, %rdi
	callq	*(%rax)
	testq	%rax, %rax
	jne	LBB0_10
## %bb.6:
	movq	_LINK_UP_TIMEOUT@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	(%r15), %rsi
	addq	%r14, %rsi
	callq	_time_after
	testq	%rax, %rax
	jne	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	movl	$100, %edi
	callq	_udelay
	movq	(%rbx), %rax
	movq	(%rax), %rax
	movq	%rbx, %rdi
	callq	*(%rax)
	testq	%rax, %rax
	je	LBB0_7
	jmp	LBB0_10
LBB0_8:
	leaq	L_.str.1(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
LBB0_10:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_jiffies,8,3                    ## @jiffies
	.comm	_RP_DEVFN,4,2                   ## @RP_DEVFN
	.comm	_PCI_EXP_LNKSTA,4,2             ## @PCI_EXP_LNKSTA
	.comm	_PCI_EXP_LNKSTA_LT,4,2          ## @PCI_EXP_LNKSTA_LT
	.comm	_LINK_RETRAIN_TIMEOUT,8,3       ## @LINK_RETRAIN_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"link retrain timeout\n"

	.comm	_LINK_UP_TIMEOUT,8,3            ## @LINK_UP_TIMEOUT
L_.str.1:                               ## @.str.1
	.asciz	"link up timeout\n"

	.no_dead_strip	_altera_wait_link_retrain
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function altera_wait_link_retrain
_altera_wait_link_retrain:              ; @altera_wait_link_retrain
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x0
	ldr	x19, [x0, #16]
Lloh0:
	adrp	x21, _jiffies@GOTPAGE
Lloh1:
	ldr	x21, [x21, _jiffies@GOTPAGEOFF]
	ldr	x22, [x21]
	ldr	w1, [x0, #8]
Lloh2:
	adrp	x23, _RP_DEVFN@GOTPAGE
Lloh3:
	ldr	x23, [x23, _RP_DEVFN@GOTPAGEOFF]
	ldr	w2, [x23]
Lloh4:
	adrp	x24, _PCI_EXP_LNKSTA@GOTPAGE
Lloh5:
	ldr	x24, [x24, _PCI_EXP_LNKSTA@GOTPAGEOFF]
	ldr	w3, [x24]
	add	x4, sp, #12
	bl	_altera_read_cap_word
	ldr	w8, [sp, #12]
Lloh6:
	adrp	x25, _PCI_EXP_LNKSTA_LT@GOTPAGE
Lloh7:
	ldr	x25, [x25, _PCI_EXP_LNKSTA_LT@GOTPAGEOFF]
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.1:
Lloh8:
	adrp	x26, _LINK_RETRAIN_TIMEOUT@GOTPAGE
Lloh9:
	ldr	x26, [x26, _LINK_RETRAIN_TIMEOUT@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x21]
	ldr	x8, [x26]
	add	x1, x8, x22
	bl	_time_after
	cbnz	x0, LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w0, #100
	bl	_udelay
	ldr	w1, [x20, #8]
	ldr	w2, [x23]
	ldr	w3, [x24]
	add	x4, sp, #12
	mov	x0, x20
	bl	_altera_read_cap_word
	ldr	w8, [sp, #12]
	ldr	w9, [x25]
	tst	w9, w8
	b.ne	LBB0_2
	b	LBB0_5
LBB0_4:
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_dev_err
LBB0_5:
	ldr	x22, [x21]
	ldr	x8, [x20]
	ldr	x8, [x8]
	ldr	x8, [x8]
	mov	x0, x20
	blr	x8
	cbnz	x0, LBB0_10
; %bb.6:
Lloh12:
	adrp	x23, _LINK_UP_TIMEOUT@GOTPAGE
Lloh13:
	ldr	x23, [x23, _LINK_UP_TIMEOUT@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x21]
	ldr	x8, [x23]
	add	x1, x8, x22
	bl	_time_after
	cbnz	x0, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	w0, #100
	bl	_udelay
	ldr	x8, [x20]
	ldr	x8, [x8]
	ldr	x8, [x8]
	mov	x0, x20
	blr	x8
	cbz	x0, LBB0_7
	b	LBB0_10
LBB0_9:
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_dev_err
LBB0_10:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_jiffies,8,3                    ; @jiffies
	.comm	_RP_DEVFN,4,2                   ; @RP_DEVFN
	.comm	_PCI_EXP_LNKSTA,4,2             ; @PCI_EXP_LNKSTA
	.comm	_PCI_EXP_LNKSTA_LT,4,2          ; @PCI_EXP_LNKSTA_LT
	.comm	_LINK_RETRAIN_TIMEOUT,8,3       ; @LINK_RETRAIN_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"link retrain timeout\n"

	.comm	_LINK_UP_TIMEOUT,8,3            ; @LINK_UP_TIMEOUT
l_.str.1:                               ; @.str.1
	.asciz	"link up timeout\n"

	.no_dead_strip	_altera_wait_link_retrain
.subsections_via_symbols
