diff options
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r-- | include/drm/drmP.h | 62 |
1 files changed, 49 insertions, 13 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index c1b987158dfa..e2a4da7d7fab 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,17 +1069,21 @@ struct drm_device { | |||
1060 | 1069 | ||
1061 | }; | 1070 | }; |
1062 | 1071 | ||
1063 | static inline int drm_dev_to_irq(struct drm_device *dev) | ||
1064 | { | ||
1065 | return dev->pdev->irq; | ||
1066 | } | ||
1067 | |||
1068 | static __inline__ int drm_core_check_feature(struct drm_device *dev, | 1072 | static __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 | ||
1078 | |||
1079 | static inline int drm_dev_to_irq(struct drm_device *dev) | ||
1080 | { | ||
1081 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) | ||
1082 | return platform_get_irq(dev->platformdev, 0); | ||
1083 | else | ||
1084 | return dev->pdev->irq; | ||
1085 | } | ||
1086 | |||
1074 | #ifdef __alpha__ | 1087 | #ifdef __alpha__ |
1075 | #define drm_get_pci_domain(dev) dev->hose->index | 1088 | #define drm_get_pci_domain(dev) dev->hose->index |
1076 | #else | 1089 | #else |
@@ -1138,6 +1151,7 @@ extern long drm_compat_ioctl(struct file *filp, | |||
1138 | extern int drm_lastclose(struct drm_device *dev); | 1151 | extern int drm_lastclose(struct drm_device *dev); |
1139 | 1152 | ||
1140 | /* Device support (drm_fops.h) */ | 1153 | /* Device support (drm_fops.h) */ |
1154 | extern struct mutex drm_global_mutex; | ||
1141 | extern int drm_open(struct inode *inode, struct file *filp); | 1155 | extern int drm_open(struct inode *inode, struct file *filp); |
1142 | extern int drm_stub_open(struct inode *inode, struct file *filp); | 1156 | extern int drm_stub_open(struct inode *inode, struct file *filp); |
1143 | extern int drm_fasync(int fd, struct file *filp, int on); | 1157 | extern int drm_fasync(int fd, struct file *filp, int on); |
@@ -1273,10 +1287,6 @@ extern int drm_freebufs(struct drm_device *dev, void *data, | |||
1273 | extern int drm_mapbufs(struct drm_device *dev, void *data, | 1287 | extern int drm_mapbufs(struct drm_device *dev, void *data, |
1274 | struct drm_file *file_priv); | 1288 | struct drm_file *file_priv); |
1275 | extern int drm_order(unsigned long size); | 1289 | extern int drm_order(unsigned long size); |
1276 | extern resource_size_t drm_get_resource_start(struct drm_device *dev, | ||
1277 | unsigned int resource); | ||
1278 | extern resource_size_t drm_get_resource_len(struct drm_device *dev, | ||
1279 | unsigned int resource); | ||
1280 | 1290 | ||
1281 | /* DMA support (drm_dma.h) */ | 1291 | /* DMA support (drm_dma.h) */ |
1282 | extern int drm_dma_setup(struct drm_device *dev); | 1292 | extern int drm_dma_setup(struct drm_device *dev); |
@@ -1351,8 +1361,11 @@ extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data, | |||
1351 | struct drm_master *drm_master_create(struct drm_minor *minor); | 1361 | struct drm_master *drm_master_create(struct drm_minor *minor); |
1352 | extern struct drm_master *drm_master_get(struct drm_master *master); | 1362 | extern struct drm_master *drm_master_get(struct drm_master *master); |
1353 | extern void drm_master_put(struct drm_master **master); | 1363 | extern void drm_master_put(struct drm_master **master); |
1354 | extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, | 1364 | extern int drm_get_pci_dev(struct pci_dev *pdev, |
1355 | struct drm_driver *driver); | 1365 | const struct pci_device_id *ent, |
1366 | struct drm_driver *driver); | ||
1367 | extern int drm_get_platform_dev(struct platform_device *pdev, | ||
1368 | struct drm_driver *driver); | ||
1356 | extern void drm_put_dev(struct drm_device *dev); | 1369 | extern void drm_put_dev(struct drm_device *dev); |
1357 | extern int drm_put_minor(struct drm_minor **minor); | 1370 | extern int drm_put_minor(struct drm_minor **minor); |
1358 | extern unsigned int drm_debug; | 1371 | extern unsigned int drm_debug; |
@@ -1440,6 +1453,8 @@ void drm_gem_vm_open(struct vm_area_struct *vma); | |||
1440 | void drm_gem_vm_close(struct vm_area_struct *vma); | 1453 | void drm_gem_vm_close(struct vm_area_struct *vma); |
1441 | int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); | 1454 | int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); |
1442 | 1455 | ||
1456 | #include "drm_global.h" | ||
1457 | |||
1443 | static inline void | 1458 | static inline void |
1444 | drm_gem_object_reference(struct drm_gem_object *obj) | 1459 | drm_gem_object_reference(struct drm_gem_object *obj) |
1445 | { | 1460 | { |
@@ -1529,6 +1544,9 @@ static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev, | |||
1529 | 1544 | ||
1530 | static __inline__ int drm_device_is_agp(struct drm_device *dev) | 1545 | static __inline__ int drm_device_is_agp(struct drm_device *dev) |
1531 | { | 1546 | { |
1547 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) | ||
1548 | return 0; | ||
1549 | |||
1532 | if (dev->driver->device_is_agp != NULL) { | 1550 | if (dev->driver->device_is_agp != NULL) { |
1533 | int err = (*dev->driver->device_is_agp) (dev); | 1551 | int err = (*dev->driver->device_is_agp) (dev); |
1534 | 1552 | ||
@@ -1542,7 +1560,10 @@ static __inline__ int drm_device_is_agp(struct drm_device *dev) | |||
1542 | 1560 | ||
1543 | static __inline__ int drm_device_is_pcie(struct drm_device *dev) | 1561 | static __inline__ int drm_device_is_pcie(struct drm_device *dev) |
1544 | { | 1562 | { |
1545 | return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); | 1563 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) |
1564 | return 0; | ||
1565 | else | ||
1566 | return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); | ||
1546 | } | 1567 | } |
1547 | 1568 | ||
1548 | static __inline__ void drm_core_dropmap(struct drm_local_map *map) | 1569 | static __inline__ void drm_core_dropmap(struct drm_local_map *map) |
@@ -1550,6 +1571,21 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map) | |||
1550 | } | 1571 | } |
1551 | 1572 | ||
1552 | #include "drm_mem_util.h" | 1573 | #include "drm_mem_util.h" |
1574 | |||
1575 | static inline void *drm_get_device(struct drm_device *dev) | ||
1576 | { | ||
1577 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) | ||
1578 | return dev->platformdev; | ||
1579 | else | ||
1580 | return dev->pdev; | ||
1581 | } | ||
1582 | |||
1583 | extern int drm_platform_init(struct drm_driver *driver); | ||
1584 | extern int drm_pci_init(struct drm_driver *driver); | ||
1585 | extern int drm_fill_in_dev(struct drm_device *dev, | ||
1586 | const struct pci_device_id *ent, | ||
1587 | struct drm_driver *driver); | ||
1588 | int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); | ||
1553 | /*@}*/ | 1589 | /*@}*/ |
1554 | 1590 | ||
1555 | #endif /* __KERNEL__ */ | 1591 | #endif /* __KERNEL__ */ |