	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hisi_qm_init                   ## -- Begin function hisi_qm_init
	.p2align	4, 0x90
_hisi_qm_init:                          ## @hisi_qm_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	%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, %r12
	movq	32(%rdi), %r14
	movl	(%rdi), %eax
	cmpl	$129, %eax
	je	LBB0_1
## %bb.2:
	cmpl	$128, %eax
	jne	LBB0_23
## %bb.3:
	movq	_qm_hw_ops_v2@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_1:
	movq	_qm_hw_ops_v1@GOTPCREL(%rip), %rax
LBB0_4:
	leaq	8(%r14), %r15
	movq	%rax, 24(%r12)
	movq	%r14, %rdi
	callq	_pci_enable_device_mem
	testl	%eax, %eax
	js	LBB0_5
## %bb.6:
	movl	40(%r12), %esi
	movq	%r14, %rdi
	callq	_pci_request_mem_regions
	testl	%eax, %eax
	js	LBB0_7
## %bb.8:
	movq	_PCI_BAR_2@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%r14, %rdi
	callq	_pci_resource_start
	movl	%eax, %ebx
	movq	32(%r12), %rdi
	movl	(%r13), %esi
	callq	_pci_resource_len
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_ioremap
	movl	%eax, 4(%r12)
	testl	%eax, %eax
	je	LBB0_9
## %bb.10:
	movl	$64, %edi
	callq	_DMA_BIT_MASK
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_dma_set_mask_and_coherent
	testl	%eax, %eax
	js	LBB0_11
## %bb.12:
	movq	%r14, %rdi
	callq	_pci_set_master
	movq	24(%r12), %rax
	movq	(%rax), %rcx
	testq	%rcx, %rcx
	je	LBB0_13
## %bb.14:
	movq	%r12, %rdi
	callq	*%rcx
	movq	_PCI_IRQ_MSI@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	%r14, %rdi
	movl	%eax, %esi
	movl	%eax, %edx
	callq	_pci_alloc_irq_vectors
	testl	%eax, %eax
	js	LBB0_15
## %bb.16:
	movq	%r12, %rdi
	callq	_qm_irq_register
	testl	%eax, %eax
	je	LBB0_17
## %bb.18:
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_pci_free_irq_vectors
	jmp	LBB0_19
LBB0_23:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_22
LBB0_5:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	callq	_dev_err
	jmp	LBB0_22
LBB0_7:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	callq	_dev_err
	jmp	LBB0_21
LBB0_9:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_20
LBB0_11:
	movl	%eax, %ebx
	jmp	LBB0_19
LBB0_13:
	movq	_EOPNOTSUPP@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_19
LBB0_15:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	callq	_dev_err
LBB0_19:
	movl	4(%r12), %edi
	callq	_iounmap
LBB0_20:
	movq	%r14, %rdi
	callq	_pci_release_mem_regions
LBB0_21:
	movq	%r14, %rdi
	callq	_pci_disable_device
LBB0_22:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	leaq	20(%r12), %rdi
	callq	_mutex_init
	leaq	16(%r12), %rdi
	callq	_rwlock_init
	cmpq	$0, (%r14)
	leaq	L_.str.5(%rip), %rax
	leaq	L_.str.4(%rip), %rdx
	cmoveq	%rax, %rdx
	cmpq	$0, 8(%r12)
	leaq	L_.str.7(%rip), %rax
	leaq	L_.str.6(%rip), %rcx
	cmoveq	%rax, %rcx
	leaq	L_.str.3(%rip), %rsi
	movq	%r15, %rdi
	callq	_dev_dbg
	xorl	%ebx, %ebx
	jmp	LBB0_22
	.cfi_endproc
                                        ## -- End function
	.comm	_qm_hw_ops_v1,8,3               ## @qm_hw_ops_v1
	.comm	_qm_hw_ops_v2,8,3               ## @qm_hw_ops_v2
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to enable device mem!\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to request mem regions!\n"

	.comm	_PCI_BAR_2,4,2                  ## @PCI_BAR_2
	.comm	_EIO,4,2                        ## @EIO
	.comm	_EOPNOTSUPP,4,2                 ## @EOPNOTSUPP
	.comm	_PCI_IRQ_MSI,4,2                ## @PCI_IRQ_MSI
L_.str.2:                               ## @.str.2
	.asciz	"Failed to enable MSI vectors!\n"

L_.str.3:                               ## @.str.3
	.asciz	"init qm %s with %s\n"

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

L_.str.5:                               ## @.str.5
	.asciz	"vf"

L_.str.6:                               ## @.str.6
	.asciz	"dma api"

L_.str.7:                               ## @.str.7
	.asciz	"iommu api"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hisi_qm_init                   ; -- Begin function hisi_qm_init
	.p2align	2
