1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29#include <linux/kernel.h>
30#include <linux/initrd.h>
31#include <linux/init.h>
32#include <linux/console.h>
33#include <linux/seq_file.h>
34#define PCI_DEBUG
35#include <linux/pci.h>
36#undef PCI_DEBUG
37#include <linux/proc_fs.h>
38#include <linux/export.h>
39#include <linux/sched.h>
40#include <linux/sched/clock.h>
41#include <linux/start_kernel.h>
42
43#include <asm/processor.h>
44#include <asm/sections.h>
45#include <asm/pdc.h>
46#include <asm/led.h>
47#include <asm/machdep.h>
48#include <asm/pdc_chassis.h>
49#include <asm/io.h>
50#include <asm/setup.h>
51#include <asm/unwind.h>
52#include <asm/smp.h>
53
54static char __initdata command_line[COMMAND_LINE_SIZE];
55
56
57struct proc_dir_entry * proc_runway_root __read_mostly = NULL;
58struct proc_dir_entry * proc_gsc_root __read_mostly = NULL;
59struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL;
60
61void __init setup_cmdline(char **cmdline_p)
62{
63 extern unsigned int boot_args[];
64
65
66
67
68 if (boot_args[0] < 64) {
69
70 boot_command_line[0] = '\0';
71 } else {
72 strlcpy(boot_command_line, (char *)__va(boot_args[1]),
73 COMMAND_LINE_SIZE);
74
75#ifdef CONFIG_BLK_DEV_INITRD
76 if (boot_args[2] != 0)
77 {
78 initrd_start = (unsigned long)__va(boot_args[2]);
79 initrd_end = (unsigned long)__va(boot_args[3]);
80 }
81#endif
82 }
83
84 strcpy(command_line, boot_command_line);
85 *cmdline_p = command_line;
86}
87
88#ifdef CONFIG_PA11
89void __init dma_ops_init(void)
90{
91 switch (boot_cpu_data.cpu_type) {
92 case pcx:
93
94
95
96
97 panic( "PA-RISC Linux currently only supports machines that conform to\n"
98 "the PA-RISC 1.1 or 2.0 architecture specification.\n");
99
100 case pcxl2:
101 pa7300lc_init();
102 case pcxl:
103 case pcxs:
104 case pcxt:
105 hppa_dma_ops = &dma_noncoherent_ops;
106 break;
107 default:
108 break;
109 }
110}
111#endif
112
113extern void collect_boot_cpu_data(void);
114
115void __init setup_arch(char **cmdline_p)
116{
117#ifdef CONFIG_64BIT
118 extern int parisc_narrow_firmware;
119#endif
120 unwind_init();
121
122 init_per_cpu(smp_processor_id());
123
124#ifdef CONFIG_64BIT
125 printk(KERN_INFO "The 64-bit Kernel has started...\n");
126#else
127 printk(KERN_INFO "The 32-bit Kernel has started...\n");
128#endif
129
130 printk(KERN_INFO "Kernel default page size is %d KB. Huge pages ",
131 (int)(PAGE_SIZE / 1024));
132#ifdef CONFIG_HUGETLB_PAGE
133 printk(KERN_CONT "enabled with %d MB physical and %d MB virtual size",
134 1 << (REAL_HPAGE_SHIFT - 20), 1 << (HPAGE_SHIFT - 20));
135#else
136 printk(KERN_CONT "disabled");
137#endif
138 printk(KERN_CONT ".\n");
139
140
141
142
143
144
145 if (__pa((unsigned long) &_end) >= KERNEL_INITIAL_SIZE)
146 panic("KERNEL_INITIAL_ORDER too small!");
147
148 pdc_console_init();
149
150#ifdef CONFIG_64BIT
151 if(parisc_narrow_firmware) {
152 printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n");
153 }
154#endif
155 setup_pdc();
156 setup_cmdline(cmdline_p);
157 collect_boot_cpu_data();
158 do_memory_inventory();
159 parisc_cache_init();
160 paging_init();
161
162#ifdef CONFIG_CHASSIS_LCD_LED
163
164 led_init();
165#endif
166
167#ifdef CONFIG_PA11
168 dma_ops_init();
169#endif
170
171#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
172 conswitchp = &dummy_con;
173#endif
174
175 clear_sched_clock_stable();
176}
177
178
179
180
181
182extern int show_cpuinfo (struct seq_file *m, void *v);
183
184static void *
185c_start (struct seq_file *m, loff_t *pos)
186{
187
188
189
190
191
192 return ((long)*pos < 1) ? (void *)1 : NULL;
193}
194
195static void *
196c_next (struct seq_file *m, void *v, loff_t *pos)
197{
198 ++*pos;
199 return c_start(m, pos);
200}
201
202static void
203c_stop (struct seq_file *m, void *v)
204{
205}
206
207const struct seq_operations cpuinfo_op = {
208 .start = c_start,
209 .next = c_next,
210 .stop = c_stop,
211 .show = show_cpuinfo
212};
213
214static void __init parisc_proc_mkdir(void)
215{
216
217
218
219
220
221
222 switch (boot_cpu_data.cpu_type) {
223 case pcxl:
224 case pcxl2:
225 if (NULL == proc_gsc_root)
226 {
227 proc_gsc_root = proc_mkdir("bus/gsc", NULL);
228 }
229 break;
230 case pcxt_:
231 case pcxu:
232 case pcxu_:
233 case pcxw:
234 case pcxw_:
235 case pcxw2:
236 if (NULL == proc_runway_root)
237 {
238 proc_runway_root = proc_mkdir("bus/runway", NULL);
239 }
240 break;
241 case mako:
242 case mako2:
243 if (NULL == proc_mckinley_root)
244 {
245 proc_mckinley_root = proc_mkdir("bus/mckinley", NULL);
246 }
247 break;
248 default:
249
250
251
252 break;
253 }
254}
255
256static struct resource central_bus = {
257 .name = "Central Bus",
258 .start = F_EXTEND(0xfff80000),
259 .end = F_EXTEND(0xfffaffff),
260 .flags = IORESOURCE_MEM,
261};
262
263static struct resource local_broadcast = {
264 .name = "Local Broadcast",
265 .start = F_EXTEND(0xfffb0000),
266 .end = F_EXTEND(0xfffdffff),
267 .flags = IORESOURCE_MEM,
268};
269
270static struct resource global_broadcast = {
271 .name = "Global Broadcast",
272 .start = F_EXTEND(0xfffe0000),
273 .end = F_EXTEND(0xffffffff),
274 .flags = IORESOURCE_MEM,
275};
276
277static int __init parisc_init_resources(void)
278{
279 int result;
280
281 result = request_resource(&iomem_resource, ¢ral_bus);
282 if (result < 0) {
283 printk(KERN_ERR
284 "%s: failed to claim %s address space!\n",
285 __FILE__, central_bus.name);
286 return result;
287 }
288
289 result = request_resource(&iomem_resource, &local_broadcast);
290 if (result < 0) {
291 printk(KERN_ERR
292 "%s: failed to claim %saddress space!\n",
293 __FILE__, local_broadcast.name);
294 return result;
295 }
296
297 result = request_resource(&iomem_resource, &global_broadcast);
298 if (result < 0) {
299 printk(KERN_ERR
300 "%s: failed to claim %s address space!\n",
301 __FILE__, global_broadcast.name);
302 return result;
303 }
304
305 return 0;
306}
307
308extern void gsc_init(void);
309extern void processor_init(void);
310extern void ccio_init(void);
311extern void hppb_init(void);
312extern void dino_init(void);
313extern void iosapic_init(void);
314extern void lba_init(void);
315extern void sba_init(void);
316extern void eisa_init(void);
317
318static int __init parisc_init(void)
319{
320 u32 osid = (OS_ID_LINUX << 16);
321
322 parisc_proc_mkdir();
323 parisc_init_resources();
324 do_device_inventory();
325
326 parisc_pdc_chassis_init();
327
328
329 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BSTART);
330
331
332 pdc_stable_write(0x40, &osid, sizeof(osid));
333
334
335 flush_cache_all_local();
336 flush_tlb_all_local(NULL);
337
338 processor_init();
339#ifdef CONFIG_SMP
340 pr_info("CPU(s): %d out of %d %s at %d.%06d MHz online\n",
341 num_online_cpus(), num_present_cpus(),
342#else
343 pr_info("CPU(s): 1 x %s at %d.%06d MHz\n",
344#endif
345 boot_cpu_data.cpu_name,
346 boot_cpu_data.cpu_hz / 1000000,
347 boot_cpu_data.cpu_hz % 1000000 );
348
349 parisc_setup_cache_timing();
350
351
352#if defined(CONFIG_IOSAPIC)
353 iosapic_init();
354#endif
355#if defined(CONFIG_IOMMU_SBA)
356 sba_init();
357#endif
358#if defined(CONFIG_PCI_LBA)
359 lba_init();
360#endif
361
362
363#if defined(CONFIG_IOMMU_CCIO)
364 ccio_init();
365#endif
366
367
368
369
370
371
372#if defined(CONFIG_GSC_LASI) || defined(CONFIG_GSC_WAX)
373 gsc_init();
374#endif
375#ifdef CONFIG_EISA
376 eisa_init();
377#endif
378
379#if defined(CONFIG_HPPB)
380 hppb_init();
381#endif
382
383#if defined(CONFIG_GSC_DINO)
384 dino_init();
385#endif
386
387#ifdef CONFIG_CHASSIS_LCD_LED
388 register_led_regions();
389#endif
390
391 return 0;
392}
393arch_initcall(parisc_init);
394
395void __init start_parisc(void)
396{
397 extern void early_trap_init(void);
398
399 int ret, cpunum;
400 struct pdc_coproc_cfg coproc_cfg;
401
402 cpunum = smp_processor_id();
403
404 init_cpu_topology();
405
406 set_firmware_width_unlocked();
407
408 ret = pdc_coproc_cfg_unlocked(&coproc_cfg);
409 if (ret >= 0 && coproc_cfg.ccr_functional) {
410 mtctl(coproc_cfg.ccr_functional, 10);
411
412 per_cpu(cpu_data, cpunum).fp_rev = coproc_cfg.revision;
413 per_cpu(cpu_data, cpunum).fp_model = coproc_cfg.model;
414
415 asm volatile ("fstd %fr0,8(%sp)");
416 } else {
417 panic("must have an fpu to boot linux");
418 }
419
420 early_trap_init();
421
422 start_kernel();
423
424}
425