| 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/smp.h> | 
 | 6 | #include <linux/init.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include <linux/interrupt.h> | 
 | 8 | #include <asm/acpi.h> | 
 | 9 | #include <asm/arch_hooks.h> | 
| Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 10 | #include <asm/e820.h> | 
 | 11 | #include <asm/setup.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 |  | 
| Ashok Raj | 67664c8 | 2005-06-25 14:54:52 -0700 | [diff] [blame] | 13 | #ifdef CONFIG_HOTPLUG_CPU | 
 | 14 | #define DEFAULT_SEND_IPI	(1) | 
 | 15 | #else | 
 | 16 | #define DEFAULT_SEND_IPI	(0) | 
 | 17 | #endif | 
 | 18 |  | 
 | 19 | int no_broadcast=DEFAULT_SEND_IPI; | 
 | 20 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | /** | 
 | 22 |  * pre_intr_init_hook - initialisation prior to setting up interrupt vectors | 
 | 23 |  * | 
 | 24 |  * Description: | 
 | 25 |  *	Perform any necessary interrupt initialisation prior to setting up | 
 | 26 |  *	the "ordinary" interrupt call gates.  For legacy reasons, the ISA | 
 | 27 |  *	interrupts should be initialised here if the machine emulates a PC | 
 | 28 |  *	in any way. | 
 | 29 |  **/ | 
 | 30 | void __init pre_intr_init_hook(void) | 
 | 31 | { | 
 | 32 | 	init_ISA_irqs(); | 
 | 33 | } | 
 | 34 |  | 
 | 35 | /* | 
 | 36 |  * IRQ2 is cascade interrupt to second interrupt controller | 
 | 37 |  */ | 
| Thomas Gleixner | 6a61f6a | 2007-10-17 18:04:36 +0200 | [diff] [blame] | 38 | static struct irqaction irq2 = { | 
 | 39 | 	.handler = no_action, | 
 | 40 | 	.mask = CPU_MASK_NONE, | 
 | 41 | 	.name = "cascade", | 
 | 42 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 |  | 
 | 44 | /** | 
 | 45 |  * intr_init_hook - post gate setup interrupt initialisation | 
 | 46 |  * | 
 | 47 |  * Description: | 
 | 48 |  *	Fill in any interrupts that may have been left out by the general | 
 | 49 |  *	init_IRQ() routine.  interrupts having to do with the machine rather | 
 | 50 |  *	than the devices on the I/O bus (like APIC interrupts in intel MP | 
 | 51 |  *	systems) are started here. | 
 | 52 |  **/ | 
 | 53 | void __init intr_init_hook(void) | 
 | 54 | { | 
 | 55 | #ifdef CONFIG_X86_LOCAL_APIC | 
 | 56 | 	apic_intr_init(); | 
 | 57 | #endif | 
 | 58 |  | 
 | 59 | 	if (!acpi_ioapic) | 
 | 60 | 		setup_irq(2, &irq2); | 
 | 61 | } | 
 | 62 |  | 
 | 63 | /** | 
 | 64 |  * pre_setup_arch_hook - hook called prior to any setup_arch() execution | 
 | 65 |  * | 
 | 66 |  * Description: | 
 | 67 |  *	generally used to activate any machine specific identification | 
 | 68 |  *	routines that may be needed before setup_arch() runs.  On VISWS | 
 | 69 |  *	this is used to get the board revision and type. | 
 | 70 |  **/ | 
 | 71 | void __init pre_setup_arch_hook(void) | 
 | 72 | { | 
 | 73 | } | 
 | 74 |  | 
 | 75 | /** | 
 | 76 |  * trap_init_hook - initialise system specific traps | 
 | 77 |  * | 
 | 78 |  * Description: | 
 | 79 |  *	Called as the final act of trap_init().  Used in VISWS to initialise | 
 | 80 |  *	the various board specific APIC traps. | 
 | 81 |  **/ | 
 | 82 | void __init trap_init_hook(void) | 
 | 83 | { | 
 | 84 | } | 
 | 85 |  | 
| Thomas Gleixner | e9e2cdb | 2007-02-16 01:28:04 -0800 | [diff] [blame] | 86 | static struct irqaction irq0  = { | 
 | 87 | 	.handler = timer_interrupt, | 
| Bernhard Walle | b34942f | 2007-05-08 00:35:29 -0700 | [diff] [blame] | 88 | 	.flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL, | 
| Thomas Gleixner | e9e2cdb | 2007-02-16 01:28:04 -0800 | [diff] [blame] | 89 | 	.mask = CPU_MASK_NONE, | 
 | 90 | 	.name = "timer" | 
 | 91 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 |  | 
 | 93 | /** | 
 | 94 |  * time_init_hook - do any specific initialisations for the system timer. | 
 | 95 |  * | 
 | 96 |  * Description: | 
 | 97 |  *	Must plug the system timer interrupt source at HZ into the IRQ listed | 
 | 98 |  *	in irq_vectors.h:TIMER_IRQ | 
 | 99 |  **/ | 
 | 100 | void __init time_init_hook(void) | 
 | 101 | { | 
| Thomas Gleixner | e9e2cdb | 2007-02-16 01:28:04 -0800 | [diff] [blame] | 102 | 	irq0.mask = cpumask_of_cpu(0); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | 	setup_irq(0, &irq0); | 
 | 104 | } | 
 | 105 |  | 
 | 106 | #ifdef CONFIG_MCA | 
 | 107 | /** | 
 | 108 |  * mca_nmi_hook - hook into MCA specific NMI chain | 
 | 109 |  * | 
 | 110 |  * Description: | 
| Simon Arlott | 27b46d7 | 2007-10-20 01:13:56 +0200 | [diff] [blame] | 111 |  *	The MCA (Microchannel Architecture) has an NMI chain for NMI sources | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 |  *	along the MCA bus.  Use this to hook into that chain if you will need | 
 | 113 |  *	it. | 
 | 114 |  **/ | 
| Al Viro | aaba6d4 | 2007-02-01 13:52:28 +0000 | [diff] [blame] | 115 | void mca_nmi_hook(void) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | { | 
 | 117 | 	/* If I recall correctly, there's a whole bunch of other things that | 
 | 118 | 	 * we can do to check for NMI problems, but that's all I know about | 
 | 119 | 	 * at the moment. | 
 | 120 | 	 */ | 
 | 121 |  | 
 | 122 | 	printk("NMI generated from unknown source!\n"); | 
 | 123 | } | 
 | 124 | #endif | 
| Ashok Raj | 67664c8 | 2005-06-25 14:54:52 -0700 | [diff] [blame] | 125 |  | 
 | 126 | static __init int no_ipi_broadcast(char *str) | 
 | 127 | { | 
 | 128 | 	get_option(&str, &no_broadcast); | 
 | 129 | 	printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" : | 
 | 130 | 											"IPI Broadcast"); | 
 | 131 | 	return 1; | 
 | 132 | } | 
 | 133 |  | 
| Robert P. J. Day | 4aad794 | 2007-10-20 00:19:06 +0200 | [diff] [blame] | 134 | __setup("no_ipi_broadcast=", no_ipi_broadcast); | 
| Ashok Raj | 67664c8 | 2005-06-25 14:54:52 -0700 | [diff] [blame] | 135 |  | 
 | 136 | static int __init print_ipi_mode(void) | 
 | 137 | { | 
 | 138 | 	printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" : | 
 | 139 | 											"Shortcut"); | 
 | 140 | 	return 0; | 
 | 141 | } | 
 | 142 |  | 
 | 143 | late_initcall(print_ipi_mode); | 
| Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 144 |  | 
 | 145 | /** | 
 | 146 |  * machine_specific_memory_setup - Hook for machine specific memory setup. | 
 | 147 |  * | 
 | 148 |  * Description: | 
 | 149 |  *	This is included late in kernel/setup.c so that it can make | 
 | 150 |  *	use of all of the static functions. | 
 | 151 |  **/ | 
 | 152 |  | 
 | 153 | char * __init machine_specific_memory_setup(void) | 
 | 154 | { | 
 | 155 | 	char *who; | 
 | 156 |  | 
 | 157 |  | 
 | 158 | 	who = "BIOS-e820"; | 
 | 159 |  | 
 | 160 | 	/* | 
 | 161 | 	 * Try to copy the BIOS-supplied E820-map. | 
 | 162 | 	 * | 
 | 163 | 	 * Otherwise fake a memory map; one section from 0k->640k, | 
 | 164 | 	 * the next section from 1mb->appropriate_mem_k | 
 | 165 | 	 */ | 
| H. Peter Anvin | 30c8264 | 2007-10-15 17:13:22 -0700 | [diff] [blame] | 166 | 	sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries); | 
 | 167 | 	if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) | 
 | 168 | 	    < 0) { | 
| Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 169 | 		unsigned long mem_size; | 
 | 170 |  | 
 | 171 | 		/* compare results from other methods and take the greater */ | 
| H. Peter Anvin | 30c8264 | 2007-10-15 17:13:22 -0700 | [diff] [blame] | 172 | 		if (boot_params.alt_mem_k | 
 | 173 | 		    < boot_params.screen_info.ext_mem_k) { | 
 | 174 | 			mem_size = boot_params.screen_info.ext_mem_k; | 
| Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 175 | 			who = "BIOS-88"; | 
 | 176 | 		} else { | 
| H. Peter Anvin | 30c8264 | 2007-10-15 17:13:22 -0700 | [diff] [blame] | 177 | 			mem_size = boot_params.alt_mem_k; | 
| Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 178 | 			who = "BIOS-e801"; | 
 | 179 | 		} | 
 | 180 |  | 
 | 181 | 		e820.nr_map = 0; | 
 | 182 | 		add_memory_region(0, LOWMEMSIZE(), E820_RAM); | 
 | 183 | 		add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM); | 
 | 184 |   	} | 
 | 185 | 	return who; | 
 | 186 | } |