diff options
Diffstat (limited to 'arch/mips/include/asm')
23 files changed, 426 insertions, 121 deletions
diff --git a/arch/mips/include/asm/abi.h b/arch/mips/include/asm/abi.h index 37f84078e78a..940760844e2f 100644 --- a/arch/mips/include/asm/abi.h +++ b/arch/mips/include/asm/abi.h | |||
@@ -11,19 +11,20 @@ | |||
11 | 11 | ||
12 | #include <asm/signal.h> | 12 | #include <asm/signal.h> |
13 | #include <asm/siginfo.h> | 13 | #include <asm/siginfo.h> |
14 | #include <asm/vdso.h> | ||
14 | 15 | ||
15 | struct mips_abi { | 16 | struct mips_abi { |
16 | int (* const setup_frame)(void *sig_return, struct ksignal *ksig, | 17 | int (* const setup_frame)(void *sig_return, struct ksignal *ksig, |
17 | struct pt_regs *regs, sigset_t *set); | 18 | struct pt_regs *regs, sigset_t *set); |
18 | const unsigned long signal_return_offset; | ||
19 | int (* const setup_rt_frame)(void *sig_return, struct ksignal *ksig, | 19 | int (* const setup_rt_frame)(void *sig_return, struct ksignal *ksig, |
20 | struct pt_regs *regs, sigset_t *set); | 20 | struct pt_regs *regs, sigset_t *set); |
21 | const unsigned long rt_signal_return_offset; | ||
22 | const unsigned long restart; | 21 | const unsigned long restart; |
23 | 22 | ||
24 | unsigned off_sc_fpregs; | 23 | unsigned off_sc_fpregs; |
25 | unsigned off_sc_fpc_csr; | 24 | unsigned off_sc_fpc_csr; |
26 | unsigned off_sc_used_math; | 25 | unsigned off_sc_used_math; |
26 | |||
27 | struct mips_vdso_image *vdso; | ||
27 | }; | 28 | }; |
28 | 29 | ||
29 | #endif /* _ASM_ABI_H */ | 30 | #endif /* _ASM_ABI_H */ |
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h index f82d3af07931..835b402e4574 100644 --- a/arch/mips/include/asm/atomic.h +++ b/arch/mips/include/asm/atomic.h | |||
@@ -507,7 +507,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v) | |||
507 | * @u: ...unless v is equal to u. | 507 | * @u: ...unless v is equal to u. |
508 | * | 508 | * |
509 | * Atomically adds @a to @v, so long as it was not @u. | 509 | * Atomically adds @a to @v, so long as it was not @u. |
510 | * Returns the old value of @v. | 510 | * Returns true iff @v was not @u. |
511 | */ | 511 | */ |
512 | static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) | 512 | static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) |
513 | { | 513 | { |
diff --git a/arch/mips/include/asm/bcache.h b/arch/mips/include/asm/bcache.h index 8c34484cea82..a00857b135c3 100644 --- a/arch/mips/include/asm/bcache.h +++ b/arch/mips/include/asm/bcache.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #ifndef _ASM_BCACHE_H | 9 | #ifndef _ASM_BCACHE_H |
10 | #define _ASM_BCACHE_H | 10 | #define _ASM_BCACHE_H |
11 | 11 | ||
12 | #include <linux/types.h> | ||
12 | 13 | ||
13 | /* Some R4000 / R4400 / R4600 / R5000 machines may have a non-dma-coherent, | 14 | /* Some R4000 / R4400 / R4600 / R5000 machines may have a non-dma-coherent, |
14 | chipset implemented caches. On machines with other CPUs the CPU does the | 15 | chipset implemented caches. On machines with other CPUs the CPU does the |
@@ -18,6 +19,9 @@ struct bcache_ops { | |||
18 | void (*bc_disable)(void); | 19 | void (*bc_disable)(void); |
19 | void (*bc_wback_inv)(unsigned long page, unsigned long size); | 20 | void (*bc_wback_inv)(unsigned long page, unsigned long size); |
20 | void (*bc_inv)(unsigned long page, unsigned long size); | 21 | void (*bc_inv)(unsigned long page, unsigned long size); |
22 | void (*bc_prefetch_enable)(void); | ||
23 | void (*bc_prefetch_disable)(void); | ||
24 | bool (*bc_prefetch_is_enabled)(void); | ||
21 | }; | 25 | }; |
22 | 26 | ||
23 | extern void indy_sc_init(void); | 27 | extern void indy_sc_init(void); |
@@ -46,6 +50,26 @@ static inline void bc_inv(unsigned long page, unsigned long size) | |||
46 | bcops->bc_inv(page, size); | 50 | bcops->bc_inv(page, size); |
47 | } | 51 | } |
48 | 52 | ||
53 | static inline void bc_prefetch_enable(void) | ||
54 | { | ||
55 | if (bcops->bc_prefetch_enable) | ||
56 | bcops->bc_prefetch_enable(); | ||
57 | } | ||
58 | |||
59 | static inline void bc_prefetch_disable(void) | ||
60 | { | ||
61 | if (bcops->bc_prefetch_disable) | ||
62 | bcops->bc_prefetch_disable(); | ||
63 | } | ||
64 | |||
65 | static inline bool bc_prefetch_is_enabled(void) | ||
66 | { | ||
67 | if (bcops->bc_prefetch_is_enabled) | ||
68 | return bcops->bc_prefetch_is_enabled(); | ||
69 | |||
70 | return false; | ||
71 | } | ||
72 | |||
49 | #else /* !defined(CONFIG_BOARD_SCACHE) */ | 73 | #else /* !defined(CONFIG_BOARD_SCACHE) */ |
50 | 74 | ||
51 | /* Not R4000 / R4400 / R4600 / R5000. */ | 75 | /* Not R4000 / R4400 / R4600 / R5000. */ |
@@ -54,6 +78,9 @@ static inline void bc_inv(unsigned long page, unsigned long size) | |||
54 | #define bc_disable() do { } while (0) | 78 | #define bc_disable() do { } while (0) |
55 | #define bc_wback_inv(page, size) do { } while (0) | 79 | #define bc_wback_inv(page, size) do { } while (0) |
56 | #define bc_inv(page, size) do { } while (0) | 80 | #define bc_inv(page, size) do { } while (0) |
81 | #define bc_prefetch_enable() do { } while (0) | ||
82 | #define bc_prefetch_disable() do { } while (0) | ||
83 | #define bc_prefetch_is_enabled() 0 | ||
57 | 84 | ||
58 | #endif /* !defined(CONFIG_BOARD_SCACHE) */ | 85 | #endif /* !defined(CONFIG_BOARD_SCACHE) */ |
59 | 86 | ||
diff --git a/arch/mips/include/asm/cdmm.h b/arch/mips/include/asm/cdmm.h index bece2064cc8c..c06dbf8ba937 100644 --- a/arch/mips/include/asm/cdmm.h +++ b/arch/mips/include/asm/cdmm.h | |||
@@ -84,6 +84,17 @@ void mips_cdmm_driver_unregister(struct mips_cdmm_driver *); | |||
84 | module_driver(__mips_cdmm_driver, mips_cdmm_driver_register, \ | 84 | module_driver(__mips_cdmm_driver, mips_cdmm_driver_register, \ |
85 | mips_cdmm_driver_unregister) | 85 | mips_cdmm_driver_unregister) |
86 | 86 | ||
87 | /* | ||
88 | * builtin_mips_cdmm_driver() - Helper macro for drivers that don't do anything | ||
89 | * special in init and have no exit. This eliminates some boilerplate. Each | ||
90 | * driver may only use this macro once, and calling it replaces device_initcall | ||
91 | * (or in some cases, the legacy __initcall). This is meant to be a direct | ||
92 | * parallel of module_mips_cdmm_driver() above but without the __exit stuff that | ||
93 | * is not used for builtin cases. | ||
94 | */ | ||
95 | #define builtin_mips_cdmm_driver(__mips_cdmm_driver) \ | ||
96 | builtin_driver(__mips_cdmm_driver, mips_cdmm_driver_register) | ||
97 | |||
87 | /* drivers/tty/mips_ejtag_fdc.c */ | 98 | /* drivers/tty/mips_ejtag_fdc.c */ |
88 | 99 | ||
89 | #ifdef CONFIG_MIPS_EJTAG_FDC_EARLYCON | 100 | #ifdef CONFIG_MIPS_EJTAG_FDC_EARLYCON |
diff --git a/arch/mips/include/asm/clocksource.h b/arch/mips/include/asm/clocksource.h new file mode 100644 index 000000000000..3deb1d0c1a94 --- /dev/null +++ b/arch/mips/include/asm/clocksource.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015 Imagination Technologies | ||
3 | * Author: Alex Smith <alex.smith@imgtec.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 | #ifndef __ASM_CLOCKSOURCE_H | ||
12 | #define __ASM_CLOCKSOURCE_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | |||
16 | /* VDSO clocksources. */ | ||
17 | #define VDSO_CLOCK_NONE 0 /* No suitable clocksource. */ | ||
18 | #define VDSO_CLOCK_R4K 1 /* Use the coprocessor 0 count. */ | ||
19 | #define VDSO_CLOCK_GIC 2 /* Use the GIC. */ | ||
20 | |||
21 | /** | ||
22 | * struct arch_clocksource_data - Architecture-specific clocksource information. | ||
23 | * @vdso_clock_mode: Method the VDSO should use to access the clocksource. | ||
24 | */ | ||
25 | struct arch_clocksource_data { | ||
26 | u8 vdso_clock_mode; | ||
27 | }; | ||
28 | |||
29 | #endif /* __ASM_CLOCKSOURCE_H */ | ||
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h index c4bd54a7f5ce..a9580097cba8 100644 --- a/arch/mips/include/asm/compat.h +++ b/arch/mips/include/asm/compat.h | |||
@@ -130,6 +130,8 @@ typedef union compat_sigval { | |||
130 | compat_uptr_t sival_ptr; | 130 | compat_uptr_t sival_ptr; |
131 | } compat_sigval_t; | 131 | } compat_sigval_t; |
132 | 132 | ||
133 | /* Can't use the generic version because si_code and si_errno are swapped */ | ||
134 | |||
133 | #define SI_PAD_SIZE32 (128/sizeof(int) - 3) | 135 | #define SI_PAD_SIZE32 (128/sizeof(int) - 3) |
134 | 136 | ||
135 | typedef struct compat_siginfo { | 137 | typedef struct compat_siginfo { |
@@ -138,57 +140,61 @@ typedef struct compat_siginfo { | |||
138 | int si_errno; | 140 | int si_errno; |
139 | 141 | ||
140 | union { | 142 | union { |
141 | int _pad[SI_PAD_SIZE32]; | 143 | int _pad[128 / sizeof(int) - 3]; |
142 | 144 | ||
143 | /* kill() */ | 145 | /* kill() */ |
144 | struct { | 146 | struct { |
145 | compat_pid_t _pid; /* sender's pid */ | 147 | compat_pid_t _pid; /* sender's pid */ |
146 | __compat_uid_t _uid; /* sender's uid */ | 148 | __compat_uid32_t _uid; /* sender's uid */ |
147 | } _kill; | 149 | } _kill; |
148 | 150 | ||
151 | /* POSIX.1b timers */ | ||
152 | struct { | ||
153 | compat_timer_t _tid; /* timer id */ | ||
154 | int _overrun; /* overrun count */ | ||
155 | compat_sigval_t _sigval; /* same as below */ | ||
156 | } _timer; | ||
157 | |||
158 | /* POSIX.1b signals */ | ||
159 | struct { | ||
160 | compat_pid_t _pid; /* sender's pid */ | ||
161 | __compat_uid32_t _uid; /* sender's uid */ | ||
162 | compat_sigval_t _sigval; | ||
163 | } _rt; | ||
164 | |||
149 | /* SIGCHLD */ | 165 | /* SIGCHLD */ |
150 | struct { | 166 | struct { |
151 | compat_pid_t _pid; /* which child */ | 167 | compat_pid_t _pid; /* which child */ |
152 | __compat_uid_t _uid; /* sender's uid */ | 168 | __compat_uid32_t _uid; /* sender's uid */ |
153 | int _status; /* exit code */ | 169 | int _status; /* exit code */ |
154 | compat_clock_t _utime; | 170 | compat_clock_t _utime; |
155 | compat_clock_t _stime; | 171 | compat_clock_t _stime; |
156 | } _sigchld; | 172 | } _sigchld; |
157 | 173 | ||
158 | /* IRIX SIGCHLD */ | ||
159 | struct { | ||
160 | compat_pid_t _pid; /* which child */ | ||
161 | compat_clock_t _utime; | ||
162 | int _status; /* exit code */ | ||
163 | compat_clock_t _stime; | ||
164 | } _irix_sigchld; | ||
165 | |||
166 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ | 174 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ |
167 | struct { | 175 | struct { |
168 | s32 _addr; /* faulting insn/memory ref. */ | 176 | compat_uptr_t _addr; /* faulting insn/memory ref. */ |
177 | #ifdef __ARCH_SI_TRAPNO | ||
178 | int _trapno; /* TRAP # which caused the signal */ | ||
179 | #endif | ||
180 | short _addr_lsb; /* LSB of the reported address */ | ||
181 | struct { | ||
182 | compat_uptr_t _lower; | ||
183 | compat_uptr_t _upper; | ||
184 | } _addr_bnd; | ||
169 | } _sigfault; | 185 | } _sigfault; |
170 | 186 | ||
171 | /* SIGPOLL, SIGXFSZ (To do ...) */ | 187 | /* SIGPOLL */ |
172 | struct { | 188 | struct { |
173 | int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ | 189 | compat_long_t _band; /* POLL_IN, POLL_OUT, POLL_MSG */ |
174 | int _fd; | 190 | int _fd; |
175 | } _sigpoll; | 191 | } _sigpoll; |
176 | 192 | ||
177 | /* POSIX.1b timers */ | ||
178 | struct { | ||
179 | timer_t _tid; /* timer id */ | ||
180 | int _overrun; /* overrun count */ | ||
181 | compat_sigval_t _sigval;/* same as below */ | ||
182 | int _sys_private; /* not to be passed to user */ | ||
183 | } _timer; | ||
184 | |||
185 | /* POSIX.1b signals */ | ||
186 | struct { | 193 | struct { |
187 | compat_pid_t _pid; /* sender's pid */ | 194 | compat_uptr_t _call_addr; /* calling insn */ |
188 | __compat_uid_t _uid; /* sender's uid */ | 195 | int _syscall; /* triggering system call number */ |
189 | compat_sigval_t _sigval; | 196 | compat_uint_t _arch; /* AUDIT_ARCH_* of syscall */ |
190 | } _rt; | 197 | } _sigsys; |
191 | |||
192 | } _sifields; | 198 | } _sifields; |
193 | } compat_siginfo_t; | 199 | } compat_siginfo_t; |
194 | 200 | ||
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h index fe67f12ac239..d1e04c943f5f 100644 --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h | |||
@@ -131,11 +131,7 @@ | |||
131 | #endif | 131 | #endif |
132 | 132 | ||
133 | #ifndef cpu_has_rixi | 133 | #ifndef cpu_has_rixi |
134 | # ifdef CONFIG_64BIT | 134 | #define cpu_has_rixi (cpu_data[0].options & MIPS_CPU_RIXI) |
135 | # define cpu_has_rixi (cpu_data[0].options & MIPS_CPU_RIXI) | ||
136 | # else /* CONFIG_32BIT */ | ||
137 | # define cpu_has_rixi ((cpu_data[0].options & MIPS_CPU_RIXI) && !cpu_has_64bits) | ||
138 | # endif | ||
139 | #endif | 135 | #endif |
140 | 136 | ||
141 | #ifndef cpu_has_mmips | 137 | #ifndef cpu_has_mmips |
diff --git a/arch/mips/include/asm/debug.h b/arch/mips/include/asm/debug.h new file mode 100644 index 000000000000..254f00deb9d5 --- /dev/null +++ b/arch/mips/include/asm/debug.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015 Imagination Technologies | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef __MIPS_ASM_DEBUG_H__ | ||
11 | #define __MIPS_ASM_DEBUG_H__ | ||
12 | |||
13 | #include <linux/dcache.h> | ||
14 | |||
15 | /* | ||
16 | * mips_debugfs_dir corresponds to the "mips" directory at the top level | ||
17 | * of the DebugFS hierarchy. MIPS-specific DebugFS entires should be | ||
18 | * placed beneath this directory. | ||
19 | */ | ||
20 | extern struct dentry *mips_debugfs_dir; | ||
21 | |||
22 | #endif /* __MIPS_ASM_DEBUG_H__ */ | ||
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h index 53b26933b12c..b01a6ff468e0 100644 --- a/arch/mips/include/asm/elf.h +++ b/arch/mips/include/asm/elf.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #ifndef _ASM_ELF_H | 8 | #ifndef _ASM_ELF_H |
9 | #define _ASM_ELF_H | 9 | #define _ASM_ELF_H |
10 | 10 | ||
11 | #include <linux/auxvec.h> | ||
11 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
12 | #include <uapi/linux/elf.h> | 13 | #include <uapi/linux/elf.h> |
13 | 14 | ||
@@ -419,6 +420,12 @@ extern const char *__elf_platform; | |||
419 | #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) | 420 | #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) |
420 | #endif | 421 | #endif |
421 | 422 | ||
423 | #define ARCH_DLINFO \ | ||
424 | do { \ | ||
425 | NEW_AUX_ENT(AT_SYSINFO_EHDR, \ | ||
426 | (unsigned long)current->mm->context.vdso); \ | ||
427 | } while (0) | ||
428 | |||
422 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 | 429 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 |
423 | struct linux_binprm; | 430 | struct linux_binprm; |
424 | extern int arch_setup_additional_pages(struct linux_binprm *bprm, | 431 | extern int arch_setup_additional_pages(struct linux_binprm *bprm, |
diff --git a/arch/mips/include/asm/fw/fw.h b/arch/mips/include/asm/fw/fw.h index f3e6978aad70..d0ef8b4892bb 100644 --- a/arch/mips/include/asm/fw/fw.h +++ b/arch/mips/include/asm/fw/fw.h | |||
@@ -10,21 +10,6 @@ | |||
10 | 10 | ||
11 | #include <asm/bootinfo.h> /* For cleaner code... */ | 11 | #include <asm/bootinfo.h> /* For cleaner code... */ |
12 | 12 | ||
13 | enum fw_memtypes { | ||
14 | fw_dontuse, | ||
15 | fw_code, | ||
16 | fw_free, | ||
17 | }; | ||
18 | |||
19 | typedef struct { | ||
20 | unsigned long base; /* Within KSEG0 */ | ||
21 | unsigned int size; /* bytes */ | ||
22 | enum fw_memtypes type; /* fw_memtypes */ | ||
23 | } fw_memblock_t; | ||
24 | |||
25 | /* Maximum number of memory block descriptors. */ | ||
26 | #define FW_MAX_MEMBLOCKS 32 | ||
27 | |||
28 | extern int fw_argc; | 13 | extern int fw_argc; |
29 | extern int *_fw_argv; | 14 | extern int *_fw_argv; |
30 | extern int *_fw_envp; | 15 | extern int *_fw_envp; |
@@ -38,7 +23,6 @@ extern int *_fw_envp; | |||
38 | 23 | ||
39 | extern void fw_init_cmdline(void); | 24 | extern void fw_init_cmdline(void); |
40 | extern char *fw_getcmdline(void); | 25 | extern char *fw_getcmdline(void); |
41 | extern fw_memblock_t *fw_getmdesc(int); | ||
42 | extern void fw_meminit(void); | 26 | extern void fw_meminit(void); |
43 | extern char *fw_getenv(char *name); | 27 | extern char *fw_getenv(char *name); |
44 | extern unsigned long fw_getenvl(char *name); | 28 | extern unsigned long fw_getenvl(char *name); |
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h index 1461c10c1c4c..71e4096a2145 100644 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | |||
@@ -48,11 +48,6 @@ extern enum bcm47xx_bus_type bcm47xx_bus_type; | |||
48 | void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix, | 48 | void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix, |
49 | bool fallback); | 49 | bool fallback); |
50 | 50 | ||
51 | #ifdef CONFIG_BCM47XX_SSB | ||
52 | void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, | ||
53 | const char *prefix); | ||
54 | #endif | ||
55 | |||
56 | void bcm47xx_set_system_type(u16 chip_id); | 51 | void bcm47xx_set_system_type(u16 chip_id); |
57 | 52 | ||
58 | #endif /* __ASM_BCM47XX_H */ | 53 | #endif /* __ASM_BCM47XX_H */ |
diff --git a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h index 133336b493b6..dd6005b75e0c 100644 --- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h +++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h | |||
@@ -35,6 +35,17 @@ | |||
35 | #define SOC_ID_VRX268_2 0x00C /* v1.2 */ | 35 | #define SOC_ID_VRX268_2 0x00C /* v1.2 */ |
36 | #define SOC_ID_GRX288_2 0x00D /* v1.2 */ | 36 | #define SOC_ID_GRX288_2 0x00D /* v1.2 */ |
37 | #define SOC_ID_GRX282_2 0x00E /* v1.2 */ | 37 | #define SOC_ID_GRX282_2 0x00E /* v1.2 */ |
38 | #define SOC_ID_VRX220 0x000 | ||
39 | |||
40 | #define SOC_ID_ARX362 0x004 | ||
41 | #define SOC_ID_ARX368 0x005 | ||
42 | #define SOC_ID_ARX382 0x007 | ||
43 | #define SOC_ID_ARX388 0x008 | ||
44 | #define SOC_ID_URX388 0x009 | ||
45 | #define SOC_ID_GRX383 0x010 | ||
46 | #define SOC_ID_GRX369 0x011 | ||
47 | #define SOC_ID_GRX387 0x00F | ||
48 | #define SOC_ID_GRX389 0x012 | ||
38 | 49 | ||
39 | /* SoC Types */ | 50 | /* SoC Types */ |
40 | #define SOC_TYPE_DANUBE 0x01 | 51 | #define SOC_TYPE_DANUBE 0x01 |
@@ -43,6 +54,9 @@ | |||
43 | #define SOC_TYPE_VR9 0x04 /* v1.1 */ | 54 | #define SOC_TYPE_VR9 0x04 /* v1.1 */ |
44 | #define SOC_TYPE_VR9_2 0x05 /* v1.2 */ | 55 | #define SOC_TYPE_VR9_2 0x05 /* v1.2 */ |
45 | #define SOC_TYPE_AMAZON_SE 0x06 | 56 | #define SOC_TYPE_AMAZON_SE 0x06 |
57 | #define SOC_TYPE_AR10 0x07 | ||
58 | #define SOC_TYPE_GRX390 0x08 | ||
59 | #define SOC_TYPE_VRX220 0x09 | ||
46 | 60 | ||
47 | /* BOOT_SEL - find what boot media we have */ | 61 | /* BOOT_SEL - find what boot media we have */ |
48 | #define BS_EXT_ROM 0x0 | 62 | #define BS_EXT_ROM 0x0 |
diff --git a/arch/mips/include/asm/mach-malta/malta-dtshim.h b/arch/mips/include/asm/mach-malta/malta-dtshim.h new file mode 100644 index 000000000000..cfd777663c64 --- /dev/null +++ b/arch/mips/include/asm/mach-malta/malta-dtshim.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015 Imagination Technologies | ||
3 | * Author: Paul Burton <paul.burton@imgtec.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 | #ifndef __MIPS_MALTA_DTSHIM_H__ | ||
12 | #define __MIPS_MALTA_DTSHIM_H__ | ||
13 | |||
14 | #include <linux/init.h> | ||
15 | |||
16 | #ifdef CONFIG_MIPS_MALTA | ||
17 | |||
18 | extern void __init *malta_dt_shim(void *fdt); | ||
19 | |||
20 | #else /* !CONFIG_MIPS_MALTA */ | ||
21 | |||
22 | static inline void *malta_dt_shim(void *fdt) | ||
23 | { | ||
24 | return fdt; | ||
25 | } | ||
26 | |||
27 | #endif /* !CONFIG_MIPS_MALTA */ | ||
28 | |||
29 | #endif /* __MIPS_MALTA_DTSHIM_H__ */ | ||
diff --git a/arch/mips/include/asm/mach-ralink/mt7620.h b/arch/mips/include/asm/mach-ralink/mt7620.h index 1976fb815fd1..455d406e8ddf 100644 --- a/arch/mips/include/asm/mach-ralink/mt7620.h +++ b/arch/mips/include/asm/mach-ralink/mt7620.h | |||
@@ -13,17 +13,11 @@ | |||
13 | #ifndef _MT7620_REGS_H_ | 13 | #ifndef _MT7620_REGS_H_ |
14 | #define _MT7620_REGS_H_ | 14 | #define _MT7620_REGS_H_ |
15 | 15 | ||
16 | enum mt762x_soc_type { | ||
17 | MT762X_SOC_UNKNOWN = 0, | ||
18 | MT762X_SOC_MT7620A, | ||
19 | MT762X_SOC_MT7620N, | ||
20 | MT762X_SOC_MT7628AN, | ||
21 | }; | ||
22 | |||
23 | #define MT7620_SYSC_BASE 0x10000000 | 16 | #define MT7620_SYSC_BASE 0x10000000 |
24 | 17 | ||
25 | #define SYSC_REG_CHIP_NAME0 0x00 | 18 | #define SYSC_REG_CHIP_NAME0 0x00 |
26 | #define SYSC_REG_CHIP_NAME1 0x04 | 19 | #define SYSC_REG_CHIP_NAME1 0x04 |
20 | #define SYSC_REG_EFUSE_CFG 0x08 | ||
27 | #define SYSC_REG_CHIP_REV 0x0c | 21 | #define SYSC_REG_CHIP_REV 0x0c |
28 | #define SYSC_REG_SYSTEM_CONFIG0 0x10 | 22 | #define SYSC_REG_SYSTEM_CONFIG0 0x10 |
29 | #define SYSC_REG_SYSTEM_CONFIG1 0x14 | 23 | #define SYSC_REG_SYSTEM_CONFIG1 0x14 |
diff --git a/arch/mips/include/asm/mach-ralink/ralink_regs.h b/arch/mips/include/asm/mach-ralink/ralink_regs.h index bd93014490df..4c9fba68c8b2 100644 --- a/arch/mips/include/asm/mach-ralink/ralink_regs.h +++ b/arch/mips/include/asm/mach-ralink/ralink_regs.h | |||
@@ -13,6 +13,23 @@ | |||
13 | #ifndef _RALINK_REGS_H_ | 13 | #ifndef _RALINK_REGS_H_ |
14 | #define _RALINK_REGS_H_ | 14 | #define _RALINK_REGS_H_ |
15 | 15 | ||
16 | enum ralink_soc_type { | ||
17 | RALINK_UNKNOWN = 0, | ||
18 | RT2880_SOC, | ||
19 | RT3883_SOC, | ||
20 | RT305X_SOC_RT3050, | ||
21 | RT305X_SOC_RT3052, | ||
22 | RT305X_SOC_RT3350, | ||
23 | RT305X_SOC_RT3352, | ||
24 | RT305X_SOC_RT5350, | ||
25 | MT762X_SOC_MT7620A, | ||
26 | MT762X_SOC_MT7620N, | ||
27 | MT762X_SOC_MT7621AT, | ||
28 | MT762X_SOC_MT7628AN, | ||
29 | MT762X_SOC_MT7688, | ||
30 | }; | ||
31 | extern enum ralink_soc_type ralink_soc; | ||
32 | |||
16 | extern __iomem void *rt_sysc_membase; | 33 | extern __iomem void *rt_sysc_membase; |
17 | extern __iomem void *rt_memc_membase; | 34 | extern __iomem void *rt_memc_membase; |
18 | 35 | ||
diff --git a/arch/mips/include/asm/mach-ralink/rt305x.h b/arch/mips/include/asm/mach-ralink/rt305x.h index 96f731bac79a..2eea79331a14 100644 --- a/arch/mips/include/asm/mach-ralink/rt305x.h +++ b/arch/mips/include/asm/mach-ralink/rt305x.h | |||
@@ -13,25 +13,16 @@ | |||
13 | #ifndef _RT305X_REGS_H_ | 13 | #ifndef _RT305X_REGS_H_ |
14 | #define _RT305X_REGS_H_ | 14 | #define _RT305X_REGS_H_ |
15 | 15 | ||
16 | enum rt305x_soc_type { | 16 | extern enum ralink_soc_type ralink_soc; |
17 | RT305X_SOC_UNKNOWN = 0, | ||
18 | RT305X_SOC_RT3050, | ||
19 | RT305X_SOC_RT3052, | ||
20 | RT305X_SOC_RT3350, | ||
21 | RT305X_SOC_RT3352, | ||
22 | RT305X_SOC_RT5350, | ||
23 | }; | ||
24 | |||
25 | extern enum rt305x_soc_type rt305x_soc; | ||
26 | 17 | ||
27 | static inline int soc_is_rt3050(void) | 18 | static inline int soc_is_rt3050(void) |
28 | { | 19 | { |
29 | return rt305x_soc == RT305X_SOC_RT3050; | 20 | return ralink_soc == RT305X_SOC_RT3050; |
30 | } | 21 | } |
31 | 22 | ||
32 | static inline int soc_is_rt3052(void) | 23 | static inline int soc_is_rt3052(void) |
33 | { | 24 | { |
34 | return rt305x_soc == RT305X_SOC_RT3052; | 25 | return ralink_soc == RT305X_SOC_RT3052; |
35 | } | 26 | } |
36 | 27 | ||
37 | static inline int soc_is_rt305x(void) | 28 | static inline int soc_is_rt305x(void) |
@@ -41,17 +32,17 @@ static inline int soc_is_rt305x(void) | |||
41 | 32 | ||
42 | static inline int soc_is_rt3350(void) | 33 | static inline int soc_is_rt3350(void) |
43 | { | 34 | { |
44 | return rt305x_soc == RT305X_SOC_RT3350; | 35 | return ralink_soc == RT305X_SOC_RT3350; |
45 | } | 36 | } |
46 | 37 | ||
47 | static inline int soc_is_rt3352(void) | 38 | static inline int soc_is_rt3352(void) |
48 | { | 39 | { |
49 | return rt305x_soc == RT305X_SOC_RT3352; | 40 | return ralink_soc == RT305X_SOC_RT3352; |
50 | } | 41 | } |
51 | 42 | ||
52 | static inline int soc_is_rt5350(void) | 43 | static inline int soc_is_rt5350(void) |
53 | { | 44 | { |
54 | return rt305x_soc == RT305X_SOC_RT5350; | 45 | return ralink_soc == RT305X_SOC_RT5350; |
55 | } | 46 | } |
56 | 47 | ||
57 | #define RT305X_SYSC_BASE 0x10000000 | 48 | #define RT305X_SYSC_BASE 0x10000000 |
diff --git a/arch/mips/include/asm/mach-xilfpga/irq.h b/arch/mips/include/asm/mach-xilfpga/irq.h new file mode 100644 index 000000000000..0132a5b91f57 --- /dev/null +++ b/arch/mips/include/asm/mach-xilfpga/irq.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015 Imagination Technologies | ||
3 | * Author: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.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 | #ifndef __MIPS_ASM_MACH_XILFPGA_IRQ_H__ | ||
12 | #define __MIPS_ASM_MACH_XILFPGA_IRQ_H__ | ||
13 | |||
14 | #define NR_IRQS 32 | ||
15 | |||
16 | #include_next <irq.h> | ||
17 | |||
18 | #endif /* __MIPS_ASM_MACH_XILFPGA_IRQ_H__ */ | ||
diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h index 1f1927ab4269..6516e9da5133 100644 --- a/arch/mips/include/asm/mips-cm.h +++ b/arch/mips/include/asm/mips-cm.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #ifndef __MIPS_ASM_MIPS_CM_H__ | 11 | #ifndef __MIPS_ASM_MIPS_CM_H__ |
12 | #define __MIPS_ASM_MIPS_CM_H__ | 12 | #define __MIPS_ASM_MIPS_CM_H__ |
13 | 13 | ||
14 | #include <linux/bitops.h> | ||
14 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
15 | #include <linux/io.h> | 16 | #include <linux/io.h> |
16 | #include <linux/types.h> | 17 | #include <linux/types.h> |
@@ -36,12 +37,12 @@ extern phys_addr_t __mips_cm_phys_base(void); | |||
36 | /* | 37 | /* |
37 | * mips_cm_is64 - determine CM register width | 38 | * mips_cm_is64 - determine CM register width |
38 | * | 39 | * |
39 | * The CM register width is processor and CM specific. A 64-bit processor | 40 | * The CM register width is determined by the version of the CM, with CM3 |
40 | * usually has a 64-bit CM and a 32-bit one has a 32-bit CM but a 64-bit | 41 | * introducing 64 bit GCRs and all prior CM versions having 32 bit GCRs. |
41 | * processor could come with a 32-bit CM. Moreover, accesses on 64-bit CMs | 42 | * However we may run a kernel built for MIPS32 on a system with 64 bit GCRs, |
42 | * can be done either using regular 64-bit load/store instructions, or 32-bit | 43 | * or vice-versa. This variable indicates the width of the memory accesses |
43 | * load/store instruction on 32-bit register pairs. We opt for using 64-bit | 44 | * that the kernel will perform to GCRs, which may differ from the actual |
44 | * accesses on 64-bit CMs and kernels and 32-bit in any other case. | 45 | * width of the GCRs. |
45 | * | 46 | * |
46 | * It's set to 0 for 32-bit accesses and 1 for 64-bit accesses. | 47 | * It's set to 0 for 32-bit accesses and 1 for 64-bit accesses. |
47 | */ | 48 | */ |
@@ -125,7 +126,17 @@ static inline u32 read32_gcr_##name(void) \ | |||
125 | \ | 126 | \ |
126 | static inline u64 read64_gcr_##name(void) \ | 127 | static inline u64 read64_gcr_##name(void) \ |
127 | { \ | 128 | { \ |
128 | return __raw_readq(addr_gcr_##name()); \ | 129 | void __iomem *addr = addr_gcr_##name(); \ |
130 | u64 ret; \ | ||
131 | \ | ||
132 | if (mips_cm_is64) { \ | ||
133 | ret = __raw_readq(addr); \ | ||
134 | } else { \ | ||
135 | ret = __raw_readl(addr); \ | ||
136 | ret |= (u64)__raw_readl(addr + 0x4) << 32; \ | ||
137 | } \ | ||
138 | \ | ||
139 | return ret; \ | ||
129 | } \ | 140 | } \ |
130 | \ | 141 | \ |
131 | static inline unsigned long read_gcr_##name(void) \ | 142 | static inline unsigned long read_gcr_##name(void) \ |
@@ -195,6 +206,8 @@ BUILD_CM_R_(gic_status, MIPS_CM_GCB_OFS + 0xd0) | |||
195 | BUILD_CM_R_(cpc_status, MIPS_CM_GCB_OFS + 0xf0) | 206 | BUILD_CM_R_(cpc_status, MIPS_CM_GCB_OFS + 0xf0) |
196 | BUILD_CM_RW(l2_config, MIPS_CM_GCB_OFS + 0x130) | 207 | BUILD_CM_RW(l2_config, MIPS_CM_GCB_OFS + 0x130) |
197 | BUILD_CM_RW(sys_config2, MIPS_CM_GCB_OFS + 0x150) | 208 | BUILD_CM_RW(sys_config2, MIPS_CM_GCB_OFS + 0x150) |
209 | BUILD_CM_RW(l2_pft_control, MIPS_CM_GCB_OFS + 0x300) | ||
210 | BUILD_CM_RW(l2_pft_control_b, MIPS_CM_GCB_OFS + 0x308) | ||
198 | 211 | ||
199 | /* Core Local & Core Other register accessor functions */ | 212 | /* Core Local & Core Other register accessor functions */ |
200 | BUILD_CM_Cx_RW(reset_release, 0x00) | 213 | BUILD_CM_Cx_RW(reset_release, 0x00) |
@@ -245,11 +258,14 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80) | |||
245 | ((minor) << CM_GCR_REV_MINOR_SHF)) | 258 | ((minor) << CM_GCR_REV_MINOR_SHF)) |
246 | 259 | ||
247 | #define CM_REV_CM2 CM_ENCODE_REV(6, 0) | 260 | #define CM_REV_CM2 CM_ENCODE_REV(6, 0) |
261 | #define CM_REV_CM2_5 CM_ENCODE_REV(7, 0) | ||
248 | #define CM_REV_CM3 CM_ENCODE_REV(8, 0) | 262 | #define CM_REV_CM3 CM_ENCODE_REV(8, 0) |
249 | 263 | ||
250 | /* GCR_ERROR_CAUSE register fields */ | 264 | /* GCR_ERROR_CAUSE register fields */ |
251 | #define CM_GCR_ERROR_CAUSE_ERRTYPE_SHF 27 | 265 | #define CM_GCR_ERROR_CAUSE_ERRTYPE_SHF 27 |
252 | #define CM_GCR_ERROR_CAUSE_ERRTYPE_MSK (_ULCAST_(0x1f) << 27) | 266 | #define CM_GCR_ERROR_CAUSE_ERRTYPE_MSK (_ULCAST_(0x1f) << 27) |
267 | #define CM3_GCR_ERROR_CAUSE_ERRTYPE_SHF 58 | ||
268 | #define CM3_GCR_ERROR_CAUSE_ERRTYPE_MSK GENMASK_ULL(63, 58) | ||
253 | #define CM_GCR_ERROR_CAUSE_ERRINFO_SHF 0 | 269 | #define CM_GCR_ERROR_CAUSE_ERRINFO_SHF 0 |
254 | #define CM_GCR_ERROR_CAUSE_ERRINGO_MSK (_ULCAST_(0x7ffffff) << 0) | 270 | #define CM_GCR_ERROR_CAUSE_ERRINGO_MSK (_ULCAST_(0x7ffffff) << 0) |
255 | 271 | ||
@@ -321,6 +337,20 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80) | |||
321 | #define CM_GCR_SYS_CONFIG2_MAXVPW_SHF 0 | 337 | #define CM_GCR_SYS_CONFIG2_MAXVPW_SHF 0 |
322 | #define CM_GCR_SYS_CONFIG2_MAXVPW_MSK (_ULCAST_(0xf) << 0) | 338 | #define CM_GCR_SYS_CONFIG2_MAXVPW_MSK (_ULCAST_(0xf) << 0) |
323 | 339 | ||
340 | /* GCR_L2_PFT_CONTROL register fields */ | ||
341 | #define CM_GCR_L2_PFT_CONTROL_PAGEMASK_SHF 12 | ||
342 | #define CM_GCR_L2_PFT_CONTROL_PAGEMASK_MSK (_ULCAST_(0xfffff) << 12) | ||
343 | #define CM_GCR_L2_PFT_CONTROL_PFTEN_SHF 8 | ||
344 | #define CM_GCR_L2_PFT_CONTROL_PFTEN_MSK (_ULCAST_(0x1) << 8) | ||
345 | #define CM_GCR_L2_PFT_CONTROL_NPFT_SHF 0 | ||
346 | #define CM_GCR_L2_PFT_CONTROL_NPFT_MSK (_ULCAST_(0xff) << 0) | ||
347 | |||
348 | /* GCR_L2_PFT_CONTROL_B register fields */ | ||
349 | #define CM_GCR_L2_PFT_CONTROL_B_CEN_SHF 8 | ||
350 | #define CM_GCR_L2_PFT_CONTROL_B_CEN_MSK (_ULCAST_(0x1) << 8) | ||
351 | #define CM_GCR_L2_PFT_CONTROL_B_PORTID_SHF 0 | ||
352 | #define CM_GCR_L2_PFT_CONTROL_B_PORTID_MSK (_ULCAST_(0xff) << 0) | ||
353 | |||
324 | /* GCR_Cx_COHERENCE register fields */ | 354 | /* GCR_Cx_COHERENCE register fields */ |
325 | #define CM_GCR_Cx_COHERENCE_COHDOMAINEN_SHF 0 | 355 | #define CM_GCR_Cx_COHERENCE_COHDOMAINEN_SHF 0 |
326 | #define CM_GCR_Cx_COHERENCE_COHDOMAINEN_MSK (_ULCAST_(0xff) << 0) | 356 | #define CM_GCR_Cx_COHERENCE_COHDOMAINEN_MSK (_ULCAST_(0xff) << 0) |
@@ -329,11 +359,15 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80) | |||
329 | #define CM_GCR_Cx_CONFIG_IOCUTYPE_SHF 10 | 359 | #define CM_GCR_Cx_CONFIG_IOCUTYPE_SHF 10 |
330 | #define CM_GCR_Cx_CONFIG_IOCUTYPE_MSK (_ULCAST_(0x3) << 10) | 360 | #define CM_GCR_Cx_CONFIG_IOCUTYPE_MSK (_ULCAST_(0x3) << 10) |
331 | #define CM_GCR_Cx_CONFIG_PVPE_SHF 0 | 361 | #define CM_GCR_Cx_CONFIG_PVPE_SHF 0 |
332 | #define CM_GCR_Cx_CONFIG_PVPE_MSK (_ULCAST_(0x1ff) << 0) | 362 | #define CM_GCR_Cx_CONFIG_PVPE_MSK (_ULCAST_(0x3ff) << 0) |
333 | 363 | ||
334 | /* GCR_Cx_OTHER register fields */ | 364 | /* GCR_Cx_OTHER register fields */ |
335 | #define CM_GCR_Cx_OTHER_CORENUM_SHF 16 | 365 | #define CM_GCR_Cx_OTHER_CORENUM_SHF 16 |
336 | #define CM_GCR_Cx_OTHER_CORENUM_MSK (_ULCAST_(0xffff) << 16) | 366 | #define CM_GCR_Cx_OTHER_CORENUM_MSK (_ULCAST_(0xffff) << 16) |
367 | #define CM3_GCR_Cx_OTHER_CORE_SHF 8 | ||
368 | #define CM3_GCR_Cx_OTHER_CORE_MSK (_ULCAST_(0x3f) << 8) | ||
369 | #define CM3_GCR_Cx_OTHER_VP_SHF 0 | ||
370 | #define CM3_GCR_Cx_OTHER_VP_MSK (_ULCAST_(0x7) << 0) | ||
337 | 371 | ||
338 | /* GCR_Cx_RESET_BASE register fields */ | 372 | /* GCR_Cx_RESET_BASE register fields */ |
339 | #define CM_GCR_Cx_RESET_BASE_BEVEXCBASE_SHF 12 | 373 | #define CM_GCR_Cx_RESET_BASE_BEVEXCBASE_SHF 12 |
@@ -444,4 +478,32 @@ static inline unsigned int mips_cm_vp_id(unsigned int cpu) | |||
444 | return (core * mips_cm_max_vp_width()) + vp; | 478 | return (core * mips_cm_max_vp_width()) + vp; |
445 | } | 479 | } |
446 | 480 | ||
481 | #ifdef CONFIG_MIPS_CM | ||
482 | |||
483 | /** | ||
484 | * mips_cm_lock_other - lock access to another core | ||
485 | * @core: the other core to be accessed | ||
486 | * @vp: the VP within the other core to be accessed | ||
487 | * | ||
488 | * Call before operating upon a core via the 'other' register region in | ||
489 | * order to prevent the region being moved during access. Must be followed | ||
490 | * by a call to mips_cm_unlock_other. | ||
491 | */ | ||
492 | extern void mips_cm_lock_other(unsigned int core, unsigned int vp); | ||
493 | |||
494 | /** | ||
495 | * mips_cm_unlock_other - unlock access to another core | ||
496 | * | ||
497 | * Call after operating upon another core via the 'other' register region. | ||
498 | * Must be called after mips_cm_lock_other. | ||
499 | */ | ||
500 | extern void mips_cm_unlock_other(void); | ||
501 | |||
502 | #else /* !CONFIG_MIPS_CM */ | ||
503 | |||
504 | static inline void mips_cm_lock_other(unsigned int core) { } | ||
505 | static inline void mips_cm_unlock_other(void) { } | ||
506 | |||
507 | #endif /* !CONFIG_MIPS_CM */ | ||
508 | |||
447 | #endif /* __MIPS_ASM_MIPS_CM_H__ */ | 509 | #endif /* __MIPS_ASM_MIPS_CM_H__ */ |
diff --git a/arch/mips/include/asm/mips-cpc.h b/arch/mips/include/asm/mips-cpc.h index f386f32702f1..e09035239e53 100644 --- a/arch/mips/include/asm/mips-cpc.h +++ b/arch/mips/include/asm/mips-cpc.h | |||
@@ -149,7 +149,8 @@ BUILD_CPC_Cx_RW(other, 0x10) | |||
149 | * core: the other core to be accessed | 149 | * core: the other core to be accessed |
150 | * | 150 | * |
151 | * Call before operating upon a core via the 'other' register region in | 151 | * Call before operating upon a core via the 'other' register region in |
152 | * order to prevent the region being moved during access. Must be followed | 152 | * order to prevent the region being moved during access. Must be called |
153 | * within the bounds of a mips_cm_{lock,unlock}_other pair, and followed | ||
153 | * by a call to mips_cpc_unlock_other. | 154 | * by a call to mips_cpc_unlock_other. |
154 | */ | 155 | */ |
155 | extern void mips_cpc_lock_other(unsigned int core); | 156 | extern void mips_cpc_lock_other(unsigned int core); |
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index c64781cf649f..e43aca183c99 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -50,7 +50,9 @@ | |||
50 | #define CP0_PAGEMASK $5 | 50 | #define CP0_PAGEMASK $5 |
51 | #define CP0_WIRED $6 | 51 | #define CP0_WIRED $6 |
52 | #define CP0_INFO $7 | 52 | #define CP0_INFO $7 |
53 | #define CP0_HWRENA $7, 0 | ||
53 | #define CP0_BADVADDR $8 | 54 | #define CP0_BADVADDR $8 |
55 | #define CP0_BADINSTR $8, 1 | ||
54 | #define CP0_COUNT $9 | 56 | #define CP0_COUNT $9 |
55 | #define CP0_ENTRYHI $10 | 57 | #define CP0_ENTRYHI $10 |
56 | #define CP0_COMPARE $11 | 58 | #define CP0_COMPARE $11 |
@@ -58,7 +60,11 @@ | |||
58 | #define CP0_CAUSE $13 | 60 | #define CP0_CAUSE $13 |
59 | #define CP0_EPC $14 | 61 | #define CP0_EPC $14 |
60 | #define CP0_PRID $15 | 62 | #define CP0_PRID $15 |
63 | #define CP0_EBASE $15, 1 | ||
64 | #define CP0_CMGCRBASE $15, 3 | ||
61 | #define CP0_CONFIG $16 | 65 | #define CP0_CONFIG $16 |
66 | #define CP0_CONFIG3 $16, 3 | ||
67 | #define CP0_CONFIG5 $16, 5 | ||
62 | #define CP0_LLADDR $17 | 68 | #define CP0_LLADDR $17 |
63 | #define CP0_WATCHLO $18 | 69 | #define CP0_WATCHLO $18 |
64 | #define CP0_WATCHHI $19 | 70 | #define CP0_WATCHHI $19 |
@@ -126,15 +132,9 @@ | |||
126 | #define R3K_ENTRYLO_N (_ULCAST_(1) << 11) | 132 | #define R3K_ENTRYLO_N (_ULCAST_(1) << 11) |
127 | 133 | ||
128 | /* MIPS32/64 EntryLo bit definitions */ | 134 | /* MIPS32/64 EntryLo bit definitions */ |
129 | #ifdef CONFIG_64BIT | 135 | #define MIPS_ENTRYLO_PFN_SHIFT 6 |
130 | /* as read by dmfc0 */ | 136 | #define MIPS_ENTRYLO_XI (_ULCAST_(1) << (BITS_PER_LONG - 2)) |
131 | #define MIPS_ENTRYLO_XI (_ULCAST_(1) << 62) | 137 | #define MIPS_ENTRYLO_RI (_ULCAST_(1) << (BITS_PER_LONG - 1)) |
132 | #define MIPS_ENTRYLO_RI (_ULCAST_(1) << 63) | ||
133 | #else | ||
134 | /* as read by mfc0 */ | ||
135 | #define MIPS_ENTRYLO_XI (_ULCAST_(1) << 30) | ||
136 | #define MIPS_ENTRYLO_RI (_ULCAST_(1) << 31) | ||
137 | #endif | ||
138 | 138 | ||
139 | /* | 139 | /* |
140 | * Values for PageMask register | 140 | * Values for PageMask register |
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h index 89dd7fed1a57..ad1fccdb8d13 100644 --- a/arch/mips/include/asm/page.h +++ b/arch/mips/include/asm/page.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #define PAGE_SHIFT 16 | 33 | #define PAGE_SHIFT 16 |
34 | #endif | 34 | #endif |
35 | #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) | 35 | #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) |
36 | #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) | 36 | #define PAGE_MASK (~(PAGE_SIZE - 1)) |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * This is used for calculating the real page sizes | 39 | * This is used for calculating the real page sizes |
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h index 59ee6dcf6eed..3f832c3dd8f5 100644 --- a/arch/mips/include/asm/processor.h +++ b/arch/mips/include/asm/processor.h | |||
@@ -36,12 +36,6 @@ extern unsigned int vced_count, vcei_count; | |||
36 | */ | 36 | */ |
37 | #define HAVE_ARCH_PICK_MMAP_LAYOUT 1 | 37 | #define HAVE_ARCH_PICK_MMAP_LAYOUT 1 |
38 | 38 | ||
39 | /* | ||
40 | * A special page (the vdso) is mapped into all processes at the very | ||
41 | * top of the virtual memory space. | ||
42 | */ | ||
43 | #define SPECIAL_PAGES_SIZE PAGE_SIZE | ||
44 | |||
45 | #ifdef CONFIG_32BIT | 39 | #ifdef CONFIG_32BIT |
46 | #ifdef CONFIG_KVM_GUEST | 40 | #ifdef CONFIG_KVM_GUEST |
47 | /* User space process size is limited to 1GB in KVM Guest Mode */ | 41 | /* User space process size is limited to 1GB in KVM Guest Mode */ |
@@ -80,7 +74,7 @@ extern unsigned int vced_count, vcei_count; | |||
80 | 74 | ||
81 | #endif | 75 | #endif |
82 | 76 | ||
83 | #define STACK_TOP ((TASK_SIZE & PAGE_MASK) - SPECIAL_PAGES_SIZE) | 77 | #define STACK_TOP (TASK_SIZE & PAGE_MASK) |
84 | 78 | ||
85 | /* | 79 | /* |
86 | * This decides where the kernel will search for a free chunk of vm | 80 | * This decides where the kernel will search for a free chunk of vm |
diff --git a/arch/mips/include/asm/vdso.h b/arch/mips/include/asm/vdso.h index cca56aa40ff4..8f4ca5dd992b 100644 --- a/arch/mips/include/asm/vdso.h +++ b/arch/mips/include/asm/vdso.h | |||
@@ -1,29 +1,136 @@ | |||
1 | /* | 1 | /* |
2 | * This file is subject to the terms and conditions of the GNU General Public | 2 | * Copyright (C) 2015 Imagination Technologies |
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * Author: Alex Smith <alex.smith@imgtec.com> |
4 | * for more details. | ||
5 | * | 4 | * |
6 | * Copyright (C) 2009 Cavium Networks | 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. | ||
7 | */ | 9 | */ |
8 | 10 | ||
9 | #ifndef __ASM_VDSO_H | 11 | #ifndef __ASM_VDSO_H |
10 | #define __ASM_VDSO_H | 12 | #define __ASM_VDSO_H |
11 | 13 | ||
12 | #include <linux/types.h> | 14 | #include <linux/mm_types.h> |
13 | 15 | ||
16 | #include <asm/barrier.h> | ||
14 | 17 | ||
15 | #ifdef CONFIG_32BIT | 18 | /** |
16 | struct mips_vdso { | 19 | * struct mips_vdso_image - Details of a VDSO image. |
17 | u32 signal_trampoline[2]; | 20 | * @data: Pointer to VDSO image data (page-aligned). |
18 | u32 rt_signal_trampoline[2]; | 21 | * @size: Size of the VDSO image data (page-aligned). |
22 | * @off_sigreturn: Offset of the sigreturn() trampoline. | ||
23 | * @off_rt_sigreturn: Offset of the rt_sigreturn() trampoline. | ||
24 | * @mapping: Special mapping structure. | ||
25 | * | ||
26 | * This structure contains details of a VDSO image, including the image data | ||
27 | * and offsets of certain symbols required by the kernel. It is generated as | ||
28 | * part of the VDSO build process, aside from the mapping page array, which is | ||
29 | * populated at runtime. | ||
30 | */ | ||
31 | struct mips_vdso_image { | ||
32 | void *data; | ||
33 | unsigned long size; | ||
34 | |||
35 | unsigned long off_sigreturn; | ||
36 | unsigned long off_rt_sigreturn; | ||
37 | |||
38 | struct vm_special_mapping mapping; | ||
19 | }; | 39 | }; |
20 | #else /* !CONFIG_32BIT */ | 40 | |
21 | struct mips_vdso { | 41 | /* |
22 | u32 o32_signal_trampoline[2]; | 42 | * The following structures are auto-generated as part of the build for each |
23 | u32 o32_rt_signal_trampoline[2]; | 43 | * ABI by genvdso, see arch/mips/vdso/Makefile. |
24 | u32 rt_signal_trampoline[2]; | 44 | */ |
25 | u32 n32_rt_signal_trampoline[2]; | 45 | |
46 | extern struct mips_vdso_image vdso_image; | ||
47 | |||
48 | #ifdef CONFIG_MIPS32_O32 | ||
49 | extern struct mips_vdso_image vdso_image_o32; | ||
50 | #endif | ||
51 | |||
52 | #ifdef CONFIG_MIPS32_N32 | ||
53 | extern struct mips_vdso_image vdso_image_n32; | ||
54 | #endif | ||
55 | |||
56 | /** | ||
57 | * union mips_vdso_data - Data provided by the kernel for the VDSO. | ||
58 | * @xtime_sec: Current real time (seconds part). | ||
59 | * @xtime_nsec: Current real time (nanoseconds part, shifted). | ||
60 | * @wall_to_mono_sec: Wall-to-monotonic offset (seconds part). | ||
61 | * @wall_to_mono_nsec: Wall-to-monotonic offset (nanoseconds part). | ||
62 | * @seq_count: Counter to synchronise updates (odd = updating). | ||
63 | * @cs_shift: Clocksource shift value. | ||
64 | * @clock_mode: Clocksource to use for time functions. | ||
65 | * @cs_mult: Clocksource multiplier value. | ||
66 | * @cs_cycle_last: Clock cycle value at last update. | ||
67 | * @cs_mask: Clocksource mask value. | ||
68 | * @tz_minuteswest: Minutes west of Greenwich (from timezone). | ||
69 | * @tz_dsttime: Type of DST correction (from timezone). | ||
70 | * | ||
71 | * This structure contains data needed by functions within the VDSO. It is | ||
72 | * populated by the kernel and mapped read-only into user memory. The time | ||
73 | * fields are mirrors of internal data from the timekeeping infrastructure. | ||
74 | * | ||
75 | * Note: Care should be taken when modifying as the layout must remain the same | ||
76 | * for both 64- and 32-bit (for 32-bit userland on 64-bit kernel). | ||
77 | */ | ||
78 | union mips_vdso_data { | ||
79 | struct { | ||
80 | u64 xtime_sec; | ||
81 | u64 xtime_nsec; | ||
82 | u32 wall_to_mono_sec; | ||
83 | u32 wall_to_mono_nsec; | ||
84 | u32 seq_count; | ||
85 | u32 cs_shift; | ||
86 | u8 clock_mode; | ||
87 | u32 cs_mult; | ||
88 | u64 cs_cycle_last; | ||
89 | u64 cs_mask; | ||
90 | s32 tz_minuteswest; | ||
91 | s32 tz_dsttime; | ||
92 | }; | ||
93 | |||
94 | u8 page[PAGE_SIZE]; | ||
26 | }; | 95 | }; |
27 | #endif /* CONFIG_32BIT */ | 96 | |
97 | static inline u32 vdso_data_read_begin(const union mips_vdso_data *data) | ||
98 | { | ||
99 | u32 seq; | ||
100 | |||
101 | while (true) { | ||
102 | seq = ACCESS_ONCE(data->seq_count); | ||
103 | if (likely(!(seq & 1))) { | ||
104 | /* Paired with smp_wmb() in vdso_data_write_*(). */ | ||
105 | smp_rmb(); | ||
106 | return seq; | ||
107 | } | ||
108 | |||
109 | cpu_relax(); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | static inline bool vdso_data_read_retry(const union mips_vdso_data *data, | ||
114 | u32 start_seq) | ||
115 | { | ||
116 | /* Paired with smp_wmb() in vdso_data_write_*(). */ | ||
117 | smp_rmb(); | ||
118 | return unlikely(data->seq_count != start_seq); | ||
119 | } | ||
120 | |||
121 | static inline void vdso_data_write_begin(union mips_vdso_data *data) | ||
122 | { | ||
123 | ++data->seq_count; | ||
124 | |||
125 | /* Ensure sequence update is written before other data page values. */ | ||
126 | smp_wmb(); | ||
127 | } | ||
128 | |||
129 | static inline void vdso_data_write_end(union mips_vdso_data *data) | ||
130 | { | ||
131 | /* Ensure data values are written before updating sequence again. */ | ||
132 | smp_wmb(); | ||
133 | ++data->seq_count; | ||
134 | } | ||
28 | 135 | ||
29 | #endif /* __ASM_VDSO_H */ | 136 | #endif /* __ASM_VDSO_H */ |