4 Commits

Author SHA1 Message Date
guillemj
a07014523a Fix compilation warnings.
Removed some trailing spaces.
2003-06-28 19:31:06 +00:00
guillemj
c9a4d92bdb Use newer 3dfx.mak. 2003-06-28 19:16:40 +00:00
guillemj
4df65b726c Fixed preprocessor invalid tokens in newer gcc 3.x versions. 2003-06-28 19:10:36 +00:00
guillemj
f40ae0ac13 Fixed bug when compiling for 2.4 kernels with modversions.
Added devfs support.
Added MODULE_* declarations.
Cleaned detection code.
2003-06-26 07:32:42 +00:00
10 changed files with 128 additions and 45 deletions

View File

@@ -21,6 +21,18 @@
ChangeLog
2002/05/05 Guillem Jover <guillem@hadrons.org>
* Re-included VOODOO pci id, accidentally removed in last patch,
thanks to Jan Kuipers to point this out.
2002/01/29 Guillem Jover <guillem@hadrons.org>
* Fixed bug when compiling for 2.4 kernels with modversions.
* Added devfs support.
* Added MODULE_* declarations.
* Cleaned detection code.
2000/02/04 Joseph Kain <joseph@3dfx.com>
* Updated Carlo Woord's email address.
@@ -100,13 +112,13 @@
#endif
#ifdef MODULE
#include <linux/module.h>
#if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
#define MODVERSIONS
#endif
#ifdef MODVERSIONS
#include <linux/modversions.h>
#endif
#include <linux/module.h>
#else
#define MOD_INC_USE_COUNT
#define MOD_DEC_USE_COUNT
@@ -117,6 +129,9 @@
#include <linux/mm.h>
#include <linux/errno.h>
#include <linux/pci.h>
#if KERNEL_MIN_VER(2,3,46) || defined(DEVFS_SUPPORT)
#include <linux/devfs_fs_kernel.h>
#endif
#include <asm/segment.h>
#include <asm/ioctl.h>
#include <asm/io.h>
@@ -172,6 +187,17 @@
#define PCI_DEVICE_ID_3DFX_VOODOO3 5
#endif
static struct pci_card {
unsigned short vendor;
unsigned short device;
} pci_card_list[] = {
{PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO},
{PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO2},
{PCI_VENDOR_ID_ALLIANCE, PCI_DEVICE_ID_ALLIANCE_AT3D},
{PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_BANSHEE},
{PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3}
};
#ifdef DEBUG
#define DEBUGMSG(x) printk x
#else
@@ -218,6 +244,9 @@ void cleanup_module(void);
static cardInfo cards[MAXCARDS];
static int numCards = 0;
#if KERNEL_MIN_VER(2,3,46) || defined(DEVFS_SUPPORT)
static devfs_handle_t devfs_handle;
#endif
static void findCardType(int vendor, int device)
{
@@ -243,14 +272,12 @@ static void findCardType(int vendor, int device)
static int findCards(void)
{
int i;
if (!pci_present())
return 0;
numCards = 0;
findCardType(PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO);
findCardType(PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO2);
findCardType(PCI_VENDOR_ID_ALLIANCE, 0x643d);
findCardType(PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_BANSHEE);
findCardType(PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3);
for (i = 0; i < (sizeof(pci_card_list)/sizeof(struct pci_card)); i++)
findCardType(pci_card_list[i].vendor, pci_card_list[i].device);
return numCards;
}
@@ -669,10 +696,22 @@ int init_module(void)
int ret;
DEBUGMSG(("3dfx: Entering init_module()\n"));
#if KERNEL_MIN_VER(2,3,46) || defined(DEVFS_SUPPORT)
if ((ret = devfs_register_chrdev(MAJOR_3DFX, "3dfx", &fops_3dfx)) < 0) {
printk("3dfx: Unable to register character device with major %d\n", MAJOR_3DFX);
return ret;
}
devfs_handle = devfs_register(NULL, "3dfx", DEVFS_FL_NONE,
MAJOR_3DFX, DEVICE_VOODOO,
S_IFCHR | S_IROTH | S_IWOTH | S_IRGRP | S_IWGRP,
&fops_3dfx, NULL);
#else
if ((ret = register_chrdev(MAJOR_3DFX, "3dfx", &fops_3dfx)) < 0) {
printk("3dfx: Unable to register character device with major %d\n", MAJOR_3DFX);
return ret;
}
#endif
DEBUGMSG(("3dfx: Successfully registered device 3dfx\n"));
findCards();
@@ -698,11 +737,21 @@ void cleanup_module(void)
#ifdef HAVE_MTRR
resetmtrr_3dfx();
#endif
#if KERNEL_MIN_VER(2,3,46) || defined(DEVFS_SUPPORT)
devfs_unregister(devfs_handle);
if (devfs_unregister_chrdev(MAJOR_3DFX, "3dfx"))
{
DEBUGMSG(("3dfx: devfs_unregister_chrdev failed\n"));
return;
}
#else
if (unregister_chrdev(MAJOR_3DFX, "3dfx"))
{
DEBUGMSG(("3dfx: unregister_chrdev failed\n"));
return;
}
#endif
}
#else /* !MODULE */
@@ -719,6 +768,11 @@ long init_3dfx(long mem_start, long mem_end)
}
#endif /* !MODULE */
#if KERNEL_MIN_VER(2,1,21)
MODULE_AUTHOR("Daryll Strauss et al.");
MODULE_DESCRIPTION("3dfx glide kernel device driver");
MODULE_LICENSE("GPL");
#endif
#if defined(DEBUG)
/*

View File

@@ -78,7 +78,7 @@ install:
echo "" >> /lib/modules/$(shell ./kinfo --UTS)/modules.dep; \
fi; \
fi; \
if [ ! -c /dev/3dfx ]; then \
if [ ! -e /dev/.devfsd -a ! -c /dev/3dfx ]; then \
mknod /dev/3dfx c 107 0; \
chmod go+w /dev/3dfx; \
fi; \

View File

@@ -89,5 +89,5 @@ FX_EXPORT FxU32 FX_CSTYLE fxoemInitSetVideo(OemInitInfo *oem);
FX_EXPORT FxU32 FX_CSTYLE fxoemRestoreVideo(OemInitInfo *oem);
FX_EXPORT FxU32 FX_CSTYLE fxoemControl(FxU32 mode);
#endif __OEMINIT_H__
#endif /* __OEMINIT_H__ */

