diff options
Diffstat (limited to 'drivers/pci/pci-sysfs.c')
| -rw-r--r-- | drivers/pci/pci-sysfs.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index a15f94072a6f..cc9d65388e62 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
| @@ -60,15 +60,18 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf) | |||
| 60 | char * str = buf; | 60 | char * str = buf; |
| 61 | int i; | 61 | int i; |
| 62 | int max = 7; | 62 | int max = 7; |
| 63 | u64 start, end; | ||
| 63 | 64 | ||
| 64 | if (pci_dev->subordinate) | 65 | if (pci_dev->subordinate) |
| 65 | max = DEVICE_COUNT_RESOURCE; | 66 | max = DEVICE_COUNT_RESOURCE; |
| 66 | 67 | ||
| 67 | for (i = 0; i < max; i++) { | 68 | for (i = 0; i < max; i++) { |
| 68 | str += sprintf(str,"0x%016lx 0x%016lx 0x%016lx\n", | 69 | struct resource *res = &pci_dev->resource[i]; |
| 69 | pci_resource_start(pci_dev,i), | 70 | pci_resource_to_user(pci_dev, i, res, &start, &end); |
| 70 | pci_resource_end(pci_dev,i), | 71 | str += sprintf(str,"0x%016llx 0x%016llx 0x%016llx\n", |
| 71 | pci_resource_flags(pci_dev,i)); | 72 | (unsigned long long)start, |
| 73 | (unsigned long long)end, | ||
| 74 | (unsigned long long)res->flags); | ||
| 72 | } | 75 | } |
| 73 | return (str - buf); | 76 | return (str - buf); |
| 74 | } | 77 | } |
| @@ -313,8 +316,21 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, | |||
| 313 | struct device, kobj)); | 316 | struct device, kobj)); |
| 314 | struct resource *res = (struct resource *)attr->private; | 317 | struct resource *res = (struct resource *)attr->private; |
| 315 | enum pci_mmap_state mmap_type; | 318 | enum pci_mmap_state mmap_type; |
| 319 | u64 start, end; | ||
| 320 | int i; | ||
| 316 | 321 | ||
| 317 | vma->vm_pgoff += res->start >> PAGE_SHIFT; | 322 | for (i = 0; i < PCI_ROM_RESOURCE; i++) |
| 323 | if (res == &pdev->resource[i]) | ||
| 324 | break; | ||
| 325 | if (i >= PCI_ROM_RESOURCE) | ||
| 326 | return -ENODEV; | ||
| 327 | |||
| 328 | /* pci_mmap_page_range() expects the same kind of entry as coming | ||
| 329 | * from /proc/bus/pci/ which is a "user visible" value. If this is | ||
| 330 | * different from the resource itself, arch will do necessary fixup. | ||
| 331 | */ | ||
| 332 | pci_resource_to_user(pdev, i, res, &start, &end); | ||
| 333 | vma->vm_pgoff += start >> PAGE_SHIFT; | ||
| 318 | mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; | 334 | mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; |
| 319 | 335 | ||
| 320 | return pci_mmap_page_range(pdev, vma, mmap_type, 0); | 336 | return pci_mmap_page_range(pdev, vma, mmap_type, 0); |