_hisi_qm_init:                          ; @hisi_qm_init
	.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	x20, x0
	ldr	x19, [x0, #32]
	ldr	w8, [x0]
	cmp	w8, #129
	b.eq	LBB0_3
; %bb.1:
	cmp	w8, #128
	b.ne	LBB0_12
; %bb.2:
Lloh0:
	adrp	x8, _qm_hw_ops_v2@GOTPAGE
Lloh1:
	ldr	x8, [x8, _qm_hw_ops_v2@GOTPAGEOFF]
	b	LBB0_4
LBB0_3:
Lloh2:
	adrp	x8, _qm_hw_ops_v1@GOTPAGE
Lloh3:
	ldr	x8, [x8, _qm_hw_ops_v1@GOTPAGEOFF]
LBB0_4:
	add	x21, x19, #8
	str	x8, [x20, #24]
	mov	x0, x19
	bl	_pci_enable_device_mem
	tbnz	w0, #31, LBB0_13
; %bb.5:
	ldr	w1, [x20, #40]
	mov	x0, x19
	bl	_pci_request_mem_regions
	tbnz	w0, #31, LBB0_14
; %bb.6:
Lloh4:
	adrp	x23, _PCI_BAR_2@GOTPAGE
Lloh5:
	ldr	x23, [x23, _PCI_BAR_2@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x19
	bl	_pci_resource_start
	mov	x22, x0
	ldr	x0, [x20, #32]
	ldr	w1, [x23]
	bl	_pci_resource_len
	mov	x1, x0
	mov	x0, x22
	bl	_ioremap
	str	w0, [x20, #4]
	cbz	w0, LBB0_15
; %bb.7:
	mov	w0, #64
	bl	_DMA_BIT_MASK
	mov	x1, x0
	mov	x0, x21
	bl	_dma_set_mask_and_coherent
	tbnz	w0, #31, LBB0_16
; %bb.8:
	mov	x0, x19
	bl	_pci_set_master
	ldr	x8, [x20, #24]
	ldr	x8, [x8]
	cbz	x8, LBB0_17
; %bb.9:
	mov	x0, x20
	blr	x8
	mov	x1, x0
Lloh6:
	adrp	x8, _PCI_IRQ_MSI@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PCI_IRQ_MSI@GOTPAGEOFF]
Lloh8:
	ldr	w3, [x8]
	mov	x0, x19
	mov	x2, x1
	bl	_pci_alloc_irq_vectors
	tbnz	w0, #31, LBB0_18
; %bb.10:
	mov	x0, x20
	bl	_qm_irq_register
	mov	x22, x0
	cbz	w0, LBB0_23
; %bb.11:
	mov	x0, x19
	bl	_pci_free_irq_vectors
	b	LBB0_19
LBB0_12:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_22
LBB0_13:
	mov	x22, x0
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_dev_err
	b	LBB0_22
LBB0_14:
	mov	x22, x0
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	bl	_dev_err
	b	LBB0_21
LBB0_15:
Lloh16:
	adrp	x8, _EIO@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_20
LBB0_16:
	mov	x22, x0
	b	LBB0_19
LBB0_17:
Lloh19:
	adrp	x8, _EOPNOTSUPP@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EOPNOTSUPP@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_19
LBB0_18:
	mov	x22, x0
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	bl	_dev_err
LBB0_19:
	ldr	w0, [x20, #4]
	bl	_iounmap
LBB0_20:
	mov	x0, x19
	bl	_pci_release_mem_regions
LBB0_21:
	mov	x0, x19
	bl	_pci_disable_device
LBB0_22:
	mov	x0, x22
	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
LBB0_23:
	add	x0, x20, #20
	bl	_mutex_init
	add	x0, x20, #16
	bl	_rwlock_init
Lloh24:
	adrp	x8, l_.str.4@PAGE
Lloh25:
	add	x8, x8, l_.str.4@PAGEOFF
	ldr	x9, [x19]
Lloh26:
	adrp	x10, l_.str.5@PAGE
Lloh27:
	add	x10, x10, l_.str.5@PAGEOFF
	cmp	x9, #0
	csel	x2, x10, x8, eq
	ldr	x8, [x20, #8]
Lloh28:
	adrp	x9, l_.str.6@PAGE
Lloh29:
	add	x9, x9, l_.str.6@PAGEOFF
Lloh30:
	adrp	x10, l_.str.7@PAGE
Lloh31:
	add	x10, x10, l_.str.7@PAGEOFF
	cmp	x8, #0
	csel	x3, x10, x9, eq
Lloh32:
	adrp	x1, l_.str.3@PAGE
Lloh33:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x21
	bl	_dev_dbg
	b	LBB0_22
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_qm_hw_ops_v1,8,3               ; @qm_hw_ops_v1
	.comm	_qm_hw_ops_v2,8,3               ; @qm_hw_ops_v2
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to enable device mem!\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to request mem regions!\n"

	.comm	_PCI_BAR_2,4,2                  ; @PCI_BAR_2
	.comm	_EIO,4,2                        ; @EIO
	.comm	_EOPNOTSUPP,4,2                 ; @EOPNOTSUPP
	.comm	_PCI_IRQ_MSI,4,2                ; @PCI_IRQ_MSI
l_.str.2:                               ; @.str.2
	.asciz	"Failed to enable MSI vectors!\n"

l_.str.3:                               ; @.str.3
	.asciz	"init qm %s with %s\n"

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

l_.str.5:                               ; @.str.5
	.asciz	"vf"

l_.str.6:                               ; @.str.6
	.asciz	"dma api"

l_.str.7:                               ; @.str.7
	.asciz	"iommu api"

.subsections_via_symbols
