diff options
author | Matthew Wilcox <willy@linux.intel.com> | 2009-03-17 08:54:10 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-03-20 13:48:14 -0400 |
commit | 1c8d7b0a562da06d3ebe83f01b1ed553205d1ae4 (patch) | |
tree | 79c84432f5aed5a08b3bef262a10d933daae6a9b /Documentation/PCI/MSI-HOWTO.txt | |
parent | f2440d9acbe866b917b16cc0f927366341ce9215 (diff) |
PCI MSI: Add support for multiple MSI
Add the new API pci_enable_msi_block() to allow drivers to
request multiple MSI and reimplement pci_enable_msi in terms of
pci_enable_msi_block. Ensure that the architecture back ends don't
have to know about multiple MSI.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'Documentation/PCI/MSI-HOWTO.txt')
-rw-r--r-- | Documentation/PCI/MSI-HOWTO.txt | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/Documentation/PCI/MSI-HOWTO.txt b/Documentation/PCI/MSI-HOWTO.txt index 1c02431f1d1a..9494f6dc38eb 100644 --- a/Documentation/PCI/MSI-HOWTO.txt +++ b/Documentation/PCI/MSI-HOWTO.txt | |||
@@ -94,15 +94,48 @@ This function should be called before the driver calls request_irq() | |||
94 | since enabling MSIs disables the pin-based IRQ and the driver will not | 94 | since enabling MSIs disables the pin-based IRQ and the driver will not |
95 | receive interrupts on the old interrupt. | 95 | receive interrupts on the old interrupt. |
96 | 96 | ||
97 | 4.2.2 pci_disable_msi | 97 | 4.2.2 pci_enable_msi_block |
98 | |||
99 | int pci_enable_msi_block(struct pci_dev *dev, int count) | ||
100 | |||
101 | This variation on the above call allows a device driver to request multiple | ||
102 | MSIs. The MSI specification only allows interrupts to be allocated in | ||
103 | powers of two, up to a maximum of 2^5 (32). | ||
104 | |||
105 | If this function returns 0, it has succeeded in allocating at least as many | ||
106 | interrupts as the driver requested (it may have allocated more in order | ||
107 | to satisfy the power-of-two requirement). In this case, the function | ||
108 | enables MSI on this device and updates dev->irq to be the lowest of | ||
109 | the new interrupts assigned to it. The other interrupts assigned to | ||
110 | the device are in the range dev->irq to dev->irq + count - 1. | ||
111 | |||
112 | If this function returns a negative number, it indicates an error and | ||
113 | the driver should not attempt to request any more MSI interrupts for | ||
114 | this device. If this function returns a positive number, it will be | ||
115 | less than 'count' and indicate the number of interrupts that could have | ||
116 | been allocated. In neither case will the irq value have been | ||
117 | updated, nor will the device have been switched into MSI mode. | ||
118 | |||
119 | The device driver must decide what action to take if | ||
120 | pci_enable_msi_block() returns a value less than the number asked for. | ||
121 | Some devices can make use of fewer interrupts than the maximum they | ||
122 | request; in this case the driver should call pci_enable_msi_block() | ||
123 | again. Note that it is not guaranteed to succeed, even when the | ||
124 | 'count' has been reduced to the value returned from a previous call to | ||
125 | pci_enable_msi_block(). This is because there are multiple constraints | ||
126 | on the number of vectors that can be allocated; pci_enable_msi_block() | ||
127 | will return as soon as it finds any constraint that doesn't allow the | ||
128 | call to succeed. | ||
129 | |||
130 | 4.2.3 pci_disable_msi | ||
98 | 131 | ||
99 | void pci_disable_msi(struct pci_dev *dev) | 132 | void pci_disable_msi(struct pci_dev *dev) |
100 | 133 | ||
101 | This function should be used to undo the effect of pci_enable_msi(). | 134 | This function should be used to undo the effect of pci_enable_msi() or |
102 | Calling it restores dev->irq to the pin-based interrupt number and frees | 135 | pci_enable_msi_block(). Calling it restores dev->irq to the pin-based |
103 | the previously allocated message signaled interrupt(s). The interrupt | 136 | interrupt number and frees the previously allocated message signaled |
104 | may subsequently be assigned to another device, so drivers should not | 137 | interrupt(s). The interrupt may subsequently be assigned to another |
105 | cache the value of dev->irq. | 138 | device, so drivers should not cache the value of dev->irq. |
106 | 139 | ||
107 | A device driver must always call free_irq() on the interrupt(s) | 140 | A device driver must always call free_irq() on the interrupt(s) |
108 | for which it has called request_irq() before calling this function. | 141 | for which it has called request_irq() before calling this function. |