Subversion Repositories shark

Rev

Rev 132 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
132 giacomo 1
/*
2
*/
3
 
4
#include <stdlib.h>
5
#include <stdio.h>              /* for printf */
6
#include <string.h>             /* for memset */
7
#include <unistd.h>
8
//#include <sys/mman.h>         /* for mmap */
9
#include "vga.h"
10
#include "libvga.h"
11
#include "driver.h"
12
 
13
/* New style driver interface. */
14
#include "timing.h"
15
#include "vgaregs.h"
16
#include "interface.h"
17
#include "lrmi.h"
18
#include "vbe.h"
19
#define VESAREG_SAVE(i) (VGA_TOTAL_REGS+i)
20
#define VESA_TOTAL_REGS (VGA_TOTAL_REGS + 4024)
21
 
22
/* #define VESA_savebitmap 0x0e */
23
int __svgalib_VESA_savebitmap=0x0e;
24
int __svgalib_VESA_textmode=3;
25
 
26
static int vesa_init(int, int, int);
27
static void vesa_unlock(void);
28
 
29
static int vesa_memory,vesa_chiptype;
30
static int vesa_is_linear, vesa_logical_width, vesa_bpp, vesa_granularity;
31
static int vesa_regs_size, vesa_linear_base, vesa_last_mode_set;
32
static struct LRMI_regs vesa_r;
33
static int vesa_read_write, vesa_read_window, vesa_write_window;
34
static void * LRMI_mem1, * LRMI_mem2;
35
 
36
static CardSpecs *cardspecs;
37
static struct
38
        {
39
        struct vbe_info_block *info;
40
        struct vbe_mode_info_block *mode;
41
        } vesa_data;
42
 
43
static int SVGALIB_VESA[__GLASTMODE+1];
44
 
45
static void vesa_setpage(int page)
46
{
47
vesa_r.eax=0x4f05;
48
vesa_r.ebx=0;
49
vesa_r.edx=page*64/vesa_granularity;
50
__svgalib_LRMI_int(0x10,&vesa_r);
51
 
52
if(vesa_read_write){
53
   vesa_r.eax=0x4f05;
54
   vesa_r.ebx=1;
55
   vesa_r.edx=page*64/vesa_granularity;
56
   __svgalib_LRMI_int(0x10,&vesa_r);
57
};
58
}
59
 
60
 
61
static int __svgalib_vesa_inlinearmode(void)
62
{
63
return vesa_is_linear;
64
}
65
 
66
 
67
/* Fill in chipset specific mode information */
68
 
69
static void vesa_getmodeinfo(int mode, vga_modeinfo *modeinfo)
70
{
71
    if (IS_IN_STANDARD_VGA_DRIVER(mode))
72
        return __svgalib_vga_driverspecs.getmodeinfo(mode, modeinfo);
73
 
74
    if(modeinfo->colors==16)return;
75
 
76
    modeinfo->maxpixels = vesa_memory*1024/modeinfo->bytesperpixel;
77
    modeinfo->maxlogicalwidth = 4088; /* just a guess, */
78
    modeinfo->startaddressrange = vesa_memory * 1024 - 1;
79
    modeinfo->haveblit = 0;
80
    modeinfo->flags &= ~HAVE_RWPAGE;
81
    modeinfo->flags |= vesa_read_write;  /* sets HAVE_RWPAGE bit */
82
 
83
    /* for linear need VBE2 */
84
    if(vesa_chiptype>=1)
85
      if (modeinfo->bytesperpixel >= 1) {
86
        modeinfo->flags |= CAPABLE_LINEAR;
87
        if (__svgalib_vesa_inlinearmode())
88
            modeinfo->flags |= IS_LINEAR | LINEAR_MODE;
89
      }
90
 
91
    /* to get the logical scanline width */
92
    memset(&vesa_r, 0, sizeof(vesa_r));
93
 
94
    vesa_r.eax = 0x4f01;
95
    vesa_r.ecx = SVGALIB_VESA[mode];
96
    vesa_r.es = (unsigned int)vesa_data.mode >> 4;
97
    vesa_r.edi = (unsigned int)vesa_data.mode & 0xf;
98
 
99
    if (!__svgalib_LRMI_int(0x10, &vesa_r)) {
100
       printk(KERN_ERR "Can't get mode info (vm86 failure)\n");
101
       return;
102
    }
103
    modeinfo->linewidth = vesa_data.mode->bytes_per_scanline;
104
}
105
 
