	.file	"extr_sbbc.c_sbbc_pci_attach.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"/chosen"
.LC1:
	.string	"failed to find /chosen\n"
.LC2:
	.string	"iosram"
.LC3:
	.string	"failed to get iosram\n"
.LC4:
	.string	"failed to allocate resources\n"
.LC5:
	.string	"failed to add UART device\n"
.LC6:
	.string	"failed to attach UART device\n"
.LC7:
	.string	"failed to parse TOC\n"
.LC8:
	.string	"invalid TOD magic %#x\n"
.LC9:
	.string	"invalid TOD version %#x\n"
.LC10:
	.string	"current time: %ld.%09ld\n"
	.text
	.p2align 4
	.type	sbbc_pci_attach, @function
sbbc_pci_attach:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	mov	rbp, rdi
	lea	rdi, .LC0[rip]
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	sub	rsp, 48
	.cfi_def_cfa_offset 80
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 40[rsp], rax
	xor	eax, eax
	call	OF_finddevice@PLT
	mov	DWORD PTR 8[rsp], eax
	cmp	eax, -1
	je	.L25
	mov	edi, eax
	lea	rdx, 8[rsp]
	mov	ecx, 4
	lea	rsi, .LC2[rip]
	call	OF_getprop@PLT
	cmp	eax, -1
	je	.L26
	mov	rdi, rbp
	call	ofw_bus_get_node@PLT
	cmp	eax, DWORD PTR 8[rsp]
	je	.L5
.L23:
	xor	r12d, r12d
