	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function load_8051_firmware
_load_8051_firmware:                    ## @load_8051_firmware
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_DC_DC8051_CFG_RST_M8051W_SMASK@GOTPCREL(%rip), %r14
	movq	_DC_DC8051_CFG_RST_CRAM_SMASK@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	orq	(%r14), %rdx
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	_DC_DC8051_CFG_RST_DRAM_SMASK@GOTPCREL(%rip), %rax
	orq	(%rax), %rdx
	movq	_DC_DC8051_CFG_RST_IRAM_SMASK@GOTPCREL(%rip), %rax
	orq	(%rax), %rdx
	movq	_DC_DC8051_CFG_RST_SFR_SMASK@GOTPCREL(%rip), %rax
	orq	(%rax), %rdx
	movq	_DC_DC8051_CFG_RST@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	callq	_write_csr
	movq	(%r14), %rdx
	movl	(%r12), %esi
	movq	%r15, %rdi
	callq	_write_csr
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_load_security_variables
	movq	_MISC_CFG_FW_CTRL@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_write_csr
	movl	4(%rbx), %r8d
	movl	8(%rbx), %ecx
	movq	%r15, %rdi
	movl	$1, %esi
	xorl	%edx, %edx
	callq	_write_8051
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_7
## %bb.1:
	movl	(%r13), %esi
	movq	_MISC_CFG_FW_CTRL_FW_8051_LOADED_SMASK@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	%r15, %rdi
	callq	_write_csr
	movl	(%rbx), %edx
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	callq	_run_rsa
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_7
## %bb.2:
	movl	(%r12), %esi
	xorl	%r14d, %r14d
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_write_csr
	movq	_TIMEOUT_8051_START@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_wait_fm_ready
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movq	%r15, %rdi
	callq	_get_firmware_state
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	movl	%eax, %edx
	callq	_dd_dev_err
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_4:
	leaq	-64(%rbp), %rsi
	leaq	-56(%rbp), %rdx
	leaq	-48(%rbp), %rcx
	movq	%r15, %rdi
	callq	_read_misc_status
	movl	-64(%rbp), %edx
	movl	-56(%rbp), %ecx
	movl	-48(%rbp), %r8d
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	callq	_dd_dev_info
	movq	-64(%rbp), %rdi
	movq	-56(%rbp), %rsi
	movq	-48(%rbp), %rdx
	callq	_dc8051_ver
	movl	%eax, (%r15)
	movq	_HOST_INTERFACE_VERSION@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_write_host_interface_version
	movq	_HCMD_SUCCESS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_7
## %bb.5:
	leaq	L_.str.3(%rip), %rsi
	movq	%r15, %rdi
	movl	%eax, %edx
	callq	_dd_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
LBB0_6:
	subl	(%rax), %r14d
LBB0_7:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DC_DC8051_CFG_RST_M8051W_SMASK,8,3 ## @DC_DC8051_CFG_RST_M8051W_SMASK
	.comm	_DC_DC8051_CFG_RST_CRAM_SMASK,8,3 ## @DC_DC8051_CFG_RST_CRAM_SMASK
	.comm	_DC_DC8051_CFG_RST_DRAM_SMASK,8,3 ## @DC_DC8051_CFG_RST_DRAM_SMASK
	.comm	_DC_DC8051_CFG_RST_IRAM_SMASK,8,3 ## @DC_DC8051_CFG_RST_IRAM_SMASK
	.comm	_DC_DC8051_CFG_RST_SFR_SMASK,8,3 ## @DC_DC8051_CFG_RST_SFR_SMASK
	.comm	_DC_DC8051_CFG_RST,4,2          ## @DC_DC8051_CFG_RST
	.comm	_MISC_CFG_FW_CTRL,4,2           ## @MISC_CFG_FW_CTRL
	.comm	_MISC_CFG_FW_CTRL_FW_8051_LOADED_SMASK,8,3 ## @MISC_CFG_FW_CTRL_FW_8051_LOADED_SMASK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"8051"

	.comm	_TIMEOUT_8051_START,4,2         ## @TIMEOUT_8051_START
