aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm')
-rw-r--r--drivers/char/drm/ati_pcigart.c23
-rw-r--r--drivers/char/drm/drmP.h3
-rw-r--r--drivers/char/drm/r128_cce.c15
-rw-r--r--drivers/char/drm/r128_drm.h4
-rw-r--r--drivers/char/drm/r128_drv.h4
-rw-r--r--drivers/char/drm/r128_irq.c4
-rw-r--r--drivers/char/drm/r128_state.c4
-rw-r--r--drivers/char/drm/radeon_cp.c24
8 files changed, 43 insertions, 38 deletions
diff --git a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c
index efff0eec618c..5485382cadec 100644
--- a/drivers/char/drm/ati_pcigart.c
+++ b/drivers/char/drm/ati_pcigart.c
@@ -52,7 +52,7 @@
52# define ATI_MAX_PCIGART_PAGES 8192 /**< 32 MB aperture, 4K pages */ 52# define ATI_MAX_PCIGART_PAGES 8192 /**< 32 MB aperture, 4K pages */
53# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ 53# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */
54 54
55static unsigned long drm_ati_alloc_pcigart_table(void) 55static void *drm_ati_alloc_pcigart_table(void)
56{ 56{
57 unsigned long address; 57 unsigned long address;
58 struct page *page; 58 struct page *page;
@@ -72,27 +72,26 @@ static unsigned long drm_ati_alloc_pcigart_table(void)
72 } 72 }
73 73
74 DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address); 74 DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address);
75 return address; 75 return (void *)address;
76} 76}
77 77
78static void drm_ati_free_pcigart_table(unsigned long address) 78static void drm_ati_free_pcigart_table(void *address)
79{ 79{
80 struct page *page; 80 struct page *page;
81 int i; 81 int i;
82 DRM_DEBUG("%s\n", __FUNCTION__); 82 DRM_DEBUG("%s\n", __FUNCTION__);
83 83
84 page = virt_to_page(address); 84 page = virt_to_page((unsigned long)address);
85 85
86 for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { 86 for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) {
87 __put_page(page); 87 __put_page(page);
88 ClearPageReserved(page); 88 ClearPageReserved(page);
89 } 89 }
90 90
91 free_pages(address, ATI_PCIGART_TABLE_ORDER); 91 free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER);
92} 92}
93 93
94int drm_ati_pcigart_cleanup(drm_device_t * dev, 94int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info)
95 drm_ati_pcigart_info * gart_info)
96{ 95{
97 drm_sg_mem_t *entry = dev->sg; 96 drm_sg_mem_t *entry = dev->sg;
98 unsigned long pages; 97 unsigned long pages;
@@ -136,10 +135,10 @@ int drm_ati_pcigart_cleanup(drm_device_t * dev,
136 135
137EXPORT_SYMBOL(drm_ati_pcigart_cleanup); 136EXPORT_SYMBOL(drm_ati_pcigart_cleanup);
138 137
139int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) 138int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info)
140{ 139{
141 drm_sg_mem_t *entry = dev->sg; 140 drm_sg_mem_t *entry = dev->sg;
142 unsigned long address = 0; 141 void *address = NULL;
143 unsigned long pages; 142 unsigned long pages;
144 u32 *pci_gart, page_base, bus_address = 0; 143 u32 *pci_gart, page_base, bus_address = 0;
145 int i, j, ret = 0; 144 int i, j, ret = 0;
@@ -163,7 +162,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info)
163 goto done; 162 goto done;
164 } 163 }
165 164
166 bus_address = pci_map_single(dev->pdev, (void *)address, 165 bus_address = pci_map_single(dev->pdev, address,
167 ATI_PCIGART_TABLE_PAGES * 166 ATI_PCIGART_TABLE_PAGES *
168 PAGE_SIZE, PCI_DMA_TODEVICE); 167 PAGE_SIZE, PCI_DMA_TODEVICE);
169 if (bus_address == 0) { 168 if (bus_address == 0) {
@@ -176,7 +175,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info)
176 address = gart_info->addr; 175 address = gart_info->addr;
177 bus_address = gart_info->bus_addr; 176 bus_address = gart_info->bus_addr;
178 DRM_DEBUG("PCI: Gart Table: VRAM %08X mapped at %08lX\n", 177 DRM_DEBUG("PCI: Gart Table: VRAM %08X mapped at %08lX\n",
179 bus_address, address); 178 bus_address, (unsigned long)address);
180 } 179 }
181 180
182 pci_gart = (u32 *) address; 181 pci_gart = (u32 *) address;
@@ -195,7 +194,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info)
195 if (entry->busaddr[i] == 0) { 194 if (entry->busaddr[i] == 0) {
196 DRM_ERROR("unable to map PCIGART pages!\n"); 195 DRM_ERROR("unable to map PCIGART pages!\n");
197 drm_ati_pcigart_cleanup(dev, gart_info); 196 drm_ati_pcigart_cleanup(dev, gart_info);
198 address = 0; 197 address = NULL;
199 bus_address = 0; 198 bus_address = 0;
200 goto done; 199 goto done;
201 } 200 }
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index a3ad85e05bd3..43c49ad3069b 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -522,8 +522,9 @@ typedef struct drm_vbl_sig {
522typedef struct ati_pcigart_info { 522typedef struct ati_pcigart_info {
523 int gart_table_location; 523 int gart_table_location;
524 int is_pcie; 524 int is_pcie;
525 unsigned long addr; 525 void *addr;
526 dma_addr_t bus_addr; 526 dma_addr_t bus_addr;
527 drm_local_map_t mapping;
527} drm_ati_pcigart_info; 528} drm_ati_pcigart_info;
528 529
529/** 530/**
diff --git a/drivers/char/drm/r128_cce.c b/drivers/char/drm/r128_cce.c
index 7452753d4d01..db5a60450e68 100644
--- a/drivers/char/drm/r128_cce.c
+++ b/drivers/char/drm/r128_cce.c
@@ -1,6 +1,7 @@
1/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*- 1/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*-
2 * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com 2 * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com
3 * 3 */
4/*
4 * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. 5 * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 6 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6 * All Rights Reserved. 7 * All Rights Reserved.
@@ -559,7 +560,8 @@ static int r128_do_init_cce(drm_device_t * dev, drm_r128_init_t * init)
559 if (dev_priv->is_pci) { 560 if (dev_priv->is_pci) {
560#endif 561#endif
561 dev_priv->gart_info.gart_table_location = DRM_ATI_GART_MAIN; 562 dev_priv->gart_info.gart_table_location = DRM_ATI_GART_MAIN;
562 dev_priv->gart_info.addr = dev_priv->gart_info.bus_addr = 0; 563 dev_priv->gart_info.addr = NULL;
564 dev_priv->gart_info.bus_addr = 0;
563 dev_priv->gart_info.is_pcie = 0; 565 dev_priv->gart_info.is_pcie = 0;
564 if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) { 566 if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) {
565 DRM_ERROR("failed to init PCI GART!\n"); 567 DRM_ERROR("failed to init PCI GART!\n");
@@ -601,15 +603,16 @@ int r128_do_cleanup_cce(drm_device_t * dev)
601 drm_core_ioremapfree(dev_priv->cce_ring, dev); 603 drm_core_ioremapfree(dev_priv->cce_ring, dev);
602 if (dev_priv->ring_rptr != NULL) 604 if (dev_priv->ring_rptr != NULL)
603 drm_core_ioremapfree(dev_priv->ring_rptr, dev); 605 drm_core_ioremapfree(dev_priv->ring_rptr, dev);
604 if (dev->agp_buffer_map != NULL) 606 if (dev->agp_buffer_map != NULL) {
605 drm_core_ioremapfree(dev->agp_buffer_map, dev); 607 drm_core_ioremapfree(dev->agp_buffer_map, dev);
608 dev->agp_buffer_map = NULL;
609 }
606 } else 610 } else
607#endif 611#endif
608 { 612 {
609 if (dev_priv->gart_info.bus_addr) 613 if (dev_priv->gart_info.bus_addr)
610 if (!drm_ati_pcigart_cleanup(dev, 614 if (!drm_ati_pcigart_cleanup(dev,
611 &dev_priv-> 615 &dev_priv->gart_info))
612 gart_info))
613 DRM_ERROR 616 DRM_ERROR
614 ("failed to cleanup PCI GART!\n"); 617 ("failed to cleanup PCI GART!\n");
615 } 618 }
diff --git a/drivers/char/drm/r128_drm.h b/drivers/char/drm/r128_drm.h
index 5ddc03202411..5d835b006f55 100644
--- a/drivers/char/drm/r128_drm.h
+++ b/drivers/char/drm/r128_drm.h
@@ -1,7 +1,7 @@
1/* r128_drm.h -- Public header for the r128 driver -*- linux-c -*- 1/* r128_drm.h -- Public header for the r128 driver -*- linux-c -*-
2 * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com 2 * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com
3 * 3 */
4 * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. 4/* Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
diff --git a/drivers/char/drm/r128_drv.h b/drivers/char/drm/r128_drv.h
index 9a779bad3da3..94abffb2cca5 100644
--- a/drivers/char/drm/r128_drv.h
+++ b/drivers/char/drm/r128_drv.h
@@ -1,7 +1,7 @@
1/* r128_drv.h -- Private header for r128 driver -*- linux-c -*- 1/* r128_drv.h -- Private header for r128 driver -*- linux-c -*-
2 * Created: Mon Dec 13 09:51:11 1999 by faith@precisioninsight.com 2 * Created: Mon Dec 13 09:51:11 1999 by faith@precisioninsight.com
3 * 3 */
4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 4/* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
diff --git a/drivers/char/drm/r128_irq.c b/drivers/char/drm/r128_irq.c
index 27eb0e31bd3b..87f8ca2b0685 100644
--- a/drivers/char/drm/r128_irq.c
+++ b/drivers/char/drm/r128_irq.c
@@ -1,5 +1,5 @@
1/* r128_irq.c -- IRQ handling for radeon -*- linux-c -*- 1/* r128_irq.c -- IRQ handling for radeon -*- linux-c -*- */
2 * 2/*
3 * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. 3 * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
4 * 4 *
5 * The Weather Channel (TM) funded Tungsten Graphics to develop the 5 * The Weather Channel (TM) funded Tungsten Graphics to develop the
diff --git a/drivers/char/drm/r128_state.c b/drivers/char/drm/r128_state.c
index 6aeeb4b62d03..caeecc2c36da 100644
--- a/drivers/char/drm/r128_state.c
+++ b/drivers/char/drm/r128_state.c
@@ -1,7 +1,7 @@
1/* r128_state.c -- State support for r128 -*- linux-c -*- 1/* r128_state.c -- State support for r128 -*- linux-c -*-
2 * Created: Thu Jan 27 02:53:43 2000 by gareth@valinux.com 2 * Created: Thu Jan 27 02:53:43 2000 by gareth@valinux.com
3 * 3 */
4 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 4/* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
5 * All Rights Reserved. 5 * All Rights Reserved.
6 * 6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a 7 * Permission is hereby granted, free of charge, to any person obtaining a
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index dc3a15a1819a..eaa0e2b7c2f8 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -1,5 +1,5 @@
1/* radeon_cp.c -- CP support for Radeon -*- linux-c -*- 1/* radeon_cp.c -- CP support for Radeon -*- linux-c -*- */
2 * 2/*
3 * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. 3 * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
4 * Copyright 2000 VA Linux Systems, Inc., Fremont, California. 4 * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
5 * All Rights Reserved. 5 * All Rights Reserved.
@@ -1561,25 +1561,28 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
1561 if (dev_priv->pcigart_offset) { 1561 if (dev_priv->pcigart_offset) {
1562 dev_priv->gart_info.bus_addr = 1562 dev_priv->gart_info.bus_addr =
1563 dev_priv->pcigart_offset + dev_priv->fb_location; 1563 dev_priv->pcigart_offset + dev_priv->fb_location;
1564 dev_priv->gart_info.mapping.offset =
1565 dev_priv->gart_info.bus_addr;
1566 dev_priv->gart_info.mapping.size =
1567 RADEON_PCIGART_TABLE_SIZE;
1568
1569 drm_core_ioremap(&dev_priv->gart_info.mapping, dev);
1564 dev_priv->gart_info.addr = 1570 dev_priv->gart_info.addr =
1565 (unsigned long)drm_ioremap(dev_priv->gart_info. 1571 dev_priv->gart_info.mapping.handle;
1566 bus_addr,
1567 RADEON_PCIGART_TABLE_SIZE,
1568 dev);
1569 1572
1570 dev_priv->gart_info.is_pcie = 1573 dev_priv->gart_info.is_pcie =
1571 !!(dev_priv->flags & CHIP_IS_PCIE); 1574 !!(dev_priv->flags & CHIP_IS_PCIE);
1572 dev_priv->gart_info.gart_table_location = 1575 dev_priv->gart_info.gart_table_location =
1573 DRM_ATI_GART_FB; 1576 DRM_ATI_GART_FB;
1574 1577
1575 DRM_DEBUG("Setting phys_pci_gart to %08lX %08lX\n", 1578 DRM_DEBUG("Setting phys_pci_gart to %p %08lX\n",
1576 dev_priv->gart_info.addr, 1579 dev_priv->gart_info.addr,
1577 dev_priv->pcigart_offset); 1580 dev_priv->pcigart_offset);
1578 } else { 1581 } else {
1579 dev_priv->gart_info.gart_table_location = 1582 dev_priv->gart_info.gart_table_location =
1580 DRM_ATI_GART_MAIN; 1583 DRM_ATI_GART_MAIN;
1581 dev_priv->gart_info.addr = 1584 dev_priv->gart_info.addr = NULL;
1582 dev_priv->gart_info.bus_addr = 0; 1585 dev_priv->gart_info.bus_addr = 0;
1583 if (dev_priv->flags & CHIP_IS_PCIE) { 1586 if (dev_priv->flags & CHIP_IS_PCIE) {
1584 DRM_ERROR 1587 DRM_ERROR
1585 ("Cannot use PCI Express without GART in FB memory\n"); 1588 ("Cannot use PCI Express without GART in FB memory\n");
@@ -1641,8 +1644,7 @@ static int radeon_do_cleanup_cp(drm_device_t * dev)
1641 DRM_ERROR("failed to cleanup PCI GART!\n"); 1644 DRM_ERROR("failed to cleanup PCI GART!\n");
1642 1645
1643 if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB) { 1646 if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB) {
1644 drm_ioremapfree((void *)dev_priv->gart_info.addr, 1647 drm_core_ioremapfree(&dev_priv->gart_info.mapping, dev);
1645 RADEON_PCIGART_TABLE_SIZE, dev);
1646 dev_priv->gart_info.addr = 0; 1648 dev_priv->gart_info.addr = 0;
1647 } 1649 }
1648 } 1650 }