aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drmP.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r--include/drm/drmP.h82
1 files changed, 64 insertions, 18 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index c1b987158dfa..2a512bc0d4ab 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -9,6 +9,7 @@
9/* 9/*
10 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 10 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
11 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 11 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
12 * Copyright (c) 2009-2010, Code Aurora Forum.
12 * All rights reserved. 13 * All rights reserved.
13 * 14 *
14 * Permission is hereby granted, free of charge, to any person obtaining a 15 * Permission is hereby granted, free of charge, to any person obtaining a
@@ -48,9 +49,9 @@
48#include <linux/proc_fs.h> 49#include <linux/proc_fs.h>
49#include <linux/init.h> 50#include <linux/init.h>
50#include <linux/file.h> 51#include <linux/file.h>
52#include <linux/platform_device.h>
51#include <linux/pci.h> 53#include <linux/pci.h>
52#include <linux/jiffies.h> 54#include <linux/jiffies.h>
53#include <linux/smp_lock.h> /* For (un)lock_kernel */
54#include <linux/dma-mapping.h> 55#include <linux/dma-mapping.h>
55#include <linux/mm.h> 56#include <linux/mm.h>
56#include <linux/cdev.h> 57#include <linux/cdev.h>
@@ -144,6 +145,7 @@ extern void drm_ut_debug_printk(unsigned int request_level,
144#define DRIVER_IRQ_VBL2 0x800 145#define DRIVER_IRQ_VBL2 0x800
145#define DRIVER_GEM 0x1000 146#define DRIVER_GEM 0x1000
146#define DRIVER_MODESET 0x2000 147#define DRIVER_MODESET 0x2000
148#define DRIVER_USE_PLATFORM_DEVICE 0x4000
147 149
148/***********************************************************************/ 150/***********************************************************************/
149/** \name Begin the DRM... */ 151/** \name Begin the DRM... */
@@ -403,6 +405,8 @@ struct drm_pending_event {
403 struct drm_event *event; 405 struct drm_event *event;
404 struct list_head link; 406 struct list_head link;
405 struct drm_file *file_priv; 407 struct drm_file *file_priv;
408 pid_t pid; /* pid of requester, no guarantee it's valid by the time
409 we deliver the event, for tracing only */
406 void (*destroy)(struct drm_pending_event *event); 410 void (*destroy)(struct drm_pending_event *event);
407}; 411};
408 412
@@ -823,6 +827,7 @@ struct drm_driver {
823 int num_ioctls; 827 int num_ioctls;
824 struct file_operations fops; 828 struct file_operations fops;
825 struct pci_driver pci_driver; 829 struct pci_driver pci_driver;
830 struct platform_device *platform_device;
826 /* List of devices hanging off this driver */ 831 /* List of devices hanging off this driver */
827 struct list_head device_list; 832 struct list_head device_list;
828}; 833};
@@ -1015,12 +1020,16 @@ struct drm_device {
1015 1020
1016 struct drm_agp_head *agp; /**< AGP data */ 1021 struct drm_agp_head *agp; /**< AGP data */
1017 1022
1023 struct device *dev; /**< Device structure */
1018 struct pci_dev *pdev; /**< PCI device structure */ 1024 struct pci_dev *pdev; /**< PCI device structure */
1019 int pci_vendor; /**< PCI vendor id */ 1025 int pci_vendor; /**< PCI vendor id */
1020 int pci_device; /**< PCI device id */ 1026 int pci_device; /**< PCI device id */
1021#ifdef __alpha__ 1027#ifdef __alpha__
1022 struct pci_controller *hose; 1028 struct pci_controller *hose;
1023#endif 1029#endif
1030
1031 struct platform_device *platformdev; /**< Platform device struture */
1032
1024 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1033 struct drm_sg_mem *sg; /**< Scatter gather memory */
1025 int num_crtcs; /**< Number of CRTCs on this device */ 1034 int num_crtcs; /**< Number of CRTCs on this device */
1026 void *dev_private; /**< device private data */ 1035 void *dev_private; /**< device private data */
@@ -1060,22 +1069,36 @@ struct drm_device {
1060 1069
1061}; 1070};
1062 1071
1063static inline int drm_dev_to_irq(struct drm_device *dev)
1064{
1065 return dev->pdev->irq;
1066}
1067
1068static __inline__ int drm_core_check_feature(struct drm_device *dev, 1072static __inline__ int drm_core_check_feature(struct drm_device *dev,
1069 int feature) 1073 int feature)
1070{ 1074{
1071 return ((dev->driver->driver_features & feature) ? 1 : 0); 1075 return ((dev->driver->driver_features & feature) ? 1 : 0);
1072} 1076}
1073 1077
1074#ifdef __alpha__ 1078static inline int drm_dev_to_irq(struct drm_device *dev)
1075#define drm_get_pci_domain(dev) dev->hose->index 1079{
1076#else 1080 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1077#define drm_get_pci_domain(dev) 0 1081 return platform_get_irq(dev->platformdev, 0);
1078#endif 1082 else
1083 return dev->pdev->irq;
1084}
1085
1086static inline int drm_get_pci_domain(struct drm_device *dev)
1087{
1088 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1089 return 0;
1090
1091#ifndef __alpha__
1092 /* For historical reasons, drm_get_pci_domain() is busticated
1093 * on most archs and has to remain so for userspace interface
1094 * < 1.4, except on alpha which was right from the beginning
1095 */
1096 if (dev->if_version < 0x10004)
1097 return 0;
1098#endif /* __alpha__ */
1099
1100 return pci_domain_nr(dev->pdev->bus);
1101}
1079 1102
1080#if __OS_HAS_AGP 1103#if __OS_HAS_AGP
1081static inline int drm_core_has_AGP(struct drm_device *dev) 1104static inline int drm_core_has_AGP(struct drm_device *dev)
@@ -1138,6 +1161,7 @@ extern long drm_compat_ioctl(struct file *filp,
1138extern int drm_lastclose(struct drm_device *dev); 1161extern int drm_lastclose(struct drm_device *dev);
1139 1162
1140 /* Device support (drm_fops.h) */ 1163 /* Device support (drm_fops.h) */
1164extern struct mutex drm_global_mutex;
1141extern int drm_open(struct inode *inode, struct file *filp); 1165extern int drm_open(struct inode *inode, struct file *filp);
1142extern int drm_stub_open(struct inode *inode, struct file *filp); 1166extern int drm_stub_open(struct inode *inode, struct file *filp);
1143extern int drm_fasync(int fd, struct file *filp, int on); 1167extern int drm_fasync(int fd, struct file *filp, int on);
@@ -1273,10 +1297,6 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
1273extern int drm_mapbufs(struct drm_device *dev, void *data, 1297extern int drm_mapbufs(struct drm_device *dev, void *data,
1274 struct drm_file *file_priv); 1298 struct drm_file *file_priv);
1275extern int drm_order(unsigned long size); 1299extern int drm_order(unsigned long size);
1276extern resource_size_t drm_get_resource_start(struct drm_device *dev,
1277 unsigned int resource);
1278extern resource_size_t drm_get_resource_len(struct drm_device *dev,
1279 unsigned int resource);
1280 1300
1281 /* DMA support (drm_dma.h) */ 1301 /* DMA support (drm_dma.h) */
1282extern int drm_dma_setup(struct drm_device *dev); 1302extern int drm_dma_setup(struct drm_device *dev);
@@ -1351,8 +1371,11 @@ extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
1351struct drm_master *drm_master_create(struct drm_minor *minor); 1371struct drm_master *drm_master_create(struct drm_minor *minor);
1352extern struct drm_master *drm_master_get(struct drm_master *master); 1372extern struct drm_master *drm_master_get(struct drm_master *master);
1353extern void drm_master_put(struct drm_master **master); 1373extern void drm_master_put(struct drm_master **master);
1354extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1374extern int drm_get_pci_dev(struct pci_dev *pdev,
1355 struct drm_driver *driver); 1375 const struct pci_device_id *ent,
1376 struct drm_driver *driver);
1377extern int drm_get_platform_dev(struct platform_device *pdev,
1378 struct drm_driver *driver);
1356extern void drm_put_dev(struct drm_device *dev); 1379extern void drm_put_dev(struct drm_device *dev);
1357extern int drm_put_minor(struct drm_minor **minor); 1380extern int drm_put_minor(struct drm_minor **minor);
1358extern unsigned int drm_debug; 1381extern unsigned int drm_debug;
@@ -1440,6 +1463,8 @@ void drm_gem_vm_open(struct vm_area_struct *vma);
1440void drm_gem_vm_close(struct vm_area_struct *vma); 1463void drm_gem_vm_close(struct vm_area_struct *vma);
1441int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 1464int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1442 1465
1466#include "drm_global.h"
1467
1443static inline void 1468static inline void
1444drm_gem_object_reference(struct drm_gem_object *obj) 1469drm_gem_object_reference(struct drm_gem_object *obj)
1445{ 1470{
@@ -1529,6 +1554,9 @@ static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1529 1554
1530static __inline__ int drm_device_is_agp(struct drm_device *dev) 1555static __inline__ int drm_device_is_agp(struct drm_device *dev)
1531{ 1556{
1557 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1558 return 0;
1559
1532 if (dev->driver->device_is_agp != NULL) { 1560 if (dev->driver->device_is_agp != NULL) {
1533 int err = (*dev->driver->device_is_agp) (dev); 1561 int err = (*dev->driver->device_is_agp) (dev);
1534 1562
@@ -1542,7 +1570,10 @@ static __inline__ int drm_device_is_agp(struct drm_device *dev)
1542 1570
1543static __inline__ int drm_device_is_pcie(struct drm_device *dev) 1571static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1544{ 1572{
1545 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); 1573 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1574 return 0;
1575 else
1576 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1546} 1577}
1547 1578
1548static __inline__ void drm_core_dropmap(struct drm_local_map *map) 1579static __inline__ void drm_core_dropmap(struct drm_local_map *map)
@@ -1550,6 +1581,21 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1550} 1581}
1551 1582
1552#include "drm_mem_util.h" 1583#include "drm_mem_util.h"
1584
1585static inline void *drm_get_device(struct drm_device *dev)
1586{
1587 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1588 return dev->platformdev;
1589 else
1590 return dev->pdev;
1591}
1592
1593extern int drm_platform_init(struct drm_driver *driver);
1594extern int drm_pci_init(struct drm_driver *driver);
1595extern int drm_fill_in_dev(struct drm_device *dev,
1596 const struct pci_device_id *ent,
1597 struct drm_driver *driver);
1598int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type);
1553/*@}*/ 1599/*@}*/
1554 1600
1555#endif /* __KERNEL__ */ 1601#endif /* __KERNEL__ */