L_.str.1:                               ## @.str.1
	.asciz	"8051 start timeout, current state 0x%x\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
L_.str.2:                               ## @.str.2
	.asciz	"8051 firmware version %d.%d.%d\n"

	.comm	_HOST_INTERFACE_VERSION,4,2     ## @HOST_INTERFACE_VERSION
	.comm	_HCMD_SUCCESS,4,2               ## @HCMD_SUCCESS
L_.str.3:                               ## @.str.3
	.asciz	"Failed to set host interface version, return 0x%x\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_load_8051_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function load_8051_firmware
_load_8051_firmware:                    ; @load_8051_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x22, _DC_DC8051_CFG_RST_M8051W_SMASK@GOTPAGE
Lloh1:
	ldr	x22, [x22, _DC_DC8051_CFG_RST_M8051W_SMASK@GOTPAGEOFF]
Lloh2:
	adrp	x8, _DC_DC8051_CFG_RST_CRAM_SMASK@GOTPAGE
Lloh3:
	ldr	x8, [x8, _DC_DC8051_CFG_RST_CRAM_SMASK@GOTPAGEOFF]
	ldr	x9, [x22]
Lloh4:
	ldr	x8, [x8]
	orr	x8, x8, x9
Lloh5:
	adrp	x9, _DC_DC8051_CFG_RST_DRAM_SMASK@GOTPAGE
