aperture_64.c (8c9fd91a0dc503f085169d44f4360be025f75224) | aperture_64.c (7677b2ef6c0c4fddc84f6473f3863f40eb71821b) |
---|---|
1/* 2 * Firmware replacement code. 3 * 4 * Work around broken BIOSes that don't set an aperture or only set the 5 * aperture in the AGP bridge. 6 * If all fails map the aperture over some low memory. This is cheaper than 7 * doing bounce buffering. The memory is lost. This is done at early boot 8 * because only the bootmem allocator can allocate 32+MB. --- 41 unchanged lines hidden (view full) --- 50/* This code runs before the PCI subsystem is initialized, so just 51 access the northbridge directly. */ 52 53static u32 __init allocate_aperture(void) 54{ 55 u32 aper_size; 56 void *p; 57 | 1/* 2 * Firmware replacement code. 3 * 4 * Work around broken BIOSes that don't set an aperture or only set the 5 * aperture in the AGP bridge. 6 * If all fails map the aperture over some low memory. This is cheaper than 7 * doing bounce buffering. The memory is lost. This is done at early boot 8 * because only the bootmem allocator can allocate 32+MB. --- 41 unchanged lines hidden (view full) --- 50/* This code runs before the PCI subsystem is initialized, so just 51 access the northbridge directly. */ 52 53static u32 __init allocate_aperture(void) 54{ 55 u32 aper_size; 56 void *p; 57 |
58 if (fallback_aper_order > 7) 59 fallback_aper_order = 7; | 58 /* aper_size should <= 1G */ 59 if (fallback_aper_order > 5) 60 fallback_aper_order = 5; |
60 aper_size = (32 * 1024 * 1024) << fallback_aper_order; 61 62 /* 63 * Aperture has to be naturally aligned. This means a 2GB aperture 64 * won't have much chance of finding a place in the lower 4GB of 65 * memory. Unfortunately we cannot move it up because that would 66 * make the IOMMU useless. 67 */ | 61 aper_size = (32 * 1024 * 1024) << fallback_aper_order; 62 63 /* 64 * Aperture has to be naturally aligned. This means a 2GB aperture 65 * won't have much chance of finding a place in the lower 4GB of 66 * memory. Unfortunately we cannot move it up because that would 67 * make the IOMMU useless. 68 */ |
68 p = __alloc_bootmem_nopanic(aper_size, aper_size, 0); | 69 /* 70 * using 512M as goal, in case kexec will load kernel_big 71 * that will do the on position decompress, and could overlap with 72 * that positon with gart that is used. 73 * sequende: 74 * kernel_small 75 * ==> kexec (with kdump trigger path or previous doesn't shutdown gart) 76 * ==> kernel_small(gart area become e820_reserved) 77 * ==> kexec (with kdump trigger path or previous doesn't shutdown gart) 78 * ==> kerne_big (uncompressed size will be big than 64M or 128M) 79 * so don't use 512M below as gart iommu, leave the space for kernel 80 * code for safe 81 */ 82 p = __alloc_bootmem_nopanic(aper_size, aper_size, 512ULL<<20); |
69 if (!p || __pa(p)+aper_size > 0xffffffff) { 70 printk(KERN_ERR 71 "Cannot allocate aperture memory hole (%p,%uK)\n", 72 p, aper_size>>10); 73 if (p) 74 free_bootmem(__pa(p), aper_size); 75 return 0; 76 } --- 377 unchanged lines hidden --- | 83 if (!p || __pa(p)+aper_size > 0xffffffff) { 84 printk(KERN_ERR 85 "Cannot allocate aperture memory hole (%p,%uK)\n", 86 p, aper_size>>10); 87 if (p) 88 free_bootmem(__pa(p), aper_size); 89 return 0; 90 } --- 377 unchanged lines hidden --- |