Commit 67c27d08 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Greg Kroah-Hartman

[PATCH] PCI: domain support for sysfs

parent 43635f82
...@@ -295,6 +295,10 @@ config PCI ...@@ -295,6 +295,10 @@ config PCI
information about which PCI hardware does work under Linux and which information about which PCI hardware does work under Linux and which
doesn't. doesn't.
config PCI_DOMAINS
bool
default PCI
config ALPHA_CORE_AGP config ALPHA_CORE_AGP
bool bool
depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL
......
...@@ -484,11 +484,3 @@ sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn) ...@@ -484,11 +484,3 @@ sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
/* Return the index of the PCI controller for device PDEV. */
int
pci_controller_num(struct pci_dev *pdev)
{
struct pci_controller *hose = pdev->sysdata;
return (hose ? (int) hose->index : -ENXIO);
}
...@@ -543,6 +543,10 @@ config PCI ...@@ -543,6 +543,10 @@ config PCI
information about which PCI hardware does work under Linux and which information about which PCI hardware does work under Linux and which
doesn't. doesn't.
config PCI_DOMAINS
bool
default PCI
source "drivers/pci/Kconfig" source "drivers/pci/Kconfig"
config HOTPLUG config HOTPLUG
......
...@@ -1889,7 +1889,7 @@ sba_connect_bus(struct pci_bus *bus) ...@@ -1889,7 +1889,7 @@ sba_connect_bus(struct pci_bus *bus)
handle = parent; handle = parent;
} while (ACPI_SUCCESS(status)); } while (ACPI_SUCCESS(status));
printk(KERN_WARNING "No IOC for PCI Bus %02x:%02x in ACPI\n", PCI_SEGMENT(bus), bus->number); printk(KERN_WARNING "No IOC for PCI Bus %04x:%02x in ACPI\n", pci_domain_nr(bus), bus->number);
} }
static int __init static int __init
......
...@@ -87,14 +87,14 @@ __pci_sal_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value) ...@@ -87,14 +87,14 @@ __pci_sal_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value)
static int static int
pci_sal_read (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) pci_sal_read (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value)
{ {
return __pci_sal_read(PCI_SEGMENT(bus), bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), return __pci_sal_read(pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn),
where, size, value); where, size, value);
} }
static int static int
pci_sal_write (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) pci_sal_write (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
{ {
return __pci_sal_write(PCI_SEGMENT(bus), bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), return __pci_sal_write(pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn),
where, size, value); where, size, value);
} }
......
...@@ -773,6 +773,10 @@ config PCI ...@@ -773,6 +773,10 @@ config PCI
your box. If you say Y here, the kernel will include drivers and your box. If you say Y here, the kernel will include drivers and
infrastructure code to support PCI bus devices. infrastructure code to support PCI bus devices.
config PCI_DOMAINS
bool
default PCI
config PC_KEYBOARD config PC_KEYBOARD
bool "PC PS/2 style Keyboard" bool "PC PS/2 style Keyboard"
depends on 4xx || 8260 depends on 4xx || 8260
......
...@@ -1482,16 +1482,6 @@ pci_resource_to_bus(struct pci_dev *pdev, struct resource *res) ...@@ -1482,16 +1482,6 @@ pci_resource_to_bus(struct pci_dev *pdev, struct resource *res)
return res->start; return res->start;
} }
/*
* Return the index of the PCI controller for device pdev.
*/
int pci_controller_num(struct pci_dev *dev)
{
struct pci_controller *hose = (struct pci_controller *) dev->sysdata;
return hose->index;
}
/* /*
* Platform support for /proc/bus/pci/X/Y mmap()s, * Platform support for /proc/bus/pci/X/Y mmap()s,
* modelled on the sparc64 implementation by Dave Miller. * modelled on the sparc64 implementation by Dave Miller.
......
...@@ -171,6 +171,10 @@ config PCI ...@@ -171,6 +171,10 @@ config PCI
your box. If you say Y here, the kernel will include drivers and your box. If you say Y here, the kernel will include drivers and
infrastructure code to support PCI bus devices. infrastructure code to support PCI bus devices.
config PCI_DOMAINS
bool
default PCI
# only elf supported, a.out is not -- Cort # only elf supported, a.out is not -- Cort
config KCORE_ELF config KCORE_ELF
bool bool
......
...@@ -371,11 +371,11 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) ...@@ -371,11 +371,11 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
} }
/* /*
* Return the index of the PCI controller for device pdev. * Return the domain number for this bus.
*/ */
int pci_controller_num(struct pci_dev *dev) int pci_domain_nr(struct pci_bus *bus)
{ {
struct pci_controller *hose = PCI_GET_PHB_PTR(dev); struct pci_controller *hose = PCI_GET_PHB_PTR(bus);
return hose->global_number; return hose->global_number;
} }
......
...@@ -318,6 +318,10 @@ config PCI ...@@ -318,6 +318,10 @@ config PCI
information about which PCI hardware does work under Linux and which information about which PCI hardware does work under Linux and which
doesn't. doesn't.
config PCI_DOMAINS
bool
default PCI
config RTC config RTC
tristate tristate
depends on PCI depends on PCI
......
...@@ -802,11 +802,11 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, ...@@ -802,11 +802,11 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
return 0; return 0;
} }
/* Return the index of the PCI controller for device PDEV. */ /* Return the domain nuber for this pci bus */
int pci_controller_num(struct pci_dev *pdev) int pci_domain_nr(struct pci_bus *bus)
{ {
struct pcidev_cookie *cookie = pdev->sysdata; struct pcidev_cookie *cookie = bus->sysdata;
int ret; int ret;
if (cookie != NULL) { if (cookie != NULL) {
......
...@@ -529,7 +529,8 @@ pci_scan_device(struct pci_bus *bus, int devfn) ...@@ -529,7 +529,8 @@ pci_scan_device(struct pci_bus *bus, int devfn)
pci_name_device(dev); pci_name_device(dev);
/* now put in global tree */ /* now put in global tree */
strcpy(dev->dev.bus_id,dev->slot_name); sprintf(dev->dev.bus_id, "%04x:%s", pci_domain_nr(bus),
dev->slot_name);
dev->dev.dma_mask = &dev->dma_mask; dev->dev.dma_mask = &dev->dma_mask;
return dev; return dev;
......
...@@ -210,7 +210,7 @@ static int proc_bus_pci_ioctl(struct inode *inode, struct file *file, unsigned i ...@@ -210,7 +210,7 @@ static int proc_bus_pci_ioctl(struct inode *inode, struct file *file, unsigned i
switch (cmd) { switch (cmd) {
case PCIIOC_CONTROLLER: case PCIIOC_CONTROLLER:
ret = pci_controller_num(dev); ret = pci_domain_nr(dev->bus);
break; break;
#ifdef HAVE_PCI_MMAP #ifdef HAVE_PCI_MMAP
......
...@@ -188,13 +188,12 @@ pci_dac_dma_sync_single(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, ...@@ -188,13 +188,12 @@ pci_dac_dma_sync_single(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len,
/* Nothing to do. */ /* Nothing to do. */
} }
/* Return the index of the PCI controller for device PDEV. */
extern int pci_controller_num(struct pci_dev *pdev);
extern void extern void
pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
struct resource *res); struct resource *res);
#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/* Values for the `which' argument to sys_pciconfig_iobase. */ /* Values for the `which' argument to sys_pciconfig_iobase. */
......
...@@ -128,14 +128,6 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) ...@@ -128,14 +128,6 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
*/ */
#define pci_dac_dma_supported(pci_dev, mask) (0) #define pci_dac_dma_supported(pci_dev, mask) (0)
/*
* Return the index of the PCI controller for device PDEV.
*/
static inline int pci_controller_num(struct pci_dev *dev)
{
return 0;
}
#if defined(CONFIG_SA1111) && !defined(CONFIG_PCI) #if defined(CONFIG_SA1111) && !defined(CONFIG_PCI)
/* /*
......
...@@ -19,7 +19,4 @@ extern inline void pcibios_penalize_isa_irq(int irq) ...@@ -19,7 +19,4 @@ extern inline void pcibios_penalize_isa_irq(int irq)
/* We don't do dynamic PCI IRQ allocation */ /* We don't do dynamic PCI IRQ allocation */
} }
/* Return the index of the PCI controller for device PDEV. */
#define pci_controller_num(PDEV) (0)
#endif /* _ASM_H8300_PCI_H */ #endif /* _ASM_H8300_PCI_H */
...@@ -90,12 +90,6 @@ pci_dac_dma_sync_single(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, ...@@ -90,12 +90,6 @@ pci_dac_dma_sync_single(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len,
#define sg_dma_address(sg) ((sg)->dma_address) #define sg_dma_address(sg) ((sg)->dma_address)
#define sg_dma_len(sg) ((sg)->length) #define sg_dma_len(sg) ((sg)->length)
/* Return the index of the PCI controller for device. */
static inline int pci_controller_num(struct pci_dev *dev)
{
return 0;
}
#define HAVE_PCI_MMAP #define HAVE_PCI_MMAP
extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine); enum pci_mmap_state mmap_state, int write_combine);
......
...@@ -70,9 +70,6 @@ extern int pcibios_prep_mwi (struct pci_dev *); ...@@ -70,9 +70,6 @@ extern int pcibios_prep_mwi (struct pci_dev *);
#define pci_dac_dma_to_offset(dev,dma_addr) ((dma_addr) & ~PAGE_MASK) #define pci_dac_dma_to_offset(dev,dma_addr) ((dma_addr) & ~PAGE_MASK)
#define pci_dac_dma_sync_single(dev,dma_addr,len,dir) do { mb(); } while (0) #define pci_dac_dma_sync_single(dev,dma_addr,len,dir) do { mb(); } while (0)
/* Return the index of the PCI controller for device PDEV. */
#define pci_controller_num(PDEV) (0)
#define sg_dma_len(sg) ((sg)->dma_length) #define sg_dma_len(sg) ((sg)->dma_length)
#define sg_dma_address(sg) ((sg)->dma_address) #define sg_dma_address(sg) ((sg)->dma_address)
...@@ -95,7 +92,7 @@ struct pci_controller { ...@@ -95,7 +92,7 @@ struct pci_controller {
}; };
#define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata) #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
#define PCI_SEGMENT(busdev) (PCI_CONTROLLER(busdev)->segment) #define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment)
/* generic pci stuff */ /* generic pci stuff */
#include <asm-generic/pci.h> #include <asm-generic/pci.h>
......
...@@ -45,9 +45,6 @@ extern inline void pcibios_penalize_isa_irq(int irq) ...@@ -45,9 +45,6 @@ extern inline void pcibios_penalize_isa_irq(int irq)
/* We don't do dynamic PCI IRQ allocation */ /* We don't do dynamic PCI IRQ allocation */
} }
/* Return the index of the PCI controller for device PDEV. */
#define pci_controller_num(PDEV) (0)
/* The PCI address space does equal the physical memory /* The PCI address space does equal the physical memory
* address space. The networking and block device layers use * address space. The networking and block device layers use
* this boolean for bounce buffer decisions. * this boolean for bounce buffer decisions.
......
...@@ -237,9 +237,6 @@ extern inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) ...@@ -237,9 +237,6 @@ extern inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
} }
/* Return the index of the PCI controller for device. */
#define pci_controller_num(pdev) (0)
/* /*
* These macros should be used after a pci_map_sg call has been done * These macros should be used after a pci_map_sg call has been done
* to get bus addresses of each of the SG entries and their lengths. * to get bus addresses of each of the SG entries and their lengths.
......
...@@ -255,11 +255,6 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) ...@@ -255,11 +255,6 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
return 1; return 1;
} }
/*
* Return the index of the PCI controller for device.
*/
#define pci_controller_num(pdev) (0)
/* /*
* These macros should be used after a pci_map_sg call has been done * These macros should be used after a pci_map_sg call has been done
* to get bus addresses of each of the SG entries and their lengths. * to get bus addresses of each of the SG entries and their lengths.
......
...@@ -180,9 +180,6 @@ extern inline void pcibios_register_hba(struct pci_hba_data *x) ...@@ -180,9 +180,6 @@ extern inline void pcibios_register_hba(struct pci_hba_data *x)
/* Don't support DAC yet. */ /* Don't support DAC yet. */
#define pci_dac_dma_supported(pci_dev, mask) (0) #define pci_dac_dma_supported(pci_dev, mask) (0)
/* Return the index of the PCI controller for device PDEV. */
#define pci_controller_num(PDEV) (0)
/* export the pci_ DMA API in terms of the dma_ one */ /* export the pci_ DMA API in terms of the dma_ one */
#include <asm-generic/pci-dma-compat.h> #include <asm-generic/pci-dma-compat.h>
......
...@@ -39,7 +39,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose, ...@@ -39,7 +39,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
* Structure of a PCI controller (host bridge) * Structure of a PCI controller (host bridge)
*/ */
struct pci_controller { struct pci_controller {
int index; /* used for pci_controller_num */ int index; /* PCI domain number */
struct pci_controller *next; struct pci_controller *next;
struct pci_bus *bus; struct pci_bus *bus;
void *arch_data; void *arch_data;
......
...@@ -266,7 +266,7 @@ pci_dac_dma_sync_single(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, ...@@ -266,7 +266,7 @@ 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. */ /* Return the index of the PCI controller for device PDEV. */
extern int pci_controller_num(struct pci_dev *pdev); #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
/* Map a range of PCI memory or I/O space for a device into user space */ /* 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, int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
......
...@@ -86,8 +86,7 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) ...@@ -86,8 +86,7 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
return 1; return 1;
} }
/* Return the index of the PCI controller for device PDEV. */ extern int pci_domain_nr(struct pci_bus *bus);
extern int pci_controller_num(struct pci_dev *pdev);
struct vm_area_struct; struct vm_area_struct;
/* Map a range of PCI memory or I/O space for a device into user space */ /* Map a range of PCI memory or I/O space for a device into user space */
......
...@@ -226,9 +226,6 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) ...@@ -226,9 +226,6 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
*/ */
#define pci_dac_dma_supported(pci_dev, mask) (0) #define pci_dac_dma_supported(pci_dev, mask) (0)
/* Return the index of the PCI controller for device PDEV. */
#define pci_controller_num(PDEV) (0)
/* These macros should be used after a pci_map_sg call has been done /* These macros should be used after a pci_map_sg call has been done
* to get bus addresses of each of the SG entries and their lengths. * to get bus addresses of each of the SG entries and their lengths.
* You should only work with the number of sg entries pci_map_sg * You should only work with the number of sg entries pci_map_sg
......
...@@ -132,9 +132,6 @@ extern inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) ...@@ -132,9 +132,6 @@ extern inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
#define pci_dac_dma_supported(dev, mask) (0) #define pci_dac_dma_supported(dev, mask) (0)
/* Return the index of the PCI controller for device PDEV. */
#define pci_controller_num(PDEV) (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/* generic pci stuff */ /* generic pci stuff */
......
...@@ -189,7 +189,7 @@ pci_dac_dma_sync_single(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, ...@@ -189,7 +189,7 @@ 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. */ /* Return the index of the PCI controller for device PDEV. */
extern int pci_controller_num(struct pci_dev *pdev); extern int pci_domain_nr(struct pci_bus *bus);
/* Platform support for /proc/bus/pci/X/Y mmap()s. */ /* Platform support for /proc/bus/pci/X/Y mmap()s. */
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
instead, perversely enough, this becomes always true! */ instead, perversely enough, this becomes always true! */
#define pci_dma_supported(dev, mask) 1 #define pci_dma_supported(dev, mask) 1
#define pci_dac_dma_supported(dev, mask) 0 #define pci_dac_dma_supported(dev, mask) 0
#define pci_controller_num(dev) 0
#define pcibios_assign_all_busses() 1 #define pcibios_assign_all_busses() 1
......
...@@ -270,12 +270,6 @@ pci_dac_dma_sync_single(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, ...@@ -270,12 +270,6 @@ pci_dac_dma_sync_single(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len,
#define sg_dma_address(sg) ((sg)->dma_address) #define sg_dma_address(sg) ((sg)->dma_address)
#define sg_dma_len(sg) ((sg)->length) #define sg_dma_len(sg) ((sg)->length)
/* Return the index of the PCI controller for device. */
static inline int pci_controller_num(struct pci_dev *dev)
{
return 0;
}
#define HAVE_PCI_MMAP #define HAVE_PCI_MMAP
extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine); enum pci_mmap_state mmap_state, int write_combine);
......
...@@ -805,5 +805,15 @@ extern int pci_pci_problems; ...@@ -805,5 +805,15 @@ extern int pci_pci_problems;
#define PCIPCI_VSFX 16 #define PCIPCI_VSFX 16
#define PCIPCI_ALIMAGIK 32 #define PCIPCI_ALIMAGIK 32
/*
* PCI domain support. Sometimes called PCI segment (eg by ACPI),
* a PCI domain is defined to be a set of PCI busses which share
* configuration space.
*/
#ifndef CONFIG_PCI_DOMAINS
#define pci_domain_nr(bus) 0
#endif
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* LINUX_PCI_H */ #endif /* LINUX_PCI_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment