	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function spear_smi_read_sr
_spear_smi_read_sr:                     ## @spear_smi_read_sr
	.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, %ebx
	movq	%rdi, %r12
	leaq	4(%rdi), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movl	$0, (%r12)
	movq	_SMI_CR1@GOTPCREL(%rip), %r13
	movq	(%r13), %rdi
	addq	8(%r12), %rdi
	callq	_readl
	movl	%eax, %r15d
	movq	_SW_MODE@GOTPCREL(%rip), %rax
	movq	_WB_MODE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	notl	%edi
	andl	%r15d, %edi
	movq	(%r13), %rsi
	addq	8(%r12), %rsi
	callq	_writel
	movq	_BANK_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %ebx
	movq	_RD_STATUS_REG@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_TFIE@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_SMI_CR2@GOTPCREL(%rip), %r13
	movq	(%r13), %rsi
	addq	8(%r12), %rsi
	movl	%ebx, %edi
	callq	_writel
	movl	16(%r12), %edi
	movq	_TFF@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	andl	(%r12), %esi
	movq	_SMI_CMD_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_wait_event_interruptible_timeout
	testl	%eax, %eax
	jle	LBB0_2
## %bb.1:
	movzwl	(%r12), %ebx
	jmp	LBB0_4
LBB0_2:
	movl	%eax, %ebx
	jne	LBB0_4
## %bb.3:
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_4:
	movq	_SMI_CR1@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r12), %rsi
	movl	%r15d, %edi
	callq	_writel
	movq	(%r13), %rsi
	addq	8(%r12), %rsi
	xorl	%edi, %edi
	callq	_writel
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%ebx, %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	_WB_MODE,4,2                    ## @WB_MODE
	.comm	_BANK_SHIFT,4,2                 ## @BANK_SHIFT
	.comm	_RD_STATUS_REG,4,2              ## @RD_STATUS_REG
	.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	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_spear_smi_read_sr
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function spear_smi_read_sr
_spear_smi_read_sr:                     ; @spear_smi_read_sr
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x22, x1
	mov	x20, x0
	add	x19, x0, #4
	mov	x0, x19
	bl	_mutex_lock
	str	wzr, [x20]
	ldr	x8, [x20, #8]
Lloh0:
	adrp	x23, _SMI_CR1@GOTPAGE
Lloh1:
	ldr	x23, [x23, _SMI_CR1@GOTPAGEOFF]
	ldr	x9, [x23]
	add	x0, x9, x8
	bl	_readl
	mov	x21, x0
Lloh2:
	adrp	x8, _SW_MODE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _SW_MODE@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _WB_MODE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _WB_MODE@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w8, w9, w8
	bic	w0, w0, w8
	ldr	x8, [x20, #8]
	ldr	x9, [x23]
	add	x1, x9, x8
	bl	_writel
Lloh8:
	adrp	x8, _BANK_SHIFT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _BANK_SHIFT@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	adrp	x9, _RD_STATUS_REG@GOTPAGE
Lloh12:
	ldr	x9, [x9, _RD_STATUS_REG@GOTPAGEOFF]
	lsl	w8, w22, w8
Lloh13:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh14:
	adrp	x9, _TFIE@GOTPAGE
Lloh15:
	ldr	x9, [x9, _TFIE@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	orr	w0, w8, w9
	ldr	x8, [x20, #8]
Lloh17:
	adrp	x24, _SMI_CR2@GOTPAGE
Lloh18:
	ldr	x24, [x24, _SMI_CR2@GOTPAGEOFF]
	ldr	x9, [x24]
	add	x1, x9, x8
	bl	_writel
	ldr	w0, [x20, #16]
Lloh19:
	adrp	x8, _TFF@GOTPAGE
Lloh20:
	ldr	x8, [x8, _TFF@GOTPAGEOFF]
	ldr	w9, [x20]
Lloh21:
	ldr	w8, [x8]
	and	w1, w8, w9
Lloh22:
	adrp	x8, _SMI_CMD_TIMEOUT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _SMI_CMD_TIMEOUT@GOTPAGEOFF]
Lloh24:
	ldr	w2, [x8]
	bl	_wait_event_interruptible_timeout
	cmp	w0, #1
	b.lt	LBB0_2
; %bb.1:
	ldrh	w22, [x20]
	b	LBB0_4
LBB0_2:
	mov	x22, x0
	cbnz	w0, LBB0_4
; %bb.3:
Lloh25:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_4:
	ldr	x8, [x20, #8]
	ldr	x9, [x23]
	add	x1, x9, x8
	mov	x0, x21
	bl	_writel
	ldr	x8, [x20, #8]
	ldr	x9, [x24]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writel
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x22
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.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	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_SMI_CR1,8,3                    ; @SMI_CR1
	.comm	_SW_MODE,4,2                    ; @SW_MODE
	.comm	_WB_MODE,4,2                    ; @WB_MODE
	.comm	_BANK_SHIFT,4,2                 ; @BANK_SHIFT
	.comm	_RD_STATUS_REG,4,2              ; @RD_STATUS_REG
	.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	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_spear_smi_read_sr
.subsections_via_symbols
