	.file	"extr_ahci.c_ahci_reset.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"AHCI reset...\n"
.LC1:
	.string	"AHCI reset: device not found\n"
.LC2:
	.string	"AHCI reset: device found\n"
	.text
	.p2align 4
	.type	ahci_reset, @function
ahci_reset:
.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
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	mov	edi, DWORD PTR 44[rdi]
	call	device_get_parent@PLT
	mov	edi, eax
	call	device_get_softc@PLT
	mov	edi, DWORD PTR 32[r12]
	mov	esi, 1
	mov	rbp, rax
	call	xpt_freeze_simq@PLT
	cmp	QWORD PTR bootverbose[rip], 0
	jne	.L43
.L2:
	mov	ecx, DWORD PTR [r12]
	test	ecx, ecx
	jne	.L44
.L3:
	mov	r13, QWORD PTR 104[r12]
	test	r13, r13
	je	.L4
	mov	QWORD PTR 104[r12], 0
	mov	eax, DWORD PTR CAM_REQUEUE_REQ[rip]
	or	eax, DWORD PTR CAM_RELEASE_SIMQ[rip]
	mov	DWORD PTR 0[r13], eax
	test	DWORD PTR CAM_DEV_QFRZN[rip], eax
	je	.L45
.L5:
	mov	rsi, r13
	mov	rdi, r12
	call	ahci_done@PLT
.L4:
	mov	rdi, r12
	xor	ebx, ebx
	call	ahci_stop@PLT
	mov	edx, DWORD PTR 4[r12]
	test	edx, edx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L6:
	mov	rax, QWORD PTR 96[r12]
	lea	rdi, [rax+rbx*8]
	mov	rax, QWORD PTR AHCI_SLOT_RUNNING[rip]
	cmp	QWORD PTR [rdi], rax
	jl	.L9
	mov	esi, DWORD PTR AHCI_ERR_INNOCENT[rip]
	call	ahci_end_transaction@PLT
.L9:
	mov	eax, DWORD PTR 4[r12]
	add	rbx, 1
	cmp	eax, ebx
	jg	.L6
	test	eax, eax
	jle	.L10
	mov	rax, QWORD PTR 88[r12]
	xor	ebx, ebx
	.p2align 4,,10
	.p2align 3
.L12:
	mov	rsi, QWORD PTR [rax+rbx*8]
	test	rsi, rsi
	je	.L11
	mov	rdi, r12
	call	ahci_done@PLT
	mov	rax, QWORD PTR 88[r12]
	mov	QWORD PTR [rax+rbx*8], 0
	sub	DWORD PTR 80[r12], 1
.L11:
	add	rbx, 1
	cmp	DWORD PTR 4[r12], ebx
	jg	.L12
.L10:
	cmp	QWORD PTR 8[r12], 0
	jne	.L46
.L8:
	mov	QWORD PTR 72[r12], 0
	mov	esi, DWORD PTR 48[r12]
	xor	edx, edx
	mov	QWORD PTR 8[r12], 0
	mov	edi, DWORD PTR AC_BUS_RESET[rip]
	mov	QWORD PTR 64[r12], 0
	mov	QWORD PTR 56[r12], 0
	call	xpt_async@PLT
	mov	edi, DWORD PTR 40[r12]
	mov	esi, DWORD PTR AHCI_P_IE[rip]
	xor	edx, edx
	call	ATA_OUTL@PLT
	mov	rdi, r12
	call	ahci_sata_phy_reset@PLT
	mov	ebx, eax
	test	eax, eax
	je	.L47
	cmp	QWORD PTR bootverbose[rip], 0
	jne	.L48
.L16:
	cmp	QWORD PTR dumping[rip], 1
	mov	rdi, r12
	sbb	esi, esi
	xor	edx, edx
	not	esi
	and	esi, 31000
	call	ahci_wait_ready@PLT
	test	rax, rax
	je	.L18
	cmp	QWORD PTR dumping[rip], 0
	jne	.L49
	mov	DWORD PTR [r12], 310
