PCI domain support
PATCH 1/1 PCI domain support
This patch (approved by Ivan) adds PCI domain support to sysfs. Please apply.
Implementations for alpha & ia64 and a default implementation for architectures which don't support PCI domains yet.
Index: arch/alpha/Kconfig
===================================================================
RCS file: /var/cvs/linux-2.5/arch/alpha/Kconfig,v
retrieving revision 1.13
alpha/Kconfig +4 -0
@@ -295,6 +295,10 @@ config PCI information about which PCI hardware does work under Linux and which doesn't. +config PCI_DOMAINS + bool + default PCI + config ALPHA_CORE_AGP bool depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL
Index: arch/ia64/Kconfig
===================================================================
RCS file: /var/cvs/linux-2.5/arch/ia64/Kconfig,v
retrieving revision 1.12
ia64/Kconfig +4 -0
@@ -543,6 +543,10 @@ config PCI information about which PCI hardware does work under Linux and which doesn't. +config PCI_DOMAINS + bool + default PCI + source "drivers/pci/Kconfig" config HOTPLUG
Index: arch/ia64/hp/common/sba_iommu.c
===================================================================
RCS file: /var/cvs/linux-2.5/arch/ia64/hp/common/sba_iommu.c,v retrieving revision 1.7
ia64/hp/common/sba_iommu.c +1 -1
@@ -1889,7 +1889,7 @@ sba_connect_bus(struct pci_bus *bus) handle = parent; }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
Index: arch/ia64/pci/pci.c
===================================================================
RCS file: /var/cvs/linux-2.5/arch/ia64/pci/pci.c,v retrieving revision 1.7
ia64/pci/pci.c +2 -2
@@ -87,14 +87,14 @@ __pci_sal_write (int seg, int bus, int dstatic int 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); }static int 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); }
Index: drivers/pci/probe.c
===================================================================
RCS file: /var/cvs/linux-2.5/drivers/pci/probe.c,v retrieving revision 1.14
pci/probe.c +2 -1
@@ -528,7 +528,8 @@ pci_scan_device(struct pci_bus *bus, intpci_name_device (dev);/* 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;return dev;
Index: include/asm-alpha/pci.h
===================================================================
RCS file: /var/cvs/linux-2.5/include/asm-alpha/pci.h,v retrieving revision 1.9
asm-alpha/pci.h +3 -0
@@ -195,6 +195,9 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res); +#define pci_domain_nr (bus) ({ struct pci_controller *_hose_ = bus->sysdata; \ + _hose_->index; }) +#endif /* __KERNEL__ */ /* Values for the `which' argument to sys_pciconfig_iobase. */
Index: include/asm-ia64/pci.h
===================================================================
RCS file: /var/cvs/linux-2.5/include/asm-ia64/pci.h,v retrieving revision 1.7
asm-ia64/pci.h +1 -1
@@ -95,7 +95,7 @@ struct pci_controller { };#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 */ #include <asm-generic/pci.h>
Index: include/linux/pci.h
===================================================================
RCS file: /var/cvs/linux-2.5/include/linux/pci.h,v retrieving revision 1.16
linux/pci.h +10 -0
@@ -868,5 +868,15 @@ extern int pci_pci_problems;#define PCIPCI_VSFX 16#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 /* LINUX_PCI_H */
Signature · 3 lines
"It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies. Do you think I want to have an academic debate on this subject?" -- Robert Fisk