tdfx_pci.c (65146) | tdfx_pci.c (66910) |
---|---|
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 65146 2000-08-28 04:28:53Z cokane $ | 31 * $FreeBSD: head/sys/dev/tdfx/tdfx_pci.c 66910 2000-10-10 03:51:54Z 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 */ --- 411 unchanged lines hidden (view full) --- 451static int 452tdfx_mmap(dev_t dev, vm_offset_t offset, int nprot) 453{ 454 /* 455 * mmap(2) is called by a user process to request that an area of memory 456 * associated with this device be mapped for the process to work with. Nprot 457 * holds the protections requested, PROT_READ, PROT_WRITE, or both. 458 */ | 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 */ --- 411 unchanged lines hidden (view full) --- 451static int 452tdfx_mmap(dev_t dev, vm_offset_t offset, int nprot) 453{ 454 /* 455 * mmap(2) is called by a user process to request that an area of memory 456 * associated with this device be mapped for the process to work with. Nprot 457 * holds the protections requested, PROT_READ, PROT_WRITE, or both. 458 */ |
459 struct tdfx_softc* tdfx_info; | 459 460 /**** OLD GET CONFIG ****/ 461 /* struct tdfx_softc* tdfx_info; */ |
460 461 /* Get the configuration for our card XXX*/ | 462 463 /* Get the configuration for our card XXX*/ |
462 tdfx_info = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, 463 UNIT(minor(dev))); | 464 /*tdfx_info = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, 465 UNIT(minor(dev)));*/ 466 /************************/ 467 468 struct tdfx_softc* tdfx_info[2]; |
464 | 469 |
470 tdfx_info[0] = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, 0); 471 |
|
465 /* If, for some reason, its not configured, we bail out */ | 472 /* If, for some reason, its not configured, we bail out */ |
466 if(tdfx_info == NULL) { | 473 if(tdfx_info[0] == NULL) { |
467#ifdef DEBUG 468 printf("tdfx: tdfx_info (softc) is NULL\n"); 469#endif 470 return -1; 471 } | 474#ifdef DEBUG 475 printf("tdfx: tdfx_info (softc) is NULL\n"); 476#endif 477 return -1; 478 } |
472 | 479 |
473 /* We must stay within the bound of our address space */ | 480 /* We must stay within the bound of our address space */ |
474 if((offset & 0xff000000) == tdfx_info->addr0) | 481 if((offset & 0xff000000) == tdfx_info[0]->addr0) { |
475 offset &= 0xffffff; | 482 offset &= 0xffffff; |
483 return atop(rman_get_start(tdfx_info[0]->memrange) + offset); 484 } 485 486 if(tdfx_count > 1) { 487 tdfx_info[1] = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, 1); 488 if((offset & 0xff000000) == tdfx_info[1]->addr0) { 489 offset &= 0xffffff; 490 return atop(rman_get_start(tdfx_info[1]->memrange) + offset); 491 } 492 } |
|
476 477 /* See if the Banshee/V3 LFB is being requested */ | 493 494 /* See if the Banshee/V3 LFB is being requested */ |
478 if(tdfx_info->memrange2 != NULL && (offset & 0xff000000) == | 495 /*if(tdfx_info->memrange2 != NULL && (offset & 0xff000000) == |
479 tdfx_info->addr1) { 480 offset &= 0xffffff; | 496 tdfx_info->addr1) { 497 offset &= 0xffffff; |
481 return atop(rman_get_start(tdfx_info->memrange2) + offset); 482 } | 498 return atop(rman_get_start(tdfx_info[1]->memrange2) + offset); 499 }*/ /* VoodooNG code */ |
483 | 500 |
484 if((offset >= 0x1000000) || (offset < 0)) { 485#ifdef DEBUG 486 printf("tdfx: offset %x out of range\n", offset); 487#endif 488 return -1; 489 } 490 | 501 /* The ret call */ |
491 /* atop -> address to page 492 * rman_get_start, get the (struct resource*)->r_start member, 493 * the mapping base address. 494 */ | 502 /* atop -> address to page 503 * rman_get_start, get the (struct resource*)->r_start member, 504 * the mapping base address. 505 */ |
495 return atop(rman_get_start(tdfx_info->memrange) + offset); | 506 return -1; |
496} 497 498static int 499tdfx_query_boards(void) { 500 /* 501 * This returns the number of installed tdfx cards, we have been keeping 502 * count, look at tdfx_attach 503 */ --- 362 unchanged lines hidden --- | 507} 508 509static int 510tdfx_query_boards(void) { 511 /* 512 * This returns the number of installed tdfx cards, we have been keeping 513 * count, look at tdfx_attach 514 */ --- 362 unchanged lines hidden --- |