aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2014-12-02 00:29:53 +0200
committerBen Hutchings <ben@decadent.org.uk>2014-12-14 16:24:00 +0000
commit7250ff7dd18b7a7a650af4079bbf940f20fd4253 (patch)
tree0cf58d237cb54b34a2a24ec59f08529649c26b7f /drivers/staging
parent5debff3f190462800f5590682b93bfbe0084cb4a (diff)
downloadkernel_samsung_smdk4412-7250ff7dd18b7a7a650af4079bbf940f20fd4253.zip
kernel_samsung_smdk4412-7250ff7dd18b7a7a650af4079bbf940f20fd4253.tar.gz
kernel_samsung_smdk4412-7250ff7dd18b7a7a650af4079bbf940f20fd4253.tar.bz2
mei: add mei_quirk_probe function
commit 9a123f19832702753805afe0e93db26799b91b07 upstream. The main purpose of this function is to exclude ME devices without support for MEI/HECI interface from binding Currently affected systems are C600/X79 based servers that expose PCI device even though it doesn't supported ME Interface. MEI driver accessing such nonfunctional device can corrupt the system. [Backported to 3.2: files were moved] Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/mei/main.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/staging/mei/main.c b/drivers/staging/mei/main.c
index eb05c36..44ed7a8 100644
--- a/drivers/staging/mei/main.c
+++ b/drivers/staging/mei/main.c
@@ -106,6 +106,27 @@ MODULE_DEVICE_TABLE(pci, mei_pci_tbl);
static DEFINE_MUTEX(mei_mutex);
/**
+ * mei_quirk_probe - probe for devices that doesn't valid ME interface
+ * @pdev: PCI device structure
+ * @ent: entry into pci_device_table
+ *
+ * returns true if ME Interface is valid, false otherwise
+ */
+static bool __devinit mei_quirk_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
+{
+ u32 reg;
+ if (ent->device == MEI_DEV_ID_PBG_1) {
+ pci_read_config_dword(pdev, 0x48, &reg);
+ /* make sure that bit 9 is up and bit 10 is down */
+ if ((reg & 0x600) == 0x200) {
+ dev_info(&pdev->dev, "Device doesn't have valid ME Interface\n");
+ return false;
+ }
+ }
+ return true;
+}
+/**
* mei_probe - Device Initialization Routine
*
* @pdev: PCI device structure
@@ -120,6 +141,12 @@ static int __devinit mei_probe(struct pci_dev *pdev,
int err;
mutex_lock(&mei_mutex);
+
+ if (!mei_quirk_probe(pdev, ent)) {
+ err = -ENODEV;
+ goto end;
+ }
+
if (mei_device) {
err = -EEXIST;
goto end;