	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fsl_espi_attach
_fsl_espi_attach:                       ## @fsl_espi_attach
	.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	%edi, %ebx
	callq	_device_get_softc
	movq	%rax, %r14
	movl	%ebx, 28(%rax)
	movl	%ebx, %edi
	callq	_ofw_bus_get_node
	movl	%eax, %r15d
	movl	$0, -44(%rbp)
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	_RF_ACTIVE@GOTPCREL(%rip), %r13
	movl	(%r13), %ecx
	leaq	-44(%rbp), %rdx
	movl	%ebx, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, 8(%r14)
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movl	$0, -44(%rbp)
	movq	_SYS_RES_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r13), %ecx
	leaq	-44(%rbp), %rdx
	movl	%ebx, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, 16(%r14)
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	_INTR_TYPE_MISC@GOTPCREL(%rip), %rcx
	movq	_INTR_MPSAFE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movq	_fsl_espi_intr@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	leaq	24(%r14), %rcx
	movq	%rcx, (%rsp)
	movl	%ebx, %edi
	movq	%rax, %rsi
	xorl	%ecx, %ecx
	movq	%r14, %r9
	callq	_bus_setup_intr
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movq	_SYS_RES_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	16(%r14), %rcx
	movl	%ebx, %edi
	xorl	%edx, %edx
	callq	_bus_release_resource
	movl	(%r12), %esi
	movq	8(%r14), %rcx
	movl	%ebx, %edi
	xorl	%edx, %edx
	callq	_bus_release_resource
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_2
LBB0_1:
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_2
LBB0_4:
	movl	(%r12), %esi
	movq	8(%r14), %rcx
	movl	%ebx, %edi
	xorl	%edx, %edx
	callq	_bus_release_resource
	leaq	L_.str.1(%rip), %rsi
LBB0_2:
	movl	%ebx, %edi
	callq	_device_printf
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_10:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	leaq	L_.str.3(%rip), %rsi
	movl	%r15d, %edi
	movq	%r14, %rdx
	movl	$4, %ecx
	callq	_OF_getencprop
	testq	%rax, %rax
	jns	LBB0_9
## %bb.8:
	movl	$4, (%r14)
LBB0_9:
	movq	%r14, %rdi
	addq	$4, %rdi
	movq	_MTX_DEF@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str.4(%rip), %rsi
	xorl	%edx, %edx
	callq	_mtx_init
	movq	_ESPI_SPMODE_TXTHR_S@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	$16, %eax
	shll	%cl, %eax
	movq	_ESPI_SPMODE@GOTPCREL(%rip), %rcx
	movq	_ESPI_SPMODE_EN@GOTPCREL(%rip), %rdx
	orl	(%rdx), %eax
	movl	(%rcx), %esi
	movq	_ESPI_SPMODE_RXTHR_S@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	$15, %edx
	shll	%cl, %edx
	orl	%eax, %edx
	movq	%r14, %rdi
	callq	_FSL_ESPI_WRITE
	movq	_ESPI_SPIM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_FSL_ESPI_WRITE
	leaq	L_.str.5(%rip), %rsi
	movl	%ebx, %edi
	movl	$-1, %edx
	callq	_device_add_child
	movl	%ebx, %edi
	callq	_bus_generic_attach
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_SYS_RES_MEMORY,4,2             ## @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ## @RF_ACTIVE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cannot allocate memory resource\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_SYS_RES_IRQ,4,2                ## @SYS_RES_IRQ
L_.str.1:                               ## @.str.1
	.asciz	"cannot allocate interrupt\n"

	.comm	_INTR_TYPE_MISC,4,2             ## @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ## @INTR_MPSAFE
	.comm	_fsl_espi_intr,4,2              ## @fsl_espi_intr
L_.str.2:                               ## @.str.2
	.asciz	"cannot setup the interrupt handler\n"

L_.str.3:                               ## @.str.3
	.asciz	"fsl,espi-num-chipselects"

