aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2013-05-07 19:27:46 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-05-07 19:27:46 -0400
commit9b3539e0e545e4c2f338acfc1ce52033a6f5e7f7 (patch)
tree5c56e4a208dbe7e985e59911e1a421a7c1ee024c /arch/mips/kernel
parent3d39019a1655d195a60a86ebf38f9da30bd83d03 (diff)
parent1cd1c049271233deccfcc75123afa7f39a607f5a (diff)
Merge branch 'mips-next-3.10' of git://git.linux-mips.org/pub/scm/john/linux-john into mips-for-linux-next
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/Makefile29
-rw-r--r--arch/mips/kernel/cpu-probe.c6
-rw-r--r--arch/mips/kernel/mcount.S11
-rw-r--r--arch/mips/kernel/mips_machine.c22
-rw-r--r--arch/mips/kernel/proc.c4
-rw-r--r--arch/mips/kernel/prom.c33
-rw-r--r--arch/mips/kernel/setup.c22
-rw-r--r--arch/mips/kernel/traps.c2
8 files changed, 75 insertions, 54 deletions
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index f81d98f6184c..cdb87b2a423d 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -5,7 +5,7 @@
5extra-y := head.o vmlinux.lds 5extra-y := head.o vmlinux.lds
6 6
7obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ 7obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
8 ptrace.o reset.o setup.o signal.o syscall.o \ 8 prom.o ptrace.o reset.o setup.o signal.o syscall.o \
9 time.o topology.o traps.o unaligned.o watch.o vdso.o 9 time.o topology.o traps.o unaligned.o watch.o vdso.o
10 10
11ifdef CONFIG_FUNCTION_TRACER 11ifdef CONFIG_FUNCTION_TRACER
@@ -86,8 +86,6 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
86obj-$(CONFIG_SPINLOCK_TEST) += spinlock_test.o 86obj-$(CONFIG_SPINLOCK_TEST) += spinlock_test.o
87obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o 87obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o
88 88
89obj-$(CONFIG_OF) += prom.o
90
91CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -x c /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) 89CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -x c /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
92 90
93obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o 91obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
@@ -100,29 +98,16 @@ obj-$(CONFIG_HW_PERF_EVENTS) += perf_event_mipsxx.o
100obj-$(CONFIG_JUMP_LABEL) += jump_label.o 98obj-$(CONFIG_JUMP_LABEL) += jump_label.o
101 99
102# 100#
103# DSP ASE supported for MIPS32 or MIPS64 Release 2 cores only. It is safe 101# DSP ASE supported for MIPS32 or MIPS64 Release 2 cores only. It is not
104# to enable DSP assembler support here even if the MIPS Release 2 CPU we 102# safe to unconditionnaly use the assembler -mdsp / -mdspr2 switches
105# are targetting does not support DSP because all code-paths making use of 103# here because the compiler may use DSP ASE instructions (such as lwx) in
106# it properly check that the running CPU *actually does* support these 104# code paths where we cannot check that the CPU we are running on supports it.
107# instructions. 105# Proper abstraction using HAVE_AS_DSP and macros is done in
106# arch/mips/include/asm/mipsregs.h.
108# 107#
109ifeq ($(CONFIG_CPU_MIPSR2), y) 108ifeq ($(CONFIG_CPU_MIPSR2), y)
110CFLAGS_DSP = -DHAVE_AS_DSP 109CFLAGS_DSP = -DHAVE_AS_DSP
111 110
112#
113# Check if assembler supports DSP ASE
114#
115ifeq ($(call cc-option-yn,-mdsp), y)
116CFLAGS_DSP += -mdsp
117endif
118
119#
120# Check if assembler supports DSP ASE Rev2
121#
122ifeq ($(call cc-option-yn,-mdspr2), y)
123CFLAGS_DSP += -mdspr2
124endif
125
126CFLAGS_signal.o = $(CFLAGS_DSP) 111CFLAGS_signal.o = $(CFLAGS_DSP)
127CFLAGS_signal32.o = $(CFLAGS_DSP) 112CFLAGS_signal32.o = $(CFLAGS_DSP)
128CFLAGS_process.o = $(CFLAGS_DSP) 113CFLAGS_process.o = $(CFLAGS_DSP)
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index d069a19112e8..5fe66a0c3224 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -1227,10 +1227,8 @@ __cpuinit void cpu_probe(void)
1227 if (c->options & MIPS_CPU_FPU) { 1227 if (c->options & MIPS_CPU_FPU) {
1228 c->fpu_id = cpu_get_fpu_id(); 1228 c->fpu_id = cpu_get_fpu_id();
1229 1229
1230 if (c->isa_level == MIPS_CPU_ISA_M32R1 || 1230 if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
1231 c->isa_level == MIPS_CPU_ISA_M32R2 || 1231 MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) {
1232 c->isa_level == MIPS_CPU_ISA_M64R1 ||
1233 c->isa_level == MIPS_CPU_ISA_M64R2) {
1234 if (c->fpu_id & MIPS_FPIR_3D) 1232 if (c->fpu_id & MIPS_FPIR_3D)
1235 c->ases |= MIPS_ASE_MIPS3D; 1233 c->ases |= MIPS_ASE_MIPS3D;
1236 } 1234 }
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 165867673357..33d067148e61 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -46,10 +46,9 @@
46 PTR_L a5, PT_R9(sp) 46 PTR_L a5, PT_R9(sp)
47 PTR_L a6, PT_R10(sp) 47 PTR_L a6, PT_R10(sp)
48 PTR_L a7, PT_R11(sp) 48 PTR_L a7, PT_R11(sp)
49#else
50 PTR_ADDIU sp, PT_SIZE
51#endif 49#endif
52.endm 50 PTR_ADDIU sp, PT_SIZE
51 .endm
53 52
54 .macro RETURN_BACK 53 .macro RETURN_BACK
55 jr ra 54 jr ra
@@ -68,7 +67,11 @@ NESTED(ftrace_caller, PT_SIZE, ra)
68 .globl _mcount 67 .globl _mcount
69_mcount: 68_mcount:
70 b ftrace_stub 69 b ftrace_stub
71 addiu sp,sp,8 70#ifdef CONFIG_32BIT
71 addiu sp,sp,8
72#else
73 nop
74#endif
72 75
73 /* When tracing is activated, it calls ftrace_caller+8 (aka here) */ 76 /* When tracing is activated, it calls ftrace_caller+8 (aka here) */
74 lw t1, function_trace_stop 77 lw t1, function_trace_stop
diff --git a/arch/mips/kernel/mips_machine.c b/arch/mips/kernel/mips_machine.c
index 411a058d2c53..876097529697 100644
--- a/arch/mips/kernel/mips_machine.c
+++ b/arch/mips/kernel/mips_machine.c
@@ -11,9 +11,9 @@
11#include <linux/slab.h> 11#include <linux/slab.h>
12 12
13#include <asm/mips_machine.h> 13#include <asm/mips_machine.h>
14#include <asm/prom.h>
14 15
15static struct mips_machine *mips_machine __initdata; 16static struct mips_machine *mips_machine __initdata;
16static char *mips_machine_name = "Unknown";
17 17
18#define for_each_machine(mach) \ 18#define for_each_machine(mach) \
19 for ((mach) = (struct mips_machine *)&__mips_machines_start; \ 19 for ((mach) = (struct mips_machine *)&__mips_machines_start; \
@@ -21,25 +21,6 @@ static char *mips_machine_name = "Unknown";
21 (unsigned long)(mach) < (unsigned long)&__mips_machines_end; \ 21 (unsigned long)(mach) < (unsigned long)&__mips_machines_end; \
22 (mach)++) 22 (mach)++)
23 23
24__init void mips_set_machine_name(const char *name)
25{
26 char *p;
27
28 if (name == NULL)
29 return;
30
31 p = kstrdup(name, GFP_KERNEL);
32 if (!p)
33 pr_err("MIPS: no memory for machine_name\n");
34
35 mips_machine_name = p;
36}
37
38char *mips_get_machine_name(void)
39{
40 return mips_machine_name;
41}
42
43__init int mips_machtype_setup(char *id) 24__init int mips_machtype_setup(char *id)
44{ 25{
45 struct mips_machine *mach; 26 struct mips_machine *mach;
@@ -79,7 +60,6 @@ __init void mips_machine_setup(void)
79 return; 60 return;
80 61
81 mips_set_machine_name(mips_machine->mach_name); 62 mips_set_machine_name(mips_machine->mach_name);
82 pr_info("MIPS: machine is %s\n", mips_machine_name);
83 63
84 if (mips_machine->mach_setup) 64 if (mips_machine->mach_setup)
85 mips_machine->mach_setup(); 65 mips_machine->mach_setup();
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 135c4aadccbe..1dd137bab5c5 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -12,7 +12,7 @@
12#include <asm/cpu-features.h> 12#include <asm/cpu-features.h>
13#include <asm/mipsregs.h> 13#include <asm/mipsregs.h>
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/mips_machine.h> 15#include <asm/prom.h>
16 16
17unsigned int vced_count, vcei_count; 17unsigned int vced_count, vcei_count;
18 18
@@ -67,7 +67,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
67 if (cpu_has_mips_r) { 67 if (cpu_has_mips_r) {
68 seq_printf(m, "isa\t\t\t:"); 68 seq_printf(m, "isa\t\t\t:");
69 if (cpu_has_mips_1) 69 if (cpu_has_mips_1)
70 seq_printf(m, "%s", "mips1"); 70 seq_printf(m, "%s", " mips1");
71 if (cpu_has_mips_2) 71 if (cpu_has_mips_2)
72 seq_printf(m, "%s", " mips2"); 72 seq_printf(m, "%s", " mips2");
73 if (cpu_has_mips_3) 73 if (cpu_has_mips_3)
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index 028f6f837ef9..5712bb532245 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -23,6 +23,23 @@
23#include <asm/page.h> 23#include <asm/page.h>
24#include <asm/prom.h> 24#include <asm/prom.h>
25 25
26static char mips_machine_name[64] = "Unknown";
27
28__init void mips_set_machine_name(const char *name)
29{
30 if (name == NULL)
31 return;
32
33 strncpy(mips_machine_name, name, sizeof(mips_machine_name));
34 pr_info("MIPS: machine is %s\n", mips_get_machine_name());
35}
36
37char *mips_get_machine_name(void)
38{
39 return mips_machine_name;
40}
41
42#ifdef CONFIG_OF
26int __init early_init_dt_scan_memory_arch(unsigned long node, 43int __init early_init_dt_scan_memory_arch(unsigned long node,
27 const char *uname, int depth, 44 const char *uname, int depth,
28 void *data) 45 void *data)
@@ -50,6 +67,18 @@ void __init early_init_dt_setup_initrd_arch(unsigned long start,
50} 67}
51#endif 68#endif
52 69
70int __init early_init_dt_scan_model(unsigned long node, const char *uname,
71 int depth, void *data)
72{
73 if (!depth) {
74 char *model = of_get_flat_dt_prop(node, "model", NULL);
75
76 if (model)
77 mips_set_machine_name(model);
78 }
79 return 0;
80}
81
53void __init early_init_devtree(void *params) 82void __init early_init_devtree(void *params)
54{ 83{
55 /* Setup flat device-tree pointer */ 84 /* Setup flat device-tree pointer */
@@ -65,6 +94,9 @@ void __init early_init_devtree(void *params)
65 /* Scan memory nodes */ 94 /* Scan memory nodes */
66 of_scan_flat_dt(early_init_dt_scan_root, NULL); 95 of_scan_flat_dt(early_init_dt_scan_root, NULL);
67 of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL); 96 of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL);
97
98 /* try to load the mips machine name */
99 of_scan_flat_dt(early_init_dt_scan_model, NULL);
68} 100}
69 101
70void __init __dt_setup_arch(struct boot_param_header *bph) 102void __init __dt_setup_arch(struct boot_param_header *bph)
@@ -79,3 +111,4 @@ void __init __dt_setup_arch(struct boot_param_header *bph)
79 111
80 early_init_devtree(initial_boot_params); 112 early_init_devtree(initial_boot_params);
81} 113}
114#endif
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 4c774d5d5087..c7f90519e58c 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -23,6 +23,7 @@
23#include <linux/pfn.h> 23#include <linux/pfn.h>
24#include <linux/debugfs.h> 24#include <linux/debugfs.h>
25#include <linux/kexec.h> 25#include <linux/kexec.h>
26#include <linux/sizes.h>
26 27
27#include <asm/addrspace.h> 28#include <asm/addrspace.h>
28#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
@@ -77,6 +78,8 @@ EXPORT_SYMBOL(mips_io_port_base);
77static struct resource code_resource = { .name = "Kernel code", }; 78static struct resource code_resource = { .name = "Kernel code", };
78static struct resource data_resource = { .name = "Kernel data", }; 79static struct resource data_resource = { .name = "Kernel data", };
79 80
81static void *detect_magic __initdata = detect_memory_region;
82
80void __init add_memory_region(phys_t start, phys_t size, long type) 83void __init add_memory_region(phys_t start, phys_t size, long type)
81{ 84{
82 int x = boot_mem_map.nr_map; 85 int x = boot_mem_map.nr_map;
@@ -122,6 +125,25 @@ void __init add_memory_region(phys_t start, phys_t size, long type)
122 boot_mem_map.nr_map++; 125 boot_mem_map.nr_map++;
123} 126}
124 127
128void __init detect_memory_region(phys_t start, phys_t sz_min, phys_t sz_max)
129{
130 void *dm = &detect_magic;
131 phys_t size;
132
133 for (size = sz_min; size < sz_max; size <<= 1) {
134 if (!memcmp(dm, dm + size, sizeof(detect_magic)))
135 break;
136 }
137
138 pr_debug("Memory: %lluMB of RAM detected at 0x%llx (min: %lluMB, max: %lluMB)\n",
139 ((unsigned long long) size) / SZ_1M,
140 (unsigned long long) start,
141 ((unsigned long long) sz_min) / SZ_1M,
142 ((unsigned long long) sz_max) / SZ_1M);
143
144 add_memory_region(start, size, BOOT_MEM_RAM);
145}
146
125static void __init print_memory_map(void) 147static void __init print_memory_map(void)
126{ 148{
127 int i; 149 int i;
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index feb42c072384..3b98b7b8487f 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1570,7 +1570,7 @@ void __cpuinit per_cpu_trap_init(bool is_boot_cpu)
1570#ifdef CONFIG_64BIT 1570#ifdef CONFIG_64BIT
1571 status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX; 1571 status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX;
1572#endif 1572#endif
1573 if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV) 1573 if (current_cpu_data.isa_level & MIPS_CPU_ISA_IV)
1574 status_set |= ST0_XX; 1574 status_set |= ST0_XX;
1575 if (cpu_has_dsp) 1575 if (cpu_has_dsp)
1576 status_set |= ST0_MX; 1576 status_set |= ST0_MX;