xref: /netbsd-src/sys/external/bsd/drm2/dist/include/drm/drm_pci.h (revision 1cf7f83ee58b25736fe512e945b3e68a92ac9ff7)
1*1cf7f83eSriastradh /*	$NetBSD: drm_pci.h,v 1.9 2021/12/19 11:53:50 riastradh Exp $	*/
24e390cabSriastradh 
34e390cabSriastradh /*
44e390cabSriastradh  * Internal Header for the Direct Rendering Manager
54e390cabSriastradh  *
64e390cabSriastradh  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
74e390cabSriastradh  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
84e390cabSriastradh  * Copyright (c) 2009-2010, Code Aurora Forum.
94e390cabSriastradh  * All rights reserved.
104e390cabSriastradh  *
114e390cabSriastradh  * Author: Rickard E. (Rik) Faith <faith@valinux.com>
124e390cabSriastradh  * Author: Gareth Hughes <gareth@valinux.com>
134e390cabSriastradh  *
144e390cabSriastradh  * Permission is hereby granted, free of charge, to any person obtaining a
154e390cabSriastradh  * copy of this software and associated documentation files (the "Software"),
164e390cabSriastradh  * to deal in the Software without restriction, including without limitation
174e390cabSriastradh  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
184e390cabSriastradh  * and/or sell copies of the Software, and to permit persons to whom the
194e390cabSriastradh  * Software is furnished to do so, subject to the following conditions:
204e390cabSriastradh  *
214e390cabSriastradh  * The above copyright notice and this permission notice (including the next
224e390cabSriastradh  * paragraph) shall be included in all copies or substantial portions of the
234e390cabSriastradh  * Software.
244e390cabSriastradh  *
254e390cabSriastradh  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
264e390cabSriastradh  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
274e390cabSriastradh  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
284e390cabSriastradh  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
294e390cabSriastradh  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
304e390cabSriastradh  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
314e390cabSriastradh  * OTHER DEALINGS IN THE SOFTWARE.
324e390cabSriastradh  */
334e390cabSriastradh 
344e390cabSriastradh #ifndef _DRM_PCI_H_
354e390cabSriastradh #define _DRM_PCI_H_
364e390cabSriastradh 
374e390cabSriastradh #include <linux/pci.h>
384e390cabSriastradh 
394e390cabSriastradh struct drm_dma_handle;
404e390cabSriastradh struct drm_device;
414e390cabSriastradh struct drm_driver;
424e390cabSriastradh struct drm_master;
434e390cabSriastradh 
444e390cabSriastradh #ifdef CONFIG_PCI
454e390cabSriastradh 
464e390cabSriastradh struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size,
474e390cabSriastradh 				     size_t align);
484e390cabSriastradh void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah);
494e390cabSriastradh 
504e390cabSriastradh int drm_get_pci_dev(struct pci_dev *pdev,
514e390cabSriastradh 		    const struct pci_device_id *ent,
524e390cabSriastradh 		    struct drm_driver *driver);
534e390cabSriastradh 
544e390cabSriastradh #else
554e390cabSriastradh 
drm_pci_alloc(struct drm_device * dev,size_t size,size_t align)564e390cabSriastradh static inline struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev,
574e390cabSriastradh 						   size_t size, size_t align)
584e390cabSriastradh {
594e390cabSriastradh 	return NULL;
604e390cabSriastradh }
614e390cabSriastradh 
drm_pci_free(struct drm_device * dev,struct drm_dma_handle * dmah)624e390cabSriastradh static inline void drm_pci_free(struct drm_device *dev,
634e390cabSriastradh 				struct drm_dma_handle *dmah)
644e390cabSriastradh {
654e390cabSriastradh }
664e390cabSriastradh 
drm_get_pci_dev(struct pci_dev * pdev,const struct pci_device_id * ent,struct drm_driver * driver)674e390cabSriastradh static inline int drm_get_pci_dev(struct pci_dev *pdev,
684e390cabSriastradh 				  const struct pci_device_id *ent,
694e390cabSriastradh 				  struct drm_driver *driver)
704e390cabSriastradh {
714e390cabSriastradh 	return -ENOSYS;
724e390cabSriastradh }
734e390cabSriastradh 
744e390cabSriastradh #endif
754e390cabSriastradh 
7654b9a614Sriastradh #ifdef __NetBSD__
7754b9a614Sriastradh int drm_pci_request_irq(struct drm_device *, int);
7854b9a614Sriastradh void drm_pci_free_irq(struct drm_device *);
79*1cf7f83eSriastradh int drm_pci_attach(struct drm_device *, struct pci_dev *);
80daf16ae8Sriastradh void drm_pci_detach(struct drm_device *);
8154b9a614Sriastradh #endif
8254b9a614Sriastradh 
834e390cabSriastradh #endif /* _DRM_PCI_H_ */
84