	.file	"extr_thunder_bgx.c_bgx_sgmii_change_link_state.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	bgx_sgmii_change_link_state, @function
bgx_sgmii_change_link_state:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	mov	edx, DWORD PTR BGX_CMRX_CFG[rip]
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	mov	rbp, QWORD PTR 24[rdi]
	mov	rbx, rdi
	mov	esi, DWORD PTR 8[rdi]
	mov	rdi, rbp
	call	bgx_reg_read@PLT
	mov	r13d, DWORD PTR CMR_EN[rip]
	mov	esi, DWORD PTR 8[rbx]
	mov	rdi, rbp
	mov	edx, DWORD PTR BGX_CMRX_CFG[rip]
	not	r13d
	and	r13d, eax
	mov	ecx, r13d
	call	bgx_reg_write@PLT
	mov	esi, DWORD PTR 8[rbx]
	mov	edx, DWORD PTR BGX_GMP_GMI_PRTX_CFG[rip]
	mov	rdi, rbp
	call	bgx_reg_read@PLT
	mov	esi, DWORD PTR 8[rbx]
	mov	edx, DWORD PTR BGX_GMP_PCS_MISCX_CTL[rip]
	mov	rdi, rbp
	mov	r12d, eax
	call	bgx_reg_read@PLT
	cmp	QWORD PTR 16[rbx], 0
	mov	r14d, eax
	je	.L2
	mov	eax, DWORD PTR PCS_MISC_CTL_GMX_ENO[rip]
	mov	esi, DWORD PTR 8[rbx]
	not	eax
	and	r14d, eax
	mov	eax, DWORD PTR GMI_PORT_CFG_DUPLEX[rip]
	not	eax
	and	r12d, eax
	mov	eax, DWORD PTR [rbx]
	sal	eax, 2
	or	r12d, eax
	mov	eax, DWORD PTR 4[rbx]
	cmp	eax, 100
	je	.L4
.L13:
	cmp	eax, 1000
	je	.L5
	cmp	eax, 10
	je	.L12
.L6:
	mov	edx, DWORD PTR BGX_GMP_PCS_MISCX_CTL[rip]
	mov	ecx, r14d
	mov	rdi, rbp
	call	bgx_reg_write@PLT
	mov	esi, DWORD PTR 8[rbx]
	mov	ecx, r12d
	mov	rdi, rbp
	mov	edx, DWORD PTR BGX_GMP_GMI_PRTX_CFG[rip]
	call	bgx_reg_write@PLT
	mov	esi, DWORD PTR 8[rbx]
	mov	edx, DWORD PTR BGX_GMP_GMI_PRTX_CFG[rip]
	mov	rdi, rbp
	call	bgx_reg_read@PLT
	mov	ecx, DWORD PTR CMR_EN[rip]
	mov	esi, DWORD PTR 8[rbx]
	mov	rdi, rbp
	mov	edx, DWORD PTR BGX_CMRX_CFG[rip]
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	or	ecx, r13d
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	jmp	bgx_reg_write@PLT
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	eax, DWORD PTR 4[rbx]
	mov	esi, DWORD PTR 8[rbx]
	or	r14d, DWORD PTR PCS_MISC_CTL_GMX_ENO[rip]
	cmp	eax, 100
	jne	.L13
.L4:
	mov	eax, DWORD PTR GMI_PORT_CFG_SPEED[rip]
	or	eax, DWORD PTR GMI_PORT_CFG_SPEED_MSB[rip]
	or	eax, DWORD PTR GMI_PORT_CFG_SLOT_TIME[rip]
	not	eax
	and	r12d, eax
	mov	eax, DWORD PTR PCS_MISC_CTL_SAMP_PT_MASK[rip]
	not	eax
	and	r14d, eax
	or	r14d, 5
.L9:
	mov	edx, DWORD PTR BGX_GMP_GMI_TXX_SLOT[rip]
	mov	ecx, 64
	mov	rdi, rbp
	call	bgx_reg_write@PLT
	mov	esi, DWORD PTR 8[rbx]
