diff options
| author | Coleman Kane <cokane@FreeBSD.org> | 2000-10-10 03:51:54 +0000 |
|---|---|---|
| committer | Coleman Kane <cokane@FreeBSD.org> | 2000-10-10 03:51:54 +0000 |
| commit | 67072510e8c98b16f0b413ed65f76e81ab8a57fa (patch) | |
| tree | 658b1fa85186802340db4bb98dd451a9cc98fde6 /sys | |
| parent | ed539fcc50d45a08030656de7a317ad8fa100930 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/dev/tdfx/tdfx_pci.c | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c index 621409450ccc..8339738d4820 100644 --- a/sys/dev/tdfx/tdfx_pci.c +++ b/sys/dev/tdfx/tdfx_pci.c @@ -456,43 +456,54 @@ tdfx_mmap(dev_t dev, vm_offset_t offset, int nprot) * associated with this device be mapped for the process to work with. Nprot * holds the protections requested, PROT_READ, PROT_WRITE, or both. */ - struct tdfx_softc* tdfx_info; + + /**** OLD GET CONFIG ****/ + /* struct tdfx_softc* tdfx_info; */ /* Get the configuration for our card XXX*/ - tdfx_info = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, - UNIT(minor(dev))); + /*tdfx_info = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, + UNIT(minor(dev)));*/ + /************************/ + + struct tdfx_softc* tdfx_info[2]; + tdfx_info[0] = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, 0); + /* If, for some reason, its not configured, we bail out */ - if(tdfx_info == NULL) { + if(tdfx_info[0] == NULL) { #ifdef DEBUG printf("tdfx: tdfx_info (softc) is NULL\n"); #endif return -1; } - + /* We must stay within the bound of our address space */ - if((offset & 0xff000000) == tdfx_info->addr0) + if((offset & 0xff000000) == tdfx_info[0]->addr0) { offset &= 0xffffff; + return atop(rman_get_start(tdfx_info[0]->memrange) + offset); + } + + if(tdfx_count > 1) { + tdfx_info[1] = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, 1); + if((offset & 0xff000000) == tdfx_info[1]->addr0) { + offset &= 0xffffff; + return atop(rman_get_start(tdfx_info[1]->memrange) + offset); + } + } /* See if the Banshee/V3 LFB is being requested */ - if(tdfx_info->memrange2 != NULL && (offset & 0xff000000) == + /*if(tdfx_info->memrange2 != NULL && (offset & 0xff000000) == tdfx_info->addr1) { offset &= 0xffffff; - return atop(rman_get_start(tdfx_info->memrange2) + offset); - } - - if((offset >= 0x1000000) || (offset < 0)) { -#ifdef DEBUG - printf("tdfx: offset %x out of range\n", offset); -#endif - return -1; - } + return atop(rman_get_start(tdfx_info[1]->memrange2) + offset); + }*/ /* VoodooNG code */ + /* The ret call */ /* atop -> address to page * rman_get_start, get the (struct resource*)->r_start member, * the mapping base address. */ - return atop(rman_get_start(tdfx_info->memrange) + offset); + return -1; } static int |
