]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/pci-gart_64.c
x86: apic - introduce get_physical_broadcast for 64bit
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / pci-gart_64.c
index aa569db73a2a9bf5147a86f68565c32cec1dfd28..145f1c83369f17a7e5696a7e241d1d28573606dc 100644 (file)
@@ -80,7 +80,7 @@ AGPEXTERN int agp_memory_reserved;
 AGPEXTERN __u32 *agp_gatt_table;
 
 static unsigned long next_bit;  /* protected by iommu_bitmap_lock */
-static int need_flush;         /* global flush state. set for each gart wrap */
+static bool need_flush;                /* global flush state. set for each gart wrap */
 
 static unsigned long alloc_iommu(struct device *dev, int size,
                                 unsigned long align_mask)
@@ -98,7 +98,7 @@ static unsigned long alloc_iommu(struct device *dev, int size,
        offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, next_bit,
                                  size, base_index, boundary_size, align_mask);
        if (offset == -1) {
-               need_flush = 1;
+               need_flush = true;
                offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, 0,
                                          size, base_index, boundary_size,
                                          align_mask);
@@ -107,11 +107,11 @@ static unsigned long alloc_iommu(struct device *dev, int size,
                next_bit = offset+size;
                if (next_bit >= iommu_pages) {
                        next_bit = 0;
-                       need_flush = 1;
+                       need_flush = true;
                }
        }
        if (iommu_fullflush)
-               need_flush = 1;
+               need_flush = true;
        spin_unlock_irqrestore(&iommu_bitmap_lock, flags);
 
        return offset;
@@ -136,7 +136,7 @@ static void flush_gart(void)
        spin_lock_irqsave(&iommu_bitmap_lock, flags);
        if (need_flush) {
                k8_flush_garts();
-               need_flush = 0;
+               need_flush = false;
        }
        spin_unlock_irqrestore(&iommu_bitmap_lock, flags);
 }
@@ -650,7 +650,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
        struct pci_dev *dev;
        void *gatt;
        int i, error;
-       unsigned long start_pfn, end_pfn;
 
        printk(KERN_INFO "PCI-DMA: Disabling AGP.\n");
        aper_size = aper_base = info->aper_size = 0;
@@ -674,13 +673,13 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
        info->aper_size = aper_size >> 20;
 
        gatt_size = (aper_size >> PAGE_SHIFT) * sizeof(u32);
-       gatt = (void *)__get_free_pages(GFP_KERNEL, get_order(gatt_size));
+       gatt = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
+                                       get_order(gatt_size));
        if (!gatt)
                panic("Cannot allocate GATT table");
        if (set_memory_uc((unsigned long)gatt, gatt_size >> PAGE_SHIFT))
                panic("Could not set GART PTEs to uncacheable pages");
 
-       memset(gatt, 0, gatt_size);
        agp_gatt_table = gatt;
 
        enable_gart_translations();
@@ -697,12 +696,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
        printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n",
               aper_base, aper_size>>10);
 
-       /* need to map that range */
-       end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
-       if (end_pfn > max_low_pfn_mapped) {
-               start_pfn = (aper_base>>PAGE_SHIFT);
-               init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
-       }
        return 0;
 
  nommu:
@@ -745,7 +738,8 @@ void __init gart_iommu_init(void)
 {
        struct agp_kern_info info;
        unsigned long iommu_start;
-       unsigned long aper_size;
+       unsigned long aper_base, aper_size;
+       unsigned long start_pfn, end_pfn;
        unsigned long scratch;
        long i;
 
@@ -783,24 +777,29 @@ void __init gart_iommu_init(void)
                return;
        }
 
+       /* need to map that range */
+       aper_size = info.aper_size << 20;
+       aper_base = info.aper_base;
+       end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
+       if (end_pfn > max_low_pfn_mapped) {
+               start_pfn = (aper_base>>PAGE_SHIFT);
+               init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
+       }
+
        printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n");
-       aper_size = info.aper_size * 1024 * 1024;
        iommu_size = check_iommu_size(info.aper_base, aper_size);
        iommu_pages = iommu_size >> PAGE_SHIFT;
 
-       iommu_gart_bitmap = (void *) __get_free_pages(GFP_KERNEL,
+       iommu_gart_bitmap = (void *) __get_free_pages(GFP_KERNEL | __GFP_ZERO,
                                                      get_order(iommu_pages/8));
        if (!iommu_gart_bitmap)
                panic("Cannot allocate iommu bitmap\n");
-       memset(iommu_gart_bitmap, 0, iommu_pages/8);
 
 #ifdef CONFIG_IOMMU_LEAK
        if (leak_trace) {
-               iommu_leak_tab = (void *)__get_free_pages(GFP_KERNEL,
+               iommu_leak_tab = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
                                  get_order(iommu_pages*sizeof(void *)));
-               if (iommu_leak_tab)
-                       memset(iommu_leak_tab, 0, iommu_pages * 8);
-               else
+               if (!iommu_leak_tab)
                        printk(KERN_DEBUG
                               "PCI-DMA: Cannot allocate leak trace area\n");
        }