	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nvme_map_cmb
_nvme_map_cmb:                          ## @nvme_map_cmb
	.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, %rbx
	movl	36(%rdi), %edi
	callq	_to_pci_dev
	cmpl	$0, (%rbx)
	je	LBB0_1
LBB0_10:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	%rax, %r14
	movslq	32(%rbx), %rdi
	movq	_NVME_REG_CMBSZ@GOTPCREL(%rip), %rax
	addq	(%rax), %rdi
	callq	_readl
	movl	%eax, 4(%rbx)
	testl	%eax, %eax
	je	LBB0_10
## %bb.2:
	movslq	32(%rbx), %rdi
	movq	_NVME_REG_CMBLOC@GOTPCREL(%rip), %rax
	addq	(%rax), %rdi
	callq	_readl
	movq	%rax, 24(%rbx)
	movq	%rbx, %rdi
	callq	_nvme_cmb_size_unit
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%rbx, %rdi
	callq	_nvme_cmb_size
	movl	%eax, %r15d
	movq	%rbx, %rdi
	callq	_nvme_cmb_size_unit
	movl	%eax, %r12d
	movq	24(%rbx), %rdi
	callq	_NVME_CMB_OFST
	movl	%eax, %r13d
	imull	%r12d, %r13d
	movq	24(%rbx), %rdi
	callq	_NVME_CMB_BIR
	movl	%eax, %r12d
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_pci_resource_len
	subl	%r13d, %eax
	jl	LBB0_10
## %bb.3:
	imull	-44(%rbp), %r15d                ## 4-byte Folded Reload
	cmpl	%eax, %r15d
	cmovgel	%eax, %r15d
	movq	%r14, %rdi
	movl	%r12d, %esi
	movl	%r15d, %edx
	movl	%r13d, %ecx
	callq	_pci_p2pdma_add_resource
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	addq	$16, %rbx
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_9
LBB0_5:
	movl	%r15d, (%rbx)
	movq	_use_cmb_sqes@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	setne	%al
	movl	4(%rbx), %ecx
	movq	_NVME_CMBSZ_SQS@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	andl	%ecx, %edx
	setne	%dl
	andb	%al, %dl
	movzbl	%dl, %eax
	movl	%eax, 8(%rbx)
	movq	_NVME_CMBSZ_WDS@GOTPCREL(%rip), %rax
	movq	_NVME_CMBSZ_RDS@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rax), %edx
	notl	%ecx
	testl	%ecx, %edx
	jne	LBB0_7
## %bb.6:
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_pci_p2pmem_publish
LBB0_7:
	movq	16(%rbx), %rdi
	movq	_dev_attr_cmb@GOTPCREL(%rip), %rsi
	xorl	%edx, %edx
	callq	_sysfs_add_file_to_group
	testq	%rax, %rax
	je	LBB0_10
## %bb.8:
	addq	$16, %rbx
	leaq	L_.str.1(%rip), %rsi
LBB0_9:
	movq	(%rbx), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_warn                       ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_NVME_REG_CMBSZ,8,3             ## @NVME_REG_CMBSZ
	.comm	_NVME_REG_CMBLOC,8,3            ## @NVME_REG_CMBLOC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to register the CMB\n"

	.comm	_use_cmb_sqes,8,3               ## @use_cmb_sqes
	.comm	_NVME_CMBSZ_SQS,4,2             ## @NVME_CMBSZ_SQS
	.comm	_NVME_CMBSZ_WDS,4,2             ## @NVME_CMBSZ_WDS
	.comm	_NVME_CMBSZ_RDS,4,2             ## @NVME_CMBSZ_RDS
	.comm	_dev_attr_cmb,4,2               ## @dev_attr_cmb