106
/* Read and save chipset-specific registers */
107
static int vesa_saveregs(uint8_t regs[])
108
{
109
  void * buf;
110
  buf=LRMI_mem1;
111
  vesa_r.eax=0x4f04;
112
  vesa_r.ebx=0;
113
  vesa_r.es=((long)buf)>>4;
114
  vesa_r.edx=1;
115
  vesa_r.ecx=__svgalib_VESA_savebitmap;
116
  __svgalib_LRMI_int(0x10,&vesa_r);
117
  memcpy(&regs[VGA_TOTAL_REGS],buf,vesa_regs_size);  
118
    return vesa_regs_size;
119
}
120
 
121
/* Set chipset-specific registers */
122
 
123
static void vesa_setregs(const uint8_t regs[], int mode)
124
{  
125
 
126
  void * buf;
127
  buf=LRMI_mem1;
128
  memcpy(buf,&regs[VGA_TOTAL_REGS],vesa_regs_size);  
129
  vesa_r.eax=0x4f04;
130
  vesa_r.ebx=0;
131
  vesa_r.es=((long)buf)>>4;
132
  vesa_r.edx=2;
133
  vesa_r.ecx=__svgalib_VESA_savebitmap;
134
  __svgalib_LRMI_int(0x10,&vesa_r);
135
}
136
 
137
 
138
/* Return nonzero if mode is available */
139
 
140
static int vesa_modeavailable(int mode)
141
{
142
    struct info *info;
143
    ModeTiming *modetiming;
144
    ModeInfo *modeinfo;
145
 
146
 
147
    if (IS_IN_STANDARD_VGA_DRIVER(mode))
148
        return __svgalib_vga_driverspecs.modeavailable(mode);
149
 
150
    info = &__svgalib_infotable[mode];
151
 
152
    modeinfo = __svgalib_createModeInfoStructureForSvgalibMode(mode);
153
 
154
    modetiming = malloc(sizeof(ModeTiming));
155
    if (__svgalib_getmodetiming(modetiming, modeinfo, cardspecs)) {
156
        free(modetiming);
157
        free(modeinfo);
158
        return 0;
159
    }
160
    free(modetiming);
161
    free(modeinfo);
162
 
163
return SVGALIB_VESA[mode];
164
}
165
 
166
 
167
static int vesa_setmode(int mode, int prv_mode)
168
{
169
    vesa_bpp=1;
170
    vesa_granularity=1;
171
    if (IS_IN_STANDARD_VGA_DRIVER(mode)) {
172
 
173
        if(__svgalib_vesatext){
174
            vesa_r.eax=0x4f02; /* make sure we are in a regular VGA mode before we start */
175
            vesa_r.ebx=__svgalib_VESA_textmode;    /* without this, if we start in SVGA mode the result might */
176
            __svgalib_LRMI_int(0x10,&vesa_r); /* be something weird */
177
        };
178
        return __svgalib_vga_driverspecs.setmode(mode, prv_mode);
179
    }
180
    if (!vesa_modeavailable(mode)) return 1;
181
    vesa_r.eax=0x4f02;
182
    vesa_r.ebx=SVGALIB_VESA[mode]|0x8000|(vesa_is_linear*0x4000);
183
    vesa_last_mode_set=vesa_r.ebx;
184
    __svgalib_LRMI_int(0x10,&vesa_r);
185
 
186
    vesa_data.info = LRMI_mem2 ;
187
    vesa_data.mode = (struct vbe_mode_info_block *)(vesa_data.info + 1);
188
    vesa_r.eax = 0x4f01;
189
    vesa_r.ecx=SVGALIB_VESA[mode];
190
    vesa_r.es = (unsigned int)vesa_data.mode >> 4;
191
    vesa_r.edi = (unsigned int)vesa_data.mode&0xf;    
192
    __svgalib_LRMI_int(0x10, &vesa_r);
193
    vesa_logical_width=vesa_data.mode->bytes_per_scanline;
194
    vesa_bpp=(vesa_data.mode->bits_per_pixel+7)/8;
195
    if(vesa_logical_width==0) vesa_logical_width=vesa_bpp*vesa_data.mode->x_resolution;
196
                                                /* if not reported then guess */
197
    vesa_granularity=vesa_data.mode->win_granularity;
198
    if(vesa_granularity==0)vesa_granularity=64; /* if not reported then guess */
199
    if(vesa_chiptype>=1)vesa_linear_base=vesa_data.mode->phys_base_ptr;
200
    vesa_read_write=0;
201
    vesa_read_window=0;
202
    vesa_write_window=0;
203
    if((vesa_data.mode->win_a_attributes&6)!=6){
204
        vesa_read_write=1;
205
        if ((vesa_data.mode->win_b_attributes&2) == 2) vesa_read_window=1;
206
        if ((vesa_data.mode->win_b_attributes&4) == 4) vesa_write_window=1;
207
    }
208
    return 0;
209
}
210
 
