	.file	"extr_rtsx_scsi.c_erase_eeprom2.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	erase_eeprom2, @function
erase_eeprom2:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	mov	r12, rdi
	mov	rdi, rsi
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rsi
	call	rtsx_disable_aspm@PLT
	cmp	QWORD PTR 0[rbp], 0
	jne	.L14
.L3:
	mov	esi, DWORD PTR RTSX_STAT_RUN[rip]
	mov	rdi, rbp
	call	rtsx_set_stat@PLT
	mov	esi, DWORD PTR SSC_PDCTL[rip]
	mov	rdi, rbp
	call	rtsx_force_power_on@PLT
	cmp	DWORD PTR STATUS_SUCCESS[rip], eax
	jne	.L12
	mov	rax, QWORD PTR [r12]
	mov	edx, DWORD PTR 12[rax]
	test	edx, edx
	je	.L15
	cmp	edx, 1
	jne	.L9
	mov	esi, DWORD PTR 16[rax]
	mov	rdi, rbp
	sal	esi, 8
	or	si, WORD PTR 20[rax]
	movzx	esi, si
	call	spi_erase_eeprom_byte@PLT
	cmp	DWORD PTR STATUS_SUCCESS[rip], eax
	jne	.L12
.L8:
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	mov	eax, DWORD PTR TRANSPORT_GOOD[rip]
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	mov	rdi, rbp
	call	spi_erase_eeprom_chip@PLT
	cmp	DWORD PTR STATUS_SUCCESS[rip], eax
	je	.L8
	.p2align 4,,10
	.p2align 3
.L12:
	mov	r13d, DWORD PTR SENSE_TYPE_MEDIA_WRITE_ERR[rip]
.L11:
	mov	rdi, r12
	call	SCSI_LUN@PLT
	mov	edx, r13d
	mov	rdi, rbp
	mov	esi, eax
	call	set_sense_type@PLT
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	mov	eax, DWORD PTR TRANSPORT_FAILED[rip]
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	mov	rdi, rbp
	call	rtsx_get_stat@PLT
	cmp	rax, QWORD PTR RTSX_STAT_SS[rip]
	jne	.L3
	mov	rdi, rbp
	call	rtsx_exit_ss@PLT
	mov	edi, 100
	call	wait_timeout@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L9:
	mov	r13d, DWORD PTR SENSE_TYPE_MEDIA_INVALID_CMD_FIELD[rip]
	jmp	.L11
	.cfi_endproc
.LFE0:
	.size	erase_eeprom2, .-erase_eeprom2
	.comm	TRANSPORT_GOOD,4,4
	.comm	TRANSPORT_FAILED,4,4
	.comm	STATUS_SUCCESS,4,4
	.comm	SSC_PDCTL,4,4
	.comm	SENSE_TYPE_MEDIA_WRITE_ERR,4,4
	.comm	SENSE_TYPE_MEDIA_INVALID_CMD_FIELD,4,4
	.comm	RTSX_STAT_SS,8,8
	.comm	RTSX_STAT_RUN,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_rtsx_scsi.c_erase_eeprom2.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	erase_eeprom2, %function
erase_eeprom2:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r4, r1
	mov	r6, r0
	mov	r0, r1
	bl	rtsx_disable_aspm
	ldr	r3, [r4]
	cmp	r3, #0
	bne	.L15
.L3:
	ldr	r3, .L17
	mov	r0, r4
	ldr	r1, [r3]
	bl	rtsx_set_stat
	ldr	r3, .L17+4
	mov	r0, r4
	ldr	r1, [r3]
	bl	rtsx_force_power_on
	ldr	r5, .L17+8
	ldr	r3, [r5]
	cmp	r3, r0
	bne	.L13
	ldr	r3, [r6]
	ldr	r2, [r3, #12]
	cmp	r2, #0
	beq	.L16
	cmp	r2, #1
	bne	.L9
	ldr	r2, [r3, #16]
	ldr	r1, [r3, #20]
	mov	r0, r4
	orr	r1, r1, r2, lsl #8
	lsl	r1, r1, #16
	lsr	r1, r1, #16
	bl	spi_erase_eeprom_byte
	ldr	r3, [r5]
	cmp	r3, r0
	bne	.L13
.L8:
	ldr	r3, .L17+12
	ldr	r0, [r3]
	pop	{r4, r5, r6, pc}
.L16:
	mov	r0, r4
	bl	spi_erase_eeprom_chip
	ldr	r3, [r5]
	cmp	r3, r0
	beq	.L8
.L13:
	mov	r0, r6
	bl	SCSI_LUN
	mov	r1, r0
	ldr	r3, .L17+16
.L12:
	ldr	r2, [r3]
	mov	r0, r4
	bl	set_sense_type
	ldr	r3, .L17+20
	ldr	r0, [r3]
	pop	{r4, r5, r6, pc}
.L15:
	mov	r0, r4
	bl	rtsx_get_stat
	ldr	r3, .L17+24
	ldr	r3, [r3]
	cmp	r0, r3
	bne	.L3
	mov	r0, r4
	bl	rtsx_exit_ss
	mov	r0, #100
	bl	wait_timeout
	b	.L3
.L9:
	mov	r0, r6
	bl	SCSI_LUN
	ldr	r3, .L17+28
	mov	r1, r0
	b	.L12
.L18:
	.align	2
.L17:
	.word	RTSX_STAT_RUN
	.word	SSC_PDCTL
	.word	STATUS_SUCCESS
	.word	TRANSPORT_GOOD
	.word	SENSE_TYPE_MEDIA_WRITE_ERR
	.word	TRANSPORT_FAILED
	.word	RTSX_STAT_SS
	.word	SENSE_TYPE_MEDIA_INVALID_CMD_FIELD
	.size	erase_eeprom2, .-erase_eeprom2
	.comm	TRANSPORT_GOOD,4,4
	.comm	TRANSPORT_FAILED,4,4
	.comm	STATUS_SUCCESS,4,4
	.comm	SSC_PDCTL,4,4
	.comm	SENSE_TYPE_MEDIA_WRITE_ERR,4,4
	.comm	SENSE_TYPE_MEDIA_INVALID_CMD_FIELD,4,4
	.comm	RTSX_STAT_SS,4,4
	.comm	RTSX_STAT_RUN,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