.L18:
	mov	ecx, DWORD PTR AHCI_P_IX_TFE[rip]
	mov	edi, DWORD PTR AHCI_P_IX_HBF[rip]
	mov	DWORD PTR 16[r12], 1
	mov	edx, DWORD PTR AHCI_P_IX_HBD[rip]
	mov	esi, DWORD PTR AHCI_P_IX_IF[rip]
	or	ecx, edi
	mov	eax, DWORD PTR AHCI_P_IX_OF[rip]
	or	edx, ecx
	or	edx, esi
	cmp	QWORD PTR 24[r12], 0
	jne	.L50
	mov	ecx, DWORD PTR AHCI_P_IX_PRC[rip]
	or	eax, edx
.L24:
	mov	edx, DWORD PTR AHCI_P_IX_PC[rip]
	or	edx, DWORD PTR AHCI_P_IX_DP[rip]
	or	edx, DWORD PTR AHCI_P_IX_UF[rip]
	or	edx, ecx
	mov	ecx, DWORD PTR AHCI_P_IX_PS[rip]
	or	edx, eax
	mov	eax, DWORD PTR AHCI_P_IX_DS[rip]
	or	eax, ecx
	cmp	QWORD PTR 0[rbp], 0
	jne	.L40
	or	eax, DWORD PTR AHCI_P_IX_SDB[rip]
	or	eax, DWORD PTR AHCI_P_IX_DHR[rip]
.L40:
	mov	edi, DWORD PTR 40[r12]
	mov	esi, DWORD PTR AHCI_P_IE[rip]
	or	edx, eax
	call	ATA_OUTL@PLT
	mov	eax, DWORD PTR [r12]
	test	eax, eax
	je	.L22
	movsx	rsi, DWORD PTR hz[rip]
	mov	edx, DWORD PTR ahci_reset_to[rip]
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	lea	rdi, 36[r12]
	pop	rbx
	.cfi_def_cfa_offset 32
	mov	rcx, r12
	pop	rbp
	.cfi_def_cfa_offset 24
	mov	rax, rsi
	imul	rsi, rsi, 1717986919
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	sar	eax, 31
	sar	rsi, 34
	sub	esi, eax
	jmp	callout_reset@PLT
	.p2align 4,,10
	.p2align 3
.L50:
	.cfi_restore_state
	or	edx, eax
	mov	eax, DWORD PTR AHCI_P_IX_MP[rip]
	or	edx, DWORD PTR AHCI_P_IX_CPD[rip]
	xor	ecx, ecx
	or	eax, edx
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L45:
	mov	edi, DWORD PTR 4[r13]
	mov	esi, 1
	call	xpt_freeze_devq@PLT
	mov	eax, DWORD PTR CAM_DEV_QFRZN[rip]
	or	DWORD PTR 0[r13], eax
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L48:
	mov	edi, DWORD PTR 44[r12]
	lea	rsi, .LC2[rip]
	call	device_printf@PLT
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L47:
	cmp	QWORD PTR bootverbose[rip], 0
	jne	.L51
.L14:
	mov	DWORD PTR 16[r12], 0
	cmp	QWORD PTR 24[r12], 0
	jne	.L52
.L15:
	mov	edx, DWORD PTR AHCI_P_IX_PRC[rip]
	mov	edi, DWORD PTR 40[r12]
	or	edx, DWORD PTR AHCI_P_IX_PC[rip]
	mov	esi, DWORD PTR AHCI_P_IE[rip]
	or	edx, ebx
	call	ATA_OUTL@PLT
.L41:
	mov	edi, DWORD PTR 32[r12]
	mov	esi, DWORD PTR TRUE[rip]
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	jmp	xpt_release_simq@PLT
	.p2align 4,,10
	.p2align 3
.L22:
	.cfi_restore_state
	mov	esi, 1
	mov	rdi, r12
	call	ahci_start@PLT
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L46:
	mov	edi, DWORD PTR 32[r12]
	mov	esi, DWORD PTR TRUE[rip]
	call	xpt_release_simq@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L44:
	mov	DWORD PTR [r12], 0
	lea	rdi, 36[r12]
	call	callout_stop@PLT
	mov	edi, DWORD PTR 32[r12]
	mov	esi, DWORD PTR TRUE[rip]
	call	xpt_release_simq@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L43:
	mov	edi, DWORD PTR 44[r12]
	lea	rsi, .LC0[rip]
	call	device_printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L52:
	mov	ebx, DWORD PTR AHCI_P_IX_CPD[rip]
	or	ebx, DWORD PTR AHCI_P_IX_MP[rip]
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L51:
	mov	edi, DWORD PTR 44[r12]
	lea	rsi, .LC1[rip]
	call	device_printf@PLT
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L49:
	mov	rdi, r12
	call	ahci_clo@PLT
	jmp	.L18
	.cfi_endproc