211
 
212
/* Unlock chipset-specific registers */
213
 
214
static void vesa_unlock(void)
215
{
216
}
217
 
218
 
219
/* Relock chipset-specific registers */
220
/* (currently not used) */
221
 
222
static void vesa_lock(void)
223
{
224
}
225
 
226
 
227
/* Indentify chipset, initialize and return non-zero if detected */
228
 
229
int vesa_test(void)
230
{
231
        __svgalib_LRMI_init();
161 giacomo 232
        LRMI_mem2 = __svgalib_LRMI_alloc_real(sizeof(struct vbe_info_block)
132 giacomo 233
                                        + sizeof(struct vbe_mode_info_block));
234
        vesa_data.info = LRMI_mem2;
235
        vesa_data.mode = (struct vbe_mode_info_block *)(vesa_data.info + 1);
236
        vesa_r.eax = 0x4f00;
237
        vesa_r.es = (unsigned int)vesa_data.info >> 4;
238
        vesa_r.edi = 0;
239
 
161 giacomo 240
        __svgalib_LRMI_free_real(LRMI_mem2,sizeof(void *));
132 giacomo 241
 
242
        __svgalib_LRMI_int(0x10, &vesa_r);
243
        if (vesa_r.eax!=0x4f) return 0;
244
        return !vesa_init(0,0,0);
245
}
246
 
247
 
248
/* No r/w paging */
249
static void vesa_setrdpage(int page)
250
{
251
vesa_r.eax=0x4f05;
252
vesa_r.ebx=vesa_read_window;
253
vesa_r.edx=page*64/vesa_granularity;
254
__svgalib_LRMI_int(0x10,&vesa_r);
255
}
256
static void vesa_setwrpage(int page)
257
{
258
vesa_r.eax=0x4f05;
259
vesa_r.ebx=vesa_write_window;
260
vesa_r.edx=page*64/vesa_granularity;
261
__svgalib_LRMI_int(0x10,&vesa_r);
262
}
263
 
264
 
265
/* Set display start address (not for 16 color modes) */
266
 
267
static void vesa_setdisplaystart(int address)
268
{
269
  vesa_r.eax=0x4f07;
270
  vesa_r.ebx=0;
271
  vesa_r.ecx=address % vesa_logical_width;
272
  vesa_r.edx=address / vesa_logical_width;
273
 
274
  __svgalib_LRMI_int(0x10,&vesa_r);
275
 
276
}
277
 
278
/* Set logical scanline length (usually multiple of 8) */
279
 
280
static void vesa_setlogicalwidth(int width)
281
{
282
  vesa_r.eax=0x4f06;
283
  vesa_r.ebx=0;
284
  vesa_r.ecx=width / vesa_bpp ;
285
  __svgalib_LRMI_int(0x10,&vesa_r);
286
  vesa_logical_width=vesa_r.ebx;
287
 
288
}
289
 
