Update to the code I sent Linus and Alan this morning. Added some missing

agp chipsets to drm_agpsupport.h, redid the card detection common code
    to use a structure (avoids endian porting issues), changed the tdfx
    driver to use the kernel pci id '#defines'
main
Jeff Hartmann 2001-08-08 16:10:47 +00:00
parent 938a637d1f
commit b6923b3953
8 changed files with 88 additions and 32 deletions

View File

@ -393,6 +393,11 @@ do { \
typedef int drm_ioctl_t( struct inode *inode, struct file *filp, typedef int drm_ioctl_t( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ); unsigned int cmd, unsigned long arg );
typedef struct drm_pci_list {
u16 vendor;
u16 device;
} drm_pci_list_t;
typedef struct drm_ioctl_desc { typedef struct drm_ioctl_desc {
drm_ioctl_t *func; drm_ioctl_t *func;
int auth_needed; int auth_needed;

View File

@ -272,13 +272,14 @@ drm_agp_head_t *DRM(agp_init)(void)
case INTEL_I810: head->chipset = "Intel i810"; break; case INTEL_I810: head->chipset = "Intel i810"; break;
#if LINUX_VERSION_CODE >= 0x020400 #if LINUX_VERSION_CODE >= 0x020400
case INTEL_I815: head->chipset = "Intel i815"; break;
case INTEL_I840: head->chipset = "Intel i840"; break; case INTEL_I840: head->chipset = "Intel i840"; break;
case INTEL_I850: head->chipset = "Intel i850"; break;
#endif #endif
case VIA_GENERIC: head->chipset = "VIA"; break; case VIA_GENERIC: head->chipset = "VIA"; break;
case VIA_VP3: head->chipset = "VIA VP3"; break; case VIA_VP3: head->chipset = "VIA VP3"; break;
case VIA_MVP3: head->chipset = "VIA MVP3"; break; case VIA_MVP3: head->chipset = "VIA MVP3"; break;
#if LINUX_VERSION_CODE >= 0x020400 #if LINUX_VERSION_CODE >= 0x020400
case VIA_MVP4: head->chipset = "VIA MVP4"; break; case VIA_MVP4: head->chipset = "VIA MVP4"; break;
case VIA_APOLLO_KX133: head->chipset = "VIA Apollo KX133"; case VIA_APOLLO_KX133: head->chipset = "VIA Apollo KX133";
@ -294,6 +295,25 @@ drm_agp_head_t *DRM(agp_init)(void)
case AMD_IRONGATE: head->chipset = "AMD Irongate"; break; case AMD_IRONGATE: head->chipset = "AMD Irongate"; break;
case ALI_GENERIC: head->chipset = "ALi"; break; case ALI_GENERIC: head->chipset = "ALi"; break;
case ALI_M1541: head->chipset = "ALi M1541"; break; case ALI_M1541: head->chipset = "ALi M1541"; break;
#if LINUX_VERSION_CODE >= 0x020402
case ALI_M1621: head->chipset = "ALi M1621"; break;
case ALI_M1631: head->chipset = "ALi M1631"; break;
case ALI_M1632: head->chipset = "ALi M1632"; break;
case ALI_M1641: head->chipset = "ALi M1641"; break;
case ALI_M1647: head->chipset = "ALi M1647"; break;
case ALI_M1651: head->chipset = "ALi M1651"; break;
#endif
#if LINUX_VERSION_CODE >= 0x020406
case SVWRKS_HE: head->chipset = "Serverworks HE";
break;
case SVWRKS_LE: head->chipset = "Serverworks LE";
break;
case SVWRKS_GENERIC: head->chipset = "Serverworks Generic";
break;
#endif
default: head->chipset = "Unknown"; break; default: head->chipset = "Unknown"; break;
} }
DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n", DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n",

View File

@ -506,8 +506,9 @@ static int drm_count_cards(void)
{ {
int num = 0; int num = 0;
#if defined(DRIVER_CARD_LIST) #if defined(DRIVER_CARD_LIST)
u_int *l; int i;
u_int device, vendor; drm_pci_list_t *l;
u16 device, vendor;
struct pci_dev *pdev = NULL; struct pci_dev *pdev = NULL;
#endif #endif
@ -516,14 +517,12 @@ static int drm_count_cards(void)
#if defined(DRIVER_COUNT_CARDS) #if defined(DRIVER_COUNT_CARDS)
num = DRIVER_COUNT_CARDS(); num = DRIVER_COUNT_CARDS();
#elif defined(DRIVER_CARD_LIST) #elif defined(DRIVER_CARD_LIST)
for (l = DRIVER_CARD_LIST; *l; l++) { for (i = 0, l = DRIVER_CARD_LIST; l[i].vendor != 0; i++) {
pdev = NULL; pdev = NULL;
device = *l & 0xFFFF; vendor = l[i].vendor;
if (device == 0xFFFF) device = l[i].device;
device = PCI_ANY_ID; if(device == 0xffff) device = PCI_ANY_ID;
vendor = (*l >> 16) & 0xFFFF; if(vendor == 0xffff) vendor = PCI_ANY_ID;
if (vendor == 0xFFFF)
vendor = PCI_ANY_ID;
while ((pdev = pci_find_device(vendor, device, pdev))) { while ((pdev = pci_find_device(vendor, device, pdev))) {
num++; num++;
} }
@ -648,7 +647,7 @@ static void __exit drm_cleanup( void )
#endif #endif
#if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR #if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR
if ( dev->agp && dev->agp->agp_mtrr ) { if ( dev->agp && dev->agp->agp_mtrr >= 0) {
int retval; int retval;
retval = mtrr_del( dev->agp->agp_mtrr, retval = mtrr_del( dev->agp->agp_mtrr,
dev->agp->agp_info.aper_base, dev->agp->agp_info.aper_base,

View File

@ -44,11 +44,15 @@
#define DRIVER_MINOR 0 #define DRIVER_MINOR 0
#define DRIVER_PATCHLEVEL 0 #define DRIVER_PATCHLEVEL 0
static u_int DRM(idlist)[] = { #ifndef PCI_DEVICE_ID_3DFX_VOODOO5
0x121A0003, /* Banshee */ #define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009
0x121A0005, /* Voodoo3 */ #endif
0x121A0009, /* Voodoo5 */
0 static drm_pci_list_t DRM(idlist)[] = {
{ PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_BANSHEE },
{ PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3 },
{ PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO5 },
{ 0, 0 }
}; };
#define DRIVER_CARD_LIST DRM(idlist) #define DRIVER_CARD_LIST DRM(idlist)

View File

@ -393,6 +393,11 @@ do { \
typedef int drm_ioctl_t( struct inode *inode, struct file *filp, typedef int drm_ioctl_t( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ); unsigned int cmd, unsigned long arg );
typedef struct drm_pci_list {
u16 vendor;
u16 device;
} drm_pci_list_t;
typedef struct drm_ioctl_desc { typedef struct drm_ioctl_desc {
drm_ioctl_t *func; drm_ioctl_t *func;
int auth_needed; int auth_needed;

View File

@ -272,13 +272,14 @@ drm_agp_head_t *DRM(agp_init)(void)
case INTEL_I810: head->chipset = "Intel i810"; break; case INTEL_I810: head->chipset = "Intel i810"; break;
#if LINUX_VERSION_CODE >= 0x020400 #if LINUX_VERSION_CODE >= 0x020400
case INTEL_I815: head->chipset = "Intel i815"; break;
case INTEL_I840: head->chipset = "Intel i840"; break; case INTEL_I840: head->chipset = "Intel i840"; break;
case INTEL_I850: head->chipset = "Intel i850"; break;
#endif #endif
case VIA_GENERIC: head->chipset = "VIA"; break; case VIA_GENERIC: head->chipset = "VIA"; break;
case VIA_VP3: head->chipset = "VIA VP3"; break; case VIA_VP3: head->chipset = "VIA VP3"; break;
case VIA_MVP3: head->chipset = "VIA MVP3"; break; case VIA_MVP3: head->chipset = "VIA MVP3"; break;
#if LINUX_VERSION_CODE >= 0x020400 #if LINUX_VERSION_CODE >= 0x020400
case VIA_MVP4: head->chipset = "VIA MVP4"; break; case VIA_MVP4: head->chipset = "VIA MVP4"; break;
case VIA_APOLLO_KX133: head->chipset = "VIA Apollo KX133"; case VIA_APOLLO_KX133: head->chipset = "VIA Apollo KX133";
@ -294,6 +295,25 @@ drm_agp_head_t *DRM(agp_init)(void)
case AMD_IRONGATE: head->chipset = "AMD Irongate"; break; case AMD_IRONGATE: head->chipset = "AMD Irongate"; break;
case ALI_GENERIC: head->chipset = "ALi"; break; case ALI_GENERIC: head->chipset = "ALi"; break;
case ALI_M1541: head->chipset = "ALi M1541"; break; case ALI_M1541: head->chipset = "ALi M1541"; break;
#if LINUX_VERSION_CODE >= 0x020402
case ALI_M1621: head->chipset = "ALi M1621"; break;
case ALI_M1631: head->chipset = "ALi M1631"; break;
case ALI_M1632: head->chipset = "ALi M1632"; break;
case ALI_M1641: head->chipset = "ALi M1641"; break;
case ALI_M1647: head->chipset = "ALi M1647"; break;
case ALI_M1651: head->chipset = "ALi M1651"; break;
#endif
#if LINUX_VERSION_CODE >= 0x020406
case SVWRKS_HE: head->chipset = "Serverworks HE";
break;
case SVWRKS_LE: head->chipset = "Serverworks LE";
break;
case SVWRKS_GENERIC: head->chipset = "Serverworks Generic";
break;
#endif
default: head->chipset = "Unknown"; break; default: head->chipset = "Unknown"; break;
} }
DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n", DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n",

View File

@ -506,8 +506,9 @@ static int drm_count_cards(void)
{ {
int num = 0; int num = 0;
#if defined(DRIVER_CARD_LIST) #if defined(DRIVER_CARD_LIST)
u_int *l; int i;
u_int device, vendor; drm_pci_list_t *l;
u16 device, vendor;
struct pci_dev *pdev = NULL; struct pci_dev *pdev = NULL;
#endif #endif
@ -516,14 +517,12 @@ static int drm_count_cards(void)
#if defined(DRIVER_COUNT_CARDS) #if defined(DRIVER_COUNT_CARDS)
num = DRIVER_COUNT_CARDS(); num = DRIVER_COUNT_CARDS();
#elif defined(DRIVER_CARD_LIST) #elif defined(DRIVER_CARD_LIST)
for (l = DRIVER_CARD_LIST; *l; l++) { for (i = 0, l = DRIVER_CARD_LIST; l[i].vendor != 0; i++) {
pdev = NULL; pdev = NULL;
device = *l & 0xFFFF; vendor = l[i].vendor;
if (device == 0xFFFF) device = l[i].device;
device = PCI_ANY_ID; if(device == 0xffff) device = PCI_ANY_ID;
vendor = (*l >> 16) & 0xFFFF; if(vendor == 0xffff) vendor = PCI_ANY_ID;
if (vendor == 0xFFFF)
vendor = PCI_ANY_ID;
while ((pdev = pci_find_device(vendor, device, pdev))) { while ((pdev = pci_find_device(vendor, device, pdev))) {
num++; num++;
} }
@ -648,7 +647,7 @@ static void __exit drm_cleanup( void )
#endif #endif
#if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR #if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR
if ( dev->agp && dev->agp->agp_mtrr ) { if ( dev->agp && dev->agp->agp_mtrr >= 0) {
int retval; int retval;
retval = mtrr_del( dev->agp->agp_mtrr, retval = mtrr_del( dev->agp->agp_mtrr,
dev->agp->agp_info.aper_base, dev->agp->agp_info.aper_base,

View File

@ -44,11 +44,15 @@
#define DRIVER_MINOR 0 #define DRIVER_MINOR 0
#define DRIVER_PATCHLEVEL 0 #define DRIVER_PATCHLEVEL 0
static u_int DRM(idlist)[] = { #ifndef PCI_DEVICE_ID_3DFX_VOODOO5
0x121A0003, /* Banshee */ #define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009
0x121A0005, /* Voodoo3 */ #endif
0x121A0009, /* Voodoo5 */
0 static drm_pci_list_t DRM(idlist)[] = {
{ PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_BANSHEE },
{ PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3 },
{ PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO5 },
{ 0, 0 }
}; };
#define DRIVER_CARD_LIST DRM(idlist) #define DRIVER_CARD_LIST DRM(idlist)