	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ath5k_hw_update_noise_floor    ## -- Begin function ath5k_hw_update_noise_floor
	.p2align	4, 0x90
_ath5k_hw_update_noise_floor:           ## @ath5k_hw_update_noise_floor
	.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	%rdi, %r15
	movq	_AR5K_PHY_AGCCTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_ath5k_hw_reg_read
	movq	_AR5K_PHY_AGCCTL_NF@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_1
## %bb.4:
	movq	_ATH5K_DEBUG_CALIBRATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%r15, %rdi
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ATH5K_DBG                      ## TAILCALL
LBB0_1:
	movq	_AR5K_CALIBRATION_NF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 4(%r15)
	movl	8(%r15), %esi
	movq	%r15, %rdi
	callq	_ath5k_eeprom_mode_from_channel
	movq	%rax, %rbx
	movq	%r15, %rdi
	callq	_ath5k_hw_read_measured_noise_floor
	movq	16(%r15), %rcx
	movl	(%rcx,%rbx,4), %r8d
	cmpl	%r8d, %eax
	jle	LBB0_3
## %bb.2:
	movq	_ATH5K_DEBUG_CALIBRATE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	leaq	L_.str.1(%rip), %rdx
	movq	%r15, %rdi
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_ATH5K_DBG
	movq	_AR5K_TUNE_CCA_MAX_GOOD_VALUE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_3:
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_ath5k_hw_update_nfcal_hist
	movq	%r15, %rdi
	callq	_ath5k_hw_get_median_noise_floor
	movl	%eax, %r14d
	movq	_AR5K_PHY_NF@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r15, %rdi
	callq	_ath5k_hw_reg_read
	movq	_AR5K_PHY_NF_M@GOTPCREL(%rip), %rcx
	leal	(%r14,%r14), %ebx
	xorl	%eax, %ebx
	andl	(%rcx), %ebx
	xorl	%eax, %ebx
	movl	(%r12), %edx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_ath5k_hw_reg_write
	movq	_AR5K_PHY_AGCCTL@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	_AR5K_PHY_AGCCTL_NF@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movq	_AR5K_PHY_AGCCTL_NF_EN@GOTPCREL(%rip), %rax
	movq	_AR5K_PHY_AGCCTL_NF_NOUPDATE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	notl	%ecx
	movq	%r15, %rdi
	callq	_AR5K_REG_MASKED_BITS
	movl	(%r13), %esi
	movl	(%r12), %edx
	movq	%r15, %rdi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_ath5k_hw_register_timeout
	movl	%ebx, %esi
	xorl	$-100, %esi
	movq	_AR5K_PHY_NF_M@GOTPCREL(%rip), %rax
	andl	(%rax), %esi
	xorl	%ebx, %esi
	movq	_AR5K_PHY_NF@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_ath5k_hw_reg_write
	movl	(%r13), %esi
	movq	_AR5K_PHY_AGCCTL_NF_NOUPDATE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_AR5K_PHY_AGCCTL_NF_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	orl	(%r12), %edx
	movq	%r15, %rdi
	callq	_AR5K_REG_ENABLE_BITS
	movl	%r14d, (%r15)
	movq	_AR5K_CALIBRATION_NF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	andl	%eax, 4(%r15)
	movq	_ATH5K_DEBUG_CALIBRATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdx
	movq	%r15, %rdi
	movl	%r14d, %ecx
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ATH5K_DBG                      ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_AR5K_PHY_AGCCTL,4,2            ## @AR5K_PHY_AGCCTL
	.comm	_AR5K_PHY_AGCCTL_NF,4,2         ## @AR5K_PHY_AGCCTL_NF
	.comm	_ATH5K_DEBUG_CALIBRATE,4,2      ## @ATH5K_DEBUG_CALIBRATE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"NF did not complete in calibration window\n"

	.comm	_AR5K_CALIBRATION_NF,4,2        ## @AR5K_CALIBRATION_NF
