	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function myri10ge_enable_ecrc
_myri10ge_enable_ecrc:                  ## @myri10ge_enable_ecrc
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_myri10ge_ecrc_enable@GOTPCREL(%rip), %rbx
	cmpl	$0, (%rbx)
	je	LBB0_15
## %bb.1:
	movq	(%rdi), %r14
	movq	8(%r14), %rax
	movq	(%rax), %r15
	testq	%r15, %r15
	je	LBB0_15
## %bb.2:
	movq	%r15, %rdi
	callq	_pci_pcie_type
	movq	_PCI_EXP_TYPE_ROOT_PORT@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rax
	jne	LBB0_4
## %bb.3:
	movq	%r15, %rbx
LBB0_10:
	movq	_PCI_EXT_CAP_ID_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_pci_find_ext_capability
	testl	%eax, %eax
	je	LBB0_15
## %bb.11:
	movslq	%eax, %r15
	movq	_PCI_ERR_CAP@GOTPCREL(%rip), %r12
	movq	(%r12), %rsi
	addq	%r15, %rsi
	leaq	-36(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_pci_read_config_dword
	testl	%eax, %eax
	je	LBB0_13
## %bb.12:
	movq	%rbx, %rdi
	callq	_pci_name
	leaq	L_.str.3(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	leaq	L_.str.4(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_15
LBB0_4:
	cmpl	$2, (%rbx)
	jl	LBB0_17
## %bb.5:
	movq	%r15, %rcx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rcx), %rax
	movq	(%rax), %rbx
	testq	%rbx, %rbx
	je	LBB0_16
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	cmpq	%rbx, %rcx
	je	LBB0_16
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%rbx, %rdi
	callq	_pci_pcie_type
	movq	%rbx, %rcx
	cmpq	(%r12), %rax
	jne	LBB0_6
## %bb.9:
	movq	%r15, %rdi
	callq	_pci_name
	movl	%eax, %r15d
	movq	%rbx, %rdi
	callq	_pci_name
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movl	%r15d, %edx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_dev_info
	jmp	LBB0_10
LBB0_17:
	movq	%r15, %rdi
	callq	_pci_name
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_err                        ## TAILCALL
LBB0_13:
	movl	-36(%rbp), %edx
	movq	_PCI_ERR_CAP_ECRC_GENC@GOTPCREL(%rip), %rax
	testl	%edx, (%rax)
	je	LBB0_15
## %bb.14:
	movq	_PCI_ERR_CAP_ECRC_GENE@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movl	%edx, -36(%rbp)
	addq	(%r12), %r15
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_pci_write_config_dword
	movq	%rbx, %rdi
	callq	_pci_name
	leaq	L_.str.5(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_info
LBB0_15:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_err                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_myri10ge_ecrc_enable,4,2       ## @myri10ge_ecrc_enable
	.comm	_PCI_EXP_TYPE_ROOT_PORT,8,3     ## @PCI_EXP_TYPE_ROOT_PORT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to find root port to force ECRC\n"

L_.str.1:                               ## @.str.1
	.asciz	"Forcing ECRC on non-root port %s (enabling on root port %s)\n"

L_.str.2:                               ## @.str.2
	.asciz	"Not enabling ECRC on non-root port %s\n"

	.comm	_PCI_EXT_CAP_ID_ERR,4,2         ## @PCI_EXT_CAP_ID_ERR
	.comm	_PCI_ERR_CAP,8,3                ## @PCI_ERR_CAP
L_.str.3:                               ## @.str.3
	.asciz	"failed reading ext-conf-space of %s\n"

L_.str.4:                               ## @.str.4
	.asciz	"\t pci=nommconf in use? or buggy/incomplete/absent ACPI MCFG attr?\n"

	.comm	_PCI_ERR_CAP_ECRC_GENC,4,2      ## @PCI_ERR_CAP_ECRC_GENC
	.comm	_PCI_ERR_CAP_ECRC_GENE,4,2      ## @PCI_ERR_CAP_ECRC_GENE
L_.str.5:                               ## @.str.5
	.asciz	"Enabled ECRC on upstream bridge %s\n"

	.no_dead_strip	_myri10ge_enable_ecrc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function myri10ge_enable_ecrc
_myri10ge_enable_ecrc:                  ; @myri10ge_enable_ecrc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	ldr	x19, [x0]
	ldr	x8, [x19, #8]
	ldr	x21, [x8]
Lloh0:
	adrp	x20, _myri10ge_ecrc_enable@GOTPAGE
Lloh1:
	ldr	x20, [x20, _myri10ge_ecrc_enable@GOTPAGEOFF]
	ldr	w8, [x20]
	cmp	w8, #0
	ccmp	x21, #0, #4, ne
	b.eq	LBB0_13
; %bb.1:
	mov	x0, x21
	bl	_pci_pcie_type
Lloh2:
	adrp	x22, _PCI_EXP_TYPE_ROOT_PORT@GOTPAGE
Lloh3:
	ldr	x22, [x22, _PCI_EXP_TYPE_ROOT_PORT@GOTPAGEOFF]
	ldr	x8, [x22]
	cmp	x0, x8
	b.ne	LBB0_6
; %bb.2:
	mov	x20, x21
LBB0_3:
Lloh4:
	adrp	x8, _PCI_EXT_CAP_ID_ERR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _PCI_EXT_CAP_ID_ERR@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_pci_find_ext_capability
                                        ; kill: def $w0 killed $w0 def $x0
	cbz	w0, LBB0_13
; %bb.4:
	sxtw	x21, w0
Lloh7:
	adrp	x22, _PCI_ERR_CAP@GOTPAGE
Lloh8:
	ldr	x22, [x22, _PCI_ERR_CAP@GOTPAGEOFF]
	ldr	x8, [x22]
	add	x1, x8, x21
	add	x2, sp, #12
	mov	x0, x20
	bl	_pci_read_config_dword
	cbz	w0, LBB0_14
; %bb.5:
	mov	x0, x20
	bl	_pci_name
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh9:
	adrp	x1, l_.str.3@PAGE
Lloh10:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_dev_err
Lloh11:
	adrp	x1, l_.str.4@PAGE
Lloh12:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_12
LBB0_6:
	ldr	w8, [x20]
	cmp	w8, #2
	b.lt	LBB0_11
; %bb.7:
	mov	x20, x21
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	mov	x8, x20
	ldr	x9, [x20]
	ldr	x20, [x9]
	cmp	x20, #0
	ccmp	x8, x20, #4, ne
	b.eq	LBB0_16
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	mov	x0, x20
	bl	_pci_pcie_type
	ldr	x8, [x22]
	cmp	x0, x8
	b.ne	LBB0_8
; %bb.10:
	mov	x0, x21
	bl	_pci_name
	mov	x21, x0
	mov	x0, x20
	bl	_pci_name
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x2, x21
	bl	_dev_info
	b	LBB0_3
LBB0_11:
	mov	x0, x21
	bl	_pci_name
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh15:
	adrp	x1, l_.str.2@PAGE
Lloh16:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_12:
	mov	x0, x19
	bl	_dev_err
LBB0_13:
	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
	add	sp, sp, #64
	ret
LBB0_14:
	ldr	w8, [sp, #12]
Lloh17:
	adrp	x9, _PCI_ERR_CAP_ECRC_GENC@GOTPAGE
Lloh18:
	ldr	x9, [x9, _PCI_ERR_CAP_ECRC_GENC@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_13
; %bb.15:
Lloh20:
	adrp	x9, _PCI_ERR_CAP_ECRC_GENE@GOTPAGE
Lloh21:
	ldr	x9, [x9, _PCI_ERR_CAP_ECRC_GENE@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	orr	w2, w9, w8
	str	w2, [sp, #12]
	ldr	x8, [x22]
	add	x1, x8, x21
	mov	x0, x20
	bl	_pci_write_config_dword
	mov	x0, x20
	bl	_pci_name
	mov	x2, x0
Lloh23:
	adrp	x1, l_.str.5@PAGE
Lloh24:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x19
	bl	_dev_info
	b	LBB0_13
LBB0_16:
Lloh25:
	adrp	x1, l_.str@PAGE
Lloh26:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	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
	add	sp, sp, #64
	b	_dev_err
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_myri10ge_ecrc_enable,4,2       ; @myri10ge_ecrc_enable
	.comm	_PCI_EXP_TYPE_ROOT_PORT,8,3     ; @PCI_EXP_TYPE_ROOT_PORT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to find root port to force ECRC\n"

l_.str.1:                               ; @.str.1
	.asciz	"Forcing ECRC on non-root port %s (enabling on root port %s)\n"

l_.str.2:                               ; @.str.2
	.asciz	"Not enabling ECRC on non-root port %s\n"

	.comm	_PCI_EXT_CAP_ID_ERR,4,2         ; @PCI_EXT_CAP_ID_ERR
	.comm	_PCI_ERR_CAP,8,3                ; @PCI_ERR_CAP
l_.str.3:                               ; @.str.3
	.asciz	"failed reading ext-conf-space of %s\n"

l_.str.4:                               ; @.str.4
	.asciz	"\t pci=nommconf in use? or buggy/incomplete/absent ACPI MCFG attr?\n"

	.comm	_PCI_ERR_CAP_ECRC_GENC,4,2      ; @PCI_ERR_CAP_ECRC_GENC
	.comm	_PCI_ERR_CAP_ECRC_GENE,4,2      ; @PCI_ERR_CAP_ECRC_GENE
l_.str.5:                               ; @.str.5
	.asciz	"Enabled ECRC on upstream bridge %s\n"

	.no_dead_strip	_myri10ge_enable_ecrc
.subsections_via_symbols
