	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function armada_thermal_attach
_armada_thermal_attach:                 ## @armada_thermal_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, %r14d
	callq	_device_get_softc
	movq	%rax, %r13
	movq	_STAT_RID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	_RF_ACTIVE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %ecx
	leaq	-44(%rbp), %rdx
	movl	%r14d, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, 24(%r13)
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movq	_CTRL_RID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)
	movl	(%r12), %esi
	movl	(%rbx), %ecx
	leaq	-44(%rbp), %rdx
	movl	%r14d, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, 16(%r13)
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	32(%r13), %rax
	movq	%r13, %rdi
	callq	*(%rax)
	movl	$1001, %ebx                     ## imm = 0x3E9
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movq	%r13, %rsi
	callq	_armada_tsen_get_temp
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	$10, %edi
	callq	_DELAY
	decl	%ebx
	cmpl	$1, %ebx
	ja	LBB0_6
## %bb.8:
	movl	(%r12), %r15d
	movq	24(%r13), %rdi
	callq	_rman_get_rid
	movq	24(%r13), %rcx
	movl	%r14d, %edi
	movl	%r15d, %esi
	movl	%eax, %edx
	callq	_bus_release_resource
	movq	$0, 24(%r13)
	movl	(%r12), %r15d
	movq	16(%r13), %rdi
	callq	_rman_get_rid
	movq	16(%r13), %rcx
	movl	%r14d, %edi
	movl	%r15d, %esi
	movl	%eax, %edx
	callq	_bus_release_resource
	movq	$0, 16(%r13)
	jmp	LBB0_2
LBB0_1:
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edi
	callq	_device_printf
	jmp	LBB0_2
LBB0_4:
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edi
	callq	_device_printf
	movl	(%r12), %r15d
	movq	24(%r13), %rdi
	callq	_rman_get_rid
	movq	24(%r13), %rcx
	movl	%r14d, %edi
	movl	%r15d, %esi
	movl	%eax, %edx
	callq	_bus_release_resource
	movq	$0, 24(%r13)
