	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function psp_load_fw
_psp_load_fw:                           ## @psp_load_fw
	.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	%rdi, %rbx
	leaq	8(%rdi), %r14
	callq	_amdgpu_sriov_vf
	testq	%rax, %rax
	je	LBB0_6
## %bb.1:
	cmpq	$0, (%rbx)
	je	LBB0_6
## %bb.2:
	movq	_PSP_RING_TYPE__KM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_psp_ring_stop
LBB0_3:
	movq	%r14, %rdi
	callq	_psp_hw_start
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_14
## %bb.4:
	movq	%r14, %rdi
	callq	_psp_np_fw_load
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_14
## %bb.5:
	xorl	%r15d, %r15d
	jmp	LBB0_14
LBB0_6:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$4, %edi
	callq	_kzalloc
	movl	%eax, 64(%rbx)
	testl	%eax, %eax
	je	LBB0_7
## %bb.8:
	movq	56(%rbx), %rdi
	callq	_amdgpu_sriov_vf
	testq	%rax, %rax
	je	LBB0_9
LBB0_10:
	movq	_PSP_FENCE_BUFFER_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_AMDGPU_GEM_DOMAIN_VRAM@GOTPCREL(%rip), %r12
	movl	(%r12), %ecx
	leaq	40(%rbx), %r8
	leaq	36(%rbx), %r9
	leaq	16(%rbx), %r13
	movq	%r13, (%rsp)
	movq	%rbx, %rdi
	callq	_amdgpu_bo_create_kernel
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_14
## %bb.11:
	movq	_PSP_CMD_BUFFER_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	(%r12), %ecx
	leaq	32(%rbx), %r8
	leaq	28(%rbx), %r9
	leaq	24(%rbx), %rax
	movq	%rax, (%rsp)
	movq	%rbx, %rdi
	callq	_amdgpu_bo_create_kernel
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_14
## %bb.12:
	movq	(%r13), %rdi
	movq	_PSP_FENCE_BUFFER_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%esi, %esi
	callq	_memset
	movq	_PSP_RING_TYPE__KM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_psp_ring_init
	testl	%eax, %eax
	je	LBB0_3
## %bb.13:
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rdi
	callq	_DRM_ERROR
	jmp	LBB0_14
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_14
LBB0_9:
	movq	_PSP_1_MEG@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_AMDGPU_GEM_DOMAIN_GTT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	48(%rbx), %r8
	leaq	44(%rbx), %r9
	movq	%r14, (%rsp)
	movq	%rbx, %rdi
	movl	%edx, %esi
	callq	_amdgpu_bo_create_kernel
	movl	%eax, %r15d
	testl	%eax, %eax
	je	LBB0_10
LBB0_14:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PSP_RING_TYPE__KM,4,2          ## @PSP_RING_TYPE__KM
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_PSP_1_MEG,4,2                  ## @PSP_1_MEG
	.comm	_AMDGPU_GEM_DOMAIN_GTT,4,2      ## @AMDGPU_GEM_DOMAIN_GTT
	.comm	_PSP_FENCE_BUFFER_SIZE,4,2      ## @PSP_FENCE_BUFFER_SIZE
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_AMDGPU_GEM_DOMAIN_VRAM,4,2     ## @AMDGPU_GEM_DOMAIN_VRAM
	.comm	_PSP_CMD_BUFFER_SIZE,4,2        ## @PSP_CMD_BUFFER_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"PSP ring init failed!\n"

	.no_dead_strip	_psp_load_fw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function psp_load_fw
_psp_load_fw:                           ; @psp_load_fw
	.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, x0
	add	x19, x0, #8
	bl	_amdgpu_sriov_vf
	cbz	x0, LBB0_5
; %bb.1:
	ldr	x8, [x20]
	cbz	x8, LBB0_5
; %bb.2:
Lloh0:
	adrp	x8, _PSP_RING_TYPE__KM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PSP_RING_TYPE__KM@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_psp_ring_stop