L_.str.1:                               ## @.str.1
	.asciz	"failed to add sysfs attribute for CMB\n"

	.no_dead_strip	_nvme_map_cmb
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nvme_map_cmb
_nvme_map_cmb:                          ; @nvme_map_cmb
	.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	x19, x0
	ldr	w0, [x0, #36]
	bl	_to_pci_dev
	ldr	w8, [x19]
	cbz	w8, LBB0_2
LBB0_1:
	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_2:
	mov	x20, x0
	ldrsw	x8, [x19, #32]
Lloh0:
	adrp	x9, _NVME_REG_CMBSZ@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NVME_REG_CMBSZ@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl
	str	w0, [x19, #4]
	cbz	w0, LBB0_1
; %bb.3:
	ldrsw	x8, [x19, #32]
Lloh3:
	adrp	x9, _NVME_REG_CMBLOC@GOTPAGE
Lloh4:
	ldr	x9, [x9, _NVME_REG_CMBLOC@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl
	str	x0, [x19, #24]
	mov	x0, x19
	bl	_nvme_cmb_size_unit
	mov	x21, x0
	mov	x0, x19
	bl	_nvme_cmb_size
	mov	x22, x0
	mov	x0, x19
	bl	_nvme_cmb_size_unit
	mov	x23, x0
	ldr	x0, [x19, #24]
	bl	_NVME_CMB_OFST
	mul	w23, w0, w23
	ldr	x0, [x19, #24]
	bl	_NVME_CMB_BIR
	mov	x24, x0
	mov	x0, x20
	mov	x1, x24
	bl	_pci_resource_len
	subs	w8, w0, w23
	b.lt	LBB0_1
; %bb.4:
	mul	w9, w22, w21
	cmp	w9, w8
	csel	w21, w9, w8, lt
	mov	x0, x20
	mov	x1, x24
	mov	x2, x21
	mov	x3, x23
	bl	_pci_p2pdma_add_resource
	cbz	x0, LBB0_6
; %bb.5:
	add	x19, x19, #16
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_10
LBB0_6:
Lloh8:
	adrp	x8, _use_cmb_sqes@GOTPAGE
Lloh9:
	ldr	x8, [x8, _use_cmb_sqes@GOTPAGEOFF]
	str	w21, [x19]
Lloh10:
	ldr	x8, [x8]
	ldr	w9, [x19, #4]
Lloh11:
	adrp	x10, _NVME_CMBSZ_SQS@GOTPAGE
Lloh12:
	ldr	x10, [x10, _NVME_CMBSZ_SQS@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	tst	w10, w9
	ccmp	x8, #0, #4, ne
	cset	w8, ne
	str	w8, [x19, #8]
Lloh14:
	adrp	x8, _NVME_CMBSZ_WDS@GOTPAGE
Lloh15:
	ldr	x8, [x8, _NVME_CMBSZ_WDS@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
Lloh17:
	adrp	x10, _NVME_CMBSZ_RDS@GOTPAGE
Lloh18:
	ldr	x10, [x10, _NVME_CMBSZ_RDS@GOTPAGEOFF]
Lloh19:
	ldr	w10, [x10]
	orr	w8, w10, w8
	bics	wzr, w8, w9
	b.ne	LBB0_8
; %bb.7:
	mov	x0, x20
	mov	w1, #1
	bl	_pci_p2pmem_publish
LBB0_8:
	ldr	x0, [x19, #16]!
Lloh20:
	adrp	x1, _dev_attr_cmb@GOTPAGE
Lloh21:
	ldr	x1, [x1, _dev_attr_cmb@GOTPAGEOFF]
	mov	x2, #0
	bl	_sysfs_add_file_to_group
	cbz	x0, LBB0_1
; %bb.9:
Lloh22:
	adrp	x1, l_.str.1@PAGE
Lloh23:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_10:
	ldr	x0, [x19]
	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
	b	_dev_warn
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_NVME_REG_CMBSZ,8,3             ; @NVME_REG_CMBSZ
	.comm	_NVME_REG_CMBLOC,8,3            ; @NVME_REG_CMBLOC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to register the CMB\n"

	.comm	_use_cmb_sqes,8,3               ; @use_cmb_sqes
	.comm	_NVME_CMBSZ_SQS,4,2             ; @NVME_CMBSZ_SQS
	.comm	_NVME_CMBSZ_WDS,4,2             ; @NVME_CMBSZ_WDS
	.comm	_NVME_CMBSZ_RDS,4,2             ; @NVME_CMBSZ_RDS
	.comm	_dev_attr_cmb,4,2               ; @dev_attr_cmb
l_.str.1:                               ; @.str.1
	.asciz	"failed to add sysfs attribute for CMB\n"

	.no_dead_strip	_nvme_map_cmb
.subsections_via_symbols
