From 2d7680dc333313c94019cb5d0366299c14140899 Mon Sep 17 00:00:00 2001 From: cokane Date: Tue, 10 Oct 2000 03:51:54 +0000 Subject: Added some handling code to work with SLI configs, and removed some unused older code that was phased out but not removed, heh. --- sys/dev/tdfx/tdfx_pci.c | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'sys/dev/tdfx') diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c index 6214094..8339738 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 -- cgit v1.1