This is the first draft of my devfs patch, it moves *most* of the PCI ids into the
shared tree.
gamma_drv.h has both a linux and bsd copy of the PCI ids. Some cards like the
i8{1,3}0 we don't
know the PCI ids. I have tested that it compiles under Linux(Debian) and correctly
makes and
removes the devfs inodes :)
I have not yet tested if it breakes dri, it shouldn't I didn't touch any of that. It
will be
later today when I can get to testing it totally. I have not tested it on BSD, I
can't. I have
not tested it on non-devfs systems, but if your lp driver workes, so will this one :)
Mike
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
diff -aNur orig/bsd/drm/kernel/drmP.h myne/bsd/drm/kernel/drmP.h
--- orig/bsd/drm/kernel/drmP.h Fri Jul 5 03:31:07 2002
+++ myne/bsd/drm/kernel/drmP.h Wed Jul 10 00:36:55 2002
@@ -73,12 +73,16 @@
#include "drm_os_freebsd.h"
#elif defined __NetBSD__
#include "drm_os_netbsd.h"
+#else
+#warning "This is not FreeBSD or NetBSD!"
#endif
#include "drm.h"
/* Begin the DRM... */
+#define DRM_SUP_BSD 1
+
#define DRM_HASH_SIZE 16 /* Size of key hash table */
#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
@@ -145,11 +149,6 @@
(_map) = (_dev)->context_sareas[_ctx]; \
} while(0)
-
-typedef struct drm_pci_list {
- u16 vendor;
- u16 device;
-} drm_pci_list_t;
typedef struct drm_ioctl_desc {
d_ioctl_t *func;
diff -aNur orig/bsd/drm/kernel/gamma_drv.c myne/bsd/drm/kernel/gamma_drv.c
--- orig/bsd/drm/kernel/gamma_drv.c Fri Jul 5 03:31:08 2002
+++ myne/bsd/drm/kernel/gamma_drv.c Wed Jul 10 06:04:20 2002
@@ -34,6 +34,7 @@
#include "drmP.h"
#include "drm.h"
#include "gamma_drm.h"
+#define DEVICELIST
#include "gamma_drv.h"
#define DRIVER_AUTHOR "VA Linux Systems Inc."
@@ -48,14 +49,6 @@
#define DRIVER_IOCTLS \
[DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 }
-
-/* List acquired from http://www.yourvote.com/pci/pcihdr.h and
xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
- * Please report to [EMAIL PROTECTED] inaccuracies or if a chip you have works that
is marked unsupported here.
- */
-drm_chipinfo_t DRM(devicelist)[] = {
- {0x3d3d, 0x0008, 1, "3DLabs Gamma"},
- {0, 0, 0, NULL}
-};
#define __HAVE_COUNTERS 5
diff -aNur orig/bsd/drm/kernel/gamma_drv.h myne/bsd/drm/kernel/gamma_drv.h
--- orig/bsd/drm/kernel/gamma_drv.h Fri Jul 5 03:31:08 2002
+++ myne/bsd/drm/kernel/gamma_drv.h Wed Jul 10 06:16:03 2002
@@ -32,6 +32,8 @@
#ifndef _GAMMA_DRV_H_
#define _GAMMA_DRV_H_
+#define "drmP.h"
+#define "dri_sup.h"
typedef struct drm_gamma_private {
drm_map_t *buffers;
@@ -100,5 +102,17 @@
#define GAMMA_OUTPUTFIFO 0x2000
#define GAMMA_SYNC 0x8c40
#define GAMMA_SYNC_TAG 0x0188
+
+#ifdef DEVICELIST
+/* List acquired from http://www.yourvote.com/pci/pcihdr.h and
+xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
+ * Please report to [EMAIL PROTECTED] inaccuracies or if a chip you have works that
+is marked unsupported here.
+ */
+drm_chipinfo_t DRM(devicelist)[] = {
+ {0x3d3d, 0x0008, 1, "3DLabs Gamma"},
+ {0, 0, 0, NULL}
+};
+
+#define DRIVER_CARD_LIST DRM(devicelist)
+#endif
#endif
diff -aNur orig/bsd/drm/kernel/mga_drv.c myne/bsd/drm/kernel/mga_drv.c
--- orig/bsd/drm/kernel/mga_drv.c Fri Jul 5 03:31:08 2002
+++ myne/bsd/drm/kernel/mga_drv.c Wed Jul 10 06:04:47 2002
@@ -35,18 +35,8 @@
#include "drmP.h"
#include "drm.h"
#include "mga_drm.h"
+#define DEVICELIST
#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 [EMAIL PROTECTED] 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"
diff -aNur orig/bsd/drm/kernel/r128_drv.c myne/bsd/drm/kernel/r128_drv.c
--- orig/bsd/drm/kernel/r128_drv.c Fri Jul 5 03:31:08 2002
+++ myne/bsd/drm/kernel/r128_drv.c Wed Jul 10 06:05:11 2002
@@ -36,34 +36,11 @@
#include "drmP.h"
#include "drm.h"
#include "r128_drm.h"
+#define DEVICELIST
#include "r128_drv.h"
#if __REALLY_HAVE_SG
#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 [EMAIL PROTECTED] 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"
diff -aNur orig/bsd/drm/kernel/radeon_drv.c myne/bsd/drm/kernel/radeon_drv.c
--- orig/bsd/drm/kernel/radeon_drv.c Fri Jul 5 03:31:08 2002
+++ myne/bsd/drm/kernel/radeon_drv.c Wed Jul 10 06:05:27 2002
@@ -33,27 +33,11 @@
#include "drmP.h"
#include "drm.h"
#include "radeon_drm.h"
+#define DEVICELIST
#include "radeon_drv.h"
#if __REALLY_HAVE_SG
#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 [EMAIL PROTECTED] inaccuracies or if a chip you have works that is
marked unsupported here.
- */
-drm_chipinfo_t DRM(devicelist)[] = {
- {0x1002, 0x4C57, 1, "ATI Radeon LW Mobility 7 (AGP)"},
- {0x1002, 0x4C59, 1, "ATI Radeon LY Mobility 6 (AGP)"},
- {0x1002, 0x4C5A, 1, "ATI Radeon LZ Mobility 6 (AGP)"},
- {0x1002, 0x5144, 1, "ATI Radeon QD (AGP)"},
- {0x1002, 0x5145, 1, "ATI Radeon QE (AGP)"},
- {0x1002, 0x5146, 1, "ATI Radeon QF (AGP)"},
- {0x1002, 0x5147, 1, "ATI Radeon QG (AGP)"},
- {0x1002, 0x5157, 1, "ATI Radeon QW 7500 (AGP)"},
- {0x1002, 0x5159, 1, "ATI Radeon QY VE (AGP)"},
- {0x1002, 0x515A, 1, "ATI Radeon QZ VE (AGP)"},
- {0, 0, 0, NULL}
-};
#include "drm_agpsupport.h"
#include "drm_auth.h"
diff -aNur orig/bsd/drm/kernel/tdfx_drv.c myne/bsd/drm/kernel/tdfx_drv.c
--- orig/bsd/drm/kernel/tdfx_drv.c Fri Jul 5 03:31:08 2002
+++ myne/bsd/drm/kernel/tdfx_drv.c Wed Jul 10 06:05:44 2002
@@ -35,6 +35,8 @@
#include "tdfx.h"
#include "drmP.h"
+#define DEVICELIST
+#include "tdfx_drv.h"
#define DRIVER_AUTHOR "VA Linux Systems Inc."
@@ -45,37 +47,6 @@
#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 [EMAIL PROTECTED] 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"
diff -aNur orig/linux/drm/kernel/drm.h myne/linux/drm/kernel/drm.h
--- orig/linux/drm/kernel/drm.h Fri Jul 5 03:31:09 2002
+++ myne/linux/drm/kernel/drm.h Wed Jul 10 05:11:30 2002
@@ -80,6 +80,7 @@
#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0)
#define DRM_MAJOR 226
+/* If max minor is bigger than 9999 there is a buffer overrun */
#define DRM_MAX_MINOR 15
#endif
#define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */
@@ -439,7 +440,7 @@
#define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, drm_scatter_gather_t)
#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, drm_scatter_gather_t)
-/* Device specfic ioctls should only be in their respective headers
+/* Device specific ioctls should only be in their respective headers
* The device specific ioctl range is 0x40 to 0x79. */
#define DRM_COMMAND_BASE 0x40
diff -aNur orig/linux/drm/kernel/drmP.h myne/linux/drm/kernel/drmP.h
--- orig/linux/drm/kernel/drmP.h Fri Jul 5 03:31:09 2002
+++ myne/linux/drm/kernel/drmP.h Wed Jul 10 00:35:48 2002
@@ -69,6 +69,7 @@
#include <linux/tqueue.h>
#include <linux/poll.h>
#include <asm/pgalloc.h>
+#include <linux/devfs_fs_kernel.h>
#include "drm.h"
#include "drm_os_linux.h"
@@ -108,6 +109,8 @@
/* Begin the DRM...
*/
+#define DRM_SUP_LINUX 1
+
#define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then
also include looping detection. */
@@ -271,10 +274,13 @@
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_chipinfo
+{
+ int vendor;
+ int device;
+ int supported;
+ char *name;
+} drm_chipinfo_t;
typedef struct drm_ioctl_desc {
drm_ioctl_t *func;
@@ -522,6 +528,7 @@
char *unique; /* Unique identifier: e.g., busid */
int unique_len; /* Length of unique field */
dev_t device; /* Device number for mknod */
+ devfs_handle_t dev_handle; /* Device handel for devfs */
char *devname; /* For /proc/interrupts */
int blocked; /* Blocked due to VC switch? */
diff -aNur orig/linux/drm/kernel/drm_drv.h myne/linux/drm/kernel/drm_drv.h
--- orig/linux/drm/kernel/drm_drv.h Fri Jul 5 03:31:09 2002
+++ myne/linux/drm/kernel/drm_drv.h Wed Jul 10 05:53:30 2002
@@ -87,6 +87,16 @@
#ifndef __HAVE_KERNEL_CTX_SWITCH
#define __HAVE_KERNEL_CTX_SWITCH 0
#endif
+#ifndef DRM_MAX_MINOR
+/*
+ * Do not try to bend the spoon, that's impossible.
+ * Instead edit drm.h
+ *
+ * This is only hear for the case where something is wrong with your computer.
+ */
+# define DRM_MAX_MINOR 16
+#endif
+
#ifndef DRIVER_PREINIT
#define DRIVER_PREINIT()
@@ -145,7 +155,7 @@
#endif
/*
- * The default number of instances (minor numbers) to initialize.
+ * The default number of instances (minor numbers) to initialise.
*/
#ifndef DRIVER_NUM_CARDS
#define DRIVER_NUM_CARDS 1
@@ -338,7 +348,7 @@
* in drm_dma_enqueue. This is more resource-efficient for
* hardware that does not do DMA, but may mean that
* drm_select_queue fails between the time the interrupt is
- * initialized and the time the queues are initialized.
+ * initialised and the time the queues are initialised.
*/
DRIVER_POSTSETUP();
return 0;
@@ -501,14 +511,14 @@
}
/*
- * Figure out how many instances to initialize.
+ * Figure out how many instances to initialise.
*/
static int drm_count_cards(void)
{
int num = 0;
#if defined(DRIVER_CARD_LIST)
int i;
- drm_pci_list_t *l;
+ drm_chipinfo_t *l;
u16 device, vendor;
struct pci_dev *pdev = NULL;
#endif
@@ -519,14 +529,19 @@
num = DRIVER_COUNT_CARDS();
#elif defined(DRIVER_CARD_LIST)
for (i = 0, l = DRIVER_CARD_LIST; l[i].vendor != 0; i++) {
+ if (l[i].supported)
+ {
pdev = NULL;
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))) {
+ printk("There is a %s in slot %s.\n",
+ l[i].name, pdev->slot_name);
num++;
}
+ }
}
#else
num = DRIVER_NUM_CARDS;
@@ -556,6 +571,13 @@
/* Force at least one instance. */
if (DRM(numdevs) <= 0)
DRM(numdevs) = 1;
+ /* Make sure not grater than 9999, or we have a buffer overrun */
+ if (DRM(numdevs) > DRM_MAX_MINOR) {
+ printk("Max number of cards is %d.\n", DRM_MAX_MINOR);
+ printk("Try increasing DRM_MAX_MINOR to %d.\n",
+ DRM(numdevs) + 1);
+ DRM(numdevs) = DRM_MAX_MINOR;
+ }
DRM(device) = kmalloc(sizeof(*DRM(device)) * DRM(numdevs), GFP_KERNEL);
if (!DRM(device)) {
@@ -635,6 +657,7 @@
for (i = DRM(numdevs) - 1; i >= 0; i--) {
dev = &(DRM(device)[i]);
+ devfs_unregister(dev->dev_handle);
if ( DRM(stub_unregister)(DRM(minor)[i]) ) {
DRM_ERROR( "Cannot unload module\n" );
} else {
diff -aNur orig/linux/drm/kernel/drm_stub.h myne/linux/drm/kernel/drm_stub.h
--- orig/linux/drm/kernel/drm_stub.h Thu May 16 18:47:15 2002
+++ myne/linux/drm/kernel/drm_stub.h Wed Jul 10 05:45:55 2002
@@ -31,7 +31,10 @@
#define __NO_VERSION__
#include "drmP.h"
-#define DRM_STUB_MAXCARDS 16 /* Enough for one machine */
+#ifndef DRM_MAX_MINOR
+#define DRM_MAX_MINOR 16 /* Enough for one machine */
+#endif
+#define DRM_STUB_MAXCARDS ( DRM_MAX_MINOR + 1 )
static struct drm_stub_list {
const char *name;
@@ -45,8 +48,11 @@
int (*info_register)(const char *name, struct file_operations *fops,
drm_device_t *dev);
int (*info_unregister)(int minor);
+ devfs_handle_t *info_handle;
} DRM(stub_info);
+static devfs_handle_t DRM(devfs_dir_dri);
+
static int DRM(stub_open)(struct inode *inode, struct file *filp)
{
int minor = minor(inode->i_rdev);
@@ -84,6 +90,7 @@
DRM(stub_list)[i].fops = NULL;
}
}
+
for (i = 0; i < DRM_STUB_MAXCARDS; i++) {
if (!DRM(stub_list)[i].fops) {
DRM(stub_list)[i].name = name;
@@ -111,7 +118,8 @@
DRM(free)(DRM(stub_list),
sizeof(*DRM(stub_list)) * DRM_STUB_MAXCARDS,
DRM_MEM_STUB);
- unregister_chrdev(DRM_MAJOR, "drm");
+ devfs_unregister_chrdev(DRM_MAJOR, "drm");
+ devfs_unregister(DRM(devfs_dir_dri));
}
return 0;
}
@@ -121,25 +129,60 @@
drm_device_t *dev)
{
struct drm_stub_info *i = NULL;
+ int minor;
+ char buff[8];
DRM_DEBUG("\n");
- if (register_chrdev(DRM_MAJOR, "drm", &DRM(stub_fops)))
+ /*
+ * FIX-ME
+ *
+ * The first drm gets stuck if another drm is loaded
+ * and can not be unloaded if it needs to be.
+ * You will have to unload ALL dris.
+ *
+ * This is because the other dri modules will increment
+ * the first dri's use count, making lsmod look funny.
+ *
+ * inter_module_get (called if devfs_register_chrdev returns error
+ * I.E. another drm already registered DRM_MAJOR)
+ * increments the module use count of the dri that calls
+ * inter_module_register.
+ *
+ * The dri that calls inter_module_register may also
+ * call inter_module_put and deinc it's own use count.
+ * It may not be intended to work that way, how ever I
+ * see no problem in kernel/module.c with doing it this way.
+ *
+ */
+ if (devfs_register_chrdev(DRM_MAJOR, "drm", &DRM(stub_fops)))
i = (struct drm_stub_info *)inter_module_get("drm");
if (i) {
/* Already registered */
DRM(stub_info).info_register = i->info_register;
DRM(stub_info).info_unregister = i->info_unregister;
+ DRM(stub_info).info_handle = i->info_handle;
+ DRM(devfs_dir_dri) = *DRM(stub_info).info_handle;
DRM_DEBUG("already registered\n");
} else if (DRM(stub_info).info_register != DRM(stub_getminor)) {
+ DRM(devfs_dir_dri) = devfs_mk_dir(NULL, "dri", NULL);
DRM(stub_info).info_register = DRM(stub_getminor);
DRM(stub_info).info_unregister = DRM(stub_putminor);
+ DRM(stub_info).info_handle = &DRM(devfs_dir_dri);
DRM_DEBUG("calling inter_module_register\n");
inter_module_register("drm", THIS_MODULE, &DRM(stub_info));
}
if (DRM(stub_info).info_register)
- return DRM(stub_info).info_register(name, fops, dev);
- return -1;
+ { minor = DRM(stub_info).info_register(name, fops, dev); }
+ else return -1;
+
+ sprintf(buff, "card%d", minor);
+ dev->dev_handle = devfs_register(DRM(devfs_dir_dri), buff,
+ DEVFS_FL_DEFAULT, DRM_MAJOR, minor,
+ S_IFCHR | S_IRUGO | S_IWUGO,
+ fops, NULL);
+
+ return minor;
}
int DRM(stub_unregister)(int minor)
diff -aNur orig/linux/drm/kernel/gamma_drv.c myne/linux/drm/kernel/gamma_drv.c
--- orig/linux/drm/kernel/gamma_drv.c Fri Jul 5 03:31:09 2002
+++ myne/linux/drm/kernel/gamma_drv.c Wed Jul 10 05:55:49 2002
@@ -34,6 +34,7 @@
#include "drmP.h"
#include "drm.h"
#include "gamma_drm.h"
+#define DEVICELIST
#include "gamma_drv.h"
#include "drm_auth.h"
diff -aNur orig/linux/drm/kernel/gamma_drv.h myne/linux/drm/kernel/gamma_drv.h
--- orig/linux/drm/kernel/gamma_drv.h Wed Feb 13 20:00:23 2002
+++ myne/linux/drm/kernel/gamma_drv.h Wed Jul 10 06:25:24 2002
@@ -32,6 +32,9 @@
#ifndef _GAMMA_DRV_H_
#define _GAMMA_DRV_H_
+#include "drmP.h" /* drm_chipinfo */
+#include "drm_sup.h"
+
typedef struct drm_gamma_private {
drm_gamma_sarea_t *sarea_priv;
drm_map_t *sarea;
@@ -116,5 +119,17 @@
#define GAMMA_DMAADDRTAG 0x530
#define GAMMA_DMACOUNTTAG 0x531
#define GAMMA_COMMANDINTTAG 0x532
+
+#ifdef DEVICELIST
+/* List acquired from http://www.yourvote.com/pci/pcihdr.h and
+xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
+ * Please report to [EMAIL PROTECTED] inaccuracies or if a chip you have works that
+is marked unsupported here.
+ */
+drm_chipinfo_t DRM(devicelist)[] = {
+ {0x3d3d, 0x0008, 1, "3DLabs Gamma"},
+ {0, 0, 0, NULL}
+};
+
+#define DRIVER_CARD_LIST DRM(devicelist)
+#endif
#endif
diff -aNur orig/linux/drm/kernel/mga_drv.c myne/linux/drm/kernel/mga_drv.c
--- orig/linux/drm/kernel/mga_drv.c Fri Jul 5 03:31:10 2002
+++ myne/linux/drm/kernel/mga_drv.c Wed Jul 10 06:02:35 2002
@@ -34,6 +34,7 @@
#include "drmP.h"
#include "drm.h"
#include "mga_drm.h"
+#define DEVICELIST
#include "mga_drv.h"
#include "drm_agpsupport.h"
#include "drm_auth.h"
diff -aNur orig/linux/drm/kernel/r128_drv.c myne/linux/drm/kernel/r128_drv.c
--- orig/linux/drm/kernel/r128_drv.c Fri Jul 5 03:31:10 2002
+++ myne/linux/drm/kernel/r128_drv.c Wed Jul 10 05:58:22 2002
@@ -34,6 +34,7 @@
#include "drmP.h"
#include "drm.h"
#include "r128_drm.h"
+#define DEVICELIST
#include "r128_drv.h"
#include "ati_pcigart.h"
diff -aNur orig/linux/drm/kernel/radeon_drv.c myne/linux/drm/kernel/radeon_drv.c
--- orig/linux/drm/kernel/radeon_drv.c Fri Jul 5 03:31:10 2002
+++ myne/linux/drm/kernel/radeon_drv.c Wed Jul 10 06:01:43 2002
@@ -32,6 +32,7 @@
#include "drmP.h"
#include "drm.h"
#include "radeon_drm.h"
+#define DEVICELIST
#include "radeon_drv.h"
#include "ati_pcigart.h"
diff -aNur orig/linux/drm/kernel/tdfx_drv.c myne/linux/drm/kernel/tdfx_drv.c
--- orig/linux/drm/kernel/tdfx_drv.c Fri Jul 5 03:31:10 2002
+++ myne/linux/drm/kernel/tdfx_drv.c Wed Jul 10 06:19:39 2002
@@ -33,6 +33,8 @@
#include <linux/config.h>
#include "tdfx.h"
#include "drmP.h"
+#define DEVICELIST
+#include "tdfx_drv.h"
#define DRIVER_AUTHOR "VA Linux Systems Inc."
@@ -43,36 +45,6 @@
#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
-
-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_2000 },
- { PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3_3000 },
- { PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO4 },
- { PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO5 },
- { 0, 0 }
-};
-
-#define DRIVER_CARD_LIST DRM(idlist)
#include "drm_auth.h"
diff -aNur orig/shared/drm/kernel/drm_sup.h myne/shared/drm/kernel/drm_sup.h
--- orig/shared/drm/kernel/drm_sup.h Wed Dec 31 18:00:00 1969
+++ myne/shared/drm/kernel/drm_sup.h Wed Jul 10 05:57:32 2002
@@ -0,0 +1,25 @@
+/* drm_sup.h -- This is for DRM specific kernel identifiers.
+ *
+ * Add your DRM_SUP_* hear if your going to use our PCI ids.
+ *
+ * Authors:
+ * Mike Mestnik <[EMAIL PROTECTED]>
+ */
+
+#include "drmP.h" /* so the below can't get miss defined */
+
+#ifndef DRM_SUP_LINUX
+#ifdef __linux__
+#define DRM_SUP_LINUX 1
+#else
+#define DRM_SUP_LINUX 0
+#endif
+#endif
+
+#ifndef DRM_SUP_BSD
+#if (defined __NetBSD__ | defined __FreeBSD)
+#define DRM_SUP_BSD 1
+#else
+#define DRM_SUP_BSD 0
+#endif
+#endif
diff -aNur orig/shared/drm/kernel/mga_drv.h myne/shared/drm/kernel/mga_drv.h
--- orig/shared/drm/kernel/mga_drv.h Fri Jul 5 03:31:11 2002
+++ myne/shared/drm/kernel/mga_drv.h Wed Jul 10 06:02:19 2002
@@ -31,6 +31,9 @@
#ifndef __MGA_DRV_H__
#define __MGA_DRV_H__
+#include "drmP.h" /* drm_chipinfo */
+#include "drm_sup.h"
+
typedef struct drm_mga_primary_buffer {
u8 *start;
u8 *end;
@@ -627,5 +630,20 @@
u32 status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK;
return ( status == MGA_ENDPRDMASTS );
}
+
+#ifdef DEVICELIST
+/* List acquired from http://www.yourvote.com/pci/pcihdr.h and
+xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
+ * Please report to [EMAIL PROTECTED] inaccuracies or if a chip you have works that
+is marked unsupported here.
+ */
+drm_chipinfo_t DRM(devicelist)[] = {
+ {0x102b, 0x0520, (0 | DRM_SUP_LINUX), "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}
+};
+
+#define DRIVER_CARD_LIST DRM(devicelist)
+#endif
#endif
diff -aNur orig/shared/drm/kernel/r128_drv.h myne/shared/drm/kernel/r128_drv.h
--- orig/shared/drm/kernel/r128_drv.h Fri Jul 5 03:31:11 2002
+++ myne/shared/drm/kernel/r128_drv.h Wed Jul 10 05:59:57 2002
@@ -34,6 +34,9 @@
#ifndef __R128_DRV_H__
#define __R128_DRV_H__
+#include "drmP.h" /* drm_chipinfo */
+#include "drm_sup.h"
+
#define GET_RING_HEAD(ring) DRM_READ32( (volatile u32 *) (ring)->head )
#define SET_RING_HEAD(ring,val) DRM_WRITE32( (volatile u32 *)
(ring)->head, (val) )
@@ -500,5 +503,39 @@
ring[write++] = cpu_to_le32( x ); \
write &= tail_mask; \
} while (0)
+
+#ifdef DEVICELIST
+/* List acquired from http://www.yourvote.com/pci/pcihdr.h and
+xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
+ * Please report to [EMAIL PROTECTED] inaccuracies or if a chip you have works that is
+marked unsupported here.
+ */
+drm_chipinfo_t DRM(devicelist)[] = {
+ {0x1002, 0x4c45, (__REALLY_HAVE_SG | DRM_SUP_LINUX),
+ "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 | DRM_SUP_LINUX),
+ "ATI Rage 128 Pro PD (PCI)"},
+ {0x1002, 0x5046, 1, "ATI Rage 128 Pro PF (AGP)"},
+ {0x1002, 0x5050, (__REALLY_HAVE_SG | DRM_SUP_LINUX),
+ "ATI Rage 128 Pro PP (PCI)"},
+ {0x1002, 0x5052, (__REALLY_HAVE_SG | DRM_SUP_LINUX),
+ "ATI Rage 128 Pro PR (PCI)"},
+ {0x1002, 0x5245, (__REALLY_HAVE_SG | DRM_SUP_LINUX),
+ "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 | DRM_SUP_LINUX),
+ "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}
+};
+
+#define DRIVER_CARD_LIST DRM(devicelist)
+#endif
#endif /* __R128_DRV_H__ */
diff -aNur orig/shared/drm/kernel/radeon_drv.h myne/shared/drm/kernel/radeon_drv.h
--- orig/shared/drm/kernel/radeon_drv.h Fri Jul 5 03:31:11 2002
+++ myne/shared/drm/kernel/radeon_drv.h Wed Jul 10 06:01:31 2002
@@ -31,6 +31,9 @@
#ifndef __RADEON_DRV_H__
#define __RADEON_DRV_H__
+#include "drmP.h" /* drm_chipinfo */
+#include "drm_sup.h"
+
#define GET_RING_HEAD(ring) DRM_READ32( (volatile u32 *) (ring)->head )
#define SET_RING_HEAD(ring,val) DRM_WRITE32( (volatile u32 *)
(ring)->head , (val))
@@ -754,6 +757,26 @@
write &= mask; \
} while (0)
+#ifdef DEVICELIST
+/* List acquired from http://www.yourvote.com/pci/pcihdr.h and
+xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
+ * Please report to [EMAIL PROTECTED] inaccuracies or if a chip you have works that is
+marked unsupported here.
+ */
+drm_chipinfo_t DRM(devicelist)[] = {
+ {0x1002, 0x4C57, 1, "ATI Radeon LW Mobility 7 (AGP)"},
+ {0x1002, 0x4C59, 1, "ATI Radeon LY Mobility 6 (AGP)"},
+ {0x1002, 0x4C5A, 1, "ATI Radeon LZ Mobility 6 (AGP)"},
+ {0x1002, 0x5144, 1, "ATI Radeon QD (AGP)"},
+ {0x1002, 0x5145, 1, "ATI Radeon QE (AGP)"},
+ {0x1002, 0x5146, 1, "ATI Radeon QF (AGP)"},
+ {0x1002, 0x5147, 1, "ATI Radeon QG (AGP)"},
+ {0x1002, 0x5157, 1, "ATI Radeon QW 7500 (AGP)"},
+ {0x1002, 0x5159, 1, "ATI Radeon QY VE (AGP)"},
+ {0x1002, 0x515A, 1, "ATI Radeon QZ VE (AGP)"},
+ {0, 0, 0, NULL}
+};
+
+#define DRIVER_CARD_LIST DRM(devicelist)
+#endif
#define RADEON_PERFORMANCE_BOXES 0
diff -aNur orig/shared/drm/kernel/tdfx_drv.h myne/shared/drm/kernel/tdfx_drv.h
--- orig/shared/drm/kernel/tdfx_drv.h Wed Dec 31 18:00:00 1969
+++ myne/shared/drm/kernel/tdfx_drv.h Wed Jul 10 06:38:39 2002
@@ -0,0 +1,30 @@
+/* tdfx_drv.h -- Private header for tdfx driver -*- linux-c -*-
+ *
+ * Authors:
+ * Eric Anholt <[EMAIL PROTECTED]>
+ * Mike Mestnik <[EMAIL PROTECTED]>
+ */
+
+#ifndef __TDFX_DRV_H__
+#define __TDFX_DRV_H__
+
+#include "drmP.h" /* drm_chipinfo */
+#include "drm_sup.h"
+
+#ifdef DEVICELIST
+/* List acquired from http://www.yourvote.com/pci/pcihdr.h and
+xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
+ * Please report to [EMAIL PROTECTED] 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}
+};
+
+#define DRIVER_CARD_LIST DRM(devicelist)
+#endif
+
+#endif /* __TDFX_DRV_H__ */