	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function attach_device
_attach_device:                         ## @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	%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, %r15
	movq	%rdi, %rbx
	leaq	4(%rsi), %r14
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movq	%rbx, %rdi
	callq	_get_dev_data
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_spin_lock
	cmpq	$0, 48(%r13)
	je	LBB0_2
## %bb.1:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_12
LBB0_2:
	movq	%rbx, %rdi
	callq	_dev_is_pci
	testl	%eax, %eax
	je	LBB0_11
## %bb.3:
	movq	%rbx, %rdi
	callq	_to_pci_dev
	movq	%rax, %r12
	movq	_PD_IOMMUV2_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r15)
	je	LBB0_8
## %bb.4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	cmpl	$0, 40(%r13)
	je	LBB0_12
## %bb.5:
	cmpq	$0, 32(%r13)
	je	LBB0_11
## %bb.6:
	movq	%r12, %rdi
	callq	_pdev_iommuv2_enable
	testq	%rax, %rax
	jne	LBB0_12
## %bb.7:
	movl	$1, 8(%r13)
	movq	%r12, %rdi
	callq	_pci_ats_queue_depth
	movq	%rax, 16(%r13)
	movq	%r12, %rdi
	callq	_pci_prg_resp_pasid_required
	movl	%eax, 24(%r13)
	jmp	LBB0_11
LBB0_8:
	movq	_amd_iommu_iotlb_sup@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_11
## %bb.9:
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_pci_enable_ats
	testq	%rax, %rax
	jne	LBB0_11
## %bb.10:
	movl	$1, 8(%r13)
	movq	%r12, %rdi
	callq	_pci_ats_queue_depth
	movq	%rax, 16(%r13)
LBB0_11:
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_do_attach
	movq	%r15, %rdi
	callq	_domain_flush_tlb_pde
	movq	%r15, %rdi
	callq	_domain_flush_complete
	xorl	%ebx, %ebx
LBB0_12:
	movq	%r13, %rdi
	callq	_spin_unlock
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_PD_IOMMUV2_MASK,4,2            ## @PD_IOMMUV2_MASK
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_amd_iommu_iotlb_sup,8,3        ## @amd_iommu_iotlb_sup
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.no_dead_strip	_attach_device
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function attach_device
_attach_device:                         ; @attach_device
	.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	x21, x1
	mov	x22, x0
	add	x19, x1, #4
	mov	x0, x19
	bl	_spin_lock_irqsave
	mov	x0, x22
	bl	_get_dev_data
	mov	x20, x0
	bl	_spin_lock
	ldr	x8, [x20, #48]
	cbz	x8, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _EBUSY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_12
LBB0_2:
	mov	x0, x22
	bl	_dev_is_pci
	cbz	w0, LBB0_11
; %bb.3:
	mov	x0, x22
	bl	_to_pci_dev
	mov	x22, x0
	ldr	w8, [x21]
Lloh3:
	adrp	x9, _PD_IOMMUV2_MASK@GOTPAGE
Lloh4:
	ldr	x9, [x9, _PD_IOMMUV2_MASK@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.4:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w23, w8
	ldr	w8, [x20, #40]
	cbz	w8, LBB0_12
; %bb.5:
	ldr	x8, [x20, #32]
	cbz	x8, LBB0_11
; %bb.6:
	mov	x0, x22
	bl	_pdev_iommuv2_enable
	cbnz	x0, LBB0_12
; %bb.7:
	mov	w8, #1
	str	w8, [x20, #8]
	mov	x0, x22
	bl	_pci_ats_queue_depth
	str	x0, [x20, #16]
	mov	x0, x22
	bl	_pci_prg_resp_pasid_required
	str	w0, [x20, #24]
	b	LBB0_11
LBB0_8:
Lloh9:
	adrp	x8, _amd_iommu_iotlb_sup@GOTPAGE
Lloh10:
	ldr	x8, [x8, _amd_iommu_iotlb_sup@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	cbz	x8, LBB0_11
; %bb.9:
Lloh12:
	adrp	x8, _PAGE_SHIFT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PAGE_SHIFT@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_pci_enable_ats
	cbnz	x0, LBB0_11
; %bb.10:
	mov	w8, #1
	str	w8, [x20, #8]
	mov	x0, x22
	bl	_pci_ats_queue_depth
	str	x0, [x20, #16]
LBB0_11:
	mov	x0, x20
	mov	x1, x21
	bl	_do_attach
	mov	x0, x21
	bl	_domain_flush_tlb_pde
	mov	x0, x21
	bl	_domain_flush_complete
	mov	w23, #0
LBB0_12:
	mov	x0, x20
	bl	_spin_unlock
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_PD_IOMMUV2_MASK,4,2            ; @PD_IOMMUV2_MASK
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_amd_iommu_iotlb_sup,8,3        ; @amd_iommu_iotlb_sup
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.no_dead_strip	_attach_device
.subsections_via_symbols
