	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function arm_smmu_attach_dev
_arm_smmu_attach_dev:                   ## @arm_smmu_attach_dev
	.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	%rsi, %r13
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	_dev_iommu_fwspec_get
	movq	%rax, %rbx
	movq	%r14, %rdi
	callq	_to_smmu_domain
	testq	%rbx, %rbx
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movq	(%rbx), %r15
	movq	16(%r15), %rbx
	movq	%r15, %rdi
	callq	_arm_smmu_detach_dev
	leaq	8(%r12), %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movq	24(%r12), %rax
	testq	%rax, %rax
	je	LBB0_3
## %bb.5:
	cmpq	%rbx, %rax
	movq	%rbx, %r14
	je	LBB0_7
## %bb.6:
	movl	(%rax), %edi
	callq	_dev_name
	movl	%eax, %ebx
	movl	(%r14), %edi
	callq	_dev_name
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rdi
	movl	%ebx, %edx
	movl	%eax, %ecx
	callq	_dev_err
	movq	_ENXIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_12
LBB0_1:
	movq	_ENOENT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_13
LBB0_3:
	movq	%rbx, 24(%r12)
	movq	%r14, %rdi
	callq	_arm_smmu_domain_finalise
	movq	%rbx, %r14
	testl	%eax, %eax
	je	LBB0_7
## %bb.4:
	movl	%eax, %ebx
	movq	$0, 24(%r12)
	jmp	LBB0_12
LBB0_7:
	movq	%r14, %rbx
	movq	%r12, 8(%r15)
	movq	(%r12), %rax
	movq	_ARM_SMMU_DOMAIN_BYPASS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_9
## %bb.8:
	movq	%r15, %rdi
	callq	_arm_smmu_ats_supported
	movl	%eax, 4(%r15)
	movq	(%r12), %rax
LBB0_9:
	movq	_ARM_SMMU_DOMAIN_S1@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_11
## %bb.10:
	movq	%rbx, %rdi
	leaq	20(%r12), %rsi
	callq	_arm_smmu_write_ctx_desc
LBB0_11:
	movq	%r15, %rdi
	callq	_arm_smmu_install_ste_for_dev
	leaq	12(%r12), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock_irqsave
	addq	$16, %r12
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_list_add
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	movq	%r15, %rdi
	callq	_arm_smmu_enable_ats
	xorl	%ebx, %ebx
LBB0_12:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
LBB0_13:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOENT,4,2                     ## @ENOENT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cannot attach to SMMU %s (upstream of %s)\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_ARM_SMMU_DOMAIN_BYPASS,8,3     ## @ARM_SMMU_DOMAIN_BYPASS
	.comm	_ARM_SMMU_DOMAIN_S1,8,3         ## @ARM_SMMU_DOMAIN_S1
	.no_dead_strip	_arm_smmu_attach_dev
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function arm_smmu_attach_dev
_arm_smmu_attach_dev:                   ; @arm_smmu_attach_dev
	.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	x23, x1
	mov	x24, x0
	mov	x0, x1
	bl	_dev_iommu_fwspec_get
	mov	x19, x0
	mov	x0, x24
	bl	_to_smmu_domain
	cbz	x19, LBB0_4
; %bb.1:
	mov	x21, x0
	ldr	x20, [x19]
	ldr	x22, [x20, #16]
	mov	x0, x20
	bl	_arm_smmu_detach_dev
	add	x19, x21, #8
	mov	x0, x19
	bl	_mutex_lock
	ldr	x8, [x21, #24]
	cbz	x8, LBB0_5
; %bb.2:
	cmp	x8, x22
	b.eq	LBB0_7
; %bb.3:
	ldr	w0, [x8]
	bl	_dev_name
	mov	x20, x0
	ldr	w0, [x22]
	bl	_dev_name
	mov	x3, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x23
	mov	x2, x20
	bl	_dev_err
Lloh2:
	adrp	x8, _ENXIO@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_12
LBB0_4:
Lloh5:
	adrp	x8, _ENOENT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_13
LBB0_5:
	str	x22, [x21, #24]
	mov	x0, x24
	bl	_arm_smmu_domain_finalise
	cbz	w0, LBB0_7
; %bb.6:
	mov	x23, x0
	str	xzr, [x21, #24]
	b	LBB0_12
LBB0_7:
	str	x21, [x20, #8]
	ldr	x8, [x21]
Lloh8:
	adrp	x9, _ARM_SMMU_DOMAIN_BYPASS@GOTPAGE
Lloh9:
	ldr	x9, [x9, _ARM_SMMU_DOMAIN_BYPASS@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_9
; %bb.8:
	mov	x0, x20
	bl	_arm_smmu_ats_supported
	str	w0, [x20, #4]
	ldr	x8, [x21]
LBB0_9:
Lloh11:
	adrp	x9, _ARM_SMMU_DOMAIN_S1@GOTPAGE
Lloh12:
	ldr	x9, [x9, _ARM_SMMU_DOMAIN_S1@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_11
; %bb.10:
	add	x1, x21, #20
	mov	x0, x22
	bl	_arm_smmu_write_ctx_desc
LBB0_11:
	mov	x0, x20
	bl	_arm_smmu_install_ste_for_dev
	add	x22, x21, #12
	mov	x0, x22
	bl	_spin_lock_irqsave
	add	x1, x21, #16
	mov	x0, x20
	bl	_list_add
	mov	x0, x22
	bl	_spin_unlock_irqrestore
	mov	x0, x20
	bl	_arm_smmu_enable_ats
	mov	w23, #0
LBB0_12:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_13:
	mov	x0, x23
	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	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOENT,4,2                     ; @ENOENT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cannot attach to SMMU %s (upstream of %s)\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_ARM_SMMU_DOMAIN_BYPASS,8,3     ; @ARM_SMMU_DOMAIN_BYPASS
	.comm	_ARM_SMMU_DOMAIN_S1,8,3         ; @ARM_SMMU_DOMAIN_S1
	.no_dead_strip	_arm_smmu_attach_dev
.subsections_via_symbols
