aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-acpi.c
diff options
context:
space:
mode:
authorTaku Izumi <izumi.taku@jp.fujitsu.com>2008-11-20 01:22:32 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-01-07 14:12:34 -0500
commit753e3aca735dc446f66d501b625122661738b57d (patch)
treeceb7f6cb60fd5cfdad2acbcac5618367ff8097fb /drivers/pci/pci-acpi.c
parent4ba7d0f0eb68cf7731ead4ca20e540d0266cfa8e (diff)
PCI: revert additional _OSC evaluation
Reverts adf411b819adc9fa96e9b3e638c7480d5e71d270. The commit adf411b819adc9fa96e9b3e638c7480d5e71d270 was based on the improper assumption that queried result was not updated when _OSC support field was changed. But, in fact, queried result is updated whenever _OSC support field was changed through __acpi_query_osc(). As a result, the commit adf411b819adc9fa96e9b3e638c7480d5e71d270 only introduced unnecessary additional _OSC evaluation... Tested-by: Andrew Patterson <andrew.patterson@hp.com> Reviewed-by: Andrew Patterson <andrew.patterson@hp.com> Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r--drivers/pci/pci-acpi.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 8f923ee5177f..c580a525d9ce 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -24,13 +24,15 @@ struct acpi_osc_data {
24 acpi_handle handle; 24 acpi_handle handle;
25 u32 support_set; 25 u32 support_set;
26 u32 control_set; 26 u32 control_set;
27 int is_queried;
28 u32 query_result;
27 struct list_head sibiling; 29 struct list_head sibiling;
28}; 30};
29static LIST_HEAD(acpi_osc_data_list); 31static LIST_HEAD(acpi_osc_data_list);
30 32
31struct acpi_osc_args { 33struct acpi_osc_args {
32 u32 capbuf[3]; 34 u32 capbuf[3];
33 u32 ctrl_result; 35 u32 query_result;
34}; 36};
35 37
36static DEFINE_MUTEX(pci_acpi_lock); 38static DEFINE_MUTEX(pci_acpi_lock);
@@ -112,8 +114,9 @@ static acpi_status acpi_run_osc(acpi_handle handle,
112 goto out_kfree; 114 goto out_kfree;
113 } 115 }
114out_success: 116out_success:
115 osc_args->ctrl_result = 117 if (flags & OSC_QUERY_ENABLE)
116 *((u32 *)(out_obj->buffer.pointer + 8)); 118 osc_args->query_result =
119 *((u32 *)(out_obj->buffer.pointer + 8));
117 status = AE_OK; 120 status = AE_OK;
118 121
119out_kfree: 122out_kfree:
@@ -121,8 +124,7 @@ out_kfree:
121 return status; 124 return status;
122} 125}
123 126
124static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data, 127static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data)
125 u32 *result)
126{ 128{
127 acpi_status status; 129 acpi_status status;
128 u32 support_set; 130 u32 support_set;
@@ -137,7 +139,8 @@ static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data,
137 status = acpi_run_osc(osc_data->handle, &osc_args); 139 status = acpi_run_osc(osc_data->handle, &osc_args);
138 if (ACPI_SUCCESS(status)) { 140 if (ACPI_SUCCESS(status)) {
139 osc_data->support_set = support_set; 141 osc_data->support_set = support_set;
140 *result = osc_args.ctrl_result; 142 osc_data->query_result = osc_args.query_result;
143 osc_data->is_queried = 1;
141 } 144 }
142 145
143 return status; 146 return status;
@@ -151,7 +154,6 @@ static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data,
151 */ 154 */
152int pci_acpi_osc_support(acpi_handle handle, u32 flags) 155int pci_acpi_osc_support(acpi_handle handle, u32 flags)
153{ 156{
154 u32 dummy;
155 acpi_status status; 157 acpi_status status;
156 acpi_handle tmp; 158 acpi_handle tmp;
157 struct acpi_osc_data *osc_data; 159 struct acpi_osc_data *osc_data;
@@ -169,7 +171,7 @@ int pci_acpi_osc_support(acpi_handle handle, u32 flags)
169 goto out; 171 goto out;
170 } 172 }
171 173
172 __acpi_query_osc(flags, osc_data, &dummy); 174 __acpi_query_osc(flags, osc_data);
173out: 175out:
174 mutex_unlock(&pci_acpi_lock); 176 mutex_unlock(&pci_acpi_lock);
175 return rc; 177 return rc;
@@ -185,7 +187,7 @@ out:
185acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) 187acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
186{ 188{
187 acpi_status status; 189 acpi_status status;
188 u32 ctrlset, control_set, result; 190 u32 ctrlset, control_set;
189 acpi_handle tmp; 191 acpi_handle tmp;
190 struct acpi_osc_data *osc_data; 192 struct acpi_osc_data *osc_data;
191 struct acpi_osc_args osc_args; 193 struct acpi_osc_args osc_args;
@@ -208,11 +210,13 @@ acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
208 goto out; 210 goto out;
209 } 211 }
210 212
211 status = __acpi_query_osc(osc_data->support_set, osc_data, &result); 213 if (!osc_data->is_queried) {
212 if (ACPI_FAILURE(status)) 214 status = __acpi_query_osc(osc_data->support_set, osc_data);
213 goto out; 215 if (ACPI_FAILURE(status))
216 goto out;
217 }
214 218
215 if ((result & ctrlset) != ctrlset) { 219 if ((osc_data->query_result & ctrlset) != ctrlset) {
216 status = AE_SUPPORT; 220 status = AE_SUPPORT;
217 goto out; 221 goto out;
218 } 222 }