.L10:
	mov	edx, DWORD PTR BGX_GMP_GMI_TXX_BURST[rip]
	xor	ecx, ecx
	mov	rdi, rbp
	call	bgx_reg_write@PLT
	mov	esi, DWORD PTR 8[rbx]
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L12:
	mov	eax, DWORD PTR GMI_PORT_CFG_SPEED[rip]
	not	eax
	and	r12d, eax
	mov	eax, DWORD PTR GMI_PORT_CFG_SLOT_TIME[rip]
	or	r12d, DWORD PTR GMI_PORT_CFG_SPEED_MSB[rip]
	not	eax
	and	r12d, eax
	mov	eax, DWORD PTR PCS_MISC_CTL_SAMP_PT_MASK[rip]
	not	eax
	and	r14d, eax
	or	r14d, 50
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L5:
	mov	eax, DWORD PTR GMI_PORT_CFG_SPEED[rip]
	mov	edx, DWORD PTR BGX_GMP_GMI_TXX_SLOT[rip]
	mov	ecx, 512
	mov	rdi, rbp
	or	eax, r12d
	mov	r12d, DWORD PTR GMI_PORT_CFG_SPEED_MSB[rip]
	not	r12d
	and	r12d, eax
	mov	eax, DWORD PTR PCS_MISC_CTL_SAMP_PT_MASK[rip]
	or	r12d, DWORD PTR GMI_PORT_CFG_SLOT_TIME[rip]
	not	eax
	and	r14d, eax
	call	bgx_reg_write@PLT
	mov	eax, DWORD PTR [rbx]
	or	r14d, 1
	mov	esi, DWORD PTR 8[rbx]
	test	eax, eax
	jne	.L10
	mov	edx, DWORD PTR BGX_GMP_GMI_TXX_BURST[rip]
	mov	ecx, 8192
	mov	rdi, rbp
	call	bgx_reg_write@PLT
	mov	esi, DWORD PTR 8[rbx]
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	bgx_sgmii_change_link_state, .-bgx_sgmii_change_link_state
	.comm	PCS_MISC_CTL_SAMP_PT_MASK,4,4
	.comm	PCS_MISC_CTL_GMX_ENO,4,4
	.comm	GMI_PORT_CFG_SPEED_MSB,4,4
	.comm	GMI_PORT_CFG_SPEED,4,4
	.comm	GMI_PORT_CFG_SLOT_TIME,4,4
	.comm	GMI_PORT_CFG_DUPLEX,4,4
	.comm	CMR_EN,4,4
	.comm	BGX_GMP_PCS_MISCX_CTL,4,4
	.comm	BGX_GMP_GMI_TXX_SLOT,4,4
	.comm	BGX_GMP_GMI_TXX_BURST,4,4
	.comm	BGX_GMP_GMI_PRTX_CFG,4,4
	.comm	BGX_CMRX_CFG,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_thunder_bgx.c_bgx_sgmii_change_link_state.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	bgx_sgmii_change_link_state, %function
