initial commit with v2.6.9
[linux-2.6.9-moxart.git] / arch / parisc / kernel / setup.c
blob37bd6a607b95a22639f8bc068325c186f9630c4d
1 /* $Id: setup.c,v 1.8 2000/02/02 04:42:38 prumpf Exp $
3 * Initial setup-routines for HP 9000 based hardware.
5 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
6 * Modifications for PA-RISC (C) 1999 Helge Deller <deller@gmx.de>
7 * Modifications copyright 1999 SuSE GmbH (Philipp Rumpf)
8 * Modifications copyright 2000 Martin K. Petersen <mkp@mkp.net>
9 * Modifications copyright 2000 Philipp Rumpf <prumpf@tux.org>
10 * Modifications copyright 2001 Ryan Bradetich <rbradetich@uswest.net>
12 * Initial PA-RISC Version: 04-23-1999 by Helge Deller
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2, or (at your option)
17 * any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #include <linux/config.h>
31 #include <linux/kernel.h>
32 #include <linux/initrd.h>
33 #include <linux/init.h>
34 #include <linux/console.h>
35 #include <linux/seq_file.h>
36 #define PCI_DEBUG
37 #include <linux/pci.h>
38 #undef PCI_DEBUG
39 #include <linux/proc_fs.h>
41 #include <asm/processor.h>
42 #include <asm/pdc.h>
43 #include <asm/led.h>
44 #include <asm/machdep.h> /* for pa7300lc_init() proto */
45 #include <asm/pdc_chassis.h>
46 #include <asm/io.h>
47 #include <asm/setup.h>
49 char command_line[COMMAND_LINE_SIZE];
51 /* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */
52 struct proc_dir_entry * proc_runway_root = NULL;
53 struct proc_dir_entry * proc_gsc_root = NULL;
54 struct proc_dir_entry * proc_mckinley_root = NULL;
57 void __init setup_cmdline(char **cmdline_p)
59 extern unsigned int boot_args[];
61 /* Collect stuff passed in from the boot loader */
63 /* boot_args[0] is free-mem start, boot_args[1] is ptr to command line */
64 if (boot_args[0] < 64) {
65 /* called from hpux boot loader */
66 saved_command_line[0] = '\0';
67 } else {
68 strcpy(saved_command_line, (char *)__va(boot_args[1]));
70 #ifdef CONFIG_BLK_DEV_INITRD
71 if (boot_args[2] != 0) /* did palo pass us a ramdisk? */
73 initrd_start = (unsigned long)__va(boot_args[2]);
74 initrd_end = (unsigned long)__va(boot_args[3]);
76 #endif
79 strcpy(command_line, saved_command_line);
80 *cmdline_p = command_line;
83 #ifdef CONFIG_PA11
84 void __init dma_ops_init(void)
86 switch (boot_cpu_data.cpu_type) {
87 case pcx:
89 * We've got way too many dependencies on 1.1 semantics
90 * to support 1.0 boxes at this point.
92 panic( "PA-RISC Linux currently only supports machines that conform to\n"
93 "the PA-RISC 1.1 or 2.0 architecture specification.\n");
95 case pcxs:
96 case pcxt:
97 hppa_dma_ops = &pcx_dma_ops;
98 break;
99 case pcxl2:
100 pa7300lc_init();
101 case pcxl: /* falls through */
102 hppa_dma_ops = &pcxl_dma_ops;
103 break;
104 default:
105 break;
108 #endif
110 extern int init_per_cpu(int cpuid);
111 extern void collect_boot_cpu_data(void);
113 void __init setup_arch(char **cmdline_p)
115 init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */
117 #ifdef __LP64__
118 printk(KERN_INFO "The 64-bit Kernel has started...\n");
119 #else
120 printk(KERN_INFO "The 32-bit Kernel has started...\n");
121 #endif
123 pdc_console_init();
125 #ifdef __LP64__
126 extern int parisc_narrow_firmware;
127 if(parisc_narrow_firmware) {
128 printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n");
130 #endif
131 setup_pdc();
132 setup_cmdline(cmdline_p);
133 collect_boot_cpu_data();
134 do_memory_inventory(); /* probe for physical memory */
135 parisc_cache_init();
136 paging_init();
138 #ifdef CONFIG_CHASSIS_LCD_LED
139 /* initialize the LCD/LED after boot_cpu_data is available ! */
140 led_init(); /* LCD/LED initialization */
141 #endif
143 #ifdef CONFIG_PA11
144 dma_ops_init();
145 #endif
147 #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
148 conswitchp = &dummy_con; /* we use take_over_console() later ! */
149 #endif
154 * Display cpu info for all cpu's.
155 * for parisc this is in processor.c
157 extern int show_cpuinfo (struct seq_file *m, void *v);
159 static void *
160 c_start (struct seq_file *m, loff_t *pos)
162 /* Looks like the caller will call repeatedly until we return
163 * 0, signaling EOF perhaps. This could be used to sequence
164 * through CPUs for example. Since we print all cpu info in our
165 * show_cpuinfo() disregarding 'pos' (which I assume is 'v' above)
166 * we only allow for one "position". */
167 return ((long)*pos < 1) ? (void *)1 : NULL;
170 static void *
171 c_next (struct seq_file *m, void *v, loff_t *pos)
173 ++*pos;
174 return c_start(m, pos);
177 static void
178 c_stop (struct seq_file *m, void *v)
182 struct seq_operations cpuinfo_op = {
183 .start = c_start,
184 .next = c_next,
185 .stop = c_stop,
186 .show = show_cpuinfo
189 static void __init parisc_proc_mkdir(void)
192 ** Can't call proc_mkdir() until after proc_root_init() has been
193 ** called by start_kernel(). In other words, this code can't
194 ** live in arch/.../setup.c because start_parisc() calls
195 ** start_kernel().
197 switch (boot_cpu_data.cpu_type) {
198 case pcxl:
199 case pcxl2:
200 if (NULL == proc_gsc_root)
202 proc_gsc_root = proc_mkdir("bus/gsc", 0);
204 break;
205 case pcxt_:
206 case pcxu:
207 case pcxu_:
208 case pcxw:
209 case pcxw_:
210 case pcxw2:
211 if (NULL == proc_runway_root)
213 proc_runway_root = proc_mkdir("bus/runway", 0);
215 break;
216 case mako:
217 if (NULL == proc_mckinley_root)
219 proc_mckinley_root = proc_mkdir("bus/mckinley", 0);
221 break;
222 default:
223 /* FIXME: this was added to prevent the compiler
224 * complaining about missing pcx, pcxs and pcxt
225 * I'm assuming they have neither gsc nor runway */
226 break;
230 static struct resource central_bus = {
231 .name = "Central Bus",
232 .start = F_EXTEND(0xfff80000),
233 .end = F_EXTEND(0xfffaffff),
234 .flags = IORESOURCE_MEM,
237 static struct resource local_broadcast = {
238 .name = "Local Broadcast",
239 .start = F_EXTEND(0xfffb0000),
240 .end = F_EXTEND(0xfffdffff),
241 .flags = IORESOURCE_MEM,
244 static struct resource global_broadcast = {
245 .name = "Global Broadcast",
246 .start = F_EXTEND(0xfffe0000),
247 .end = F_EXTEND(0xffffffff),
248 .flags = IORESOURCE_MEM,
251 static int __init parisc_init_resources(void)
253 int result;
255 result = request_resource(&iomem_resource, &central_bus);
256 if (result < 0) {
257 printk(KERN_ERR
258 "%s: failed to claim %s address space!\n",
259 __FILE__, central_bus.name);
260 return result;
263 result = request_resource(&iomem_resource, &local_broadcast);
264 if (result < 0) {
265 printk(KERN_ERR
266 "%s: failed to claim %saddress space!\n",
267 __FILE__, local_broadcast.name);
268 return result;
271 result = request_resource(&iomem_resource, &global_broadcast);
272 if (result < 0) {
273 printk(KERN_ERR
274 "%s: failed to claim %s address space!\n",
275 __FILE__, global_broadcast.name);
276 return result;
279 return 0;
282 extern void gsc_init(void);
283 extern void processor_init(void);
284 extern void ccio_init(void);
285 extern void hppb_init(void);
286 extern void dino_init(void);
287 extern void iosapic_init(void);
288 extern void lba_init(void);
289 extern void sba_init(void);
290 extern void eisa_init(void);
292 static int __init parisc_init(void)
294 parisc_proc_mkdir();
295 parisc_init_resources();
296 do_device_inventory(); /* probe for hardware */
298 parisc_pdc_chassis_init();
300 /* set up a new led state on systems shipped LED State panel */
301 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BSTART);
303 processor_init();
304 printk(KERN_INFO "CPU(s): %d x %s at %d.%06d MHz\n",
305 boot_cpu_data.cpu_count,
306 boot_cpu_data.cpu_name,
307 boot_cpu_data.cpu_hz / 1000000,
308 boot_cpu_data.cpu_hz % 1000000 );
310 /* These are in a non-obvious order, will fix when we have an iotree */
311 #if defined(CONFIG_IOSAPIC)
312 iosapic_init();
313 #endif
314 #if defined(CONFIG_IOMMU_SBA)
315 sba_init();
316 #endif
317 #if defined(CONFIG_PCI_LBA)
318 lba_init();
319 #endif
321 /* CCIO before any potential subdevices */
322 #if defined(CONFIG_IOMMU_CCIO)
323 ccio_init();
324 #endif
327 * Need to register Asp & Wax before the EISA adapters for the IRQ
328 * regions. EISA must come before PCI to be sure it gets IRQ region
329 * 0.
331 #if defined(CONFIG_GSC_LASI) || defined(CONFIG_GSC_WAX)
332 gsc_init();
333 #endif
334 #ifdef CONFIG_EISA
335 eisa_init();
336 #endif
338 #if defined(CONFIG_HPPB)
339 hppb_init();
340 #endif
342 #if defined(CONFIG_GSC_DINO)
343 dino_init();
344 #endif
346 #ifdef CONFIG_CHASSIS_LCD_LED
347 register_led_regions(); /* register LED port info in procfs */
348 #endif
350 return 0;
353 arch_initcall(parisc_init);