2 * Initial setup-routines for HP 9000 based hardware.
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 * Modifications for PA-RISC (C) 1999 Helge Deller <deller@gmx.de>
6 * Modifications copyright 1999 SuSE GmbH (Philipp Rumpf)
7 * Modifications copyright 2000 Martin K. Petersen <mkp@mkp.net>
8 * Modifications copyright 2000 Philipp Rumpf <prumpf@tux.org>
9 * Modifications copyright 2001 Ryan Bradetich <rbradetich@uswest.net>
11 * Initial PA-RISC Version: 04-23-1999 by Helge Deller
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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>
35 #include <linux/pci.h>
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>
43 #include <asm/processor.h>
44 #include <asm/sections.h>
47 #include <asm/machdep.h> /* for pa7300lc_init() proto */
48 #include <asm/pdc_chassis.h>
50 #include <asm/setup.h>
51 #include <asm/unwind.h>
54 static char __initdata command_line[COMMAND_LINE_SIZE];
56 /* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */
57 struct proc_dir_entry * proc_runway_root __read_mostly = NULL;
58 struct proc_dir_entry * proc_gsc_root __read_mostly = NULL;
59 struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL;
61 void __init setup_cmdline(char **cmdline_p)
63 extern unsigned int boot_args[];
65 /* Collect stuff passed in from the boot loader */
67 /* boot_args[0] is free-mem start, boot_args[1] is ptr to command line */
68 if (boot_args[0] < 64) {
69 /* called from hpux boot loader */
70 boot_command_line[0] = '\0';
72 strlcpy(boot_command_line, (char *)__va(boot_args[1]),
75 #ifdef CONFIG_BLK_DEV_INITRD
76 if (boot_args[2] != 0) /* did palo pass us a ramdisk? */
78 initrd_start = (unsigned long)__va(boot_args[2]);
79 initrd_end = (unsigned long)__va(boot_args[3]);
84 strcpy(command_line, boot_command_line);
85 *cmdline_p = command_line;
89 void __init dma_ops_init(void)
91 switch (boot_cpu_data.cpu_type) {
94 * We've got way too many dependencies on 1.1 semantics
95 * to support 1.0 boxes at this point.
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");
102 case pcxl: /* falls through */
105 hppa_dma_ops = &dma_noncoherent_ops;
113 extern void collect_boot_cpu_data(void);
115 void __init setup_arch(char **cmdline_p)
118 extern int parisc_narrow_firmware;
122 init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */
125 printk(KERN_INFO "The 64-bit Kernel has started...\n");
127 printk(KERN_INFO "The 32-bit Kernel has started...\n");
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));
136 printk(KERN_CONT "disabled");
138 printk(KERN_CONT ".\n");
141 * Check if initial kernel page mappings are sufficient.
142 * panic early if not, else we may access kernel functions
143 * and variables which can't be reached.
145 if (__pa((unsigned long) &_end) >= KERNEL_INITIAL_SIZE)
146 panic("KERNEL_INITIAL_ORDER too small!");
151 if(parisc_narrow_firmware) {
152 printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n");
156 setup_cmdline(cmdline_p);
157 collect_boot_cpu_data();
158 do_memory_inventory(); /* probe for physical memory */
162 #ifdef CONFIG_CHASSIS_LCD_LED
163 /* initialize the LCD/LED after boot_cpu_data is available ! */
164 led_init(); /* LCD/LED initialization */
171 #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
172 conswitchp = &dummy_con; /* we use do_take_over_console() later ! */
175 clear_sched_clock_stable();
179 * Display CPU info for all CPUs.
180 * for parisc this is in processor.c
182 extern int show_cpuinfo (struct seq_file *m, void *v);
185 c_start (struct seq_file *m, loff_t *pos)
187 /* Looks like the caller will call repeatedly until we return
188 * 0, signaling EOF perhaps. This could be used to sequence
189 * through CPUs for example. Since we print all cpu info in our
190 * show_cpuinfo() disregarding 'pos' (which I assume is 'v' above)
191 * we only allow for one "position". */
192 return ((long)*pos < 1) ? (void *)1 : NULL;
196 c_next (struct seq_file *m, void *v, loff_t *pos)
199 return c_start(m, pos);
203 c_stop (struct seq_file *m, void *v)
207 const struct seq_operations cpuinfo_op = {
214 static void __init parisc_proc_mkdir(void)
217 ** Can't call proc_mkdir() until after proc_root_init() has been
218 ** called by start_kernel(). In other words, this code can't
219 ** live in arch/.../setup.c because start_parisc() calls
222 switch (boot_cpu_data.cpu_type) {
225 if (NULL == proc_gsc_root)
227 proc_gsc_root = proc_mkdir("bus/gsc", NULL);
236 if (NULL == proc_runway_root)
238 proc_runway_root = proc_mkdir("bus/runway", NULL);
243 if (NULL == proc_mckinley_root)
245 proc_mckinley_root = proc_mkdir("bus/mckinley", NULL);
249 /* FIXME: this was added to prevent the compiler
250 * complaining about missing pcx, pcxs and pcxt
251 * I'm assuming they have neither gsc nor runway */
256 static struct resource central_bus = {
257 .name = "Central Bus",
258 .start = F_EXTEND(0xfff80000),
259 .end = F_EXTEND(0xfffaffff),
260 .flags = IORESOURCE_MEM,
263 static struct resource local_broadcast = {
264 .name = "Local Broadcast",
265 .start = F_EXTEND(0xfffb0000),
266 .end = F_EXTEND(0xfffdffff),
267 .flags = IORESOURCE_MEM,
270 static struct resource global_broadcast = {
271 .name = "Global Broadcast",
272 .start = F_EXTEND(0xfffe0000),
273 .end = F_EXTEND(0xffffffff),
274 .flags = IORESOURCE_MEM,
277 static int __init parisc_init_resources(void)
281 result = request_resource(&iomem_resource, ¢ral_bus);
284 "%s: failed to claim %s address space!\n",
285 __FILE__, central_bus.name);
289 result = request_resource(&iomem_resource, &local_broadcast);
292 "%s: failed to claim %saddress space!\n",
293 __FILE__, local_broadcast.name);
297 result = request_resource(&iomem_resource, &global_broadcast);
300 "%s: failed to claim %s address space!\n",
301 __FILE__, global_broadcast.name);
308 extern void gsc_init(void);
309 extern void processor_init(void);
310 extern void ccio_init(void);
311 extern void hppb_init(void);
312 extern void dino_init(void);
313 extern void iosapic_init(void);
314 extern void lba_init(void);
315 extern void sba_init(void);
316 extern void eisa_init(void);
318 static int __init parisc_init(void)
320 u32 osid = (OS_ID_LINUX << 16);
323 parisc_init_resources();
324 do_device_inventory(); /* probe for hardware */
326 parisc_pdc_chassis_init();
328 /* set up a new led state on systems shipped LED State panel */
329 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BSTART);
331 /* tell PDC we're Linux. Nevermind failure. */
332 pdc_stable_write(0x40, &osid, sizeof(osid));
334 /* start with known state */
335 flush_cache_all_local();
336 flush_tlb_all_local(NULL);
340 pr_info("CPU(s): %d out of %d %s at %d.%06d MHz online\n",
341 num_online_cpus(), num_present_cpus(),
343 pr_info("CPU(s): 1 x %s at %d.%06d MHz\n",
345 boot_cpu_data.cpu_name,
346 boot_cpu_data.cpu_hz / 1000000,
347 boot_cpu_data.cpu_hz % 1000000 );
349 parisc_setup_cache_timing();
351 /* These are in a non-obvious order, will fix when we have an iotree */
352 #if defined(CONFIG_IOSAPIC)
355 #if defined(CONFIG_IOMMU_SBA)
358 #if defined(CONFIG_PCI_LBA)
362 /* CCIO before any potential subdevices */
363 #if defined(CONFIG_IOMMU_CCIO)
368 * Need to register Asp & Wax before the EISA adapters for the IRQ
369 * regions. EISA must come before PCI to be sure it gets IRQ region
372 #if defined(CONFIG_GSC_LASI) || defined(CONFIG_GSC_WAX)
379 #if defined(CONFIG_HPPB)
383 #if defined(CONFIG_GSC_DINO)
387 #ifdef CONFIG_CHASSIS_LCD_LED
388 register_led_regions(); /* register LED port info in procfs */
393 arch_initcall(parisc_init);
395 void __init start_parisc(void)
397 extern void early_trap_init(void);
400 struct pdc_coproc_cfg coproc_cfg;
402 /* check QEMU/SeaBIOS marker in PAGE0 */
403 running_on_qemu = (memcmp(&PAGE0->pad0, "SeaBIOS", 8) == 0);
405 cpunum = smp_processor_id();
409 set_firmware_width_unlocked();
411 ret = pdc_coproc_cfg_unlocked(&coproc_cfg);
412 if (ret >= 0 && coproc_cfg.ccr_functional) {
413 mtctl(coproc_cfg.ccr_functional, 10);
415 per_cpu(cpu_data, cpunum).fp_rev = coproc_cfg.revision;
416 per_cpu(cpu_data, cpunum).fp_model = coproc_cfg.model;
418 asm volatile ("fstd %fr0,8(%sp)");
420 panic("must have an fpu to boot linux");
423 early_trap_init(); /* initialize checksum of fault_vector */