diff options
Diffstat (limited to 'drivers/char/agp')
-rw-r--r-- | drivers/char/agp/intel-gtt.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 9c86dac41da..f800e9cfc36 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -73,6 +73,7 @@ struct intel_gtt_driver { | |||
73 | unsigned int is_g33 : 1; | 73 | unsigned int is_g33 : 1; |
74 | unsigned int is_pineview : 1; | 74 | unsigned int is_pineview : 1; |
75 | unsigned int is_ironlake : 1; | 75 | unsigned int is_ironlake : 1; |
76 | unsigned int has_pgtbl_enable : 1; | ||
76 | unsigned int dma_mask_size : 8; | 77 | unsigned int dma_mask_size : 8; |
77 | /* Chipset specific GTT setup */ | 78 | /* Chipset specific GTT setup */ |
78 | int (*setup)(void); | 79 | int (*setup)(void); |
@@ -113,6 +114,7 @@ static struct _intel_private { | |||
113 | #define IS_G33 intel_private.driver->is_g33 | 114 | #define IS_G33 intel_private.driver->is_g33 |
114 | #define IS_PINEVIEW intel_private.driver->is_pineview | 115 | #define IS_PINEVIEW intel_private.driver->is_pineview |
115 | #define IS_IRONLAKE intel_private.driver->is_ironlake | 116 | #define IS_IRONLAKE intel_private.driver->is_ironlake |
117 | #define HAS_PGTBL_EN intel_private.driver->has_pgtbl_enable | ||
116 | 118 | ||
117 | static void intel_agp_free_sglist(struct agp_memory *mem) | 119 | static void intel_agp_free_sglist(struct agp_memory *mem) |
118 | { | 120 | { |
@@ -803,6 +805,9 @@ static int intel_gtt_init(void) | |||
803 | intel_private.PGETBL_save = | 805 | intel_private.PGETBL_save = |
804 | readl(intel_private.registers+I810_PGETBL_CTL) | 806 | readl(intel_private.registers+I810_PGETBL_CTL) |
805 | & ~I810_PGETBL_ENABLED; | 807 | & ~I810_PGETBL_ENABLED; |
808 | /* we only ever restore the register when enabling the PGTBL... */ | ||
809 | if (HAS_PGTBL_EN) | ||
810 | intel_private.PGETBL_save |= I810_PGETBL_ENABLED; | ||
806 | 811 | ||
807 | dev_info(&intel_private.bridge_dev->dev, | 812 | dev_info(&intel_private.bridge_dev->dev, |
808 | "detected gtt size: %dK total, %dK mappable\n", | 813 | "detected gtt size: %dK total, %dK mappable\n", |
@@ -925,7 +930,6 @@ static void i830_write_entry(dma_addr_t addr, unsigned int entry, | |||
925 | static bool intel_enable_gtt(void) | 930 | static bool intel_enable_gtt(void) |
926 | { | 931 | { |
927 | u32 gma_addr; | 932 | u32 gma_addr; |
928 | u16 gmch_ctrl; | ||
929 | u8 __iomem *reg; | 933 | u8 __iomem *reg; |
930 | 934 | ||
931 | if (INTEL_GTT_GEN == 2) | 935 | if (INTEL_GTT_GEN == 2) |
@@ -940,26 +944,30 @@ static bool intel_enable_gtt(void) | |||
940 | if (INTEL_GTT_GEN >= 6) | 944 | if (INTEL_GTT_GEN >= 6) |
941 | return true; | 945 | return true; |
942 | 946 | ||
943 | pci_read_config_word(intel_private.bridge_dev, | 947 | if (INTEL_GTT_GEN == 2) { |
944 | I830_GMCH_CTRL, &gmch_ctrl); | 948 | u16 gmch_ctrl; |
945 | gmch_ctrl |= I830_GMCH_ENABLED; | ||
946 | pci_write_config_word(intel_private.bridge_dev, | ||
947 | I830_GMCH_CTRL, gmch_ctrl); | ||
948 | 949 | ||
949 | pci_read_config_word(intel_private.bridge_dev, | 950 | pci_read_config_word(intel_private.bridge_dev, |
950 | I830_GMCH_CTRL, &gmch_ctrl); | 951 | I830_GMCH_CTRL, &gmch_ctrl); |
951 | if ((gmch_ctrl & I830_GMCH_ENABLED) == 0) { | 952 | gmch_ctrl |= I830_GMCH_ENABLED; |
952 | dev_err(&intel_private.pcidev->dev, | 953 | pci_write_config_word(intel_private.bridge_dev, |
953 | "failed to enable the GTT: GMCH_CTRL=%x\n", | 954 | I830_GMCH_CTRL, gmch_ctrl); |
954 | gmch_ctrl); | 955 | |
955 | return false; | 956 | pci_read_config_word(intel_private.bridge_dev, |
957 | I830_GMCH_CTRL, &gmch_ctrl); | ||
958 | if ((gmch_ctrl & I830_GMCH_ENABLED) == 0) { | ||
959 | dev_err(&intel_private.pcidev->dev, | ||
960 | "failed to enable the GTT: GMCH_CTRL=%x\n", | ||
961 | gmch_ctrl); | ||
962 | return false; | ||
963 | } | ||
956 | } | 964 | } |
957 | 965 | ||
958 | reg = intel_private.registers+I810_PGETBL_CTL; | 966 | reg = intel_private.registers+I810_PGETBL_CTL; |
959 | writel(intel_private.PGETBL_save|I810_PGETBL_ENABLED, reg); | 967 | writel(intel_private.PGETBL_save, reg); |
960 | if ((readl(reg) & I810_PGETBL_ENABLED) == 0) { | 968 | if (HAS_PGTBL_EN && (readl(reg) & I810_PGETBL_ENABLED) == 0) { |
961 | dev_err(&intel_private.pcidev->dev, | 969 | dev_err(&intel_private.pcidev->dev, |
962 | "failed to enable the GTT: PGETBL=%x [expected %x|1]\n", | 970 | "failed to enable the GTT: PGETBL=%x [expected %x]\n", |
963 | readl(reg), intel_private.PGETBL_save); | 971 | readl(reg), intel_private.PGETBL_save); |
964 | return false; | 972 | return false; |
965 | } | 973 | } |
@@ -1395,6 +1403,7 @@ static const struct intel_gtt_driver i81x_gtt_driver = { | |||
1395 | }; | 1403 | }; |
1396 | static const struct intel_gtt_driver i8xx_gtt_driver = { | 1404 | static const struct intel_gtt_driver i8xx_gtt_driver = { |
1397 | .gen = 2, | 1405 | .gen = 2, |
1406 | .has_pgtbl_enable = 1, | ||
1398 | .setup = i830_setup, | 1407 | .setup = i830_setup, |
1399 | .cleanup = i830_cleanup, | 1408 | .cleanup = i830_cleanup, |
1400 | .write_entry = i830_write_entry, | 1409 | .write_entry = i830_write_entry, |
@@ -1404,6 +1413,7 @@ static const struct intel_gtt_driver i8xx_gtt_driver = { | |||
1404 | }; | 1413 | }; |
1405 | static const struct intel_gtt_driver i915_gtt_driver = { | 1414 | static const struct intel_gtt_driver i915_gtt_driver = { |
1406 | .gen = 3, | 1415 | .gen = 3, |
1416 | .has_pgtbl_enable = 1, | ||
1407 | .setup = i9xx_setup, | 1417 | .setup = i9xx_setup, |
1408 | .cleanup = i9xx_cleanup, | 1418 | .cleanup = i9xx_cleanup, |
1409 | /* i945 is the last gpu to need phys mem (for overlay and cursors). */ | 1419 | /* i945 is the last gpu to need phys mem (for overlay and cursors). */ |
@@ -1434,6 +1444,7 @@ static const struct intel_gtt_driver pineview_gtt_driver = { | |||
1434 | }; | 1444 | }; |
1435 | static const struct intel_gtt_driver i965_gtt_driver = { | 1445 | static const struct intel_gtt_driver i965_gtt_driver = { |
1436 | .gen = 4, | 1446 | .gen = 4, |
1447 | .has_pgtbl_enable = 1, | ||
1437 | .setup = i9xx_setup, | 1448 | .setup = i9xx_setup, |
1438 | .cleanup = i9xx_cleanup, | 1449 | .cleanup = i9xx_cleanup, |
1439 | .write_entry = i965_write_entry, | 1450 | .write_entry = i965_write_entry, |