	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_driver_open_kms         ## -- Begin function amdgpu_driver_open_kms
	.p2align	4, 0x90
_amdgpu_driver_open_kms:                ## @amdgpu_driver_open_kms
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	8(%rdi), %r12
	leaq	8(%r12), %rdi
	callq	_flush_delayed_work
	movq	$0, (%rbx)
	movl	(%r14), %edi
	callq	_pm_runtime_get_sync
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$24, %edi
	callq	_kzalloc
	movq	%rax, %r15
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_17
LBB0_1:
	movl	%eax, %r13d
	jmp	LBB0_18
LBB0_4:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	$16, %edi
	callq	_amdgpu_pasid_alloc
	testl	%eax, %eax
	jns	LBB0_6
## %bb.5:
	movl	4(%r12), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_warn
	xorl	%eax, %eax
LBB0_6:
	movq	_AMDGPU_VM_CONTEXT_GFX@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%r12, %rdi
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	movq	%r15, %rsi
	movl	%eax, %r15d
	movl	%eax, %ecx
	callq	_amdgpu_vm_init
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_10
## %bb.7:
	xorl	%r13d, %r13d
	movq	%r12, %rdi
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rsi
	xorl	%edx, %edx
	callq	_amdgpu_vm_bo_add
	movl	%eax, 20(%rbx)
	testl	%eax, %eax
	je	LBB0_8
## %bb.13:
	movq	_amdgpu_mcbp@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	jne	LBB0_15
## %bb.14:
	movq	%r12, %rdi
	callq	_amdgpu_sriov_vf
	testq	%rax, %rax
	je	LBB0_16
LBB0_15:
	movq	%r12, %rdi
	callq	_amdgpu_csa_vaddr
	movq	_AMDGPU_GMC_HOLE_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	movl	(%r12), %edx
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	leaq	16(%rsi), %rcx
	movq	_AMDGPU_CSA_SIZE@GOTPCREL(%rip), %rdi
	movl	(%rdi), %r9d
	movq	%r12, %rdi
	movl	%eax, %r8d
	callq	_amdgpu_map_static_csa
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_9
LBB0_16:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	leaq	12(%rbx), %rdi
	callq	_mutex_init
	leaq	8(%rbx), %rdi
	callq	_idr_init
	movq	%rbx, %rdi
	addq	$4, %rdi
	callq	_amdgpu_ctx_mgr_init
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rbx, (%rax)
	xorl	%r13d, %r13d
	jmp	LBB0_17
LBB0_8:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
LBB0_9:
	movq	%r12, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_amdgpu_vm_fini
LBB0_10:
	testl	%r15d, %r15d
	je	LBB0_12
## %bb.11:
	movl	%r15d, %edi
	callq	_amdgpu_pasid_free
LBB0_12:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
LBB0_17:
	movl	(%r14), %edi
	callq	_pm_runtime_mark_last_busy
	movl	(%r14), %edi
	callq	_pm_runtime_put_autosuspend
LBB0_18:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No more PASIDs available!"

	.comm	_AMDGPU_VM_CONTEXT_GFX,4,2      ## @AMDGPU_VM_CONTEXT_GFX
	.comm	_amdgpu_mcbp,8,3                ## @amdgpu_mcbp
	.comm	_AMDGPU_GMC_HOLE_MASK,4,2       ## @AMDGPU_GMC_HOLE_MASK
	.comm	_AMDGPU_CSA_SIZE,4,2            ## @AMDGPU_CSA_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_driver_open_kms         ; -- Begin function amdgpu_driver_open_kms
	.p2align	2
_amdgpu_driver_open_kms:                ; @amdgpu_driver_open_kms
	.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	x21, x1
	mov	x19, x0
	ldr	x22, [x0, #8]
	add	x0, x22, #8
	bl	_flush_delayed_work
	str	xzr, [x21]
	ldr	w0, [x19]
	bl	_pm_runtime_get_sync
	tbnz	w0, #31, LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #24
	bl	_kzalloc
	mov	x20, x0
	cmp	x0, #0
	cset	w0, eq
	bl	_unlikely
	cbz	x0, LBB0_4
; %bb.2:
Lloh3:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_17
LBB0_3:
	mov	x24, x0
	b	LBB0_18
LBB0_4:
	mov	w0, #16
	bl	_amdgpu_pasid_alloc
	mov	x23, x0
	tbz	w0, #31, LBB0_6
; %bb.5:
	ldr	w0, [x22, #4]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_warn
	mov	w23, #0
LBB0_6:
Lloh8:
	adrp	x8, _AMDGPU_VM_CONTEXT_GFX@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AMDGPU_VM_CONTEXT_GFX@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x20
	mov	x3, x23
	bl	_amdgpu_vm_init
	mov	x24, x0
	cbnz	w0, LBB0_14
; %bb.7:
	mov	x0, x22
	mov	x1, x20
	mov	x2, #0
	bl	_amdgpu_vm_bo_add
	str	w0, [x20, #20]
	cbz	w0, LBB0_12
; %bb.8:
Lloh11:
	adrp	x8, _amdgpu_mcbp@GOTPAGE
Lloh12:
	ldr	x8, [x8, _amdgpu_mcbp@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
	cbnz	x8, LBB0_10
; %bb.9:
	mov	x0, x22
	bl	_amdgpu_sriov_vf
	cbz	x0, LBB0_11
LBB0_10:
	mov	x0, x22
	bl	_amdgpu_csa_vaddr
Lloh14:
	adrp	x8, _AMDGPU_GMC_HOLE_MASK@GOTPAGE
Lloh15:
	ldr	x8, [x8, _AMDGPU_GMC_HOLE_MASK@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	and	w4, w8, w0
	ldr	w2, [x22]
	add	x3, x20, #16
Lloh17:
	adrp	x8, _AMDGPU_CSA_SIZE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _AMDGPU_CSA_SIZE@GOTPAGEOFF]
Lloh19:
	ldr	w5, [x8]
	mov	x0, x22
	mov	x1, x20
	bl	_amdgpu_map_static_csa
	mov	x24, x0
	cbnz	w0, LBB0_13
LBB0_11:
	add	x0, x20, #12
	bl	_mutex_init
	add	x0, x20, #8
	bl	_idr_init
	add	x0, x20, #4
	bl	_amdgpu_ctx_mgr_init
	mov	w24, #0
	str	x20, [x21]
	b	LBB0_17
LBB0_12:
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_13:
	mov	x0, x22
	mov	x1, x20
	bl	_amdgpu_vm_fini
LBB0_14:
	cbz	w23, LBB0_16
; %bb.15:
	mov	x0, x23
	bl	_amdgpu_pasid_free
LBB0_16:
	mov	x0, x20
	bl	_kfree
LBB0_17:
	ldr	w0, [x19]
	bl	_pm_runtime_mark_last_busy
	ldr	w0, [x19]
	bl	_pm_runtime_put_autosuspend
LBB0_18:
	mov	x0, x24
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No more PASIDs available!"

	.comm	_AMDGPU_VM_CONTEXT_GFX,4,2      ; @AMDGPU_VM_CONTEXT_GFX
	.comm	_amdgpu_mcbp,8,3                ; @amdgpu_mcbp
	.comm	_AMDGPU_GMC_HOLE_MASK,4,2       ; @AMDGPU_GMC_HOLE_MASK
	.comm	_AMDGPU_CSA_SIZE,4,2            ; @AMDGPU_CSA_SIZE
.subsections_via_symbols
