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