	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cxllib_switch_phb_mode         ## -- Begin function cxllib_switch_phb_mode
	.p2align	4, 0x90
_cxllib_switch_phb_mode:                ## @cxllib_switch_phb_mode
	.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	%rdx, %r15
	movl	%esi, %ebx
	movq	%rdi, %r14
	movq	_CPU_FTR_HVMODE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_cpu_has_feature
	testl	%eax, %eax
	je	LBB0_9
## %bb.1:
	cmpl	$129, %ebx
	je	LBB0_6
## %bb.2:
	cmpl	$128, %ebx
	jne	LBB0_9
## %bb.3:
	movq	_OPAL_PHB_CAPI_MODE_SNOOP_OFF@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_pnv_phb_to_cxl_mode
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movq	_EBUSY@GOTPCREL(%rip), %rcx
	jmp	LBB0_10
LBB0_6:
	movq	_CXL_MODE_DMA_TVT1@GOTPCREL(%rip), %rax
	cmpq	%r15, (%rax)
	jne	LBB0_9
## %bb.7:
	movq	_OPAL_PHB_CAPI_MODE_DMA_TVT1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_pnv_phb_to_cxl_mode
	testl	%eax, %eax
	jne	LBB0_11
## %bb.8:
	movq	_OPAL_PHB_CAPI_MODE_SNOOP_ON@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_pnv_phb_to_cxl_mode            ## TAILCALL
LBB0_9:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_10:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_11:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	_EPERM@GOTPCREL(%rip), %rcx
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_CPU_FTR_HVMODE,4,2             ## @CPU_FTR_HVMODE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_OPAL_PHB_CAPI_MODE_SNOOP_OFF,4,2 ## @OPAL_PHB_CAPI_MODE_SNOOP_OFF
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_EPERM,4,2                      ## @EPERM
	.comm	_CXL_MODE_DMA_TVT1,8,3          ## @CXL_MODE_DMA_TVT1
	.comm	_OPAL_PHB_CAPI_MODE_DMA_TVT1,4,2 ## @OPAL_PHB_CAPI_MODE_DMA_TVT1
	.comm	_OPAL_PHB_CAPI_MODE_SNOOP_ON,4,2 ## @OPAL_PHB_CAPI_MODE_SNOOP_ON
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cxllib_switch_phb_mode         ; -- Begin function cxllib_switch_phb_mode
	.p2align	2
_cxllib_switch_phb_mode:                ; @cxllib_switch_phb_mode
	.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	x20, x2
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _CPU_FTR_HVMODE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CPU_FTR_HVMODE@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_cpu_has_feature
	cbz	w0, LBB0_8
; %bb.1:
	cmp	w21, #129
	b.eq	LBB0_5
; %bb.2:
	cmp	w21, #128
	b.ne	LBB0_8
; %bb.3:
Lloh3:
	adrp	x8, _OPAL_PHB_CAPI_MODE_SNOOP_OFF@GOTPAGE
Lloh4:
	ldr	x8, [x8, _OPAL_PHB_CAPI_MODE_SNOOP_OFF@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_pnv_phb_to_cxl_mode
	cbz	w0, LBB0_11
; %bb.4:
Lloh6:
	adrp	x8, _EBUSY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_9
LBB0_5:
Lloh8:
	adrp	x8, _CXL_MODE_DMA_TVT1@GOTPAGE
Lloh9:
	ldr	x8, [x8, _CXL_MODE_DMA_TVT1@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	cmp	x8, x20
	b.ne	LBB0_8
; %bb.6:
Lloh11:
	adrp	x8, _OPAL_PHB_CAPI_MODE_DMA_TVT1@GOTPAGE
Lloh12:
	ldr	x8, [x8, _OPAL_PHB_CAPI_MODE_DMA_TVT1@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_pnv_phb_to_cxl_mode
	cbnz	w0, LBB0_10
; %bb.7:
Lloh14:
	adrp	x8, _OPAL_PHB_CAPI_MODE_SNOOP_ON@GOTPAGE
Lloh15:
	ldr	x8, [x8, _OPAL_PHB_CAPI_MODE_SNOOP_ON@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x19
	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
	b	_pnv_phb_to_cxl_mode
LBB0_8:
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	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_11:
Lloh19:
	adrp	x8, _EPERM@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EPERM@GOTPAGEOFF]
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_CPU_FTR_HVMODE,4,2             ; @CPU_FTR_HVMODE
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_OPAL_PHB_CAPI_MODE_SNOOP_OFF,4,2 ; @OPAL_PHB_CAPI_MODE_SNOOP_OFF
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_EPERM,4,2                      ; @EPERM
	.comm	_CXL_MODE_DMA_TVT1,8,3          ; @CXL_MODE_DMA_TVT1
	.comm	_OPAL_PHB_CAPI_MODE_DMA_TVT1,4,2 ; @OPAL_PHB_CAPI_MODE_DMA_TVT1
	.comm	_OPAL_PHB_CAPI_MODE_SNOOP_ON,4,2 ; @OPAL_PHB_CAPI_MODE_SNOOP_ON
.subsections_via_symbols
