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.h122
1 files changed, 67 insertions, 55 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 348843b80150..ad5770f2315c 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -145,7 +145,10 @@ extern void drm_ut_debug_printk(unsigned int request_level,
145#define DRIVER_IRQ_VBL2 0x800 145#define DRIVER_IRQ_VBL2 0x800
146#define DRIVER_GEM 0x1000 146#define DRIVER_GEM 0x1000
147#define DRIVER_MODESET 0x2000 147#define DRIVER_MODESET 0x2000
148#define DRIVER_USE_PLATFORM_DEVICE 0x4000 148
149#define DRIVER_BUS_PCI 0x1
150#define DRIVER_BUS_PLATFORM 0x2
151#define DRIVER_BUS_USB 0x3
149 152
150/***********************************************************************/ 153/***********************************************************************/
151/** \name Begin the DRM... */ 154/** \name Begin the DRM... */
@@ -698,6 +701,19 @@ struct drm_master {
698#define DRM_SCANOUTPOS_INVBL (1 << 1) 701#define DRM_SCANOUTPOS_INVBL (1 << 1)
699#define DRM_SCANOUTPOS_ACCURATE (1 << 2) 702#define DRM_SCANOUTPOS_ACCURATE (1 << 2)
700 703
704struct drm_bus {
705 int bus_type;
706 int (*get_irq)(struct drm_device *dev);
707 const char *(*get_name)(struct drm_device *dev);
708 int (*set_busid)(struct drm_device *dev, struct drm_master *master);
709 int (*set_unique)(struct drm_device *dev, struct drm_master *master,
710 struct drm_unique *unique);
711 int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
712 /* hooks that are for PCI */
713 int (*agp_init)(struct drm_device *dev);
714
715};
716
701/** 717/**
702 * DRM driver structure. This structure represent the common code for 718 * DRM driver structure. This structure represent the common code for
703 * a family of cards. There will one drm_device for each card present 719 * a family of cards. There will one drm_device for each card present
@@ -880,6 +896,17 @@ struct drm_driver {
880 /* vga arb irq handler */ 896 /* vga arb irq handler */
881 void (*vgaarb_irq)(struct drm_device *dev, bool state); 897 void (*vgaarb_irq)(struct drm_device *dev, bool state);
882 898
899 /* dumb alloc support */
900 int (*dumb_create)(struct drm_file *file_priv,
901 struct drm_device *dev,
902 struct drm_mode_create_dumb *args);
903 int (*dumb_map_offset)(struct drm_file *file_priv,
904 struct drm_device *dev, uint32_t handle,
905 uint64_t *offset);
906 int (*dumb_destroy)(struct drm_file *file_priv,
907 struct drm_device *dev,
908 uint32_t handle);
909
883 /* Driver private ops for this object */ 910 /* Driver private ops for this object */
884 struct vm_operations_struct *gem_vm_ops; 911 struct vm_operations_struct *gem_vm_ops;
885 912
@@ -895,8 +922,13 @@ struct drm_driver {
895 struct drm_ioctl_desc *ioctls; 922 struct drm_ioctl_desc *ioctls;
896 int num_ioctls; 923 int num_ioctls;
897 struct file_operations fops; 924 struct file_operations fops;
898 struct pci_driver pci_driver; 925 union {
899 struct platform_device *platform_device; 926 struct pci_driver *pci;
927 struct platform_device *platform_device;
928 struct usb_driver *usb;
929 } kdriver;
930 struct drm_bus *bus;
931
900 /* List of devices hanging off this driver */ 932 /* List of devices hanging off this driver */
901 struct list_head device_list; 933 struct list_head device_list;
902}; 934};
@@ -1099,6 +1131,7 @@ struct drm_device {
1099#endif 1131#endif
1100 1132
1101 struct platform_device *platformdev; /**< Platform device struture */ 1133 struct platform_device *platformdev; /**< Platform device struture */
1134 struct usb_device *usbdev;
1102 1135
1103 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1136 struct drm_sg_mem *sg; /**< Scatter gather memory */
1104 unsigned int num_crtcs; /**< Number of CRTCs on this device */ 1137 unsigned int num_crtcs; /**< Number of CRTCs on this device */
@@ -1136,28 +1169,9 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
1136 1169
1137static inline int drm_dev_to_irq(struct drm_device *dev) 1170static inline int drm_dev_to_irq(struct drm_device *dev)
1138{ 1171{
1139 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) 1172 return dev->driver->bus->get_irq(dev);
1140 return platform_get_irq(dev->platformdev, 0);
1141 else
1142 return dev->pdev->irq;
1143} 1173}
1144 1174
1145static inline int drm_get_pci_domain(struct drm_device *dev)
1146{
1147 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1148 return 0;
1149
1150#ifndef __alpha__
1151 /* For historical reasons, drm_get_pci_domain() is busticated
1152 * on most archs and has to remain so for userspace interface
1153 * < 1.4, except on alpha which was right from the beginning
1154 */
1155 if (dev->if_version < 0x10004)
1156 return 0;
1157#endif /* __alpha__ */
1158
1159 return pci_domain_nr(dev->pdev->bus);
1160}
1161 1175
1162#if __OS_HAS_AGP 1176#if __OS_HAS_AGP
1163static inline int drm_core_has_AGP(struct drm_device *dev) 1177static inline int drm_core_has_AGP(struct drm_device *dev)
@@ -1211,8 +1225,6 @@ static inline int drm_mtrr_del(int handle, unsigned long offset,
1211/*@{*/ 1225/*@{*/
1212 1226
1213 /* Driver support (drm_drv.h) */ 1227 /* Driver support (drm_drv.h) */
1214extern int drm_init(struct drm_driver *driver);
1215extern void drm_exit(struct drm_driver *driver);
1216extern long drm_ioctl(struct file *filp, 1228extern long drm_ioctl(struct file *filp,
1217 unsigned int cmd, unsigned long arg); 1229 unsigned int cmd, unsigned long arg);
1218extern long drm_compat_ioctl(struct file *filp, 1230extern long drm_compat_ioctl(struct file *filp,
@@ -1264,6 +1276,8 @@ extern int drm_getclient(struct drm_device *dev, void *data,
1264 struct drm_file *file_priv); 1276 struct drm_file *file_priv);
1265extern int drm_getstats(struct drm_device *dev, void *data, 1277extern int drm_getstats(struct drm_device *dev, void *data,
1266 struct drm_file *file_priv); 1278 struct drm_file *file_priv);
1279extern int drm_getcap(struct drm_device *dev, void *data,
1280 struct drm_file *file_priv);
1267extern int drm_setversion(struct drm_device *dev, void *data, 1281extern int drm_setversion(struct drm_device *dev, void *data,
1268 struct drm_file *file_priv); 1282 struct drm_file *file_priv);
1269extern int drm_noop(struct drm_device *dev, void *data, 1283extern int drm_noop(struct drm_device *dev, void *data,
@@ -1422,11 +1436,7 @@ extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
1422struct drm_master *drm_master_create(struct drm_minor *minor); 1436struct drm_master *drm_master_create(struct drm_minor *minor);
1423extern struct drm_master *drm_master_get(struct drm_master *master); 1437extern struct drm_master *drm_master_get(struct drm_master *master);
1424extern void drm_master_put(struct drm_master **master); 1438extern void drm_master_put(struct drm_master **master);
1425extern int drm_get_pci_dev(struct pci_dev *pdev, 1439
1426 const struct pci_device_id *ent,
1427 struct drm_driver *driver);
1428extern int drm_get_platform_dev(struct platform_device *pdev,
1429 struct drm_driver *driver);
1430extern void drm_put_dev(struct drm_device *dev); 1440extern void drm_put_dev(struct drm_device *dev);
1431extern int drm_put_minor(struct drm_minor **minor); 1441extern int drm_put_minor(struct drm_minor **minor);
1432extern unsigned int drm_debug; 1442extern unsigned int drm_debug;
@@ -1544,6 +1554,7 @@ drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
1544int drm_gem_handle_create(struct drm_file *file_priv, 1554int drm_gem_handle_create(struct drm_file *file_priv,
1545 struct drm_gem_object *obj, 1555 struct drm_gem_object *obj,
1546 u32 *handlep); 1556 u32 *handlep);
1557int drm_gem_handle_delete(struct drm_file *filp, u32 handle);
1547 1558
1548static inline void 1559static inline void
1549drm_gem_object_handle_reference(struct drm_gem_object *obj) 1560drm_gem_object_handle_reference(struct drm_gem_object *obj)
@@ -1616,11 +1627,21 @@ static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1616 return NULL; 1627 return NULL;
1617} 1628}
1618 1629
1619static __inline__ int drm_device_is_agp(struct drm_device *dev) 1630static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1620{ 1631{
1621 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) 1632}
1622 return 0;
1623 1633
1634#include "drm_mem_util.h"
1635
1636extern int drm_fill_in_dev(struct drm_device *dev,
1637 const struct pci_device_id *ent,
1638 struct drm_driver *driver);
1639int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type);
1640/*@}*/
1641
1642/* PCI section */
1643static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)
1644{
1624 if (dev->driver->device_is_agp != NULL) { 1645 if (dev->driver->device_is_agp != NULL) {
1625 int err = (*dev->driver->device_is_agp) (dev); 1646 int err = (*dev->driver->device_is_agp) (dev);
1626 1647
@@ -1632,35 +1653,26 @@ static __inline__ int drm_device_is_agp(struct drm_device *dev)
1632 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); 1653 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
1633} 1654}
1634 1655
1635static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1636{
1637 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1638 return 0;
1639 else
1640 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1641}
1642 1656
1643static __inline__ void drm_core_dropmap(struct drm_local_map *map) 1657static __inline__ int drm_pci_device_is_pcie(struct drm_device *dev)
1644{ 1658{
1659 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1645} 1660}
1646 1661
1647#include "drm_mem_util.h"
1648
1649static inline void *drm_get_device(struct drm_device *dev)
1650{
1651 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1652 return dev->platformdev;
1653 else
1654 return dev->pdev;
1655}
1656 1662
1657extern int drm_platform_init(struct drm_driver *driver); 1663extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
1658extern int drm_pci_init(struct drm_driver *driver); 1664extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
1659extern int drm_fill_in_dev(struct drm_device *dev, 1665extern int drm_get_pci_dev(struct pci_dev *pdev,
1660 const struct pci_device_id *ent, 1666 const struct pci_device_id *ent,
1661 struct drm_driver *driver); 1667 struct drm_driver *driver);
1662int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); 1668
1663/*@}*/ 1669
1670/* platform section */
1671extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device);
1672extern void drm_platform_exit(struct drm_driver *driver, struct platform_device *platform_device);
1673
1674extern int drm_get_platform_dev(struct platform_device *pdev,
1675 struct drm_driver *driver);
1664 1676
1665#endif /* __KERNEL__ */ 1677#endif /* __KERNEL__ */
1666#endif 1678#endif