X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=Documentation%2Fpci.txt;h=a1a2bd557f1b670c793c7b405c1cbd4bd700ab8f;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=41194763862ba8e4ae436df20fc850e9b13ce45a;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/Documentation/pci.txt b/Documentation/pci.txt index 411947638..a1a2bd557 100644 --- a/Documentation/pci.txt +++ b/Documentation/pci.txt @@ -25,6 +25,7 @@ on (either the old or the new way), it needs to perform the following steps: Discover resources (addresses and IRQ numbers) provided by the device Allocate these resources Communicate with the device + Disable the device Most of these topics are covered by the following sections, for the rest look at , it's hopefully well commented. @@ -162,8 +163,8 @@ You must eventually (possibly at module unload) decrement the reference count on these devices by calling pci_dev_put(). -3. Enabling devices -~~~~~~~~~~~~~~~~~~~ +3. Enabling and disabling devices +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Before you do anything with the device you've found, you need to enable it by calling pci_enable_device() which enables I/O and memory regions of the device, allocates an IRQ if necessary, assigns missing resources if @@ -180,6 +181,12 @@ and also ensures that the cache line size register is set correctly. Make sure to check the return value of pci_set_mwi(), not all architectures may support Memory-Write-Invalidate. + If your driver decides to stop using the device (e.g., there was an +error while setting it up or the driver module is being unloaded), it +should call pci_disable_device() to deallocate any IRQ resources, disable +PCI bus-mastering, etc. You should not do anything with the device after +calling pci_disable_device(). + 4. How to access PCI config space ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can use pci_(read|write)_config_(byte|word|dword) to access the config