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>
39 #include <asm/processor.h>
42 #include <asm/machdep.h> /* for pa7300lc_init() proto */
43 #include <asm/pdc_chassis.h>
45 #include <asm/setup.h>
46 #include <asm/unwind.h>
48 static char __initdata command_line
[COMMAND_LINE_SIZE
];
50 /* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */
51 struct proc_dir_entry
* proc_runway_root __read_mostly
= NULL
;
52 struct proc_dir_entry
* proc_gsc_root __read_mostly
= NULL
;
53 struct proc_dir_entry
* proc_mckinley_root __read_mostly
= NULL
;
55 #if !defined(CONFIG_PA20) && (defined(CONFIG_IOMMU_CCIO) || defined(CONFIG_IOMMU_SBA))
56 int parisc_bus_is_phys __read_mostly
= 1; /* Assume no IOMMU is present */
57 EXPORT_SYMBOL(parisc_bus_is_phys
);
60 void __init
setup_cmdline(char **cmdline_p
)
62 extern unsigned int boot_args
[];
64 /* Collect stuff passed in from the boot loader */
66 /* boot_args[0] is free-mem start, boot_args[1] is ptr to command line */
67 if (boot_args
[0] < 64) {
68 /* called from hpux boot loader */
69 boot_command_line
[0] = '\0';
71 strcpy(boot_command_line
, (char *)__va(boot_args
[1]));
73 #ifdef CONFIG_BLK_DEV_INITRD
74 if (boot_args
[2] != 0) /* did palo pass us a ramdisk? */
76 initrd_start
= (unsigned long)__va(boot_args
[2]);
77 initrd_end
= (unsigned long)__va(boot_args
[3]);
82 strcpy(command_line
, boot_command_line
);
83 *cmdline_p
= command_line
;
87 void __init
dma_ops_init(void)
89 switch (boot_cpu_data
.cpu_type
) {
92 * We've got way too many dependencies on 1.1 semantics
93 * to support 1.0 boxes at this point.
95 panic( "PA-RISC Linux currently only supports machines that conform to\n"
96 "the PA-RISC 1.1 or 2.0 architecture specification.\n");
100 hppa_dma_ops
= &pcx_dma_ops
;
104 case pcxl
: /* falls through */
105 hppa_dma_ops
= &pcxl_dma_ops
;
113 extern int init_per_cpu(int cpuid
);
114 extern void collect_boot_cpu_data(void);
116 void __init
setup_arch(char **cmdline_p
)
119 extern int parisc_narrow_firmware
;
123 init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */
126 printk(KERN_INFO
"The 64-bit Kernel has started...\n");
128 printk(KERN_INFO
"The 32-bit Kernel has started...\n");
134 if(parisc_narrow_firmware
) {
135 printk(KERN_INFO
"Kernel is using PDC in 32-bit mode.\n");
139 setup_cmdline(cmdline_p
);
140 collect_boot_cpu_data();
141 do_memory_inventory(); /* probe for physical memory */
145 #ifdef CONFIG_CHASSIS_LCD_LED
146 /* initialize the LCD/LED after boot_cpu_data is available ! */
147 led_init(); /* LCD/LED initialization */
154 #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
155 conswitchp
= &dummy_con
; /* we use take_over_console() later ! */
161 * Display CPU info for all CPUs.
162 * for parisc this is in processor.c
164 extern int show_cpuinfo (struct seq_file
*m
, void *v
);
167 c_start (struct seq_file
*m
, loff_t
*pos
)
169 /* Looks like the caller will call repeatedly until we return
170 * 0, signaling EOF perhaps. This could be used to sequence
171 * through CPUs for example. Since we print all cpu info in our
172 * show_cpuinfo() disregarding 'pos' (which I assume is 'v' above)
173 * we only allow for one "position". */
174 return ((long)*pos
< 1) ? (void *)1 : NULL
;
178 c_next (struct seq_file
*m
, void *v
, loff_t
*pos
)
181 return c_start(m
, pos
);
185 c_stop (struct seq_file
*m
, void *v
)
189 const struct seq_operations cpuinfo_op
= {
196 static void __init
parisc_proc_mkdir(void)
199 ** Can't call proc_mkdir() until after proc_root_init() has been
200 ** called by start_kernel(). In other words, this code can't
201 ** live in arch/.../setup.c because start_parisc() calls
204 switch (boot_cpu_data
.cpu_type
) {
207 if (NULL
== proc_gsc_root
)
209 proc_gsc_root
= proc_mkdir("bus/gsc", NULL
);
218 if (NULL
== proc_runway_root
)
220 proc_runway_root
= proc_mkdir("bus/runway", NULL
);
225 if (NULL
== proc_mckinley_root
)
227 proc_mckinley_root
= proc_mkdir("bus/mckinley", NULL
);
231 /* FIXME: this was added to prevent the compiler
232 * complaining about missing pcx, pcxs and pcxt
233 * I'm assuming they have neither gsc nor runway */
238 static struct resource central_bus
= {
239 .name
= "Central Bus",
240 .start
= F_EXTEND(0xfff80000),
241 .end
= F_EXTEND(0xfffaffff),
242 .flags
= IORESOURCE_MEM
,
245 static struct resource local_broadcast
= {
246 .name
= "Local Broadcast",
247 .start
= F_EXTEND(0xfffb0000),
248 .end
= F_EXTEND(0xfffdffff),
249 .flags
= IORESOURCE_MEM
,
252 static struct resource global_broadcast
= {
253 .name
= "Global Broadcast",
254 .start
= F_EXTEND(0xfffe0000),
255 .end
= F_EXTEND(0xffffffff),
256 .flags
= IORESOURCE_MEM
,
259 static int __init
parisc_init_resources(void)
263 result
= request_resource(&iomem_resource
, ¢ral_bus
);
266 "%s: failed to claim %s address space!\n",
267 __FILE__
, central_bus
.name
);
271 result
= request_resource(&iomem_resource
, &local_broadcast
);
274 "%s: failed to claim %saddress space!\n",
275 __FILE__
, local_broadcast
.name
);
279 result
= request_resource(&iomem_resource
, &global_broadcast
);
282 "%s: failed to claim %s address space!\n",
283 __FILE__
, global_broadcast
.name
);
290 extern void gsc_init(void);
291 extern void processor_init(void);
292 extern void ccio_init(void);
293 extern void hppb_init(void);
294 extern void dino_init(void);
295 extern void iosapic_init(void);
296 extern void lba_init(void);
297 extern void sba_init(void);
298 extern void eisa_init(void);
300 static int __init
parisc_init(void)
302 u32 osid
= (OS_ID_LINUX
<< 16);
305 parisc_init_resources();
306 do_device_inventory(); /* probe for hardware */
308 parisc_pdc_chassis_init();
310 /* set up a new led state on systems shipped LED State panel */
311 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BSTART
);
313 /* tell PDC we're Linux. Nevermind failure. */
314 pdc_stable_write(0x40, &osid
, sizeof(osid
));
317 printk(KERN_INFO
"CPU(s): %d x %s at %d.%06d MHz\n",
319 boot_cpu_data
.cpu_name
,
320 boot_cpu_data
.cpu_hz
/ 1000000,
321 boot_cpu_data
.cpu_hz
% 1000000 );
323 parisc_setup_cache_timing();
325 /* These are in a non-obvious order, will fix when we have an iotree */
326 #if defined(CONFIG_IOSAPIC)
329 #if defined(CONFIG_IOMMU_SBA)
332 #if defined(CONFIG_PCI_LBA)
336 /* CCIO before any potential subdevices */
337 #if defined(CONFIG_IOMMU_CCIO)
342 * Need to register Asp & Wax before the EISA adapters for the IRQ
343 * regions. EISA must come before PCI to be sure it gets IRQ region
346 #if defined(CONFIG_GSC_LASI) || defined(CONFIG_GSC_WAX)
353 #if defined(CONFIG_HPPB)
357 #if defined(CONFIG_GSC_DINO)
361 #ifdef CONFIG_CHASSIS_LCD_LED
362 register_led_regions(); /* register LED port info in procfs */
367 arch_initcall(parisc_init
);
369 void start_parisc(void)
371 extern void start_kernel(void);
374 struct pdc_coproc_cfg coproc_cfg
;
376 cpunum
= smp_processor_id();
378 set_firmware_width_unlocked();
380 ret
= pdc_coproc_cfg_unlocked(&coproc_cfg
);
381 if (ret
>= 0 && coproc_cfg
.ccr_functional
) {
382 mtctl(coproc_cfg
.ccr_functional
, 10);
384 per_cpu(cpu_data
, cpunum
).fp_rev
= coproc_cfg
.revision
;
385 per_cpu(cpu_data
, cpunum
).fp_model
= coproc_cfg
.model
;
387 asm volatile ("fstd %fr0,8(%sp)");
389 panic("must have an fpu to boot linux");