290
static int vesa_linear(int op, int param)
291
{
292
if (op==LINEAR_ENABLE) {  
293
  vesa_r.eax=0x4f02;
294
  vesa_r.ebx=vesa_last_mode_set|0x4000;
295
  __svgalib_LRMI_int(0x10,&vesa_r);
296
  vesa_is_linear=1;
297
};
298
 
299
if (op==LINEAR_DISABLE){
300
  vesa_r.eax=0x4f02;
301
  vesa_r.ebx=vesa_last_mode_set;
302
  __svgalib_LRMI_int(0x10,&vesa_r);
303
  vesa_is_linear=0;
304
};
305
if (op==LINEAR_QUERY_BASE) {return vesa_linear_base ;}
306
if (op == LINEAR_QUERY_RANGE || op == LINEAR_QUERY_GRANULARITY) return 0;               /* No granularity or range. */
307
    else return -1;             /* Unknown function. */
308
}
309
 
310
static int vesa_match_programmable_clock(int clock)
311
{
312
return clock ;
313
}
314
static int vesa_map_clock(int bpp, int clock)
315
{
316
return clock ;
317
}
318
static int vesa_map_horizontal_crtc(int bpp, int pixelclock, int htiming)
319
{
320
return htiming;
321
}
322
/* Function table (exported) */
323
 
324
DriverSpecs __svgalib_vesa_driverspecs =
325
{
326
    vesa_saveregs,
327
    vesa_setregs,
328
    vesa_unlock,
329
    vesa_lock,
330
    vesa_test,
331
    vesa_init,
332
    vesa_setpage,
333
    vesa_setrdpage,
334
    vesa_setwrpage,
335
    vesa_setmode,
336
    vesa_modeavailable,
337
    vesa_setdisplaystart,
338
    vesa_setlogicalwidth,
339
    vesa_getmodeinfo,
340
    0,                          /* old blit funcs */
341
    0,
342
    0,
343
    0,
344
    0,
345
    0,                          /* ext_set */
346
    0,                          /* accel */
347
    vesa_linear,
348
    0,                          /* accelspecs, filled in during init. */
349
    NULL,                       /* Emulation */
350
};
351
 
352
/* Initialize chipset (called after detection) */
353
 