View File

@@ -20,6 +20,7 @@
#include <sys/utsname.h>
#include <stdio.h>
#include <string.h>
int _cpu_detect_asm() {
struct utsname name;

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1 1999/12/07 21:49:09 joseph
** Initial checkin into SourceForge.
**
**
** 206 6/06/98 12:06p Peter
** gmt's trilinear hell bug

View File

@@ -19,6 +19,12 @@
**
** $Header$
** $Log$
** Revision 1.2 2003/06/28 19:10:36 guillemj
** Fixed preprocessor invalid tokens in newer gcc 3.x versions.
**
** Revision 1.1.1.1 1999/12/07 21:49:26 joseph
** Initial checkin into SourceForge.
**
**
** 3 3/17/99 6:16p Dow
** Phantom Menace and other fixes.
@@ -3353,16 +3359,16 @@ double_precision_asm(void);
//#define GLIDE3_DEBUG 1
#endif
#ifdef GLIDE3_DEBUG
#define TEX_INFO(ptr,field) ptr##field
#define TEX_INFO(ptr,field) ptr.field
#define G3_LOD_TRANSLATE(lod) (lod)
#define G3_ASPECT_TRANSLATE(aspect) (aspect)
#else
#define TEX_INFO(ptr,field) ptr##field##Log2
#define TEX_INFO(ptr,field) ptr.field ## Log2
#define G3_LOD_TRANSLATE(lod) (0x8-lod)
#define G3_ASPECT_TRANSLATE(aspect) (0x3-(aspect))
#endif /* GLIDE3_DEBUG */
#else
#define TEX_INFO(ptr,field) ptr##field
#define TEX_INFO(ptr,field) ptr.field
#define G3_LOD_TRANSLATE(lod) (lod)
#define G3_ASPECT_TRANSLATE(aspect) (aspect)
#endif

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1 1999/12/07 21:49:28 joseph
** Initial checkin into SourceForge.
**
**
** 3 3/17/99 6:16p Dow
** Phantom Menace and other fixes.
@@ -239,9 +242,9 @@ static void
downloadTexture(Texture *texture, Gu3dfInfo *info)
{
texture->info.data = info->data;
TEX_INFO(texture->info.,smallLod) = info->header.small_lod;
TEX_INFO(texture->info.,largeLod) = info->header.large_lod;
TEX_INFO(texture->info.,aspectRatio) = info->header.aspect_ratio;
TEX_INFO(texture->info,smallLod) = info->header.small_lod;
TEX_INFO(texture->info,largeLod) = info->header.large_lod;
TEX_INFO(texture->info,aspectRatio) = info->header.aspect_ratio;
texture->info.format = info->header.format;
texture->addr = nextFreeBase;

View File

@@ -20,7 +20,10 @@
/* $Header$ */
/* $Revision$ */
/* $Log$ */
/* $Log$
/* Revision 1.1.1.1 1999/12/07 21:49:30 joseph
/* Initial checkin into SourceForge.
/* */
/* */
/* 11 10/05/98 7:43p Peter */
/* 3DNow!(tm) happiness everywhere */
@@ -122,10 +125,12 @@ PROC_TYPE(cull):
#define GLIDE_GENERIC_SETUP 0
#include "xdraw2.inc.S"
#undef cull
#define GLIDE_GENERIC_SETUP 0
#define GLIDE_PACK_ALPHA 0
#define GLIDE_PACK_RGB 0
#define GLIDE_CULLING 0
#undef GLIDE_GENERIC_SETUP
#undef GLIDE_PACK_ALPHA
#undef GLIDE_PACK_RGB
#undef GLIDE_CULLING
#undef LOCAL
END_PROC_TYPE(cull):
.size PROC_TYPE(cull),END_PROC_TYPE(cull)-PROC_TYPE(cull)
@@ -144,10 +149,12 @@ PROC_TYPE(cull_rgb):
#define GLIDE_PACK_ALPHA 0
#define GLIDE_GENERIC_SETUP 0
#include "xdraw2.inc.S"
#define GLIDE_GENERIC_SETUP 0
#define GLIDE_PACK_ALPHA 0
#define GLIDE_PACK_RGB 0
#define GLIDE_CULLING 0
#undef GLIDE_GENERIC_SETUP
#undef GLIDE_PACK_ALPHA
#undef GLIDE_PACK_RGB
#undef GLIDE_CULLING
#undef LOCAL
END_PROC_TYPE(cull_rgb):
.size PROC_TYPE(cull_rgb),END_PROC_TYPE(cull_rgb)-PROC_TYPE(cull_rgb)
@@ -165,10 +172,10 @@ PROC_TYPE(cull_argb):
#define GLIDE_PACK_ALPHA 1
#define GLIDE_GENERIC_SETUP 0
#include "xdraw2.inc.S"
#define GLIDE_GENERIC_SETUP 0
#define GLIDE_PACK_ALPHA 0
#define GLIDE_PACK_RGB 0
#define GLIDE_CULLING 0
#undef GLIDE_GENERIC_SETUP
#undef GLIDE_PACK_ALPHA
#undef GLIDE_PACK_RGB
#undef GLIDE_CULLING
END_PROC_TYPE(cull_argb):
.size PROC_TYPE(cull_argb),END_PROC_TYPE(cull_argb)-PROC_TYPE(cull_argb)
@@ -187,10 +194,12 @@ PROC_TYPE(Default):
#define GLIDE_PACK_ALPHA 0
#define GLIDE_GENERIC_SETUP 0
#include "xdraw2.inc.S"
#define GLIDE_GENERIC_SETUP 0
#define GLIDE_PACK_ALPHA 0
#define GLIDE_PACK_RGB 0
#define GLIDE_CULLING 0
#undef GLIDE_GENERIC_SETUP
#undef GLIDE_PACK_ALPHA
#undef GLIDE_PACK_RGB
#undef GLIDE_CULLING
#undef LOCAL
END_PROC_TYPE(Default):
.size PROC_TYPE(Default),END_PROC_TYPE(Default)-PROC_TYPE(Default)
@@ -209,10 +218,12 @@ PROC_TYPE(rgb):
#define GLIDE_PACK_ALPHA 0
#define GLIDE_GENERIC_SETUP 0
#include "xdraw2.inc.S"
#define GLIDE_GENERIC_SETUP 0
#define GLIDE_PACK_ALPHA 0
#define GLIDE_PACK_RGB 0
#define GLIDE_CULLING 0
#undef GLIDE_GENERIC_SETUP
#undef GLIDE_PACK_ALPHA
#undef GLIDE_PACK_RGB
#undef GLIDE_CULLING
#undef LOCAL
END_PROC_TYPE(rgb):
.size PROC_TYPE(rgb),END_PROC_TYPE(rgb)-PROC_TYPE(rgb)
@@ -230,10 +241,12 @@ PROC_TYPE(argb):
#define GLIDE_PACK_ALPHA 1
#define GLIDE_GENERIC_SETUP 0
#include "xdraw2.inc.S"
#define GLIDE_GENERIC_SETUP 0
#define GLIDE_PACK_ALPHA 0
#define GLIDE_PACK_RGB 0
#define GLIDE_CULLING 0
#undef GLIDE_GENERIC_SETUP
#undef GLIDE_PACK_ALPHA
#undef GLIDE_PACK_RGB
#undef GLIDE_CULLING
#undef LOCAL
END_PROC_TYPE(argb):
.size PROC_TYPE(argb),END_PROC_TYPE(argb)-PROC_TYPE(argb)

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.2 2000/10/03 18:29:57 mercury
** 003-clean_up_h3-000, h3 tree cleanup.
**
** Revision 1.1.1.1 1999/12/07 21:49:43 joseph
** Initial checkin into SourceForge.
**
@@ -38,8 +41,8 @@
** I/O Macros
*/
#warning Here!
#define HWC_IO_LOAD(regInfo, reg, val)
GDBG_INFO(120, "%s: Storing 0x%x to IO Register %s\n",
#define HWC_IO_LOAD(regInfo, reg, val) \
GDBG_INFO(120, "%s: Storing 0x%x to IO Register %s\n", \
((SstIORegs *) regInfo.ioMemBase)->

View File

@@ -59,4 +59,4 @@ export FX_NO_GET_BOF=1
export FX_GLIDE_HW
export SCRIPTDIR=$(TOPDIR)/swlibs/include/make
include swlibs/include/make/3dfx.linux.mak
include swlibs/include/make/3dfx.mak