diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-alpha/pci.h | 12 | ||||
| -rw-r--r-- | include/asm-ia64/pci.h | 10 | ||||
| -rw-r--r-- | include/asm-ppc/pci.h | 7 | ||||
| -rw-r--r-- | include/asm-ppc64/pci.h | 7 | ||||
| -rw-r--r-- | include/asm-sparc64/pci.h | 7 | ||||
| -rw-r--r-- | include/linux/pci.h | 5 |
6 files changed, 48 insertions, 0 deletions
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h index d23b1f5db70c..34d0376dc322 100644 --- a/include/asm-alpha/pci.h +++ b/include/asm-alpha/pci.h @@ -194,6 +194,18 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index +/* Bus number == domain number until we get above 256 busses */ +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + int domain = pci_domain_nr(bus) + if (domain < 256) { + sprintf(name, "%02x", domain); + } else { + sprintf(name, "%04x:%02x", domain, bus->number); + } + return 0; +} + #endif /* __KERNEL__ */ /* Values for the `which' argument to sys_pciconfig_iobase. */ diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h index 13e56cfe1e3c..129436b9e730 100644 --- a/include/asm-ia64/pci.h +++ b/include/asm-ia64/pci.h @@ -102,6 +102,16 @@ struct pci_controller { #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata) #define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment) +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + if (pci_domain_nr(bus) == 0) { + sprintf(name, "%02x", bus->number); + } else { + sprintf(name, "%04x:%02x", pci_domain_nr(bus), bus->number); + } + return 0; +} + /* generic pci stuff */ #include <asm-generic/pci.h> diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h index ae9f2d0d8a4f..0f535e374c97 100644 --- a/include/asm-ppc/pci.h +++ b/include/asm-ppc/pci.h @@ -269,6 +269,13 @@ pci_dac_dma_sync_single(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, /* Return the index of the PCI controller for device PDEV. */ #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index +/* Set the name of the bus as it appears in /proc/bus/pci */ +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + sprintf(name, "%02x", bus->number); + return 0; +} + /* Map a range of PCI memory or I/O space for a device into user space */ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, enum pci_mmap_state mmap_state, int write_combine); diff --git a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h index 12c74914bc5d..289683028031 100644 --- a/include/asm-ppc64/pci.h +++ b/include/asm-ppc64/pci.h @@ -88,6 +88,13 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) extern int pci_domain_nr(struct pci_bus *bus); +/* Set the name of the bus as it appears in /proc/bus/pci */ +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + sprintf(name, "%02x", bus->number); + return 0; +} + struct vm_area_struct; /* Map a range of PCI memory or I/O space for a device into user space */ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h index 440e7ac0c934..c276200453a3 100644 --- a/include/asm-sparc64/pci.h +++ b/include/asm-sparc64/pci.h @@ -191,6 +191,13 @@ pci_dac_dma_sync_single(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, extern int pci_domain_nr(struct pci_bus *bus); +/* Set the name of the bus as it appears in /proc/bus/pci */ +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + sprintf(name, "%02x", bus->number); + return 0; +} + /* Platform support for /proc/bus/pci/X/Y mmap()s. */ #define HAVE_PCI_MMAP diff --git a/include/linux/pci.h b/include/linux/pci.h index 87ad2d6fd1e7..0a2ecb5fd9e7 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -768,6 +768,11 @@ static inline int pci_module_init(struct pci_driver *drv) */ #ifndef CONFIG_PCI_DOMAINS static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } +static inline int pci_name_bus(char *name, struct pci_bus *bus) +{ + sprintf(name, "%02x", bus->number); + return 0; +} #endif #endif /* !CONFIG_PCI */ |
