Blame view
include/linux/vgaarb.h
5.06 KB
deb2d2ecd PCI/GPU: implemen... |
1 |
/* |
e2d4304b7 PCI: fix VGA arbi... |
2 3 |
* The VGA aribiter manages VGA space routing and VGA resource decode to * allow multiple VGA devices to be used in a system in a safe way. |
deb2d2ecd PCI/GPU: implemen... |
4 5 6 7 |
* * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com> * (C) Copyright 2007, 2009 Tiago Vignatti <vignatti@freedesktop.org> |
c0db9cbc7 vgaarb: use MIT l... |
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
* * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS * IN THE SOFTWARE. * |
deb2d2ecd PCI/GPU: implemen... |
29 30 31 |
*/ #ifndef LINUX_VGA_H |
a6a1a095e include/linux/vga... |
32 |
#define LINUX_VGA_H |
deb2d2ecd PCI/GPU: implemen... |
33 |
|
1a39b310e vgaarb: Add suppo... |
34 |
#include <video/vga.h> |
deb2d2ecd PCI/GPU: implemen... |
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
/* Legacy VGA regions */ #define VGA_RSRC_NONE 0x00 #define VGA_RSRC_LEGACY_IO 0x01 #define VGA_RSRC_LEGACY_MEM 0x02 #define VGA_RSRC_LEGACY_MASK (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM) /* Non-legacy access */ #define VGA_RSRC_NORMAL_IO 0x04 #define VGA_RSRC_NORMAL_MEM 0x08 /* Passing that instead of a pci_dev to use the system "default" * device, that is the one used by vgacon. Archs will probably * have to provide their own vga_default_device(); */ #define VGA_DEFAULT_DEVICE (NULL) |
6069a4c98 vgaarb.h: fix bui... |
50 |
struct pci_dev; |
deb2d2ecd PCI/GPU: implemen... |
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
/* For use by clients */ /** * vga_set_legacy_decoding * * @pdev: pci device of the VGA card * @decodes: bit mask of what legacy regions the card decodes * * Indicates to the arbiter if the card decodes legacy VGA IOs, * legacy VGA Memory, both, or none. All cards default to both, * the card driver (fbdev for example) should tell the arbiter * if it has disabled legacy decoding, so the card can be left * out of the arbitration process (and can be safe to take * interrupts at any time. */ |
0ea18b40c vgaarb: Stub vga_... |
66 |
#if defined(CONFIG_VGA_ARB) |
deb2d2ecd PCI/GPU: implemen... |
67 |
extern void vga_set_legacy_decoding(struct pci_dev *pdev, |
7c329288d vgaarb: make clie... |
68 |
unsigned int decodes); |
0ea18b40c vgaarb: Stub vga_... |
69 70 71 72 |
#else static inline void vga_set_legacy_decoding(struct pci_dev *pdev, unsigned int decodes) { }; #endif |
deb2d2ecd PCI/GPU: implemen... |
73 |
|
04cbe1de6 vgaarb: Wrap vga_... |
74 75 76 77 78 |
#if defined(CONFIG_VGA_ARB) extern int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible); #else static inline int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible) { return 0; } #endif |
deb2d2ecd PCI/GPU: implemen... |
79 80 |
/** |
b754b35b0 vgaarbiter: rst-i... |
81 82 83 |
* vga_get_interruptible * @pdev: pci device of the VGA card or NULL for the system default * @rsrc: bit mask of resources to acquire and lock |
deb2d2ecd PCI/GPU: implemen... |
84 |
* |
b754b35b0 vgaarbiter: rst-i... |
85 86 87 |
* Shortcut to vga_get with interruptible set to true. * * On success, release the VGA resource again with vga_put(). |
deb2d2ecd PCI/GPU: implemen... |
88 |
*/ |
deb2d2ecd PCI/GPU: implemen... |
89 |
static inline int vga_get_interruptible(struct pci_dev *pdev, |
6ac3bd527 PCI/vgaarb: clean... |
90 |
unsigned int rsrc) |
deb2d2ecd PCI/GPU: implemen... |
91 92 93 94 95 |
{ return vga_get(pdev, rsrc, 1); } /** |
b754b35b0 vgaarbiter: rst-i... |
96 97 98 |
* vga_get_uninterruptible - shortcut to vga_get() * @pdev: pci device of the VGA card or NULL for the system default * @rsrc: bit mask of resources to acquire and lock |
deb2d2ecd PCI/GPU: implemen... |
99 |
* |
b754b35b0 vgaarbiter: rst-i... |
100 101 102 |
* Shortcut to vga_get with interruptible set to false. * * On success, release the VGA resource again with vga_put(). |
deb2d2ecd PCI/GPU: implemen... |
103 |
*/ |
deb2d2ecd PCI/GPU: implemen... |
104 |
static inline int vga_get_uninterruptible(struct pci_dev *pdev, |
6ac3bd527 PCI/vgaarb: clean... |
105 |
unsigned int rsrc) |
deb2d2ecd PCI/GPU: implemen... |
106 107 108 |
{ return vga_get(pdev, rsrc, 0); } |
04cbe1de6 vgaarb: Wrap vga_... |
109 |
#if defined(CONFIG_VGA_ARB) |
deb2d2ecd PCI/GPU: implemen... |
110 |
extern void vga_put(struct pci_dev *pdev, unsigned int rsrc); |
04cbe1de6 vgaarb: Wrap vga_... |
111 112 113 |
#else #define vga_put(pdev, rsrc) #endif |
deb2d2ecd PCI/GPU: implemen... |
114 |
|
6e079d53c vgaarb: Provide d... |
115 |
#ifdef CONFIG_VGA_ARB |
deb2d2ecd PCI/GPU: implemen... |
116 |
extern struct pci_dev *vga_default_device(void); |
1a39b310e vgaarb: Add suppo... |
117 |
extern void vga_set_default_device(struct pci_dev *pdev); |
c6b38fbbd drm: move i915_ki... |
118 |
extern int vga_remove_vgacon(struct pci_dev *pdev); |
6e079d53c vgaarb: Provide d... |
119 120 121 |
#else static inline struct pci_dev *vga_default_device(void) { return NULL; }; static inline void vga_set_default_device(struct pci_dev *pdev) { }; |
c6b38fbbd drm: move i915_ki... |
122 |
static inline int vga_remove_vgacon(struct pci_dev *pdev) { return 0; }; |
6e079d53c vgaarb: Provide d... |
123 |
#endif |
deb2d2ecd PCI/GPU: implemen... |
124 |
|
b754b35b0 vgaarbiter: rst-i... |
125 126 127 128 |
/* * Architectures should define this if they have several * independent PCI domains that can afford concurrent VGA * decoding |
deb2d2ecd PCI/GPU: implemen... |
129 |
*/ |
deb2d2ecd PCI/GPU: implemen... |
130 131 132 133 134 135 |
#ifndef __ARCH_HAS_VGA_CONFLICT static inline int vga_conflicts(struct pci_dev *p1, struct pci_dev *p2) { return 1; } #endif |
7c329288d vgaarb: make clie... |
136 |
#if defined(CONFIG_VGA_ARB) |
deb2d2ecd PCI/GPU: implemen... |
137 138 139 |
int vga_client_register(struct pci_dev *pdev, void *cookie, void (*irq_set_state)(void *cookie, bool state), unsigned int (*set_vga_decode)(void *cookie, bool state)); |
7c329288d vgaarb: make clie... |
140 141 142 143 144 145 146 147 |
#else static inline int vga_client_register(struct pci_dev *pdev, void *cookie, void (*irq_set_state)(void *cookie, bool state), unsigned int (*set_vga_decode)(void *cookie, bool state)) { return 0; } #endif |
deb2d2ecd PCI/GPU: implemen... |
148 149 |
#endif /* LINUX_VGA_H */ |