7 * Revision 1.1.1.1 1997/10/30 23:27:18 verghese
10 * Revision 1.1.9.2 1995/04/24 23:34:47 Jeff_Colburn
11 * Add support for shared interrupts, ISR's now have a return value
12 * of INTR_SERVICED or INTR_NOT_SERVICED. Changed return type from "void"
13 * to "int" for interrupt return type in "tga_info_t".
14 * [1995/04/24 23:24:12 Jeff_Colburn]
16 * Revision 1.1.7.2 1994/11/07 23:31:23 Jeff_Colburn
17 * Added defines for putting TGA in Copy mode to support console scrolling fix.
18 * [1994/10/26 22:32:00 Jeff_Colburn]
20 * Revision 1.1.5.5 1994/05/16 19:29:08 Monty_Brandenberg
21 * Add dma_map_info_t to the info struct.
22 * [1994/05/12 05:31:19 Monty_Brandenberg]
24 * Revision 1.1.5.4 1994/04/19 21:59:33 Stuart_Hollander
25 * merge agoshw2 bl5 to gold bl10
26 * Revision 1.1.2.4 1994/04/14 20:17:15 Monty_Brandenberg
27 * T32-88 Framebuffer offset was incorrect causing obscure z buffering
29 * [1994/04/14 19:17:10 Monty_Brandenberg]
31 * Revision 1.1.5.3 1994/04/11 12:58:27 Stuart_Hollander
32 * Revision 1.1.2.3 1994/02/28 16:53:52 Monty_Brandenberg
33 * Removed a few magic numbers from the code and made symbolics out of
35 * [1994/02/23 21:09:10 Monty_Brandenberg]
37 * Add header files we need to define structures. Added two new ioctls
38 * to extract direct dma mapping info. SFB+ and TGA ioctl structures
39 * are now incompatible. Fixed truecolor index and private ioctl code.
40 * [1994/02/04 21:10:07 Monty_Brandenberg]
42 * Removed two interrupt sources as per spec. Fixed the RAMDAC access
43 * macros to actually work. Imagine.
44 * [1994/02/02 23:16:55 Monty_Brandenberg]
46 * Converted to use io_handles. Needs work on DMA
47 * [1994/01/07 21:14:33 Monty_Brandenberg]
49 * Added support for 24-plane option using BT463 and custom cursor chip.
50 * Converted to fully prototyped functions. Started conversion to
51 * io_handle structure.
52 * [1994/01/06 21:15:14 Monty_Brandenberg]
54 * Revision 1.1.5.2 1994/01/23 21:16:19 Stuart_Hollander
55 * merge from hw2 to goldbl8
56 * [1993/12/29 12:57:23 Stuart_Hollander]
58 * Revision 1.1.2.2 1993/12/21 13:42:28 Monty_Brandenberg
59 * Initial version of the TGA device driver.
60 * [1993/12/14 00:22:06 Monty_Brandenberg]
65 * @(#)$RCSfile: tga.h,v $ $Revision: 1.1.1.1 $ (DEC) $Date: 1997/10/30 23:27:18 $
68 /************************************************************************
70 * Copyright (c) 1993 by *
71 * Digital Equipment Corporation, Maynard, MA *
72 * All rights reserved. *
74 * This software is furnished under a license and may be used and *
75 * copied only in accordance with the terms of such license and *
76 * with the inclusion of the above copyright notice. This *
77 * software or any other copies thereof may not be provided or *
78 * otherwise made available to any other person. No title to and *
79 * ownership of the software is hereby transferred. *
81 * The information in this software is subject to change without *
82 * notice and should not be construed as a commitment by Digital *
83 * Equipment Corporation. *
85 * Digital assumes no responsibility for the use or reliability *
86 * of its software on equipment which is not supplied by Digital. *
88 ************************************************************************/
91 * RAMDAC is a trademark of Brooktree Corporation
101 #include <sys/types.h>
102 #include <sys/ioctl.h>
103 #include <sys/workstation.h>
104 #include <sys/inputdevice.h>
105 #include <sys/wsdevice.h>
106 #include <io/common/devdriver.h>
110 * Special offsets within the PCI configuration header
112 #define TGA_CONFIG_PVRR_OFFSET 0x00000040
113 #define TGA_CONFIG_PAER_OFFSET 0x00000044
118 #define TGA_CONFIG_PAER_32MB 0x00000000
119 #define TGA_CONFIG_PAER_64MB 0x00010000
120 #define TGA_CONFIG_PAER_128MB 0x00030000
123 * Offsets within Memory Space
125 #define TGA_ROM_OFFSET 0x000000
126 #define TGA_ASIC_OFFSET 0x100000
127 #define TGA_RAMDAC_SETUP_OFFSET 0x1000c0
128 #define TGA_RAMDAC_DATA_OFFSET 0x1001f0
129 #define TGA_XY_REG_OFFSET 0x100074
130 #define TGA_VALID_REG_OFFSET 0x100070
132 #define TGA_0_0_FB_OFFSET 0x00200000
133 #define TGA_0_0_FB_SIZE 0x00200000
134 #define TGA_0_1_FB_OFFSET 0x00400000
135 #define TGA_0_1_FB_SIZE 0x00400000
136 #define TGA_0_3_FB_OFFSET 0x00800000
137 #define TGA_0_3_FB_SIZE 0x00800000
138 #define TGA_1_3_FB_OFFSET 0x00800000
139 #define TGA_1_3_FB_SIZE 0x00800000
140 #define TGA_1_7_FB_OFFSET 0x01000000
141 #define TGA_1_7_FB_SIZE 0x01000000
142 #define TGA_INVALID_FB_OFFSET 0
143 #define TGA_INVALID_FB_SIZE 0
148 #define TGA_TYPE_T801 0
149 #define TGA_TYPE_T802 1
150 #define TGA_TYPE_T822 2
151 #define TGA_TYPE_T844 3
152 #define TGA_TYPE_T3204 4
153 #define TGA_TYPE_T3208 5
154 #define TGA_TYPE_T3288 6
155 #define TGA_TYPE_INVALID 7
156 #define TGA_TYPE_NUM 8
159 #define NDEPTHS 1 /* all current hardware just has one */
163 typedef unsigned char tga_pix8_t
;
164 typedef unsigned int tga_pix32_t
;
165 typedef unsigned int tga_reg_t
;
168 * Window tags definitions
170 #define TGA_TRUECOLOR_WID_INDEX 0xc
171 #define TGA_TRUECOLOR_WID_MASK 0xc0000000
175 * Device-private ioctls
177 #define TGA_IOCTL_PRIVATE _IOWR('w', (0|IOC_S), tga_ioc_t)
178 #define TGA_IOC_LOAD_WINDOW_TAGS 0
179 #define TGA_IOC_ENABLE_DMA_OPS 1
180 #define TGA_IOC_SET_STEREO_MODE 2
181 #define TGA_IOC_GET_STEREO_MODE 3
182 #define TGA_IOC_GET_DIRECT_DMA_COUNT 4
183 #define TGA_IOC_GET_DIRECT_DMA_INFO 5
190 } tga_window_tag_cell_t
;
195 tga_window_tag_cell_t
*p_cells
;
196 } tga_ioc_window_tag_t
;
199 vm_offset_t phys_base
;
200 vm_offset_t bus_base
;
205 int alloc_map_num
; /* input */
206 int actual_map_num
; /* output */
207 tga_dma_map_t
*maps
; /* input & output */
208 } tga_ioc_dma_info_t
;
214 tga_ioc_window_tag_t window_tag
;
215 unsigned int stereo_mode
;
216 #define TGA_IOC_STEREO_NONE 0
217 #define TGA_IOC_STEREO_24 1
219 int direct_dma_count
;
220 tga_ioc_dma_info_t direct_dma_info
;
230 unsigned col_size
: 1;
231 unsigned sam_size
: 1;
233 unsigned write_en
: 1;
235 unsigned slow_dac
: 1;
236 unsigned dma_size
: 1;
237 unsigned sync_type
: 1;
241 #define TGA_DEEP_DEEP_8PLANE 0
242 #define TGA_DEEP_DEEP_32PLANE 1
244 #define TGA_DEEP_MASK_4MB 0x00
245 #define TGA_DEEP_MASK_8MB 0x01
246 #define TGA_DEEP_MASK_16MB 0x03
247 #define TGA_DEEP_MASK_32MB 0x07
249 #define TGA_DEEP_PARITY_ODD 0
250 #define TGA_DEEP_PARITY_EVEN 1
252 #define TGA_DEEP_READY_ON_8 0
253 #define TGA_DEEP_READY_ON_2 1
255 #define TGA_DEEP_DMA_64 0
256 #define TGA_DEEP_DMA_128 1
259 unsigned s_wr_mask
: 8;
260 unsigned s_rd_mask
: 8;
267 } tga_stencil_mode_reg_t
;
269 #define TGA_SM_TEST_GEQ 0x00
270 #define TGA_SM_TEST_TRUE 0x01
271 #define TGA_SM_TEST_FALSE 0x02
272 #define TGA_SM_TEST_LS 0x03
273 #define TGA_SM_TEST_EQ 0x04
274 #define TGA_SM_TEST_LEQ 0x05
275 #define TGA_SM_TEST_GT 0x06
276 #define TGA_SM_TEST_NEQ 0x07
278 #define TGA_SM_RESULT_KEEP 0x00
279 #define TGA_SM_RESULT_ZERO 0x01
280 #define TGA_SM_RESULT_REPLACE 0x02
281 #define TGA_SM_RESULT_INCR 0x03
282 #define TGA_SM_RESULT_DECR 0x04
283 #define TGA_SM_RESULT_INV 0x05
285 #define TGA_SM_Z_REPLACE 0
286 #define TGA_SM_Z_KEEP 1
294 unsigned cap_ends
: 1;
298 #define TGA_MODE_MODE_SIMPLE 0x00
299 #define TGA_MODE_MODE_Z_SIMPLE 0x10
300 #define TGA_MODE_MODE_OPA_STIP 0x01
301 #define TGA_MODE_MODE_OPA_FILL 0x21
302 #define TGA_MODE_MODE_TRA_STIP 0x05
303 #define TGA_MODE_MODE_TRA_FILL 0x25
304 #define TGA_MODE_MODE_TRA_BLK_STIP 0x0d
305 #define TGA_MODE_MODE_TRA_BLK_FILL 0x2d
306 #define TGA_MODE_MODE_OPA_LINE 0x02
307 #define TGA_MODE_MODE_TRA_LINE 0x06
308 #define TGA_MODE_MODE_CINT_TRA_LINE 0x0e
309 #define TGA_MODE_MODE_CINT_TRA_DITH_LINE 0x2e
310 #define TGA_MODE_MODE_Z_OPA_LINE 0x12
311 #define TGA_MODE_MODE_Z_TRA_LINE 0x16
312 #define TGA_MODE_MODE_Z_CINT_OPA_LINE 0x1a
313 #define TGA_MODE_MODE_Z_SINT_OPA 0x5a
314 #define TGA_MODE_MODE_Z_CINT_OPA_DITH_LINE 0x3a
315 #define TGA_MODE_MODE_Z_CINT_TRA_LINE 0x1e
316 #define TGA_MODE_MODE_Z_SINT_TRA 0x5e
317 #define TGA_MODE_MODE_Z_CINT_TRA_DITH_LINE 0x3e
318 #define TGA_MODE_MODE_COPY 0x07
319 #define TGA_MODE_MODE_COPY24 0x307
320 #define TGA_MODE_MODE_DMA_READ 0x17
321 #define TGA_MODE_MODE_DMA_READ_DITH 0x37
322 #define TGA_MODE_MODE_DMA_WRITE 0x1f
324 #define TGA_MODE_VISUAL_8_PACKED 0x00
325 #define TGA_MODE_VISUAL_8_UNPACKED 0x01
326 #define TGA_MODE_VISUAL_12_LOW 0x02
327 #define TGA_MODE_VISUAL_12_HIGH 0x06
328 #define TGA_MODE_VISUAL_24 0x03
330 #define TGA_MODE_PM_IS_PERS 0x00800000
331 #define TGA_MODE_ADDR_IS_NEW 0x00400000
332 #define TGA_MODE_BRES3_IS_NEW 0x00200000
333 #define TGA_MODE_COPY_WILL_DRAIN 0x00100000
342 #define TGA_ROP_OP_CLEAR 0
343 #define TGA_ROP_OP_AND 1
344 #define TGA_ROP_OP_AND_REVERSE 2
345 #define TGA_ROP_OP_COPY 3
346 #define TGA_ROP_OP_COPY24 0x303
347 #define TGA_ROP_OP_AND_INVERTED 4
348 #define TGA_ROP_OP_NOOP 5
349 #define TGA_ROP_OP_XOR 6
350 #define TGA_ROP_OP_OR 7
351 #define TGA_ROP_OP_NOR 8
352 #define TGA_ROP_OP_EQUIV 9
353 #define TGA_ROP_OP_INVERT 10
354 #define TGA_ROP_OP_OR_REVERSE 11
355 #define TGA_ROP_OP_COPY_INVERTED 12
356 #define TGA_ROP_OP_OR_INVERTED 13
357 #define TGA_ROP_OP_NAND 14
358 #define TGA_ROP_OP_SET 15
360 #define TGA_ROP_VISUAL_8_PACKED 0x00
361 #define TGA_ROP_VISUAL_8_UNPACKED 0x01
362 #define TGA_ROP_VISUAL_12 0x02
363 #define TGA_ROP_VISUAL_24 0x03
365 #define TGA_INTR_VSYNC 0x00000001
366 #define TGA_INTR_SHIFT_ADDR 0x00000002
367 #define TGA_INTR_TIMER 0x00000010
368 #define TGA_INTR_ALL 0x00000013
369 #define TGA_INTR_ENABLE_SHIFT 16
371 #define TGA_RAMDAC_INTERF_WRITE_SHIFT 0
372 #define TGA_RAMDAC_INTERF_READ0_SHIFT 16
373 #define TGA_RAMDAC_INTERF_READ1_SHIFT 24
375 #define TGA_RAMDAC_485_READ 0x01
376 #define TGA_RAMDAC_485_WRITE 0x00
378 #define TGA_RAMDAC_485_ADDR_PAL_WRITE 0x00
379 #define TGA_RAMDAC_485_DATA_PAL 0x02
380 #define TGA_RAMDAC_485_PIXEL_MASK 0x04
381 #define TGA_RAMDAC_485_ADDR_PAL_READ 0x06
382 #define TGA_RAMDAC_485_ADDR_CUR_WRITE 0x08
383 #define TGA_RAMDAC_485_DATA_CUR 0x0a
384 #define TGA_RAMDAC_485_CMD_0 0x0c
385 #define TGA_RAMDAC_485_ADDR_CUR_READ 0x0e
386 #define TGA_RAMDAC_485_CMD_1 0x10
387 #define TGA_RAMDAC_485_CMD_2 0x12
388 #define TGA_RAMDAC_485_STATUS 0x14
389 #define TGA_RAMDAC_485_CMD_3 0x14
390 #define TGA_RAMDAC_485_CUR_RAM 0x16
391 #define TGA_RAMDAC_485_CUR_LOW_X 0x18
392 #define TGA_RAMDAC_485_CUR_HIGH_X 0x1a
393 #define TGA_RAMDAC_485_CUR_LOW_Y 0x1c
394 #define TGA_RAMDAC_485_CUR_HIGH_Y 0x1e
396 #define TGA_RAMDAC_485_ADDR_EPSR_SHIFT 0
397 #define TGA_RAMDAC_485_ADDR_EPDR_SHIFT 8
399 #define TGA_RAMDAC_463_HEAD_MASK 0x01
400 #define TGA_RAMDAC_463_READ 0x02
401 #define TGA_RAMDAC_463_WRITE 0x00
402 #define TGA_RAMDAC_463_ADDR_LOW 0x00
403 #define TGA_RAMDAC_463_ADDR_HIGH 0x04
404 #define TGA_RAMDAC_463_CMD_CURS 0x08
405 #define TGA_RAMDAC_463_CMD_CMAP 0x0c
407 #define TGA_RAMDAC_463_ADDR_EPSR_SHIFT 0
408 #define TGA_RAMDAC_463_ADDR_EPDR_SHIFT 8
410 #define TGA_RAMDAC_463_CURSOR_COLOR0 0x0100
411 #define TGA_RAMDAC_463_CURSOR_COLOR1 0x0101
412 #define TGA_RAMDAC_463_COMMAND_REG_0 0x0201
413 #define TGA_RAMDAC_463_COMMAND_REG_1 0x0202
414 #define TGA_RAMDAC_463_COMMAND_REG_2 0x0203
415 #define TGA_RAMDAC_463_READ_MASK 0x0205
416 #define TGA_RAMDAC_463_BLINK_MASK 0x0209
417 #define TGA_RAMDAC_463_WINDOW_TYPE_TABLE 0x0300
421 unsigned int pixels
: 9;
422 unsigned int front_porch
: 5;
423 unsigned int sync
: 7;
424 unsigned int back_porch
: 7;
425 unsigned int ignore
: 3;
426 unsigned int odd
: 1;
428 unsigned int h_setup
;
429 } tga_horizontal_setup_t
;
433 unsigned int scan_lines
: 11;
434 unsigned int front_porch
: 5;
435 unsigned int sync
: 6;
436 unsigned int back_porch
: 6;
438 unsigned int v_setup
;
439 } tga_vertical_setup_t
;
441 typedef volatile struct {
444 tga_reg_t foreground
;
445 tga_reg_t background
;
459 tga_reg_t stencil_mode
;
460 tga_reg_t pers_pixelmask
;
462 tga_reg_t cursor_base_address
;
463 tga_reg_t horizontal_setup
;
464 tga_reg_t vertical_setup
;
466 #define TGA_VERT_STEREO_EN 0x80000000
467 tga_reg_t base_address
;
468 tga_reg_t video_valid
;
470 #define TGA_VIDEO_VALID_SCANNING 0x00000001
471 #define TGA_VIDEO_VALID_BLANK 0x00000002
472 #define TGA_VIDEO_VALID_CURSOR_ENABLE 0x00000004
474 tga_reg_t video_shift_addr
;
475 tga_reg_t intr_status
;
477 tga_reg_t pixel_data
;
479 tga_reg_t green_incr
;
481 tga_reg_t z_incr_low
;
482 tga_reg_t z_incr_high
;
483 tga_reg_t dma_address
;
484 tga_reg_t bres_width
;
486 tga_reg_t z_value_low
;
487 tga_reg_t z_value_high
;
488 tga_reg_t z_base_address
;
491 tga_reg_t green_value
;
492 tga_reg_t blue_value
;
495 tga_reg_t ramdac_setup
;
508 tga_reg_t bm_color_0
;
509 tga_reg_t bm_color_1
;
510 tga_reg_t bm_color_2
;
511 tga_reg_t bm_color_3
;
512 tga_reg_t bm_color_4
;
513 tga_reg_t bm_color_5
;
514 tga_reg_t bm_color_6
;
515 tga_reg_t bm_color_7
;
530 tga_reg_t eprom_write
;
536 tga_reg_t command_status
;
537 tga_reg_t command_status2
;
540 tga_rec_t
, *tga_ptr_t
;
544 ws_screen_descriptor screen
; /* MUST be first!!! */
545 ws_depth_descriptor depth
[NDEPTHS
];
546 ws_visual_descriptor visual
[NVISUALS
];
547 ws_cursor_functions cf
;
548 ws_color_map_functions cmf
;
549 ws_screen_functions sf
;
559 unsigned int bt485_present
;
560 unsigned int bits_per_pixel
;
561 unsigned int core_size
;
562 unsigned int paer_value
;
565 tga_reg_t refresh_count
;
566 tga_reg_t horizontal_setup
;
567 tga_reg_t vertical_setup
;
568 tga_reg_t base_address
;
570 vm_offset_t virtual_dma_buffer
;
571 vm_offset_t physical_dma_buffer
;
575 tga_window_tag_cell_t wt_cell
[16]; /* magic number */
576 unsigned int stereo_mode
;
577 io_handle_t io_handle
;
578 dma_map_info_t p_map_info
;
581 #define TGA_USER_MAPPING_COUNT 4
584 vm_offset_t fb_alias_increment
;
585 vm_offset_t option_base
;
586 unsigned int planemask
;
587 vm_offset_t virtual_dma_buffer
;
588 vm_offset_t physical_dma_buffer
;
593 unsigned char dirty_cell
;
594 unsigned char red
; /* only need 8 bits */
597 } tga_bt485_color_cell_t
;
600 volatile unsigned int *setup
;
601 volatile unsigned int *data
;
602 unsigned int head_mask
;
613 volatile unsigned int *setup
;
614 volatile unsigned int *data
;
615 unsigned int head_mask
;
623 /*************************************************************** fields
624 * above this line MUST match struct bt485type
625 * exactly!***************************************************************/
633 ws_color_cell cursor_fg
;
634 ws_color_cell cursor_bg
;
635 void (*enable_interrupt
)();
637 tga_bt485_color_cell_t cells
[256];
641 #define TGA_RAMDAC_463_WINDOW_TAG_COUNT 16
642 #define TGA_RAMDAC_463_CMAP_ENTRY_COUNT 528
645 unsigned char dirty_cell
;
649 } tga_bt463_color_cell_t
;
652 unsigned char low_byte
;
653 unsigned char middle_byte
;
654 unsigned char high_byte
;
655 unsigned char unused
;
656 } tga_bt463_wid_cell_t
;
659 volatile unsigned int *setup
;
660 volatile unsigned int *data
;
661 unsigned int head_mask
;
668 volatile unsigned int *setup
;
669 volatile unsigned int *data
;
670 unsigned int head_mask
;
676 char dirty_cursormap
;
678 void (*enable_interrupt
)();
679 caddr_t cursor_closure
;
680 ws_color_cell cursor_fg
;
681 ws_color_cell cursor_bg
;
684 tga_bt463_color_cell_t cells
[TGA_RAMDAC_463_CMAP_ENTRY_COUNT
];
689 volatile unsigned int *xy_reg
;
690 volatile unsigned int *valid
;
697 volatile unsigned int *xy_reg
;
698 volatile unsigned int *valid
;
704 char dirty_cursormap
;
708 ws_color_cell cursor_fg
;
709 ws_color_cell cursor_bg
;
710 void (*enable_interrupt
)();
711 unsigned int bits
[256];
715 #endif /* TGA_DEFINED */