9 #include <linux/module.h>
14 #include <linux/connector.h>
15 #include <linux/random.h>
21 #include <linux/slab.h>
22 #include <video/edid.h>
32 static struct cb_id uvesafb_cn_id = {
36 static char v86d_path[
PATH_MAX] =
"/sbin/v86d";
37 static char v86d_started;
46 static int mtrr __devinitdata = 3;
47 static bool blank = 1;
49 static bool pmi_setpal __devinitdata =
true;
59 static u8 dac_width = 6;
61 static struct uvesafb_ktask *uvfb_tasks[UVESAFB_TASKS_MAX];
74 struct uvesafb_ktask *
task;
79 if (msg->
seq >= UVESAFB_TASKS_MAX)
83 task = uvfb_tasks[msg->
seq];
85 if (!task || msg->
ack != task->ack) {
102 memcpy(&task->t, utask,
sizeof(*utask));
104 if (task->t.buf_len && task->buf)
111 static int uvesafb_helper_start(
void)
124 return call_usermodehelper(v86d_path, argv, envp,
UMH_WAIT_PROC);
143 static int uvesafb_exec(
struct uvesafb_ktask *task)
148 int len =
sizeof(task->t) + task->t.buf_len;
156 "can't execute task\n", (
int)(
sizeof(*m) + len));
164 init_completion(task->done);
166 memcpy(&m->
id, &uvesafb_cn_id,
sizeof(m->
id));
172 memcpy(m + 1, &task->t,
sizeof(task->t));
175 memcpy((
u8 *)(m + 1) +
sizeof(task->t), task->buf, task->t.buf_len);
186 if (uvfb_tasks[seq]) {
202 err = uvesafb_helper_start();
207 "helper is installed and executable\n");
217 if (!err && !(task->t.flags &
TF_EXIT))
226 if (seq >= UVESAFB_TASKS_MAX)
236 static void uvesafb_free(
struct uvesafb_ktask *task)
248 static void uvesafb_reset(
struct uvesafb_ktask *task)
252 memset(task, 0,
sizeof(*task));
259 static struct uvesafb_ktask *uvesafb_prep(
void)
261 struct uvesafb_ktask *
task;
265 task->done = kzalloc(
sizeof(*task->done),
GFP_KERNEL);
277 struct uvesafb_par *par = info->
par;
282 var->
xres = mode->x_res;
283 var->
yres = mode->y_res;
286 info->
fix.smem_len / mode->bytes_per_scan_line :
296 var->
red.offset = mode->red_off;
297 var->
red.length = mode->red_len;
298 var->
green.offset = mode->green_off;
299 var->
green.length = mode->green_len;
300 var->
blue.offset = mode->blue_off;
301 var->
blue.length = mode->blue_len;
302 var->
transp.offset = mode->rsvd_off;
303 var->
transp.length = mode->rsvd_len;
306 var->
green.offset = 0;
307 var->
blue.offset = 0;
311 var->
green.length = 8;
312 var->
blue.length = 8;
317 static int uvesafb_vbe_find_mode(
struct uvesafb_par *par,
318 int xres,
int yres,
int depth,
unsigned char flags)
320 int i,
match = -1,
h = 0,
d = 0x7fffffff;
322 for (i = 0; i < par->vbe_modes_cnt; i++) {
323 h =
abs(par->vbe_modes[i].x_res - xres) +
324 abs(par->vbe_modes[i].y_res - yres) +
325 abs(depth - par->vbe_modes[i].depth);
334 if (
h <
d || (
h ==
d && par->vbe_modes[i].depth > depth)) {
341 if (flags & UVESAFB_EXACT_DEPTH &&
342 par->vbe_modes[match].depth != depth)
345 if (flags & UVESAFB_EXACT_RES &&
d > 24)
354 static u8 *uvesafb_vbe_state_save(
struct uvesafb_par *par)
356 struct uvesafb_ktask *
task;
360 if (!par->vbe_state_size)
367 task = uvesafb_prep();
373 task->t.regs.eax = 0x4f04;
374 task->t.regs.ecx = 0x000f;
375 task->t.regs.edx = 0x0001;
377 task->t.buf_len = par->vbe_state_size;
379 err = uvesafb_exec(task);
381 if (err || (task->t.regs.eax & 0xffff) != 0x004f) {
383 "failed (eax=0x%x, err=%d)\n",
384 task->t.regs.eax, err);
393 static void uvesafb_vbe_state_restore(
struct uvesafb_par *par,
u8 *state_buf)
395 struct uvesafb_ktask *
task;
401 task = uvesafb_prep();
405 task->t.regs.eax = 0x4f04;
406 task->t.regs.ecx = 0x000f;
407 task->t.regs.edx = 0x0002;
408 task->t.buf_len = par->vbe_state_size;
410 task->buf = state_buf;
412 err = uvesafb_exec(task);
413 if (err || (task->t.regs.eax & 0xffff) != 0x004f)
415 "failed (eax=0x%x, err=%d)\n",
416 task->t.regs.eax, err);
421 static int __devinit uvesafb_vbe_getinfo(
struct uvesafb_ktask *task,
422 struct uvesafb_par *par)
426 task->t.regs.eax = 0x4f00;
428 task->t.buf_len =
sizeof(
struct vbe_ib);
429 task->buf = &par->vbe_ib;
430 strncpy(par->vbe_ib.vbe_signature,
"VBE2", 4);
432 err = uvesafb_exec(task);
433 if (err || (task->t.regs.eax & 0xffff) != 0x004f) {
435 "(eax=0x%x, err=%d)\n", (
u32)task->t.regs.eax,
440 if (par->vbe_ib.vbe_version < 0x0200) {
446 if (!par->vbe_ib.mode_list_ptr) {
458 if (par->vbe_ib.oem_vendor_name_ptr)
460 ((
char *)task->buf) + par->vbe_ib.oem_vendor_name_ptr);
462 if (par->vbe_ib.oem_product_name_ptr)
464 ((
char *)task->buf) + par->vbe_ib.oem_product_name_ptr);
466 if (par->vbe_ib.oem_product_rev_ptr)
468 ((
char *)task->buf) + par->vbe_ib.oem_product_rev_ptr);
470 if (par->vbe_ib.oem_string_ptr)
472 ((
char *)task->buf) + par->vbe_ib.oem_string_ptr);
474 printk(
"VBE v%d.%d\n", ((par->vbe_ib.vbe_version & 0xff00) >> 8),
475 par->vbe_ib.vbe_version & 0xff);
480 static int __devinit uvesafb_vbe_getmodes(
struct uvesafb_ktask *task,
481 struct uvesafb_par *par)
486 par->vbe_modes_cnt = 0;
489 mode = (
u16 *) (((
u8 *)&par->vbe_ib) + par->vbe_ib.mode_list_ptr);
490 while (*mode != 0xffff) {
491 par->vbe_modes_cnt++;
495 par->vbe_modes = kzalloc(
sizeof(
struct vbe_mode_ib) *
501 mode = (
u16 *) (((
u8 *)&par->vbe_ib) + par->vbe_ib.mode_list_ptr);
502 while (*mode != 0xffff) {
503 struct vbe_mode_ib *mib;
506 task->t.regs.eax = 0x4f01;
507 task->t.regs.ecx = (
u32) *mode;
509 task->t.buf_len =
sizeof(
struct vbe_mode_ib);
510 task->buf = par->vbe_modes + off;
512 err = uvesafb_exec(task);
513 if (err || (task->t.regs.eax & 0xffff) != 0x004f) {
515 "for mode 0x%x failed (eax=0x%x, err=%d)\n",
516 *mode, (
u32)task->t.regs.eax, err);
518 par->vbe_modes_cnt--;
523 mib->mode_id = *
mode;
530 if ((mib->mode_attr & VBE_MODE_MASK) == VBE_MODE_MASK &&
531 mib->bits_per_pixel >= 8)
534 par->vbe_modes_cnt--;
537 mib->depth = mib->red_len + mib->green_len + mib->blue_len;
543 if (mib->depth == 0 || (mib->depth == 24 &&
544 mib->bits_per_pixel == 32))
545 mib->depth = mib->bits_per_pixel;
548 if (par->vbe_modes_cnt > 0)
559 static int __devinit uvesafb_vbe_getpmi(
struct uvesafb_ktask *task,
560 struct uvesafb_par *par)
565 task->t.regs.eax = 0x4f0a;
566 task->t.regs.ebx = 0x0;
567 err = uvesafb_exec(task);
569 if ((task->t.regs.eax & 0xffff) != 0x4f || task->t.regs.es < 0xc000) {
570 par->pmi_setpal = par->ypan = 0;
574 par->pmi_start = (
u8 *)par->pmi_base + par->pmi_base[1];
575 par->pmi_pal = (
u8 *)par->pmi_base + par->pmi_base[2];
578 (
u16)task->t.regs.es, (
u16)task->t.regs.edi);
580 "set palette = %p\n", par->pmi_start,
583 if (par->pmi_base[3]) {
585 for (i = par->pmi_base[3]/2;
586 par->pmi_base[i] != 0xffff; i++)
587 printk(
"%x ", par->pmi_base[i]);
590 if (par->pmi_base[i] != 0xffff) {
592 " requests, pmi disabled\n");
593 par->ypan = par->pmi_setpal = 0;
614 if (uvesafb_vbe_find_mode(info->
par, mode->
xres, mode->
yres, 8,
615 UVESAFB_EXACT_RES) == -1)
621 static int __devinit uvesafb_vbe_getedid(
struct uvesafb_ktask *task,
624 struct uvesafb_par *par = info->
par;
627 if (noedid || par->vbe_ib.vbe_version < 0x0300)
630 task->t.regs.eax = 0x4f15;
631 task->t.regs.ebx = 0;
632 task->t.regs.ecx = 0;
636 err = uvesafb_exec(task);
638 if ((task->t.regs.eax & 0xffff) != 0x004f || err)
641 if ((task->t.regs.ebx & 0x3) == 3) {
643 "DDC1 and DDC2 transfers\n");
644 }
else if ((task->t.regs.ebx & 0x3) == 2) {
647 }
else if ((task->t.regs.ebx & 0x3) == 1) {
656 task->t.regs.eax = 0x4f15;
657 task->t.regs.ebx = 1;
658 task->t.regs.ecx = task->t.regs.edx = 0;
665 err = uvesafb_exec(task);
667 if ((task->t.regs.eax & 0xffff) == 0x004f && !err) {
676 info->
monspecs.dclkmax = 300 * 1000000;
687 static void __devinit uvesafb_vbe_getmonspecs(
struct uvesafb_ktask *task,
690 struct uvesafb_par *par = info->
par;
700 if (uvesafb_vbe_getedid(task, info)) {
707 info->
monspecs.dclkmax = maxclk * 1000000;
711 info->
monspecs.hfmax = maxhf * 1000;
717 if (info->
monspecs.gtf == 0 && maxclk && maxvf && maxhf) {
727 "uvesafb: monitor limits: vf = %d Hz, hf = %d kHz, "
728 "clk = %d MHz\n", info->
monspecs.vfmax,
730 (
int)(info->
monspecs.dclkmax / 1000000));
733 "default refresh rate will be used\n");
736 for (i = 0; i < par->vbe_modes_cnt; i++) {
738 struct vbe_mode_ib *
mode;
741 mode = &par->vbe_modes[
i];
742 memset(&var, 0,
sizeof(var));
744 var.
xres = mode->x_res;
745 var.
yres = mode->y_res;
755 &vesa_modes[i], info))
759 for (i = 0; i < info->
monspecs.modedb_len; i++) {
760 if (uvesafb_is_valid_mode(&info->
monspecs.modedb[i], info))
768 static void __devinit uvesafb_vbe_getstatesize(
struct uvesafb_ktask *task,
769 struct uvesafb_par *par)
779 task->t.regs.eax = 0x4f04;
780 task->t.regs.ecx = 0x000f;
781 task->t.regs.edx = 0x0000;
784 err = uvesafb_exec(task);
786 if (err || (task->t.regs.eax & 0xffff) != 0x004f) {
788 "cannot be determined (eax=0x%x, err=%d)\n",
789 task->t.regs.eax, err);
790 par->vbe_state_size = 0;
794 par->vbe_state_size = 64 * (task->t.regs.ebx & 0xffff);
799 struct uvesafb_ktask *task =
NULL;
800 struct uvesafb_par *par = info->
par;
803 task = uvesafb_prep();
807 err = uvesafb_vbe_getinfo(task, par);
811 err = uvesafb_vbe_getmodes(task, par);
815 par->nocrtc = nocrtc;
817 par->pmi_setpal = pmi_setpal;
820 if (par->pmi_setpal || par->ypan) {
821 if (__supported_pte_mask &
_PAGE_NX) {
822 par->pmi_setpal = par->ypan = 0;
824 "We have better not to use the PMI.\n");
826 uvesafb_vbe_getpmi(task, par);
831 par->pmi_setpal = par->ypan = 0;
835 uvesafb_vbe_getmonspecs(task, info);
836 uvesafb_vbe_getstatesize(task, par);
838 out: uvesafb_free(task);
847 struct uvesafb_par *par = info->
par;
852 for (i = 0; i < par->vbe_modes_cnt; i++) {
853 if (par->vbe_modes[i].mode_id == vbemode) {
855 uvesafb_setup_var(&info->
var, info,
856 &par->vbe_modes[modeid]);
863 info->
var.pixclock = 0;
868 "unavailable\n", vbemode);
886 mode[
i] = modelist->
mode;
891 mode_option = UVESAFB_DEFAULT_MODE;
901 info->
var.xres = 640;
902 info->
var.yres = 480;
909 modeid = par->vbe_modes[0].mode_id;
910 uvesafb_setup_var(&info->
var, info,
911 &par->vbe_modes[modeid]);
920 modeid = uvesafb_vbe_find_mode(par, info->
var.xres, info->
var.yres,
921 info->
var.bits_per_pixel, UVESAFB_EXACT_RES);
926 uvesafb_setup_var(&info->
var, info, &par->vbe_modes[modeid]);
933 if (par->vbe_ib.vbe_version < 0x0300 || par->nocrtc)
940 static int uvesafb_setpalette(
struct uvesafb_pal_entry *
entries,
int count,
943 struct uvesafb_ktask *
task;
945 struct uvesafb_par *par = info->
par;
946 int i = par->mode_idx;
954 if (start + count > 256)
959 if (i >= 0 && i < par->vbe_modes_cnt &&
960 par->vbe_modes[i].mode_attr & VBE_MODE_VGACOMPAT) {
961 for (i = 0; i <
count; i++) {
969 else if (par->pmi_setpal) {
978 "S" (&par->pmi_pal));
984 task = uvesafb_prep();
988 task->t.regs.eax = 0x4f09;
989 task->t.regs.ebx = 0x0;
990 task->t.regs.ecx =
count;
991 task->t.regs.edx =
start;
993 task->t.buf_len =
sizeof(
struct uvesafb_pal_entry) *
count;
996 err = uvesafb_exec(task);
997 if ((task->t.regs.eax & 0xffff) != 0x004f)
1005 static int uvesafb_setcolreg(
unsigned regno,
unsigned red,
unsigned green,
1009 struct uvesafb_pal_entry
entry;
1010 int shift = 16 - dac_width;
1013 if (regno >= info->
cmap.len)
1016 if (info->
var.bits_per_pixel == 8) {
1017 entry.red = red >> shift;
1018 entry.green = green >> shift;
1019 entry.blue = blue >> shift;
1022 err = uvesafb_setpalette(&
entry, 1, regno, info);
1023 }
else if (regno < 16) {
1024 switch (info->
var.bits_per_pixel) {
1026 if (info->
var.red.offset == 10) {
1029 ((red & 0xf800) >> 1) |
1030 ((green & 0xf800) >> 6) |
1031 ((blue & 0xf800) >> 11);
1036 ((green & 0xfc00) >> 5) |
1037 ((blue & 0xf800) >> 11);
1047 (red << info->
var.red.offset) |
1048 (green << info->
var.green.offset) |
1049 (blue << info->
var.blue.offset);
1056 static int uvesafb_setcmap(
struct fb_cmap *cmap,
struct fb_info *info)
1058 struct uvesafb_pal_entry *
entries;
1059 int shift = 16 - dac_width;
1062 if (info->
var.bits_per_pixel == 8) {
1067 entries =
kmalloc(
sizeof(*entries) * cmap->
len, GFP_KERNEL);
1071 for (i = 0; i < cmap->
len; i++) {
1072 entries[
i].red = cmap->
red[
i] >> shift;
1073 entries[
i].green = cmap->
green[
i] >> shift;
1074 entries[
i].blue = cmap->
blue[
i] >> shift;
1077 err = uvesafb_setpalette(entries, cmap->
len, cmap->
start, info);
1085 for (i = 0; i < cmap->
len; i++) {
1086 err |= uvesafb_setcolreg(cmap->
start + i, cmap->
red[i],
1097 #ifdef CONFIG_X86_32
1099 struct uvesafb_par *par = info->
par;
1107 if (par->pmi_start) {
1115 "D" (&par->pmi_start));
1121 static int uvesafb_blank(
int blank,
struct fb_info *info)
1123 struct uvesafb_ktask *
task;
1126 struct uvesafb_par *par = info->
par;
1130 u8 seq = 0, crtc17 = 0;
1142 vga_wseq(
NULL, 0x00, 0x01);
1143 seq |= vga_rseq(
NULL, 0x01) & ~0x20;
1144 vga_wseq(
NULL, 0x00, seq);
1146 crtc17 |= vga_rcrt(
NULL, 0x17) & ~0x80;
1148 vga_wcrt(
NULL, 0x17, crtc17);
1149 vga_wseq(
NULL, 0x00, 0x03);
1153 task = uvesafb_prep();
1157 task->t.regs.eax = 0x4f10;
1160 task->t.regs.ebx = 0x0001;
1163 task->t.regs.ebx = 0x0101;
1166 task->t.regs.ebx = 0x0401;
1172 err = uvesafb_exec(task);
1173 if (err || (task->t.regs.eax & 0xffff) != 0x004f)
1175 out: uvesafb_free(task);
1180 static int uvesafb_open(
struct fb_info *info,
int user)
1182 struct uvesafb_par *par = info->
par;
1186 if (!cnt && par->vbe_state_size) {
1187 buf = uvesafb_vbe_state_save(par);
1190 "failed, error code is %ld!\n", PTR_ERR(buf));
1192 par->vbe_state_orig =
buf;
1200 static int uvesafb_release(
struct fb_info *info,
int user)
1202 struct uvesafb_ktask *task =
NULL;
1203 struct uvesafb_par *par = info->
par;
1212 task = uvesafb_prep();
1217 task->t.regs.eax = 0x0003;
1224 uvesafb_vbe_state_restore(par, par->vbe_state_orig);
1232 static int uvesafb_set_par(
struct fb_info *info)
1234 struct uvesafb_par *par = info->
par;
1235 struct uvesafb_ktask *task =
NULL;
1237 struct vbe_mode_ib *mode =
NULL;
1238 int i, err = 0, depth = info->
var.bits_per_pixel;
1240 if (depth > 8 && depth != 32)
1241 depth = info->
var.red.length + info->
var.green.length +
1242 info->
var.blue.length;
1244 i = uvesafb_vbe_find_mode(par, info->
var.xres, info->
var.yres, depth,
1245 UVESAFB_EXACT_RES | UVESAFB_EXACT_DEPTH);
1247 mode = &par->vbe_modes[
i];
1251 task = uvesafb_prep();
1255 task->t.regs.eax = 0x4f02;
1256 task->t.regs.ebx = mode->mode_id | 0x4000;
1258 if (par->vbe_ib.vbe_version >= 0x0300 && !par->nocrtc &&
1259 info->
var.pixclock != 0) {
1260 task->t.regs.ebx |= 0x0800;
1262 crtc = kzalloc(
sizeof(
struct vbe_crtc_ib), GFP_KERNEL);
1267 crtc->horiz_start = info->
var.xres + info->
var.right_margin;
1268 crtc->horiz_end = crtc->horiz_start + info->
var.hsync_len;
1269 crtc->horiz_total = crtc->horiz_end + info->
var.left_margin;
1271 crtc->vert_start = info->
var.yres + info->
var.lower_margin;
1272 crtc->vert_end = crtc->vert_start + info->
var.vsync_len;
1273 crtc->vert_total = crtc->vert_end + info->
var.upper_margin;
1275 crtc->pixel_clock =
PICOS2KHZ(info->
var.pixclock) * 1000;
1276 crtc->refresh_rate = (
u16)(100 * (crtc->pixel_clock /
1277 (crtc->vert_total * crtc->horiz_total)));
1287 memcpy(&par->crtc, crtc,
sizeof(*crtc));
1289 memset(&par->crtc, 0,
sizeof(*crtc));
1292 task->t.buf_len =
sizeof(
struct vbe_crtc_ib);
1293 task->buf = &par->crtc;
1295 err = uvesafb_exec(task);
1296 if (err || (task->t.regs.eax & 0xffff) != 0x004f) {
1303 "(eax=0x%x, err=%d). Trying again with "
1304 "default timings.\n", task->t.regs.eax, err);
1305 uvesafb_reset(task);
1308 info->
var.pixclock = 0;
1312 "0x%x, err=%d)\n", task->t.regs.eax, err);
1321 mode->bits_per_pixel <= 8) {
1322 uvesafb_reset(task);
1323 task->t.regs.eax = 0x4f08;
1324 task->t.regs.ebx = 0x0800;
1326 err = uvesafb_exec(task);
1327 if (err || (task->t.regs.eax & 0xffff) != 0x004f ||
1328 ((task->t.regs.ebx & 0xff00) >> 8) != 8) {
1335 info->
fix.visual = (info->
var.bits_per_pixel == 8) ?
1337 info->
fix.line_length = mode->bytes_per_scan_line;
1350 struct uvesafb_par *par = info->
par;
1359 if (par->vbe_ib.vbe_version < 0x0300) {
1385 struct uvesafb_par *par = info->
par;
1386 struct vbe_mode_ib *mode =
NULL;
1388 int depth = var->
red.length + var->
green.length + var->
blue.length;
1398 match = uvesafb_vbe_find_mode(par, var->
xres, var->
yres, depth,
1403 mode = &par->vbe_modes[
match];
1404 uvesafb_setup_var(var, info, mode);
1411 if (var->
yres * mode->bytes_per_scan_line > info->
fix.smem_len
1412 && info->
fix.smem_len)
1416 !(par->vbe_modes[match].mode_attr & 0x100))
1420 !(par->vbe_modes[match].mode_attr & 0x200))
1423 uvesafb_check_limits(var, info);
1427 info->
fix.smem_len / mode->bytes_per_scan_line :
1432 static struct fb_ops uvesafb_ops = {
1434 .fb_open = uvesafb_open,
1435 .fb_release = uvesafb_release,
1436 .fb_setcolreg = uvesafb_setcolreg,
1437 .fb_setcmap = uvesafb_setcmap,
1438 .fb_pan_display = uvesafb_pan_display,
1439 .fb_blank = uvesafb_blank,
1443 .fb_check_var = uvesafb_check_var,
1444 .fb_set_par = uvesafb_set_par,
1448 struct vbe_mode_ib *mode)
1450 unsigned int size_vmode;
1451 unsigned int size_remap;
1452 unsigned int size_total;
1453 struct uvesafb_par *par = info->
par;
1457 info->
fix = uvesafb_fix;
1458 info->
fix.ypanstep = par->ypan ? 1 : 0;
1459 info->
fix.ywrapstep = (par->ypan > 1) ? 1 : 0;
1470 for (i = 0; i < par->vbe_modes_cnt; i++) {
1471 h = par->vbe_modes[
i].bytes_per_scan_line *
1472 par->vbe_modes[
i].y_res;
1484 size_vmode = info->
var.yres * mode->bytes_per_scan_line;
1486 size_vmode = info->
var.yres * info->
var.xres *
1487 ((info->
var.bits_per_pixel + 7) >> 3);
1495 size_total = par->vbe_ib.total_memory * 65536;
1497 size_total = vram_total * 1024 * 1024;
1498 if (size_total < size_vmode)
1499 size_total = size_vmode;
1508 size_remap = vram_remap * 1024 * 1024;
1509 if (size_remap < size_vmode)
1510 size_remap = size_vmode;
1511 if (size_remap > size_total)
1512 size_remap = size_total;
1514 info->
fix.smem_len = size_remap;
1515 info->
fix.smem_start = mode->phys_base_ptr;
1521 info->
var.yres_virtual = info->
fix.smem_len /
1522 mode->bytes_per_scan_line;
1524 if (par->ypan && info->
var.yres_virtual > info->
var.yres) {
1526 "using protected mode interface, "
1527 "yres_virtual=%d\n",
1528 (par->ypan > 1) ?
"ywrap" :
"ypan",
1529 info->
var.yres_virtual);
1532 info->
var.yres_virtual = info->
var.yres;
1546 if (mtrr && !(info->
fix.smem_start & (
PAGE_SIZE - 1))) {
1547 int temp_size = info->
fix.smem_len;
1548 unsigned int type = 0;
1577 temp_size, type, 1);
1612 struct uvesafb_par *par = info->
par;
1623 struct uvesafb_par *par = info->
par;
1626 for (i = 0; i < par->vbe_modes_cnt && ret <
PAGE_SIZE; i++) {
1627 ret +=
snprintf(buf + ret, PAGE_SIZE - ret,
1628 "%dx%d-%d, 0x%.4x\n",
1629 par->vbe_modes[i].x_res, par->vbe_modes[i].y_res,
1630 par->vbe_modes[i].depth, par->vbe_modes[i].mode_id);
1642 struct uvesafb_par *par = info->
par;
1644 if (par->vbe_ib.oem_vendor_name_ptr)
1646 (&par->vbe_ib) + par->vbe_ib.oem_vendor_name_ptr);
1653 static ssize_t uvesafb_show_product_name(
struct device *dev,
1657 struct uvesafb_par *par = info->
par;
1659 if (par->vbe_ib.oem_product_name_ptr)
1661 (&par->vbe_ib) + par->vbe_ib.oem_product_name_ptr);
1672 struct uvesafb_par *par = info->
par;
1674 if (par->vbe_ib.oem_product_rev_ptr)
1676 (&par->vbe_ib) + par->vbe_ib.oem_product_rev_ptr);
1687 struct uvesafb_par *par = info->
par;
1689 if (par->vbe_ib.oem_string_ptr)
1691 (
char *)(&par->vbe_ib) + par->vbe_ib.oem_string_ptr);
1702 struct uvesafb_par *par = info->
par;
1711 struct uvesafb_par *par = info->
par;
1723 uvesafb_store_nocrtc);
1725 static struct attribute *uvesafb_dev_attrs[] = {
1726 &dev_attr_vbe_version.attr,
1727 &dev_attr_vbe_modes.attr,
1728 &dev_attr_oem_vendor.attr,
1729 &dev_attr_oem_product_name.attr,
1730 &dev_attr_oem_product_rev.attr,
1731 &dev_attr_oem_string.attr,
1732 &dev_attr_nocrtc.attr,
1738 .attrs = uvesafb_dev_attrs,
1744 struct vbe_mode_ib *mode =
NULL;
1745 struct uvesafb_par *par;
1754 err = uvesafb_vbe_init(info);
1760 info->
fbops = &uvesafb_ops;
1762 i = uvesafb_vbe_init_mode(info);
1767 mode = &par->vbe_modes[
i];
1775 uvesafb_init_info(info, mode);
1786 "0x%lx\n", info->
fix.smem_start);
1791 uvesafb_init_mtrr(info);
1792 uvesafb_ioremap(info);
1796 "uvesafb: abort, cannot ioremap 0x%x bytes of video "
1797 "memory at 0x%lx\n",
1798 info->
fix.smem_len, info->
fix.smem_start);
1803 platform_set_drvdata(dev, info);
1807 "uvesafb: failed to register framebuffer device\n");
1813 "using %dk, total %dk\n", info->
fix.smem_start,
1815 par->vbe_ib.total_memory * 64);
1839 kfree(par->vbe_modes);
1847 struct fb_info *info = platform_get_drvdata(dev);
1850 struct uvesafb_par *par = info->
par;
1862 kfree(par->vbe_modes);
1863 if (par->vbe_state_orig)
1864 kfree(par->vbe_state_orig);
1865 if (par->vbe_state_saved)
1866 kfree(par->vbe_state_saved);
1875 .probe = uvesafb_probe,
1876 .remove = uvesafb_remove,
1889 if (!options || !*options)
1892 while ((this_opt =
strsep(&options,
",")) !=
NULL) {
1893 if (!*this_opt)
continue;
1895 if (!
strcmp(this_opt,
"redraw"))
1897 else if (!
strcmp(this_opt,
"ypan"))
1899 else if (!
strcmp(this_opt,
"ywrap"))
1901 else if (!
strcmp(this_opt,
"vgapal"))
1903 else if (!
strcmp(this_opt,
"pmipal"))
1905 else if (!
strncmp(this_opt,
"mtrr:", 5))
1907 else if (!
strcmp(this_opt,
"nomtrr"))
1909 else if (!
strcmp(this_opt,
"nocrtc"))
1911 else if (!
strcmp(this_opt,
"noedid"))
1913 else if (!
strcmp(this_opt,
"noblank"))
1915 else if (!
strncmp(this_opt,
"vtotal:", 7))
1917 else if (!
strncmp(this_opt,
"vremap:", 7))
1919 else if (!
strncmp(this_opt,
"maxhf:", 6))
1921 else if (!
strncmp(this_opt,
"maxvf:", 6))
1923 else if (!
strncmp(this_opt,
"maxclk:", 7))
1925 else if (!
strncmp(this_opt,
"vbemode:", 8))
1927 else if (this_opt[0] >=
'0' && this_opt[0] <=
'9') {
1928 mode_option = this_opt;
1931 "uvesafb: unrecognized option %s\n", this_opt);
1962 uvesafb_setup(option);
1964 err =
cn_add_callback(&uvesafb_cn_id,
"uvesafb", uvesafb_cn_callback);
1997 static void __devexit uvesafb_exit(
void)
1999 struct uvesafb_ktask *
task;
2002 task = uvesafb_prep();
2018 static int param_set_scroll(
const char *
val,
const struct kernel_param *kp)
2022 if (!
strcmp(val,
"redraw"))
2024 else if (!
strcmp(val,
"ypan"))
2026 else if (!
strcmp(val,
"ywrap"))
2034 .set = param_set_scroll,
2036 #define param_check_scroll(name, p) __param_check(name, p, void)
2040 "Scrolling mode, set to 'redraw', 'ypan', or 'ywrap'");
2047 "Memory Type Range Registers setting. Use 0 to disable.");
2054 "Ignore EDID-provided monitor limits when setting modes");
2056 MODULE_PARM_DESC(vram_remap,
"Set amount of video memory to be used [MiB]");
2063 "Maximum horizontal frequency [kHz], overrides EDID data");
2066 "Maximum vertical frequency [Hz], overrides EDID data");
2069 "Specify initial video mode as \"<xres>x<yres>[-<bpp>][@<refresh>]\"");
2072 "VBE mode number to set, overrides the 'mode' option");