]> err.no Git - linux-2.6/commitdiff
drm: update PCIGART support from CVS
authorDave Airlie <airlied@starflyer.(none)>
Mon, 2 Jan 2006 06:18:39 +0000 (17:18 +1100)
committerDave Airlie <airlied@linux.ie>
Mon, 2 Jan 2006 06:18:39 +0000 (17:18 +1100)
In order to work on FreeBSD the gart needed to use a local mapping
This patch moves the mainline to the new code and aligns some comment
changes

From: Eric Anholt <anholt@freebsd.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/char/drm/ati_pcigart.c
drivers/char/drm/drmP.h
drivers/char/drm/r128_cce.c
drivers/char/drm/r128_drm.h
drivers/char/drm/r128_drv.h
drivers/char/drm/r128_irq.c
drivers/char/drm/r128_state.c
drivers/char/drm/radeon_cp.c

index efff0eec618c23c28fc78c1eb55dfe409cb7730c..5485382cadec8cc361293569bba79a985687f97e 100644 (file)
@@ -52,7 +52,7 @@
 # define ATI_MAX_PCIGART_PAGES         8192    /**< 32 MB aperture, 4K pages */
 # define ATI_PCIGART_PAGE_SIZE         4096    /**< PCI GART page size */
 
-static unsigned long drm_ati_alloc_pcigart_table(void)
+static void *drm_ati_alloc_pcigart_table(void)
 {
        unsigned long address;
        struct page *page;
@@ -72,27 +72,26 @@ static unsigned long drm_ati_alloc_pcigart_table(void)
        }
 
        DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address);
-       return address;
+       return (void *)address;
 }
 
-static void drm_ati_free_pcigart_table(unsigned long address)
+static void drm_ati_free_pcigart_table(void *address)
 {
        struct page *page;
        int i;
        DRM_DEBUG("%s\n", __FUNCTION__);
 
-       page = virt_to_page(address);
+       page = virt_to_page((unsigned long)address);
 
        for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) {
                __put_page(page);
                ClearPageReserved(page);
        }
 
-       free_pages(address, ATI_PCIGART_TABLE_ORDER);
+       free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER);
 }
 
-int drm_ati_pcigart_cleanup(drm_device_t * dev,
-                           drm_ati_pcigart_info * gart_info)
+int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info)
 {
        drm_sg_mem_t *entry = dev->sg;
        unsigned long pages;
@@ -136,10 +135,10 @@ int drm_ati_pcigart_cleanup(drm_device_t * dev,
 
 EXPORT_SYMBOL(drm_ati_pcigart_cleanup);
 
-int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info)
+int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info)
 {
        drm_sg_mem_t *entry = dev->sg;
-       unsigned long address = 0;
+       void *address = NULL;
        unsigned long pages;
        u32 *pci_gart, page_base, bus_address = 0;
        int i, j, ret = 0;
@@ -163,7 +162,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info)
                        goto done;
                }
 
-               bus_address = pci_map_single(dev->pdev, (void *)address,
+               bus_address = pci_map_single(dev->pdev, address,
                                             ATI_PCIGART_TABLE_PAGES *
                                             PAGE_SIZE, PCI_DMA_TODEVICE);
                if (bus_address == 0) {
@@ -176,7 +175,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info)
                address = gart_info->addr;
                bus_address = gart_info->bus_addr;
                DRM_DEBUG("PCI: Gart Table: VRAM %08X mapped at %08lX\n",
-                         bus_address, address);
+                         bus_address, (unsigned long)address);
        }
 
        pci_gart = (u32 *) address;
@@ -195,7 +194,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info)
                if (entry->busaddr[i] == 0) {
                        DRM_ERROR("unable to map PCIGART pages!\n");
                        drm_ati_pcigart_cleanup(dev, gart_info);
-                       address = 0;
+                       address = NULL;
                        bus_address = 0;
                        goto done;
                }
