	.file	"extr_ata-lowlevel.c_ata_generic_command.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"timeout waiting to issue command\n"
	.align 8
.LC1:
	.string	"timeout waiting for PACKET command\n"
	.align 8
.LC2:
	.string	"timeout waiting for ATAPI ready\n"
	.text
	.p2align 4
	.globl	ata_generic_command
	.type	ata_generic_command, @function
ata_generic_command:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	mov	r12, rdi
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	mov	edi, DWORD PTR 24[rdi]
	call	device_get_softc@PLT
	mov	edi, DWORD PTR 28[r12]
	mov	ebx, DWORD PTR ATA_D_IBM[rip]
	mov	rbp, rax
	or	ebx, DWORD PTR ATA_D_LBA[rip]
	call	ATA_DEV@PLT
	mov	esi, DWORD PTR ATA_DRIVE[rip]
	mov	rdi, rbp
	or	ebx, eax
	mov	edx, ebx
	call	ATA_IDX_OUTB@PLT
	mov	esi, DWORD PTR 28[r12]
	xor	edx, edx
	mov	rdi, rbp
	call	ata_wait@PLT
	test	eax, eax
	js	.L21
	mov	edx, DWORD PTR ATA_A_4BIT[rip]
	mov	esi, DWORD PTR ATA_CONTROL[rip]
	mov	rdi, rbp
	call	ATA_IDX_OUTB@PLT
	mov	eax, DWORD PTR [r12]
	mov	r13d, eax
	and	r13d, DWORD PTR ATA_R_ATAPI[rip]
	je	.L4
	mov	esi, DWORD PTR ATA_FEATURE[rip]
	test	DWORD PTR ATA_R_DMA[rip], eax
	je	.L5
	mov	edx, DWORD PTR ATA_F_DMA[rip]
	mov	rdi, rbp
	call	ATA_IDX_OUTB@PLT
	mov	esi, DWORD PTR ATA_CYL_LSB[rip]
	xor	edx, edx
	mov	rdi, rbp
	call	ATA_IDX_OUTB@PLT
	mov	esi, DWORD PTR ATA_CYL_MSB[rip]
	xor	edx, edx
	mov	rdi, rbp
	call	ATA_IDX_OUTB@PLT
.L6:
	mov	edx, DWORD PTR ATA_PACKET_CMD[rip]
	mov	esi, DWORD PTR ATA_COMMAND[rip]
	mov	rdi, rbp
	xor	r13d, r13d
	call	ATA_IDX_OUTB@PLT
	mov	eax, DWORD PTR [r12]
	test	DWORD PTR ATA_R_ATAPI_INTR[rip], eax
	jne	.L1
	mov	esi, DWORD PTR 28[r12]
	xor	edx, edx
	mov	rdi, rbp
	call	ata_wait@PLT
	mov	r13d, eax
	test	eax, eax
	jne	.L22
	mov	ebx, 4999
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L23:
	mov	edi, 20
	sub	ebx, 1
	call	DELAY@PLT
	cmp	ebx, -1
	je	.L9
.L7:
	mov	esi, DWORD PTR ATA_IREASON[rip]
	mov	rdi, rbp
	call	ATA_IDX_INB@PLT
	mov	esi, DWORD PTR ATA_STATUS[rip]
	mov	rdi, rbp
	mov	r14d, eax
	call	ATA_IDX_INB@PLT
	mov	edx, DWORD PTR ATA_I_CMD[rip]
	or	edx, DWORD PTR ATA_I_IN[rip]
	mov	r8d, eax
	mov	eax, DWORD PTR ATA_S_DRQ[rip]
	or	eax, DWORD PTR ATA_S_BUSY[rip]
	and	edx, r14d
	and	eax, r8d
	or	edx, eax
	cmp	edx, DWORD PTR ATAPI_P_CMDOUT[rip]
	jne	.L23
	test	ebx, ebx
	je	.L9
	mov	edi, 10
	call	DELAY@PLT
	mov	eax, DWORD PTR [r12]
	mov	rdx, QWORD PTR 16[r12]
	mov	rdi, rbp
	and	eax, DWORD PTR ATA_R_ATAPI16[rip]
	mov	esi, DWORD PTR ATA_DATA[rip]
	cmp	eax, 1
	sbb	ecx, ecx
	and	ecx, -2
	add	ecx, 8
	call	ATA_IDX_OUTSW_STRM@PLT
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, 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
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	mov	rdi, r12
	call	[QWORD PTR 0[rbp]]
	mov	edx, DWORD PTR 8[r12]
	mov	esi, DWORD PTR ATA_COMMAND[rip]
	mov	rdi, rbp
	call	ATA_IDX_OUTB@PLT
