blob: defc6ebbd56517ac054deeeafbf17239de36cc5d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Machine specific setup for generic
3 */
4
5#include <linux/config.h>
6#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <linux/interrupt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#include <asm/arch_hooks.h>
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -07009#include <asm/voyager.h>
10#include <asm/e820.h>
James Bottomleyd5fb3422006-06-27 02:53:50 -070011#include <asm/io.h>
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070012#include <asm/setup.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
14void __init pre_intr_init_hook(void)
15{
16 init_ISA_irqs();
17}
18
19/*
20 * IRQ2 is cascade interrupt to second interrupt controller
21 */
22static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL};
23
24void __init intr_init_hook(void)
25{
26#ifdef CONFIG_SMP
27 smp_intr_init();
28#endif
29
James Bottomleyd5fb3422006-06-27 02:53:50 -070030 setup_irq(2, &irq2);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031}
32
33void __init pre_setup_arch_hook(void)
34{
35 /* Voyagers run their CPUs from independent clocks, so disable
36 * the TSC code because we can't sync them */
37 tsc_disable = 1;
38}
39
40void __init trap_init_hook(void)
41{
42}
43
44static struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL};
45
46void __init time_init_hook(void)
47{
48 setup_irq(0, &irq0);
49}
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070050
51/* Hook for machine specific memory setup. */
52
53char * __init machine_specific_memory_setup(void)
54{
55 char *who;
56
57 who = "NOT VOYAGER";
58
59 if(voyager_level == 5) {
60 __u32 addr, length;
61 int i;
62
63 who = "Voyager-SUS";
64
65 e820.nr_map = 0;
66 for(i=0; voyager_memory_detect(i, &addr, &length); i++) {
67 add_memory_region(addr, length, E820_RAM);
68 }
69 return who;
70 } else if(voyager_level == 4) {
71 __u32 tom;
72 __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT)<<8;
73 /* select the DINO config space */
74 outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT);
75 /* Read DINO top of memory register */
76 tom = ((inb(catbase + 0x4) & 0xf0) << 16)
77 + ((inb(catbase + 0x5) & 0x7f) << 24);
78
79 if(inb(catbase) != VOYAGER_DINO) {
80 printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
81 tom = (EXT_MEM_K)<<10;
82 }
83 who = "Voyager-TOM";
84 add_memory_region(0, 0x9f000, E820_RAM);
85 /* map from 1M to top of memory */
86 add_memory_region(1*1024*1024, tom - 1*1024*1024, E820_RAM);
87 /* FIXME: Should check the ASICs to see if I need to
88 * take out the 8M window. Just do it at the moment
89 * */
90 add_memory_region(8*1024*1024, 8*1024*1024, E820_RESERVED);
91 return who;
92 }
93
94 who = "BIOS-e820";
95
96 /*
97 * Try to copy the BIOS-supplied E820-map.
98 *
99 * Otherwise fake a memory map; one section from 0k->640k,
100 * the next section from 1mb->appropriate_mem_k
101 */
102 sanitize_e820_map(E820_MAP, &E820_MAP_NR);
103 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
104 unsigned long mem_size;
105
106 /* compare results from other methods and take the greater */
107 if (ALT_MEM_K < EXT_MEM_K) {
108 mem_size = EXT_MEM_K;
109 who = "BIOS-88";
110 } else {
111 mem_size = ALT_MEM_K;
112 who = "BIOS-e801";
113 }
114
115 e820.nr_map = 0;
116 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
117 add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
118 }
119 return who;
120}