aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Hustvedt <ehustvedt@cecropia.com>2006-05-27 04:30:00 -0400
committerDave Airlie <airlied@linux.ie>2006-05-27 04:30:00 -0400
commit1aecb393091d3c0787f92445420d96ef58c9782a (patch)
treead1a929d79f6219b461ab037105f0b52380bc41d
parentdf7df8ab7b38ca80bbaf5ffafd401d6c739fd45f (diff)
Adds support for 256MB aperture on 945 chipsets to the intelfb driver
and corrects calculation of stolen memory overhead. Signed-off-by: Eric Hustvedt <ehustvedt@cecropia.com> Signed-off-by: Dennis Munsie <dmunsie@cecropia.com> Signed-off-by: Dave Airlie <airlied@linux.ie>
-rw-r--r--drivers/video/intelfb/intelfbhw.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c
index eba8f8f6a4d4..82a2b9048df9 100644
--- a/drivers/video/intelfb/intelfbhw.c
+++ b/drivers/video/intelfb/intelfbhw.c
@@ -156,6 +156,7 @@ intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
156{ 156{
157 struct pci_dev *bridge_dev; 157 struct pci_dev *bridge_dev;
158 u16 tmp; 158 u16 tmp;
159 int stolen_overhead;
159 160
160 if (!pdev || !aperture_size || !stolen_size) 161 if (!pdev || !aperture_size || !stolen_size)
161 return 1; 162 return 1;
@@ -170,21 +171,41 @@ intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
170 tmp = 0; 171 tmp = 0;
171 pci_read_config_word(bridge_dev, INTEL_GMCH_CTRL, &tmp); 172 pci_read_config_word(bridge_dev, INTEL_GMCH_CTRL, &tmp);
172 switch (pdev->device) { 173 switch (pdev->device) {
173 case PCI_DEVICE_ID_INTEL_830M: 174 case PCI_DEVICE_ID_INTEL_915G:
174 case PCI_DEVICE_ID_INTEL_845G: 175 case PCI_DEVICE_ID_INTEL_915GM:
176 case PCI_DEVICE_ID_INTEL_945G:
177 case PCI_DEVICE_ID_INTEL_945GM:
178 /* 915 and 945 chipsets support a 256MB aperture.
179 Aperture size is determined by inspected the
180 base address of the aperture. */
181 if (pci_resource_start(pdev, 2) & 0x08000000)
182 *aperture_size = MB(128);
183 else
184 *aperture_size = MB(256);
185 break;
186 default:
175 if ((tmp & INTEL_GMCH_MEM_MASK) == INTEL_GMCH_MEM_64M) 187 if ((tmp & INTEL_GMCH_MEM_MASK) == INTEL_GMCH_MEM_64M)
176 *aperture_size = MB(64); 188 *aperture_size = MB(64);
177 else 189 else
178 *aperture_size = MB(128); 190 *aperture_size = MB(128);
191 break;
192 }
193
194 /* Stolen memory size is reduced by the GTT and the popup.
195 GTT is 1K per MB of aperture size, and popup is 4K. */
196 stolen_overhead = (*aperture_size / MB(1)) + 4;
197 switch(pdev->device) {
198 case PCI_DEVICE_ID_INTEL_830M:
199 case PCI_DEVICE_ID_INTEL_845G:
179 switch (tmp & INTEL_830_GMCH_GMS_MASK) { 200 switch (tmp & INTEL_830_GMCH_GMS_MASK) {
180 case INTEL_830_GMCH_GMS_STOLEN_512: 201 case INTEL_830_GMCH_GMS_STOLEN_512:
181 *stolen_size = KB(512) - KB(132); 202 *stolen_size = KB(512) - KB(stolen_overhead);
182 return 0; 203 return 0;
183 case INTEL_830_GMCH_GMS_STOLEN_1024: 204 case INTEL_830_GMCH_GMS_STOLEN_1024:
184 *stolen_size = MB(1) - KB(132); 205 *stolen_size = MB(1) - KB(stolen_overhead);
185 return 0; 206 return 0;
186 case INTEL_830_GMCH_GMS_STOLEN_8192: 207 case INTEL_830_GMCH_GMS_STOLEN_8192:
187 *stolen_size = MB(8) - KB(132); 208 *stolen_size = MB(8) - KB(stolen_overhead);
188 return 0; 209 return 0;
189 case INTEL_830_GMCH_GMS_LOCAL: 210 case INTEL_830_GMCH_GMS_LOCAL:
190 ERR_MSG("only local memory found\n"); 211 ERR_MSG("only local memory found\n");
@@ -199,28 +220,27 @@ intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
199 } 220 }
200 break; 221 break;
201 default: 222 default:
202 *aperture_size = MB(128);
203 switch (tmp & INTEL_855_GMCH_GMS_MASK) { 223 switch (tmp & INTEL_855_GMCH_GMS_MASK) {
204 case INTEL_855_GMCH_GMS_STOLEN_1M: 224 case INTEL_855_GMCH_GMS_STOLEN_1M:
205 *stolen_size = MB(1) - KB(132); 225 *stolen_size = MB(1) - KB(stolen_overhead);
206 return 0; 226 return 0;
207 case INTEL_855_GMCH_GMS_STOLEN_4M: 227 case INTEL_855_GMCH_GMS_STOLEN_4M:
208 *stolen_size = MB(4) - KB(132); 228 *stolen_size = MB(4) - KB(stolen_overhead);
209 return 0; 229 return 0;
210 case INTEL_855_GMCH_GMS_STOLEN_8M: 230 case INTEL_855_GMCH_GMS_STOLEN_8M:
211 *stolen_size = MB(8) - KB(132); 231 *stolen_size = MB(8) - KB(stolen_overhead);
212 return 0; 232 return 0;
213 case INTEL_855_GMCH_GMS_STOLEN_16M: 233 case INTEL_855_GMCH_GMS_STOLEN_16M:
214 *stolen_size = MB(16) - KB(132); 234 *stolen_size = MB(16) - KB(stolen_overhead);
215 return 0; 235 return 0;
216 case INTEL_855_GMCH_GMS_STOLEN_32M: 236 case INTEL_855_GMCH_GMS_STOLEN_32M:
217 *stolen_size = MB(32) - KB(132); 237 *stolen_size = MB(32) - KB(stolen_overhead);
218 return 0; 238 return 0;
219 case INTEL_915G_GMCH_GMS_STOLEN_48M: 239 case INTEL_915G_GMCH_GMS_STOLEN_48M:
220 *stolen_size = MB(48) - KB(132); 240 *stolen_size = MB(48) - KB(stolen_overhead);
221 return 0; 241 return 0;
222 case INTEL_915G_GMCH_GMS_STOLEN_64M: 242 case INTEL_915G_GMCH_GMS_STOLEN_64M:
223 *stolen_size = MB(64) - KB(132); 243 *stolen_size = MB(64) - KB(stolen_overhead);
224 return 0; 244 return 0;
225 case INTEL_855_GMCH_GMS_DISABLED: 245 case INTEL_855_GMCH_GMS_DISABLED:
226 ERR_MSG("video memory is disabled\n"); 246 ERR_MSG("video memory is disabled\n");