.L1:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, 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
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	xor	edx, edx
	mov	rdi, rbp
	call	ATA_IDX_OUTB@PLT
	mov	edx, DWORD PTR 4[r12]
	mov	esi, DWORD PTR ATA_CYL_LSB[rip]
	mov	rdi, rbp
	call	ATA_IDX_OUTB@PLT
	mov	edx, DWORD PTR 4[r12]
	mov	esi, DWORD PTR ATA_CYL_MSB[rip]
	mov	rdi, rbp
	sar	edx, 8
	call	ATA_IDX_OUTB@PLT
	jmp	.L6
.L9:
	mov	edi, DWORD PTR 24[r12]
	lea	rsi, .LC2[rip]
	mov	r13d, -1
	call	device_printf@PLT
	mov	eax, DWORD PTR ATA_R_TIMEOUT[rip]
	or	DWORD PTR [r12], eax
	jmp	.L1
.L21:
	mov	edi, DWORD PTR 24[r12]
	lea	rsi, .LC0[rip]
	mov	r13d, -1
	call	device_printf@PLT
	mov	eax, DWORD PTR ATA_R_TIMEOUT[rip]
	or	DWORD PTR [r12], eax
	jmp	.L1
.L22:
	mov	r13d, -1
	jns	.L1
	mov	edi, DWORD PTR 24[r12]
	lea	rsi, .LC1[rip]
	call	device_printf@PLT
	mov	eax, DWORD PTR ATA_R_TIMEOUT[rip]
	or	DWORD PTR [r12], eax
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	ata_generic_command, .-ata_generic_command
	.comm	ATA_S_DRQ,4,4
	.comm	ATA_S_BUSY,4,4
	.comm	ATA_STATUS,4,4
	.comm	ATA_R_TIMEOUT,4,4
	.comm	ATA_R_DMA,4,4
	.comm	ATA_R_ATAPI_INTR,4,4
	.comm	ATA_R_ATAPI16,4,4
	.comm	ATA_R_ATAPI,4,4
	.comm	ATA_PACKET_CMD,4,4
	.comm	ATA_I_IN,4,4
	.comm	ATA_I_CMD,4,4
	.comm	ATA_IREASON,4,4
	.comm	ATA_F_DMA,4,4
	.comm	ATA_FEATURE,4,4
	.comm	ATA_D_LBA,4,4
	.comm	ATA_D_IBM,4,4
	.comm	ATA_DRIVE,4,4
	.comm	ATA_DATA,4,4
	.comm	ATA_CYL_MSB,4,4
	.comm	ATA_CYL_LSB,4,4
	.comm	ATA_CONTROL,4,4
	.comm	ATA_COMMAND,4,4
	.comm	ATA_A_4BIT,4,4
	.comm	ATAPI_P_CMDOUT,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_ata-lowlevel.c_ata_generic_command.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"timeout waiting to issue command\012\000"
	.align	2
.LC1:
	.ascii	"timeout waiting for PACKET command\012\000"
	.align	2
