	.file	"extr_advansys.c_AscInitMicroCodeVar.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	AscInitMicroCodeVar, @function
AscInitMicroCodeVar:
.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
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 24
	.cfi_def_cfa_offset 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	call	asc_dvc_to_board@PLT
	mov	r12d, DWORD PTR 32[rbp]
	mov	r13, rax
	mov	eax, DWORD PTR ASC_MAX_TID[rip]
	test	eax, eax
	js	.L2
	xor	ebx, ebx
	.p2align 4,,10
	.p2align 3
.L3:
	mov	rax, QWORD PTR 16[rbp]
	mov	esi, ebx
	mov	edi, r12d
	mov	rax, QWORD PTR 24[rax]
	mov	edx, DWORD PTR [rax+rbx*4]
	add	rbx, 1
	call	AscPutMCodeInitSDTRAtID@PLT
	cmp	DWORD PTR ASC_MAX_TID[rip], ebx
	jge	.L3
.L2:
	mov	rdi, rbp
	call	AscInitQLinkVar@PLT
	mov	rax, QWORD PTR 16[rbp]
	mov	esi, DWORD PTR ASCV_DISC_ENABLE_B[rip]
	mov	edi, r12d
	mov	edx, DWORD PTR 20[rax]
	call	AscWriteLramByte@PLT
	mov	rax, QWORD PTR 16[rbp]
	mov	edi, DWORD PTR 16[rax]
	call	ASC_TID_TO_TARGET_ID@PLT
	mov	esi, DWORD PTR ASCV_HOSTSCSI_ID_B[rip]
	mov	edi, r12d
	mov	edx, eax
	call	AscWriteLramByte@PLT
	mov	rdi, QWORD PTR 24[rbp]
	and	edi, 7
	call	BUG_ON@PLT
	mov	rsi, QWORD PTR 24[rbp]
	mov	edi, DWORD PTR 0[r13]
	mov	ecx, DWORD PTR DMA_FROM_DEVICE[rip]
	mov	rdx, QWORD PTR ASC_OVERRUN_BSIZE[rip]
	call	dma_map_single@PLT
	mov	edi, DWORD PTR 0[r13]
	mov	QWORD PTR 0[rbp], rax
	mov	rsi, rax
	call	dma_mapping_error@PLT
	test	rax, rax
	je	.L4
	mov	r12d, DWORD PTR ENOMEM[rip]
	neg	r12d
.L5:
	mov	QWORD PTR 0[rbp], 0