bgx_sgmii_change_link_state:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r5, [r0, #16]
	ldr	r9, .L13
	mov	r4, r0
	sub	sp, sp, #4
	ldr	r1, [r0, #8]
	ldr	r2, [r9]
	mov	r0, r5
	bl	bgx_reg_read
	mov	r8, r0
	ldr	fp, .L13+4
	ldr	r10, .L13+8
	ldr	r3, [fp]
	ldr	r1, [r4, #8]
	bic	r8, r8, r3
	mov	r3, r8
	ldr	r2, [r9]
	mov	r0, r5
	bl	bgx_reg_write
	ldr	r1, [r4, #8]
	ldr	r2, [r10]
	mov	r0, r5
	bl	bgx_reg_read
	ldr	r3, .L13+12
	mov	r6, r0
	ldr	r2, [r3]
	mov	r0, r5
	ldr	r1, [r4, #8]
	bl	bgx_reg_read
	ldr	r3, [r4, #12]
	cmp	r3, #0
	beq	.L2
	ldr	r3, .L13+16
	ldr	r2, .L13+20
	ldr	r3, [r3]
	ldr	r7, [r2]
	bic	r6, r6, r3
	ldr	r3, [r4]
	ldr	r1, [r4, #8]
	orr	r6, r6, r3, lsl #2
	ldr	r3, [r4, #4]
	bic	r7, r0, r7
	cmp	r3, #100
	beq	.L4
.L12:
	cmp	r3, #1000
	beq	.L5
	cmp	r3, #10
	beq	.L11
.L6:
	ldr	r2, .L13+12
	mov	r3, r7
	mov	r0, r5
	ldr	r2, [r2]
	bl	bgx_reg_write
	mov	r3, r6
	ldr	r2, [r10]
	ldr	r1, [r4, #8]
	mov	r0, r5
	bl	bgx_reg_write
	ldr	r2, [r10]
	ldr	r1, [r4, #8]
	mov	r0, r5
	bl	bgx_reg_read
	mov	r0, r5
	ldr	r3, [fp]
	ldr	r2, [r9]
	ldr	r1, [r4, #8]
	orr	r3, r8, r3
	add	sp, sp, #4
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	b	bgx_reg_write
.L2:
	ldr	r3, .L13+20
	ldr	r1, [r4, #8]
	ldr	r7, [r3]
	ldr	r3, [r4, #4]
	orr	r7, r0, r7
	cmp	r3, #100
	bne	.L12
.L4:
	ldr	ip, .L13+24
	ldr	r3, .L13+28
	ldr	ip, [ip]
	ldr	r3, [r3]
	ldr	r0, .L13+32
	ldr	r2, .L13+36
	ldr	r0, [r0]
	ldr	r2, [r2]
	orr	ip, ip, r3
	ldr	r3, .L13+40
	orr	ip, ip, r0
	bic	r7, r7, r2
	mov	r0, r5
	ldr	r2, [r3]
	mov	r3, #64
	bic	r6, r6, ip
	bl	bgx_reg_write
	mov	r3, #0
	ldr	r2, .L13+44
	orr	r7, r7, #5
.L9:
	ldr	r1, [r4, #8]
	mov	r0, r5
	ldr	r2, [r2]
	bl	bgx_reg_write
	ldr	r1, [r4, #8]
	b	.L6
.L11:
	ldr	r3, .L13+24
	ldr	r0, .L13+28
	ldr	r3, [r3]
	ldr	r2, .L13+36
	ldr	ip, .L13+32
	ldr	r0, [r0]
	ldr	r2, [r2]
	bic	r6, r6, r3
	ldr	r3, .L13+40
	ldr	ip, [ip]
	orr	r6, r6, r0
	bic	r7, r7, r2
	mov	r0, r5
	ldr	r2, [r3]
	mov	r3, #64
	bic	r6, r6, ip
	orr	r7, r7, #50
	bl	bgx_reg_write
	mov	r3, #0
	ldr	r2, .L13+44
	b	.L9
.L5:
	ldr	r3, .L13+24
	ldr	r0, .L13+28
	ldr	r3, [r3]
	ldr	r2, .L13+36
	ldr	ip, .L13+32
	ldr	r0, [r0]
	ldr	r2, [r2]
	orr	r6, r6, r3
	ldr	r3, .L13+40
	ldr	ip, [ip]
	bic	r6, r6, r0
	bic	r7, r7, r2
	mov	r0, r5
	ldr	r2, [r3]
	mov	r3, #512
	orr	r6, r6, ip
	bl	bgx_reg_write
	ldr	r3, [r4]
	ldr	r2, .L13+44
	cmp	r3, #0
	movne	r3, #0
	moveq	r3, #8192
	orr	r7, r7, #1
	b	.L9
.L14:
	.align	2
.L13:
	.word	BGX_CMRX_CFG
	.word	CMR_EN
	.word	BGX_GMP_GMI_PRTX_CFG
	.word	BGX_GMP_PCS_MISCX_CTL
	.word	GMI_PORT_CFG_DUPLEX
	.word	PCS_MISC_CTL_GMX_ENO
	.word	GMI_PORT_CFG_SPEED
	.word	GMI_PORT_CFG_SPEED_MSB
	.word	GMI_PORT_CFG_SLOT_TIME
	.word	PCS_MISC_CTL_SAMP_PT_MASK
	.word	BGX_GMP_GMI_TXX_SLOT
	.word	BGX_GMP_GMI_TXX_BURST
	.size	bgx_sgmii_change_link_state, .-bgx_sgmii_change_link_state
	.comm	PCS_MISC_CTL_SAMP_PT_MASK,4,4
	.comm	PCS_MISC_CTL_GMX_ENO,4,4
	.comm	GMI_PORT_CFG_SPEED_MSB,4,4
	.comm	GMI_PORT_CFG_SPEED,4,4
	.comm	GMI_PORT_CFG_SLOT_TIME,4,4
	.comm	GMI_PORT_CFG_DUPLEX,4,4
	.comm	CMR_EN,4,4
	.comm	BGX_GMP_PCS_MISCX_CTL,4,4
	.comm	BGX_GMP_GMI_TXX_SLOT,4,4
	.comm	BGX_GMP_GMI_TXX_BURST,4,4
	.comm	BGX_GMP_GMI_PRTX_CFG,4,4
	.comm	BGX_CMRX_CFG,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
