	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function drm_iommu_attach_device
_drm_iommu_attach_device:               ## @drm_iommu_attach_device
	.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	%rsi, %r14
	movq	(%rdi), %r15
	movq	8(%r15), %rdi
	callq	_get_dma_ops
	movq	%rax, %rbx
	movq	%r14, %rdi
	callq	_get_dma_ops
	movq	%r14, %rdi
	cmpq	%rax, %rbx
	jne	LBB0_1
## %bb.2:
	callq	_configure_dma_max_seg_size
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_12
## %bb.3:
	movq	_CONFIG_ARM_DMA_USE_IOMMU@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_IS_ENABLED
	testq	%rax, %rax
	je	LBB0_7
## %bb.4:
	movq	%r14, %rdi
	callq	_to_dma_iommu_mapping
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movq	%r14, %rdi
	callq	_arm_iommu_detach_device
LBB0_6:
	movl	(%r15), %esi
	movq	%r14, %rdi
	callq	_arm_iommu_attach_device
	jmp	LBB0_10
LBB0_1:
	callq	_dev_name
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_DRM_DEV_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_CONFIG_IOMMU_DMA@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_IS_ENABLED
	testq	%rax, %rax
	je	LBB0_8
## %bb.9:
	movl	(%r15), %edi
	movq	%r14, %rsi
	callq	_iommu_attach_device
LBB0_10:
	xorl	%ebx, %ebx
	testl	%eax, %eax
	je	LBB0_12
## %bb.11:
	movq	%r14, %rdi
	callq	_clear_dma_max_seg_size
	jmp	LBB0_12
LBB0_8:
	xorl	%ebx, %ebx
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Device %s lacks support for IOMMU\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_CONFIG_ARM_DMA_USE_IOMMU,4,2   ## @CONFIG_ARM_DMA_USE_IOMMU
	.comm	_CONFIG_IOMMU_DMA,4,2           ## @CONFIG_IOMMU_DMA
	.no_dead_strip	_drm_iommu_attach_device
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function drm_iommu_attach_device
_drm_iommu_attach_device:               ; @drm_iommu_attach_device
	.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	x19, x1
	ldr	x21, [x0]
	ldr	x0, [x21, #8]
	bl	_get_dma_ops
	mov	x20, x0
	mov	x0, x19
	bl	_get_dma_ops
	cmp	x20, x0
	b.ne	LBB0_6
; %bb.1:
	mov	x0, x19
	bl	_configure_dma_max_seg_size
	cbnz	w0, LBB0_7
; %bb.2:
Lloh0:
	adrp	x8, _CONFIG_ARM_DMA_USE_IOMMU@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CONFIG_ARM_DMA_USE_IOMMU@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_IS_ENABLED
	cbz	x0, LBB0_8
; %bb.3:
	mov	x0, x19
	bl	_to_dma_iommu_mapping
	cbz	x0, LBB0_5
; %bb.4:
	mov	x0, x19
	bl	_arm_iommu_detach_device
LBB0_5:
	ldr	w1, [x21]
	mov	x0, x19
	bl	_arm_iommu_attach_device
	cbnz	w0, LBB0_10
	b	LBB0_7
LBB0_6:
	mov	x0, x19
	bl	_dev_name
	mov	x2, x0
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_DRM_DEV_ERROR
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_7:
	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_8:
Lloh8:
	adrp	x8, _CONFIG_IOMMU_DMA@GOTPAGE
Lloh9:
	ldr	x8, [x8, _CONFIG_IOMMU_DMA@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	bl	_IS_ENABLED
	cbz	x0, LBB0_7
; %bb.9:
	ldr	w0, [x21]
	mov	x1, x19
	bl	_iommu_attach_device
	cbz	w0, LBB0_7
LBB0_10:
	mov	x0, x19
	bl	_clear_dma_max_seg_size
	mov	w0, #0
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Device %s lacks support for IOMMU\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_CONFIG_ARM_DMA_USE_IOMMU,4,2   ; @CONFIG_ARM_DMA_USE_IOMMU
	.comm	_CONFIG_IOMMU_DMA,4,2           ; @CONFIG_IOMMU_DMA
	.no_dead_strip	_drm_iommu_attach_device
.subsections_via_symbols
