From b6923b39539c34c2a589197def5eee72a9d719bf Mon Sep 17 00:00:00 2001 From: Jeff Hartmann Date: Wed, 8 Aug 2001 16:10:47 +0000 Subject: 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' --- linux-core/drmP.h | 5 +++++ linux-core/drm_agpsupport.c | 22 +++++++++++++++++++++- linux-core/drm_drv.c | 19 +++++++++---------- linux-core/tdfx_drv.c | 14 +++++++++----- 4 files changed, 44 insertions(+), 16 deletions(-) (limited to 'linux-core') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index b48d9b1f..3b282685 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -393,6 +393,11 @@ do { \ typedef int drm_ioctl_t( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); +typedef struct drm_pci_list { + u16 vendor; + u16 device; +} drm_pci_list_t; + typedef struct drm_ioctl_desc { drm_ioctl_t *func; int auth_needed; diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c index 9b056c75..66d1defc 100644 --- a/linux-core/drm_agpsupport.c +++ b/linux-core/drm_agpsupport.c @@ -272,13 +272,14 @@ drm_agp_head_t *DRM(agp_init)(void) case INTEL_I810: head->chipset = "Intel i810"; break; #if LINUX_VERSION_CODE >= 0x020400 + case INTEL_I815: head->chipset = "Intel i815"; break; case INTEL_I840: head->chipset = "Intel i840"; break; + case INTEL_I850: head->chipset = "Intel i850"; break; #endif case VIA_GENERIC: head->chipset = "VIA"; break; case VIA_VP3: head->chipset = "VIA VP3"; break; case VIA_MVP3: head->chipset = "VIA MVP3"; break; - #if LINUX_VERSION_CODE >= 0x020400 case VIA_MVP4: head->chipset = "VIA MVP4"; break; 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 ALI_GENERIC: head->chipset = "ALi"; 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; } DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n", diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index a28b0b5b..e1aff06d 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -506,8 +506,9 @@ static int drm_count_cards(void) { int num = 0; #if defined(DRIVER_CARD_LIST) - u_int *l; - u_int device, vendor; + int i; + drm_pci_list_t *l; + u16 device, vendor; struct pci_dev *pdev = NULL; #endif @@ -516,14 +517,12 @@ static int drm_count_cards(void) #if defined(DRIVER_COUNT_CARDS) num = DRIVER_COUNT_CARDS(); #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; - device = *l & 0xFFFF; - if (device == 0xFFFF) - device = PCI_ANY_ID; - vendor = (*l >> 16) & 0xFFFF; - if (vendor == 0xFFFF) - vendor = PCI_ANY_ID; + vendor = l[i].vendor; + device = l[i].device; + if(device == 0xffff) device = PCI_ANY_ID; + if(vendor == 0xffff) vendor = PCI_ANY_ID; while ((pdev = pci_find_device(vendor, device, pdev))) { num++; } @@ -648,7 +647,7 @@ static void __exit drm_cleanup( void ) #endif #if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR - if ( dev->agp && dev->agp->agp_mtrr ) { + if ( dev->agp && dev->agp->agp_mtrr >= 0) { int retval; retval = mtrr_del( dev->agp->agp_mtrr, dev->agp->agp_info.aper_base, diff --git a/linux-core/tdfx_drv.c b/linux-core/tdfx_drv.c index 94e5d41c..8f975875 100644 --- a/linux-core/tdfx_drv.c +++ b/linux-core/tdfx_drv.c @@ -44,11 +44,15 @@ #define DRIVER_MINOR 0 #define DRIVER_PATCHLEVEL 0 -static u_int DRM(idlist)[] = { - 0x121A0003, /* Banshee */ - 0x121A0005, /* Voodoo3 */ - 0x121A0009, /* Voodoo5 */ - 0 +#ifndef PCI_DEVICE_ID_3DFX_VOODOO5 +#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009 +#endif + +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) -- cgit v1.2.3