summary refs log tree commit diff
path: root/drivers/pci
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2010-08-25 21:17:34 +0100
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-09-21 22:35:28 +0100
commiteecfd57f6429d9d8e10be186566ef99fced55163 (patch)
tree35551f0505dbd39820ffd618d225efa058882f3e /drivers/pci
parent9eecabcb9a924f1e11ba670365fd4babe423045c (diff)
downloadlinux-eecfd57f6429d9d8e10be186566ef99fced55163.tar.gz
intel-iommu: Use symbolic values instead of magic numbers in Lenovo w/a
Commit 9eecabcb9a924f1e11ba670365fd4babe423045c ("intel-iommu: Abort 
IOMMU setup for igfx if BIOS gave no shadow GTT space") uses a bunch of 
magic numbers. Provide #defines for those to make it look slightly saner.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/intel-iommu.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index dee88c6cb3ef..4dfce3dad6ab 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -3761,14 +3761,24 @@ static void __devinit quirk_iommu_rwbf(struct pci_dev *dev)
 
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf);
 
+#define GGC 0x52
+#define GGC_MEMORY_SIZE_MASK	(0xf << 8)
+#define GGC_MEMORY_SIZE_NONE	(0x0 << 8)
+#define GGC_MEMORY_SIZE_1M	(0x1 << 8)
+#define GGC_MEMORY_SIZE_2M	(0x3 << 8)
+#define GGC_MEMORY_VT_ENABLED	(0x8 << 8)
+#define GGC_MEMORY_SIZE_2M_VT	(0x9 << 8)
+#define GGC_MEMORY_SIZE_3M_VT	(0xa << 8)
+#define GGC_MEMORY_SIZE_4M_VT	(0xb << 8)
+
 static void __devinit quirk_calpella_no_shadow_gtt(struct pci_dev *dev)
 {
 	unsigned short ggc;
 
-	if (pci_read_config_word(dev, 0x52, &ggc))
+	if (pci_read_config_word(dev, GGC, &ggc))
 		return;
 
-	if (!(ggc & 0x800)) {
+	if (!(ggc & GGC_MEMORY_VT_ENABLED)) {
 		printk(KERN_INFO "DMAR: BIOS has allocated no shadow GTT; disabling IOMMU for graphics\n");
 		dmar_map_gfx = 0;
 	}