aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/pci
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/Kconfig59
-rw-r--r--drivers/pci/Makefile65
-rw-r--r--drivers/pci/access.c62
-rw-r--r--drivers/pci/bus.c151
-rw-r--r--drivers/pci/gen-devlist.c132
-rw-r--r--drivers/pci/hotplug.c163
-rw-r--r--drivers/pci/hotplug/Kconfig197
-rw-r--r--drivers/pci/hotplug/Makefile74
-rw-r--r--drivers/pci/hotplug/acpiphp.h268
-rw-r--r--drivers/pci/hotplug/acpiphp_core.c453
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c1344
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c499
-rw-r--r--drivers/pci/hotplug/acpiphp_pci.c449
-rw-r--r--drivers/pci/hotplug/acpiphp_res.c700
-rw-r--r--drivers/pci/hotplug/cpci_hotplug.h96
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_core.c792
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_pci.c661
-rw-r--r--drivers/pci/hotplug/cpcihp_generic.c223
-rw-r--r--drivers/pci/hotplug/cpcihp_zt5550.c305
-rw-r--r--drivers/pci/hotplug/cpcihp_zt5550.h79
-rw-r--r--drivers/pci/hotplug/cpqphp.h721
-rw-r--r--drivers/pci/hotplug/cpqphp_core.c1509
-rw-r--r--drivers/pci/hotplug/cpqphp_ctrl.c3096
-rw-r--r--drivers/pci/hotplug/cpqphp_nvram.c666
-rw-r--r--drivers/pci/hotplug/cpqphp_nvram.h57
-rw-r--r--drivers/pci/hotplug/cpqphp_pci.c1569
-rw-r--r--drivers/pci/hotplug/cpqphp_sysfs.c143
-rw-r--r--drivers/pci/hotplug/fakephp.c358
-rw-r--r--drivers/pci/hotplug/ibmphp.h763
-rw-r--r--drivers/pci/hotplug/ibmphp_core.c1422
-rw-r--r--drivers/pci/hotplug/ibmphp_ebda.c1275
-rw-r--r--drivers/pci/hotplug/ibmphp_hpc.c1161
-rw-r--r--drivers/pci/hotplug/ibmphp_pci.c1747
-rw-r--r--drivers/pci/hotplug/ibmphp_res.c2156
-rw-r--r--drivers/pci/hotplug/pci_hotplug.h180
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c715
-rw-r--r--drivers/pci/hotplug/pciehp.h352
-rw-r--r--drivers/pci/hotplug/pciehp_core.c662
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c2706
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c1501
-rw-r--r--drivers/pci/hotplug/pciehp_pci.c827
-rw-r--r--drivers/pci/hotplug/pciehprm.h52
-rw-r--r--drivers/pci/hotplug/pciehprm_acpi.c1737
-rw-r--r--drivers/pci/hotplug/pciehprm_nonacpi.c501
-rw-r--r--drivers/pci/hotplug/pciehprm_nonacpi.h56
-rw-r--r--drivers/pci/hotplug/pcihp_skeleton.c375
-rw-r--r--drivers/pci/hotplug/rpadlpar.h24
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c503
-rw-r--r--drivers/pci/hotplug/rpadlpar_sysfs.c151
-rw-r--r--drivers/pci/hotplug/rpaphp.h138
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c536
-rw-r--r--drivers/pci/hotplug/rpaphp_pci.c538
-rw-r--r--drivers/pci/hotplug/rpaphp_slot.c267
-rw-r--r--drivers/pci/hotplug/rpaphp_vio.c129
-rw-r--r--drivers/pci/hotplug/shpchp.h463
-rw-r--r--drivers/pci/hotplug/shpchp_core.c630
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c2848
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c1620
-rw-r--r--drivers/pci/hotplug/shpchp_pci.c810
-rw-r--r--drivers/pci/hotplug/shpchp_sysfs.c143
-rw-r--r--drivers/pci/hotplug/shpchprm.h55
-rw-r--r--drivers/pci/hotplug/shpchprm_acpi.c1713
-rw-r--r--drivers/pci/hotplug/shpchprm_legacy.c439
-rw-r--r--drivers/pci/hotplug/shpchprm_legacy.h113
-rw-r--r--drivers/pci/hotplug/shpchprm_nonacpi.c434
-rw-r--r--drivers/pci/hotplug/shpchprm_nonacpi.h56
-rw-r--r--drivers/pci/msi.c1151
-rw-r--r--drivers/pci/msi.h159
-rw-r--r--drivers/pci/names.c137
-rw-r--r--drivers/pci/pci-acpi.c209
-rw-r--r--drivers/pci/pci-driver.c531
-rw-r--r--drivers/pci/pci-sysfs.c490
-rw-r--r--drivers/pci/pci.c837
-rw-r--r--drivers/pci/pci.h96
-rw-r--r--drivers/pci/pci.ids10179
-rw-r--r--drivers/pci/pcie/Kconfig36
-rw-r--r--drivers/pci/pcie/Makefile7
-rw-r--r--drivers/pci/pcie/portdrv.h41
-rw-r--r--drivers/pci/pcie/portdrv_bus.c77
-rw-r--r--drivers/pci/pcie/portdrv_core.c434
-rw-r--r--drivers/pci/pcie/portdrv_pci.c122
-rw-r--r--drivers/pci/probe.c939
-rw-r--r--drivers/pci/proc.c619
-rw-r--r--drivers/pci/quirks.c1352
-rw-r--r--drivers/pci/remove.c118
-rw-r--r--drivers/pci/rom.c227
-rw-r--r--drivers/pci/search.c388
-rw-r--r--drivers/pci/setup-bus.c552
-rw-r--r--drivers/pci/setup-irq.c64
-rw-r--r--drivers/pci/setup-res.c200
-rw-r--r--drivers/pci/syscall.c145
91 files changed, 63799 insertions, 0 deletions
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
new file mode 100644
index 00000000000..7f31991772e
--- /dev/null
+++ b/drivers/pci/Kconfig
@@ -0,0 +1,59 @@
+#
+# PCI configuration
+#
+config PCI_MSI
+ bool "Message Signaled Interrupts (MSI and MSI-X)"
+ depends on PCI
+ depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64
+ help
+ This allows device drivers to enable MSI (Message Signaled
+ Interrupts). Message Signaled Interrupts enable a device to
+ generate an interrupt using an inbound Memory Write on its
+ PCI bus instead of asserting a device IRQ pin.
+
+ If you don't know what to do here, say N.
+
+config PCI_LEGACY_PROC
+ bool "Legacy /proc/pci interface"
+ depends on PCI
+ ---help---
+ This feature enables a procfs file -- /proc/pci -- that provides a
+ summary of PCI devices in the system.
+
+ This feature has been deprecated as of v2.5.53, in favor of using the
+ tool lspci(8). This feature may be removed at a future date.
+
+ lspci can provide the same data, as well as much more. lspci is a part of
+ the pci-utils package, which should be installed by your distribution.
+ See <file:Documentation/Changes> for information on where to get the latest
+ version.
+
+ When in doubt, say N.
+
+config PCI_NAMES
+ bool "PCI device name database"
+ depends on PCI
+ ---help---
+ By default, the kernel contains a database of all known PCI device
+ names to make the information in /proc/pci, /proc/ioports and
+ similar files comprehensible to the user.
+
+ This database increases size of the kernel image by about 80KB. This
+ memory is freed after the system boots up if CONFIG_HOTPLUG is not set.
+
+ Anyway, if you are building an installation floppy or kernel for an
+ embedded system where kernel image size really matters, you can disable
+ this feature and you'll get device ID numbers instead of names.
+
+ When in doubt, say Y.
+
+config PCI_DEBUG
+ bool "PCI Debugging"
+ depends on PCI && DEBUG_KERNEL
+ help
+ Say Y here if you want the PCI core to produce a bunch of debug
+ messages to the system log. Select this if you are having a
+ problem with PCI support and want to see more of what is going on.
+
+ When in doubt, say N.
+
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
new file mode 100644
index 00000000000..7dea494c0d7
--- /dev/null
+++ b/drivers/pci/Makefile
@@ -0,0 +1,65 @@
+#
+# Makefile for the PCI bus specific drivers.
+#
+
+obj-y += access.o bus.o probe.o remove.o pci.o quirks.o \
+ names.o pci-driver.o search.o pci-sysfs.o \
+ rom.o
+obj-$(CONFIG_PROC_FS) += proc.o
+
+ifndef CONFIG_SPARC64
+obj-y += setup-res.o
+endif
+
+obj-$(CONFIG_HOTPLUG) += hotplug.o
+
+# Build the PCI Hotplug drivers if we were asked to
+obj-$(CONFIG_HOTPLUG_PCI) += hotplug/
+
+#
+# Some architectures use the generic PCI setup functions
+#
+obj-$(CONFIG_ALPHA) += setup-bus.o setup-irq.o
+obj-$(CONFIG_ARM) += setup-bus.o setup-irq.o
+obj-$(CONFIG_PARISC) += setup-bus.o
+obj-$(CONFIG_SUPERH) += setup-bus.o setup-irq.o
+obj-$(CONFIG_PPC32) += setup-irq.o
+obj-$(CONFIG_PPC64) += setup-bus.o
+obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o
+obj-$(CONFIG_X86_VISWS) += setup-irq.o
+obj-$(CONFIG_PCI_MSI) += msi.o
+
+#
+# ACPI Related PCI FW Functions
+#
+obj-$(CONFIG_ACPI) += pci-acpi.o
+
+# Cardbus & CompactPCI use setup-bus
+obj-$(CONFIG_HOTPLUG) += setup-bus.o
+
+ifndef CONFIG_X86
+obj-y += syscall.o
+endif
+
+ifeq ($(CONFIG_PCI_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
+
+hostprogs-y := gen-devlist
+
+# Dependencies on generated files need to be listed explicitly
+$(obj)/names.o: $(obj)/devlist.h $(obj)/classlist.h
+$(obj)/classlist.h: $(obj)/devlist.h
+
+# And that's how to generate them
+quiet_cmd_devlist = DEVLIST $@
+ cmd_devlist = ( cd $(obj); ./gen-devlist ) < $<
+$(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist
+ $(call cmd,devlist)
+
+# Files generated that shall be removed upon make clean
+clean-files := devlist.h classlist.h
+
+# Build PCI Express stuff if needed
+obj-$(CONFIG_PCIEPORTBUS) += pcie/
+
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
new file mode 100644
index 00000000000..24a76de49f4
--- /dev/null
+++ b/drivers/pci/access.c
@@ -0,0 +1,62 @@
+#include <linux/pci.h>
+#include <linux/module.h>
+#include <linux/ioport.h>
+
+/*
+ * This interrupt-safe spinlock protects all accesses to PCI
+ * configuration space.
+ */
+
+static DEFINE_SPINLOCK(pci_lock);
+
+/*
+ * Wrappers for all PCI configuration access functions. They just check
+ * alignment, do locking and call the low-level functions pointed to
+ * by pci_dev->ops.
+ */
+
+#define PCI_byte_BAD 0
+#define PCI_word_BAD (pos & 1)
+#define PCI_dword_BAD (pos & 3)
+
+#define PCI_OP_READ(size,type,len) \
+int pci_bus_read_config_##size \
+ (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \
+{ \
+ int res; \
+ unsigned long flags; \
+ u32 data = 0; \
+ if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
+ spin_lock_irqsave(&pci_lock, flags); \
+ res = bus->ops->read(bus, devfn, pos, len, &data); \
+ *value = (type)data; \
+ spin_unlock_irqrestore(&pci_lock, flags); \
+ return res; \
+}
+
+#define PCI_OP_WRITE(size,type,len) \
+int pci_bus_write_config_##size \
+ (struct pci_bus *bus, unsigned int devfn, int pos, type value) \
+{ \
+ int res; \
+ unsigned long flags; \
+ if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
+ spin_lock_irqsave(&pci_lock, flags); \
+ res = bus->ops->write(bus, devfn, pos, len, value); \
+ spin_unlock_irqrestore(&pci_lock, flags); \
+ return res; \
+}
+
+PCI_OP_READ(byte, u8, 1)
+PCI_OP_READ(word, u16, 2)
+PCI_OP_READ(dword, u32, 4)
+PCI_OP_WRITE(byte, u8, 1)
+PCI_OP_WRITE(word, u16, 2)
+PCI_OP_WRITE(dword, u32, 4)
+
+EXPORT_SYMBOL(pci_bus_read_config_byte);
+EXPORT_SYMBOL(pci_bus_read_config_word);
+EXPORT_SYMBOL(pci_bus_read_config_dword);
+EXPORT_SYMBOL(pci_bus_write_config_byte);
+EXPORT_SYMBOL(pci_bus_write_config_word);
+EXPORT_SYMBOL(pci_bus_write_config_dword);
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
new file mode 100644
index 00000000000..dbd33605cc1
--- /dev/null
+++ b/drivers/pci/bus.c
@@ -0,0 +1,151 @@
+/*
+ * drivers/pci/bus.c
+ *
+ * From setup-res.c, by:
+ * Dave Rusling (david.rusling@reo.mts.dec.com)
+ * David Mosberger (davidm@cs.arizona.edu)
+ * David Miller (davem@redhat.com)
+ * Ivan Kokshaysky (ink@jurassic.park.msu.ru)
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/errno.h>
+#include <linux/ioport.h>
+#include <linux/proc_fs.h>
+#include <linux/init.h>
+
+#include "pci.h"
+
+/**
+ * pci_bus_alloc_resource - allocate a resource from a parent bus
+ * @bus: PCI bus
+ * @res: resource to allocate
+ * @size: size of resource to allocate
+ * @align: alignment of resource to allocate
+ * @min: minimum /proc/iomem address to allocate
+ * @type_mask: IORESOURCE_* type flags
+ * @alignf: resource alignment function
+ * @alignf_data: data argument for resource alignment function
+ *
+ * Given the PCI bus a device resides on, the size, minimum address,
+ * alignment and type, try to find an acceptable resource allocation
+ * for a specific device resource.
+ */
+int
+pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
+ unsigned long size, unsigned long align, unsigned long min,
+ unsigned int type_mask,
+ void (*alignf)(void *, struct resource *,
+ unsigned long, unsigned long),
+ void *alignf_data)
+{
+ int i, ret = -ENOMEM;
+
+ type_mask |= IORESOURCE_IO | IORESOURCE_MEM;
+
+ for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
+ struct resource *r = bus->resource[i];
+ if (!r)
+ continue;
+
+ /* type_mask must match */
+ if ((res->flags ^ r->flags) & type_mask)
+ continue;
+
+ /* We cannot allocate a non-prefetching resource
+ from a pre-fetching area */
+ if ((r->flags & IORESOURCE_PREFETCH) &&
+ !(res->flags & IORESOURCE_PREFETCH))
+ continue;
+
+ /* Ok, try it out.. */
+ ret = allocate_resource(r, res, size, min, -1, align,
+ alignf, alignf_data);
+ if (ret == 0)
+ break;
+ }
+ return ret;
+}
+
+/**
+ * add a single device
+ * @dev: device to add
+ *
+ * This adds a single pci device to the global
+ * device list and adds sysfs and procfs entries
+ */
+void __devinit pci_bus_add_device(struct pci_dev *dev)
+{
+ device_add(&dev->dev);
+
+ spin_lock(&pci_bus_lock);
+ list_add_tail(&dev->global_list, &pci_devices);
+ spin_unlock(&pci_bus_lock);
+
+ pci_proc_attach_device(dev);
+ pci_create_sysfs_dev_files(dev);
+}
+
+/**
+ * pci_bus_add_devices - insert newly discovered PCI devices
+ * @bus: bus to check for new devices
+ *
+ * Add newly discovered PCI devices (which are on the bus->devices
+ * list) to the global PCI device list, add the sysfs and procfs
+ * entries. Where a bridge is found, add the discovered bus to
+ * the parents list of child buses, and recurse (breadth-first
+ * to be compatible with 2.4)
+ *
+ * Call hotplug for each new devices.
+ */
+void __devinit pci_bus_add_devices(struct pci_bus *bus)
+{
+ struct pci_dev *dev;
+
+ list_for_each_entry(dev, &bus->devices, bus_list) {
+ /*
+ * Skip already-present devices (which are on the
+ * global device list.)
+ */
+ if (!list_empty(&dev->global_list))
+ continue;
+ pci_bus_add_device(dev);
+ }
+
+ list_for_each_entry(dev, &bus->devices, bus_list) {
+
+ BUG_ON(list_empty(&dev->global_list));
+
+ /*
+ * If there is an unattached subordinate bus, attach
+ * it and then scan for unattached PCI devices.
+ */
+ if (dev->subordinate && list_empty(&dev->subordinate->node)) {
+ spin_lock(&pci_bus_lock);
+ list_add_tail(&dev->subordinate->node, &dev->bus->children);
+ spin_unlock(&pci_bus_lock);
+ pci_bus_add_devices(dev->subordinate);
+
+ sysfs_create_link(&dev->subordinate->class_dev.kobj, &dev->dev.kobj, "bridge");
+ }
+ }
+}
+
+void pci_enable_bridges(struct pci_bus *bus)
+{
+ struct pci_dev *dev;
+
+ list_for_each_entry(dev, &bus->devices, bus_list) {
+ if (dev->subordinate) {
+ pci_enable_device(dev);
+ pci_set_master(dev);
+ pci_enable_bridges(dev->subordinate);
+ }
+ }
+}
+
+EXPORT_SYMBOL(pci_bus_alloc_resource);
+EXPORT_SYMBOL_GPL(pci_bus_add_device);
+EXPORT_SYMBOL(pci_bus_add_devices);
+EXPORT_SYMBOL(pci_enable_bridges);
diff --git a/drivers/pci/gen-devlist.c b/drivers/pci/gen-devlist.c
new file mode 100644
index 00000000000..8abfc499fde
--- /dev/null
+++ b/drivers/pci/gen-devlist.c
@@ -0,0 +1,132 @@
+/*
+ * Generate devlist.h and classlist.h from the PCI ID file.
+ *
+ * (c) 1999--2002 Martin Mares <mj@ucw.cz>
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#define MAX_NAME_SIZE 200
+
+static void
+pq(FILE *f, const char *c, int len)
+{
+ int i = 1;
+ while (*c && i != len) {
+ if (*c == '"')
+ fprintf(f, "\\\"");
+ else {
+ fputc(*c, f);
+ if (*c == '?' && c[1] == '?') {
+ /* Avoid trigraphs */
+ fprintf(f, "\" \"");
+ }
+ }
+ c++;
+ i++;
+ }
+}
+
+