.. | .. |
---|
13 | 13 | #include <linux/mm.h> |
---|
14 | 14 | #include <linux/export.h> |
---|
15 | 15 | #include <linux/cpumask.h> |
---|
| 16 | +#include <asm/bootinfo.h> |
---|
16 | 17 | #include <asm/cpu.h> |
---|
17 | 18 | #include <asm/io.h> |
---|
18 | | -#include <asm/pgtable.h> |
---|
| 19 | +#include <asm/sgialib.h> |
---|
19 | 20 | #include <asm/time.h> |
---|
| 21 | +#include <asm/sn/agent.h> |
---|
20 | 22 | #include <asm/sn/types.h> |
---|
21 | | -#include <asm/sn/sn0/addrs.h> |
---|
22 | | -#include <asm/sn/sn0/hubni.h> |
---|
23 | | -#include <asm/sn/sn0/hubio.h> |
---|
24 | 23 | #include <asm/sn/klconfig.h> |
---|
25 | 24 | #include <asm/sn/ioc3.h> |
---|
26 | 25 | #include <asm/mipsregs.h> |
---|
27 | 26 | #include <asm/sn/gda.h> |
---|
28 | | -#include <asm/sn/hub.h> |
---|
29 | 27 | #include <asm/sn/intr.h> |
---|
30 | 28 | #include <asm/current.h> |
---|
31 | 29 | #include <asm/processor.h> |
---|
32 | 30 | #include <asm/mmu_context.h> |
---|
33 | 31 | #include <asm/thread_info.h> |
---|
34 | 32 | #include <asm/sn/launch.h> |
---|
35 | | -#include <asm/sn/sn_private.h> |
---|
36 | | -#include <asm/sn/sn0/ip27.h> |
---|
37 | 33 | #include <asm/sn/mapped_kernel.h> |
---|
| 34 | + |
---|
| 35 | +#include "ip27-common.h" |
---|
38 | 36 | |
---|
39 | 37 | #define CPU_NONE (cpuid_t)-1 |
---|
40 | 38 | |
---|
41 | | -static DECLARE_BITMAP(hub_init_mask, MAX_COMPACT_NODES); |
---|
| 39 | +static DECLARE_BITMAP(hub_init_mask, MAX_NUMNODES); |
---|
42 | 40 | nasid_t master_nasid = INVALID_NASID; |
---|
43 | | - |
---|
44 | | -cnodeid_t nasid_to_compact_node[MAX_NASIDS]; |
---|
45 | | -nasid_t compact_to_nasid_node[MAX_COMPACT_NODES]; |
---|
46 | | -cnodeid_t cpuid_to_compact_node[MAXCPUS]; |
---|
47 | | - |
---|
48 | | -EXPORT_SYMBOL(nasid_to_compact_node); |
---|
49 | 41 | |
---|
50 | 42 | struct cpuinfo_ip27 sn_cpu_info[NR_CPUS]; |
---|
51 | 43 | EXPORT_SYMBOL_GPL(sn_cpu_info); |
---|
52 | 44 | |
---|
53 | | -extern void pcibr_setup(cnodeid_t); |
---|
54 | | - |
---|
55 | | -extern void xtalk_probe_node(cnodeid_t nid); |
---|
56 | | - |
---|
57 | | -static void per_hub_init(cnodeid_t cnode) |
---|
| 45 | +static void per_hub_init(nasid_t nasid) |
---|
58 | 46 | { |
---|
59 | | - struct hub_data *hub = hub_data(cnode); |
---|
60 | | - nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode); |
---|
61 | | - int i; |
---|
| 47 | + struct hub_data *hub = hub_data(nasid); |
---|
62 | 48 | |
---|
63 | 49 | cpumask_set_cpu(smp_processor_id(), &hub->h_cpus); |
---|
64 | 50 | |
---|
65 | | - if (test_and_set_bit(cnode, hub_init_mask)) |
---|
| 51 | + if (test_and_set_bit(nasid, hub_init_mask)) |
---|
66 | 52 | return; |
---|
67 | 53 | /* |
---|
68 | 54 | * Set CRB timeout at 5ms, (< PI timeout of 10ms) |
---|
.. | .. |
---|
70 | 56 | REMOTE_HUB_S(nasid, IIO_ICTP, 0x800); |
---|
71 | 57 | REMOTE_HUB_S(nasid, IIO_ICTO, 0xff); |
---|
72 | 58 | |
---|
73 | | - hub_rtc_init(cnode); |
---|
74 | | - xtalk_probe_node(cnode); |
---|
| 59 | + hub_rtc_init(nasid); |
---|
75 | 60 | |
---|
76 | | -#ifdef CONFIG_REPLICATE_EXHANDLERS |
---|
77 | | - /* |
---|
78 | | - * If this is not a headless node initialization, |
---|
79 | | - * copy over the caliased exception handlers. |
---|
80 | | - */ |
---|
81 | | - if (get_compact_nodeid() == cnode) { |
---|
82 | | - extern char except_vec2_generic, except_vec3_generic; |
---|
83 | | - extern void build_tlb_refill_handler(void); |
---|
84 | | - |
---|
85 | | - memcpy((void *)(CKSEG0 + 0x100), &except_vec2_generic, 0x80); |
---|
86 | | - memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x80); |
---|
87 | | - build_tlb_refill_handler(); |
---|
88 | | - memcpy((void *)(CKSEG0 + 0x100), (void *) CKSEG0, 0x80); |
---|
89 | | - memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x100); |
---|
| 61 | + if (nasid) { |
---|
| 62 | + /* copy exception handlers from first node to current node */ |
---|
| 63 | + memcpy((void *)NODE_OFFSET_TO_K0(nasid, 0), |
---|
| 64 | + (void *)CKSEG0, 0x200); |
---|
90 | 65 | __flush_cache_all(); |
---|
91 | | - } |
---|
92 | | -#endif |
---|
93 | | - |
---|
94 | | - /* |
---|
95 | | - * Some interrupts are reserved by hardware or by software convention. |
---|
96 | | - * Mark these as reserved right away so they won't be used accidentally |
---|
97 | | - * later. |
---|
98 | | - */ |
---|
99 | | - for (i = 0; i <= BASE_PCI_IRQ; i++) { |
---|
100 | | - __set_bit(i, hub->irq_alloc_mask); |
---|
101 | | - LOCAL_HUB_CLR_INTR(INT_PEND0_BASELVL + i); |
---|
102 | | - } |
---|
103 | | - |
---|
104 | | - __set_bit(IP_PEND0_6_63, hub->irq_alloc_mask); |
---|
105 | | - LOCAL_HUB_S(PI_INT_PEND_MOD, IP_PEND0_6_63); |
---|
106 | | - |
---|
107 | | - for (i = NI_BRDCAST_ERR_A; i <= MSC_PANIC_INTR; i++) { |
---|
108 | | - __set_bit(i, hub->irq_alloc_mask); |
---|
109 | | - LOCAL_HUB_CLR_INTR(INT_PEND1_BASELVL + i); |
---|
| 66 | + /* switch to node local exception handlers */ |
---|
| 67 | + REMOTE_HUB_S(nasid, PI_CALIAS_SIZE, PI_CALIAS_SIZE_8K); |
---|
110 | 68 | } |
---|
111 | 69 | } |
---|
112 | 70 | |
---|
113 | 71 | void per_cpu_init(void) |
---|
114 | 72 | { |
---|
115 | 73 | int cpu = smp_processor_id(); |
---|
116 | | - int slice = LOCAL_HUB_L(PI_CPU_NUM); |
---|
117 | | - cnodeid_t cnode = get_compact_nodeid(); |
---|
118 | | - struct hub_data *hub = hub_data(cnode); |
---|
119 | | - struct slice_data *si = hub->slice + slice; |
---|
120 | | - int i; |
---|
121 | | - |
---|
122 | | - if (test_and_set_bit(slice, &hub->slice_map)) |
---|
123 | | - return; |
---|
| 74 | + nasid_t nasid = get_nasid(); |
---|
124 | 75 | |
---|
125 | 76 | clear_c0_status(ST0_IM); |
---|
126 | 77 | |
---|
127 | | - per_hub_init(cnode); |
---|
| 78 | + per_hub_init(nasid); |
---|
128 | 79 | |
---|
129 | | - for (i = 0; i < LEVELS_PER_SLICE; i++) |
---|
130 | | - si->level_to_irq[i] = -1; |
---|
| 80 | + pr_info("CPU %d clock is %dMHz.\n", cpu, sn_cpu_info[cpu].p_speed); |
---|
131 | 81 | |
---|
132 | | - /* |
---|
133 | | - * We use this so we can find the local hub's data as fast as only |
---|
134 | | - * possible. |
---|
135 | | - */ |
---|
136 | | - cpu_data[cpu].data = si; |
---|
137 | | - |
---|
138 | | - cpu_time_init(); |
---|
139 | 82 | install_ipi(); |
---|
140 | 83 | |
---|
141 | 84 | /* Install our NMI handler if symmon hasn't installed one. */ |
---|
142 | 85 | install_cpu_nmi_handler(cputoslice(cpu)); |
---|
143 | 86 | |
---|
144 | | - set_c0_status(SRB_DEV0 | SRB_DEV1); |
---|
| 87 | + enable_percpu_irq(IP27_HUB_PEND0_IRQ, IRQ_TYPE_NONE); |
---|
| 88 | + enable_percpu_irq(IP27_HUB_PEND1_IRQ, IRQ_TYPE_NONE); |
---|
145 | 89 | } |
---|
146 | | - |
---|
147 | | -/* |
---|
148 | | - * get_nasid() returns the physical node id number of the caller. |
---|
149 | | - */ |
---|
150 | | -nasid_t |
---|
151 | | -get_nasid(void) |
---|
152 | | -{ |
---|
153 | | - return (nasid_t)((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_NODEID_MASK) |
---|
154 | | - >> NSRI_NODEID_SHFT); |
---|
155 | | -} |
---|
156 | | - |
---|
157 | | -/* |
---|
158 | | - * Map the physical node id to a virtual node id (virtual node ids are contiguous). |
---|
159 | | - */ |
---|
160 | | -cnodeid_t get_compact_nodeid(void) |
---|
161 | | -{ |
---|
162 | | - return NASID_TO_COMPACT_NODEID(get_nasid()); |
---|
163 | | -} |
---|
164 | | - |
---|
165 | | -static inline void ioc3_eth_init(void) |
---|
166 | | -{ |
---|
167 | | - struct ioc3 *ioc3; |
---|
168 | | - nasid_t nid; |
---|
169 | | - |
---|
170 | | - nid = get_nasid(); |
---|
171 | | - ioc3 = (struct ioc3 *) KL_CONFIG_CH_CONS_INFO(nid)->memory_base; |
---|
172 | | - |
---|
173 | | - ioc3->eier = 0; |
---|
174 | | -} |
---|
175 | | - |
---|
176 | | -extern void ip27_reboot_setup(void); |
---|
177 | 90 | |
---|
178 | 91 | void __init plat_mem_setup(void) |
---|
179 | 92 | { |
---|
180 | | - hubreg_t p, e, n_mode; |
---|
| 93 | + u64 p, e, n_mode; |
---|
181 | 94 | nasid_t nid; |
---|
| 95 | + |
---|
| 96 | + register_smp_ops(&ip27_smp_ops); |
---|
182 | 97 | |
---|
183 | 98 | ip27_reboot_setup(); |
---|
184 | 99 | |
---|
.. | .. |
---|
214 | 129 | panic("Kernel compiled for N mode."); |
---|
215 | 130 | #endif |
---|
216 | 131 | |
---|
217 | | - ioc3_eth_init(); |
---|
218 | | - per_cpu_init(); |
---|
219 | | - |
---|
| 132 | + ioport_resource.start = 0; |
---|
| 133 | + ioport_resource.end = ~0UL; |
---|
220 | 134 | set_io_port_base(IO_BASE); |
---|
221 | 135 | } |
---|
| 136 | + |
---|
| 137 | +const char *get_system_type(void) |
---|
| 138 | +{ |
---|
| 139 | + return "SGI Origin"; |
---|
| 140 | +} |
---|
| 141 | + |
---|
| 142 | +void __init prom_init(void) |
---|
| 143 | +{ |
---|
| 144 | + prom_init_cmdline(fw_arg0, (LONG *)fw_arg1); |
---|
| 145 | + prom_meminit(); |
---|
| 146 | +} |
---|
| 147 | + |
---|