.LC2:
	.ascii	"timeout waiting for ATAPI ready\012\000"
	.text
	.align	2
	.global	ata_generic_command
	.syntax unified
	.arm
	.fpu softvfp
	.type	ata_generic_command, %function
ata_generic_command:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r6, r0
	sub	sp, sp, #12
	ldr	r0, [r0, #16]
	bl	device_get_softc
	ldr	r2, .L25
	ldr	r3, .L25+4
	ldr	r5, [r2]
	ldr	r2, [r3]
	ldr	r3, .L25+8
	mov	r4, r0
	ldr	r0, [r6, #20]
	ldr	r7, [r3]
	orr	r5, r5, r2
	bl	ATA_DEV
	mov	r1, r7
	orr	r2, r5, r0
	mov	r0, r4
	bl	ATA_IDX_OUTB
	ldr	r1, [r6, #20]
	mov	r0, r4
	mov	r2, #0
	bl	ata_wait
	cmp	r0, #0
	ldrlt	r1, .L25+12
	blt	.L20
	ldr	r3, .L25+16
	ldr	r2, .L25+20
	ldr	r1, [r3]
	ldr	r2, [r2]
	mov	r0, r4
	bl	ATA_IDX_OUTB
	ldr	r3, .L25+24
	ldr	r2, [r6]
	ldr	r0, [r3]
	ands	r3, r2, r0
	str	r3, [sp]
	beq	.L4
	ldr	r3, .L25+28
	ldr	r1, .L25+32
	ldr	r3, [r3]
	ldr	r1, [r1]
	ands	r2, r2, r3
	beq	.L5
	ldr	r3, .L25+36
	mov	r0, r4
	ldr	r2, [r3]
	bl	ATA_IDX_OUTB
	ldr	r3, .L25+40
	mov	r2, #0
	ldr	r1, [r3]
	mov	r0, r4
	bl	ATA_IDX_OUTB
	ldr	r3, .L25+44
	mov	r2, #0
	mov	r0, r4
	ldr	r1, [r3]
	bl	ATA_IDX_OUTB
.L6:
	ldr	r3, .L25+48
	ldr	r2, .L25+52
	ldr	r1, [r3]
	ldr	r2, [r2]
	mov	r0, r4
	bl	ATA_IDX_OUTB
	ldr	r3, .L25+56
	ldr	r2, [r6]
	ldr	r3, [r3]
	ands	r2, r2, r3
	movne	r3, #0
	strne	r3, [sp]
	bne	.L1
	mov	r0, r4
	ldr	r1, [r6, #20]
	bl	ata_wait
	subs	r3, r0, #0
	str	r3, [sp]
	bne	.L22
	ldr	r5, .L25+60
	ldr	fp, .L25+64
	ldr	r10, .L25+68
	ldr	r9, .L25+72
	ldr	r8, .L25+76
	ldr	r7, .L25+80
	str	r6, [sp, #4]
	b	.L7
.L24:
	mov	r0, #20
	sub	r5, r5, #1
	bl	DELAY
	cmn	r5, #1
	beq	.L23
.L7:
	ldr	r3, .L25+84
	mov	r0, r4
	ldr	r1, [r3]
	bl	ATA_IDX_INB
	ldr	r3, .L25+88
	mov	r6, r0
	ldr	r1, [r3]
	mov	r0, r4
	bl	ATA_IDX_INB
	ldr	r1, [r10]
	ldr	r3, [fp]
	ldr	r2, [r9]
	orr	r3, r3, r1
	ldr	r1, [r8]
	and	r3, r3, r6
	orr	r2, r2, r1
	and	r2, r2, r0
	ldr	r1, [r7]
	orr	r2, r3, r2
	cmp	r2, r1
	bne	.L24
	cmp	r5, #0
	ldr	r6, [sp, #4]
	beq	.L9
	mov	r0, #10
	bl	DELAY
	ldr	r3, .L25+92
	ldr	r2, [r6]
	ldr	r3, [r3]
	ldr	r1, .L25+96
	tst	r2, r3
	mov	r0, r4
	movne	r3, #8
	moveq	r3, #6
	ldr	r2, [r6, #12]
	ldr	r1, [r1]
	bl	ATA_IDX_OUTSW_STRM
	ldr	r0, [sp]
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L4:
	ldr	r3, [r4]
	mov	r0, r6
	blx	r3
	ldr	r3, .L25+48
	mov	r0, r4
	ldr	r2, [r6, #8]
	ldr	r1, [r3]
	bl	ATA_IDX_OUTB
.L1:
	ldr	r0, [sp]
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L5:
	mov	r0, r4
	bl	ATA_IDX_OUTB
	ldr	r3, .L25+40
	ldr	r2, [r6, #4]
	ldr	r1, [r3]
	mov	r0, r4
	bl	ATA_IDX_OUTB
	ldr	r2, [r6, #4]
	ldr	r3, .L25+44
	mov	r0, r4
	ldr	r1, [r3]
	asr	r2, r2, #8
	bl	ATA_IDX_OUTB
	b	.L6
.L22:
	mvnge	r3, #0
	strge	r3, [sp]
	bge	.L1
	ldr	r1, .L25+100
.L20:
	ldr	r0, [r6, #16]
	bl	device_printf
	mvn	r1, #0
	ldr	r2, .L25+104
	ldr	r3, [r6]
	ldr	r2, [r2]
	str	r1, [sp]
	orr	r3, r3, r2
	str	r3, [r6]
	b	.L1
.L23:
	ldr	r6, [sp, #4]
.L9:
	ldr	r1, .L25+108
	b	.L20
.L26:
	.align	2
.L25:
	.word	ATA_D_IBM
	.word	ATA_D_LBA
	.word	ATA_DRIVE
	.word	.LC0
	.word	ATA_CONTROL
	.word	ATA_A_4BIT
	.word	ATA_R_ATAPI
	.word	ATA_R_DMA
	.word	ATA_FEATURE
	.word	ATA_F_DMA
	.word	ATA_CYL_LSB
	.word	ATA_CYL_MSB
	.word	ATA_COMMAND
	.word	ATA_PACKET_CMD
	.word	ATA_R_ATAPI_INTR
	.word	4999
	.word	ATA_I_CMD
	.word	ATA_I_IN
	.word	ATA_S_DRQ
	.word	ATA_S_BUSY
	.word	ATAPI_P_CMDOUT
	.word	ATA_IREASON
	.word	ATA_STATUS
	.word	ATA_R_ATAPI16
	.word	ATA_DATA
	.word	.LC1
	.word	ATA_R_TIMEOUT
	.word	.LC2
	.size	ata_generic_command, .-ata_generic_command
	.comm	ATA_S_DRQ,4,4
	.comm	ATA_S_BUSY,4,4
	.comm	ATA_STATUS,4,4
	.comm	ATA_R_TIMEOUT,4,4
	.comm	ATA_R_DMA,4,4
	.comm	ATA_R_ATAPI_INTR,4,4
	.comm	ATA_R_ATAPI16,4,4
	.comm	ATA_R_ATAPI,4,4
	.comm	ATA_PACKET_CMD,4,4
	.comm	ATA_I_IN,4,4
	.comm	ATA_I_CMD,4,4
	.comm	ATA_IREASON,4,4
	.comm	ATA_F_DMA,4,4
	.comm	ATA_FEATURE,4,4
	.comm	ATA_D_LBA,4,4
	.comm	ATA_D_IBM,4,4
	.comm	ATA_DRIVE,4,4
	.comm	ATA_DATA,4,4
	.comm	ATA_CYL_MSB,4,4
	.comm	ATA_CYL_LSB,4,4
	.comm	ATA_CONTROL,4,4
	.comm	ATA_COMMAND,4,4
	.comm	ATA_A_4BIT,4,4
	.comm	ATAPI_P_CMDOUT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
