aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp/intel-gtt.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-10-29 13:11:26 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-10-29 15:30:44 -0400
commite380f60b22eddec7825224b8d788572c82b63161 (patch)
tree731ca9b67c0c8cc506924af26f61cf21405c364d /drivers/char/agp/intel-gtt.c
parentc584fe47e4d92934c10e5d7f932ee042587dbcff (diff)
agp/intel: Sandybridge doesn't require GMCH enabling
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/char/agp/intel-gtt.c')
-rw-r--r--drivers/char/agp/intel-gtt.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 5dc1f5db55a7..9c86dac41da7 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -922,10 +922,11 @@ static void i830_write_entry(dma_addr_t addr, unsigned int entry,
922 writel(addr | pte_flags, intel_private.gtt + entry); 922 writel(addr | pte_flags, intel_private.gtt + entry);
923} 923}
924 924
925static void intel_enable_gtt(void) 925static bool intel_enable_gtt(void)
926{ 926{
927 u32 gma_addr; 927 u32 gma_addr;
928 u16 gmch_ctrl; 928 u16 gmch_ctrl;
929 u8 __iomem *reg;
929 930
930 if (INTEL_GTT_GEN == 2) 931 if (INTEL_GTT_GEN == 2)
931 pci_read_config_dword(intel_private.pcidev, I810_GMADDR, 932 pci_read_config_dword(intel_private.pcidev, I810_GMADDR,
@@ -936,13 +937,34 @@ static void intel_enable_gtt(void)
936 937
937 intel_private.gma_bus_addr = (gma_addr & PCI_BASE_ADDRESS_MEM_MASK); 938 intel_private.gma_bus_addr = (gma_addr & PCI_BASE_ADDRESS_MEM_MASK);
938 939
939 pci_read_config_word(intel_private.bridge_dev, I830_GMCH_CTRL, &gmch_ctrl); 940 if (INTEL_GTT_GEN >= 6)
941 return true;
942
943 pci_read_config_word(intel_private.bridge_dev,
944 I830_GMCH_CTRL, &gmch_ctrl);
940 gmch_ctrl |= I830_GMCH_ENABLED; 945 gmch_ctrl |= I830_GMCH_ENABLED;
941 pci_write_config_word(intel_private.bridge_dev, I830_GMCH_CTRL, gmch_ctrl); 946 pci_write_config_word(intel_private.bridge_dev,
947 I830_GMCH_CTRL, gmch_ctrl);
942 948
943 writel(intel_private.PGETBL_save|I810_PGETBL_ENABLED, 949 pci_read_config_word(intel_private.bridge_dev,
944 intel_private.registers+I810_PGETBL_CTL); 950 I830_GMCH_CTRL, &gmch_ctrl);
945 readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ 951 if ((gmch_ctrl & I830_GMCH_ENABLED) == 0) {
952 dev_err(&intel_private.pcidev->dev,
953 "failed to enable the GTT: GMCH_CTRL=%x\n",
954 gmch_ctrl);
955 return false;
956 }
957
958 reg = intel_private.registers+I810_PGETBL_CTL;
959 writel(intel_private.PGETBL_save|I810_PGETBL_ENABLED, reg);
960 if ((readl(reg) & I810_PGETBL_ENABLED) == 0) {
961 dev_err(&intel_private.pcidev->dev,
962 "failed to enable the GTT: PGETBL=%x [expected %x|1]\n",
963 readl(reg), intel_private.PGETBL_save);
964 return false;
965 }
966
967 return true;
946} 968}
947 969
948static int i830_setup(void) 970static int i830_setup(void)
@@ -981,7 +1003,8 @@ static int intel_fake_agp_configure(void)
981{ 1003{
982 int i; 1004 int i;
983 1005
984 intel_enable_gtt(); 1006 if (!intel_enable_gtt())
1007 return -EIO;
985 1008
986 agp_bridge->gart_bus_addr = intel_private.gma_bus_addr; 1009 agp_bridge->gart_bus_addr = intel_private.gma_bus_addr;
987 1010