mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tomas Winkler <tomas.winkler@intel.com>
To: gregkh@linuxfoundation.org
Cc: arnd@arndb.de, linux-kernel@vger.kernel.org,
	Tomas Winkler <tomas.winkler@intel.com>
Subject: [char-misc-next 1/3] mei me: add handler for me_hw_ops fw_status
Date: Wed, 24 Jul 2013 18:41:55 +0300	[thread overview]
Message-ID: <1374680517-30894-2-git-send-email-tomas.winkler@intel.com> (raw)
In-Reply-To: <1374680517-30894-1-git-send-email-tomas.winkler@intel.com>

FW status is read from mei pci configuration space.
The register address depends on the plataform id

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/hw-me-regs.h |  9 +++++++++
 drivers/misc/mei/hw-me.c      | 30 ++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
index 6a203b6..3f612ce 100644
--- a/drivers/misc/mei/hw-me-regs.h
+++ b/drivers/misc/mei/hw-me-regs.h
@@ -111,10 +111,19 @@
 
 #define MEI_DEV_ID_LPT        0x8C3A  /* Lynx Point */
 #define MEI_DEV_ID_LPT_LP     0x9C3A  /* Lynx Point LP */
+
 /*
  * MEI HW Section
  */
 
+/* Host Firmware Status in Platforms < LPT */
+#define PCI_CFG_HFS_PPT   0x40
+/* Host Firmware Status in Platforms >= LPT */
+#define PCI_CFG_HFS_LPT 0x60
+#  define PCI_CFG_HFS_STATE_MSK    0x0000000F
+#  define PCI_CFG_HFS_ISR_CNT_MSK  0x00000600
+#  define PCI_CFG_HFS_ERR_CODE_MSK 0x0000F000
+
 /* MEI registers */
 /* H_CB_WW - Host Circular Buffer (CB) Write Window register */
 #define H_CB_WW    0
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index b22c7e2..2346167 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -536,8 +536,38 @@ end:
 
 	return IRQ_HANDLED;
 }
+
+/**
+ * mei_me_fw_status  - retrieve fw status from the pci config space
+ *
+ * @dev: the device structure
+ * @fw_status: fw status register value
+ *
+ * returns 0 on success an error code otherwise
+ */
+static int mei_me_fw_status(struct mei_device *dev, u32 *fw_status)
+{
+	u32 reg;
+	if (!dev || !fw_status)
+		return -EINVAL;
+
+	switch (dev->pdev->device) {
+	case MEI_DEV_ID_LPT:
+	case MEI_DEV_ID_LPT_LP:
+		reg = PCI_CFG_HFS_LPT;
+		break;
+	default:
+		reg = PCI_CFG_HFS_PPT;
+		break;
+	}
+
+	return pci_read_config_dword(dev->pdev, reg, fw_status);
+}
+
 static const struct mei_hw_ops mei_me_hw_ops = {
 
+	.fw_status = mei_me_fw_status,
+
 	.host_is_ready = mei_me_host_is_ready,
 
 	.hw_is_ready = mei_me_hw_is_ready,
-- 
1.8.1.2


  reply	other threads:[~2013-07-24 15:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-24 15:41 [char-misc-next 0/3] mei: export fw status register through sysfs Tomas Winkler
2013-07-24 15:41 ` Tomas Winkler [this message]
2013-07-24 15:41 ` [char-misc-next 2/3] mei: adding sysfs fw_status attribute Tomas Winkler
2013-07-24 16:00   ` Greg KH
2013-07-24 16:20     ` Winkler, Tomas
2013-07-24 16:26       ` Greg KH
2013-07-24 18:04         ` Winkler, Tomas
2013-07-24 20:29           ` Greg KH
2013-07-28  8:48             ` Winkler, Tomas
2013-07-28 15:31               ` Greg KH
2013-07-29 22:27                 ` Winkler, Tomas
2013-07-29 22:38                   ` Greg KH
2013-07-29 23:08                     ` Winkler, Tomas
2013-07-29 23:17                       ` Greg KH
2013-08-01  7:21                         ` Winkler, Tomas
2013-08-01  7:32                           ` Greg KH
2013-07-24 15:41 ` [char-misc-next 3/3] mei: update ABI for fw_status register exported through sysfs Tomas Winkler

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=1374680517-30894-2-git-send-email-tomas.winkler@intel.com \
    --to=tomas.winkler@intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.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®