tgavar.h revision 1.6 1 /* $NetBSD: tgavar.h,v 1.6 2000/03/05 07:57:52 elric Exp $ */
2
3 /*
4 * Copyright (c) 1995, 1996 Carnegie-Mellon University.
5 * All rights reserved.
6 *
7 * Author: Chris G. Demetriou
8 *
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
14 *
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 *
19 * Carnegie Mellon requests users of this software to return to
20 *
21 * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
25 *
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
28 */
29
30 #include <dev/ic/ramdac.h>
31 #include <dev/pci/tgareg.h>
32 #include <dev/rcons/raster.h>
33 #include <dev/wscons/wsconsio.h>
34 #include <dev/wscons/wscons_raster.h>
35
36 struct tga_devconfig;
37 struct fbcmap;
38 struct fbcursor;
39 struct fbcurpos;
40
41 struct tga_conf {
42 char *tgac_name; /* name for this board type */
43
44 int tgac_phys_depth; /* physical frame buffer depth */
45 vsize_t tgac_cspace_size; /* core space size */
46 vsize_t tgac_vvbr_units; /* what '1' in the VVBR means */
47
48 int tgac_ndbuf; /* number of display buffers */
49 vaddr_t tgac_dbuf[2]; /* display buffer offsets/addresses */
50 vsize_t tgac_dbufsz[2]; /* display buffer sizes */
51
52 int tgac_nbbuf; /* number of display buffers */
53 vaddr_t tgac_bbuf[2]; /* back buffer offsets/addresses */
54 vsize_t tgac_bbufsz[2]; /* back buffer sizes */
55 };
56
57 struct tga_devconfig {
58 bus_space_tag_t dc_memt;
59 pci_chipset_tag_t dc_pc;
60
61 pcitag_t dc_pcitag; /* PCI tag */
62 bus_addr_t dc_pcipaddr; /* PCI phys addr. */
63
64 tga_reg_t *dc_regs; /* registers; XXX: need aliases */
65
66 int dc_tga_type; /* the device type; see below */
67 int dc_tga2; /* True if it is a TGA2 */
68 const struct tga_conf *dc_tgaconf; /* device buffer configuration */
69
70 struct ramdac_funcs
71 *dc_ramdac_funcs; /* The RAMDAC functions */
72 struct ramdac_cookie
73 *dc_ramdac_cookie; /* the RAMDAC type; see above */
74
75 vaddr_t dc_vaddr; /* memory space virtual base address */
76 paddr_t dc_paddr; /* memory space physical base address */
77
78 int dc_wid; /* width of frame buffer */
79 int dc_ht; /* height of frame buffer */
80 int dc_rowbytes; /* bytes in a FB scan line */
81
82 vaddr_t dc_videobase; /* base of flat frame buffer */
83
84 struct raster dc_raster; /* raster description */
85 struct rcons dc_rcons; /* raster blitter control info */
86
87 int dc_blanked; /* currently had video disabled */
88 void *dc_ramdac_private; /* RAMDAC private storage */
89
90 void (*dc_ramdac_intr) __P((void *));
91 };
92
93 struct tga_softc {
94 struct device sc_dev;
95
96 struct tga_devconfig *sc_dc; /* device configuration */
97 void *sc_intr; /* interrupt handler info */
98 /* XXX should record intr fns/arg */
99
100 int nscreens;
101 };
102
103 #define TGA_TYPE_T8_01 0 /* 8bpp, 1MB */
104 #define TGA_TYPE_T8_02 1 /* 8bpp, 2MB */
105 #define TGA_TYPE_T8_22 2 /* 8bpp, 4MB */
106 #define TGA_TYPE_T8_44 3 /* 8bpp, 8MB */
107 #define TGA_TYPE_T32_04 4 /* 32bpp, 4MB */
108 #define TGA_TYPE_T32_08 5 /* 32bpp, 8MB */
109 #define TGA_TYPE_T32_88 6 /* 32bpp, 16MB */
110 #define TGA_TYPE_UNKNOWN 7 /* unknown */
111
112 #define DEVICE_IS_TGA(class, id) \
113 (((PCI_VENDOR(id) == PCI_VENDOR_DEC && \
114 PCI_PRODUCT(id) == PCI_PRODUCT_DEC_21030) || \
115 PCI_PRODUCT(id) == PCI_PRODUCT_DEC_PBXGB) ? 10 : 0)
116
117 int tga_cnattach __P((bus_space_tag_t, bus_space_tag_t, pci_chipset_tag_t,
118 int, int, int));
119
120 int tga_identify __P((tga_reg_t *));
121 const struct tga_conf *tga_getconf __P((int));
122
123 int tga_builtin_set_cursor __P((struct tga_devconfig *,
124 struct wsdisplay_cursor *));
125 int tga_builtin_get_cursor __P((struct tga_devconfig *,
126 struct wsdisplay_cursor *));
127 int tga_builtin_set_curpos __P((struct tga_devconfig *,
128 struct wsdisplay_curpos *));
129 int tga_builtin_get_curpos __P((struct tga_devconfig *,
130 struct wsdisplay_curpos *));
131 int tga_builtin_get_curmax __P((struct tga_devconfig *,
132 struct wsdisplay_curpos *));
133