diff options
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r-- | drivers/pci/pci-acpi.c | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 14848bf95e82..7d33fc0ec2fc 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -120,14 +120,35 @@ out_kfree: | |||
120 | return status; | 120 | return status; |
121 | } | 121 | } |
122 | 122 | ||
123 | static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data) | ||
124 | { | ||
125 | acpi_status status; | ||
126 | u32 support_set; | ||
127 | struct acpi_osc_args osc_args; | ||
128 | |||
129 | /* do _OSC query for all possible controls */ | ||
130 | support_set = osc_data->support_set | (flags & OSC_SUPPORT_MASKS); | ||
131 | osc_args.capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | ||
132 | osc_args.capbuf[OSC_SUPPORT_TYPE] = support_set; | ||
133 | osc_args.capbuf[OSC_CONTROL_TYPE] = OSC_CONTROL_MASKS; | ||
134 | |||
135 | status = acpi_run_osc(osc_data->handle, &osc_args); | ||
136 | if (ACPI_SUCCESS(status)) { | ||
137 | osc_data->support_set = support_set; | ||
138 | osc_data->query_result = osc_args.query_result; | ||
139 | osc_data->is_queried = 1; | ||
140 | } | ||
141 | |||
142 | return status; | ||
143 | } | ||
144 | |||
123 | static acpi_status acpi_query_osc(acpi_handle handle, | 145 | static acpi_status acpi_query_osc(acpi_handle handle, |
124 | u32 level, void *context, void **retval) | 146 | u32 level, void *context, void **retval) |
125 | { | 147 | { |
126 | acpi_status status; | 148 | acpi_status status; |
127 | struct acpi_osc_data *osc_data; | 149 | struct acpi_osc_data *osc_data; |
128 | u32 flags = (unsigned long)context, support_set; | 150 | u32 flags = (unsigned long)context; |
129 | acpi_handle tmp; | 151 | acpi_handle tmp; |
130 | struct acpi_osc_args osc_args; | ||
131 | 152 | ||
132 | status = acpi_get_handle(handle, "_OSC", &tmp); | 153 | status = acpi_get_handle(handle, "_OSC", &tmp); |
133 | if (ACPI_FAILURE(status)) | 154 | if (ACPI_FAILURE(status)) |
@@ -141,18 +162,7 @@ static acpi_status acpi_query_osc(acpi_handle handle, | |||
141 | goto out; | 162 | goto out; |
142 | } | 163 | } |
143 | 164 | ||
144 | /* do _OSC query for all possible controls */ | 165 | status = __acpi_query_osc(flags, osc_data); |
145 | support_set = osc_data->support_set | (flags & OSC_SUPPORT_MASKS); | ||
146 | osc_args.capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | ||
147 | osc_args.capbuf[OSC_SUPPORT_TYPE] = support_set; | ||
148 | osc_args.capbuf[OSC_CONTROL_TYPE] = OSC_CONTROL_MASKS; | ||
149 | |||
150 | status = acpi_run_osc(handle, &osc_args); | ||
151 | if (ACPI_SUCCESS(status)) { | ||
152 | osc_data->support_set = support_set; | ||
153 | osc_data->query_result = osc_args.query_result; | ||
154 | osc_data->is_queried = 1; | ||
155 | } | ||
156 | out: | 166 | out: |
157 | mutex_unlock(&pci_acpi_lock); | 167 | mutex_unlock(&pci_acpi_lock); |
158 | return status; | 168 | return status; |
@@ -209,8 +219,13 @@ acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) | |||
209 | goto out; | 219 | goto out; |
210 | } | 220 | } |
211 | 221 | ||
212 | if (osc_data->is_queried && | 222 | if (!osc_data->is_queried) { |
213 | ((osc_data->query_result & ctrlset) != ctrlset)) { | 223 | status = __acpi_query_osc(osc_data->support_set, osc_data); |
224 | if (ACPI_FAILURE(status)) | ||
225 | goto out; | ||
226 | } | ||
227 | |||
228 | if ((osc_data->query_result & ctrlset) != ctrlset) { | ||
214 | status = AE_SUPPORT; | 229 | status = AE_SUPPORT; |
215 | goto out; | 230 | goto out; |
216 | } | 231 | } |