	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function spear_smi_write_enable
_spear_smi_write_enable:                ## @spear_smi_write_enable
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %rbx
	addq	$4, %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movl	$0, (%rbx)
	movq	_SMI_CR1@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	%rax, %r14
	addq	16(%rbx), %rdi
	callq	_readl
	movl	%eax, %r12d
	movq	_SW_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	notl	%edi
	andl	%r12d, %edi
	movq	(%r14), %rsi
	addq	16(%rbx), %rsi
	callq	_writel
	movq	_BANK_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	%r15d, %edi
	shll	%cl, %edi
	movq	_WE@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_TFIE@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_SMI_CR2@GOTPCREL(%rip), %r14
	movq	(%r14), %rsi
	addq	16(%rbx), %rsi
	callq	_writel
	movl	24(%rbx), %edi
	movq	_TFF@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	andl	(%rbx), %esi
	movq	_SMI_CMD_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_wait_event_interruptible_timeout
	movl	%eax, %r13d
	movq	_SMI_CR1@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	16(%rbx), %rsi
	movl	%r12d, %edi
	callq	_writel
	movq	(%r14), %rsi
	addq	16(%rbx), %rsi
	xorl	%r12d, %r12d
	xorl	%edi, %edi
	callq	_writel
	testl	%r13d, %r13d
	je	LBB0_4
## %bb.1:
	jle	LBB0_5
## %bb.2:
	movl	(%rbx), %eax
	movq	_WM_SHIFT@GOTPCREL(%rip), %rcx
	addl	(%rcx), %r15d
	xorl	%r12d, %r12d
	btl	%r15d, %eax
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	jb	LBB0_7
## %bb.3:
	movq	8(%rbx), %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_7
LBB0_4:
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	movq	8(%rbx), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_6
LBB0_5:
	movl	%r13d, %r12d
LBB0_6:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
LBB0_7:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SMI_CR1,8,3                    ## @SMI_CR1
	.comm	_SW_MODE,4,2                    ## @SW_MODE
	.comm	_BANK_SHIFT,4,2                 ## @BANK_SHIFT
	.comm	_WE,4,2                         ## @WE
	.comm	_TFIE,4,2                       ## @TFIE
	.comm	_SMI_CR2,8,3                    ## @SMI_CR2
	.comm	_TFF,4,2                        ## @TFF
	.comm	_SMI_CMD_TIMEOUT,4,2            ## @SMI_CMD_TIMEOUT
	.comm	_EIO,4,2                        ## @EIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"smi controller failed on write enable\n"

	.comm	_WM_SHIFT,4,2                   ## @WM_SHIFT
L_.str.1:                               ## @.str.1
	.asciz	"couldn't enable write\n"

	.no_dead_strip	_spear_smi_write_enable
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function spear_smi_write_enable
_spear_smi_write_enable:                ; @spear_smi_write_enable
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x21, x1
	mov	x20, x0
	add	x19, x0, #4
	mov	x0, x19
	bl	_mutex_lock
	str	wzr, [x20]
	ldr	x8, [x20, #16]
Lloh0:
	adrp	x24, _SMI_CR1@GOTPAGE
Lloh1:
	ldr	x24, [x24, _SMI_CR1@GOTPAGEOFF]
	ldr	x9, [x24]
	add	x0, x9, x8
	bl	_readl
	mov	x23, x0
Lloh2:
	adrp	x8, _SW_MODE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _SW_MODE@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	bic	w0, w0, w8
	ldr	x8, [x20, #16]
	ldr	x9, [x24]
	add	x1, x9, x8
	bl	_writel
Lloh5:
	adrp	x8, _BANK_SHIFT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _BANK_SHIFT@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
Lloh8:
	adrp	x9, _WE@GOTPAGE
Lloh9:
	ldr	x9, [x9, _WE@GOTPAGEOFF]
	lsl	w8, w21, w8
Lloh10:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh11:
	adrp	x9, _TFIE@GOTPAGE
Lloh12:
	ldr	x9, [x9, _TFIE@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w0, w8, w9
	ldr	x8, [x20, #16]
Lloh14:
	adrp	x25, _SMI_CR2@GOTPAGE
Lloh15:
	ldr	x25, [x25, _SMI_CR2@GOTPAGEOFF]
	ldr	x9, [x25]
	add	x1, x9, x8
	bl	_writel
	ldr	w0, [x20, #24]
Lloh16:
	adrp	x8, _TFF@GOTPAGE
Lloh17:
	ldr	x8, [x8, _TFF@GOTPAGEOFF]
	ldr	w9, [x20]
Lloh18:
	ldr	w8, [x8]
	and	w1, w8, w9
Lloh19:
	adrp	x8, _SMI_CMD_TIMEOUT@GOTPAGE
Lloh20:
	ldr	x8, [x8, _SMI_CMD_TIMEOUT@GOTPAGEOFF]
Lloh21:
	ldr	w2, [x8]
	bl	_wait_event_interruptible_timeout
	mov	x22, x0
	ldr	x8, [x20, #16]
	ldr	x9, [x24]
	add	x1, x9, x8
	mov	x0, x23
	bl	_writel
	ldr	x8, [x20, #16]
	ldr	x9, [x25]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writel
	cbz	w22, LBB0_4
; %bb.1:
	cmp	w22, #1
	b.lt	LBB0_6
; %bb.2:
	ldr	w8, [x20]
Lloh22:
	adrp	x9, _WM_SHIFT@GOTPAGE
Lloh23:
	ldr	x9, [x9, _WM_SHIFT@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	add	w9, w9, w21
	lsr	w8, w8, w9
	tbz	w8, #0, LBB0_5
; %bb.3:
	mov	w22, #0
	b	LBB0_6
LBB0_4:
Lloh25:
	adrp	x8, _EIO@GOTPAGE
Lloh26:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	neg	w22, w8
	ldr	x0, [x20, #8]
Lloh28:
	adrp	x1, l_.str@PAGE
Lloh29:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_6
LBB0_5:
	ldr	x0, [x20, #8]
Lloh30:
	adrp	x1, l_.str.1@PAGE
Lloh31:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
Lloh32:
	adrp	x8, _EIO@GOTPAGE
Lloh33:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_6:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x22
	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
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.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 AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_SMI_CR1,8,3                    ; @SMI_CR1
	.comm	_SW_MODE,4,2                    ; @SW_MODE
	.comm	_BANK_SHIFT,4,2                 ; @BANK_SHIFT
	.comm	_WE,4,2                         ; @WE
	.comm	_TFIE,4,2                       ; @TFIE
	.comm	_SMI_CR2,8,3                    ; @SMI_CR2
	.comm	_TFF,4,2                        ; @TFF
	.comm	_SMI_CMD_TIMEOUT,4,2            ; @SMI_CMD_TIMEOUT
	.comm	_EIO,4,2                        ; @EIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"smi controller failed on write enable\n"

	.comm	_WM_SHIFT,4,2                   ; @WM_SHIFT
l_.str.1:                               ; @.str.1
	.asciz	"couldn't enable write\n"

	.no_dead_strip	_spear_smi_write_enable
.subsections_via_symbols
