13
13
#include <linux/kernel.h>
14
14
#include <linux/types.h>
15
15
#include <linux/init.h>
16
#include <linux/bootmem.h>
16
#include <linux/memblock.h>
17
17
#include <linux/mmzone.h>
18
18
#include <linux/pci_ids.h>
19
19
#include <linux/pci.h>
74
74
* using 512M as goal, in case kexec will load kernel_big
75
75
* that will do the on position decompress, and could overlap with
76
* that positon with gart that is used.
76
* that position with gart that is used.
79
79
* ==> kexec (with kdump trigger path or previous doesn't shutdown gart)
83
83
* so don't use 512M below as gart iommu, leave the space for kernel
86
p = __alloc_bootmem_nopanic(aper_size, aper_size, 512ULL<<20);
86
addr = memblock_find_in_range(0, 1ULL<<32, aper_size, 512ULL<<20);
87
if (addr == MEMBLOCK_ERROR || addr + aper_size > 0xffffffff) {
89
"Cannot allocate aperture memory hole (%lx,%uK)\n",
93
memblock_x86_reserve_range(addr, addr + aper_size, "aperture64");
88
95
* Kmemleak should not scan this block as it may not be mapped via the
89
96
* kernel direct mapping.
92
if (!p || __pa(p)+aper_size > 0xffffffff) {
94
"Cannot allocate aperture memory hole (%p,%uK)\n",
97
free_bootmem(__pa(p), aper_size);
98
kmemleak_ignore(phys_to_virt(addr));
100
99
printk(KERN_INFO "Mapping aperture over %d KB of RAM @ %lx\n",
101
aper_size >> 10, __pa(p));
102
insert_aperture_resource((u32)__pa(p), aper_size);
103
register_nosave_region((u32)__pa(p) >> PAGE_SHIFT,
104
(u32)__pa(p+aper_size) >> PAGE_SHIFT);
100
aper_size >> 10, addr);
101
insert_aperture_resource((u32)addr, aper_size);
102
register_nosave_region(addr >> PAGE_SHIFT,
103
(addr+aper_size) >> PAGE_SHIFT);
500
499
* Don't enable translation yet but enable GART IO and CPU
501
500
* accesses and set DISTLBWALKPRB since GART table memory is UC.
503
u32 ctl = DISTLBWALKPRB | aper_order << 1;
502
u32 ctl = aper_order << 1;
505
504
bus = amd_nb_bus_dev_ranges[i].bus;
506
505
dev_base = amd_nb_bus_dev_ranges[i].dev_base;