Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
[linux-2.6-microblaze.git] / drivers / gpu / drm / bochs / bochs.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2
3 #include <linux/io.h>
4 #include <linux/console.h>
5
6 #include <drm/drm_crtc.h>
7 #include <drm/drm_crtc_helper.h>
8 #include <drm/drm_encoder.h>
9 #include <drm/drm_fb_helper.h>
10 #include <drm/drm_gem.h>
11 #include <drm/drm_gem_vram_helper.h>
12 #include <drm/drm_simple_kms_helper.h>
13
14 /* ---------------------------------------------------------------------- */
15
16 #define VBE_DISPI_IOPORT_INDEX           0x01CE
17 #define VBE_DISPI_IOPORT_DATA            0x01CF
18
19 #define VBE_DISPI_INDEX_ID               0x0
20 #define VBE_DISPI_INDEX_XRES             0x1
21 #define VBE_DISPI_INDEX_YRES             0x2
22 #define VBE_DISPI_INDEX_BPP              0x3
23 #define VBE_DISPI_INDEX_ENABLE           0x4
24 #define VBE_DISPI_INDEX_BANK             0x5
25 #define VBE_DISPI_INDEX_VIRT_WIDTH       0x6
26 #define VBE_DISPI_INDEX_VIRT_HEIGHT      0x7
27 #define VBE_DISPI_INDEX_X_OFFSET         0x8
28 #define VBE_DISPI_INDEX_Y_OFFSET         0x9
29 #define VBE_DISPI_INDEX_VIDEO_MEMORY_64K 0xa
30
31 #define VBE_DISPI_ID0                    0xB0C0
32 #define VBE_DISPI_ID1                    0xB0C1
33 #define VBE_DISPI_ID2                    0xB0C2
34 #define VBE_DISPI_ID3                    0xB0C3
35 #define VBE_DISPI_ID4                    0xB0C4
36 #define VBE_DISPI_ID5                    0xB0C5
37
38 #define VBE_DISPI_DISABLED               0x00
39 #define VBE_DISPI_ENABLED                0x01
40 #define VBE_DISPI_GETCAPS                0x02
41 #define VBE_DISPI_8BIT_DAC               0x20
42 #define VBE_DISPI_LFB_ENABLED            0x40
43 #define VBE_DISPI_NOCLEARMEM             0x80
44
45 /* ---------------------------------------------------------------------- */
46
47 enum bochs_types {
48         BOCHS_QEMU_STDVGA,
49         BOCHS_UNKNOWN,
50 };
51
52 struct bochs_device {
53         /* hw */
54         void __iomem   *mmio;
55         int            ioports;
56         void __iomem   *fb_map;
57         unsigned long  fb_base;
58         unsigned long  fb_size;
59         unsigned long  qext_size;
60
61         /* mode */
62         u16 xres;
63         u16 yres;
64         u16 yres_virtual;
65         u32 stride;
66         u32 bpp;
67         struct edid *edid;
68
69         /* drm */
70         struct drm_device *dev;
71         struct drm_simple_display_pipe pipe;
72         struct drm_connector connector;
73 };
74
75 /* ---------------------------------------------------------------------- */
76
77 /* bochs_hw.c */
78 int bochs_hw_init(struct drm_device *dev);
79 void bochs_hw_fini(struct drm_device *dev);
80
81 void bochs_hw_setmode(struct bochs_device *bochs,
82                       struct drm_display_mode *mode);
83 void bochs_hw_setformat(struct bochs_device *bochs,
84                         const struct drm_format_info *format);
85 void bochs_hw_setbase(struct bochs_device *bochs,
86                       int x, int y, int stride, u64 addr);
87 int bochs_hw_load_edid(struct bochs_device *bochs);
88
89 /* bochs_mm.c */
90 int bochs_mm_init(struct bochs_device *bochs);
91 void bochs_mm_fini(struct bochs_device *bochs);
92
93 /* bochs_kms.c */
94 int bochs_kms_init(struct bochs_device *bochs);
95
96 /* bochs_fbdev.c */
97 extern const struct drm_mode_config_funcs bochs_mode_funcs;