aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/pci_root.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index e10dbafa0569..d2ae816df0f5 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -226,22 +226,35 @@ static acpi_status acpi_pci_run_osc(acpi_handle handle,
226 return status; 226 return status;
227} 227}
228 228
229static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root, u32 flags) 229static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root,
230 u32 support,
231 u32 *control)
230{ 232{
231 acpi_status status; 233 acpi_status status;
232 u32 support_set, result, capbuf[3]; 234 u32 result, capbuf[3];
235
236 support &= OSC_PCI_SUPPORT_MASKS;
237 support |= root->osc_support_set;
233 238
234 /* do _OSC query for all possible controls */
235 support_set = root->osc_support_set | (flags & OSC_PCI_SUPPORT_MASKS);
236 capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; 239 capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE;
237 capbuf[OSC_SUPPORT_TYPE] = support_set; 240 capbuf[OSC_SUPPORT_TYPE] = support;
238 capbuf[OSC_CONTROL_TYPE] = OSC_PCI_CONTROL_MASKS; 241 if (control) {
242 *control &= OSC_PCI_CONTROL_MASKS;
243 capbuf[OSC_CONTROL_TYPE] = *control | root->osc_control_set;
244 } else {
245 /* Run _OSC query for all possible controls. */
246 capbuf[OSC_CONTROL_TYPE] = OSC_PCI_CONTROL_MASKS;
247 }
239 248
240 status = acpi_pci_run_osc(root->device->handle, capbuf, &result); 249 status = acpi_pci_run_osc(root->device->handle, capbuf, &result);
241 if (ACPI_SUCCESS(status)) { 250 if (ACPI_SUCCESS(status)) {
242 root->osc_support_set = support_set; 251 root->osc_support_set = support;
243 root->osc_control_qry = result; 252 if (control) {
244 root->osc_queried = 1; 253 *control = result;
254 } else {
255 root->osc_control_qry = result;
256 root->osc_queried = 1;
257 }
245 } 258 }
246 return status; 259 return status;
247} 260}
@@ -255,7 +268,7 @@ static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags)
255 if (ACPI_FAILURE(status)) 268 if (ACPI_FAILURE(status))
256 return status; 269 return status;
257 mutex_lock(&osc_lock); 270 mutex_lock(&osc_lock);
258 status = acpi_pci_query_osc(root, flags); 271 status = acpi_pci_query_osc(root, flags, NULL);
259 mutex_unlock(&osc_lock); 272 mutex_unlock(&osc_lock);
260 return status; 273 return status;
261} 274}
@@ -397,7 +410,7 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags)
397 410
398 /* Need to query controls first before requesting them */ 411 /* Need to query controls first before requesting them */
399 if (!root->osc_queried) { 412 if (!root->osc_queried) {
400 status = acpi_pci_query_osc(root, root->osc_support_set); 413 status = acpi_pci_query_osc(root, root->osc_support_set, NULL);
401 if (ACPI_FAILURE(status)) 414 if (ACPI_FAILURE(status))
402 goto out; 415 goto out;
403 } 416 }