aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/main.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2012-08-06 08:23:55 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-16 12:40:28 -0400
commit9a123f19832702753805afe0e93db26799b91b07 (patch)
treeef70961cad7389f2ea2bddf89dc11d507effe90a /drivers/misc/mei/main.c
parent07b509b7943e5594f3f228e5b62a49cf6a033709 (diff)
mei: add mei_quirk_probe function
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. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/main.c')
-rw-r--r--drivers/misc/mei/main.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index b0903bd44bf7..86b73e596263 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -906,6 +906,27 @@ static struct miscdevice mei_misc_device = {
906}; 906};
907 907
908/** 908/**
909 * mei_quirk_probe - probe for devices that doesn't valid ME interface
910 * @pdev: PCI device structure
911 * @ent: entry into pci_device_table
912 *
913 * returns true if ME Interface is valid, false otherwise
914 */
915static bool __devinit mei_quirk_probe(struct pci_dev *pdev,
916 const struct pci_device_id *ent)
917{
918 u32 reg;
919 if (ent->device == MEI_DEV_ID_PBG_1) {
920 pci_read_config_dword(pdev, 0x48, &reg);
921 /* make sure that bit 9 is up and bit 10 is down */
922 if ((reg & 0x600) == 0x200) {
923 dev_info(&pdev->dev, "Device doesn't have valid ME Interface\n");
924 return false;
925 }
926 }
927 return true;
928}
929/**
909 * mei_probe - Device Initialization Routine 930 * mei_probe - Device Initialization Routine
910 * 931 *
911 * @pdev: PCI device structure 932 * @pdev: PCI device structure
@@ -920,6 +941,12 @@ static int __devinit mei_probe(struct pci_dev *pdev,
920 int err; 941 int err;
921 942
922 mutex_lock(&mei_mutex); 943 mutex_lock(&mei_mutex);
944
945 if (!mei_quirk_probe(pdev, ent)) {
946 err = -ENODEV;
947 goto end;
948 }
949
923 if (mei_device) { 950 if (mei_device) {
924 err = -EEXIST; 951 err = -EEXIST;
925 goto end; 952 goto end;