diofbvar.h revision 1.2 1 1.2 tsutsui /* $NetBSD: diofbvar.h,v 1.2 2011/02/12 05:08:40 tsutsui Exp $ */
2 1.1 tsutsui /* $OpenBSD: diofbvar.h,v 1.10 2006/08/11 18:33:13 miod Exp $ */
3 1.1 tsutsui
4 1.1 tsutsui /*
5 1.1 tsutsui * Copyright (c) 2005, Miodrag Vallat
6 1.1 tsutsui *
7 1.1 tsutsui * Redistribution and use in source and binary forms, with or without
8 1.1 tsutsui * modification, are permitted provided that the following conditions
9 1.1 tsutsui * are met:
10 1.1 tsutsui * 1. Redistributions of source code must retain the above copyright
11 1.1 tsutsui * notice, this list of conditions and the following disclaimer.
12 1.1 tsutsui * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 tsutsui * notice, this list of conditions and the following disclaimer in the
14 1.1 tsutsui * documentation and/or other materials provided with the distribution.
15 1.1 tsutsui *
16 1.1 tsutsui * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1 tsutsui * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 1.1 tsutsui * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 1.1 tsutsui * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
20 1.1 tsutsui * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 1.1 tsutsui * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 1.1 tsutsui * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 1.1 tsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24 1.1 tsutsui * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25 1.1 tsutsui * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 1.1 tsutsui * POSSIBILITY OF SUCH DAMAGE.
27 1.1 tsutsui */
28 1.1 tsutsui /*
29 1.1 tsutsui * Copyright (c) 1988 University of Utah.
30 1.1 tsutsui * Copyright (c) 1990, 1993
31 1.1 tsutsui * The Regents of the University of California. All rights reserved.
32 1.1 tsutsui *
33 1.1 tsutsui * This code is derived from software contributed to Berkeley by
34 1.1 tsutsui * the Systems Programming Group of the University of Utah Computer
35 1.1 tsutsui * Science Department.
36 1.1 tsutsui *
37 1.1 tsutsui * Redistribution and use in source and binary forms, with or without
38 1.1 tsutsui * modification, are permitted provided that the following conditions
39 1.1 tsutsui * are met:
40 1.1 tsutsui * 1. Redistributions of source code must retain the above copyright
41 1.1 tsutsui * notice, this list of conditions and the following disclaimer.
42 1.1 tsutsui * 2. Redistributions in binary form must reproduce the above copyright
43 1.1 tsutsui * notice, this list of conditions and the following disclaimer in the
44 1.1 tsutsui * documentation and/or other materials provided with the distribution.
45 1.1 tsutsui * 3. Neither the name of the University nor the names of its contributors
46 1.1 tsutsui * may be used to endorse or promote products derived from this software
47 1.1 tsutsui * without specific prior written permission.
48 1.1 tsutsui *
49 1.1 tsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 1.1 tsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 1.1 tsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 1.1 tsutsui * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 1.1 tsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 1.1 tsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 1.1 tsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 1.1 tsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 1.1 tsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 1.1 tsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 1.1 tsutsui * SUCH DAMAGE.
60 1.1 tsutsui *
61 1.1 tsutsui * from: Utah $Hdr: grfvar.h 1.11 93/08/13$
62 1.1 tsutsui *
63 1.1 tsutsui * @(#)grfvar.h 8.2 (Berkeley) 9/9/93
64 1.1 tsutsui */
65 1.1 tsutsui
66 1.1 tsutsui #ifdef _KERNEL
67 1.1 tsutsui
68 1.1 tsutsui struct diocmap {
69 1.1 tsutsui u_int8_t r[256], g[256], b[256];
70 1.1 tsutsui };
71 1.1 tsutsui
72 1.1 tsutsui /*
73 1.1 tsutsui * Minimal frame buffer state structure.
74 1.1 tsutsui */
75 1.1 tsutsui struct diofb {
76 1.1 tsutsui uint8_t *regkva; /* KVA of registers */
77 1.1 tsutsui uint8_t *fbkva; /* KVA of framebuffer */
78 1.1 tsutsui
79 1.1 tsutsui uint8_t *regaddr; /* control registers physaddr */
80 1.1 tsutsui uint8_t *fbaddr; /* frame buffer physaddr */
81 1.1 tsutsui
82 1.1 tsutsui u_int fbsize; /* frame buffer size */
83 1.1 tsutsui u_int fbwidth; /* frame buffer width */
84 1.1 tsutsui u_int fbheight; /* frame buffer height */
85 1.1 tsutsui u_int dwidth; /* displayed part width */
86 1.1 tsutsui u_int dheight; /* displayed part height */
87 1.1 tsutsui
88 1.1 tsutsui u_int planes; /* number of planes */
89 1.1 tsutsui u_int planemask; /* and related mask */
90 1.1 tsutsui
91 1.1 tsutsui /* rasops information */
92 1.1 tsutsui struct rasops_info ri;
93 1.1 tsutsui
94 1.1 tsutsui /* color information */
95 1.1 tsutsui struct diocmap cmap;
96 1.1 tsutsui
97 1.1 tsutsui /* wsdisplay information */
98 1.1 tsutsui char wsdname[32];
99 1.1 tsutsui struct wsscreen_descr wsd;
100 1.1 tsutsui struct wsscreen_list wsl;
101 1.1 tsutsui struct wsscreen_descr *scrlist[1];
102 1.1 tsutsui int nscreens;
103 1.1 tsutsui u_int mapmode;
104 1.1 tsutsui
105 1.1 tsutsui /* blockmove routine */
106 1.1 tsutsui int (*bmv)(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
107 1.1 tsutsui u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
108 1.1 tsutsui };
109 1.1 tsutsui
110 1.1 tsutsui /* Replacement Rules (rops) */
111 1.1 tsutsui #define RR_CLEAR 0x0
112 1.1 tsutsui #define RR_COPY 0x3
113 1.1 tsutsui #define RR_XOR 0x6
114 1.1 tsutsui #define RR_INVERT 0xa
115 1.1 tsutsui #define RR_COPYINVERTED 0xc
116 1.1 tsutsui
117 1.1 tsutsui void diofb_cnattach(struct diofb *);
118 1.1 tsutsui void diofb_end_attach(device_t, struct wsdisplay_accessops *, struct diofb *,
119 1.1 tsutsui int, const char *);
120 1.1 tsutsui int diofb_fbinquire(struct diofb *, int, struct diofbreg *);
121 1.1 tsutsui void diofb_fbsetup(struct diofb *);
122 1.1 tsutsui int diofb_getcmap(struct diofb *, struct wsdisplay_cmap *);
123 1.1 tsutsui void diofb_resetcmap(struct diofb *);
124 1.1 tsutsui
125 1.1 tsutsui int diofb_alloc_attr(void *, int, int, int, long *);
126 1.1 tsutsui int diofb_alloc_screen(void *, const struct wsscreen_descr *, void **,
127 1.1 tsutsui int *, int *, long *);
128 1.1 tsutsui void diofb_free_screen(void *, void *);
129 1.1 tsutsui paddr_t diofb_mmap(void *, void *, off_t, int);
130 1.1 tsutsui int diofb_show_screen(void *, void *, int, void (*)(void *, int, int),
131 1.1 tsutsui void *);
132 1.1 tsutsui
133 1.1 tsutsui int diofb_mono_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
134 1.1 tsutsui u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
135 1.1 tsutsui
136 1.1 tsutsui /* Console support */
137 1.1 tsutsui int dvboxcnattach(bus_space_tag_t, bus_addr_t, int);
138 1.1 tsutsui int gboxcnattach(bus_space_tag_t, bus_addr_t, int);
139 1.1 tsutsui int hypercnattach(bus_space_tag_t, bus_addr_t, int);
140 1.1 tsutsui int rboxcnattach(bus_space_tag_t, bus_addr_t, int);
141 1.1 tsutsui int topcatcnattach(bus_space_tag_t, bus_addr_t, int);
142 1.1 tsutsui int tvrxcnattach(bus_space_tag_t, bus_addr_t, int);
143 1.2 tsutsui int gendiofbcnattach(bus_space_tag_t, bus_addr_t, int);
144 1.1 tsutsui extern struct diofb diofb_cn; /* struct diofb for console device */
145 1.1 tsutsui
146 1.1 tsutsui #endif
147 1.1 tsutsui
148 1.1 tsutsui /*
149 1.1 tsutsui * In mapped mode, mmap() will provide the following layout:
150 1.1 tsutsui * 0 - (DIOFB_REGSPACE - 1) frame buffer registers
151 1.1 tsutsui * DIOFB_REGSPACE onwards frame buffer memory
152 1.1 tsutsui */
153 1.1 tsutsui #define DIOFB_REGSPACE 0x020000
154