FreeBSD/Linux Kernel Cross Reference
sys/chips/cfb_hdw.c
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: cfb_hdw.c,v $
29 * Revision 2.14 93/05/15 19:35:54 mrt
30 * machparam.h -> machspl.h
31 *
32 * Revision 2.13 93/05/10 20:07:25 rvb
33 * Fixed types.
34 * [93/05/06 10:00:37 af]
35 *
36 * Revision 2.12 93/02/05 08:04:55 danner
37 * Changes for Flamingo.
38 * [93/02/04 01:28:05 af]
39 *
40 * Interrupt routine takes an spllevel on mips only.
41 * [92/11/30 af]
42 *
43 * Revision 2.11 92/05/22 15:46:47 jfriedl
44 * Now all screens clearup at boot.
45 * [92/05/21 af]
46 *
47 * Revision 2.10 92/02/19 16:45:39 elf
48 * Reflected changes in tc_enable_interrupt().
49 * [92/02/10 17:13:38 af]
50 *
51 * Revision 2.9 91/08/24 11:51:31 af
52 * Works on 3mins too. New calling seq, declare screen sizes.
53 * [91/08/02 01:59:46 af]
54 *
55 * Revision 2.8 91/06/25 20:53:24 rpd
56 * Tweaks to make gcc happy.
57 *
58 * Revision 2.7 91/06/19 16:57:45 rvb
59 * File moved here from mips/PMAX since it tries to be generic.
60 * [91/06/04 rvb]
61 *
62 * Revision 2.6 91/05/14 17:20:02 mrt
63 * Correcting copyright
64 *
65 * Revision 2.5 91/02/14 14:33:38 mrt
66 * In interrupt routine, drop priority as now required.
67 * [91/02/12 12:44:36 af]
68 *
69 * Revision 2.4 91/02/05 17:40:04 mrt
70 * Added author notices
71 * [91/02/04 11:12:22 mrt]
72 *
73 * Changed to use new Mach copyright
74 * [91/02/02 12:10:07 mrt]
75 *
76 * Revision 2.3 90/12/05 23:30:35 af
77 * Cleaned up.
78 * [90/12/03 23:11:53 af]
79 *
80 * Revision 2.1.1.1 90/11/01 03:42:09 af
81 * Created, from the DEC specs:
82 * "PMAG-BA TURBOchannel Color Frame Buffer Functional Specification"
83 * Workstation Systems Engineering, Palo Alto, CA. Aug 27, 1990
84 * [90/09/03 af]
85 */
86 /*
87 * File: cfb_hdw.c
88 * Author: Alessandro Forin, Carnegie Mellon University
89 * Date: 9/90
90 *
91 * Driver for the 3max Color Frame Buffer Display,
92 * hardware-level operations.
93 */
94
95 #include <cfb.h>
96 #if (NCFB > 0)
97
98 #include <platforms.h>
99
100 #include <machine/machspl.h>
101 #include <mach/std_types.h>
102 #include <chips/busses.h>
103 #include <chips/screen_defs.h>
104 #include <chips/pm_defs.h>
105
106 typedef pm_softc_t cfb_softc_t;
107
108 #ifdef DECSTATION
109 #include <mips/PMAX/pmag_ba.h>
110 #include <mips/PMAX/tc.h>
111 #endif
112
113 #ifdef FLAMINGO
114 #include <mips/PMAX/pmag_ba.h> /* XXX fixme */
115 #include <alpha/DEC/tc.h>
116 #endif
117
118 /*
119 * Definition of the driver for the auto-configuration program.
120 */
121
122 int cfb_probe(), cfb_intr();
123 static void cfb_attach();
124
125 vm_offset_t cfb_std[NCFB] = { 0 };
126 struct bus_device *cfb_info[NCFB];
127 struct bus_driver cfb_driver =
128 { cfb_probe, 0, cfb_attach, 0, cfb_std, "cfb", cfb_info,
129 0, 0, BUS_INTR_DISABLED};
130
131 /*
132 * Probe/Attach functions
133 */
134
135 cfb_probe( /* reg, ui */)
136 {
137 static probed_once = 0;
138
139 /*
140 * Probing was really done sweeping the TC long ago
141 */
142 if (tc_probe("cfb") == 0)
143 return 0;
144 if (probed_once++ > 1)
145 printf("[mappable] ");
146 return 1;
147 }
148
149 static void
150 cfb_attach(ui)
151 struct bus_device *ui;
152 {
153 /* ... */
154 printf(": color display");
155 }
156
157
158 /*
159 * Interrupt routine
160 */
161
162 cfb_intr(unit,spllevel)
163 spl_t spllevel;
164 {
165 register volatile char *ack;
166
167 /* acknowledge interrupt */
168 ack = (volatile char *) cfb_info[unit]->address + CFB_OFFSET_IREQ;
169 *ack = 0;
170
171 #ifdef mips
172 splx(spllevel);
173 #endif
174 lk201_led(unit);
175 }
176
177 cfb_vretrace(cfb, on)
178 cfb_softc_t *cfb;
179 {
180 int i;
181
182 for (i = 0; i < NCFB; i++)
183 if (cfb_info[i]->address == (vm_offset_t)cfb->framebuffer)
184 break;
185 if (i == NCFB) return;
186
187 (*tc_enable_interrupt)(cfb_info[i]->adaptor, on, 0);
188 }
189
190 /*
191 * Boot time initialization: must make device
192 * usable as console asap.
193 */
194 extern int
195 cfb_soft_reset(), cfb_set_status(),
196 bt459_pos_cursor(), bt459_video_on(),
197 bt459_video_off(), cfb_vretrace(),
198 pm_get_status(), pm_char_paint(),
199 pm_insert_line(), pm_remove_line(),
200 pm_clear_bitmap(), pm_map_page();
201
202 static struct screen_switch cfb_sw = {
203 screen_noop, /* graphic_open */
204 cfb_soft_reset, /* graphic_close */
205 cfb_set_status, /* set_status */
206 pm_get_status, /* get_status */
207 pm_char_paint, /* char_paint */
208 bt459_pos_cursor, /* pos_cursor */
209 pm_insert_line, /* insert_line */
210 pm_remove_line, /* remove_line */
211 pm_clear_bitmap, /* clear_bitmap */
212 bt459_video_on, /* video_on */
213 bt459_video_off, /* video_off */
214 cfb_vretrace, /* intr_enable */
215 pm_map_page /* map_page */
216 };
217
218 cfb_cold_init(unit, up)
219 user_info_t *up;
220 {
221 cfb_softc_t *cfb;
222 screen_softc_t sc = screen(unit);
223 int base = tc_probe("cfb");
224
225 bcopy(&cfb_sw, &sc->sw, sizeof(sc->sw));
226 sc->flags |= COLOR_SCREEN;
227 sc->frame_scanline_width = 1024;
228 sc->frame_height = 1024;
229 sc->frame_visible_width = 1024;
230 sc->frame_visible_height = 864;
231
232 pm_init_screen_params(sc,up);
233 (void) screen_up(unit, up);
234
235 cfb = pm_alloc(unit, base + CFB_OFFSET_BT459, base + CFB_OFFSET_VRAM, -1);
236
237 screen_default_colors(up);
238
239 cfb_soft_reset(sc);
240
241 /*
242 * Clearing the screen at boot saves from scrolling
243 * much, and speeds up booting quite a bit.
244 */
245 screen_blitc( unit, 'C'-'@');/* clear screen */
246 }
247
248 #endif (NCFB > 0)
Cache object: b734702ad03090d2c36fd244b2a3d3f9
|