Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139313
b: refs/heads/master
c: 90e9cd5
h: refs/heads/master
i:
  139311: 64e25de
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Jesse Barnes committed Mar 20, 2009
1 parent ae77a85 commit dfb3e70
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 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: 1bf83e558cb29d163f4bc6decbc3800ecf4db195
refs/heads/master: 90e9cd50f7feeddc911325c8a8c1b7e1fccc6599
41 changes: 28 additions & 13 deletions trunk/drivers/pci/pcie/portdrv_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ static int assign_interrupt_mode(struct pci_dev *dev, int *vectors, int mask)
{
struct pcie_port_data *port_data = pci_get_drvdata(dev);
int i, pos, nvec, status = -EINVAL;
int interrupt_mode = PCIE_PORT_INTx_MODE;
int interrupt_mode = PCIE_PORT_NO_IRQ;

/* Set INTx as default */
for (i = 0, nvec = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) {
if (mask & (1 << i))
nvec++;
vectors[i] = dev->irq;
}

if (dev->pin)
interrupt_mode = PCIE_PORT_INTx_MODE;

/* Check MSI quirk */
if (port_data->port_type == PCIE_RC_PORT && pcie_mch_quirk)
return interrupt_mode;
Expand Down Expand Up @@ -141,7 +143,7 @@ static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev,
dev->id.vendor = parent->vendor;
dev->id.device = parent->device;
dev->id.port_type = port_type;
dev->id.service_type = (1 << service_type);
dev->id.service_type = service_type;

/* Initialize generic device interface */
device = &dev->device;
Expand Down Expand Up @@ -232,19 +234,32 @@ int pcie_port_device_register(struct pci_dev *dev)
/* Allocate child services if any */
for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) {
struct pcie_device *child;
int service = 1 << i;

if (capabilities & (1 << i)) {
child = alloc_pcie_device(dev, i, vectors[i]);
if (child) {
status = device_register(&child->device);
if (status) {
kfree(child);
continue;
}
get_device(&child->device);
}
if (!(capabilities & service))
continue;

/*
* Don't use service devices that require interrupts if there is
* no way to generate them.
*/
if (irq_mode == PCIE_PORT_NO_IRQ
&& service != PCIE_PORT_SERVICE_VC)
continue;

child = alloc_pcie_device(dev, service, vectors[i]);
if (!child)
continue;

status = device_register(&child->device);
if (status) {
kfree(child);
continue;
}

get_device(&child->device);
}

return 0;
}

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/pcieport_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define PCIE_PORT_SERVICE_VC 8 /* Virtual Channel */

/* Root/Upstream/Downstream Port's Interrupt Mode */
#define PCIE_PORT_NO_IRQ (-1)
#define PCIE_PORT_INTx_MODE 0
#define PCIE_PORT_MSI_MODE 1
#define PCIE_PORT_MSIX_MODE 2
Expand Down

0 comments on commit dfb3e70

Please sign in to comment.