	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_drm_dp_mst_topology_mgr_set_mst ## -- Begin function drm_dp_mst_topology_mgr_set_mst
	.p2align	4, 0x90
_drm_dp_mst_topology_mgr_set_mst:       ## @drm_dp_mst_topology_mgr_set_mst
	.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
	movl	%esi, %ebx
	movq	%rdi, %r13
	leaq	20(%rdi), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	xorl	%r15d, %r15d
	cmpl	%ebx, (%r13)
	je	LBB0_12
## %bb.1:
	movl	%ebx, (%r13)
	movq	48(%r13), %r12
	testl	%ebx, %ebx
	je	LBB0_7
## %bb.2:
	movq	%r12, %rdi
	callq	_WARN_ON
	movl	44(%r13), %edi
	movq	_DP_DPCD_REV@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	8(%r13), %rdx
	movq	_DP_RECEIVER_CAP_SIZE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %ecx
	callq	_drm_dp_dpcd_read
	cmpl	(%rbx), %eax
	jne	LBB0_8
## %bb.3:
	movq	8(%r13), %rax
	movl	4(%rax), %edi
	movq	_DP_MAX_LANE_COUNT_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	andl	8(%rax), %esi
	leaq	60(%r13), %rdx
	callq	_drm_dp_get_vc_payload_bw
	testl	%eax, %eax
	je	LBB0_9
## %bb.4:
	xorl	%r15d, %r15d
	movl	$1, %edi
	xorl	%esi, %esi
	callq	_drm_dp_add_mst_branch_device
	testq	%rax, %rax
	je	LBB0_10
## %bb.5:
	movq	%rax, %r12
	movq	%r13, (%rax)
	movq	%rax, 48(%r13)
	movq	%rax, %rdi
	callq	_drm_dp_mst_topology_get_mstb
	movl	44(%r13), %edi
	movq	_DP_MSTM_CTRL@GOTPCREL(%rip), %rax
	movq	_DP_MST_EN@GOTPCREL(%rip), %rcx
	movq	_DP_UP_REQ_EN@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movl	(%rax), %esi
	movq	_DP_UPSTREAM_IS_SRC@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	callq	_drm_dp_dpcd_writeb
	testl	%eax, %eax
	js	LBB0_14
## %bb.6:
	movq	$0, -48(%rbp)
	movl	$63, -56(%rbp)
	xorl	%r15d, %r15d
	leaq	-56(%rbp), %rdx
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_drm_dp_dpcd_write_payload
	movq	_system_long_wq@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addq	$56, %r13
	movq	%r13, %rsi
	callq	_queue_work
	jmp	LBB0_15
LBB0_7:
	movq	$0, 48(%r13)
	movl	44(%r13), %edi
	movq	_DP_MSTM_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r15d, %r15d
	xorl	%edx, %edx
	callq	_drm_dp_dpcd_writeb
	movl	16(%r13), %edx
	movl	40(%r13), %edi
	shll	$4, %edx
	xorl	%esi, %esi
	callq	_memset
	leaq	32(%r13), %rsi
	movq	$0, 32(%r13)
	xorl	%edi, %edi
	callq	_set_bit
	movq	$0, 24(%r13)
	movq	%r14, %rdi
	callq	_mutex_unlock
	testq	%r12, %r12
	jne	LBB0_16
	jmp	LBB0_13
LBB0_8:
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rdi
	callq	_DRM_DEBUG_KMS
	jmp	LBB0_12
LBB0_9:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	jmp	LBB0_11
LBB0_10:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_11:
	subl	(%rax), %r15d
LBB0_12:
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_13:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	movl	%eax, %r15d
LBB0_15:
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_16:
	movq	%r12, %rdi
	callq	_drm_dp_mst_topology_put_mstb
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_DP_DPCD_REV,4,2                ## @DP_DPCD_REV
	.comm	_DP_RECEIVER_CAP_SIZE,4,2       ## @DP_RECEIVER_CAP_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to read DPCD\n"

	.comm	_DP_MAX_LANE_COUNT_MASK,4,2     ## @DP_MAX_LANE_COUNT_MASK
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_DP_MSTM_CTRL,4,2               ## @DP_MSTM_CTRL
	.comm	_DP_MST_EN,4,2                  ## @DP_MST_EN
	.comm	_DP_UP_REQ_EN,4,2               ## @DP_UP_REQ_EN
	.comm	_DP_UPSTREAM_IS_SRC,4,2         ## @DP_UPSTREAM_IS_SRC
	.comm	_system_long_wq,4,2             ## @system_long_wq
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_drm_dp_mst_topology_mgr_set_mst ; -- Begin function drm_dp_mst_topology_mgr_set_mst
	.p2align	2
_drm_dp_mst_topology_mgr_set_mst:       ; @drm_dp_mst_topology_mgr_set_mst
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x22, x1
	mov	x20, x0
	add	x19, x0, #20
	mov	x0, x19
	bl	_mutex_lock
	ldr	w8, [x20]
	cmp	w8, w22
	b.ne	LBB0_2
; %bb.1:
	mov	w22, #0
	b	LBB0_13
