2 #include "../port/lib.h"
7 #include "../port/pci.h"
8 #include "../port/error.h"
22 cyber938xpageset(VGAscr*, int page)
35 cyber938xpage(VGAscr* scr, int page)
38 cyber938xpageset(scr, page);
39 unlock(&scr->devlock);
43 cyber938xlinear(VGAscr* scr, int, int)
57 * Heuristic to detect the MMIO space. We're flying blind
58 * here, with only the XFree86 source to guide us.
60 if(p->mem[1].size == 0x20000 && (p->mem[1].bar & 1) == 0)
61 scr->mmio = vmap(p->mem[1].bar & ~0x0F, p->mem[1].size);
64 addvgaseg("cyber938xscreen", scr->paddr, scr->apsize);
66 addvgaseg("cyber938xmmio", p->mem[1].bar&~0x0F, 0x20000);
70 cyber938xcurdisable(VGAscr*)
72 vgaxo(Crtx, 0x50, CursorOFF);
76 cyber938xcurload(VGAscr* scr, Cursor* curs)
79 int islinear, opage, y;
81 cyber938xcurdisable(scr);
85 islinear = vgaxi(Crtx, 0x21) & 0x20;
88 opage = cyber938xpageset(scr, scr->storage>>16);
89 p += (scr->storage & 0xFFFF);
94 for(y = 0; y < 16; y++){
95 *p++ = curs->set[2*y]|curs->clr[2*y];
96 *p++ = curs->set[2*y + 1]|curs->clr[2*y + 1];
99 *p++ = curs->set[2*y];
100 *p++ = curs->set[2*y + 1];
104 memset(p, 0, (32-y)*8);
107 cyber938xpageset(scr, opage);
108 unlock(&scr->devlock);
112 * Save the cursor hotpoint and enable the cursor.
114 scr->offset = curs->offset;
115 vgaxo(Crtx, 0x50, CursorON);
119 cyber938xcurmove(VGAscr* scr, Point p)
124 * Mustn't position the cursor offscreen even partially,
125 * or it might disappear. Therefore, if x or y is -ve, adjust the
126 * cursor origins instead.
128 if((x = p.x+scr->offset.x) < 0){
134 if((y = p.y+scr->offset.y) < 0){
142 * Load the new values.
144 vgaxo(Crtx, 0x46, xo);
145 vgaxo(Crtx, 0x47, yo);
146 vgaxo(Crtx, 0x40, x & 0xFF);
147 vgaxo(Crtx, 0x41, (x>>8) & 0xFF);
148 vgaxo(Crtx, 0x42, y & 0xFF);
149 vgaxo(Crtx, 0x43, (y>>8) & 0xFF);
155 cyber938xcurenable(VGAscr* scr)
160 cyber938xcurdisable(scr);
165 for(i = 0x48; i < 0x4C; i++)
166 vgaxo(Crtx, i, 0x00);
167 for(i = 0x4C; i < 0x50; i++)
168 vgaxo(Crtx, i, 0xFF);
171 * Find a place for the cursor data in display memory.
173 storage = ((scr->pitch*scr->height+1023)/1024);
174 vgaxo(Crtx, 0x44, storage & 0xFF);
175 vgaxo(Crtx, 0x45, (storage>>8) & 0xFF);
177 scr->storage = storage;
180 * Load, locate and enable the 32x32 cursor.
181 * (64x64 is bit 0, X11 format is bit 6 and cursor
182 * enable is bit 7). Bit 3 needs to be set on 9382
183 * chips otherwise even the white bits are black.
185 cyber938xcurload(scr, &cursor);
186 cyber938xcurmove(scr, ZP);
187 vgaxo(Crtx, 0x50, CursorON);
190 VGAdev vgacyber938xdev = {
195 cyber938xpage, /* page */
196 cyber938xlinear, /* linear */
200 VGAcur vgacyber938xcur = {
203 cyber938xcurenable, /* enable */
204 cyber938xcurdisable, /* disable */
205 cyber938xcurload, /* load */
206 cyber938xcurmove, /* move */