Subversion Repositories shark

Rev

Rev 185 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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