aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-09-16 19:32:17 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-21 06:19:45 -0400
commita6c45cf013a57e32ddae43dd4ac911eb4a3919fd (patch)
tree21ce3ea9dcbeb815c92eb0a17377e5061b33151c /drivers
parent219adae138513bae20b256f1946b9cb3b75ca05c (diff)
drm/i915: INTEL_INFO->gen supercedes i8xx, i9xx, i965g
Avoid confusion between i965g meaning broadwater and the gen4+ chipset families. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c11
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c28
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c84
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h18
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c29
-rw-r--r--drivers/gpu/drm/i915/i915_gem_tiling.c30
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c29
-rw-r--r--drivers/gpu/drm/i915/i915_suspend.c24
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c8
-rw-r--r--drivers/gpu/drm/i915/intel_display.c74
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c4
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c10
-rw-r--r--drivers/gpu/drm/i915/intel_overlay.c29
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c4
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c8
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c4
-rw-r--r--drivers/gpu/drm/i915/intel_tv.c4
17 files changed, 197 insertions, 201 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index fb5c2a621907..361a825c2363 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -58,13 +58,9 @@ static int i915_capabilities(struct seq_file *m, void *data)
58 seq_printf(m, "gen: %d\n", info->gen); 58 seq_printf(m, "gen: %d\n", info->gen);
59#define B(x) seq_printf(m, #x ": %s\n", yesno(info->x)) 59#define B(x) seq_printf(m, #x ": %s\n", yesno(info->x))
60 B(is_mobile); 60 B(is_mobile);
61 B(is_i8xx);
62 B(is_i85x); 61 B(is_i85x);
63 B(is_i915g); 62 B(is_i915g);
64 B(is_i9xx);
65 B(is_i945gm); 63 B(is_i945gm);
66 B(is_i965g);
67 B(is_i965gm);
68 B(is_g33); 64 B(is_g33);
69 B(need_gfx_hws); 65 B(need_gfx_hws);
70 B(is_g4x); 66 B(is_g4x);
@@ -79,6 +75,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
79 B(cursor_needs_physical); 75 B(cursor_needs_physical);
80 B(has_overlay); 76 B(has_overlay);
81 B(overlay_needs_physical); 77 B(overlay_needs_physical);
78 B(supports_tv);
82#undef B 79#undef B
83 80
84 return 0; 81 return 0;
@@ -473,7 +470,7 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data)
473 seq_printf(m, "RingHead : %08x\n", head); 470 seq_printf(m, "RingHead : %08x\n", head);
474 seq_printf(m, "RingTail : %08x\n", tail); 471 seq_printf(m, "RingTail : %08x\n", tail);
475 seq_printf(m, "RingSize : %08lx\n", dev_priv->render_ring.size); 472 seq_printf(m, "RingSize : %08lx\n", dev_priv->render_ring.size);
476 seq_printf(m, "Acthd : %08x\n", I915_READ(IS_I965G(dev) ? ACTHD_I965 : ACTHD)); 473 seq_printf(m, "Acthd : %08x\n", I915_READ(INTEL_INFO(dev)->gen >= 4 ? ACTHD_I965 : ACTHD));
477 474
478 return 0; 475 return 0;
479} 476}
@@ -535,7 +532,7 @@ static int i915_error_state(struct seq_file *m, void *unused)
535 seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr); 532 seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr);
536 seq_printf(m, " INSTDONE: 0x%08x\n", error->instdone); 533 seq_printf(m, " INSTDONE: 0x%08x\n", error->instdone);
537 seq_printf(m, " ACTHD: 0x%08x\n", error->acthd); 534 seq_printf(m, " ACTHD: 0x%08x\n", error->acthd);
538 if (IS_I965G(dev)) { 535 if (INTEL_INFO(dev)->gen >= 4) {
539 seq_printf(m, " INSTPS: 0x%08x\n", error->instps); 536 seq_printf(m, " INSTPS: 0x%08x\n", error->instps);
540 seq_printf(m, " INSTDONE1: 0x%08x\n", error->instdone1); 537 seq_printf(m, " INSTDONE1: 0x%08x\n", error->instdone1);
541 } 538 }
@@ -757,7 +754,7 @@ static int i915_sr_status(struct seq_file *m, void *unused)
757 754
758 if (IS_IRONLAKE(dev)) 755 if (IS_IRONLAKE(dev))
759 sr_enabled = I915_READ(WM1_LP_ILK) & WM1_LP_SR_EN; 756 sr_enabled = I915_READ(WM1_LP_ILK) & WM1_LP_SR_EN;
760 else if (IS_I965GM(dev) || IS_I945G(dev) || IS_I945GM(dev)) 757 else if (IS_CRESTLINE(dev) || IS_I945G(dev) || IS_I945GM(dev))
761 sr_enabled = I915_READ(FW_BLC_SELF) & FW_BLC_SELF_EN; 758 sr_enabled = I915_READ(FW_BLC_SELF) & FW_BLC_SELF_EN;
762 else if (IS_I915GM(dev)) 759 else if (IS_I915GM(dev))
763 sr_enabled = I915_READ(INSTPM) & INSTPM_SELF_EN; 760 sr_enabled = I915_READ(INSTPM) & INSTPM_SELF_EN;
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 39aaffe79583..9977a0a5308a 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -63,7 +63,7 @@ static int i915_init_phys_hws(struct drm_device *dev)
63 63
64 memset(dev_priv->render_ring.status_page.page_addr, 0, PAGE_SIZE); 64 memset(dev_priv->render_ring.status_page.page_addr, 0, PAGE_SIZE);
65 65
66 if (IS_I965G(dev)) 66 if (INTEL_INFO(dev)->gen >= 4)
67 dev_priv->dma_status_page |= (dev_priv->dma_status_page >> 28) & 67 dev_priv->dma_status_page |= (dev_priv->dma_status_page >> 28) &
68 0xf0; 68 0xf0;
69 69
@@ -376,7 +376,7 @@ i915_emit_box(struct drm_device *dev,
376 return -EINVAL; 376 return -EINVAL;
377 } 377 }
378 378
379 if (IS_I965G(dev)) { 379 if (INTEL_INFO(dev)->gen >= 4) {
380 BEGIN_LP_RING(4); 380 BEGIN_LP_RING(4);
381 OUT_RING(GFX_OP_DRAWRECT_INFO_I965); 381 OUT_RING(GFX_OP_DRAWRECT_INFO_I965);
382 OUT_RING((box.x1 & 0xffff) | (box.y1 << 16)); 382 OUT_RING((box.x1 & 0xffff) | (box.y1 << 16));
@@ -480,7 +480,7 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev,
480 480
481 if (!IS_I830(dev) && !IS_845G(dev)) { 481 if (!IS_I830(dev) && !IS_845G(dev)) {
482 BEGIN_LP_RING(2); 482 BEGIN_LP_RING(2);
483 if (IS_I965G(dev)) { 483 if (INTEL_INFO(dev)->gen >= 4) {
484 OUT_RING(MI_BATCH_BUFFER_START | (2 << 6) | MI_BATCH_NON_SECURE_I965); 484 OUT_RING(MI_BATCH_BUFFER_START | (2 << 6) | MI_BATCH_NON_SECURE_I965);
485 OUT_RING(batch->start); 485 OUT_RING(batch->start);
486 } else { 486 } else {
@@ -887,12 +887,12 @@ static int
887intel_alloc_mchbar_resource(struct drm_device *dev) 887intel_alloc_mchbar_resource(struct drm_device *dev)
888{ 888{
889 drm_i915_private_t *dev_priv = dev->dev_private; 889 drm_i915_private_t *dev_priv = dev->dev_private;
890 int reg = IS_I965G(dev) ? MCHBAR_I965 : MCHBAR_I915; 890 int reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
891 u32 temp_lo, temp_hi = 0; 891 u32 temp_lo, temp_hi = 0;
892 u64 mchbar_addr; 892 u64 mchbar_addr;
893 int ret; 893 int ret;
894 894
895 if (IS_I965G(dev)) 895 if (INTEL_INFO(dev)->gen >= 4)
896 pci_read_config_dword(dev_priv->bridge_dev, reg + 4, &temp_hi); 896 pci_read_config_dword(dev_priv->bridge_dev, reg + 4, &temp_hi);
897 pci_read_config_dword(dev_priv->bridge_dev, reg, &temp_lo); 897 pci_read_config_dword(dev_priv->bridge_dev, reg, &temp_lo);
898 mchbar_addr = ((u64)temp_hi << 32) | temp_lo; 898 mchbar_addr = ((u64)temp_hi << 32) | temp_lo;
@@ -919,7 +919,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev)
919 return ret; 919 return ret;
920 } 920 }
921 921
922 if (IS_I965G(dev)) 922 if (INTEL_INFO(dev)->gen >= 4)
923 pci_write_config_dword(dev_priv->bridge_dev, reg + 4, 923 pci_write_config_dword(dev_priv->bridge_dev, reg + 4,
924 upper_32_bits(dev_priv->mch_res.start)); 924 upper_32_bits(dev_priv->mch_res.start));
925 925
@@ -933,7 +933,7 @@ static void
933intel_setup_mchbar(struct drm_device *dev) 933intel_setup_mchbar(struct drm_device *dev)
934{ 934{
935 drm_i915_private_t *dev_priv = dev->dev_private; 935 drm_i915_private_t *dev_priv = dev->dev_private;
936 int mchbar_reg = IS_I965G(dev) ? MCHBAR_I965 : MCHBAR_I915; 936 int mchbar_reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
937 u32 temp; 937 u32 temp;
938 bool enabled; 938 bool enabled;
939 939
@@ -970,7 +970,7 @@ static void
970intel_teardown_mchbar(struct drm_device *dev) 970intel_teardown_mchbar(struct drm_device *dev)
971{ 971{
972 drm_i915_private_t *dev_priv = dev->dev_private; 972 drm_i915_private_t *dev_priv = dev->dev_private;
973 int mchbar_reg = IS_I965G(dev) ? MCHBAR_I965 : MCHBAR_I915; 973 int mchbar_reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
974 u32 temp; 974 u32 temp;
975 975
976 if (dev_priv->mchbar_need_disable) { 976 if (dev_priv->mchbar_need_disable) {
@@ -1012,11 +1012,11 @@ static unsigned long i915_gtt_to_phys(struct drm_device *dev,
1012{ 1012{
1013 unsigned long *gtt; 1013 unsigned long *gtt;
1014 unsigned long entry, phys; 1014 unsigned long entry, phys;
1015 int gtt_bar = IS_I9XX(dev) ? 0 : 1; 1015 int gtt_bar = IS_GEN2(dev) ? 1 : 0;
1016 int gtt_offset, gtt_size; 1016 int gtt_offset, gtt_size;
1017 1017
1018 if (IS_I965G(dev)) { 1018 if (INTEL_INFO(dev)->gen >= 4) {
1019 if (IS_G4X(dev) || IS_IRONLAKE(dev) || IS_GEN6(dev)) { 1019 if (IS_G4X(dev) || INTEL_INFO(dev)->gen > 4) {
1020 gtt_offset = 2*1024*1024; 1020 gtt_offset = 2*1024*1024;
1021 gtt_size = 2*1024*1024; 1021 gtt_size = 2*1024*1024;
1022 } else { 1022 } else {
@@ -1041,10 +1041,8 @@ static unsigned long i915_gtt_to_phys(struct drm_device *dev,
1041 DRM_DEBUG_DRIVER("GTT addr: 0x%08lx, PTE: 0x%08lx\n", gtt_addr, entry); 1041 DRM_DEBUG_DRIVER("GTT addr: 0x%08lx, PTE: 0x%08lx\n", gtt_addr, entry);
1042 1042
1043 /* Mask out these reserved bits on this hardware. */ 1043 /* Mask out these reserved bits on this hardware. */
1044 if (!IS_I9XX(dev) || IS_I915G(dev) || IS_I915GM(dev) || 1044 if (INTEL_INFO(dev)->gen < 4 && !IS_G33(dev))
1045 IS_I945G(dev) || IS_I945GM(dev)) {
1046 entry &= ~PTE_ADDRESS_MASK_HIGH; 1045 entry &= ~PTE_ADDRESS_MASK_HIGH;
1047 }
1048 1046
1049 /* If it's not a mapping type we know, then bail. */ 1047 /* If it's not a mapping type we know, then bail. */
1050 if ((entry & PTE_MAPPING_TYPE_MASK) != PTE_MAPPING_TYPE_UNCACHED && 1048 if ((entry & PTE_MAPPING_TYPE_MASK) != PTE_MAPPING_TYPE_UNCACHED &&
@@ -1899,7 +1897,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1899 dev_priv->info = (struct intel_device_info *) flags; 1897 dev_priv->info = (struct intel_device_info *) flags;
1900 1898
1901 /* Add register map (needed for suspend/resume) */ 1899 /* Add register map (needed for suspend/resume) */
1902 mmio_bar = IS_I9XX(dev) ? 0 : 1; 1900 mmio_bar = IS_GEN2(dev) ? 1 : 0;
1903 base = pci_resource_start(dev->pdev, mmio_bar); 1901 base = pci_resource_start(dev->pdev, mmio_bar);
1904 size = pci_resource_len(dev->pdev, mmio_bar); 1902 size = pci_resource_len(dev->pdev, mmio_bar);
1905 1903
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 13dca9da6507..87c6b5f81fea 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -61,97 +61,101 @@ extern int intel_agp_enabled;
61 .driver_data = (unsigned long) info } 61 .driver_data = (unsigned long) info }
62 62
63static const struct intel_device_info intel_i830_info = { 63static const struct intel_device_info intel_i830_info = {
64 .gen = 2, .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1, 64 .gen = 2, .is_mobile = 1, .cursor_needs_physical = 1,
65 .has_overlay = 1, .overlay_needs_physical = 1, 65 .has_overlay = 1, .overlay_needs_physical = 1,
66}; 66};
67 67
68static const struct intel_device_info intel_845g_info = { 68static const struct intel_device_info intel_845g_info = {
69 .gen = 2, .is_i8xx = 1, 69 .gen = 2,
70 .has_overlay = 1, .overlay_needs_physical = 1, 70 .has_overlay = 1, .overlay_needs_physical = 1,
71}; 71};
72 72
73static const struct intel_device_info intel_i85x_info = { 73static const struct intel_device_info intel_i85x_info = {
74 .gen = 2, .is_i8xx = 1, .is_i85x = 1, .is_mobile = 1, 74 .gen = 2, .is_i85x = 1, .is_mobile = 1,
75 .cursor_needs_physical = 1, 75 .cursor_needs_physical = 1,
76 .has_overlay = 1, .overlay_needs_physical = 1, 76 .has_overlay = 1, .overlay_needs_physical = 1,
77}; 77};
78 78
79static const struct intel_device_info intel_i865g_info = { 79static const struct intel_device_info intel_i865g_info = {
80 .gen = 2, .is_i8xx = 1, 80 .gen = 2,
81 .has_overlay = 1, .overlay_needs_physical = 1, 81 .has_overlay = 1, .overlay_needs_physical = 1,
82}; 82};
83 83
84static const struct intel_device_info intel_i915g_info = { 84static const struct intel_device_info intel_i915g_info = {
85 .gen = 3, .is_i915g = 1, .is_i9xx = 1, .cursor_needs_physical = 1, 85 .gen = 3, .is_i915g = 1, .cursor_needs_physical = 1,
86 .has_overlay = 1, .overlay_needs_physical = 1, 86 .has_overlay = 1, .overlay_needs_physical = 1,
87}; 87};
88static const struct intel_device_info intel_i915gm_info = { 88static const struct intel_device_info intel_i915gm_info = {
89 .gen = 3, .is_i9xx = 1, .is_mobile = 1, 89 .gen = 3, .is_mobile = 1,
90 .cursor_needs_physical = 1, 90 .cursor_needs_physical = 1,
91 .has_overlay = 1, .overlay_needs_physical = 1, 91 .has_overlay = 1, .overlay_needs_physical = 1,
92 .supports_tv = 1,
92}; 93};
93static const struct intel_device_info intel_i945g_info = { 94static const struct intel_device_info intel_i945g_info = {
94 .gen = 3, .is_i9xx = 1, .has_hotplug = 1, .cursor_needs_physical = 1, 95 .gen = 3, .has_hotplug = 1, .cursor_needs_physical = 1,
95 .has_overlay = 1, .overlay_needs_physical = 1, 96 .has_overlay = 1, .overlay_needs_physical = 1,
96}; 97};
97static const struct intel_device_info intel_i945gm_info = { 98static const struct intel_device_info intel_i945gm_info = {
98 .gen = 3, .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1, 99 .gen = 3, .is_i945gm = 1, .is_mobile = 1,
99 .has_hotplug = 1, .cursor_needs_physical = 1, 100 .has_hotplug = 1, .cursor_needs_physical = 1,
100 .has_overlay = 1, .overlay_needs_physical = 1, 101 .has_overlay = 1, .overlay_needs_physical = 1,
102 .supports_tv = 1,
101}; 103};
102 104
103static const struct intel_device_info intel_i965g_info = { 105static const struct intel_device_info intel_i965g_info = {
104 .gen = 4, .is_broadwater = 1, .is_i965g = 1, .is_i9xx = 1, 106 .gen = 4, .is_broadwater = 1,
105 .has_hotplug = 1, 107 .has_hotplug = 1,
106 .has_overlay = 1, 108 .has_overlay = 1,
107}; 109};
108 110
109static const struct intel_device_info intel_i965gm_info = { 111static const struct intel_device_info intel_i965gm_info = {
110 .gen = 4, .is_crestline = 1, .is_i965g = 1, .is_i965gm = 1, .is_i9xx = 1, 112 .gen = 4, .is_crestline = 1,
111 .is_mobile = 1, .has_fbc = 1, .has_rc6 = 1, .has_hotplug = 1, 113 .is_mobile = 1, .has_fbc = 1, .has_rc6 = 1, .has_hotplug = 1,
112 .has_overlay = 1, 114 .has_overlay = 1,
115 .supports_tv = 1,
113}; 116};
114 117
115static const struct intel_device_info intel_g33_info = { 118static const struct intel_device_info intel_g33_info = {
116 .gen = 3, .is_g33 = 1, .is_i9xx = 1, 119 .gen = 3, .is_g33 = 1,
117 .need_gfx_hws = 1, .has_hotplug = 1, 120 .need_gfx_hws = 1, .has_hotplug = 1,
118 .has_overlay = 1, 121 .has_overlay = 1,
119}; 122};
120 123
121static const struct intel_device_info intel_g45_info = { 124static const struct intel_device_info intel_g45_info = {
122 .gen = 4, .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, .need_gfx_hws = 1, 125 .gen = 4, .is_g4x = 1, .need_gfx_hws = 1,
123 .has_pipe_cxsr = 1, .has_hotplug = 1, 126 .has_pipe_cxsr = 1, .has_hotplug = 1,
124}; 127};
125 128
126static const struct intel_device_info intel_gm45_info = { 129static const struct intel_device_info intel_gm45_info = {
127 .gen = 4, .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, 130 .gen = 4, .is_g4x = 1,
128 .is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1, 131 .is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1,
129 .has_pipe_cxsr = 1, .has_hotplug = 1, 132 .has_pipe_cxsr = 1, .has_hotplug = 1,
133 .supports_tv = 1,
130}; 134};
131 135
132static const struct intel_device_info intel_pineview_info = { 136static const struct intel_device_info intel_pineview_info = {
133 .gen = 3, .is_g33 = 1, .is_pineview = 1, .is_mobile = 1, .is_i9xx = 1, 137 .gen = 3, .is_g33 = 1, .is_pineview = 1, .is_mobile = 1,
134 .need_gfx_hws = 1, .has_hotplug = 1, 138 .need_gfx_hws = 1, .has_hotplug = 1,
135 .has_overlay = 1, 139 .has_overlay = 1,
136}; 140};
137 141
138static const struct intel_device_info intel_ironlake_d_info = { 142static const struct intel_device_info intel_ironlake_d_info = {
139 .gen = 5, .is_ironlake = 1, .is_i965g = 1, .is_i9xx = 1, 143 .gen = 5, .is_ironlake = 1,
140 .need_gfx_hws = 1, .has_pipe_cxsr = 1, .has_hotplug = 1, 144 .need_gfx_hws = 1, .has_pipe_cxsr = 1, .has_hotplug = 1,
141}; 145};
142 146
143static const struct intel_device_info intel_ironlake_m_info = { 147static const struct intel_device_info intel_ironlake_m_info = {
144 .gen = 5, .is_ironlake = 1, .is_mobile = 1, .is_i965g = 1, .is_i9xx = 1, 148 .gen = 5, .is_ironlake = 1, .is_mobile = 1,
145 .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1, .has_hotplug = 1, 149 .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1, .has_hotplug = 1,
146}; 150};
147 151
148static const struct intel_device_info intel_sandybridge_d_info = { 152static const struct intel_device_info intel_sandybridge_d_info = {
149 .gen = 6, .is_i965g = 1, .is_i9xx = 1, 153 .gen = 6,
150 .need_gfx_hws = 1, .has_hotplug = 1, 154 .need_gfx_hws = 1, .has_hotplug = 1,
151}; 155};
152 156
153static const struct intel_device_info intel_sandybridge_m_info = { 157static const struct intel_device_info intel_sandybridge_m_info = {
154 .gen = 6, .is_i965g = 1, .is_mobile = 1, .is_i9xx = 1, 158 .gen = 6, .is_mobile = 1,
155 .need_gfx_hws = 1, .has_hotplug = 1, 159 .need_gfx_hws = 1, .has_hotplug = 1,
156}; 160};
157 161
@@ -359,33 +363,27 @@ int i965_reset(struct drm_device *dev, u8 flags)
359 if (need_display) 363 if (need_display)
360 i915_save_display(dev); 364 i915_save_display(dev);
361 365
362 if (IS_I965G(dev) || IS_G4X(dev)) { 366 /*
363 /* 367 * Set the domains we want to reset, then the reset bit (bit 0).
364 * Set the domains we want to reset, then the reset bit (bit 0). 368 * Clear the reset bit after a while and wait for hardware status
365 * Clear the reset bit after a while and wait for hardware status 369 * bit (bit 1) to be set
366 * bit (bit 1) to be set 370 */
367 */ 371 pci_read_config_byte(dev->pdev, GDRST, &gdrst);
372 pci_write_config_byte(dev->pdev, GDRST, gdrst | flags | ((flags == GDRST_FULL) ? 0x1 : 0x0));
373 udelay(50);
374 pci_write_config_byte(dev->pdev, GDRST, gdrst & 0xfe);
375
376 /* ...we don't want to loop forever though, 500ms should be plenty */
377 timeout = jiffies + msecs_to_jiffies(500);
378 do {
379 udelay(100);
368 pci_read_config_byte(dev->pdev, GDRST, &gdrst); 380 pci_read_config_byte(dev->pdev, GDRST, &gdrst);
369 pci_write_config_byte(dev->pdev, GDRST, gdrst | flags | ((flags == GDRST_FULL) ? 0x1 : 0x0)); 381 } while ((gdrst & 0x1) && time_after(timeout, jiffies));
370 udelay(50); 382
371 pci_write_config_byte(dev->pdev, GDRST, gdrst & 0xfe); 383 if (gdrst & 0x1) {
372 384 WARN(true, "i915: Failed to reset chip\n");
373 /* ...we don't want to loop forever though, 500ms should be plenty */
374 timeout = jiffies + msecs_to_jiffies(500);
375 do {
376 udelay(100);
377 pci_read_config_byte(dev->pdev, GDRST, &gdrst);
378 } while ((gdrst & 0x1) && time_after(timeout, jiffies));
379
380 if (gdrst & 0x1) {
381 WARN(true, "i915: Failed to reset chip\n");
382 mutex_unlock(&dev->struct_mutex);
383 return -EIO;
384 }
385 } else {
386 DRM_ERROR("Error occurred. Don't know how to reset this chip.\n");
387 mutex_unlock(&dev->struct_mutex); 385 mutex_unlock(&dev->struct_mutex);
388 return -ENODEV; 386 return -EIO;
389 } 387 }
390 388
391 /* Ok, now get things going again... */ 389 /* Ok, now get things going again... */
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index cf08128798a7..4b6aeb5e66b9 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -196,13 +196,9 @@ struct drm_i915_display_funcs {
196struct intel_device_info { 196struct intel_device_info {
197 u8 gen; 197 u8 gen;
198 u8 is_mobile : 1; 198 u8 is_mobile : 1;
199 u8 is_i8xx : 1;
200 u8 is_i85x : 1; 199 u8 is_i85x : 1;
201 u8 is_i915g : 1; 200 u8 is_i915g : 1;
202 u8 is_i9xx : 1;
203 u8 is_i945gm : 1; 201 u8 is_i945gm : 1;
204 u8 is_i965g : 1;
205 u8 is_i965gm : 1;
206 u8 is_g33 : 1; 202 u8 is_g33 : 1;
207 u8 need_gfx_hws : 1; 203 u8 need_gfx_hws : 1;
208 u8 is_g4x : 1; 204 u8 is_g4x : 1;
@@ -217,6 +213,7 @@ struct intel_device_info {
217 u8 cursor_needs_physical : 1; 213 u8 cursor_needs_physical : 1;
218 u8 has_overlay : 1; 214 u8 has_overlay : 1;
219 u8 overlay_needs_physical : 1; 215 u8 overlay_needs_physical : 1;
216 u8 supports_tv : 1;
220}; 217};
221 218
222enum no_fbc_reason { 219enum no_fbc_reason {
@@ -1220,8 +1217,6 @@ static inline void i915_write(struct drm_i915_private *dev_priv, u32 reg,
1220#define IS_I915GM(dev) ((dev)->pci_device == 0x2592) 1217#define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
1221#define IS_I945G(dev) ((dev)->pci_device == 0x2772) 1218#define IS_I945G(dev) ((dev)->pci_device == 0x2772)
1222#define IS_I945GM(dev) (INTEL_INFO(dev)->is_i945gm) 1219#define IS_I945GM(dev) (INTEL_INFO(dev)->is_i945gm)
1223#define IS_I965G(dev) (INTEL_INFO(dev)->is_i965g)
1224#define IS_I965GM(dev) (INTEL_INFO(dev)->is_i965gm)
1225#define IS_BROADWATER(dev) (INTEL_INFO(dev)->is_broadwater) 1220#define IS_BROADWATER(dev) (INTEL_INFO(dev)->is_broadwater)
1226#define IS_CRESTLINE(dev) (INTEL_INFO(dev)->is_crestline) 1221#define IS_CRESTLINE(dev) (INTEL_INFO(dev)->is_crestline)
1227#define IS_GM45(dev) ((dev)->pci_device == 0x2A42) 1222#define IS_GM45(dev) ((dev)->pci_device == 0x2A42)
@@ -1233,7 +1228,6 @@ static inline void i915_write(struct drm_i915_private *dev_priv, u32 reg,
1233#define IS_IRONLAKE_D(dev) ((dev)->pci_device == 0x0042) 1228#define IS_IRONLAKE_D(dev) ((dev)->pci_device == 0x0042)
1234#define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046) 1229#define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046)
1235#define IS_IRONLAKE(dev) (INTEL_INFO(dev)->is_ironlake) 1230#define IS_IRONLAKE(dev) (INTEL_INFO(dev)->is_ironlake)
1236#define IS_I9XX(dev) (INTEL_INFO(dev)->is_i9xx)
1237#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile) 1231#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
1238 1232
1239#define IS_GEN2(dev) (INTEL_INFO(dev)->gen == 2) 1233#define IS_GEN2(dev) (INTEL_INFO(dev)->gen == 2)
@@ -1251,20 +1245,18 @@ static inline void i915_write(struct drm_i915_private *dev_priv, u32 reg,
1251/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte 1245/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
1252 * rows, which changed the alignment requirements and fence programming. 1246 * rows, which changed the alignment requirements and fence programming.
1253 */ 1247 */
1254#define HAS_128_BYTE_Y_TILING(dev) (IS_I9XX(dev) && !(IS_I915G(dev) || \ 1248#define HAS_128_BYTE_Y_TILING(dev) (!IS_GEN2(dev) && !(IS_I915G(dev) || \
1255 IS_I915GM(dev))) 1249 IS_I915GM(dev)))
1256#define SUPPORTS_DIGITAL_OUTPUTS(dev) (IS_I9XX(dev) && !IS_PINEVIEW(dev)) 1250#define SUPPORTS_DIGITAL_OUTPUTS(dev) (!IS_GEN2(dev) && !IS_PINEVIEW(dev))
1257#define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IRONLAKE(dev)) 1251#define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IRONLAKE(dev))
1258#define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IRONLAKE(dev)) 1252#define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IRONLAKE(dev))
1259#define SUPPORTS_EDP(dev) (IS_IRONLAKE_M(dev)) 1253#define SUPPORTS_EDP(dev) (IS_IRONLAKE_M(dev))
1260#define SUPPORTS_TV(dev) (IS_I9XX(dev) && IS_MOBILE(dev) && \ 1254#define SUPPORTS_TV(dev) (INTEL_INFO(dev)->supports_tv)
1261 !IS_IRONLAKE(dev) && !IS_PINEVIEW(dev) && \
1262 !IS_GEN6(dev))
1263#define I915_HAS_HOTPLUG(dev) (INTEL_INFO(dev)->has_hotplug) 1255#define I915_HAS_HOTPLUG(dev) (INTEL_INFO(dev)->has_hotplug)
1264/* dsparb controlled by hw only */ 1256/* dsparb controlled by hw only */
1265#define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev)) 1257#define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev))
1266 1258
1267#define HAS_FW_BLC(dev) (IS_I9XX(dev) || IS_G4X(dev) || IS_IRONLAKE(dev)) 1259#define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2)
1268#define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr) 1260#define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
1269#define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc) 1261#define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
1270#define I915_HAS_RC6(dev) (INTEL_INFO(dev)->has_rc6) 1262#define I915_HAS_RC6(dev) (INTEL_INFO(dev)->has_rc6)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 0355cd28b270..71a2723545b9 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1346,14 +1346,14 @@ i915_gem_get_gtt_alignment(struct drm_gem_object *obj)
1346 * Minimum alignment is 4k (GTT page size), but might be greater 1346 * Minimum alignment is 4k (GTT page size), but might be greater
1347 * if a fence register is needed for the object. 1347 * if a fence register is needed for the object.
1348 */ 1348 */
1349 if (IS_I965G(dev) || obj_priv->tiling_mode == I915_TILING_NONE) 1349 if (INTEL_INFO(dev)->gen >= 4 || obj_priv->tiling_mode == I915_TILING_NONE)
1350 return 4096; 1350 return 4096;
1351 1351
1352 /* 1352 /*
1353 * Previous chips need to be aligned to the size of the smallest 1353 * Previous chips need to be aligned to the size of the smallest
1354 * fence register that can contain the object. 1354 * fence register that can contain the object.
1355 */ 1355 */
1356 if (IS_I9XX(dev)) 1356 if (INTEL_INFO(dev)->gen == 3)
1357 start = 1024*1024; 1357 start = 1024*1024;
1358 else 1358 else
1359 start = 512*1024; 1359 start = 512*1024;
@@ -1660,7 +1660,7 @@ i915_retire_commands(struct drm_device *dev, struct intel_ring_buffer *ring)
1660 uint32_t flush_domains = 0; 1660 uint32_t flush_domains = 0;
1661 1661
1662 /* The sampler always gets flushed on i965 (sigh) */ 1662 /* The sampler always gets flushed on i965 (sigh) */
1663 if (IS_I965G(dev)) 1663 if (INTEL_INFO(dev)->gen >= 4)
1664 flush_domains |= I915_GEM_DOMAIN_SAMPLER; 1664 flush_domains |= I915_GEM_DOMAIN_SAMPLER;
1665 1665
1666 ring->flush(dev, ring, 1666 ring->flush(dev, ring,
@@ -2443,7 +2443,7 @@ i915_gem_object_put_fence_reg(struct drm_gem_object *obj,
2443 * therefore we must wait for any outstanding access to complete 2443 * therefore we must wait for any outstanding access to complete
2444 * before clearing the fence. 2444 * before clearing the fence.
2445 */ 2445 */
2446 if (!IS_I965G(dev)) { 2446 if (INTEL_INFO(dev)->gen < 4) {
2447 int ret; 2447 int ret;
2448 2448
2449 ret = i915_gem_object_flush_gpu_write_domain(obj, true); 2449 ret = i915_gem_object_flush_gpu_write_domain(obj, true);
@@ -3893,7 +3893,7 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
3893 exec2_list[i].relocs_ptr = exec_list[i].relocs_ptr; 3893 exec2_list[i].relocs_ptr = exec_list[i].relocs_ptr;
3894 exec2_list[i].alignment = exec_list[i].alignment; 3894 exec2_list[i].alignment = exec_list[i].alignment;
3895 exec2_list[i].offset = exec_list[i].offset; 3895 exec2_list[i].offset = exec_list[i].offset;
3896 if (!IS_I965G(dev)) 3896 if (INTEL_INFO(dev)->gen < 4)
3897 exec2_list[i].flags = EXEC_OBJECT_NEEDS_FENCE; 3897 exec2_list[i].flags = EXEC_OBJECT_NEEDS_FENCE;
3898 else 3898 else
3899 exec2_list[i].flags = 0; 3899 exec2_list[i].flags = 0;
@@ -4614,21 +4614,30 @@ i915_gem_load(struct drm_device *dev)
4614 if (!drm_core_check_feature(dev, DRIVER_MODESET)) 4614 if (!drm_core_check_feature(dev, DRIVER_MODESET))
4615 dev_priv->fence_reg_start = 3; 4615 dev_priv->fence_reg_start = 3;
4616 4616
4617 if (IS_I965G(dev) || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) 4617 if (INTEL_INFO(dev)->gen >= 4 || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
4618 dev_priv->num_fence_regs = 16; 4618 dev_priv->num_fence_regs = 16;
4619 else 4619 else
4620 dev_priv->num_fence_regs = 8; 4620 dev_priv->num_fence_regs = 8;
4621 4621
4622 /* Initialize fence registers to zero */ 4622 /* Initialize fence registers to zero */
4623 if (IS_I965G(dev)) { 4623 switch (INTEL_INFO(dev)->gen) {
4624 case 6:
4625 for (i = 0; i < 16; i++)
4626 I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + (i * 8), 0);
4627 break;
4628 case 5:
4629 case 4:
4624 for (i = 0; i < 16; i++) 4630 for (i = 0; i < 16; i++)
4625 I915_WRITE64(FENCE_REG_965_0 + (i * 8), 0); 4631 I915_WRITE64(FENCE_REG_965_0 + (i * 8), 0);
4626 } else { 4632 break;
4627 for (i = 0; i < 8; i++) 4633 case 3:
4628 I915_WRITE(FENCE_REG_830_0 + (i * 4), 0);
4629 if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) 4634 if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
4630 for (i = 0; i < 8; i++) 4635 for (i = 0; i < 8; i++)
4631 I915_WRITE(FENCE_REG_945_8 + (i * 4), 0); 4636 I915_WRITE(FENCE_REG_945_8 + (i * 4), 0);
4637 case 2:
4638 for (i = 0; i < 8; i++)
4639 I915_WRITE(FENCE_REG_830_0 + (i * 4), 0);
4640 break;
4632 } 4641 }
4633 i915_gem_detect_bit_6_swizzle(dev); 4642 i915_gem_detect_bit_6_swizzle(dev);
4634 init_waitqueue_head(&dev_priv->pending_flip_queue); 4643 init_waitqueue_head(&dev_priv->pending_flip_queue);
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index caef7ff2aa39..b09b157f6ada 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -98,7 +98,7 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
98 */ 98 */
99 swizzle_x = I915_BIT_6_SWIZZLE_9_10; 99 swizzle_x = I915_BIT_6_SWIZZLE_9_10;
100 swizzle_y = I915_BIT_6_SWIZZLE_9; 100 swizzle_y = I915_BIT_6_SWIZZLE_9;
101 } else if (!IS_I9XX(dev)) { 101 } else if (IS_GEN2(dev)) {
102 /* As far as we know, the 865 doesn't have these bit 6 102 /* As far as we know, the 865 doesn't have these bit 6
103 * swizzling issues. 103 * swizzling issues.
104 */ 104 */
@@ -190,19 +190,19 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
190 if (tiling_mode == I915_TILING_NONE) 190 if (tiling_mode == I915_TILING_NONE)
191 return true; 191 return true;
192 192
193 if (!IS_I9XX(dev) || 193 if (IS_GEN2(dev) ||
194 (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev))) 194 (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev)))
195 tile_width = 128; 195 tile_width = 128;
196 else 196 else
197 tile_width = 512; 197 tile_width = 512;
198 198
199 /* check maximum stride & object size */ 199 /* check maximum stride & object size */
200 if (IS_I965G(dev)) { 200 if (INTEL_INFO(dev)->gen >= 4) {
201 /* i965 stores the end address of the gtt mapping in the fence 201 /* i965 stores the end address of the gtt mapping in the fence
202 * reg, so dont bother to check the size */ 202 * reg, so dont bother to check the size */
203 if (stride / 128 > I965_FENCE_MAX_PITCH_VAL) 203 if (stride / 128 > I965_FENCE_MAX_PITCH_VAL)
204 return false; 204 return false;
205 } else if (IS_GEN3(dev) || IS_GEN2(dev)) { 205 } else {
206 if (stride > 8192) 206 if (stride > 8192)
207 return false; 207 return false;
208 208
@@ -216,7 +216,7 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
216 } 216 }
217 217
218 /* 965+ just needs multiples of tile width */ 218 /* 965+ just needs multiples of tile width */
219 if (IS_I965G(dev)) { 219 if (INTEL_INFO(dev)->gen >= 4) {
220 if (stride & (tile_width - 1)) 220 if (stride & (tile_width - 1))
221 return false; 221 return false;
222 return true; 222 return true;
@@ -244,16 +244,18 @@ i915_gem_object_fence_offset_ok(struct drm_gem_object *obj, int tiling_mode)
244 if (tiling_mode == I915_TILING_NONE) 244 if (tiling_mode == I915_TILING_NONE)
245 return true; 245 return true;
246 246
247 if (!IS_I965G(dev)) { 247 if (INTEL_INFO(dev)->gen >= 4)
248 if (obj_priv->gtt_offset & (obj->size - 1)) 248 return true;
249
250 if (obj_priv->gtt_offset & (obj->size - 1))
251 return false;
252
253 if (IS_GEN3(dev)) {
254 if (obj_priv->gtt_offset & ~I915_FENCE_START_MASK)
255 return false;
256 } else {
257 if (obj_priv->gtt_offset & ~I830_FENCE_START_MASK)
249 return false; 258 return false;
250 if (IS_I9XX(dev)) {
251 if (obj_priv->gtt_offset & ~I915_FENCE_START_MASK)
252 return false;
253 } else {
254 if (obj_priv->gtt_offset & ~I830_FENCE_START_MASK)
255 return false;
256 }
257 } 259 }
258 260
259 return true; 261 return true;
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index e64b8eaa0b9d..2b5e54c2900f 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -172,7 +172,7 @@ void intel_enable_asle (struct drm_device *dev)
172 else { 172 else {
173 i915_enable_pipestat(dev_priv, 1, 173 i915_enable_pipestat(dev_priv, 1,
174 PIPE_LEGACY_BLC_EVENT_ENABLE); 174 PIPE_LEGACY_BLC_EVENT_ENABLE);
175 if (IS_I965G(dev)) 175 if (INTEL_INFO(dev)->gen >= 4)
176 i915_enable_pipestat(dev_priv, 0, 176 i915_enable_pipestat(dev_priv, 0,
177 PIPE_LEGACY_BLC_EVENT_ENABLE); 177 PIPE_LEGACY_BLC_EVENT_ENABLE);
178 } 178 }
@@ -397,15 +397,18 @@ static void i915_error_work_func(struct work_struct *work)
397 kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, error_event); 397 kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, error_event);
398 398
399 if (atomic_read(&dev_priv->mm.wedged)) { 399 if (atomic_read(&dev_priv->mm.wedged)) {
400 if (IS_I965G(dev)) { 400 switch (INTEL_INFO(dev)->gen) {
401 case 4:
401 DRM_DEBUG_DRIVER("resetting chip\n"); 402 DRM_DEBUG_DRIVER("resetting chip\n");
402 kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, reset_event); 403 kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, reset_event);
403 if (!i965_reset(dev, GDRST_RENDER)) { 404 if (!i965_reset(dev, GDRST_RENDER)) {
404 atomic_set(&dev_priv->mm.wedged, 0); 405 atomic_set(&dev_priv->mm.wedged, 0);
405 kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, reset_done_event); 406 kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, reset_done_event);
406 } 407 }
407 } else { 408 break;
409 default:
408 DRM_DEBUG_DRIVER("reboot required\n"); 410 DRM_DEBUG_DRIVER("reboot required\n");
411 break;
409 } 412 }
410 } 413 }
411} 414}
@@ -501,7 +504,7 @@ i915_get_bbaddr(struct drm_device *dev, u32 *ring)
501 504
502 if (IS_I830(dev) || IS_845G(dev)) 505 if (IS_I830(dev) || IS_845G(dev))
503 cmd = MI_BATCH_BUFFER; 506 cmd = MI_BATCH_BUFFER;
504 else if (IS_I965G(dev)) 507 else if (INTEL_INFO(dev)->gen >= 4)
505 cmd = (MI_BATCH_BUFFER_START | (2 << 6) | 508 cmd = (MI_BATCH_BUFFER_START | (2 << 6) |
506 MI_BATCH_NON_SECURE_I965); 509 MI_BATCH_NON_SECURE_I965);
507 else 510 else
@@ -580,7 +583,7 @@ static void i915_capture_error_state(struct drm_device *dev)
580 error->pipeastat = I915_READ(PIPEASTAT); 583 error->pipeastat = I915_READ(PIPEASTAT);
581 error->pipebstat = I915_READ(PIPEBSTAT); 584 error->pipebstat = I915_READ(PIPEBSTAT);
582 error->instpm = I915_READ(INSTPM); 585 error->instpm = I915_READ(INSTPM);
583 if (!IS_I965G(dev)) { 586 if (INTEL_INFO(dev)->gen < 4) {
584 error->ipeir = I915_READ(IPEIR); 587 error->ipeir = I915_READ(IPEIR);
585 error->ipehr = I915_READ(IPEHR); 588 error->ipehr = I915_READ(IPEHR);
586 error->instdone = I915_READ(INSTDONE); 589 error->instdone = I915_READ(INSTDONE);
@@ -778,7 +781,7 @@ static void i915_report_and_clear_eir(struct drm_device *dev)
778 } 781 }
779 } 782 }
780 783
781 if (IS_I9XX(dev)) { 784 if (!IS_GEN2(dev)) {
782 if (eir & I915_ERROR_PAGE_TABLE) { 785 if (eir & I915_ERROR_PAGE_TABLE) {
783 u32 pgtbl_err = I915_READ(PGTBL_ER); 786 u32 pgtbl_err = I915_READ(PGTBL_ER);
784 printk(KERN_ERR "page table error\n"); 787 printk(KERN_ERR "page table error\n");
@@ -804,7 +807,7 @@ static void i915_report_and_clear_eir(struct drm_device *dev)
804 printk(KERN_ERR "instruction error\n"); 807 printk(KERN_ERR "instruction error\n");
805 printk(KERN_ERR " INSTPM: 0x%08x\n", 808 printk(KERN_ERR " INSTPM: 0x%08x\n",
806 I915_READ(INSTPM)); 809 I915_READ(INSTPM));
807 if (!IS_I965G(dev)) { 810 if (INTEL_INFO(dev)->gen < 4) {
808 u32 ipeir = I915_READ(IPEIR); 811 u32 ipeir = I915_READ(IPEIR);
809 812
810 printk(KERN_ERR " IPEIR: 0x%08x\n", 813 printk(KERN_ERR " IPEIR: 0x%08x\n",
@@ -905,7 +908,7 @@ static void i915_pageflip_stall_check(struct drm_device *dev, int pipe)
905 908
906 /* Potential stall - if we see that the flip has happened, assume a missed interrupt */ 909 /* Potential stall - if we see that the flip has happened, assume a missed interrupt */
907 obj_priv = to_intel_bo(work->pending_flip_obj); 910 obj_priv = to_intel_bo(work->pending_flip_obj);
908 if(IS_I965G(dev)) { 911 if (INTEL_INFO(dev)->gen >= 4) {
909 int dspsurf = intel_crtc->plane == 0 ? DSPASURF : DSPBSURF; 912 int dspsurf = intel_crtc->plane == 0 ? DSPASURF : DSPBSURF;
910 stall_detected = I915_READ(dspsurf) == obj_priv->gtt_offset; 913 stall_detected = I915_READ(dspsurf) == obj_priv->gtt_offset;
911 } else { 914 } else {
@@ -944,7 +947,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
944 947
945 iir = I915_READ(IIR); 948 iir = I915_READ(IIR);
946 949
947 if (IS_I965G(dev)) 950 if (INTEL_INFO(dev)->gen >= 4)
948 vblank_status = PIPE_START_VBLANK_INTERRUPT_STATUS; 951 vblank_status = PIPE_START_VBLANK_INTERRUPT_STATUS;
949 else 952 else
950 vblank_status = PIPE_VBLANK_INTERRUPT_STATUS; 953 vblank_status = PIPE_VBLANK_INTERRUPT_STATUS;
@@ -1209,7 +1212,7 @@ int i915_enable_vblank(struct drm_device *dev, int pipe)
1209 if (HAS_PCH_SPLIT(dev)) 1212 if (HAS_PCH_SPLIT(dev))
1210 ironlake_enable_display_irq(dev_priv, (pipe == 0) ? 1213 ironlake_enable_display_irq(dev_priv, (pipe == 0) ?
1211 DE_PIPEA_VBLANK: DE_PIPEB_VBLANK); 1214 DE_PIPEA_VBLANK: DE_PIPEB_VBLANK);
1212 else if (IS_I965G(dev)) 1215 else if (INTEL_INFO(dev)->gen >= 4)
1213 i915_enable_pipestat(dev_priv, pipe, 1216 i915_enable_pipestat(dev_priv, pipe,
1214 PIPE_START_VBLANK_INTERRUPT_ENABLE); 1217 PIPE_START_VBLANK_INTERRUPT_ENABLE);
1215 else 1218 else
@@ -1322,11 +1325,7 @@ void i915_hangcheck_elapsed(unsigned long data)
1322 drm_i915_private_t *dev_priv = dev->dev_private; 1325 drm_i915_private_t *dev_priv = dev->dev_private;
1323 uint32_t acthd, instdone, instdone1; 1326 uint32_t acthd, instdone, instdone1;
1324 1327
1325 /* No reset support on this chip yet. */ 1328 if (INTEL_INFO(dev)->gen < 4) {
1326 if (IS_GEN6(dev))
1327 return;
1328
1329 if (!IS_I965G(dev)) {
1330 acthd = I915_READ(ACTHD); 1329 acthd = I915_READ(ACTHD);
1331 instdone = I915_READ(INSTDONE); 1330 instdone = I915_READ(INSTDONE);
1332 instdone1 = 0; 1331 instdone1 = 0;
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 967dcde312b2..989c19d2d959 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -256,7 +256,7 @@ static void i915_save_modeset_reg(struct drm_device *dev)
256 dev_priv->saveFPA1 = I915_READ(FPA1); 256 dev_priv->saveFPA1 = I915_READ(FPA1);
257 dev_priv->saveDPLL_A = I915_READ(DPLL_A); 257 dev_priv->saveDPLL_A = I915_READ(DPLL_A);
258 } 258 }
259 if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) 259 if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev))
260 dev_priv->saveDPLL_A_MD = I915_READ(DPLL_A_MD); 260 dev_priv->saveDPLL_A_MD = I915_READ(DPLL_A_MD);
261 dev_priv->saveHTOTAL_A = I915_READ(HTOTAL_A); 261 dev_priv->saveHTOTAL_A = I915_READ(HTOTAL_A);
262 dev_priv->saveHBLANK_A = I915_READ(HBLANK_A); 262 dev_priv->saveHBLANK_A = I915_READ(HBLANK_A);
@@ -294,7 +294,7 @@ static void i915_save_modeset_reg(struct drm_device *dev)
294 dev_priv->saveDSPASIZE = I915_READ(DSPASIZE); 294 dev_priv->saveDSPASIZE = I915_READ(DSPASIZE);
295 dev_priv->saveDSPAPOS = I915_READ(DSPAPOS); 295 dev_priv->saveDSPAPOS = I915_READ(DSPAPOS);
296 dev_priv->saveDSPAADDR = I915_READ(DSPAADDR); 296 dev_priv->saveDSPAADDR = I915_READ(DSPAADDR);
297 if (IS_I965G(dev)) { 297 if (INTEL_INFO(dev)->gen >= 4) {
298 dev_priv->saveDSPASURF = I915_READ(DSPASURF); 298 dev_priv->saveDSPASURF = I915_READ(DSPASURF);
299 dev_priv->saveDSPATILEOFF = I915_READ(DSPATILEOFF); 299 dev_priv->saveDSPATILEOFF = I915_READ(DSPATILEOFF);
300 } 300 }
@@ -313,7 +313,7 @@ static void i915_save_modeset_reg(struct drm_device *dev)
313 dev_priv->saveFPB1 = I915_READ(FPB1); 313 dev_priv->saveFPB1 = I915_READ(FPB1);
314 dev_priv->saveDPLL_B = I915_READ(DPLL_B); 314 dev_priv->saveDPLL_B = I915_READ(DPLL_B);
315 } 315 }
316 if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) 316 if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev))
317 dev_priv->saveDPLL_B_MD = I915_READ(DPLL_B_MD); 317 dev_priv->saveDPLL_B_MD = I915_READ(DPLL_B_MD);
318 dev_priv->saveHTOTAL_B = I915_READ(HTOTAL_B); 318 dev_priv->saveHTOTAL_B = I915_READ(HTOTAL_B);
319 dev_priv->saveHBLANK_B = I915_READ(HBLANK_B); 319 dev_priv->saveHBLANK_B = I915_READ(HBLANK_B);
@@ -351,7 +351,7 @@ static void i915_save_modeset_reg(struct drm_device *dev)
351 dev_priv->saveDSPBSIZE = I915_READ(DSPBSIZE); 351 dev_priv->saveDSPBSIZE = I915_READ(DSPBSIZE);
352 dev_priv->saveDSPBPOS = I915_READ(DSPBPOS); 352 dev_priv->saveDSPBPOS = I915_READ(DSPBPOS);
353 dev_priv->saveDSPBADDR = I915_READ(DSPBADDR); 353 dev_priv->saveDSPBADDR = I915_READ(DSPBADDR);
354 if (IS_I965GM(dev) || IS_GM45(dev)) { 354 if (INTEL_INFO(dev)->gen >= 4) {
355 dev_priv->saveDSPBSURF = I915_READ(DSPBSURF); 355 dev_priv->saveDSPBSURF = I915_READ(DSPBSURF);
356 dev_priv->saveDSPBTILEOFF = I915_READ(DSPBTILEOFF); 356 dev_priv->saveDSPBTILEOFF = I915_READ(DSPBTILEOFF);
357 } 357 }
@@ -404,7 +404,7 @@ static void i915_restore_modeset_reg(struct drm_device *dev)
404 I915_WRITE(dpll_a_reg, dev_priv->saveDPLL_A); 404 I915_WRITE(dpll_a_reg, dev_priv->saveDPLL_A);
405 POSTING_READ(dpll_a_reg); 405 POSTING_READ(dpll_a_reg);
406 udelay(150); 406 udelay(150);
407 if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) { 407 if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
408 I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD); 408 I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD);
409 POSTING_READ(DPLL_A_MD); 409 POSTING_READ(DPLL_A_MD);
410 } 410 }
@@ -448,7 +448,7 @@ static void i915_restore_modeset_reg(struct drm_device *dev)
448 I915_WRITE(PIPEASRC, dev_priv->savePIPEASRC); 448 I915_WRITE(PIPEASRC, dev_priv->savePIPEASRC);
449 I915_WRITE(DSPAADDR, dev_priv->saveDSPAADDR); 449 I915_WRITE(DSPAADDR, dev_priv->saveDSPAADDR);
450 I915_WRITE(DSPASTRIDE, dev_priv->saveDSPASTRIDE); 450 I915_WRITE(DSPASTRIDE, dev_priv->saveDSPASTRIDE);
451 if (IS_I965G(dev)) { 451 if (INTEL_INFO(dev)->gen >= 4) {
452 I915_WRITE(DSPASURF, dev_priv->saveDSPASURF); 452 I915_WRITE(DSPASURF, dev_priv->saveDSPASURF);
453 I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF); 453 I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF);
454 } 454 }
@@ -473,7 +473,7 @@ static void i915_restore_modeset_reg(struct drm_device *dev)
473 I915_WRITE(dpll_b_reg, dev_priv->saveDPLL_B); 473 I915_WRITE(dpll_b_reg, dev_priv->saveDPLL_B);
474 POSTING_READ(dpll_b_reg); 474 POSTING_READ(dpll_b_reg);
475 udelay(150); 475 udelay(150);
476 if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) { 476 if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
477 I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD); 477 I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD);
478 POSTING_READ(DPLL_B_MD); 478 POSTING_READ(DPLL_B_MD);
479 } 479 }
@@ -517,7 +517,7 @@ static void i915_restore_modeset_reg(struct drm_device *dev)
517 I915_WRITE(PIPEBSRC, dev_priv->savePIPEBSRC); 517 I915_WRITE(PIPEBSRC, dev_priv->savePIPEBSRC);
518 I915_WRITE(DSPBADDR, dev_priv->saveDSPBADDR); 518 I915_WRITE(DSPBADDR, dev_priv->saveDSPBADDR);
519 I915_WRITE(DSPBSTRIDE, dev_priv->saveDSPBSTRIDE); 519 I915_WRITE(DSPBSTRIDE, dev_priv->saveDSPBSTRIDE);
520 if (IS_I965G(dev)) { 520 if (INTEL_INFO(dev)->gen >= 4) {
521 I915_WRITE(DSPBSURF, dev_priv->saveDSPBSURF); 521 I915_WRITE(DSPBSURF, dev_priv->saveDSPBSURF);
522 I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF); 522 I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF);
523 } 523 }
@@ -550,7 +550,7 @@ void i915_save_display(struct drm_device *dev)
550 dev_priv->saveCURBCNTR = I915_READ(CURBCNTR); 550 dev_priv->saveCURBCNTR = I915_READ(CURBCNTR);
551 dev_priv->saveCURBPOS = I915_READ(CURBPOS); 551 dev_priv->saveCURBPOS = I915_READ(CURBPOS);
552 dev_priv->saveCURBBASE = I915_READ(CURBBASE); 552 dev_priv->saveCURBBASE = I915_READ(CURBBASE);
553 if (!IS_I9XX(dev)) 553 if (IS_GEN2(dev))
554 dev_priv->saveCURSIZE = I915_READ(CURSIZE); 554 dev_priv->saveCURSIZE = I915_READ(CURSIZE);
555 555
556 /* CRT state */ 556 /* CRT state */
@@ -573,7 +573,7 @@ void i915_save_display(struct drm_device *dev)
573 dev_priv->savePFIT_PGM_RATIOS = I915_READ(PFIT_PGM_RATIOS); 573 dev_priv->savePFIT_PGM_RATIOS = I915_READ(PFIT_PGM_RATIOS);
574 dev_priv->saveBLC_PWM_CTL = I915_READ(BLC_PWM_CTL); 574 dev_priv->saveBLC_PWM_CTL = I915_READ(BLC_PWM_CTL);
575 dev_priv->saveBLC_HIST_CTL = I915_READ(BLC_HIST_CTL); 575 dev_priv->saveBLC_HIST_CTL = I915_READ(BLC_HIST_CTL);
576 if (IS_I965G(dev)) 576 if (INTEL_INFO(dev)->gen >= 4)
577 dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2); 577 dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2);
578 if (IS_MOBILE(dev) && !IS_I830(dev)) 578 if (IS_MOBILE(dev) && !IS_I830(dev))
579 dev_priv->saveLVDS = I915_READ(LVDS); 579 dev_priv->saveLVDS = I915_READ(LVDS);
@@ -664,7 +664,7 @@ void i915_restore_display(struct drm_device *dev)
664 I915_WRITE(CURBPOS, dev_priv->saveCURBPOS); 664 I915_WRITE(CURBPOS, dev_priv->saveCURBPOS);
665 I915_WRITE(CURBCNTR, dev_priv->saveCURBCNTR); 665 I915_WRITE(CURBCNTR, dev_priv->saveCURBCNTR);
666 I915_WRITE(CURBBASE, dev_priv->saveCURBBASE); 666 I915_WRITE(CURBBASE, dev_priv->saveCURBBASE);
667 if (!IS_I9XX(dev)) 667 if (IS_GEN2(dev))
668 I915_WRITE(CURSIZE, dev_priv->saveCURSIZE); 668 I915_WRITE(CURSIZE, dev_priv->saveCURSIZE);
669 669
670 /* CRT state */ 670 /* CRT state */
@@ -674,7 +674,7 @@ void i915_restore_display(struct drm_device *dev)
674 I915_WRITE(ADPA, dev_priv->saveADPA); 674 I915_WRITE(ADPA, dev_priv->saveADPA);
675 675
676 /* LVDS state */ 676 /* LVDS state */
677 if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) 677 if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev))
678 I915_WRITE(BLC_PWM_CTL2, dev_priv->saveBLC_PWM_CTL2); 678 I915_WRITE(BLC_PWM_CTL2, dev_priv->saveBLC_PWM_CTL2);
679 679
680 if (HAS_PCH_SPLIT(dev)) { 680 if (HAS_PCH_SPLIT(dev)) {
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 6d3385511663..8e484c9ac1f5 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -79,7 +79,7 @@ static int intel_crt_mode_valid(struct drm_connector *connector,
79 if (mode->clock < 25000) 79 if (mode->clock < 25000)
80 return MODE_CLOCK_LOW; 80 return MODE_CLOCK_LOW;
81 81
82 if (!IS_I9XX(dev)) 82 if (IS_GEN2(dev))
83 max_clock = 350000; 83 max_clock = 350000;
84 else 84 else
85 max_clock = 400000; 85 max_clock = 400000;
@@ -123,7 +123,7 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,
123 * Disable separate mode multiplier used when cloning SDVO to CRT 123 * Disable separate mode multiplier used when cloning SDVO to CRT
124 * XXX this needs to be adjusted when we really are cloning 124 * XXX this needs to be adjusted when we really are cloning
125 */ 125 */
126 if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) { 126 if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
127 dpll_md = I915_READ(dpll_md_reg); 127 dpll_md = I915_READ(dpll_md_reg);
128 I915_WRITE(dpll_md_reg, 128 I915_WRITE(dpll_md_reg,
129 dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK); 129 dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK);
@@ -325,7 +325,7 @@ intel_crt_load_detect(struct drm_crtc *crtc, struct intel_encoder *intel_encoder
325 /* Set the border color to purple. */ 325 /* Set the border color to purple. */
326 I915_WRITE(bclrpat_reg, 0x500050); 326 I915_WRITE(bclrpat_reg, 0x500050);
327 327
328 if (IS_I9XX(dev)) { 328 if (!IS_GEN2(dev)) {
329 uint32_t pipeconf = I915_READ(pipeconf_reg); 329 uint32_t pipeconf = I915_READ(pipeconf_reg);
330 I915_WRITE(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER); 330 I915_WRITE(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER);
331 POSTING_READ(pipeconf_reg); 331 POSTING_READ(pipeconf_reg);
@@ -411,7 +411,7 @@ intel_crt_detect(struct drm_connector *connector, bool force)
411 int dpms_mode; 411 int dpms_mode;
412 enum drm_connector_status status; 412 enum drm_connector_status status;
413 413
414 if (IS_I9XX(dev) && !IS_I915G(dev) && !IS_I915GM(dev)) { 414 if (I915_HAS_HOTPLUG(dev)) {
415 if (intel_crt_detect_hotplug(connector)) 415 if (intel_crt_detect_hotplug(connector))
416 return connector_status_connected; 416 return connector_status_connected;
417 else 417 else
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 1b5d878be975..c3f0400963de 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -708,16 +708,16 @@ static const intel_limit_t *intel_limit(struct drm_crtc *crtc)
708 limit = intel_ironlake_limit(crtc); 708 limit = intel_ironlake_limit(crtc);
709 else if (IS_G4X(dev)) { 709 else if (IS_G4X(dev)) {
710 limit = intel_g4x_limit(crtc); 710 limit = intel_g4x_limit(crtc);
711 } else if (IS_I9XX(dev) && !IS_PINEVIEW(dev)) {
712 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
713 limit = &intel_limits_i9xx_lvds;
714 else
715 limit = &intel_limits_i9xx_sdvo;
716 } else if (IS_PINEVIEW(dev)) { 711 } else if (IS_PINEVIEW(dev)) {
717 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) 712 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
718 limit = &intel_limits_pineview_lvds; 713 limit = &intel_limits_pineview_lvds;
719 else 714 else
720 limit = &intel_limits_pineview_sdvo; 715 limit = &intel_limits_pineview_sdvo;
716 } else if (!IS_GEN2(dev)) {
717 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
718 limit = &intel_limits_i9xx_lvds;
719 else
720 limit = &intel_limits_i9xx_sdvo;
721 } else { 721 } else {
722 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) 722 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
723 limit = &intel_limits_i8xx_lvds; 723 limit = &intel_limits_i8xx_lvds;
@@ -1429,7 +1429,7 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev,
1429 case I915_TILING_NONE: 1429 case I915_TILING_NONE:
1430 if (IS_BROADWATER(dev) || IS_CRESTLINE(dev)) 1430 if (IS_BROADWATER(dev) || IS_CRESTLINE(dev))
1431 alignment = 128 * 1024; 1431 alignment = 128 * 1024;
1432 else if (IS_I965G(dev)) 1432 else if (INTEL_INFO(dev)->gen >= 4)
1433 alignment = 4 * 1024; 1433 alignment = 4 * 1024;
1434 else 1434 else
1435 alignment = 64 * 1024; 1435 alignment = 64 * 1024;
@@ -1524,7 +1524,7 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
1524 DRM_ERROR("Unknown color depth\n"); 1524 DRM_ERROR("Unknown color depth\n");
1525 return -EINVAL; 1525 return -EINVAL;
1526 } 1526 }
1527 if (IS_I965G(dev)) { 1527 if (INTEL_INFO(dev)->gen >= 4) {
1528 if (obj_priv->tiling_mode != I915_TILING_NONE) 1528 if (obj_priv->tiling_mode != I915_TILING_NONE)
1529 dspcntr |= DISPPLANE_TILED; 1529 dspcntr |= DISPPLANE_TILED;
1530 else 1530 else
@@ -1543,7 +1543,7 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
1543 DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n", 1543 DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n",
1544 Start, Offset, x, y, fb->pitch); 1544 Start, Offset, x, y, fb->pitch);
1545 I915_WRITE(DSPSTRIDE(plane), fb->pitch); 1545 I915_WRITE(DSPSTRIDE(plane), fb->pitch);
1546 if (IS_I965G(dev)) { 1546 if (INTEL_INFO(dev)->gen >= 4) {
1547 I915_WRITE(DSPSURF(plane), Start); 1547 I915_WRITE(DSPSURF(plane), Start);
1548 I915_WRITE(DSPTILEOFF(plane), (y << 16) | x); 1548 I915_WRITE(DSPTILEOFF(plane), (y << 16) | x);
1549 I915_WRITE(DSPADDR(plane), Offset); 1549 I915_WRITE(DSPADDR(plane), Offset);
@@ -2388,7 +2388,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
2388 intel_flush_display_plane(dev, plane); 2388 intel_flush_display_plane(dev, plane);
2389 2389
2390 /* Wait for vblank for the disable to take effect */ 2390 /* Wait for vblank for the disable to take effect */
2391 if (!IS_I9XX(dev)) 2391 if (IS_GEN2(dev))
2392 intel_wait_for_vblank_off(dev, pipe); 2392 intel_wait_for_vblank_off(dev, pipe);
2393 } 2393 }
2394 2394
@@ -3181,11 +3181,11 @@ static void i965_update_wm(struct drm_device *dev, int planea_clock,
3181 DRM_DEBUG_KMS("self-refresh watermark: display plane %d " 3181 DRM_DEBUG_KMS("self-refresh watermark: display plane %d "
3182 "cursor %d\n", srwm, cursor_sr); 3182 "cursor %d\n", srwm, cursor_sr);
3183 3183
3184 if (IS_I965GM(dev)) 3184 if (IS_CRESTLINE(dev))
3185 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN); 3185 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN);
3186 } else { 3186 } else {
3187 /* Turn off self refresh if both pipes are enabled */ 3187 /* Turn off self refresh if both pipes are enabled */
3188 if (IS_I965GM(dev)) 3188 if (IS_CRESTLINE(dev))
3189 I915_WRITE(FW_BLC_SELF, I915_READ(FW_BLC_SELF) 3189 I915_WRITE(FW_BLC_SELF, I915_READ(FW_BLC_SELF)
3190 & ~FW_BLC_SELF_EN); 3190 & ~FW_BLC_SELF_EN);
3191 } 3191 }
@@ -3215,9 +3215,9 @@ static void i9xx_update_wm(struct drm_device *dev, int planea_clock,
3215 int sr_clock, sr_entries = 0; 3215 int sr_clock, sr_entries = 0;
3216 3216
3217 /* Create copies of the base settings for each pipe */ 3217 /* Create copies of the base settings for each pipe */
3218 if (IS_I965GM(dev) || IS_I945GM(dev)) 3218 if (IS_CRESTLINE(dev) || IS_I945GM(dev))
3219 planea_params = planeb_params = i945_wm_info; 3219 planea_params = planeb_params = i945_wm_info;
3220 else if (IS_I9XX(dev)) 3220 else if (!IS_GEN2(dev))
3221 planea_params = planeb_params = i915_wm_info; 3221 planea_params = planeb_params = i915_wm_info;
3222 else 3222 else
3223 planea_params = planeb_params = i855_wm_info; 3223 planea_params = planeb_params = i855_wm_info;
@@ -3576,7 +3576,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
3576 refclk = dev_priv->lvds_ssc_freq * 1000; 3576 refclk = dev_priv->lvds_ssc_freq * 1000;
3577 DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n", 3577 DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n",
3578 refclk / 1000); 3578 refclk / 1000);
3579 } else if (IS_I9XX(dev)) { 3579 } else if (!IS_GEN2(dev)) {
3580 refclk = 96000; 3580 refclk = 96000;
3581 if (HAS_PCH_SPLIT(dev)) 3581 if (HAS_PCH_SPLIT(dev))
3582 refclk = 120000; /* 120Mhz refclk */ 3582 refclk = 120000; /* 120Mhz refclk */
@@ -3775,7 +3775,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
3775 if (!HAS_PCH_SPLIT(dev)) 3775 if (!HAS_PCH_SPLIT(dev))
3776 dpll = DPLL_VGA_MODE_DIS; 3776 dpll = DPLL_VGA_MODE_DIS;
3777 3777
3778 if (IS_I9XX(dev)) { 3778 if (!IS_GEN2(dev)) {
3779 if (is_lvds) 3779 if (is_lvds)
3780 dpll |= DPLLB_MODE_LVDS; 3780 dpll |= DPLLB_MODE_LVDS;
3781 else 3781 else
@@ -3818,7 +3818,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
3818 dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14; 3818 dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14;
3819 break; 3819 break;
3820 } 3820 }
3821 if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) 3821 if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev))
3822 dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT); 3822 dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT);
3823 } else { 3823 } else {
3824 if (is_lvds) { 3824 if (is_lvds) {
@@ -3859,7 +3859,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
3859 dspcntr |= DISPPLANE_SEL_PIPE_B; 3859 dspcntr |= DISPPLANE_SEL_PIPE_B;
3860 } 3860 }
3861 3861
3862 if (pipe == 0 && !IS_I965G(dev)) { 3862 if (pipe == 0 && INTEL_INFO(dev)->gen < 4) {
3863 /* Enable pixel doubling when the dot clock is > 90% of the (display) 3863 /* Enable pixel doubling when the dot clock is > 90% of the (display)
3864 * core speed. 3864 * core speed.
3865 * 3865 *
@@ -3947,7 +3947,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
3947 * panels behave in the two modes. 3947 * panels behave in the two modes.
3948 */ 3948 */
3949 /* set the dithering flag on non-PCH LVDS as needed */ 3949 /* set the dithering flag on non-PCH LVDS as needed */
3950 if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) { 3950 if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
3951 if (dev_priv->lvds_dither) 3951 if (dev_priv->lvds_dither)
3952 temp |= LVDS_ENABLE_DITHER; 3952 temp |= LVDS_ENABLE_DITHER;
3953 else 3953 else
@@ -3991,7 +3991,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
3991 POSTING_READ(dpll_reg); 3991 POSTING_READ(dpll_reg);
3992 udelay(150); 3992 udelay(150);
3993 3993
3994 if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) { 3994 if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
3995 temp = 0; 3995 temp = 0;
3996 if (is_sdvo) { 3996 if (is_sdvo) {
3997 temp = intel_mode_get_pixel_multiplier(adjusted_mode); 3997 temp = intel_mode_get_pixel_multiplier(adjusted_mode);
@@ -4334,7 +4334,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
4334 addr = obj_priv->phys_obj->handle->busaddr; 4334 addr = obj_priv->phys_obj->handle->busaddr;
4335 } 4335 }
4336 4336
4337 if (!IS_I9XX(dev)) 4337 if (IS_GEN2(dev))
4338 I915_WRITE(CURSIZE, (height << 12) | width); 4338 I915_WRITE(CURSIZE, (height << 12) | width);
4339 4339
4340 finish: 4340 finish:
@@ -4569,7 +4569,7 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
4569 clock.m2 = (fp & FP_M2_DIV_MASK) >> FP_M2_DIV_SHIFT; 4569 clock.m2 = (fp & FP_M2_DIV_MASK) >> FP_M2_DIV_SHIFT;
4570 } 4570 }
4571 4571
4572 if (IS_I9XX(dev)) { 4572 if (!IS_GEN2(dev)) {
4573 if (IS_PINEVIEW(dev)) 4573 if (IS_PINEVIEW(dev))
4574 clock.p1 = ffs((dpll & DPLL_FPA01_P1_POST_DIV_MASK_PINEVIEW) >> 4574 clock.p1 = ffs((dpll & DPLL_FPA01_P1_POST_DIV_MASK_PINEVIEW) >>
4575 DPLL_FPA01_P1_POST_DIV_SHIFT_PINEVIEW); 4575 DPLL_FPA01_P1_POST_DIV_SHIFT_PINEVIEW);
@@ -5768,20 +5768,20 @@ void intel_init_clock_gating(struct drm_device *dev)
5768 if (IS_GM45(dev)) 5768 if (IS_GM45(dev))
5769 dspclk_gate |= DSSUNIT_CLOCK_GATE_DISABLE; 5769 dspclk_gate |= DSSUNIT_CLOCK_GATE_DISABLE;
5770 I915_WRITE(DSPCLK_GATE_D, dspclk_gate); 5770 I915_WRITE(DSPCLK_GATE_D, dspclk_gate);
5771 } else if (IS_I965GM(dev)) { 5771 } else if (IS_CRESTLINE(dev)) {
5772 I915_WRITE(RENCLK_GATE_D1, I965_RCC_CLOCK_GATE_DISABLE); 5772 I915_WRITE(RENCLK_GATE_D1, I965_RCC_CLOCK_GATE_DISABLE);
5773 I915_WRITE(RENCLK_GATE_D2, 0); 5773 I915_WRITE(RENCLK_GATE_D2, 0);
5774 I915_WRITE(DSPCLK_GATE_D, 0); 5774 I915_WRITE(DSPCLK_GATE_D, 0);
5775 I915_WRITE(RAMCLK_GATE_D, 0); 5775 I915_WRITE(RAMCLK_GATE_D, 0);
5776 I915_WRITE16(DEUC, 0); 5776 I915_WRITE16(DEUC, 0);
5777 } else if (IS_I965G(dev)) { 5777 } else if (IS_BROADWATER(dev)) {
5778 I915_WRITE(RENCLK_GATE_D1, I965_RCZ_CLOCK_GATE_DISABLE | 5778 I915_WRITE(RENCLK_GATE_D1, I965_RCZ_CLOCK_GATE_DISABLE |
5779 I965_RCC_CLOCK_GATE_DISABLE | 5779 I965_RCC_CLOCK_GATE_DISABLE |
5780 I965_RCPB_CLOCK_GATE_DISABLE | 5780 I965_RCPB_CLOCK_GATE_DISABLE |
5781 I965_ISC_CLOCK_GATE_DISABLE | 5781 I965_ISC_CLOCK_GATE_DISABLE |
5782 I965_FBC_CLOCK_GATE_DISABLE); 5782 I965_FBC_CLOCK_GATE_DISABLE);
5783 I915_WRITE(RENCLK_GATE_D2, 0); 5783 I915_WRITE(RENCLK_GATE_D2, 0);
5784 } else if (IS_I9XX(dev)) { 5784 } else if (IS_GEN3(dev)) {
5785 u32 dstate = I915_READ(D_STATE); 5785 u32 dstate = I915_READ(D_STATE);
5786 5786
5787 dstate |= DSTATE_PLL_D3_OFF | DSTATE_GFX_CLOCK_GATING | 5787 dstate |= DSTATE_PLL_D3_OFF | DSTATE_GFX_CLOCK_GATING |
@@ -5863,7 +5863,7 @@ static void intel_init_display(struct drm_device *dev)
5863 dev_priv->display.fbc_enabled = g4x_fbc_enabled; 5863 dev_priv->display.fbc_enabled = g4x_fbc_enabled;
5864 dev_priv->display.enable_fbc = g4x_enable_fbc; 5864 dev_priv->display.enable_fbc = g4x_enable_fbc;
5865 dev_priv->display.disable_fbc = g4x_disable_fbc; 5865 dev_priv->display.disable_fbc = g4x_disable_fbc;
5866 } else if (IS_I965GM(dev)) { 5866 } else if (IS_CRESTLINE(dev)) {
5867 dev_priv->display.fbc_enabled = i8xx_fbc_enabled; 5867 dev_priv->display.fbc_enabled = i8xx_fbc_enabled;
5868 dev_priv->display.enable_fbc = i8xx_enable_fbc; 5868 dev_priv->display.enable_fbc = i8xx_enable_fbc;
5869 dev_priv->display.disable_fbc = i8xx_disable_fbc; 5869 dev_priv->display.disable_fbc = i8xx_disable_fbc;
@@ -5923,9 +5923,9 @@ static void intel_init_display(struct drm_device *dev)
5923 dev_priv->display.update_wm = pineview_update_wm; 5923 dev_priv->display.update_wm = pineview_update_wm;
5924 } else if (IS_G4X(dev)) 5924 } else if (IS_G4X(dev))
5925 dev_priv->display.update_wm = g4x_update_wm; 5925 dev_priv->display.update_wm = g4x_update_wm;
5926 else if (IS_I965G(dev)) 5926 else if (IS_GEN4(dev))
5927 dev_priv->display.update_wm = i965_update_wm; 5927 dev_priv->display.update_wm = i965_update_wm;
5928 else if (IS_I9XX(dev)) { 5928 else if (IS_GEN3(dev)) {
5929 dev_priv->display.update_wm = i9xx_update_wm; 5929 dev_priv->display.update_wm = i9xx_update_wm;
5930 dev_priv->display.get_fifo_size = i9xx_get_fifo_size; 5930 dev_priv->display.get_fifo_size = i9xx_get_fifo_size;
5931 } else if (IS_I85X(dev)) { 5931 } else if (IS_I85X(dev)) {
@@ -6039,24 +6039,24 @@ void intel_modeset_init(struct drm_device *dev)
6039 6039
6040 intel_init_display(dev); 6040 intel_init_display(dev);
6041 6041
6042 if (IS_I965G(dev)) { 6042 if (IS_GEN2(dev)) {
6043 dev->mode_config.max_width = 8192; 6043 dev->mode_config.max_width = 2048;
6044 dev->mode_config.max_height = 8192; 6044 dev->mode_config.max_height = 2048;
6045 } else if (IS_I9XX(dev)) { 6045 } else if (IS_GEN3(dev)) {
6046 dev->mode_config.max_width = 4096; 6046 dev->mode_config.max_width = 4096;
6047 dev->mode_config.max_height = 4096; 6047 dev->mode_config.max_height = 4096;
6048 } else { 6048 } else {
6049 dev->mode_config.max_width = 2048; 6049 dev->mode_config.max_width = 8192;
6050 dev->mode_config.max_height = 2048; 6050 dev->mode_config.max_height = 8192;
6051 } 6051 }
6052 6052
6053 /* set memory base */ 6053 /* set memory base */
6054 if (IS_I9XX(dev)) 6054 if (IS_GEN2(dev))
6055 dev->mode_config.fb_base = pci_resource_start(dev->pdev, 2);
6056 else
6057 dev->mode_config.fb_base = pci_resource_start(dev->pdev, 0); 6055 dev->mode_config.fb_base = pci_resource_start(dev->pdev, 0);
6056 else
6057 dev->mode_config.fb_base = pci_resource_start(dev->pdev, 2);
6058 6058
6059 if (IS_MOBILE(dev) || IS_I9XX(dev)) 6059 if (IS_MOBILE(dev) || !IS_GEN2(dev))
6060 dev_priv->num_pipe = 2; 6060 dev_priv->num_pipe = 2;
6061 else 6061 else
6062 dev_priv->num_pipe = 1; 6062 dev_priv->num_pipe = 1;
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 8a23bf772c95..7af4accafb7f 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -68,7 +68,7 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
68 struct drm_gem_object *fbo = NULL; 68 struct drm_gem_object *fbo = NULL;
69 struct drm_i915_gem_object *obj_priv; 69 struct drm_i915_gem_object *obj_priv;
70 struct device *device = &dev->pdev->dev; 70 struct device *device = &dev->pdev->dev;
71 int size, ret, mmio_bar = IS_I9XX(dev) ? 0 : 1; 71 int size, ret, mmio_bar = IS_GEN2(dev) ? 1 : 0;
72 72
73 /* we don't do packed 24bpp */ 73 /* we don't do packed 24bpp */
74 if (sizes->surface_bpp == 24) 74 if (sizes->surface_bpp == 24)
@@ -129,7 +129,7 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
129 goto out_unpin; 129 goto out_unpin;
130 } 130 }
131 info->apertures->ranges[0].base = dev->mode_config.fb_base; 131 info->apertures->ranges[0].base = dev->mode_config.fb_base;
132 if (IS_I9XX(dev)) 132 if (!IS_GEN2(dev))
133 info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 2); 133 info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 2);
134 else 134 else
135 info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0); 135 info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 5666e89288d3..02c5aed36c87 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -198,7 +198,7 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
198 u32 pfit_control = 0, pfit_pgm_ratios = 0, border = 0; 198 u32 pfit_control = 0, pfit_pgm_ratios = 0, border = 0;
199 199
200 /* Should never happen!! */ 200 /* Should never happen!! */
201 if (!IS_I965G(dev) && intel_crtc->pipe == 0) { 201 if (INTEL_INFO(dev)->gen < 4 && intel_crtc->pipe == 0) {
202 DRM_ERROR("Can't support LVDS on pipe A\n"); 202 DRM_ERROR("Can't support LVDS on pipe A\n");
203 return false; 203 return false;
204 } 204 }
@@ -227,7 +227,7 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
227 } 227 }
228 228
229 /* Make sure pre-965s set dither correctly */ 229 /* Make sure pre-965s set dither correctly */
230 if (!IS_I965G(dev)) { 230 if (INTEL_INFO(dev)->gen < 4) {
231 if (dev_priv->panel_wants_dither || dev_priv->lvds_dither) 231 if (dev_priv->panel_wants_dither || dev_priv->lvds_dither)
232 pfit_control |= PANEL_8TO6_DITHER_ENABLE; 232 pfit_control |= PANEL_8TO6_DITHER_ENABLE;
233 } 233 }
@@ -238,7 +238,7 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
238 goto out; 238 goto out;
239 239
240 /* 965+ wants fuzzy fitting */ 240 /* 965+ wants fuzzy fitting */
241 if (IS_I965G(dev)) 241 if (INTEL_INFO(dev)->gen >= 4)
242 pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) | 242 pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) |
243 PFIT_FILTER_FUZZY); 243 PFIT_FILTER_FUZZY);
244 244
@@ -264,7 +264,7 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
264 264
265 case DRM_MODE_SCALE_ASPECT: 265 case DRM_MODE_SCALE_ASPECT:
266 /* Scale but preserve the aspect ratio */ 266 /* Scale but preserve the aspect ratio */
267 if (IS_I965G(dev)) { 267 if (INTEL_INFO(dev)->gen >= 4) {
268 u32 scaled_width = adjusted_mode->hdisplay * mode->vdisplay; 268 u32 scaled_width = adjusted_mode->hdisplay * mode->vdisplay;
269 u32 scaled_height = mode->hdisplay * adjusted_mode->vdisplay; 269 u32 scaled_height = mode->hdisplay * adjusted_mode->vdisplay;
270 270
@@ -323,7 +323,7 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
323 * Fortunately this is all done for us in hw. 323 * Fortunately this is all done for us in hw.
324 */ 324 */
325 pfit_control |= PFIT_ENABLE; 325 pfit_control |= PFIT_ENABLE;
326 if (IS_I965G(dev)) 326 if (INTEL_INFO(dev)->gen >= 4)
327 pfit_control |= PFIT_SCALING_AUTO; 327 pfit_control |= PFIT_SCALING_AUTO;
328 else 328 else
329 pfit_control |= (VERT_AUTO_SCALE | HORIZ_AUTO_SCALE | 329 pfit_control |= (VERT_AUTO_SCALE | HORIZ_AUTO_SCALE |
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index c4699c916698..375316a8420e 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -552,15 +552,15 @@ static int uv_vsubsampling(u32 format)
552static u32 calc_swidthsw(struct drm_device *dev, u32 offset, u32 width) 552static u32 calc_swidthsw(struct drm_device *dev, u32 offset, u32 width)
553{ 553{
554 u32 mask, shift, ret; 554 u32 mask, shift, ret;
555 if (IS_I9XX(dev)) { 555 if (IS_GEN2(dev)) {
556 mask = 0x3f;
557 shift = 6;
558 } else {
559 mask = 0x1f; 556 mask = 0x1f;
560 shift = 5; 557 shift = 5;
558 } else {
559 mask = 0x3f;
560 shift = 6;
561 } 561 }
562 ret = ((offset + width + mask) >> shift) - (offset >> shift); 562 ret = ((offset + width + mask) >> shift) - (offset >> shift);
563 if (IS_I9XX(dev)) 563 if (!IS_GEN2(dev))
564 ret <<= 1; 564 ret <<= 1;
565 ret -=1; 565 ret -=1;
566 return ret << 2; 566 return ret << 2;
@@ -768,7 +768,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
768 goto out_unpin; 768 goto out_unpin;
769 } 769 }
770 regs->OCONFIG = OCONF_CC_OUT_8BIT; 770 regs->OCONFIG = OCONF_CC_OUT_8BIT;
771 if (IS_I965GM(overlay->dev)) 771 if (IS_GEN4(overlay->dev))
772 regs->OCONFIG |= OCONF_CSC_MODE_BT709; 772 regs->OCONFIG |= OCONF_CSC_MODE_BT709;
773 regs->OCONFIG |= overlay->crtc->pipe == 0 ? 773 regs->OCONFIG |= overlay->crtc->pipe == 0 ?
774 OCONF_PIPE_A : OCONF_PIPE_B; 774 OCONF_PIPE_A : OCONF_PIPE_B;
@@ -880,7 +880,7 @@ static int check_overlay_possible_on_crtc(struct intel_overlay *overlay,
880 return -EINVAL; 880 return -EINVAL;
881 881
882 /* can't use the overlay with double wide pipe */ 882 /* can't use the overlay with double wide pipe */
883 if (!IS_I965G(overlay->dev) && 883 if (INTEL_INFO(overlay->dev)->gen < 4 &&
884 (I915_READ(PIPECONF(crtc->pipe)) & (PIPECONF_DOUBLE_WIDE | PIPECONF_ENABLE)) != PIPECONF_ENABLE) 884 (I915_READ(PIPECONF(crtc->pipe)) & (PIPECONF_DOUBLE_WIDE | PIPECONF_ENABLE)) != PIPECONF_ENABLE)
885 return -EINVAL; 885 return -EINVAL;
886 886
@@ -897,14 +897,15 @@ static void update_pfit_vscale_ratio(struct intel_overlay *overlay)
897 /* XXX: This is not the same logic as in the xorg driver, but more in 897 /* XXX: This is not the same logic as in the xorg driver, but more in
898 * line with the intel documentation for the i965 898 * line with the intel documentation for the i965
899 */ 899 */
900 if (!IS_I965G(dev)) { 900 if (INTEL_INFO(dev)->gen >= 4) {
901 /* on i965 use the PGM reg to read out the autoscaler values */
902 ratio = I915_READ(PFIT_PGM_RATIOS) >> PFIT_VERT_SCALE_SHIFT_965;
903 } else {
901 if (pfit_control & VERT_AUTO_SCALE) 904 if (pfit_control & VERT_AUTO_SCALE)
902 ratio = I915_READ(PFIT_AUTO_RATIOS); 905 ratio = I915_READ(PFIT_AUTO_RATIOS);
903 else 906 else
904 ratio = I915_READ(PFIT_PGM_RATIOS); 907 ratio = I915_READ(PFIT_PGM_RATIOS);
905 ratio >>= PFIT_VERT_SCALE_SHIFT; 908 ratio >>= PFIT_VERT_SCALE_SHIFT;
906 } else { /* on i965 use the PGM reg to read out the autoscaler values */
907 ratio = I915_READ(PFIT_PGM_RATIOS) >> PFIT_VERT_SCALE_SHIFT_965;
908 } 909 }
909 910
910 overlay->pfit_vscale_ratio = ratio; 911 overlay->pfit_vscale_ratio = ratio;
@@ -1007,7 +1008,7 @@ static int check_overlay_src(struct drm_device *dev,
1007 1008
1008 if (rec->stride_Y & stride_mask || rec->stride_UV & stride_mask) 1009 if (rec->stride_Y & stride_mask || rec->stride_UV & stride_mask)
1009 return -EINVAL; 1010 return -EINVAL;
1010 if (IS_I965G(dev) && rec->stride_Y < 512) 1011 if (IS_GEN4(dev) && rec->stride_Y < 512)
1011 return -EINVAL; 1012 return -EINVAL;
1012 1013
1013 tmp = (rec->flags & I915_OVERLAY_TYPE_MASK) == I915_OVERLAY_YUV_PLANAR ? 1014 tmp = (rec->flags & I915_OVERLAY_TYPE_MASK) == I915_OVERLAY_YUV_PLANAR ?
@@ -1068,7 +1069,7 @@ static int intel_panel_fitter_pipe(struct drm_device *dev)
1068 return -1; 1069 return -1;
1069 1070
1070 /* 965 can place panel fitter on either pipe */ 1071 /* 965 can place panel fitter on either pipe */
1071 if (IS_I965G(dev)) 1072 if (IS_GEN4(dev))
1072 return (pfit_control >> 29) & 0x3; 1073 return (pfit_control >> 29) & 0x3;
1073 1074
1074 /* older chips can only use pipe 1 */ 1075 /* older chips can only use pipe 1 */
@@ -1302,7 +1303,7 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
1302 attrs->contrast = overlay->contrast; 1303 attrs->contrast = overlay->contrast;
1303 attrs->saturation = overlay->saturation; 1304 attrs->saturation = overlay->saturation;
1304 1305
1305 if (IS_I9XX(dev)) { 1306 if (!IS_GEN2(dev)) {
1306 attrs->gamma0 = I915_READ(OGAMC0); 1307 attrs->gamma0 = I915_READ(OGAMC0);
1307 attrs->gamma1 = I915_READ(OGAMC1); 1308 attrs->gamma1 = I915_READ(OGAMC1);
1308 attrs->gamma2 = I915_READ(OGAMC2); 1309 attrs->gamma2 = I915_READ(OGAMC2);
@@ -1334,7 +1335,7 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
1334 intel_overlay_unmap_regs(overlay, regs); 1335 intel_overlay_unmap_regs(overlay, regs);
1335 1336
1336 if (attrs->flags & I915_OVERLAY_UPDATE_GAMMA) { 1337 if (attrs->flags & I915_OVERLAY_UPDATE_GAMMA) {
1337 if (!IS_I9XX(dev)) 1338 if (IS_GEN2(dev))
1338 goto out_unlock; 1339 goto out_unlock;
1339 1340
1340 if (overlay->active) { 1341 if (overlay->active) {
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 30abe7afc942..92ff8f385278 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -116,7 +116,7 @@ static int is_backlight_combination_mode(struct drm_device *dev)
116{ 116{
117 struct drm_i915_private *dev_priv = dev->dev_private; 117 struct drm_i915_private *dev_priv = dev->dev_private;
118 118
119 if (IS_I965G(dev)) 119 if (INTEL_INFO(dev)->gen >= 4)
120 return I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE; 120 return I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
121 121
122 if (IS_GEN2(dev)) 122 if (IS_GEN2(dev))
@@ -138,7 +138,7 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev)
138 max >>= 17; 138 max >>= 17;
139 } else { 139 } else {
140 max >>= 16; 140 max >>= 16;
141 if (!IS_I965G(dev)) 141 if (INTEL_INFO(dev)->gen < 4)
142 max &= ~1; 142 max &= ~1;
143 } 143 }
144 144
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 11bcfc871a0d..670f94af6b07 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -97,7 +97,7 @@ render_ring_flush(struct drm_device *dev,
97 if ((invalidate_domains|flush_domains) & 97 if ((invalidate_domains|flush_domains) &
98 I915_GEM_DOMAIN_RENDER) 98 I915_GEM_DOMAIN_RENDER)
99 cmd &= ~MI_NO_WRITE_FLUSH; 99 cmd &= ~MI_NO_WRITE_FLUSH;
100 if (!IS_I965G(dev)) { 100 if (INTEL_INFO(dev)->gen < 4) {
101 /* 101 /*
102 * On the 965, the sampler cache always gets flushed 102 * On the 965, the sampler cache always gets flushed
103 * and this bit is reserved. 103 * and this bit is reserved.
@@ -138,7 +138,7 @@ static unsigned int render_ring_get_active_head(struct drm_device *dev,
138 struct intel_ring_buffer *ring) 138 struct intel_ring_buffer *ring)
139{ 139{
140 drm_i915_private_t *dev_priv = dev->dev_private; 140 drm_i915_private_t *dev_priv = dev->dev_private;
141 u32 acthd_reg = IS_I965G(dev) ? ACTHD_I965 : ACTHD; 141 u32 acthd_reg = INTEL_INFO(dev)->gen ? ACTHD_I965 : ACTHD;
142 142
143 return I915_READ(acthd_reg); 143 return I915_READ(acthd_reg);
144} 144}
@@ -224,7 +224,7 @@ static int init_render_ring(struct drm_device *dev,
224 int ret = init_ring_common(dev, ring); 224 int ret = init_ring_common(dev, ring);
225 int mode; 225 int mode;
226 226
227 if (IS_I9XX(dev) && !IS_GEN3(dev)) { 227 if (INTEL_INFO(dev)->gen > 3) {
228 mode = VS_TIMER_DISPATCH << 16 | VS_TIMER_DISPATCH; 228 mode = VS_TIMER_DISPATCH << 16 | VS_TIMER_DISPATCH;
229 if (IS_GEN6(dev)) 229 if (IS_GEN6(dev))
230 mode |= MI_FLUSH_ENABLE << 16 | MI_FLUSH_ENABLE; 230 mode |= MI_FLUSH_ENABLE << 16 | MI_FLUSH_ENABLE;
@@ -528,7 +528,7 @@ render_ring_dispatch_gem_execbuffer(struct drm_device *dev,
528 intel_ring_emit(dev, ring, 0); 528 intel_ring_emit(dev, ring, 0);
529 } else { 529 } else {
530 intel_ring_begin(dev, ring, 4); 530 intel_ring_begin(dev, ring, 4);
531 if (IS_I965G(dev)) { 531 if (INTEL_INFO(dev)->gen >= 4) {
532 intel_ring_emit(dev, ring, 532 intel_ring_emit(dev, ring,
533 MI_BATCH_BUFFER_START | (2 << 6) 533 MI_BATCH_BUFFER_START | (2 << 6)
534 | MI_BATCH_NON_SECURE_I965); 534 | MI_BATCH_NON_SECURE_I965);
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index ba058e600ce7..7cd2d9592d65 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1162,7 +1162,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1162 return; 1162 return;
1163 1163
1164 /* Set the SDVO control regs. */ 1164 /* Set the SDVO control regs. */
1165 if (IS_I965G(dev)) { 1165 if (INTEL_INFO(dev)->gen >= 4) {
1166 sdvox = SDVO_BORDER_ENABLE; 1166 sdvox = SDVO_BORDER_ENABLE;
1167 if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) 1167 if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
1168 sdvox |= SDVO_VSYNC_ACTIVE_HIGH; 1168 sdvox |= SDVO_VSYNC_ACTIVE_HIGH;
@@ -1185,7 +1185,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1185 if (intel_sdvo->is_hdmi) 1185 if (intel_sdvo->is_hdmi)
1186 sdvox |= SDVO_AUDIO_ENABLE; 1186 sdvox |= SDVO_AUDIO_ENABLE;
1187 1187
1188 if (IS_I965G(dev)) { 1188 if (INTEL_INFO(dev)->gen >= 4) {
1189 /* done in crtc_mode_set as the dpll_md reg must be written early */ 1189 /* done in crtc_mode_set as the dpll_md reg must be written early */
1190 } else if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) { 1190 } else if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) {
1191 /* done in crtc_mode_set as it lives inside the dpll register */ 1191 /* done in crtc_mode_set as it lives inside the dpll register */
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index e03783fbbf95..49ab11c667bb 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1139,7 +1139,7 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
1139 color_conversion->av); 1139 color_conversion->av);
1140 } 1140 }
1141 1141
1142 if (IS_I965G(dev)) 1142 if (INTEL_INFO(dev)->gen >= 4)
1143 I915_WRITE(TV_CLR_KNOBS, 0x00404000); 1143 I915_WRITE(TV_CLR_KNOBS, 0x00404000);
1144 else 1144 else
1145 I915_WRITE(TV_CLR_KNOBS, 0x00606000); 1145 I915_WRITE(TV_CLR_KNOBS, 0x00606000);
@@ -1165,7 +1165,7 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
1165 I915_WRITE(dspbase_reg, I915_READ(dspbase_reg)); 1165 I915_WRITE(dspbase_reg, I915_READ(dspbase_reg));
1166 1166
1167 /* Wait for vblank for the disable to take effect */ 1167 /* Wait for vblank for the disable to take effect */
1168 if (!IS_I9XX(dev)) 1168 if (IS_GEN2(dev))
1169 intel_wait_for_vblank(dev, intel_crtc->pipe); 1169 intel_wait_for_vblank(dev, intel_crtc->pipe);
1170 1170
1171 I915_WRITE(pipeconf_reg, pipeconf & ~PIPECONF_ENABLE); 1171 I915_WRITE(pipeconf_reg, pipeconf & ~PIPECONF_ENABLE);