FreeBSD/Linux Kernel Cross Reference
sys/chips/pm_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: pm_hdw.c,v $
29 * Revision 2.16 93/05/15 19:37:36 mrt
30 * machparam.h -> machspl.h
31 *
32 * Revision 2.15 93/05/10 20:08:30 rvb
33 * Fixed types.
34 * [93/05/06 09:57:15 af]
35 *
36 * Revision 2.14 93/01/14 17:21:39 danner
37 * Proper spl typing.
38 * [92/11/30 af]
39 *
40 * Revision 2.13 92/05/22 15:48:07 jfriedl
41 * Now all screens clearup at boot.
42 * [92/05/21 af]
43 *
44 * Revision 2.12 91/08/24 11:52:40 af
45 * Declare screen sizes, new calling sequences for a couple funcs.
46 * [91/08/02 01:58:48 af]
47 *
48 * Revision 2.11 91/06/25 20:54:31 rpd
49 * Tweaks to make gcc happy.
50 *
51 * Revision 2.10 91/06/19 11:54:07 rvb
52 * mips->DECSTATION; vax->VAXSTATION
53 * [91/06/12 14:02:01 rvb]
54 *
55 * File moved here from mips/PMAX since it tries to be generic;
56 * it is used on the PMAX and the Vax3100.
57 * [91/06/04 rvb]
58 *
59 * Revision 2.9 91/05/14 17:25:24 mrt
60 * Correcting copyright
61 *
62 * Revision 2.8 91/02/14 14:35:10 mrt
63 * In interrupt routine, drop priority as now required.
64 * [91/02/12 12:42:39 af]
65 *
66 * Revision 2.7 91/02/05 17:43:11 mrt
67 * Added author notices
68 * [91/02/04 11:15:55 mrt]
69 *
70 * Changed to use new Mach copyright
71 * [91/02/02 12:14:43 mrt]
72 *
73 * Revision 2.6 90/12/05 23:33:16 af
74 * Cleanups.
75 * [90/12/03 23:30:26 af]
76 *
77 * Revision 2.4.1.1 90/11/01 03:45:08 af
78 * Created, from the DEC specs:
79 * "DECstation 3100 Desktop Workstation Functional Specification"
80 * Workstation Systems Engineering, Palo Alto, CA. Aug 28, 1990.
81 * And from code written by Robert V. Baron at CMU.
82 * [90/09/03 af]
83 */
84 /*
85 * File: pm_hdw.c
86 * Author: Alessandro Forin, Carnegie Mellon University
87 * Date: 9/90
88 *
89 * Driver for the VFB01/02 Mono/Color framebuffer (pmax)
90 * Hardware-level operations.
91 */
92
93 #include <bm.h>
94 #if NBM>0
95 #include <platforms.h>
96
97 #include <machine/machspl.h> /* spl definitions */
98 #include <chips/screen_defs.h>
99 #include <chips/pm_defs.h>
100 #include <chips/busses.h>
101 #include <machine/machspl.h>
102
103 #ifdef DECSTATION
104 #include <mips/mips_cpu.h>
105 #include <mips/PMAX/kn01.h>
106
107 #define KN01_CSR_ADDR PHYS_TO_K1SEG(KN01_SYS_CSR)
108 #define KN01_FBUF_ADDR PHYS_TO_K1SEG(KN01_PHYS_FBUF_START)
109 #define KN01_PLM_ADDR PHYS_TO_K1SEG(KN01_PHYS_COLMASK_START)
110 #define KN01_BT478_ADDR PHYS_TO_K1SEG(KN01_SYS_VDAC)
111 #define KN01_DC503_ADDR PHYS_TO_K1SEG(KN01_SYS_PCC)
112
113 #define VRETRACE dc503_vretrace
114 #define MONO_FRAME_WIDTH 2048
115 #define ISA_MONO ((*(volatile short*)KN01_CSR_ADDR)&KN01_CSR_MONO)
116
117 #endif /*DECSTATION*/
118
119 #ifdef VAXSTATION
120 #include <vax/ka3100.h>
121 #define VRETRACE ka42_vretrace
122 #define ISA_MONO 1
123 #define MONO_FRAME_WIDTH 1024
124 #endif /*VAXSTATION*/
125
126 /*
127 * Definition of the driver for the auto-configuration program.
128 */
129
130 int pm_probe(), pm_intr();
131 static void pm_attach();
132
133 vm_offset_t pm_std[] = { 0 };
134 struct bus_device *pm_info[1];
135 struct bus_driver pm_driver =
136 { pm_probe, 0, pm_attach, 0, pm_std, "pm", pm_info, };
137
138 /*
139 * Probe/Attach functions
140 */
141
142 pm_probe( /* reg, ui */)
143 {
144 static probed_once = 0;
145 #ifdef DECSTATION
146 if (!isa_pmax())
147 return 0;
148 if (check_memory(KN01_FBUF_ADDR, 0))
149 return 0;
150 #endif /*DECSTATION*/
151 if (probed_once++ > 1)
152 printf("[mappable] ");
153 return 1;
154 }
155
156 static void
157 pm_attach(ui)
158 struct bus_device *ui;
159 {
160 int isa_mono = ISA_MONO;
161
162 printf(": %s%s",
163 isa_mono ? "monochrome" : "color",
164 " display");
165 }
166
167
168 /*
169 * Interrupt routine
170 */
171 #ifdef DECSTATION
172 pm_intr(unit,spllevel)
173 spl_t spllevel;
174 {
175 /* this is the vertical retrace one */
176 splx(spllevel);
177 lk201_led(unit);
178 }
179 #endif /*DECSTATION*/
180
181 #ifdef VAXSTATION
182 pm_intr(unit)
183 {
184 lk201_led(unit);
185 }
186 #endif /*VAXSTATION*/
187
188 /*
189 * Boot time initialization: must make device
190 * usable as console asap.
191 */
192 extern int
193 pm_cons_init(), pm_soft_reset(),
194 dc503_video_on(), dc503_video_off(),
195 pm_char_paint(), dc503_pos_cursor(),
196 pm_insert_line(), pm_remove_line(), pm_clear_bitmap(),
197 pm_set_status(), pm_get_status(),
198 VRETRACE(), pm_map_page();
199
200 static struct screen_switch pm_sw = {
201 screen_noop, /* graphic_open */
202 pm_soft_reset, /* graphic_close */
203 pm_set_status, /* set_status */
204 pm_get_status, /* set_status */
205 pm_char_paint, /* char_paint */
206 dc503_pos_cursor, /* pos_cursor */
207 pm_insert_line, /* insert_line */
208 pm_remove_line, /* remove_line */
209 pm_clear_bitmap, /* clear_bitmap */
210 dc503_video_on, /* video_on */
211 dc503_video_off, /* video_off */
212 VRETRACE, /* enable vert retrace intr */
213 pm_map_page /* map_page */
214 };
215
216 pm_cold_init(unit, up)
217 user_info_t *up;
218 {
219 pm_softc_t *pm;
220 screen_softc_t sc = screen(unit);
221 int isa_mono = ISA_MONO;
222
223 bcopy(&pm_sw, &sc->sw, sizeof(sc->sw));
224 if (isa_mono) {
225 sc->flags |= MONO_SCREEN;
226 sc->frame_scanline_width = MONO_FRAME_WIDTH;
227 } else {
228 sc->flags |= COLOR_SCREEN;
229 sc->frame_scanline_width = 1024;
230 }
231 sc->frame_height = 864;
232 sc->frame_visible_width = 1024;
233 sc->frame_visible_height = 864;
234
235 pm_init_screen_params(sc, up);
236 (void) screen_up(unit, up);
237
238 #ifdef DECSTATION
239 pm = pm_alloc(unit, KN01_DC503_ADDR, KN01_FBUF_ADDR, KN01_PLM_ADDR);
240 pm->vdac_registers = (char*)KN01_BT478_ADDR;
241 #endif /*DECSTATION*/
242 #ifdef VAXSTATION
243 pm = pm_alloc(unit, cur_xxx, bm_mem, 0);
244 #endif /*VAXSTATION*/
245
246 screen_default_colors(up);
247
248 dc503_init(pm);
249
250 pm_soft_reset(sc);
251
252 /*
253 * Clearing the screen at boot saves from scrolling
254 * much, and speeds up booting quite a bit.
255 */
256 screen_blitc( unit, 'C'-'@');/* clear screen */
257 }
258
259 #endif NBM>0
Cache object: 50eeb11deec0e45982625e1a5e57a69d
|