	.file	"extr_boot.c_wl1251_boot_upload_firmware.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"chip id before fw upload: 0x%x"
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"fw_data_len %zu chunk_size %d"
	.section	.rodata.str1.8
	.align 8
.LC2:
	.string	"firmware length not multiple of four"
	.align 8
.LC3:
	.string	"allocation for firmware upload chunk failed"
	.align 8
.LC4:
	.string	"uploading fw chunk 0x%p to 0x%x"
	.align 8
.LC5:
	.string	"uploading fw last chunk (%zu B) 0x%p to 0x%x"
	.text
	.p2align 4
	.type	wl1251_boot_upload_firmware, @function
wl1251_boot_upload_firmware:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdi
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	esi, DWORD PTR CHIP_ID_B[rip]
	call	wl1251_reg_read32@PLT
	mov	edi, DWORD PTR DEBUG_BOOT[rip]
	lea	rsi, .LC0[rip]
	mov	edx, eax
	xor	eax, eax
	call	wl1251_debug@PLT
	mov	rax, QWORD PTR [rbx]
	mov	rcx, QWORD PTR CHUNK_SIZE[rip]
	lea	rsi, .LC1[rip]
	mov	edi, DWORD PTR DEBUG_BOOT[rip]
	mov	r12d, DWORD PTR 16[rax]
	mov	edx, DWORD PTR 20[rax]
	sal	r12d, 24
	sal	edx, 16
	or	r12d, edx
	or	r12d, DWORD PTR 28[rax]
	mov	eax, DWORD PTR 24[rax]
	sal	eax, 8
	or	r12d, eax
	movsx	rax, r12d
	mov	QWORD PTR [rsp], rax
	mov	rdx, rax
	xor	eax, eax
	call	wl1251_debug@PLT
	and	r12d, 3
	mov	DWORD PTR 12[rsp], r12d
	jne	.L12
	mov	esi, DWORD PTR GFP_KERNEL[rip]
	mov	rdi, QWORD PTR CHUNK_SIZE[rip]
	call	kmalloc@PLT
	mov	rbp, rax
	test	rax, rax
	je	.L13
	mov	esi, DWORD PTR WL1251_PART_DOWN_MEM_START[rip]
	mov	r8d, DWORD PTR WL1251_PART_DOWN_REG_SIZE[rip]
	mov	rdi, rbx
	mov	ecx, DWORD PTR WL1251_PART_DOWN_REG_START[rip]
	mov	edx, DWORD PTR WL1251_PART_DOWN_MEM_SIZE[rip]
	call	wl1251_set_partition@PLT
	mov	eax, DWORD PTR WL1251_PART_DOWN_MEM_SIZE[rip]
	mov	rsi, QWORD PTR CHUNK_SIZE[rip]
	mov	DWORD PTR 8[rsp], eax
	cmp	QWORD PTR [rsp], rsi
	jb	.L8
	xor	r12d, r12d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	imul	r15d, esi
	movsx	rax, DWORD PTR FW_HDR_SIZE[rip]
	mov	edi, DWORD PTR DEBUG_BOOT[rip]
	imul	rsi, r12
	add	r12, 1
	add	r15d, edx
	add	rsi, rax
	mov	rax, QWORD PTR [rbx]
	mov	ecx, r15d
	lea	r14, [rax+rsi*4]
	lea	rsi, .LC4[rip]
	xor	eax, eax
	mov	rdx, r14
	call	wl1251_debug@PLT
	mov	r13, QWORD PTR CHUNK_SIZE[rip]
	mov	rsi, r14
	mov	rdi, rbp
	mov	rdx, r13
	call	memcpy@PLT
	mov	rdx, rbp
	mov	esi, r15d
	mov	rcx, r13
	mov	rdi, rbx
	call	wl1251_mem_write@PLT
	mov	rsi, QWORD PTR CHUNK_SIZE[rip]
	mov	rax, QWORD PTR [rsp]
	xor	edx, edx
	div	rsi
	cmp	rax, r12
	jbe	.L14
.L7:
	lea	eax, 2[r12]
	mov	edx, DWORD PTR WL1251_PART_DOWN_MEM_START[rip]
	mov	r15d, r12d
	imul	eax, esi
	add	eax, edx
	cmp	eax, DWORD PTR 8[rsp]
	jle	.L6
	imul	esi, r12d
	mov	r11d, DWORD PTR WL1251_PART_DOWN_MEM_SIZE[rip]
	mov	r8d, DWORD PTR WL1251_PART_DOWN_REG_SIZE[rip]
	mov	rdi, rbx
	mov	ecx, DWORD PTR WL1251_PART_DOWN_REG_START[rip]
	lea	eax, [r11+rsi]
	add	esi, edx
	mov	edx, r11d
	mov	DWORD PTR 8[rsp], eax
	call	wl1251_set_partition@PLT
	mov	edx, DWORD PTR WL1251_PART_DOWN_MEM_START[rip]
	mov	rsi, QWORD PTR CHUNK_SIZE[rip]
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L14:
	mov	r14d, r12d
	mov	r9, r12
	imul	r14d, esi
	imul	r9, rsi
