diff options
author | Gowtham Tammana <g-tammana@ti.com> | 2010-09-06 18:28:38 +0200 |
---|---|---|
committer | Sebastien Jan <s-jan@ti.com> | 2010-09-07 15:44:25 +0200 |
commit | b6b1ac9c0f53064f24f28a7b2347707edf4e28a5 (patch) | |
tree | b7991b8f8ff20c036a1181a88d98f1aacfeeaeff | |
parent | d72fa8ec2dd60e3ceb486440fd5b180c281c7fa4 (diff) |
DRM: enable DRM build for SGX DDK
PCI dependency is removed in the DRM makefile. DRM stub files from
DDK are added to drm source tree in the kernel.
Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
[s-jan@ti.com: defconfig changes to debian folder + checkpatch fixes]
Signed-off-by: Sebastien Jan <s-jan@ti.com>
-rw-r--r-- | debian.ti-omap4/config/config.common.ubuntu | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/Kconfig | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/Makefile | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/pvr_drm_stubs.c | 187 | ||||
-rw-r--r-- | include/drm/drmP.h | 2 | ||||
-rw-r--r-- | include/drm/pvr_drm_mod.h | 34 |
6 files changed, 231 insertions, 3 deletions
diff --git a/debian.ti-omap4/config/config.common.ubuntu b/debian.ti-omap4/config/config.common.ubuntu index 7f5b06ec8ede..deaa4ed12346 100644 --- a/debian.ti-omap4/config/config.common.ubuntu +++ b/debian.ti-omap4/config/config.common.ubuntu @@ -587,6 +587,11 @@ CONFIG_DNET=m CONFIG_DNOTIFY=y CONFIG_DONGLE=y CONFIG_DRAGONRISE_FF=y +CONFIG_DRM=y +# CONFIG_DRM_MGA is not set +# CONFIG_DRM_NOUVEAU is not set +# CONFIG_DRM_SAVAGE is not set +# CONFIG_DRM_VIA is not set CONFIG_DS1682=m CONFIG_DUCATI_BASEIMAGE_PHYS_ADDR=0x9CF00000 CONFIG_DUMMY=m diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 88910e5a2c77..41933dd10123 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -6,9 +6,8 @@ # menuconfig DRM tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" - depends on (AGP || AGP=n) && PCI && !EMULATED_CMPXCHG && MMU + depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU select I2C - select I2C_ALGOBIT select SLOW_WORK help Kernel-level support for the Direct Rendering Infrastructure (DRI) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index abe3f446ca48..a0ef9b3c7f8c 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -11,7 +11,8 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \ drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o \ drm_crtc.o drm_modes.o drm_edid.o \ - drm_info.o drm_debugfs.o drm_encoder_slave.o + drm_info.o drm_debugfs.o drm_encoder_slave.o \ + pvr_drm_stubs.o drm-$(CONFIG_COMPAT) += drm_ioc32.o diff --git a/drivers/gpu/drm/pvr_drm_stubs.c b/drivers/gpu/drm/pvr_drm_stubs.c new file mode 100644 index 000000000000..58ca77a5ba49 --- /dev/null +++ b/drivers/gpu/drm/pvr_drm_stubs.c @@ -0,0 +1,187 @@ +/********************************************************************** + * + * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * The full GNU General Public License is included in this distribution in + * the file called "COPYING". + * + * Contact Information: + * Imagination Technologies Ltd. <gpl-support@imgtec.com> + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * + ******************************************************************************/ + +#include <linux/version.h> +/*#include <linux/kernel.h> +#include <linux/pci.h>*/ +#include "drmP.h" +#include <asm/system.h> + +#include "pvr_drm_mod.h" + +#define DRV_MSG_PREFIX_STR "pvr drm: " + +#define SGX_VENDOR_ID 1 +#define SGX_DEVICE_ID 1 +#define SGX_SUB_VENDOR_ID 1 +#define SGX_SUB_DEVICE_ID 1 + +#if defined(DEBUG) +#define DEBUG_PRINTK(format, args...) printk(format, ## args) +#else +#define DEBUG_PRINTK(format, args...) +#endif + +#define CLEAR_STRUCT(x) memset(&(x), 0, sizeof(x)) + +static struct pci_bus pvr_pci_bus; +static struct pci_dev pvr_pci_dev; + +static bool bDeviceIsRegistered; + +static void +release_device(struct device *dev) +{ +} + +int +drm_pvr_dev_add(void) +{ + int ret; + + DEBUG_PRINTK(KERN_INFO DRV_MSG_PREFIX_STR "%s\n", __FUNCTION__); + + if (bDeviceIsRegistered) { + DEBUG_PRINTK(KERN_WARNING DRV_MSG_PREFIX_STR "%s: Device already registered\n", __FUNCTION__); + return 0; + } + + + pvr_pci_dev.vendor = SGX_VENDOR_ID; + pvr_pci_dev.device = SGX_DEVICE_ID; + pvr_pci_dev.subsystem_vendor = SGX_SUB_VENDOR_ID; + pvr_pci_dev.subsystem_device = SGX_SUB_DEVICE_ID; + + + pvr_pci_dev.bus = &pvr_pci_bus; + + dev_set_name(&pvr_pci_dev.dev, "%s", "SGX"); + pvr_pci_dev.dev.release = release_device; + + ret = device_register(&pvr_pci_dev.dev); + if (ret != 0) { + printk(KERN_ERR DRV_MSG_PREFIX_STR "%s: device_register failed (%d)\n", __FUNCTION__, ret); + } + + bDeviceIsRegistered = true; + + return ret; +} +EXPORT_SYMBOL(drm_pvr_dev_add); + +void +drm_pvr_dev_remove(void) +{ + DEBUG_PRINTK(KERN_INFO DRV_MSG_PREFIX_STR "%s\n", __FUNCTION__); + + if (bDeviceIsRegistered) { + DEBUG_PRINTK(KERN_INFO DRV_MSG_PREFIX_STR "%s: Unregistering device\n", __FUNCTION__); + + device_unregister(&pvr_pci_dev.dev); + bDeviceIsRegistered = false; + + + CLEAR_STRUCT(pvr_pci_dev); + CLEAR_STRUCT(pvr_pci_bus); + } else { + DEBUG_PRINTK(KERN_WARNING DRV_MSG_PREFIX_STR "%s: Device not registered\n", __FUNCTION__); + } +} +EXPORT_SYMBOL(drm_pvr_dev_remove); + +void +pci_disable_device(struct pci_dev *dev) +{ +} + +struct pci_dev * +pci_dev_get(struct pci_dev *dev) +{ + return dev; +} + +void +pci_set_master(struct pci_dev *dev) +{ +} + +#define PCI_ID_COMP(field, value) (((value) == PCI_ANY_ID) || \ + ((field) == (value))) + +struct pci_dev * +pci_get_subsys(unsigned int vendor, unsigned int device, + unsigned int ss_vendor, unsigned int ss_device, struct pci_dev *from) +{ + if (from == NULL && + PCI_ID_COMP(pvr_pci_dev.vendor, vendor) && + PCI_ID_COMP(pvr_pci_dev.device, device) && + PCI_ID_COMP(pvr_pci_dev.subsystem_vendor, ss_vendor) && + PCI_ID_COMP(pvr_pci_dev.subsystem_device, ss_device)) { + DEBUG_PRINTK(KERN_INFO DRV_MSG_PREFIX_STR "%s: Found %x %x %x %x\n", __FUNCTION__, vendor, device, ss_vendor, ss_device); + + return &pvr_pci_dev; + } + + if (from == NULL) { + DEBUG_PRINTK(KERN_INFO DRV_MSG_PREFIX_STR "%s: Couldn't find %x %x %x %x\n", __FUNCTION__, vendor, device, ss_vendor, ss_device); + } + + return NULL; +} + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)) +int +pci_set_dma_mask(struct pci_dev *dev, u64 mask) +{ + return 0; +} +#endif + +void +pci_unregister_driver(struct pci_driver *drv) +{ +} + +int +__pci_register_driver(struct pci_driver *drv, struct module *owner, + const char *mod_name) +{ + return 0; +} + +int +pci_enable_device(struct pci_dev *dev) +{ + return 0; +} + +void +__bad_cmpxchg(volatile void *ptr, int size) +{ + printk(KERN_ERR DRV_MSG_PREFIX_STR "%s: ptr %p size %u\n", + __FUNCTION__, ptr, size); +} + diff --git a/include/drm/drmP.h b/include/drm/drmP.h index c1b987158dfa..bd833c3c86a6 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -48,6 +48,8 @@ #include <linux/proc_fs.h> #include <linux/init.h> #include <linux/file.h> +#define CONFIG_PCI /* hack, PCI is not enabled globally + * enabling it locally here. TODO: clean */ #include <linux/pci.h> #include <linux/jiffies.h> #include <linux/smp_lock.h> /* For (un)lock_kernel */ diff --git a/include/drm/pvr_drm_mod.h b/include/drm/pvr_drm_mod.h new file mode 100644 index 000000000000..1a9db9b7edc7 --- /dev/null +++ b/include/drm/pvr_drm_mod.h @@ -0,0 +1,34 @@ +/********************************************************************** + * + * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * The full GNU General Public License is included in this distribution in + * the file called "COPYING". + * + * Contact Information: + * Imagination Technologies Ltd. <gpl-support@imgtec.com> + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * + ******************************************************************************/ + +#ifndef __PVR_DRM_MOD_H__ +#define __PVR_DRM_MOD_H__ + +int drm_pvr_dev_add(void); + +void drm_pvr_dev_remove(void); + +#endif |