.LFE0:
	.size	ahci_reset, .-ahci_reset
	.comm	hz,4,4
	.comm	dumping,8,8
	.comm	bootverbose,8,8
	.comm	ahci_reset_to,4,4
	.comm	TRUE,4,4
	.comm	CAM_REQUEUE_REQ,4,4
	.comm	CAM_RELEASE_SIMQ,4,4
	.comm	CAM_DEV_QFRZN,4,4
	.comm	AHCI_SLOT_RUNNING,8,8
	.comm	AHCI_P_IX_UF,4,4
	.comm	AHCI_P_IX_TFE,4,4
	.comm	AHCI_P_IX_SDB,4,4
	.comm	AHCI_P_IX_PS,4,4
	.comm	AHCI_P_IX_PRC,4,4
	.comm	AHCI_P_IX_PC,4,4
	.comm	AHCI_P_IX_OF,4,4
	.comm	AHCI_P_IX_MP,4,4
	.comm	AHCI_P_IX_IF,4,4
	.comm	AHCI_P_IX_HBF,4,4
	.comm	AHCI_P_IX_HBD,4,4
	.comm	AHCI_P_IX_DS,4,4
	.comm	AHCI_P_IX_DP,4,4
	.comm	AHCI_P_IX_DHR,4,4
	.comm	AHCI_P_IX_CPD,4,4
	.comm	AHCI_P_IE,4,4
	.comm	AHCI_ERR_INNOCENT,4,4
	.comm	AC_BUS_RESET,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_ahci.c_ahci_reset.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"AHCI reset...\012\000"
	.align	2
.LC1:
	.ascii	"AHCI reset: device not found\012\000"
	.align	2
.LC2:
	.ascii	"AHCI reset: device found\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	ahci_reset, %function
