mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Wiedemeier, Jeff" <Jeff.Wiedemeier@hp.com>
To: "David S. Miller" <davem@redhat.com>
Cc: ink@jurassic.park.msu.ru, jgarzik@pobox.com, willy@debian.org,
	linux-kernel@vger.kernel.org,
	Jeff Wiedemeier <Jeff.Wiedemeier@hp.com>
Subject: Re: [patch 2.5] tg3.c: pci_{save,restore}_extended_state
Date: Fri, 24 Jan 2003 19:33:53 -0500	[thread overview]
Message-ID: <20030124193353.A6814@dsnt25.mro.cpqcorp.net> (raw)
In-Reply-To: <20030124.143252.97527503.davem@redhat.com>; from davem@redhat.com on Fri, Jan 24, 2003 at 02:32:52PM -0800

On Fri, Jan 24, 2003 at 02:32:52PM -0800, David S. Miller wrote:
>    From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
>    Date: Sat, 25 Jan 2003 01:41:02 +0300
>    
>    I don't understand the issue, really. The config register says:
>    "MSIs are enabled". Which means: "My platform is *really* going to
>    use MSI". Why do you want to ignore that?
> 
> I see, why not code up a generic pci_using_msi(pdev) that
> does this?
> 
> I suggested a per-arch version because I was not clear on how
> this exactly worked.

You mean something like this? My reading of the PCI spec says that if
the enable bit in Message Command (part of which is PCI_MSI_FLAGS as
defined in pci.h) is that if the enable bit is set, MSIs are being
used... 

Then the tg3 code after the pci_restore_extended_state could be
     if (pci_using_msi(tp->pdev))
        tw32(MSGINT_MODE, MSGINT_MODE_ENABLE);

/jeff
------
diff -Nuar linux-2.5.59/drivers/pci/pci.c pci_using_msi/drivers/pci/pci.c
--- linux-2.5.59/drivers/pci/pci.c	Thu Jan 16 21:21:48 2003
+++ pci_using_msi/drivers/pci/pci.c	Fri Jan 24 19:00:53 2003
@@ -679,6 +679,26 @@
 	}
 }
 
+/**
+ * pci_using_msi - is this pci device configured to use MSI?
+ * @dev: PCI device structure of device being queried
+ *
+ * Tells whether or not a pci device is configured to use Message Signalled
+ * Interrupts. Returns non-zero if configured for MSI, else 0.
+ */
+int
+pci_using_msi(struct pci_dev *dev)
+{
+	int msi = pci_find_capability(dev, PCI_CAP_ID_MSI);
+	u8 flags;
+
+	if (!msi)
+		return 0;
+
+	pci_read_config_byte(dev, msi + PCI_MSI_FLAGS, &flags);
+	return (flags & PCI_MSI_FLAGS_ENABLE);
+}
+
 int
 pci_set_dma_mask(struct pci_dev *dev, u64 mask)
 {
@@ -749,6 +769,7 @@
 EXPORT_SYMBOL(pci_set_master);
 EXPORT_SYMBOL(pci_set_mwi);
 EXPORT_SYMBOL(pci_clear_mwi);
+EXPORT_SYMBOL(pci_using_msi);
 EXPORT_SYMBOL(pci_set_dma_mask);
 EXPORT_SYMBOL(pci_dac_set_dma_mask);
 EXPORT_SYMBOL(pci_assign_resource);
diff -Nuar linux-2.5.59/include/linux/pci.h pci_using_msi/include/linux/pci.h
--- linux-2.5.59/include/linux/pci.h	Thu Jan 16 21:22:08 2003
+++ pci_using_msi/include/linux/pci.h	Fri Jan 24 19:01:26 2003
@@ -622,6 +622,7 @@
 #define HAVE_PCI_SET_MWI
 int pci_set_mwi(struct pci_dev *dev);
 void pci_clear_mwi(struct pci_dev *dev);
+int pci_using_msi(struct pci_dev *dev);
 int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
 int pci_dac_set_dma_mask(struct pci_dev *dev, u64 mask);
 int pci_assign_resource(struct pci_dev *dev, int i);


  parent reply	other threads:[~2003-01-25  0:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-24 18:27 Ivan Kokshaysky
2003-01-24 19:31 ` Jeff Garzik
2003-01-24 19:34   ` David S. Miller
2003-01-24 20:00   ` Wiedemeier, Jeff
2003-01-24 19:53     ` David S. Miller
2003-01-24 20:04       ` Wiedemeier, Jeff
2003-01-24 20:05     ` Jeff Garzik
2003-01-24 20:24       ` Wiedemeier, Jeff
2003-01-24 20:34         ` Jeff Garzik
2003-01-24 20:46           ` Wiedemeier, Jeff
2003-01-24 20:51             ` David S. Miller
2003-01-24 21:33               ` Wiedemeier, Jeff
2003-01-24 21:34                 ` David S. Miller
2003-01-24 22:41                   ` Ivan Kokshaysky
2003-01-24 22:32                     ` David S. Miller
2003-01-24 22:51                       ` Jeff Garzik
2003-01-25  0:33                       ` Wiedemeier, Jeff [this message]
2003-01-25  1:42                         ` David S. Miller
2003-01-24 22:56                 ` Jeff Garzik

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=20030124193353.A6814@dsnt25.mro.cpqcorp.net \
    --to=jeff.wiedemeier@hp.com \
    --cc=davem@redhat.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@debian.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®