L_.str.1:                               ## @.str.1
	.asciz	"noise floor failure detected; read %d, threshold %d\n"

	.comm	_AR5K_TUNE_CCA_MAX_GOOD_VALUE,4,2 ## @AR5K_TUNE_CCA_MAX_GOOD_VALUE
	.comm	_AR5K_PHY_NF,4,2                ## @AR5K_PHY_NF
	.comm	_AR5K_PHY_NF_M,4,2              ## @AR5K_PHY_NF_M
	.comm	_AR5K_PHY_AGCCTL_NF_EN,4,2      ## @AR5K_PHY_AGCCTL_NF_EN
	.comm	_AR5K_PHY_AGCCTL_NF_NOUPDATE,4,2 ## @AR5K_PHY_AGCCTL_NF_NOUPDATE
L_.str.2:                               ## @.str.2
	.asciz	"noise floor calibrated: %d\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ath5k_hw_update_noise_floor    ; -- Begin function ath5k_hw_update_noise_floor
	.p2align	2
_ath5k_hw_update_noise_floor:           ; @ath5k_hw_update_noise_floor
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
Lloh0:
	adrp	x22, _AR5K_PHY_AGCCTL@GOTPAGE
Lloh1:
	ldr	x22, [x22, _AR5K_PHY_AGCCTL@GOTPAGEOFF]
	ldr	w1, [x22]
	bl	_ath5k_hw_reg_read
Lloh2:
	adrp	x24, _AR5K_PHY_AGCCTL_NF@GOTPAGE
Lloh3:
	ldr	x24, [x24, _AR5K_PHY_AGCCTL_NF@GOTPAGEOFF]
	ldr	w8, [x24]
	tst	w8, w0
	b.eq	LBB0_2
; %bb.1:
Lloh4:
	adrp	x8, _ATH5K_DEBUG_CALIBRATE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ATH5K_DEBUG_CALIBRATE@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
Lloh7:
	adrp	x2, l_.str@PAGE
Lloh8:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_ATH5K_DBG
LBB0_2:
Lloh9:
	adrp	x23, _AR5K_CALIBRATION_NF@GOTPAGE
