summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
Diffstat (limited to 'linux')
-rw-r--r--linux/Makefile3
-rw-r--r--linux/drmP.h4
-rw-r--r--linux/drm_compat.h51
-rw-r--r--linux/drm_stub.h27
-rw-r--r--linux/ffb_drv.c15
-rw-r--r--linux/i810_dma.c5
-rw-r--r--linux/i810_drv.c19
-rw-r--r--linux/i830_dma.c5
-rw-r--r--linux/i830_drv.c19
-rw-r--r--linux/i915_drv.c18
-rw-r--r--linux/mach64_drv.c19
-rw-r--r--linux/mga_drv.c19
-rw-r--r--linux/r128_drv.c18
-rw-r--r--linux/radeon_drv.c18
-rw-r--r--linux/radeon_i2c.c5
-rw-r--r--linux/savage_drv.c19
-rw-r--r--linux/sis_drv.c19
-rw-r--r--linux/tdfx_drv.c19
18 files changed, 82 insertions, 220 deletions
diff --git a/linux/Makefile b/linux/Makefile
index 9cfe7d5c..b338f7db 100644
--- a/linux/Makefile
+++ b/linux/Makefile
@@ -69,7 +69,8 @@ DRM_MODULES ?= $(MODULE_LIST)
DRMTEMPLATES = drm_auth.h drm_bufs.h drm_context.h drm_dma.h drm_drawable.h \
drm_drv.h drm_fops.h drm_init.h drm_ioctl.h drm_irq.h \
- drm_lock.h drm_memory.h drm_proc.h drm_stub.h drm_vm.h
+ drm_lock.h drm_memory.h drm_proc.h drm_stub.h drm_vm.h \
+ drm_sysfs.h drm_core.h
DRMSHARED = drm.h drm_sarea.h
DRMHEADERS = drmP.h $(DRMSHARED)
diff --git a/linux/drmP.h b/linux/drmP.h
index 6a0a73a6..f89db79c 100644
--- a/linux/drmP.h
+++ b/linux/drmP.h
@@ -56,7 +56,9 @@
#include <linux/smp_lock.h> /* For (un)lock_kernel */
#include <linux/mm.h>
#include <linux/pagemap.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <linux/cdev.h>
+#endif
#if defined(__alpha__) || defined(__powerpc__)
#include <asm/pgtable.h> /* For pte_wrprotect */
#endif
@@ -693,7 +695,7 @@ typedef struct drm_minor {
typedef struct drm_global {
unsigned int cards_limit;
drm_minor_t *minors;
- struct class_simple *drm_class;
+ struct drm_sysfs_class *drm_class;
struct proc_dir_entry *proc_root;
struct cdev drm_cdev;
} drm_global_t;
diff --git a/linux/drm_compat.h b/linux/drm_compat.h
index d1c55cd1..50e13b9a 100644
--- a/linux/drm_compat.h
+++ b/linux/drm_compat.h
@@ -52,6 +52,10 @@
#define pte_unmap(pte)
#endif
+#ifndef module_param
+#define module_param(name, type, perm)
+#endif
+
#ifndef list_for_each_safe
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
@@ -100,6 +104,17 @@ static inline struct page * vmalloc_to_page(void * vmalloc_addr)
}
#endif
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,2)
+#define down_write down
+#define up_write up
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#define DRM_PCI_DEV(pdev) &pdev->dev
+#else
+#define DRM_PCI_DEV(pdev) NULL
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
static inline unsigned iminor(struct inode *inode)
{
@@ -108,24 +123,52 @@ static inline unsigned iminor(struct inode *inode)
#define old_encode_dev(x) (x)
+struct drm_sysfs_class;
struct class_simple;
struct device;
#define pci_dev_put(x) do {} while (0)
#define pci_get_subsys pci_find_subsys
-#define class_simple_device_add(...) do {} while (0)
+static inline struct class_device *DRM(sysfs_device_add)(struct drm_sysfs_class *cs, dev_t dev, struct device *device, const char *fmt, ...){return NULL;}
-static inline void class_simple_device_remove(dev_t dev){}
+static inline void DRM(sysfs_device_remove)(dev_t dev){}
-static inline void class_simple_destroy(struct class_simple *cs){}
+static inline void DRM(sysfs_destroy)(struct drm_sysfs_class *cs){}
-static inline struct class_simple *class_simple_create(struct module *owner, char *name) { return (struct class_simple *)owner; }
+static inline struct drm_sysfs_class *DRM(sysfs_create)(struct module *owner, char *name) { return NULL; }
#ifndef pci_pretty_name
#define pci_pretty_name(x) x->name
#endif
+/* not used in 2.4, just makes the code compile */
+#define KOBJ_NAME_LEN 20
+struct kobject {
+ char name[KOBJ_NAME_LEN];
+};
+struct cdev {
+ struct kobject kobj;
+ struct module *owner;
+ struct file_operations *ops;
+ struct list_head list;
+ dev_t dev;
+ unsigned int count;
+};
+static inline void cdev_del(struct cdev *cd){}
+static inline void cdev_init(struct cdev *cd, struct file_operations *fop){}
+static inline int cdev_add(struct cdev *cd, dev_t dt, unsigned u){ return 0;}
+
+static inline int register_chrdev_region(dev_t device, unsigned minor, char *name) {
+ return register_chrdev(device, name, NULL);
+}
+
+static inline int unregister_chrdev_region(dev_t device, unsigned minor) {
+ return unregister_chrdev(device, NULL);
+}
+
+static inline int kobject_put(struct kobject *kobj){ return 0;};
+
#endif
#ifndef __user
diff --git a/linux/drm_stub.h b/linux/drm_stub.h
index 7037338a..52b03453 100644
--- a/linux/drm_stub.h
+++ b/linux/drm_stub.h
@@ -42,10 +42,8 @@ MODULE_LICENSE("GPL and additional rights");
MODULE_PARM_DESC(cards_limit, "Maximum number of graphics cards");
MODULE_PARM_DESC(debug, "Enable debug output");
-#ifdef module_param
module_param(cards_limit, int, 0444);
module_param(debug, int, 0666);
-#endif
drm_global_t *DRM(global);
@@ -135,10 +133,10 @@ static int get_minor(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_request_regions(pdev, DRIVER_NAME);
pci_enable_device(pdev);
}
- dev_class = class_simple_device_add(DRM(global)->drm_class,
- MKDEV(DRM_MAJOR, minor), &pdev->dev, "card%d", minor);
+ dev_class = DRM(sysfs_device_add)(DRM(global)->drm_class,
+ MKDEV(DRM_MAJOR, minor), DRM_PCI_DEV(pdev), "card%d", minor);
if (IS_ERR(dev_class)) {
- printk (KERN_ERR "DRM: Error class_simple_device_add.\n");
+ printk (KERN_ERR "DRM: Error sysfs_device_add.\n");
ret = PTR_ERR(dev_class);
goto err_g2;
}
@@ -191,10 +189,10 @@ int DRM(get_secondary_minor)(drm_device_t *dev, drm_minor_t **sec_minor)
goto err_g1;
}
- dev_class = class_simple_device_add(DRM(global)->drm_class,
- MKDEV(DRM_MAJOR, minor), &dev->pdev->dev, "card%d", minor);
+ dev_class = DRM(sysfs_device_add)(DRM(global)->drm_class,
+ MKDEV(DRM_MAJOR, minor), DRM_PCI_DEV(dev->pdev), "card%d", minor);
if (IS_ERR(dev_class)) {
- printk (KERN_ERR "DRM: Error class_simple_device_add.\n");
+ printk (KERN_ERR "DRM: Error sysfs_device_add.\n");
ret = PTR_ERR(dev_class);
goto err_g2;
}
@@ -232,7 +230,7 @@ int DRM(put_minor)(drm_device_t *dev)
DRM_DEBUG("release primary minor %d\n", dev->minor);
DRM(proc_cleanup)(dev->minor, DRM(global)->proc_root, minors->dev_root);
- class_simple_device_remove(MKDEV(DRM_MAJOR, dev->minor));
+ DRM(sysfs_device_remove)(MKDEV(DRM_MAJOR, dev->minor));
*minors = (drm_minor_t){.dev = NULL, .class = DRM_MINOR_FREE};
DRM(free)(dev, sizeof(*dev), DRM_MEM_STUB);
@@ -248,7 +246,8 @@ int DRM(put_minor)(drm_device_t *dev)
DRM_DEBUG("unregistering inter_module \n");
inter_module_unregister("drm");
remove_proc_entry("dri", NULL);
- class_simple_destroy(DRM(global)->drm_class);
+ DRM(sysfs_destroy)(DRM(global)->drm_class);
+
cdev_del(&DRM(global)->drm_cdev);
unregister_chrdev_region(MKDEV(DRM_MAJOR, 0), DRM_MAX_MINOR);
@@ -277,7 +276,7 @@ int DRM(put_secondary_minor)(drm_minor_t *sec_minor)
DRM_DEBUG("release secondary minor %d\n", minor);
DRM(proc_cleanup)(minor, DRM(global)->proc_root, sec_minor->dev_root);
- class_simple_device_remove(MKDEV(DRM_MAJOR, minor));
+ DRM(sysfs_device_remove)(MKDEV(DRM_MAJOR, minor));
*sec_minor = (drm_minor_t){.dev = NULL, .class = DRM_MINOR_FREE};
@@ -333,8 +332,8 @@ int DRM(probe)(struct pci_dev *pdev, const struct pci_device_id *ent)
printk (KERN_ERR "DRM: Error registering drm major number.\n");
goto err_p2;
}
-
- global->drm_class = class_simple_create(THIS_MODULE, "drm");
+
+ global->drm_class = DRM(sysfs_create)(THIS_MODULE, "drm");
if (IS_ERR(global->drm_class)) {
printk (KERN_ERR "DRM: Error creating drm class.\n");
ret = PTR_ERR(global->drm_class);
@@ -359,7 +358,7 @@ int DRM(probe)(struct pci_dev *pdev, const struct pci_device_id *ent)
}
return 0;
err_p4:
- class_simple_destroy(global->drm_class);
+ DRM(sysfs_destroy)(global->drm_class);
err_p3:
cdev_del(&global->drm_cdev);
unregister_chrdev_region(dev, DRM_MAX_MINOR);
diff --git a/linux/ffb_drv.c b/linux/ffb_drv.c
index 5edafa09..1d78cbda 100644
--- a/linux/ffb_drv.c
+++ b/linux/ffb_drv.c
@@ -237,12 +237,7 @@ unsigned long ffb_get_unmapped_area(struct file *filp,
return addr;
}
-#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_core.h"
/* This functions must be here since it references DRM(numdevs)
* which drm_drv.h declares.
@@ -281,11 +276,3 @@ int ffb_presetup(drm_device_t *dev)
return ret;
}
-#include "drm_fops.h"
-#include "drm_init.h"
-#include "drm_ioctl.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
diff --git a/linux/i810_dma.c b/linux/i810_dma.c
index 0c828850..5d2165c6 100644
--- a/linux/i810_dma.c
+++ b/linux/i810_dma.c
@@ -52,11 +52,6 @@
#define I810_BUF_UNMAPPED 0
#define I810_BUF_MAPPED 1
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,2)
-#define down_write down
-#define up_write up
-#endif
-
static inline void i810_print_status_page(drm_device_t *dev)
{
drm_device_dma_t *dma = dev->dma;
diff --git a/linux/i810_drv.c b/linux/i810_drv.c
index 1ab8b013..00ca5516 100644
--- a/linux/i810_drv.c
+++ b/linux/i810_drv.c
@@ -37,21 +37,4 @@
#include "i810_drm.h"
#include "i810_drv.h"
-#include "drm_agpsupport.h"
-#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_init.h"
-#include "drm_ioctl.h"
-#include "drm_irq.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
-#include "drm_scatter.h"
+#include "drm_core.h"
diff --git a/linux/i830_dma.c b/linux/i830_dma.c
index f39611c0..1ce2a357 100644
--- a/linux/i830_dma.c
+++ b/linux/i830_dma.c
@@ -54,11 +54,6 @@
#define I830_BUF_UNMAPPED 0
#define I830_BUF_MAPPED 1
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,2)
-#define down_write down
-#define up_write up
-#endif
-
static inline void i830_print_status_page(drm_device_t *dev)
{
drm_device_dma_t *dma = dev->dma;
diff --git a/linux/i830_drv.c b/linux/i830_drv.c
index 900706cf..eb45b272 100644
--- a/linux/i830_drv.c
+++ b/linux/i830_drv.c
@@ -39,21 +39,4 @@
#include "i830_drm.h"
#include "i830_drv.h"
-#include "drm_agpsupport.h"
-#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_init.h"
-#include "drm_ioctl.h"
-#include "drm_irq.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
-#include "drm_scatter.h"
+#include "drm_core.h"
diff --git a/linux/i915_drv.c b/linux/i915_drv.c
index e74ef349..becce4d7 100644
--- a/linux/i915_drv.c
+++ b/linux/i915_drv.c
@@ -14,20 +14,4 @@
#include "i915_drm.h"
#include "i915_drv.h"
-#include "drm_agpsupport.h"
-#include "drm_auth.h" /* is this needed? */
-#include "drm_bufs.h"
-#include "drm_context.h" /* is this needed? */
-#include "drm_drawable.h" /* is this needed? */
-#include "drm_dma.h"
-#include "drm_drv.h"
-#include "drm_fops.h"
-#include "drm_init.h"
-#include "drm_irq.h"
-#include "drm_ioctl.h"
-#include "drm_lock.h"
-#include "drm_memory.h" /* */
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
-#include "drm_scatter.h"
+#include "drm_core.h"
diff --git a/linux/mach64_drv.c b/linux/mach64_drv.c
index 32f6cddc..05170abc 100644
--- a/linux/mach64_drv.c
+++ b/linux/mach64_drv.c
@@ -34,21 +34,4 @@
#include "mach64_drm.h"
#include "mach64_drv.h"
-#include "drm_agpsupport.h"
-#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_init.h"
-#include "drm_irq.h"
-#include "drm_ioctl.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_pci.h"
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
-#include "drm_scatter.h"
+#include "drm_core.h"
diff --git a/linux/mga_drv.c b/linux/mga_drv.c
index 57940d5d..54bfb2d3 100644
--- a/linux/mga_drv.c
+++ b/linux/mga_drv.c
@@ -35,20 +35,5 @@
#include "drm.h"
#include "mga_drm.h"
#include "mga_drv.h"
-#include "drm_agpsupport.h"
-#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_init.h"
-#include "drm_ioctl.h"
-#include "drm_irq.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
-#include "drm_scatter.h"
+
+#include "drm_core.h"
diff --git a/linux/r128_drv.c b/linux/r128_drv.c
index 1dee1615..8cfc9966 100644
--- a/linux/r128_drv.c
+++ b/linux/r128_drv.c
@@ -37,20 +37,4 @@
#include "r128_drv.h"
#include "ati_pcigart.h"
-#include "drm_agpsupport.h"
-#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_init.h"
-#include "drm_ioctl.h"
-#include "drm_irq.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
-#include "drm_scatter.h"
+#include "drm_core.h"
diff --git a/linux/radeon_drv.c b/linux/radeon_drv.c
index 74e32df0..965abc44 100644
--- a/linux/radeon_drv.c
+++ b/linux/radeon_drv.c
@@ -38,20 +38,4 @@
#include "radeon_drv.h"
#include "ati_pcigart.h"
-#include "drm_agpsupport.h"
-#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_init.h"
-#include "drm_ioctl.h"
-#include "drm_irq.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
-#include "drm_scatter.h"
+#include "drm_core.h"
diff --git a/linux/radeon_i2c.c b/linux/radeon_i2c.c
index a68b9ee1..e2591723 100644
--- a/linux/radeon_i2c.c
+++ b/linux/radeon_i2c.c
@@ -19,6 +19,9 @@
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/fb.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <asm/io.h>
#include <video/radeon.h>
@@ -150,3 +153,5 @@ void radeon_delete_i2c_busses(drm_device_t *dev)
dev_priv->i2c[i].dev = NULL;
}
}
+
+#endif
diff --git a/linux/savage_drv.c b/linux/savage_drv.c
index 5d19682c..0c518874 100644
--- a/linux/savage_drv.c
+++ b/linux/savage_drv.c
@@ -250,23 +250,6 @@ int savage_free_cont_mem(struct inode *inode, struct file *filp,
#endif /* end #if 0 */
-#include "drm_agpsupport.h"
-#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_init.h"
-#include "drm_ioctl.h"
-#include "drm_irq.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
-#include "drm_scatter.h"
-
+#include "drm_core.h"
diff --git a/linux/sis_drv.c b/linux/sis_drv.c
index 0b968dc2..90e01cdc 100644
--- a/linux/sis_drv.c
+++ b/linux/sis_drv.c
@@ -31,22 +31,5 @@
#include "sis_drm.h"
#include "sis_drv.h"
-#include "drm_auth.h"
-#include "drm_agpsupport.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_init.h"
-#include "drm_irq.h"
-#include "drm_ioctl.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
-#include "drm_scatter.h"
-
+#include "drm_core.h"
diff --git a/linux/tdfx_drv.c b/linux/tdfx_drv.c
index f34d32db..d1314443 100644
--- a/linux/tdfx_drv.c
+++ b/linux/tdfx_drv.c
@@ -34,24 +34,7 @@
#include "tdfx.h"
#include "drmP.h"
-#include "drm_agpsupport.h"
-#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_init.h"
-#include "drm_ioctl.h"
-#include "drm_irq.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
-#include "drm_scatter.h"
+#include "drm_core.h"
void DRM(driver_register_fns)(drm_device_t *dev)
{