debuggers.hg
changeset 4658:caaf9d543bc5
bitkeeper revision 1.1357 (4267c91c8u7H5ttS9RWRyBY5FrTm3g)
Fix APIC setup on legacy systems.
Signed-off-by: Keir Fraser <keir@xensource.com>
Fix APIC setup on legacy systems.
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Thu Apr 21 15:39:08 2005 +0000 (2005-04-21) |
parents | 67c40314aa6e |
children | 9a768d11cc7b 2fdf5cc2b79b |
files | xen/arch/x86/apic.c xen/arch/x86/setup.c |
line diff
1.1 --- a/xen/arch/x86/apic.c Thu Apr 21 14:19:31 2005 +0000 1.2 +++ b/xen/arch/x86/apic.c Thu Apr 21 15:39:08 2005 +0000 1.3 @@ -229,17 +229,48 @@ void __init sync_Arb_IDs(void) 1.4 1.5 extern void __error_in_apic_c (void); 1.6 1.7 -/* 1.8 - * WAS: An initial setup of the virtual wire mode. 1.9 - * NOW: We don't bother doing anything. All we need at this point 1.10 - * is to receive timer ticks, so that 'jiffies' is incremented. 1.11 - * If we're SMP, then we can assume BIOS did setup for us. 1.12 - * If we're UP, then the APIC should be disabled (it is at reset). 1.13 - * If we're UP and APIC is enabled, then BIOS is clever and has 1.14 - * probably done initial interrupt routing for us. 1.15 - */ 1.16 void __init init_bsp_APIC(void) 1.17 { 1.18 + unsigned long value, ver; 1.19 + 1.20 + /* 1.21 + * Don't do the setup now if we have a SMP BIOS as the through-I/O-APIC 1.22 + * virtual wire mode might be active. 1.23 + */ 1.24 + if (smp_found_config || !cpu_has_apic) 1.25 + return; 1.26 + 1.27 + value = apic_read(APIC_LVR); 1.28 + ver = GET_APIC_VERSION(value); 1.29 + 1.30 + /* 1.31 + * Do not trust the local APIC being empty at bootup. 1.32 + */ 1.33 + clear_local_APIC(); 1.34 + 1.35 + /* 1.36 + * Enable APIC. 1.37 + */ 1.38 + value = apic_read(APIC_SPIV); 1.39 + value &= ~APIC_VECTOR_MASK; 1.40 + value |= APIC_SPIV_APIC_ENABLED; 1.41 + 1.42 + /* This bit is reserved on P4/Xeon and should be cleared */ 1.43 + if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 == 15)) 1.44 + value &= ~APIC_SPIV_FOCUS_DISABLED; 1.45 + else 1.46 + value |= APIC_SPIV_FOCUS_DISABLED; 1.47 + value |= SPURIOUS_APIC_VECTOR; 1.48 + apic_write_around(APIC_SPIV, value); 1.49 + 1.50 + /* 1.51 + * Set up the virtual wire mode. 1.52 + */ 1.53 + apic_write_around(APIC_LVT0, APIC_DM_EXTINT); 1.54 + value = APIC_DM_NMI; 1.55 + if (!APIC_INTEGRATED(ver)) /* 82489DX */ 1.56 + value |= APIC_LVT_LEVEL_TRIGGER; 1.57 + apic_write_around(APIC_LVT1, value); 1.58 } 1.59 1.60 void __init setup_local_APIC (void)
2.1 --- a/xen/arch/x86/setup.c Thu Apr 21 14:19:31 2005 +0000 2.2 +++ b/xen/arch/x86/setup.c Thu Apr 21 15:39:08 2005 +0000 2.3 @@ -388,11 +388,11 @@ static void __init start_of_day(void) 2.4 if ( smp_found_config ) 2.5 get_smp_config(); 2.6 #endif 2.7 + init_apic_mappings(); /* make APICs addressable in our pagetables. */ 2.8 scheduler_init(); 2.9 init_IRQ(); /* installs simple interrupt wrappers. Starts HZ clock. */ 2.10 trap_init(); 2.11 time_init(); /* installs software handler for HZ clock. */ 2.12 - init_apic_mappings(); /* make APICs addressable in our pagetables. */ 2.13 2.14 arch_init_memory(); 2.15