pm2fb.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:59k
- /*
- * Permedia2 framebuffer driver.
- * Copyright (c) 1998-1999 Ilario Nardinocchi (nardinoc@CS.UniBO.IT)
- * Copyright (c) 1999 Jakub Jelinek (jakub@redhat.com)
- * Based on linux/drivers/video/skeletonfb.c by Geert Uytterhoeven.
- * --------------------------------------------------------------------------
- * $Id: pm2fb.c,v 1.163 1999/02/21 14:06:49 illo Exp $
- * --------------------------------------------------------------------------
- * TODO multiple boards support
- * --------------------------------------------------------------------------
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file COPYING in the main directory of this archive
- * for more details.
- */
- #include <linux/config.h>
- #include <linux/module.h>
- #include <linux/kernel.h>
- #include <linux/errno.h>
- #include <linux/string.h>
- #include <linux/mm.h>
- #include <linux/tty.h>
- #include <linux/slab.h>
- #include <linux/vmalloc.h>
- #include <linux/delay.h>
- #include <linux/interrupt.h>
- #include <linux/fb.h>
- #include <linux/selection.h>
- #include <linux/console.h>
- #include <linux/init.h>
- #include <linux/pci.h>
- #include <asm/system.h>
- #include <asm/io.h>
- #include <asm/uaccess.h>
- #include <video/fbcon.h>
- #include <video/fbcon-cfb8.h>
- #include <video/fbcon-cfb16.h>
- #include <video/fbcon-cfb24.h>
- #include <video/fbcon-cfb32.h>
- #include "pm2fb.h"
- #include "cvisionppc.h"
- #ifdef __sparc__
- #include <asm/pbm.h>
- #include <asm/fbio.h>
- #endif
- #if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)
- #error "The endianness of the target host has not been defined."
- #endif
- #if defined(__BIG_ENDIAN) && !defined(__sparc__)
- #define PM2FB_BE_APERTURE
- #endif
- /* Need to debug this some more */
- #undef PM2FB_HW_CURSOR
- #if defined(CONFIG_FB_PM2_PCI) && !defined(CONFIG_PCI)
- #undef CONFIG_FB_PM2_PCI
- #warning "support for Permedia2 PCI boards with no generic PCI support!"
- #endif
- #undef PM2FB_MASTER_DEBUG
- #ifdef PM2FB_MASTER_DEBUG
- #define DPRINTK(a,b...) printk(KERN_DEBUG "pm2fb: %s: " a, __FUNCTION__ , ## b)
- #else
- #define DPRINTK(a,b...)
- #endif
- #define PICOS2KHZ(a) (1000000000UL/(a))
- #define KHZ2PICOS(a) (1000000000UL/(a))
- /*
- * The _DEFINITIVE_ memory mapping/unmapping functions.
- * This is due to the fact that they're changing soooo often...
- */
- #define MMAP(a,b) ioremap((unsigned long )(a), b)
- #define UNMAP(a,b) iounmap(a)
- /*
- * The _DEFINITIVE_ memory i/o barrier functions.
- * This is due to the fact that they're changing soooo often...
- */
- #define DEFW() wmb()
- #define DEFR() rmb()
- #define DEFRW() mb()
- #ifndef MIN
- #define MIN(a,b) ((a)<(b)?(a):(b))
- #endif
- #ifndef MAX
- #define MAX(a,b) ((a)>(b)?(a):(b))
- #endif
- struct pm2fb_par {
- u32 pixclock; /* pixclock in KHz */
- u32 width; /* width of virtual screen */
- u32 height; /* height of virtual screen */
- u32 hsstart; /* horiz. sync start */
- u32 hsend; /* horiz. sync end */
- u32 hbend; /* horiz. blank end (also gate end) */
- u32 htotal; /* total width (w/ sync & blank) */
- u32 vsstart; /* vert. sync start */
- u32 vsend; /* vert. sync end */
- u32 vbend; /* vert. blank end */
- u32 vtotal; /* total height (w/ sync & blank) */
- u32 stride; /* screen stride */
- u32 base; /* screen base (xoffset+yoffset) */
- u32 depth; /* screen depth (8, 16, 24 or 32) */
- u32 video; /* video control (hsync,vsync) */
- };
- #define OPTF_OLD_MEM (1L<<0)
- #define OPTF_YPAN (1L<<1)
- #define OPTF_VIRTUAL (1L<<2)
- #define OPTF_USER (1L<<3)
- static struct {
- char font[40];
- u32 flags;
- struct pm2fb_par user_mode;
- } pm2fb_options =
- #ifdef __sparc__
- /* For some reason Raptor is not happy with the low-end mode */
- {"