	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function goya_hw_init
_goya_hw_init:                          ## @goya_hw_init
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movl	(%rdi), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_info
	movq	_mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_RREG32
	movq	_mmHW_STATE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_HL_DEVICE_HW_STATE_DIRTY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_WREG32
	movq	_GOYA_CPU_TIMEOUT_USEC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_goya_init_cpu
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %ebx
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_8
LBB0_2:
	movq	%r14, %rdi
	callq	_goya_tpc_mbist_workaround
	movq	%r14, %rdi
	callq	_goya_init_golden_registers
	movq	_DRAM_PHYS_BASE@GOTPCREL(%rip), %rax
	movq	_MMU_PAGE_TABLES_ADDR@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rcx
	movslq	4(%r14), %rsi
	negq	%rsi
	andq	%rcx, %rsi
	addq	(%rax), %rsi
	movq	%r14, %rdi
	callq	_goya_set_ddr_bar_base
	movq	_U64_MAX@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.3:
	movl	(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_4:
	movq	%r14, %rdi
	callq	_goya_mmu_init
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_8
## %bb.5:
	movq	%r14, %rdi
	callq	_goya_init_security
	movq	%r14, %rdi
	callq	_goya_init_dma_qmans
	movq	%r14, %rdi
	callq	_goya_init_mme_qmans
	movq	%r14, %rdi
	callq	_goya_init_tpc_qmans
	movq	%r14, %rdi
	callq	_goya_enable_timestamp
	movq	%r14, %rdi
	callq	_goya_enable_msix
	testl	%eax, %eax
	je	LBB0_6
## %bb.7:
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_goya_disable_internal_queues
	movq	%r14, %rdi
	callq	_goya_disable_external_queues
	jmp	LBB0_8
LBB0_6:
	movl	(%r15), %edi
	callq	_RREG32
	xorl	%ebx, %ebx
LBB0_8:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Starting initialization of H/W\n"

	.comm	_mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG,4,2 ## @mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG
	.comm	_mmHW_STATE,4,2                 ## @mmHW_STATE
	.comm	_HL_DEVICE_HW_STATE_DIRTY,4,2   ## @HL_DEVICE_HW_STATE_DIRTY
	.comm	_GOYA_CPU_TIMEOUT_USEC,4,2      ## @GOYA_CPU_TIMEOUT_USEC
L_.str.1:                               ## @.str.1
	.asciz	"failed to initialize CPU\n"

	.comm	_DRAM_PHYS_BASE,8,3             ## @DRAM_PHYS_BASE
	.comm	_MMU_PAGE_TABLES_ADDR,4,2       ## @MMU_PAGE_TABLES_ADDR
	.comm	_U64_MAX,8,3                    ## @U64_MAX
L_.str.2:                               ## @.str.2
	.asciz	"failed to map DDR bar to MMU page tables\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_goya_hw_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function goya_hw_init
_goya_hw_init:                          ; @goya_hw_init
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x19, x0
	ldr	w0, [x0]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_info
Lloh2:
	adrp	x21, _mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG@GOTPAGE
Lloh3:
	ldr	x21, [x21, _mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_RREG32
Lloh4:
	adrp	x8, _mmHW_STATE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _mmHW_STATE@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
Lloh7:
	adrp	x8, _HL_DEVICE_HW_STATE_DIRTY@GOTPAGE
Lloh8:
	ldr	x8, [x8, _HL_DEVICE_HW_STATE_DIRTY@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	bl	_WREG32
Lloh10:
	adrp	x8, _GOYA_CPU_TIMEOUT_USEC@GOTPAGE
Lloh11:
	ldr	x8, [x8, _GOYA_CPU_TIMEOUT_USEC@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_goya_init_cpu
	cbz	w0, LBB0_2
; %bb.1:
	mov	x20, x0
	ldr	w0, [x19]
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	b	LBB0_8
LBB0_2:
	mov	x0, x19
	bl	_goya_tpc_mbist_workaround
	mov	x0, x19
	bl	_goya_init_golden_registers
Lloh15:
	adrp	x8, _DRAM_PHYS_BASE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _DRAM_PHYS_BASE@GOTPAGEOFF]
Lloh17:
	adrp	x9, _MMU_PAGE_TABLES_ADDR@GOTPAGE
Lloh18:
	ldr	x9, [x9, _MMU_PAGE_TABLES_ADDR@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
Lloh20:
	ldrsw	x9, [x9]
	ldrsw	x10, [x19, #4]
	neg	x10, x10
	and	x9, x10, x9
	add	x1, x9, x8
	mov	x0, x19
	bl	_goya_set_ddr_bar_base
Lloh21:
	adrp	x8, _U64_MAX@GOTPAGE
Lloh22:
	ldr	x8, [x8, _U64_MAX@GOTPAGEOFF]
Lloh23:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_4
; %bb.3:
	ldr	w0, [x19]
Lloh24:
	adrp	x1, l_.str.2@PAGE
Lloh25:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
Lloh26:
	adrp	x8, _EIO@GOTPAGE
Lloh27:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_8
LBB0_4:
	mov	x0, x19
	bl	_goya_mmu_init
	mov	x20, x0
	cbnz	w0, LBB0_8
; %bb.5:
	mov	x0, x19
	bl	_goya_init_security
	mov	x0, x19
	bl	_goya_init_dma_qmans
	mov	x0, x19
	bl	_goya_init_mme_qmans
	mov	x0, x19
	bl	_goya_init_tpc_qmans
	mov	x0, x19
	bl	_goya_enable_timestamp
	mov	x0, x19
	bl	_goya_enable_msix
	mov	x20, x0
	cbz	w0, LBB0_7
; %bb.6:
	mov	x0, x19
	bl	_goya_disable_internal_queues
	mov	x0, x19
	bl	_goya_disable_external_queues
	b	LBB0_8
LBB0_7:
	ldr	w0, [x21]
	bl	_RREG32
LBB0_8:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh19
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Starting initialization of H/W\n"

	.comm	_mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG,4,2 ; @mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG
	.comm	_mmHW_STATE,4,2                 ; @mmHW_STATE
	.comm	_HL_DEVICE_HW_STATE_DIRTY,4,2   ; @HL_DEVICE_HW_STATE_DIRTY
	.comm	_GOYA_CPU_TIMEOUT_USEC,4,2      ; @GOYA_CPU_TIMEOUT_USEC
l_.str.1:                               ; @.str.1
	.asciz	"failed to initialize CPU\n"

	.comm	_DRAM_PHYS_BASE,8,3             ; @DRAM_PHYS_BASE
	.comm	_MMU_PAGE_TABLES_ADDR,4,2       ; @MMU_PAGE_TABLES_ADDR
	.comm	_U64_MAX,8,3                    ; @U64_MAX
l_.str.2:                               ; @.str.2
	.asciz	"failed to map DDR bar to MMU page tables\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_goya_hw_init
.subsections_via_symbols
