	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pci_ptm_init                   ## -- Begin function pci_ptm_init
	.p2align	4, 0x90
_pci_ptm_init:                          ## @pci_ptm_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	callq	_pci_is_pcie
	testl	%eax, %eax
	je	LBB0_14
## %bb.1:
	movq	_PCI_EXT_CAP_ID_PTM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_pci_find_ext_capability
	testl	%eax, %eax
	je	LBB0_14
## %bb.2:
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_pci_pcie_type
	movq	_PCI_EXP_TYPE_ENDPOINT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_14
## %bb.3:
	movq	%r15, %rdi
	callq	_pci_pcie_type
	movq	_PCI_EXP_TYPE_RC_END@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_14
## %bb.4:
	movslq	%ebx, %r14
	movq	_PCI_PTM_CAP@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	%r14, %rsi
	leaq	-28(%rbp), %rdx
	movq	%r15, %rdi
	callq	_pci_read_config_dword
	movq	_PCI_PTM_GRANULARITY_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	andl	-28(%rbp), %ebx
	sarl	$8, %ebx
	movq	%r15, %rdi
	callq	_pci_upstream_bridge
	testq	%rax, %rax
	je	LBB0_11
## %bb.5:
	cmpl	$0, (%rax)
	je	LBB0_11
## %bb.6:
	movq	_PCI_PTM_CTRL_ENABLE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	4(%rax), %edx
	testl	%edx, %edx
	je	LBB0_7
## %bb.8:
	cmpl	%ebx, %edx
	jle	LBB0_9
## %bb.10:
	movl	%edx, 4(%r15)
	jmp	LBB0_13
LBB0_11:
	movq	_PCI_PTM_CAP_ROOT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, -28(%rbp)
	je	LBB0_14
## %bb.12:
	movq	_PCI_PTM_CTRL_ENABLE@GOTPCREL(%rip), %rax
	movq	_PCI_PTM_CTRL_ROOT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movl	$1, 8(%r15)
	movl	%ebx, 4(%r15)
	movl	%ebx, %edx
	jmp	LBB0_13
LBB0_7:
	movl	$0, 4(%r15)
	xorl	%edx, %edx
	jmp	LBB0_13
LBB0_9:
	movl	4(%r15), %edx
LBB0_13:
	shll	$8, %edx
	orl	%ecx, %edx
	movq	_PCI_PTM_CTRL@GOTPCREL(%rip), %rax
	addq	(%rax), %r14
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_pci_write_config_dword
	movl	$1, (%r15)
	movq	%r15, %rdi
	callq	_pci_ptm_info
LBB0_14:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PCI_EXT_CAP_ID_PTM,4,2         ## @PCI_EXT_CAP_ID_PTM
	.comm	_PCI_EXP_TYPE_ENDPOINT,8,3      ## @PCI_EXP_TYPE_ENDPOINT
	.comm	_PCI_EXP_TYPE_RC_END,8,3        ## @PCI_EXP_TYPE_RC_END
	.comm	_PCI_PTM_CAP,8,3                ## @PCI_PTM_CAP
	.comm	_PCI_PTM_GRANULARITY_MASK,4,2   ## @PCI_PTM_GRANULARITY_MASK
	.comm	_PCI_PTM_CTRL_ENABLE,4,2        ## @PCI_PTM_CTRL_ENABLE
	.comm	_PCI_PTM_CAP_ROOT,4,2           ## @PCI_PTM_CAP_ROOT
	.comm	_PCI_PTM_CTRL_ROOT,4,2          ## @PCI_PTM_CTRL_ROOT
	.comm	_PCI_PTM_CTRL,8,3               ## @PCI_PTM_CTRL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pci_ptm_init                   ; -- Begin function pci_ptm_init
	.p2align	2
_pci_ptm_init:                          ; @pci_ptm_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
	bl	_pci_is_pcie
	cbz	w0, LBB0_14
; %bb.1:
Lloh0:
	adrp	x8, _PCI_EXT_CAP_ID_PTM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PCI_EXT_CAP_ID_PTM@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_pci_find_ext_capability
	cbz	w0, LBB0_14
; %bb.2:
	mov	x20, x0
	mov	x0, x19
	bl	_pci_pcie_type
