	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function goya_init_cpu
_goya_init_cpu:                         ## @goya_init_cpu
	.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
	xorl	%r14d, %r14d
	cmpl	$0, 16(%rdi)
	je	LBB0_17
## %bb.1:
	movq	%rdi, %rbx
	movq	24(%rdi), %r12
	movq	_HW_CAP_CPU@GOTPCREL(%rip), %r13
	movl	(%r13), %eax
	testl	%eax, (%r12)
	jne	LBB0_17
## %bb.2:
	movl	%esi, %r15d
	movq	_DRAM_PHYS_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_goya_set_ddr_bar_base
	movq	_U64_MAX@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_5
## %bb.3:
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_dev_err
LBB0_4:
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	jmp	LBB0_17
LBB0_5:
	cmpq	$0, 8(%rbx)
	je	LBB0_7
## %bb.6:
	movq	%rbx, %rdi
	callq	_goya_pldm_init_cpu
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_17
	jmp	LBB0_16
LBB0_7:
	movq	_mmPSOC_GLOBAL_CONF_WARM_REBOOT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r14d, %r14d
	movq	%rbx, %rdi
	xorl	%ecx, %ecx
	movl	$10000, %r8d                    ## imm = 0x2710
	movl	%r15d, %r9d
	callq	_hl_poll_timeout
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:
	movl	(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	movl	(%rbx), %edi
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_4
LBB0_9:
	movq	_FW_COMP_UBOOT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_goya_read_device_fw_version
	movq	_FW_COMP_PREBOOT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_goya_read_device_fw_version
	cmpl	$0, 4(%rbx)
	je	LBB0_10
## %bb.11:
	movq	%rbx, %rdi
	callq	_goya_push_linux_to_device
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_17
## %bb.12:
	movq	_mmPSOC_GLOBAL_CONF_UBOOT_MAGIC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_KMD_MSG_FIT_RDY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_WREG32
	movq	_mmPSOC_GLOBAL_CONF_WARM_REBOOT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r14d, %r14d
	movq	%rbx, %rdi
	xorl	%ecx, %ecx
	movl	$10000, %r8d                    ## imm = 0x2710
	movl	%r15d, %r9d
	callq	_hl_poll_timeout
	movl	(%rbx), %edi
	testl	%eax, %eax
	je	LBB0_14
## %bb.13:
	leaq	L_.str.13(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	movq	_mmPSOC_GLOBAL_CONF_UBOOT_MAGIC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_KMD_MSG_NA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_WREG32
	jmp	LBB0_4
LBB0_10:
	movl	(%rbx), %edi
	leaq	L_.str.11(%rip), %rsi
	jmp	LBB0_15
LBB0_14:
	leaq	L_.str.14(%rip), %rsi
LBB0_15:
	callq	_dev_info
LBB0_16:
	movl	(%r13), %eax
	orl	%eax, (%r12)
	xorl	%r14d, %r14d
LBB0_17:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HW_CAP_CPU,4,2                 ## @HW_CAP_CPU
	.comm	_DRAM_PHYS_BASE,4,2             ## @DRAM_PHYS_BASE
	.comm	_U64_MAX,8,3                    ## @U64_MAX
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to map DDR bar to DRAM base address\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_mmPSOC_GLOBAL_CONF_WARM_REBOOT,4,2 ## @mmPSOC_GLOBAL_CONF_WARM_REBOOT
	.comm	_CPU_BOOT_STATUS_DRAM_RDY,4,2   ## @CPU_BOOT_STATUS_DRAM_RDY
	.comm	_CPU_BOOT_STATUS_SRAM_AVAIL,4,2 ## @CPU_BOOT_STATUS_SRAM_AVAIL
L_.str.1:                               ## @.str.1
	.asciz	"Error in ARM u-boot!"

L_.str.2:                               ## @.str.2
	.asciz	"ARM status %d - BTL did NOT run\n"

	.comm	_FW_COMP_UBOOT,4,2              ## @FW_COMP_UBOOT
	.comm	_FW_COMP_PREBOOT,4,2            ## @FW_COMP_PREBOOT
L_.str.11:                              ## @.str.11
	.asciz	"Skip loading FW\n"

	.comm	_mmPSOC_GLOBAL_CONF_UBOOT_MAGIC,4,2 ## @mmPSOC_GLOBAL_CONF_UBOOT_MAGIC
	.comm	_KMD_MSG_FIT_RDY,4,2            ## @KMD_MSG_FIT_RDY
	.comm	_CPU_BOOT_STATUS_FIT_CORRUPTED,4,2 ## @CPU_BOOT_STATUS_FIT_CORRUPTED
L_.str.13:                              ## @.str.13
	.asciz	"ARM Linux failed to load, %d\n"

	.comm	_KMD_MSG_NA,4,2                 ## @KMD_MSG_NA
L_.str.14:                              ## @.str.14
	.asciz	"Successfully loaded firmware to device\n"

	.no_dead_strip	_goya_init_cpu
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function goya_init_cpu
_goya_init_cpu:                         ; @goya_init_cpu
	.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
	ldr	w8, [x0, #16]
	cbz	w8, LBB0_2
; %bb.1:
	mov	x19, x0
	ldr	x21, [x0, #24]
	ldr	w8, [x21]
Lloh0:
	adrp	x22, _HW_CAP_CPU@GOTPAGE
Lloh1:
	ldr	x22, [x22, _HW_CAP_CPU@GOTPAGEOFF]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_4
LBB0_2:
	mov	w0, #0
LBB0_3:
	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_4:
	mov	x20, x1
Lloh2:
	adrp	x8, _DRAM_PHYS_BASE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _DRAM_PHYS_BASE@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_goya_set_ddr_bar_base
Lloh5:
	adrp	x8, _U64_MAX@GOTPAGE
Lloh6:
	ldr	x8, [x8, _U64_MAX@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_8
; %bb.5:
	ldr	w0, [x19]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
LBB0_6:
	bl	_dev_err
LBB0_7:
Lloh10:
	adrp	x8, _EIO@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_3
LBB0_8:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_10
; %bb.9:
	mov	x0, x19
	bl	_goya_pldm_init_cpu
	cbnz	w0, LBB0_3
	b	LBB0_19
LBB0_10:
Lloh13:
	adrp	x23, _mmPSOC_GLOBAL_CONF_WARM_REBOOT@GOTPAGE
Lloh14:
	ldr	x23, [x23, _mmPSOC_GLOBAL_CONF_WARM_REBOOT@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x19
	mov	w3, #0
	mov	w4, #10000
	mov	x5, x20
	bl	_hl_poll_timeout
	cbz	w0, LBB0_12
; %bb.11:
	ldr	w0, [x19]
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	ldr	w0, [x19]
Lloh17:
	adrp	x1, l_.str.2@PAGE
Lloh18:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_6
LBB0_12:
Lloh19:
	adrp	x8, _FW_COMP_UBOOT@GOTPAGE
Lloh20:
	ldr	x8, [x8, _FW_COMP_UBOOT@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_goya_read_device_fw_version
Lloh22:
	adrp	x8, _FW_COMP_PREBOOT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _FW_COMP_PREBOOT@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_goya_read_device_fw_version
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_16
; %bb.13:
	mov	x0, x19
	bl	_goya_push_linux_to_device
	cbnz	w0, LBB0_3
; %bb.14:
Lloh25:
	adrp	x24, _mmPSOC_GLOBAL_CONF_UBOOT_MAGIC@GOTPAGE
Lloh26:
	ldr	x24, [x24, _mmPSOC_GLOBAL_CONF_UBOOT_MAGIC@GOTPAGEOFF]
	ldr	w0, [x24]
Lloh27:
	adrp	x8, _KMD_MSG_FIT_RDY@GOTPAGE
Lloh28:
	ldr	x8, [x8, _KMD_MSG_FIT_RDY@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
	bl	_WREG32
	ldr	w1, [x23]
	mov	x0, x19
	mov	w3, #0
	mov	w4, #10000
	mov	x5, x20
	bl	_hl_poll_timeout
	mov	x8, x0
	ldr	w0, [x19]
	cbz	w8, LBB0_17
; %bb.15:
Lloh30:
	adrp	x1, l_.str.13@PAGE
Lloh31:
	add	x1, x1, l_.str.13@PAGEOFF
	bl	_dev_err
	ldr	w0, [x24]
Lloh32:
	adrp	x8, _KMD_MSG_NA@GOTPAGE
Lloh33:
	ldr	x8, [x8, _KMD_MSG_NA@GOTPAGEOFF]
Lloh34:
	ldr	w1, [x8]
	bl	_WREG32
	b	LBB0_7
LBB0_16:
	ldr	w0, [x19]
Lloh35:
	adrp	x1, l_.str.11@PAGE
Lloh36:
	add	x1, x1, l_.str.11@PAGEOFF
	b	LBB0_18
LBB0_17:
Lloh37:
	adrp	x1, l_.str.14@PAGE
Lloh38:
	add	x1, x1, l_.str.14@PAGEOFF
LBB0_18:
	bl	_dev_info
LBB0_19:
	mov	w0, #0
	ldr	w8, [x22]
	ldr	w9, [x21]
	orr	w8, w9, w8
	str	w8, [x21]
	b	LBB0_3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpAdd	Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_HW_CAP_CPU,4,2                 ; @HW_CAP_CPU
	.comm	_DRAM_PHYS_BASE,4,2             ; @DRAM_PHYS_BASE
	.comm	_U64_MAX,8,3                    ; @U64_MAX
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to map DDR bar to DRAM base address\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_mmPSOC_GLOBAL_CONF_WARM_REBOOT,4,2 ; @mmPSOC_GLOBAL_CONF_WARM_REBOOT
	.comm	_CPU_BOOT_STATUS_DRAM_RDY,4,2   ; @CPU_BOOT_STATUS_DRAM_RDY
	.comm	_CPU_BOOT_STATUS_SRAM_AVAIL,4,2 ; @CPU_BOOT_STATUS_SRAM_AVAIL
l_.str.1:                               ; @.str.1
	.asciz	"Error in ARM u-boot!"

l_.str.2:                               ; @.str.2
	.asciz	"ARM status %d - BTL did NOT run\n"

	.comm	_FW_COMP_UBOOT,4,2              ; @FW_COMP_UBOOT
	.comm	_FW_COMP_PREBOOT,4,2            ; @FW_COMP_PREBOOT
l_.str.11:                              ; @.str.11
	.asciz	"Skip loading FW\n"

	.comm	_mmPSOC_GLOBAL_CONF_UBOOT_MAGIC,4,2 ; @mmPSOC_GLOBAL_CONF_UBOOT_MAGIC
	.comm	_KMD_MSG_FIT_RDY,4,2            ; @KMD_MSG_FIT_RDY
	.comm	_CPU_BOOT_STATUS_FIT_CORRUPTED,4,2 ; @CPU_BOOT_STATUS_FIT_CORRUPTED
l_.str.13:                              ; @.str.13
	.asciz	"ARM Linux failed to load, %d\n"

	.comm	_KMD_MSG_NA,4,2                 ; @KMD_MSG_NA
l_.str.14:                              ; @.str.14
	.asciz	"Successfully loaded firmware to device\n"

	.no_dead_strip	_goya_init_cpu
.subsections_via_symbols