Lloh10:
	ldr	x23, [x23, _AR5K_CALIBRATION_NF@GOTPAGEOFF]
	ldr	w8, [x23]
	ldp	w9, w1, [x19, #4]
	orr	w8, w9, w8
	str	w8, [x19, #4]
	mov	x0, x19
	bl	_ath5k_eeprom_mode_from_channel
	mov	x20, x0
	mov	x0, x19
	bl	_ath5k_hw_read_measured_noise_floor
	mov	x8, x0
	ldr	x9, [x19, #16]
	ldr	w9, [x9, x20, lsl #2]
	cmp	w0, w9
	b.le	LBB0_4
; %bb.3:
Lloh11:
	adrp	x10, _ATH5K_DEBUG_CALIBRATE@GOTPAGE
Lloh12:
	ldr	x10, [x10, _ATH5K_DEBUG_CALIBRATE@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x10]
	stp	x8, x9, [sp]
Lloh14:
	adrp	x2, l_.str.1@PAGE
Lloh15:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_ATH5K_DBG
Lloh16:
	adrp	x8, _AR5K_TUNE_CCA_MAX_GOOD_VALUE@GOTPAGE
Lloh17:
	ldr	x8, [x8, _AR5K_TUNE_CCA_MAX_GOOD_VALUE@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
LBB0_4:
	mov	x0, x19
	mov	x1, x8
	bl	_ath5k_hw_update_nfcal_hist
	mov	x0, x19
	bl	_ath5k_hw_get_median_noise_floor
	mov	x20, x0
Lloh19:
	adrp	x25, _AR5K_PHY_NF@GOTPAGE
Lloh20:
	ldr	x25, [x25, _AR5K_PHY_NF@GOTPAGEOFF]
	ldr	w1, [x25]
	mov	x0, x19
	bl	_ath5k_hw_reg_read
Lloh21:
	adrp	x26, _AR5K_PHY_NF_M@GOTPAGE
Lloh22:
	ldr	x26, [x26, _AR5K_PHY_NF_M@GOTPAGEOFF]
	ldr	w8, [x26]
	bic	w9, w0, w8
	and	w8, w8, w20, lsl #1
	orr	w21, w9, w8
	ldr	w2, [x25]
	mov	x0, x19
	mov	x1, x21
	bl	_ath5k_hw_reg_write
	ldr	w1, [x22]
	ldr	w2, [x24]
Lloh23:
	adrp	x27, _AR5K_PHY_AGCCTL_NF_EN@GOTPAGE
Lloh24:
	ldr	x27, [x27, _AR5K_PHY_AGCCTL_NF_EN@GOTPAGEOFF]
	ldr	w8, [x27]
Lloh25:
	adrp	x28, _AR5K_PHY_AGCCTL_NF_NOUPDATE@GOTPAGE
Lloh26:
	ldr	x28, [x28, _AR5K_PHY_AGCCTL_NF_NOUPDATE@GOTPAGEOFF]
	ldr	w9, [x28]
	orr	w8, w9, w8
	mvn	w3, w8
	mov	x0, x19
	bl	_AR5K_REG_MASKED_BITS
	ldr	w1, [x22]
	ldr	w2, [x24]
	mov	x0, x19
	mov	w3, #0
	mov	w4, #0
	bl	_ath5k_hw_register_timeout
	ldr	w8, [x26]
	bic	w9, w21, w8
	mov	w10, #-100
	and	w8, w8, w10
	orr	w1, w9, w8
	ldr	w2, [x25]
	mov	x0, x19
	bl	_ath5k_hw_reg_write
	ldr	w1, [x22]
	ldr	w8, [x27]
	ldr	w9, [x28]
	orr	w8, w9, w8
	ldr	w9, [x24]
	orr	w2, w8, w9
	mov	x0, x19
	bl	_AR5K_REG_ENABLE_BITS
	str	w20, [x19]
	ldr	w8, [x23]
	ldr	w9, [x19, #4]
	bic	w8, w9, w8
	str	w8, [x19, #4]
Lloh27:
	adrp	x8, _ATH5K_DEBUG_CALIBRATE@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ATH5K_DEBUG_CALIBRATE@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
	str	x20, [sp]
Lloh30:
	adrp	x2, l_.str.2@PAGE
Lloh31:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_ATH5K_DBG
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_AR5K_PHY_AGCCTL,4,2            ; @AR5K_PHY_AGCCTL
	.comm	_AR5K_PHY_AGCCTL_NF,4,2         ; @AR5K_PHY_AGCCTL_NF
	.comm	_ATH5K_DEBUG_CALIBRATE,4,2      ; @ATH5K_DEBUG_CALIBRATE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"NF did not complete in calibration window\n"

	.comm	_AR5K_CALIBRATION_NF,4,2        ; @AR5K_CALIBRATION_NF
l_.str.1:                               ; @.str.1
	.asciz	"noise floor failure detected; read %d, threshold %d\n"

	.comm	_AR5K_TUNE_CCA_MAX_GOOD_VALUE,4,2 ; @AR5K_TUNE_CCA_MAX_GOOD_VALUE
	.comm	_AR5K_PHY_NF,4,2                ; @AR5K_PHY_NF
	.comm	_AR5K_PHY_NF_M,4,2              ; @AR5K_PHY_NF_M
	.comm	_AR5K_PHY_AGCCTL_NF_EN,4,2      ; @AR5K_PHY_AGCCTL_NF_EN
	.comm	_AR5K_PHY_AGCCTL_NF_NOUPDATE,4,2 ; @AR5K_PHY_AGCCTL_NF_NOUPDATE
l_.str.2:                               ; @.str.2
	.asciz	"noise floor calibrated: %d\n"

.subsections_via_symbols