.L1:
	mov	rax, QWORD PTR 40[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L27
	add	rsp, 48
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	mov	rdi, rbp
	call	device_get_softc@PLT
	mov	ecx, DWORD PTR RF_ACTIVE[rip]
	mov	esi, DWORD PTR SYS_RES_MEMORY[rip]
	mov	rdi, rbp
	mov	rbx, rax
	mov	eax, DWORD PTR SBBC_PCI_BAR[rip]
	lea	rdx, 12[rsp]
	mov	DWORD PTR 12[rsp], eax
	call	bus_alloc_resource_any@PLT
	mov	QWORD PTR [rbx], rax
	mov	rdi, rax
	test	rax, rax
	je	.L28
	call	rman_get_bustag@PLT
	mov	rdi, QWORD PTR [rbx]
	mov	r12d, eax
	call	rman_get_bushandle@PLT
	cmp	QWORD PTR sbbc_console[rip], 0
	mov	esi, eax
	je	.L7
	mov	rdi, rbp
	call	pci_get_intpin@PLT
	test	rax, rax
	je	.L29
.L8:
	xor	esi, esi
	mov	edx, -1
	mov	rdi, rbp
	call	device_add_child@PLT
	test	rax, rax
	je	.L30
.L9:
	mov	rdi, rbp
	call	bus_generic_attach@PLT
	test	eax, eax
	jne	.L31
.L11:
	cmp	QWORD PTR sbbc_toddata[rip], 0
	je	.L23
	mov	edi, DWORD PTR tod_magic[rip]
	call	SBBC_TOD_OFF@PLT
	add	rax, QWORD PTR sbbc_toddata[rip]
	mov	rdi, rax
	call	SBBC_SRAM_READ_4@PLT
	cmp	DWORD PTR SBBC_TOD_MAGIC[rip], eax
	mov	edx, eax
	je	.L13
	lea	rsi, .LC8[rip]
	mov	rdi, rbp
	xor	eax, eax
	xor	r12d, r12d
	call	device_printf@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L25:
	lea	rsi, .LC1[rip]
	mov	rdi, rbp
	xor	eax, eax
	call	device_printf@PLT
	mov	r12d, DWORD PTR ENXIO[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L26:
	lea	rsi, .LC3[rip]
	mov	rdi, rbp
	xor	eax, eax
	call	device_printf@PLT
	mov	r12d, DWORD PTR ENXIO[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L7:
	mov	edi, r12d
	call	sbbc_parse_toc@PLT
	mov	r12d, eax
	test	eax, eax
	je	.L11
	xor	eax, eax
	lea	rsi, .LC7[rip]
	mov	rdi, rbp
	call	device_printf@PLT
	cmp	QWORD PTR sbbc_console[rip], 0
	je	.L11
	mov	rcx, QWORD PTR [rbx]
	mov	edx, DWORD PTR 12[rsp]
	mov	rdi, rbp
	mov	esi, DWORD PTR SYS_RES_MEMORY[rip]
	call	bus_release_resource@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L28:
	lea	rsi, .LC4[rip]
	mov	rdi, rbp
	xor	eax, eax
	call	device_printf@PLT
	mov	r12d, DWORD PTR ENXIO[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L13:
	mov	edi, DWORD PTR tod_version[rip]
	call	SBBC_TOD_OFF@PLT
	add	rax, QWORD PTR sbbc_toddata[rip]
	mov	rdi, rax
	call	SBBC_SRAM_READ_4@PLT
	cmp	DWORD PTR SBBC_TOD_VERSION[rip], eax
	mov	edx, eax
	jle	.L14
	lea	rsi, .LC9[rip]
	mov	rdi, rbp
	xor	eax, eax
	xor	r12d, r12d
	call	device_printf@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L31:
	lea	rsi, .LC6[rip]
	mov	rdi, rbp
	xor	eax, eax
	call	device_printf@PLT
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L29:
	mov	esi, 1
	mov	rdi, rbp
	call	pci_set_intpin@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L30:
	lea	rsi, .LC5[rip]
	mov	rdi, rbp
	call	device_printf@PLT
	jmp	.L9
.L14:
	mov	esi, 1000000
	mov	rdi, rbp
	call	clock_register@PLT
	cmp	QWORD PTR bootverbose[rip], 0
	je	.L23
	lea	rsi, 16[rsp]
	mov	rdi, rbp
	call	sbbc_tod_gettime@PLT
	mov	ecx, DWORD PTR 16[rsp]
	mov	rdx, QWORD PTR 24[rsp]
	xor	eax, eax
	lea	rsi, .LC10[rip]
	mov	rdi, rbp
	call	device_printf@PLT
	jmp	.L23
.L27:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	sbbc_pci_attach, .-sbbc_pci_attach
	.comm	tod_version,4,4
	.comm	tod_magic,4,4
	.comm	sbbc_toddata,8,8
	.comm	sbbc_console,8,8
	.comm	bootverbose,8,8
	.comm	SYS_RES_MEMORY,4,4
	.comm	SBBC_TOD_VERSION,4,4
	.comm	SBBC_TOD_MAGIC,4,4
	.comm	SBBC_PCI_BAR,4,4
	.comm	RF_ACTIVE,4,4
	.comm	ENXIO,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_sbbc.c_sbbc_pci_attach.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"/chosen\000"
	.align	2
.LC1:
	.ascii	"failed to find /chosen\012\000"
	.align	2
.LC2:
	.ascii	"iosram\000"
	.align	2
.LC3:
	.ascii	"failed to get iosram\012\000"
	.align	2
.LC4:
	.ascii	"failed to allocate resources\012\000"
	.align	2
.LC5:
	.ascii	"failed to add UART device\012\000"
	.align	2
.LC6:
	.ascii	"failed to attach UART device\012\000"
	.align	2
.LC7:
	.ascii	"failed to parse TOC\012\000"
	.align	2
.LC8:
	.ascii	"invalid TOD magic %#x\012\000"
	.align	2
.LC9:
	.ascii	"invalid TOD version %#x\012\000"
	.align	2
.LC10:
	.ascii	"current time: %ld.%09ld\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC11:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	sbbc_pci_attach, %function
sbbc_pci_attach:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	ldr	r3, .L41
	sub	sp, sp, #24
	mov	r4, r0
	ldr	r0, .L41+4
	ldr	r3, [r3]
	str	r3, [sp, #20]
	mov	r3,#0
	bl	OF_finddevice
	cmn	r0, #1
	str	r0, [sp, #4]
	beq	.L34
	mov	r3, #4
	ldr	r1, .L41+8
	add	r2, sp, r3
	bl	OF_getprop
	cmn	r0, #1
	mov	r0, r4
	beq	.L35
	bl	ofw_bus_get_node
	ldr	r3, [sp, #4]
	cmp	r0, r3
	beq	.L5
.L32:
	mov	r5, #0
.L1:
	ldr	r3, .L41
	ldr	r2, [r3]
	ldr	r3, [sp, #20]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L36
	mov	r0, r5
	add	sp, sp, #24
	@ sp needed
	pop	{r4, r5, r6, r7, r8, pc}
.L5:
	mov	r0, r4
	bl	device_get_softc
	ldr	r2, .L41+12
	ldr	r3, .L41+16
	ldr	r7, .L41+20
	ldr	ip, [r2]
	mov	r6, r0
	ldr	r3, [r3]
	mov	r0, r4
	ldr	r1, [r7]
	add	r2, sp, #8
	str	ip, [sp, #8]
	bl	bus_alloc_resource_any
	cmp	r0, #0
	str	r0, [r6]
	beq	.L37
	bl	rman_get_bustag
	mov	r5, r0
	ldr	r0, [r6]
	bl	rman_get_bushandle
	ldr	r8, .L41+24
	mov	r1, r0
	ldr	r3, [r8]
	cmp	r3, #0
	beq	.L7
	mov	r0, r4
	bl	pci_get_intpin
	cmp	r0, #0
	beq	.L38
.L8:
	mvn	r2, #0
	mov	r1, #0
	mov	r0, r4
	bl	device_add_child
	cmp	r0, #0
	beq	.L39
.L9:
	mov	r0, r4
	bl	bus_generic_attach
	cmp	r0, #0
	bne	.L40
.L11:
	ldr	r5, .L41+28
	ldr	r3, [r5]
	cmp	r3, #0
	beq	.L32
	ldr	r3, .L41+32
	ldr	r0, [r3]
	bl	SBBC_TOD_OFF
	ldr	r3, [r5]
	add	r0, r0, r3
	bl	SBBC_SRAM_READ_4
	ldr	r3, .L41+36
	mov	r2, r0
	ldr	r3, [r3]
	cmp	r3, r0
	beq	.L13
	mov	r0, r4
	ldr	r1, .L41+40
	bl	device_printf
	mov	r5, #0
	b	.L1
.L34:
	mov	r0, r4
	ldr	r1, .L41+44
	bl	device_printf
	ldr	r3, .L41+48
	ldr	r5, [r3]
	b	.L1
.L35:
	ldr	r1, .L41+52
	bl	device_printf
	ldr	r3, .L41+48
	ldr	r5, [r3]
	b	.L1
.L7:
	mov	r0, r5
	bl	sbbc_parse_toc
	subs	r5, r0, #0
	beq	.L11
	mov	r0, r4
	ldr	r1, .L41+56
	bl	device_printf
	ldr	r3, [r8]
	cmp	r3, #0
	beq	.L11
	mov	r0, r4
	ldr	r3, [r6]
	ldr	r1, [r7]
	ldr	r2, [sp, #8]
	bl	bus_release_resource
	b	.L1
.L37:
	mov	r0, r4
	ldr	r1, .L41+60
	bl	device_printf
	ldr	r3, .L41+48
	ldr	r5, [r3]
	b	.L1
.L13:
	ldr	r3, .L41+64
	ldr	r0, [r3]
	bl	SBBC_TOD_OFF
	ldr	r3, [r5]
	add	r0, r0, r3
	bl	SBBC_SRAM_READ_4
	ldr	r3, .L41+68
	mov	r2, r0
	ldr	r3, [r3]
	cmp	r3, r0
	ble	.L14
	mov	r0, r4
	ldr	r1, .L41+72
	bl	device_printf
	mov	r5, #0
	b	.L1
.L40:
	mov	r0, r4
	ldr	r1, .L41+76
	bl	device_printf
	b	.L11
.L38:
	mov	r1, #1
	mov	r0, r4
	bl	pci_set_intpin
	b	.L8
.L39:
	mov	r0, r4
	ldr	r1, .L41+80
	bl	device_printf
	b	.L9
.L14:
	mov	r0, r4
	ldr	r1, .L41+84
	bl	clock_register
	ldr	r3, .L41+88
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L32
	add	r1, sp, #12
	mov	r0, r4
	bl	sbbc_tod_gettime
	mov	r0, r4
	ldr	r3, [sp, #12]
	ldr	r2, [sp, #16]
	ldr	r1, .L41+92
	bl	device_printf
	b	.L32
.L36:
	bl	__stack_chk_fail
.L42:
	.align	2
.L41:
	.word	.LC11
	.word	.LC0
	.word	.LC2
	.word	SBBC_PCI_BAR
	.word	RF_ACTIVE
	.word	SYS_RES_MEMORY
	.word	sbbc_console
	.word	sbbc_toddata
	.word	tod_magic
	.word	SBBC_TOD_MAGIC
	.word	.LC8
	.word	.LC1
	.word	ENXIO
	.word	.LC3
	.word	.LC7
	.word	.LC4
	.word	tod_version
	.word	SBBC_TOD_VERSION
	.word	.LC9
	.word	.LC6
	.word	.LC5
	.word	1000000
	.word	bootverbose
	.word	.LC10
	.size	sbbc_pci_attach, .-sbbc_pci_attach
	.comm	tod_version,4,4
	.comm	tod_magic,4,4
	.comm	sbbc_toddata,4,4
	.comm	sbbc_console,4,4
	.comm	bootverbose,4,4
	.comm	SYS_RES_MEMORY,4,4
	.comm	SBBC_TOD_VERSION,4,4
	.comm	SBBC_TOD_MAGIC,4,4
	.comm	SBBC_PCI_BAR,4,4
	.comm	RF_ACTIVE,4,4
	.comm	ENXIO,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
