|
|
1.1 root 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 [email protected]
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: * File: pm_hdw.c
28: * Author: Alessandro Forin, Carnegie Mellon University
29: * Date: 9/90
30: *
31: * Driver for the VFB01/02 Mono/Color framebuffer (pmax)
32: * Hardware-level operations.
33: */
34:
35: #include <bm.h>
36: #if NBM>0
37: #include <platforms.h>
38:
39: #include <machine/machspl.h> /* spl definitions */
40: #include <chips/screen_defs.h>
41: #include <chips/pm_defs.h>
42: #include <chips/busses.h>
43: #include <machine/machspl.h>
44:
45: #ifdef DECSTATION
46: #include <mips/mips_cpu.h>
47: #include <mips/PMAX/kn01.h>
48:
49: #define KN01_CSR_ADDR PHYS_TO_K1SEG(KN01_SYS_CSR)
50: #define KN01_FBUF_ADDR PHYS_TO_K1SEG(KN01_PHYS_FBUF_START)
51: #define KN01_PLM_ADDR PHYS_TO_K1SEG(KN01_PHYS_COLMASK_START)
52: #define KN01_BT478_ADDR PHYS_TO_K1SEG(KN01_SYS_VDAC)
53: #define KN01_DC503_ADDR PHYS_TO_K1SEG(KN01_SYS_PCC)
54:
55: #define VRETRACE dc503_vretrace
56: #define MONO_FRAME_WIDTH 2048
57: #define ISA_MONO ((*(volatile short*)KN01_CSR_ADDR)&KN01_CSR_MONO)
58:
59: #endif /*DECSTATION*/
60:
61: #ifdef VAXSTATION
62: #include <vax/ka3100.h>
63: #define VRETRACE ka42_vretrace
64: #define ISA_MONO 1
65: #define MONO_FRAME_WIDTH 1024
66: #endif /*VAXSTATION*/
67:
68: /*
69: * Definition of the driver for the auto-configuration program.
70: */
71:
72: int pm_probe(), pm_intr();
73: static void pm_attach();
74:
75: vm_offset_t pm_std[] = { 0 };
76: struct bus_device *pm_info[1];
77: struct bus_driver pm_driver =
78: { pm_probe, 0, pm_attach, 0, pm_std, "pm", pm_info, };
79:
80: /*
81: * Probe/Attach functions
82: */
83:
84: pm_probe( /* reg, ui */)
85: {
86: static probed_once = 0;
87: #ifdef DECSTATION
88: if (!isa_pmax())
89: return 0;
90: if (check_memory(KN01_FBUF_ADDR, 0))
91: return 0;
92: #endif /*DECSTATION*/
93: if (probed_once++ > 1)
94: printf("[mappable] ");
95: return 1;
96: }
97:
98: static void
99: pm_attach(ui)
100: struct bus_device *ui;
101: {
102: int isa_mono = ISA_MONO;
103:
104: printf(": %s%s",
105: isa_mono ? "monochrome" : "color",
106: " display");
107: }
108:
109:
110: /*
111: * Interrupt routine
112: */
113: #ifdef DECSTATION
114: pm_intr(unit,spllevel)
115: spl_t spllevel;
116: {
117: /* this is the vertical retrace one */
118: splx(spllevel);
119: lk201_led(unit);
120: }
121: #endif /*DECSTATION*/
122:
123: #ifdef VAXSTATION
124: pm_intr(unit)
125: {
126: lk201_led(unit);
127: }
128: #endif /*VAXSTATION*/
129:
130: /*
131: * Boot time initialization: must make device
132: * usable as console asap.
133: */
134: extern int
135: pm_cons_init(), pm_soft_reset(),
136: dc503_video_on(), dc503_video_off(),
137: pm_char_paint(), dc503_pos_cursor(),
138: pm_insert_line(), pm_remove_line(), pm_clear_bitmap(),
139: pm_set_status(), pm_get_status(),
140: VRETRACE(), pm_map_page();
141:
142: static struct screen_switch pm_sw = {
143: screen_noop, /* graphic_open */
144: pm_soft_reset, /* graphic_close */
145: pm_set_status, /* set_status */
146: pm_get_status, /* set_status */
147: pm_char_paint, /* char_paint */
148: dc503_pos_cursor, /* pos_cursor */
149: pm_insert_line, /* insert_line */
150: pm_remove_line, /* remove_line */
151: pm_clear_bitmap, /* clear_bitmap */
152: dc503_video_on, /* video_on */
153: dc503_video_off, /* video_off */
154: VRETRACE, /* enable vert retrace intr */
155: pm_map_page /* map_page */
156: };
157:
158: pm_cold_init(unit, up)
159: user_info_t *up;
160: {
161: pm_softc_t *pm;
162: screen_softc_t sc = screen(unit);
163: int isa_mono = ISA_MONO;
164:
165: bcopy(&pm_sw, &sc->sw, sizeof(sc->sw));
166: if (isa_mono) {
167: sc->flags |= MONO_SCREEN;
168: sc->frame_scanline_width = MONO_FRAME_WIDTH;
169: } else {
170: sc->flags |= COLOR_SCREEN;
171: sc->frame_scanline_width = 1024;
172: }
173: sc->frame_height = 864;
174: sc->frame_visible_width = 1024;
175: sc->frame_visible_height = 864;
176:
177: pm_init_screen_params(sc, up);
178: (void) screen_up(unit, up);
179:
180: #ifdef DECSTATION
181: pm = pm_alloc(unit, KN01_DC503_ADDR, KN01_FBUF_ADDR, KN01_PLM_ADDR);
182: pm->vdac_registers = (char*)KN01_BT478_ADDR;
183: #endif /*DECSTATION*/
184: #ifdef VAXSTATION
185: pm = pm_alloc(unit, cur_xxx, bm_mem, 0);
186: #endif /*VAXSTATION*/
187:
188: screen_default_colors(up);
189:
190: dc503_init(pm);
191:
192: pm_soft_reset(sc);
193:
194: /*
195: * Clearing the screen at boot saves from scrolling
196: * much, and speeds up booting quite a bit.
197: */
198: screen_blitc( unit, 'C'-'@');/* clear screen */
199: }
200:
201: #endif NBM>0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.