.L1:
	mov	rax, QWORD PTR 8[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L15
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	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
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	mov	rdi, QWORD PTR 0[rbp]
	call	cpu_to_le32@PLT
	mov	rdx, rsp
	mov	ecx, 1
	mov	edi, r12d
	mov	esi, DWORD PTR ASCV_OVERRUN_PADDR_D[rip]
	mov	DWORD PTR [rsp], eax
	call	AscMemDWordCopyPtrToLram@PLT
	mov	rdi, QWORD PTR ASC_OVERRUN_BSIZE[rip]
	call	cpu_to_le32@PLT
	mov	esi, DWORD PTR ASCV_OVERRUN_BSIZE_D[rip]
	lea	rdx, 4[rsp]
	mov	edi, r12d
	mov	ecx, 1
	mov	DWORD PTR 4[rsp], eax
	call	AscMemDWordCopyPtrToLram@PLT
	mov	esi, DWORD PTR ASCV_MC_DATE_W[rip]
	mov	rbx, QWORD PTR 16[rbp]
	mov	edi, r12d
	call	AscReadLramWord@PLT
	mov	esi, DWORD PTR ASCV_MC_VER_W[rip]
	mov	edi, r12d
	mov	QWORD PTR 8[rbx], rax
	mov	rbx, QWORD PTR 16[rbp]
	call	AscReadLramWord@PLT
	mov	rsi, QWORD PTR ASC_MCODE_START_ADDR[rip]
	mov	edi, r12d
	mov	QWORD PTR [rbx], rax
	call	AscSetPCAddr@PLT
	mov	edi, r12d
	call	AscGetPCAddr@PLT
	cmp	rax, QWORD PTR ASC_MCODE_START_ADDR[rip]
	je	.L6
	mov	eax, DWORD PTR ASC_IERR_SET_PC_ADDR[rip]
	or	DWORD PTR 8[rbp], eax
	mov	r12d, DWORD PTR EINVAL[rip]
	neg	r12d
.L7:
	mov	ecx, DWORD PTR DMA_FROM_DEVICE[rip]
	mov	rdx, QWORD PTR ASC_OVERRUN_BSIZE[rip]
	mov	rsi, QWORD PTR 0[rbp]
	mov	edi, DWORD PTR 0[r13]
	call	dma_unmap_single@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	mov	edi, r12d
	xor	r12d, r12d
	call	AscStartChip@PLT
	cmp	eax, 1
	je	.L1
	mov	r12d, DWORD PTR EIO[rip]
	mov	eax, DWORD PTR ASC_IERR_START_STOP_CHIP[rip]
	or	DWORD PTR 8[rbp], eax
	neg	r12d
	jmp	.L7
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	AscInitMicroCodeVar, .-AscInitMicroCodeVar
	.comm	ENOMEM,4,4
	.comm	EIO,4,4
	.comm	EINVAL,4,4
	.comm	DMA_FROM_DEVICE,4,4
	.comm	ASC_OVERRUN_BSIZE,8,8
	.comm	ASC_MCODE_START_ADDR,8,8
	.comm	ASC_MAX_TID,4,4
	.comm	ASC_IERR_START_STOP_CHIP,4,4
	.comm	ASC_IERR_SET_PC_ADDR,4,4
	.comm	ASCV_OVERRUN_PADDR_D,4,4
	.comm	ASCV_OVERRUN_BSIZE_D,4,4
	.comm	ASCV_MC_VER_W,8,8
	.comm	ASCV_MC_DATE_W,8,8
	.comm	ASCV_HOSTSCSI_ID_B,4,4
	.comm	ASCV_DISC_ENABLE_B,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_advansys.c_AscInitMicroCodeVar.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	AscInitMicroCodeVar, %function
AscInitMicroCodeVar:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r3, .L18
	sub	sp, sp, #20
	ldr	r3, [r3]
	str	r3, [sp, #12]
	mov	r3,#0
	mov	r5, r0
	bl	asc_dvc_to_board
	ldr	r7, .L18+4
	mov	r8, r0
	ldr	r3, [r7]
	ldr	r6, [r5, #16]
	cmp	r3, #0
	blt	.L2
	mov	r4, #0
.L3:
	ldr	r3, [r5, #8]
	mov	r1, r4
	ldr	r3, [r3, #16]
	mov	r0, r6
	ldr	r2, [r3, r4, lsl #2]
	bl	AscPutMCodeInitSDTRAtID
	ldr	r3, [r7]
	add	r4, r4, #1
	cmp	r3, r4
	bge	.L3
.L2:
	mov	r0, r5
	bl	AscInitQLinkVar
	ldr	r3, .L18+8
	ldr	r2, [r5, #8]
	ldr	r1, [r3]
	ldr	r2, [r2, #12]
	mov	r0, r6
	bl	AscWriteLramByte
	ldr	r3, [r5, #8]
	ldr	r2, .L18+12
	ldr	r0, [r3, #8]
	ldr	r4, [r2]
	bl	ASC_TID_TO_TARGET_ID
	mov	r1, r4
	mov	r2, r0
	mov	r0, r6
	bl	AscWriteLramByte
	ldr	r0, [r5, #12]
	ldr	r7, .L18+16
	ldr	r4, .L18+20
	and	r0, r0, #7
	bl	BUG_ON
	ldr	r3, [r7]
	ldr	r2, [r4]
	ldr	r1, [r5, #12]
	ldr	r0, [r8]
	bl	dma_map_single
	mov	r1, r0
	ldr	r0, [r8]
	str	r1, [r5]
	bl	dma_mapping_error
	subs	r9, r0, #0
	beq	.L4
	ldr	r3, .L18+24
	ldr	r0, [r3]
	rsb	r9, r0, #0
.L5:
	mov	r3, #0
	str	r3, [r5]
.L1:
	ldr	r3, .L18
	ldr	r2, [r3]
	ldr	r3, [sp, #12]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L17
	mov	r0, r9
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L4:
	ldr	r0, [r5]
	bl	cpu_to_le32
	mov	ip, r0
	ldr	r2, .L18+28
	mov	r3, #1
	ldr	r1, [r2]
	mov	r0, r6
	add	r2, sp, #4
	str	ip, [sp, #4]
	bl	AscMemDWordCopyPtrToLram
	ldr	r0, [r4]
	bl	cpu_to_le32
	mov	ip, r0
	ldr	r2, .L18+32
	mov	r3, #1
	ldr	r1, [r2]
	mov	r0, r6
	add	r2, sp, #8
	str	ip, [sp, #8]
	bl	AscMemDWordCopyPtrToLram
	ldr	r3, .L18+36
	mov	r0, r6
	ldr	r1, [r3]
	ldr	r10, [r5, #8]
	bl	AscReadLramWord
	ldr	r3, .L18+40
	str	r0, [r10, #4]
	ldr	r1, [r3]
	mov	r0, r6
	ldr	fp, [r5, #8]
	bl	AscReadLramWord
	ldr	r10, .L18+44
	str	r0, [fp]
	ldr	r1, [r10]
	mov	r0, r6
	bl	AscSetPCAddr
	mov	r0, r6
	bl	AscGetPCAddr
	ldr	r3, [r10]
	cmp	r0, r3
	beq	.L6
	ldr	r3, .L18+48
	ldr	r1, .L18+52
.L15:
.L7:
	ldr	r2, [r3]
	ldr	r3, [r5, #4]
	ldr	r0, [r1]
	orr	r3, r3, r2
	str	r3, [r5, #4]
	rsb	r9, r0, #0
	ldr	r3, [r7]
	ldr	r2, [r4]
	ldr	r0, [r8]
	ldr	r1, [r5]
	bl	dma_unmap_single
	b	.L5
.L6:
	mov	r0, r6
	bl	AscStartChip
	cmp	r0, #1
	beq	.L1
	ldr	r3, .L18+56
	ldr	r1, .L18+60
	b	.L15
.L17:
	bl	__stack_chk_fail
.L19:
	.align	2
.L18:
	.word	.LC0
	.word	ASC_MAX_TID
	.word	ASCV_DISC_ENABLE_B
	.word	ASCV_HOSTSCSI_ID_B
	.word	DMA_FROM_DEVICE
	.word	ASC_OVERRUN_BSIZE
	.word	ENOMEM
	.word	ASCV_OVERRUN_PADDR_D
	.word	ASCV_OVERRUN_BSIZE_D
	.word	ASCV_MC_DATE_W
	.word	ASCV_MC_VER_W
	.word	ASC_MCODE_START_ADDR
	.word	ASC_IERR_SET_PC_ADDR
	.word	EINVAL
	.word	ASC_IERR_START_STOP_CHIP
	.word	EIO
	.size	AscInitMicroCodeVar, .-AscInitMicroCodeVar
	.comm	ENOMEM,4,4
	.comm	EIO,4,4
	.comm	EINVAL,4,4
	.comm	DMA_FROM_DEVICE,4,4
	.comm	ASC_OVERRUN_BSIZE,4,4
	.comm	ASC_MCODE_START_ADDR,4,4
	.comm	ASC_MAX_TID,4,4
	.comm	ASC_IERR_START_STOP_CHIP,4,4
	.comm	ASC_IERR_SET_PC_ADDR,4,4
	.comm	ASCV_OVERRUN_PADDR_D,4,4
	.comm	ASCV_OVERRUN_BSIZE_D,4,4
	.comm	ASCV_MC_VER_W,4,4
	.comm	ASCV_MC_DATE_W,4,4
	.comm	ASCV_HOSTSCSI_ID_B,4,4
	.comm	ASCV_DISC_ENABLE_B,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
