	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cgx_fwi_cmd_send
_cgx_fwi_cmd_send:                      ## @cgx_fwi_cmd_send
	.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
	movq	%rdx, %rbx
	movq	%rsi, %r12
	movl	%edi, %r13d
	movq	24(%rdx), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	leaq	4(%rdx), %r14
	movq	%r14, %rdi
	callq	_mutex_lock_interruptible
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_8
## %bb.1:
	movl	12(%rbx), %esi
	movq	_CGX_COMMAND_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_cgx_read
	movq	_CMDREG_OWN@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	movl	%eax, %esi
	callq	_FIELD_GET
	movq	_CGX_CMD_OWN_NS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.4:
	movl	(%r15), %edi
	movq	_CGX_CMD_OWN_FIRMWARE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r13d, %edx
	callq	_FIELD_SET
	movl	$1, (%rbx)
	movl	12(%rbx), %esi
	movq	_CGX_COMMAND_REG@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %ecx
	callq	_cgx_write
	xorl	%r15d, %r15d
	cmpl	$0, (%rbx)
	movl	16(%rbx), %r13d
	sete	%r15b
	movq	_CGX_CMD_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msecs_to_jiffies
	movl	%r13d, %edi
	movl	%r15d, %esi
	movl	%eax, %edx
	callq	_wait_event_timeout
	testl	%eax, %eax
	je	LBB0_5
## %bb.6:
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_smp_rmb
	movl	8(%rbx), %eax
	movl	%eax, (%r12)
	jmp	LBB0_7
LBB0_2:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_5:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rdi
	movl	(%rax), %edx
	movl	12(%rbx), %ecx
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_7:
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_8:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CGX_COMMAND_REG,4,2            ## @CGX_COMMAND_REG
	.comm	_CMDREG_OWN,4,2                 ## @CMDREG_OWN
	.comm	_CGX_CMD_OWN_NS,8,3             ## @CGX_CMD_OWN_NS
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_CGX_CMD_OWN_FIRMWARE,4,2       ## @CGX_CMD_OWN_FIRMWARE
	.comm	_CGX_CMD_TIMEOUT,4,2            ## @CGX_CMD_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cgx port %d:%d cmd timeout\n"

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

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cgx_fwi_cmd_send
_cgx_fwi_cmd_send:                      ; @cgx_fwi_cmd_send
	.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	x20, x2
	mov	x21, x1
	mov	x23, x0
	ldr	x22, [x2, #24]
	add	x19, x2, #4
	mov	x0, x19
	bl	_mutex_lock_interruptible
	mov	x24, x0
	cbnz	w0, LBB0_8
; %bb.1:
	ldr	w1, [x20, #12]
Lloh0:
	adrp	x24, _CGX_COMMAND_REG@GOTPAGE
Lloh1:
	ldr	x24, [x24, _CGX_COMMAND_REG@GOTPAGEOFF]
	ldr	w2, [x24]
	mov	x0, x22
	bl	_cgx_read
	mov	x1, x0
Lloh2:
	adrp	x25, _CMDREG_OWN@GOTPAGE
Lloh3:
	ldr	x25, [x25, _CMDREG_OWN@GOTPAGEOFF]
	ldr	w0, [x25]
	bl	_FIELD_GET
Lloh4:
	adrp	x8, _CGX_CMD_OWN_NS@GOTPAGE
Lloh5:
	ldr	x8, [x8, _CGX_CMD_OWN_NS@GOTPAGEOFF]
Lloh6:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_4
; %bb.2:
	ldr	w0, [x25]
Lloh7:
	adrp	x8, _CGX_CMD_OWN_FIRMWARE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _CGX_CMD_OWN_FIRMWARE@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x2, x23
	bl	_FIELD_SET
	mov	x3, x0
	mov	w8, #1
	str	w8, [x20]
	ldr	w1, [x20, #12]
	ldr	w2, [x24]
	mov	x0, x22
	bl	_cgx_write
	ldr	w23, [x20, #16]
	ldr	w8, [x20]
	cmp	w8, #0
	cset	w24, eq
Lloh10:
	adrp	x8, _CGX_CMD_TIMEOUT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CGX_CMD_TIMEOUT@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	bl	_msecs_to_jiffies
	mov	x2, x0
	mov	x0, x23
	mov	x1, x24
	bl	_wait_event_timeout
	cbz	w0, LBB0_5
; %bb.3:
	bl	_smp_rmb
	mov	w24, #0
	ldr	w8, [x20, #8]
	str	w8, [x21]
	b	LBB0_7
LBB0_4:
Lloh13:
	adrp	x8, _EBUSY@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_6
LBB0_5:
	ldr	x0, [x22, #8]
	ldr	w2, [x22]
	ldr	w3, [x20, #12]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh17:
	adrp	x8, _EIO@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_7:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_8:
	mov	x0, x24
	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	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_CGX_COMMAND_REG,4,2            ; @CGX_COMMAND_REG
	.comm	_CMDREG_OWN,4,2                 ; @CMDREG_OWN
	.comm	_CGX_CMD_OWN_NS,8,3             ; @CGX_CMD_OWN_NS
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_CGX_CMD_OWN_FIRMWARE,4,2       ; @CGX_CMD_OWN_FIRMWARE
	.comm	_CGX_CMD_TIMEOUT,4,2            ; @CGX_CMD_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cgx port %d:%d cmd timeout\n"

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