aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2017-03-08 09:12:37 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2017-03-09 10:18:02 -0500
commit23ef59ef6dcc9b62bf077490a74df93b3bb0d530 (patch)
treed58b64920d9e49648ae45385a5dfb5597954b4a7
parentd891b9c78ac83a14d0b7c5bbd652572bcd58c823 (diff)
drm: Extract drm_pci.h
Just another step in finally making drmP.h obsolete. Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170308141257.12119-5-daniel.vetter@ffwll.ch
-rw-r--r--drivers/gpu/drm/drm_pci.c7
-rw-r--r--include/drm/drmP.h43
-rw-r--r--include/drm/drm_pci.h78
3 files changed, 89 insertions, 39 deletions
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index a3b356e70b35..1eb4fc3eee20 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -26,6 +26,7 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/export.h> 28#include <linux/export.h>
29#include <drm/drm_pci.h>
29#include <drm/drmP.h> 30#include <drm/drmP.h>
30#include "drm_internal.h" 31#include "drm_internal.h"
31#include "drm_legacy.h" 32#include "drm_legacy.h"
@@ -36,6 +37,9 @@
36 * @size: size of block to allocate 37 * @size: size of block to allocate
37 * @align: alignment of block 38 * @align: alignment of block
38 * 39 *
40 * FIXME: This is a needless abstraction of the Linux dma-api and should be
41 * removed.
42 *
39 * Return: A handle to the allocated memory block on success or NULL on 43 * Return: A handle to the allocated memory block on success or NULL on
40 * failure. 44 * failure.
41 */ 45 */
@@ -104,6 +108,9 @@ void __drm_legacy_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
104 * drm_pci_free - Free a PCI consistent memory block 108 * drm_pci_free - Free a PCI consistent memory block
105 * @dev: DRM device 109 * @dev: DRM device
106 * @dmah: handle to memory block 110 * @dmah: handle to memory block
111 *
112 * FIXME: This is a needless abstraction of the Linux dma-api and should be
113 * removed.
107 */ 114 */
108void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) 115void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
109{ 116{
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 22b6f6f45b07..1ad699de8769 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -47,7 +47,6 @@
47#include <linux/miscdevice.h> 47#include <linux/miscdevice.h>
48#include <linux/mm.h> 48#include <linux/mm.h>
49#include <linux/mutex.h> 49#include <linux/mutex.h>
50#include <linux/pci.h>
51#include <linux/platform_device.h> 50#include <linux/platform_device.h>
52#include <linux/poll.h> 51#include <linux/poll.h>
53#include <linux/ratelimit.h> 52#include <linux/ratelimit.h>
@@ -77,6 +76,7 @@
77#include <drm/drm_sarea.h> 76#include <drm/drm_sarea.h>
78#include <drm/drm_drv.h> 77#include <drm/drm_drv.h>
79#include <drm/drm_prime.h> 78#include <drm/drm_prime.h>
79#include <drm/drm_pci.h>
80 80
81struct module; 81struct module;
82 82
@@ -85,7 +85,6 @@ struct drm_device;
85struct drm_agp_head; 85struct drm_agp_head;
86struct drm_local_map; 86struct drm_local_map;
87struct drm_device_dma; 87struct drm_device_dma;
88struct drm_dma_handle;
89struct drm_gem_object; 88struct drm_gem_object;
90struct drm_master; 89struct drm_master;
91struct drm_vblank_crtc; 90struct drm_vblank_crtc;
@@ -96,6 +95,9 @@ struct videomode;
96struct reservation_object; 95struct reservation_object;
97struct dma_buf_attachment; 96struct dma_buf_attachment;
98 97
98struct pci_dev;
99struct pci_controller;
100
99/* 101/*
100 * The following categories are defined: 102 * The following categories are defined:
101 * 103 *
@@ -739,49 +741,12 @@ static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
739} 741}
740#endif 742#endif
741 743
742
743extern struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size,
744 size_t align);
745extern void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah);
746
747 /* sysfs support (drm_sysfs.c) */ 744 /* sysfs support (drm_sysfs.c) */
748extern void drm_sysfs_hotplug_event(struct drm_device *dev); 745extern void drm_sysfs_hotplug_event(struct drm_device *dev);
749 746
750 747
751/*@}*/ 748/*@}*/
752 749
753extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
754extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
755#ifdef CONFIG_PCI
756extern int drm_get_pci_dev(struct pci_dev *pdev,
757 const struct pci_device_id *ent,
758 struct drm_driver *driver);
759extern int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
760#else
761static inline int drm_get_pci_dev(struct pci_dev *pdev,
762 const struct pci_device_id *ent,
763 struct drm_driver *driver)
764{
765 return -ENOSYS;
766}
767
768static inline int drm_pci_set_busid(struct drm_device *dev,
769 struct drm_master *master)
770{
771 return -ENOSYS;
772}
773#endif
774
775#define DRM_PCIE_SPEED_25 1
776#define DRM_PCIE_SPEED_50 2
777#define DRM_PCIE_SPEED_80 4
778
779extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask);
780extern int drm_pcie_get_max_link_width(struct drm_device *dev, u32 *mlw);
781
782/* platform section */
783extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device);
784
785/* returns true if currently okay to sleep */ 750/* returns true if currently okay to sleep */
786static __inline__ bool drm_can_sleep(void) 751static __inline__ bool drm_can_sleep(void)
787{ 752{
diff --git a/include/drm/drm_pci.h b/include/drm/drm_pci.h
new file mode 100644
index 000000000000..5081b3eba309
--- /dev/null
+++ b/include/drm/drm_pci.h
@@ -0,0 +1,78 @@
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
37struct drm_dma_handle;
38struct drm_device;
39struct drm_driver;
40struct drm_master;
41
42extern struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size,
43 size_t align);
44extern void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah);
45
46extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
47extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
48#ifdef CONFIG_PCI
49extern int drm_get_pci_dev(struct pci_dev *pdev,
50 const struct pci_device_id *ent,
51 struct drm_driver *driver);
52extern int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
53#else
54static inline int drm_get_pci_dev(struct pci_dev *pdev,
55 const struct pci_device_id *ent,
56 struct drm_driver *driver)
57{
58 return -ENOSYS;
59}
60
61static inline int drm_pci_set_busid(struct drm_device *dev,
62 struct drm_master *master)
63{
64 return -ENOSYS;
65}
66#endif
67
68#define DRM_PCIE_SPEED_25 1
69#define DRM_PCIE_SPEED_50 2
70#define DRM_PCIE_SPEED_80 4
71
72extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask);
73extern int drm_pcie_get_max_link_width(struct drm_device *dev, u32 *mlw);
74
75/* platform section */
76extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device);
77
78#endif /* _DRM_PCI_H_ */