ahci_reset:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r4, r0
	ldr	r0, [r0, #32]
	bl	device_get_parent
	bl	device_get_softc
	ldr	r7, .L65
	mov	r6, r0
	mov	r1, #1
	ldr	r0, [r4, #20]
	bl	xpt_freeze_simq
	ldr	r3, [r7]
	cmp	r3, #0
	bne	.L56
.L2:
	ldr	r3, [r4]
	cmp	r3, #0
	bne	.L57
.L3:
	ldr	r5, [r4, #64]
	cmp	r5, #0
	beq	.L4
	mov	r2, #0
	ldr	r3, .L65+4
	ldr	r1, .L65+8
	ldr	r3, [r3]
	ldr	r1, [r1]
	ldr	r8, .L65+12
	orr	r3, r3, r1
	str	r2, [r4, #64]
	str	r3, [r5]
	ldr	r2, [r8]
	tst	r3, r2
	beq	.L58
.L5:
	mov	r1, r5
	mov	r0, r4
	bl	ahci_done
.L4:
	mov	r0, r4
	bl	ahci_stop
	ldr	r3, [r4, #4]
	cmp	r3, #0
	ble	.L10
	mov	r5, #0
	ldr	r9, .L65+16
	ldr	r8, .L65+20
.L6:
	ldr	r0, [r4, #60]
	ldr	r2, [r9]
	ldr	r1, [r0, r5, lsl #2]
	add	r0, r0, r5, lsl #2
	cmp	r1, r2
	add	r5, r5, #1
	blt	.L9
	ldr	r1, [r8]
	bl	ahci_end_transaction
	ldr	r3, [r4, #4]
.L9:
	cmp	r3, r5
	bgt	.L6
	cmp	r3, #0
	ble	.L10
	mov	r5, #0
	mov	r8, r5
	ldr	r0, [r4, #56]
.L12:
	ldr	r1, [r0, r5, lsl #2]
	cmp	r1, #0
	beq	.L11
	mov	r0, r4
	bl	ahci_done
	ldr	r2, [r4, #52]
	ldr	r0, [r4, #56]
	sub	r2, r2, #1
	ldr	r3, [r4, #4]
	str	r8, [r0, r5, lsl #2]
	str	r2, [r4, #52]
.L11:
	add	r5, r5, #1
	cmp	r3, r5
	bgt	.L12
.L10:
	ldr	r3, [r4, #8]
	cmp	r3, #0
	bne	.L59
.L8:
	mov	r5, #0
	ldr	r3, .L65+24
	ldr	r8, .L65+28
	ldr	r0, [r3]
	mov	r2, r5
	ldr	r1, [r4, #36]
	str	r5, [r4, #48]
	str	r5, [r4, #8]
	str	r5, [r4, #44]
	str	r5, [r4, #40]
	bl	xpt_async
	mov	r2, r5
	ldr	r1, [r8]
	ldr	r0, [r4, #28]
	bl	ATA_OUTL
	mov	r0, r4
	bl	ahci_sata_phy_reset
	cmp	r0, r5
	ldr	r3, [r7]
	beq	.L60
	cmp	r3, #0
	bne	.L61
.L16:
	mov	r2, #0
	ldr	r5, .L65+32
	ldr	r1, .L65+36
	ldr	r3, [r5]
	mov	r0, r4
	cmp	r3, r2
	moveq	r1, r3
	bl	ahci_wait_ready
	cmp	r0, #0
	beq	.L18
	ldr	r3, [r5]
	cmp	r3, #0
	ldreq	r3, .L65+40
	streq	r3, [r4]
	bne	.L62
.L18:
	mov	r5, #1
	ldr	r1, [r4, #16]
	ldr	lr, .L65+44
	ldr	r0, .L65+48
	ldr	r3, .L65+52
	ldr	r2, .L65+56
	ldr	ip, .L65+60
	cmp	r1, #0
	ldr	r7, [lr]
	str	r5, [r4, #12]
	ldr	lr, [r0]
	ldr	r1, [r8]
	ldr	r3, [r3]
	ldr	r2, [r2]
	ldr	r5, [ip]
	ldr	r0, [r4, #28]
	bne	.L63
	orr	r2, r3, r2
	ldr	r3, .L65+64
	orr	r2, r2, r7
	orr	r2, r2, r5
	ldr	ip, [r3]
	orr	r2, r2, lr
.L24:
	ldr	lr, .L65+68
	ldr	r3, .L65+72
	ldr	r5, .L65+76
	ldr	r7, [lr]
	ldr	r3, [r3]
	ldr	lr, [r6]
	ldr	r5, [r5]
	orr	r3, r3, r7
	cmp	lr, #0
	orr	r3, r3, r5
	ldr	lr, .L65+80
	ldr	r5, .L65+84
	orr	r3, r3, ip
	ldr	lr, [lr]
	ldr	ip, [r5]
	orr	r2, r3, r2
	orrne	ip, ip, lr
	orrne	r2, ip, r2
	bne	.L23
	ldr	r3, .L65+88
	orr	lr, ip, lr
	ldr	ip, .L65+92
	ldr	r3, [r3]
	ldr	ip, [ip]
	orr	lr, lr, r3
	orr	lr, lr, ip
	orr	r2, lr, r2
.L23:
	bl	ATA_OUTL
	ldr	r3, [r4]
	cmp	r3, #0
	beq	.L22
	ldr	r3, .L65+96
	ldr	r1, .L65+100
	ldr	r3, [r3]
	ldr	r2, .L65+104
	smull	r0, r1, r3, r1
	asr	r3, r3, #31
	rsb	r1, r3, r1, asr #2
	add	r0, r4, #24
	mov	r3, r4
	pop	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	r2, [r2]
	b	callout_reset
.L63:
	orr	r3, r3, r2
	ldr	r8, .L65+108
	orr	r2, r3, r7
	ldr	r3, .L65+112
	orr	r2, r2, r5
	ldr	r5, [r8]
	ldr	r3, [r3]
	orr	r2, r2, lr
	orr	r2, r2, r5
	mov	ip, #0
	orr	r2, r2, r3
	b	.L24
.L58:
	mov	r1, #1
	ldr	r0, [r5, #4]
	bl	xpt_freeze_devq
	ldr	r2, [r8]
	ldr	r3, [r5]
	orr	r3, r3, r2
	str	r3, [r5]
	b	.L5
.L61:
	ldr	r1, .L65+116
	ldr	r0, [r4, #32]
	bl	device_printf
	b	.L16
.L60:
	cmp	r3, r5
	bne	.L64
.L14:
	mov	r2, #0
	ldr	r3, [r4, #16]
	str	r2, [r4, #12]
	cmp	r3, r2
	ldrne	r3, .L65+108
	ldrne	r2, .L65+112
	ldrne	r3, [r3]
	ldrne	r2, [r2]
	ldr	ip, .L65+72
	orrne	r3, r3, r2
	ldr	r2, .L65+64
	ldr	ip, [ip]
	ldr	r2, [r2]
	ldr	r1, [r8]
	orr	r2, r2, ip
	ldr	r0, [r4, #28]
	orr	r2, r2, r3
	bl	ATA_OUTL
.L54:
	ldr	r3, .L65+120
	ldr	r0, [r4, #20]
	ldr	r1, [r3]
	pop	{r4, r5, r6, r7, r8, r9, r10, lr}
	b	xpt_release_simq
.L22:
	mov	r1, #1
	mov	r0, r4
	bl	ahci_start
	b	.L54
.L59:
	ldr	r3, .L65+120
	ldr	r0, [r4, #20]
	ldr	r1, [r3]
	bl	xpt_release_simq
	b	.L8
.L57:
	mov	r3, #0
	mov	r0, r4
	str	r3, [r0], #24
	bl	callout_stop
	ldr	r3, .L65+120
	ldr	r0, [r4, #20]
	ldr	r1, [r3]
	bl	xpt_release_simq
	b	.L3
.L56:
	ldr	r1, .L65+124
	ldr	r0, [r4, #32]
	bl	device_printf
	b	.L2
.L62:
	mov	r0, r4
	bl	ahci_clo
	b	.L18
.L64:
	ldr	r1, .L65+128
	ldr	r0, [r4, #32]
	bl	device_printf
	b	.L14
.L66:
	.align	2
.L65:
	.word	bootverbose
	.word	CAM_REQUEUE_REQ
	.word	CAM_RELEASE_SIMQ
	.word	CAM_DEV_QFRZN
	.word	AHCI_SLOT_RUNNING
	.word	AHCI_ERR_INNOCENT
	.word	AC_BUS_RESET
	.word	AHCI_P_IE
	.word	dumping
	.word	31000
	.word	310
	.word	AHCI_P_IX_HBD
	.word	AHCI_P_IX_OF
	.word	AHCI_P_IX_TFE
	.word	AHCI_P_IX_HBF
	.word	AHCI_P_IX_IF
	.word	AHCI_P_IX_PRC
	.word	AHCI_P_IX_DP
	.word	AHCI_P_IX_PC
	.word	AHCI_P_IX_UF
	.word	AHCI_P_IX_PS
	.word	AHCI_P_IX_DS
	.word	AHCI_P_IX_SDB
	.word	AHCI_P_IX_DHR
	.word	hz
	.word	1717986919
	.word	ahci_reset_to
	.word	AHCI_P_IX_CPD
	.word	AHCI_P_IX_MP
	.word	.LC2
	.word	TRUE
	.word	.LC0
	.word	.LC1
	.size	ahci_reset, .-ahci_reset
	.comm	hz,4,4
	.comm	dumping,4,4
	.comm	bootverbose,4,4
	.comm	ahci_reset_to,4,4
	.comm	TRUE,4,4
	.comm	CAM_REQUEUE_REQ,4,4
	.comm	CAM_RELEASE_SIMQ,4,4
	.comm	CAM_DEV_QFRZN,4,4
	.comm	AHCI_SLOT_RUNNING,4,4
	.comm	AHCI_P_IX_UF,4,4
	.comm	AHCI_P_IX_TFE,4,4
	.comm	AHCI_P_IX_SDB,4,4
	.comm	AHCI_P_IX_PS,4,4
	.comm	AHCI_P_IX_PRC,4,4
	.comm	AHCI_P_IX_PC,4,4
	.comm	AHCI_P_IX_OF,4,4
	.comm	AHCI_P_IX_MP,4,4
	.comm	AHCI_P_IX_IF,4,4
	.comm	AHCI_P_IX_HBF,4,4
	.comm	AHCI_P_IX_HBD,4,4
	.comm	AHCI_P_IX_DS,4,4
	.comm	AHCI_P_IX_DP,4,4
	.comm	AHCI_P_IX_DHR,4,4
	.comm	AHCI_P_IX_CPD,4,4
	.comm	AHCI_P_IE,4,4
	.comm	AHCI_ERR_INNOCENT,4,4
	.comm	AC_BUS_RESET,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
