	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tegra_pcib_attach_msi
_tegra_pcib_attach_msi:                 ## @tegra_pcib_attach_msi
	.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
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %r15
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	movq	_M_WAITOK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_BUS_SPACE_MAXADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_VM_MEMATTR_DEFAULT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rsp)
	xorl	%ebx, %ebx
	xorl	%edx, %edx
	movl	%edi, %r8d
	xorl	%r9d, %r9d
	callq	_kmem_alloc_contig
	movl	%eax, 8(%r15)
	movl	%eax, %edi
	callq	_vtophys
	movl	%eax, %r12d
	movl	8(%r15), %edi
	callq	_vtophys
	movl	(%r13), %r8d
	movq	%r15, %rdi
	movl	$9, %esi
	movl	%r12d, %edx
	movl	%eax, %ecx
	xorl	%r9d, %r9d
	callq	_tegra_pcib_set_bar
	movq	_AFI_MSI_REGS@GOTPCREL(%rip), %r12
	cmpl	$0, (%r12)
	jle	LBB0_2
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	%ebx, %edi
	callq	_AFI_MSI_EN_VEC
	movq	%r15, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_AFI_WR4
	movl	%ebx, %edi
	callq	_AFI_MSI_VEC
	movq	%r15, %rdi
	movl	%eax, %esi
	movl	$-1, %edx
	callq	_AFI_WR4
	incl	%ebx
	cmpl	(%r12), %ebx
	jl	LBB0_1
LBB0_2:
	movl	4(%r15), %esi
	movq	_INTR_TYPE_BIO@GOTPCREL(%rip), %rax
	movq	_INTR_MPSAFE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	_tegra_pcib_msi_intr@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r15, (%rsp)
	movl	%r14d, %edi
	xorl	%r8d, %r8d
	movq	%r15, %r9
	callq	_bus_setup_intr
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edi
	callq	_device_printf
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_8
LBB0_4:
	movq	%r15, %rdi
	callq	_tegra_pcib_msi_attach
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edi
	callq	_device_printf
	movq	%r15, %rdi
	callq	_tegra_pcib_msi_detach
	jmp	LBB0_7
LBB0_6:
	movq	_AFI_INTR_MASK@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r15, %rdi
	callq	_AFI_RD4
	movq	_AFI_INTR_MASK_MSI_MASK@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	(%rbx), %esi
	movq	%r15, %rdi
	movl	%eax, %edx
	callq	_AFI_WR4
LBB0_7:
	xorl	%eax, %eax
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_M_WAITOK,4,2                   ## @M_WAITOK
	.comm	_BUS_SPACE_MAXADDR,4,2          ## @BUS_SPACE_MAXADDR
	.comm	_VM_MEMATTR_DEFAULT,4,2         ## @VM_MEMATTR_DEFAULT
	.comm	_AFI_MSI_REGS,4,2               ## @AFI_MSI_REGS
	.comm	_INTR_TYPE_BIO,4,2              ## @INTR_TYPE_BIO
	.comm	_INTR_MPSAFE,4,2                ## @INTR_MPSAFE
	.comm	_tegra_pcib_msi_intr,4,2        ## @tegra_pcib_msi_intr
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cannot setup MSI interrupt handler\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
L_.str.1:                               ## @.str.1
	.asciz	"WARNING: unable to attach PIC\n"

	.comm	_AFI_INTR_MASK,4,2              ## @AFI_INTR_MASK
	.comm	_AFI_INTR_MASK_MSI_MASK,4,2     ## @AFI_INTR_MASK_MSI_MASK
	.no_dead_strip	_tegra_pcib_attach_msi
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tegra_pcib_attach_msi
_tegra_pcib_attach_msi:                 ; @tegra_pcib_attach_msi
	.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, x0
	bl	_device_get_softc
	mov	x19, x0
Lloh0:
	adrp	x22, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x22, [x22, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w0, [x22]
Lloh2:
	adrp	x8, _M_WAITOK@GOTPAGE
Lloh3:
	ldr	x8, [x8, _M_WAITOK@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
Lloh5:
	adrp	x8, _BUS_SPACE_MAXADDR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _BUS_SPACE_MAXADDR@GOTPAGEOFF]
Lloh7:
	ldr	w3, [x8]
Lloh8:
	adrp	x8, _VM_MEMATTR_DEFAULT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _VM_MEMATTR_DEFAULT@GOTPAGEOFF]