index a3ad85e05bd31a4b1ec5d30317572a42533acab4..43c49ad3069bc236940266b82ef88caaa9444ec4 100644 (file)
@@ -522,8 +522,9 @@ typedef struct drm_vbl_sig {
 typedef struct ati_pcigart_info {
        int gart_table_location;
        int is_pcie;
-       unsigned long addr;
+       void *addr;
        dma_addr_t bus_addr;
+       drm_local_map_t mapping;
 } drm_ati_pcigart_info;
 
 /**
index 7452753d4d01d2c0ba8c9c4d6cecd51c95044cfd..db5a60450e689c58f8df6c0ee6800bb8f4f78c0b 100644 (file)
@@ -1,6 +1,7 @@
-/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*-
+/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*- 
  * Created: Wed Apr  5 19:24:19 2000 by kevin@precisioninsight.com
- *
+ */
+/*
  * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
  * All Rights Reserved.
@@ -559,7 +560,8 @@ static int r128_do_init_cce(drm_device_t * dev, drm_r128_init_t * init)
        if (dev_priv->is_pci) {
 #endif
                dev_priv->gart_info.gart_table_location = DRM_ATI_GART_MAIN;
-               dev_priv->gart_info.addr = dev_priv->gart_info.bus_addr = 0;
+               dev_priv->gart_info.addr = NULL;
+               dev_priv->gart_info.bus_addr = 0;
                dev_priv->gart_info.is_pcie = 0;
                if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) {
                        DRM_ERROR("failed to init PCI GART!\n");
@@ -601,15 +603,16 @@ int r128_do_cleanup_cce(drm_device_t * dev)
                                drm_core_ioremapfree(dev_priv->cce_ring, dev);
                        if (dev_priv->ring_rptr != NULL)
                                drm_core_ioremapfree(dev_priv->ring_rptr, dev);
-                       if (dev->agp_buffer_map != NULL)
+                       if (dev->agp_buffer_map != NULL) {
                                drm_core_ioremapfree(dev->agp_buffer_map, dev);
+                               dev->agp_buffer_map = NULL;
+                       }
                } else
 #endif
                {
                        if (dev_priv->gart_info.bus_addr)
                                if (!drm_ati_pcigart_cleanup(dev,
-                                                            &dev_priv->
-                                                            gart_info))
+                                                       &dev_priv->gart_info))
                                        DRM_ERROR
                                            ("failed to cleanup PCI GART!\n");
                }
index 5ddc03202411aea7525739a00e1fc3bb1b52b0a2..5d835b006f55e41941e7ccdae4f7a11e45d61655 100644 (file)
@@ -1,7 +1,7 @@
 /* r128_drm.h -- Public header for the r128 driver -*- linux-c -*-
  * Created: Wed Apr  5 19:24:19 2000 by kevin@precisioninsight.com
- *
- * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
+ */
+/* Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
  * All rights reserved.
  *
index 9a779bad3da321a35048f6f27297009b5b24b491..94abffb2cca56859ded7d19631b77f39af2396cf 100644 (file)
@@ -1,7 +1,7 @@
 /* r128_drv.h -- Private header for r128 driver -*- linux-c -*-
  * Created: Mon Dec 13 09:51:11 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ */
+/* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
  * All rights reserved.
  *
index 27eb0e31bd3b3007f7b84a7c717ee7fa2ec7d177..87f8ca2b0685aa4497fb2c02cb906b2f87cdbd40 100644 (file)
@@ -1,5 +1,5 @@
-/* r128_irq.c -- IRQ handling for radeon -*- linux-c -*-
- *
+/* r128_irq.c -- IRQ handling for radeon -*- linux-c -*- */
+/*
  * Copyright (C) The Weather Channel, Inc.  2002.  All Rights Reserved.
  *
  * The Weather Channel (TM) funded Tungsten Graphics to develop the
index 6aeeb4b62d0361cddcd76024b98c65a6c084a4a7..caeecc2c36dab290ddd6da3cf85c38bab7c2d157 100644 (file)
@@ -1,7 +1,7 @@
 /* r128_state.c -- State support for r128 -*- linux-c -*-
  * Created: Thu Jan 27 02:53:43 2000 by gareth@valinux.com
- *
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ */
+/* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
  * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
index dc3a15a1819ac9c48d8aa8781a42bfc14bf6c617..eaa0e2b7c2f8e9ba34057ee31af02368ecb9c3aa 100644 (file)
@@ -1,5 +1,5 @@
-/* radeon_cp.c -- CP support for Radeon -*- linux-c -*-
- *
+/* radeon_cp.c -- CP support for Radeon -*- linux-c -*- */
+/*
  * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
  * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
  * All Rights Reserved.
@@ -1561,25 +1561,28 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
                if (dev_priv->pcigart_offset) {
                        dev_priv->gart_info.bus_addr =
                            dev_priv->pcigart_offset + dev_priv->fb_location;
+                       dev_priv->gart_info.mapping.offset =
+                           dev_priv->gart_info.bus_addr;
+                       dev_priv->gart_info.mapping.size =
+                           RADEON_PCIGART_TABLE_SIZE;
+
+                       drm_core_ioremap(&dev_priv->gart_info.mapping, dev);
                        dev_priv->gart_info.addr =
-                           (unsigned long)drm_ioremap(dev_priv->gart_info.
-                                                      bus_addr,
-                                                      RADEON_PCIGART_TABLE_SIZE,
-                                                      dev);
+                           dev_priv->gart_info.mapping.handle;
 
                        dev_priv->gart_info.is_pcie =
                            !!(dev_priv->flags & CHIP_IS_PCIE);
                        dev_priv->gart_info.gart_table_location =
                            DRM_ATI_GART_FB;
 
-                       DRM_DEBUG("Setting phys_pci_gart to %08lX %08lX\n",
+                       DRM_DEBUG("Setting phys_pci_gart to %p %08lX\n",
                                  dev_priv->gart_info.addr,
                                  dev_priv->pcigart_offset);
                } else {
                        dev_priv->gart_info.gart_table_location =
                            DRM_ATI_GART_MAIN;
-                       dev_priv->gart_info.addr =
-                           dev_priv->gart_info.bus_addr = 0;
+                       dev_priv->gart_info.addr = NULL;
+                       dev_priv->gart_info.bus_addr = 0;
                        if (dev_priv->flags & CHIP_IS_PCIE) {
                                DRM_ERROR
                                    ("Cannot use PCI Express without GART in FB memory\n");
@@ -1641,8 +1644,7 @@ static int radeon_do_cleanup_cp(drm_device_t * dev)
                                DRM_ERROR("failed to cleanup PCI GART!\n");
 
                if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB) {
-                       drm_ioremapfree((void *)dev_priv->gart_info.addr,
-                                       RADEON_PCIGART_TABLE_SIZE, dev);
+                       drm_core_ioremapfree(&dev_priv->gart_info.mapping, dev);
                        dev_priv->gart_info.addr = 0;
                }
        }