summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/Makefile7
-rw-r--r--linux-core/Makefile.kernel5
-rw-r--r--linux-core/drm_fops.c6
l---------linux-core/nouveau_drm.h1
-rw-r--r--linux-core/nouveau_drv.c103
l---------linux-core/nouveau_drv.h1
l---------linux-core/nouveau_fifo.c1
-rw-r--r--linux-core/nouveau_ioc32.c73
l---------linux-core/nouveau_irq.c1
l---------linux-core/nouveau_mem.c1
l---------linux-core/nouveau_object.c1
l---------linux-core/nouveau_reg.h1
l---------linux-core/nouveau_state.c1
13 files changed, 197 insertions, 5 deletions
diff --git a/linux-core/Makefile b/linux-core/Makefile
index 06a15ff2..590633b3 100644
--- a/linux-core/Makefile
+++ b/linux-core/Makefile
@@ -58,7 +58,7 @@ endif
# Modules for all architectures
MODULE_LIST := drm.o tdfx.o r128.o radeon.o mga.o sis.o savage.o via.o \
- mach64.o nv.o
+ mach64.o nv.o nouveau.o
# Modules only for ix86 architectures
ifneq (,$(findstring 86,$(MACHINE)))
@@ -91,6 +91,7 @@ VIAHEADERS = via_drm.h via_drv.h via_3d_reg.h via_verifier.h $(DRMHEADERS)
MACH64HEADERS = mach64_drv.h mach64_drm.h $(DRMHEADERS)
NVHEADERS = nv_drv.h $(DRMHEADERS)
FFBHEADERS = ffb_drv.h $(DRMHEADERS)
+NOUVEAUHEADERS = nouveau_drv.h nouveau_drm.h nouveau_reg.h $(DRMHEADERS)
PROGS = dristat drmstat
@@ -314,6 +315,9 @@ endif
ifneq (,$(findstring nv,$(DRM_MODULES)))
CONFIG_DRM_NV := m
endif
+ifneq (,$(findstring nouveau,$(DRM_MODULES)))
+CONFIG_DRM_NOUVEAU := m
+endif
# These require AGP support
@@ -344,6 +348,7 @@ $(savage-objs): $(SAVAGEHEADERS)
$(via-objs): $(VIAHEADERS)
$(mach64-objs): $(MACH64HEADERS)
$(nv-objs): $(NVHEADERS)
+$(nouveau-objs): $(NOUVEAUHEADERS)
endif
diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel
index fba57ddf..4b7c90be 100644
--- a/linux-core/Makefile.kernel
+++ b/linux-core/Makefile.kernel
@@ -20,7 +20,8 @@ mga-objs := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
i810-objs := i810_drv.o i810_dma.o
i830-objs := i830_drv.o i830_dma.o i830_irq.o
i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o i915_fence.o \
- i915_buffer.o
+ i915_buffer.o
+nouveau-objs := nouveau_drv.o nouveau_state.o nouveau_fifo.o nouveau_mem.o nouveau_object.o nouveau_irq.o
radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
sis-objs := sis_drv.o sis_mm.o
ffb-objs := ffb_drv.o ffb_context.o
@@ -36,6 +37,7 @@ radeon-objs += radeon_ioc32.o
mga-objs += mga_ioc32.o
r128-objs += r128_ioc32.o
i915-objs += i915_ioc32.o
+nouveau-objs += nouveau_ioc32.o
endif
obj-m += drm.o
@@ -52,3 +54,4 @@ obj-$(CONFIG_DRM_SAVAGE)+= savage.o
obj-$(CONFIG_DRM_VIA) += via.o
obj-$(CONFIG_DRM_MACH64)+= mach64.o
obj-$(CONFIG_DRM_NV) += nv.o
+obj-$(CONFIG_DRM_NOUVEAU) += nouveau.o
diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c
index ac205730..84e06c87 100644
--- a/linux-core/drm_fops.c
+++ b/linux-core/drm_fops.c
@@ -46,7 +46,7 @@ static int drm_setup(drm_device_t * dev)
drm_local_map_t *map;
int i;
int ret;
-
+ int sareapage;
if (dev->driver->firstopen) {
ret = dev->driver->firstopen(dev);
@@ -57,8 +57,8 @@ static int drm_setup(drm_device_t * dev)
dev->magicfree.next = NULL;
/* prebuild the SAREA */
-
- i = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM, _DRM_CONTAINS_LOCK, &map);
+ sareapage = max(SAREA_MAX, PAGE_SIZE);
+ i = drm_addmap(dev, 0, sareapage, _DRM_SHM, _DRM_CONTAINS_LOCK, &map);
if (i != 0)
return i;
diff --git a/linux-core/nouveau_drm.h b/linux-core/nouveau_drm.h
new file mode 120000
index 00000000..d300ae06
--- /dev/null
+++ b/linux-core/nouveau_drm.h
@@ -0,0 +1 @@
+../shared-core/nouveau_drm.h \ No newline at end of file
diff --git a/linux-core/nouveau_drv.c b/linux-core/nouveau_drv.c
new file mode 100644
index 00000000..57b55ce1
--- /dev/null
+++ b/linux-core/nouveau_drv.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2005 Stephane Marchesin.
+ * 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.
+ */
+
+#include "drmP.h"
+#include "drm.h"
+#include "nouveau_drv.h"
+
+#include "drm_pciids.h"
+
+static struct pci_device_id pciidlist[] = {
+ nouveau_PCI_IDS
+};
+
+extern drm_ioctl_desc_t nouveau_ioctls[];
+extern int nouveau_max_ioctl;
+
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
+static struct drm_driver driver = {
+ .driver_features =
+ DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
+ DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
+ .load = nouveau_load,
+ .firstopen = nouveau_firstopen,
+ .unload = nouveau_unload,
+ .preclose = nouveau_preclose,
+ .irq_preinstall = nouveau_irq_preinstall,
+ .irq_postinstall = nouveau_irq_postinstall,
+ .irq_uninstall = nouveau_irq_uninstall,
+ .irq_handler = nouveau_irq_handler,
+ .reclaim_buffers = drm_core_reclaim_buffers,
+ .get_map_ofs = drm_core_get_map_ofs,
+ .get_reg_ofs = drm_core_get_reg_ofs,
+ .ioctls = nouveau_ioctls,
+ .fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+#if defined(CONFIG_COMPAT) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
+ .compat_ioctl = nouveau_compat_ioctl,
+#endif
+ },
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ },
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
+};
+
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+ return drm_get_dev(pdev, ent, &driver);
+}
+
+static int __init nouveau_init(void)
+{
+ driver.num_ioctls = nouveau_max_ioctl;
+ return drm_init(&driver, pciidlist);
+}
+
+static void __exit nouveau_exit(void)
+{
+ drm_exit(&driver);
+}
+
+module_init(nouveau_init);
+module_exit(nouveau_exit);
+
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL and additional rights");
diff --git a/linux-core/nouveau_drv.h b/linux-core/nouveau_drv.h
new file mode 120000
index 00000000..8852e264
--- /dev/null
+++ b/linux-core/nouveau_drv.h
@@ -0,0 +1 @@
+../shared-core/nouveau_drv.h \ No newline at end of file
diff --git a/linux-core/nouveau_fifo.c b/linux-core/nouveau_fifo.c
new file mode 120000
index 00000000..60759a57
--- /dev/null
+++ b/linux-core/nouveau_fifo.c
@@ -0,0 +1 @@
+../shared-core/nouveau_fifo.c \ No newline at end of file
diff --git a/linux-core/nouveau_ioc32.c b/linux-core/nouveau_ioc32.c
new file mode 100644
index 00000000..a752a581
--- /dev/null
+++ b/linux-core/nouveau_ioc32.c
@@ -0,0 +1,73 @@
+/**
+ * \file mga_ioc32.c
+ *
+ * 32-bit ioctl compatibility routines for the MGA DRM.
+ *
+ * \author Dave Airlie <airlied@linux.ie> with code from patches by Egbert Eich
+ *
+ *
+ * Copyright (C) Paul Mackerras 2005
+ * Copyright (C) Egbert Eich 2003,2004
+ * Copyright (C) Dave Airlie 2005
+ * 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
+ * THE AUTHOR 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.
+ */
+
+#include <linux/compat.h>
+#include <linux/ioctl32.h>
+
+#include "drmP.h"
+#include "drm.h"
+
+#include "nouveau_drm.h"
+
+/**
+ * Called whenever a 32-bit process running under a 64-bit kernel
+ * performs an ioctl on /dev/dri/card<n>.
+ *
+ * \param filp file pointer.
+ * \param cmd command.
+ * \param arg user argument.
+ * \return zero on success or negative number on failure.
+ */
+long nouveau_compat_ioctl(struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ unsigned int nr = DRM_IOCTL_NR(cmd);
+ drm_ioctl_compat_t *fn = NULL;
+ int ret;
+
+ if (nr < DRM_COMMAND_BASE)
+ return drm_compat_ioctl(filp, cmd, arg);
+
+#if 0
+ if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls))
+ fn = nouveau_compat_ioctls[nr - DRM_COMMAND_BASE];
+#endif
+ lock_kernel(); /* XXX for now */
+ if (fn != NULL)
+ ret = (*fn)(filp, cmd, arg);
+ else
+ ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
+ unlock_kernel();
+
+ return ret;
+}
diff --git a/linux-core/nouveau_irq.c b/linux-core/nouveau_irq.c
new file mode 120000
index 00000000..3137b813
--- /dev/null
+++ b/linux-core/nouveau_irq.c
@@ -0,0 +1 @@
+../shared-core/nouveau_irq.c \ No newline at end of file
diff --git a/linux-core/nouveau_mem.c b/linux-core/nouveau_mem.c
new file mode 120000
index 00000000..a0085200
--- /dev/null
+++ b/linux-core/nouveau_mem.c
@@ -0,0 +1 @@
+../shared-core/nouveau_mem.c \ No newline at end of file
diff --git a/linux-core/nouveau_object.c b/linux-core/nouveau_object.c
new file mode 120000
index 00000000..1c1426e3
--- /dev/null
+++ b/linux-core/nouveau_object.c
@@ -0,0 +1 @@
+../shared-core/nouveau_object.c \ No newline at end of file
diff --git a/linux-core/nouveau_reg.h b/linux-core/nouveau_reg.h
new file mode 120000
index 00000000..2ad07397
--- /dev/null
+++ b/linux-core/nouveau_reg.h
@@ -0,0 +1 @@
+../shared-core/nouveau_reg.h \ No newline at end of file
diff --git a/linux-core/nouveau_state.c b/linux-core/nouveau_state.c
new file mode 120000
index 00000000..b304f6bb
--- /dev/null
+++ b/linux-core/nouveau_state.c
@@ -0,0 +1 @@
+../shared-core/nouveau_state.c \ No newline at end of file