aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/Kconfig4
-rw-r--r--arch/x86/kernel/acpi/boot.c32
-rw-r--r--arch/x86/kernel/acpi/processor.c3
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c90
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.h20
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_64.c2
-rw-r--r--arch/x86/kernel/cpu/proc.c8
-rw-r--r--arch/x86/kernel/io_apic_32.c21
-rw-r--r--arch/x86/kernel/io_apic_64.c24
-rw-r--r--arch/x86/kernel/reboot_fixups_32.c1
-rw-r--r--arch/x86/kernel/setup_64.c9
-rw-r--r--arch/x86/kernel/time_64.c41
-rw-r--r--arch/x86/mach-voyager/voyager_cat.c2
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c4
-rw-r--r--arch/x86/pci/acpi.c6
-rw-r--r--arch/x86/vdso/vgetcpu.c19
16 files changed, 149 insertions, 137 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 1eb59971af5d..368864dfe6eb 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -3,8 +3,8 @@ mainmenu "Linux Kernel Configuration for x86"
3 3
4# Select 32 or 64 bit 4# Select 32 or 64 bit
5config 64BIT 5config 64BIT
6 bool "64-bit kernel" 6 bool "64-bit kernel" if ARCH = "x86"
7 default n 7 default ARCH = "x86_64"
8 help 8 help
9 Say yes to build a 64-bit kernel - formerly known as x86_64 9 Say yes to build a 64-bit kernel - formerly known as x86_64
10 Say no to build a 32-bit kernel - formerly known as i386 10 Say no to build a 32-bit kernel - formerly known as i386
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 289247d974c6..0ca27c7b0e8d 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -637,6 +637,38 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table)
637 } 637 }
638 638
639 hpet_address = hpet_tbl->address.address; 639 hpet_address = hpet_tbl->address.address;
640
641 /*
642 * Some broken BIOSes advertise HPET at 0x0. We really do not
643 * want to allocate a resource there.
644 */
645 if (!hpet_address) {
646 printk(KERN_WARNING PREFIX
647 "HPET id: %#x base: %#lx is invalid\n",
648 hpet_tbl->id, hpet_address);
649 return 0;
650 }
651#ifdef CONFIG_X86_64
652 /*
653 * Some even more broken BIOSes advertise HPET at
654 * 0xfed0000000000000 instead of 0xfed00000. Fix it up and add
655 * some noise:
656 */
657 if (hpet_address == 0xfed0000000000000UL) {
658 if (!hpet_force_user) {
659 printk(KERN_WARNING PREFIX "HPET id: %#x "
660 "base: 0xfed0000000000000 is bogus\n "
661 "try hpet=force on the kernel command line to "
662 "fix it up to 0xfed00000.\n", hpet_tbl->id);
663 hpet_address = 0;
664 return 0;
665 }
666 printk(KERN_WARNING PREFIX
667 "HPET id: %#x base: 0xfed0000000000000 fixed up "
668 "to 0xfed00000.\n", hpet_tbl->id);
669 hpet_address >>= 32;
670 }
671#endif
640 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 672 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
641 hpet_tbl->id, hpet_address); 673 hpet_tbl->id, hpet_address);
642 674
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
index f63e5ff0aca1..a25db514c719 100644
--- a/arch/x86/kernel/acpi/processor.c
+++ b/arch/x86/kernel/acpi/processor.c
@@ -49,6 +49,9 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
49 if (cpu_has(c, X86_FEATURE_EST)) 49 if (cpu_has(c, X86_FEATURE_EST))
50 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP; 50 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
51 51
52 if (cpu_has(c, X86_FEATURE_ACPI))
53 buf[2] |= ACPI_PDC_T_FFH;
54
52 obj->type = ACPI_TYPE_BUFFER; 55 obj->type = ACPI_TYPE_BUFFER;
53 obj->buffer.length = 12; 56 obj->buffer.length = 12;
54 obj->buffer.pointer = (u8 *) buf; 57 obj->buffer.pointer = (u8 *) buf;
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 9c36a53676b7..99e1ef9939be 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -46,7 +46,7 @@
46 46
47#define PFX "powernow-k8: " 47#define PFX "powernow-k8: "
48#define BFX PFX "BIOS error: " 48#define BFX PFX "BIOS error: "
49#define VERSION "version 2.00.00" 49#define VERSION "version 2.20.00"
50#include "powernow-k8.h" 50#include "powernow-k8.h"
51 51
52/* serialize freq changes */ 52/* serialize freq changes */
@@ -73,33 +73,11 @@ static u32 find_khz_freq_from_fid(u32 fid)
73 return 1000 * find_freq_from_fid(fid); 73 return 1000 * find_freq_from_fid(fid);
74} 74}
75 75
76/* Return a frequency in MHz, given an input fid and did */ 76static u32 find_khz_freq_from_pstate(struct cpufreq_frequency_table *data, u32 pstate)
77static u32 find_freq_from_fiddid(u32 fid, u32 did)
78{ 77{
79 if (current_cpu_data.x86 == 0x10) 78 return data[pstate].frequency;
80 return 100 * (fid + 0x10) >> did;
81 else
82 return 100 * (fid + 0x8) >> did;
83}
84
85static u32 find_khz_freq_from_fiddid(u32 fid, u32 did)
86{
87 return 1000 * find_freq_from_fiddid(fid, did);
88}
89
90static u32 find_fid_from_pstate(u32 pstate)
91{
92 u32 hi, lo;
93 rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi);
94 return lo & HW_PSTATE_FID_MASK;
95} 79}
96 80
97static u32 find_did_from_pstate(u32 pstate)
98{
99 u32 hi, lo;
100 rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi);
101 return (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
102}
103 81
104/* Return the vco fid for an input fid 82/* Return the vco fid for an input fid
105 * 83 *
@@ -142,9 +120,7 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data)
142 if (cpu_family == CPU_HW_PSTATE) { 120 if (cpu_family == CPU_HW_PSTATE) {
143 rdmsr(MSR_PSTATE_STATUS, lo, hi); 121 rdmsr(MSR_PSTATE_STATUS, lo, hi);
144 i = lo & HW_PSTATE_MASK; 122 i = lo & HW_PSTATE_MASK;
145 rdmsr(MSR_PSTATE_DEF_BASE + i, lo, hi); 123 data->currpstate = i;
146 data->currfid = lo & HW_PSTATE_FID_MASK;
147 data->currdid = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
148 return 0; 124 return 0;
149 } 125 }
150 do { 126 do {
@@ -295,7 +271,7 @@ static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid,
295static int transition_pstate(struct powernow_k8_data *data, u32 pstate) 271static int transition_pstate(struct powernow_k8_data *data, u32 pstate)
296{ 272{
297 wrmsr(MSR_PSTATE_CTRL, pstate, 0); 273 wrmsr(MSR_PSTATE_CTRL, pstate, 0);
298 data->currfid = find_fid_from_pstate(pstate); 274 data->currpstate = pstate;
299 return 0; 275 return 0;
300} 276}
301 277
@@ -845,17 +821,20 @@ err_out:
845static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table) 821static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table)
846{ 822{
847 int i; 823 int i;
824 u32 hi = 0, lo = 0;
825 rdmsr(MSR_PSTATE_CUR_LIMIT, hi, lo);
826 data->max_hw_pstate = (hi & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT;
848 827
849 for (i = 0; i < data->acpi_data.state_count; i++) { 828 for (i = 0; i < data->acpi_data.state_count; i++) {
850 u32 index; 829 u32 index;
851 u32 hi = 0, lo = 0; 830 u32 hi = 0, lo = 0;
852 u32 fid;
853 u32 did;
854 831
855 index = data->acpi_data.states[i].control & HW_PSTATE_MASK; 832 index = data->acpi_data.states[i].control & HW_PSTATE_MASK;
856 if (index > MAX_HW_PSTATE) { 833 if (index > data->max_hw_pstate) {
857 printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index); 834 printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index);
858 printk(KERN_ERR PFX "Please report to BIOS manufacturer\n"); 835 printk(KERN_ERR PFX "Please report to BIOS manufacturer\n");
836 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
837 continue;
859 } 838 }
860 rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi); 839 rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
861 if (!(hi & HW_PSTATE_VALID_MASK)) { 840 if (!(hi & HW_PSTATE_VALID_MASK)) {
@@ -864,22 +843,9 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpuf
864 continue; 843 continue;
865 } 844 }
866 845
867 fid = lo & HW_PSTATE_FID_MASK; 846 powernow_table[i].index = index;
868 did = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
869 847
870 dprintk(" %d : fid 0x%x, did 0x%x\n", index, fid, did); 848 powernow_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000;
871
872 powernow_table[i].index = index | (fid << HW_FID_INDEX_SHIFT) | (did << HW_DID_INDEX_SHIFT);
873
874 powernow_table[i].frequency = find_khz_freq_from_fiddid(fid, did);
875
876 if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) {
877 printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n",
878 powernow_table[i].frequency,
879 (unsigned int) (data->acpi_data.states[i].core_frequency * 1000));
880 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
881 continue;
882 }
883 } 849 }
884 return 0; 850 return 0;
885} 851}
@@ -1020,22 +986,18 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, unsigned i
1020/* Take a frequency, and issue the hardware pstate transition command */ 986/* Take a frequency, and issue the hardware pstate transition command */
1021static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned int index) 987static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned int index)
1022{ 988{
1023 u32 fid = 0;
1024 u32 did = 0;
1025 u32 pstate = 0; 989 u32 pstate = 0;
1026 int res, i; 990 int res, i;
1027 struct cpufreq_freqs freqs; 991 struct cpufreq_freqs freqs;
1028 992
1029 dprintk("cpu %d transition to index %u\n", smp_processor_id(), index); 993 dprintk("cpu %d transition to index %u\n", smp_processor_id(), index);
1030 994
1031 /* get fid did for hardware pstate transition */ 995 /* get MSR index for hardware pstate transition */
1032 pstate = index & HW_PSTATE_MASK; 996 pstate = index & HW_PSTATE_MASK;
1033 if (pstate > MAX_HW_PSTATE) 997 if (pstate > data->max_hw_pstate)
1034 return 0; 998 return 0;
1035 fid = (index & HW_FID_INDEX_MASK) >> HW_FID_INDEX_SHIFT; 999 freqs.old = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
1036 did = (index & HW_DID_INDEX_MASK) >> HW_DID_INDEX_SHIFT; 1000 freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
1037 freqs.old = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1038 freqs.new = find_khz_freq_from_fiddid(fid, did);
1039 1001
1040 for_each_cpu_mask(i, *(data->available_cores)) { 1002 for_each_cpu_mask(i, *(data->available_cores)) {
1041 freqs.cpu = i; 1003 freqs.cpu = i;
@@ -1043,9 +1005,7 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i
1043 } 1005 }
1044 1006
1045 res = transition_pstate(data, pstate); 1007 res = transition_pstate(data, pstate);
1046 data->currfid = find_fid_from_pstate(pstate); 1008 freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
1047 data->currdid = find_did_from_pstate(pstate);
1048 freqs.new = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1049 1009
1050 for_each_cpu_mask(i, *(data->available_cores)) { 1010 for_each_cpu_mask(i, *(data->available_cores)) {
1051 freqs.cpu = i; 1011 freqs.cpu = i;
@@ -1090,10 +1050,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
1090 if (query_current_values_with_pending_wait(data)) 1050 if (query_current_values_with_pending_wait(data))
1091 goto err_out; 1051 goto err_out;
1092 1052
1093 if (cpu_family == CPU_HW_PSTATE) 1053 if (cpu_family != CPU_HW_PSTATE) {
1094 dprintk("targ: curr fid 0x%x, did 0x%x\n",
1095 data->currfid, data->currdid);
1096 else {
1097 dprintk("targ: curr fid 0x%x, vid 0x%x\n", 1054 dprintk("targ: curr fid 0x%x, vid 0x%x\n",
1098 data->currfid, data->currvid); 1055 data->currfid, data->currvid);
1099 1056
@@ -1124,7 +1081,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
1124 mutex_unlock(&fidvid_mutex); 1081 mutex_unlock(&fidvid_mutex);
1125 1082
1126 if (cpu_family == CPU_HW_PSTATE) 1083 if (cpu_family == CPU_HW_PSTATE)
1127 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid); 1084 pol->cur = find_khz_freq_from_pstate(data->powernow_table, newstate);
1128 else 1085 else
1129 pol->cur = find_khz_freq_from_fid(data->currfid); 1086 pol->cur = find_khz_freq_from_fid(data->currfid);
1130 ret = 0; 1087 ret = 0;
@@ -1223,7 +1180,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1223 + (3 * (1 << data->irt) * 10)) * 1000; 1180 + (3 * (1 << data->irt) * 10)) * 1000;
1224 1181
1225 if (cpu_family == CPU_HW_PSTATE) 1182 if (cpu_family == CPU_HW_PSTATE)
1226 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid); 1183 pol->cur = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
1227 else 1184 else
1228 pol->cur = find_khz_freq_from_fid(data->currfid); 1185 pol->cur = find_khz_freq_from_fid(data->currfid);
1229 dprintk("policy current frequency %d kHz\n", pol->cur); 1186 dprintk("policy current frequency %d kHz\n", pol->cur);
@@ -1240,8 +1197,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1240 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); 1197 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu);
1241 1198
1242 if (cpu_family == CPU_HW_PSTATE) 1199 if (cpu_family == CPU_HW_PSTATE)
1243 dprintk("cpu_init done, current fid 0x%x, did 0x%x\n", 1200 dprintk("cpu_init done, current pstate 0x%x\n", data->currpstate);
1244 data->currfid, data->currdid);
1245 else 1201 else
1246 dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n", 1202 dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n",
1247 data->currfid, data->currvid); 1203 data->currfid, data->currvid);
@@ -1297,7 +1253,7 @@ static unsigned int powernowk8_get (unsigned int cpu)
1297 goto out; 1253 goto out;
1298 1254
1299 if (cpu_family == CPU_HW_PSTATE) 1255 if (cpu_family == CPU_HW_PSTATE)
1300 khz = find_khz_freq_from_fiddid(data->currfid, data->currdid); 1256 khz = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
1301 else 1257 else
1302 khz = find_khz_freq_from_fid(data->currfid); 1258 khz = find_khz_freq_from_fid(data->currfid);
1303 1259
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
index 7c4f6e0faed4..afd2b520d35c 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
@@ -10,6 +10,7 @@ struct powernow_k8_data {
10 10
11 u32 numps; /* number of p-states */ 11 u32 numps; /* number of p-states */
12 u32 batps; /* number of p-states supported on battery */ 12 u32 batps; /* number of p-states supported on battery */
13 u32 max_hw_pstate; /* maximum legal hardware pstate */
13 14
14 /* these values are constant when the PSB is used to determine 15 /* these values are constant when the PSB is used to determine
15 * vid/fid pairings, but are modified during the ->target() call 16 * vid/fid pairings, but are modified during the ->target() call
@@ -21,8 +22,8 @@ struct powernow_k8_data {
21 u32 plllock; /* pll lock time, units 1 us */ 22 u32 plllock; /* pll lock time, units 1 us */
22 u32 exttype; /* extended interface = 1 */ 23 u32 exttype; /* extended interface = 1 */
23 24
24 /* keep track of the current fid / vid or did */ 25 /* keep track of the current fid / vid or pstate */
25 u32 currvid, currfid, currdid; 26 u32 currvid, currfid, currpstate;
26 27
27 /* the powernow_table includes all frequency and vid/fid pairings: 28 /* the powernow_table includes all frequency and vid/fid pairings:
28 * fid are the lower 8 bits of the index, vid are the upper 8 bits. 29 * fid are the lower 8 bits of the index, vid are the upper 8 bits.
@@ -87,23 +88,14 @@ struct powernow_k8_data {
87 88
88/* Hardware Pstate _PSS and MSR definitions */ 89/* Hardware Pstate _PSS and MSR definitions */
89#define USE_HW_PSTATE 0x00000080 90#define USE_HW_PSTATE 0x00000080
90#define HW_PSTATE_FID_MASK 0x0000003f
91#define HW_PSTATE_DID_MASK 0x000001c0
92#define HW_PSTATE_DID_SHIFT 6
93#define HW_PSTATE_MASK 0x00000007 91#define HW_PSTATE_MASK 0x00000007
94#define HW_PSTATE_VALID_MASK 0x80000000 92#define HW_PSTATE_VALID_MASK 0x80000000
95#define HW_FID_INDEX_SHIFT 8 93#define HW_PSTATE_MAX_MASK 0x000000f0
96#define HW_FID_INDEX_MASK 0x0000ff00 94#define HW_PSTATE_MAX_SHIFT 4
97#define HW_DID_INDEX_SHIFT 16
98#define HW_DID_INDEX_MASK 0x00ff0000
99#define HW_WATTS_MASK 0xff
100#define HW_PWR_DVR_MASK 0x300
101#define HW_PWR_DVR_SHIFT 8
102#define HW_PWR_MAX_MULT 3
103#define MAX_HW_PSTATE 8 /* hw pstate supports up to 8 */
104#define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */ 95#define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */
105#define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */ 96#define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */
106#define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */ 97#define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */
98#define MSR_PSTATE_CUR_LIMIT 0xc0010061 /* pstate current limit MSR */
107 99
108/* define the two driver architectures */ 100/* define the two driver architectures */
109#define CPU_OPTERON 0 101#define CPU_OPTERON 0
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
index 447b351f1f2a..4b21d29fb5aa 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -810,7 +810,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
810 int err; 810 int err;
811 int i; 811 int i;
812 812
813 if (!mce_available(&cpu_data(cpu))) 813 if (!mce_available(&boot_cpu_data))
814 return -EIO; 814 return -EIO;
815 815
816 memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject)); 816 memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject));
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 066f8c6af4df..3900e46d66db 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -89,8 +89,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
89 int fpu_exception; 89 int fpu_exception;
90 90
91#ifdef CONFIG_SMP 91#ifdef CONFIG_SMP
92 if (!cpu_online(n))
93 return 0;
94 n = c->cpu_index; 92 n = c->cpu_index;
95#endif 93#endif
96 seq_printf(m, "processor\t: %d\n" 94 seq_printf(m, "processor\t: %d\n"
@@ -177,14 +175,14 @@ static int show_cpuinfo(struct seq_file *m, void *v)
177static void *c_start(struct seq_file *m, loff_t *pos) 175static void *c_start(struct seq_file *m, loff_t *pos)
178{ 176{
179 if (*pos == 0) /* just in case, cpu 0 is not the first */ 177 if (*pos == 0) /* just in case, cpu 0 is not the first */
180 *pos = first_cpu(cpu_possible_map); 178 *pos = first_cpu(cpu_online_map);
181 if ((*pos) < NR_CPUS && cpu_possible(*pos)) 179 if ((*pos) < NR_CPUS && cpu_online(*pos))
182 return &cpu_data(*pos); 180 return &cpu_data(*pos);
183 return NULL; 181 return NULL;
184} 182}
185static void *c_next(struct seq_file *m, void *v, loff_t *pos) 183static void *c_next(struct seq_file *m, void *v, loff_t *pos)
186{ 184{
187 *pos = next_cpu(*pos, cpu_possible_map); 185 *pos = next_cpu(*pos, cpu_online_map);
188 return c_start(m, pos); 186 return c_start(m, pos);
189} 187}
190static void c_stop(struct seq_file *m, void *v) 188static void c_stop(struct seq_file *m, void *v)
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index f35c6eb33da9..6bb80ea5f4ee 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -962,7 +962,7 @@ static int EISA_ELCR(unsigned int irq)
962#define default_MCA_trigger(idx) (1) 962#define default_MCA_trigger(idx) (1)
963#define default_MCA_polarity(idx) (0) 963#define default_MCA_polarity(idx) (0)
964 964
965static int __init MPBIOS_polarity(int idx) 965static int MPBIOS_polarity(int idx)
966{ 966{
967 int bus = mp_irqs[idx].mpc_srcbus; 967 int bus = mp_irqs[idx].mpc_srcbus;
968 int polarity; 968 int polarity;
@@ -2830,6 +2830,25 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
2830 return 0; 2830 return 0;
2831} 2831}
2832 2832
2833int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
2834{
2835 int i;
2836
2837 if (skip_ioapic_setup)
2838 return -1;
2839
2840 for (i = 0; i < mp_irq_entries; i++)
2841 if (mp_irqs[i].mpc_irqtype == mp_INT &&
2842 mp_irqs[i].mpc_srcbusirq == bus_irq)
2843 break;
2844 if (i >= mp_irq_entries)
2845 return -1;
2846
2847 *trigger = irq_trigger(i);
2848 *polarity = irq_polarity(i);
2849 return 0;
2850}
2851
2833#endif /* CONFIG_ACPI */ 2852#endif /* CONFIG_ACPI */
2834 2853
2835static int __init parse_disable_timer_pin_1(char *arg) 2854static int __init parse_disable_timer_pin_1(char *arg)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 953328b55a30..435a8c9b55f8 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -546,7 +546,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
546#define default_PCI_trigger(idx) (1) 546#define default_PCI_trigger(idx) (1)
547#define default_PCI_polarity(idx) (1) 547#define default_PCI_polarity(idx) (1)
548 548
549static int __init MPBIOS_polarity(int idx) 549static int MPBIOS_polarity(int idx)
550{ 550{
551 int bus = mp_irqs[idx].mpc_srcbus; 551 int bus = mp_irqs[idx].mpc_srcbus;
552 int polarity; 552 int polarity;
@@ -2222,8 +2222,27 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p
2222 return 0; 2222 return 0;
2223} 2223}
2224 2224
2225#endif /* CONFIG_ACPI */
2226 2225
2226int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
2227{
2228 int i;
2229
2230 if (skip_ioapic_setup)
2231 return -1;
2232
2233 for (i = 0; i < mp_irq_entries; i++)
2234 if (mp_irqs[i].mpc_irqtype == mp_INT &&
2235 mp_irqs[i].mpc_srcbusirq == bus_irq)
2236 break;
2237 if (i >= mp_irq_entries)
2238 return -1;
2239
2240 *trigger = irq_trigger(i);
2241 *polarity = irq_polarity(i);
2242 return 0;
2243}
2244
2245#endif /* CONFIG_ACPI */
2227 2246
2228/* 2247/*
2229 * This function currently is only a helper for the i386 smp boot process where 2248 * This function currently is only a helper for the i386 smp boot process where
@@ -2260,3 +2279,4 @@ void __init setup_ioapic_dest(void)
2260 } 2279 }
2261} 2280}
2262#endif 2281#endif
2282
diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
index 1a07bbea7be3..f452726c0fe2 100644
--- a/arch/x86/kernel/reboot_fixups_32.c
+++ b/arch/x86/kernel/reboot_fixups_32.c
@@ -39,6 +39,7 @@ struct device_fixup {
39static struct device_fixup fixups_table[] = { 39static struct device_fixup fixups_table[] = {
40{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset }, 40{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset },
41{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, cs5536_warm_reset }, 41{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, cs5536_warm_reset },
42{ PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE, cs5530a_warm_reset },
42}; 43};
43 44
44/* 45/*
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 238633d3d09a..30d94d1d5f5f 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -892,7 +892,6 @@ void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
892 892
893#ifdef CONFIG_SMP 893#ifdef CONFIG_SMP
894 c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; 894 c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
895 c->cpu_index = 0;
896#endif 895#endif
897} 896}
898 897
@@ -1078,8 +1077,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1078 1077
1079 1078
1080#ifdef CONFIG_SMP 1079#ifdef CONFIG_SMP
1081 if (!cpu_online(c->cpu_index))
1082 return 0;
1083 cpu = c->cpu_index; 1080 cpu = c->cpu_index;
1084#endif 1081#endif
1085 1082
@@ -1171,15 +1168,15 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1171static void *c_start(struct seq_file *m, loff_t *pos) 1168static void *c_start(struct seq_file *m, loff_t *pos)
1172{ 1169{
1173 if (*pos == 0) /* just in case, cpu 0 is not the first */ 1170 if (*pos == 0) /* just in case, cpu 0 is not the first */
1174 *pos = first_cpu(cpu_possible_map); 1171 *pos = first_cpu(cpu_online_map);
1175 if ((*pos) < NR_CPUS && cpu_possible(*pos)) 1172 if ((*pos) < NR_CPUS && cpu_online(*pos))
1176 return &cpu_data(*pos); 1173 return &cpu_data(*pos);
1177 return NULL; 1174 return NULL;
1178} 1175}
1179 1176
1180static void *c_next(struct seq_file *m, void *v, loff_t *pos) 1177static void *c_next(struct seq_file *m, void *v, loff_t *pos)
1181{ 1178{
1182 *pos = next_cpu(*pos, cpu_possible_map); 1179 *pos = next_cpu(*pos, cpu_online_map);
1183 return c_start(m, pos); 1180 return c_start(m, pos);
1184} 1181}
1185 1182
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index c821edc32216..368b1942b39a 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -82,18 +82,15 @@ static int set_rtc_mmss(unsigned long nowtime)
82 int retval = 0; 82 int retval = 0;
83 int real_seconds, real_minutes, cmos_minutes; 83 int real_seconds, real_minutes, cmos_minutes;
84 unsigned char control, freq_select; 84 unsigned char control, freq_select;
85 unsigned long flags;
85 86
86/* 87/*
87 * IRQs are disabled when we're called from the timer interrupt, 88 * set_rtc_mmss is called when irqs are enabled, so disable irqs here
88 * no need for spin_lock_irqsave()
89 */ 89 */
90 90 spin_lock_irqsave(&rtc_lock, flags);
91 spin_lock(&rtc_lock);
92
93/* 91/*
94 * Tell the clock it's being set and stop it. 92 * Tell the clock it's being set and stop it.
95 */ 93 */
96
97 control = CMOS_READ(RTC_CONTROL); 94 control = CMOS_READ(RTC_CONTROL);
98 CMOS_WRITE(control | RTC_SET, RTC_CONTROL); 95 CMOS_WRITE(control | RTC_SET, RTC_CONTROL);
99 96
@@ -138,7 +135,7 @@ static int set_rtc_mmss(unsigned long nowtime)
138 CMOS_WRITE(control, RTC_CONTROL); 135 CMOS_WRITE(control, RTC_CONTROL);
139 CMOS_WRITE(freq_select, RTC_FREQ_SELECT); 136 CMOS_WRITE(freq_select, RTC_FREQ_SELECT);
140 137
141 spin_unlock(&rtc_lock); 138 spin_unlock_irqrestore(&rtc_lock, flags);
142 139
143 return retval; 140 return retval;
144} 141}
@@ -164,21 +161,27 @@ unsigned long read_persistent_clock(void)
164 unsigned century = 0; 161 unsigned century = 0;
165 162
166 spin_lock_irqsave(&rtc_lock, flags); 163 spin_lock_irqsave(&rtc_lock, flags);
164 /*
165 * if UIP is clear, then we have >= 244 microseconds before RTC
166 * registers will be updated. Spec sheet says that this is the
167 * reliable way to read RTC - registers invalid (off bus) during update
168 */
169 while ((CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
170 cpu_relax();
167 171
168 do { 172
169 sec = CMOS_READ(RTC_SECONDS); 173 /* now read all RTC registers while stable with interrupts disabled */
170 min = CMOS_READ(RTC_MINUTES); 174 sec = CMOS_READ(RTC_SECONDS);
171 hour = CMOS_READ(RTC_HOURS); 175 min = CMOS_READ(RTC_MINUTES);
172 day = CMOS_READ(RTC_DAY_OF_MONTH); 176 hour = CMOS_READ(RTC_HOURS);
173 mon = CMOS_READ(RTC_MONTH); 177 day = CMOS_READ(RTC_DAY_OF_MONTH);
174 year = CMOS_READ(RTC_YEAR); 178 mon = CMOS_READ(RTC_MONTH);
179 year = CMOS_READ(RTC_YEAR);
175#ifdef CONFIG_ACPI 180#ifdef CONFIG_ACPI
176 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID && 181 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
177 acpi_gbl_FADT.century) 182 acpi_gbl_FADT.century)
178 century = CMOS_READ(acpi_gbl_FADT.century); 183 century = CMOS_READ(acpi_gbl_FADT.century);
179#endif 184#endif
180 } while (sec != CMOS_READ(RTC_SECONDS));
181
182 spin_unlock_irqrestore(&rtc_lock, flags); 185 spin_unlock_irqrestore(&rtc_lock, flags);
183 186
184 /* 187 /*
diff --git a/arch/x86/mach-voyager/voyager_cat.c b/arch/x86/mach-voyager/voyager_cat.c
index 26a2d4c54b68..2132ca652df1 100644
--- a/arch/x86/mach-voyager/voyager_cat.c
+++ b/arch/x86/mach-voyager/voyager_cat.c
@@ -568,7 +568,7 @@ static voyager_module_t *voyager_initial_module;
568 * boot cpu *after* all memory initialisation has been done (so we can 568 * boot cpu *after* all memory initialisation has been done (so we can
569 * use kmalloc) but before smp initialisation, so we can probe the SMP 569 * use kmalloc) but before smp initialisation, so we can probe the SMP
570 * configuration and pick up necessary information. */ 570 * configuration and pick up necessary information. */
571void 571void __init
572voyager_cat_init(void) 572voyager_cat_init(void)
573{ 573{
574 voyager_module_t **modpp = &voyager_initial_module; 574 voyager_module_t **modpp = &voyager_initial_module;
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 69371434b0cf..88124dd35406 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -1900,7 +1900,7 @@ voyager_smp_prepare_cpus(unsigned int max_cpus)
1900 smp_boot_cpus(); 1900 smp_boot_cpus();
1901} 1901}
1902 1902
1903static void __devinit voyager_smp_prepare_boot_cpu(void) 1903static void __cpuinit voyager_smp_prepare_boot_cpu(void)
1904{ 1904{
1905 init_gdt(smp_processor_id()); 1905 init_gdt(smp_processor_id());
1906 switch_to_new_gdt(); 1906 switch_to_new_gdt();
@@ -1911,7 +1911,7 @@ static void __devinit voyager_smp_prepare_boot_cpu(void)
1911 cpu_set(smp_processor_id(), cpu_present_map); 1911 cpu_set(smp_processor_id(), cpu_present_map);
1912} 1912}
1913 1913
1914static int __devinit 1914static int __cpuinit
1915voyager_cpu_up(unsigned int cpu) 1915voyager_cpu_up(unsigned int cpu)
1916{ 1916{
1917 /* This only works at boot for x86. See "rewrite" above. */ 1917 /* This only works at boot for x86. See "rewrite" above. */
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index a7536dcc2acf..0234f2831bf3 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -77,6 +77,9 @@ count_resource(struct acpi_resource *acpi_res, void *data)
77 struct acpi_resource_address64 addr; 77 struct acpi_resource_address64 addr;
78 acpi_status status; 78 acpi_status status;
79 79
80 if (info->res_num >= PCI_BUS_NUM_RESOURCES)
81 return AE_OK;
82
80 status = resource_to_addr(acpi_res, &addr); 83 status = resource_to_addr(acpi_res, &addr);
81 if (ACPI_SUCCESS(status)) 84 if (ACPI_SUCCESS(status))
82 info->res_num++; 85 info->res_num++;
@@ -93,6 +96,9 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
93 unsigned long flags; 96 unsigned long flags;
94 struct resource *root; 97 struct resource *root;
95 98
99 if (info->res_num >= PCI_BUS_NUM_RESOURCES)
100 return AE_OK;
101
96 status = resource_to_addr(acpi_res, &addr); 102 status = resource_to_addr(acpi_res, &addr);
97 if (!ACPI_SUCCESS(status)) 103 if (!ACPI_SUCCESS(status))
98 return AE_OK; 104 return AE_OK;
diff --git a/arch/x86/vdso/vgetcpu.c b/arch/x86/vdso/vgetcpu.c
index 91f6e85d0fc2..3b1ae1abfba9 100644
--- a/arch/x86/vdso/vgetcpu.c
+++ b/arch/x86/vdso/vgetcpu.c
@@ -13,32 +13,17 @@
13#include <asm/vgtod.h> 13#include <asm/vgtod.h>
14#include "vextern.h" 14#include "vextern.h"
15 15
16long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache) 16long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
17{ 17{
18 unsigned int dummy, p; 18 unsigned int dummy, p;
19 unsigned long j = 0;
20 19
21 /* Fast cache - only recompute value once per jiffies and avoid 20 if (*vdso_vgetcpu_mode == VGETCPU_RDTSCP) {
22 relatively costly rdtscp/cpuid otherwise.
23 This works because the scheduler usually keeps the process
24 on the same CPU and this syscall doesn't guarantee its
25 results anyways.
26 We do this here because otherwise user space would do it on
27 its own in a likely inferior way (no access to jiffies).
28 If you don't like it pass NULL. */
29 if (tcache && tcache->blob[0] == (j = *vdso_jiffies)) {
30 p = tcache->blob[1];
31 } else if (*vdso_vgetcpu_mode == VGETCPU_RDTSCP) {
32 /* Load per CPU data from RDTSCP */ 21 /* Load per CPU data from RDTSCP */
33 rdtscp(dummy, dummy, p); 22 rdtscp(dummy, dummy, p);
34 } else { 23 } else {
35 /* Load per CPU data from GDT */ 24 /* Load per CPU data from GDT */
36 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); 25 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
37 } 26 }
38 if (tcache) {
39 tcache->blob[0] = j;
40 tcache->blob[1] = p;
41 }
42 if (cpu) 27 if (cpu)
43 *cpu = p & 0xfff; 28 *cpu = p & 0xfff;
44 if (node) 29 if (node)