	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bcma_bus_register              ## -- Begin function bcma_bus_register
	.p2align	4, 0x90
_bcma_bus_register:                     ## @bcma_bus_register
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movq	_bcma_buses_mutex@GOTPCREL(%rip), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	_bcma_bus_next_num@GOTPCREL(%rip), %rax
	movslq	(%rax), %rcx
	leal	1(%rcx), %edx
	movl	%edx, (%rax)
	movq	%rcx, 32(%rbx)
	movq	%r14, %rdi
	callq	_mutex_unlock
	movq	%rbx, %rdi
	callq	_bcma_bus_scan
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_bcma_err
	movl	$-1, %eax
	jmp	LBB0_19
LBB0_2:
	movq	%rbx, %rdi
	callq	_bcma_cc_core_id
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_bcma_find_core
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	leaq	24(%rbx), %rdi
	movq	%rax, 24(%rbx)
	callq	_bcma_core_chipcommon_early_init
LBB0_4:
	movq	%rbx, %rdi
	callq	_bcma_sprom_get
	movq	_ENOENT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	addl	%eax, %ecx
	jne	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	_bcma_err
	jmp	LBB0_8
LBB0_6:
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	leaq	L_.str.2(%rip), %rsi
	movq	%rbx, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_bcma_err
LBB0_8:
	movq	%rbx, %rdi
	callq	_bcma_cc_core_id
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_bcma_find_core
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	leaq	24(%rbx), %rdi
	movq	%rax, 24(%rbx)
	callq	_bcma_core_chipcommon_init
LBB0_10:
	movq	_BCMA_CORE_MIPS_74K@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_bcma_find_core
	testq	%rax, %rax
	je	LBB0_12
## %bb.11:
	leaq	16(%rbx), %rdi
	movq	%rax, 16(%rbx)
	callq	_bcma_core_mips_init
LBB0_12:
	movq	_BCMA_CORE_PCIE@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_bcma_find_core_unit
	testq	%rax, %rax
	je	LBB0_14
## %bb.13:
	movq	8(%rbx), %rdi
	movq	%rax, (%rdi)
	callq	_bcma_core_pci_init
LBB0_14:
	movl	(%r14), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_bcma_find_core_unit
	testq	%rax, %rax
	je	LBB0_16
## %bb.15:
	movq	8(%rbx), %rdi
	movq	%rax, 8(%rdi)
	addq	$8, %rdi
	callq	_bcma_core_pci_init
LBB0_16:
	movq	_BCMA_CORE_4706_MAC_GBIT_COMMON@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_bcma_find_core
	testq	%rax, %rax
	je	LBB0_18
## %bb.17:
	movq	%rax, (%rbx)
	movq	%rbx, %rdi
	callq	_bcma_core_gmac_cmn_init
LBB0_18:
	movq	%rbx, %rdi
	callq	_bcma_register_cores
	leaq	L_.str.3(%rip), %rsi
	movq	%rbx, %rdi
	callq	_bcma_info
	xorl	%eax, %eax
LBB0_19:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_bcma_buses_mutex,4,2           ## @bcma_buses_mutex
	.comm	_bcma_bus_next_num,4,2          ## @bcma_bus_next_num
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to scan: %d\n"

	.comm	_ENOENT,4,2                     ## @ENOENT
L_.str.1:                               ## @.str.1
	.asciz	"No SPROM available\n"

L_.str.2:                               ## @.str.2
	.asciz	"Failed to get SPROM: %d\n"

	.comm	_BCMA_CORE_MIPS_74K,4,2         ## @BCMA_CORE_MIPS_74K
	.comm	_BCMA_CORE_PCIE,4,2             ## @BCMA_CORE_PCIE
	.comm	_BCMA_CORE_4706_MAC_GBIT_COMMON,4,2 ## @BCMA_CORE_4706_MAC_GBIT_COMMON
L_.str.3:                               ## @.str.3
	.asciz	"Bus registered\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bcma_bus_register              ; -- Begin function bcma_bus_register
	.p2align	2
_bcma_bus_register:                     ; @bcma_bus_register
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh0:
	adrp	x20, _bcma_buses_mutex@GOTPAGE
Lloh1:
	ldr	x20, [x20, _bcma_buses_mutex@GOTPAGEOFF]
	mov	x0, x20
	bl	_mutex_lock
Lloh2:
	adrp	x8, _bcma_bus_next_num@GOTPAGE
