diff options
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r-- | include/drm/drmP.h | 122 |
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 | ||
704 | struct 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 | ||
1137 | static inline int drm_dev_to_irq(struct drm_device *dev) | 1170 | static 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 | ||
1145 | static 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 |
1163 | static inline int drm_core_has_AGP(struct drm_device *dev) | 1177 | static 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) */ |
1214 | extern int drm_init(struct drm_driver *driver); | ||
1215 | extern void drm_exit(struct drm_driver *driver); | ||
1216 | extern long drm_ioctl(struct file *filp, | 1228 | extern long drm_ioctl(struct file *filp, |
1217 | unsigned int cmd, unsigned long arg); | 1229 | unsigned int cmd, unsigned long arg); |
1218 | extern long drm_compat_ioctl(struct file *filp, | 1230 | extern 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); |
1265 | extern int drm_getstats(struct drm_device *dev, void *data, | 1277 | extern int drm_getstats(struct drm_device *dev, void *data, |
1266 | struct drm_file *file_priv); | 1278 | struct drm_file *file_priv); |
1279 | extern int drm_getcap(struct drm_device *dev, void *data, | ||
1280 | struct drm_file *file_priv); | ||
1267 | extern int drm_setversion(struct drm_device *dev, void *data, | 1281 | extern int drm_setversion(struct drm_device *dev, void *data, |
1268 | struct drm_file *file_priv); | 1282 | struct drm_file *file_priv); |
1269 | extern int drm_noop(struct drm_device *dev, void *data, | 1283 | extern int drm_noop(struct drm_device *dev, void *data, |
@@ -1422,11 +1436,7 @@ extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data, | |||
1422 | struct drm_master *drm_master_create(struct drm_minor *minor); | 1436 | struct drm_master *drm_master_create(struct drm_minor *minor); |
1423 | extern struct drm_master *drm_master_get(struct drm_master *master); | 1437 | extern struct drm_master *drm_master_get(struct drm_master *master); |
1424 | extern void drm_master_put(struct drm_master **master); | 1438 | extern void drm_master_put(struct drm_master **master); |
1425 | extern int drm_get_pci_dev(struct pci_dev *pdev, | 1439 | |
1426 | const struct pci_device_id *ent, | ||
1427 | struct drm_driver *driver); | ||
1428 | extern int drm_get_platform_dev(struct platform_device *pdev, | ||
1429 | struct drm_driver *driver); | ||
1430 | extern void drm_put_dev(struct drm_device *dev); | 1440 | extern void drm_put_dev(struct drm_device *dev); |
1431 | extern int drm_put_minor(struct drm_minor **minor); | 1441 | extern int drm_put_minor(struct drm_minor **minor); |
1432 | extern unsigned int drm_debug; | 1442 | extern unsigned int drm_debug; |
@@ -1544,6 +1554,7 @@ drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) | |||
1544 | int drm_gem_handle_create(struct drm_file *file_priv, | 1554 | int 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); |
1557 | int drm_gem_handle_delete(struct drm_file *filp, u32 handle); | ||
1547 | 1558 | ||
1548 | static inline void | 1559 | static inline void |
1549 | drm_gem_object_handle_reference(struct drm_gem_object *obj) | 1560 | drm_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 | ||
1619 | static __inline__ int drm_device_is_agp(struct drm_device *dev) | 1630 | static __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 | |||
1636 | extern int drm_fill_in_dev(struct drm_device *dev, | ||
1637 | const struct pci_device_id *ent, | ||
1638 | struct drm_driver *driver); | ||
1639 | int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); | ||
1640 | /*@}*/ | ||
1641 | |||
1642 | /* PCI section */ | ||
1643 | static __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 | ||
1635 | static __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 | ||
1643 | static __inline__ void drm_core_dropmap(struct drm_local_map *map) | 1657 | static __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 | |||
1649 | static 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 | ||
1657 | extern int drm_platform_init(struct drm_driver *driver); | 1663 | extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver); |
1658 | extern int drm_pci_init(struct drm_driver *driver); | 1664 | extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver); |
1659 | extern int drm_fill_in_dev(struct drm_device *dev, | 1665 | extern 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); |
1662 | int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); | 1668 | |
1663 | /*@}*/ | 1669 | |
1670 | /* platform section */ | ||
1671 | extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device); | ||
1672 | extern void drm_platform_exit(struct drm_driver *driver, struct platform_device *platform_device); | ||
1673 | |||
1674 | extern 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 |