LBB0_2:
	str	w22, [x20]
	ldr	x21, [x20, #48]
	cbz	w22, LBB0_8
; %bb.3:
	mov	x0, x21
	bl	_WARN_ON
Lloh0:
	adrp	x8, _DP_DPCD_REV@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DP_DPCD_REV@GOTPAGEOFF]
	ldr	w0, [x20, #44]
Lloh2:
	ldr	w1, [x8]
	ldr	x2, [x20, #8]
Lloh3:
	adrp	x21, _DP_RECEIVER_CAP_SIZE@GOTPAGE
Lloh4:
	ldr	x21, [x21, _DP_RECEIVER_CAP_SIZE@GOTPAGEOFF]
	ldr	w3, [x21]
	bl	_drm_dp_dpcd_read
	ldr	w8, [x21]
	cmp	w0, w8
	b.ne	LBB0_9
; %bb.4:
	ldr	x8, [x20, #8]
	ldp	w0, w8, [x8, #4]
Lloh5:
	adrp	x9, _DP_MAX_LANE_COUNT_MASK@GOTPAGE
Lloh6:
	ldr	x9, [x9, _DP_MAX_LANE_COUNT_MASK@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	and	w1, w9, w8
	add	x2, x20, #60
	bl	_drm_dp_get_vc_payload_bw
	cbz	w0, LBB0_10
; %bb.5:
	mov	w0, #1
	mov	x1, #0
	bl	_drm_dp_add_mst_branch_device
	cbz	x0, LBB0_11
; %bb.6:
	mov	x21, x0
	str	x20, [x0]
	str	x0, [x20, #48]
	bl	_drm_dp_mst_topology_get_mstb
	ldr	w0, [x20, #44]
Lloh8:
	adrp	x8, _DP_MSTM_CTRL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _DP_MSTM_CTRL@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
Lloh11:
	adrp	x8, _DP_MST_EN@GOTPAGE
Lloh12:
	ldr	x8, [x8, _DP_MST_EN@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
Lloh14:
	adrp	x9, _DP_UP_REQ_EN@GOTPAGE
Lloh15:
	ldr	x9, [x9, _DP_UP_REQ_EN@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh17:
	adrp	x9, _DP_UPSTREAM_IS_SRC@GOTPAGE
Lloh18:
	ldr	x9, [x9, _DP_UPSTREAM_IS_SRC@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w2, w8, w9
	bl	_drm_dp_dpcd_writeb
	tbnz	w0, #31, LBB0_15
; %bb.7:
	str	xzr, [sp, #8]
	mov	w8, #63
	str	w8, [sp]
	mov	x2, sp
	mov	x0, x20
	mov	w1, #0
	bl	_drm_dp_dpcd_write_payload
Lloh20:
	adrp	x8, _system_long_wq@GOTPAGE
Lloh21:
	ldr	x8, [x8, _system_long_wq@GOTPAGEOFF]
Lloh22:
	ldr	w0, [x8]
	add	x1, x20, #56
	bl	_queue_work
	mov	w23, #0
	b	LBB0_16
LBB0_8:
	str	xzr, [x20, #48]
	ldr	w0, [x20, #44]
Lloh23:
	adrp	x8, _DP_MSTM_CTRL@GOTPAGE
Lloh24:
	ldr	x8, [x8, _DP_MSTM_CTRL@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_drm_dp_dpcd_writeb
	ldr	w0, [x20, #40]
	ldr	w8, [x20, #16]
	lsl	w2, w8, #4
	mov	w1, #0
	bl	_memset
	str	xzr, [x20, #32]!
	mov	w0, #0
	mov	x1, x20
	bl	_set_bit
	stur	xzr, [x20, #-8]
	mov	x0, x19
	bl	_mutex_unlock
	mov	w23, #0
	cbnz	x21, LBB0_17
	b	LBB0_14
LBB0_9:
	mov	x22, x0
Lloh26:
	adrp	x0, l_.str@PAGE
Lloh27:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG_KMS
	b	LBB0_13
LBB0_10:
Lloh28:
	adrp	x8, _EINVAL@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_12
LBB0_11:
Lloh30:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh31:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_13:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_14:
	mov	x0, x22
	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
	add	sp, sp, #80
	ret
LBB0_15:
	mov	x23, x0
LBB0_16:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_17:
	mov	x0, x21
	bl	_drm_dp_mst_topology_put_mstb
	mov	x22, x23
	b	LBB0_14
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_DP_DPCD_REV,4,2                ; @DP_DPCD_REV
	.comm	_DP_RECEIVER_CAP_SIZE,4,2       ; @DP_RECEIVER_CAP_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to read DPCD\n"

	.comm	_DP_MAX_LANE_COUNT_MASK,4,2     ; @DP_MAX_LANE_COUNT_MASK
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_DP_MSTM_CTRL,4,2               ; @DP_MSTM_CTRL
	.comm	_DP_MST_EN,4,2                  ; @DP_MST_EN
	.comm	_DP_UP_REQ_EN,4,2               ; @DP_UP_REQ_EN
	.comm	_DP_UPSTREAM_IS_SRC,4,2         ; @DP_UPSTREAM_IS_SRC
	.comm	_system_long_wq,4,2             ; @system_long_wq
.subsections_via_symbols
