Subversion Repositories shark

Rev

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