Merge davem@outer-richmond.davemloft.net:src/GIT/net-2.6/
[powerpc.git] / drivers / char / agp / intel-agp.c
index 6a5047e..1f7d415 100644 (file)
@@ -286,7 +286,7 @@ static struct agp_memory *alloc_agpphysmem_i8xx(size_t pg_count, int type)
        if (new == NULL)
                return NULL;
 
-       new->memory[0] = virt_to_phys(addr);
+       new->memory[0] = virt_to_gart(addr);
        if (pg_count == 4) {
                /* kludge to get 4 physical pages for ARGB cursor */
                new->memory[1] = new->memory[0] + PAGE_SIZE;
@@ -329,10 +329,10 @@ static void intel_i810_free_by_type(struct agp_memory *curr)
        agp_free_key(curr->key);
        if(curr->type == AGP_PHYS_MEMORY) {
                if (curr->page_count == 4)
-                       i8xx_destroy_pages(phys_to_virt(curr->memory[0]));
+                       i8xx_destroy_pages(gart_to_virt(curr->memory[0]));
                else
                        agp_bridge->driver->agp_destroy_page(
-                                phys_to_virt(curr->memory[0]));
+                                gart_to_virt(curr->memory[0]));
                vfree(curr->memory);
        }
        kfree(curr);
@@ -1047,9 +1047,15 @@ static int intel_845_configure(void)
        /* aperture size */
        pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
 
-       /* address to map to */
-       pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
-       agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
+       if (agp_bridge->apbase_config != 0) {
+               pci_write_config_dword(agp_bridge->dev, AGP_APBASE,
+                                      agp_bridge->apbase_config);
+       } else {
+               /* address to map to */
+               pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
+               agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
+               agp_bridge->apbase_config = temp;
+       }
 
        /* attbase - aperture base */
        pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);