1 /*
2  * Copyright (C) 2009 Lemote Inc.
3  * Author: Wu Zhangjin, wuzhangjin@gmail.com
4  *
5  * This program is free software; you can redistribute	it and/or modify it
6  * under  the terms of	the GNU General	 Public License as published by the
7  * Free Software Foundation;  either version 2 of the  License, or (at your
8  * option) any later version.
9  */
10 
11 #include <linux/bootmem.h>
12 #include <asm/bootinfo.h>
13 #include <asm/traps.h>
14 #include <asm/smp-ops.h>
15 #include <asm/cacheflush.h>
16 
17 #include <loongson.h>
18 
19 /* Loongson CPU address windows config space base address */
20 unsigned long __maybe_unused _loongson_addrwincfg_base;
21 
mips_nmi_setup(void)22 static void __init mips_nmi_setup(void)
23 {
24 	void *base;
25 	extern char except_vec_nmi;
26 
27 	base = (void *)(CAC_BASE + 0x380);
28 	memcpy(base, &except_vec_nmi, 0x80);
29 	flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
30 }
31 
prom_init(void)32 void __init prom_init(void)
33 {
34 #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
35 	_loongson_addrwincfg_base = (unsigned long)
36 		ioremap(LOONGSON_ADDRWINCFG_BASE, LOONGSON_ADDRWINCFG_SIZE);
37 #endif
38 
39 	prom_init_cmdline();
40 	prom_init_env();
41 
42 	/* init base address of io space */
43 	set_io_port_base((unsigned long)
44 		ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE));
45 
46 #ifdef CONFIG_NUMA
47 	prom_init_numa_memory();
48 #else
49 	prom_init_memory();
50 #endif
51 
52 	/*init the uart base address */
53 	prom_init_uart_base();
54 	register_smp_ops(&loongson3_smp_ops);
55 	board_nmi_handler_setup = mips_nmi_setup;
56 }
57 
prom_free_prom_memory(void)58 void __init prom_free_prom_memory(void)
59 {
60 }
61