.L5:
	movsx	rax, DWORD PTR FW_HDR_SIZE[rip]
	xor	edx, edx
	mov	rdi, rbp
	add	r14d, DWORD PTR WL1251_PART_DOWN_MEM_START[rip]
	add	r9, rax
	mov	rax, QWORD PTR [rbx]
	lea	r15, [rax+r9*4]
	mov	rax, QWORD PTR [rsp]
	div	rsi
	mov	rsi, r15
	mov	r13, rdx
	call	memcpy@PLT
	mov	edi, DWORD PTR DEBUG_BOOT[rip]
	mov	r8d, r14d
	xor	eax, eax
	mov	rcx, r15
	mov	rdx, r13
	lea	rsi, .LC5[rip]
	call	wl1251_debug@PLT
	mov	rdi, rbx
	mov	rcx, r13
	mov	rdx, rbp
	mov	esi, r14d
	call	wl1251_mem_write@PLT
	mov	rdi, rbp
	call	kfree@PLT
.L1:
	mov	eax, DWORD PTR 12[rsp]
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L12:
	.cfi_restore_state
	lea	rdi, .LC2[rip]
	call	wl1251_error@PLT
	mov	eax, DWORD PTR EIO[rip]
	neg	eax
	mov	DWORD PTR 12[rsp], eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L8:
	xor	r9d, r9d
	xor	r14d, r14d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L13:
	lea	rdi, .LC3[rip]
	call	wl1251_error@PLT
	mov	eax, DWORD PTR ENOMEM[rip]
	neg	eax
	mov	DWORD PTR 12[rsp], eax
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	wl1251_boot_upload_firmware, .-wl1251_boot_upload_firmware
	.comm	WL1251_PART_DOWN_REG_START,4,4
	.comm	WL1251_PART_DOWN_REG_SIZE,4,4
	.comm	WL1251_PART_DOWN_MEM_START,4,4
	.comm	WL1251_PART_DOWN_MEM_SIZE,4,4
	.comm	GFP_KERNEL,4,4
	.comm	FW_HDR_SIZE,4,4
	.comm	ENOMEM,4,4
	.comm	EIO,4,4
	.comm	DEBUG_BOOT,4,4
	.comm	CHUNK_SIZE,8,8
	.comm	CHIP_ID_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_boot.c_wl1251_boot_upload_firmware.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"chip id before fw upload: 0x%x\000"
	.align	2
.LC1:
	.ascii	"fw_data_len %zu chunk_size %d\000"
	.align	2
.LC2:
	.ascii	"firmware length not multiple of four\000"
	.align	2
.LC3:
	.ascii	"allocation for firmware upload chunk failed\000"
	.align	2
.LC4:
	.ascii	"uploading fw chunk 0x%p to 0x%x\000"
	.global	__aeabi_uidiv
	.global	__aeabi_uidivmod
	.align	2
.LC5:
	.ascii	"uploading fw last chunk (%zu B) 0x%p to 0x%x\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	wl1251_boot_upload_firmware, %function
