Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139319
b: refs/heads/master
c: a52e2e3
h: refs/heads/master
i:
  139317: baa96cc
  139315: 3667d86
  139311: 64e25de
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Jesse Barnes committed Mar 20, 2009
1 parent 4f4a788 commit ff11fe1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a447b772826fde2a3abfd9bb943dee8750994c55
refs/heads/master: a52e2e3513d4beafe8fe8699f1519b021c2d05ba
24 changes: 19 additions & 5 deletions trunk/drivers/pci/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,23 @@ static int msi_free_irqs(struct pci_dev* dev)
return 0;
}

/**
* pci_msix_table_size - return the number of device's MSI-X table entries
* @dev: pointer to the pci_dev data structure of MSI-X device function
*/
int pci_msix_table_size(struct pci_dev *dev)
{
int pos;
u16 control;

pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
if (!pos)
return 0;

pci_read_config_word(dev, msi_control_reg(pos), &control);
return multi_msix_capable(control);
}

/**
* pci_enable_msix - configure device's MSI-X capability structure
* @dev: pointer to the pci_dev data structure of MSI-X device function
Expand All @@ -691,9 +708,8 @@ static int msi_free_irqs(struct pci_dev* dev)
**/
int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
{
int status, pos, nr_entries;
int status, nr_entries;
int i, j;
u16 control;

if (!entries)
return -EINVAL;
Expand All @@ -702,9 +718,7 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
if (status)
return status;

pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
pci_read_config_word(dev, msi_control_reg(pos), &control);
nr_entries = multi_msix_capable(control);
nr_entries = pci_msix_table_size(dev);
if (nvec > nr_entries)
return -EINVAL;

Expand Down
5 changes: 5 additions & 0 deletions trunk/include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,10 @@ static inline void pci_msi_shutdown(struct pci_dev *dev)
static inline void pci_disable_msi(struct pci_dev *dev)
{ }

static inline int pci_msix_table_size(struct pci_dev *dev)
{
return 0;
}
static inline int pci_enable_msix(struct pci_dev *dev,
struct msix_entry *entries, int nvec)
{
Expand All @@ -823,6 +827,7 @@ static inline int pci_msi_enabled(void)
extern int pci_enable_msi(struct pci_dev *dev);
extern void pci_msi_shutdown(struct pci_dev *dev);
extern void pci_disable_msi(struct pci_dev *dev);
extern int pci_msix_table_size(struct pci_dev *dev);
extern int pci_enable_msix(struct pci_dev *dev,
struct msix_entry *entries, int nvec);
extern void pci_msix_shutdown(struct pci_dev *dev);
Expand Down

0 comments on commit ff11fe1

Please sign in to comment.