summaryrefslogtreecommitdiffstats
path: root/Documentation/pci.txt
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-05-07 02:55:41 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-05-07 02:55:41 +0000
commitdcec8a13bf565e47942a1751a9cec21bec5648fe (patch)
tree548b69625b18cc2e88c3e68d0923be546c9ebb03 /Documentation/pci.txt
parent2e0f55e79c49509b7ff70ff1a10e1e9e90a3dfd4 (diff)
o Merge with Linux 2.1.99.
o Fix ancient bug in the ELF loader making ldd crash. o Fix ancient bug in the keyboard code for SGI, SNI and Jazz.
Diffstat (limited to 'Documentation/pci.txt')
-rw-r--r--Documentation/pci.txt65
1 files changed, 65 insertions, 0 deletions
diff --git a/Documentation/pci.txt b/Documentation/pci.txt
new file mode 100644
index 000000000..d40bfaf38
--- /dev/null
+++ b/Documentation/pci.txt
@@ -0,0 +1,65 @@
+ Few Notes About The PCI Subsystem
+
+ or
+
+ "What should you avoid when writing PCI drivers"
+
+ by Martin Mares <mj@atrey.karlin.mff.cuni.cz> on 13-Feb-1998
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+1. How to find PCI devices
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+ In case your driver wants to search for all devices with given vendor/device
+ID, it should use:
+
+ struct pci_dev *dev = NULL;
+ while (dev = pci_find_device(VENDOR_ID, DEVICE_ID, dev))
+ configure_device(dev);
+
+ For class-based search, use pci_find_class(CLASS_ID, dev).
+
+ In case you want to do some complex matching, look at pci_devices -- it's
+a linked list of pci_dev structures for all PCI devices in the system.
+
+ All these methods return a pointer to a pci_dev structure which is used as a
+parameter for many other PCI functions. The rest of them accept bus and
+device/function numbers which can be found in pci_dev->bus->number and
+pci_dev->devfn. Feel free to use all other fields of the pci_dev structure, but
+don't modify them.
+
+ The pci_present() function can be used to test presence of PCI in the
+machine.
+
+2. How to access PCI config space
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ You can use pci_(read|write)_config_(byte|word|dword) to access the config
+space of a device represented by pci_dev. All these functions return 0 when
+successful or an error code (PCIBIOS_...) which can be translated to a text
+string by pcibios_strerror. Most drivers expect that accesses to valid PCI
+devices don't fail.
+
+ In case you want to address the devices by bus/device/function numbers,
+use pcibios_(read_write)_config_(byte|word|dword).
+
+ If you access fields in the standard portion of the config header, please
+use symbolic names of locations and bits declared in <linux/pci.h>.
+
+3. Addresses and interrupts
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ Memory and port addresses and interrupt numbers should NOT be read from the
+config space. You should use the values in the pci_dev structure as they might
+have been remapped by the kernel.
+
+4. Obsolete functions
+~~~~~~~~~~~~~~~~~~~~~
+<linux/bios32.h> is obsolete and should not be included in new code.
+
+pcibios_find_(device|class) are also obsolete and should be replaced by
+pci_find_(device|class).
+
+5. Bus mastering
+~~~~~~~~~~~~~~~~
+ If you need to setup a bus-mastering card, just call pci_set_master(). It
+should set PCI_COMMAND_MASTER in the command register and adjust the latency
+timer if needed.