wl1251_boot_upload_firmware:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r3, .L17
	ldr	r5, .L17+4
	ldr	r1, [r3]
	sub	sp, sp, #20
	ldr	r4, [r5]
	mov	r8, r0
	bl	wl1251_reg_read32
	ldr	r1, .L17+8
	mov	r2, r0
	mov	r0, r4
	bl	wl1251_debug
	ldr	r3, [r8]
	ldr	r7, .L17+12
	ldr	r6, [r3, #20]
	ldr	r1, [r3, #16]
	ldr	r2, [r3, #28]
	lsl	r6, r6, #16
	ldr	r3, [r3, #24]
	orr	r6, r6, r1, lsl #24
	orr	r6, r6, r2
	orr	r6, r6, r3, lsl #8
	ldr	r0, [r5]
	mov	r2, r6
	ldr	r3, [r7]
	ldr	r1, .L17+16
	bl	wl1251_debug
	ands	r5, r6, #3
	bne	.L13
	ldr	r3, .L17+20
	ldr	r0, [r7]
	ldr	r1, [r3]
	bl	kmalloc
	subs	r9, r0, #0
	beq	.L14
	ldr	r3, .L17+24
	ldr	r10, .L17+28
	ldr	r3, [r3]
	ldr	r1, .L17+32
	str	r3, [sp]
	ldr	r3, .L17+36
	ldr	r2, [r10]
	ldr	r3, [r3]
	mov	r0, r8
	ldr	r1, [r1]
	bl	wl1251_set_partition
	ldr	r4, [r7]
	ldr	r3, [r10]
	cmp	r6, r4
	ldr	r10, .L17+40
	ldrcs	fp, .L17+44
	str	r3, [sp, #12]
	bcs	.L7
.L5:
	ldr	r3, .L17+32
	ldr	r2, [r10]
	ldr	ip, [r3]
	ldr	r3, [r8]
	add	r2, r5, r2
	mov	r1, r4
	mov	r0, r6
	add	r5, r5, ip
	add	r6, r3, r2, lsl #2
	bl	__aeabi_uidivmod
	mov	r4, r1
	mov	r0, r9
	mov	r1, r6
	mov	r2, r4
	bl	memcpy
	ldr	r2, .L17+4
	str	r5, [sp]
	mov	r3, r6
	ldr	r0, [r2]
	ldr	r1, .L17+48
	mov	r2, r4
	bl	wl1251_debug
	mov	r3, r4
	mov	r2, r9
	mov	r1, r5
	mov	r0, r8
	bl	wl1251_mem_write
	mov	r0, r9
	bl	kfree
	mov	r0, #0
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L16:
	ldr	r3, .L17+28
	mul	r4, r5, r4
	ldr	r2, [r3]
	ldr	r3, .L17+24
	add	r1, r1, r4
	ldr	r3, [r3]
	add	ip, r2, r4
	str	r3, [sp]
	ldr	r3, .L17+36
	mov	r0, r8
	ldr	r3, [r3]
	str	ip, [sp, #12]
	bl	wl1251_set_partition
	ldr	r3, .L17+32
	ldr	r1, [r3]
.L6:
	ldr	r4, [r7]
	ldr	r2, [r10]
	mul	r4, r5, r4
	ldr	r3, [r8]
	ldr	r0, .L17+4
	add	r2, r4, r2
	add	r4, r4, r1
	add	r2, r3, r2, lsl #2
	mov	r1, fp
	mov	r3, r4
	ldr	r0, [r0]
	str	r2, [sp, #8]
	bl	wl1251_debug
	ldr	r3, [r7]
	ldr	r2, [sp, #8]
	mov	r0, r9
	mov	r1, r2
	mov	r2, r3
	str	r3, [sp, #8]
	bl	memcpy
	mov	r1, r4
	mov	r2, r9
	ldr	r3, [sp, #8]
	mov	r0, r8
	bl	wl1251_mem_write
	ldr	r4, [r7]
	mov	r0, r6
	mov	r1, r4
	bl	__aeabi_uidiv
	add	r5, r5, #1
	cmp	r0, r5
	bls	.L15
.L7:
	ldr	r3, .L17+32
	ldr	r2, [sp, #12]
	ldr	r1, [r3]
	add	r3, r5, #2
	mla	r3, r4, r3, r1
	cmp	r3, r2
	ble	.L6
	b	.L16
.L15:
	mul	r5, r4, r5
	b	.L5
.L13:
	ldr	r0, .L17+52
	bl	wl1251_error
	ldr	r3, .L17+56
	ldr	r0, [r3]
	rsb	r0, r0, #0
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L14:
	ldr	r0, .L17+60
	bl	wl1251_error
	ldr	r3, .L17+64
	ldr	r0, [r3]
	rsb	r0, r0, #0
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L18:
	.align	2
.L17:
	.word	CHIP_ID_B
	.word	DEBUG_BOOT
	.word	.LC0
	.word	CHUNK_SIZE
	.word	.LC1
	.word	GFP_KERNEL
	.word	WL1251_PART_DOWN_REG_SIZE
	.word	WL1251_PART_DOWN_MEM_SIZE
	.word	WL1251_PART_DOWN_MEM_START
	.word	WL1251_PART_DOWN_REG_START
	.word	FW_HDR_SIZE
	.word	.LC4
	.word	.LC5
	.word	.LC2
	.word	EIO
	.word	.LC3
	.word	ENOMEM
	.size	wl1251_boot_upload_firmware, .-wl1251_boot_upload_firmware
	.comm	WL1251_PART_DOWN_REG_START,4,4
	.comm	WL1251_PART_DOWN_REG_SIZE,4,4
	.comm	WL1251_PART_DOWN_MEM_START,4,4
	.comm	WL1251_PART_DOWN_MEM_SIZE,4,4
	.comm	GFP_KERNEL,4,4
	.comm	FW_HDR_SIZE,4,4
	.comm	ENOMEM,4,4
	.comm	EIO,4,4
	.comm	DEBUG_BOOT,4,4
	.comm	CHUNK_SIZE,4,4
	.comm	CHIP_ID_B,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
