tdfx_pci.c (63488) | tdfx_pci.c (64085) |
---|---|
1/* 2 * Copyright (c) 2000 by Coleman Kane <cokane@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * | 1/* 2 * Copyright (c) 2000 by Coleman Kane <cokane@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * |
31 * $FreeBSD: head/sys/dev/tdfx/tdfx_pci.c 63488 2000-07-19 05:41:14Z cokane $ | 31 * $FreeBSD: head/sys/dev/tdfx/tdfx_pci.c 64085 2000-08-01 05:10:29Z cokane $ |
32 */ 33 34/* 3dfx driver for FreeBSD 4.x - Finished 11 May 2000, 12:25AM ET 35 * 36 * Copyright (C) 2000, by Coleman Kane <cokane@FreeBSD.org>, 37 * based upon the 3dfx driver written for linux, by Daryll Straus, Jon Taylor, 38 * and Jens Axboe, located at http://linux.3dfx.com. 39 */ --- 176 unchanged lines hidden (view full) --- 216 device_printf(dev, "Mapped to: 0x%x\n", 217 (unsigned int)rman_get_start(tdfx_info->memrange)); 218#endif 219 } 220 221 /* Setup for Voodoo3 and Banshee, PIO and an extram Memrange */ 222 if(pci_get_devid(dev) == PCI_DEVICE_3DFX_VOODOO3 || 223 pci_get_devid(dev) == PCI_DEVICE_3DFX_BANSHEE) { | 32 */ 33 34/* 3dfx driver for FreeBSD 4.x - Finished 11 May 2000, 12:25AM ET 35 * 36 * Copyright (C) 2000, by Coleman Kane <cokane@FreeBSD.org>, 37 * based upon the 3dfx driver written for linux, by Daryll Straus, Jon Taylor, 38 * and Jens Axboe, located at http://linux.3dfx.com. 39 */ --- 176 unchanged lines hidden (view full) --- 216 device_printf(dev, "Mapped to: 0x%x\n", 217 (unsigned int)rman_get_start(tdfx_info->memrange)); 218#endif 219 } 220 221 /* Setup for Voodoo3 and Banshee, PIO and an extram Memrange */ 222 if(pci_get_devid(dev) == PCI_DEVICE_3DFX_VOODOO3 || 223 pci_get_devid(dev) == PCI_DEVICE_3DFX_BANSHEE) { |
224 rid = PCIR_MAPS; | 224 rid = 0x14; /* 2nd mem map */ |
225 tdfx_info->addr1 = (pci_read_config(dev, 0x14, 4) & 0xffff0000); 226#ifdef DEBUG 227 device_printf(dev, "Base1 @ 0x%x\n", tdfx_info->addr1); 228#endif 229 tdfx_info->memrange2 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 230 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE); 231 if(tdfx_info->memrange2 == NULL) { 232#ifdef DEBUG 233 device_printf(dev, "Mem1 couldn't be allocated, glide may not work."); 234#endif 235 tdfx_info->memrid2 = 0; 236 } 237 else { 238 tdfx_info->memrid2 = rid; 239 } 240 /* Now to map the PIO stuff */ | 225 tdfx_info->addr1 = (pci_read_config(dev, 0x14, 4) & 0xffff0000); 226#ifdef DEBUG 227 device_printf(dev, "Base1 @ 0x%x\n", tdfx_info->addr1); 228#endif 229 tdfx_info->memrange2 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 230 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE); 231 if(tdfx_info->memrange2 == NULL) { 232#ifdef DEBUG 233 device_printf(dev, "Mem1 couldn't be allocated, glide may not work."); 234#endif 235 tdfx_info->memrid2 = 0; 236 } 237 else { 238 tdfx_info->memrid2 = rid; 239 } 240 /* Now to map the PIO stuff */ |
241 rid = 0; | 241/* rid = 0; |
242 tdfx_info->piorange = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 243 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE); 244 if(tdfx_info->piorange == NULL) { 245#ifdef DEBUG 246 device_printf(dev, "Couldn't map PIO range."); 247#endif 248 tdfx_info->piorid = 0; 249 } 250 else { 251 tdfx_info->piorid = rid; | 242 tdfx_info->piorange = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 243 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE); 244 if(tdfx_info->piorange == NULL) { 245#ifdef DEBUG 246 device_printf(dev, "Couldn't map PIO range."); 247#endif 248 tdfx_info->piorid = 0; 249 } 250 else { 251 tdfx_info->piorid = rid; |
252 } | 252 }*/ |
253 } else { 254 tdfx_info->addr1 = 0; 255 tdfx_info->memrange2 = NULL; 256 tdfx_info->piorange = NULL; 257 } 258 259 /* 260 * Set Writecombining, or at least Uncacheable for the memory region, if we --- 30 unchanged lines hidden (view full) --- 291 tdfx_info->memrange); 292 293 /* Release extended Voodoo3/Banshee resources */ 294 if(pci_get_devid(dev) == PCI_DEVICE_3DFX_BANSHEE || 295 pci_get_devid(dev) == PCI_DEVICE_3DFX_VOODOO3) { 296 if(tdfx_info->memrange2 != NULL) 297 bus_release_resource(dev, SYS_RES_MEMORY, tdfx_info->memrid2, 298 tdfx_info->memrange); | 253 } else { 254 tdfx_info->addr1 = 0; 255 tdfx_info->memrange2 = NULL; 256 tdfx_info->piorange = NULL; 257 } 258 259 /* 260 * Set Writecombining, or at least Uncacheable for the memory region, if we --- 30 unchanged lines hidden (view full) --- 291 tdfx_info->memrange); 292 293 /* Release extended Voodoo3/Banshee resources */ 294 if(pci_get_devid(dev) == PCI_DEVICE_3DFX_BANSHEE || 295 pci_get_devid(dev) == PCI_DEVICE_3DFX_VOODOO3) { 296 if(tdfx_info->memrange2 != NULL) 297 bus_release_resource(dev, SYS_RES_MEMORY, tdfx_info->memrid2, 298 tdfx_info->memrange); |
299 if(tdfx_info->piorange != NULL) | 299 /* if(tdfx_info->piorange != NULL) |
300 bus_release_resource(dev, SYS_RES_IOPORT, tdfx_info->piorid, | 300 bus_release_resource(dev, SYS_RES_IOPORT, tdfx_info->piorid, |
301 tdfx_info->piorange); | 301 tdfx_info->piorange);*/ |
302 } 303 304 /* Though it is safe to leave the WRCOMB support since the 305 mem driver checks for it, we should remove it in order 306 to free an MTRR for another device */ 307 retval = tdfx_clrmtrr(dev); 308#ifdef DEBUG 309 if(retval != 0) --- 159 unchanged lines hidden (view full) --- 469 } 470 471 /* We must stay within the bound of our address space */ 472 if((offset & 0xff000000) == tdfx_info->addr0) 473 offset &= 0xffffff; 474 475 /* See if the Banshee/V3 LFB is being requested */ 476 if(tdfx_info->memrange2 != NULL && (offset & 0xff000000) == | 302 } 303 304 /* Though it is safe to leave the WRCOMB support since the 305 mem driver checks for it, we should remove it in order 306 to free an MTRR for another device */ 307 retval = tdfx_clrmtrr(dev); 308#ifdef DEBUG 309 if(retval != 0) --- 159 unchanged lines hidden (view full) --- 469 } 470 471 /* We must stay within the bound of our address space */ 472 if((offset & 0xff000000) == tdfx_info->addr0) 473 offset &= 0xffffff; 474 475 /* See if the Banshee/V3 LFB is being requested */ 476 if(tdfx_info->memrange2 != NULL && (offset & 0xff000000) == |
477 tdfx_info->addr1) | 477 tdfx_info->addr1) { |
478 offset &= 0xffffff; | 478 offset &= 0xffffff; |
479 return atop(rman_get_start(tdfx_info->memrange2) + offset); 480 } |
|
479 480 if((offset >= 0x1000000) || (offset < 0)) { 481#ifdef DEBUG 482 printf("tdfx: offset %x out of range\n", offset); 483#endif 484 return -1; 485 } 486 --- 355 unchanged lines hidden --- | 481 482 if((offset >= 0x1000000) || (offset < 0)) { 483#ifdef DEBUG 484 printf("tdfx: offset %x out of range\n", offset); 485#endif 486 return -1; 487 } 488 --- 355 unchanged lines hidden --- |