L_.str.4:                               ## @.str.4
	.asciz	"fsl_espi"

	.comm	_MTX_DEF,4,2                    ## @MTX_DEF
	.comm	_ESPI_SPMODE,4,2                ## @ESPI_SPMODE
	.comm	_ESPI_SPMODE_EN,4,2             ## @ESPI_SPMODE_EN
	.comm	_ESPI_SPMODE_TXTHR_S,4,2        ## @ESPI_SPMODE_TXTHR_S
	.comm	_ESPI_SPMODE_RXTHR_S,4,2        ## @ESPI_SPMODE_RXTHR_S
	.comm	_ESPI_SPIM,4,2                  ## @ESPI_SPIM
L_.str.5:                               ## @.str.5
	.asciz	"spibus"

	.no_dead_strip	_fsl_espi_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fsl_espi_attach
_fsl_espi_attach:                       ; @fsl_espi_attach
	.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	x19, x0
	bl	_device_get_softc
	mov	x20, x0
	str	w19, [x0, #28]
	mov	x0, x19
	bl	_ofw_bus_get_node
	mov	x21, x0
	str	wzr, [sp, #12]
Lloh0:
	adrp	x22, _SYS_RES_MEMORY@GOTPAGE
Lloh1:
	ldr	x22, [x22, _SYS_RES_MEMORY@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh2:
	adrp	x24, _RF_ACTIVE@GOTPAGE
Lloh3:
	ldr	x24, [x24, _RF_ACTIVE@GOTPAGEOFF]
	ldr	w3, [x24]
	add	x2, sp, #12
	mov	x0, x19
	bl	_bus_alloc_resource_any
	str	x0, [x20, #8]
	cbz	x0, LBB0_4
; %bb.1:
	str	wzr, [sp, #12]
Lloh4:
	adrp	x23, _SYS_RES_IRQ@GOTPAGE
Lloh5:
	ldr	x23, [x23, _SYS_RES_IRQ@GOTPAGEOFF]
	ldr	w1, [x23]
	ldr	w3, [x24]
	add	x2, sp, #12
	mov	x0, x19
	bl	_bus_alloc_resource_any
	str	x0, [x20, #16]
	cbz	x0, LBB0_5
; %bb.2:
	mov	x1, x0
Lloh6:
	adrp	x8, _INTR_TYPE_MISC@GOTPAGE
Lloh7:
	ldr	x8, [x8, _INTR_TYPE_MISC@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
Lloh9:
	adrp	x9, _INTR_MPSAFE@GOTPAGE
Lloh10:
	ldr	x9, [x9, _INTR_MPSAFE@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh12:
	adrp	x8, _fsl_espi_intr@GOTPAGE
Lloh13:
	ldr	x8, [x8, _fsl_espi_intr@GOTPAGEOFF]
Lloh14:
	ldr	w4, [x8]
	add	x6, x20, #24
	mov	x0, x19
	mov	x3, #0
	mov	x5, x20
	bl	_bus_setup_intr
	cbz	x0, LBB0_8
; %bb.3:
	ldr	w1, [x23]
	ldr	x3, [x20, #16]
	mov	x0, x19
	mov	w2, #0
	bl	_bus_release_resource
	ldr	w1, [x22]
	ldr	x3, [x20, #8]
	mov	x0, x19
	mov	w2, #0
	bl	_bus_release_resource
Lloh15:
	adrp	x1, l_.str.2@PAGE
Lloh16:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_6
LBB0_4:
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_6
LBB0_5:
	ldr	w1, [x22]
	ldr	x3, [x20, #8]
	mov	x0, x19
	mov	w2, #0
	bl	_bus_release_resource
Lloh19:
	adrp	x1, l_.str.1@PAGE
Lloh20:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_6:
	mov	x0, x19
	bl	_device_printf
Lloh21:
	adrp	x8, _ENXIO@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
LBB0_7:
	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
LBB0_8:
Lloh24:
	adrp	x1, l_.str.3@PAGE
Lloh25:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w22, #4
	mov	x0, x21
	mov	x2, x20
	mov	w3, #4
	bl	_OF_getencprop
	tbz	x0, #63, LBB0_10
; %bb.9:
	str	w22, [x20]
LBB0_10:
	add	x0, x20, #4
Lloh26:
	adrp	x8, _MTX_DEF@GOTPAGE
Lloh27:
	ldr	x8, [x8, _MTX_DEF@GOTPAGEOFF]
Lloh28:
	ldr	w3, [x8]
Lloh29:
	adrp	x1, l_.str.4@PAGE
Lloh30:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x2, #0
	bl	_mtx_init
Lloh31:
	adrp	x8, _ESPI_SPMODE@GOTPAGE
Lloh32:
	ldr	x8, [x8, _ESPI_SPMODE@GOTPAGEOFF]
Lloh33:
	ldr	w1, [x8]
Lloh34:
	adrp	x8, _ESPI_SPMODE_EN@GOTPAGE
Lloh35:
	ldr	x8, [x8, _ESPI_SPMODE_EN@GOTPAGEOFF]
Lloh36:
	ldr	w8, [x8]
Lloh37:
	adrp	x9, _ESPI_SPMODE_TXTHR_S@GOTPAGE
Lloh38:
	ldr	x9, [x9, _ESPI_SPMODE_TXTHR_S@GOTPAGEOFF]
Lloh39:
	ldr	w9, [x9]
	mov	w10, #16
	lsl	w9, w10, w9
	orr	w8, w9, w8
Lloh40:
	adrp	x9, _ESPI_SPMODE_RXTHR_S@GOTPAGE
Lloh41:
	ldr	x9, [x9, _ESPI_SPMODE_RXTHR_S@GOTPAGEOFF]
Lloh42:
	ldr	w9, [x9]
	mov	w10, #15
	lsl	w9, w10, w9
	orr	w2, w8, w9
	mov	x0, x20
	bl	_FSL_ESPI_WRITE
Lloh43:
	adrp	x8, _ESPI_SPIM@GOTPAGE
Lloh44:
	ldr	x8, [x8, _ESPI_SPIM@GOTPAGEOFF]
Lloh45:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_FSL_ESPI_WRITE
Lloh46:
	adrp	x1, l_.str.5@PAGE
Lloh47:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x19
	mov	w2, #-1
	bl	_device_add_child
	mov	x0, x19
	bl	_bus_generic_attach
	b	LBB0_7
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_SYS_RES_MEMORY,4,2             ; @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ; @RF_ACTIVE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cannot allocate memory resource\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_SYS_RES_IRQ,4,2                ; @SYS_RES_IRQ
l_.str.1:                               ; @.str.1
	.asciz	"cannot allocate interrupt\n"

	.comm	_INTR_TYPE_MISC,4,2             ; @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ; @INTR_MPSAFE
	.comm	_fsl_espi_intr,4,2              ; @fsl_espi_intr
l_.str.2:                               ; @.str.2
	.asciz	"cannot setup the interrupt handler\n"

l_.str.3:                               ; @.str.3
	.asciz	"fsl,espi-num-chipselects"

l_.str.4:                               ; @.str.4
	.asciz	"fsl_espi"

	.comm	_MTX_DEF,4,2                    ; @MTX_DEF
	.comm	_ESPI_SPMODE,4,2                ; @ESPI_SPMODE
	.comm	_ESPI_SPMODE_EN,4,2             ; @ESPI_SPMODE_EN
	.comm	_ESPI_SPMODE_TXTHR_S,4,2        ; @ESPI_SPMODE_TXTHR_S
	.comm	_ESPI_SPMODE_RXTHR_S,4,2        ; @ESPI_SPMODE_RXTHR_S
	.comm	_ESPI_SPIM,4,2                  ; @ESPI_SPIM
l_.str.5:                               ; @.str.5
	.asciz	"spibus"

	.no_dead_strip	_fsl_espi_attach
.subsections_via_symbols
