blob: d914a7996a6684758f9ba1be29b6e012c88c21eb [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Machine specific setup for generic
3 */
4
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#include <linux/interrupt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <asm/arch_hooks.h>
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -07008#include <asm/voyager.h>
9#include <asm/e820.h>
James Bottomleyd5fb3422006-06-27 02:53:50 -070010#include <asm/io.h>
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070011#include <asm/setup.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
13void __init pre_intr_init_hook(void)
14{
15 init_ISA_irqs();
16}
17
18/*
19 * IRQ2 is cascade interrupt to second interrupt controller
20 */
Thomas Gleixner6a61f6a2007-10-17 18:04:36 +020021static struct irqaction irq2 = {
22 .handler = no_action,
23 .mask = CPU_MASK_NONE,
24 .name = "cascade",
25};
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27void __init intr_init_hook(void)
28{
29#ifdef CONFIG_SMP
James Bottomley73557af2008-10-31 13:59:49 -040030 voyager_smp_intr_init();
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#endif
32
James Bottomleyd5fb3422006-06-27 02:53:50 -070033 setup_irq(2, &irq2);
Linus Torvalds1da177e2005-04-16 15:20:36 -070034}
35
James Bottomley92ab7832009-01-31 17:24:43 +010036static void voyager_disable_tsc(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037{
38 /* Voyagers run their CPUs from independent clocks, so disable
39 * the TSC code because we can't sync them */
Andi Kleen404ee5b2008-01-30 13:33:20 +010040 setup_clear_cpu_cap(X86_FEATURE_TSC);
Linus Torvalds1da177e2005-04-16 15:20:36 -070041}
42
James Bottomley92ab7832009-01-31 17:24:43 +010043void __init pre_setup_arch_hook(void)
44{
45 voyager_disable_tsc();
46}
47
48void __init pre_time_init_hook(void)
49{
50 voyager_disable_tsc();
51}
52
Linus Torvalds1da177e2005-04-16 15:20:36 -070053void __init trap_init_hook(void)
54{
55}
56
Ingo Molnara4ec1ef2008-01-30 13:30:10 +010057static struct irqaction irq0 = {
James Bottomley9f483512007-04-30 11:30:10 -050058 .handler = timer_interrupt,
Bernhard Walleb34942f2007-05-08 00:35:29 -070059 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
James Bottomley9f483512007-04-30 11:30:10 -050060 .mask = CPU_MASK_NONE,
61 .name = "timer"
62};
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64void __init time_init_hook(void)
65{
James Bottomley9f483512007-04-30 11:30:10 -050066 irq0.mask = cpumask_of_cpu(safe_smp_processor_id());
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 setup_irq(0, &irq0);
68}
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070069
70/* Hook for machine specific memory setup. */
71
Ingo Molnara4ec1ef2008-01-30 13:30:10 +010072char *__init machine_specific_memory_setup(void)
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070073{
74 char *who;
Paul Jackson6e9bcc72008-05-14 08:15:46 -070075 int new_nr;
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070076
77 who = "NOT VOYAGER";
78
Ingo Molnara4ec1ef2008-01-30 13:30:10 +010079 if (voyager_level == 5) {
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070080 __u32 addr, length;
81 int i;
82
83 who = "Voyager-SUS";
84
85 e820.nr_map = 0;
Ingo Molnara4ec1ef2008-01-30 13:30:10 +010086 for (i = 0; voyager_memory_detect(i, &addr, &length); i++) {
Yinghai Lud0be6bd2008-06-15 18:58:51 -070087 e820_add_region(addr, length, E820_RAM);
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070088 }
89 return who;
Ingo Molnara4ec1ef2008-01-30 13:30:10 +010090 } else if (voyager_level == 4) {
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070091 __u32 tom;
Ingo Molnara4ec1ef2008-01-30 13:30:10 +010092 __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT) << 8;
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070093 /* select the DINO config space */
94 outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT);
95 /* Read DINO top of memory register */
96 tom = ((inb(catbase + 0x4) & 0xf0) << 16)
Ingo Molnara4ec1ef2008-01-30 13:30:10 +010097 + ((inb(catbase + 0x5) & 0x7f) << 24);
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070098
Ingo Molnara4ec1ef2008-01-30 13:30:10 +010099 if (inb(catbase) != VOYAGER_DINO) {
100 printk(KERN_ERR
101 "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
102 tom = (boot_params.screen_info.ext_mem_k) << 10;
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -0700103 }
104 who = "Voyager-TOM";
Yinghai Lud0be6bd2008-06-15 18:58:51 -0700105 e820_add_region(0, 0x9f000, E820_RAM);
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -0700106 /* map from 1M to top of memory */
Yinghai Lud0be6bd2008-06-15 18:58:51 -0700107 e820_add_region(1 * 1024 * 1024, tom - 1 * 1024 * 1024,
Ingo Molnara4ec1ef2008-01-30 13:30:10 +0100108 E820_RAM);
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -0700109 /* FIXME: Should check the ASICs to see if I need to
110 * take out the 8M window. Just do it at the moment
111 * */
Yinghai Lud0be6bd2008-06-15 18:58:51 -0700112 e820_add_region(8 * 1024 * 1024, 8 * 1024 * 1024,
Ingo Molnara4ec1ef2008-01-30 13:30:10 +0100113 E820_RESERVED);
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -0700114 return who;
115 }
116
Yinghai Lu95a71a42008-06-18 17:27:08 -0700117 return default_machine_specific_memory_setup();
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -0700118}