	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hl_pci_elbi_write
_hl_pci_elbi_write:                     ## @hl_pci_elbi_write
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %ebx
	movq	%rsi, %r14
	movq	16(%rdi), %r12
	cmpq	$0, 8(%rdi)
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	jne	LBB0_1
## %bb.2:
	movq	_HL_PCI_ELBI_TIMEOUT_MSEC@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_HL_PLDM_PCI_ELBI_TIMEOUT_MSEC@GOTPCREL(%rip), %rax
LBB0_3:
	movq	(%rax), %r13
	movq	_mmPCI_CONFIG_ELBI_STS@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_pci_write_config_dword
	movq	_mmPCI_CONFIG_ELBI_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movl	%r14d, %edx
	callq	_pci_write_config_dword
	movq	_mmPCI_CONFIG_ELBI_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movl	%ebx, %edx
	callq	_pci_write_config_dword
	movq	_mmPCI_CONFIG_ELBI_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_PCI_CONFIG_ELBI_CTRL_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_pci_write_config_dword
	xorl	%eax, %eax
	callq	_ktime_get
	movl	%eax, %edi
	movq	%r13, %rsi
	callq	_ktime_add_ms
	movl	%eax, %ebx
	movl	(%r15), %esi
	leaq	-44(%rbp), %rdx
	movq	%r12, %rdi
	callq	_pci_read_config_dword
	movl	-44(%rbp), %ecx
	movq	_PCI_CONFIG_ELBI_STS_MASK@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	testl	%ecx, %esi
	jne	LBB0_8
## %bb.4:
	leaq	-44(%rbp), %r13
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_ktime_get
	movl	%eax, %edi
	movl	%ebx, %esi
	callq	_ktime_compare
	testq	%rax, %rax
	jg	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	$300, %edi                      ## imm = 0x12C
	movl	$500, %esi                      ## imm = 0x1F4
	callq	_usleep_range
	movl	(%r15), %esi
	movq	%r12, %rdi
	movq	%r13, %rdx
	callq	_pci_read_config_dword
	movl	-44(%rbp), %ecx
	movl	(%r14), %esi
	testl	%ecx, %esi
	je	LBB0_5
	jmp	LBB0_8
LBB0_6:
	movl	(%r15), %esi
	leaq	-44(%rbp), %rdx
	movq	%r12, %rdi
	callq	_pci_read_config_dword
	movl	-44(%rbp), %ecx
	movl	(%r14), %esi
LBB0_8:
	andl	%ecx, %esi
	movq	_PCI_CONFIG_ELBI_STS_DONE@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %esi
	movl	$0, %eax
	je	LBB0_15
## %bb.9:
	movq	_PCI_CONFIG_ELBI_STS_ERR@GOTPCREL(%rip), %rdx
	testl	%ecx, (%rdx)
	je	LBB0_11
## %bb.10:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_14
LBB0_11:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rcx), %edi
	testl	%esi, %esi
	je	LBB0_12
## %bb.13:
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_14
LBB0_12:
	leaq	L_.str.1(%rip), %rsi
LBB0_14:
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_15:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HL_PLDM_PCI_ELBI_TIMEOUT_MSEC,8,3 ## @HL_PLDM_PCI_ELBI_TIMEOUT_MSEC
	.comm	_HL_PCI_ELBI_TIMEOUT_MSEC,8,3   ## @HL_PCI_ELBI_TIMEOUT_MSEC
	.comm	_mmPCI_CONFIG_ELBI_STS,4,2      ## @mmPCI_CONFIG_ELBI_STS
	.comm	_mmPCI_CONFIG_ELBI_ADDR,4,2     ## @mmPCI_CONFIG_ELBI_ADDR
	.comm	_mmPCI_CONFIG_ELBI_DATA,4,2     ## @mmPCI_CONFIG_ELBI_DATA
	.comm	_mmPCI_CONFIG_ELBI_CTRL,4,2     ## @mmPCI_CONFIG_ELBI_CTRL
	.comm	_PCI_CONFIG_ELBI_CTRL_WRITE,4,2 ## @PCI_CONFIG_ELBI_CTRL_WRITE
	.comm	_PCI_CONFIG_ELBI_STS_MASK,4,2   ## @PCI_CONFIG_ELBI_STS_MASK
	.comm	_PCI_CONFIG_ELBI_STS_DONE,4,2   ## @PCI_CONFIG_ELBI_STS_DONE
	.comm	_PCI_CONFIG_ELBI_STS_ERR,4,2    ## @PCI_CONFIG_ELBI_STS_ERR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Error writing to ELBI\n"

	.comm	_EIO,4,2                        ## @EIO
L_.str.1:                               ## @.str.1
	.asciz	"ELBI write didn't finish in time\n"

L_.str.2:                               ## @.str.2
	.asciz	"ELBI write has undefined bits in status\n"

	.no_dead_strip	_hl_pci_elbi_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hl_pci_elbi_write
_hl_pci_elbi_write:                     ; @hl_pci_elbi_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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, x2
	mov	x22, x1
	mov	x19, x0
	ldp	x8, x20, [x0, #8]
Lloh0:
	adrp	x9, _HL_PCI_ELBI_TIMEOUT_MSEC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _HL_PCI_ELBI_TIMEOUT_MSEC@GOTPAGEOFF]
Lloh2:
	adrp	x10, _HL_PLDM_PCI_ELBI_TIMEOUT_MSEC@GOTPAGE
Lloh3:
	ldr	x10, [x10, _HL_PLDM_PCI_ELBI_TIMEOUT_MSEC@GOTPAGEOFF]
	cmp	x8, #0
	csel	x8, x9, x10, eq
	ldr	x23, [x8]
