aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp/amd64-agp.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-04-13 21:42:31 -0400
committerIngo Molnar <mingo@elte.hu>2008-05-12 15:28:10 -0400
commit8c9fd91a0dc503f085169d44f4360be025f75224 (patch)
tree9c182a2683d427ea10aa8f846bac1d0bb51f09ac /drivers/char/agp/amd64-agp.c
parent1edc1ab3f68168ec6815e6d630f38948a6da005a (diff)
x86: checking aperture size order
some systems are using 32M for gart and agp when memory is less than 4G. Kernel will reject and try to allcate another 64M that is not needed, and we will waste 64M of perfectly good RAM. this patch adds a workaround by checking aper_base/order between NB and agp bridge. If they are the same, and memory size is less than 4G, it will allow it. Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/char/agp/amd64-agp.c')
-rw-r--r--drivers/char/agp/amd64-agp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 9e3939db76e8..9c24470a8252 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -245,11 +245,7 @@ static int __devinit aperture_valid(u64 aper, u32 size)
245 printk(KERN_ERR PFX "No aperture\n"); 245 printk(KERN_ERR PFX "No aperture\n");
246 return 0; 246 return 0;
247 } 247 }
248 if (size < 32*1024*1024) { 248 if ((u64)aper + size > 0x100000000ULL) {
249 printk(KERN_ERR PFX "Aperture too small (%d MB)\n", size>>20);
250 return 0;
251 }
252 if ((u64)aper + size > 0x100000000ULL) {
253 printk(KERN_ERR PFX "Aperture out of bounds\n"); 249 printk(KERN_ERR PFX "Aperture out of bounds\n");
254 return 0; 250 return 0;
255 } 251 }
@@ -257,6 +253,10 @@ static int __devinit aperture_valid(u64 aper, u32 size)
257 printk(KERN_ERR PFX "Aperture pointing to RAM\n"); 253 printk(KERN_ERR PFX "Aperture pointing to RAM\n");
258 return 0; 254 return 0;
259 } 255 }
256 if (size < 32*1024*1024) {
257 printk(KERN_ERR PFX "Aperture too small (%d MB)\n", size>>20);
258 return 0;
259 }
260 260
261 /* Request the Aperture. This catches cases when someone else 261 /* Request the Aperture. This catches cases when someone else
262 already put a mapping in there - happens with some very broken BIOS 262 already put a mapping in there - happens with some very broken BIOS
@@ -317,7 +317,7 @@ static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
317 * On some sick chips APSIZE is 0. This means it wants 4G 317 * On some sick chips APSIZE is 0. This means it wants 4G
318 * so let double check that order, and lets trust the AMD NB settings 318 * so let double check that order, and lets trust the AMD NB settings
319 */ 319 */
320 if (aper + (32ULL<<(20 + order)) > 0x100000000ULL) { 320 if (order >=0 && aper + (32ULL<<(20 + order)) > 0x100000000ULL) {
321 printk(KERN_INFO "Aperture size %u MB is not right, using settings from NB\n", 321 printk(KERN_INFO "Aperture size %u MB is not right, using settings from NB\n",
322 32 << order); 322 32 << order);
323 order = nb_order; 323 order = nb_order;