diff options
author | Zhenyu Wang <zhenyuw@linux.intel.com> | 2010-04-07 04:15:53 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-04-12 12:23:39 -0400 |
commit | 3bad0781832e4e8c9a532f1169bfcd7257bcfd9e (patch) | |
tree | d1ab074ca4a3e6f30fa95473584507776d7ac435 | |
parent | 7da9f6cbf70656ed1c913a674b82b68e076c99f7 (diff) |
drm/i915: Probe for PCH chipset type
PCH is the new name for south bridge from Ironlake/Sandybridge,
which contains most of the display outputs except eDP. This one
adds a probe function to detect current PCH type, and method to
detect Cougarpoint PCH.
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 13 |
3 files changed, 44 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index a9f8589490cf..d2daff1f8291 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1710,6 +1710,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1710 | /* Start out suspended */ | 1710 | /* Start out suspended */ |
1711 | dev_priv->mm.suspended = 1; | 1711 | dev_priv->mm.suspended = 1; |
1712 | 1712 | ||
1713 | intel_detect_pch(dev); | ||
1714 | |||
1713 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 1715 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
1714 | ret = i915_load_modeset_init(dev, prealloc_start, | 1716 | ret = i915_load_modeset_init(dev, prealloc_start, |
1715 | prealloc_size, agp_size); | 1717 | prealloc_size, agp_size); |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 0af3dcc85ce9..01e91ea5bdea 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -187,6 +187,35 @@ const static struct pci_device_id pciidlist[] = { | |||
187 | MODULE_DEVICE_TABLE(pci, pciidlist); | 187 | MODULE_DEVICE_TABLE(pci, pciidlist); |
188 | #endif | 188 | #endif |
189 | 189 | ||
190 | #define INTEL_PCH_DEVICE_ID_MASK 0xff00 | ||
191 | #define INTEL_PCH_CPT_DEVICE_ID_TYPE 0x1c00 | ||
192 | |||
193 | void intel_detect_pch (struct drm_device *dev) | ||
194 | { | ||
195 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
196 | struct pci_dev *pch; | ||
197 | |||
198 | /* | ||
199 | * The reason to probe ISA bridge instead of Dev31:Fun0 is to | ||
200 | * make graphics device passthrough work easy for VMM, that only | ||
201 | * need to expose ISA bridge to let driver know the real hardware | ||
202 | * underneath. This is a requirement from virtualization team. | ||
203 | */ | ||
204 | pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); | ||
205 | if (pch) { | ||
206 | if (pch->vendor == PCI_VENDOR_ID_INTEL) { | ||
207 | int id; | ||
208 | id = pch->device & INTEL_PCH_DEVICE_ID_MASK; | ||
209 | |||
210 | if (id == INTEL_PCH_CPT_DEVICE_ID_TYPE) { | ||
211 | dev_priv->pch_type = PCH_CPT; | ||
212 | DRM_DEBUG_KMS("Found CougarPoint PCH\n"); | ||
213 | } | ||
214 | } | ||
215 | pci_dev_put(pch); | ||
216 | } | ||
217 | } | ||
218 | |||
190 | static int i915_drm_freeze(struct drm_device *dev) | 219 | static int i915_drm_freeze(struct drm_device *dev) |
191 | { | 220 | { |
192 | struct drm_i915_private *dev_priv = dev->dev_private; | 221 | struct drm_i915_private *dev_priv = dev->dev_private; |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 94fc9b65f4d7..6ffabab3bb60 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -221,6 +221,11 @@ enum no_fbc_reason { | |||
221 | FBC_NOT_TILED, /* buffer not tiled */ | 221 | FBC_NOT_TILED, /* buffer not tiled */ |
222 | }; | 222 | }; |
223 | 223 | ||
224 | enum intel_pch { | ||
225 | PCH_IBX, /* Ibexpeak PCH */ | ||
226 | PCH_CPT, /* Cougarpoint PCH */ | ||
227 | }; | ||
228 | |||
224 | typedef struct drm_i915_private { | 229 | typedef struct drm_i915_private { |
225 | struct drm_device *dev; | 230 | struct drm_device *dev; |
226 | 231 | ||
@@ -331,6 +336,9 @@ typedef struct drm_i915_private { | |||
331 | /* Display functions */ | 336 | /* Display functions */ |
332 | struct drm_i915_display_funcs display; | 337 | struct drm_i915_display_funcs display; |
333 | 338 | ||
339 | /* PCH chipset type */ | ||
340 | enum intel_pch pch_type; | ||
341 | |||
334 | /* Register state */ | 342 | /* Register state */ |
335 | bool modeset_on_lid; | 343 | bool modeset_on_lid; |
336 | u8 saveLBB; | 344 | u8 saveLBB; |
@@ -992,6 +1000,8 @@ extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state); | |||
992 | extern void i8xx_disable_fbc(struct drm_device *dev); | 1000 | extern void i8xx_disable_fbc(struct drm_device *dev); |
993 | extern void g4x_disable_fbc(struct drm_device *dev); | 1001 | extern void g4x_disable_fbc(struct drm_device *dev); |
994 | 1002 | ||
1003 | extern void intel_detect_pch (struct drm_device *dev); | ||
1004 | |||
995 | /** | 1005 | /** |
996 | * Lock test for when it's just for synchronization of ring access. | 1006 | * Lock test for when it's just for synchronization of ring access. |
997 | * | 1007 | * |
@@ -1137,6 +1147,9 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
1137 | #define HAS_PCH_SPLIT(dev) (IS_IRONLAKE(dev) || \ | 1147 | #define HAS_PCH_SPLIT(dev) (IS_IRONLAKE(dev) || \ |
1138 | IS_GEN6(dev)) | 1148 | IS_GEN6(dev)) |
1139 | 1149 | ||
1150 | #define INTEL_PCH_TYPE(dev) (((struct drm_i915_private *)(dev)->dev_private)->pch_type) | ||
1151 | #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT) | ||
1152 | |||
1140 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) | 1153 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) |
1141 | 1154 | ||
1142 | #endif | 1155 | #endif |