/* * Set a single color register. The values supplied are * already rounded down to the hardware's capabilities * (according to the entries in the `var' structure). Return * != 0 for invalid regno.
*/
/* * fb_ops.fb_destroy is called by the last put_fb_info() call at the end * of unregister_framebuffer() or fb_release(). Do any cleanup here.
*/ staticvoid vesafb_destroy(struct fb_info *info)
{ struct vesafb_par *par = info->par;
fb_dealloc_cmap(&info->cmap);
arch_phys_wc_del(par->wc_cookie); if (info->screen_base)
iounmap(info->screen_base);
release_mem_region(par->base, par->size);
/* * If we fail probing the device, the kernel might try a different * driver. We get a copy of the attached screen_info, so that we can * modify its values without affecting later drivers.
*/
si = dev_get_platdata(&dev->dev); if (!si) return -ENODEV;
si = devm_kmemdup(&dev->dev, si, sizeof(*si), GFP_KERNEL); if (!si) return -ENOMEM;
/* ignore error return of fb_get_options */
fb_get_options("vesafb", &option);
vesafb_setup(option);
if (si->orig_video_isVGA != VIDEO_TYPE_VLFB) return -ENODEV;
/* size_vmode -- that is the amount of memory needed for the * used video mode, i.e. the minimum amount of
* memory we need. */
size_vmode = vesafb_defined.yres * vesafb_fix.line_length;
/* size_total -- all video memory we have. Used for mtrr * entries, resource allocation and bounds
* checking. */
size_total = si->lfb_size * 65536; if (vram_total)
size_total = vram_total * 1024 * 1024; if (size_total < size_vmode)
size_total = size_vmode;
/* size_remap -- the amount of video memory we are going to * use for vesafb. With modern cards it is no * option to simply use size_total as that
* wastes plenty of kernel address space. */
size_remap = size_vmode * 2; if (vram_remap)
size_remap = vram_remap * 1024 * 1024; if (size_remap < size_vmode)
size_remap = size_vmode; if (size_remap > size_total)
size_remap = size_total;
vesafb_fix.smem_len = size_remap;
#ifndef __i386__
si->vesapm_seg = 0; #endif
if (!request_mem_region(vesafb_fix.smem_start, size_total, "vesafb")) {
printk(KERN_WARNING "vesafb: cannot reserve video memory at 0x%lx\n",
vesafb_fix.smem_start); /* We cannot make this fatal. Sometimes this comes from magic
spaces our resource handlers simply don't know about */
}
info = framebuffer_alloc(sizeof(struct vesafb_par), &dev->dev); if (!info) {
release_mem_region(vesafb_fix.smem_start, size_total); return -ENOMEM;
}
platform_set_drvdata(dev, info);
par = info->par;
info->pseudo_palette = par->pseudo_palette;
if (si->vesapm_seg) {
printk(KERN_INFO "vesafb: protected mode interface info at %04x:%04x\n",
si->vesapm_seg, si->vesapm_off);
}
if (si->vesapm_seg < 0xc000)
ypan = pmi_setpal = 0; /* not available or some DOS TSR ... */
if (ypan || pmi_setpal) { unsignedlong pmi_phys; unsignedshort *pmi_base;
pmi_phys = ((unsignedlong)si->vesapm_seg << 4) + si->vesapm_off;
pmi_base = (unsignedshort *)phys_to_virt(pmi_phys);
pmi_start = (void*)((char*)pmi_base + pmi_base[1]);
pmi_pal = (void*)((char*)pmi_base + pmi_base[2]);
printk(KERN_INFO "vesafb: pmi: set display start = %p, set palette = %p\n",pmi_start,pmi_pal); if (pmi_base[3]) {
printk(KERN_INFO "vesafb: pmi: ports = "); for (i = pmi_base[3]/2; pmi_base[i] != 0xffff; i++)
printk("%x ", pmi_base[i]);
printk("\n"); if (pmi_base[i] != 0xffff) { /* * memory areas not supported (yet?) * * Rules are: we have to set up a descriptor for the requested * memory area and pass it in the ES register to the BIOS function.
*/
printk(KERN_INFO "vesafb: can't handle memory requests, pmi disabled\n");
ypan = pmi_setpal = 0;
}
}
}
if (vesafb_defined.bits_per_pixel == 8 && !pmi_setpal && !vga_compat) {
printk(KERN_WARNING "vesafb: hardware palette is unchangeable,\n" " colors may be incorrect\n");
vesafb_fix.visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
}
/* request failure does not faze us, as vgacon probably has this
* region already (FIXME) */
par->region = request_region(0x3c0, 32, "vesafb");
if (mtrr == 3) { unsignedint temp_size = size_total;
/* Find the largest power-of-two */
temp_size = roundup_pow_of_two(temp_size);
/* Try and find a power of two to add */ do {
par->wc_cookie =
arch_phys_wc_add(vesafb_fix.smem_start,
temp_size);
temp_size >>= 1;
} while (temp_size >= PAGE_SIZE && par->wc_cookie < 0);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.