Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Machine specific setup for generic |
| 3 | */ |
| 4 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | #include <linux/interrupt.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include <asm/arch_hooks.h> |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 8 | #include <asm/voyager.h> |
| 9 | #include <asm/e820.h> |
James Bottomley | d5fb342 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 10 | #include <asm/io.h> |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 11 | #include <asm/setup.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | |
| 13 | void __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 Gleixner | 6a61f6a | 2007-10-17 18:04:36 +0200 | [diff] [blame] | 21 | static struct irqaction irq2 = { |
| 22 | .handler = no_action, |
| 23 | .mask = CPU_MASK_NONE, |
| 24 | .name = "cascade", |
| 25 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | |
| 27 | void __init intr_init_hook(void) |
| 28 | { |
| 29 | #ifdef CONFIG_SMP |
| 30 | smp_intr_init(); |
| 31 | #endif |
| 32 | |
James Bottomley | d5fb342 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 33 | setup_irq(2, &irq2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | void __init pre_setup_arch_hook(void) |
| 37 | { |
| 38 | /* Voyagers run their CPUs from independent clocks, so disable |
| 39 | * the TSC code because we can't sync them */ |
Andi Kleen | 404ee5b | 2008-01-30 13:33:20 +0100 | [diff] [blame] | 40 | setup_clear_cpu_cap(X86_FEATURE_TSC); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | void __init trap_init_hook(void) |
| 44 | { |
| 45 | } |
| 46 | |
Ingo Molnar | a4ec1ef | 2008-01-30 13:30:10 +0100 | [diff] [blame] | 47 | static struct irqaction irq0 = { |
James Bottomley | 9f48351 | 2007-04-30 11:30:10 -0500 | [diff] [blame] | 48 | .handler = timer_interrupt, |
Bernhard Walle | b34942f | 2007-05-08 00:35:29 -0700 | [diff] [blame] | 49 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL, |
James Bottomley | 9f48351 | 2007-04-30 11:30:10 -0500 | [diff] [blame] | 50 | .mask = CPU_MASK_NONE, |
| 51 | .name = "timer" |
| 52 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
| 54 | void __init time_init_hook(void) |
| 55 | { |
James Bottomley | 9f48351 | 2007-04-30 11:30:10 -0500 | [diff] [blame] | 56 | irq0.mask = cpumask_of_cpu(safe_smp_processor_id()); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | setup_irq(0, &irq0); |
| 58 | } |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 59 | |
| 60 | /* Hook for machine specific memory setup. */ |
| 61 | |
Ingo Molnar | a4ec1ef | 2008-01-30 13:30:10 +0100 | [diff] [blame] | 62 | char *__init machine_specific_memory_setup(void) |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 63 | { |
| 64 | char *who; |
Paul Jackson | 6e9bcc7 | 2008-05-14 08:15:46 -0700 | [diff] [blame] | 65 | int new_nr; |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 66 | |
| 67 | who = "NOT VOYAGER"; |
| 68 | |
Ingo Molnar | a4ec1ef | 2008-01-30 13:30:10 +0100 | [diff] [blame] | 69 | if (voyager_level == 5) { |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 70 | __u32 addr, length; |
| 71 | int i; |
| 72 | |
| 73 | who = "Voyager-SUS"; |
| 74 | |
| 75 | e820.nr_map = 0; |
Ingo Molnar | a4ec1ef | 2008-01-30 13:30:10 +0100 | [diff] [blame] | 76 | for (i = 0; voyager_memory_detect(i, &addr, &length); i++) { |
Yinghai Lu | d0be6bd | 2008-06-15 18:58:51 -0700 | [diff] [blame] | 77 | e820_add_region(addr, length, E820_RAM); |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 78 | } |
| 79 | return who; |
Ingo Molnar | a4ec1ef | 2008-01-30 13:30:10 +0100 | [diff] [blame] | 80 | } else if (voyager_level == 4) { |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 81 | __u32 tom; |
Ingo Molnar | a4ec1ef | 2008-01-30 13:30:10 +0100 | [diff] [blame] | 82 | __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT) << 8; |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 83 | /* select the DINO config space */ |
| 84 | outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT); |
| 85 | /* Read DINO top of memory register */ |
| 86 | tom = ((inb(catbase + 0x4) & 0xf0) << 16) |
Ingo Molnar | a4ec1ef | 2008-01-30 13:30:10 +0100 | [diff] [blame] | 87 | + ((inb(catbase + 0x5) & 0x7f) << 24); |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 88 | |
Ingo Molnar | a4ec1ef | 2008-01-30 13:30:10 +0100 | [diff] [blame] | 89 | if (inb(catbase) != VOYAGER_DINO) { |
| 90 | printk(KERN_ERR |
| 91 | "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n"); |
| 92 | tom = (boot_params.screen_info.ext_mem_k) << 10; |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 93 | } |
| 94 | who = "Voyager-TOM"; |
Yinghai Lu | d0be6bd | 2008-06-15 18:58:51 -0700 | [diff] [blame] | 95 | e820_add_region(0, 0x9f000, E820_RAM); |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 96 | /* map from 1M to top of memory */ |
Yinghai Lu | d0be6bd | 2008-06-15 18:58:51 -0700 | [diff] [blame] | 97 | e820_add_region(1 * 1024 * 1024, tom - 1 * 1024 * 1024, |
Ingo Molnar | a4ec1ef | 2008-01-30 13:30:10 +0100 | [diff] [blame] | 98 | E820_RAM); |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 99 | /* FIXME: Should check the ASICs to see if I need to |
| 100 | * take out the 8M window. Just do it at the moment |
| 101 | * */ |
Yinghai Lu | d0be6bd | 2008-06-15 18:58:51 -0700 | [diff] [blame] | 102 | e820_add_region(8 * 1024 * 1024, 8 * 1024 * 1024, |
Ingo Molnar | a4ec1ef | 2008-01-30 13:30:10 +0100 | [diff] [blame] | 103 | E820_RESERVED); |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 104 | return who; |
| 105 | } |
| 106 | |
Yinghai Lu | 95a71a4 | 2008-06-18 17:27:08 -0700 | [diff] [blame] | 107 | return default_machine_specific_memory_setup(); |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 108 | } |