2 #include "../port/lib.h"
7 #include "../port/pci.h"
8 #include "../port/error.h"
17 Xrx = 0x3D6, /* Configuration Extensions Index */
21 hiqvideoxi(long port, uchar index)
32 hiqvideoxo(long port, uchar index, uchar data)
39 hiqvideolinear(VGAscr*, int, int)
44 hiqvideoenable(VGAscr* scr)
50 * Only once, can't be disabled for now.
55 if(p == nil || p->vid != 0x102C)
58 case 0x00C0: /* 69000 HiQVideo */
61 case 0x00E0: /* 65550 HiQV32 */
62 case 0x00E4: /* 65554 HiQV32 */
63 case 0x00E5: /* 65555 HiQV32 */
64 switch((hiqvideoxi(Xrx, 0x43)>>1) & 0x03){
80 addvgaseg("hiqvideoscreen", scr->paddr, scr->apsize);
83 * Find a place for the cursor data in display memory.
84 * Must be on a 4096-byte boundary.
85 * scr->mmio holds the virtual address of the cursor
86 * storage area in the framebuffer region.
88 scr->storage = vmsize-4096;
89 scr->mmio = (ulong*)((uchar*)scr->vaddr+scr->storage);
93 hiqvideocurdisable(VGAscr*)
95 hiqvideoxo(Xrx, 0xA0, 0x10);
99 hiqvideocurload(VGAscr* scr, Cursor* curs)
105 * Disable the cursor.
107 hiqvideocurdisable(scr);
111 p = (uchar*)scr->mmio;
113 for(y = 0; y < 16; y += 2){
114 *p++ = ~(curs->clr[2*y]|curs->set[2*y]);
115 *p++ = ~(curs->clr[2*y+1]|curs->set[2*y+1]);
118 *p++ = ~(curs->clr[2*y+2]|curs->set[2*y+2]);
119 *p++ = ~(curs->clr[2*y+3]|curs->set[2*y+3]);
122 *p++ = curs->set[2*y];
123 *p++ = curs->set[2*y+1];
126 *p++ = curs->set[2*y+2];
127 *p++ = curs->set[2*y+3];
132 for(x = 0; x < 64; x += 8)
134 for(x = 0; x < 64; x += 8)
140 * Save the cursor hotpoint and enable the cursor.
142 scr->offset = curs->offset;
143 hiqvideoxo(Xrx, 0xA0, 0x11);
147 hiqvideocurmove(VGAscr* scr, Point p)
154 if((x = p.x+scr->offset.x) < 0)
155 x = 0x8000|(-x & 0x07FF);
156 if((y = p.y+scr->offset.y) < 0)
157 y = 0x8000|(-y & 0x07FF);
159 hiqvideoxo(Xrx, 0xA4, x & 0xFF);
160 hiqvideoxo(Xrx, 0xA5, (x>>8) & 0xFF);
161 hiqvideoxo(Xrx, 0xA6, y & 0xFF);
162 hiqvideoxo(Xrx, 0xA7, (y>>8) & 0xFF);
168 hiqvideocurenable(VGAscr* scr)
177 * Disable the cursor.
179 hiqvideocurdisable(scr);
183 * Can't call setcolor here as cursor is already locked.
184 * When done make sure the cursor enable in Xr80 is set.
186 xr80 = hiqvideoxi(Xrx, 0x80);
187 hiqvideoxo(Xrx, 0x80, xr80|0x01);
195 hiqvideoxo(Xrx, 0x80, xr80|0x10);
197 hiqvideoxo(Xrx, 0xA2, (scr->storage>>12)<<4);
198 hiqvideoxo(Xrx, 0xA3, (scr->storage>>16) & 0x3F);
201 * Load, locate and enable the 32x32 cursor.
202 * Cursor enable in Xr80 better be set already.
204 hiqvideocurload(scr, &cursor);
205 hiqvideocurmove(scr, ZP);
206 hiqvideoxo(Xrx, 0xA0, 0x11);
209 VGAdev vgahiqvideodev = {
212 hiqvideoenable, /* enable */
215 hiqvideolinear, /* linear */
218 VGAcur vgahiqvideocur = {
221 hiqvideocurenable, /* enable */
222 hiqvideocurdisable, /* disable */
223 hiqvideocurload, /* load */
224 hiqvideocurmove, /* move */