	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_etnaviv_gpu_init               ## -- Begin function etnaviv_gpu_init
	.p2align	4, 0x90
_etnaviv_gpu_init:                      ## @etnaviv_gpu_init
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	72(%rdi), %rax
	movq	(%rax), %r15
	movl	8(%rdi), %edi
	callq	_pm_runtime_get_sync
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movq	%r14, %rdi
	callq	_etnaviv_hw_identify
	cmpq	$0, 40(%r14)
	je	LBB0_3
## %bb.5:
	movl	48(%r14), %eax
	movq	_chipFeatures_PIPE_VG@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_8
## %bb.6:
	movq	_chipFeatures_FE20@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_8
## %bb.7:
	movl	8(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	callq	_dev_info
	jmp	LBB0_4
LBB0_1:
	movl	%eax, %ebx
	movl	8(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_29
LBB0_8:
	movq	_chipMinorFeatures7_BIT_SECURITY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 52(%r14)
	je	LBB0_11
## %bb.9:
	movq	_chipMinorFeatures10_SECURITY_AHB@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 56(%r14)
	je	LBB0_11
## %bb.10:
	movq	_ETNA_SEC_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 64(%r14)
LBB0_11:
	movq	%r14, %rdi
	callq	_etnaviv_hw_reset
	testl	%eax, %eax
	je	LBB0_15
## %bb.12:
	movl	%eax, %ebx
	movl	8(%r14), %edi
	leaq	L_.str.3(%rip), %rsi
LBB0_13:
	callq	_dev_err
	jmp	LBB0_14
LBB0_3:
	movl	8(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
LBB0_4:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_14:
	movl	8(%r14), %edi
	callq	_pm_runtime_mark_last_busy
	movl	8(%r14), %edi
	callq	_pm_runtime_put_autosuspend
LBB0_29:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	movq	%r14, %rdi
	callq	_etnaviv_iommu_global_init
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_14
## %bb.16:
	movq	_chipFeatures_PIPE_3D@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 48(%r14)
	je	LBB0_18
## %bb.17:
	movq	_chipMinorFeatures0_MC20@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 60(%r14)
	je	LBB0_21
LBB0_18:
	movl	8(%r14), %edi
	callq	_dma_get_required_mask
	cltq
	movq	_PHYS_OFFSET@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	_SZ_2G@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	leaq	(%rdx,%rcx), %rsi
	cmpq	%rax, %rsi
	jle	LBB0_20
## %bb.19:
	movq	8(%r15), %rax
	movq	%rcx, (%rax)
	jmp	LBB0_23
LBB0_20:
	subq	%rdx, %rax
	incq	%rax
	movq	8(%r15), %rcx
	movq	%rax, (%rcx)
	jmp	LBB0_23
LBB0_21:
	movq	_PHYS_OFFSET@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	movq	_SZ_2G@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jl	LBB0_23
## %bb.22:
	movl	8(%r14), %edi
	leaq	L_.str.4(%rip), %rsi
	callq	_dev_info
	movq	(%rbx), %rax
	movq	8(%r15), %rcx
	movq	%rax, (%rcx)
	movq	_chipFeatures_FAST_CLEAR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	andl	%eax, 48(%r14)
LBB0_23:
	movl	(%r15), %edi
	leaq	32(%r14), %rsi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_etnaviv_cmdbuf_init
	testl	%eax, %eax
	je	LBB0_25
## %bb.24:
	movl	%eax, %ebx
	movl	8(%r14), %edi
	leaq	L_.str.5(%rip), %rsi
	jmp	LBB0_13
LBB0_25:
	leaq	28(%r14), %rdi
	callq	_spin_lock_init
	leaq	16(%r14), %r15
	movq	%r15, %rdi
	callq	_init_completion
	movl	24(%r14), %edi
	movq	_ETNA_NR_EVENTS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_bitmap_zero
	movl	20(%r14), %edi
	callq	_ARRAY_SIZE
	testl	%eax, %eax
	jle	LBB0_28
## %bb.26:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_27:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	_complete
	incl	%ebx
	movl	20(%r14), %edi
	callq	_ARRAY_SIZE
	cmpl	%eax, %ebx
	jl	LBB0_27
LBB0_28:
	leaq	12(%r14), %rbx
	movq	%rbx, %rdi
	callq	_mutex_lock
	movq	%r14, %rdi
	callq	_etnaviv_gpu_hw_init
	movl	$-1, (%r14)
	movq	%rbx, %rdi
	callq	_mutex_unlock
	movl	8(%r14), %edi
	callq	_pm_runtime_mark_last_busy
	movl	8(%r14), %edi
	callq	_pm_runtime_put_autosuspend
	movl	$1, 4(%r14)
	xorl	%ebx, %ebx
	jmp	LBB0_29
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to enable GPU power domain\n"

L_.str.1:                               ## @.str.1
	.asciz	"Unknown GPU model\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_chipFeatures_PIPE_VG,4,2       ## @chipFeatures_PIPE_VG
	.comm	_chipFeatures_FE20,4,2          ## @chipFeatures_FE20
L_.str.2:                               ## @.str.2
	.asciz	"Ignoring GPU with VG and FE2.0\n"

	.comm	_chipMinorFeatures7_BIT_SECURITY,4,2 ## @chipMinorFeatures7_BIT_SECURITY
	.comm	_chipMinorFeatures10_SECURITY_AHB,4,2 ## @chipMinorFeatures10_SECURITY_AHB
	.comm	_ETNA_SEC_KERNEL,4,2            ## @ETNA_SEC_KERNEL
L_.str.3:                               ## @.str.3
	.asciz	"GPU reset failed\n"

	.comm	_chipFeatures_PIPE_3D,4,2       ## @chipFeatures_PIPE_3D
	.comm	_chipMinorFeatures0_MC20,4,2    ## @chipMinorFeatures0_MC20
	.comm	_PHYS_OFFSET,8,3                ## @PHYS_OFFSET
	.comm	_SZ_2G,8,3                      ## @SZ_2G
L_.str.4:                               ## @.str.4
	.asciz	"Need to move linear window on MC1.0, disabling TS\n"

	.comm	_chipFeatures_FAST_CLEAR,4,2    ## @chipFeatures_FAST_CLEAR
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
L_.str.5:                               ## @.str.5
	.asciz	"could not create command buffer\n"

	.comm	_ETNA_NR_EVENTS,4,2             ## @ETNA_NR_EVENTS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_etnaviv_gpu_init               ; -- Begin function etnaviv_gpu_init
	.p2align	2
_etnaviv_gpu_init:                      ; @etnaviv_gpu_init
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x19, x0
	ldr	x8, [x0, #72]
	ldr	x21, [x8]
	ldr	w0, [x0, #8]
	bl	_pm_runtime_get_sync
	tbnz	w0, #31, LBB0_5
; %bb.1:
	mov	x0, x19
	bl	_etnaviv_hw_identify
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_12
; %bb.2:
	ldr	w8, [x19, #48]
Lloh0:
	adrp	x9, _chipFeatures_PIPE_VG@GOTPAGE
Lloh1:
	ldr	x9, [x9, _chipFeatures_PIPE_VG@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.3:
Lloh3:
	adrp	x9, _chipFeatures_FE20@GOTPAGE
Lloh4:
	ldr	x9, [x9, _chipFeatures_FE20@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.4:
	ldr	w0, [x19, #8]
Lloh6:
	adrp	x1, l_.str.2@PAGE
Lloh7:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_info
	b	LBB0_13
LBB0_5:
	mov	x20, x0
	ldr	w0, [x19, #8]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_15
LBB0_6:
	ldr	w8, [x19, #52]
Lloh10:
	adrp	x9, _chipMinorFeatures7_BIT_SECURITY@GOTPAGE
Lloh11:
	ldr	x9, [x9, _chipMinorFeatures7_BIT_SECURITY@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.7:
	ldr	w8, [x19, #56]
Lloh13:
	adrp	x9, _chipMinorFeatures10_SECURITY_AHB@GOTPAGE
Lloh14:
	ldr	x9, [x9, _chipMinorFeatures10_SECURITY_AHB@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.8:
Lloh16:
	adrp	x8, _ETNA_SEC_KERNEL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ETNA_SEC_KERNEL@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	str	w8, [x19, #64]
LBB0_9:
	mov	x0, x19
	bl	_etnaviv_hw_reset
	cbz	w0, LBB0_16
; %bb.10:
	mov	x20, x0
	ldr	w0, [x19, #8]
Lloh19:
	adrp	x1, l_.str.3@PAGE
Lloh20:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_11:
	bl	_dev_err
	b	LBB0_14
LBB0_12:
	ldr	w0, [x19, #8]
Lloh21:
	adrp	x1, l_.str.1@PAGE
Lloh22:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
LBB0_13:
Lloh23:
	adrp	x8, _ENXIO@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_14:
	ldr	w0, [x19, #8]
	bl	_pm_runtime_mark_last_busy
	ldr	w0, [x19, #8]
	bl	_pm_runtime_put_autosuspend
LBB0_15:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_16:
	mov	x0, x19
	bl	_etnaviv_iommu_global_init
	mov	x20, x0
	cbnz	w0, LBB0_14
; %bb.17:
	ldr	w8, [x19, #48]
Lloh26:
	adrp	x9, _chipFeatures_PIPE_3D@GOTPAGE
Lloh27:
	ldr	x9, [x9, _chipFeatures_PIPE_3D@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_19
; %bb.18:
	ldr	w8, [x19, #60]
Lloh29:
	adrp	x9, _chipMinorFeatures0_MC20@GOTPAGE
Lloh30:
	ldr	x9, [x9, _chipMinorFeatures0_MC20@GOTPAGEOFF]
Lloh31:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_28
LBB0_19:
	ldr	w0, [x19, #8]
	bl	_dma_get_required_mask
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x9, w0
Lloh32:
	adrp	x8, _PHYS_OFFSET@GOTPAGE
Lloh33:
	ldr	x8, [x8, _PHYS_OFFSET@GOTPAGEOFF]
Lloh34:
	ldr	x8, [x8]
Lloh35:
	adrp	x10, _SZ_2G@GOTPAGE
Lloh36:
	ldr	x10, [x10, _SZ_2G@GOTPAGEOFF]
Lloh37:
	ldr	x10, [x10]
	add	x11, x10, x8
	cmp	x11, x9
	b.gt	LBB0_21
; %bb.20:
	sub	x8, x9, x10
	add	x8, x8, #1
LBB0_21:
	ldr	x9, [x21, #8]
	str	x8, [x9]
LBB0_22:
	ldr	w0, [x21]
	add	x1, x19, #32
Lloh38:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh39:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh40:
	ldr	w2, [x8]
	bl	_etnaviv_cmdbuf_init
	cbz	w0, LBB0_24
; %bb.23:
	mov	x20, x0
	ldr	w0, [x19, #8]
Lloh41:
	adrp	x1, l_.str.5@PAGE
Lloh42:
	add	x1, x1, l_.str.5@PAGEOFF
	b	LBB0_11
LBB0_24:
	add	x0, x19, #28
	bl	_spin_lock_init
	add	x20, x19, #16
	mov	x0, x20
	bl	_init_completion
	ldr	w0, [x19, #24]
Lloh43:
	adrp	x8, _ETNA_NR_EVENTS@GOTPAGE
Lloh44:
	ldr	x8, [x8, _ETNA_NR_EVENTS@GOTPAGEOFF]
Lloh45:
	ldr	w1, [x8]
	bl	_bitmap_zero
	ldr	w0, [x19, #20]
	bl	_ARRAY_SIZE
	cmp	w0, #1
	b.lt	LBB0_27
; %bb.25:
	mov	w21, #0
LBB0_26:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_complete
	add	w21, w21, #1
	ldr	w0, [x19, #20]
	bl	_ARRAY_SIZE
	cmp	w21, w0
	b.lt	LBB0_26
LBB0_27:
	add	x20, x19, #12
	mov	x0, x20
	bl	_mutex_lock
	mov	x0, x19
	bl	_etnaviv_gpu_hw_init
	mov	w8, #-1
	str	w8, [x19]
	mov	x0, x20
	bl	_mutex_unlock
	ldr	w0, [x19, #8]
	bl	_pm_runtime_mark_last_busy
	ldr	w0, [x19, #8]
	bl	_pm_runtime_put_autosuspend
	mov	w20, #0
	mov	w8, #1
	str	w8, [x19, #4]
	b	LBB0_15
LBB0_28:
Lloh46:
	adrp	x20, _PHYS_OFFSET@GOTPAGE
Lloh47:
	ldr	x20, [x20, _PHYS_OFFSET@GOTPAGEOFF]
	ldr	x8, [x20]
Lloh48:
	adrp	x9, _SZ_2G@GOTPAGE
Lloh49:
	ldr	x9, [x9, _SZ_2G@GOTPAGEOFF]
Lloh50:
	ldr	x9, [x9]
	cmp	x8, x9
	b.lt	LBB0_22
; %bb.29:
	ldr	w0, [x19, #8]
Lloh51:
	adrp	x1, l_.str.4@PAGE
Lloh52:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_dev_info
	ldr	x8, [x20]
	ldr	x9, [x21, #8]
	str	x8, [x9]
Lloh53:
	adrp	x8, _chipFeatures_FAST_CLEAR@GOTPAGE
Lloh54:
	ldr	x8, [x8, _chipFeatures_FAST_CLEAR@GOTPAGEOFF]
Lloh55:
	ldr	w8, [x8]
	ldr	w9, [x19, #48]
	bic	w8, w9, w8
	str	w8, [x19, #48]
	b	LBB0_22
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdd	Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpLdrGot	Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh53, Lloh54, Lloh55
	.loh AdrpAdd	Lloh51, Lloh52
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to enable GPU power domain\n"

l_.str.1:                               ; @.str.1
	.asciz	"Unknown GPU model\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_chipFeatures_PIPE_VG,4,2       ; @chipFeatures_PIPE_VG
	.comm	_chipFeatures_FE20,4,2          ; @chipFeatures_FE20
l_.str.2:                               ; @.str.2
	.asciz	"Ignoring GPU with VG and FE2.0\n"

	.comm	_chipMinorFeatures7_BIT_SECURITY,4,2 ; @chipMinorFeatures7_BIT_SECURITY
	.comm	_chipMinorFeatures10_SECURITY_AHB,4,2 ; @chipMinorFeatures10_SECURITY_AHB
	.comm	_ETNA_SEC_KERNEL,4,2            ; @ETNA_SEC_KERNEL
l_.str.3:                               ; @.str.3
	.asciz	"GPU reset failed\n"

	.comm	_chipFeatures_PIPE_3D,4,2       ; @chipFeatures_PIPE_3D
	.comm	_chipMinorFeatures0_MC20,4,2    ; @chipMinorFeatures0_MC20
	.comm	_PHYS_OFFSET,8,3                ; @PHYS_OFFSET
	.comm	_SZ_2G,8,3                      ; @SZ_2G
l_.str.4:                               ; @.str.4
	.asciz	"Need to move linear window on MC1.0, disabling TS\n"

	.comm	_chipFeatures_FAST_CLEAR,4,2    ; @chipFeatures_FAST_CLEAR
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
l_.str.5:                               ; @.str.5
	.asciz	"could not create command buffer\n"

	.comm	_ETNA_NR_EVENTS,4,2             ; @ETNA_NR_EVENTS
.subsections_via_symbols
