diff options
author | Dave Airlie <airlied@starflyer.(none)> | 2006-01-02 01:18:39 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-01-02 01:18:39 -0500 |
commit | f26c473cdf557ea6e8f267d34eee82d30473a363 (patch) | |
tree | 6b8f9ab884e26b5ee7861700a3e95808442d5720 /drivers/char/drm/ati_pcigart.c | |
parent | 0a406877e638a6f43ed4591bb08d528415d7d53a (diff) |
drm: update PCIGART support from CVS
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>
Diffstat (limited to 'drivers/char/drm/ati_pcigart.c')
-rw-r--r-- | drivers/char/drm/ati_pcigart.c | 23 |
1 files changed, 11 insertions, 12 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 | ||
55 | static unsigned long drm_ati_alloc_pcigart_table(void) | 55 | static 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 | ||
78 | static void drm_ati_free_pcigart_table(unsigned long address) | 78 | static 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 | ||
94 | int drm_ati_pcigart_cleanup(drm_device_t * dev, | 94 | int 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 | ||
137 | EXPORT_SYMBOL(drm_ati_pcigart_cleanup); | 136 | EXPORT_SYMBOL(drm_ati_pcigart_cleanup); |
138 | 137 | ||
139 | int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) | 138 | int 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 | } |