Lloh3:
	ldr	x8, [x8, _bcma_bus_next_num@GOTPAGEOFF]
	ldrsw	x9, [x8]
	add	w10, w9, #1
	str	w10, [x8]
	str	x9, [x19, #32]
	mov	x0, x20
	bl	_mutex_unlock
	mov	x0, x19
	bl	_bcma_bus_scan
                                        ; kill: def $w0 killed $w0 def $x0
	cbz	w0, LBB0_2
; %bb.1:
	str	x0, [sp]
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_bcma_err
	mov	w0, #-1
	b	LBB0_20
LBB0_2:
	mov	x0, x19
	bl	_bcma_cc_core_id
	mov	x1, x0
	mov	x0, x19
	bl	_bcma_find_core
	cbz	x0, LBB0_4
; %bb.3:
	mov	x8, x19
	str	x0, [x8, #24]!
	mov	x0, x8
	bl	_bcma_core_chipcommon_early_init
LBB0_4:
	mov	x0, x19
	bl	_bcma_sprom_get
                                        ; kill: def $w0 killed $w0 def $x0
Lloh6:
	adrp	x8, _ENOENT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmn	w0, w8
	b.ne	LBB0_6
; %bb.5:
Lloh9:
	adrp	x1, l_.str.1@PAGE
Lloh10:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_8
LBB0_6:
	cbz	w0, LBB0_9
; %bb.7:
	str	x0, [sp]
Lloh11:
	adrp	x1, l_.str.2@PAGE
Lloh12:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_8:
	mov	x0, x19
	bl	_bcma_err
LBB0_9:
	mov	x0, x19
	bl	_bcma_cc_core_id
	mov	x1, x0
	mov	x0, x19
	bl	_bcma_find_core
	cbz	x0, LBB0_11
; %bb.10:
	mov	x8, x19
	str	x0, [x8, #24]!
	mov	x0, x8
	bl	_bcma_core_chipcommon_init
LBB0_11:
Lloh13:
	adrp	x8, _BCMA_CORE_MIPS_74K@GOTPAGE
Lloh14:
	ldr	x8, [x8, _BCMA_CORE_MIPS_74K@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_bcma_find_core
	cbz	x0, LBB0_13
; %bb.12:
	mov	x8, x19
	str	x0, [x8, #16]!
	mov	x0, x8
	bl	_bcma_core_mips_init
LBB0_13:
Lloh16:
	adrp	x20, _BCMA_CORE_PCIE@GOTPAGE
Lloh17:
	ldr	x20, [x20, _BCMA_CORE_PCIE@GOTPAGEOFF]
	ldr	w1, [x20]
	mov	x0, x19
	mov	w2, #0
	bl	_bcma_find_core_unit
	cbz	x0, LBB0_15
; %bb.14:
	ldr	x8, [x19, #8]
	str	x0, [x8]
	mov	x0, x8
	bl	_bcma_core_pci_init
LBB0_15:
	ldr	w1, [x20]
	mov	x0, x19
	mov	w2, #1
	bl	_bcma_find_core_unit
	cbz	x0, LBB0_17
; %bb.16:
	ldr	x8, [x19, #8]
	str	x0, [x8, #8]!
	mov	x0, x8
	bl	_bcma_core_pci_init
LBB0_17:
Lloh18:
	adrp	x8, _BCMA_CORE_4706_MAC_GBIT_COMMON@GOTPAGE
Lloh19:
	ldr	x8, [x8, _BCMA_CORE_4706_MAC_GBIT_COMMON@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_bcma_find_core
	cbz	x0, LBB0_19
; %bb.18:
	str	x0, [x19]
	mov	x0, x19
	bl	_bcma_core_gmac_cmn_init
LBB0_19:
	mov	x0, x19
	bl	_bcma_register_cores
Lloh21:
	adrp	x1, l_.str.3@PAGE
Lloh22:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_bcma_info
	mov	w0, #0
LBB0_20:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_bcma_buses_mutex,4,2           ; @bcma_buses_mutex
	.comm	_bcma_bus_next_num,4,2          ; @bcma_bus_next_num
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to scan: %d\n"

	.comm	_ENOENT,4,2                     ; @ENOENT
l_.str.1:                               ; @.str.1
	.asciz	"No SPROM available\n"

l_.str.2:                               ; @.str.2
	.asciz	"Failed to get SPROM: %d\n"

	.comm	_BCMA_CORE_MIPS_74K,4,2         ; @BCMA_CORE_MIPS_74K
	.comm	_BCMA_CORE_PCIE,4,2             ; @BCMA_CORE_PCIE
	.comm	_BCMA_CORE_4706_MAC_GBIT_COMMON,4,2 ; @BCMA_CORE_4706_MAC_GBIT_COMMON
l_.str.3:                               ; @.str.3
	.asciz	"Bus registered\n"

.subsections_via_symbols
