diff options
author | David S. Miller <davem@davemloft.net> | 2008-05-15 03:34:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-05-15 03:34:44 -0400 |
commit | 63fe46da9c380b3f2bbdf3765044649517cc717c (patch) | |
tree | 9478c1aca1d692b408955aea20c9cd9a37e589c0 /drivers/pci | |
parent | 99dd1a2b8347ac2ae802300b7862f6f7bcf17139 (diff) | |
parent | 066b2118976e6e7cc50eed39e2747c75343a23c4 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/wireless/iwlwifi/iwl-4965-rs.c
drivers/net/wireless/rt2x00/rt61pci.c
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/intel-iommu.c | 6 | ||||
-rw-r--r-- | drivers/pci/pci-acpi.c | 109 | ||||
-rw-r--r-- | drivers/pci/probe.c | 33 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 1 |
4 files changed, 100 insertions, 49 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 1fd8bb765702..66c0fd21894b 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -49,7 +49,7 @@ | |||
49 | 49 | ||
50 | #define DEFAULT_DOMAIN_ADDRESS_WIDTH 48 | 50 | #define DEFAULT_DOMAIN_ADDRESS_WIDTH 48 |
51 | 51 | ||
52 | #define DMAR_OPERATION_TIMEOUT (HZ*60) /* 1m */ | 52 | #define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000) /* 10sec */ |
53 | 53 | ||
54 | #define DOMAIN_MAX_ADDR(gaw) ((((u64)1) << gaw) - 1) | 54 | #define DOMAIN_MAX_ADDR(gaw) ((((u64)1) << gaw) - 1) |
55 | 55 | ||
@@ -490,12 +490,12 @@ static int iommu_alloc_root_entry(struct intel_iommu *iommu) | |||
490 | 490 | ||
491 | #define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ | 491 | #define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ |
492 | {\ | 492 | {\ |
493 | unsigned long start_time = jiffies;\ | 493 | cycles_t start_time = get_cycles();\ |
494 | while (1) {\ | 494 | while (1) {\ |
495 | sts = op (iommu->reg + offset);\ | 495 | sts = op (iommu->reg + offset);\ |
496 | if (cond)\ | 496 | if (cond)\ |
497 | break;\ | 497 | break;\ |
498 | if (time_after(jiffies, start_time + DMAR_OPERATION_TIMEOUT))\ | 498 | if (DMAR_OPERATION_TIMEOUT < (get_cycles() - start_time))\ |
499 | panic("DMAR hardware is malfunctioning\n");\ | 499 | panic("DMAR hardware is malfunctioning\n");\ |
500 | cpu_relax();\ | 500 | cpu_relax();\ |
501 | }\ | 501 | }\ |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 72f7476930c8..9d6fc8e6285d 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -19,8 +19,31 @@ | |||
19 | #include <linux/pci-acpi.h> | 19 | #include <linux/pci-acpi.h> |
20 | #include "pci.h" | 20 | #include "pci.h" |
21 | 21 | ||
22 | static u32 ctrlset_buf[3] = {0, 0, 0}; | 22 | struct acpi_osc_data { |
23 | static u32 global_ctrlsets = 0; | 23 | acpi_handle handle; |
24 | u32 ctrlset_buf[3]; | ||
25 | u32 global_ctrlsets; | ||
26 | struct list_head sibiling; | ||
27 | }; | ||
28 | static LIST_HEAD(acpi_osc_data_list); | ||
29 | |||
30 | static struct acpi_osc_data *acpi_get_osc_data(acpi_handle handle) | ||
31 | { | ||
32 | struct acpi_osc_data *data; | ||
33 | |||
34 | list_for_each_entry(data, &acpi_osc_data_list, sibiling) { | ||
35 | if (data->handle == handle) | ||
36 | return data; | ||
37 | } | ||
38 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
39 | if (!data) | ||
40 | return NULL; | ||
41 | INIT_LIST_HEAD(&data->sibiling); | ||
42 | data->handle = handle; | ||
43 | list_add_tail(&data->sibiling, &acpi_osc_data_list); | ||
44 | return data; | ||
45 | } | ||
46 | |||
24 | static u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40, 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66}; | 47 | static u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40, 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66}; |
25 | 48 | ||
26 | static acpi_status | 49 | static acpi_status |
@@ -37,8 +60,27 @@ acpi_query_osc ( | |||
37 | union acpi_object *out_obj; | 60 | union acpi_object *out_obj; |
38 | u32 osc_dw0; | 61 | u32 osc_dw0; |
39 | acpi_status *ret_status = (acpi_status *)retval; | 62 | acpi_status *ret_status = (acpi_status *)retval; |
63 | struct acpi_osc_data *osc_data; | ||
64 | u32 flags = (unsigned long)context, temp; | ||
65 | acpi_handle tmp; | ||
66 | |||
67 | status = acpi_get_handle(handle, "_OSC", &tmp); | ||
68 | if (ACPI_FAILURE(status)) | ||
69 | return status; | ||
70 | |||
71 | osc_data = acpi_get_osc_data(handle); | ||
72 | if (!osc_data) { | ||
73 | printk(KERN_ERR "acpi osc data array is full\n"); | ||
74 | return AE_ERROR; | ||
75 | } | ||
76 | |||
77 | osc_data->ctrlset_buf[OSC_SUPPORT_TYPE] |= (flags & OSC_SUPPORT_MASKS); | ||
78 | |||
79 | /* do _OSC query for all possible controls */ | ||
80 | temp = osc_data->ctrlset_buf[OSC_CONTROL_TYPE]; | ||
81 | osc_data->ctrlset_buf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | ||
82 | osc_data->ctrlset_buf[OSC_CONTROL_TYPE] = OSC_CONTROL_MASKS; | ||
40 | 83 | ||
41 | |||
42 | /* Setting up input parameters */ | 84 | /* Setting up input parameters */ |
43 | input.count = 4; | 85 | input.count = 4; |
44 | input.pointer = in_params; | 86 | input.pointer = in_params; |
@@ -51,13 +93,11 @@ acpi_query_osc ( | |||
51 | in_params[2].integer.value = 3; | 93 | in_params[2].integer.value = 3; |
52 | in_params[3].type = ACPI_TYPE_BUFFER; | 94 | in_params[3].type = ACPI_TYPE_BUFFER; |
53 | in_params[3].buffer.length = 12; | 95 | in_params[3].buffer.length = 12; |
54 | in_params[3].buffer.pointer = (u8 *)context; | 96 | in_params[3].buffer.pointer = (u8 *)osc_data->ctrlset_buf; |
55 | 97 | ||
56 | status = acpi_evaluate_object(handle, "_OSC", &input, &output); | 98 | status = acpi_evaluate_object(handle, "_OSC", &input, &output); |
57 | if (ACPI_FAILURE (status)) { | 99 | if (ACPI_FAILURE(status)) |
58 | *ret_status = status; | 100 | goto out_nofree; |
59 | return status; | ||
60 | } | ||
61 | out_obj = output.pointer; | 101 | out_obj = output.pointer; |
62 | 102 | ||
63 | if (out_obj->type != ACPI_TYPE_BUFFER) { | 103 | if (out_obj->type != ACPI_TYPE_BUFFER) { |
@@ -76,7 +116,8 @@ acpi_query_osc ( | |||
76 | printk(KERN_DEBUG "_OSC invalid revision\n"); | 116 | printk(KERN_DEBUG "_OSC invalid revision\n"); |
77 | if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { | 117 | if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { |
78 | /* Update Global Control Set */ | 118 | /* Update Global Control Set */ |
79 | global_ctrlsets = *((u32 *)(out_obj->buffer.pointer+8)); | 119 | osc_data->global_ctrlsets = |
120 | *((u32 *)(out_obj->buffer.pointer + 8)); | ||
80 | status = AE_OK; | 121 | status = AE_OK; |
81 | goto query_osc_out; | 122 | goto query_osc_out; |
82 | } | 123 | } |
@@ -85,12 +126,21 @@ acpi_query_osc ( | |||
85 | } | 126 | } |
86 | 127 | ||
87 | /* Update Global Control Set */ | 128 | /* Update Global Control Set */ |
88 | global_ctrlsets = *((u32 *)(out_obj->buffer.pointer + 8)); | 129 | osc_data->global_ctrlsets = *((u32 *)(out_obj->buffer.pointer + 8)); |
89 | status = AE_OK; | 130 | status = AE_OK; |
90 | 131 | ||
91 | query_osc_out: | 132 | query_osc_out: |
92 | kfree(output.pointer); | 133 | kfree(output.pointer); |
134 | out_nofree: | ||
93 | *ret_status = status; | 135 | *ret_status = status; |
136 | |||
137 | osc_data->ctrlset_buf[OSC_QUERY_TYPE] = !OSC_QUERY_ENABLE; | ||
138 | osc_data->ctrlset_buf[OSC_CONTROL_TYPE] = temp; | ||
139 | if (ACPI_FAILURE(status)) { | ||
140 | /* no osc support at all */ | ||
141 | osc_data->ctrlset_buf[OSC_SUPPORT_TYPE] = 0; | ||
142 | } | ||
143 | |||
94 | return status; | 144 | return status; |
95 | } | 145 | } |
96 | 146 | ||
@@ -165,28 +215,15 @@ run_osc_out: | |||
165 | **/ | 215 | **/ |
166 | acpi_status __pci_osc_support_set(u32 flags, const char *hid) | 216 | acpi_status __pci_osc_support_set(u32 flags, const char *hid) |
167 | { | 217 | { |
168 | u32 temp; | 218 | acpi_status retval = AE_NOT_FOUND; |
169 | acpi_status retval; | ||
170 | 219 | ||
171 | if (!(flags & OSC_SUPPORT_MASKS)) { | 220 | if (!(flags & OSC_SUPPORT_MASKS)) { |
172 | return AE_TYPE; | 221 | return AE_TYPE; |
173 | } | 222 | } |
174 | ctrlset_buf[OSC_SUPPORT_TYPE] |= (flags & OSC_SUPPORT_MASKS); | ||
175 | |||
176 | /* do _OSC query for all possible controls */ | ||
177 | temp = ctrlset_buf[OSC_CONTROL_TYPE]; | ||
178 | ctrlset_buf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | ||
179 | ctrlset_buf[OSC_CONTROL_TYPE] = OSC_CONTROL_MASKS; | ||
180 | acpi_get_devices(hid, | 223 | acpi_get_devices(hid, |
181 | acpi_query_osc, | 224 | acpi_query_osc, |
182 | ctrlset_buf, | 225 | (void *)(unsigned long)flags, |
183 | (void **) &retval ); | 226 | (void **) &retval ); |
184 | ctrlset_buf[OSC_QUERY_TYPE] = !OSC_QUERY_ENABLE; | ||
185 | ctrlset_buf[OSC_CONTROL_TYPE] = temp; | ||
186 | if (ACPI_FAILURE(retval)) { | ||
187 | /* no osc support at all */ | ||
188 | ctrlset_buf[OSC_SUPPORT_TYPE] = 0; | ||
189 | } | ||
190 | return AE_OK; | 227 | return AE_OK; |
191 | } | 228 | } |
192 | 229 | ||
@@ -201,19 +238,31 @@ acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) | |||
201 | { | 238 | { |
202 | acpi_status status; | 239 | acpi_status status; |
203 | u32 ctrlset; | 240 | u32 ctrlset; |
241 | acpi_handle tmp; | ||
242 | struct acpi_osc_data *osc_data; | ||
243 | |||
244 | status = acpi_get_handle(handle, "_OSC", &tmp); | ||
245 | if (ACPI_FAILURE(status)) | ||
246 | return status; | ||
247 | |||
248 | osc_data = acpi_get_osc_data(handle); | ||
249 | if (!osc_data) { | ||
250 | printk(KERN_ERR "acpi osc data array is full\n"); | ||
251 | return AE_ERROR; | ||
252 | } | ||
204 | 253 | ||
205 | ctrlset = (flags & OSC_CONTROL_MASKS); | 254 | ctrlset = (flags & OSC_CONTROL_MASKS); |
206 | if (!ctrlset) { | 255 | if (!ctrlset) { |
207 | return AE_TYPE; | 256 | return AE_TYPE; |
208 | } | 257 | } |
209 | if (ctrlset_buf[OSC_SUPPORT_TYPE] && | 258 | if (osc_data->ctrlset_buf[OSC_SUPPORT_TYPE] && |
210 | ((global_ctrlsets & ctrlset) != ctrlset)) { | 259 | ((osc_data->global_ctrlsets & ctrlset) != ctrlset)) { |
211 | return AE_SUPPORT; | 260 | return AE_SUPPORT; |
212 | } | 261 | } |
213 | ctrlset_buf[OSC_CONTROL_TYPE] |= ctrlset; | 262 | osc_data->ctrlset_buf[OSC_CONTROL_TYPE] |= ctrlset; |
214 | status = acpi_run_osc(handle, ctrlset_buf); | 263 | status = acpi_run_osc(handle, osc_data->ctrlset_buf); |
215 | if (ACPI_FAILURE (status)) { | 264 | if (ACPI_FAILURE (status)) { |
216 | ctrlset_buf[OSC_CONTROL_TYPE] &= ~ctrlset; | 265 | osc_data->ctrlset_buf[OSC_CONTROL_TYPE] &= ~ctrlset; |
217 | } | 266 | } |
218 | 267 | ||
219 | return status; | 268 | return status; |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 4a55bf380957..3706ce7972dd 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -842,13 +842,25 @@ static void set_pcie_port_type(struct pci_dev *pdev) | |||
842 | * reading the dword at 0x100 which must either be 0 or a valid extended | 842 | * reading the dword at 0x100 which must either be 0 or a valid extended |
843 | * capability header. | 843 | * capability header. |
844 | */ | 844 | */ |
845 | int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix) | 845 | int pci_cfg_space_size_ext(struct pci_dev *dev) |
846 | { | 846 | { |
847 | int pos; | ||
848 | u32 status; | 847 | u32 status; |
849 | 848 | ||
850 | if (!check_exp_pcix) | 849 | if (pci_read_config_dword(dev, 256, &status) != PCIBIOS_SUCCESSFUL) |
851 | goto skip; | 850 | goto fail; |
851 | if (status == 0xffffffff) | ||
852 | goto fail; | ||
853 | |||
854 | return PCI_CFG_SPACE_EXP_SIZE; | ||
855 | |||
856 | fail: | ||
857 | return PCI_CFG_SPACE_SIZE; | ||
858 | } | ||
859 | |||
860 | int pci_cfg_space_size(struct pci_dev *dev) | ||
861 | { | ||
862 | int pos; | ||
863 | u32 status; | ||
852 | 864 | ||
853 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); | 865 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); |
854 | if (!pos) { | 866 | if (!pos) { |
@@ -861,23 +873,12 @@ int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix) | |||
861 | goto fail; | 873 | goto fail; |
862 | } | 874 | } |
863 | 875 | ||
864 | skip: | 876 | return pci_cfg_space_size_ext(dev); |
865 | if (pci_read_config_dword(dev, 256, &status) != PCIBIOS_SUCCESSFUL) | ||
866 | goto fail; | ||
867 | if (status == 0xffffffff) | ||
868 | goto fail; | ||
869 | |||
870 | return PCI_CFG_SPACE_EXP_SIZE; | ||
871 | 877 | ||
872 | fail: | 878 | fail: |
873 | return PCI_CFG_SPACE_SIZE; | 879 | return PCI_CFG_SPACE_SIZE; |
874 | } | 880 | } |
875 | 881 | ||
876 | int pci_cfg_space_size(struct pci_dev *dev) | ||
877 | { | ||
878 | return pci_cfg_space_size_ext(dev, 1); | ||
879 | } | ||
880 | |||
881 | static void pci_release_bus_bridge_dev(struct device *dev) | 882 | static void pci_release_bus_bridge_dev(struct device *dev) |
882 | { | 883 | { |
883 | kfree(dev); | 884 | kfree(dev); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index afd914ebe215..f2d9c770f51a 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1826,6 +1826,7 @@ static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) | |||
1826 | } | 1826 | } |
1827 | } | 1827 | } |
1828 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk); | 1828 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk); |
1829 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_ANY_ID, nv_msi_ht_cap_quirk); | ||
1829 | 1830 | ||
1830 | static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev) | 1831 | static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev) |
1831 | { | 1832 | { |