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, #define DRIVER_IRQ_VBL2 0x800 #define DRIVER_GEM 0x1000 #define DRIVER_MODESET 0x2000 -#define DRIVER_USE_PLATFORM_DEVICE 0x4000 + +#define DRIVER_BUS_PCI 0x1 +#define DRIVER_BUS_PLATFORM 0x2 +#define DRIVER_BUS_USB 0x3 /***********************************************************************/ /** \name Begin the DRM... */ @@ -698,6 +701,19 @@ struct drm_master { #define DRM_SCANOUTPOS_INVBL (1 << 1) #define DRM_SCANOUTPOS_ACCURATE (1 << 2) +struct drm_bus { + int bus_type; + int (*get_irq)(struct drm_device *dev); + const char *(*get_name)(struct drm_device *dev); + int (*set_busid)(struct drm_device *dev, struct drm_master *master); + int (*set_unique)(struct drm_device *dev, struct drm_master *master, + struct drm_unique *unique); + int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p); + /* hooks that are for PCI */ + int (*agp_init)(struct drm_device *dev); + +}; + /** * DRM driver structure. This structure represent the common code for * a family of cards. There will one drm_device for each card present @@ -880,6 +896,17 @@ struct drm_driver { /* vga arb irq handler */ void (*vgaarb_irq)(struct drm_device *dev, bool state); + /* dumb alloc support */ + int (*dumb_create)(struct drm_file *file_priv, + struct drm_device *dev, + struct drm_mode_create_dumb *args); + int (*dumb_map_offset)(struct drm_file *file_priv, + struct drm_device *dev, uint32_t handle, + uint64_t *offset); + int (*dumb_destroy)(struct drm_file *file_priv, + struct drm_device *dev, + uint32_t handle); + /* Driver private ops for this object */ struct vm_operations_struct *gem_vm_ops; @@ -895,8 +922,13 @@ struct drm_driver { struct drm_ioctl_desc *ioctls; int num_ioctls; struct file_operations fops; - struct pci_driver pci_driver; - struct platform_device *platform_device; + union { + struct pci_driver *pci; + struct platform_device *platform_device; + struct usb_driver *usb; + } kdriver; + struct drm_bus *bus; + /* List of devices hanging off this driver */ struct list_head device_list; }; @@ -1099,6 +1131,7 @@ struct drm_device { #endif struct platform_device *platformdev; /**< Platform device struture */ + struct usb_device *usbdev; struct drm_sg_mem *sg; /**< Scatter gather memory */ 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, static inline int drm_dev_to_irq(struct drm_device *dev) { - if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) - return platform_get_irq(dev->platformdev, 0); - else - return dev->pdev->irq; + return dev->driver->bus->get_irq(dev); } -static inline int drm_get_pci_domain(struct drm_device *dev) -{ - if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) - return 0; - -#ifndef __alpha__ - /* For historical reasons, drm_get_pci_domain() is busticated - * on most archs and has to remain so for userspace interface - * < 1.4, except on alpha which was right from the beginning - */ - if (dev->if_version < 0x10004) - return 0; -#endif /* __alpha__ */ - - return pci_domain_nr(dev->pdev->bus); -} #if __OS_HAS_AGP 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, /*@{*/ /* Driver support (drm_drv.h) */ -extern int drm_init(struct drm_driver *driver); -extern void drm_exit(struct drm_driver *driver); extern long drm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); extern long drm_compat_ioctl(struct file *filp, @@ -1264,6 +1276,8 @@ extern int drm_getclient(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_getstats(struct drm_device *dev, void *data, struct drm_file *file_priv); +extern int drm_getcap(struct drm_device *dev, void *data, + struct drm_file *file_priv); extern int drm_setversion(struct drm_device *dev, void *data, struct drm_file *file_priv); 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, struct drm_master *drm_master_create(struct drm_minor *minor); extern struct drm_master *drm_master_get(struct drm_master *master); extern void drm_master_put(struct drm_master **master); -extern int drm_get_pci_dev(struct pci_dev *pdev, - const struct pci_device_id *ent, - struct drm_driver *driver); -extern int drm_get_platform_dev(struct platform_device *pdev, - struct drm_driver *driver); + extern void drm_put_dev(struct drm_device *dev); extern int drm_put_minor(struct drm_minor **minor); extern unsigned int drm_debug; @@ -1544,6 +1554,7 @@ drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) int drm_gem_handle_create(struct drm_file *file_priv, struct drm_gem_object *obj, u32 *handlep); +int drm_gem_handle_delete(struct drm_file *filp, u32 handle); static inline void 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, return NULL; } -static __inline__ int drm_device_is_agp(struct drm_device *dev) +static __inline__ void drm_core_dropmap(struct drm_local_map *map) { - if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) - return 0; +} +#include "drm_mem_util.h" + +extern int drm_fill_in_dev(struct drm_device *dev, + const struct pci_device_id *ent, + struct drm_driver *driver); +int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); +/*@}*/ + +/* PCI section */ +static __inline__ int drm_pci_device_is_agp(struct drm_device *dev) +{ if (dev->driver->device_is_agp != NULL) { int err = (*dev->driver->device_is_agp) (dev); @@ -1632,35 +1653,26 @@ static __inline__ int drm_device_is_agp(struct drm_device *dev) return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); } -static __inline__ int drm_device_is_pcie(struct drm_device *dev) -{ - if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) - return 0; - else - return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); -} -static __inline__ void drm_core_dropmap(struct drm_local_map *map) +static __inline__ int drm_pci_device_is_pcie(struct drm_device *dev) { + return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); } -#include "drm_mem_util.h" - -static inline void *drm_get_device(struct drm_device *dev) -{ - if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) - return dev->platformdev; - else - return dev->pdev; -} -extern int drm_platform_init(struct drm_driver *driver); -extern int drm_pci_init(struct drm_driver *driver); -extern int drm_fill_in_dev(struct drm_device *dev, +extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver); +extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver); +extern int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_driver *driver); -int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); -/*@}*/ + + +/* platform section */ +extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device); +extern void drm_platform_exit(struct drm_driver *driver, struct platform_device *platform_device); + +extern int drm_get_platform_dev(struct platform_device *pdev, + struct drm_driver *driver); #endif /* __KERNEL__ */ #endif |