tgavar.h revision 1.2 1 /* $NetBSD: tgavar.h,v 1.2 1998/08/13 02:10:55 eeh 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/pci/tgareg.h>
31 #include <dev/rcons/raster.h>
32 #include <dev/wscons/wsconsio.h>
33 #include <dev/wscons/wscons_raster.h>
34
35 struct tga_devconfig;
36 struct fbcmap;
37 struct fbcursor;
38 struct fbcurpos;
39
40 struct tga_ramdac_conf {
41 char *tgar_name;
42 void (*tgar_init) __P((struct tga_devconfig *, int));
43 int (*tgar_intr) __P((void *));
44 int (*tgar_set_cmap) __P((struct tga_devconfig *,
45 struct wsdisplay_cmap *));
46 int (*tgar_get_cmap) __P((struct tga_devconfig *,
47 struct wsdisplay_cmap *));
48 int (*tgar_set_cursor) __P((struct tga_devconfig *,
49 struct wsdisplay_cursor *));
50 int (*tgar_get_cursor) __P((struct tga_devconfig *,
51 struct wsdisplay_cursor *));
52 int (*tgar_set_curpos) __P((struct tga_devconfig *,
53 struct wsdisplay_curpos *));
54 int (*tgar_get_curpos) __P((struct tga_devconfig *,
55 struct wsdisplay_curpos *));
56 int (*tgar_get_curmax) __P((struct tga_devconfig *,
57 struct wsdisplay_curpos *));
58 };
59
60 struct tga_conf {
61 char *tgac_name; /* name for this board type */
62
63 const struct tga_ramdac_conf
64 *tgac_ramdac; /* the RAMDAC type; see above */
65 int tgac_phys_depth; /* physical frame buffer depth */
66 vsize_t tgac_cspace_size; /* core space size */
67 vsize_t tgac_vvbr_units; /* what '1' in the VVBR means */
68
69 int tgac_ndbuf; /* number of display buffers */
70 vaddr_t tgac_dbuf[2]; /* display buffer offsets/addresses */
71 vsize_t tgac_dbufsz[2]; /* display buffer sizes */
72
73 int tgac_nbbuf; /* number of display buffers */
74 vaddr_t tgac_bbuf[2]; /* back buffer offsets/addresses */
75 vsize_t tgac_bbufsz[2]; /* back buffer sizes */
76 };
77
78 struct tga_devconfig {
79 bus_space_tag_t dc_memt;
80 pci_chipset_tag_t dc_pc;
81
82 pcitag_t dc_pcitag; /* PCI tag */
83 bus_addr_t dc_pcipaddr; /* PCI phys addr. */
84
85 tga_reg_t *dc_regs; /* registers; XXX: need aliases */
86
87 int dc_tga_type; /* the device type; see below */
88 const struct tga_conf *dc_tgaconf; /* device buffer configuration */
89
90 vaddr_t dc_vaddr; /* memory space virtual base address */
91 paddr_t dc_paddr; /* memory space physical base address */
92
93 int dc_wid; /* width of frame buffer */
94 int dc_ht; /* height of frame buffer */
95 int dc_rowbytes; /* bytes in a FB scan line */
96
97 vaddr_t dc_videobase; /* base of flat frame buffer */
98
99 struct raster dc_raster; /* raster description */
100 struct rcons dc_rcons; /* raster blitter control info */
101
102 int dc_blanked; /* currently had video disabled */
103 void *dc_ramdac_private; /* RAMDAC private storage */
104 };
105
106 struct tga_softc {
107 struct device sc_dev;
108
109 struct tga_devconfig *sc_dc; /* device configuration */
110 void *sc_intr; /* interrupt handler info */
111 /* XXX should record intr fns/arg */
112
113 int nscreens;
114 };
115
116 #define TGA_TYPE_T8_01 0 /* 8bpp, 1MB */
117 #define TGA_TYPE_T8_02 1 /* 8bpp, 2MB */
118 #define TGA_TYPE_T8_22 2 /* 8bpp, 4MB */
119 #define TGA_TYPE_T8_44 3 /* 8bpp, 8MB */
120 #define TGA_TYPE_T32_04 4 /* 32bpp, 4MB */
121 #define TGA_TYPE_T32_08 5 /* 32bpp, 8MB */
122 #define TGA_TYPE_T32_88 6 /* 32bpp, 16MB */
123 #define TGA_TYPE_UNKNOWN 7 /* unknown */
124
125 #define DEVICE_IS_TGA(class, id) \
126 ((PCI_VENDOR(id) == PCI_VENDOR_DEC && \
127 PCI_PRODUCT(id) == PCI_PRODUCT_DEC_21030) ? 10 : 0)
128
129 int tga_cnattach __P((bus_space_tag_t, bus_space_tag_t, pci_chipset_tag_t,
130 int, int, int));
131
132 int tga_identify __P((tga_reg_t *));
133 const struct tga_conf *tga_getconf __P((int));
134
135 extern const struct tga_ramdac_conf tga_ramdac_bt463;
136 extern const struct tga_ramdac_conf tga_ramdac_bt485;
137
138 int tga_builtin_set_cursor __P((struct tga_devconfig *,
139 struct wsdisplay_cursor *));
140 int tga_builtin_get_cursor __P((struct tga_devconfig *,
141 struct wsdisplay_cursor *));
142 int tga_builtin_set_curpos __P((struct tga_devconfig *,
143 struct wsdisplay_curpos *));
144 int tga_builtin_get_curpos __P((struct tga_devconfig *,
145 struct wsdisplay_curpos *));
146 int tga_builtin_get_curmax __P((struct tga_devconfig *,
147 struct wsdisplay_curpos *));
148