aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2012-11-09 12:00:10 -0500
committerBjorn Helgaas <bhelgaas@google.com>2012-11-09 12:00:10 -0500
commit0dcccc5c53c55565a6b1061e1b15894495c7c9b9 (patch)
tree75a19916763452385e3843d944943779f91b7961 /arch/x86/pci
parent05508270064efd674e8f2a047911dcd7776aaae0 (diff)
parentb4873931cc8c934a9893d5962bde97aca23be983 (diff)
Merge branch 'pci/mike-x86-tra' into next
* pci/mike-x86-tra: x86/PCI: Allow x86 platforms to use translation offsets
Diffstat (limited to 'arch/x86/pci')
-rw-r--r--arch/x86/pci/acpi.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 49e5195223db..0c01261fe5a8 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -12,6 +12,7 @@ struct pci_root_info {
12 char name[16]; 12 char name[16];
13 unsigned int res_num; 13 unsigned int res_num;
14 struct resource *res; 14 struct resource *res;
15 resource_size_t *res_offset;
15 struct pci_sysdata sd; 16 struct pci_sysdata sd;
16#ifdef CONFIG_PCI_MMCONFIG 17#ifdef CONFIG_PCI_MMCONFIG
17 bool mcfg_added; 18 bool mcfg_added;
@@ -323,6 +324,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
323 res->flags = flags; 324 res->flags = flags;
324 res->start = start; 325 res->start = start;
325 res->end = end; 326 res->end = end;
327 info->res_offset[info->res_num] = addr.translation_offset;
326 328
327 if (!pci_use_crs) { 329 if (!pci_use_crs) {
328 dev_printk(KERN_DEBUG, &info->bridge->dev, 330 dev_printk(KERN_DEBUG, &info->bridge->dev,
@@ -392,7 +394,8 @@ static void add_resources(struct pci_root_info *info,
392 "ignoring host bridge window %pR (conflicts with %s %pR)\n", 394 "ignoring host bridge window %pR (conflicts with %s %pR)\n",
393 res, conflict->name, conflict); 395 res, conflict->name, conflict);
394 else 396 else
395 pci_add_resource(resources, res); 397 pci_add_resource_offset(resources, res,
398 info->res_offset[i]);
396 } 399 }
397} 400}
398 401
@@ -400,6 +403,8 @@ static void free_pci_root_info_res(struct pci_root_info *info)
400{ 403{
401 kfree(info->res); 404 kfree(info->res);
402 info->res = NULL; 405 info->res = NULL;
406 kfree(info->res_offset);
407 info->res_offset = NULL;
403 info->res_num = 0; 408 info->res_num = 0;
404} 409}
405 410
@@ -450,10 +455,20 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
450 return; 455 return;
451 456
452 size = sizeof(*info->res) * info->res_num; 457 size = sizeof(*info->res) * info->res_num;
453 info->res_num = 0;
454 info->res = kzalloc(size, GFP_KERNEL); 458 info->res = kzalloc(size, GFP_KERNEL);
455 if (!info->res) 459 if (!info->res) {
460 info->res_num = 0;
461 return;
462 }
463
464 size = sizeof(*info->res_offset) * info->res_num;
465 info->res_num = 0;
466 info->res_offset = kzalloc(size, GFP_KERNEL);
467 if (!info->res_offset) {
468 kfree(info->res);
469 info->res = NULL;
456 return; 470 return;
471 }
457 472
458 acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, 473 acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource,
459 info); 474 info);