xref: /linux/arch/mips/loongson64/init.c (revision 2c97b5ae83dca56718774e7b4bf9640f05d11867)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2009 Lemote Inc.
4  * Author: Wu Zhangjin, wuzhangjin@gmail.com
5  */
6 
7 #include <linux/memblock.h>
8 #include <asm/bootinfo.h>
9 #include <asm/traps.h>
10 #include <asm/smp-ops.h>
11 #include <asm/cacheflush.h>
12 #include <asm/fw/fw.h>
13 
14 #include <loongson.h>
15 
16 static void __init mips_nmi_setup(void)
17 {
18 	void *base;
19 	extern char except_vec_nmi;
20 
21 	base = (void *)(CAC_BASE + 0x380);
22 	memcpy(base, &except_vec_nmi, 0x80);
23 	flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
24 }
25 
26 void __init prom_init(void)
27 {
28 	fw_init_cmdline();
29 	prom_init_env();
30 
31 	/* init base address of io space */
32 	set_io_port_base((unsigned long)
33 		ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE));
34 
35 	prom_init_numa_memory();
36 
37 	/* Hardcode to CPU UART 0 */
38 	setup_8250_early_printk_port(TO_UNCAC(LOONGSON_REG_BASE + 0x1e0), 0, 1024);
39 
40 	register_smp_ops(&loongson3_smp_ops);
41 	board_nmi_handler_setup = mips_nmi_setup;
42 }
43 
44 void __init prom_free_prom_memory(void)
45 {
46 }
47