diff options
Diffstat (limited to 'drivers/char/agp/intel-agp.c')
-rw-r--r-- | drivers/char/agp/intel-agp.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index a3e10dc7cc25..aa4248efc5d8 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
6 | #include <linux/pci.h> | 6 | #include <linux/pci.h> |
7 | #include <linux/slab.h> | ||
7 | #include <linux/init.h> | 8 | #include <linux/init.h> |
8 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
9 | #include <linux/pagemap.h> | 10 | #include <linux/pagemap.h> |
@@ -97,6 +98,9 @@ EXPORT_SYMBOL(intel_agp_enabled); | |||
97 | #define IS_PINEVIEW (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB || \ | 98 | #define IS_PINEVIEW (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB || \ |
98 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_HB) | 99 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_HB) |
99 | 100 | ||
101 | #define IS_SNB (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB || \ | ||
102 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB) | ||
103 | |||
100 | #define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_EAGLELAKE_HB || \ | 104 | #define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_EAGLELAKE_HB || \ |
101 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \ | 105 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \ |
102 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \ | 106 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \ |
@@ -107,8 +111,7 @@ EXPORT_SYMBOL(intel_agp_enabled); | |||
107 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB || \ | 111 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB || \ |
108 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB || \ | 112 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB || \ |
109 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB || \ | 113 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB || \ |
110 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB || \ | 114 | IS_SNB) |
111 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB) | ||
112 | 115 | ||
113 | extern int agp_memory_reserved; | 116 | extern int agp_memory_reserved; |
114 | 117 | ||
@@ -175,6 +178,10 @@ extern int agp_memory_reserved; | |||
175 | #define SNB_GMCH_GMS_STOLEN_448M (0xe << 3) | 178 | #define SNB_GMCH_GMS_STOLEN_448M (0xe << 3) |
176 | #define SNB_GMCH_GMS_STOLEN_480M (0xf << 3) | 179 | #define SNB_GMCH_GMS_STOLEN_480M (0xf << 3) |
177 | #define SNB_GMCH_GMS_STOLEN_512M (0x10 << 3) | 180 | #define SNB_GMCH_GMS_STOLEN_512M (0x10 << 3) |
181 | #define SNB_GTT_SIZE_0M (0 << 8) | ||
182 | #define SNB_GTT_SIZE_1M (1 << 8) | ||
183 | #define SNB_GTT_SIZE_2M (2 << 8) | ||
184 | #define SNB_GTT_SIZE_MASK (3 << 8) | ||
178 | 185 | ||
179 | static const struct aper_size_info_fixed intel_i810_sizes[] = | 186 | static const struct aper_size_info_fixed intel_i810_sizes[] = |
180 | { | 187 | { |
@@ -1200,6 +1207,9 @@ static void intel_i9xx_setup_flush(void) | |||
1200 | if (intel_private.ifp_resource.start) | 1207 | if (intel_private.ifp_resource.start) |
1201 | return; | 1208 | return; |
1202 | 1209 | ||
1210 | if (IS_SNB) | ||
1211 | return; | ||
1212 | |||
1203 | /* setup a resource for this object */ | 1213 | /* setup a resource for this object */ |
1204 | intel_private.ifp_resource.name = "Intel Flush Page"; | 1214 | intel_private.ifp_resource.name = "Intel Flush Page"; |
1205 | intel_private.ifp_resource.flags = IORESOURCE_MEM; | 1215 | intel_private.ifp_resource.flags = IORESOURCE_MEM; |
@@ -1438,6 +1448,8 @@ static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge, | |||
1438 | 1448 | ||
1439 | static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size) | 1449 | static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size) |
1440 | { | 1450 | { |
1451 | u16 snb_gmch_ctl; | ||
1452 | |||
1441 | switch (agp_bridge->dev->device) { | 1453 | switch (agp_bridge->dev->device) { |
1442 | case PCI_DEVICE_ID_INTEL_GM45_HB: | 1454 | case PCI_DEVICE_ID_INTEL_GM45_HB: |
1443 | case PCI_DEVICE_ID_INTEL_EAGLELAKE_HB: | 1455 | case PCI_DEVICE_ID_INTEL_EAGLELAKE_HB: |
@@ -1449,9 +1461,26 @@ static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size) | |||
1449 | case PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB: | 1461 | case PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB: |
1450 | case PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB: | 1462 | case PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB: |
1451 | case PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB: | 1463 | case PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB: |
1464 | *gtt_offset = *gtt_size = MB(2); | ||
1465 | break; | ||
1452 | case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB: | 1466 | case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB: |
1453 | case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB: | 1467 | case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB: |
1454 | *gtt_offset = *gtt_size = MB(2); | 1468 | *gtt_offset = MB(2); |
1469 | |||
1470 | pci_read_config_word(intel_private.pcidev, SNB_GMCH_CTRL, &snb_gmch_ctl); | ||
1471 | switch (snb_gmch_ctl & SNB_GTT_SIZE_MASK) { | ||
1472 | default: | ||
1473 | case SNB_GTT_SIZE_0M: | ||
1474 | printk(KERN_ERR "Bad GTT size mask: 0x%04x.\n", snb_gmch_ctl); | ||
1475 | *gtt_size = MB(0); | ||
1476 | break; | ||
1477 | case SNB_GTT_SIZE_1M: | ||
1478 | *gtt_size = MB(1); | ||
1479 | break; | ||
1480 | case SNB_GTT_SIZE_2M: | ||
1481 | *gtt_size = MB(2); | ||
1482 | break; | ||
1483 | } | ||
1455 | break; | 1484 | break; |
1456 | default: | 1485 | default: |
1457 | *gtt_offset = *gtt_size = KB(512); | 1486 | *gtt_offset = *gtt_size = KB(512); |
@@ -1788,8 +1817,6 @@ static int intel_845_configure(void) | |||
1788 | pci_write_config_byte(agp_bridge->dev, INTEL_I845_AGPM, temp2 | (1 << 1)); | 1817 | pci_write_config_byte(agp_bridge->dev, INTEL_I845_AGPM, temp2 | (1 << 1)); |
1789 | /* clear any possible error conditions */ | 1818 | /* clear any possible error conditions */ |
1790 | pci_write_config_word(agp_bridge->dev, INTEL_I845_ERRSTS, 0x001c); | 1819 | pci_write_config_word(agp_bridge->dev, INTEL_I845_ERRSTS, 0x001c); |
1791 | |||
1792 | intel_i830_setup_flush(); | ||
1793 | return 0; | 1820 | return 0; |
1794 | } | 1821 | } |
1795 | 1822 | ||
@@ -2159,7 +2186,6 @@ static const struct agp_bridge_driver intel_845_driver = { | |||
2159 | .agp_destroy_page = agp_generic_destroy_page, | 2186 | .agp_destroy_page = agp_generic_destroy_page, |
2160 | .agp_destroy_pages = agp_generic_destroy_pages, | 2187 | .agp_destroy_pages = agp_generic_destroy_pages, |
2161 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, | 2188 | .agp_type_to_mask_type = agp_generic_type_to_mask_type, |
2162 | .chipset_flush = intel_i830_chipset_flush, | ||
2163 | }; | 2189 | }; |
2164 | 2190 | ||
2165 | static const struct agp_bridge_driver intel_850_driver = { | 2191 | static const struct agp_bridge_driver intel_850_driver = { |