	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hns_roce_cq_alloc
_hns_roce_cq_alloc:                     ## @hns_roce_cq_alloc
	.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
	subq	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r8d, %r15d
	movq	%rcx, -88(%rbp)                 ## 8-byte Spill
	movq	%rdx, %rbx
	movl	%esi, -64(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r12
	movq	32(%rdi), %r14
	movq	_HEM_TYPE_CQE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_hns_roce_check_whether_mhop
	xorl	%ecx, %ecx
	testq	%rax, %rax
	setne	%cl
	leaq	(%r12,%rcx,4), %rsi
	addq	$12, %rsi
	movl	(%rbx), %edx
	leaq	-68(%rbp), %rcx
	movq	%r12, %rdi
	callq	_hns_roce_table_find
	testq	%rax, %rax
	je	LBB0_1
## %bb.4:
	cmpl	%r15d, 8(%r12)
	jle	LBB0_5
## %bb.6:
	movq	%rax, %r13
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movl	%r15d, -60(%rbp)                ## 4-byte Spill
	movl	%r15d, (%rax)
	leaq	20(%r12), %r14
	leaq	8(%rax), %rbx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_hns_roce_bitmap_alloc
	cmpl	$-1, %eax
	je	LBB0_7
## %bb.8:
	movq	%r14, -104(%rbp)                ## 8-byte Spill
	leaq	24(%r12), %r15
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	(%rbx), %edx
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_hns_roce_table_get
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movl	%eax, %r14d
	leaq	L_.str.3(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_18
LBB0_1:
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_2
LBB0_5:
	leaq	L_.str.1(%rip), %rsi
LBB0_2:
	movq	%r14, %rdi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_19:
	movl	%r14d, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	leaq	L_.str.2(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_10:
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	leaq	28(%r12), %rbx
	movq	-88(%rbp), %r15                 ## 8-byte Reload
	movl	8(%r15), %esi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movq	%r15, %rdx
	callq	_xa_store
	movl	%eax, %edi
	callq	_xa_err
	testl	%eax, %eax
	je	LBB0_12
## %bb.11:
	movl	%eax, %r14d
	leaq	L_.str.4(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_17
LBB0_12:
	movq	%rbx, -96(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdi
	callq	_hns_roce_alloc_cmd_mailbox
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_14
## %bb.13:
	movq	%rbx, %rdi
	callq	_PTR_ERR
	movl	%eax, %r14d
	jmp	LBB0_16
LBB0_14:
	movq	(%r12), %rax
	movl	(%rbx), %edx
	movl	-68(%rbp), %r8d
	movl	-60(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, (%rsp)
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%r13, %rcx
	movl	-64(%rbp), %r9d                 ## 4-byte Reload
	callq	*(%rax)
	movl	8(%r15), %edx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_hns_roce_sw2hw_cq
	movl	%eax, %r14d
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_hns_roce_free_cmd_mailbox
	testl	%r14d, %r14d
	je	LBB0_20
## %bb.15:
	leaq	L_.str.5(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
LBB0_16:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %esi
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	callq	_xa_erase
LBB0_17:
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movl	(%rbx), %edx
	movq	%r12, %rdi
	callq	_hns_roce_table_put
LBB0_18:
	movl	(%rbx), %esi
	movq	_BITMAP_NO_RR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-104(%rbp), %rdi                ## 8-byte Reload
	callq	_hns_roce_bitmap_free
	jmp	LBB0_19
LBB0_20:
	movq	$0, 24(%r15)
	movl	$1, 4(%r15)
	leaq	16(%r15), %rdi
	movl	$1, %esi
	callq	_atomic_set
	addq	$12, %r15
	movq	%r15, %rdi
	callq	_init_completion
	xorl	%r14d, %r14d
	jmp	LBB0_19
	.cfi_endproc
                                        ## -- End function
	.comm	_HEM_TYPE_CQE,4,2               ## @HEM_TYPE_CQE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"CQ alloc.Failed to find cq buf addr.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"CQ alloc.Invalid vector.\n"

L_.str.2:                               ## @.str.2
	.asciz	"CQ alloc.Failed to alloc index.\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.3:                               ## @.str.3
	.asciz	"CQ alloc.Failed to get context mem.\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.4:                               ## @.str.4
	.asciz	"CQ alloc failed xa_store.\n"

L_.str.5:                               ## @.str.5
	.asciz	"CQ alloc.Failed to cmd mailbox.\n"

	.comm	_BITMAP_NO_RR,4,2               ## @BITMAP_NO_RR
	.no_dead_strip	_hns_roce_cq_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hns_roce_cq_alloc
_hns_roce_cq_alloc:                     ; @hns_roce_cq_alloc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x25, x4
	mov	x23, x3
	mov	x20, x2
	mov	x26, x1
	mov	x19, x0
	ldr	x22, [x0, #32]
Lloh0:
	adrp	x8, _HEM_TYPE_CQE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HEM_TYPE_CQE@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_hns_roce_check_whether_mhop
	add	x8, x19, #16
	add	x9, x19, #12
	cmp	x0, #0
	csel	x1, x9, x8, eq
	ldr	w2, [x20]
	add	x3, sp, #28
	mov	x0, x19
	bl	_hns_roce_table_find
	cbz	x0, LBB0_5
; %bb.1:
	ldr	w8, [x19, #8]
	cmp	w8, w25
	b.le	LBB0_6
; %bb.2:
	mov	x28, x0
	mov	x21, x23
	str	w25, [x21], #8
	add	x20, x19, #20
	mov	x0, x20
	mov	x1, x21
	bl	_hns_roce_bitmap_alloc
	cmn	w0, #1
	b.eq	LBB0_10
; %bb.3:
	add	x24, x19, #24
	ldr	w2, [x21]
	mov	x0, x19
	mov	x1, x24
	bl	_hns_roce_table_get
	cbz	w0, LBB0_11
; %bb.4:
	mov	x27, x0
Lloh3:
	adrp	x1, l_.str.3@PAGE
Lloh4:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x22
	bl	_dev_err
	b	LBB0_19
LBB0_5:
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_7
LBB0_6:
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_7:
	mov	x0, x22
	bl	_dev_err
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w27, w8
LBB0_9:
	mov	x0, x27
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_10:
Lloh11:
	adrp	x1, l_.str.2@PAGE
Lloh12:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x22
	bl	_dev_err
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_8
LBB0_11:
	str	x24, [sp, #16]                  ; 8-byte Folded Spill
	add	x24, x19, #28
	ldr	w1, [x23, #8]
Lloh15:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh16:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh17:
	ldr	w3, [x8]
	mov	x0, x24
	mov	x2, x23
	bl	_xa_store
	bl	_xa_err
	cbz	w0, LBB0_13
; %bb.12:
	mov	x27, x0
Lloh18:
	adrp	x1, l_.str.4@PAGE
Lloh19:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x22
	bl	_dev_err
	ldr	x24, [sp, #16]                  ; 8-byte Folded Reload
	b	LBB0_18
LBB0_13:
	str	x24, [sp, #8]                   ; 8-byte Folded Spill
	mov	x0, x19
	bl	_hns_roce_alloc_cmd_mailbox
	mov	x24, x0
	bl	_IS_ERR
	cbz	x0, LBB0_15
; %bb.14:
	mov	x0, x24
	bl	_PTR_ERR
	mov	x27, x0
	ldr	x24, [sp, #16]                  ; 8-byte Folded Reload
	b	LBB0_17
LBB0_15:
	ldr	x8, [x19]
	ldr	x8, [x8]
	ldr	w2, [x24]
	ldr	w4, [sp, #28]
	mov	x0, x19
	mov	x1, x23
	mov	x3, x28
	mov	x5, x26
	mov	x6, x25
	blr	x8
	ldr	w2, [x23, #8]
	mov	x0, x19
	mov	x1, x24
	bl	_hns_roce_sw2hw_cq
	mov	x27, x0
	mov	x0, x19
	mov	x1, x24
	bl	_hns_roce_free_cmd_mailbox
	ldr	x24, [sp, #16]                  ; 8-byte Folded Reload
	cbz	w27, LBB0_20
; %bb.16:
Lloh20:
	adrp	x1, l_.str.5@PAGE
Lloh21:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x22
	bl	_dev_err
LBB0_17:
	ldr	w1, [x21]
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	bl	_xa_erase
LBB0_18:
	ldr	w2, [x21]
	mov	x0, x19
	mov	x1, x24
	bl	_hns_roce_table_put
LBB0_19:
	ldr	w1, [x21]
Lloh22:
	adrp	x8, _BITMAP_NO_RR@GOTPAGE
Lloh23:
	ldr	x8, [x8, _BITMAP_NO_RR@GOTPAGEOFF]
Lloh24:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_hns_roce_bitmap_free
	b	LBB0_9
LBB0_20:
	str	xzr, [x23, #24]
	mov	w8, #1
	str	w8, [x23, #4]
	add	x0, x23, #16
	mov	w1, #1
	bl	_atomic_set
	add	x0, x23, #12
	bl	_init_completion
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_HEM_TYPE_CQE,4,2               ; @HEM_TYPE_CQE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"CQ alloc.Failed to find cq buf addr.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"CQ alloc.Invalid vector.\n"

l_.str.2:                               ; @.str.2
	.asciz	"CQ alloc.Failed to alloc index.\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.3:                               ; @.str.3
	.asciz	"CQ alloc.Failed to get context mem.\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.4:                               ; @.str.4
	.asciz	"CQ alloc failed xa_store.\n"

l_.str.5:                               ; @.str.5
	.asciz	"CQ alloc.Failed to cmd mailbox.\n"

	.comm	_BITMAP_NO_RR,4,2               ; @BITMAP_NO_RR
	.no_dead_strip	_hns_roce_cq_alloc
.subsections_via_symbols
