diff options
| -rw-r--r-- | drivers/pci/pci-sysfs.c | 4 | ||||
| -rw-r--r-- | drivers/pci/probe.c | 2 | ||||
| -rw-r--r-- | drivers/pci/proc.c | 7 | ||||
| -rw-r--r-- | include/linux/pci.h | 37 |
4 files changed, 32 insertions, 18 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index d2f1354fd18..ea54cedcdfc 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
| @@ -102,11 +102,13 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf) | |||
| 102 | struct pci_dev * pci_dev = to_pci_dev(dev); | 102 | struct pci_dev * pci_dev = to_pci_dev(dev); |
| 103 | char * str = buf; | 103 | char * str = buf; |
| 104 | int i; | 104 | int i; |
| 105 | int max = 7; | 105 | int max; |
| 106 | resource_size_t start, end; | 106 | resource_size_t start, end; |
| 107 | 107 | ||
| 108 | if (pci_dev->subordinate) | 108 | if (pci_dev->subordinate) |
| 109 | max = DEVICE_COUNT_RESOURCE; | 109 | max = DEVICE_COUNT_RESOURCE; |
| 110 | else | ||
| 111 | max = PCI_BRIDGE_RESOURCES; | ||
| 110 | 112 | ||
| 111 | for (i = 0; i < max; i++) { | 113 | for (i = 0; i < max; i++) { |
| 112 | struct resource *res = &pci_dev->resource[i]; | 114 | struct resource *res = &pci_dev->resource[i]; |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5dcf2b65e3f..e1cf5d50ed4 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -423,7 +423,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, | |||
| 423 | child->subordinate = 0xff; | 423 | child->subordinate = 0xff; |
| 424 | 424 | ||
| 425 | /* Set up default resource pointers and names.. */ | 425 | /* Set up default resource pointers and names.. */ |
| 426 | for (i = 0; i < 4; i++) { | 426 | for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) { |
| 427 | child->resource[i] = &bridge->resource[PCI_BRIDGE_RESOURCES+i]; | 427 | child->resource[i] = &bridge->resource[PCI_BRIDGE_RESOURCES+i]; |
| 428 | child->resource[i]->name = child->name; | 428 | child->resource[i]->name = child->name; |
| 429 | } | 429 | } |
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 7fb086d3961..593bb844b8d 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
| @@ -361,15 +361,16 @@ static int show_device(struct seq_file *m, void *v) | |||
| 361 | dev->vendor, | 361 | dev->vendor, |
| 362 | dev->device, | 362 | dev->device, |
| 363 | dev->irq); | 363 | dev->irq); |
| 364 | /* Here should be 7 and not PCI_NUM_RESOURCES as we need to preserve compatibility */ | 364 | |
| 365 | for (i=0; i<7; i++) { | 365 | /* only print standard and ROM resources to preserve compatibility */ |
| 366 | for (i = 0; i <= PCI_ROM_RESOURCE; i++) { | ||
| 366 | resource_size_t start, end; | 367 | resource_size_t start, end; |
| 367 | pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); | 368 | pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); |
| 368 | seq_printf(m, "\t%16llx", | 369 | seq_printf(m, "\t%16llx", |
| 369 | (unsigned long long)(start | | 370 | (unsigned long long)(start | |
| 370 | (dev->resource[i].flags & PCI_REGION_FLAG_MASK))); | 371 | (dev->resource[i].flags & PCI_REGION_FLAG_MASK))); |
| 371 | } | 372 | } |
| 372 | for (i=0; i<7; i++) { | 373 | for (i = 0; i <= PCI_ROM_RESOURCE; i++) { |
| 373 | resource_size_t start, end; | 374 | resource_size_t start, end; |
| 374 | pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); | 375 | pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); |
| 375 | seq_printf(m, "\t%16llx", | 376 | seq_printf(m, "\t%16llx", |
diff --git a/include/linux/pci.h b/include/linux/pci.h index c5e02f324e1..da1c22bab40 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -82,7 +82,30 @@ enum pci_mmap_state { | |||
| 82 | #define PCI_DMA_FROMDEVICE 2 | 82 | #define PCI_DMA_FROMDEVICE 2 |
| 83 | #define PCI_DMA_NONE 3 | 83 | #define PCI_DMA_NONE 3 |
| 84 | 84 | ||
| 85 | #define DEVICE_COUNT_RESOURCE 12 | 85 | /* |
| 86 | * For PCI devices, the region numbers are assigned this way: | ||
| 87 | */ | ||
| 88 | enum { | ||
| 89 | /* #0-5: standard PCI resources */ | ||
| 90 | PCI_STD_RESOURCES, | ||
| 91 | PCI_STD_RESOURCE_END = 5, | ||
| 92 | |||
| 93 | /* #6: expansion ROM resource */ | ||
| 94 | PCI_ROM_RESOURCE, | ||
| 95 | |||
| 96 | /* resources assigned to buses behind the bridge */ | ||
| 97 | #define PCI_BRIDGE_RESOURCE_NUM 4 | ||
| 98 | |||
| 99 | PCI_BRIDGE_RESOURCES, | ||
| 100 | PCI_BRIDGE_RESOURCE_END = PCI_BRIDGE_RESOURCES + | ||
| 101 | PCI_BRIDGE_RESOURCE_NUM - 1, | ||
| 102 | |||
| 103 | /* total resources associated with a PCI device */ | ||
| 104 | PCI_NUM_RESOURCES, | ||
| 105 | |||
| 106 | /* preserve this for compatibility */ | ||
| 107 | DEVICE_COUNT_RESOURCE | ||
| 108 | }; | ||
| 86 | 109 | ||
| 87 | typedef int __bitwise pci_power_t; | 110 | typedef int __bitwise pci_power_t; |
| 88 | 111 | ||
| @@ -274,18 +297,6 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev, | |||
| 274 | hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); | 297 | hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); |
| 275 | } | 298 | } |
| 276 | 299 | ||
| 277 | /* | ||
| 278 | * For PCI devices, the region numbers are assigned this way: | ||
| 279 | * | ||
| 280 | * 0-5 standard PCI regions | ||
| 281 | * 6 expansion ROM | ||
| 282 | * 7-10 bridges: address space assigned to buses behind the bridge | ||
| 283 | */ | ||
| 284 | |||
| 285 | #define PCI_ROM_RESOURCE 6 | ||
| 286 | #define PCI_BRIDGE_RESOURCES 7 | ||
| 287 | #define PCI_NUM_RESOURCES 11 | ||
| 288 | |||
| 289 | #ifndef PCI_BUS_NUM_RESOURCES | 300 | #ifndef PCI_BUS_NUM_RESOURCES |
| 290 | #define PCI_BUS_NUM_RESOURCES 16 | 301 | #define PCI_BUS_NUM_RESOURCES 16 |
| 291 | #endif | 302 | #endif |
