	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aml8726_wdt_attach
_aml8726_wdt_attach:                    ## @aml8726_wdt_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r15d
	callq	_device_get_softc
	movq	_aml8726_wdt_sc@GOTPCREL(%rip), %r12
	cmpq	$0, (%r12)
	jne	LBB0_1
## %bb.2:
	movq	%rax, %r14
	movl	%r15d, 12(%rax)
	movq	_aml8726_wdt_spec@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	(%rax), %rdx
	movl	%r15d, %edi
	callq	_bus_alloc_resources
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rsi
	movl	%r15d, %edi
	callq	_device_printf
	jmp	LBB0_1
LBB0_4:
	movq	_aml8726_soc_hw_rev@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	$129, %eax
	je	LBB0_7
## %bb.5:
	cmpl	$130, %eax
	jne	LBB0_8
## %bb.6:
	movq	_AML_WDT_CTRL_CPU_WDRESET_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	$15, %eax
	shll	%cl, %eax
	movq	_aml8726_wdt_soc_params@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	_aml8726_soc_metal_rev@GOTPCREL(%rip), %rax
	cmpl	$128, (%rax)
	movl	$524288, %eax                   ## imm = 0x80000
	movl	$4194304, %ecx                  ## imm = 0x400000
	cmovel	%eax, %ecx
	movl	$524287, %edx                   ## imm = 0x7FFFF
	movl	$4194303, %eax                  ## imm = 0x3FFFFF
	cmovel	%edx, %eax
	jmp	LBB0_9
LBB0_7:
	movq	_AML_WDT_CTRL_CPU_WDRESET_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	$15, %eax
	shll	%cl, %eax
	movq	_aml8726_wdt_soc_params@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movl	$524287, %eax                   ## imm = 0x7FFFF
	movl	$524288, %ecx                   ## imm = 0x80000
	jmp	LBB0_9
LBB0_8:
	movq	_AML_WDT_CTRL_CPU_WDRESET_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	$3, %eax
	shll	%cl, %eax
	movq	_aml8726_wdt_soc_params@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movl	$4194303, %eax                  ## imm = 0x3FFFFF
	movl	$4194304, %ecx                  ## imm = 0x400000
LBB0_9:
	movq	_aml8726_wdt_soc_params@GOTPCREL(%rip), %rdx
	movl	%ecx, 4(%rdx)
	movq	_AML_WDT_CTRL_TERMINAL_CNT_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	%eax, %esi
	shll	%cl, %esi
	movq	_AML_WDT_RESET_CNT_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %eax
	movl	%esi, 8(%rdx)
	movl	%eax, 12(%rdx)
	movq	_AML_WDT_CTRL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_CSR_READ_4
	movq	_AML_WDT_CTRL_IRQ_EN@GOTPCREL(%rip), %rcx
	movq	_AML_WDT_CTRL_EN@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	notl	%edx
	andl	%eax, %edx
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_CSR_WRITE_4
	movq	%r14, %rdi
	callq	_AML_WDT_LOCK_INIT
	movq	(%r14), %rax
	movq	_INTR_TYPE_MISC@GOTPCREL(%rip), %rcx
	movq	_INTR_MPSAFE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movl	4(%rax), %esi
	movq	_aml8726_wdt_intr@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rax
	addq	$8, %rax
	movq	%rax, (%rsp)
	xorl	%ebx, %ebx
	movl	%r15d, %edi
	xorl	%r8d, %r8d
	movq	%r14, %r9
	callq	_bus_setup_intr
	testq	%rax, %rax
	je	LBB0_11
## %bb.10:
	leaq	L_.str.1(%rip), %rsi
	movl	%r15d, %edi
	callq	_device_printf
	movl	(%r13), %esi
	movq	(%r14), %rdx
	movl	%r15d, %edi
	callq	_bus_release_resources
	movq	%r14, %rdi
	callq	_AML_WDT_LOCK_DESTROY
LBB0_1:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movq	%r14, (%r12)
	movq	_watchdog_list@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_aml8726_wdt_watchdog@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdx
	xorl	%ecx, %ecx
	callq	_EVENTHANDLER_REGISTER
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_aml8726_wdt_sc,8,3             ## @aml8726_wdt_sc
	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_aml8726_wdt_spec,4,2           ## @aml8726_wdt_spec
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"can not allocate resources for device\n"

	.comm	_aml8726_soc_hw_rev,4,2         ## @aml8726_soc_hw_rev
	.comm	_AML_WDT_CTRL_CPU_WDRESET_SHIFT,4,2 ## @AML_WDT_CTRL_CPU_WDRESET_SHIFT
	.comm	_aml8726_wdt_soc_params,16,2    ## @aml8726_wdt_soc_params
	.comm	_aml8726_soc_metal_rev,4,2      ## @aml8726_soc_metal_rev
	.comm	_AML_WDT_CTRL_TERMINAL_CNT_SHIFT,4,2 ## @AML_WDT_CTRL_TERMINAL_CNT_SHIFT
	.comm	_AML_WDT_RESET_CNT_SHIFT,4,2    ## @AML_WDT_RESET_CNT_SHIFT
	.comm	_AML_WDT_CTRL_REG,4,2           ## @AML_WDT_CTRL_REG
	.comm	_AML_WDT_CTRL_IRQ_EN,4,2        ## @AML_WDT_CTRL_IRQ_EN
	.comm	_AML_WDT_CTRL_EN,4,2            ## @AML_WDT_CTRL_EN
	.comm	_INTR_TYPE_MISC,4,2             ## @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ## @INTR_MPSAFE
	.comm	_aml8726_wdt_intr,4,2           ## @aml8726_wdt_intr
