aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic_32.c
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-03-19 13:25:48 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:41:02 -0400
commitdf7939ae8bee101d9d79d104e17f14b60845cf0f (patch)
treef818959f4ea857838c0829bfb868cc907aff79ff /arch/x86/kernel/apic_32.c
parentea0cadbfed09674bcc2b3e1e7f2d7317ddde4e95 (diff)
x86: wrap esr setting up in i386 in lapic_setup_esr
it is a little bit more complicated than x86_64 due to erratas and other stuff, but its existance will ease integration Signed-off-by: Glauber Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic_32.c')
-rw-r--r--arch/x86/kernel/apic_32.c73
1 files changed, 40 insertions, 33 deletions
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index c32cc0feb47b..80c81c76625a 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -897,12 +897,50 @@ void __init init_bsp_APIC(void)
897 apic_write_around(APIC_LVT1, value); 897 apic_write_around(APIC_LVT1, value);
898} 898}
899 899
900void __cpuinit lapic_setup_esr(void)
901{
902 unsigned long oldvalue, value, maxlvt;
903 if (lapic_is_integrated() && !esr_disable) {
904 /* !82489DX */
905 maxlvt = lapic_get_maxlvt();
906 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */
907 apic_write(APIC_ESR, 0);
908 oldvalue = apic_read(APIC_ESR);
909
910 /* enables sending errors */
911 value = ERROR_APIC_VECTOR;
912 apic_write_around(APIC_LVTERR, value);
913 /*
914 * spec says clear errors after enabling vector.
915 */
916 if (maxlvt > 3)
917 apic_write(APIC_ESR, 0);
918 value = apic_read(APIC_ESR);
919 if (value != oldvalue)
920 apic_printk(APIC_VERBOSE, "ESR value before enabling "
921 "vector: 0x%08lx after: 0x%08lx\n",
922 oldvalue, value);
923 } else {
924 if (esr_disable)
925 /*
926 * Something untraceable is creating bad interrupts on
927 * secondary quads ... for the moment, just leave the
928 * ESR disabled - we can't do anything useful with the
929 * errors anyway - mbligh
930 */
931 printk(KERN_INFO "Leaving ESR disabled.\n");
932 else
933 printk(KERN_INFO "No ESR for 82489DX.\n");
934 }
935}
936
937
900/** 938/**
901 * setup_local_APIC - setup the local APIC 939 * setup_local_APIC - setup the local APIC
902 */ 940 */
903void __cpuinit setup_local_APIC(void) 941void __cpuinit setup_local_APIC(void)
904{ 942{
905 unsigned long oldvalue, value, maxlvt, integrated; 943 unsigned long value, integrated;
906 int i, j; 944 int i, j;
907 945
908 /* Pound the ESR really hard over the head with a big hammer - mbligh */ 946 /* Pound the ESR really hard over the head with a big hammer - mbligh */
@@ -1027,38 +1065,7 @@ void __cpuinit setup_local_APIC(void)
1027 value |= APIC_LVT_LEVEL_TRIGGER; 1065 value |= APIC_LVT_LEVEL_TRIGGER;
1028 apic_write_around(APIC_LVT1, value); 1066 apic_write_around(APIC_LVT1, value);
1029 1067
1030 if (integrated && !esr_disable) { 1068 lapic_setup_esr();
1031 /* !82489DX */
1032 maxlvt = lapic_get_maxlvt();
1033 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */
1034 apic_write(APIC_ESR, 0);
1035 oldvalue = apic_read(APIC_ESR);
1036
1037 /* enables sending errors */
1038 value = ERROR_APIC_VECTOR;
1039 apic_write_around(APIC_LVTERR, value);
1040 /*
1041 * spec says clear errors after enabling vector.
1042 */
1043 if (maxlvt > 3)
1044 apic_write(APIC_ESR, 0);
1045 value = apic_read(APIC_ESR);
1046 if (value != oldvalue)
1047 apic_printk(APIC_VERBOSE, "ESR value before enabling "
1048 "vector: 0x%08lx after: 0x%08lx\n",
1049 oldvalue, value);
1050 } else {
1051 if (esr_disable)
1052 /*
1053 * Something untraceable is creating bad interrupts on
1054 * secondary quads ... for the moment, just leave the
1055 * ESR disabled - we can't do anything useful with the
1056 * errors anyway - mbligh
1057 */
1058 printk(KERN_INFO "Leaving ESR disabled.\n");
1059 else
1060 printk(KERN_INFO "No ESR for 82489DX.\n");
1061 }
1062 1069
1063 /* Disable the local apic timer */ 1070 /* Disable the local apic timer */
1064 value = apic_read(APIC_LVTT); 1071 value = apic_read(APIC_LVTT);