LBB0_2:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	jmp	LBB0_10
LBB0_9:
	leaq	8(%r13), %r12
	movq	_MTX_DEF@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str.2(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_mtx_init
	movq	%r13, %rbx
	addq	$4, %rbx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_callout_init_mtx
	movq	_hz@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_armada_temp_update@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	%r13, %rcx
	callq	_callout_reset
	movl	%r14d, %edi
	callq	_device_get_sysctl_ctx
	movq	%rax, %r12
	movl	%r14d, %edi
	callq	_device_get_sysctl_tree
	movl	%eax, %edi
	callq	_SYSCTL_CHILDREN
	movq	_OID_AUTO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	_CTLFLAG_RD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	leaq	L_.str.4(%rip), %rcx
	movq	%rcx, (%rsp)
	leaq	L_.str.3(%rip), %rcx
	movq	%r12, %rdi
	movq	%rax, %rsi
	movq	%r13, %r9
	callq	_SYSCTL_ADD_LONG
LBB0_10:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STAT_RID,4,2                   ## @STAT_RID
	.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	"Could not allocate memory for the status register\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_CTRL_RID,4,2                   ## @CTRL_RID
L_.str.1:                               ## @.str.1
	.asciz	"Could not allocate memory for the control register\n"

L_.str.2:                               ## @.str.2
	.asciz	"Armada Thermal"

	.comm	_MTX_DEF,4,2                    ## @MTX_DEF
	.comm	_hz,4,2                         ## @hz
	.comm	_armada_temp_update,4,2         ## @armada_temp_update
	.comm	_OID_AUTO,4,2                   ## @OID_AUTO
L_.str.3:                               ## @.str.3
	.asciz	"temperature"

	.comm	_CTLFLAG_RD,4,2                 ## @CTLFLAG_RD
L_.str.4:                               ## @.str.4
	.asciz	"SoC temperature"

	.no_dead_strip	_armada_thermal_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function armada_thermal_attach
_armada_thermal_attach:                 ; @armada_thermal_attach
	.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
	mov	x20, x0
	bl	_device_get_softc
	mov	x19, x0
Lloh0:
	adrp	x8, _STAT_RID@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STAT_RID@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [sp, #12]
Lloh3:
	adrp	x22, _SYS_RES_MEMORY@GOTPAGE
Lloh4:
	ldr	x22, [x22, _SYS_RES_MEMORY@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh5:
	adrp	x21, _RF_ACTIVE@GOTPAGE
Lloh6:
	ldr	x21, [x21, _RF_ACTIVE@GOTPAGEOFF]
	ldr	w3, [x21]
	add	x2, sp, #12
	mov	x0, x20
	bl	_bus_alloc_resource_any
	str	x0, [x19, #24]
	cbz	x0, LBB0_6
; %bb.1:
Lloh7:
	adrp	x8, _CTRL_RID@GOTPAGE
Lloh8:
	ldr	x8, [x8, _CTRL_RID@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	str	w8, [sp, #12]
	ldr	w1, [x22]
	ldr	w3, [x21]
	add	x2, sp, #12
	mov	x0, x20
	bl	_bus_alloc_resource_any
	str	x0, [x19, #16]
	cbz	x0, LBB0_7
; %bb.2:
	ldr	x8, [x19, #32]
	ldr	x8, [x8]
	mov	x0, x19
	blr	x8
	mov	w21, #1001
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x19
	bl	_armada_tsen_get_temp
	cbz	x0, LBB0_9
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w0, #10
	bl	_DELAY
	sub	w21, w21, #1
	cmp	w21, #1
	b.hi	LBB0_3
; %bb.5:
	ldr	w21, [x22]
	ldr	x0, [x19, #24]
	bl	_rman_get_rid
	mov	x2, x0
	ldr	x3, [x19, #24]
	mov	x0, x20
	mov	x1, x21
	bl	_bus_release_resource
	str	xzr, [x19, #24]
	ldr	w21, [x22]
	ldr	x0, [x19, #16]
	bl	_rman_get_rid
	mov	x2, x0
	ldr	x3, [x19, #16]
	mov	x0, x20
	mov	x1, x21
	bl	_bus_release_resource
	str	xzr, [x19, #16]
	b	LBB0_8
LBB0_6:
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_device_printf
	b	LBB0_8
LBB0_7:
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_device_printf
	ldr	w21, [x22]
	ldr	x0, [x19, #24]
	bl	_rman_get_rid
	mov	x2, x0
	ldr	x3, [x19, #24]
	mov	x0, x20
	mov	x1, x21
	bl	_bus_release_resource
	str	xzr, [x19, #24]
LBB0_8:
Lloh14:
	adrp	x8, _ENXIO@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	b	LBB0_10
LBB0_9:
	add	x21, x19, #8
Lloh17:
	adrp	x8, _MTX_DEF@GOTPAGE
Lloh18:
	ldr	x8, [x8, _MTX_DEF@GOTPAGEOFF]
Lloh19:
	ldr	w3, [x8]
Lloh20:
	adrp	x1, l_.str.2@PAGE
Lloh21:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	mov	x2, #0
	bl	_mtx_init
	add	x22, x19, #4
	mov	x0, x22
	mov	x1, x21
	mov	w2, #0
	bl	_callout_init_mtx
Lloh22:
	adrp	x8, _hz@GOTPAGE
Lloh23:
	ldr	x8, [x8, _hz@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
Lloh25:
	adrp	x8, _armada_temp_update@GOTPAGE
Lloh26:
	ldr	x8, [x8, _armada_temp_update@GOTPAGEOFF]
Lloh27:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x3, x19
	bl	_callout_reset
	mov	x0, x20
	bl	_device_get_sysctl_ctx
	mov	x21, x0
	mov	x0, x20
	bl	_device_get_sysctl_tree
	bl	_SYSCTL_CHILDREN
	mov	x1, x0
Lloh28:
	adrp	x8, _OID_AUTO@GOTPAGE
Lloh29:
	ldr	x8, [x8, _OID_AUTO@GOTPAGEOFF]
Lloh30:
	ldr	w2, [x8]
Lloh31:
	adrp	x8, _CTLFLAG_RD@GOTPAGE
Lloh32:
	ldr	x8, [x8, _CTLFLAG_RD@GOTPAGEOFF]
Lloh33:
	ldr	w4, [x8]
Lloh34:
	adrp	x3, l_.str.3@PAGE
Lloh35:
	add	x3, x3, l_.str.3@PAGEOFF
Lloh36:
	adrp	x6, l_.str.4@PAGE
Lloh37:
	add	x6, x6, l_.str.4@PAGEOFF
	mov	x0, x21
	mov	x5, x19
	bl	_SYSCTL_ADD_LONG
	mov	w0, #0
LBB0_10:
	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
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_STAT_RID,4,2                   ; @STAT_RID
	.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	"Could not allocate memory for the status register\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_CTRL_RID,4,2                   ; @CTRL_RID
l_.str.1:                               ; @.str.1
	.asciz	"Could not allocate memory for the control register\n"

l_.str.2:                               ; @.str.2
	.asciz	"Armada Thermal"

	.comm	_MTX_DEF,4,2                    ; @MTX_DEF
	.comm	_hz,4,2                         ; @hz
	.comm	_armada_temp_update,4,2         ; @armada_temp_update
	.comm	_OID_AUTO,4,2                   ; @OID_AUTO
l_.str.3:                               ; @.str.3
	.asciz	"temperature"

	.comm	_CTLFLAG_RD,4,2                 ; @CTLFLAG_RD
l_.str.4:                               ; @.str.4
	.asciz	"SoC temperature"

	.no_dead_strip	_armada_thermal_attach
.subsections_via_symbols
