xref: /dragonfly/sys/dev/drm/include/drm/drm_pci.h (revision 2b57e6df)
1 /*
2  * Internal Header for the Direct Rendering Manager
3  *
4  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
5  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6  * Copyright (c) 2009-2010, Code Aurora Forum.
7  * All rights reserved.
8  *
9  * Author: Rickard E. (Rik) Faith <faith@valinux.com>
10  * Author: Gareth Hughes <gareth@valinux.com>
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice (including the next
20  * paragraph) shall be included in all copies or substantial portions of the
21  * Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
26  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29  * OTHER DEALINGS IN THE SOFTWARE.
30  */
31 
32 #ifndef _DRM_PCI_H_
33 #define _DRM_PCI_H_
34 
35 #include <linux/pci.h>
36 #include <linux/platform_device.h>
37 
38 struct drm_dma_handle;
39 struct drm_device;
40 struct drm_driver;
41 struct drm_master;
42 
43 extern struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size,
44 					    size_t align);
45 extern void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah);
46 
47 extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
48 extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
49 #ifdef CONFIG_PCI
50 extern int drm_get_pci_dev(struct pci_dev *pdev,
51 			   const struct pci_device_id *ent,
52 			   struct drm_driver *driver);
53 extern int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
54 #else
55 static inline int drm_get_pci_dev(struct pci_dev *pdev,
56 				  const struct pci_device_id *ent,
57 				  struct drm_driver *driver)
58 {
59 	return -ENOSYS;
60 }
61 
62 static inline int drm_pci_set_busid(struct drm_device *dev,
63 				    struct drm_master *master)
64 {
65 	return -ENOSYS;
66 }
67 #endif
68 
69 #define DRM_PCIE_SPEED_25 1
70 #define DRM_PCIE_SPEED_50 2
71 #define DRM_PCIE_SPEED_80 4
72 
73 extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask);
74 extern int drm_pcie_get_max_link_width(struct drm_device *dev, u32 *mlw);
75 
76 /* platform section */
77 extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device);
78 
79 #endif /* _DRM_PCI_H_ */
80