From: Stephen Hemminger <shemminger@linux-foundation•org>
To: Jeff Garzik <jgarzik@pobox•com>
Cc: netdev@vger•kernel.org
Cc: Greg KH <greg@kroah•com>
Cc: linux-pci@atrey•karlin.mff.cuni.cz
Subject: [PATCH 14/17] pci_wake_enabled function
Date: Tue, 08 May 2007 20:50:03 -0700 [thread overview]
Message-ID: <20070509035030.716588432@linux-foundation.org> (raw)
In-Reply-To: 20070509034949.624934448@linux-foundation.org
[-- Attachment #1: pci_pme_enabled.patch --]
[-- Type: text/plain, Size: 3498 bytes --]
Both skge and sky2 drivers have test to see if PCI wakeup is enabled
in the BIOS. It makes sense to move this to common code.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation•org>
---
drivers/net/skge.c | 18 ------------------
drivers/net/sky2.c | 11 -----------
drivers/pci/pci.c | 22 ++++++++++++++++++++++
include/linux/pci.h | 1 +
4 files changed, 23 insertions(+), 29 deletions(-)
--- sky2-2.6.21.orig/drivers/net/skge.c 2007-05-08 15:36:57.000000000 -0700
+++ sky2-2.6.21/drivers/net/skge.c 2007-05-08 15:37:06.000000000 -0700
@@ -144,24 +144,6 @@ static u32 wol_supported(const struct sk
return WAKE_MAGIC | WAKE_PHY;
}
-static u32 pci_wake_enabled(struct pci_dev *dev)
-{
- int pm = pci_find_capability(dev, PCI_CAP_ID_PM);
- u16 value;
-
- /* If device doesn't support PM Capabilities, but request is to disable
- * wake events, it's a nop; otherwise fail */
- if (!pm)
- return 0;
-
- pci_read_config_word(dev, pm + PCI_PM_PMC, &value);
-
- value &= PCI_PM_CAP_PME_MASK;
- value >>= ffs(PCI_PM_CAP_PME_MASK) - 1; /* First bit of mask */
-
- return value != 0;
-}
-
static void skge_wol_init(struct skge_port *skge)
{
struct skge_hw *hw = skge->hw;
--- sky2-2.6.21.orig/drivers/net/sky2.c 2007-05-08 15:37:04.000000000 -0700
+++ sky2-2.6.21/drivers/net/sky2.c 2007-05-08 15:37:06.000000000 -0700
@@ -3558,17 +3558,6 @@ static int __devinit sky2_test_msi(struc
return err;
}
-static int __devinit pci_wake_enabled(struct pci_dev *dev)
-{
- int pm = pci_find_capability(dev, PCI_CAP_ID_PM);
- u16 value;
-
- if (!pm)
- return 0;
- if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value))
- return 0;
- return value & PCI_PM_CTRL_PME_ENABLE;
-}
static int __devinit sky2_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
--- sky2-2.6.21.orig/drivers/pci/pci.c 2007-05-08 15:36:57.000000000 -0700
+++ sky2-2.6.21/drivers/pci/pci.c 2007-05-08 15:37:06.000000000 -0700
@@ -991,6 +991,27 @@ int pci_enable_wake(struct pci_dev *dev,
return 0;
}
+/**
+ * pci_wake_enabled - is wakeup event from this PCI device entabled
+ * @dev: PCI device affected
+ *
+ * This checks if device has a wakeup event source.
+ *
+ * 0 is returned if the device is not a wakeup event source.
+ * 1 is returned if the device cat generate wakeup events.
+ */
+int pci_wake_enabled(struct pci_dev *dev)
+{
+ int pm = pci_find_capability(dev, PCI_CAP_ID_PM);
+ u16 value;
+
+ if (!pm)
+ return 0;
+ if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value))
+ return 0;
+ return (value & PCI_PM_CTRL_PME_ENABLE) != 0;
+}
+
int
pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
{
@@ -1454,5 +1475,6 @@ EXPORT_SYMBOL(pci_set_power_state);
EXPORT_SYMBOL(pci_save_state);
EXPORT_SYMBOL(pci_restore_state);
EXPORT_SYMBOL(pci_enable_wake);
+EXPORT_SYMBOL(pci_wake_enabled);
EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
--- sky2-2.6.21.orig/include/linux/pci.h 2007-05-08 15:36:57.000000000 -0700
+++ sky2-2.6.21/include/linux/pci.h 2007-05-08 15:37:06.000000000 -0700
@@ -567,6 +567,7 @@ int pci_restore_state(struct pci_dev *de
int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
+int pci_wake_enabled(struct pci_dev *dev);
/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
void pci_bus_assign_resources(struct pci_bus *bus);
--
next prev parent reply other threads:[~2007-05-09 4:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-09 3:49 [PATCH 00/17] sky2 update for 2.6.22 Stephen Hemminger
2007-05-09 3:49 ` [PATCH 01/17] sky2: fix oops on shutdown Stephen Hemminger
2007-05-09 3:49 ` [PATCH 02/17] sky2: dont restrict config space access Stephen Hemminger
2007-05-09 3:49 ` [PATCH 03/17] sky2: keep track of receive alloc failures Stephen Hemminger
2007-05-09 3:49 ` [PATCH 04/17] sky2: remove dual port workaround Stephen Hemminger
2007-05-09 3:49 ` [PATCH 05/17] pci: advanced error reporting stub return values Stephen Hemminger
2007-05-10 15:48 ` Stephen Hemminger
2007-05-09 3:49 ` [PATCH 06/17] sky2: advanced error reporting Stephen Hemminger
2007-05-09 17:05 ` Linas Vepstas
2007-05-09 22:35 ` Stephen Hemminger
2007-05-09 3:49 ` [PATCH 07/17] sky2: use pci_config access functions Stephen Hemminger
2007-05-09 3:49 ` [PATCH 08/17] sky2: MIB counter overflow handling Stephen Hemminger
2007-05-09 3:49 ` [PATCH 09/17] sky2: memory barriers change Stephen Hemminger
2007-05-09 3:49 ` [PATCH 10/17] sky2: add prefetch for next skb on receive Stephen Hemminger
2007-05-09 3:50 ` [PATCH 11/17] sky2: use MII defines Stephen Hemminger
2007-05-09 3:50 ` [PATCH 12/17] sky2: chip id enum Stephen Hemminger
2007-05-09 3:50 ` [PATCH 13/17] sky2: whitespace cleanups Stephen Hemminger
2007-05-09 3:50 ` Stephen Hemminger [this message]
2007-05-09 3:50 ` [PATCH 15/17] sky2: only disable 88e8056 on some boards Stephen Hemminger
2007-05-09 3:50 ` [PATCH 16/17] sky2: make sure high DMA bits set Stephen Hemminger
2007-05-09 3:50 ` [PATCH 17/17] sky2: version 1.15 Stephen Hemminger
2007-05-09 4:16 ` [PATCH 00/17] sky2 update for 2.6.22 Jeff Garzik
2007-05-09 14:48 ` Stephen Hemminger
2007-05-09 23:27 ` Jeff Garzik
2007-05-10 5:08 ` Stephen Hemminger
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=20070509035030.716588432@linux-foundation.org \
--to=shemminger@linux-foundation$(echo .)org \
--cc=jgarzik@pobox$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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