Lloh3:
	adrp	x8, _PCI_EXP_TYPE_ENDPOINT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PCI_EXP_TYPE_ENDPOINT@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	x0, x8
	b.eq	LBB0_14
; %bb.3:
	mov	x0, x19
	bl	_pci_pcie_type
Lloh6:
	adrp	x8, _PCI_EXP_TYPE_RC_END@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PCI_EXP_TYPE_RC_END@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	cmp	x0, x8
	b.eq	LBB0_14
; %bb.4:
	sxtw	x20, w20
Lloh9:
	adrp	x8, _PCI_PTM_CAP@GOTPAGE
Lloh10:
	ldr	x8, [x8, _PCI_PTM_CAP@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	add	x1, x8, x20
	add	x2, sp, #12
	mov	x0, x19
	bl	_pci_read_config_dword
	ldr	w8, [sp, #12]
Lloh12:
	adrp	x9, _PCI_PTM_GRANULARITY_MASK@GOTPAGE
Lloh13:
	ldr	x9, [x9, _PCI_PTM_GRANULARITY_MASK@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	and	w8, w9, w8
	asr	w21, w8, #8
	mov	x0, x19
	bl	_pci_upstream_bridge
	cbz	x0, LBB0_9
; %bb.5:
	ldr	w8, [x0]
	cbz	w8, LBB0_9
; %bb.6:
Lloh15:
	adrp	x8, _PCI_PTM_CTRL_ENABLE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PCI_PTM_CTRL_ENABLE@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	ldr	w9, [x0, #4]
	cbz	w9, LBB0_11
; %bb.7:
	cmp	w9, w21
	b.le	LBB0_12
; %bb.8:
	str	w9, [x19, #4]
	b	LBB0_13
LBB0_9:
	ldr	w8, [sp, #12]
Lloh18:
	adrp	x9, _PCI_PTM_CAP_ROOT@GOTPAGE
Lloh19:
	ldr	x9, [x9, _PCI_PTM_CAP_ROOT@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.10:
Lloh21:
	adrp	x8, _PCI_PTM_CTRL_ENABLE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _PCI_PTM_CTRL_ENABLE@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
Lloh24:
	adrp	x9, _PCI_PTM_CTRL_ROOT@GOTPAGE
Lloh25:
	ldr	x9, [x9, _PCI_PTM_CTRL_ROOT@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	orr	w8, w9, w8
	mov	w9, #1
	stp	w21, w9, [x19, #4]
	mov	x9, x21
	b	LBB0_13
LBB0_11:
	str	wzr, [x19, #4]
	b	LBB0_13
LBB0_12:
	ldr	w9, [x19, #4]
LBB0_13:
	orr	w2, w8, w9, lsl #8
Lloh27:
	adrp	x8, _PCI_PTM_CTRL@GOTPAGE
Lloh28:
	ldr	x8, [x8, _PCI_PTM_CTRL@GOTPAGEOFF]
Lloh29:
	ldr	x8, [x8]
	add	x1, x8, x20
	mov	x0, x19
	bl	_pci_write_config_dword
	mov	w8, #1
	str	w8, [x19]
	mov	x0, x19
	bl	_pci_ptm_info
LBB0_14:
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_PCI_EXT_CAP_ID_PTM,4,2         ; @PCI_EXT_CAP_ID_PTM
	.comm	_PCI_EXP_TYPE_ENDPOINT,8,3      ; @PCI_EXP_TYPE_ENDPOINT
	.comm	_PCI_EXP_TYPE_RC_END,8,3        ; @PCI_EXP_TYPE_RC_END
	.comm	_PCI_PTM_CAP,8,3                ; @PCI_PTM_CAP
	.comm	_PCI_PTM_GRANULARITY_MASK,4,2   ; @PCI_PTM_GRANULARITY_MASK
	.comm	_PCI_PTM_CTRL_ENABLE,4,2        ; @PCI_PTM_CTRL_ENABLE
	.comm	_PCI_PTM_CAP_ROOT,4,2           ; @PCI_PTM_CAP_ROOT
	.comm	_PCI_PTM_CTRL_ROOT,4,2          ; @PCI_PTM_CTRL_ROOT
	.comm	_PCI_PTM_CTRL,8,3               ; @PCI_PTM_CTRL
.subsections_via_symbols