LBB0_3:
	mov	x0, x19
	bl	_psp_hw_start
	mov	x21, x0
	cbnz	w0, LBB0_13
; %bb.4:
	mov	x0, x19
	bl	_psp_np_fw_load
	mov	x21, x0
	b	LBB0_13
LBB0_5:
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	w0, #4
	bl	_kzalloc
	str	w0, [x20, #64]
	cbz	w0, LBB0_11
; %bb.6:
	ldr	x0, [x20, #56]
	bl	_amdgpu_sriov_vf
	cbz	x0, LBB0_12
LBB0_7:
Lloh6:
	adrp	x23, _PSP_FENCE_BUFFER_SIZE@GOTPAGE
Lloh7:
	ldr	x23, [x23, _PSP_FENCE_BUFFER_SIZE@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh8:
	adrp	x24, _PAGE_SIZE@GOTPAGE
Lloh9:
	ldr	x24, [x24, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w2, [x24]
Lloh10:
	adrp	x25, _AMDGPU_GEM_DOMAIN_VRAM@GOTPAGE
Lloh11:
	ldr	x25, [x25, _AMDGPU_GEM_DOMAIN_VRAM@GOTPAGEOFF]
	ldr	w3, [x25]
	add	x4, x20, #40
	add	x5, x20, #36
	add	x22, x20, #16
	mov	x0, x20
	mov	x6, x22
	bl	_amdgpu_bo_create_kernel
	mov	x21, x0
	cbnz	w0, LBB0_13
; %bb.8:
Lloh12:
	adrp	x8, _PSP_CMD_BUFFER_SIZE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PSP_CMD_BUFFER_SIZE@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	ldr	w2, [x24]
	ldr	w3, [x25]
	add	x4, x20, #32
	add	x5, x20, #28
	add	x6, x20, #24
	mov	x0, x20
	bl	_amdgpu_bo_create_kernel
	mov	x21, x0
	cbnz	w0, LBB0_13
; %bb.9:
	ldr	x0, [x22]
	ldr	w2, [x23]
	mov	w1, #0
	bl	_memset
Lloh15:
	adrp	x8, _PSP_RING_TYPE__KM@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PSP_RING_TYPE__KM@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_psp_ring_init
	cbz	w0, LBB0_3
; %bb.10:
	mov	x21, x0
Lloh18:
	adrp	x0, l_.str@PAGE
Lloh19:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
	b	LBB0_13
LBB0_11:
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_13
LBB0_12:
Lloh23:
	adrp	x8, _PSP_1_MEG@GOTPAGE
Lloh24:
	ldr	x8, [x8, _PSP_1_MEG@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
Lloh26:
	adrp	x8, _AMDGPU_GEM_DOMAIN_GTT@GOTPAGE
Lloh27:
	ldr	x8, [x8, _AMDGPU_GEM_DOMAIN_GTT@GOTPAGEOFF]
Lloh28:
	ldr	w3, [x8]
	add	x4, x20, #48
	add	x5, x20, #44
	mov	x0, x20
	mov	x2, x1
	mov	x6, x19
	bl	_amdgpu_bo_create_kernel
	mov	x21, x0
	cbz	w0, LBB0_7
LBB0_13:
	mov	x0, x21
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_PSP_RING_TYPE__KM,4,2          ; @PSP_RING_TYPE__KM
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_PSP_1_MEG,4,2                  ; @PSP_1_MEG
	.comm	_AMDGPU_GEM_DOMAIN_GTT,4,2      ; @AMDGPU_GEM_DOMAIN_GTT
	.comm	_PSP_FENCE_BUFFER_SIZE,4,2      ; @PSP_FENCE_BUFFER_SIZE
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_AMDGPU_GEM_DOMAIN_VRAM,4,2     ; @AMDGPU_GEM_DOMAIN_VRAM
	.comm	_PSP_CMD_BUFFER_SIZE,4,2        ; @PSP_CMD_BUFFER_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"PSP ring init failed!\n"

	.no_dead_strip	_psp_load_fw
.subsections_via_symbols
