|
@@ -103,11 +103,11 @@ static void msix_set_enable(struct pci_dev *dev, int enable)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static void msix_flush_writes(unsigned int irq)
|
|
|
|
|
|
+static void msix_flush_writes(struct irq_desc *desc)
|
|
{
|
|
{
|
|
struct msi_desc *entry;
|
|
struct msi_desc *entry;
|
|
|
|
|
|
- entry = get_irq_msi(irq);
|
|
|
|
|
|
+ entry = get_irq_desc_msi(desc);
|
|
BUG_ON(!entry || !entry->dev);
|
|
BUG_ON(!entry || !entry->dev);
|
|
switch (entry->msi_attrib.type) {
|
|
switch (entry->msi_attrib.type) {
|
|
case PCI_CAP_ID_MSI:
|
|
case PCI_CAP_ID_MSI:
|
|
@@ -135,11 +135,11 @@ static void msix_flush_writes(unsigned int irq)
|
|
* Returns 1 if it succeeded in masking the interrupt and 0 if the device
|
|
* Returns 1 if it succeeded in masking the interrupt and 0 if the device
|
|
* doesn't support MSI masking.
|
|
* doesn't support MSI masking.
|
|
*/
|
|
*/
|
|
-static int msi_set_mask_bits(unsigned int irq, u32 mask, u32 flag)
|
|
|
|
|
|
+static int msi_set_mask_bits(struct irq_desc *desc, u32 mask, u32 flag)
|
|
{
|
|
{
|
|
struct msi_desc *entry;
|
|
struct msi_desc *entry;
|
|
|
|
|
|
- entry = get_irq_msi(irq);
|
|
|
|
|
|
+ entry = get_irq_desc_msi(desc);
|
|
BUG_ON(!entry || !entry->dev);
|
|
BUG_ON(!entry || !entry->dev);
|
|
switch (entry->msi_attrib.type) {
|
|
switch (entry->msi_attrib.type) {
|
|
case PCI_CAP_ID_MSI:
|
|
case PCI_CAP_ID_MSI:
|
|
@@ -172,9 +172,9 @@ static int msi_set_mask_bits(unsigned int irq, u32 mask, u32 flag)
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
-void read_msi_msg(unsigned int irq, struct msi_msg *msg)
|
|
|
|
|
|
+void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg)
|
|
{
|
|
{
|
|
- struct msi_desc *entry = get_irq_msi(irq);
|
|
|
|
|
|
+ struct msi_desc *entry = get_irq_desc_msi(desc);
|
|
switch(entry->msi_attrib.type) {
|
|
switch(entry->msi_attrib.type) {
|
|
case PCI_CAP_ID_MSI:
|
|
case PCI_CAP_ID_MSI:
|
|
{
|
|
{
|
|
@@ -211,9 +211,16 @@ void read_msi_msg(unsigned int irq, struct msi_msg *msg)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void write_msi_msg(unsigned int irq, struct msi_msg *msg)
|
|
|
|
|
|
+void read_msi_msg(unsigned int irq, struct msi_msg *msg)
|
|
{
|
|
{
|
|
- struct msi_desc *entry = get_irq_msi(irq);
|
|
|
|
|
|
+ struct irq_desc *desc = irq_to_desc(irq);
|
|
|
|
+
|
|
|
|
+ read_msi_msg_desc(desc, msg);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg)
|
|
|
|
+{
|
|
|
|
+ struct msi_desc *entry = get_irq_desc_msi(desc);
|
|
switch (entry->msi_attrib.type) {
|
|
switch (entry->msi_attrib.type) {
|
|
case PCI_CAP_ID_MSI:
|
|
case PCI_CAP_ID_MSI:
|
|
{
|
|
{
|
|
@@ -252,21 +259,31 @@ void write_msi_msg(unsigned int irq, struct msi_msg *msg)
|
|
entry->msg = *msg;
|
|
entry->msg = *msg;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void write_msi_msg(unsigned int irq, struct msi_msg *msg)
|
|
|
|
+{
|
|
|
|
+ struct irq_desc *desc = irq_to_desc(irq);
|
|
|
|
+
|
|
|
|
+ write_msi_msg_desc(desc, msg);
|
|
|
|
+}
|
|
|
|
+
|
|
void mask_msi_irq(unsigned int irq)
|
|
void mask_msi_irq(unsigned int irq)
|
|
{
|
|
{
|
|
- msi_set_mask_bits(irq, 1, 1);
|
|
|
|
- msix_flush_writes(irq);
|
|
|
|
|
|
+ struct irq_desc *desc = irq_to_desc(irq);
|
|
|
|
+
|
|
|
|
+ msi_set_mask_bits(desc, 1, 1);
|
|
|
|
+ msix_flush_writes(desc);
|
|
}
|
|
}
|
|
|
|
|
|
void unmask_msi_irq(unsigned int irq)
|
|
void unmask_msi_irq(unsigned int irq)
|
|
{
|
|
{
|
|
- msi_set_mask_bits(irq, 1, 0);
|
|
|
|
- msix_flush_writes(irq);
|
|
|
|
|
|
+ struct irq_desc *desc = irq_to_desc(irq);
|
|
|
|
+
|
|
|
|
+ msi_set_mask_bits(desc, 1, 0);
|
|
|
|
+ msix_flush_writes(desc);
|
|
}
|
|
}
|
|
|
|
|
|
static int msi_free_irqs(struct pci_dev* dev);
|
|
static int msi_free_irqs(struct pci_dev* dev);
|
|
|
|
|
|
-
|
|
|
|
static struct msi_desc* alloc_msi_entry(void)
|
|
static struct msi_desc* alloc_msi_entry(void)
|
|
{
|
|
{
|
|
struct msi_desc *entry;
|
|
struct msi_desc *entry;
|
|
@@ -303,9 +320,11 @@ static void __pci_restore_msi_state(struct pci_dev *dev)
|
|
pci_intx_for_msi(dev, 0);
|
|
pci_intx_for_msi(dev, 0);
|
|
msi_set_enable(dev, 0);
|
|
msi_set_enable(dev, 0);
|
|
write_msi_msg(dev->irq, &entry->msg);
|
|
write_msi_msg(dev->irq, &entry->msg);
|
|
- if (entry->msi_attrib.maskbit)
|
|
|
|
- msi_set_mask_bits(dev->irq, entry->msi_attrib.maskbits_mask,
|
|
|
|
|
|
+ if (entry->msi_attrib.maskbit) {
|
|
|
|
+ struct irq_desc *desc = irq_to_desc(dev->irq);
|
|
|
|
+ msi_set_mask_bits(desc, entry->msi_attrib.maskbits_mask,
|
|
entry->msi_attrib.masked);
|
|
entry->msi_attrib.masked);
|
|
|
|
+ }
|
|
|
|
|
|
pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control);
|
|
pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control);
|
|
control &= ~PCI_MSI_FLAGS_QSIZE;
|
|
control &= ~PCI_MSI_FLAGS_QSIZE;
|
|
@@ -327,8 +346,9 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
|
|
msix_set_enable(dev, 0);
|
|
msix_set_enable(dev, 0);
|
|
|
|
|
|
list_for_each_entry(entry, &dev->msi_list, list) {
|
|
list_for_each_entry(entry, &dev->msi_list, list) {
|
|
|
|
+ struct irq_desc *desc = irq_to_desc(entry->irq);
|
|
write_msi_msg(entry->irq, &entry->msg);
|
|
write_msi_msg(entry->irq, &entry->msg);
|
|
- msi_set_mask_bits(entry->irq, 1, entry->msi_attrib.masked);
|
|
|
|
|
|
+ msi_set_mask_bits(desc, 1, entry->msi_attrib.masked);
|
|
}
|
|
}
|
|
|
|
|
|
BUG_ON(list_empty(&dev->msi_list));
|
|
BUG_ON(list_empty(&dev->msi_list));
|
|
@@ -596,7 +616,8 @@ void pci_msi_shutdown(struct pci_dev* dev)
|
|
/* Return the the pci reset with msi irqs unmasked */
|
|
/* Return the the pci reset with msi irqs unmasked */
|
|
if (entry->msi_attrib.maskbit) {
|
|
if (entry->msi_attrib.maskbit) {
|
|
u32 mask = entry->msi_attrib.maskbits_mask;
|
|
u32 mask = entry->msi_attrib.maskbits_mask;
|
|
- msi_set_mask_bits(dev->irq, mask, ~mask);
|
|
|
|
|
|
+ struct irq_desc *desc = irq_to_desc(dev->irq);
|
|
|
|
+ msi_set_mask_bits(desc, mask, ~mask);
|
|
}
|
|
}
|
|
if (!entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI)
|
|
if (!entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI)
|
|
return;
|
|
return;
|