diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_ibm.c | 3 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp.h | 2 | ||||
-rw-r--r-- | drivers/pci/ioapic.c | 1 | ||||
-rw-r--r-- | drivers/pci/pci-acpi.c | 17 | ||||
-rw-r--r-- | drivers/pci/pci-label.c | 130 |
6 files changed, 45 insertions, 110 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index ee26bac2d378..cd929aed3613 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -494,7 +494,7 @@ static void acpiphp_bus_add(acpi_handle handle) | |||
494 | 494 | ||
495 | acpi_bus_scan(handle); | 495 | acpi_bus_scan(handle); |
496 | acpi_bus_get_device(handle, &adev); | 496 | acpi_bus_get_device(handle, &adev); |
497 | if (adev) | 497 | if (acpi_device_enumerated(adev)) |
498 | acpi_device_set_power(adev, ACPI_STATE_D0); | 498 | acpi_device_set_power(adev, ACPI_STATE_D0); |
499 | } | 499 | } |
500 | 500 | ||
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index ecfac7e72d91..8dcccffd6e21 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c | |||
@@ -31,12 +31,11 @@ | |||
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
34 | #include <acpi/acpi_bus.h> | ||
35 | #include <linux/sysfs.h> | 34 | #include <linux/sysfs.h> |
36 | #include <linux/kobject.h> | 35 | #include <linux/kobject.h> |
37 | #include <asm/uaccess.h> | ||
38 | #include <linux/moduleparam.h> | 36 | #include <linux/moduleparam.h> |
39 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
38 | #include <asm/uaccess.h> | ||
40 | 39 | ||
41 | #include "acpiphp.h" | 40 | #include "acpiphp.h" |
42 | #include "../pci.h" | 41 | #include "../pci.h" |
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index ccb0925bcd7b..88b37cad4b35 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -162,8 +162,6 @@ static inline const char *slot_name(struct slot *slot) | |||
162 | } | 162 | } |
163 | 163 | ||
164 | #ifdef CONFIG_ACPI | 164 | #ifdef CONFIG_ACPI |
165 | #include <acpi/acpi.h> | ||
166 | #include <acpi/acpi_bus.h> | ||
167 | #include <linux/pci-acpi.h> | 165 | #include <linux/pci-acpi.h> |
168 | 166 | ||
169 | void __init pciehp_acpi_slot_detection_init(void); | 167 | void __init pciehp_acpi_slot_detection_init(void); |
diff --git a/drivers/pci/ioapic.c b/drivers/pci/ioapic.c index 2c2930ea06ad..6b2b7dddbbdb 100644 --- a/drivers/pci/ioapic.c +++ b/drivers/pci/ioapic.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/acpi.h> | 21 | #include <linux/acpi.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <acpi/acpi_bus.h> | ||
24 | 23 | ||
25 | struct ioapic { | 24 | struct ioapic { |
26 | acpi_handle handle; | 25 | acpi_handle handle; |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 2bdbc0080204..f49abef88485 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -12,9 +12,6 @@ | |||
12 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/pci-aspm.h> | 14 | #include <linux/pci-aspm.h> |
15 | #include <acpi/acpi.h> | ||
16 | #include <acpi/acpi_bus.h> | ||
17 | |||
18 | #include <linux/pci-acpi.h> | 15 | #include <linux/pci-acpi.h> |
19 | #include <linux/pm_runtime.h> | 16 | #include <linux/pm_runtime.h> |
20 | #include <linux/pm_qos.h> | 17 | #include <linux/pm_qos.h> |
@@ -306,10 +303,10 @@ void acpi_pci_remove_bus(struct pci_bus *bus) | |||
306 | } | 303 | } |
307 | 304 | ||
308 | /* ACPI bus type */ | 305 | /* ACPI bus type */ |
309 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) | 306 | static struct acpi_device *acpi_pci_find_companion(struct device *dev) |
310 | { | 307 | { |
311 | struct pci_dev *pci_dev = to_pci_dev(dev); | 308 | struct pci_dev *pci_dev = to_pci_dev(dev); |
312 | bool is_bridge; | 309 | bool check_children; |
313 | u64 addr; | 310 | u64 addr; |
314 | 311 | ||
315 | /* | 312 | /* |
@@ -317,14 +314,12 @@ static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) | |||
317 | * is set only after acpi_pci_find_device() has been called for the | 314 | * is set only after acpi_pci_find_device() has been called for the |
318 | * given device. | 315 | * given device. |
319 | */ | 316 | */ |
320 | is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE | 317 | check_children = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE |
321 | || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; | 318 | || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; |
322 | /* Please ref to ACPI spec for the syntax of _ADR */ | 319 | /* Please ref to ACPI spec for the syntax of _ADR */ |
323 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); | 320 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); |
324 | *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge); | 321 | return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr, |
325 | if (!*handle) | 322 | check_children); |
326 | return -ENODEV; | ||
327 | return 0; | ||
328 | } | 323 | } |
329 | 324 | ||
330 | static void pci_acpi_setup(struct device *dev) | 325 | static void pci_acpi_setup(struct device *dev) |
@@ -367,7 +362,7 @@ static bool pci_acpi_bus_match(struct device *dev) | |||
367 | static struct acpi_bus_type acpi_pci_bus = { | 362 | static struct acpi_bus_type acpi_pci_bus = { |
368 | .name = "PCI", | 363 | .name = "PCI", |
369 | .match = pci_acpi_bus_match, | 364 | .match = pci_acpi_bus_match, |
370 | .find_device = acpi_pci_find_device, | 365 | .find_companion = acpi_pci_find_companion, |
371 | .setup = pci_acpi_setup, | 366 | .setup = pci_acpi_setup, |
372 | .cleanup = pci_acpi_cleanup, | 367 | .cleanup = pci_acpi_cleanup, |
373 | }; | 368 | }; |
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c index 6f5d343d251c..45113daaa778 100644 --- a/drivers/pci/pci-label.c +++ b/drivers/pci/pci-label.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/nls.h> | 29 | #include <linux/nls.h> |
30 | #include <linux/acpi.h> | 30 | #include <linux/acpi.h> |
31 | #include <linux/pci-acpi.h> | 31 | #include <linux/pci-acpi.h> |
32 | #include <acpi/acpi_bus.h> | ||
33 | #include "pci.h" | 32 | #include "pci.h" |
34 | 33 | ||
35 | #define DEVICE_LABEL_DSM 0x07 | 34 | #define DEVICE_LABEL_DSM 0x07 |
@@ -162,7 +161,6 @@ static const char device_label_dsm_uuid[] = { | |||
162 | }; | 161 | }; |
163 | 162 | ||
164 | enum acpi_attr_enum { | 163 | enum acpi_attr_enum { |
165 | ACPI_ATTR_NONE = 0, | ||
166 | ACPI_ATTR_LABEL_SHOW, | 164 | ACPI_ATTR_LABEL_SHOW, |
167 | ACPI_ATTR_INDEX_SHOW, | 165 | ACPI_ATTR_INDEX_SHOW, |
168 | }; | 166 | }; |
@@ -170,84 +168,61 @@ enum acpi_attr_enum { | |||
170 | static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) | 168 | static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) |
171 | { | 169 | { |
172 | int len; | 170 | int len; |
173 | len = utf16s_to_utf8s((const wchar_t *)obj-> | 171 | len = utf16s_to_utf8s((const wchar_t *)obj->string.pointer, |
174 | package.elements[1].string.pointer, | 172 | obj->string.length, |
175 | obj->package.elements[1].string.length, | ||
176 | UTF16_LITTLE_ENDIAN, | 173 | UTF16_LITTLE_ENDIAN, |
177 | buf, PAGE_SIZE); | 174 | buf, PAGE_SIZE); |
178 | buf[len] = '\n'; | 175 | buf[len] = '\n'; |
179 | } | 176 | } |
180 | 177 | ||
181 | static int | 178 | static int |
182 | dsm_get_label(acpi_handle handle, int func, | 179 | dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr) |
183 | struct acpi_buffer *output, | ||
184 | char *buf, enum acpi_attr_enum attribute) | ||
185 | { | 180 | { |
186 | struct acpi_object_list input; | 181 | acpi_handle handle; |
187 | union acpi_object params[4]; | 182 | union acpi_object *obj, *tmp; |
188 | union acpi_object *obj; | 183 | int len = -1; |
189 | int len = 0; | 184 | |
190 | 185 | handle = ACPI_HANDLE(dev); | |
191 | int err; | 186 | if (!handle) |
192 | |||
193 | input.count = 4; | ||
194 | input.pointer = params; | ||
195 | params[0].type = ACPI_TYPE_BUFFER; | ||
196 | params[0].buffer.length = sizeof(device_label_dsm_uuid); | ||
197 | params[0].buffer.pointer = (char *)device_label_dsm_uuid; | ||
198 | params[1].type = ACPI_TYPE_INTEGER; | ||
199 | params[1].integer.value = 0x02; | ||
200 | params[2].type = ACPI_TYPE_INTEGER; | ||
201 | params[2].integer.value = func; | ||
202 | params[3].type = ACPI_TYPE_PACKAGE; | ||
203 | params[3].package.count = 0; | ||
204 | params[3].package.elements = NULL; | ||
205 | |||
206 | err = acpi_evaluate_object(handle, "_DSM", &input, output); | ||
207 | if (err) | ||
208 | return -1; | 187 | return -1; |
209 | 188 | ||
210 | obj = (union acpi_object *)output->pointer; | 189 | obj = acpi_evaluate_dsm(handle, device_label_dsm_uuid, 0x2, |
211 | 190 | DEVICE_LABEL_DSM, NULL); | |
212 | switch (obj->type) { | 191 | if (!obj) |
213 | case ACPI_TYPE_PACKAGE: | 192 | return -1; |
214 | if (obj->package.count != 2) | 193 | |
215 | break; | 194 | tmp = obj->package.elements; |
216 | len = obj->package.elements[0].integer.value; | 195 | if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 && |
217 | if (buf) { | 196 | tmp[0].type == ACPI_TYPE_INTEGER && |
218 | if (attribute == ACPI_ATTR_INDEX_SHOW) | 197 | tmp[1].type == ACPI_TYPE_STRING) { |
219 | scnprintf(buf, PAGE_SIZE, "%llu\n", | 198 | /* |
220 | obj->package.elements[0].integer.value); | 199 | * The second string element is optional even when |
221 | else if (attribute == ACPI_ATTR_LABEL_SHOW) | 200 | * this _DSM is implemented; when not implemented, |
222 | dsm_label_utf16s_to_utf8s(obj, buf); | 201 | * this entry must return a null string. |
223 | kfree(output->pointer); | 202 | */ |
224 | return strlen(buf); | 203 | if (attr == ACPI_ATTR_INDEX_SHOW) |
225 | } | 204 | scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value); |
226 | kfree(output->pointer); | 205 | else if (attr == ACPI_ATTR_LABEL_SHOW) |
227 | return len; | 206 | dsm_label_utf16s_to_utf8s(tmp + 1, buf); |
228 | break; | 207 | len = strlen(buf) > 0 ? strlen(buf) : -1; |
229 | default: | ||
230 | kfree(output->pointer); | ||
231 | } | 208 | } |
232 | return -1; | 209 | |
210 | ACPI_FREE(obj); | ||
211 | |||
212 | return len; | ||
233 | } | 213 | } |
234 | 214 | ||
235 | static bool | 215 | static bool |
236 | device_has_dsm(struct device *dev) | 216 | device_has_dsm(struct device *dev) |
237 | { | 217 | { |
238 | acpi_handle handle; | 218 | acpi_handle handle; |
239 | struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
240 | 219 | ||
241 | handle = ACPI_HANDLE(dev); | 220 | handle = ACPI_HANDLE(dev); |
242 | |||
243 | if (!handle) | 221 | if (!handle) |
244 | return FALSE; | 222 | return false; |
245 | 223 | ||
246 | if (dsm_get_label(handle, DEVICE_LABEL_DSM, &output, NULL, | 224 | return !!acpi_check_dsm(handle, device_label_dsm_uuid, 0x2, |
247 | ACPI_ATTR_NONE) > 0) | 225 | 1 << DEVICE_LABEL_DSM); |
248 | return TRUE; | ||
249 | |||
250 | return FALSE; | ||
251 | } | 226 | } |
252 | 227 | ||
253 | static umode_t | 228 | static umode_t |
@@ -266,44 +241,13 @@ acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n) | |||
266 | static ssize_t | 241 | static ssize_t |
267 | acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf) | 242 | acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf) |
268 | { | 243 | { |
269 | struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; | 244 | return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW); |
270 | acpi_handle handle; | ||
271 | int length; | ||
272 | |||
273 | handle = ACPI_HANDLE(dev); | ||
274 | |||
275 | if (!handle) | ||
276 | return -1; | ||
277 | |||
278 | length = dsm_get_label(handle, DEVICE_LABEL_DSM, | ||
279 | &output, buf, ACPI_ATTR_LABEL_SHOW); | ||
280 | |||
281 | if (length < 1) | ||
282 | return -1; | ||
283 | |||
284 | return length; | ||
285 | } | 245 | } |
286 | 246 | ||
287 | static ssize_t | 247 | static ssize_t |
288 | acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf) | 248 | acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf) |
289 | { | 249 | { |
290 | struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; | 250 | return dsm_get_label(dev, buf, ACPI_ATTR_INDEX_SHOW); |
291 | acpi_handle handle; | ||
292 | int length; | ||
293 | |||
294 | handle = ACPI_HANDLE(dev); | ||
295 | |||
296 | if (!handle) | ||
297 | return -1; | ||
298 | |||
299 | length = dsm_get_label(handle, DEVICE_LABEL_DSM, | ||
300 | &output, buf, ACPI_ATTR_INDEX_SHOW); | ||
301 | |||
302 | if (length < 0) | ||
303 | return -1; | ||
304 | |||
305 | return length; | ||
306 | |||
307 | } | 251 | } |
308 | 252 | ||
309 | static struct device_attribute acpi_attr_label = { | 253 | static struct device_attribute acpi_attr_label = { |