Index: configure.in =================================================================== RCS file: /cvsroot/utah-glx/glx/configure.in,v retrieving revision 1.56 diff -u -r1.56 configure.in --- configure.in 2000/03/31 04:26:15 1.56 +++ configure.in 2000/03/31 17:11:19 @@ -839,7 +839,7 @@ AC_PATH_XTRA AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h unistd.h floatingpoint.h \ - sys/types.h sys/mman.h sys/perm.h asm/sigcontext.h) + sys/types.h sys/mman.h sys/perm.h asm/sigcontext.h physmap.h) AC_CHECK_HEADER(asm/mtrr.h, [ if test "$enable_mtrr" = "no" Index: servGL/hwglx/mga/mgadmainit.c =================================================================== RCS file: /cvsroot/utah-glx/glx/servGL/hwglx/mga/mgadmainit.c,v retrieving revision 1.41 diff -u -r1.41 mgadmainit.c --- servGL/hwglx/mga/mgadmainit.c 2000/03/20 09:14:33 1.41 +++ servGL/hwglx/mga/mgadmainit.c 2000/03/31 17:11:19 @@ -293,6 +293,9 @@ free( test ); } + + + static void AllocatePhysicalDmaBuffer( void ) { PMemBlock block; @@ -442,6 +445,41 @@ #endif } +#ifdef __sun__ +#ifdef HAVE_PHYSMAP_H +#include +static int AllocatePhysmapMemory(void) +{ + int physmapfd; + struct physmap_info pminfo; + physmapfd=open("/dev/physmap",O_RDWR); + if(physmapfd==-1){ + hwMsg(1,"Cannot open /dev/physmap: %s\n",strerror(errno)); + return 0; + } + + if(ioctl(physmapfd,PHYSMAP_GETINFO,&pminfo)==-1){ + hwMsg(1,"ioctl on /dev/physmap failed.\n"); + return 0; + } + + if(pminfo.allow_detach){ + /* Don't want the module to DMA memory while using it... */ + ioctl(physmapfd,PHYSMAP_DENYDETACH,0); + } + + sysmemPhysical = pminfo.slice_phys; + sysmemBytes = pminfo.largest_slice; + + hwMsg(1,"Autodetecting DMA parameters: Offset: 0x%x, size: 0x%x\n", + sysmemPhysical,sysmemBytes); + close(physmapfd); + + return 1; +} +#endif +#endif + /* * AllocateGARTMemory */ @@ -665,7 +703,9 @@ if ( !mgaglx.dmaDriver ) { return; } - + +#ifndef HAVE_PHYSMAP_H + /* determine total requested size of buffer */ sysmemBytes = mgaglx.dmaSize; if ( !sysmemBytes ) { @@ -673,6 +713,7 @@ return; } sysmemBytes *= 0x100000; +#endif #ifdef HAVE_LINUX_NEWAGP /* try AGP memory */ @@ -708,6 +749,21 @@ #endif /* HAVE_LINUX_NEWAGP */ +#ifdef __sun__ + + if(mgaglx.dmaAdr > 0){ + hwMsg(1,"It is not safe to specify mga_dmaadr on Solaris, ignoring.\n"); + } +#ifdef HAVE_PHYSMAP_H + if(!AllocatePhysmapMemory()){ + return; + } +#else + return; +#endif + +#else + /* mgaglx.dmaDriverADR should be set to a value >= the mem= kernel parm */ sysmemPhysical = mgaglx.dmaAdr; sysmemPhysical *= 0x100000; @@ -716,8 +772,7 @@ hwMsg( 1, "unlikely mga_dmaadr=%i, skipping physical allocation\n", mgaglx.dmaAdr ); return; } - - +#endif /* FIXME!!!: should check sysmemPhysical against /proc/meminfo */