Commit 7250ff7d authored by Tomas Winkler's avatar Tomas Winkler Committed by Ben Hutchings

mei: add mei_quirk_probe function

commit 9a123f19 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: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 5debff3f
...@@ -105,6 +105,27 @@ MODULE_DEVICE_TABLE(pci, mei_pci_tbl); ...@@ -105,6 +105,27 @@ MODULE_DEVICE_TABLE(pci, mei_pci_tbl);
static DEFINE_MUTEX(mei_mutex); 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 * mei_probe - Device Initialization Routine
* *
...@@ -120,6 +141,12 @@ static int __devinit mei_probe(struct pci_dev *pdev, ...@@ -120,6 +141,12 @@ static int __devinit mei_probe(struct pci_dev *pdev,
int err; int err;
mutex_lock(&mei_mutex); mutex_lock(&mei_mutex);
if (!mei_quirk_probe(pdev, ent)) {
err = -ENODEV;
goto end;
}
if (mei_device) { if (mei_device) {
err = -EEXIST; err = -EEXIST;
goto end; goto end;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment