Commit 241fa85b authored by Eric Anholt's avatar Eric Anholt Committed by Dave Airlie

drm/i915: Respect the other stolen memory sizes we know of.

fd.o bug #19336.
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 1fc45d84
...@@ -827,6 +827,7 @@ static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size, ...@@ -827,6 +827,7 @@ static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size,
struct pci_dev *bridge_dev; struct pci_dev *bridge_dev;
u16 tmp = 0; u16 tmp = 0;
unsigned long overhead; unsigned long overhead;
unsigned long stolen;
bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0,0));
if (!bridge_dev) { if (!bridge_dev) {
...@@ -866,36 +867,55 @@ static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size, ...@@ -866,36 +867,55 @@ static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size,
else else
overhead = (*aperture_size / 1024) + 4096; overhead = (*aperture_size / 1024) + 4096;
switch (tmp & INTEL_855_GMCH_GMS_MASK) { switch (tmp & INTEL_GMCH_GMS_MASK) {
case INTEL_855_GMCH_GMS_DISABLED:
DRM_ERROR("video memory is disabled\n");
return -1;
case INTEL_855_GMCH_GMS_STOLEN_1M: case INTEL_855_GMCH_GMS_STOLEN_1M:
break; /* 1M already */ stolen = 1 * 1024 * 1024;
break;
case INTEL_855_GMCH_GMS_STOLEN_4M: case INTEL_855_GMCH_GMS_STOLEN_4M:
*preallocated_size *= 4; stolen = 4 * 1024 * 1024;
break; break;
case INTEL_855_GMCH_GMS_STOLEN_8M: case INTEL_855_GMCH_GMS_STOLEN_8M:
*preallocated_size *= 8; stolen = 8 * 1024 * 1024;
break; break;
case INTEL_855_GMCH_GMS_STOLEN_16M: case INTEL_855_GMCH_GMS_STOLEN_16M:
*preallocated_size *= 16; stolen = 16 * 1024 * 1024;
break; break;
case INTEL_855_GMCH_GMS_STOLEN_32M: case INTEL_855_GMCH_GMS_STOLEN_32M:
*preallocated_size *= 32; stolen = 32 * 1024 * 1024;
break; break;
case INTEL_915G_GMCH_GMS_STOLEN_48M: case INTEL_915G_GMCH_GMS_STOLEN_48M:
*preallocated_size *= 48; stolen = 48 * 1024 * 1024;
break; break;
case INTEL_915G_GMCH_GMS_STOLEN_64M: case INTEL_915G_GMCH_GMS_STOLEN_64M:
*preallocated_size *= 64; stolen = 64 * 1024 * 1024;
break;
case INTEL_GMCH_GMS_STOLEN_128M:
stolen = 128 * 1024 * 1024;
break;
case INTEL_GMCH_GMS_STOLEN_256M:
stolen = 256 * 1024 * 1024;
break;
case INTEL_GMCH_GMS_STOLEN_96M:
stolen = 96 * 1024 * 1024;
break;
case INTEL_GMCH_GMS_STOLEN_160M:
stolen = 160 * 1024 * 1024;
break;
case INTEL_GMCH_GMS_STOLEN_224M:
stolen = 224 * 1024 * 1024;
break;
case INTEL_GMCH_GMS_STOLEN_352M:
stolen = 352 * 1024 * 1024;
break; break;
case INTEL_855_GMCH_GMS_DISABLED:
DRM_ERROR("video memory is disabled\n");
return -1;
default: default:
DRM_ERROR("unexpected GMCH_GMS value: 0x%02x\n", DRM_ERROR("unexpected GMCH_GMS value: 0x%02x\n",
tmp & INTEL_855_GMCH_GMS_MASK); tmp & INTEL_GMCH_GMS_MASK);
return -1; return -1;
} }
*preallocated_size -= overhead; *preallocated_size = stolen - overhead;
return 0; return 0;
} }
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define INTEL_GMCH_MEM_64M 0x1 #define INTEL_GMCH_MEM_64M 0x1
#define INTEL_GMCH_MEM_128M 0 #define INTEL_GMCH_MEM_128M 0
#define INTEL_855_GMCH_GMS_MASK (0x7 << 4) #define INTEL_GMCH_GMS_MASK (0xf << 4)
#define INTEL_855_GMCH_GMS_DISABLED (0x0 << 4) #define INTEL_855_GMCH_GMS_DISABLED (0x0 << 4)
#define INTEL_855_GMCH_GMS_STOLEN_1M (0x1 << 4) #define INTEL_855_GMCH_GMS_STOLEN_1M (0x1 << 4)
#define INTEL_855_GMCH_GMS_STOLEN_4M (0x2 << 4) #define INTEL_855_GMCH_GMS_STOLEN_4M (0x2 << 4)
...@@ -45,6 +45,12 @@ ...@@ -45,6 +45,12 @@
#define INTEL_915G_GMCH_GMS_STOLEN_48M (0x6 << 4) #define INTEL_915G_GMCH_GMS_STOLEN_48M (0x6 << 4)
#define INTEL_915G_GMCH_GMS_STOLEN_64M (0x7 << 4) #define INTEL_915G_GMCH_GMS_STOLEN_64M (0x7 << 4)
#define INTEL_GMCH_GMS_STOLEN_128M (0x8 << 4)
#define INTEL_GMCH_GMS_STOLEN_256M (0x9 << 4)
#define INTEL_GMCH_GMS_STOLEN_96M (0xa << 4)
#define INTEL_GMCH_GMS_STOLEN_160M (0xb << 4)
#define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4)
#define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4)
/* PCI config space */ /* PCI config space */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment