1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 #include <dev/ic/ramdac.h>
32 #include <dev/pci/tgareg.h>
33 #include <dev/wscons/wsconsio.h>
34 #include <dev/wscons/wsdisplayvar.h>
35 #include <dev/rasops/rasops.h>
36
37 struct tga_devconfig;
38 struct fbcmap;
39 struct fbcursor;
40 struct fbcurpos;
41
42 struct tga_conf {
43 char *tgac_name;
44
45 struct ramdac_funcs *(*ramdac_funcs)(void);
46
47 int tgac_phys_depth;
48 vsize_t tgac_cspace_size;
49 vsize_t tgac_vvbr_units;
50
51 int tgac_ndbuf;
52 vaddr_t tgac_dbuf[2];
53 vsize_t tgac_dbufsz[2];
54
55 int tgac_nbbuf;
56 vaddr_t tgac_bbuf[2];
57 vsize_t tgac_bbufsz[2];
58 };
59
60 struct tga_devconfig {
61 bus_space_tag_t dc_memt;
62 bus_space_handle_t dc_memh;
63
64 pcitag_t dc_pcitag;
65 bus_addr_t dc_pcipaddr;
66
67 bus_space_handle_t dc_regs;
68
69 int dc_tga_type;
70 int dc_tga2;
71 const struct tga_conf *dc_tgaconf;
72
73 struct ramdac_funcs
74 *dc_ramdac_funcs;
75 struct ramdac_cookie
76 *dc_ramdac_cookie;
77
78 vaddr_t dc_vaddr;
79 paddr_t dc_paddr;
80
81 int dc_wid;
82 int dc_ht;
83 int dc_rowbytes;
84
85 vaddr_t dc_videobase;
86
87 struct rasops_info dc_rinfo;
88
89 int dc_blanked;
90 void *dc_ramdac_private;
91
92 void (*dc_ramdac_intr)(void *);
93 int dc_intrenabled;
94 };
95
96 struct tga_softc {
97 struct device sc_dev;
98
99 struct tga_devconfig *sc_dc;
100 void *sc_intr;
101 u_int sc_mode;
102
103
104 int nscreens;
105 };
106
107 #define TGA_TYPE_T8_01 0
108 #define TGA_TYPE_T8_02 1
109 #define TGA_TYPE_T8_22 2
110 #define TGA_TYPE_T8_44 3
111 #define TGA_TYPE_T32_04 4
112 #define TGA_TYPE_T32_08 5
113 #define TGA_TYPE_T32_88 6
114 #define TGA_TYPE_POWERSTORM_4D20 7
115 #define TGA_TYPE_UNKNOWN 8
116
117 #define DEVICE_IS_TGA(class, id) \
118 (((PCI_VENDOR(id) == PCI_VENDOR_DEC && \
119 PCI_PRODUCT(id) == PCI_PRODUCT_DEC_21030) || \
120 PCI_PRODUCT(id) == PCI_PRODUCT_DEC_PBXGB) ? 10 : 0)
121
122 int tga_cnattach(bus_space_tag_t, bus_space_tag_t, pci_chipset_tag_t,
123 int, int, int);
124
125 int tga_identify(struct tga_devconfig *);
126 const struct tga_conf *tga_getconf(int);
127
128 int tga_builtin_set_cursor(struct tga_devconfig *,
129 struct wsdisplay_cursor *);
130 int tga_builtin_get_cursor(struct tga_devconfig *,
131 struct wsdisplay_cursor *);
132 int tga_builtin_set_curpos(struct tga_devconfig *,
133 struct wsdisplay_curpos *);
134 int tga_builtin_get_curpos(struct tga_devconfig *,
135 struct wsdisplay_curpos *);
136 int tga_builtin_get_curmax(struct tga_devconfig *,
137 struct wsdisplay_curpos *);
138
139
140 #define TGARREG(dc,reg) (bus_space_read_4((dc)->dc_memt, (dc)->dc_regs, \
141 (reg) << 2))
142
143
144 #define TGAWREG(dc,reg,val) bus_space_write_4((dc)->dc_memt, (dc)->dc_regs, \
145 (reg) << 2, (val))
146
147
148 #define TGAWALREG(dc,reg,alias,val) bus_space_write_4( \
149 (dc)->dc_memt, (dc)->dc_regs, \
150 ((alias) * TGA_CREGS_ALIAS) + ((reg) << 2), \
151 (val))
152
153
154 #define TGAREGWB(dc,reg, nregs) bus_space_barrier( \
155 (dc)->dc_memt, (dc)->dc_regs, \
156 ((reg) << 2), 4 * (nregs), BUS_SPACE_BARRIER_WRITE)
157
158
159 #define TGAREGRB(dc,reg, nregs) bus_space_barrier( \
160 (dc)->dc_memt, (dc)->dc_regs, \
161 ((reg) << 2), 4 * (nregs), BUS_SPACE_BARRIER_READ)
162
163
164 #define TGAREGRWB(dc,reg, nregs) bus_space_barrier( \
165 (dc)->dc_memt, (dc)->dc_regs, \
166 ((reg) << 2), 4 * (nregs), \
167 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE)