All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: mj@ucw.cz
Cc: linux-pci@atrey.karlin.mff.cuni.cz, linux-kernel@vger.kernel.org
Subject: [PATCH] pciutils: Support for MSI-X capability
Date: Sat, 26 Jun 2004 10:58:49 -0700	[thread overview]
Message-ID: <52y8mayzdy.fsf@topspin.com> (raw)

Hi, here is a patch to pciutils that adds parsing of MSI-X capability
entries.  With this patch, an MSI-X capability will be dumped with -v as

	Capabilities: [40] MSI-X: Enable- Mask- TabSize=32

and with -vv as

	Capabilities: [40] MSI-X: Enable- Mask- TabSize=32
		Vector table: BAR=0 offset=00082000
		PBA: BAR=0 offset=00082200

Please let me know if you need any changes/fixes before you can apply.

Thanks,
  Roland

Index: pciutils-2.1.99-test5/lib/header.h
===================================================================
--- pciutils-2.1.99-test5.orig/lib/header.h	2004-05-28 03:54:41.000000000 -0700
+++ pciutils-2.1.99-test5/lib/header.h	2004-06-26 10:44:14.000000000 -0700
@@ -185,6 +185,7 @@
 #define  PCI_CAP_ID_CHSWP	0x06	/* CompactPCI HotSwap */
 #define  PCI_CAP_ID_PCIX        0x07    /* PCI-X */
 #define  PCI_CAP_ID_HT          0x08    /* HyperTransport */
+#define  PCI_CAP_ID_MSIX        0x11    /* MSI-X */
 #define PCI_CAP_LIST_NEXT	1	/* Next capability in the list */
 #define PCI_CAP_FLAGS		2	/* Capability defined flags (16 bits) */
 #define PCI_CAP_SIZEOF		4
@@ -661,6 +662,14 @@
 #define PCI_HT_RM_CNT1		10	/* Retry Count 1 Register */
 #define PCI_HT_RM_SIZEOF	12
 
+/* MSI-X */
+#define  PCI_MSIX_ENABLE  0x8000
+#define  PCI_MSIX_MASK    0x4000
+#define  PCI_MSIX_TABSIZE 0x03ff
+#define PCI_MSIX_TABLE    4
+#define PCI_MSIX_PBA      8
+#define  PCI_MSIX_BIR     0x7
+
 /*
  * The PCI interface treats multi-function devices as independent
  * devices.  The slot/function address of each device is encoded
Index: pciutils-2.1.99-test5/lspci.c
===================================================================
--- pciutils-2.1.99-test5.orig/lspci.c	2004-06-26 10:32:47.000000000 -0700
+++ pciutils-2.1.99-test5/lspci.c	2004-06-26 10:53:26.000000000 -0700
@@ -924,6 +924,28 @@
 }
 
 static void
+show_msix(struct device *d, int where, int cap)
+{
+  u32 off;
+
+  printf("MSI-X: Enable%c Mask%c TabSize=%d\n",
+	 FLAG(cap, PCI_MSIX_ENABLE),
+	 FLAG(cap, PCI_MSIX_MASK),
+	 (cap & PCI_MSIX_TABSIZE) + 1);
+  if (verbose < 2)
+    return;
+
+  config_fetch(d, where + PCI_MSIX_TABLE, 4);
+  off = get_conf_long(d, where + PCI_MSIX_TABLE);
+  printf("\t\tVector table: BAR=%d offset=%08x\n",
+	 off & PCI_MSIX_BIR, off & ~PCI_MSIX_BIR);
+  config_fetch(d, where + PCI_MSIX_PBA, 4);
+  off = get_conf_long(d, where + PCI_MSIX_PBA);
+  printf("\t\tPBA: BAR=%d offset=%08x\n",
+	 off & PCI_MSIX_BIR, off & ~PCI_MSIX_BIR);
+}
+
+static void
 show_slotid(int cap)
 {
   int esr = cap & 0xff;
@@ -982,6 +1004,9 @@
 	    case PCI_CAP_ID_HT:
 	      show_ht(d, where, cap);
 	      break;
+	    case PCI_CAP_ID_MSIX:
+	      show_msix(d, where, cap);
+	      break;
 	    default:
 	      printf("#%02x [%04x]\n", id, cap);
 	    }

             reply	other threads:[~2004-06-26 18:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-26 17:58 Roland Dreier [this message]
2004-06-26 21:54 ` [PATCH] pciutils: Support for MSI-X capability Matthew Wilcox
2004-06-26 23:29   ` Roland Dreier
2004-06-27  0:54     ` Matthew Wilcox
2004-06-27  1:01       ` Roland Dreier
2004-06-27  1:08         ` Matthew Wilcox
2004-06-27 11:43 ` Martin Mares
2004-06-27 17:07   ` Roland Dreier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52y8mayzdy.fsf@topspin.com \
    --to=roland@topspin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=mj@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.