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