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 pcxs:
101 case pcxt:
102 hppa_dma_ops = &pcx_dma_ops;
103 break;
104 case pcxl2:
105 pa7300lc_init();
106 case pcxl:
107 hppa_dma_ops = &pcxl_dma_ops;
108 break;
109 default:
110 break;
111 }
112}
113#endif
114
115extern void collect_boot_cpu_data(void);
116
117void __init setup_arch(char **cmdline_p)
118{
119#ifdef CONFIG_64BIT
120 extern int parisc_narrow_firmware;
121#endif
122 unwind_init();
123
124 init_per_cpu(smp_processor_id());
125
126#ifdef CONFIG_64BIT
127 printk(KERN_INFO "The 64-bit Kernel has started...\n");
128#else
129 printk(KERN_INFO "The 32-bit Kernel has started...\n");
130#endif
131
132 printk(KERN_INFO "Kernel default page size is %d KB. Huge pages ",
133 (int)(PAGE_SIZE / 1024));
134#ifdef CONFIG_HUGETLB_PAGE
135 printk(KERN_CONT "enabled with %d MB physical and %d MB virtual size",
136 1 << (REAL_HPAGE_SHIFT - 20), 1 << (HPAGE_SHIFT - 20));
137#else
138 printk(KERN_CONT "disabled");
139#endif
140 printk(KERN_CONT ".\n");
141
142
143
144
145
146
147 if (__pa((unsigned long) &_end) >= KERNEL_INITIAL_SIZE)
148 panic("KERNEL_INITIAL_ORDER too small!");
149
150 pdc_console_init();
151
152#ifdef CONFIG_64BIT
153 if(parisc_narrow_firmware) {
154 printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n");
155 }
156#endif
157 setup_pdc();
158 setup_cmdline(cmdline_p);
159 collect_boot_cpu_data();
160 do_memory_inventory();
161 parisc_cache_init();
162 paging_init();
163
164#ifdef CONFIG_CHASSIS_LCD_LED
165
166 led_init();
167#endif
168
169#ifdef CONFIG_PA11
170 dma_ops_init();
171#endif
172
173#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
174 conswitchp = &dummy_con;
175#endif
176
177 clear_sched_clock_stable();
178}
179
180
181
182
183
184extern int show_cpuinfo (struct seq_file *m, void *v);
185
186static void *
187c_start (struct seq_file *m, loff_t *pos)
188{
189
190
191
192
193
194 return ((long)*pos < 1) ? (void *)1 : NULL;
195}
196
197static void *
198c_next (struct seq_file *m, void *v, loff_t *pos)
199{
200 ++*pos;
201 return c_start(m, pos);
202}
203
204static void
205c_stop (struct seq_file *m, void *v)
206{
207}
208
209const struct seq_operations cpuinfo_op = {
210 .start = c_start,
211 .next = c_next,
212 .stop = c_stop,
213 .show = show_cpuinfo
214};
215
216static void __init parisc_proc_mkdir(void)
217{
218
219
220
221
222
223
224 switch (boot_cpu_data.cpu_type) {
225 case pcxl:
226 case pcxl2:
227 if (NULL == proc_gsc_root)
228 {
229 proc_gsc_root = proc_mkdir("bus/gsc", NULL);
230 }
231 break;
232 case pcxt_:
233 case pcxu:
234 case pcxu_:
235 case pcxw:
236 case pcxw_:
237 case pcxw2:
238 if (NULL == proc_runway_root)
239 {
240 proc_runway_root = proc_mkdir("bus/runway", NULL);
241 }
242 break;
243 case mako:
244 case mako2:
245 if (NULL == proc_mckinley_root)
246 {
247 proc_mckinley_root = proc_mkdir("bus/mckinley", NULL);
248 }
249 break;
250 default:
251
252
253
254 break;
255 }
256}
257
258static struct resource central_bus = {
259 .name = "Central Bus",
260 .start = F_EXTEND(0xfff80000),
261 .end = F_EXTEND(0xfffaffff),
262 .flags = IORESOURCE_MEM,
263};
264
265static struct resource local_broadcast = {
266 .name = "Local Broadcast",
267 .start = F_EXTEND(0xfffb0000),
268 .end = F_EXTEND(0xfffdffff),
269 .flags = IORESOURCE_MEM,
270};
271
272static struct resource global_broadcast = {
273 .name = "Global Broadcast",
274 .start = F_EXTEND(0xfffe0000),
275 .end = F_EXTEND(0xffffffff),
276 .flags = IORESOURCE_MEM,
277};
278
279static int __init parisc_init_resources(void)
280{
281 int result;
282
283 result = request_resource(&iomem_resource, ¢ral_bus);
284 if (result < 0) {
285 printk(KERN_ERR
286 "%s: failed to claim %s address space!\n",
287 __FILE__, central_bus.name);
288 return result;
289 }
290
291 result = request_resource(&iomem_resource, &local_broadcast);
292 if (result < 0) {
293 printk(KERN_ERR
294 "%s: failed to claim %saddress space!\n",
295 __FILE__, local_broadcast.name);
296 return result;
297 }
298
299 result = request_resource(&iomem_resource, &global_broadcast);
300 if (result < 0) {
301 printk(KERN_ERR
302 "%s: failed to claim %s address space!\n",
303 __FILE__, global_broadcast.name);
304 return result;
305 }
306
307 return 0;
308}
309
310extern void gsc_init(void);
311extern void processor_init(void);
312extern void ccio_init(void);
313extern void hppb_init(void);
314extern void dino_init(void);
315extern void iosapic_init(void);
316extern void lba_init(void);
317extern void sba_init(void);
318extern void eisa_init(void);
319
320static int __init parisc_init(void)
321{
322 u32 osid = (OS_ID_LINUX << 16);
323
324 parisc_proc_mkdir();
325 parisc_init_resources();
326 do_device_inventory();
327
328 parisc_pdc_chassis_init();
329
330
331 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BSTART);
332
333
334 pdc_stable_write(0x40, &osid, sizeof(osid));
335
336
337 flush_cache_all_local();
338 flush_tlb_all_local(NULL);
339
340 processor_init();
341#ifdef CONFIG_SMP
342 pr_info("CPU(s): %d out of %d %s at %d.%06d MHz online\n",
343 num_online_cpus(), num_present_cpus(),
344#else
345 pr_info("CPU(s): 1 x %s at %d.%06d MHz\n",
346#endif
347 boot_cpu_data.cpu_name,
348 boot_cpu_data.cpu_hz / 1000000,
349 boot_cpu_data.cpu_hz % 1000000 );
350
351 parisc_setup_cache_timing();
352
353
354#if defined(CONFIG_IOSAPIC)
355 iosapic_init();
356#endif
357#if defined(CONFIG_IOMMU_SBA)
358 sba_init();
359#endif
360#if defined(CONFIG_PCI_LBA)
361 lba_init();
362#endif
363
364
365#if defined(CONFIG_IOMMU_CCIO)
366 ccio_init();
367#endif
368
369
370
371
372
373
374#if defined(CONFIG_GSC_LASI) || defined(CONFIG_GSC_WAX)
375 gsc_init();
376#endif
377#ifdef CONFIG_EISA
378 eisa_init();
379#endif
380
381#if defined(CONFIG_HPPB)
382 hppb_init();
383#endif
384
385#if defined(CONFIG_GSC_DINO)
386 dino_init();
387#endif
388
389#ifdef CONFIG_CHASSIS_LCD_LED
390 register_led_regions();
391#endif
392
393 return 0;
394}
395arch_initcall(parisc_init);
396
397void __init start_parisc(void)
398{
399 extern void early_trap_init(void);
400
401 int ret, cpunum;
402 struct pdc_coproc_cfg coproc_cfg;
403
404 cpunum = smp_processor_id();
405
406 init_cpu_topology();
407
408 set_firmware_width_unlocked();
409
410 ret = pdc_coproc_cfg_unlocked(&coproc_cfg);
411 if (ret >= 0 && coproc_cfg.ccr_functional) {
412 mtctl(coproc_cfg.ccr_functional, 10);
413
414 per_cpu(cpu_data, cpunum).fp_rev = coproc_cfg.revision;
415 per_cpu(cpu_data, cpunum).fp_model = coproc_cfg.model;
416
417 asm volatile ("fstd %fr0,8(%sp)");
418 } else {
419 panic("must have an fpu to boot linux");
420 }
421
422 early_trap_init();
423
424 start_kernel();
425
426}
427