diff options
author | Eric Anholt <anholt@freebsd.org> | 2003-10-17 03:14:39 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2003-10-17 03:14:39 +0000 |
commit | ff58476011ba8fe72d65e884380d3d86710bfdd4 (patch) | |
tree | c2855a267ab001340e588ae6b32a55982312cfa0 /bsd | |
parent | 355b204de0dbc01308bebc77c4c1c0a9a402cded (diff) |
- Converted Linux drivers to initialize DRM instances based on PCI IDs, not
just a single instance. Moved the PCI ID lists from <card>_drv.c in BSD
to <card>.h. The PCI ID lists include a driver private field, which may
be used by drivers for chip family or other information. Based on work
by jonsmirl.
- Make tdfx_drv.c and tdfx.h match other drivers.
- Fixed up linking of sis shared files.
Tested with Radeon and SiS on Linux and FreeBSD, including a Linux setup
with
2 SiS cards in a machine, but only one head being used (with DRI)
Diffstat (limited to 'bsd')
-rw-r--r-- | bsd/Imakefile | 1 | ||||
-rw-r--r-- | bsd/drmP.h | 8 | ||||
-rw-r--r-- | bsd/drm_drv.h | 28 | ||||
-rw-r--r-- | bsd/drm_os_freebsd.h | 8 | ||||
-rw-r--r-- | bsd/drm_os_netbsd.h | 8 | ||||
-rw-r--r-- | bsd/mga_drv.c | 11 | ||||
-rw-r--r-- | bsd/r128_drv.c | 24 | ||||
-rw-r--r-- | bsd/radeon_drv.c | 39 | ||||
-rw-r--r-- | bsd/sis_drv.c | 7 | ||||
-rw-r--r-- | bsd/tdfx.h | 43 | ||||
-rw-r--r-- | bsd/tdfx_drv.c | 44 |
11 files changed, 22 insertions, 199 deletions
diff --git a/bsd/Imakefile b/bsd/Imakefile index e51c0737..63e12966 100644 --- a/bsd/Imakefile +++ b/bsd/Imakefile @@ -47,3 +47,4 @@ LinkSourceFile(sis_drv.h,$(XF86OSSRC)/shared/drm/kernel) LinkSourceFile(sis_ds.c,$(XF86OSSRC)/shared/drm/kernel) LinkSourceFile(sis_ds.h,$(XF86OSSRC)/shared/drm/kernel) LinkSourceFile(sis_mm.c,$(XF86OSSRC)/shared/drm/kernel) +LinkSourceFile(tdfx.h,$(XF86OSSRC)/shared/drm/kernel) @@ -123,6 +123,14 @@ typedef struct drm_file drm_file_t; } while(0) +typedef struct drm_pci_id_list +{ + int vendor; + int device; + long driver_private; + char *name; +} drm_pci_id_list_t; + typedef struct drm_ioctl_desc { int (*func)(DRM_IOCTL_ARGS); int auth_needed; diff --git a/bsd/drm_drv.h b/bsd/drm_drv.h index d517d056..bfded6bb 100644 --- a/bsd/drm_drv.h +++ b/bsd/drm_drv.h @@ -219,11 +219,14 @@ static struct cdevsw DRM(cdevsw) = { #endif }; +static drm_pci_id_list_t DRM(pciidlist)[] = { + DRIVER_PCI_IDS +}; + static int DRM(probe)(device_t dev) { const char *s = NULL; int pciid, vendor, device; - /* XXX: Cope with agp bridge device? */ if (!strcmp(device_get_name(dev), "drmsub")) @@ -235,7 +238,7 @@ static int DRM(probe)(device_t dev) device = (pciid & 0xffff0000) >> 16; s = DRM(find_description)(vendor, device); - if (s) { + if (s != NULL) { device_set_desc(dev, s); return 0; } @@ -349,7 +352,8 @@ int DRM(probe)(struct pci_attach_args *pa) { const char *desc; - desc = DRM(find_description)(PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id)); + desc = DRM(find_description)(PCI_VENDOR(pa->pa_id), + PCI_PRODUCT(pa->pa_id)); if (desc != NULL) { return 1; } @@ -396,21 +400,15 @@ int DRM(activate)(struct device *self, enum devact act) #endif /* __NetBSD__ */ const char *DRM(find_description)(int vendor, int device) { - const char *s = NULL; - int i=0, done=0; + int i = 0; - while ( !done && (DRM(devicelist)[i].vendor != 0 ) ) { - if ( (DRM(devicelist)[i].vendor == vendor) && - (DRM(devicelist)[i].device == device) ) { - done=1; - if ( DRM(devicelist)[i].supported ) - s = DRM(devicelist)[i].name; - else - DRM_INFO("%s not supported\n", DRM(devicelist)[i].name); + for (i = 0; DRM(pciidlist)[i].vendor != 0; i++) { + if ((DRM(pciidlist)[i].vendor == vendor) && + (DRM(pciidlist)[i].device == device)) { + return DRM(pciidlist)[i].name; } - i++; } - return s; + return NULL; } static int DRM(setup)( drm_device_t *dev ) diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h index 0bb38ba2..3894f54d 100644 --- a/bsd/drm_os_freebsd.h +++ b/bsd/drm_os_freebsd.h @@ -270,14 +270,6 @@ for ( ret = 0 ; !ret && !(condition) ; ) { \ MALLOC_DECLARE(malloctype); #undef malloctype -typedef struct drm_chipinfo -{ - int vendor; - int device; - int supported; - char *name; -} drm_chipinfo_t; - #if __FreeBSD_version >= 480000 #define cpu_to_le32(x) htole32(x) #define le32_to_cpu(x) le32toh(x) diff --git a/bsd/drm_os_netbsd.h b/bsd/drm_os_netbsd.h index 1290e848..47e710c7 100644 --- a/bsd/drm_os_netbsd.h +++ b/bsd/drm_os_netbsd.h @@ -230,14 +230,6 @@ while (!condition) { \ #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) -typedef struct drm_chipinfo -{ - int vendor; - int device; - int supported; - char *name; -} drm_chipinfo_t; - #define cpu_to_le32(x) htole32(x) #define le32_to_cpu(x) le32toh(x) diff --git a/bsd/mga_drv.c b/bsd/mga_drv.c index 85520d5c..4eaf5edb 100644 --- a/bsd/mga_drv.c +++ b/bsd/mga_drv.c @@ -36,17 +36,6 @@ #include "mga_drm.h" #include "mga_drv.h" -/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h - * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. - */ -drm_chipinfo_t DRM(devicelist)[] = { - {0x102b, 0x0520, 0, "Matrox G200 (PCI)"}, - {0x102b, 0x0521, 1, "Matrox G200 (AGP)"}, - {0x102b, 0x0525, 1, "Matrox G400/G450 (AGP)"}, - {0x102b, 0x2527, 1, "Matrox G550 (AGP)"}, - {0, 0, 0, NULL} -}; - #include "drm_agpsupport.h" #include "drm_auth.h" #include "drm_bufs.h" diff --git a/bsd/r128_drv.c b/bsd/r128_drv.c index 14a8cc5f..e656f60d 100644 --- a/bsd/r128_drv.c +++ b/bsd/r128_drv.c @@ -39,30 +39,6 @@ #include "ati_pcigart.h" #endif -/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h - * Please report to eta@lclark.edu inaccuracies or if a chip you have works that is marked unsupported here. - */ -drm_chipinfo_t DRM(devicelist)[] = { - {0x1002, 0x4c45, __REALLY_HAVE_SG, "ATI Rage 128 Mobility LE (PCI)"}, - {0x1002, 0x4c46, 1, "ATI Rage 128 Mobility LF (AGP)"}, - {0x1002, 0x4d46, 1, "ATI Rage 128 Mobility MF (AGP)"}, - {0x1002, 0x4d4c, 1, "ATI Rage 128 Mobility ML (AGP)"}, - {0x1002, 0x5044, __REALLY_HAVE_SG, "ATI Rage 128 Pro PD (PCI)"}, - {0x1002, 0x5046, 1, "ATI Rage 128 Pro PF (AGP)"}, - {0x1002, 0x5050, __REALLY_HAVE_SG, "ATI Rage 128 Pro PP (PCI)"}, - {0x1002, 0x5052, __REALLY_HAVE_SG, "ATI Rage 128 Pro PR (PCI)"}, - {0x1002, 0x5245, __REALLY_HAVE_SG, "ATI Rage 128 RE (PCI)"}, - {0x1002, 0x5246, 1, "ATI Rage 128 RF (AGP)"}, - {0x1002, 0x5247, 1, "ATI Rage 128 RG (AGP)"}, - {0x1002, 0x524b, __REALLY_HAVE_SG, "ATI Rage 128 RK (PCI)"}, - {0x1002, 0x524c, 1, "ATI Rage 128 RL (AGP)"}, - {0x1002, 0x534d, 1, "ATI Rage 128 SM (AGP)"}, - {0x1002, 0x5446, 1, "ATI Rage 128 Pro Ultra TF (AGP)"}, - {0x1002, 0x544C, 1, "ATI Rage 128 Pro Ultra TL (AGP)"}, - {0x1002, 0x5452, 1, "ATI Rage 128 Pro Ultra TR (AGP)"}, - {0, 0, 0, NULL} -}; - #include "drm_agpsupport.h" #include "drm_auth.h" #include "drm_bufs.h" diff --git a/bsd/radeon_drv.c b/bsd/radeon_drv.c index 62433c23..3b699768 100644 --- a/bsd/radeon_drv.c +++ b/bsd/radeon_drv.c @@ -37,45 +37,6 @@ #include "ati_pcigart.h" #endif -drm_chipinfo_t DRM(devicelist)[] = { - {0x1002, 0x4242, 1, "ATI Radeon BB R200 AIW 8500DV"}, - {0x1002, 0x4964, 1, "ATI Radeon Id R250 9000"}, - {0x1002, 0x4965, 1, "ATI Radeon Ie R250 9000"}, - {0x1002, 0x4966, 1, "ATI Radeon If R250 9000"}, - {0x1002, 0x4967, 1, "ATI Radeon Ig R250 9000"}, - {0x1002, 0x4C57, 1, "ATI Radeon LW Mobility 7500 M7"}, - {0x1002, 0x4C58, 1, "ATI Radeon LX RV200 Mobility FireGL 7800 M7"}, - {0x1002, 0x4C59, 1, "ATI Radeon LY Mobility M6"}, - {0x1002, 0x4C5A, 1, "ATI Radeon LZ Mobility M6"}, - {0x1002, 0x4C64, 1, "ATI Radeon Ld R250 Mobility 9000 M9"}, - {0x1002, 0x4C65, 1, "ATI Radeon Le R250 Mobility 9000 M9"}, - {0x1002, 0x4C66, 1, "ATI Radeon Lf R250 Mobility 9000 M9"}, - {0x1002, 0x4C67, 1, "ATI Radeon Lg R250 Mobility 9000 M9"}, - {0x1002, 0x5144, 1, "ATI Radeon QD R100"}, - {0x1002, 0x5145, 1, "ATI Radeon QE R100"}, - {0x1002, 0x5146, 1, "ATI Radeon QF R100"}, - {0x1002, 0x5147, 1, "ATI Radeon QG R100"}, - {0x1002, 0x5148, 1, "ATI Radeon QH R200 8500"}, - {0x1002, 0x5149, 1, "ATI Radeon QI R200"}, - {0x1002, 0x514A, 1, "ATI Radeon QJ R200"}, - {0x1002, 0x514B, 1, "ATI Radeon QK R200"}, - {0x1002, 0x514C, 1, "ATI Radeon QL R200 8500 LE"}, - {0x1002, 0x514D, 1, "ATI Radeon QM R200 9100"}, - {0x1002, 0x514E, 1, "ATI Radeon QN R200 8500 LE"}, - {0x1002, 0x514F, 1, "ATI Radeon QO R200 8500 LE"}, - {0x1002, 0x5157, 1, "ATI Radeon QW RV200 7500"}, - {0x1002, 0x5158, 1, "ATI Radeon QX RV200 7500"}, - {0x1002, 0x5159, 1, "ATI Radeon QY RV100 7000/VE"}, - {0x1002, 0x515A, 1, "ATI Radeon QZ RV100 7000/VE"}, - {0x1002, 0x5168, 1, "ATI Radeon Qh R200"}, - {0x1002, 0x5169, 1, "ATI Radeon Qi R200"}, - {0x1002, 0x516A, 1, "ATI Radeon Qj R200"}, - {0x1002, 0x516B, 1, "ATI Radeon Qk R200"}, - {0x1002, 0x516C, 1, "ATI Radeon Ql R200"}, - {0x1002, 0x5961, 1, "ATI Radeon RV280 9200"}, - {0, 0, 0, NULL} -}; - #include "drm_agpsupport.h" #include "drm_auth.h" #include "drm_bufs.h" diff --git a/bsd/sis_drv.c b/bsd/sis_drv.c index 13be07a2..64767a4a 100644 --- a/bsd/sis_drv.c +++ b/bsd/sis_drv.c @@ -30,13 +30,6 @@ #include "sis_drm.h" #include "sis_drv.h" -drm_chipinfo_t DRM(devicelist)[] = { - {0x1039, 0x0300, 1, "SiS 300"}, - {0x1039, 0x5300, 1, "SiS 540"}, - {0x1039, 0x6300, 1, "SiS 630"}, - {0, 0, 0, NULL} -}; - #include "drm_auth.h" #include "drm_agpsupport.h" #include "drm_bufs.h" diff --git a/bsd/tdfx.h b/bsd/tdfx.h deleted file mode 100644 index 4e6db524..00000000 --- a/bsd/tdfx.h +++ /dev/null @@ -1,43 +0,0 @@ -/* tdfx.h -- 3dfx DRM template customization -*- linux-c -*- - * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com - * - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Gareth Hughes <gareth@valinux.com> - * - */ - -#ifndef __TDFX_H__ -#define __TDFX_H__ - -/* This remains constant for all DRM template files. - */ -#define DRM(x) tdfx_##x - -/* General customization: - */ -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 - -#endif diff --git a/bsd/tdfx_drv.c b/bsd/tdfx_drv.c index 1c803752..e96216c8 100644 --- a/bsd/tdfx_drv.c +++ b/bsd/tdfx_drv.c @@ -34,56 +34,12 @@ #include "tdfx.h" #include "drmP.h" -#define DRIVER_AUTHOR "VA Linux Systems Inc." - -#define DRIVER_NAME "tdfx" -#define DRIVER_DESC "3dfx Banshee/Voodoo3+" -#define DRIVER_DATE "20010216" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 0 - -#ifndef PCI_VENDOR_ID_3DFX -#define PCI_VENDOR_ID_3DFX 0x121A -#endif -#ifndef PCI_DEVICE_ID_3DFX_VOODOO5 -#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009 -#endif -#ifndef PCI_DEVICE_ID_3DFX_VOODOO4 -#define PCI_DEVICE_ID_3DFX_VOODOO4 0x0007 -#endif -#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_3000 /* Voodoo3 3000 */ -#define PCI_DEVICE_ID_3DFX_VOODOO3_3000 0x0005 -#endif -#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_2000 /* Voodoo3 3000 */ -#define PCI_DEVICE_ID_3DFX_VOODOO3_2000 0x0004 -#endif -#ifndef PCI_DEVICE_ID_3DFX_BANSHEE -#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003 -#endif - -/* List acquired from http://www.yourvote.com/pci/pcihdr.h and xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h - * Please report to anholt@teleport.com inaccuracies or if a chip you have works that is marked unsupported here. - */ -drm_chipinfo_t DRM(devicelist)[] = { - {0x121a, 0x0003, 1, "3dfx Voodoo Banshee"}, - {0x121a, 0x0004, 1, "3dfx Voodoo3 2000"}, - {0x121a, 0x0005, 1, "3dfx Voodoo3 3000"}, - {0x121a, 0x0007, 1, "3dfx Voodoo4"}, - {0x121a, 0x0009, 1, "3dfx Voodoo5"}, - {0, 0, 0, NULL} -}; - - #include "drm_auth.h" #include "drm_bufs.h" #include "drm_context.h" #include "drm_dma.h" #include "drm_drawable.h" #include "drm_drv.h" - - #include "drm_fops.h" #include "drm_ioctl.h" #include "drm_lock.h" |