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