aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/include/asm')
-rw-r--r--arch/sh/include/asm/atomic.h2
-rw-r--r--arch/sh/include/asm/cache.h4
-rw-r--r--arch/sh/include/asm/clkdev.h35
-rw-r--r--arch/sh/include/asm/clock.h161
-rw-r--r--arch/sh/include/asm/dmaengine.h63
-rw-r--r--arch/sh/include/asm/hw_breakpoint.h11
-rw-r--r--arch/sh/include/asm/hwblk.h12
-rw-r--r--arch/sh/include/asm/io_generic.h1
-rw-r--r--arch/sh/include/asm/irq.h19
-rw-r--r--arch/sh/include/asm/kexec.h8
-rw-r--r--arch/sh/include/asm/machvec.h2
-rw-r--r--arch/sh/include/asm/mmzone.h3
-rw-r--r--arch/sh/include/asm/page.h15
-rw-r--r--arch/sh/include/asm/processor.h7
-rw-r--r--arch/sh/include/asm/processor_32.h2
-rw-r--r--arch/sh/include/asm/setup.h1
-rw-r--r--arch/sh/include/asm/siu.h8
-rw-r--r--arch/sh/include/asm/smp-ops.h51
-rw-r--r--arch/sh/include/asm/smp.h40
19 files changed, 190 insertions, 255 deletions
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h
index 275a448ae8c..c7983124d99 100644
--- a/arch/sh/include/asm/atomic.h
+++ b/arch/sh/include/asm/atomic.h
@@ -13,7 +13,7 @@
13 13
14#define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) 14#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
15 15
16#define atomic_read(v) ((v)->counter) 16#define atomic_read(v) (*(volatile int *)&(v)->counter)
17#define atomic_set(v,i) ((v)->counter = (i)) 17#define atomic_set(v,i) ((v)->counter = (i))
18 18
19#if defined(CONFIG_GUSA_RB) 19#if defined(CONFIG_GUSA_RB)
diff --git a/arch/sh/include/asm/cache.h b/arch/sh/include/asm/cache.h
index 02df18ea960..e461d67f03c 100644
--- a/arch/sh/include/asm/cache.h
+++ b/arch/sh/include/asm/cache.h
@@ -38,14 +38,10 @@ struct cache_info {
38 * 2. those in the physical page number. 38 * 2. those in the physical page number.
39 */ 39 */
40 unsigned int alias_mask; 40 unsigned int alias_mask;
41
42 unsigned int n_aliases; /* Number of aliases */ 41 unsigned int n_aliases; /* Number of aliases */
43 42
44 unsigned long flags; 43 unsigned long flags;
45}; 44};
46
47int __init detect_cpu_and_cache_system(void);
48
49#endif /* __ASSEMBLY__ */ 45#endif /* __ASSEMBLY__ */
50#endif /* __KERNEL__ */ 46#endif /* __KERNEL__ */
51#endif /* __ASM_SH_CACHE_H */ 47#endif /* __ASM_SH_CACHE_H */
diff --git a/arch/sh/include/asm/clkdev.h b/arch/sh/include/asm/clkdev.h
new file mode 100644
index 00000000000..5645f358128
--- /dev/null
+++ b/arch/sh/include/asm/clkdev.h
@@ -0,0 +1,35 @@
1/*
2 * arch/sh/include/asm/clkdev.h
3 *
4 * Cloned from arch/arm/include/asm/clkdev.h:
5 *
6 * Copyright (C) 2008 Russell King.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * Helper for the clk API to assist looking up a struct clk.
13 */
14#ifndef __ASM_CLKDEV_H
15#define __ASM_CLKDEV_H
16
17struct clk;
18
19struct clk_lookup {
20 struct list_head node;
21 const char *dev_id;
22 const char *con_id;
23 struct clk *clk;
24};
25
26struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
27 const char *dev_fmt, ...);
28
29void clkdev_add(struct clk_lookup *cl);
30void clkdev_drop(struct clk_lookup *cl);
31
32void clkdev_add_table(struct clk_lookup *, size_t);
33int clk_add_alias(const char *, const char *, char *, struct device *);
34
35#endif
diff --git a/arch/sh/include/asm/clock.h b/arch/sh/include/asm/clock.h
index 11da4c5beb6..803d4c7f09d 100644
--- a/arch/sh/include/asm/clock.h
+++ b/arch/sh/include/asm/clock.h
@@ -1,171 +1,16 @@
1#ifndef __ASM_SH_CLOCK_H 1#ifndef __ASM_SH_CLOCK_H
2#define __ASM_SH_CLOCK_H 2#define __ASM_SH_CLOCK_H
3 3
4#include <linux/list.h> 4#include <linux/sh_clk.h>
5#include <linux/seq_file.h>
6#include <linux/cpufreq.h>
7#include <linux/clk.h>
8#include <linux/err.h>
9
10struct clk;
11
12struct clk_ops {
13 void (*init)(struct clk *clk);
14 int (*enable)(struct clk *clk);
15 void (*disable)(struct clk *clk);
16 unsigned long (*recalc)(struct clk *clk);
17 int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
18 int (*set_parent)(struct clk *clk, struct clk *parent);
19 long (*round_rate)(struct clk *clk, unsigned long rate);
20};
21
22struct clk {
23 struct list_head node;
24 const char *name;
25 int id;
26 struct module *owner;
27
28 struct clk *parent;
29 struct clk_ops *ops;
30
31 struct list_head children;
32 struct list_head sibling; /* node for children */
33
34 int usecount;
35
36 unsigned long rate;
37 unsigned long flags;
38
39 void __iomem *enable_reg;
40 unsigned int enable_bit;
41
42 unsigned long arch_flags;
43 void *priv;
44 struct dentry *dentry;
45 struct cpufreq_frequency_table *freq_table;
46};
47
48struct clk_lookup {
49 struct list_head node;
50 const char *dev_id;
51 const char *con_id;
52 struct clk *clk;
53};
54
55#define CLK_ENABLE_ON_INIT (1 << 0)
56 5
57/* Should be defined by processor-specific code */ 6/* Should be defined by processor-specific code */
58void __deprecated arch_init_clk_ops(struct clk_ops **, int type); 7void __deprecated arch_init_clk_ops(struct clk_ops **, int type);
59int __init arch_clk_init(void); 8int __init arch_clk_init(void);
60 9
61/* arch/sh/kernel/cpu/clock.c */
62int clk_init(void);
63unsigned long followparent_recalc(struct clk *);
64void recalculate_root_clocks(void);
65void propagate_rate(struct clk *);
66int clk_reparent(struct clk *child, struct clk *parent);
67int clk_register(struct clk *);
68void clk_unregister(struct clk *);
69
70/* arch/sh/kernel/cpu/clock-cpg.c */ 10/* arch/sh/kernel/cpu/clock-cpg.c */
71int __init __deprecated cpg_clk_init(void); 11int __init __deprecated cpg_clk_init(void);
72 12
73/* the exported API, in addition to clk_set_rate */ 13/* arch/sh/kernel/cpu/clock.c */
74/** 14int clk_init(void);
75 * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
76 * @clk: clock source
77 * @rate: desired clock rate in Hz
78 * @algo_id: algorithm id to be passed down to ops->set_rate
79 *
80 * Returns success (0) or negative errno.
81 */
82int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
83
84enum clk_sh_algo_id {
85 NO_CHANGE = 0,
86
87 IUS_N1_N1,
88 IUS_322,
89 IUS_522,
90 IUS_N11,
91
92 SB_N1,
93
94 SB3_N1,
95 SB3_32,
96 SB3_43,
97 SB3_54,
98
99 BP_N1,
100
101 IP_N1,
102};
103
104struct clk_div_mult_table {
105 unsigned int *divisors;
106 unsigned int nr_divisors;
107 unsigned int *multipliers;
108 unsigned int nr_multipliers;
109};
110
111struct cpufreq_frequency_table;
112void clk_rate_table_build(struct clk *clk,
113 struct cpufreq_frequency_table *freq_table,
114 int nr_freqs,
115 struct clk_div_mult_table *src_table,
116 unsigned long *bitmap);
117
118long clk_rate_table_round(struct clk *clk,
119 struct cpufreq_frequency_table *freq_table,
120 unsigned long rate);
121
122int clk_rate_table_find(struct clk *clk,
123 struct cpufreq_frequency_table *freq_table,
124 unsigned long rate);
125
126#define SH_CLK_MSTP32(_name, _id, _parent, _enable_reg, \
127 _enable_bit, _flags) \
128{ \
129 .name = _name, \
130 .id = _id, \
131 .parent = _parent, \
132 .enable_reg = (void __iomem *)_enable_reg, \
133 .enable_bit = _enable_bit, \
134 .flags = _flags, \
135}
136
137int sh_clk_mstp32_register(struct clk *clks, int nr);
138
139#define SH_CLK_DIV4(_name, _parent, _reg, _shift, _div_bitmap, _flags) \
140{ \
141 .name = _name, \
142 .parent = _parent, \
143 .enable_reg = (void __iomem *)_reg, \
144 .enable_bit = _shift, \
145 .arch_flags = _div_bitmap, \
146 .flags = _flags, \
147}
148
149struct clk_div4_table {
150 struct clk_div_mult_table *div_mult_table;
151 void (*kick)(struct clk *clk);
152};
153
154int sh_clk_div4_register(struct clk *clks, int nr,
155 struct clk_div4_table *table);
156int sh_clk_div4_enable_register(struct clk *clks, int nr,
157 struct clk_div4_table *table);
158int sh_clk_div4_reparent_register(struct clk *clks, int nr,
159 struct clk_div4_table *table);
160
161#define SH_CLK_DIV6(_name, _parent, _reg, _flags) \
162{ \
163 .name = _name, \
164 .parent = _parent, \
165 .enable_reg = (void __iomem *)_reg, \
166 .flags = _flags, \
167}
168
169int sh_clk_div6_register(struct clk *clks, int nr);
170 15
171#endif /* __ASM_SH_CLOCK_H */ 16#endif /* __ASM_SH_CLOCK_H */
diff --git a/arch/sh/include/asm/dmaengine.h b/arch/sh/include/asm/dmaengine.h
index bf2f30cf0a2..2a02b611a9a 100644
--- a/arch/sh/include/asm/dmaengine.h
+++ b/arch/sh/include/asm/dmaengine.h
@@ -10,14 +10,9 @@
10#ifndef ASM_DMAENGINE_H 10#ifndef ASM_DMAENGINE_H
11#define ASM_DMAENGINE_H 11#define ASM_DMAENGINE_H
12 12
13#include <linux/dmaengine.h> 13#include <linux/sh_dma.h>
14#include <linux/list.h>
15 14
16#include <asm/dma-register.h> 15enum {
17
18#define SH_DMAC_MAX_CHANNELS 6
19
20enum sh_dmae_slave_chan_id {
21 SHDMA_SLAVE_SCIF0_TX, 16 SHDMA_SLAVE_SCIF0_TX,
22 SHDMA_SLAVE_SCIF0_RX, 17 SHDMA_SLAVE_SCIF0_RX,
23 SHDMA_SLAVE_SCIF1_TX, 18 SHDMA_SLAVE_SCIF1_TX,
@@ -34,60 +29,6 @@ enum sh_dmae_slave_chan_id {
34 SHDMA_SLAVE_SIUA_RX, 29 SHDMA_SLAVE_SIUA_RX,
35 SHDMA_SLAVE_SIUB_TX, 30 SHDMA_SLAVE_SIUB_TX,
36 SHDMA_SLAVE_SIUB_RX, 31 SHDMA_SLAVE_SIUB_RX,
37 SHDMA_SLAVE_NUMBER, /* Must stay last */
38};
39
40struct sh_dmae_slave_config {
41 enum sh_dmae_slave_chan_id slave_id;
42 dma_addr_t addr;
43 u32 chcr;
44 char mid_rid;
45};
46
47struct sh_dmae_channel {
48 unsigned int offset;
49 unsigned int dmars;
50 unsigned int dmars_bit;
51};
52
53struct sh_dmae_pdata {
54 struct sh_dmae_slave_config *slave;
55 int slave_num;
56 struct sh_dmae_channel *channel;
57 int channel_num;
58 unsigned int ts_low_shift;
59 unsigned int ts_low_mask;
60 unsigned int ts_high_shift;
61 unsigned int ts_high_mask;
62 unsigned int *ts_shift;
63 int ts_shift_num;
64 u16 dmaor_init;
65};
66
67struct device;
68
69/* Used by slave DMA clients to request DMA to/from a specific peripheral */
70struct sh_dmae_slave {
71 enum sh_dmae_slave_chan_id slave_id; /* Set by the platform */
72 struct device *dma_dev; /* Set by the platform */
73 struct sh_dmae_slave_config *config; /* Set by the driver */
74};
75
76struct sh_dmae_regs {
77 u32 sar; /* SAR / source address */
78 u32 dar; /* DAR / destination address */
79 u32 tcr; /* TCR / transfer count */
80};
81
82struct sh_desc {
83 struct sh_dmae_regs hw;
84 struct list_head node;
85 struct dma_async_tx_descriptor async_tx;
86 enum dma_data_direction direction;
87 dma_cookie_t cookie;
88 size_t partial;
89 int chunks;
90 int mark;
91}; 32};
92 33
93#endif 34#endif
diff --git a/arch/sh/include/asm/hw_breakpoint.h b/arch/sh/include/asm/hw_breakpoint.h
index 965dd780d51..89890f61a7b 100644
--- a/arch/sh/include/asm/hw_breakpoint.h
+++ b/arch/sh/include/asm/hw_breakpoint.h
@@ -46,17 +46,20 @@ struct pmu;
46/* Maximum number of UBC channels */ 46/* Maximum number of UBC channels */
47#define HBP_NUM 2 47#define HBP_NUM 2
48 48
49static inline int hw_breakpoint_slots(int type)
50{
51 return HBP_NUM;
52}
53
49/* arch/sh/kernel/hw_breakpoint.c */ 54/* arch/sh/kernel/hw_breakpoint.c */
50extern int arch_check_va_in_userspace(unsigned long va, u16 hbp_len); 55extern int arch_check_bp_in_kernelspace(struct perf_event *bp);
51extern int arch_validate_hwbkpt_settings(struct perf_event *bp, 56extern int arch_validate_hwbkpt_settings(struct perf_event *bp);
52 struct task_struct *tsk);
53extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused, 57extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
54 unsigned long val, void *data); 58 unsigned long val, void *data);
55 59
56int arch_install_hw_breakpoint(struct perf_event *bp); 60int arch_install_hw_breakpoint(struct perf_event *bp);
57void arch_uninstall_hw_breakpoint(struct perf_event *bp); 61void arch_uninstall_hw_breakpoint(struct perf_event *bp);
58void hw_breakpoint_pmu_read(struct perf_event *bp); 62void hw_breakpoint_pmu_read(struct perf_event *bp);
59void hw_breakpoint_pmu_unthrottle(struct perf_event *bp);
60 63
61extern void arch_fill_perf_breakpoint(struct perf_event *bp); 64extern void arch_fill_perf_breakpoint(struct perf_event *bp);
62extern int register_sh_ubc(struct sh_ubc *); 65extern int register_sh_ubc(struct sh_ubc *);
diff --git a/arch/sh/include/asm/hwblk.h b/arch/sh/include/asm/hwblk.h
index 5d3ccae4202..855e945c619 100644
--- a/arch/sh/include/asm/hwblk.h
+++ b/arch/sh/include/asm/hwblk.h
@@ -58,13 +58,11 @@ void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt);
58void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt); 58void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt);
59 59
60/* allow clocks to enable and disable hardware blocks */ 60/* allow clocks to enable and disable hardware blocks */
61#define SH_HWBLK_CLK(_name, _id, _parent, _hwblk, _flags) \ 61#define SH_HWBLK_CLK(_hwblk, _parent, _flags) \
62{ \ 62[_hwblk] = { \
63 .name = _name, \ 63 .parent = _parent, \
64 .id = _id, \ 64 .arch_flags = _hwblk, \
65 .parent = _parent, \ 65 .flags = _flags, \
66 .arch_flags = _hwblk, \
67 .flags = _flags, \
68} 66}
69 67
70int sh_hwblk_clk_register(struct clk *clks, int nr); 68int sh_hwblk_clk_register(struct clk *clks, int nr);
diff --git a/arch/sh/include/asm/io_generic.h b/arch/sh/include/asm/io_generic.h
index 1e5d375f55d..491df93cbf8 100644
--- a/arch/sh/include/asm/io_generic.h
+++ b/arch/sh/include/asm/io_generic.h
@@ -38,5 +38,6 @@ void IO_CONCAT(__IO_PREFIX,iounmap)(void *addr);
38 38
39void __iomem *IO_CONCAT(__IO_PREFIX,ioport_map)(unsigned long addr, unsigned int size); 39void __iomem *IO_CONCAT(__IO_PREFIX,ioport_map)(unsigned long addr, unsigned int size);
40void IO_CONCAT(__IO_PREFIX,ioport_unmap)(void __iomem *addr); 40void IO_CONCAT(__IO_PREFIX,ioport_unmap)(void __iomem *addr);
41void IO_CONCAT(__IO_PREFIX,mem_init)(void);
41 42
42#undef __IO_PREFIX 43#undef __IO_PREFIX
diff --git a/arch/sh/include/asm/irq.h b/arch/sh/include/asm/irq.h
index df8e1500527..02c2f0102cf 100644
--- a/arch/sh/include/asm/irq.h
+++ b/arch/sh/include/asm/irq.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_SH_IRQ_H 1#ifndef __ASM_SH_IRQ_H
2#define __ASM_SH_IRQ_H 2#define __ASM_SH_IRQ_H
3 3
4#include <linux/cpumask.h>
4#include <asm/machvec.h> 5#include <asm/machvec.h>
5 6
6/* 7/*
@@ -12,6 +13,14 @@
12#define NR_IRQS_LEGACY 8 /* Legacy external IRQ0-7 */ 13#define NR_IRQS_LEGACY 8 /* Legacy external IRQ0-7 */
13 14
14/* 15/*
16 * This is a special IRQ number for indicating that no IRQ has been
17 * triggered and to simply ignore the IRQ dispatch. This is a special
18 * case that can happen with IRQ auto-distribution when multiple CPUs
19 * are woken up and signalled in parallel.
20 */
21#define NO_IRQ_IGNORE ((unsigned int)-1)
22
23/*
15 * Convert back and forth between INTEVT and IRQ values. 24 * Convert back and forth between INTEVT and IRQ values.
16 */ 25 */
17#ifdef CONFIG_CPU_HAS_INTEVT 26#ifdef CONFIG_CPU_HAS_INTEVT
@@ -42,6 +51,8 @@ static inline int generic_irq_demux(int irq)
42#define irq_demux(irq) sh_mv.mv_irq_demux(irq) 51#define irq_demux(irq) sh_mv.mv_irq_demux(irq)
43 52
44void init_IRQ(void); 53void init_IRQ(void);
54void migrate_irqs(void);
55
45asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs); 56asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs);
46 57
47#ifdef CONFIG_IRQSTACKS 58#ifdef CONFIG_IRQSTACKS
@@ -53,6 +64,14 @@ extern void irq_ctx_exit(int cpu);
53# define irq_ctx_exit(cpu) do { } while (0) 64# define irq_ctx_exit(cpu) do { } while (0)
54#endif 65#endif
55 66
67#ifdef CONFIG_INTC_BALANCING
68extern unsigned int irq_lookup(unsigned int irq);
69extern void irq_finish(unsigned int irq);
70#else
71#define irq_lookup(irq) (irq)
72#define irq_finish(irq) do { } while (0)
73#endif
74
56#include <asm-generic/irq.h> 75#include <asm-generic/irq.h>
57#ifdef CONFIG_CPU_SH5 76#ifdef CONFIG_CPU_SH5
58#include <cpu/irq.h> 77#include <cpu/irq.h>
diff --git a/arch/sh/include/asm/kexec.h b/arch/sh/include/asm/kexec.h
index 765a5e1660f..ad6ef8a275e 100644
--- a/arch/sh/include/asm/kexec.h
+++ b/arch/sh/include/asm/kexec.h
@@ -26,6 +26,10 @@
26/* The native architecture */ 26/* The native architecture */
27#define KEXEC_ARCH KEXEC_ARCH_SH 27#define KEXEC_ARCH KEXEC_ARCH_SH
28 28
29#ifdef CONFIG_KEXEC
30/* arch/sh/kernel/machine_kexec.c */
31void reserve_crashkernel(void);
32
29static inline void crash_setup_regs(struct pt_regs *newregs, 33static inline void crash_setup_regs(struct pt_regs *newregs,
30 struct pt_regs *oldregs) 34 struct pt_regs *oldregs)
31{ 35{
@@ -59,4 +63,8 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
59 newregs->pc = (unsigned long)current_text_addr(); 63 newregs->pc = (unsigned long)current_text_addr();
60 } 64 }
61} 65}
66#else
67static inline void reserve_crashkernel(void) { }
68#endif /* CONFIG_KEXEC */
69
62#endif /* __ASM_SH_KEXEC_H */ 70#endif /* __ASM_SH_KEXEC_H */
diff --git a/arch/sh/include/asm/machvec.h b/arch/sh/include/asm/machvec.h
index 9c30955630f..bc0218cb72e 100644
--- a/arch/sh/include/asm/machvec.h
+++ b/arch/sh/include/asm/machvec.h
@@ -49,6 +49,8 @@ struct sh_machine_vector {
49 49
50 int (*mv_clk_init)(void); 50 int (*mv_clk_init)(void);
51 int (*mv_mode_pins)(void); 51 int (*mv_mode_pins)(void);
52
53 void (*mv_mem_init)(void);
52}; 54};
53 55
54extern struct sh_machine_vector sh_mv; 56extern struct sh_machine_vector sh_mv;
diff --git a/arch/sh/include/asm/mmzone.h b/arch/sh/include/asm/mmzone.h
index 7f5363b29ba..8887baff5ef 100644
--- a/arch/sh/include/asm/mmzone.h
+++ b/arch/sh/include/asm/mmzone.h
@@ -42,9 +42,10 @@ setup_bootmem_node(int nid, unsigned long start, unsigned long end)
42void __init plat_mem_setup(void); 42void __init plat_mem_setup(void);
43 43
44/* arch/sh/kernel/setup.c */ 44/* arch/sh/kernel/setup.c */
45void __init setup_bootmem_allocator(unsigned long start_pfn);
46void __init __add_active_range(unsigned int nid, unsigned long start_pfn, 45void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
47 unsigned long end_pfn); 46 unsigned long end_pfn);
47/* arch/sh/mm/init.c */
48void __init allocate_pgdat(unsigned int nid);
48 49
49#endif /* __KERNEL__ */ 50#endif /* __KERNEL__ */
50#endif /* __ASM_SH_MMZONE_H */ 51#endif /* __ASM_SH_MMZONE_H */
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
index d71feb35930..fb703d120d0 100644
--- a/arch/sh/include/asm/page.h
+++ b/arch/sh/include/asm/page.h
@@ -49,7 +49,7 @@
49 49
50extern unsigned long shm_align_mask; 50extern unsigned long shm_align_mask;
51extern unsigned long max_low_pfn, min_low_pfn; 51extern unsigned long max_low_pfn, min_low_pfn;
52extern unsigned long memory_start, memory_end; 52extern unsigned long memory_start, memory_end, memory_limit;
53 53
54static inline unsigned long 54static inline unsigned long
55pages_do_alias(unsigned long addr1, unsigned long addr2) 55pages_do_alias(unsigned long addr1, unsigned long addr2)
@@ -128,13 +128,18 @@ typedef struct page *pgtable_t;
128 * added or subtracted as required. 128 * added or subtracted as required.
129 */ 129 */
130#ifdef CONFIG_PMB 130#ifdef CONFIG_PMB
131#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET+__MEMORY_START) 131#define ___pa(x) ((x)-PAGE_OFFSET+__MEMORY_START)
132#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET-__MEMORY_START)) 132#define ___va(x) ((x)+PAGE_OFFSET-__MEMORY_START)
133#else 133#else
134#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 134#define ___pa(x) ((x)-PAGE_OFFSET)
135#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 135#define ___va(x) ((x)+PAGE_OFFSET)
136#endif 136#endif
137 137
138#ifndef __ASSEMBLY__
139#define __pa(x) ___pa((unsigned long)x)
140#define __va(x) (void *)___va((unsigned long)x)
141#endif /* !__ASSEMBLY__ */
142
138#ifdef CONFIG_UNCACHED_MAPPING 143#ifdef CONFIG_UNCACHED_MAPPING
139#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + uncached_start) 144#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + uncached_start)
140#define CAC_ADDR(addr) ((addr) - uncached_start + PAGE_OFFSET) 145#define CAC_ADDR(addr) ((addr) - uncached_start + PAGE_OFFSET)
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index 9605e062840..0a58cb25a65 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -85,6 +85,10 @@ struct sh_cpuinfo {
85 struct tlb_info itlb; 85 struct tlb_info itlb;
86 struct tlb_info dtlb; 86 struct tlb_info dtlb;
87 87
88#ifdef CONFIG_SMP
89 struct task_struct *idle;
90#endif
91
88 unsigned long flags; 92 unsigned long flags;
89} __attribute__ ((aligned(L1_CACHE_BYTES))); 93} __attribute__ ((aligned(L1_CACHE_BYTES)));
90 94
@@ -102,6 +106,9 @@ struct task_struct;
102 106
103extern struct pt_regs fake_swapper_regs; 107extern struct pt_regs fake_swapper_regs;
104 108
109extern void cpu_init(void);
110extern void cpu_probe(void);
111
105/* arch/sh/kernel/process.c */ 112/* arch/sh/kernel/process.c */
106extern unsigned int xstate_size; 113extern unsigned int xstate_size;
107extern void free_thread_xstate(struct task_struct *); 114extern void free_thread_xstate(struct task_struct *);
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
index 572b4eb0949..61a445d2d02 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -27,8 +27,6 @@
27#define CCN_CVR 0xff000040 27#define CCN_CVR 0xff000040
28#define CCN_PRR 0xff000044 28#define CCN_PRR 0xff000044
29 29
30asmlinkage void __init sh_cpu_init(void);
31
32/* 30/*
33 * User space process size: 2GB. 31 * User space process size: 2GB.
34 * 32 *
diff --git a/arch/sh/include/asm/setup.h b/arch/sh/include/asm/setup.h
index 4758325bb24..01fa17a3d75 100644
--- a/arch/sh/include/asm/setup.h
+++ b/arch/sh/include/asm/setup.h
@@ -19,6 +19,7 @@
19#define COMMAND_LINE ((char *) (PARAM+0x100)) 19#define COMMAND_LINE ((char *) (PARAM+0x100))
20 20
21void sh_mv_setup(void); 21void sh_mv_setup(void);
22void check_for_initrd(void);
22 23
23#endif /* __KERNEL__ */ 24#endif /* __KERNEL__ */
24 25
diff --git a/arch/sh/include/asm/siu.h b/arch/sh/include/asm/siu.h
index f1b1e6944a5..e8d4142baf5 100644
--- a/arch/sh/include/asm/siu.h
+++ b/arch/sh/include/asm/siu.h
@@ -17,10 +17,10 @@ struct device;
17 17
18struct siu_platform { 18struct siu_platform {
19 struct device *dma_dev; 19 struct device *dma_dev;
20 enum sh_dmae_slave_chan_id dma_slave_tx_a; 20 unsigned int dma_slave_tx_a;
21 enum sh_dmae_slave_chan_id dma_slave_rx_a; 21 unsigned int dma_slave_rx_a;
22 enum sh_dmae_slave_chan_id dma_slave_tx_b; 22 unsigned int dma_slave_tx_b;
23 enum sh_dmae_slave_chan_id dma_slave_rx_b; 23 unsigned int dma_slave_rx_b;
24}; 24};
25 25
26#endif /* ASM_SIU_H */ 26#endif /* ASM_SIU_H */
diff --git a/arch/sh/include/asm/smp-ops.h b/arch/sh/include/asm/smp-ops.h
new file mode 100644
index 00000000000..c590f76856f
--- /dev/null
+++ b/arch/sh/include/asm/smp-ops.h
@@ -0,0 +1,51 @@
1#ifndef __ASM_SH_SMP_OPS_H
2#define __ASM_SH_SMP_OPS_H
3
4struct plat_smp_ops {
5 void (*smp_setup)(void);
6 unsigned int (*smp_processor_id)(void);
7 void (*prepare_cpus)(unsigned int max_cpus);
8 void (*start_cpu)(unsigned int cpu, unsigned long entry_point);
9 void (*send_ipi)(unsigned int cpu, unsigned int message);
10 int (*cpu_disable)(unsigned int cpu);
11 void (*cpu_die)(unsigned int cpu);
12 void (*play_dead)(void);
13};
14
15extern struct plat_smp_ops *mp_ops;
16extern struct plat_smp_ops shx3_smp_ops;
17
18#ifdef CONFIG_SMP
19
20static inline void plat_smp_setup(void)
21{
22 BUG_ON(!mp_ops);
23 mp_ops->smp_setup();
24}
25
26static inline void play_dead(void)
27{
28 mp_ops->play_dead();
29}
30
31extern void register_smp_ops(struct plat_smp_ops *ops);
32
33#else
34
35static inline void plat_smp_setup(void)
36{
37 /* UP, nothing to do ... */
38}
39
40static inline void register_smp_ops(struct plat_smp_ops *ops)
41{
42}
43
44static inline void play_dead(void)
45{
46 BUG();
47}
48
49#endif /* CONFIG_SMP */
50
51#endif /* __ASM_SH_SMP_OPS_H */
diff --git a/arch/sh/include/asm/smp.h b/arch/sh/include/asm/smp.h
index 53ef26ced75..9070d943ddd 100644
--- a/arch/sh/include/asm/smp.h
+++ b/arch/sh/include/asm/smp.h
@@ -3,15 +3,16 @@
3 3
4#include <linux/bitops.h> 4#include <linux/bitops.h>
5#include <linux/cpumask.h> 5#include <linux/cpumask.h>
6#include <asm/smp-ops.h>
6 7
7#ifdef CONFIG_SMP 8#ifdef CONFIG_SMP
8 9
9#include <linux/spinlock.h> 10#include <linux/spinlock.h>
10#include <asm/atomic.h> 11#include <asm/atomic.h>
11#include <asm/current.h> 12#include <asm/current.h>
13#include <asm/percpu.h>
12 14
13#define raw_smp_processor_id() (current_thread_info()->cpu) 15#define raw_smp_processor_id() (current_thread_info()->cpu)
14#define hard_smp_processor_id() plat_smp_processor_id()
15 16
16/* Map from cpu id to sequential logical cpu number. */ 17/* Map from cpu id to sequential logical cpu number. */
17extern int __cpu_number_map[NR_CPUS]; 18extern int __cpu_number_map[NR_CPUS];
@@ -30,20 +31,43 @@ enum {
30 SMP_MSG_NR, /* must be last */ 31 SMP_MSG_NR, /* must be last */
31}; 32};
32 33
34DECLARE_PER_CPU(int, cpu_state);
35
33void smp_message_recv(unsigned int msg); 36void smp_message_recv(unsigned int msg);
34void smp_timer_broadcast(const struct cpumask *mask); 37void smp_timer_broadcast(const struct cpumask *mask);
35 38
36void local_timer_interrupt(void); 39void local_timer_interrupt(void);
37void local_timer_setup(unsigned int cpu); 40void local_timer_setup(unsigned int cpu);
38 41void local_timer_stop(unsigned int cpu);
39void plat_smp_setup(void);
40void plat_prepare_cpus(unsigned int max_cpus);
41int plat_smp_processor_id(void);
42void plat_start_cpu(unsigned int cpu, unsigned long entry_point);
43void plat_send_ipi(unsigned int cpu, unsigned int message);
44 42
45void arch_send_call_function_single_ipi(int cpu); 43void arch_send_call_function_single_ipi(int cpu);
46extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 44void arch_send_call_function_ipi_mask(const struct cpumask *mask);
45
46void native_play_dead(void);
47void native_cpu_die(unsigned int cpu);
48int native_cpu_disable(unsigned int cpu);
49
50#ifdef CONFIG_HOTPLUG_CPU
51void play_dead_common(void);
52extern int __cpu_disable(void);
53
54static inline void __cpu_die(unsigned int cpu)
55{
56 extern struct plat_smp_ops *mp_ops; /* private */
57
58 mp_ops->cpu_die(cpu);
59}
60#endif
61
62static inline int hard_smp_processor_id(void)
63{
64 extern struct plat_smp_ops *mp_ops; /* private */
65
66 if (!mp_ops)
67 return 0; /* boot CPU */
68
69 return mp_ops->smp_processor_id();
70}
47 71
48#else 72#else
49 73