L_.str.1:                               ## @.str.1
	.asciz	"could not setup interrupt handler\n"

	.comm	_watchdog_list,4,2              ## @watchdog_list
	.comm	_aml8726_wdt_watchdog,4,2       ## @aml8726_wdt_watchdog
	.no_dead_strip	_aml8726_wdt_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aml8726_wdt_attach
_aml8726_wdt_attach:                    ; @aml8726_wdt_attach
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x20, x0
	bl	_device_get_softc
Lloh0:
	adrp	x22, _aml8726_wdt_sc@GOTPAGE
Lloh1:
	ldr	x22, [x22, _aml8726_wdt_sc@GOTPAGEOFF]
	ldr	x8, [x22]
	cbnz	x8, LBB0_10
; %bb.1:
	mov	x19, x0
	str	w20, [x0, #12]
Lloh2:
	adrp	x23, _aml8726_wdt_spec@GOTPAGE
Lloh3:
	ldr	x23, [x23, _aml8726_wdt_spec@GOTPAGEOFF]
	ldr	w1, [x23]
	ldr	x2, [x0]
	mov	x0, x20
	bl	_bus_alloc_resources
	cbz	x0, LBB0_3
; %bb.2:
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_device_printf
	b	LBB0_10
LBB0_3:
Lloh6:
	adrp	x8, _aml8726_soc_hw_rev@GOTPAGE
Lloh7:
	ldr	x8, [x8, _aml8726_soc_hw_rev@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x8]
Lloh9:
	adrp	x8, _aml8726_wdt_soc_params@GOTPAGE
Lloh10:
	ldr	x8, [x8, _aml8726_wdt_soc_params@GOTPAGEOFF]
	cmp	w9, #129
	b.eq	LBB0_6
; %bb.4:
	cmp	w9, #130
	b.ne	LBB0_7
; %bb.5:
Lloh11:
	adrp	x9, _AML_WDT_CTRL_CPU_WDRESET_SHIFT@GOTPAGE
Lloh12:
	ldr	x9, [x9, _AML_WDT_CTRL_CPU_WDRESET_SHIFT@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	mov	w10, #15
	lsl	w9, w10, w9
	str	w9, [x8]
Lloh14:
	adrp	x9, _aml8726_soc_metal_rev@GOTPAGE
Lloh15:
	ldr	x9, [x9, _aml8726_soc_metal_rev@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	mov	w10, #4194304
	mov	w11, #524288
	cmp	w9, #128
	csel	w10, w11, w10, eq
	mov	w9, #4194303
	mov	w11, #524287
	csel	w9, w11, w9, eq
	b	LBB0_8
LBB0_6:
Lloh17:
	adrp	x9, _AML_WDT_CTRL_CPU_WDRESET_SHIFT@GOTPAGE
Lloh18:
	ldr	x9, [x9, _AML_WDT_CTRL_CPU_WDRESET_SHIFT@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	mov	w10, #15
	lsl	w9, w10, w9
	str	w9, [x8]
	mov	w9, #524287
	mov	w10, #524288
	b	LBB0_8
LBB0_7:
Lloh20:
	adrp	x9, _AML_WDT_CTRL_CPU_WDRESET_SHIFT@GOTPAGE
Lloh21:
	ldr	x9, [x9, _AML_WDT_CTRL_CPU_WDRESET_SHIFT@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	mov	w10, #3
	lsl	w9, w10, w9
	str	w9, [x8]
	mov	w9, #4194303
	mov	w10, #4194304
LBB0_8:
Lloh23:
	adrp	x11, _AML_WDT_CTRL_TERMINAL_CNT_SHIFT@GOTPAGE
Lloh24:
	ldr	x11, [x11, _AML_WDT_CTRL_TERMINAL_CNT_SHIFT@GOTPAGEOFF]
Lloh25:
	ldr	w11, [x11]
	lsl	w11, w9, w11
	stp	w10, w11, [x8, #4]
Lloh26:
	adrp	x10, _AML_WDT_RESET_CNT_SHIFT@GOTPAGE
Lloh27:
	ldr	x10, [x10, _AML_WDT_RESET_CNT_SHIFT@GOTPAGEOFF]
Lloh28:
	ldr	w10, [x10]
	lsl	w9, w9, w10
	str	w9, [x8, #12]
Lloh29:
	adrp	x8, _AML_WDT_CTRL_REG@GOTPAGE
Lloh30:
	ldr	x8, [x8, _AML_WDT_CTRL_REG@GOTPAGEOFF]
Lloh31:
	ldr	w21, [x8]
	mov	x0, x19
	mov	x1, x21
	bl	_CSR_READ_4
Lloh32:
	adrp	x8, _AML_WDT_CTRL_IRQ_EN@GOTPAGE
Lloh33:
	ldr	x8, [x8, _AML_WDT_CTRL_IRQ_EN@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
Lloh35:
	adrp	x9, _AML_WDT_CTRL_EN@GOTPAGE
Lloh36:
	ldr	x9, [x9, _AML_WDT_CTRL_EN@GOTPAGEOFF]
Lloh37:
	ldr	w9, [x9]
	orr	w8, w9, w8
	bic	w2, w0, w8
	mov	x0, x19
	mov	x1, x21
	bl	_CSR_WRITE_4
	mov	x0, x19
	bl	_AML_WDT_LOCK_INIT
	mov	x6, x19
	ldr	x8, [x6], #8
	ldr	w1, [x8, #4]
Lloh38:
	adrp	x8, _INTR_TYPE_MISC@GOTPAGE
Lloh39:
	ldr	x8, [x8, _INTR_TYPE_MISC@GOTPAGEOFF]
Lloh40:
	adrp	x9, _INTR_MPSAFE@GOTPAGE
Lloh41:
	ldr	x9, [x9, _INTR_MPSAFE@GOTPAGEOFF]
Lloh42:
	ldr	w8, [x8]
Lloh43:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh44:
	adrp	x8, _aml8726_wdt_intr@GOTPAGE
Lloh45:
	ldr	x8, [x8, _aml8726_wdt_intr@GOTPAGEOFF]
Lloh46:
	ldr	w3, [x8]
	mov	x0, x20
	mov	x4, #0
	mov	x5, x19
	bl	_bus_setup_intr
	cbz	x0, LBB0_12
; %bb.9:
Lloh47:
	adrp	x1, l_.str.1@PAGE
Lloh48:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_device_printf
	ldr	w1, [x23]
	ldr	x2, [x19]
	mov	x0, x20
	bl	_bus_release_resources
	mov	x0, x19
	bl	_AML_WDT_LOCK_DESTROY
LBB0_10:
Lloh49:
	adrp	x8, _ENXIO@GOTPAGE
Lloh50:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh51:
	ldr	w0, [x8]
LBB0_11:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_12:
	str	x19, [x22]
Lloh52:
	adrp	x8, _watchdog_list@GOTPAGE
Lloh53:
	ldr	x8, [x8, _watchdog_list@GOTPAGEOFF]
Lloh54:
	ldr	w0, [x8]
Lloh55:
	adrp	x8, _aml8726_wdt_watchdog@GOTPAGE
Lloh56:
	ldr	x8, [x8, _aml8726_wdt_watchdog@GOTPAGEOFF]
Lloh57:
	ldr	w1, [x8]
	mov	x2, x19
	mov	w3, #0
	bl	_EVENTHANDLER_REGISTER
	mov	w0, #0
	b	LBB0_11
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh43
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh42
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh55, Lloh56, Lloh57
	.loh AdrpLdrGotLdr	Lloh52, Lloh53, Lloh54
	.cfi_endproc
                                        ; -- End function
	.comm	_aml8726_wdt_sc,8,3             ; @aml8726_wdt_sc
	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_aml8726_wdt_spec,4,2           ; @aml8726_wdt_spec
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"can not allocate resources for device\n"

	.comm	_aml8726_soc_hw_rev,4,2         ; @aml8726_soc_hw_rev
	.comm	_AML_WDT_CTRL_CPU_WDRESET_SHIFT,4,2 ; @AML_WDT_CTRL_CPU_WDRESET_SHIFT
	.comm	_aml8726_wdt_soc_params,16,2    ; @aml8726_wdt_soc_params
	.comm	_aml8726_soc_metal_rev,4,2      ; @aml8726_soc_metal_rev
	.comm	_AML_WDT_CTRL_TERMINAL_CNT_SHIFT,4,2 ; @AML_WDT_CTRL_TERMINAL_CNT_SHIFT
	.comm	_AML_WDT_RESET_CNT_SHIFT,4,2    ; @AML_WDT_RESET_CNT_SHIFT
	.comm	_AML_WDT_CTRL_REG,4,2           ; @AML_WDT_CTRL_REG
	.comm	_AML_WDT_CTRL_IRQ_EN,4,2        ; @AML_WDT_CTRL_IRQ_EN
	.comm	_AML_WDT_CTRL_EN,4,2            ; @AML_WDT_CTRL_EN
	.comm	_INTR_TYPE_MISC,4,2             ; @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ; @INTR_MPSAFE
	.comm	_aml8726_wdt_intr,4,2           ; @aml8726_wdt_intr
l_.str.1:                               ; @.str.1
	.asciz	"could not setup interrupt handler\n"

	.comm	_watchdog_list,4,2              ; @watchdog_list
	.comm	_aml8726_wdt_watchdog,4,2       ; @aml8726_wdt_watchdog
	.no_dead_strip	_aml8726_wdt_attach
.subsections_via_symbols
