2 #include "../port/lib.h"
7 #include "../port/error.h"
32 i81xblank(VGAscr *scr, int blank)
34 char *srx, *srxd, *dpms;
37 srx = (char *)scr->mmio+SRX;
39 dpms = (char *)scr->mmio+DPMSsync;
54 i81xenable(VGAscr* scr)
59 ulong *pgtbl, *rp, cursor, *pte, fbuf, fbend;
66 scr->mmio = vmap(p->mem[1].bar & ~0x0F, p->mem[1].size);
69 addvgaseg("i81xmmio", p->mem[1].bar&~0x0F, p->mem[1].size);
71 /* allocate page table */
72 pgtbl = xspanalloc(64*1024, BY2PG, 0);
73 scr->mmio[0x2020/4] = PADDR(pgtbl) | 1;
75 size = p->mem[0].size;
78 vgalinearaddr(scr, p->mem[0].bar&~0xF, size);
79 addvgaseg("i81xscreen", p->mem[0].bar&~0xF, size);
82 * allocate backing store for frame buffer
83 * and populate device page tables.
85 fbuf = PADDR(xspanalloc(size, BY2PG, 0));
86 fbend = PGROUND(fbuf+size);
87 rp = scr->mmio+0x10000/4;
94 * allocate space for the cursor data in system memory.
97 cursor = (ulong)xspanalloc(BY2PG, BY2PG, 0);
99 pte = mmuwalk(mach0->pdb, cursor, 2, 0);
101 panic("i81x cursor mmuwalk");
103 scr->storage = cursor;
105 scr->blank = i81xblank;
110 i81xcurdisable(VGAscr* scr)
116 hwcurs = (void*)((uchar*)scr->mmio+hwCur);
117 hwcurs->ctl = (1<<4);
121 i81xcurload(VGAscr* scr, Cursor* curs)
129 hwcurs = (void*)((uchar*)scr->mmio+hwCur);
132 * Disable the cursor then load the new image in
133 * the top-left of the 32x32 array.
134 * Unused portions of the image have been initialised to be
137 hwcurs->ctl = (1<<4);
138 p = (uchar*)scr->storage;
139 for(y = 0; y < 16; y += 2) {
140 *p++ = ~(curs->clr[2*y]|curs->set[2*y]);
141 *p++ = ~(curs->clr[2*y+1]|curs->set[2*y+1]);
143 *p++ = ~(curs->clr[2*y+2]|curs->set[2*y+2]);
144 *p++ = ~(curs->clr[2*y+3]|curs->set[2*y+3]);
146 *p++ = curs->set[2*y];
147 *p++ = curs->set[2*y+1];
149 *p++ = curs->set[2*y+2];
150 *p++ = curs->set[2*y+3];
155 * Save the cursor hotpoint and enable the cursor.
156 * The 0,0 cursor point is top-left.
158 scr->offset.x = curs->offset.x;
159 scr->offset.y = curs->offset.y;
160 hwcurs->ctl = (1<<4)|1;
164 i81xcurmove(VGAscr* scr, Point p)
172 hwcurs = (void*)((uchar*)scr->mmio+hwCur);
174 x = p.x+scr->offset.x;
175 y = p.y+scr->offset.y;
185 pos |= ((y&0x7ff)<<16)|(x&0x7ff);
192 i81xcurenable(VGAscr* scr)
201 hwcurs = (void*)((uchar*)scr->mmio+hwCur);
204 * Initialise the 32x32 cursor to be transparent in 2bpp mode.
206 hwcurs->base = PADDR(scr->storage);
207 p = (uchar*)scr->storage;
208 for(i = 0; i < 32/2; i++) {
214 * Load, locate and enable the 32x32 cursor in 2bpp mode.
216 i81xcurload(scr, &arrow);
217 i81xcurmove(scr, ZP);
220 VGAdev vgai81xdev = {
229 VGAcur vgai81xcur = {