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
);
235 static struct resource central_bus
= {
236 .name
= "Central Bus",
237 .start
= F_EXTEND(0xfff80000),
238 .end
= F_EXTEND(0xfffaffff),
239 .flags
= IORESOURCE_MEM
,
242 static struct resource local_broadcast
= {
243 .name
= "Local Broadcast",
244 .start
= F_EXTEND(0xfffb0000),
245 .end
= F_EXTEND(0xfffdffff),
246 .flags
= IORESOURCE_MEM
,
249 static struct resource global_broadcast
= {
250 .name
= "Global Broadcast",
251 .start
= F_EXTEND(0xfffe0000),
252 .end
= F_EXTEND(0xffffffff),
253 .flags
= IORESOURCE_MEM
,
256 static int __init
parisc_init_resources(void)
260 result
= request_resource(&iomem_resource
, ¢ral_bus
);
263 "%s: failed to claim %s address space!\n",
264 __FILE__
, central_bus
.name
);
268 result
= request_resource(&iomem_resource
, &local_broadcast
);
271 "%s: failed to claim %saddress space!\n",
272 __FILE__
, local_broadcast
.name
);
276 result
= request_resource(&iomem_resource
, &global_broadcast
);
279 "%s: failed to claim %s address space!\n",
280 __FILE__
, global_broadcast
.name
);
287 extern void gsc_init(void);
288 extern void processor_init(void);
289 extern void ccio_init(void);
290 extern void hppb_init(void);
291 extern void dino_init(void);
292 extern void iosapic_init(void);
293 extern void lba_init(void);
294 extern void sba_init(void);
295 extern void eisa_init(void);
297 static int __init
parisc_init(void)
299 u32 osid
= (OS_ID_LINUX
<< 16);
302 parisc_init_resources();
303 do_device_inventory(); /* probe for hardware */
305 parisc_pdc_chassis_init();
307 /* set up a new led state on systems shipped LED State panel */
308 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BSTART
);
310 /* tell PDC we're Linux. Nevermind failure. */
311 pdc_stable_write(0x40, &osid
, sizeof(osid
));
314 printk(KERN_INFO
"CPU(s): %d x %s at %d.%06d MHz\n",
316 boot_cpu_data
.cpu_name
,
317 boot_cpu_data
.cpu_hz
/ 1000000,
318 boot_cpu_data
.cpu_hz
% 1000000 );
320 parisc_setup_cache_timing();
322 /* These are in a non-obvious order, will fix when we have an iotree */
323 #if defined(CONFIG_IOSAPIC)
326 #if defined(CONFIG_IOMMU_SBA)
329 #if defined(CONFIG_PCI_LBA)
333 /* CCIO before any potential subdevices */
334 #if defined(CONFIG_IOMMU_CCIO)
339 * Need to register Asp & Wax before the EISA adapters for the IRQ
340 * regions. EISA must come before PCI to be sure it gets IRQ region
343 #if defined(CONFIG_GSC_LASI) || defined(CONFIG_GSC_WAX)
350 #if defined(CONFIG_HPPB)
354 #if defined(CONFIG_GSC_DINO)
358 #ifdef CONFIG_CHASSIS_LCD_LED
359 register_led_regions(); /* register LED port info in procfs */
364 arch_initcall(parisc_init
);
366 void start_parisc(void)
368 extern void start_kernel(void);
371 struct pdc_coproc_cfg coproc_cfg
;
373 cpunum
= smp_processor_id();
375 set_firmware_width_unlocked();
377 ret
= pdc_coproc_cfg_unlocked(&coproc_cfg
);
378 if (ret
>= 0 && coproc_cfg
.ccr_functional
) {
379 mtctl(coproc_cfg
.ccr_functional
, 10);
381 per_cpu(cpu_data
, cpunum
).fp_rev
= coproc_cfg
.revision
;
382 per_cpu(cpu_data
, cpunum
).fp_model
= coproc_cfg
.model
;
384 asm volatile ("fstd %fr0,8(%sp)");
386 panic("must have an fpu to boot linux");