	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function catu_enable_hw
_catu_enable_hw:                        ## @catu_enable_hw
	.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
	movq	%rsi, %rbx
	movq	%rdi, %r13
	movq	8(%rdi), %r14
	callq	_catu_wait_for_ready
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_warn
LBB0_2:
	movq	%r13, %rdi
	callq	_catu_read_control
	movl	%eax, %r15d
	movq	_CATU_CONTROL_ENABLE@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	callq	_BIT
	testl	%r15d, %eax
	je	LBB0_4
## %bb.3:
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_warn
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_10
LBB0_4:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movl	(%r13), %edi
	callq	_coresight_claim_device_unlocked
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_10
## %bb.5:
	movl	(%r12), %edi
	callq	_BIT
	orl	%r15d, %eax
	movl	%eax, %r15d
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	testq	%rdx, %rdx
	je	LBB0_8
## %bb.6:
	movq	(%rdx), %rax
	movq	_ETR_MODE_CATU@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_8
## %bb.7:
	movq	8(%rdx), %rbx
	movq	_CATU_MODE_TRANSLATE@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_CATU_OS_AXICTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_catu_write_axictrl
	movl	(%rbx), %esi
	movq	%r13, %rdi
	callq	_catu_write_sladdr
	movq	_CATU_DEFAULT_INADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_9
LBB0_8:
	movq	_CATU_MODE_PASS_THROUGH@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	xorl	%ebx, %ebx
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_catu_write_sladdr
LBB0_9:
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_catu_write_inaddr
	xorl	%ebx, %ebx
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_catu_write_irqen
	movq	%r13, %rdi
	movl	%r12d, %esi
	callq	_catu_write_mode
	movq	%r13, %rdi
	movl	%r15d, %esi
	callq	_catu_write_control
	movq	_CATU_MODE_PASS_THROUGH@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	leaq	L_.str.3(%rip), %rax
	leaq	L_.str.4(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_dbg
LBB0_10:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Timeout while waiting for READY\n"

	.comm	_CATU_CONTROL_ENABLE,4,2        ## @CATU_CONTROL_ENABLE
L_.str.1:                               ## @.str.1
	.asciz	"CATU is already enabled\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_ETR_MODE_CATU,8,3              ## @ETR_MODE_CATU
	.comm	_CATU_MODE_TRANSLATE,4,2        ## @CATU_MODE_TRANSLATE
	.comm	_CATU_OS_AXICTRL,4,2            ## @CATU_OS_AXICTRL
	.comm	_CATU_DEFAULT_INADDR,4,2        ## @CATU_DEFAULT_INADDR
	.comm	_CATU_MODE_PASS_THROUGH,4,2     ## @CATU_MODE_PASS_THROUGH
L_.str.2:                               ## @.str.2
	.asciz	"Enabled in %s mode\n"

L_.str.3:                               ## @.str.3
	.asciz	"Pass through"

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

	.no_dead_strip	_catu_enable_hw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function catu_enable_hw
_catu_enable_hw:                        ; @catu_enable_hw
	.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	x22, x1
	mov	x20, x0
	ldr	x19, [x0, #8]
	bl	_catu_wait_for_ready
	cbz	x0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_dev_warn
LBB0_2:
	mov	x0, x20
	bl	_catu_read_control
	mov	x21, x0
Lloh2:
	adrp	x23, _CATU_CONTROL_ENABLE@GOTPAGE
Lloh3:
	ldr	x23, [x23, _CATU_CONTROL_ENABLE@GOTPAGEOFF]
	ldr	w0, [x23]
	bl	_BIT
	tst	w0, w21
	b.eq	LBB0_4
; %bb.3:
Lloh4:
	adrp	x1, l_.str.1@PAGE
Lloh5:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_dev_warn
Lloh6:
	adrp	x8, _EBUSY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_10
LBB0_4:
	ldr	w0, [x20]
	bl	_coresight_claim_device_unlocked
	cbnz	w0, LBB0_10
; %bb.5:
	ldr	w0, [x23]
	bl	_BIT
	orr	w21, w0, w21
Lloh9:
	adrp	x23, _CATU_MODE_PASS_THROUGH@GOTPAGE
Lloh10:
	ldr	x23, [x23, _CATU_MODE_PASS_THROUGH@GOTPAGEOFF]
	cbz	x22, LBB0_8
; %bb.6:
	ldr	x8, [x22]
Lloh11:
	adrp	x9, _ETR_MODE_CATU@GOTPAGE
Lloh12:
	ldr	x9, [x9, _ETR_MODE_CATU@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.7:
	ldr	x24, [x22, #8]
Lloh14:
	adrp	x8, _CATU_MODE_TRANSLATE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _CATU_MODE_TRANSLATE@GOTPAGEOFF]
Lloh16:
	ldr	w22, [x8]
Lloh17:
	adrp	x8, _CATU_OS_AXICTRL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _CATU_OS_AXICTRL@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_catu_write_axictrl
	ldr	w1, [x24]
	mov	x0, x20
	bl	_catu_write_sladdr
Lloh20:
	adrp	x8, _CATU_DEFAULT_INADDR@GOTPAGE
Lloh21:
	ldr	x8, [x8, _CATU_DEFAULT_INADDR@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	b	LBB0_9
LBB0_8:
	ldr	w22, [x23]
	mov	x0, x20
	mov	w1, #0
	bl	_catu_write_sladdr
	mov	w1, #0
LBB0_9:
	mov	x0, x20
	bl	_catu_write_inaddr
	mov	x0, x20
	mov	w1, #0
	bl	_catu_write_irqen
	mov	x0, x20
	mov	x1, x22
	bl	_catu_write_mode
	mov	x0, x20
	mov	x1, x21
	bl	_catu_write_control
	ldr	w8, [x23]
Lloh23:
	adrp	x9, l_.str.4@PAGE
Lloh24:
	add	x9, x9, l_.str.4@PAGEOFF
Lloh25:
	adrp	x10, l_.str.3@PAGE
Lloh26:
	add	x10, x10, l_.str.3@PAGEOFF
	cmp	w22, w8
	csel	x2, x10, x9, eq
Lloh27:
	adrp	x1, l_.str.2@PAGE
Lloh28:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_dev_dbg
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Timeout while waiting for READY\n"

	.comm	_CATU_CONTROL_ENABLE,4,2        ; @CATU_CONTROL_ENABLE
l_.str.1:                               ; @.str.1
	.asciz	"CATU is already enabled\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_ETR_MODE_CATU,8,3              ; @ETR_MODE_CATU
	.comm	_CATU_MODE_TRANSLATE,4,2        ; @CATU_MODE_TRANSLATE
	.comm	_CATU_OS_AXICTRL,4,2            ; @CATU_OS_AXICTRL
	.comm	_CATU_DEFAULT_INADDR,4,2        ; @CATU_DEFAULT_INADDR
	.comm	_CATU_MODE_PASS_THROUGH,4,2     ; @CATU_MODE_PASS_THROUGH
l_.str.2:                               ; @.str.2
	.asciz	"Enabled in %s mode\n"

l_.str.3:                               ; @.str.3
	.asciz	"Pass through"

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

	.no_dead_strip	_catu_enable_hw
.subsections_via_symbols
