diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2013-04-24 13:37:49 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-04-24 13:37:49 -0400 |
commit | d4f09c5d7fbabd1389a5f03f5c9329d790f544e3 (patch) | |
tree | e7c5a84a9b20364fd21ae7f5ce6c4412440c0937 | |
parent | 42c34707f9d24ef159cce87e4353babcf2b417a6 (diff) | |
parent | a9047f24df85b06d3fd443ff76e9993bc127c570 (diff) |
Merge branch 'pci/gavin-msi-cleanup' into next
* pci/gavin-msi-cleanup:
vfio-pci: Use cached MSI/MSI-X capabilities
vfio-pci: Use PCI_MSIX_TABLE_BIR, not PCI_MSIX_FLAGS_BIRMASK
PCI: Remove "extern" from function declarations
PCI: Use PCI_MSIX_TABLE_BIR, not PCI_MSIX_FLAGS_BIRMASK
PCI: Drop msi_mask_reg() and remove drivers/pci/msi.h
PCI: Use msix_table_size() directly, drop multi_msix_capable()
PCI: Drop msix_table_offset_reg() and msix_pba_offset_reg() macros
PCI: Drop is_64bit_address() and is_mask_bit_support() macros
PCI: Drop msi_data_reg() macro
PCI: Drop msi_lower_address_reg() and msi_upper_address_reg() macros
PCI: Drop msi_control_reg() macro and use PCI_MSI_FLAGS directly
PCI: Use cached MSI/MSI-X offsets from dev, not from msi_desc
PCI: Clean up MSI/MSI-X capability #defines
PCI: Use cached MSI-X cap while enabling MSI-X
PCI: Use cached MSI cap while enabling MSI interrupts
PCI: Remove MSI/MSI-X cap check in pci_msi_check_device()
PCI: Cache MSI/MSI-X capability offsets in struct pci_dev
PCI: Use u8, not int, for PM capability offset
[SCSI] megaraid_sas: Use correct #define for MSI-X capability
-rw-r--r-- | drivers/pci/msi.c | 176 | ||||
-rw-r--r-- | drivers/pci/msi.h | 24 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.h | 3 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas_base.c | 4 | ||||
-rw-r--r-- | drivers/vfio/pci/vfio_pci.c | 10 | ||||
-rw-r--r-- | include/linux/msi.h | 23 | ||||
-rw-r--r-- | include/linux/pci.h | 5 | ||||
-rw-r--r-- | include/uapi/linux/pci_regs.h | 30 |
8 files changed, 118 insertions, 157 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index bbff7d5a9b35..d40bed726769 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -22,10 +22,12 @@ | |||
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | 23 | ||
24 | #include "pci.h" | 24 | #include "pci.h" |
25 | #include "msi.h" | ||
26 | 25 | ||
27 | static int pci_msi_enable = 1; | 26 | static int pci_msi_enable = 1; |
28 | 27 | ||
28 | #define msix_table_size(flags) ((flags & PCI_MSIX_FLAGS_QSIZE) + 1) | ||
29 | |||
30 | |||
29 | /* Arch hooks */ | 31 | /* Arch hooks */ |
30 | 32 | ||
31 | #ifndef arch_msi_check_device | 33 | #ifndef arch_msi_check_device |
@@ -111,32 +113,26 @@ void default_restore_msi_irqs(struct pci_dev *dev, int irq) | |||
111 | } | 113 | } |
112 | #endif | 114 | #endif |
113 | 115 | ||
114 | static void msi_set_enable(struct pci_dev *dev, int pos, int enable) | 116 | static void msi_set_enable(struct pci_dev *dev, int enable) |
115 | { | 117 | { |
116 | u16 control; | 118 | u16 control; |
117 | 119 | ||
118 | BUG_ON(!pos); | 120 | pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); |
119 | |||
120 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control); | ||
121 | control &= ~PCI_MSI_FLAGS_ENABLE; | 121 | control &= ~PCI_MSI_FLAGS_ENABLE; |
122 | if (enable) | 122 | if (enable) |
123 | control |= PCI_MSI_FLAGS_ENABLE; | 123 | control |= PCI_MSI_FLAGS_ENABLE; |
124 | pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); | 124 | pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control); |
125 | } | 125 | } |
126 | 126 | ||
127 | static void msix_set_enable(struct pci_dev *dev, int enable) | 127 | static void msix_set_enable(struct pci_dev *dev, int enable) |
128 | { | 128 | { |
129 | int pos; | ||
130 | u16 control; | 129 | u16 control; |
131 | 130 | ||
132 | pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); | 131 | pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control); |
133 | if (pos) { | 132 | control &= ~PCI_MSIX_FLAGS_ENABLE; |
134 | pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control); | 133 | if (enable) |
135 | control &= ~PCI_MSIX_FLAGS_ENABLE; | 134 | control |= PCI_MSIX_FLAGS_ENABLE; |
136 | if (enable) | 135 | pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, control); |
137 | control |= PCI_MSIX_FLAGS_ENABLE; | ||
138 | pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); | ||
139 | } | ||
140 | } | 136 | } |
141 | 137 | ||
142 | static inline __attribute_const__ u32 msi_mask(unsigned x) | 138 | static inline __attribute_const__ u32 msi_mask(unsigned x) |
@@ -247,18 +243,18 @@ void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg) | |||
247 | msg->data = readl(base + PCI_MSIX_ENTRY_DATA); | 243 | msg->data = readl(base + PCI_MSIX_ENTRY_DATA); |
248 | } else { | 244 | } else { |
249 | struct pci_dev *dev = entry->dev; | 245 | struct pci_dev *dev = entry->dev; |
250 | int pos = entry->msi_attrib.pos; | 246 | int pos = dev->msi_cap; |
251 | u16 data; | 247 | u16 data; |
252 | 248 | ||
253 | pci_read_config_dword(dev, msi_lower_address_reg(pos), | 249 | pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, |
254 | &msg->address_lo); | 250 | &msg->address_lo); |
255 | if (entry->msi_attrib.is_64) { | 251 | if (entry->msi_attrib.is_64) { |
256 | pci_read_config_dword(dev, msi_upper_address_reg(pos), | 252 | pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, |
257 | &msg->address_hi); | 253 | &msg->address_hi); |
258 | pci_read_config_word(dev, msi_data_reg(pos, 1), &data); | 254 | pci_read_config_word(dev, pos + PCI_MSI_DATA_64, &data); |
259 | } else { | 255 | } else { |
260 | msg->address_hi = 0; | 256 | msg->address_hi = 0; |
261 | pci_read_config_word(dev, msi_data_reg(pos, 0), &data); | 257 | pci_read_config_word(dev, pos + PCI_MSI_DATA_32, &data); |
262 | } | 258 | } |
263 | msg->data = data; | 259 | msg->data = data; |
264 | } | 260 | } |
@@ -302,24 +298,24 @@ void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) | |||
302 | writel(msg->data, base + PCI_MSIX_ENTRY_DATA); | 298 | writel(msg->data, base + PCI_MSIX_ENTRY_DATA); |
303 | } else { | 299 | } else { |
304 | struct pci_dev *dev = entry->dev; | 300 | struct pci_dev *dev = entry->dev; |
305 | int pos = entry->msi_attrib.pos; | 301 | int pos = dev->msi_cap; |
306 | u16 msgctl; | 302 | u16 msgctl; |
307 | 303 | ||
308 | pci_read_config_word(dev, msi_control_reg(pos), &msgctl); | 304 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl); |
309 | msgctl &= ~PCI_MSI_FLAGS_QSIZE; | 305 | msgctl &= ~PCI_MSI_FLAGS_QSIZE; |
310 | msgctl |= entry->msi_attrib.multiple << 4; | 306 | msgctl |= entry->msi_attrib.multiple << 4; |
311 | pci_write_config_word(dev, msi_control_reg(pos), msgctl); | 307 | pci_write_config_word(dev, pos + PCI_MSI_FLAGS, msgctl); |
312 | 308 | ||
313 | pci_write_config_dword(dev, msi_lower_address_reg(pos), | 309 | pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, |
314 | msg->address_lo); | 310 | msg->address_lo); |
315 | if (entry->msi_attrib.is_64) { | 311 | if (entry->msi_attrib.is_64) { |
316 | pci_write_config_dword(dev, msi_upper_address_reg(pos), | 312 | pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, |
317 | msg->address_hi); | 313 | msg->address_hi); |
318 | pci_write_config_word(dev, msi_data_reg(pos, 1), | 314 | pci_write_config_word(dev, pos + PCI_MSI_DATA_64, |
319 | msg->data); | 315 | msg->data); |
320 | } else { | 316 | } else { |
321 | pci_write_config_word(dev, msi_data_reg(pos, 0), | 317 | pci_write_config_word(dev, pos + PCI_MSI_DATA_32, |
322 | msg->data); | 318 | msg->data); |
323 | } | 319 | } |
324 | } | 320 | } |
325 | entry->msg = *msg; | 321 | entry->msg = *msg; |
@@ -391,7 +387,6 @@ static void pci_intx_for_msi(struct pci_dev *dev, int enable) | |||
391 | 387 | ||
392 | static void __pci_restore_msi_state(struct pci_dev *dev) | 388 | static void __pci_restore_msi_state(struct pci_dev *dev) |
393 | { | 389 | { |
394 | int pos; | ||
395 | u16 control; | 390 | u16 control; |
396 | struct msi_desc *entry; | 391 | struct msi_desc *entry; |
397 | 392 | ||
@@ -399,22 +394,20 @@ static void __pci_restore_msi_state(struct pci_dev *dev) | |||
399 | return; | 394 | return; |
400 | 395 | ||
401 | entry = irq_get_msi_desc(dev->irq); | 396 | entry = irq_get_msi_desc(dev->irq); |
402 | pos = entry->msi_attrib.pos; | ||
403 | 397 | ||
404 | pci_intx_for_msi(dev, 0); | 398 | pci_intx_for_msi(dev, 0); |
405 | msi_set_enable(dev, pos, 0); | 399 | msi_set_enable(dev, 0); |
406 | arch_restore_msi_irqs(dev, dev->irq); | 400 | arch_restore_msi_irqs(dev, dev->irq); |
407 | 401 | ||
408 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control); | 402 | pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); |
409 | msi_mask_irq(entry, msi_capable_mask(control), entry->masked); | 403 | msi_mask_irq(entry, msi_capable_mask(control), entry->masked); |
410 | control &= ~PCI_MSI_FLAGS_QSIZE; | 404 | control &= ~PCI_MSI_FLAGS_QSIZE; |
411 | control |= (entry->msi_attrib.multiple << 4) | PCI_MSI_FLAGS_ENABLE; | 405 | control |= (entry->msi_attrib.multiple << 4) | PCI_MSI_FLAGS_ENABLE; |
412 | pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); | 406 | pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control); |
413 | } | 407 | } |
414 | 408 | ||
415 | static void __pci_restore_msix_state(struct pci_dev *dev) | 409 | static void __pci_restore_msix_state(struct pci_dev *dev) |
416 | { | 410 | { |
417 | int pos; | ||
418 | struct msi_desc *entry; | 411 | struct msi_desc *entry; |
419 | u16 control; | 412 | u16 control; |
420 | 413 | ||
@@ -422,13 +415,12 @@ static void __pci_restore_msix_state(struct pci_dev *dev) | |||
422 | return; | 415 | return; |
423 | BUG_ON(list_empty(&dev->msi_list)); | 416 | BUG_ON(list_empty(&dev->msi_list)); |
424 | entry = list_first_entry(&dev->msi_list, struct msi_desc, list); | 417 | entry = list_first_entry(&dev->msi_list, struct msi_desc, list); |
425 | pos = entry->msi_attrib.pos; | 418 | pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control); |
426 | pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control); | ||
427 | 419 | ||
428 | /* route the table */ | 420 | /* route the table */ |
429 | pci_intx_for_msi(dev, 0); | 421 | pci_intx_for_msi(dev, 0); |
430 | control |= PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL; | 422 | control |= PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL; |
431 | pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); | 423 | pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, control); |
432 | 424 | ||
433 | list_for_each_entry(entry, &dev->msi_list, list) { | 425 | list_for_each_entry(entry, &dev->msi_list, list) { |
434 | arch_restore_msi_irqs(dev, entry->irq); | 426 | arch_restore_msi_irqs(dev, entry->irq); |
@@ -436,7 +428,7 @@ static void __pci_restore_msix_state(struct pci_dev *dev) | |||
436 | } | 428 | } |
437 | 429 | ||
438 | control &= ~PCI_MSIX_FLAGS_MASKALL; | 430 | control &= ~PCI_MSIX_FLAGS_MASKALL; |
439 | pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); | 431 | pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, control); |
440 | } | 432 | } |
441 | 433 | ||
442 | void pci_restore_msi_state(struct pci_dev *dev) | 434 | void pci_restore_msi_state(struct pci_dev *dev) |
@@ -552,27 +544,27 @@ out_unroll: | |||
552 | static int msi_capability_init(struct pci_dev *dev, int nvec) | 544 | static int msi_capability_init(struct pci_dev *dev, int nvec) |
553 | { | 545 | { |
554 | struct msi_desc *entry; | 546 | struct msi_desc *entry; |
555 | int pos, ret; | 547 | int ret; |
556 | u16 control; | 548 | u16 control; |
557 | unsigned mask; | 549 | unsigned mask; |
558 | 550 | ||
559 | pos = pci_find_capability(dev, PCI_CAP_ID_MSI); | 551 | msi_set_enable(dev, 0); /* Disable MSI during set up */ |
560 | msi_set_enable(dev, pos, 0); /* Disable MSI during set up */ | ||
561 | 552 | ||
562 | pci_read_config_word(dev, msi_control_reg(pos), &control); | 553 | pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); |
563 | /* MSI Entry Initialization */ | 554 | /* MSI Entry Initialization */ |
564 | entry = alloc_msi_entry(dev); | 555 | entry = alloc_msi_entry(dev); |
565 | if (!entry) | 556 | if (!entry) |
566 | return -ENOMEM; | 557 | return -ENOMEM; |
567 | 558 | ||
568 | entry->msi_attrib.is_msix = 0; | 559 | entry->msi_attrib.is_msix = 0; |
569 | entry->msi_attrib.is_64 = is_64bit_address(control); | 560 | entry->msi_attrib.is_64 = !!(control & PCI_MSI_FLAGS_64BIT); |
570 | entry->msi_attrib.entry_nr = 0; | 561 | entry->msi_attrib.entry_nr = 0; |
571 | entry->msi_attrib.maskbit = is_mask_bit_support(control); | 562 | entry->msi_attrib.maskbit = !!(control & PCI_MSI_FLAGS_MASKBIT); |
572 | entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */ | 563 | entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */ |
573 | entry->msi_attrib.pos = pos; | 564 | entry->msi_attrib.pos = dev->msi_cap; |
574 | 565 | ||
575 | entry->mask_pos = msi_mask_reg(pos, entry->msi_attrib.is_64); | 566 | entry->mask_pos = dev->msi_cap + (control & PCI_MSI_FLAGS_64BIT) ? |
567 | PCI_MSI_MASK_64 : PCI_MSI_MASK_32; | ||
576 | /* All MSIs are unmasked by default, Mask them all */ | 568 | /* All MSIs are unmasked by default, Mask them all */ |
577 | if (entry->msi_attrib.maskbit) | 569 | if (entry->msi_attrib.maskbit) |
578 | pci_read_config_dword(dev, entry->mask_pos, &entry->masked); | 570 | pci_read_config_dword(dev, entry->mask_pos, &entry->masked); |
@@ -598,31 +590,30 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) | |||
598 | 590 | ||
599 | /* Set MSI enabled bits */ | 591 | /* Set MSI enabled bits */ |
600 | pci_intx_for_msi(dev, 0); | 592 | pci_intx_for_msi(dev, 0); |
601 | msi_set_enable(dev, pos, 1); | 593 | msi_set_enable(dev, 1); |
602 | dev->msi_enabled = 1; | 594 | dev->msi_enabled = 1; |
603 | 595 | ||
604 | dev->irq = entry->irq; | 596 | dev->irq = entry->irq; |
605 | return 0; | 597 | return 0; |
606 | } | 598 | } |
607 | 599 | ||
608 | static void __iomem *msix_map_region(struct pci_dev *dev, unsigned pos, | 600 | static void __iomem *msix_map_region(struct pci_dev *dev, unsigned nr_entries) |
609 | unsigned nr_entries) | ||
610 | { | 601 | { |
611 | resource_size_t phys_addr; | 602 | resource_size_t phys_addr; |
612 | u32 table_offset; | 603 | u32 table_offset; |
613 | u8 bir; | 604 | u8 bir; |
614 | 605 | ||
615 | pci_read_config_dword(dev, msix_table_offset_reg(pos), &table_offset); | 606 | pci_read_config_dword(dev, dev->msix_cap + PCI_MSIX_TABLE, |
616 | bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK); | 607 | &table_offset); |
617 | table_offset &= ~PCI_MSIX_FLAGS_BIRMASK; | 608 | bir = (u8)(table_offset & PCI_MSIX_TABLE_BIR); |
609 | table_offset &= PCI_MSIX_TABLE_OFFSET; | ||
618 | phys_addr = pci_resource_start(dev, bir) + table_offset; | 610 | phys_addr = pci_resource_start(dev, bir) + table_offset; |
619 | 611 | ||
620 | return ioremap_nocache(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE); | 612 | return ioremap_nocache(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE); |
621 | } | 613 | } |
622 | 614 | ||
623 | static int msix_setup_entries(struct pci_dev *dev, unsigned pos, | 615 | static int msix_setup_entries(struct pci_dev *dev, void __iomem *base, |
624 | void __iomem *base, struct msix_entry *entries, | 616 | struct msix_entry *entries, int nvec) |
625 | int nvec) | ||
626 | { | 617 | { |
627 | struct msi_desc *entry; | 618 | struct msi_desc *entry; |
628 | int i; | 619 | int i; |
@@ -642,7 +633,7 @@ static int msix_setup_entries(struct pci_dev *dev, unsigned pos, | |||
642 | entry->msi_attrib.is_64 = 1; | 633 | entry->msi_attrib.is_64 = 1; |
643 | entry->msi_attrib.entry_nr = entries[i].entry; | 634 | entry->msi_attrib.entry_nr = entries[i].entry; |
644 | entry->msi_attrib.default_irq = dev->irq; | 635 | entry->msi_attrib.default_irq = dev->irq; |
645 | entry->msi_attrib.pos = pos; | 636 | entry->msi_attrib.pos = dev->msix_cap; |
646 | entry->mask_base = base; | 637 | entry->mask_base = base; |
647 | 638 | ||
648 | list_add_tail(&entry->list, &dev->msi_list); | 639 | list_add_tail(&entry->list, &dev->msi_list); |
@@ -652,7 +643,7 @@ static int msix_setup_entries(struct pci_dev *dev, unsigned pos, | |||
652 | } | 643 | } |
653 | 644 | ||
654 | static void msix_program_entries(struct pci_dev *dev, | 645 | static void msix_program_entries(struct pci_dev *dev, |
655 | struct msix_entry *entries) | 646 | struct msix_entry *entries) |
656 | { | 647 | { |
657 | struct msi_desc *entry; | 648 | struct msi_desc *entry; |
658 | int i = 0; | 649 | int i = 0; |
@@ -682,23 +673,22 @@ static void msix_program_entries(struct pci_dev *dev, | |||
682 | static int msix_capability_init(struct pci_dev *dev, | 673 | static int msix_capability_init(struct pci_dev *dev, |
683 | struct msix_entry *entries, int nvec) | 674 | struct msix_entry *entries, int nvec) |
684 | { | 675 | { |
685 | int pos, ret; | 676 | int ret; |
686 | u16 control; | 677 | u16 control; |
687 | void __iomem *base; | 678 | void __iomem *base; |
688 | 679 | ||
689 | pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); | 680 | pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control); |
690 | pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control); | ||
691 | 681 | ||
692 | /* Ensure MSI-X is disabled while it is set up */ | 682 | /* Ensure MSI-X is disabled while it is set up */ |
693 | control &= ~PCI_MSIX_FLAGS_ENABLE; | 683 | control &= ~PCI_MSIX_FLAGS_ENABLE; |
694 | pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); | 684 | pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, control); |
695 | 685 | ||
696 | /* Request & Map MSI-X table region */ | 686 | /* Request & Map MSI-X table region */ |
697 | base = msix_map_region(dev, pos, multi_msix_capable(control)); | 687 | base = msix_map_region(dev, msix_table_size(control)); |
698 | if (!base) | 688 | if (!base) |
699 | return -ENOMEM; | 689 | return -ENOMEM; |
700 | 690 | ||
701 | ret = msix_setup_entries(dev, pos, base, entries, nvec); | 691 | ret = msix_setup_entries(dev, base, entries, nvec); |
702 | if (ret) | 692 | if (ret) |
703 | return ret; | 693 | return ret; |
704 | 694 | ||
@@ -712,7 +702,7 @@ static int msix_capability_init(struct pci_dev *dev, | |||
712 | * interrupts coming in before they're fully set up. | 702 | * interrupts coming in before they're fully set up. |
713 | */ | 703 | */ |
714 | control |= PCI_MSIX_FLAGS_MASKALL | PCI_MSIX_FLAGS_ENABLE; | 704 | control |= PCI_MSIX_FLAGS_MASKALL | PCI_MSIX_FLAGS_ENABLE; |
715 | pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); | 705 | pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, control); |
716 | 706 | ||
717 | msix_program_entries(dev, entries); | 707 | msix_program_entries(dev, entries); |
718 | 708 | ||
@@ -727,7 +717,7 @@ static int msix_capability_init(struct pci_dev *dev, | |||
727 | dev->msix_enabled = 1; | 717 | dev->msix_enabled = 1; |
728 | 718 | ||
729 | control &= ~PCI_MSIX_FLAGS_MASKALL; | 719 | control &= ~PCI_MSIX_FLAGS_MASKALL; |
730 | pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); | 720 | pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, control); |
731 | 721 | ||
732 | return 0; | 722 | return 0; |
733 | 723 | ||
@@ -795,9 +785,6 @@ static int pci_msi_check_device(struct pci_dev *dev, int nvec, int type) | |||
795 | if (ret) | 785 | if (ret) |
796 | return ret; | 786 | return ret; |
797 | 787 | ||
798 | if (!pci_find_capability(dev, type)) | ||
799 | return -EINVAL; | ||
800 | |||
801 | return 0; | 788 | return 0; |
802 | } | 789 | } |
803 | 790 | ||
@@ -816,13 +803,13 @@ static int pci_msi_check_device(struct pci_dev *dev, int nvec, int type) | |||
816 | */ | 803 | */ |
817 | int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec) | 804 | int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec) |
818 | { | 805 | { |
819 | int status, pos, maxvec; | 806 | int status, maxvec; |
820 | u16 msgctl; | 807 | u16 msgctl; |
821 | 808 | ||
822 | pos = pci_find_capability(dev, PCI_CAP_ID_MSI); | 809 | if (!dev->msi_cap) |
823 | if (!pos) | ||
824 | return -EINVAL; | 810 | return -EINVAL; |
825 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl); | 811 | |
812 | pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl); | ||
826 | maxvec = 1 << ((msgctl & PCI_MSI_FLAGS_QMASK) >> 1); | 813 | maxvec = 1 << ((msgctl & PCI_MSI_FLAGS_QMASK) >> 1); |
827 | if (nvec > maxvec) | 814 | if (nvec > maxvec) |
828 | return maxvec; | 815 | return maxvec; |
@@ -847,14 +834,13 @@ EXPORT_SYMBOL(pci_enable_msi_block); | |||
847 | 834 | ||
848 | int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec) | 835 | int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec) |
849 | { | 836 | { |
850 | int ret, pos, nvec; | 837 | int ret, nvec; |
851 | u16 msgctl; | 838 | u16 msgctl; |
852 | 839 | ||
853 | pos = pci_find_capability(dev, PCI_CAP_ID_MSI); | 840 | if (!dev->msi_cap) |
854 | if (!pos) | ||
855 | return -EINVAL; | 841 | return -EINVAL; |
856 | 842 | ||
857 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl); | 843 | pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl); |
858 | ret = 1 << ((msgctl & PCI_MSI_FLAGS_QMASK) >> 1); | 844 | ret = 1 << ((msgctl & PCI_MSI_FLAGS_QMASK) >> 1); |
859 | 845 | ||
860 | if (maxvec) | 846 | if (maxvec) |
@@ -876,21 +862,19 @@ void pci_msi_shutdown(struct pci_dev *dev) | |||
876 | struct msi_desc *desc; | 862 | struct msi_desc *desc; |
877 | u32 mask; | 863 | u32 mask; |
878 | u16 ctrl; | 864 | u16 ctrl; |
879 | unsigned pos; | ||
880 | 865 | ||
881 | if (!pci_msi_enable || !dev || !dev->msi_enabled) | 866 | if (!pci_msi_enable || !dev || !dev->msi_enabled) |
882 | return; | 867 | return; |
883 | 868 | ||
884 | BUG_ON(list_empty(&dev->msi_list)); | 869 | BUG_ON(list_empty(&dev->msi_list)); |
885 | desc = list_first_entry(&dev->msi_list, struct msi_desc, list); | 870 | desc = list_first_entry(&dev->msi_list, struct msi_desc, list); |
886 | pos = desc->msi_attrib.pos; | ||
887 | 871 | ||
888 | msi_set_enable(dev, pos, 0); | 872 | msi_set_enable(dev, 0); |
889 | pci_intx_for_msi(dev, 1); | 873 | pci_intx_for_msi(dev, 1); |
890 | dev->msi_enabled = 0; | 874 | dev->msi_enabled = 0; |
891 | 875 | ||
892 | /* Return the device with MSI unmasked as initial states */ | 876 | /* Return the device with MSI unmasked as initial states */ |
893 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &ctrl); | 877 | pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &ctrl); |
894 | mask = msi_capable_mask(ctrl); | 878 | mask = msi_capable_mask(ctrl); |
895 | /* Keep cached state to be restored */ | 879 | /* Keep cached state to be restored */ |
896 | __msi_mask_irq(desc, mask, ~mask); | 880 | __msi_mask_irq(desc, mask, ~mask); |
@@ -917,15 +901,13 @@ EXPORT_SYMBOL(pci_disable_msi); | |||
917 | */ | 901 | */ |
918 | int pci_msix_table_size(struct pci_dev *dev) | 902 | int pci_msix_table_size(struct pci_dev *dev) |
919 | { | 903 | { |
920 | int pos; | ||
921 | u16 control; | 904 | u16 control; |
922 | 905 | ||
923 | pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); | 906 | if (!dev->msix_cap) |
924 | if (!pos) | ||
925 | return 0; | 907 | return 0; |
926 | 908 | ||
927 | pci_read_config_word(dev, msi_control_reg(pos), &control); | 909 | pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control); |
928 | return multi_msix_capable(control); | 910 | return msix_table_size(control); |
929 | } | 911 | } |
930 | 912 | ||
931 | /** | 913 | /** |
@@ -948,7 +930,7 @@ int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec) | |||
948 | int status, nr_entries; | 930 | int status, nr_entries; |
949 | int i, j; | 931 | int i, j; |
950 | 932 | ||
951 | if (!entries) | 933 | if (!entries || !dev->msix_cap) |
952 | return -EINVAL; | 934 | return -EINVAL; |
953 | 935 | ||
954 | status = pci_msi_check_device(dev, nvec, PCI_CAP_ID_MSIX); | 936 | status = pci_msi_check_device(dev, nvec, PCI_CAP_ID_MSIX); |
@@ -1048,15 +1030,17 @@ EXPORT_SYMBOL(pci_msi_enabled); | |||
1048 | 1030 | ||
1049 | void pci_msi_init_pci_dev(struct pci_dev *dev) | 1031 | void pci_msi_init_pci_dev(struct pci_dev *dev) |
1050 | { | 1032 | { |
1051 | int pos; | ||
1052 | INIT_LIST_HEAD(&dev->msi_list); | 1033 | INIT_LIST_HEAD(&dev->msi_list); |
1053 | 1034 | ||
1054 | /* Disable the msi hardware to avoid screaming interrupts | 1035 | /* Disable the msi hardware to avoid screaming interrupts |
1055 | * during boot. This is the power on reset default so | 1036 | * during boot. This is the power on reset default so |
1056 | * usually this should be a noop. | 1037 | * usually this should be a noop. |
1057 | */ | 1038 | */ |
1058 | pos = pci_find_capability(dev, PCI_CAP_ID_MSI); | 1039 | dev->msi_cap = pci_find_capability(dev, PCI_CAP_ID_MSI); |
1059 | if (pos) | 1040 | if (dev->msi_cap) |
1060 | msi_set_enable(dev, pos, 0); | 1041 | msi_set_enable(dev, 0); |
1061 | msix_set_enable(dev, 0); | 1042 | |
1043 | dev->msix_cap = pci_find_capability(dev, PCI_CAP_ID_MSIX); | ||
1044 | if (dev->msix_cap) | ||
1045 | msix_set_enable(dev, 0); | ||
1062 | } | 1046 | } |
diff --git a/drivers/pci/msi.h b/drivers/pci/msi.h deleted file mode 100644 index 65c42f80f23e..000000000000 --- a/drivers/pci/msi.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2003-2004 Intel | ||
3 | * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) | ||
4 | */ | ||
5 | |||
6 | #ifndef MSI_H | ||
7 | #define MSI_H | ||
8 | |||
9 | #define msi_control_reg(base) (base + PCI_MSI_FLAGS) | ||
10 | #define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) | ||
11 | #define msi_upper_address_reg(base) (base + PCI_MSI_ADDRESS_HI) | ||
12 | #define msi_data_reg(base, is64bit) \ | ||
13 | (base + ((is64bit == 1) ? PCI_MSI_DATA_64 : PCI_MSI_DATA_32)) | ||
14 | #define msi_mask_reg(base, is64bit) \ | ||
15 | (base + ((is64bit == 1) ? PCI_MSI_MASK_64 : PCI_MSI_MASK_32)) | ||
16 | #define is_64bit_address(control) (!!(control & PCI_MSI_FLAGS_64BIT)) | ||
17 | #define is_mask_bit_support(control) (!!(control & PCI_MSI_FLAGS_MASKBIT)) | ||
18 | |||
19 | #define msix_table_offset_reg(base) (base + PCI_MSIX_TABLE) | ||
20 | #define msix_pba_offset_reg(base) (base + PCI_MSIX_PBA) | ||
21 | #define msix_table_size(control) ((control & PCI_MSIX_FLAGS_QSIZE)+1) | ||
22 | #define multi_msix_capable(control) msix_table_size((control)) | ||
23 | |||
24 | #endif /* MSI_H */ | ||
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 408d2548a748..684cc343cf09 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -1488,7 +1488,4 @@ struct megasas_mgmt_info { | |||
1488 | int max_index; | 1488 | int max_index; |
1489 | }; | 1489 | }; |
1490 | 1490 | ||
1491 | #define msi_control_reg(base) (base + PCI_MSI_FLAGS) | ||
1492 | #define PCI_MSIX_FLAGS_ENABLE (1 << 15) | ||
1493 | |||
1494 | #endif /*LSI_MEGARAID_SAS_H */ | 1491 | #endif /*LSI_MEGARAID_SAS_H */ |
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 9d53540207ec..7c90d57b867e 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c | |||
@@ -3984,12 +3984,12 @@ static int megasas_probe_one(struct pci_dev *pdev, | |||
3984 | if (reset_devices) { | 3984 | if (reset_devices) { |
3985 | pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); | 3985 | pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); |
3986 | if (pos) { | 3986 | if (pos) { |
3987 | pci_read_config_word(pdev, msi_control_reg(pos), | 3987 | pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS, |
3988 | &control); | 3988 | &control); |
3989 | if (control & PCI_MSIX_FLAGS_ENABLE) { | 3989 | if (control & PCI_MSIX_FLAGS_ENABLE) { |
3990 | dev_info(&pdev->dev, "resetting MSI-X\n"); | 3990 | dev_info(&pdev->dev, "resetting MSI-X\n"); |
3991 | pci_write_config_word(pdev, | 3991 | pci_write_config_word(pdev, |
3992 | msi_control_reg(pos), | 3992 | pos + PCI_MSIX_FLAGS, |
3993 | control & | 3993 | control & |
3994 | ~PCI_MSIX_FLAGS_ENABLE); | 3994 | ~PCI_MSIX_FLAGS_ENABLE); |
3995 | } | 3995 | } |
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 8189cb6a86af..05afe883f038 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
@@ -70,7 +70,7 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) | |||
70 | pci_write_config_word(pdev, PCI_COMMAND, cmd); | 70 | pci_write_config_word(pdev, PCI_COMMAND, cmd); |
71 | } | 71 | } |
72 | 72 | ||
73 | msix_pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); | 73 | msix_pos = pdev->msix_cap; |
74 | if (msix_pos) { | 74 | if (msix_pos) { |
75 | u16 flags; | 75 | u16 flags; |
76 | u32 table; | 76 | u32 table; |
@@ -78,8 +78,8 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) | |||
78 | pci_read_config_word(pdev, msix_pos + PCI_MSIX_FLAGS, &flags); | 78 | pci_read_config_word(pdev, msix_pos + PCI_MSIX_FLAGS, &flags); |
79 | pci_read_config_dword(pdev, msix_pos + PCI_MSIX_TABLE, &table); | 79 | pci_read_config_dword(pdev, msix_pos + PCI_MSIX_TABLE, &table); |
80 | 80 | ||
81 | vdev->msix_bar = table & PCI_MSIX_FLAGS_BIRMASK; | 81 | vdev->msix_bar = table & PCI_MSIX_TABLE_BIR; |
82 | vdev->msix_offset = table & ~PCI_MSIX_FLAGS_BIRMASK; | 82 | vdev->msix_offset = table & PCI_MSIX_TABLE_OFFSET; |
83 | vdev->msix_size = ((flags & PCI_MSIX_FLAGS_QSIZE) + 1) * 16; | 83 | vdev->msix_size = ((flags & PCI_MSIX_FLAGS_QSIZE) + 1) * 16; |
84 | } else | 84 | } else |
85 | vdev->msix_bar = 0xFF; | 85 | vdev->msix_bar = 0xFF; |
@@ -183,7 +183,7 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type) | |||
183 | u8 pos; | 183 | u8 pos; |
184 | u16 flags; | 184 | u16 flags; |
185 | 185 | ||
186 | pos = pci_find_capability(vdev->pdev, PCI_CAP_ID_MSI); | 186 | pos = vdev->pdev->msi_cap; |
187 | if (pos) { | 187 | if (pos) { |
188 | pci_read_config_word(vdev->pdev, | 188 | pci_read_config_word(vdev->pdev, |
189 | pos + PCI_MSI_FLAGS, &flags); | 189 | pos + PCI_MSI_FLAGS, &flags); |
@@ -194,7 +194,7 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type) | |||
194 | u8 pos; | 194 | u8 pos; |
195 | u16 flags; | 195 | u16 flags; |
196 | 196 | ||
197 | pos = pci_find_capability(vdev->pdev, PCI_CAP_ID_MSIX); | 197 | pos = vdev->pdev->msix_cap; |
198 | if (pos) { | 198 | if (pos) { |
199 | pci_read_config_word(vdev->pdev, | 199 | pci_read_config_word(vdev->pdev, |
200 | pos + PCI_MSIX_FLAGS, &flags); | 200 | pos + PCI_MSIX_FLAGS, &flags); |
diff --git a/include/linux/msi.h b/include/linux/msi.h index ce93a341337d..20c2d6dd5d25 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h | |||
@@ -13,14 +13,14 @@ struct msi_msg { | |||
13 | /* Helper functions */ | 13 | /* Helper functions */ |
14 | struct irq_data; | 14 | struct irq_data; |
15 | struct msi_desc; | 15 | struct msi_desc; |
16 | extern void mask_msi_irq(struct irq_data *data); | 16 | void mask_msi_irq(struct irq_data *data); |
17 | extern void unmask_msi_irq(struct irq_data *data); | 17 | void unmask_msi_irq(struct irq_data *data); |
18 | extern void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); | 18 | void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); |
19 | extern void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg); | 19 | void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg); |
20 | extern void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); | 20 | void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); |
21 | extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); | 21 | void read_msi_msg(unsigned int irq, struct msi_msg *msg); |
22 | extern void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg); | 22 | void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg); |
23 | extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); | 23 | void write_msi_msg(unsigned int irq, struct msi_msg *msg); |
24 | 24 | ||
25 | struct msi_desc { | 25 | struct msi_desc { |
26 | struct { | 26 | struct { |
@@ -54,9 +54,8 @@ struct msi_desc { | |||
54 | */ | 54 | */ |
55 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); | 55 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); |
56 | void arch_teardown_msi_irq(unsigned int irq); | 56 | void arch_teardown_msi_irq(unsigned int irq); |
57 | extern int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); | 57 | int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); |
58 | extern void arch_teardown_msi_irqs(struct pci_dev *dev); | 58 | void arch_teardown_msi_irqs(struct pci_dev *dev); |
59 | extern int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); | 59 | int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); |
60 | |||
61 | 60 | ||
62 | #endif /* LINUX_MSI_H */ | 61 | #endif /* LINUX_MSI_H */ |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 8aaca26a2b32..e19d8648e0e6 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -247,6 +247,8 @@ struct pci_dev { | |||
247 | u8 revision; /* PCI revision, low byte of class word */ | 247 | u8 revision; /* PCI revision, low byte of class word */ |
248 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ | 248 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ |
249 | u8 pcie_cap; /* PCI-E capability offset */ | 249 | u8 pcie_cap; /* PCI-E capability offset */ |
250 | u8 msi_cap; /* MSI capability offset */ | ||
251 | u8 msix_cap; /* MSI-X capability offset */ | ||
250 | u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ | 252 | u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ |
251 | u8 rom_base_reg; /* which config register controls the ROM */ | 253 | u8 rom_base_reg; /* which config register controls the ROM */ |
252 | u8 pin; /* which interrupt pin this device uses */ | 254 | u8 pin; /* which interrupt pin this device uses */ |
@@ -264,8 +266,7 @@ struct pci_dev { | |||
264 | pci_power_t current_state; /* Current operating state. In ACPI-speak, | 266 | pci_power_t current_state; /* Current operating state. In ACPI-speak, |
265 | this is D0-D3, D0 being fully functional, | 267 | this is D0-D3, D0 being fully functional, |
266 | and D3 being off. */ | 268 | and D3 being off. */ |
267 | int pm_cap; /* PM capability offset in the | 269 | u8 pm_cap; /* PM capability offset */ |
268 | configuration space */ | ||
269 | unsigned int pme_support:5; /* Bitmask of states from which PME# | 270 | unsigned int pme_support:5; /* Bitmask of states from which PME# |
270 | can be generated */ | 271 | can be generated */ |
271 | unsigned int pme_interrupt:1; | 272 | unsigned int pme_interrupt:1; |
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index ebfadc56d1b4..864e324da80d 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h | |||
@@ -292,12 +292,12 @@ | |||
292 | 292 | ||
293 | /* Message Signalled Interrupts registers */ | 293 | /* Message Signalled Interrupts registers */ |
294 | 294 | ||
295 | #define PCI_MSI_FLAGS 2 /* Various flags */ | 295 | #define PCI_MSI_FLAGS 2 /* Message Control */ |
296 | #define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ | 296 | #define PCI_MSI_FLAGS_ENABLE 0x0001 /* MSI feature enabled */ |
297 | #define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ | 297 | #define PCI_MSI_FLAGS_QMASK 0x000e /* Maximum queue size available */ |
298 | #define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ | 298 | #define PCI_MSI_FLAGS_QSIZE 0x0070 /* Message queue size configured */ |
299 | #define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ | 299 | #define PCI_MSI_FLAGS_64BIT 0x0080 /* 64-bit addresses allowed */ |
300 | #define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */ | 300 | #define PCI_MSI_FLAGS_MASKBIT 0x0100 /* Per-vector masking capable */ |
301 | #define PCI_MSI_RFU 3 /* Rest of capability flags */ | 301 | #define PCI_MSI_RFU 3 /* Rest of capability flags */ |
302 | #define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ | 302 | #define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ |
303 | #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ | 303 | #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ |
@@ -309,13 +309,17 @@ | |||
309 | #define PCI_MSI_PENDING_64 20 /* Pending intrs for 64-bit devices */ | 309 | #define PCI_MSI_PENDING_64 20 /* Pending intrs for 64-bit devices */ |
310 | 310 | ||
311 | /* MSI-X registers */ | 311 | /* MSI-X registers */ |
312 | #define PCI_MSIX_FLAGS 2 | 312 | #define PCI_MSIX_FLAGS 2 /* Message Control */ |
313 | #define PCI_MSIX_FLAGS_QSIZE 0x7FF | 313 | #define PCI_MSIX_FLAGS_QSIZE 0x07FF /* Table size */ |
314 | #define PCI_MSIX_FLAGS_ENABLE (1 << 15) | 314 | #define PCI_MSIX_FLAGS_MASKALL 0x4000 /* Mask all vectors for this function */ |
315 | #define PCI_MSIX_FLAGS_MASKALL (1 << 14) | 315 | #define PCI_MSIX_FLAGS_ENABLE 0x8000 /* MSI-X enable */ |
316 | #define PCI_MSIX_TABLE 4 | 316 | #define PCI_MSIX_TABLE 4 /* Table offset */ |
317 | #define PCI_MSIX_PBA 8 | 317 | #define PCI_MSIX_TABLE_BIR 0x00000007 /* BAR index */ |
318 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) | 318 | #define PCI_MSIX_TABLE_OFFSET 0xfffffff8 /* Offset into specified BAR */ |
319 | #define PCI_MSIX_PBA 8 /* Pending Bit Array offset */ | ||
320 | #define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */ | ||
321 | #define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */ | ||
322 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) /* deprecated */ | ||
319 | #define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ | 323 | #define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ |
320 | 324 | ||
321 | /* MSI-X entry's format */ | 325 | /* MSI-X entry's format */ |