Lloh10:
	ldr	w6, [x8]
	mov	w2, #0
	mov	x4, x0
	mov	w5, #0
	bl	_kmem_alloc_contig
	str	w0, [x19, #8]
	bl	_vtophys
	mov	x21, x0
	ldr	w0, [x19, #8]
	bl	_vtophys
	mov	x3, x0
	ldr	w4, [x22]
	mov	x0, x19
	mov	w1, #9
	mov	x2, x21
	mov	w5, #0
	bl	_tegra_pcib_set_bar
Lloh11:
	adrp	x22, _AFI_MSI_REGS@GOTPAGE
Lloh12:
	ldr	x22, [x22, _AFI_MSI_REGS@GOTPAGEOFF]
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_3
; %bb.1:
	mov	w21, #0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	bl	_AFI_MSI_EN_VEC
	mov	x1, x0
	mov	x0, x19
	mov	w2, #0
	bl	_AFI_WR4
	mov	x0, x21
	bl	_AFI_MSI_VEC
	mov	x1, x0
	mov	x0, x19
	mov	w2, #-1
	bl	_AFI_WR4
	add	w21, w21, #1
	ldr	w8, [x22]
	cmp	w21, w8
	b.lt	LBB0_2
LBB0_3:
	ldr	w1, [x19, #4]
Lloh13:
	adrp	x8, _INTR_TYPE_BIO@GOTPAGE
Lloh14:
	ldr	x8, [x8, _INTR_TYPE_BIO@GOTPAGEOFF]
Lloh15:
	adrp	x9, _INTR_MPSAFE@GOTPAGE
Lloh16:
	ldr	x9, [x9, _INTR_MPSAFE@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
Lloh18:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh19:
	adrp	x8, _tegra_pcib_msi_intr@GOTPAGE
Lloh20:
	ldr	x8, [x8, _tegra_pcib_msi_intr@GOTPAGEOFF]
Lloh21:
	ldr	w3, [x8]
	mov	x0, x20
	mov	x4, #0
	mov	x5, x19
	mov	x6, x19
	bl	_bus_setup_intr
	cbz	w0, LBB0_5
; %bb.4:
Lloh22:
	adrp	x1, l_.str@PAGE
Lloh23:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_device_printf
Lloh24:
	adrp	x8, _ENXIO@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh26:
	ldr	w0, [x8]
	b	LBB0_9
LBB0_5:
	mov	x0, x19
	bl	_tegra_pcib_msi_attach
	cbz	x0, LBB0_7
; %bb.6:
Lloh27:
	adrp	x1, l_.str.1@PAGE
Lloh28:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_device_printf
	mov	x0, x19
	bl	_tegra_pcib_msi_detach
	b	LBB0_8
LBB0_7:
Lloh29:
	adrp	x20, _AFI_INTR_MASK@GOTPAGE
Lloh30:
	ldr	x20, [x20, _AFI_INTR_MASK@GOTPAGEOFF]
	ldr	w1, [x20]
	mov	x0, x19
	bl	_AFI_RD4
Lloh31:
	adrp	x8, _AFI_INTR_MASK_MSI_MASK@GOTPAGE
Lloh32:
	ldr	x8, [x8, _AFI_INTR_MASK_MSI_MASK@GOTPAGEOFF]
Lloh33:
	ldr	w8, [x8]
	orr	w2, w8, w0
	ldr	w1, [x20]
	mov	x0, x19
	bl	_AFI_WR4
LBB0_8:
	mov	w0, #0
LBB0_9:
	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
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh17
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_M_WAITOK,4,2                   ; @M_WAITOK
	.comm	_BUS_SPACE_MAXADDR,4,2          ; @BUS_SPACE_MAXADDR
	.comm	_VM_MEMATTR_DEFAULT,4,2         ; @VM_MEMATTR_DEFAULT
	.comm	_AFI_MSI_REGS,4,2               ; @AFI_MSI_REGS
	.comm	_INTR_TYPE_BIO,4,2              ; @INTR_TYPE_BIO
	.comm	_INTR_MPSAFE,4,2                ; @INTR_MPSAFE
	.comm	_tegra_pcib_msi_intr,4,2        ; @tegra_pcib_msi_intr
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cannot setup MSI interrupt handler\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
l_.str.1:                               ; @.str.1
	.asciz	"WARNING: unable to attach PIC\n"

	.comm	_AFI_INTR_MASK,4,2              ; @AFI_INTR_MASK
	.comm	_AFI_INTR_MASK_MSI_MASK,4,2     ; @AFI_INTR_MASK_MSI_MASK
	.no_dead_strip	_tegra_pcib_attach_msi
.subsections_via_symbols