Lloh6:
	ldr	x9, [x9, _DC_DC8051_CFG_RST_DRAM_SMASK@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	orr	x8, x8, x9
Lloh8:
	adrp	x9, _DC_DC8051_CFG_RST_IRAM_SMASK@GOTPAGE
Lloh9:
	ldr	x9, [x9, _DC_DC8051_CFG_RST_IRAM_SMASK@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
Lloh11:
	adrp	x10, _DC_DC8051_CFG_RST_SFR_SMASK@GOTPAGE
Lloh12:
	ldr	x10, [x10, _DC_DC8051_CFG_RST_SFR_SMASK@GOTPAGEOFF]
	orr	x8, x8, x9
Lloh13:
	ldr	x9, [x10]
	orr	x2, x8, x9
Lloh14:
	adrp	x21, _DC_DC8051_CFG_RST@GOTPAGE
Lloh15:
	ldr	x21, [x21, _DC_DC8051_CFG_RST@GOTPAGEOFF]
	ldr	w1, [x21]
	bl	_write_csr
	ldr	x2, [x22]
	ldr	w1, [x21]
	mov	x0, x19
	bl	_write_csr
	mov	x0, x19
	mov	x1, x20
	bl	_load_security_variables
Lloh16:
	adrp	x22, _MISC_CFG_FW_CTRL@GOTPAGE
Lloh17:
	ldr	x22, [x22, _MISC_CFG_FW_CTRL@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x19
	mov	x2, #0
	bl	_write_csr
	ldp	w4, w3, [x20, #4]
	mov	x0, x19
	mov	w1, #1
	mov	w2, #0
	bl	_write_8051
	cbnz	w0, LBB0_8
; %bb.1:
	ldr	w1, [x22]
Lloh18:
	adrp	x8, _MISC_CFG_FW_CTRL_FW_8051_LOADED_SMASK@GOTPAGE
Lloh19:
	ldr	x8, [x8, _MISC_CFG_FW_CTRL_FW_8051_LOADED_SMASK@GOTPAGEOFF]
Lloh20:
	ldr	x2, [x8]
	mov	x0, x19
	bl	_write_csr
	ldr	w2, [x20]
Lloh21:
	adrp	x1, l_.str@PAGE
Lloh22:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_run_rsa
	cbnz	w0, LBB0_8
; %bb.2:
	ldr	w1, [x21]
	mov	x0, x19
	mov	x2, #0
	bl	_write_csr
Lloh23:
	adrp	x8, _TIMEOUT_8051_START@GOTPAGE
Lloh24:
	ldr	x8, [x8, _TIMEOUT_8051_START@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_wait_fm_ready
	cbz	w0, LBB0_4
; %bb.3:
	mov	x0, x19
	bl	_get_firmware_state
	mov	x2, x0
Lloh26:
	adrp	x1, l_.str.1@PAGE
Lloh27:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_dd_dev_err
Lloh28:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_7
LBB0_4:
	add	x1, sp, #24
	add	x2, sp, #16
	add	x3, sp, #8
	mov	x0, x19
	bl	_read_misc_status
	ldr	w2, [sp, #24]
	ldr	w3, [sp, #16]
	ldr	w4, [sp, #8]
Lloh30:
	adrp	x1, l_.str.2@PAGE
Lloh31:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_dd_dev_info
	ldp	x1, x0, [sp, #16]
	ldr	x2, [sp, #8]
	bl	_dc8051_ver
	str	w0, [x19]
Lloh32:
	adrp	x8, _HOST_INTERFACE_VERSION@GOTPAGE
Lloh33:
	ldr	x8, [x8, _HOST_INTERFACE_VERSION@GOTPAGEOFF]
Lloh34:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_write_host_interface_version
Lloh35:
	adrp	x8, _HCMD_SUCCESS@GOTPAGE
Lloh36:
	ldr	x8, [x8, _HCMD_SUCCESS@GOTPAGEOFF]
Lloh37:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_6
; %bb.5:
	mov	w0, #0
	b	LBB0_8
LBB0_6:
	mov	x2, x0
Lloh38:
	adrp	x1, l_.str.3@PAGE
Lloh39:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_dd_dev_err
Lloh40:
	adrp	x8, _EIO@GOTPAGE
Lloh41:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh40, Lloh41
	.loh AdrpAdd	Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_DC_DC8051_CFG_RST_M8051W_SMASK,8,3 ; @DC_DC8051_CFG_RST_M8051W_SMASK
	.comm	_DC_DC8051_CFG_RST_CRAM_SMASK,8,3 ; @DC_DC8051_CFG_RST_CRAM_SMASK
	.comm	_DC_DC8051_CFG_RST_DRAM_SMASK,8,3 ; @DC_DC8051_CFG_RST_DRAM_SMASK
	.comm	_DC_DC8051_CFG_RST_IRAM_SMASK,8,3 ; @DC_DC8051_CFG_RST_IRAM_SMASK
	.comm	_DC_DC8051_CFG_RST_SFR_SMASK,8,3 ; @DC_DC8051_CFG_RST_SFR_SMASK
	.comm	_DC_DC8051_CFG_RST,4,2          ; @DC_DC8051_CFG_RST
	.comm	_MISC_CFG_FW_CTRL,4,2           ; @MISC_CFG_FW_CTRL
	.comm	_MISC_CFG_FW_CTRL_FW_8051_LOADED_SMASK,8,3 ; @MISC_CFG_FW_CTRL_FW_8051_LOADED_SMASK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"8051"

	.comm	_TIMEOUT_8051_START,4,2         ; @TIMEOUT_8051_START
l_.str.1:                               ; @.str.1
	.asciz	"8051 start timeout, current state 0x%x\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
l_.str.2:                               ; @.str.2
	.asciz	"8051 firmware version %d.%d.%d\n"

	.comm	_HOST_INTERFACE_VERSION,4,2     ; @HOST_INTERFACE_VERSION
	.comm	_HCMD_SUCCESS,4,2               ; @HCMD_SUCCESS
l_.str.3:                               ; @.str.3
	.asciz	"Failed to set host interface version, return 0x%x\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_load_8051_firmware
.subsections_via_symbols
