	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function activate_afu_directed
_activate_afu_directed:                 ## @activate_afu_directed
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	addq	$24, %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_info
	movl	16(%rbx), %eax
	movl	%eax, 20(%rbx)
	movq	8(%rbx), %rax
	cmpq	$0, (%rax)
	je	LBB0_1
LBB0_3:
	movq	%rbx, %rdi
	callq	_attach_spa
	movq	_CXL_PSL_SCNTL_An@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CXL_PSL_SCNTL_An_PM_AFU@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_cxl_p1n_write
	xorl	%eax, %eax
	callq	_cxl_is_power8
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movq	_CXL_PSL_AMOR_An@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$-1, %edx
	callq	_cxl_p1n_write
LBB0_5:
	movq	_CXL_PSL_ID_An@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CXL_PSL_ID_An_F@GOTPCREL(%rip), %rax
	movq	_CXL_PSL_ID_An_L@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_cxl_p1n_write
	movq	_CXL_MODE_DIRECTED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rbx)
	movq	%rbx, %rdi
	callq	_cxl_chardev_m_afu_add
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_11
## %bb.6:
	movq	%rbx, %rdi
	callq	_cxl_sysfs_afu_m_add
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_10
## %bb.7:
	movq	%rbx, %rdi
	callq	_cxl_chardev_s_afu_add
	testl	%eax, %eax
	je	LBB0_8
## %bb.9:
	movl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_cxl_sysfs_afu_m_remove
LBB0_10:
	movq	%rbx, %rdi
	callq	_cxl_chardev_afu_remove
	jmp	LBB0_11
LBB0_1:
	movq	_CXL_MODE_DIRECTED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_cxl_alloc_spa
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_11:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_8:
	xorl	%r14d, %r14d
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Activating AFU directed mode\n"

	.comm	_CXL_MODE_DIRECTED,4,2          ## @CXL_MODE_DIRECTED
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_CXL_PSL_SCNTL_An,4,2           ## @CXL_PSL_SCNTL_An
	.comm	_CXL_PSL_SCNTL_An_PM_AFU,4,2    ## @CXL_PSL_SCNTL_An_PM_AFU
	.comm	_CXL_PSL_AMOR_An,4,2            ## @CXL_PSL_AMOR_An
	.comm	_CXL_PSL_ID_An,4,2              ## @CXL_PSL_ID_An
	.comm	_CXL_PSL_ID_An_F,4,2            ## @CXL_PSL_ID_An_F
	.comm	_CXL_PSL_ID_An_L,4,2            ## @CXL_PSL_ID_An_L
	.no_dead_strip	_activate_afu_directed
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function activate_afu_directed
_activate_afu_directed:                 ; @activate_afu_directed
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	add	x0, x0, #24
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_info
	ldr	w8, [x19, #16]
	str	w8, [x19, #20]
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
Lloh2:
	adrp	x20, _CXL_MODE_DIRECTED@GOTPAGE
Lloh3:
	ldr	x20, [x20, _CXL_MODE_DIRECTED@GOTPAGEOFF]
	cbz	x8, LBB0_8
LBB0_1:
	mov	x0, x19
	bl	_attach_spa
Lloh4:
	adrp	x8, _CXL_PSL_SCNTL_An@GOTPAGE
Lloh5:
	ldr	x8, [x8, _CXL_PSL_SCNTL_An@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
Lloh7:
	adrp	x8, _CXL_PSL_SCNTL_An_PM_AFU@GOTPAGE
Lloh8:
	ldr	x8, [x8, _CXL_PSL_SCNTL_An_PM_AFU@GOTPAGEOFF]
Lloh9:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_cxl_p1n_write
	bl	_cxl_is_power8
	cbz	x0, LBB0_3
; %bb.2:
Lloh10:
	adrp	x8, _CXL_PSL_AMOR_An@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CXL_PSL_AMOR_An@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #-1
	bl	_cxl_p1n_write
LBB0_3:
Lloh13:
	adrp	x8, _CXL_PSL_ID_An@GOTPAGE
Lloh14:
	ldr	x8, [x8, _CXL_PSL_ID_An@GOTPAGEOFF]
Lloh15:
	adrp	x9, _CXL_PSL_ID_An_F@GOTPAGE
Lloh16:
	ldr	x9, [x9, _CXL_PSL_ID_An_F@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
Lloh18:
	ldr	w8, [x9]
Lloh19:
	adrp	x9, _CXL_PSL_ID_An_L@GOTPAGE
Lloh20:
	ldr	x9, [x9, _CXL_PSL_ID_An_L@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x19
	bl	_cxl_p1n_write
	ldr	w8, [x20]
	str	w8, [x19]
	mov	x0, x19
	bl	_cxl_chardev_m_afu_add
	mov	x20, x0
	cbnz	w0, LBB0_10
; %bb.4:
	mov	x0, x19
	bl	_cxl_sysfs_afu_m_add
	mov	x20, x0
	cbnz	w0, LBB0_7
; %bb.5:
	mov	x0, x19
	bl	_cxl_chardev_s_afu_add
	mov	x20, x0
	cbz	w0, LBB0_10
; %bb.6:
	mov	x0, x19
	bl	_cxl_sysfs_afu_m_remove
LBB0_7:
	mov	x0, x19
	bl	_cxl_chardev_afu_remove
	b	LBB0_10
LBB0_8:
	ldr	w1, [x20]
	mov	x0, x19
	bl	_cxl_alloc_spa
	cbz	x0, LBB0_1
; %bb.9:
Lloh22:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh23:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_10:
	mov	x0, x20
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh17
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Activating AFU directed mode\n"

	.comm	_CXL_MODE_DIRECTED,4,2          ; @CXL_MODE_DIRECTED
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_CXL_PSL_SCNTL_An,4,2           ; @CXL_PSL_SCNTL_An
	.comm	_CXL_PSL_SCNTL_An_PM_AFU,4,2    ; @CXL_PSL_SCNTL_An_PM_AFU
	.comm	_CXL_PSL_AMOR_An,4,2            ; @CXL_PSL_AMOR_An
	.comm	_CXL_PSL_ID_An,4,2              ; @CXL_PSL_ID_An
	.comm	_CXL_PSL_ID_An_F,4,2            ; @CXL_PSL_ID_An_F
	.comm	_CXL_PSL_ID_An_L,4,2            ; @CXL_PSL_ID_An_L
	.no_dead_strip	_activate_afu_directed
.subsections_via_symbols
