Fix the keyboard lockup problem. There were two big clues: The first was a
[dragonfly.git] / sys / dev / video / fb / gfb.h
1 /*
2  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
3  * All rights reserved.
4  *
5  * Author: Chris G. Demetriou
6  * 
7  * Permission to use, copy, modify and distribute this software and
8  * its documentation is hereby granted, provided that both the copyright
9  * notice and this permission notice appear in all copies of the
10  * software, derivative works or modified versions, and any portions
11  * thereof, and that both notices appear in supporting documentation.
12  * 
13  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
14  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
15  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
16  * 
17  * Carnegie Mellon requests users of this software to return to
18  *
19  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
20  *  School of Computer Science
21  *  Carnegie Mellon University
22  *  Pittsburgh PA 15213-3890
23  *
24  * any improvements or extensions that they make and grant Carnegie the
25  * rights to redistribute these changes.
26  *
27  * Copyright (c) 2000 Andrew Miklic
28  *
29  * $FreeBSD: src/sys/dev/fb/gfb.h,v 1.1.2.1 2001/11/01 08:33:14 obrien Exp $
30  * $DragonFly: src/sys/dev/video/fb/Attic/gfb.h,v 1.3 2003/07/22 17:03:28 dillon Exp $
31  */
32
33 #ifndef _FB_GFB_H_
34 #define _FB_GFB_H_
35
36 #define MAX_NUM_GFB_CARDS       16
37
38 #define GFB_UNIT(dev)           minor(dev)
39 #define GFB_MKMINOR(unit)       (unit)
40 #define BIT_REVERSE(byte)               \
41         ((((byte) & 0x01) << 7) |       \
42          (((byte) & 0x02) << 5) |       \
43          (((byte) & 0x04) << 3) |       \
44          (((byte) & 0x08) << 1) |       \
45          (((byte) & 0x10) >> 1) |       \
46          (((byte) & 0x20) >> 3) |       \
47          (((byte) & 0x40) >> 5) |       \
48          (((byte) & 0x80) >> 7))
49 #define probe_done(adp)         ((adp)->va_flags & V_ADP_PROBED)
50 #define init_done(adp)          ((adp)->va_flags & V_ADP_INITIALIZED)
51 #define config_done(adp)        ((adp)->va_flags & V_ADP_REGISTERED)
52
53 struct gfb_softc;
54
55 int gfb_error(void);
56 vi_probe_t gfb_probe;
57 vi_init_t gfb_init;
58
59 vi_get_info_t gfb_get_info;
60 /*vi_query_mode_t gfb_query_mode;*/
61 vi_set_mode_t gfb_set_mode;
62 vi_save_font_t gfb_save_font;
63 vi_load_font_t gfb_load_font;
64 vi_show_font_t gfb_show_font;
65 vi_save_palette_t gfb_save_palette;
66 vi_load_palette_t gfb_load_palette;
67 vi_save_state_t gfb_save_state;
68 vi_load_state_t gfb_load_state;
69 vi_read_hw_cursor_t gfb_read_hw_cursor;
70 vi_set_hw_cursor_t gfb_set_hw_cursor;
71 vi_set_hw_cursor_shape_t gfb_set_hw_cursor_shape;
72 vi_mmap_t gfb_mmap;
73 vi_ioctl_t gfb_ioctl;
74 vi_set_border_t gfb_set_border;
75 vi_set_win_org_t gfb_set_win_org;
76 vi_fill_rect_t gfb_fill_rect;
77 vi_bitblt_t gfb_bitblt;
78 vi_clear_t gfb_clear;
79 vi_diag_t gfb_diag;
80 vi_save_cursor_palette_t gfb_save_cursor_palette;
81 vi_load_cursor_palette_t gfb_load_cursor_palette;
82 vi_copy_t gfb_copy;
83 vi_putp_t gfb_putp;
84 vi_putc_t gfb_putc;
85 vi_puts_t gfb_puts;
86 vi_putm_t gfb_putm;
87
88 typedef void gfb_ramdac_init_t(struct gfb_softc *);
89 typedef u_int8_t gfb_ramdac_rd_t(struct gfb_softc *, u_int);
90 typedef void gfb_ramdac_wr_t(struct gfb_softc *, u_int, u_int8_t);
91 typedef void gfb_ramdac_intr_t(struct gfb_softc *);
92 typedef int gfb_ramdac_save_palette_t(video_adapter_t *, video_color_palette_t *);
93 typedef int gfb_ramdac_load_palette_t(video_adapter_t *, video_color_palette_t *);
94 typedef int gfb_ramdac_save_cursor_palette_t(video_adapter_t *, struct fbcmap *);
95 typedef int gfb_ramdac_load_cursor_palette_t(video_adapter_t *, struct fbcmap *);
96 typedef int gfb_ramdac_read_hw_cursor_t(video_adapter_t *, int *, int *);
97 typedef int gfb_ramdac_set_hw_cursor_t(video_adapter_t *, int, int);
98 typedef int gfb_ramdac_set_hw_cursor_shape_t(video_adapter_t *, int, int, int, int);
99 typedef int gfb_builtin_save_palette_t(video_adapter_t *, video_color_palette_t *);
100 typedef int gfb_builtin_load_palette_t(video_adapter_t *, video_color_palette_t *);
101 typedef int gfb_builtin_save_cursor_palette_t(video_adapter_t *, struct fbcmap *);
102 typedef int gfb_builtin_load_cursor_palette_t(video_adapter_t *, struct fbcmap *);
103 typedef int gfb_builtin_read_hw_cursor_t(video_adapter_t *, int *, int *);
104 typedef int gfb_builtin_set_hw_cursor_t(video_adapter_t *, int, int);
105 typedef int gfb_builtin_set_hw_cursor_shape_t(video_adapter_t *, int, int, int, int);
106
107 struct monitor {
108         u_int16_t       cols;           /* Columns */
109         u_int16_t       hfp;            /* Horizontal Front Porch */
110         u_int16_t       hsync;          /* Horizontal Sync */
111         u_int16_t       hbp;            /* Horizontal Back Porch */
112         u_int16_t       rows;           /* Rows */
113         u_int16_t       vfp;            /* Vertical Front Porch */
114         u_int16_t       vsync;          /* Vertical Sync */
115         u_int16_t       vbp;            /* Vertical Back Porch */
116         u_int32_t       dotclock;       /* Dot Clock */
117 };
118
119 struct gfb_font {
120         int width;
121         int height;
122         u_char data[256 * 32];
123 };
124
125 struct gfb_conf {
126         char *name;                     /* name for this board type */
127         char *ramdac_name;              /* name for this RAMDAC */
128         u_char *font;
129         struct gfb_font fonts[4];
130         video_color_palette_t palette;
131         struct fbcmap cursor_palette;
132         gfb_ramdac_init_t *ramdac_init;
133         gfb_ramdac_rd_t *ramdac_rd;
134         gfb_ramdac_wr_t *ramdac_wr;
135         gfb_ramdac_intr_t *ramdac_intr;
136         gfb_ramdac_save_palette_t *ramdac_save_palette;
137         gfb_ramdac_load_palette_t *ramdac_load_palette;
138         gfb_ramdac_save_cursor_palette_t *ramdac_save_cursor_palette;
139         gfb_ramdac_load_cursor_palette_t *ramdac_load_cursor_palette;
140         gfb_ramdac_read_hw_cursor_t *ramdac_read_hw_cursor;
141         gfb_ramdac_set_hw_cursor_t *ramdac_set_hw_cursor;
142         gfb_ramdac_set_hw_cursor_shape_t *ramdac_set_hw_cursor_shape;
143         gfb_builtin_save_palette_t *builtin_save_palette;
144         gfb_builtin_load_palette_t *builtin_load_palette;
145         gfb_builtin_save_cursor_palette_t *builtin_save_cursor_palette;
146         gfb_builtin_load_cursor_palette_t *builtin_load_cursor_palette;
147         gfb_builtin_read_hw_cursor_t *builtin_read_hw_cursor;
148         gfb_builtin_set_hw_cursor_t *builtin_set_hw_cursor;
149         gfb_builtin_set_hw_cursor_shape_t *builtin_set_hw_cursor_shape;
150 };
151
152 struct video_adapter;
153 struct genfb_softc;
154
155 typedef struct gfb_softc {
156         char *driver_name;              /* name for this driver */
157         struct video_adapter *adp;
158         struct genfb_softc *gensc;
159         struct gfb_conf *gfbc;
160         bus_space_handle_t bhandle;
161         bus_space_tag_t btag;
162         bus_space_handle_t regs;
163         void *intrhand;
164         struct resource *irq;
165         struct resource *res;
166         u_int8_t rev;                   /* GFB revision */
167         int type;
168         int model;
169         dev_t devt;
170 } *gfb_softc_t;
171
172 #endif /* _FB_GFB_H_ */