xref: /openbsd-src/sys/dev/ic/bt463.c (revision 91f110e064cd7c194e59e019b83bb7496c1c84d4)
1 /* $OpenBSD: bt463.c,v 1.12 2008/06/26 05:42:15 ray Exp $ */
2 /* $NetBSD: bt463.c,v 1.2 2000/06/13 17:21:06 nathanw Exp $ */
3 
4 /*-
5  * Copyright (c) 1998 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
10  * NASA Ames Research Center.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /*
35  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
36  * All rights reserved.
37  *
38  * Author: Chris G. Demetriou
39  *
40  * Permission to use, copy, modify and distribute this software and
41  * its documentation is hereby granted, provided that both the copyright
42  * notice and this permission notice appear in all copies of the
43  * software, derivative works or modified versions, and any portions
44  * thereof, and that both notices appear in supporting documentation.
45  *
46  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
47  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
48  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
49  *
50  * Carnegie Mellon requests users of this software to return to
51  *
52  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
53  *  School of Computer Science
54  *  Carnegie Mellon University
55  *  Pittsburgh PA 15213-3890
56  *
57  * any improvements or extensions that they make and grant Carnegie the
58  * rights to redistribute these changes.
59  */
60 
61  /* This code was derived from and originally located in sys/dev/pci/
62   *	 NetBSD: tga_bt463.c,v 1.5 2000/03/04 10:27:59 elric Exp
63   */
64 
65 #include <sys/param.h>
66 #include <sys/systm.h>
67 #include <sys/device.h>
68 #include <sys/buf.h>
69 #include <sys/kernel.h>
70 #include <sys/malloc.h>
71 
72 #include <uvm/uvm_extern.h>
73 
74 #include <dev/pci/pcivar.h>
75 #include <dev/pci/tgareg.h>
76 #include <dev/pci/tgavar.h>
77 #include <dev/ic/bt463reg.h>
78 #include <dev/ic/bt463var.h>
79 
80 #include <dev/wscons/wsconsio.h>
81 
82 /*
83  * Functions exported via the RAMDAC configuration table.
84  */
85 void	bt463_init(struct ramdac_cookie *);
86 int	bt463_set_cmap(struct ramdac_cookie *,
87 	    struct wsdisplay_cmap *);
88 int	bt463_get_cmap(struct ramdac_cookie *,
89 	    struct wsdisplay_cmap *);
90 int	bt463_set_cursor(struct ramdac_cookie *,
91 	    struct wsdisplay_cursor *);
92 int	bt463_get_cursor(struct ramdac_cookie *,
93 	    struct wsdisplay_cursor *);
94 int	bt463_set_curpos(struct ramdac_cookie *,
95 	    struct wsdisplay_curpos *);
96 int	bt463_get_curpos(struct ramdac_cookie *,
97 	    struct wsdisplay_curpos *);
98 int	bt463_get_curmax(struct ramdac_cookie *,
99 	    struct wsdisplay_curpos *);
100 int	bt463_check_curcmap(struct ramdac_cookie *,
101 	    struct wsdisplay_cursor *cursorp);
102 void	bt463_set_curcmap(struct ramdac_cookie *,
103 	    struct wsdisplay_cursor *cursorp);
104 int	bt463_get_curcmap(struct ramdac_cookie *,
105 	    struct wsdisplay_cursor *cursorp);
106 
107 #ifdef BT463_DEBUG
108 int bt463_store(void *);
109 int bt463_debug(void *);
110 int bt463_readback(void *);
111 void	bt463_copyback(void *);
112 #endif
113 
114 struct ramdac_funcs bt463_funcsstruct = {
115 	"Bt463",
116 	bt463_register,
117 	bt463_init,
118 	bt463_set_cmap,
119 	bt463_get_cmap,
120 	bt463_set_cursor,
121 	bt463_get_cursor,
122 	bt463_set_curpos,
123 	bt463_get_curpos,
124 	bt463_get_curmax,
125 	bt463_check_curcmap,
126 	bt463_set_curcmap,
127 	bt463_get_curcmap,
128 	NULL,
129 };
130 
131 /*
132  * Private data.
133  */
134 struct bt463data {
135 	void            *cookie;        /* This is what is passed
136 					 * around, and is probably
137 					 * struct tga_devconfig *
138 					 */
139 
140 	int             (*ramdac_sched_update)(void *, void (*)(void *));
141 	void            (*ramdac_wr)(void *, u_int, u_int8_t);
142 	u_int8_t        (*ramdac_rd)(void *, u_int);
143 
144 	int	changed;			/* what changed; see below */
145 	char curcmap_r[2];			/* cursor colormap */
146 	char curcmap_g[2];
147 	char curcmap_b[2];
148 	char cmap_r[BT463_NCMAP_ENTRIES];	/* colormap */
149 	char cmap_g[BT463_NCMAP_ENTRIES];
150 	char cmap_b[BT463_NCMAP_ENTRIES];
151 	int window_type[16]; /* 16 24-bit window type table entries */
152 };
153 
154 /* When we're doing console initialization, there's no
155  * way to get our cookie back to the video card's softc
156  * before we call sched_update. So we stash it here,
157  * and bt463_update will look for it here first.
158  */
159 static struct bt463data *console_data;
160 
161 
162 #define BTWREG(data, addr, val) do { bt463_wraddr((data), (addr)); \
163 	(data)->ramdac_wr((data)->cookie, BT463_REG_IREG_DATA, (val)); } while (0)
164 #define BTWNREG(data, val) (data)->ramdac_wr((data)->cookie, \
165 	BT463_REG_IREG_DATA, (val))
166 #define BTRREG(data, addr) (bt463_wraddr((data), (addr)), \
167 	(data)->ramdac_rd((data)->cookie, BT463_REG_IREG_DATA))
168 #define BTRNREG(data) ((data)->ramdac_rd((data)->cookie, BT463_REG_IREG_DATA))
169 
170 #define	DATA_CURCMAP_CHANGED	0x01	/* cursor colormap changed */
171 #define	DATA_CMAP_CHANGED	0x02	/* colormap changed */
172 #define	DATA_WTYPE_CHANGED	0x04	/* window type table changed */
173 #define	DATA_ALL_CHANGED	0x07
174 
175 /*
176  * Internal functions.
177  */
178 inline void bt463_wraddr(struct bt463data *, u_int16_t);
179 
180 void	bt463_update(void *);
181 
182 
183 /*****************************************************************************/
184 
185 /*
186  * Functions exported via the RAMDAC configuration table.
187  */
188 
189 struct ramdac_funcs *
190 bt463_funcs(void)
191 {
192 	return &bt463_funcsstruct;
193 }
194 
195 struct ramdac_cookie *
196 bt463_register(v, sched_update, wr, rd)
197 	void *v;
198 	int (*sched_update)(void *, void (*)(void *));
199 	void (*wr)(void *, u_int, u_int8_t);
200 	u_int8_t (*rd)(void *, u_int);
201 {
202 	struct bt463data *data;
203 	/*
204 	 * XXX -- comment out of date.  rcd.
205 	 * If we should allocate a new private info struct, do so.
206 	 * Otherwise, use the one we have (if it's there), or
207 	 * use the temporary one on the stack.
208 	 */
209 	data = malloc(sizeof *data, M_DEVBUF, M_WAITOK);
210 	/* XXX -- if !data */
211 	data->cookie = v;
212 	data->ramdac_sched_update = sched_update;
213 	data->ramdac_wr = wr;
214 	data->ramdac_rd = rd;
215 	return (struct ramdac_cookie *)data;
216 }
217 
218 /*
219  * This function exists solely to provide a means to init
220  * the RAMDAC without first registering.  It is useful for
221  * initializing the console early on.
222  */
223 void
224 bt463_cninit(v, sched_update, wr, rd)
225 	void *v;
226 	int (*sched_update)(void *, void (*)(void *));
227 	void (*wr)(void *, u_int, u_int8_t);
228 	u_int8_t (*rd)(void *, u_int);
229 {
230 	struct bt463data tmp, *data = &tmp;
231 	data->cookie = v;
232 	data->ramdac_sched_update = sched_update;
233 	data->ramdac_wr = wr;
234 	data->ramdac_rd = rd;
235 	/* Set up console_data so that when bt463_update is called back,
236 	 * it can use the right information.
237 	 */
238 	console_data = data;
239 	bt463_init((struct ramdac_cookie *)data);
240 	console_data = NULL;
241 }
242 
243 void
244 bt463_init(rc)
245 	struct ramdac_cookie *rc;
246 {
247 	struct bt463data *data = (struct bt463data *)rc;
248 
249 	int i;
250 
251 	/*
252 	 * Init the BT463 for normal operation.
253 	 */
254 
255 
256 	/*
257 	 * Setup:
258 	 * reg 0: 4:1 multiplexing, 25/75 blink.
259 	 * reg 1: Overlay mapping: mapped to common palette,
260 	 *        14 window type entries, 24-plane configuration mode,
261 	 *        4 overlay planes, underlays disabled, no cursor.
262 	 * reg 2: sync-on-green enabled, pedestal enabled.
263 	 */
264 
265 	BTWREG(data, BT463_IREG_COMMAND_0, 0x40);
266 	BTWREG(data, BT463_IREG_COMMAND_1, 0x48);
267 	BTWREG(data, BT463_IREG_COMMAND_2, 0xC0);
268 
269 	/*
270 	 * Initialize the read mask.
271 	 */
272 	bt463_wraddr(data, BT463_IREG_READ_MASK_P0_P7);
273 	for (i = 0; i < 4; i++)
274 		BTWNREG(data, 0xff);
275 
276 	/*
277 	 * Initialize the blink mask.
278 	 */
279 	bt463_wraddr(data, BT463_IREG_BLINK_MASK_P0_P7);
280 	for (i = 0; i < 4; i++)
281 		BTWNREG(data, 0);
282 
283 
284 	/*
285 	 * Clear test register
286 	 */
287 	BTWREG(data, BT463_IREG_TEST, 0);
288 
289 	/*
290 	 * Initialize the RAMDAC info struct to hold all of our
291 	 * data, and fill it in.
292 	 */
293 	data->changed = DATA_ALL_CHANGED;
294 
295 	/* initial cursor colormap: 0 is black, 1 is white */
296 	data->curcmap_r[0] = data->curcmap_g[0] = data->curcmap_b[0] = 0;
297 	data->curcmap_r[1] = data->curcmap_g[1] = data->curcmap_b[1] = 0xff;
298 
299 	/* Initial colormap: 0 is black, everything else is white */
300 	data->cmap_r[0] = data->cmap_g[0] = data->cmap_b[0] = 0;
301 	for (i = 1; i < 256; i++) {
302 		data->cmap_r[i] = rasops_cmap[3*i + 0];
303 		data->cmap_g[i] = rasops_cmap[3*i + 1];
304 		data->cmap_b[i] = rasops_cmap[3*i + 2];
305 	}
306 
307 	/* Initialize the window type table:
308 	 *
309 	 * Entry 0: 24-plane truecolor, overlays enabled, bypassed.
310 	 *
311 	 *  Lookup table bypass:      yes (    1 << 23 & 0x800000)  800000
312 	 *  Colormap address:       0x000 (0x000 << 17 & 0x7e0000)       0
313 	 *  Overlay mask:             0xf (  0xf << 13 & 0x01e000)   1e000
314 	 *  Overlay location:    P<27:24> (    0 << 12 & 0x001000)       0
315 	 *  Display mode:       Truecolor (    0 <<  9 & 0x000e00)     000
316 	 *  Number of planes:           8 (    8 <<  5 & 0x0001e0)     100
317 	 *  Plane shift:                0 (    0 <<  0 & 0x00001f)       0
318 	 *                                                        --------
319 	 *                                                        0x81e100
320 	 */
321 	data->window_type[0] = 0x81e100;
322 
323 	/* Entry 1: 8-plane pseudocolor in the bottom 8 bits,
324 	 *          overlays enabled, colormap starting at 0.
325 	 *
326 	 *  Lookup table bypass:       no (    0 << 23 & 0x800000)       0
327 	 *  Colormap address:       0x000 (0x000 << 17 & 0x7e0000)       0
328 	 *  Overlay mask:             0xf (  0xf << 13 & 0x01e000) 0x1e000
329 	 *  Overlay location:    P<27:24> (    0 << 12 & 0x001000)       0
330 	 *  Display mode:     Pseudocolor (    1 <<  9 & 0x000e00)   0x200
331 	 *  Number of planes:           8 (    8 <<  5 & 0x0001e0)   0x100
332 	 *  Plane shift:               16 ( 0x10 <<  0 & 0x00001f)      10
333 	 *                                                        --------
334 	 *                                                        0x01e310
335 	 */
336 	data->window_type[1] = 0x01e310;
337 
338 	/* The colormap interface to the world only supports one colormap,
339 	 * so having an entry for the 'alternate' colormap in the bt463
340 	 * probably isn't useful.
341 	 */
342 
343 	/* Fill the remaining table entries with clones of entry 0 until we
344 	 * figure out a better use for them.
345 	 */
346 
347 	for (i = 2; i < BT463_NWTYPE_ENTRIES; i++) {
348 		data->window_type[i] = 0x81e100;
349 	}
350 
351 	data->ramdac_sched_update(data->cookie, bt463_update);
352 
353 }
354 
355 int
356 bt463_set_cmap(rc, cmapp)
357 	struct ramdac_cookie *rc;
358 	struct wsdisplay_cmap *cmapp;
359 {
360 	struct bt463data *data = (struct bt463data *)rc;
361 	u_int count, index;
362 	int s, error;
363 
364 	index = cmapp->index;
365 	count = cmapp->count;
366 
367 	if (index >= BT463_NCMAP_ENTRIES || count > BT463_NCMAP_ENTRIES - index)
368 		return (EINVAL);
369 
370 	s = spltty();
371 
372 	if ((error = copyin(cmapp->red, &data->cmap_r[index], count)) != 0) {
373 		splx(s);
374 		return (error);
375 	}
376 	if ((error = copyin(cmapp->green, &data->cmap_g[index], count)) != 0) {
377 		splx(s);
378 		return (error);
379 	}
380 	if ((error = copyin(cmapp->blue, &data->cmap_b[index], count)) != 0) {
381 		splx(s);
382 		return (error);
383 	}
384 
385 	data->changed |= DATA_CMAP_CHANGED;
386 
387 	data->ramdac_sched_update(data->cookie, bt463_update);
388 	splx(s);
389 
390 	return (0);
391 }
392 
393 int
394 bt463_get_cmap(rc, cmapp)
395 	struct ramdac_cookie *rc;
396 	struct wsdisplay_cmap *cmapp;
397 {
398 	struct bt463data *data = (struct bt463data *)rc;
399 	u_int count, index;
400 	int error;
401 
402 	count = cmapp->count;
403 	index = cmapp->index;
404 
405 	if (index >= BT463_NCMAP_ENTRIES || count > BT463_NCMAP_ENTRIES - index)
406 		return (EINVAL);
407 
408 	error = copyout(&data->cmap_r[index], cmapp->red, count);
409 	if (error)
410 		return (error);
411 	error = copyout(&data->cmap_g[index], cmapp->green, count);
412 	if (error)
413 		return (error);
414 	error = copyout(&data->cmap_b[index], cmapp->blue, count);
415 	return (error);
416 }
417 
418 int
419 bt463_check_curcmap(rc, cursorp)
420 	struct ramdac_cookie *rc;
421 	struct wsdisplay_cursor *cursorp;
422 {
423 	u_int index, count;
424 	u_int8_t spare[2];
425 	int error;
426 
427 	index = cursorp->cmap.index;
428 	count = cursorp->cmap.count;
429 
430 	if (index >= 2 || count > 2 - index)
431 		return (EINVAL);
432 
433 	if ((error = copyin(&cursorp->cmap.red, &spare, count)) != 0)
434 		return (error);
435 	if ((error = copyin(&cursorp->cmap.green, &spare, count)) != 0)
436 		return (error);
437 	if ((error = copyin(&cursorp->cmap.blue, &spare, count)) != 0)
438 		return (error);
439 
440 	return (0);
441 }
442 
443 void
444 bt463_set_curcmap(rc, cursorp)
445 	struct ramdac_cookie *rc;
446 	struct wsdisplay_cursor *cursorp;
447 {
448 	struct bt463data *data = (struct bt463data *)rc;
449 	int count, index;
450 
451 	/* can't fail; parameters have already been checked. */
452 	count = cursorp->cmap.count;
453 	index = cursorp->cmap.index;
454 	copyin(cursorp->cmap.red, &data->curcmap_r[index], count);
455 	copyin(cursorp->cmap.green, &data->curcmap_g[index], count);
456 	copyin(cursorp->cmap.blue, &data->curcmap_b[index], count);
457 	data->changed |= DATA_CURCMAP_CHANGED;
458 	data->ramdac_sched_update(data->cookie, bt463_update);
459 }
460 
461 int
462 bt463_get_curcmap(rc, cursorp)
463 	struct ramdac_cookie *rc;
464 	struct wsdisplay_cursor *cursorp;
465 {
466 	struct bt463data *data = (struct bt463data *)rc;
467 	int error;
468 
469 	cursorp->cmap.index = 0;	/* DOCMAP */
470 	cursorp->cmap.count = 2;
471 	if (cursorp->cmap.red != NULL) {
472 		error = copyout(data->curcmap_r, cursorp->cmap.red, 2);
473 		if (error)
474 			return (error);
475 	}
476 	if (cursorp->cmap.green != NULL) {
477 		error = copyout(data->curcmap_g, cursorp->cmap.green, 2);
478 		if (error)
479 			return (error);
480 	}
481 	if (cursorp->cmap.blue != NULL) {
482 		error = copyout(data->curcmap_b, cursorp->cmap.blue, 2);
483 		if (error)
484 			return (error);
485 	}
486 	return (0);
487 }
488 
489 
490 /*****************************************************************************/
491 
492 /*
493  * Internal functions.
494  */
495 
496 #ifdef BT463_DEBUG
497 int bt463_store(void *v)
498 {
499 	struct bt463data *data = (struct bt463data *)v;
500 
501 	data->changed = DATA_ALL_CHANGED;
502 	data->ramdac_sched_update(data->cookie, bt463_update);
503 	printf("Scheduled bt463 store\n");
504 
505 	return 0;
506 }
507 
508 
509 int bt463_readback(void *v)
510 {
511 	struct bt463data *data = (struct bt463data *)v;
512 
513 	data->ramdac_sched_update(data->cookie, bt463_copyback);
514 	printf("Scheduled bt463 copyback\n");
515 	return 0;
516 }
517 
518 int
519 bt463_debug(v)
520 	void *v;
521 {
522 	struct bt463data *data = (struct bt463data *)v;
523 	int i;
524 	u_int8_t val;
525 
526 	printf("BT463 main regs:\n");
527 	for (i = 0x200; i < 0x20F; i ++) {
528 	  val = BTRREG(data, i);
529 	  printf("  $%04x %02x\n", i, val);
530 	}
531 
532 	printf("BT463 revision register:\n");
533 	  val = BTRREG(data, 0x220);
534 	  printf("  $%04x %02x\n", 0x220, val);
535 
536 	printf("BT463 window type table (from softc):\n");
537 
538 	for (i = 0; i < BT463_NWTYPE_ENTRIES; i++) {
539 	  printf("%02x %06x\n", i, data->window_type[i]);
540 	}
541 
542 	return 0;
543 }
544 
545 void
546 bt463_copyback(p)
547 	 void *p;
548 {
549 	struct bt463data *data = (struct bt463data *)p;
550 	int i;
551 
552 		for (i = 0; i < BT463_NWTYPE_ENTRIES; i++) {
553 			bt463_wraddr(data, BT463_IREG_WINDOW_TYPE_TABLE + i);
554 			data->window_type[i] = (BTRNREG(data) & 0xff);        /* B0-7   */
555 			data->window_type[i] |= (BTRNREG(data) & 0xff) << 8;  /* B8-15  */
556 			data->window_type[i] |= (BTRNREG(data) & 0xff) << 16; /* B16-23 */
557 		}
558 }
559 #endif
560 
561 inline void
562 bt463_wraddr(data, ireg)
563 	struct bt463data *data;
564 	u_int16_t ireg;
565 {
566 	data->ramdac_wr(data->cookie, BT463_REG_ADDR_LOW, ireg & 0xff);
567 	data->ramdac_wr(data->cookie, BT463_REG_ADDR_HIGH, (ireg >> 8) & 0xff);
568 }
569 
570 void
571 bt463_update(p)
572 	void *p;
573 {
574 	struct bt463data *data = (struct bt463data *)p;
575 	int i, v;
576 
577 	if (console_data != NULL) {
578 		/* The cookie passed in from sched_update is incorrect. Use the
579 		 * right one.
580 		 */
581 		data = console_data;
582 	}
583 
584 	v = data->changed;
585 
586 	/* The Bt463 won't accept window type data except during a blanking
587 	 * interval, so we do this early in the interrupt.
588 	 * Blanking the screen might also be a good idea, but it can cause
589 	 * unpleasant flashing and is hard to do from this side of the
590 	 * ramdac interface.
591 	 */
592 	if (v & DATA_WTYPE_CHANGED) {
593 		/* spit out the window type data */
594 		for (i = 0; i < BT463_NWTYPE_ENTRIES; i++) {
595 			bt463_wraddr(data, BT463_IREG_WINDOW_TYPE_TABLE + i);
596 			BTWNREG(data, (data->window_type[i]) & 0xff);       /* B0-7   */
597 			BTWNREG(data, (data->window_type[i] >> 8) & 0xff);  /* B8-15   */
598 			BTWNREG(data, (data->window_type[i] >> 16) & 0xff); /* B16-23  */
599 		}
600 	}
601 
602 	if (v & DATA_CURCMAP_CHANGED) {
603 		bt463_wraddr(data, BT463_IREG_CURSOR_COLOR_0);
604 		/* spit out the cursor data */
605 		for (i = 0; i < 2; i++) {
606 			BTWNREG(data, data->curcmap_r[i]);
607 			BTWNREG(data, data->curcmap_g[i]);
608 			BTWNREG(data, data->curcmap_b[i]);
609 		}
610 	}
611 
612 	if (v & DATA_CMAP_CHANGED) {
613 		bt463_wraddr(data, BT463_IREG_CPALETTE_RAM);
614 		/* spit out the colormap data */
615 		for (i = 0; i < BT463_NCMAP_ENTRIES; i++) {
616 			data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA,
617 				data->cmap_r[i]);
618 			data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA,
619 				data->cmap_g[i]);
620 			data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA,
621 				data->cmap_b[i]);
622 		}
623 	}
624 
625 	data->changed = 0;
626 }
627 
628 int	bt463_set_cursor (rc, cur)
629 	struct ramdac_cookie *rc;
630 	struct wsdisplay_cursor *cur;
631 {
632 	struct bt463data *data = (struct bt463data *)rc;
633 	return tga_builtin_set_cursor(data->cookie, cur);
634 }
635 
636 int	bt463_get_cursor (rc, cur)
637 	struct ramdac_cookie *rc;
638 	struct wsdisplay_cursor *cur;
639 {
640 	struct bt463data *data = (struct bt463data *)rc;
641 	return tga_builtin_get_cursor(data->cookie, cur);
642 }
643 
644 int	bt463_set_curpos (rc, cur)
645 	struct ramdac_cookie *rc;
646 	struct wsdisplay_curpos *cur;
647 {
648 	struct bt463data *data = (struct bt463data *)rc;
649 	return tga_builtin_set_curpos(data->cookie, cur);
650 }
651 
652 int	bt463_get_curpos (rc, cur)
653 	struct ramdac_cookie *rc;
654 	struct wsdisplay_curpos *cur;
655 {
656 	struct bt463data *data = (struct bt463data *)rc;
657 	return tga_builtin_get_curpos(data->cookie, cur);
658 }
659 
660 int	bt463_get_curmax (rc, cur)
661 	struct ramdac_cookie *rc;
662 	struct wsdisplay_curpos *cur;
663 {
664 	struct bt463data *data = (struct bt463data *)rc;
665 	return tga_builtin_get_curmax(data->cookie, cur);
666 }
667