354
static int vesa_init(int force, int par1, int par2)
355
{  
356
    short int *mode_list;
357
    int i;
161 giacomo 358
#if 0
359
    uint8_t *m;
360
    int address;
361
 
362
    m=mmap(0,0x502,PROT_READ,MAP_SHARED,__svgalib_mem_fd,0);
132 giacomo 363
 
161 giacomo 364
    address=((long)*(unsigned short *)(m+64))+(((long)*(unsigned short *)(m+66))<<4);
365
    if((address<0xa0000)||(address>0xfffff)) {
366
        fprintf(stderr, "Real mode int 0x10 at 0x%08x handler not in ROM.\n",address);
367
        fprintf(stderr, "Try running vga_reset.\n");
368
        return 1;
369
    };
370
#endif
132 giacomo 371
    __svgalib_textprog|=1;
372
 
373
    /* Get I/O priviledge */
374
 
375
    if (force) {
376
        vesa_memory = par1;
377
        vesa_chiptype = par2;
378
    } else {
379
        vesa_memory=4096;
380
    };
381
 
161 giacomo 382
    __svgalib_LRMI_init();
383
    for(i=0;i<__GLASTMODE;i++)SVGALIB_VESA[i]=IS_IN_STANDARD_VGA_DRIVER(i);
384
 
132 giacomo 385
    vesa_data.info = __svgalib_LRMI_alloc_real(sizeof(struct vbe_info_block)
386
         + sizeof(struct vbe_mode_info_block));
387
    vesa_data.mode = (struct vbe_mode_info_block *)(vesa_data.info + 1);
388
    vesa_r.eax = 0x4f00;
389
    vesa_r.es = (unsigned int)vesa_data.info >> 4;
390
    vesa_r.edi = 0;
391
 
392
    memcpy(vesa_data.info->vbe_signature, "VBE2", 4);
393
 
394
    __svgalib_LRMI_int(0x10, &vesa_r);
395
 
396
    if ((vesa_r.eax & 0xffff) != 0x4f || strncmp(vesa_data.info->vbe_signature, "VESA", 4) != 0) {
397
        printk(KERN_ERR "No VESA bios detected!\n");
161 giacomo 398
        printk(KERN_ERR"Try running vga_reset.\n");
132 giacomo 399
        return 1;
400
    }
161 giacomo 401
 
132 giacomo 402
    if(vesa_data.info->vbe_version>=0x0200)vesa_chiptype=1 ; else vesa_chiptype=0;
403
    if(vesa_data.info->vbe_version>=0x0300)vesa_chiptype=2 ;
404
 
405
    vesa_memory = vesa_data.info->total_memory*64;
406
 
407
    mode_list = (short int *)(vesa_data.info->video_mode_list_seg * 16 + vesa_data.info->video_mode_list_off);
408
 
409
    while (*mode_list != -1) {
410
       memset(&vesa_r, 0, sizeof(vesa_r));
411
 
412
       vesa_r.eax = 0x4f01;
413
       vesa_r.ecx = *mode_list;
414
       vesa_r.es = (unsigned int)vesa_data.mode >> 4;
415
       vesa_r.edi = (unsigned int)vesa_data.mode & 0xf;
416
 
417
       if((vesa_chiptype>=1)&&(vesa_data.mode->mode_attributes&0x80))
418
          vesa_linear_base=vesa_data.mode->phys_base_ptr;
419
       if (!__svgalib_LRMI_int(0x10, &vesa_r)) {
420
          printk(KERN_ERR "Can't get mode info (vm86 failure)\n");
421
          return 1;
422
       }
161 giacomo 423
#if 1
132 giacomo 424
       for(i=0;i<=__GLASTMODE;i++)
425
          if((infotable[i].xdim==vesa_data.mode->x_resolution)&&
426
             (infotable[i].ydim==vesa_data.mode->y_resolution)&&
427
             (((vesa_data.mode->rsvd_mask_size==8)&&(infotable[i].bytesperpixel==4))||
428
              ((vesa_data.mode->bits_per_pixel==32)&&(infotable[i].bytesperpixel==4))||
429
              ((vesa_data.mode->bits_per_pixel==24)&&(infotable[i].bytesperpixel==3))||
430
              ((vesa_data.mode->green_mask_size==5)&&(infotable[i].colors==32768))||
431
              ((vesa_data.mode->green_mask_size==6)&&(infotable[i].colors==65536))||
432
              ((vesa_data.mode->memory_model==VBE_MODEL_PLANAR)&&(infotable[i].colors==16))||
433
              ((vesa_data.mode->memory_model==VBE_MODEL_256)&&(infotable[i].colors==256))||
434
              ((vesa_data.mode->memory_model==VBE_MODEL_PACKED)&&
435
               (infotable[i].colors==256)&&(vesa_data.mode->bits_per_pixel==8)))){
436
                        SVGALIB_VESA[i]=*mode_list;
437
                        i=__GLASTMODE+1;
438
          };
439
 
161 giacomo 440
#else
441
       if (vesa_data.mode->memory_model == VBE_MODEL_RGB) {  
442
          if((vesa_data.mode->rsvd_mask_size==8)||(vesa_data.mode->bits_per_pixel==32)) {  
443
             switch(vesa_data.mode->y_resolution){
444
                case 200: if(vesa_data.mode->x_resolution==320)
445
                   SVGALIB_VESA[G320x200x16M32]=*mode_list; break;
446
                case 240: if(vesa_data.mode->x_resolution==320)
447
                   SVGALIB_VESA[G320x240x16M32]=*mode_list; break;
448
                case 300: if(vesa_data.mode->x_resolution==400)
449
                   SVGALIB_VESA[G400x300x16M32]=*mode_list; break;
450
                case 384: if(vesa_data.mode->x_resolution==512)
451
                   SVGALIB_VESA[G512x384x16M32]=*mode_list; break;
452
                case 480: if(vesa_data.mode->x_resolution==640)
453
                   SVGALIB_VESA[G640x480x16M32]=*mode_list; break;
454
                case 600: if(vesa_data.mode->x_resolution==800)
455
                   SVGALIB_VESA[G800x600x16M32]=*mode_list; break;
456
                case 720: if(vesa_data.mode->x_resolution==960)
457
                   SVGALIB_VESA[G960x720x16M32]=*mode_list; break;
458
                case 768: if(vesa_data.mode->x_resolution==1024)
459
                   SVGALIB_VESA[G1024x768x16M32]=*mode_list; break;
460
                case 864: if(vesa_data.mode->x_resolution==1152)
461
                    SVGALIB_VESA[G1152x864x16M32]=*mode_list; break;
462
                case 1024: if(vesa_data.mode->x_resolution==1280)
463
                    SVGALIB_VESA[G1280x1024x16M32]=*mode_list; break;
464
                case 1200: if(vesa_data.mode->x_resolution==1600)
465
                   SVGALIB_VESA[G1600x1200x16M32]=*mode_list; break;
466
                case 1440: if(vesa_data.mode->x_resolution==1920)
467
                   SVGALIB_VESA[G1920x1440x16M32]=*mode_list; break;
468
             }
469
          } else {  
470
              i=0;
471
              switch(vesa_data.mode->y_resolution){
472
                 case 200: if(vesa_data.mode->x_resolution==320)
473
                    i=G320x200x32K; break;
474
                 case 240: if(vesa_data.mode->x_resolution==320)
475
                    i=G320x240x32K; break;
476
                 case 300: if(vesa_data.mode->x_resolution==400)
477
                    i=G400x300x32K; break;
478
                 case 384: if(vesa_data.mode->x_resolution==512)
479
                    i=G512x384x32K; break;
480
                 case 480: if(vesa_data.mode->x_resolution==640)
481
                    i=G640x480x32K; break;
482
                 case 600: if(vesa_data.mode->x_resolution==800)
483
                    i=G800x600x32K; break;
484
                 case 720: if(vesa_data.mode->x_resolution==960)
485
                    i=G960x720x32K; break;
486
                 case 768: if(vesa_data.mode->x_resolution==1024)
487
                    i=G1024x768x32K; break;
488
                 case 864: if(vesa_data.mode->x_resolution==1152)
489
                    i=G1152x864x32K; break;
490
                 case 1024: if(vesa_data.mode->x_resolution==1280)
491
                    i=G1280x1024x32K; break;
492
                 case 1200: if(vesa_data.mode->x_resolution==1600)
493
                    i=G1600x1200x32K; break;
494
                 case 1440: if(vesa_data.mode->x_resolution==1920)
495
                    i=G1920x1440x32K; break;
496
              };
497
              if(i>0)switch(vesa_data.mode->green_mask_size){
498
                 case 5:SVGALIB_VESA[i]=*mode_list; break;
499
                 case 6:SVGALIB_VESA[i+1]=*mode_list; break;
500
                 case 8:if(vesa_data.mode->rsvd_mask_size==0)SVGALIB_VESA[i+2]=*mode_list; break;
501
              };
502
          };   
503
       } else if ((vesa_data.mode->memory_model == VBE_MODEL_256) ||
504
                  (vesa_data.mode->memory_model == VBE_MODEL_PACKED)){
505
            switch(vesa_data.mode->y_resolution){
506
               case 200: if(vesa_data.mode->x_resolution==320)
507
                  SVGALIB_VESA[G320x200x256]=*mode_list; break;
508
               case 240: if(vesa_data.mode->x_resolution==320) {
509
                 if(vesa_data.mode->number_of_planes==8)
510
                    SVGALIB_VESA[G320x240x256]=*mode_list;
511
                    else SVGALIB_VESA[G320x240x256V]=*mode_list;
512
                 };
513
                 break;
514
               case 300: if(vesa_data.mode->x_resolution==400)
515
                  SVGALIB_VESA[G400x300x256]=*mode_list; break;
516
               case 384: if(vesa_data.mode->x_resolution==512)
517
                  SVGALIB_VESA[G512x384x256]=*mode_list; break;
518
               case 480: if(vesa_data.mode->x_resolution==640)
519
                  SVGALIB_VESA[G640x480x256]=*mode_list; break;
520
               case 600: if(vesa_data.mode->x_resolution==800)
521
                  SVGALIB_VESA[G800x600x256]=*mode_list; break;
522
               case 720: if(vesa_data.mode->x_resolution==960)
523
                  SVGALIB_VESA[G960x720x256]=*mode_list; break;
524
               case 768: if(vesa_data.mode->x_resolution==1024)
525
                  SVGALIB_VESA[G1024x768x256]=*mode_list; break;
526
               case 864: if(vesa_data.mode->x_resolution==1152)
527
                  SVGALIB_VESA[G1152x864x256]=*mode_list; break;
528
               case 1024: if(vesa_data.mode->x_resolution==1280)
529
                  SVGALIB_VESA[G1280x1024x256]=*mode_list; break;
530
               case 1200: if(vesa_data.mode->x_resolution==1600)
531
                  SVGALIB_VESA[G1600x1200x256]=*mode_list; break;
532
               case 1440: if(vesa_data.mode->x_resolution==1920)
533
                  SVGALIB_VESA[G1920x1440x256]=*mode_list; break;
534
            }
535
       }
536
#endif
537
       mode_list++;
132 giacomo 538
    };
539
    vesa_r.eax=0x4f04;
540
    vesa_r.edx=0;
541
    vesa_r.ecx=__svgalib_VESA_savebitmap;
542
    vesa_r.ebx=0;
543
    __svgalib_LRMI_int(0x10,&vesa_r);
544
    vesa_regs_size=vesa_r.ebx*64;
161 giacomo 545
    __svgalib_LRMI_free_real(vesa_data.info,sizeof(struct vbe_info_block) + sizeof(struct vbe_mode_info_block));
132 giacomo 546
 
547
    SVGALIB_VESA[TEXT]=3;
548
 
549
    cardspecs = malloc(sizeof(CardSpecs));
550
    cardspecs->videoMemory = vesa_memory;
551
    cardspecs->maxPixelClock4bpp = 300000;     
552
    cardspecs->maxPixelClock8bpp = 300000;     
553
    cardspecs->maxPixelClock16bpp = 300000;    
554
    cardspecs->maxPixelClock24bpp = 300000;
555
    cardspecs->maxPixelClock32bpp = 300000;
556
    cardspecs->flags = CLOCK_PROGRAMMABLE;
557
    cardspecs->maxHorizontalCrtc = 4088;
558
    cardspecs->nClocks =1;
559
    cardspecs->clocks = NULL;
560
    cardspecs->mapClock = vesa_map_clock;
561
    cardspecs->mapHorizontalCrtc = vesa_map_horizontal_crtc;
562
    cardspecs->matchProgrammableClock=vesa_match_programmable_clock;
563
    __svgalib_driverspecs = &__svgalib_vesa_driverspecs;
564
 
565
    LRMI_mem1 = __svgalib_LRMI_alloc_real(vesa_regs_size);
566
    LRMI_mem2 = __svgalib_LRMI_alloc_real(sizeof(struct vbe_info_block)
567
                                    + sizeof(struct vbe_mode_info_block));
568
 
569
    __svgalib_banked_mem_base=0xa0000;
570
    __svgalib_banked_mem_size=0x10000;
571
    if(vesa_chiptype>=1) {
572
      __svgalib_linear_mem_base=vesa_linear_base;
573
      __svgalib_linear_mem_size=vesa_memory*0x400;
574
    };
575
 
576
    if (__svgalib_driver_report) {
577
        printk(KERN_INFO "Using VESA driver, %iKB. %s\n",vesa_memory,
578
                (vesa_chiptype==2)?"VBE3":(vesa_chiptype?"VBE2.0":"VBE1.2"));
579
    }
580
 
581
    sleep(4);
582
 
583
    return 0;
161 giacomo 584
}
132 giacomo 585