	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function v3d_idle_gca
_v3d_idle_gca:                          ## @v3d_idle_gca
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	cmpl	$40, (%rdi)
	jg	LBB0_2
## %bb.1:
	movq	_V3D_GCA_SAFE_SHUTDOWN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_V3D_GCA_SAFE_SHUTDOWN_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_V3D_GCA_WRITE
	movq	_V3D_GCA_SAFE_SHUTDOWN_ACK@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_V3D_GCA_READ
	movq	_V3D_GCA_SAFE_SHUTDOWN_ACK_ACKED@GOTPCREL(%rip), %rcx
	notl	%eax
	xorl	%edi, %edi
	andl	(%rcx), %eax
	sete	%dil
	movl	$100, %esi
	callq	_wait_for
	testq	%rax, %rax
	je	LBB0_2
## %bb.3:
	leaq	L_.str(%rip), %rdi
	popq	%rbp
	jmp	_DRM_ERROR                      ## TAILCALL
LBB0_2:
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_V3D_GCA_SAFE_SHUTDOWN,4,2      ## @V3D_GCA_SAFE_SHUTDOWN
	.comm	_V3D_GCA_SAFE_SHUTDOWN_EN,4,2   ## @V3D_GCA_SAFE_SHUTDOWN_EN
	.comm	_V3D_GCA_SAFE_SHUTDOWN_ACK,4,2  ## @V3D_GCA_SAFE_SHUTDOWN_ACK
	.comm	_V3D_GCA_SAFE_SHUTDOWN_ACK_ACKED,4,2 ## @V3D_GCA_SAFE_SHUTDOWN_ACK_ACKED
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to wait for safe GCA shutdown\n"

	.no_dead_strip	_v3d_idle_gca
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function v3d_idle_gca
_v3d_idle_gca:                          ; @v3d_idle_gca
	.cfi_startproc
; %bb.0:
	stp	x29, x30, [sp, #-16]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 16
	mov	x29, sp
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	ldr	w8, [x0]
	cmp	w8, #40
	b.gt	LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _V3D_GCA_SAFE_SHUTDOWN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _V3D_GCA_SAFE_SHUTDOWN@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x8, _V3D_GCA_SAFE_SHUTDOWN_EN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _V3D_GCA_SAFE_SHUTDOWN_EN@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_V3D_GCA_WRITE
Lloh6:
	adrp	x8, _V3D_GCA_SAFE_SHUTDOWN_ACK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _V3D_GCA_SAFE_SHUTDOWN_ACK@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	bl	_V3D_GCA_READ
Lloh9:
	adrp	x8, _V3D_GCA_SAFE_SHUTDOWN_ACK_ACKED@GOTPAGE
Lloh10:
	ldr	x8, [x8, _V3D_GCA_SAFE_SHUTDOWN_ACK_ACKED@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	bics	wzr, w8, w0
	cset	w0, eq
	mov	w1, #100
	bl	_wait_for
	cbz	x0, LBB0_3
; %bb.2:
Lloh12:
	adrp	x0, l_.str@PAGE
Lloh13:
	add	x0, x0, l_.str@PAGEOFF
	ldp	x29, x30, [sp], #16             ; 16-byte Folded Reload
	b	_DRM_ERROR
LBB0_3:
	ldp	x29, x30, [sp], #16             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_V3D_GCA_SAFE_SHUTDOWN,4,2      ; @V3D_GCA_SAFE_SHUTDOWN
	.comm	_V3D_GCA_SAFE_SHUTDOWN_EN,4,2   ; @V3D_GCA_SAFE_SHUTDOWN_EN
	.comm	_V3D_GCA_SAFE_SHUTDOWN_ACK,4,2  ; @V3D_GCA_SAFE_SHUTDOWN_ACK
	.comm	_V3D_GCA_SAFE_SHUTDOWN_ACK_ACKED,4,2 ; @V3D_GCA_SAFE_SHUTDOWN_ACK_ACKED
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to wait for safe GCA shutdown\n"

	.no_dead_strip	_v3d_idle_gca
.subsections_via_symbols