Lloh4:
	adrp	x24, _mmPCI_CONFIG_ELBI_STS@GOTPAGE
Lloh5:
	ldr	x24, [x24, _mmPCI_CONFIG_ELBI_STS@GOTPAGEOFF]
	ldr	w1, [x24]
	mov	x0, x20
	mov	w2, #0
	bl	_pci_write_config_dword
Lloh6:
	adrp	x8, _mmPCI_CONFIG_ELBI_ADDR@GOTPAGE
Lloh7:
	ldr	x8, [x8, _mmPCI_CONFIG_ELBI_ADDR@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x22
	bl	_pci_write_config_dword
Lloh9:
	adrp	x8, _mmPCI_CONFIG_ELBI_DATA@GOTPAGE
Lloh10:
	ldr	x8, [x8, _mmPCI_CONFIG_ELBI_DATA@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x21
	bl	_pci_write_config_dword
Lloh12:
	adrp	x8, _mmPCI_CONFIG_ELBI_CTRL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _mmPCI_CONFIG_ELBI_CTRL@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
Lloh15:
	adrp	x8, _PCI_CONFIG_ELBI_CTRL_WRITE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PCI_CONFIG_ELBI_CTRL_WRITE@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_pci_write_config_dword
	bl	_ktime_get
	mov	x1, x23
	bl	_ktime_add_ms
	mov	x21, x0
	ldr	w1, [x24]
	add	x2, sp, #12
	mov	x0, x20
	bl	_pci_read_config_dword
	ldr	w8, [sp, #12]
Lloh18:
	adrp	x22, _PCI_CONFIG_ELBI_STS_MASK@GOTPAGE
Lloh19:
	ldr	x22, [x22, _PCI_CONFIG_ELBI_STS_MASK@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x22]
	tst	w9, w8
	b.ne	LBB0_5
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	bl	_ktime_get
	mov	x1, x21
	bl	_ktime_compare
	cmp	x0, #1
	b.ge	LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w0, #300
	mov	w1, #500
	bl	_usleep_range
	ldr	w1, [x24]
	add	x2, sp, #12
	mov	x0, x20
	bl	_pci_read_config_dword
	ldr	w8, [sp, #12]
	b	LBB0_1
LBB0_4:
	ldr	w1, [x24]
	add	x2, sp, #12
	mov	x0, x20
	bl	_pci_read_config_dword
	ldr	w8, [sp, #12]
	ldr	w9, [x22]
LBB0_5:
	and	w9, w9, w8
Lloh20:
	adrp	x10, _PCI_CONFIG_ELBI_STS_DONE@GOTPAGE
Lloh21:
	ldr	x10, [x10, _PCI_CONFIG_ELBI_STS_DONE@GOTPAGEOFF]
Lloh22:
	ldr	w10, [x10]
	cmp	w9, w10
	b.ne	LBB0_7
; %bb.6:
	mov	w0, #0
	b	LBB0_13
LBB0_7:
Lloh23:
	adrp	x10, _PCI_CONFIG_ELBI_STS_ERR@GOTPAGE
Lloh24:
	ldr	x10, [x10, _PCI_CONFIG_ELBI_STS_ERR@GOTPAGEOFF]
Lloh25:
	ldr	w10, [x10]
	tst	w10, w8
	b.eq	LBB0_9
; %bb.8:
	ldr	w0, [x19]
Lloh26:
	adrp	x1, l_.str@PAGE
Lloh27:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_12
LBB0_9:
	ldr	w0, [x19]
	cbz	w9, LBB0_11
; %bb.10:
Lloh28:
	adrp	x1, l_.str.2@PAGE
Lloh29:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_12
LBB0_11:
Lloh30:
	adrp	x1, l_.str.1@PAGE
Lloh31:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_12:
	bl	_dev_err
Lloh32:
	adrp	x8, _EIO@GOTPAGE
Lloh33:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_13:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.comm	_HL_PLDM_PCI_ELBI_TIMEOUT_MSEC,8,3 ; @HL_PLDM_PCI_ELBI_TIMEOUT_MSEC
	.comm	_HL_PCI_ELBI_TIMEOUT_MSEC,8,3   ; @HL_PCI_ELBI_TIMEOUT_MSEC
	.comm	_mmPCI_CONFIG_ELBI_STS,4,2      ; @mmPCI_CONFIG_ELBI_STS
	.comm	_mmPCI_CONFIG_ELBI_ADDR,4,2     ; @mmPCI_CONFIG_ELBI_ADDR
	.comm	_mmPCI_CONFIG_ELBI_DATA,4,2     ; @mmPCI_CONFIG_ELBI_DATA
	.comm	_mmPCI_CONFIG_ELBI_CTRL,4,2     ; @mmPCI_CONFIG_ELBI_CTRL
	.comm	_PCI_CONFIG_ELBI_CTRL_WRITE,4,2 ; @PCI_CONFIG_ELBI_CTRL_WRITE
	.comm	_PCI_CONFIG_ELBI_STS_MASK,4,2   ; @PCI_CONFIG_ELBI_STS_MASK
	.comm	_PCI_CONFIG_ELBI_STS_DONE,4,2   ; @PCI_CONFIG_ELBI_STS_DONE
	.comm	_PCI_CONFIG_ELBI_STS_ERR,4,2    ; @PCI_CONFIG_ELBI_STS_ERR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Error writing to ELBI\n"

	.comm	_EIO,4,2                        ; @EIO
l_.str.1:                               ; @.str.1
	.asciz	"ELBI write didn't finish in time\n"

l_.str.2:                               ; @.str.2
	.asciz	"ELBI write has undefined bits in status\n"

	.no_dead_strip	_hl_pci_elbi_write
.subsections_via_symbols
