]> git.neil.brown.name Git - history.git/commitdiff
Import 2.1.124pre1 2.1.124pre1
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:16:49 +0000 (15:16 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:16:49 +0000 (15:16 -0500)
114 files changed:
Documentation/Configure.help
Documentation/fb/vesafb.txt
Documentation/paride.txt
Makefile
arch/i386/boot/video.S
arch/i386/defconfig
arch/i386/kernel/io_apic.c
arch/i386/kernel/process.c
arch/i386/kernel/ptrace.c
arch/i386/kernel/signal.c
arch/i386/kernel/traps.c
drivers/block/Config.in
drivers/block/ide-pci.c
drivers/block/paride/frpw.c
drivers/block/paride/jumbo [new file with mode: 0644]
drivers/block/paride/on26.c
drivers/block/paride/pcd.c
drivers/block/paride/pd.c
drivers/block/paride/pf.c
drivers/block/paride/pg.c
drivers/block/paride/pt.c
drivers/char/Makefile
drivers/char/fbmem.c [deleted file]
drivers/char/pty.c
drivers/char/tty_io.c
drivers/isdn/isdn_net.c
drivers/video/ati-gt.h [deleted file]
drivers/video/ati-gx.h [deleted file]
drivers/video/ati-vt.h [deleted file]
drivers/video/fbcmap.c
drivers/video/fbcon-afb.c
drivers/video/fbcon-afb.h [deleted file]
drivers/video/fbcon-cfb16.c
drivers/video/fbcon-cfb16.h [deleted file]
drivers/video/fbcon-cfb2.c
drivers/video/fbcon-cfb2.h [deleted file]
drivers/video/fbcon-cfb24.c
drivers/video/fbcon-cfb24.h [deleted file]
drivers/video/fbcon-cfb32.c
drivers/video/fbcon-cfb32.h [deleted file]
drivers/video/fbcon-cfb4.c
drivers/video/fbcon-cfb4.h [deleted file]
drivers/video/fbcon-cfb8.c
drivers/video/fbcon-cfb8.h [deleted file]
drivers/video/fbcon-ilbm.c
drivers/video/fbcon-ilbm.h [deleted file]
drivers/video/fbcon-iplan2p2.c
drivers/video/fbcon-iplan2p2.h [deleted file]
drivers/video/fbcon-iplan2p4.c
drivers/video/fbcon-iplan2p4.h [deleted file]
drivers/video/fbcon-iplan2p8.c
drivers/video/fbcon-iplan2p8.h [deleted file]
drivers/video/fbcon-mac.c
drivers/video/fbcon-mac.h [deleted file]
drivers/video/fbcon-mfb.c
drivers/video/fbcon-mfb.h [deleted file]
drivers/video/fbcon-vga.c
drivers/video/fbcon-vga.h [deleted file]
drivers/video/fbcon.c
drivers/video/fbcon.h [deleted file]
drivers/video/fbmem.c [new file with mode: 0644]
drivers/video/font.h [deleted file]
drivers/video/font_6x11.c
drivers/video/font_8x16.c
drivers/video/font_8x8.c
drivers/video/font_acorn_8x8.c
drivers/video/font_pearl_8x8.c
drivers/video/font_sun12x22.c
drivers/video/font_sun8x16.c
drivers/video/fonts.c
drivers/video/macmodes.h [deleted file]
drivers/video/mdacon.c [new file with mode: 0644]
drivers/video/mdafb.c [deleted file]
drivers/video/s3blit.h [deleted file]
drivers/video/sbusfb.h [deleted file]
drivers/video/skeletonfb.c
drivers/video/vesafb.c
drivers/video/vgafb.c [deleted file]
fs/fcntl.c
include/asm-alpha/termios.h
include/asm-arm/termios.h
include/asm-i386/fixmap.h
include/asm-i386/processor.h
include/asm-i386/termios.h
include/asm-m68k/termios.h
include/asm-mips/termios.h
include/asm-ppc/termios.h
include/asm-sparc/termios.h
include/asm-sparc64/termios.h
include/linux/fb.h
include/linux/parport.h
include/video/fbcon-afb.h [new file with mode: 0644]
include/video/fbcon-cfb16.h [new file with mode: 0644]
include/video/fbcon-cfb2.h [new file with mode: 0644]
include/video/fbcon-cfb24.h [new file with mode: 0644]
include/video/fbcon-cfb32.h [new file with mode: 0644]
include/video/fbcon-cfb4.h [new file with mode: 0644]
include/video/fbcon-cfb8.h [new file with mode: 0644]
include/video/fbcon-ilbm.h [new file with mode: 0644]
include/video/fbcon-iplan2p2.h [new file with mode: 0644]
include/video/fbcon-iplan2p4.h [new file with mode: 0644]
include/video/fbcon-iplan2p8.h [new file with mode: 0644]
include/video/fbcon-mac.h [new file with mode: 0644]
include/video/fbcon-mfb.h [new file with mode: 0644]
include/video/fbcon-vga.h [new file with mode: 0644]
include/video/fbcon.h [new file with mode: 0644]
include/video/font.h [new file with mode: 0644]
include/video/macmodes.h [new file with mode: 0644]
include/video/s3blit.h [new file with mode: 0644]
include/video/sbusfb.h [new file with mode: 0644]
init/main.c
net/sunrpc/clnt.c
net/sunrpc/svcsock.c
net/sunrpc/xprt.c

index ee3b2ef1c47faf7878f76cdb87b9d82c77fc2949..1e606262607156e7af38fcde07abb8d66fe6491b 100644 (file)
@@ -431,6 +431,20 @@ CONFIG_BLK_DEV_IDEDMA
 
   It is safe to say Y to this question.
 
+Boot off-board chipsets first support
+CONFIG_BLK_DEV_OFFBOARD
+  Normally, IDE controllers built into the motherboard (on-board
+  controllers) are assigned to ide0 and ide1 while those on add-in
+  PCI cards (off-board controllers) are relegated to ide2 and ide3.
+  Saying Y to here will reverse the situation, with off-board
+  controllers on ide0/1 and on-board controllers on ide2/3. This
+  can improve the usability of some boot managers such as LILO
+  when booting from a drive on an off-board controller.
+  Note that this will rearrange the order of the hd* devices and
+  may require modification of fstab and other files.
+
+  If in doubt, say N.
+
 Use DMA by default when available
 CONFIG_IDEDMA_AUTO
   Prior to kernel version 2.1.112, Linux used to automatically use
@@ -650,9 +664,11 @@ CONFIG_PARIDE_PG
   The module will be called pg.o.  You must also have at least one 
   parallel port protocol driver in your system.  This driver 
   implements an API loosely related to the generic SCSI driver.  
-  See /usr/include/linux/pg.h for details, or visit 
-  http://www.torque.net/parport/cdr.html for more information and
-  the required patches to cdrecord.
+  See /usr/include/linux/pg.h for details. 
+
+  You can obtain the most recent version of cdrecord from
+  ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/ .  Versions 1.6.1a3 and
+  later fully support the pg driver.
 
 ATEN EH-100 protocol
 CONFIG_PARIDE_ATEN
index ed58f724172536e31302b8b88a475afe97eac3bb..e6f52393d346663e2efe4485e678fad36f0dfb56 100644 (file)
@@ -30,37 +30,66 @@ How to use it?
 ==============
 
 Switching modes is done using the vga=... boot parameter.  Read
-Documentation/svga.txt for details.  With vesafb both text and
-graphics modes work.  Text modes are handled by vgafb, graphic modes
-by the new vesafb.c.
+Documentation/svga.txt for details.
 
-The graphic modes are not in the list which you get if you boot with
-vga=ask and hit return.  Here are some mode numbers:
-
-    | 640x480  800x600  1024x768
-----+---------------------------
-256 |  0x101    0x103    0x105
-32k |  0x110    0x113    0x116
-64k |  0x111    0x114    0x117
-16M |  0x112    0x115    0x118
-
-Note 1: this are the VESA mode numbers.  The video mode select code
-        expects 0x200 + VESA mode number.
-Note 2: lilo can't handle hex, for booting with "vga=??" you have to
-        transform the numbers to decimal.
+You should compile in both vgacon (for text mode) and vesafb (for
+graphics mode).   Which of them takes over the console depends on
+whenever the specified mode is text or graphics.
 
+The graphic modes are NOT in the list which you get if you boot with
+vga=ask and hit return.  Here are some mode numbers:
 
-Speed it up!
-============
-
-Check /usr/src/linux/Documentation/mtrr.txt, enabling write-combining
-for the framebuffer memory gives a performance boost.
-
-There are two ways to do console scrolling: redraw the screen
-completely, or by copying around the video memory.  You can select one
-of them using the kernel command line: video=vesa:redraw or
-video=vesa:memmove.  redraw is the default, becauce this one works
-faster on my box.
+    | 640x480  800x600  1024x768 1280x1024
+----+-------------------------------------
+256 |  0x101    0x103    0x105    0x107   
+32k |  0x110    0x113    0x116    0x119   
+64k |  0x111    0x114    0x117    0x11A   
+16M |  0x112    0x115    0x118    0x11B   
+
+This are the VESA mode numbers.  The video mode select code expects
+0x200 + VESA mode number.  Therefore you have to enter "305" at the
+"vga=ask" prompt to boot into 1024x768x8.
+
+If this does'nt work, this might be becauce your BIOS does not support
+linear framebuffers or becauce it does'nt support this mode at all.
+Even if your board does, it might be the BIOS does not.  VESA BIOS
+Extentions v2.0 are required, 1.2 is NOT sufficient.  You'll get a
+"bad mode number" message if something goes wrong.
+
+Note: LILO can't handle hex, for booting directly with "vga=mode-number"
+      you have to transform the numbers to decimal.
+
+
+X11
+===
+
+XF68_FBDev should work just fine, but it is non-accelerated.  Running
+another (accelerated) X-Server like XF86_SVGA might or might not work.
+It depends on X-Server and graphics board.
+
+The X-Server must restore the video mode correctly, else you end up
+with a broken console (and vesafb can't do anything about this).
+
+
+Configuration
+=============
+
+You can pass kernel command line options to vesafb with
+"video=vesa:option1".  Multiple options should be separated
+by comma.  Accepted options:
+
+invers - no comment...
+redraw - scroll by redrawing the affected part of the screen
+ypan    - enable display panning using the VESA protected mode
+         interface.  This enables the Shift-PgUp scrollback 
+         thing and greatly speeds up fullscreen scrolling.
+         It is slower than "redraw" when scrolling only a halve
+         screen.  This is the default.
+ywrap  - If your gfx board supports wrap-around, use this one
+         instead of ypan. 
+nopal  - Don't use the protected mode interface for palette
+         changes.  vesafb will try the standard vga registers
+         instead.
 
 
 Have fun!
index 47141f7a391b96ad929bddd6e1b63f16305bf7cd..4eb9a185501517864ed89c5e64cedabef55b243e 100644 (file)
@@ -1,7 +1,7 @@
 
                Linux and parallel port IDE devices
 
-PARIDE v1.02   (c) 1997-8  Grant Guenther <grant@torque.net>
+PARIDE v1.03   (c) 1997-8  Grant Guenther <grant@torque.net>
 
 1. Introduction
 
@@ -42,8 +42,8 @@ parallel port IDE subsystem, including:
        SyQuest EZ-135, EZ-230 & SparQ drives
        Avatar Shark
        Imation Superdisk LS-120
-       FreeCom Power CD
-       Hewlett-Packard 5GB tape drive
+       FreeCom Power CD 
+       Hewlett-Packard 5GB and 8GB tape drives
        Hewlett-Packard 7100 and 7200 CD-RW drives
 
 as well as most of the clone and no-name products on the market.
@@ -52,7 +52,7 @@ To support such a wide range of devices, PARIDE, the parallel port IDE
 subsystem, is actually structured in three parts.   There is a base
 paride module which provides a registry and some common methods for
 accessing the parallel ports.  The second component is a set of 
-high-level drivers for each of the different type of supported device
+high-level drivers for each of the different types of supported devices
 
        pd      IDE disk
        pcd     ATAPI CD-ROM
@@ -176,7 +176,7 @@ It is much faster and simpler to get to understand the PARIDE drivers
 if you use them as loadable kernel modules.   
 
 Note 1:  using these drivers with the "kerneld" automatic module loading
-system is not recommended, and is not documented here.  
+system is not recommended for beginners, and is not documented here.  
 
 Note 2:  if you build PARPORT support as a loadable module, PARIDE must
 also be built as loadable modules, and PARPORT must be loaded before the
@@ -290,14 +290,57 @@ floppy that you could share with a DOS system:
        mkdosfs /dev/pf0
        mount /dev/pf0 /mnt
 
-2.4  Using the pg driver
+
+2.4  The pf driver
+
+The pf driver is intended for use with parallel port ATAPI disk
+devices.  The most common devices in this category are PD drives
+and LS-120 drives.  Traditionally, media for these devices are not
+partitioned.  Consequently, the pf driver does not support partitioned
+media.  This may be changed in a future version of the driver. 
+
+
+2.5  Using the pt driver
+
+The pt driver for parallel port ATAPI tape drives is a minimal driver.
+It does not yet support many of the standard tape ioctl operations. 
+For best performance, a block size of 32KB should be used.  You will
+probably want to set the parallel port delay to 0, if you can.
+
+
+2.6  Using the pg driver
 
 The pg driver can be used in conjunction with the cdrecord program
-to create CD-ROMs.  For more information, and the required patches 
-to cdrecord, please visit http://www.torque.net/parport/cdr.html .
+to create CD-ROMs.  Please get cdrecord version 1.6.1a3 or later
+from ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/ (you may have to look
+in the alpha subdirectory).  To record CD-R media your parallel port
+should ideally be set to EPP mode, and the "port delay" should be
+set to 0.  With those settings it is possible to record at 2x speed
+without any buffer underruns.  If you cannot get the driver to work
+in EPP mode, try to use "bidirectional" or "PS/2" mode and 1x speeds only.
+
 
 3. Troubleshooting
 
+The most common problems that people report with the PARIDE drivers
+concern the parallel port CMOS settings.  At this time, none of the
+PARIDE protocol modules support ECP mode, or any ECP combination modes.
+If you are able to do so, please set your parallel port into EPP mode
+using your CMOS setup procedure.
+
+Some parallel ports cannot reliably transfer data at full speed.  To
+offset the errors, the PARIDE protocol modules introduce a "port
+delay" between each access to the i/o ports.  Each protocol sets
+a default value for this delay.  In most cases, the user can override
+the default and set it to 0 - resulting in somewhat higher transfer
+rates.  In some rare cases (especially with older 486 systems) the
+default delays are not long enough.  if you experience corrupt data
+transfers, or unexpected failures, you may wish to increase the
+port delay.   The delay can be programmed using the "driveN" parameters
+to each of the high-level drivers.  Please see the notes above, or
+read the comments at the beginning of the driver source files in
+linux/drivers/block/paride.
+
 While a lot of testing has gone into these drivers to make them work
 as smoothly as possible, problems will arise.  If you do have problems,
 please check all the obvious things first:  does the drive work in
index 577bc3f854d0888d387c1370cbbc55bed51d0417..a038be2dcfcd436afe46977aa4e4265bb829e62f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 2
 PATCHLEVEL = 1
-SUBLEVEL = 123
+SUBLEVEL = 124
 
 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
 
index 6480765894d3a58c4c71f2d5876aa66ecfdd64c2..879f0aa306a931ca2a31dfb3f9d9ef82113282a0 100644 (file)
@@ -24,7 +24,7 @@
 #undef CONFIG_VIDEO_LOCAL
 
 ! Force 400 scan lines for standard modes (hack to fix bad behaviour
-! of certain broken BIOS'es -- don't use unless needed)
+! of certain broken BIOSes -- don't use unless needed)
 #undef CONFIG_VIDEO_400_HACK
 
 ! A special hack allowing to force specific BIOS mode ID along with specific
@@ -85,6 +85,9 @@
 #define PARAM_LFB_SIZE         0x1c
 #define PARAM_LFB_LINELENGTH   0x24
 #define PARAM_LFB_COLORS       0x26
+#define PARAM_VESAPM_SEG       0x2e
+#define PARAM_VESAPM_OFF       0x30
+#define PARAM_LFB_PAGES                0x32
 
 ! Define DO_STORE according to CONFIG_VIDEO_RETAIN
 #ifdef CONFIG_VIDEO_RETAIN
@@ -236,13 +239,14 @@ mopar_gr:
        seg     fs
        mov     [PARAM_LFB_DEPTH],ax
 
-       mov     eax,(di+40)
+       mov     al,(di+29)
+       mov     ah,#0
        seg     fs
-       mov     [PARAM_LFB_BASE],eax
+       mov     [PARAM_LFB_PAGES],ax
 
-       mov     eax,(di+44)
+       mov     eax,(di+40)
        seg     fs
-       mov     [PARAM_LFB_SIZE],eax
+       mov     [PARAM_LFB_BASE],eax
 
        mov     eax,(di+31)
        seg     fs
@@ -251,7 +255,30 @@ mopar_gr:
        mov     eax,(di+35)
        seg     fs
        mov     [PARAM_LFB_COLORS+4],eax
-       
+
+       ! get video mem size
+       lea     di,modelist+1024
+       mov     ax,#0x4f00
+       int     0x10
+
+       xor     eax,eax 
+       mov     ax,(di+18)
+       seg     fs
+       mov     [PARAM_LFB_SIZE],eax
+
+       ! get protected mode interface informations     
+       mov     ax,#0x4f0a
+       xor     bx,bx
+       xor     di,di
+       int     0x10
+       cmp     ax,#0x004f
+       jnz     no_pm
+       seg     fs
+       mov     [PARAM_VESAPM_SEG],es
+       seg     fs
+       mov     [PARAM_VESAPM_OFF],di
+
+no_pm:
        ret
 
 !
@@ -619,7 +646,7 @@ st80:       cmpb    [adapter],#0    ! CGA/MDA/HGA => mode 3/7 is always 80x25
        jz      set80
        seg     gs              ! This is EGA+ -- beware of 80x50 etc.
        mov     al,[0x0484]
-       or      al,al           ! Some buggy BIOSs set 0 rows
+       or      al,al           ! Some buggy BIOSes set 0 rows
        jz      set80
        cmp     al,#24          ! Let's hope this is correct
        jz      set80
index 30051bea8ac8df02cd78c13a0febf498cf442733..7996c7af7f1b13fb33c8ff4a88f471640ed726e1 100644 (file)
@@ -67,6 +67,7 @@ CONFIG_BLK_DEV_CMD640=y
 CONFIG_BLK_DEV_RZ1000=y
 CONFIG_BLK_DEV_IDEPCI=y
 CONFIG_BLK_DEV_IDEDMA=y
+# CONFIG_BLK_DEV_OFFBOARD is not set
 CONFIG_IDEDMA_AUTO=y
 # CONFIG_IDE_CHIPSETS is not set
 
index 01de6305c95e03cc81dfeb6acfdd11bd35d5bcf6..fb5cfa3b3276a5bf943d14209b8cae59727de04e 100644 (file)
@@ -129,7 +129,7 @@ static inline void io_apic_sync(void)
 
 /*
  * We disable IO-APIC IRQs by setting their 'destination CPU mask' to
- * zero. Trick, trick.
+ * zero. Trick by Ramesh Nalluri.
  */
 static inline void disable_IO_APIC_irq(unsigned int irq)
 {
@@ -882,9 +882,9 @@ static void __init construct_default_ISA_mptable(void)
                if (!IO_APIC_IRQ(i))
                        continue;
 
-               mp_irqs[pos].mpc_irqtype = 0;
-               mp_irqs[pos].mpc_irqflag = 0;
-               mp_irqs[pos].mpc_srcbus = 0;
+               mp_irqs[pos].mpc_irqtype = mp_INT;
+               mp_irqs[pos].mpc_irqflag = (1 << 2) | 1;        /* High-active edge */
+               mp_irqs[pos].mpc_srcbus = MP_BUS_ISA;
                mp_irqs[pos].mpc_srcbusirq = i;
                mp_irqs[pos].mpc_dstapic = 0;
                mp_irqs[pos].mpc_dstirq = i;
index 6bf227df57dc3e69d79b575bc45a68dda2dd7a01..fc73c2e85475162bbff309e320f6de88b0cda41a 100644 (file)
@@ -519,34 +519,22 @@ void exit_thread(void)
 void flush_thread(void)
 {
        int i;
+       struct task_struct *tsk = current;
 
        for (i=0 ; i<8 ; i++)
-               current->tss.debugreg[i] = 0;
+               tsk->tss.debugreg[i] = 0;
 
        /*
         * Forget coprocessor state..
         */
-       if (current->flags & PF_USEDFPU) {
-               current->flags &= ~PF_USEDFPU;
-               stts();
-       }
-       current->used_math = 0;
+       clear_fpu(tsk);
+       tsk->used_math = 0;
 }
 
 void release_thread(struct task_struct *dead_task)
 {
 }
 
-static inline void unlazy_fpu(struct task_struct *tsk)
-{
-       if (tsk->flags & PF_USEDFPU) {
-               __asm__("fnsave %0":"=m" (tsk->tss.i387));
-               asm volatile("fwait");
-               tsk->flags &= ~PF_USEDFPU;
-               stts();
-       }
-}
-
 /*
  * If new_mm is NULL, we're being called to set up the LDT descriptor
  * for a clone task. Each clone must have a separate entry in the GDT.
@@ -621,11 +609,12 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
 int dump_fpu (struct pt_regs * regs, struct user_i387_struct* fpu)
 {
        int fpvalid;
+       struct task_struct *tsk = current;
 
-       fpvalid = current->used_math;
+       fpvalid = tsk->used_math;
        if (fpvalid) {
-               unlazy_fpu(current);
-               memcpy(fpu,&current->tss.i387.hard,sizeof(*fpu));
+               unlazy_fpu(tsk);
+               memcpy(fpu,&tsk->tss.i387.hard,sizeof(*fpu));
        }
 
        return fpvalid;
index 8968b334e1f76dd9d1641a5161df45885120b137..8f0a1c00580542da2aa549dc5dae2bf12334a16e 100644 (file)
@@ -647,8 +647,6 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
 #endif
                          __copy_from_user(&child->tss.i387.hard, (void *)data,
                                           sizeof(struct user_i387_struct));
-                         child->flags &= ~PF_USEDFPU;
-                         stts();
 #ifdef CONFIG_MATH_EMULATION
                        } else {
                          restore_i387_soft(&child->tss.i387.soft,
index 47e3c302717060e4c895184ddcb040b0d28c3d36..e6ed37c3b330250f8dec5a73a6d4e6201867a763 100644 (file)
@@ -153,11 +153,9 @@ struct rt_sigframe
 
 static inline int restore_i387_hard(struct _fpstate *buf)
 {
-       if (current->flags & PF_USEDFPU) {
-               current->flags &= ~PF_USEDFPU;
-               stts();
-       }
-       return __copy_from_user(&current->tss.i387.hard, buf, sizeof(*buf));
+       struct task_struct *tsk = current;
+       clear_fpu(tsk);
+       return __copy_from_user(&tsk->tss.i387.hard, buf, sizeof(*buf));
 }
 
 static inline int restore_i387(struct _fpstate *buf)
@@ -307,14 +305,11 @@ badframe:
 
 static inline int save_i387_hard(struct _fpstate * buf)
 {
-       if (current->flags & PF_USEDFPU) {
-               current->flags &= ~PF_USEDFPU;
-               __asm__ __volatile__("fnsave %0":"=m"(current->tss.i387.hard));
-               stts();
-       }
-       asm volatile("fwait");
-       current->tss.i387.hard.status = current->tss.i387.hard.swd;
-       if (__copy_to_user(buf, &current->tss.i387.hard, sizeof(*buf)))
+       struct task_struct *tsk = current;
+
+       unlazy_fpu(tsk);
+       tsk->tss.i387.hard.status = tsk->tss.i387.hard.swd;
+       if (__copy_to_user(buf, &tsk->tss.i387.hard, sizeof(*buf)))
                return -1;
        return 1;
 }
index bd9c5a760831e4c73468253ec354627c82981c19..08f8154e67772fa974002aa262c56c9c471ffe41 100644 (file)
@@ -385,20 +385,15 @@ void math_error(void)
 {
        struct task_struct * task;
 
-       lock_kernel();
-       clts();
-       task = current;
        /*
-        *      Save the info for the exception handler
+        * Save the info for the exception handler
+        * (this will also clear the error)
         */
-       __asm__ __volatile__("fnsave %0":"=m" (task->tss.i387.hard));
-       task->flags&=~PF_USEDFPU;
-       stts();
-
+       task = current;
+       unlazy_fpu(task);
        task->tss.trap_no = 16;
        task->tss.error_code = 0;
        force_sig(SIGFPE, task);
-       unlock_kernel();
 }
 
 asmlinkage void do_coprocessor_error(struct pt_regs * regs, long error_code)
@@ -426,16 +421,6 @@ asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs,
 asmlinkage void math_state_restore(void)
 {
        __asm__ __volatile__("clts");           /* Allow maths ops (or we recurse) */
-
-/*
- *     SMP is actually simpler than uniprocessor for once. Because
- *     we can't pull the delayed FPU switching trick Linus does
- *     we simply have to do the restore each context switch and
- *     set the flag. switch_to() will always save the state in
- *     case we swap processors. We also don't use the coprocessor
- *     timer - IRQ 13 mode isn't used with SMP machines (thank god).
- */
-
        if(current->used_math)
                __asm__("frstor %0": :"m" (current->tss.i387));
        else
index 85177ada1ce7fb0a3c61b259006e11dd22c39ff9..c63837287d77061b0cca9b6898d8ce981858fd11 100644 (file)
@@ -33,6 +33,7 @@ else
       bool '   Generic PCI IDE chipset support' CONFIG_BLK_DEV_IDEPCI
       if [ "$CONFIG_BLK_DEV_IDEPCI" = "y" ]; then
         bool '     Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA
+        bool '     Boot off-board chipsets first support' CONFIG_BLK_DEV_OFFBOARD
         if [ "$CONFIG_BLK_DEV_IDEDMA" = "y" ]; then
           bool '     Use DMA by default when available' CONFIG_IDEDMA_AUTO
         fi
index f823ffdd25d5eb45abcc345070ac52576d684bad..2a987e3d5dd74ca0a48876e789bb272df5423fbe 100644 (file)
@@ -117,29 +117,39 @@ typedef struct ide_pci_device_s {
        unsigned int            extra;
 } ide_pci_device_t;
 
+#ifdef CONFIG_BLK_DEV_OFFBOARD
+#  define ON_BOARD             0
+#  define OFF_BOARD            1
+#  define NEVER_BOARD          0
+#else /* CONFIG_BLK_DEV_OFFBOARD */
+#  define ON_BOARD             1
+#  define OFF_BOARD            0
+#  define NEVER_BOARD          0
+#endif /* CONFIG_BLK_DEV_OFFBOARD */
+
 static ide_pci_device_t ide_pci_chipsets[] __initdata = {
-       {DEVID_PIIXa,   "PIIX",         NULL,           {{0x41,0x80,0x80}, {0x43,0x80,0x80}},   0x01,   0 },
-       {DEVID_PIIXb,   "PIIX",         NULL,           {{0x41,0x80,0x80}, {0x43,0x80,0x80}},   0x01,   0 },
-       {DEVID_PIIX3,   "PIIX3",        NULL,           {{0x41,0x80,0x80}, {0x43,0x80,0x80}},   0x01,   0 },
-       {DEVID_PIIX4,   "PIIX4",        NULL,           {{0x41,0x80,0x80}, {0x43,0x80,0x80}},   0x01,   0 },
-       {DEVID_VP_IDE,  "VP_IDE",       INIT_VIA82C586, {{0x40,0x02,0x02}, {0x40,0x01,0x01}},   0x01,   0 },
-       {DEVID_PDC20246,"PDC20246",     NULL,           {{0x50,0x02,0x02}, {0x50,0x04,0x04}},   0x01,   16 },
-       {DEVID_RZ1000,  "RZ1000",       INIT_RZ1000,    {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   0x01,   0 },
-       {DEVID_RZ1001,  "RZ1001",       INIT_RZ1000,    {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   0x01,   0 },
-       {DEVID_CMD640,  "CMD640",       IDE_IGNORE,     {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   0x01,   0 },
-       {DEVID_NS87410, "NS87410",      NULL,           {{0x43,0x08,0x08}, {0x47,0x08,0x08}},   0x01,   0 },
-       {DEVID_SIS5513, "SIS5513",      NULL,           {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},   0x01,   0 },
-       {DEVID_CMD646,  "CMD646",       INIT_CMD646,    {{0x00,0x00,0x00}, {0x51,0x80,0x80}},   0x01,   0 },
-       {DEVID_HT6565,  "HT6565",       NULL,           {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   0x01,   0 },
-       {DEVID_OPTI621, "OPTI621",      INIT_OPTI621,   {{0x45,0x80,0x00}, {0x40,0x08,0x00}},   0x01,   0 },
-       {DEVID_OPTI621X,"OPTI621X",     INIT_OPTI621,   {{0x45,0x80,0x00}, {0x40,0x08,0x00}},   0x01,   0 },
-       {DEVID_TRM290,  "TRM290",       INIT_TRM290,    {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   0x01,   0 },
-       {DEVID_NS87415, "NS87415",      INIT_NS87415,   {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   0x01,   0 },
-       {DEVID_AEC6210, "AEC6210",      NULL,           {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   0x01,   0 },
-       {DEVID_W82C105, "W82C105",      INIT_W82C105,   {{0x40,0x01,0x01}, {0x40,0x10,0x10}},   0x01,   0 },
-       {DEVID_UM8886BF,"UM8886BF",     NULL,           {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   0x01,   0 },
-       {DEVID_HPT343,  "HPT343",       NULL,           {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   0x00,   16 },
-       {IDE_PCI_DEVID_NULL, "PCI_IDE", NULL,           {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   0x01,   0 }};
+       {DEVID_PIIXa,   "PIIX",         NULL,           {{0x41,0x80,0x80}, {0x43,0x80,0x80}},   ON_BOARD,       0 },
+       {DEVID_PIIXb,   "PIIX",         NULL,           {{0x41,0x80,0x80}, {0x43,0x80,0x80}},   ON_BOARD,       0 },
+       {DEVID_PIIX3,   "PIIX3",        NULL,           {{0x41,0x80,0x80}, {0x43,0x80,0x80}},   ON_BOARD,       0 },
+       {DEVID_PIIX4,   "PIIX4",        NULL,           {{0x41,0x80,0x80}, {0x43,0x80,0x80}},   ON_BOARD,       0 },
+       {DEVID_VP_IDE,  "VP_IDE",       INIT_VIA82C586, {{0x40,0x02,0x02}, {0x40,0x01,0x01}},   ON_BOARD,       0 },
+       {DEVID_PDC20246,"PDC20246",     NULL,           {{0x50,0x02,0x02}, {0x50,0x04,0x04}},   OFF_BOARD,      16 },
+       {DEVID_RZ1000,  "RZ1000",       INIT_RZ1000,    {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   ON_BOARD,       0 },
+       {DEVID_RZ1001,  "RZ1001",       INIT_RZ1000,    {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   ON_BOARD,       0 },
+       {DEVID_CMD640,  "CMD640",       IDE_IGNORE,     {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   ON_BOARD,       0 },
+       {DEVID_NS87410, "NS87410",      NULL,           {{0x43,0x08,0x08}, {0x47,0x08,0x08}},   ON_BOARD,       0 },
+       {DEVID_SIS5513, "SIS5513",      NULL,           {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},   ON_BOARD,       0 },
+       {DEVID_CMD646,  "CMD646",       INIT_CMD646,    {{0x00,0x00,0x00}, {0x51,0x80,0x80}},   ON_BOARD,       0 },
+       {DEVID_HT6565,  "HT6565",       NULL,           {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   ON_BOARD,       0 },
+       {DEVID_OPTI621, "OPTI621",      INIT_OPTI621,   {{0x45,0x80,0x00}, {0x40,0x08,0x00}},   ON_BOARD,       0 },
+       {DEVID_OPTI621X,"OPTI621X",     INIT_OPTI621,   {{0x45,0x80,0x00}, {0x40,0x08,0x00}},   ON_BOARD,       0 },
+       {DEVID_TRM290,  "TRM290",       INIT_TRM290,    {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   ON_BOARD,       0 },
+       {DEVID_NS87415, "NS87415",      INIT_NS87415,   {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   ON_BOARD,       0 },
+       {DEVID_AEC6210, "AEC6210",      NULL,           {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   OFF_BOARD,      0 },
+       {DEVID_W82C105, "W82C105",      INIT_W82C105,   {{0x40,0x01,0x01}, {0x40,0x10,0x10}},   ON_BOARD,       0 },
+       {DEVID_UM8886BF,"UM8886BF",     NULL,           {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   ON_BOARD,       0 },
+       {DEVID_HPT343,  "HPT343",       NULL,           {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   NEVER_BOARD,    16 },
+       {IDE_PCI_DEVID_NULL, "PCI_IDE", NULL,           {{0x00,0x00,0x00}, {0x00,0x00,0x00}},   ON_BOARD,       0 }};
 
 /*
  * This allows offboard ide-pci cards the enable a BIOS, verify interrupt
@@ -176,6 +186,8 @@ __initfunc(static unsigned int ide_special_settings (struct pci_dev *dev, const
                                }
                        }
                        return dev->irq;
+               case PCI_DEVICE_ID_TTI_HPT343:
+                       return dev->irq;
                default:
                        break;
        }
index f965fb9da4789622820baceeb82c257d31441842..680f9e592ffab1f3149df06655c4955e0cc3767b 100644 (file)
         1.01    GRG 1998.05.06 init_proto, release_proto
                               fix chip detect
                               added EPP-16 and EPP-32
+       1.02    GRG 1998.09.23 added hard reset to initialisation process
 
 */
 
-#define        FRPW_VERSION    "1.01
+#define        FRPW_VERSION    "1.02
 
 #include <linux/module.h>
 #include <linux/delay.h>
@@ -184,6 +185,9 @@ static int frpw_test_pnp ( PIA *pi )
 
 {      int olddelay, a, b;
 
+        w0(0); w2(8); udelay(50); w2(0xc);   /* parallel bus reset */
+        mdelay(1500);
+
        olddelay = pi->delay;
        pi->delay = 10;
 
diff --git a/drivers/block/paride/jumbo b/drivers/block/paride/jumbo
new file mode 100644 (file)
index 0000000..b952fde
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# This script can be used to build "jumbo" modules that contain the
+# base PARIDE support, one protocol module and one high-level driver.
+#
+echo -n "High level driver [pcd] : "
+read X
+HLD=${X:-pcd}
+#
+echo -n "Protocol module [bpck] : "
+read X
+PROTO=${X:-bpck}
+#
+echo -n "Use MODVERSIONS [y] ? "
+read X
+UMODV=${X:-y}
+#
+echo -n "For SMP kernel [n] ? "
+read X
+USMP=${X:-n}
+#
+echo -n "Support PARPORT [n] ? "
+read X
+UPARP=${X:-n}
+#
+echo
+#
+case $USMP in
+       y* | Y* ) FSMP="-D__SMP__"
+                 ;;
+       *)        FSMP=""
+                 ;;
+esac
+#
+MODI="-include ../../../include/linux/modversions.h"
+#
+case $UMODV in
+       y* | Y* ) FMODV="-DMODVERSIONS $MODI"
+                 ;;
+       *)        FMODV=""
+                 ;;
+esac
+#
+case $UPARP in
+       y* | Y* ) FPARP="-DCONFIG_PARPORT"
+                 ;;
+       *)        FPARP=""
+                 ;;
+esac
+#
+TARG=$HLD-$PROTO.o
+FPROTO=-DCONFIG_PARIDE_`echo "$PROTO" | tr [a-z] [A-Z]`
+FK="-D__KERNEL__ -I ../../../include"
+FLCH=-D_LINUX_CONFIG_H
+#
+echo cc $FK $FSMP $FLCH $FPARP $FPROTO -Wall -O2 -o Jb.o -c paride.c
+cc $FK $FSMP $FLCH $FPARP $FPROTO -Wall -O2 -o Jb.o -c paride.c
+#
+echo cc $FK $FSMP -Wall -O2 -o Jp.o -c $PROTO.c
+cc $FK $FSMP -Wall -O2 -o Jp.o -c $PROTO.c
+#
+echo cc $FK $FSMP $FMODV -DMODULE -DPARIDE_JUMBO -Wall -O2 -o Jd.o -c $HLD.c
+cc $FK $FSMP $FMODV -DMODULE -DPARIDE_JUMBO -Wall -O2 -o Jd.o -c $HLD.c
+#
+echo ld -r -o $TARG Jp.o Jb.o Jd.o
+ld -r -o $TARG Jp.o Jb.o Jd.o
+#
+#
+rm Jp.o Jb.o Jd.o
+#
index 89457cc801fbe98fcc3feea31de92ae6a4199d0b..78477593e545f21c0d069a8bf0ab72742bc79ab8 100644 (file)
 /* Changes:
 
         1.01    GRG 1998.05.06 init_proto, release_proto
+       1.02    GRG 1998.09.23 updates for the -E rev chip
 
 */
 
-#define ON26_VERSION      "1.01"
+#define ON26_VERSION      "1.02"
 
 #include <linux/module.h>
 #include <linux/delay.h>
@@ -91,8 +92,8 @@ static void on26_write_regr( PIA *pi, int cont, int regr, int val )
         }
 }
 
-#define  CCP(x)  w0(0xff);w0(0xaa);w0(0x55);w0(0);w0(0xff);\
-                w0(0x87);w0(0x78);w0(x);w2(4);
+#define  CCP(x)  w0(0xfe);w0(0xaa);w0(0x55);w0(0);w0(0xff);\
+                w0(0x87);w0(0x78);w0(x);w2(4);w2(5);w2(4);w0(0xff);
 
 static void on26_connect ( PIA *pi )
 
@@ -102,7 +103,6 @@ static void on26_connect ( PIA *pi )
         pi->saved_r2 = r2();
 
         CCP(0x20);
-       w2(0xcd); w2(0xcc); w0(0xff);
        x = 8; if (pi->mode) x = 9;
 
        w0(2); P1; w0(8); P2;
@@ -114,11 +114,62 @@ static void on26_disconnect ( PIA *pi )
 {       if (pi->mode >= 2) { w3(4); w3(4); w3(4); w3(4); }
                      else { w0(4); P1; w0(4); P1; }
        CCP(0x30);
-        w2(0xcd); w2(0xcc); w0(0xff);
         w0(pi->saved_r0);
         w2(pi->saved_r2);
 } 
 
+static int on26_test_port( PIA *pi)  /* hard reset */
+
+{       int     i, m, d;
+
+        pi->saved_r0 = r0();
+        pi->saved_r2 = r2();
+
+        d = pi->delay;
+        m = pi->mode;
+        pi->delay = 5;
+        pi->mode = 0;
+
+        w2(0xc);
+
+        CCP(0x30); CCP(0); 
+
+        w0(0xfe);w0(0xaa);w0(0x55);w0(0);w0(0xff);
+        i = ((r1() & 0xf0) << 4); w0(0x87);
+        i |= (r1() & 0xf0); w0(0x78);
+        w0(0x20);w2(4);w2(5);
+        i |= ((r1() & 0xf0) >> 4);
+        w2(4);w0(0xff);
+
+        if (i == 0xb5f) {
+
+            w0(2); P1; w0(0);   P2;
+            w0(3); P1; w0(0);   P2;
+            w0(2); P1; w0(8);   P2; udelay(100);
+            w0(2); P1; w0(0xa); P2; udelay(100);
+            w0(2); P1; w0(8);   P2; udelay(1000);
+            
+            on26_write_regr(pi,0,6,0xa0);
+
+            for (i=0;i<100;i++) {
+                if (!(on26_read_regr(pi,0,7) & 0x80)) break;
+                udelay(100000);
+            }
+
+            w0(4); P1; w0(4); P1;
+        }
+
+        CCP(0x30);
+
+        pi->delay = d;
+        pi->mode = m;
+        w0(pi->saved_r0);
+        w2(pi->saved_r2);
+
+        return 5;
+}
+
+
 static void on26_read_block( PIA *pi, char * buf, int count )
 
 {       int     k, a, b;
@@ -240,7 +291,7 @@ struct pi_protocol on26 = {"on26",0,5,2,1,1,
                            on26_read_block,
                            on26_connect,
                            on26_disconnect,
-                           0,
+                           on26_test_port,
                            0,
                            0,
                            on26_log_adapter,
index 4a083abbfcb14c69bc75efd88105726d3739f668..48055268c573804835f6bb869979420a09850b93 100644 (file)
                                pcd_completion, use HZ in loop timing
        1.05    GRG 1998.08.16  Conformed to "Uniform CD-ROM" standard
        1.06    GRG 1998.08.19  Added audio ioctl support
+       1.07    GRG 1998.09.24  Increased reset timeout, added jumbo support
 
 */
 
-#define        PCD_VERSION     "1.06"
+#define        PCD_VERSION     "1.07"
 #define PCD_MAJOR      46
 #define PCD_NAME       "pcd"
 #define PCD_UNITS      4
@@ -191,7 +192,7 @@ MODULE_PARM(drive3,"1-6i");
 #define PCD_TMO                   800          /* timeout in jiffies */
 #define PCD_DELAY           50          /* spin delay in uS */
 #define PCD_READY_TMO      20          /* in seconds */
-#define PCD_RESET_TMO      30          /* in tenths of a second */
+#define PCD_RESET_TMO     100          /* in tenths of a second */
 
 #define PCD_SPIN       (1000000*PCD_TMO)/(HZ*PCD_DELAY)
 
@@ -365,6 +366,12 @@ int        init_module(void)
 
 {      int     err;
 
+#ifdef PARIDE_JUMBO
+       { extern paride_init();
+         paride_init();
+       } 
+#endif
+
        err = pcd_init();
 
        return err;
index 69274fe4873d366f56ccc7a754c5e49a663f25cc..3518a59d644a7a5b65b9ed33bc01af657c0274f9 100644 (file)
                                Added slave support
        1.03    GRG 1998.06.16  Eliminate an Ugh.
        1.04    GRG 1998.08.15  Extra debugging, use HZ in loop timing
+       1.05    GRG 1998.09.24  Added jumbo support
 
 */
 
-#define PD_VERSION      "1.04"
+#define PD_VERSION      "1.05"
 #define PD_MAJOR       45
 #define PD_NAME                "pd"
 #define PD_UNITS       4
@@ -611,6 +612,12 @@ int     init_module(void)
 
 {       int     err, unit;
 
+#ifdef PARIDE_JUMBO
+       { extern paride_init();
+         paride_init();
+       } 
+#endif
+
         err = pd_init();
         if (err) return err;
 
index a2f1f1da9e306d151c6245346b39df154c846dff..a6418efa7baf9da82ea5c1df661e72dc1b9d6210 100644 (file)
                                up transfer size.
        1.02    GRG 1998.06.16  Eliminated an Ugh
        1.03    GRG 1998.08.16  Use HZ in loop timings, extra debugging
+       1.04    GRG 1998.09.24  Added jumbo support
 
 */
 
-#define PF_VERSION      "1.03"
+#define PF_VERSION      "1.04"
 #define PF_MAJOR       47
 #define PF_NAME                "pf"
 #define PF_UNITS       4
@@ -509,6 +510,12 @@ int     init_module(void)
 
 {       int     err;
 
+#ifdef PARIDE_JUMBO
+       { extern paride_init();
+         paride_init();
+       } 
+#endif
+
         err = pf_init();
 
         return err;
index fd001008dad750281eb38e60ceb31dc9c61014fd..128b2a2e5804c0c083b988bbf56e531d40360ade 100644 (file)
        To use this device, you must have the following device 
        special files defined:
 
-               /dev/pg0 b 97 0
-               /dev/pg1 b 97 1
-               /dev/pg2 b 97 2
-               /dev/pg3 b 97 3
+               /dev/pg0 c 97 0
+               /dev/pg1 c 97 1
+               /dev/pg2 c 97 2
+               /dev/pg3 c 97 3
 
        (You'll need to change the 97 to something else if you use
        the 'major' parameter to install the driver on a different
 /* Changes:
 
        1.01    GRG 1998.06.16  Bug fixes
+       1.02    GRG 1998.09.24  Added jumbo support
+
 */
 
-#define PG_VERSION      "1.01"
+#define PG_VERSION      "1.02"
 #define PG_MAJOR       97
 #define PG_NAME                "pg"
 #define PG_UNITS       4
@@ -324,6 +326,12 @@ int     init_module(void)
 
 {       int     err;
 
+#ifdef PARIDE_JUMBO
+       { extern paride_init();
+         paride_init();
+       } 
+#endif
+
        err = pg_init();
 
        return err;
index 44c4dadfbe6ebe150537f1b33763034cf8e5dc5c..48fcdda747af996daaa90627e5d5536aaf748f8f 100644 (file)
        1.02    GRG 1998.06.16  Eliminate an Ugh.
        1.03    GRG 1998.08.15  Adjusted PT_TMO, use HZ in loop timing,
                                extra debugging
-
+       1.04    GRG 1998.09.24  Repair minor coding error, added jumbo support
+       
 */
 
-#define PT_VERSION      "1.03"
+#define PT_VERSION      "1.04"
 #define PT_MAJOR       96
 #define PT_NAME                "pt"
 #define PT_UNITS       4
@@ -328,6 +329,12 @@ int     init_module(void)
 
 {       int     err;
 
+#ifdef PARIDE_JUMBO
+       { extern paride_init();
+         paride_init();
+       } 
+#endif
+
         err = pt_init();
 
         return err;
@@ -584,8 +591,8 @@ static int pt_identify( int unit )
        char    *ms[2] = {"master","slave"};
        char    mf[10], id[18];
        char    id_cmd[12] = { ATAPI_IDENTIFY,0,0,0,36,0,0,0,0,0,0,0};
-        char    ms_cmd[12] = { ATAPI_MODE_SENSE,0,0x2a,0,128,0,0,0,0,0,0,0};
-       char    ls_cmd[12] = { ATAPI_LOG_SENSE,0,0x71,0,0,0,0,0,128,0,0,0};
+        char    ms_cmd[12] = { ATAPI_MODE_SENSE,0,0x2a,0,36,0,0,0,0,0,0,0};
+       char    ls_cmd[12] = { ATAPI_LOG_SENSE,0,0x71,0,0,0,0,0,36,0,0,0};
        char    buf[36];
 
         s = pt_atapi(unit,id_cmd,36,buf,"identify");
index 5d7857c777106f027c2393a2bd8cbe96ade593dc..ac9462c9a355be29063fa386ac255aa968ad13e9 100644 (file)
@@ -27,9 +27,6 @@ ifdef CONFIG_VT
 L_OBJS += vt.o vc_screen.o consolemap.o consolemap_deftbl.o
 LX_OBJS += console.o selection.o
 endif
-ifdef CONFIG_FB
-  LX_OBJS += fbmem.o
-endif
 
 ifeq ($(CONFIG_SERIAL),y)
   ifndef CONFIG_SUN_SERIAL
diff --git a/drivers/char/fbmem.c b/drivers/char/fbmem.c
deleted file mode 100644 (file)
index e1c1140..0000000
+++ /dev/null
@@ -1,654 +0,0 @@
-/*
- *  linux/drivers/char/fbmem.c
- *
- *  Copyright (C) 1994 Martin Schaller
- *
- * 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/types.h>
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/malloc.h>
-#include <linux/mman.h>
-#include <linux/tty.h>
-#include <linux/console.h>
-#include <linux/console_struct.h>
-#include <linux/init.h>
-#ifdef CONFIG_PROC_FS
-#include <linux/proc_fs.h>
-#endif
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
-
-#ifdef __mc68000__
-#include <asm/setup.h>
-#endif
-#ifdef __powerpc__
-#include <asm/io.h>
-#endif
-#include <asm/uaccess.h>
-#include <asm/page.h>
-#include <asm/pgtable.h>
-
-#include <linux/fb.h>
-
-
-    /*
-     *  Frame buffer device initialization and setup routines
-     */
-
-extern unsigned long acornfb_init(void);
-extern void acornfb_setup(char *options, int *ints);
-extern void amifb_init(void);
-extern void amifb_setup(char *options, int *ints);
-extern void atafb_init(void);
-extern void atafb_setup(char *options, int *ints);
-extern void macfb_init(void);
-extern void macfb_setup(char *options, int *ints);
-extern void cyberfb_init(void);
-extern void cyberfb_setup(char *options, int *ints);
-extern void retz3fb_init(void);
-extern void retz3fb_setup(char *options, int *ints);
-extern void clgenfb_init(void);
-extern void clgenfb_setup(char *options, int *ints);
-extern void vfb_init(void);
-extern void vfb_setup(char *options, int *ints);
-extern void offb_init(void);
-extern void offb_setup(char *options, int *ints);
-extern void atyfb_init(void);
-extern void atyfb_setup(char *options, int *ints);
-extern void dnfb_init(void);
-extern void tgafb_init(void);
-extern void virgefb_init(void);
-extern void virgefb_setup(char *options, int *ints);
-extern void resolver_video_setup(char *options, int *ints);
-extern void s3triofb_init(void);
-extern void s3triofb_setup(char *options, int *ints);
-extern void vgafb_init(void);
-extern void vgafb_setup(char *options, int *ints);
-extern void vesafb_init(void);
-extern void vesafb_setup(char *options, int *ints);
-extern void mdafb_init(void);
-extern void mdafb_setup(char *options, int *ints);
-extern void hpfb_init(void);
-extern void hpfb_setup(char *options, int *ints);
-extern void sbusfb_init(void);
-extern void sbusfb_setup(char *options, int *ints);
-
-static struct {
-       const char *name;
-       void (*init)(void);
-       void (*setup)(char *options, int *ints);
-} fb_drivers[] __initdata = {
-#ifdef CONFIG_FB_RETINAZ3
-       { "retz3", retz3fb_init, retz3fb_setup },
-#endif
-#ifdef CONFIG_FB_ACORN
-       { "acorn", acornfb_init, acornfb_setup },
-#endif
-#ifdef CONFIG_FB_AMIGA
-       { "amifb", amifb_init, amifb_setup },
-#endif
-#ifdef CONFIG_FB_ATARI
-       { "atafb", atafb_init, atafb_setup },
-#endif
-#ifdef CONFIG_FB_MAC
-       { "macfb", macfb_init, macfb_setup },
-#endif
-#ifdef CONFIG_FB_CYBER
-       { "cyber", cyberfb_init, cyberfb_setup },
-#endif
-#ifdef CONFIG_FB_CLGEN
-       { "clgen", clgenfb_init, clgenfb_setup },
-#endif
-#ifdef CONFIG_FB_OF
-       { "offb", offb_init, offb_setup },
-#endif
-#ifdef CONFIG_FB_ATY
-       { "atyfb", atyfb_init, atyfb_setup },
-#endif
-#ifdef CONFIG_APOLLO
-       { "apollo", dnfb_init, NULL },
-#endif
-#ifdef CONFIG_FB_S3TRIO
-       { "s3trio", s3triofb_init, s3triofb_setup },
-#endif 
-#ifdef CONFIG_FB_TGA
-       { "tga", tgafb_init, NULL },
-#endif
-#ifdef CONFIG_FB_VIRGE
-       { "virge", virgefb_init, virgefb_setup },
-#endif
-#ifdef CONFIG_FB_VGA
-       { "vga", vgafb_init, vgafb_setup },
-#endif 
-#ifdef CONFIG_FB_VESA
-       { "vesa", vesafb_init, vesafb_setup },
-#endif 
-#ifdef CONFIG_FB_MDA
-       { "mda", mdafb_init, mdafb_setup },
-#endif 
-#ifdef CONFIG_FB_HP300
-       { "hpfb", hpfb_init, hpfb_setup },
-#endif 
-#ifdef CONFIG_FB_SBUS
-       { "sbus", sbusfb_init, sbusfb_setup },
-#endif
-#ifdef CONFIG_GSP_RESOLVER
-       /* Not a real frame buffer device... */
-       { "resolver", NULL, resolver_video_setup },
-#endif
-#ifdef CONFIG_FB_VIRTUAL
-       /* Must be last to avoid that vfb becomes your primary display */
-       { "vfb", vfb_init, vfb_setup },
-#endif
-};
-
-#define NUM_FB_DRIVERS (sizeof(fb_drivers)/sizeof(*fb_drivers))
-
-static void (*pref_init_funcs[FB_MAX])(void);
-static int num_pref_init_funcs __initdata = 0;
-
-
-#define GET_INODE(i) MKDEV(FB_MAJOR, (i) << FB_MODES_SHIFT)
-#define GET_FB_VAR_IDX(node) (MINOR(node) & ((1 << FB_MODES_SHIFT)-1)) 
-
-struct fb_info *registered_fb[FB_MAX];
-int num_registered_fb = 0;
-
-char con2fb_map[MAX_NR_CONSOLES];
-
-static inline int PROC_CONSOLE(void)
-{
-       if (!current->tty)
-               return fg_console;
-
-       if (current->tty->driver.type != TTY_DRIVER_TYPE_CONSOLE)
-               /* XXX Should report error here? */
-               return fg_console;
-
-       if (MINOR(current->tty->device) < 1)
-               return fg_console;
-
-       return MINOR(current->tty->device) - 1;
-}
-
-#ifdef CONFIG_PROC_FS
-static int fbmem_read_proc(char *buf, char **start, off_t offset,
-                          int len, int *eof, void *private)
-{
-       struct fb_info **fi;
-
-       len = 0;
-       for (fi = registered_fb; fi < &registered_fb[FB_MAX] && len < 4000; fi++)
-               if (*fi)
-                       len += sprintf(buf + len, "%d %s\n",
-                                      GET_FB_IDX((*fi)->node),
-                                      (*fi)->modename);
-       *start = buf + offset;
-       return len > offset ? len - offset : 0;
-}
-#endif
-
-static ssize_t
-fb_read(struct file *file, char *buf, size_t count, loff_t *ppos)
-{
-       unsigned long p = *ppos;
-       struct inode *inode = file->f_dentry->d_inode;
-       int fbidx = GET_FB_IDX(inode->i_rdev);
-       struct fb_info *info = registered_fb[fbidx];
-       struct fb_ops *fb = info->fbops;
-       struct fb_fix_screeninfo fix;
-       char *base_addr;
-       ssize_t copy_size;
-
-       if (! fb || ! info->disp)
-               return -ENODEV;
-
-       fb->fb_get_fix(&fix,PROC_CONSOLE(), info);
-       base_addr=info->disp->screen_base;
-       copy_size=(count + p <= fix.smem_len ? count : fix.smem_len - p);
-       if (copy_to_user(buf, base_addr+p, copy_size))
-           return -EFAULT;
-       *ppos += copy_size;
-       return copy_size;
-}
-
-static ssize_t
-fb_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
-{
-       unsigned long p = *ppos;
-       struct inode *inode = file->f_dentry->d_inode;
-       int fbidx = GET_FB_IDX(inode->i_rdev);
-       struct fb_info *info = registered_fb[fbidx];
-       struct fb_ops *fb = info->fbops;
-       struct fb_fix_screeninfo fix;
-       char *base_addr;
-       ssize_t copy_size;
-
-       if (! fb || ! info->disp)
-               return -ENODEV;
-
-       fb->fb_get_fix(&fix, PROC_CONSOLE(), info);
-       base_addr=info->disp->screen_base;
-       copy_size=(count + p <= fix.smem_len ? count : fix.smem_len - p);
-       if (copy_from_user(base_addr+p, buf, copy_size))
-           return -EFAULT;
-       file->f_pos += copy_size;
-       return copy_size;
-}
-
-
-static void set_con2fb_map(int unit, int newidx)
-{
-    int oldidx = con2fb_map[unit];
-    struct fb_info *oldfb, *newfb;
-    struct vc_data *conp;
-
-    if (newidx != con2fb_map[unit]) {
-       oldfb = registered_fb[oldidx];
-       newfb = registered_fb[newidx];
-       if (newfb->fbops->fb_open(newfb,0))
-          return;
-       oldfb->fbops->fb_release(oldfb,0);
-       conp = fb_display[unit].conp;
-       con2fb_map[unit] = newidx;
-       fb_display[unit] = *(newfb->disp);
-       fb_display[unit].conp = conp;
-       fb_display[unit].fb_info = newfb;
-       if (!newfb->changevar)
-          newfb->changevar = oldfb->changevar;
-       /* tell console var has changed */
-       if (newfb->changevar)
-          newfb->changevar(unit);
-    }
-}
-
-#ifdef CONFIG_KMOD
-static void try_to_load(int fb)
-{
-       char modname[16];
-
-       sprintf(modname, "fb%d", fb);
-       request_module(modname);
-}
-#endif /* CONFIG_KMOD */
-
-static int 
-fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-        unsigned long arg)
-{
-       int fbidx = GET_FB_IDX(inode->i_rdev);
-       struct fb_info *info = registered_fb[fbidx];
-       struct fb_ops *fb = info->fbops;
-       struct fb_cmap cmap;
-       struct fb_var_screeninfo var;
-       struct fb_fix_screeninfo fix;
-       struct fb_con2fbmap con2fb;
-       int i;
-       
-       if (! fb)
-               return -ENODEV;
-       switch (cmd) {
-       case FBIOGET_VSCREENINFO:
-               if ((i = fb->fb_get_var(&var, PROC_CONSOLE(), info)))
-                       return i;
-               return copy_to_user((void *) arg, &var,
-                                   sizeof(var)) ? -EFAULT : 0;
-       case FBIOPUT_VSCREENINFO:
-               if (copy_from_user(&var, (void *) arg, sizeof(var)))
-                       return -EFAULT;
-               if ((i = fb->fb_set_var(&var, PROC_CONSOLE(), info)))
-                       return i;
-               if (copy_to_user((void *) arg, &var, sizeof(var)))
-                       return -EFAULT;
-               return 0;
-       case FBIOGET_FSCREENINFO:
-               if ((i = fb->fb_get_fix(&fix, PROC_CONSOLE(), info)))
-                       return i;
-               return copy_to_user((void *) arg, &fix, sizeof(fix)) ?
-                       -EFAULT : 0;
-       case FBIOPUTCMAP:
-               if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
-                       return -EFAULT;
-               return (fb->fb_set_cmap(&cmap, 0, PROC_CONSOLE(), info));
-       case FBIOGETCMAP:
-               if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
-                       return -EFAULT;
-               return (fb->fb_get_cmap(&cmap, 0, PROC_CONSOLE(), info));
-       case FBIOPAN_DISPLAY:
-               if (copy_from_user(&var, (void *) arg, sizeof(var)))
-                       return -EFAULT;
-               if ((i=fb->fb_pan_display(&var, PROC_CONSOLE(), info)))
-                       return i;
-               if (copy_to_user((void *) arg, &var, sizeof(var)))
-                       return -EFAULT;
-               return i;
-       case FBIOGET_CON2FBMAP:
-               if (copy_from_user(&con2fb, (void *)arg, sizeof(con2fb)))
-                       return -EFAULT;
-               if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
-                   return -EINVAL;
-               con2fb.framebuffer = con2fb_map[con2fb.console-1];
-               return copy_to_user((void *)arg, &con2fb,
-                                   sizeof(con2fb)) ? -EFAULT : 0;
-       case FBIOPUT_CON2FBMAP:
-               if (copy_from_user(&con2fb, (void *)arg, sizeof(con2fb)))
-                       return - EFAULT;
-               if (con2fb.console < 0 || con2fb.console > MAX_NR_CONSOLES)
-                   return -EINVAL;
-               if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX)
-                   return -EINVAL;
-#ifdef CONFIG_KMOD
-               if (!registered_fb[con2fb.framebuffer])
-                   try_to_load(con2fb.framebuffer);
-#endif /* CONFIG_KMOD */
-               if (!registered_fb[con2fb.framebuffer])
-                   return -EINVAL;
-               if (con2fb.console != 0)
-                   set_con2fb_map(con2fb.console-1, con2fb.framebuffer);
-               else
-                   /* set them all */
-                   for (i = 0; i < MAX_NR_CONSOLES; i++)
-                       set_con2fb_map(i, con2fb.framebuffer);
-               return 0;
-       default:
-               return fb->fb_ioctl(inode, file, cmd, arg, PROC_CONSOLE(),
-                                   info);
-       }
-}
-
-static int 
-fb_mmap(struct file *file, struct vm_area_struct * vma)
-{
-       int fbidx = GET_FB_IDX(file->f_dentry->d_inode->i_rdev);
-       struct fb_info *info = registered_fb[fbidx];
-       struct fb_ops *fb = info->fbops;
-       struct fb_fix_screeninfo fix;
-       struct fb_var_screeninfo var;
-       unsigned long start;
-       u32 len;
-
-       if (!fb)
-               return -ENODEV;
-       if (fb->fb_mmap)
-               return fb->fb_mmap(info, file, vma);
-       fb->fb_get_fix(&fix, PROC_CONSOLE(), info);
-
-       /* frame buffer memory */
-       start = (unsigned long)fix.smem_start;
-       len = (start & ~PAGE_MASK)+fix.smem_len;
-       start &= PAGE_MASK;
-       len = (len+~PAGE_MASK) & PAGE_MASK;
-       if (vma->vm_offset >= len) {
-               /* memory mapped io */
-               vma->vm_offset -= len;
-               fb->fb_get_var(&var, PROC_CONSOLE(), info);
-               if (var.accel_flags)
-                       return -EINVAL;
-               start = (unsigned long)fix.mmio_start;
-               len = (start & ~PAGE_MASK)+fix.mmio_len;
-               start &= PAGE_MASK;
-               len = (len+~PAGE_MASK) & PAGE_MASK;
-       }
-       if ((vma->vm_end - vma->vm_start + vma->vm_offset) > len)
-               return -EINVAL;
-       vma->vm_offset += start;
-       if (vma->vm_offset & ~PAGE_MASK)
-               return -ENXIO;
-#if defined(__mc68000__)
-       if (CPU_IS_020_OR_030)
-               pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
-       if (CPU_IS_040_OR_060) {
-               pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
-               /* Use no-cache mode, serialized */
-               pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
-       }
-#elif defined(__powerpc__)
-       pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE|_PAGE_GUARDED;
-#elif defined(__alpha__)
-       /* Caching is off in the I/O space quadrant by design.  */
-#elif defined(__sparc__)
-       /* Should never get here, all fb drivers should have their own
-          mmap routines */
-#elif defined(__i386__)
-       if (boot_cpu_data.x86 > 3)
-               pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
-#else
-#warning What do we have to do here??
-#endif
-       if (remap_page_range(vma->vm_start, vma->vm_offset,
-                            vma->vm_end - vma->vm_start, vma->vm_page_prot))
-               return -EAGAIN;
-       vma->vm_file = file;
-       file->f_count++;
-       return 0;
-}
-
-static int
-fb_open(struct inode *inode, struct file *file)
-{
-       int fbidx = GET_FB_IDX(inode->i_rdev);
-       struct fb_info *info;
-
-#ifdef CONFIG_KMOD
-       if (!(info = registered_fb[fbidx]))
-               try_to_load(fbidx);
-#endif /* CONFIG_KMOD */
-       if (!(info = registered_fb[fbidx]))
-               return -ENODEV;
-       return info->fbops->fb_open(info,1);
-}
-
-static int 
-fb_release(struct inode *inode, struct file *file)
-{
-       int fbidx = GET_FB_IDX(inode->i_rdev);
-       struct fb_info *info = registered_fb[fbidx];
-
-       info->fbops->fb_release(info,1);
-       return 0;
-}
-
-static struct file_operations fb_fops = {
-       NULL,           /* lseek        */
-       fb_read,        /* read         */
-       fb_write,       /* write        */
-       NULL,           /* readdir      */
-       NULL,           /* poll         */
-       fb_ioctl,       /* ioctl        */
-       fb_mmap,        /* mmap         */
-       fb_open,        /* open         */
-       NULL,           /* flush        */
-       fb_release,     /* release      */
-       NULL            /* fsync        */
-};
-
-int
-register_framebuffer(struct fb_info *fb_info)
-{
-       int i, j;
-       static int fb_ever_opened[FB_MAX];
-       static int first = 1;
-
-       if (num_registered_fb == FB_MAX)
-               return -ENXIO;
-       num_registered_fb++;
-       for (i = 0 ; i < FB_MAX; i++)
-               if (!registered_fb[i])
-                       break;
-       fb_info->node=GET_INODE(i);
-       registered_fb[i] = fb_info;
-       if (!fb_ever_opened[i]) {
-               /*
-                *  We assume initial frame buffer devices can be opened this
-                *  many times
-                */
-               for (j = 0; j < MAX_NR_CONSOLES; j++)
-                       if (con2fb_map[j] == i)
-                               fb_info->fbops->fb_open(fb_info,0);
-               fb_ever_opened[i] = 1;
-       }
-
-       if (first) {
-               first = 0;
-               take_over_console(&fb_con, 0, MAX_NR_CONSOLES-1, 1);
-       }
-
-       return 0;
-}
-
-int
-unregister_framebuffer(const struct fb_info *fb_info)
-{
-       int i, j;
-
-       i = GET_FB_IDX(fb_info->node);
-       for (j = 0; j < MAX_NR_CONSOLES; j++)
-               if (con2fb_map[j] == i)
-                       return -EBUSY;
-       if (!registered_fb[i])
-               return -EINVAL; 
-       registered_fb[i]=NULL;
-       num_registered_fb--;
-       return 0;
-}
-
-#ifdef CONFIG_PROC_FS
-static struct proc_dir_entry *proc_fbmem;
-#endif
-
-__initfunc(void
-fbmem_init(void))
-{
-       int i;
-
-#ifdef CONFIG_PROC_FS
-       proc_fbmem = create_proc_entry("fb", 0, 0);
-       if (proc_fbmem)
-               proc_fbmem->read_proc = fbmem_read_proc;
-#endif
-
-       if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
-               printk("unable to get major %d for fb devs\n", FB_MAJOR);
-
-       /*
-        *  Probe for all builtin frame buffer devices
-        */
-       for (i = 0; i < num_pref_init_funcs; i++)
-               pref_init_funcs[i]();
-
-       for (i = 0; i < NUM_FB_DRIVERS; i++)
-               if (fb_drivers[i].init)
-                       fb_drivers[i].init();
-}
-
-
-int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal,
-                       const struct fb_info *fb_info)
-{
-#if 0
-       /*
-        * long long divisions .... $#%%#$ 
-        */
-    unsigned long long hpicos, vpicos;
-    const unsigned long long _1e12 = 1000000000000ULL;
-    const struct fb_monspecs *monspecs = &fb_info->monspecs;
-
-    hpicos = (unsigned long long)htotal*(unsigned long long)pixclock;
-    vpicos = (unsigned long long)vtotal*(unsigned long long)hpicos;
-    if (!vpicos)
-       return 0;
-
-    if (monspecs->hfmin == 0)
-       return 1;
-
-    if (hpicos*monspecs->hfmin > _1e12 || hpicos*monspecs->hfmax < _1e12 ||
-       vpicos*monspecs->vfmin > _1e12 || vpicos*monspecs->vfmax < _1e12)
-       return 0;
-#endif
-    return 1;
-}
-
-int fbmon_dpms(const struct fb_info *fb_info)
-{
-    return fb_info->monspecs.dpms;
-}
-
-
-    /*
-     *  Command line options
-     */
-
-__initfunc(void video_setup(char *options, int *ints))
-{
-    int i, j;
-
-    if (!options || !*options)
-           return;
-
-    if (!strncmp(options, "map:", 4)) {
-           options += 4;
-           if (*options)
-                   for (i = 0, j = 0; i < MAX_NR_CONSOLES; i++) {
-                           if (!options[j])
-                                   j = 0;
-                           con2fb_map[i] = (options[j++]-'0') % FB_MAX;
-                   }
-           return;
-    }
-
-    if (num_pref_init_funcs == FB_MAX)
-           return;
-
-    for (i = 0; i < NUM_FB_DRIVERS; i++) {
-           j = strlen(fb_drivers[i].name);
-           if (!strncmp(options, fb_drivers[i].name, j) &&
-               options[j] == ':') {
-                   if (!strcmp(options+j+1, "off"))
-                           fb_drivers[i].init = NULL;
-                   else {
-                           if (fb_drivers[i].init) {
-                                   pref_init_funcs[num_pref_init_funcs++] =
-                                           fb_drivers[i].init;
-                                   fb_drivers[i].init = NULL;
-                           }
-                           if (fb_drivers[i].setup)
-                                   fb_drivers[i].setup(options+j+1, ints);
-                   }
-                   return;
-           }
-    }
-    /*
-     * If we get here no fb was specified and we default to pass the
-     * options to the first frame buffer that has an init and a setup
-     * function.
-     */
-    for (i = 0; i < NUM_FB_DRIVERS; i++) {
-           if (fb_drivers[i].init && fb_drivers[i].setup) {
-                   pref_init_funcs[num_pref_init_funcs++] =
-                           fb_drivers[i].init;
-                   fb_drivers[i].init = NULL;
-
-                   fb_drivers[i].setup(options, ints);
-                   return;
-           }
-    }
-}
-
-
-    /*
-     *  Visible symbols for modules
-     */
-
-EXPORT_SYMBOL(register_framebuffer);
-EXPORT_SYMBOL(unregister_framebuffer);
index a7ea984973d9e4ed4e92df15ff8573637315a001..0b27057a17a60f93773c3919c5e3f8ada5acb66f 100644 (file)
@@ -336,7 +336,9 @@ static void pty_set_termios(struct tty_struct *tty, struct termios *old_termios)
 
 __initfunc(int pty_init(void))
 {
+#ifdef CONFIG_UNIX98_PTYS
        int i;
+#endif
 
        /* Traditional BSD devices */
 
index a7345a97929702906db44170ece2a3b376638157..8b29e6fd7da3df1c68cdb9ab70fc55cb72263a4c 100644 (file)
@@ -1276,8 +1276,10 @@ retry_open:
        if (retval)
                return retval;
 
+#ifdef CONFIG_UNIX98_PTYS
        /* N.B. this error exit may leave filp->f_flags with O_NONBLOCK set */
 init_dev_done:
+#endif
        filp->private_data = tty;
        check_tty_count(tty, "tty_open");
        if (tty->driver.type == TTY_DRIVER_TYPE_PTY &&
index e976d0e87f07f0c2e82bc3b112dac8f3af1878a7..33b122c960158732b2f60af5d07b2daca5752e99 100644 (file)
@@ -1042,12 +1042,14 @@ isdn_net_send_skb(struct device *ndev, isdn_net_local * lp,
        if (ret == len) {
                lp->transcount += len;
                clear_bit(0, (void *) &(ndev->tbusy));
+               mark_bh(NET_BH);
                return 0;
        }
        if (ret < 0) {
                dev_kfree_skb(skb);
                lp->stats.tx_errors++;
                clear_bit(0, (void *) &(ndev->tbusy));
+               mark_bh(NET_BH);
                return 0;
        }
        return 1;
diff --git a/drivers/video/ati-gt.h b/drivers/video/ati-gt.h
deleted file mode 100644 (file)
index 32dc792..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-/* the usage for the following structs vary from the gx and vt:
-and sdram and sgram gt's
-       pll registers (sdram) 6,7,11;
-       crtc_h_sync_strt_wid[3];
-       dsp1[3] (sdram,sgram,unused)
-       dsp2[3] (offset regbase+24, depends on colour mode);
-       crtc_h_tot_disp,crtc_v_tot_disp,crtc_v_sync_strt_wid,unused;
-       pll registers (sgram) 7,11;
-*/
-
-/* Register values for 1280x1024, 75Hz mode (20). no 16/32 */
-static struct aty_regvals aty_gt_reg_init_20 = {
-       { 0x41, 0xf9, 0x04 },
-       { 0xe02a7, 0x1401a6, 0 },
-       { 0x260957, 0x2806d6, 0 },
-       { 0x10006b6, 0x20006b6, 0x30006b6 },
-
-       0x9f00d2, 0x03ff0429, 0x30400, 0,
-       { 0xb5, 0x04 }
-};
-
-#if 0
-/* Register values for 1280x960, 75Hz mode (19) */
-static struct aty_regvals aty_gt_reg_init_19 = {
-};
-#endif
-
-/* Register values for 1152x870, 75Hz mode (18) */
-static struct aty_regvals aty_gt_reg_init_18 = {
-       { 0x41, 0xe6, 0x04 },
-       { 0x300295, 0x300194, 0x300593 },
-       { 0x260a1c, 0x380561, 0},
-       { 0x1000744, 0x2000744, 0x3000744 },
-
-       0x8f00b5, 0x3650392, 0x230368, 0,
-       { 0xe6, 0x04 }
-};
-
-/* Register values for 1024x768, 75Hz mode (17), 32 bpp untested */
-static struct aty_regvals aty_gt_reg_init_17 = {
-       { 0x41, 0xb5, 0x04 },
-       { 0xc0283, 0xc0182, 0xc0581 },
-       { 0x36066d, 0x3806d6, 0},
-       { 0xa0049e, 0x100049e, 0x200049e },
-
-       0x7f00a3, 0x2ff031f, 0x30300, 0,
-       { 0xb8, 0x04 }
-};
-
-#if 0
-/* Register values for x, Hz mode (16) */
-static struct aty_regvals aty_gt_reg_init_16 = {
-};
-#endif
-
-/* Register values for 1024x768, 70Hz mode (15) */
-static struct aty_regvals aty_gt_reg_init_15 = {
-       { 0x41, 0xad, 0x04 },
-       { 0x310284, 0x310183, 0x310582 },
-       { 0x0, 0x380727 },
-       { 0x0 },
-       0x7f00a5, 0x2ff0325, 0x260302,
-};    
-
-/* Register values for 1024x768, 60Hz mode (14) */
-static struct aty_regvals aty_gt_reg_init_14 = {
-       { 0x40, 0xe1, 0x14 },
-       { 0x310284, 0x310183, 0x310582 },
-       { 0x3607c0, 0x380840, 0x0 },
-       { 0xa80592, 0x1000592, 0x0 },
-
-       0x7f00a7, 0x2ff0325, 0x260302, 0,
-       { 0xe1, 0x14 }
-};  
-
-/* Register values for 832x624, 75Hz mode (13) */
-static struct aty_regvals aty_gt_reg_init_13 = {
-       { 0x40, 0xc6, 0x14 },
-       { 0x28026d, 0x28016c, 0x28056b },
-       { 0x3608cf, 0x380960, 0 },
-       { 0xb00655, 0x1000655, 0x2000655 },
-
-       0x67008f, 0x26f029a, 0x230270, 0,
-       { 0xc6, 0x14 }
-};
-
-/* Register values for 800x600, 75Hz mode (12) */
-static struct aty_regvals aty_gt_reg_init_12 = {
-       { 0x42, 0xe4, 0x04 },
-       { 0xa0267, 0xa0166, 0x0a0565},
-       { 0x360a33, 0x48056d, 0},
-       { 0xc00755, 0x1000755, 0x02000755},
-
-       0x630083, 0x2570270, 0x30258, 0,
-       { 0xe4, 0x4 }
-};
-
-/* Register values for 800x600, 72Hz mode (11) */
-static struct aty_regvals aty_gt_reg_init_11 = {
-       { 0x42, 0xe6, 0x04 },
-       { 0xf026c, 0xf016b, 0xf056a },
-       { 0x360a1d, 0x480561, 0},
-       { 0xc00745, 0x1000745, 0x2000745 },
-       
-       0x630081, 0x02570299, 0x6027c
-};
-
-/* Register values for 800x600, 60Hz mode (10) */
-static struct aty_regvals aty_gt_reg_init_10 = {
-       { 0x42, 0xb8, 0x04 },
-       { 0x10026a, 0x100169, 0x100568 },
-       { 0x460652, 0x4806ba, 0},
-       { 0x68048b, 0xa0048b, 0x100048b },
-
-       0x630083, 0x02570273, 0x40258, 0,
-       { 0xb8, 0x4 }
-};
-
-/* Register values for 800x600, 56Hz mode (9) */
-static struct aty_regvals aty_gt_reg_init_9 = {
-       { 0x42, 0xf9, 0x14 },
-       { 0x90268, 0x90167, 0x090566 },
-       { 0x460701, 0x480774, 0},
-       { 0x700509, 0xa80509, 0x1000509 },
-
-       0x63007f, 0x2570270, 0x20258
-};
-
-#if 0
-/* Register values for 768x576, 50Hz mode (8) */
-static struct aty_regvals aty_gt_reg_init_8 = {
-};
-
-/* Register values for 640x870, 75Hz Full Page Display (7) */
-static struct aty_regvals aty_gt_reg_init_7 = {
-};
-#endif
-
-/* Register values for 640x480, 67Hz mode (6) */
-static struct aty_regvals aty_gt_reg_init_6 = {
-       { 0x42, 0xd1, 0x14 },
-       { 0x280259, 0x280158, 0x280557 },
-       { 0x460858, 0x4808e2, 0},
-       { 0x780600, 0xb00600, 0x1000600 },
-
-       0x4f006b, 0x1df020c, 0x2301e2, 0,
-       { 0x8b, 0x4 }
-};
-
-/* Register values for 640x480, 60Hz mode (5) */
-static struct aty_regvals aty_gt_reg_init_5 = {
-       { 0x43, 0xe8, 0x04 },
-       { 0x2c0253, 0x2c0152, 0x2c0551 },
-       { 0x460a06, 0x580555, 0},
-       { 0x880734, 0xc00734, 0x1000734 },
-
-       0x4f0063, 0x1df020c, 0x2201e9, 0,
-       { 0xe8, 0x04 }
-};
-
-#if 0
-/* Register values for x, Hz mode (4) */
-static struct aty_regvals aty_gt_reg_init_4 = {
-};
-
-/* Register values for x, Hz mode (3) */
-static struct aty_regvals aty_gt_reg_init_3 = {
-};
-
-/* Register values for x, Hz mode (2) */
-static struct aty_regvals aty_gt_reg_init_2 = {
-};
-
-/* Register values for x, Hz mode (1) */
-static struct aty_regvals aty_gt_reg_init_1 = {
-};
-#endif
-
-/* yikes, more data structures (dsp2)
- * XXX kludge for sgram
- */
-static int sgram_dsp[20][3] = {
-       {0,0,0},
-       {0,0,0},
-       {0,0,0},
-       {0,0,0},
-       {0x5203d7,0x7803d9,0xb803dd}, //5
-       {0x940666,0xe0066a,0x1700672}, //6
-       {0,0,0},
-       {0,0,0},
-       {0x88055f,0xd80563,0x170056b}, //9
-       {0x8404d9,0xb804dd,0x17004e5}, //10
-       {0x7803e2,0xb803e6,0x17003ee}, //11
-       {0x7803eb,0xb803ef,0x17003f7}, //12
-       {0xe806c5,0x17006cd,0x2e006dd}, //13
-       {0xe005f6,0x17005fe,0x2e0060e}, //14
-       {0xd8052c,0x1700534,0x2e00544}, //15
-       {0,0,0},
-       {0xb804f2,0x17004e5,0x2e0050a}, //17
-       {0xb803e6,0x17003ee,0x2e003fe}, //18
-       {0,0,0},
-       {0,0,0},
-};
diff --git a/drivers/video/ati-gx.h b/drivers/video/ati-gx.h
deleted file mode 100644 (file)
index df48c18..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Register values for 1280x1024, 75Hz (WAS 60) mode (20) */
-static struct aty_regvals aty_gx_reg_init_20 = {
-   { 0x200, 0x200, 0x200 },
-
-    { 0x1200a5, 0x1200a3, 0x1200a3 },
-    { 0x30c0200, 0x30e0300, 0x30e0300 },
-    { 0x2, 0x3, 0x3 },
-
-    0x9f00d2, 0x3ff0429, 0x30400, 0x28100040,
-    { 0xd4, 0x9 }
-};     
-
-/* Register values for 1152x870, 75Hz mode (18) */
-static struct aty_regvals aty_gx_reg_init_18 = {
-    { 0x200, 0x200, 0x200 },
-
-    { 0x300097, 0x300095, 0x300094 },
-    { 0x3090200, 0x30e0300, 0x30e0600 },
-    { 0x2, 0x3, 0x6 },
-
-    0x8f00b5, 0x3650392, 0x230368, 0x24100040,
-    { 0x53, 0x3 }
-};
-
-/* Register values for 1024x768, 75Hz mode (17) */
-static struct aty_regvals aty_gx_reg_init_17 = {
-    { 0x200, 0x200, 0x200 },
-
-    { 0x2c0087, 0x2c0085, 0x2c0084 },
-    { 0x3070200, 0x30e0300, 0x30e0600 },
-    { 0x2, 0x3, 0x6 },
-
-    0x7f00a5, 0x2ff0323, 0x230302, 0x20100000,
-    { 0x42, 0x3 }
-};
-
-/* Register values for 1024x768, 72Hz mode (15) */
-static struct aty_regvals aty_gx_reg_init_15 = {
-    { 0, 0, 0 },
-
-    { 0x310086, 0x310084, 0x310084 },
-    { 0x3070200, 0x30e0300, 0x30e0300 },
-    { 0x2002312, 0x3002312, 0x3002312 },
-
-    0x7f00a5, 0x2ff0325, 0x260302, 0x20100000,
-    { 0x88, 0x7 }
-};    
-
-/* Register values for 1024x768, 60Hz mode (14) */
-static struct aty_regvals aty_gx_reg_init_14 = {
-       { 0, 0, 0 },
-
-       { 0x310086, 0x310084, 0x310084 },
-       { 0x3060200, 0x30d0300, 0x30d0300 },
-       { 0x2002312, 0x3002312, 0x3002312 },
-
-       0x7f00a7, 0x2ff0325, 0x260302, 0x20100000,
-       { 0x6c, 0x6 }
-};  
-
-/* Register values for 832x624, 75Hz mode (13) */
-static struct aty_regvals aty_gx_reg_init_13 = {
-    { 0x200, 0x200, 0x200 },
-
-    { 0x28006f, 0x28006d, 0x28006c },
-    { 0x3050200, 0x30b0300, 0x30e0600 },
-    { 0x2, 0x3, 0x6 },
-
-    0x67008f, 0x26f029a, 0x230270, 0x1a100040,
-    { 0x4f, 0x5 }
-};
-
-#if 0          /* not filled in yet */
-/* Register values for 800x600, 75Hz mode (12) */
-static struct aty_regvals aty_gx_reg_init_12 = {
-       { 0x10, 0x28, 0x50 },
-       { },
-       { }     /* pixel clock = 49.11MHz for V=74.40Hz */
-};
-
-/* Register values for 800x600, 72Hz mode (11) */
-static struct aty_regvals aty_gx_reg_init_11 = {
-       { 0x10, 0x28, 0x50 },
-       { },
-       { }     /* pixel clock = 49.63MHz for V=71.66Hz */
-};
-
-/* Register values for 800x600, 60Hz mode (10) */
-static struct aty_regvals aty_gx_reg_init_10 = {
-       { 0x10, 0x28, 0x50 },
-       { },
-       { }     /* pixel clock = 41.41MHz for V=59.78Hz */
-};
-
-/* Register values for 640x870, 75Hz Full Page Display (7) */
-static struct aty_regvals aty_gx_reg_init_7 = {
-       { 0x10, 0x30, 0x68 },
-       { },
-       { }     /* pixel clock = 57.29MHz for V=75.01Hz */
-};
-#endif
-
-/* Register values for 640x480, 67Hz mode (6) */
-static struct aty_regvals aty_gx_reg_init_6 = {
-       { 0x200, 0x200, 0x200 },
-
-       { 0x28005b, 0x280059, 0x280058 },
-       { 0x3040200, 0x3060300, 0x30c0600 },
-       { 0x2002312, 0x3002312, 0x6002312 },
-
-       0x4f006b, 0x1df020c, 0x2301e2, 0x14100040,
-        { 0x35, 0x07 }
-};
-
-#if 0          /* not filled in yet */
-/* Register values for 640x480, 60Hz mode (5) */
-static struct aty_regvals aty_gx_reg_init_5 = {
-       { 0x200, 0x200, 0x200 },
-       { },
-        { 0x35, 0x07 }
-};
-#endif
diff --git a/drivers/video/ati-vt.h b/drivers/video/ati-vt.h
deleted file mode 100644 (file)
index 3b25d6d..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Register values for 1280x1024, 60Hz mode (20) */
-static struct aty_regvals aty_vt_reg_init_20 = {
-  { 0, 0, 0 },
-     
-  { 0x002e02a7, 0x002e02a7, 0 },
-  { 0x03070200, 0x03070200, 0 },
-  { 0x0a00cb22, 0x0b00cb23, 0 },
-     
-    0x009f00d2, 0x03ff0429, 0x00030400, 0x28000000,
-  { 0x00, 0xaa }
-};
-
-/* Register values for 1280x960, 75Hz mode (19) */
-static struct aty_regvals aty_vt_reg_init_19 = {
-  { 0, 0, 0 },
-  { 0x003202a3, 0x003201a2, 0 },
-  { 0x030b0200, 0x030b0300, 0 },
-  { 0x0a00cb22, 0x0b00cb23, 0 },
-
-    0x009f00d1, 0x03bf03e7, 0x000303c0, 0x28000000,
-  { 0x00, 0xc6 }
-};
-
-/* Register values for 1152x870, 75Hz mode (18) */
-static struct aty_regvals aty_vt_reg_init_18 = {
-  { 0, 0, 0 },
-     
-  { 0x00300295, 0x00300194, 0 },
-  { 0x03080200, 0x03080300, 0 },
-  { 0x0a00cb21, 0x0b00cb22, 0 },
-     
-    0x008f00b5, 0x03650392, 0x00230368, 0x24000000,
-  { 0x00, 0x9d }
-};
-
-/* Register values for 1024x768, 75Hz mode (17) */
-static struct aty_regvals aty_vt_reg_init_17 = {
-  { 0, 0, 0 },
-
-  { 0x002c0283, 0x002c0182, 0 },
-  { 0x03080200, 0x03080300, 0 },
-  { 0x0a00cb21, 0x0b00cb22, 0 },
-     
-    0x007f00a3, 0x02ff031f, 0x00030300, 0x20000000,
-  { 0x01, 0xf7 }
-};
-
-/* Register values for 1024x768, 70Hz mode (15) */
-static struct aty_regvals aty_vt_reg_init_15 = {
-  { 0, 0, 0 },
-  { 0x00310284, 0x00310183, 0 },
-  { 0x03080200, 0x03080300, 0 },
-  { 0x0a00cb21, 0x0b00cb22, 0 },
-
-    0x007f00a5, 0x02ff0325, 0x00260302, 0x20000000,
-  { 0x01, 0xeb }
-};    
-
-/* Register values for 1024x768, 60Hz mode (14) */
-static struct aty_regvals aty_vt_reg_init_14 = {
-  { 0, 0, 0 },
-     
-  { 0x00310284, 0x00310183, 0x00310582 }, /* 32 bit 0x00310582 */
-  { 0x03080200, 0x03080300, 0x03070600 }, /* 32 bit 0x03070600 */
-  { 0x0a00cb21, 0x0b00cb22, 0x0e00cb23 },
-    
-    0x007f00a7, 0x02ff0325, 0x00260302, 0x20000000,
-  { 0x01, 0xcc }
-};  
-
-/* Register values for 832x624, 75Hz mode (13) */
-static struct aty_regvals aty_vt_reg_init_13 = {
-  { 0, 0, 0 },
-
-  { 0x0028026d, 0x0028016c, 0x0028056b },
-  { 0x03080200, 0x03070300, 0x03090600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-
-    0x0067008f, 0x026f029a, 0x00230270, 0x1a000000,
-  { 0x01, 0xb4 }
-};
-
-/* Register values for 800x600, 75Hz mode (12) */
-static struct aty_regvals aty_vt_reg_init_12 = {
-  { 0, 0, 0 },
-     
-  { 0x002a0267, 0x002a0166, 0x002a0565 },
-  { 0x03040200, 0x03060300, 0x03070600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-     
-    0x00630083, 0x02570270, 0x00030258, 0x19000000,
-  { 0x01, 0x9c }
-};
-
-/* Register values for 800x600, 72Hz mode (11) */
-static struct aty_regvals aty_vt_reg_init_11 = {
-  { 0, 0, 0 },
-     
-  { 0x002f026c, 0x002f016b, 0x002f056a },
-  { 0x03050200, 0x03070300, 0x03090600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-
-    0x00630081, 0x02570299, 0x0006027c, 0x19000000,
-  { 0x01, 0x9d }
-};
-
-/* Register values for 800x600, 60Hz mode (10) */
-static struct aty_regvals aty_vt_reg_init_10 = {
-  { 0, 0, 0 },
-     
-  { 0x0030026a, 0x00300169, 0x00300568 },
-  { 0x03050200, 0x03070300, 0x03090600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-     
-    0x00630083, 0x02570273, 0x00040258, 0x19000000,
-  { 0x02, 0xfb }
-};
-
-/* Register values for 640x480, 67Hz mode (6) */
-static struct aty_regvals aty_vt_reg_init_6 = {
-  { 0, 0, 0 },
-      
-  { 0x00280259, 0x00280158, 0x00280557 },
-  { 0x03050200, 0x03070300, 0x030a0600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-      
-    0x004f006b, 0x01df020c, 0x002301e2, 0x14000000,
-  { 0x02, 0xbe }
-};
-
-/* Register values for 640x480, 60Hz mode (5) */
-static struct aty_regvals aty_vt_reg_init_5 = {
-  { 0, 0, 0 },
-      
-  { 0x002c0253, 0x002c0152, 0x002c0551 },
-  { 0x03050200, 0x03070300, 0x03090600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-
-    0x004f0063, 0x01df020c, 0x002201e9, 0x14000000,
-  { 0x02, 0x9e }
-};
-                               /*     8 bit       15 bit      32 bit   */
-static int vt_mem_cntl[3][3] = { { 0x0A00CB21, 0x0B00CB21, 0x0E00CB21 },  /* 1 MB VRAM */
-                                 { 0x0A00CB22, 0x0B00CB22, 0x0E00CB22 },  /* 2 MB VRAM */
-                                { 0x0200053B, 0x0300053B, 0x0600053B }   /* 4 M B VRAM */
- };
-
index d3e339e4f5d2a8cb72a64ddfa1ddb2786f7001f8..5f1780bd8ded380fab2dea5a52abcf81c503b824 100644 (file)
@@ -31,10 +31,6 @@ static void memcpy_fs(int fsfromto, void *to, void *from, int len)
     }
 }
 
-#define CNVT_TOHW(val,width)   ((((val)<<(width))+0x7fff-(val))>>16)
-#define CNVT_FROMHW(val,width) (((width) ? ((((val)<<16)-(val)) / \
-                                       ((1<<(width))-1)) : 0))
-
 static u16 red2[] = {
     0x0000, 0xaaaa
 };
@@ -163,9 +159,10 @@ void fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to, int fsfromto)
      *  Get the colormap for a screen
      */
 
-int fb_get_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var, int kspc,
+int fb_get_cmap(struct fb_cmap *cmap, int kspc,
                int (*getcolreg)(u_int, u_int *, u_int *, u_int *, u_int *,
-                                struct fb_info *), struct fb_info *info)
+                                struct fb_info *),
+               struct fb_info *info)
 {
     int i, start;
     u16 *red, *green, *blue, *transp;
@@ -181,10 +178,6 @@ int fb_get_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var, int kspc,
     for (i = 0; i < cmap->len; i++) {
        if (getcolreg(start++, &hred, &hgreen, &hblue, &htransp, info))
            return 0;
-       hred = CNVT_FROMHW(hred, var->red.length);
-       hgreen = CNVT_FROMHW(hgreen, var->green.length);
-       hblue = CNVT_FROMHW(hblue, var->blue.length);
-       htransp = CNVT_FROMHW(htransp, var->transp.length);
        if (kspc) {
            *red = hred;
            *green = hgreen;
@@ -212,9 +205,10 @@ int fb_get_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var, int kspc,
      *  Set the colormap for a screen
      */
 
-int fb_set_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var, int kspc,
+int fb_set_cmap(struct fb_cmap *cmap, int kspc,
                int (*setcolreg)(u_int, u_int, u_int, u_int, u_int,
-                                struct fb_info *), struct fb_info *info)
+                                struct fb_info *),
+               struct fb_info *info)
 {
     int i, start;
     u16 *red, *green, *blue, *transp;
@@ -243,10 +237,6 @@ int fb_set_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var, int kspc,
            else
                htransp = 0;
        }
-       hred = CNVT_TOHW(hred, var->red.length);
-       hgreen = CNVT_TOHW(hgreen, var->green.length);
-       hblue = CNVT_TOHW(hblue, var->blue.length);
-       htransp = CNVT_TOHW(htransp, var->transp.length);
        red++;
        green++;
        blue++;
index a8c01d6a0fd71ba6a2cdd8abc7f8a3dc7b373bc2..205c1347d5d6149cf4e6aceba572b74369bb00c7 100644 (file)
@@ -15,8 +15,8 @@
 #include <linux/string.h>
 #include <linux/fb.h>
 
-#include "fbcon.h"
-#include "fbcon-afb.h"
+#include <video/fbcon.h>
+#include <video/fbcon-afb.h>
 
 
     /*
@@ -174,22 +174,22 @@ void fbcon_afb_bmove(struct display *p, int sy, int sx, int dy, int dx,
     u_short i, j;
 
     if (sx == 0 && dx == 0 && width == p->next_line) {
-       src = p->screen_base+sy*p->fontheight*width;
-       dest = p->screen_base+dy*p->fontheight*width;
+       src = p->screen_base+sy*fontheight(p)*width;
+       dest = p->screen_base+dy*fontheight(p)*width;
        i = p->var.bits_per_pixel;
        do {
-           mymemmove(dest, src, height*p->fontheight*width);
+           mymemmove(dest, src, height*fontheight(p)*width);
            src += p->next_plane;
            dest += p->next_plane;
        } while (--i);
     } else if (dy <= sy) {
-       src0 = p->screen_base+sy*p->fontheight*p->next_line+sx;
-       dest0 = p->screen_base+dy*p->fontheight*p->next_line+dx;
+       src0 = p->screen_base+sy*fontheight(p)*p->next_line+sx;
+       dest0 = p->screen_base+dy*fontheight(p)*p->next_line+dx;
        i = p->var.bits_per_pixel;
        do {
            src = src0;
            dest = dest0;
-           j = height*p->fontheight;
+           j = height*fontheight(p);
            do {
                mymemmove(dest, src, width);
                src += p->next_line;
@@ -199,13 +199,13 @@ void fbcon_afb_bmove(struct display *p, int sy, int sx, int dy, int dx,
            dest0 += p->next_plane;
        } while (--i);
     } else {
-       src0 = p->screen_base+(sy+height)*p->fontheight*p->next_line+sx;
-       dest0 = p->screen_base+(dy+height)*p->fontheight*p->next_line+dx;
+       src0 = p->screen_base+(sy+height)*fontheight(p)*p->next_line+sx;
+       dest0 = p->screen_base+(dy+height)*fontheight(p)*p->next_line+dx;
        i = p->var.bits_per_pixel;
        do {
            src = src0;
            dest = dest0;
-           j = height*p->fontheight;
+           j = height*fontheight(p);
            do {
                src -= p->next_line;
                dest -= p->next_line;
@@ -224,13 +224,13 @@ void fbcon_afb_clear(struct vc_data *conp, struct display *p, int sy, int sx,
     u_short i, j;
     int bg;
 
-    dest0 = p->screen_base+sy*p->fontheight*p->next_line+sx;
+    dest0 = p->screen_base+sy*fontheight(p)*p->next_line+sx;
 
     bg = attr_bgcol_ec(p,conp);
     i = p->var.bits_per_pixel;
     do {
        dest = dest0;
-       j = height*p->fontheight;
+       j = height*fontheight(p);
        do {
            if (bg & 1)
                mymemset(dest, width);
@@ -250,8 +250,8 @@ void fbcon_afb_putc(struct vc_data *conp, struct display *p, int c, int yy,
     u_short i, j;
     int fg, bg;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
-    cdat0 = p->fontdata+(c&p->charmask)*p->fontheight;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
+    cdat0 = p->fontdata+(c&p->charmask)*fontheight(p);
     fg = attr_fgcol(p,c);
     bg = attr_bgcol(p,c);
 
@@ -264,7 +264,7 @@ void fbcon_afb_putc(struct vc_data *conp, struct display *p, int c, int yy,
            expand += 512;
        if (fg & 1)
            expand += 256;
-       j = p->fontheight;
+       j = fontheight(p);
        do {
            *dest = expand[*cdat++];
            dest += p->next_line;
@@ -289,7 +289,7 @@ void fbcon_afb_putcs(struct vc_data *conp, struct display *p,
     u16 c1, c2, c3, c4;
     int fg0, bg0, fg, bg;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
     fg0 = attr_fgcol(p,*s);
     bg0 = attr_bgcol(p,*s);
 
@@ -299,7 +299,7 @@ void fbcon_afb_putcs(struct vc_data *conp, struct display *p,
            dest1 = dest0++;
            xx++;
 
-           cdat10 = p->fontdata+c1*p->fontheight;
+           cdat10 = p->fontdata+c1*fontheight(p);
            fg = fg0;
            bg = bg0;
 
@@ -312,7 +312,7 @@ void fbcon_afb_putcs(struct vc_data *conp, struct display *p,
                    expand += 512;
                if (fg & 1)
                    expand += 256;
-               j = p->fontheight;
+               j = fontheight(p);
                do {
                    *dest = expand[*cdat1++];
                    dest += p->next_line;
@@ -328,10 +328,10 @@ void fbcon_afb_putcs(struct vc_data *conp, struct display *p,
            c4 = s[3] & p->charmask;
 
            dest1 = dest0;
-           cdat10 = p->fontdata+c1*p->fontheight;
-           cdat20 = p->fontdata+c2*p->fontheight;
-           cdat30 = p->fontdata+c3*p->fontheight;
-           cdat40 = p->fontdata+c4*p->fontheight;
+           cdat10 = p->fontdata+c1*fontheight(p);
+           cdat20 = p->fontdata+c2*fontheight(p);
+           cdat30 = p->fontdata+c3*fontheight(p);
+           cdat40 = p->fontdata+c4*fontheight(p);
            fg = fg0;
            bg = bg0;
 
@@ -347,7 +347,7 @@ void fbcon_afb_putcs(struct vc_data *conp, struct display *p,
                    expand += 512;
                if (fg & 1)
                    expand += 256;
-               j = p->fontheight;
+               j = fontheight(p);
                do {
 #if defined(__BIG_ENDIAN)
                    *(u32 *)dest = expand[*cdat1++]<<24 |
@@ -381,7 +381,7 @@ void fbcon_afb_revc(struct display *p, int xx, int yy)
     u_short i, j;
     int mask;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
     mask = p->fgcol ^ p->bgcol;
 
     /*
@@ -394,7 +394,7 @@ void fbcon_afb_revc(struct display *p, int xx, int yy)
     do {
        if (mask & 1) {
            dest = dest0;
-           j = p->fontheight;
+           j = fontheight(p);
            do {
                *dest = ~*dest;
                dest += p->next_line;
diff --git a/drivers/video/fbcon-afb.h b/drivers/video/fbcon-afb.h
deleted file mode 100644 (file)
index c82d98c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-    /*
-     *  Amiga bitplanes (afb)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_AFB) || defined(CONFIG_FBCON_AFB_MODULE)
-#define FBCON_HAS_AFB
-#endif
-#else
-#if defined(CONFIG_FBCON_AFB)
-#define FBCON_HAS_AFB
-#endif
-#endif
-
-extern struct display_switch fbcon_afb;
-extern void fbcon_afb_setup(struct display *p);
-extern void fbcon_afb_bmove(struct display *p, int sy, int sx, int dy, int dx,
-                           int height, int width);
-extern void fbcon_afb_clear(struct vc_data *conp, struct display *p, int sy,
-                           int sx, int height, int width);
-extern void fbcon_afb_putc(struct vc_data *conp, struct display *p, int c,
-                          int yy, int xx);
-extern void fbcon_afb_putcs(struct vc_data *conp, struct display *p,
-                           const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_afb_revc(struct display *p, int xx, int yy);
index 221fbc572ee1c957b0ab7de158404ae57cefdcd9..a05848f5bd7e3bd71060e76477c0ddc2790383ab 100644 (file)
@@ -9,23 +9,20 @@
  *  more details.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
 #include <linux/fb.h>
 
-#include "fbcon.h"
-#include "fbcon-cfb16.h"
+#include <video/fbcon.h>
+#include <video/fbcon-cfb16.h>
 
 
     /*
      *  16 bpp packed pixels
      */
 
-u16 fbcon_cfb16_cmap[16];
-
 static u32 tab_cfb16[] = {
 #if defined(__BIG_ENDIAN)
     0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff
@@ -45,28 +42,28 @@ void fbcon_cfb16_setup(struct display *p)
 void fbcon_cfb16_bmove(struct display *p, int sy, int sx, int dy, int dx,
                       int height, int width)
 {
-    int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+    int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
     u8 *src, *dst;
 
-    if (sx == 0 && dx == 0 && width * p->fontwidth * 2 == bytes) {
+    if (sx == 0 && dx == 0 && width * fontwidth(p) * 2 == bytes) {
        mymemmove(p->screen_base + dy * linesize,
                  p->screen_base + sy * linesize,
                  height * linesize);
        return;
     }
-    if (p->fontwidthlog) {
-       sx <<= p->fontwidthlog+1;
-       dx <<= p->fontwidthlog+1;
-       width <<= p->fontwidthlog+1;
+    if (fontwidthlog(p)) {
+       sx <<= fontwidthlog(p)+1;
+       dx <<= fontwidthlog(p)+1;
+       width <<= fontwidthlog(p)+1;
     } else {
-       sx *= p->fontwidth*2;
-       dx *= p->fontwidth*2;
-       width *= p->fontwidth*2;
+       sx *= fontwidth(p)*2;
+       dx *= fontwidth(p)*2;
+       width *= fontwidth(p)*2;
     }
     if (dy < sy || (dy == sy && dx < sx)) {
        src = p->screen_base + sy * linesize + sx;
        dst = p->screen_base + dy * linesize + dx;
-       for (rows = height * p->fontheight; rows--;) {
+       for (rows = height * fontheight(p); rows--;) {
            mymemmove(dst, src, width);
            src += bytes;
            dst += bytes;
@@ -74,7 +71,7 @@ void fbcon_cfb16_bmove(struct display *p, int sy, int sx, int dy, int dx,
     } else {
        src = p->screen_base + (sy+height) * linesize + sx - bytes;
        dst = p->screen_base + (dy+height) * linesize + dx - bytes;
-       for (rows = height * p->fontheight; rows--;) {
+       for (rows = height * fontheight(p); rows--;) {
            mymemmove(dst, src, width);
            src -= bytes;
            dst -= bytes;
@@ -82,36 +79,43 @@ void fbcon_cfb16_bmove(struct display *p, int sy, int sx, int dy, int dx,
     }
 }
 
+static inline void rectfill(u8 *dest, int width, int height, u32 data,
+                           int linesize)
+{
+    int i;
+
+    data |= data<<16;
+
+    while (height-- > 0) {
+       u32 *p = (u32 *)dest;
+       for (i = 0; i < width/4; i++) {
+           *p++ = data;
+           *p++ = data;
+       }
+       if (width & 2)
+           *p++ = data;
+       if (width & 1)
+           *(u16 *)p = data;
+       dest += linesize;
+    }
+}
+
 void fbcon_cfb16_clear(struct vc_data *conp, struct display *p, int sy, int sx,
                       int height, int width)
 {
-    u8 *dest0, *dest;
-    int bytes = p->next_line, lines = height * p->fontheight, rows, i;
+    u8 *dest;
+    int bytes = p->next_line, lines = height * fontheight(p);
     u32 bgx;
 
-    dest = p->screen_base + sy * p->fontheight * bytes + sx * p->fontwidth * 2;
+    dest = p->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p) * 2;
 
-    bgx = fbcon_cfb16_cmap[attr_bgcol_ec(p, conp)];
-    bgx |= (bgx << 16);
+    bgx = ((u16 *)p->dispsw_data)[attr_bgcol_ec(p, conp)];
 
-    width *= p->fontwidth/4;
-    if (sx == 0 && width * 8 == bytes)
-       for (i = 0; i < lines * width; i++) {
-           ((u32 *)dest)[0] = bgx;
-           ((u32 *)dest)[1] = bgx;
-           dest += 8;
-       }
-    else {
-       dest0 = dest;
-       for (rows = lines; rows--; dest0 += bytes) {
-           dest = dest0;
-           for (i = 0; i < width; i++) {
-               ((u32 *)dest)[0] = bgx;
-               ((u32 *)dest)[1] = bgx;
-               dest += 8;
-           }
-       }
-    }
+    width *= fontwidth(p)/4;
+    if (width * 8 == bytes)
+       rectfill(dest, lines * width * 4, 1, bgx, bytes);
+    else
+       rectfill(dest, width * 4, lines, bgx, bytes);
 }
 
 void fbcon_cfb16_putc(struct vc_data *conp, struct display *p, int c, int yy,
@@ -121,38 +125,32 @@ void fbcon_cfb16_putc(struct vc_data *conp, struct display *p, int c, int yy,
     int bytes = p->next_line, rows;
     u32 eorx, fgx, bgx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 2;
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 2;
 
-    fgx = fbcon_cfb16_cmap[attr_fgcol(p, c)];
-    bgx = fbcon_cfb16_cmap[attr_bgcol(p, c)];
+    fgx = ((u16 *)p->dispsw_data)[attr_fgcol(p, c)];
+    bgx = ((u16 *)p->dispsw_data)[attr_bgcol(p, c)];
     fgx |= (fgx << 16);
     bgx |= (bgx << 16);
     eorx = fgx ^ bgx;
 
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-    switch (p->fontwidth) {
+    switch (fontwidth(p)) {
     case 4:
     case 8:
-#endif
-       cdat = p->fontdata + (c & p->charmask) * p->fontheight;
-       for (rows = p->fontheight; rows--; dest += bytes) {
+       cdat = p->fontdata + (c & p->charmask) * fontheight(p);
+       for (rows = fontheight(p); rows--; dest += bytes) {
            bits = *cdat++;
            ((u32 *)dest)[0] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
            ((u32 *)dest)[1] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-           if (p->fontwidth == 8)
-#endif
-           {
+           if (fontwidth(p) == 8) {
                ((u32 *)dest)[2] = (tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx;
                ((u32 *)dest)[3] = (tab_cfb16[bits & 3] & eorx) ^ bgx;
            }
        }
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
        break;
     case 12:
     case 16:
-       cdat = p->fontdata + ((c & p->charmask) * p->fontheight << 1);
-       for (rows = p->fontheight; rows--; dest += bytes) {
+       cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1);
+       for (rows = fontheight(p); rows--; dest += bytes) {
            bits = *cdat++;
            ((u32 *)dest)[0] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
            ((u32 *)dest)[1] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
@@ -161,14 +159,13 @@ void fbcon_cfb16_putc(struct vc_data *conp, struct display *p, int c, int yy,
            bits = *cdat++;
            ((u32 *)dest)[4] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
            ((u32 *)dest)[5] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
-           if (p->fontwidth == 16) {
+           if (fontwidth(p) == 16) {
                ((u32 *)dest)[6] = (tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx;
                ((u32 *)dest)[7] = (tab_cfb16[bits & 3] & eorx) ^ bgx;
            }
        }
        break;
     }
-#endif
 }
 
 void fbcon_cfb16_putcs(struct vc_data *conp, struct display *p,
@@ -179,44 +176,37 @@ void fbcon_cfb16_putcs(struct vc_data *conp, struct display *p,
     int rows, bytes = p->next_line;
     u32 eorx, fgx, bgx;
 
-    dest0 = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 2;
-    fgx = fbcon_cfb16_cmap[attr_fgcol(p, *s)];
-    bgx = fbcon_cfb16_cmap[attr_bgcol(p, *s)];
+    dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 2;
+    fgx = ((u16 *)p->dispsw_data)[attr_fgcol(p, *s)];
+    bgx = ((u16 *)p->dispsw_data)[attr_bgcol(p, *s)];
     fgx |= (fgx << 16);
     bgx |= (bgx << 16);
     eorx = fgx ^ bgx;
 
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-    switch (p->fontwidth) {
+    switch (fontwidth(p)) {
     case 4:
     case 8:
-#endif
        while (count--) {
            c = *s++ & p->charmask;
-           cdat = p->fontdata + c * p->fontheight;
-           for (rows = p->fontheight, dest = dest0; rows--; dest += bytes) {
+           cdat = p->fontdata + c * fontheight(p);
+           for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) {
                u8 bits = *cdat++;
                ((u32 *)dest)[0] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
                ((u32 *)dest)[1] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-               if (p->fontwidth == 8)
-#endif
-               {
-               
+               if (fontwidth(p) == 8) {
                    ((u32 *)dest)[2] = (tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx;
                    ((u32 *)dest)[3] = (tab_cfb16[bits & 3] & eorx) ^ bgx;
                }
            }
-           dest0 += p->fontwidth*2;;
+           dest0 += fontwidth(p)*2;;
        }
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
        break;
     case 12:
     case 16:
        while (count--) {
            c = *s++ & p->charmask;
-           cdat = p->fontdata + (c * p->fontheight << 1);
-           for (rows = p->fontheight, dest = dest0; rows--; dest += bytes) {
+           cdat = p->fontdata + (c * fontheight(p) << 1);
+           for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) {
                u8 bits = *cdat++;
                ((u32 *)dest)[0] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
                ((u32 *)dest)[1] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
@@ -225,16 +215,15 @@ void fbcon_cfb16_putcs(struct vc_data *conp, struct display *p,
                bits = *cdat++;
                ((u32 *)dest)[4] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
                ((u32 *)dest)[5] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
-               if (p->fontwidth == 16) {
+               if (fontwidth(p) == 16) {
                    ((u32 *)dest)[6] = (tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx;
                    ((u32 *)dest)[7] = (tab_cfb16[bits & 3] & eorx) ^ bgx;
                }
            }
-           dest0 += p->fontwidth*2;
+           dest0 += fontwidth(p)*2;
        }
        break;
     }
-#endif
 }
 
 void fbcon_cfb16_revc(struct display *p, int xx, int yy)
@@ -242,13 +231,9 @@ void fbcon_cfb16_revc(struct display *p, int xx, int yy)
     u8 *dest;
     int bytes = p->next_line, rows;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth*2;
-    for (rows = p->fontheight; rows--; dest += bytes) {
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-       ((u32 *)dest)[2] ^= 0xffffffff; ((u32 *)dest)[3] ^= 0xffffffff;
-       ((u32 *)dest)[0] ^= 0xffffffff; ((u32 *)dest)[1] ^= 0xffffffff;
-#else
-       switch (p->fontwidth) {
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p)*2;
+    for (rows = fontheight(p); rows--; dest += bytes) {
+       switch (fontwidth(p)) {
        case 16:
            ((u32 *)dest)[6] ^= 0xffffffff; ((u32 *)dest)[7] ^= 0xffffffff;
            /* FALL THROUGH */
@@ -261,42 +246,27 @@ void fbcon_cfb16_revc(struct display *p, int xx, int yy)
        case 4:
            ((u32 *)dest)[0] ^= 0xffffffff; ((u32 *)dest)[1] ^= 0xffffffff;
        }
-#endif
     }
 }
 
-void fbcon_cfb16_clear_margins(struct vc_data *conp, struct display *p)
+void fbcon_cfb16_clear_margins(struct vc_data *conp, struct display *p,
+                              int bottom_only)
 {
-    u8 *dest0;
-    u32 *dest;
     int bytes = p->next_line;
     u32 bgx;
-    int i, j;
 
-    unsigned int right_start = conp->vc_cols*p->fontwidth;
-    unsigned int right_width = p->var.xres_virtual-right_start;
-    unsigned int bottom_start = conp->vc_rows*p->fontheight;
-    unsigned int bottom_width = p->var.yres_virtual-bottom_start;
+    unsigned int right_start = conp->vc_cols*fontwidth(p);
+    unsigned int bottom_start = conp->vc_rows*fontheight(p);
+    unsigned int right_width, bottom_width;
 
-    bgx = fbcon_cfb16_cmap[attr_bgcol_ec(p, conp)];
-    bgx |= (bgx << 16);
+    bgx = ((u16 *)p->dispsw_data)[attr_bgcol_ec(p, conp)];
 
-    if (right_width) {
-       dest0 = p->screen_base+right_start*2;
-       for (i = 0; i < bottom_start; i++, dest0 += bytes) {
-           for (j = 0, dest = (u32 *)dest0; j < right_width/2; j++)
-               *dest++ = bgx;
-           if (right_width & 1)
-               *(u16 *)dest = bgx;
-       }
-    }
-    if (bottom_width) {
-       dest = (u32 *)(p->screen_base+bottom_start*bytes);
-       for (i = 0; i < bytes*bottom_width/4; i++)
-           *dest++ = bgx;
-       if ((bytes*bottom_width) & 2)
-           *(u16 *)dest = bgx;
-    }
+    if (!bottom_only && (right_width = p->var.xres-right_start))
+       rectfill(p->screen_base+right_start*2, right_width,
+                p->var.yres_virtual, bgx, bytes);
+    if ((bottom_width = p->var.yres-bottom_start))
+       rectfill(p->screen_base+(p->var.yoffset+bottom_start)*bytes,
+                right_start, bottom_width, bgx, bytes);
 }
 
 
@@ -333,4 +303,4 @@ EXPORT_SYMBOL(fbcon_cfb16_clear);
 EXPORT_SYMBOL(fbcon_cfb16_putc);
 EXPORT_SYMBOL(fbcon_cfb16_putcs);
 EXPORT_SYMBOL(fbcon_cfb16_revc);
-EXPORT_SYMBOL(fbcon_cfb16_cmap);
+EXPORT_SYMBOL(fbcon_cfb16_clear_margins);
diff --git a/drivers/video/fbcon-cfb16.h b/drivers/video/fbcon-cfb16.h
deleted file mode 100644 (file)
index ebff9bc..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-    /*
-     *  16 bpp packed pixel (cfb16)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB16_MODULE)
-#define FBCON_HAS_CFB16
-#endif
-#else
-#if defined(CONFIG_FBCON_CFB16)
-#define FBCON_HAS_CFB16
-#endif
-#endif
-
-extern struct display_switch fbcon_cfb16;
-extern u16 fbcon_cfb16_cmap[16];
-extern void fbcon_cfb16_setup(struct display *p);
-extern void fbcon_cfb16_bmove(struct display *p, int sy, int sx, int dy,
-                             int dx, int height, int width);
-extern void fbcon_cfb16_clear(struct vc_data *conp, struct display *p, int sy,
-                             int sx, int height, int width);
-extern void fbcon_cfb16_putc(struct vc_data *conp, struct display *p, int c,
-                            int yy, int xx);
-extern void fbcon_cfb16_putcs(struct vc_data *conp, struct display *p,
-                             const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_cfb16_revc(struct display *p, int xx, int yy);
-extern void fbcon_cfb16_clear_margins(struct vc_data *conp, struct display *p);
index 60bed6275fb67c1ce843744b9004186d64e4b196..e25fadaaeea3c5500c45960a4d18c68cdb2068a0 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/string.h>
 #include <linux/fb.h>
 
-#include "fbcon.h"
-#include "fbcon-cfb2.h"
+#include <video/fbcon.h>
+#include <video/fbcon-cfb2.h>
 
 
     /*
@@ -57,7 +57,7 @@ void fbcon_cfb2_setup(struct display *p)
 void fbcon_cfb2_bmove(struct display *p, int sy, int sx, int dy, int dx,
                      int height, int width)
 {
-       int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+       int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
        u8 *src,*dst;
 
        if (sx == 0 && dx == 0 && width * 2 == bytes) {
@@ -69,7 +69,7 @@ void fbcon_cfb2_bmove(struct display *p, int sy, int sx, int dy, int dx,
                if (dy < sy || (dy == sy && dx < sx)) {
                        src = p->screen_base + sy * linesize + sx * 2;
                        dst = p->screen_base + dy * linesize + dx * 2;
-                       for (rows = height * p->fontheight ; rows-- ;) {
+                       for (rows = height * fontheight(p) ; rows-- ;) {
                                mymemmove(dst, src, width * 2);
                                src += bytes;
                                dst += bytes;
@@ -80,7 +80,7 @@ void fbcon_cfb2_bmove(struct display *p, int sy, int sx, int dy, int dx,
                                - bytes;
                        dst = p->screen_base + (dy+height) * linesize + dx * 2
                                - bytes;
-                       for (rows = height * p->fontheight ; rows-- ;) {
+                       for (rows = height * fontheight(p) ; rows-- ;) {
                                mymemmove(dst, src, width * 2);
                                src -= bytes;
                                dst -= bytes;
@@ -93,10 +93,10 @@ void fbcon_cfb2_clear(struct vc_data *conp, struct display *p, int sy, int sx,
                      int height, int width)
 {
        u8 *dest0,*dest;
-       int bytes=p->next_line,lines=height * p->fontheight, rows, i;
+       int bytes=p->next_line,lines=height * fontheight(p), rows, i;
        u32 bgx;
 
-       dest = p->screen_base + sy * p->fontheight * bytes + sx * 2;
+       dest = p->screen_base + sy * fontheight(p) * bytes + sx * 2;
 
        bgx=attr_bgcol_ec(p,conp);
        bgx |= (bgx << 2);      /* expand the colour to 16 bits */
@@ -128,8 +128,8 @@ void fbcon_cfb2_putc(struct vc_data *conp, struct display *p, int c, int yy,
        int bytes=p->next_line,rows;
        u32 eorx,fgx,bgx;
 
-       dest = p->screen_base + yy * p->fontheight * bytes + xx * 2;
-       cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+       dest = p->screen_base + yy * fontheight(p) * bytes + xx * 2;
+       cdat = p->fontdata + (c & p->charmask) * fontheight(p);
 
        fgx=3;/*attr_fgcol(p,c);*/
        bgx=attr_bgcol(p,c);
@@ -139,7 +139,7 @@ void fbcon_cfb2_putc(struct vc_data *conp, struct display *p, int c, int yy,
        bgx |= (bgx << 4);
        eorx = fgx ^ bgx;
 
-       for (rows = p->fontheight ; rows-- ; dest += bytes) {
+       for (rows = fontheight(p) ; rows-- ; dest += bytes) {
                ((u8 *)dest)[0]=
                        (nibbletab_cfb2[*cdat >> 4] & eorx) ^ bgx;
                ((u8 *)dest)[1]=
@@ -155,7 +155,7 @@ void fbcon_cfb2_putcs(struct vc_data *conp, struct display *p, const unsigned sh
        int rows,bytes=p->next_line;
        u32 eorx, fgx, bgx;
 
-       dest0 = p->screen_base + yy * p->fontheight * bytes + xx * 2;
+       dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * 2;
        fgx=3/*attr_fgcol(p,*s)*/;
        bgx=attr_bgcol(p,*s);
        fgx |= (fgx << 2);
@@ -165,9 +165,9 @@ void fbcon_cfb2_putcs(struct vc_data *conp, struct display *p, const unsigned sh
        eorx = fgx ^ bgx;
        while (count--) {
                c = *s++ & p->charmask;
-               cdat = p->fontdata + c * p->fontheight;
+               cdat = p->fontdata + c * fontheight(p);
 
-               for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+               for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
                        ((u8 *)dest)[0]=
                                (nibbletab_cfb2[*cdat >> 4] & eorx) ^ bgx;
                        ((u8 *)dest)[1]=
@@ -182,8 +182,8 @@ void fbcon_cfb2_revc(struct display *p, int xx, int yy)
        u8 *dest;
        int bytes=p->next_line, rows;
 
-       dest = p->screen_base + yy * p->fontheight * bytes + xx * 2;
-       for (rows = p->fontheight ; rows-- ; dest += bytes) {
+       dest = p->screen_base + yy * fontheight(p) * bytes + xx * 2;
+       for (rows = fontheight(p) ; rows-- ; dest += bytes) {
                ((u16 *)dest)[0] ^= 0xffff;
        }
 }
diff --git a/drivers/video/fbcon-cfb2.h b/drivers/video/fbcon-cfb2.h
deleted file mode 100644 (file)
index 1cb29c5..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-    /*
-     *  2 bpp packed pixel (cfb2)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_CFB2) || defined(CONFIG_FBCON_CFB2_MODULE)
-#define FBCON_HAS_CFB2
-#endif
-#else
-#if defined(CONFIG_FBCON_CFB2)
-#define FBCON_HAS_CFB2
-#endif
-#endif
-
-extern struct display_switch fbcon_cfb2;
-extern void fbcon_cfb2_setup(struct display *p);
-extern void fbcon_cfb2_bmove(struct display *p, int sy, int sx, int dy, int dx,
-                            int height, int width);
-extern void fbcon_cfb2_clear(struct vc_data *conp, struct display *p, int sy,
-                            int sx, int height, int width);
-extern void fbcon_cfb2_putc(struct vc_data *conp, struct display *p, int c,
-                           int yy, int xx);
-extern void fbcon_cfb2_putcs(struct vc_data *conp, struct display *p,
-                            const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_cfb2_revc(struct display *p, int xx, int yy);
index 49c023ef3ba4927043a0f2f30e6a6bb35a9b766a..488aac2904c0092219eba5d05c9fd86c5e926a40 100644 (file)
@@ -9,23 +9,20 @@
  *  more details.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
 #include <linux/fb.h>
 
-#include "fbcon.h"
-#include "fbcon-cfb24.h"
+#include <video/fbcon.h>
+#include <video/fbcon-cfb24.h>
 
 
     /*
      *  24 bpp packed pixels
      */
 
-u32 fbcon_cfb24_cmap[16];
-
 void fbcon_cfb24_setup(struct display *p)
 {
     p->next_line = p->line_length ? p->line_length : p->var.xres_virtual*3;
@@ -35,29 +32,29 @@ void fbcon_cfb24_setup(struct display *p)
 void fbcon_cfb24_bmove(struct display *p, int sy, int sx, int dy, int dx,
                       int height, int width)
 {
-    int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+    int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
     u8 *src, *dst;
 
-    if (sx == 0 && dx == 0 && width * p->fontwidth * 3 == bytes) {
+    if (sx == 0 && dx == 0 && width * fontwidth(p) * 3 == bytes) {
        mymemmove(p->screen_base + dy * linesize,
                  p->screen_base + sy * linesize,
                  height * linesize);
        return;
     }
-    if (p->fontwidthlog) {
-       sx <<= p->fontwidthlog;
-       dx <<= p->fontwidthlog;
-       width <<= p->fontwidthlog;
+    if (fontwidthlog(p)) {
+       sx <<= fontwidthlog(p);
+       dx <<= fontwidthlog(p);
+       width <<= fontwidthlog(p);
     } else {
-       sx *= p->fontwidth;
-       dx *= p->fontwidth;
-       width *= p->fontwidth;
+       sx *= fontwidth(p);
+       dx *= fontwidth(p);
+       width *= fontwidth(p);
     }
     sx *= 3; dx *= 3; width *= 3;
     if (dy < sy || (dy == sy && dx < sx)) {
        src = p->screen_base + sy * linesize + sx;
        dst = p->screen_base + dy * linesize + dx;
-       for (rows = height * p->fontheight; rows--;) {
+       for (rows = height * fontheight(p); rows--;) {
            mymemmove(dst, src, width);
            src += bytes;
            dst += bytes;
@@ -65,7 +62,7 @@ void fbcon_cfb24_bmove(struct display *p, int sy, int sx, int dy, int dx,
     } else {
        src = p->screen_base + (sy+height) * linesize + sx - bytes;
        dst = p->screen_base + (dy+height) * linesize + dx - bytes;
-       for (rows = height * p->fontheight; rows--;) {
+       for (rows = height * fontheight(p); rows--;) {
            mymemmove(dst, src, width);
            src -= bytes;
            dst -= bytes;
@@ -73,48 +70,63 @@ void fbcon_cfb24_bmove(struct display *p, int sy, int sx, int dy, int dx,
     }
 }
 
-static inline void store4pixels(u32 d1, u32 d2, u32 d3, u32 d4, u32 *dest)
-{
 #if defined(__BIG_ENDIAN)
-    *dest++ = (d1<<8) | (d2>>16);
-    *dest++ = (d2<<16) | (d3>>8);
-    *dest++ = (d3<<24) | d4;
+#define convert4to3(in1, in2, in3, in4, out1, out2, out3) \
+    do { \
+       out1 = (in1<<8)  | (in2>>16); \
+       out2 = (in2<<16) | (in3>>8); \
+       out3 = (in3<<24) | in4; \
+    } while (0);
 #elif defined(__LITTLE_ENDIAN)
-    *dest++ = (d1<<8) | (d2>>16);
-    *dest++ = (d2<<16) | (d3>>8);
-    *dest++ = (d3<<24) | d4;
+#define convert4to3(in1, in2, in3, in4, out1, out2, out3) \
+    do { \
+       out1 = in1       | (in2<<24); \
+       out2 = (in2>> 8) | (in3<<16); \
+       out3 = (in3>>16) | (in4<< 8); \
+    } while (0);
 #else
 #error FIXME: No endianness??
 #endif
+
+static inline void store4pixels(u32 d1, u32 d2, u32 d3, u32 d4, u32 *dest)
+{
+    convert4to3(d1, d2, d3, d4, *dest++, *dest++, *dest++);
+}
+
+static inline void rectfill(u8 *dest, int width, int height, u32 data,
+                           int linesize)
+{
+    u32 d1, d2, d3;
+    int i;
+
+    convert4to3(data, data, data, data, d1, d2, d3);
+    while (height-- > 0) {
+       u32 *p = (u32 *)dest;
+       for (i = 0; i < width/4; i++) {
+           *p++ = d1;
+           *p++ = d2;
+           *p++ = d3;
+       }
+       dest += linesize;
+    }
 }
 
 void fbcon_cfb24_clear(struct vc_data *conp, struct display *p, int sy, int sx,
                       int height, int width)
 {
-    u8 *dest0, *dest;
-    int bytes = p->next_line, lines = height * p->fontheight, rows, i;
+    u8 *dest;
+    int bytes = p->next_line, lines = height * fontheight(p);
     u32 bgx;
 
-    dest = p->screen_base + sy * p->fontheight * bytes + sx * p->fontwidth * 3;
+    dest = p->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p) * 3;
 
-    bgx = fbcon_cfb24_cmap[attr_bgcol_ec(p, conp)];
+    bgx = ((u32 *)p->dispsw_data)[attr_bgcol_ec(p, conp)];
 
-    width *= p->fontwidth/4;
-    if (sx == 0 && width * 12 == bytes)
-       for (i = 0; i < lines * width; i++) {
-           store4pixels(bgx, bgx, bgx, bgx, (u32 *)dest);
-           dest += 12;
-       }
-    else {
-       dest0 = dest;
-       for (rows = lines; rows--; dest0 += bytes) {
-           dest = dest0;
-           for (i = 0; i < width; i++) {
-               store4pixels(bgx, bgx, bgx, bgx, (u32 *)dest);
-               dest += 12;
-           }
-       }
-    }
+    width *= fontwidth(p)/4;
+    if (width * 12 == bytes)
+       rectfill(dest, lines * width * 4, 1, bgx, bytes);
+    else
+       rectfill(dest, width * 4, lines, bgx, bytes);
 }
 
 void fbcon_cfb24_putc(struct vc_data *conp, struct display *p, int c, int yy,
@@ -124,34 +136,31 @@ void fbcon_cfb24_putc(struct vc_data *conp, struct display *p, int c, int yy,
     int bytes = p->next_line, rows;
     u32 eorx, fgx, bgx, d1, d2, d3, d4;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 3;
-    if (p->fontwidth <= 8)
-       cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 3;
+    if (fontwidth(p) <= 8)
+       cdat = p->fontdata + (c & p->charmask) * fontheight(p);
     else
-       cdat = p->fontdata + ((c & p->charmask) * p->fontheight << 1);
+       cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1);
 
-    fgx = fbcon_cfb24_cmap[attr_fgcol(p, c)];
-    bgx = fbcon_cfb24_cmap[attr_bgcol(p, c)];
+    fgx = ((u32 *)p->dispsw_data)[attr_fgcol(p, c)];
+    bgx = ((u32 *)p->dispsw_data)[attr_bgcol(p, c)];
     eorx = fgx ^ bgx;
 
-    for (rows = p->fontheight; rows--; dest += bytes) {
+    for (rows = fontheight(p); rows--; dest += bytes) {
        bits = *cdat++;
        d1 = (-(bits >> 7) & eorx) ^ bgx;
        d2 = (-(bits >> 6 & 1) & eorx) ^ bgx;
        d3 = (-(bits >> 5 & 1) & eorx) ^ bgx;
        d4 = (-(bits >> 4 & 1) & eorx) ^ bgx;
        store4pixels(d1, d2, d3, d4, (u32 *)dest);
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-       if (p->fontwidth < 8)
+       if (fontwidth(p) < 8)
            continue;
-#endif
        d1 = (-(bits >> 3 & 1) & eorx) ^ bgx;
        d2 = (-(bits >> 2 & 1) & eorx) ^ bgx;
        d3 = (-(bits >> 1 & 1) & eorx) ^ bgx;
        d4 = (-(bits & 1) & eorx) ^ bgx;
        store4pixels(d1, d2, d3, d4, (u32 *)(dest+12));
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-       if (p->fontwidth < 12)
+       if (fontwidth(p) < 12)
            continue;
        bits = *cdat++;
        d1 = (-(bits >> 7) & eorx) ^ bgx;
@@ -159,14 +168,13 @@ void fbcon_cfb24_putc(struct vc_data *conp, struct display *p, int c, int yy,
        d3 = (-(bits >> 5 & 1) & eorx) ^ bgx;
        d4 = (-(bits >> 4 & 1) & eorx) ^ bgx;
        store4pixels(d1, d2, d3, d4, (u32 *)(dest+24));
-       if (p->fontwidth < 16)
+       if (fontwidth(p) < 16)
            continue;
        d1 = (-(bits >> 3 & 1) & eorx) ^ bgx;
        d2 = (-(bits >> 2 & 1) & eorx) ^ bgx;
        d3 = (-(bits >> 1 & 1) & eorx) ^ bgx;
        d4 = (-(bits & 1) & eorx) ^ bgx;
        store4pixels(d1, d2, d3, d4, (u32 *)(dest+32));
-#endif
     }
 }
 
@@ -178,39 +186,32 @@ void fbcon_cfb24_putcs(struct vc_data *conp, struct display *p,
     int rows, bytes = p->next_line;
     u32 eorx, fgx, bgx, d1, d2, d3, d4;
 
-    dest0 = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 3;
-    fgx = fbcon_cfb24_cmap[attr_fgcol(p, *s)];
-    bgx = fbcon_cfb24_cmap[attr_bgcol(p, *s)];
+    dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 3;
+    fgx = ((u32 *)p->dispsw_data)[attr_fgcol(p, *s)];
+    bgx = ((u32 *)p->dispsw_data)[attr_bgcol(p, *s)];
     eorx = fgx ^ bgx;
     while (count--) {
        c = *s++ & p->charmask;
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-       cdat = p->fontdata + c * p->fontheight;
-#else
-       if (p->fontwidth <= 8)
-           cdat = p->fontdata + c * p->fontheight;
+       if (fontwidth(p) <= 8)
+           cdat = p->fontdata + c * fontheight(p);
          
        else
-           cdat = p->fontdata + (c * p->fontheight << 1);
-#endif
-       for (rows = p->fontheight, dest = dest0; rows--; dest += bytes) {
+           cdat = p->fontdata + (c * fontheight(p) << 1);
+       for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) {
            bits = *cdat++;
            d1 = (-(bits >> 7) & eorx) ^ bgx;
            d2 = (-(bits >> 6 & 1) & eorx) ^ bgx;
            d3 = (-(bits >> 5 & 1) & eorx) ^ bgx;
            d4 = (-(bits >> 4 & 1) & eorx) ^ bgx;
            store4pixels(d1, d2, d3, d4, (u32 *)dest);
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-           if (p->fontwidth < 8)
+           if (fontwidth(p) < 8)
                continue;
-#endif
            d1 = (-(bits >> 3 & 1) & eorx) ^ bgx;
            d2 = (-(bits >> 2 & 1) & eorx) ^ bgx;
            d3 = (-(bits >> 1 & 1) & eorx) ^ bgx;
            d4 = (-(bits & 1) & eorx) ^ bgx;
            store4pixels(d1, d2, d3, d4, (u32 *)(dest+12));
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-           if (p->fontwidth < 12)
+           if (fontwidth(p) < 12)
                continue;
            bits = *cdat++;
            d1 = (-(bits >> 7) & eorx) ^ bgx;
@@ -218,16 +219,15 @@ void fbcon_cfb24_putcs(struct vc_data *conp, struct display *p,
            d3 = (-(bits >> 5 & 1) & eorx) ^ bgx;
            d4 = (-(bits >> 4 & 1) & eorx) ^ bgx;
            store4pixels(d1, d2, d3, d4, (u32 *)(dest+24));
-           if (p->fontwidth < 16)
+           if (fontwidth(p) < 16)
                continue;
            d1 = (-(bits >> 3 & 1) & eorx) ^ bgx;
            d2 = (-(bits >> 2 & 1) & eorx) ^ bgx;
            d3 = (-(bits >> 1 & 1) & eorx) ^ bgx;
            d4 = (-(bits & 1) & eorx) ^ bgx;
            store4pixels(d1, d2, d3, d4, (u32 *)(dest+32));
-#endif
        }
-       dest0 += p->fontwidth*3;
+       dest0 += fontwidth(p)*3;
     }
 }
 
@@ -236,15 +236,9 @@ void fbcon_cfb24_revc(struct display *p, int xx, int yy)
     u8 *dest;
     int bytes = p->next_line, rows;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 3;
-    for (rows = p->fontheight; rows--; dest += bytes) {
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-       ((u32 *)dest)[3] ^= 0xffffffff; ((u32 *)dest)[4] ^= 0xffffffff;
-       ((u32 *)dest)[5] ^= 0xffffffff;
-       ((u32 *)dest)[0] ^= 0xffffffff; ((u32 *)dest)[1] ^= 0xffffffff;
-       ((u32 *)dest)[2] ^= 0xffffffff;
-#else
-       switch (p->fontwidth) {
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 3;
+    for (rows = fontheight(p); rows--; dest += bytes) {
+       switch (fontwidth(p)) {
        case 16:
            ((u32 *)dest)[9] ^= 0xffffffff; ((u32 *)dest)[10] ^= 0xffffffff;
            ((u32 *)dest)[11] ^= 0xffffffff;    /* FALL THROUGH */
@@ -258,39 +252,27 @@ void fbcon_cfb24_revc(struct display *p, int xx, int yy)
            ((u32 *)dest)[0] ^= 0xffffffff; ((u32 *)dest)[1] ^= 0xffffffff;
            ((u32 *)dest)[2] ^= 0xffffffff;
        }
-#endif
     }
 }
 
-void fbcon_cfb24_clear_margins(struct vc_data *conp, struct display *p)
+void fbcon_cfb24_clear_margins(struct vc_data *conp, struct display *p,
+                              int bottom_only)
 {
-    u8 *dest0, *dest;
     int bytes = p->next_line;
     u32 bgx;
-    int i, j;
-
-    unsigned int right_start = conp->vc_cols*p->fontwidth;
-    unsigned int right_width = p->var.xres_virtual-right_start;
-    unsigned int bottom_start = conp->vc_rows*p->fontheight;
-    unsigned int bottom_width = p->var.yres_virtual-bottom_start;
-
-    bgx = fbcon_cfb24_cmap[attr_bgcol_ec(p, conp)];
-
-    if (right_width) {
-       dest0 = p->screen_base+right_start*3;
-       for (i = 0; i < bottom_start; i++, dest0 += bytes)
-           for (j = 0, dest = dest0; j < right_width/4; j++) {
-               store4pixels(bgx, bgx, bgx, bgx, (u32 *)dest);
-               dest += 12;
-           }
-    }
-    if (bottom_width) {
-       dest = p->screen_base+bottom_start*bytes;
-       for (i = 0; i < bytes*bottom_width/12; i++) {
-           store4pixels(bgx, bgx, bgx, bgx, (u32 *)dest);
-           dest += 12;
-       }
-    }
+
+    unsigned int right_start = conp->vc_cols*fontwidth(p);
+    unsigned int bottom_start = conp->vc_rows*fontheight(p);
+    unsigned int right_width, bottom_width;
+
+    bgx = ((u32 *)p->dispsw_data)[attr_bgcol_ec(p, conp)];
+
+    if (!bottom_only && (right_width = p->var.xres-right_start))
+       rectfill(p->screen_base+right_start*3, right_width,
+                p->var.yres_virtual, bgx, bytes);
+    if ((bottom_width = p->var.yres-bottom_start))
+       rectfill(p->screen_base+(p->var.yoffset+bottom_start)*bytes,
+                right_start, bottom_width, bgx, bytes);
 }
 
 
@@ -327,4 +309,4 @@ EXPORT_SYMBOL(fbcon_cfb24_clear);
 EXPORT_SYMBOL(fbcon_cfb24_putc);
 EXPORT_SYMBOL(fbcon_cfb24_putcs);
 EXPORT_SYMBOL(fbcon_cfb24_revc);
-EXPORT_SYMBOL(fbcon_cfb24_cmap);
+EXPORT_SYMBOL(fbcon_cfb24_clear_margins);
diff --git a/drivers/video/fbcon-cfb24.h b/drivers/video/fbcon-cfb24.h
deleted file mode 100644 (file)
index 83cee12..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-    /*
-     *  24 bpp packed pixel (cfb24)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_CFB24) || defined(CONFIG_FBCON_CFB24_MODULE)
-#define FBCON_HAS_CFB24
-#endif
-#else
-#if defined(CONFIG_FBCON_CFB24)
-#define FBCON_HAS_CFB24
-#endif
-#endif
-
-extern struct display_switch fbcon_cfb24;
-extern u32 fbcon_cfb24_cmap[16];
-extern void fbcon_cfb24_setup(struct display *p);
-extern void fbcon_cfb24_bmove(struct display *p, int sy, int sx, int dy,
-                             int dx, int height, int width);
-extern void fbcon_cfb24_clear(struct vc_data *conp, struct display *p, int sy,
-                             int sx, int height, int width);
-extern void fbcon_cfb24_putc(struct vc_data *conp, struct display *p, int c,
-                            int yy, int xx);
-extern void fbcon_cfb24_putcs(struct vc_data *conp, struct display *p,
-                             const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_cfb24_revc(struct display *p, int xx, int yy);
-extern void fbcon_cfb24_clear_margins(struct vc_data *conp, struct display *p);
index 1a1c48bcf525c534bafdb88b23ead3306e9ee31d..cd1e80a7dbf1c04f79d21515069a68adc4dcfdb9 100644 (file)
@@ -9,23 +9,20 @@
  *  more details.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
 #include <linux/fb.h>
 
-#include "fbcon.h"
-#include "fbcon-cfb32.h"
+#include <video/fbcon.h>
+#include <video/fbcon-cfb32.h>
 
 
     /*
      *  32 bpp packed pixels
      */
 
-u32 fbcon_cfb32_cmap[16];
-
 void fbcon_cfb32_setup(struct display *p)
 {
     p->next_line = p->line_length ? p->line_length : p->var.xres_virtual<<2;
@@ -35,28 +32,28 @@ void fbcon_cfb32_setup(struct display *p)
 void fbcon_cfb32_bmove(struct display *p, int sy, int sx, int dy, int dx,
                       int height, int width)
 {
-    int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+    int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
     u8 *src, *dst;
 
-    if (sx == 0 && dx == 0 && width * p->fontwidth * 4 == bytes) {
+    if (sx == 0 && dx == 0 && width * fontwidth(p) * 4 == bytes) {
        mymemmove(p->screen_base + dy * linesize,
                  p->screen_base + sy * linesize,
                  height * linesize);
        return;
     }
-    if (p->fontwidthlog) {
-       sx <<= p->fontwidthlog+2;
-       dx <<= p->fontwidthlog+2;
-       width <<= p->fontwidthlog+2;
+    if (fontwidthlog(p)) {
+       sx <<= fontwidthlog(p)+2;
+       dx <<= fontwidthlog(p)+2;
+       width <<= fontwidthlog(p)+2;
     } else {
-       sx *= p->fontwidth*4;
-       dx *= p->fontwidth*4;
-       width *= p->fontwidth*4;
+       sx *= fontwidth(p)*4;
+       dx *= fontwidth(p)*4;
+       width *= fontwidth(p)*4;
     }
     if (dy < sy || (dy == sy && dx < sx)) {
        src = p->screen_base + sy * linesize + sx;
        dst = p->screen_base + dy * linesize + dx;
-       for (rows = height * p->fontheight; rows--;) {
+       for (rows = height * fontheight(p); rows--;) {
            mymemmove(dst, src, width);
            src += bytes;
            dst += bytes;
@@ -64,7 +61,7 @@ void fbcon_cfb32_bmove(struct display *p, int sy, int sx, int dy, int dx,
     } else {
        src = p->screen_base + (sy+height) * linesize + sx - bytes;
        dst = p->screen_base + (dy+height) * linesize + dx - bytes;
-       for (rows = height * p->fontheight; rows--;) {
+       for (rows = height * fontheight(p); rows--;) {
            mymemmove(dst, src, width);
            src -= bytes;
            dst -= bytes;
@@ -72,39 +69,45 @@ void fbcon_cfb32_bmove(struct display *p, int sy, int sx, int dy, int dx,
     }
 }
 
+static inline void rectfill(u8 *dest, int width, int height, u32 data,
+                           int linesize)
+{
+    int i;
+
+    while (height-- > 0) {
+       u32 *p = (u32 *)dest;
+       for (i = 0; i < width/4; i++) {
+           *p++ = data;
+           *p++ = data;
+           *p++ = data;
+           *p++ = data;
+       }
+       if (width & 2) {
+           *p++ = data;
+           *p++ = data;
+       }
+       if (width & 1)
+           *p++ = data;
+       dest += linesize;
+    }
+}
+
 void fbcon_cfb32_clear(struct vc_data *conp, struct display *p, int sy, int sx,
                       int height, int width)
 {
-    u8 *dest0, *dest;
-    int bytes = p->next_line, lines = height * p->fontheight, rows, i;
+    u8 *dest;
+    int bytes = p->next_line, lines = height * fontheight(p);
     u32 bgx;
 
-    dest = p->screen_base + sy * p->fontheight * bytes + sx * p->fontwidth * 4;
+    dest = p->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p) * 4;
 
-    bgx = fbcon_cfb32_cmap[attr_bgcol_ec(p, conp)];
+    bgx = ((u32 *)p->dispsw_data)[attr_bgcol_ec(p, conp)];
 
-    width *= p->fontwidth/4;
-    if (sx == 0 && width * 16 == bytes)
-       for (i = 0; i < lines * width; i++) {
-           ((u32 *)dest)[0] = bgx;
-           ((u32 *)dest)[1] = bgx;
-           ((u32 *)dest)[2] = bgx;
-           ((u32 *)dest)[3] = bgx;
-           dest += 16;
-       }
-    else {
-       dest0 = dest;
-       for (rows = lines; rows--; dest0 += bytes) {
-           dest = dest0;
-           for (i = 0; i < width; i++) {
-               ((u32 *)dest)[0] = bgx;
-               ((u32 *)dest)[1] = bgx;
-               ((u32 *)dest)[2] = bgx;
-               ((u32 *)dest)[3] = bgx;
-               dest += 16;
-           }
-       }
-    }
+    width *= fontwidth(p)/4;
+    if (width * 16 == bytes)
+       rectfill(dest, lines * width * 4, 1, bgx, bytes);
+    else
+       rectfill(dest, width * 4, lines, bgx, bytes);
 }
 
 void fbcon_cfb32_putc(struct vc_data *conp, struct display *p, int c, int yy,
@@ -114,48 +117,40 @@ void fbcon_cfb32_putc(struct vc_data *conp, struct display *p, int c, int yy,
     int bytes = p->next_line, rows;
     u32 eorx, fgx, bgx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 4;
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-    cdat = p->fontdata + (c & p->charmask) * p->fontheight;
-#else
-    if (p->fontwidth <= 8)
-       cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 4;
+    if (fontwidth(p) <= 8)
+       cdat = p->fontdata + (c & p->charmask) * fontheight(p);
     else
-       cdat = p->fontdata + ((c & p->charmask) * p->fontheight << 1);
-#endif
-    fgx = fbcon_cfb32_cmap[attr_fgcol(p, c)];
-    bgx = fbcon_cfb32_cmap[attr_bgcol(p, c)];
+       cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1);
+    fgx = ((u32 *)p->dispsw_data)[attr_fgcol(p, c)];
+    bgx = ((u32 *)p->dispsw_data)[attr_bgcol(p, c)];
     eorx = fgx ^ bgx;
 
-    for (rows = p->fontheight; rows--; dest += bytes) {
+    for (rows = fontheight(p); rows--; dest += bytes) {
        bits = *cdat++;
        ((u32 *)dest)[0] = (-(bits >> 7) & eorx) ^ bgx;
        ((u32 *)dest)[1] = (-(bits >> 6 & 1) & eorx) ^ bgx;
        ((u32 *)dest)[2] = (-(bits >> 5 & 1) & eorx) ^ bgx;
        ((u32 *)dest)[3] = (-(bits >> 4 & 1) & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-       if (p->fontwidth < 8)
+       if (fontwidth(p) < 8)
            continue;
-#endif
        ((u32 *)dest)[4] = (-(bits >> 3 & 1) & eorx) ^ bgx;
        ((u32 *)dest)[5] = (-(bits >> 2 & 1) & eorx) ^ bgx;
        ((u32 *)dest)[6] = (-(bits >> 1 & 1) & eorx) ^ bgx;
        ((u32 *)dest)[7] = (-(bits & 1) & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-       if (p->fontwidth < 12)
+       if (fontwidth(p) < 12)
            continue;
        bits = *cdat++;
        ((u32 *)dest)[8] = (-(bits >> 7) & eorx) ^ bgx;
        ((u32 *)dest)[9] = (-(bits >> 6 & 1) & eorx) ^ bgx;
        ((u32 *)dest)[10] = (-(bits >> 5 & 1) & eorx) ^ bgx;
        ((u32 *)dest)[11] = (-(bits >> 4 & 1) & eorx) ^ bgx;
-       if (p->fontwidth < 16)
+       if (fontwidth(p) < 16)
            continue;
        ((u32 *)dest)[12] = (-(bits >> 3 & 1) & eorx) ^ bgx;
        ((u32 *)dest)[13] = (-(bits >> 2 & 1) & eorx) ^ bgx;
        ((u32 *)dest)[14] = (-(bits >> 1 & 1) & eorx) ^ bgx;
        ((u32 *)dest)[15] = (-(bits & 1) & eorx) ^ bgx;
-#endif
     }
 }
 
@@ -167,51 +162,43 @@ void fbcon_cfb32_putcs(struct vc_data *conp, struct display *p,
     int rows, bytes = p->next_line;
     u32 eorx, fgx, bgx;
 
-    dest0 = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 4;
-    fgx = fbcon_cfb32_cmap[attr_fgcol(p, *s)];
-    bgx = fbcon_cfb32_cmap[attr_bgcol(p, *s)];
+    dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 4;
+    fgx = ((u32 *)p->dispsw_data)[attr_fgcol(p, *s)];
+    bgx = ((u32 *)p->dispsw_data)[attr_bgcol(p, *s)];
     eorx = fgx ^ bgx;
     while (count--) {
        c = *s++ & p->charmask;
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-       cdat = p->fontdata + c * p->fontheight;
-#else
-       if (p->fontwidth <= 8)
-           cdat = p->fontdata + c * p->fontheight;
+       if (fontwidth(p) <= 8)
+           cdat = p->fontdata + c * fontheight(p);
        else
-           cdat = p->fontdata + (c * p->fontheight << 1);
-#endif
-       for (rows = p->fontheight, dest = dest0; rows--; dest += bytes) {
+           cdat = p->fontdata + (c * fontheight(p) << 1);
+       for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) {
            bits = *cdat++;
            ((u32 *)dest)[0] = (-(bits >> 7) & eorx) ^ bgx;
            ((u32 *)dest)[1] = (-(bits >> 6 & 1) & eorx) ^ bgx;
            ((u32 *)dest)[2] = (-(bits >> 5 & 1) & eorx) ^ bgx;
            ((u32 *)dest)[3] = (-(bits >> 4 & 1) & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-           if (p->fontwidth < 8)
+           if (fontwidth(p) < 8)
                continue;
-#endif
            ((u32 *)dest)[4] = (-(bits >> 3 & 1) & eorx) ^ bgx;
            ((u32 *)dest)[5] = (-(bits >> 2 & 1) & eorx) ^ bgx;
            ((u32 *)dest)[6] = (-(bits >> 1 & 1) & eorx) ^ bgx;
            ((u32 *)dest)[7] = (-(bits & 1) & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-           if (p->fontwidth < 12)
+           if (fontwidth(p) < 12)
                continue;
            bits = *cdat++;
            ((u32 *)dest)[8] = (-(bits >> 7) & eorx) ^ bgx;
            ((u32 *)dest)[9] = (-(bits >> 6 & 1) & eorx) ^ bgx;
            ((u32 *)dest)[10] = (-(bits >> 5 & 1) & eorx) ^ bgx;
            ((u32 *)dest)[11] = (-(bits >> 4 & 1) & eorx) ^ bgx;
-           if (p->fontwidth < 16)
+           if (fontwidth(p) < 16)
                continue;
            ((u32 *)dest)[12] = (-(bits >> 3 & 1) & eorx) ^ bgx;
            ((u32 *)dest)[13] = (-(bits >> 2 & 1) & eorx) ^ bgx;
            ((u32 *)dest)[14] = (-(bits >> 1 & 1) & eorx) ^ bgx;
            ((u32 *)dest)[15] = (-(bits & 1) & eorx) ^ bgx;
-#endif
        }
-       dest0 += p->fontwidth*4;
+       dest0 += fontwidth(p)*4;
     }
 }
 
@@ -220,15 +207,9 @@ void fbcon_cfb32_revc(struct display *p, int xx, int yy)
     u8 *dest;
     int bytes = p->next_line, rows;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 4;
-    for (rows = p->fontheight; rows--; dest += bytes) {
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-       ((u32 *)dest)[4] ^= 0xffffffff; ((u32 *)dest)[5] ^= 0xffffffff;
-       ((u32 *)dest)[6] ^= 0xffffffff; ((u32 *)dest)[7] ^= 0xffffffff;
-       ((u32 *)dest)[0] ^= 0xffffffff; ((u32 *)dest)[1] ^= 0xffffffff;
-       ((u32 *)dest)[2] ^= 0xffffffff; ((u32 *)dest)[3] ^= 0xffffffff;
-#else
-       switch (p->fontwidth) {
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 4;
+    for (rows = fontheight(p); rows--; dest += bytes) {
+       switch (fontwidth(p)) {
        case 16:
            ((u32 *)dest)[12] ^= 0xffffffff; ((u32 *)dest)[13] ^= 0xffffffff;
            ((u32 *)dest)[14] ^= 0xffffffff; ((u32 *)dest)[15] ^= 0xffffffff;
@@ -246,36 +227,27 @@ void fbcon_cfb32_revc(struct display *p, int xx, int yy)
            ((u32 *)dest)[2] ^= 0xffffffff; ((u32 *)dest)[3] ^= 0xffffffff;
            /* FALL THROUGH */
        }
-#endif
     }
 }
 
-void fbcon_cfb32_clear_margins(struct vc_data *conp, struct display *p)
+void fbcon_cfb32_clear_margins(struct vc_data *conp, struct display *p,
+                              int bottom_only)
 {
-    u8 *dest0;
-    u32 *dest;
     int bytes = p->next_line;
     u32 bgx;
-    int i, j;
 
-    unsigned int right_start = conp->vc_cols*p->fontwidth;
-    unsigned int right_width = p->var.xres_virtual-right_start;
-    unsigned int bottom_start = conp->vc_rows*p->fontheight;
-    unsigned int bottom_width = p->var.yres_virtual-bottom_start;
+    unsigned int right_start = conp->vc_cols*fontwidth(p);
+    unsigned int bottom_start = conp->vc_rows*fontheight(p);
+    unsigned int right_width, bottom_width;
 
-    bgx = fbcon_cfb32_cmap[attr_bgcol_ec(p, conp)];
+    bgx = ((u32 *)p->dispsw_data)[attr_bgcol_ec(p, conp)];
 
-    if (right_width) {
-       dest0 = p->screen_base+right_start*4;
-       for (i = 0; i < bottom_start; i++, dest0 += bytes)
-           for (j = 0, dest = (u32 *)dest0; j < right_width; j++)
-               *dest++ = bgx;
-    }
-    if (bottom_width) {
-       dest = (u32 *)(p->screen_base+bottom_start*bytes);
-       for (i = 0; i < bytes*bottom_width/4; i++)
-           *dest++ = bgx;
-    }
+    if (!bottom_only && (right_width = p->var.xres-right_start))
+       rectfill(p->screen_base+right_start*4, right_width,
+                p->var.yres_virtual, bgx, bytes);
+    if ((bottom_width = p->var.yres-bottom_start))
+       rectfill(p->screen_base+(p->var.yoffset+bottom_start)*bytes,
+                right_start, bottom_width, bgx, bytes);
 }
 
 
@@ -312,4 +284,4 @@ EXPORT_SYMBOL(fbcon_cfb32_clear);
 EXPORT_SYMBOL(fbcon_cfb32_putc);
 EXPORT_SYMBOL(fbcon_cfb32_putcs);
 EXPORT_SYMBOL(fbcon_cfb32_revc);
-EXPORT_SYMBOL(fbcon_cfb32_cmap);
+EXPORT_SYMBOL(fbcon_cfb32_clear_margins);
diff --git a/drivers/video/fbcon-cfb32.h b/drivers/video/fbcon-cfb32.h
deleted file mode 100644 (file)
index 500528b..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-    /*
-     *  32 bpp packed pixel (cfb32)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FBCON_CFB32_MODULE)
-#define FBCON_HAS_CFB32
-#endif
-#else
-#if defined(CONFIG_FBCON_CFB32)
-#define FBCON_HAS_CFB32
-#endif
-#endif
-
-extern struct display_switch fbcon_cfb32;
-extern u32 fbcon_cfb32_cmap[16];
-extern void fbcon_cfb32_setup(struct display *p);
-extern void fbcon_cfb32_bmove(struct display *p, int sy, int sx, int dy,
-                             int dx, int height, int width);
-extern void fbcon_cfb32_clear(struct vc_data *conp, struct display *p, int sy,
-                             int sx, int height, int width);
-extern void fbcon_cfb32_putc(struct vc_data *conp, struct display *p, int c,
-                            int yy, int xx);
-extern void fbcon_cfb32_putcs(struct vc_data *conp, struct display *p,
-                             const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_cfb32_revc(struct display *p, int xx, int yy);
-extern void fbcon_cfb32_clear_margins(struct vc_data *conp, struct display *p);
index 4d3f196bf3596dec96ebaec6fc5dd67d9d7d68be..78b87ffe707eda0fb6f3d486350fe0098be76c01 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/string.h>
 #include <linux/fb.h>
 
-#include "fbcon.h"
-#include "fbcon-cfb4.h"
+#include <video/fbcon.h>
+#include <video/fbcon-cfb4.h>
 
 
     /*
@@ -57,7 +57,7 @@ void fbcon_cfb4_setup(struct display *p)
 void fbcon_cfb4_bmove(struct display *p, int sy, int sx, int dy, int dx,
                      int height, int width)
 {
-       int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+       int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
        u8 *src,*dst;
 
        if (sx == 0 && dx == 0 && width * 4 == bytes) {
@@ -69,7 +69,7 @@ void fbcon_cfb4_bmove(struct display *p, int sy, int sx, int dy, int dx,
                if (dy < sy || (dy == sy && dx < sx)) {
                        src = p->screen_base + sy * linesize + sx * 4;
                        dst = p->screen_base + dy * linesize + dx * 4;
-                       for (rows = height * p->fontheight ; rows-- ;) {
+                       for (rows = height * fontheight(p) ; rows-- ;) {
                                mymemmove(dst, src, width * 4);
                                src += bytes;
                                dst += bytes;
@@ -80,7 +80,7 @@ void fbcon_cfb4_bmove(struct display *p, int sy, int sx, int dy, int dx,
                                - bytes;
                        dst = p->screen_base + (dy+height) * linesize + dx * 4
                                - bytes;
-                       for (rows = height * p->fontheight ; rows-- ;) {
+                       for (rows = height * fontheight(p) ; rows-- ;) {
                                mymemmove(dst, src, width * 4);
                                src -= bytes;
                                dst -= bytes;
@@ -93,12 +93,12 @@ void fbcon_cfb4_clear(struct vc_data *conp, struct display *p, int sy, int sx,
                      int height, int width)
 {
        u8 *dest0,*dest;
-       int bytes=p->next_line,lines=height * p->fontheight, rows, i;
+       int bytes=p->next_line,lines=height * fontheight(p), rows, i;
        u32 bgx;
 
 /*     if(p->screen_base!=0xFDD00020)
                mac_boom(1);*/
-       dest = p->screen_base + sy * p->fontheight * bytes + sx * 4;
+       dest = p->screen_base + sy * fontheight(p) * bytes + sx * 4;
 
        bgx=attr_bgcol_ec(p,conp);
        bgx |= (bgx << 4);      /* expand the colour to 32bits */
@@ -130,10 +130,10 @@ void fbcon_cfb4_putc(struct vc_data *conp, struct display *p, int c, int yy,
        int bytes=p->next_line,rows;
        u32 eorx,fgx,bgx;
 
-       dest = p->screen_base + yy * p->fontheight * bytes + xx * 4;
-       cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+       dest = p->screen_base + yy * fontheight(p) * bytes + xx * 4;
+       cdat = p->fontdata + (c & p->charmask) * fontheight(p);
 
-       fgx=15;/*attr_fgcol(p,c);*/
+       fgx=attr_fgcol(p,c);
        bgx=attr_bgcol(p,c);
        fgx |= (fgx << 4);
        fgx |= (fgx << 8);
@@ -141,7 +141,7 @@ void fbcon_cfb4_putc(struct vc_data *conp, struct display *p, int c, int yy,
        bgx |= (bgx << 8);
        eorx = fgx ^ bgx;
 
-       for (rows = p->fontheight ; rows-- ; dest += bytes) {
+       for (rows = fontheight(p) ; rows-- ; dest += bytes) {
                ((u16 *)dest)[0]=
                        (nibbletab_cfb4[*cdat >> 4] & eorx) ^ bgx;
                ((u16 *)dest)[1]=
@@ -157,8 +157,8 @@ void fbcon_cfb4_putcs(struct vc_data *conp, struct display *p,
        int rows,bytes=p->next_line;
        u32 eorx, fgx, bgx;
 
-       dest0 = p->screen_base + yy * p->fontheight * bytes + xx * 4;
-       fgx=15/*attr_fgcol(p,*s)*/;
+       dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * 4;
+       fgx=attr_fgcol(p,*s);
        bgx=attr_bgcol(p,*s);
        fgx |= (fgx << 4);
        fgx |= (fgx << 8);
@@ -169,9 +169,9 @@ void fbcon_cfb4_putcs(struct vc_data *conp, struct display *p,
        eorx = fgx ^ bgx;
        while (count--) {
                c = *s++ & p->charmask;
-               cdat = p->fontdata + c * p->fontheight;
+               cdat = p->fontdata + c * fontheight(p);
 
-               for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+               for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
                        ((u16 *)dest)[0]=
                        (nibbletab_cfb4[*cdat >> 4] & eorx) ^ bgx;
                        ((u16 *)dest)[1]=
@@ -186,9 +186,9 @@ void fbcon_cfb4_revc(struct display *p, int xx, int yy)
        u8 *dest;
        int bytes=p->next_line, rows;
 
-       dest = p->screen_base + yy * p->fontheight * bytes + xx * 4;
-       for (rows = p->fontheight ; rows-- ; dest += bytes) {
-               ((u32 *)dest)[0] ^= 0x0f0f0f0f;
+       dest = p->screen_base + yy * fontheight(p) * bytes + xx * 4;
+       for (rows = fontheight(p) ; rows-- ; dest += bytes) {
+               ((u32 *)dest)[0] ^= 0xffffffff;
        }
 }
 
diff --git a/drivers/video/fbcon-cfb4.h b/drivers/video/fbcon-cfb4.h
deleted file mode 100644 (file)
index df08288..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-    /*
-     *  4 bpp packed pixel (cfb4)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_CFB4) || defined(CONFIG_FBCON_CFB4_MODULE)
-#define FBCON_HAS_CFB4
-#endif
-#else
-#if defined(CONFIG_FBCON_CFB4)
-#define FBCON_HAS_CFB4
-#endif
-#endif
-
-extern struct display_switch fbcon_cfb4;
-extern void fbcon_cfb4_setup(struct display *p);
-extern void fbcon_cfb4_bmove(struct display *p, int sy, int sx, int dy, int dx,
-                            int height, int width);
-extern void fbcon_cfb4_clear(struct vc_data *conp, struct display *p, int sy,
-                            int sx, int height, int width);
-extern void fbcon_cfb4_putc(struct vc_data *conp, struct display *p, int c,
-                           int yy, int xx);
-extern void fbcon_cfb4_putcs(struct vc_data *conp, struct display *p,
-                            const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_cfb4_revc(struct display *p, int xx, int yy);
index b4de49b3b9b96692db6839e53c570b509db469e9..5fe78bc30e0ae05243e89eb554c877d1bbecab09 100644 (file)
@@ -9,15 +9,14 @@
  *  more details.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
 #include <linux/fb.h>
 
-#include "fbcon.h"
-#include "fbcon-cfb8.h"
+#include <video/fbcon.h>
+#include <video/fbcon-cfb8.h>
 
 
     /*
@@ -49,24 +48,24 @@ void fbcon_cfb8_setup(struct display *p)
 void fbcon_cfb8_bmove(struct display *p, int sy, int sx, int dy, int dx,
                      int height, int width)
 {
-    int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+    int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
     u8 *src,*dst;
 
-    if (sx == 0 && dx == 0 && width * p->fontwidth == bytes) {
+    if (sx == 0 && dx == 0 && width * fontwidth(p) == bytes) {
        mymemmove(p->screen_base + dy * linesize,
                  p->screen_base + sy * linesize,
                  height * linesize);
        return;
     }
-    if (p->fontwidthlog) {
-       sx <<= p->fontwidthlog; dx <<= p->fontwidthlog; width <<= p->fontwidthlog;
+    if (fontwidthlog(p)) {
+       sx <<= fontwidthlog(p); dx <<= fontwidthlog(p); width <<= fontwidthlog(p);
     } else {
-       sx *= p->fontwidth; dx *= p->fontwidth; width *= p->fontwidth;
+       sx *= fontwidth(p); dx *= fontwidth(p); width *= fontwidth(p);
     }
     if (dy < sy || (dy == sy && dx < sx)) {
        src = p->screen_base + sy * linesize + sx;
        dst = p->screen_base + dy * linesize + dx;
-       for (rows = height * p->fontheight ; rows-- ;) {
+       for (rows = height * fontheight(p) ; rows-- ;) {
            mymemmove(dst, src, width);
            src += bytes;
            dst += bytes;
@@ -74,7 +73,7 @@ void fbcon_cfb8_bmove(struct display *p, int sy, int sx, int dy, int dx,
     } else {
        src = p->screen_base + (sy+height) * linesize + sx - bytes;
        dst = p->screen_base + (dy+height) * linesize + dx - bytes;
-       for (rows = height * p->fontheight ; rows-- ;) {
+       for (rows = height * fontheight(p) ; rows-- ;) {
            mymemmove(dst, src, width);
            src -= bytes;
            dst -= bytes;
@@ -82,24 +81,31 @@ void fbcon_cfb8_bmove(struct display *p, int sy, int sx, int dy, int dx,
     }
 }
 
+static inline void rectfill(u8 *dest, int width, int height, u8 data,
+                           int linesize)
+{
+    while (height-- > 0) {
+       memset(dest, data, width);
+       dest += linesize;
+    }
+}
+
 void fbcon_cfb8_clear(struct vc_data *conp, struct display *p, int sy, int sx,
                      int height, int width)
 {
     u8 *dest;
-    int bytes=p->next_line,lines=height * p->fontheight, rows;
+    int bytes=p->next_line,lines=height * fontheight(p);
     u8 bgx;
 
-    dest = p->screen_base + sy * p->fontheight * bytes + sx * p->fontwidth;
+    dest = p->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p);
 
     bgx=attr_bgcol_ec(p,conp);
 
-    if (sx == 0 && p->fontwidth == 8 && width * 8 == bytes)
-        memset(dest, bgx, lines * width * p->fontwidth);
-    else {
-       width *= p->fontwidth;
-       for (rows = lines; rows-- ; dest += bytes)
-           memset(dest, bgx, width);
-    }
+    width *= fontwidth(p);
+    if (width == bytes)
+       rectfill(dest, lines * width, 1, bgx, bytes);
+    else
+       rectfill(dest, width, lines, bgx, bytes);
 }
 
 void fbcon_cfb8_putc(struct vc_data *conp, struct display *p, int c, int yy,
@@ -109,11 +115,11 @@ void fbcon_cfb8_putc(struct vc_data *conp, struct display *p, int c, int yy,
     int bytes=p->next_line,rows;
     u32 eorx,fgx,bgx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth;
-    if (p->fontwidth <= 8)
-       cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p);
+    if (fontwidth(p) <= 8)
+       cdat = p->fontdata + (c & p->charmask) * fontheight(p);
     else
-       cdat = p->fontdata + ((c & p->charmask) * p->fontheight << 1);
+       cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1);
 
     fgx=attr_fgcol(p,c);
     bgx=attr_bgcol(p,c);
@@ -123,33 +129,29 @@ void fbcon_cfb8_putc(struct vc_data *conp, struct display *p, int c, int yy,
     bgx |= (bgx << 16);
     eorx = fgx ^ bgx;
 
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-    switch (p->fontwidth) {
+    switch (fontwidth(p)) {
     case 4:
-       for (rows = p->fontheight ; rows-- ; dest += bytes)
+       for (rows = fontheight(p) ; rows-- ; dest += bytes)
            ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat++ >> 4] & eorx) ^ bgx;
         break;
     case 8:
-#endif
-       for (rows = p->fontheight ; rows-- ; dest += bytes) {
+       for (rows = fontheight(p) ; rows-- ; dest += bytes) {
            ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx;
            ((u32 *)dest)[1]= (nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx;
         }
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
         break;
     case 12:
     case 16:
-       for (rows = p->fontheight ; rows-- ; dest += bytes) {
+       for (rows = fontheight(p) ; rows-- ; dest += bytes) {
            ((u32 *)dest)[0]= (nibbletab_cfb8[*(u16 *)cdat >> 12] & eorx) ^ bgx;
            ((u32 *)dest)[1]= (nibbletab_cfb8[(*(u16 *)cdat >> 8) & 0xf] & eorx) ^ bgx;
            ((u32 *)dest)[2]= (nibbletab_cfb8[(*(u16 *)cdat >> 4) & 0xf] & eorx) ^ bgx;
-           if (p->fontwidth == 16)
+           if (fontwidth(p) == 16)
                ((u32 *)dest)[3]= (nibbletab_cfb8[*cdat & 0xf] & eorx) ^ bgx;
            cdat += 2;
         }
         break;
     }
-#endif
 }
 
 void fbcon_cfb8_putcs(struct vc_data *conp, struct display *p, 
@@ -160,7 +162,7 @@ void fbcon_cfb8_putcs(struct vc_data *conp, struct display *p,
     int rows,bytes=p->next_line;
     u32 eorx, fgx, bgx;
 
-    dest0 = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth;
+    dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p);
     fgx=attr_fgcol(p,*s);
     bgx=attr_bgcol(p,*s);
     fgx |= (fgx << 8);
@@ -168,51 +170,47 @@ void fbcon_cfb8_putcs(struct vc_data *conp, struct display *p,
     bgx |= (bgx << 8);
     bgx |= (bgx << 16);
     eorx = fgx ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-    switch (p->fontwidth) {
+    switch (fontwidth(p)) {
     case 4:
        while (count--) {
            c = *s++ & p->charmask;
-           cdat = p->fontdata + c * p->fontheight;
+           cdat = p->fontdata + c * fontheight(p);
 
-           for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes)
+           for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes)
                ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat++ >> 4] & eorx) ^ bgx;
            dest0+=4;
         }
         break;
     case 8:
-#endif
        while (count--) {
            c = *s++ & p->charmask;
-           cdat = p->fontdata + c * p->fontheight;
+           cdat = p->fontdata + c * fontheight(p);
 
-           for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+           for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
                ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx;
                ((u32 *)dest)[1]= (nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx;
            }
            dest0+=8;
         }
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
         break;
     case 12:
     case 16:
        while (count--) {
            c = *s++ & p->charmask;
-           cdat = p->fontdata + (c * p->fontheight << 1);
+           cdat = p->fontdata + (c * fontheight(p) << 1);
 
-           for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+           for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
                ((u32 *)dest)[0]= (nibbletab_cfb8[*(u16 *)cdat >> 12] & eorx) ^ bgx;
                ((u32 *)dest)[1]= (nibbletab_cfb8[(*(u16 *)cdat >> 8) & 0xf] & eorx) ^ bgx;
                ((u32 *)dest)[2]= (nibbletab_cfb8[(*(u16 *)cdat >> 4) & 0xf] & eorx) ^ bgx;
-               if (p->fontwidth == 16)
+               if (fontwidth(p) == 16)
                    ((u32 *)dest)[3]= (nibbletab_cfb8[*cdat & 0xf] & eorx) ^ bgx;
                cdat += 2;
            }
-           dest0+=p->fontwidth;
+           dest0+=fontwidth(p);
         }
         break;
     }
-#endif
 }
 
 void fbcon_cfb8_revc(struct display *p, int xx, int yy)
@@ -220,44 +218,36 @@ void fbcon_cfb8_revc(struct display *p, int xx, int yy)
     u8 *dest;
     int bytes=p->next_line, rows;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth;
-    for (rows = p->fontheight ; rows-- ; dest += bytes) {
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-       ((u32 *)dest)[1] ^= 0x0f0f0f0f;
-       ((u32 *)dest)[0] ^= 0x0f0f0f0f;
-#else
-       switch (p->fontwidth) {
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p);
+    for (rows = fontheight(p) ; rows-- ; dest += bytes) {
+       switch (fontwidth(p)) {
        case 16: ((u32 *)dest)[3] ^= 0x0f0f0f0f; /* FALL THROUGH */
        case 12: ((u32 *)dest)[2] ^= 0x0f0f0f0f; /* FALL THROUGH */
        case 8: ((u32 *)dest)[1] ^= 0x0f0f0f0f;  /* FALL THROUGH */
        case 4: ((u32 *)dest)[0] ^= 0x0f0f0f0f;  /* FALL THROUGH */
        default: break;
        }
-#endif
     }
 }
 
-void fbcon_cfb8_clear_margins(struct vc_data *conp, struct display *p)
+void fbcon_cfb8_clear_margins(struct vc_data *conp, struct display *p,
+                             int bottom_only)
 {
-    u8 *dest;
     int bytes=p->next_line;
     u8 bgx;
-    int i;
 
-    unsigned int right_start = conp->vc_cols*p->fontwidth;
-    unsigned int right_width = p->var.xres_virtual-right_start;
-    unsigned int bottom_start = conp->vc_rows*p->fontheight;
-    unsigned int bottom_width = p->var.yres_virtual-bottom_start;
+    unsigned int right_start = conp->vc_cols*fontwidth(p);
+    unsigned int bottom_start = conp->vc_rows*fontheight(p);
+    unsigned int right_width, bottom_width;
 
     bgx=attr_bgcol_ec(p,conp);
 
-    if (right_width) {
-       dest = p->screen_base+right_start;
-       for (i = 0; i < bottom_start; i++, dest += bytes)
-           memset(dest, bgx, right_width);
-    }
-    if (bottom_width)
-       memset(p->screen_base+bottom_start*bytes, bgx, bytes*bottom_width);
+    if (!bottom_only && (right_width = p->var.xres-right_start))
+       rectfill(p->screen_base+right_start, right_width, p->var.yres_virtual,
+                bgx, bytes);
+    if ((bottom_width = p->var.yres-bottom_start))
+       rectfill(p->screen_base+(p->var.yoffset+bottom_start)*bytes,
+                right_start, bottom_width, bgx, bytes);
 }
 
 
@@ -294,3 +284,4 @@ EXPORT_SYMBOL(fbcon_cfb8_clear);
 EXPORT_SYMBOL(fbcon_cfb8_putc);
 EXPORT_SYMBOL(fbcon_cfb8_putcs);
 EXPORT_SYMBOL(fbcon_cfb8_revc);
+EXPORT_SYMBOL(fbcon_cfb8_clear_margins);
diff --git a/drivers/video/fbcon-cfb8.h b/drivers/video/fbcon-cfb8.h
deleted file mode 100644 (file)
index e1d8170..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-    /*
-     *  8 bpp packed pixel (cfb8)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_CFB8) || defined(CONFIG_FBCON_CFB8_MODULE)
-#define FBCON_HAS_CFB8
-#endif
-#else
-#if defined(CONFIG_FBCON_CFB8)
-#define FBCON_HAS_CFB8
-#endif
-#endif
-
-extern struct display_switch fbcon_cfb8;
-extern void fbcon_cfb8_setup(struct display *p);
-extern void fbcon_cfb8_bmove(struct display *p, int sy, int sx, int dy, int dx,
-                            int height, int width);
-extern void fbcon_cfb8_clear(struct vc_data *conp, struct display *p, int sy,
-                            int sx, int height, int width);
-extern void fbcon_cfb8_putc(struct vc_data *conp, struct display *p, int c,
-                           int yy, int xx);
-extern void fbcon_cfb8_putcs(struct vc_data *conp, struct display *p,
-                            const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_cfb8_revc(struct display *p, int xx, int yy);
-extern void fbcon_cfb8_clear_margins(struct vc_data *conp, struct display *p);
index b87a1d10caaae70989926dd51eed2a3558030d45..183f05a46669b4741c7686861a4c5c2026bd6b80 100644 (file)
@@ -15,8 +15,8 @@
 #include <linux/string.h>
 #include <linux/fb.h>
 
-#include "fbcon.h"
-#include "fbcon-ilbm.h"
+#include <video/fbcon.h>
+#include <video/fbcon-ilbm.h>
 
 
     /*
@@ -45,25 +45,25 @@ void fbcon_ilbm_bmove(struct display *p, int sy, int sx, int dy, int dx,
                      int height, int width)
 {
     if (sx == 0 && dx == 0 && width == p->next_plane)
-       mymemmove(p->screen_base+dy*p->fontheight*p->next_line,
-                 p->screen_base+sy*p->fontheight*p->next_line,
-                 height*p->fontheight*p->next_line);
+       mymemmove(p->screen_base+dy*fontheight(p)*p->next_line,
+                 p->screen_base+sy*fontheight(p)*p->next_line,
+                 height*fontheight(p)*p->next_line);
     else {
        u8 *src, *dest;
        u_int i;
 
        if (dy <= sy) {
-           src = p->screen_base+sy*p->fontheight*p->next_line+sx;
-           dest = p->screen_base+dy*p->fontheight*p->next_line+dx;
-           for (i = p->var.bits_per_pixel*height*p->fontheight; i--;) {
+           src = p->screen_base+sy*fontheight(p)*p->next_line+sx;
+           dest = p->screen_base+dy*fontheight(p)*p->next_line+dx;
+           for (i = p->var.bits_per_pixel*height*fontheight(p); i--;) {
                mymemmove(dest, src, width);
                src += p->next_plane;
                dest += p->next_plane;
            }
        } else {
-           src = p->screen_base+(sy+height)*p->fontheight*p->next_line+sx;
-           dest = p->screen_base+(dy+height)*p->fontheight*p->next_line+dx;
-           for (i = p->var.bits_per_pixel*height*p->fontheight; i--;) {
+           src = p->screen_base+(sy+height)*fontheight(p)*p->next_line+sx;
+           dest = p->screen_base+(dy+height)*fontheight(p)*p->next_line+dx;
+           for (i = p->var.bits_per_pixel*height*fontheight(p); i--;) {
                src -= p->next_plane;
                dest -= p->next_plane;
                mymemmove(dest, src, width);
@@ -79,10 +79,10 @@ void fbcon_ilbm_clear(struct vc_data *conp, struct display *p, int sy, int sx,
     u_int i, rows;
     int bg, bg0;
 
-    dest = p->screen_base+sy*p->fontheight*p->next_line+sx;
+    dest = p->screen_base+sy*fontheight(p)*p->next_line+sx;
 
     bg0 = attr_bgcol_ec(p,conp);
-    for (rows = height*p->fontheight; rows--;) {
+    for (rows = height*fontheight(p); rows--;) {
        bg = bg0;
        for (i = p->var.bits_per_pixel; i--; dest += p->next_plane) {
            if (bg & 1)
@@ -102,12 +102,12 @@ void fbcon_ilbm_putc(struct vc_data *conp, struct display *p, int c, int yy,
     u8 d;
     int fg0, bg0, fg, bg;
 
-    dest = p->screen_base+yy*p->fontheight*p->next_line+xx;
-    cdat = p->fontdata+(c&p->charmask)*p->fontheight;
+    dest = p->screen_base+yy*fontheight(p)*p->next_line+xx;
+    cdat = p->fontdata+(c&p->charmask)*fontheight(p);
     fg0 = attr_fgcol(p,c);
     bg0 = attr_bgcol(p,c);
 
-    for (rows = p->fontheight; rows--;) {
+    for (rows = fontheight(p); rows--;) {
        d = *cdat++;
        fg = fg0;
        bg = bg0;
@@ -153,7 +153,7 @@ void fbcon_ilbm_putcs(struct vc_data *conp, struct display *p,
     u32 d;
     int fg0, bg0, fg, bg;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
     fg0 = attr_fgcol(p,*s);
     bg0 = attr_bgcol(p,*s);
 
@@ -163,8 +163,8 @@ void fbcon_ilbm_putcs(struct vc_data *conp, struct display *p,
            dest = dest0++;
            xx++;
 
-           cdat1 = p->fontdata+c1*p->fontheight;
-           for (rows = p->fontheight; rows--;) {
+           cdat1 = p->fontdata+c1*fontheight(p);
+           for (rows = fontheight(p); rows--;) {
                d = *cdat1++;
                fg = fg0;
                bg = bg0;
@@ -191,11 +191,11 @@ void fbcon_ilbm_putcs(struct vc_data *conp, struct display *p,
            c4 = s[3] & p->charmask;
 
            dest = dest0;
-           cdat1 = p->fontdata+c1*p->fontheight;
-           cdat2 = p->fontdata+c2*p->fontheight;
-           cdat3 = p->fontdata+c3*p->fontheight;
-           cdat4 = p->fontdata+c4*p->fontheight;
-           for (rows = p->fontheight; rows--;) {
+           cdat1 = p->fontdata+c1*fontheight(p);
+           cdat2 = p->fontdata+c2*fontheight(p);
+           cdat3 = p->fontdata+c3*fontheight(p);
+           cdat4 = p->fontdata+c4*fontheight(p);
+           for (rows = fontheight(p); rows--;) {
 #if defined(__BIG_ENDIAN)
                d = *cdat1++<<24 | *cdat2++<<16 | *cdat3++<<8 | *cdat4++;
 #elif defined(__LITTLE_ENDIAN)
@@ -234,7 +234,7 @@ void fbcon_ilbm_revc(struct display *p, int xx, int yy)
     u_int rows, i;
     int mask;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
     mask = p->fgcol ^ p->bgcol;
 
     /*
@@ -246,7 +246,7 @@ void fbcon_ilbm_revc(struct display *p, int xx, int yy)
     for (i = p->var.bits_per_pixel; i--; dest0 += p->next_plane) {
        if (mask & 1) {
            dest = dest0;
-           for (rows = p->fontheight; rows--; dest += p->next_line)
+           for (rows = fontheight(p); rows--; dest += p->next_line)
                *dest = ~*dest;
        }
        mask >>= 1;
diff --git a/drivers/video/fbcon-ilbm.h b/drivers/video/fbcon-ilbm.h
deleted file mode 100644 (file)
index 13292f2..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-    /*
-     *  Amiga interleaved bitplanes (ilbm)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_ILBM) || defined(CONFIG_FBCON_ILBM_MODULE)  
-#define FBCON_HAS_ILBM 
-#endif
-#else
-#if defined(CONFIG_FBCON_ILBM) 
-#define FBCON_HAS_ILBM 
-#endif
-#endif
-
-extern struct display_switch fbcon_ilbm;
-extern void fbcon_ilbm_setup(struct display *p);
-extern void fbcon_ilbm_bmove(struct display *p, int sy, int sx, int dy, int dx,
-                            int height, int width);
-extern void fbcon_ilbm_clear(struct vc_data *conp, struct display *p, int sy,
-                            int sx, int height, int width);
-extern void fbcon_ilbm_putc(struct vc_data *conp, struct display *p, int c,
-                           int yy, int xx);
-extern void fbcon_ilbm_putcs(struct vc_data *conp, struct display *p,
-                            const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_ilbm_revc(struct display *p, int xx, int yy);
index 3cd8ab81ea21345e4b4cbb729d93901f1ef3e11d..829e89e35947dc7b3a8f413dee5b9a1d186ded6b 100644 (file)
@@ -19,8 +19,8 @@
 
 #include <asm/byteorder.h>
 
-#include "fbcon.h"
-#include "fbcon-iplan2p2.h"
+#include <video/fbcon.h>
+#include <video/fbcon-iplan2p2.h>
 
 
     /*
@@ -169,16 +169,16 @@ void fbcon_iplan2p2_bmove(struct display *p, int sy, int sx, int dy, int dx,
        /*  Special (but often used) case: Moving whole lines can be
         *  done with memmove()
         */
-       mymemmove(p->screen_base + dy * p->next_line * p->fontheight,
-                 p->screen_base + sy * p->next_line * p->fontheight,
-                 p->next_line * height * p->fontheight);
+       mymemmove(p->screen_base + ((dy * p->next_line) << fontheightlog(p)),
+                 p->screen_base + ((sy * p->next_line) << fontheightlog(p)),
+                 (p->next_line * height) << fontheightlog(p));
     } else {
        int rows, cols;
        u8 *src;
        u8 *dst;
        int bytes = p->next_line;
-       int linesize = bytes * p->fontheight;
-       u_int colsize  = height * p->fontheight;
+       int linesize = bytes << fontheightlog(p);
+       u_int colsize  = height << fontheightlog(p);
        u_int upwards  = (dy < sy) || (dy == sy && dx < sx);
 
        if ((sx & 1) == (dx & 1)) {
@@ -258,7 +258,7 @@ void fbcon_iplan2p2_clear(struct vc_data *conp, struct display *p, int sy,
     u8 *start;
     int rows;
     int bytes = p->next_line;
-    int lines = height * p->fontheight;
+    int lines = height << fontheightlog(p);
     u32 size;
     u32 cval;
     u16 pcval;
@@ -266,11 +266,11 @@ void fbcon_iplan2p2_clear(struct vc_data *conp, struct display *p, int sy,
     cval = expand2l (COLOR_2P (attr_bgcol_ec(p,conp)));
 
     if (sx == 0 && width * 2 == bytes) {
-       offset = sy * bytes * p->fontheight;
+       offset = (sy * bytes) << fontheightlog(p);
        size = lines * bytes;
        memset_even_2p(p->screen_base+offset, size, cval);
     } else {
-       offset = (sy * bytes * p->fontheight) + (sx>>1)*4 + (sx & 1);
+       offset = ((sy * bytes) << fontheightlog(p)) + (sx>>1)*4 + (sx & 1);
        start = p->screen_base + offset;
        pcval = expand2w(COLOR_2P(attr_bgcol_ec(p,conp)));
 
@@ -306,14 +306,14 @@ void fbcon_iplan2p2_putc(struct vc_data *conp, struct display *p, int c,
     int bytes = p->next_line;
     u16 eorx, fgx, bgx, fdx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*4 + (xx & 1);
-    cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + ((yy * bytes) << fontheightlog(p)) + (xx>>1)*4 + (xx & 1);
+    cdat = p->fontdata + ((c & p->charmask) << fontheightlog(p));
 
     fgx = expand2w(COLOR_2P(attr_fgcol(p,c)));
     bgx = expand2w(COLOR_2P(attr_bgcol(p,c)));
     eorx = fgx ^ bgx;
 
-    for (rows = p->fontheight ; rows-- ; dest += bytes) {
+    for (rows = fontheight(p) ; rows-- ; dest += bytes) {
        fdx = dup2w(*cdat++);
        movepw(dest, (fdx & eorx) ^ bgx);
     }
@@ -330,16 +330,16 @@ void fbcon_iplan2p2_putcs(struct vc_data *conp, struct display *p,
     u16 eorx, fgx, bgx, fdx;
 
     bytes = p->next_line;
-    dest0 = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*4 + (xx & 1);
+    dest0 = p->screen_base + ((yy * bytes) << fontheightlog(p)) + (xx>>1)*4 + (xx & 1);
     fgx = expand2w(COLOR_2P(attr_fgcol(p,*s)));
     bgx = expand2w(COLOR_2P(attr_bgcol(p,*s)));
     eorx = fgx ^ bgx;
 
     while (count--) {
        c = *s++ & p->charmask;
-       cdat  = p->fontdata + (c * p->fontheight);
+       cdat  = p->fontdata + (c << fontheightlog(p));
 
-       for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+       for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
            fdx = dup2w(*cdat++);
            movepw(dest, (fdx & eorx) ^ bgx);
        }
@@ -353,9 +353,9 @@ void fbcon_iplan2p2_revc(struct display *p, int xx, int yy)
     int j;
     int bytes;
 
-    dest = p->screen_base + yy * p->fontheight * p->next_line + (xx>>1)*4 +
-          (xx & 1);
-    j = p->fontheight;
+    dest = (p->screen_base + ((yy * p->next_line) << fontheightlog(p)) +
+           (xx>>1)*4 + (xx & 1));
+    j = fontheight(p);
     bytes = p->next_line;
     while (j--) {
        /*  This should really obey the individual character's
diff --git a/drivers/video/fbcon-iplan2p2.h b/drivers/video/fbcon-iplan2p2.h
deleted file mode 100644 (file)
index 07b5a0d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-    /*
-     *  Atari interleaved bitplanes (2 planes) (iplan2p2)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_IPLAN2P2) || defined(CONFIG_FBCON_IPLAN2P2_MODULE)
-#define FBCON_HAS_IPLAN2P2
-#endif
-#else
-#if defined(CONFIG_FBCON_IPLAN2P2)
-#define FBCON_HAS_IPLAN2P2
-#endif
-#endif
-
-extern struct display_switch fbcon_iplan2p2;
-extern void fbcon_iplan2p2_setup(struct display *p);
-extern void fbcon_iplan2p2_bmove(struct display *p, int sy, int sx, int dy,
-                                int dx, int height, int width);
-extern void fbcon_iplan2p2_clear(struct vc_data *conp, struct display *p,
-                                int sy, int sx, int height, int width);
-extern void fbcon_iplan2p2_putc(struct vc_data *conp, struct display *p, int c,
-                               int yy, int xx);
-extern void fbcon_iplan2p2_putcs(struct vc_data *conp, struct display *p,
-                                const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_iplan2p2_revc(struct display *p, int xx, int yy);
index 4bd21c36654569077e350f0aa0b6970ad04ea983..74eb40cef6701e08646c3cdc4224a017a8772a24 100644 (file)
@@ -19,8 +19,8 @@
 
 #include <asm/byteorder.h>
 
-#include "fbcon.h"
-#include "fbcon-iplan2p4.h"
+#include <video/fbcon.h>
+#include <video/fbcon-iplan2p4.h>
 
 
     /*
@@ -177,16 +177,16 @@ void fbcon_iplan2p4_bmove(struct display *p, int sy, int sx, int dy, int dx,
        /*  Special (but often used) case: Moving whole lines can be
         *done with memmove()
         */
-       mymemmove(p->screen_base + dy * p->next_line * p->fontheight,
-                 p->screen_base + sy * p->next_line * p->fontheight,
-                 p->next_line * height * p->fontheight);
+       mymemmove(p->screen_base + ((dy * p->next_line) << fontheightlog(p)),
+                 p->screen_base + ((sy * p->next_line) << fontheightlog(p)),
+                 (p->next_line * height) << fontheightlog(p));
     } else {
        int rows, cols;
        u8 *src;
        u8 *dst;
        int bytes = p->next_line;
-       int linesize = bytes * p->fontheight;
-       u_int colsize  = height * p->fontheight;
+       int linesize = bytes << fontheightlog(p);
+       u_int colsize  = height << fontheightlog(p);
        u_int upwards  = (dy < sy) || (dy == sy && dx < sx);
 
        if ((sx & 1) == (dx & 1)) {
@@ -269,18 +269,18 @@ void fbcon_iplan2p4_clear(struct vc_data *conp, struct display *p, int sy,
     u8 *start;
     int rows;
     int bytes = p->next_line;
-    int lines = height * p->fontheight;
+    int lines = height << fontheightlog(p);
     u32 size;
     u32 cval1, cval2, pcval;
 
     expand4dl(attr_bgcol_ec(p,conp), &cval1, &cval2);
 
     if (sx == 0 && width * 4 == bytes) {
-       offset = sy * bytes * p->fontheight;
+       offset = (sy * bytes) << fontheightlog(p);
        size = lines * bytes;
        memset_even_4p(p->screen_base+offset, size, cval1, cval2);
     } else {
-       offset = (sy * bytes * p->fontheight) + (sx>>1)*8 + (sx & 1);
+       offset = ((sy * bytes) << fontheightlog(p)) + (sx>>1)*8 + (sx & 1);
        start = p->screen_base + offset;
        pcval = expand4l(attr_bgcol_ec(p,conp));
 
@@ -316,14 +316,14 @@ void fbcon_iplan2p4_putc(struct vc_data *conp, struct display *p, int c,
     int bytes = p->next_line;
     u32 eorx, fgx, bgx, fdx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*8 + (xx & 1);
-    cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + ((yy * bytes) << fontheightlog(p)) + (xx>>1)*8 + (xx & 1);
+    cdat = p->fontdata + ((c & p->charmask) << fontheightlog(p));
 
     fgx = expand4l(attr_fgcol(p,c));
     bgx = expand4l(attr_bgcol(p,c));
     eorx = fgx ^ bgx;
 
-    for(rows = p->fontheight ; rows-- ; dest += bytes) {
+    for(rows = fontheight(p) ; rows-- ; dest += bytes) {
        fdx = dup4l(*cdat++);
        movepl(dest, (fdx & eorx) ^ bgx);
     }
@@ -340,7 +340,7 @@ void fbcon_iplan2p4_putcs(struct vc_data *conp, struct display *p,
     u32 eorx, fgx, bgx, fdx;
 
     bytes = p->next_line;
-    dest0 = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*8 + (xx & 1);
+    dest0 = p->screen_base + ((yy * bytes) << fontheightlog(p)) + (xx>>1)*8 + (xx & 1);
     fgx = expand4l(attr_fgcol(p,*s));
     bgx = expand4l(attr_bgcol(p,*s));
     eorx = fgx ^ bgx;
@@ -354,9 +354,9 @@ void fbcon_iplan2p4_putcs(struct vc_data *conp, struct display *p,
        */
 
        c = *s++ & p->charmask;
-       cdat  = p->fontdata + (c * p->fontheight);
+       cdat  = p->fontdata + (c << fontheightlog(p));
 
-       for(rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+       for(rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
            fdx = dup4l(*cdat++);
            movepl(dest, (fdx & eorx) ^ bgx);
        }
@@ -370,9 +370,9 @@ void fbcon_iplan2p4_revc(struct display *p, int xx, int yy)
     int j;
     int bytes;
 
-    dest = p->screen_base + yy * p->fontheight * p->next_line + (xx>>1)*8 +
-          (xx & 1);
-    j = p->fontheight;
+    dest = (p->screen_base + ((yy * p->next_line) << fontheightlog(p)) +
+           (xx>>1)*8 + (xx & 1));
+    j = fontheight(p);
     bytes = p->next_line;
 
     while (j--) {
diff --git a/drivers/video/fbcon-iplan2p4.h b/drivers/video/fbcon-iplan2p4.h
deleted file mode 100644 (file)
index 6d501a5..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-    /*
-     *  Atari interleaved bitplanes (4 planes) (iplan2p4)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_IPLAN2P4) || defined(CONFIG_FBCON_IPLAN2P4_MODULE)
-#define FBCON_HAS_IPLAN2P4
-#endif
-#else
-#if defined(CONFIG_FBCON_IPLAN2P4)
-#define FBCON_HAS_IPLAN2P4
-#endif
-#endif
-
-extern struct display_switch fbcon_iplan2p4;
-extern void fbcon_iplan2p4_setup(struct display *p);
-extern void fbcon_iplan2p4_bmove(struct display *p, int sy, int sx, int dy,
-                                int dx, int height, int width);
-extern void fbcon_iplan2p4_clear(struct vc_data *conp, struct display *p,
-                                int sy, int sx, int height, int width);
-extern void fbcon_iplan2p4_putc(struct vc_data *conp, struct display *p, int c,
-                               int yy, int xx);
-extern void fbcon_iplan2p4_putcs(struct vc_data *conp, struct display *p,
-                                const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_iplan2p4_revc(struct display *p, int xx, int yy);
index aa2f4d2f131bc631f99ce2643f5902f2e43a4d5a..307bece45618010ea509c302d4ef7e235f01a9fd 100644 (file)
@@ -19,8 +19,8 @@
 
 #include <asm/byteorder.h>
 
-#include "fbcon.h"
-#include "fbcon-iplan2p8.h"
+#include <video/fbcon.h>
+#include <video/fbcon-iplan2p8.h>
 
 
     /*
@@ -209,16 +209,16 @@ void fbcon_iplan2p8_bmove(struct display *p, int sy, int sx, int dy, int dx,
        /*  Special (but often used) case: Moving whole lines can be
         *  done with memmove()
         */
-       fast_memmove(p->screen_base + dy * p->next_line * p->fontheight,
-                    p->screen_base + sy * p->next_line * p->fontheight,
-                    p->next_line * height * p->fontheight);
+       fast_memmove(p->screen_base + ((dy * p->next_line) << fontheightlog(p)),
+                    p->screen_base + ((sy * p->next_line) << fontheightlog(p)),
+                    (p->next_line * height) << fontheightlog(p));
      } else {
        int rows, cols;
        u8 *src;
        u8 *dst;
        int bytes = p->next_line;
-       int linesize = bytes * p->fontheight;
-       u_int colsize = height * p->fontheight;
+       int linesize = bytes << fontheightlog(p);
+       u_int colsize = height << fontheightlog(p);
        u_int upwards = (dy < sy) || (dy == sy && dx < sx);
 
        if ((sx & 1) == (dx & 1)) {
@@ -301,18 +301,18 @@ void fbcon_iplan2p8_clear(struct vc_data *conp, struct display *p, int sy,
     u8 *start;
     int rows;
     int bytes = p->next_line;
-    int lines = height * p->fontheight;
+    int lines = height << fontheightlog(p);
     u32 size;
     u32 cval1, cval2, cval3, cval4, pcval1, pcval2;
 
     expand8ql(attr_bgcol_ec(p,conp), &cval1, &cval2, &cval3, &cval4);
 
     if (sx == 0 && width * 8 == bytes) {
-       offset = sy * bytes * p->fontheight;
+       offset = (sy * bytes) << fontheightlog(p);
        size    = lines * bytes;
        memset_even_8p(p->screen_base+offset, size, cval1, cval2, cval3, cval4);
     } else {
-       offset = (sy * bytes * p->fontheight) + (sx>>1)*16 + (sx & 1);
+       offset = ((sy * bytes) << fontheightlog(p)) + (sx>>1)*16 + (sx & 1);
        start = p->screen_base + offset;
        expand8dl(attr_bgcol_ec(p,conp), &pcval1, &pcval2);
 
@@ -348,14 +348,14 @@ void fbcon_iplan2p8_putc(struct vc_data *conp, struct display *p, int c,
     int bytes = p->next_line;
     u32 eorx1, eorx2, fgx1, fgx2, bgx1, bgx2, fdx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*16 + (xx & 1);
-    cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + ((yy * bytes) << fontheightlog(p)) + (xx>>1)*16 + (xx & 1);
+    cdat = p->fontdata + ((c & p->charmask) << fontheightlog(p));
 
     expand8dl(attr_fgcol(p,c), &fgx1, &fgx2);
     expand8dl(attr_bgcol(p,c), &bgx1, &bgx2);
     eorx1 = fgx1 ^ bgx1; eorx2  = fgx2 ^ bgx2;
 
-    for(rows = p->fontheight ; rows-- ; dest += bytes) {
+    for(rows = fontheight(p) ; rows-- ; dest += bytes) {
        fdx = dup4l(*cdat++);
        movepl2(dest, (fdx & eorx1) ^ bgx1, (fdx & eorx2) ^ bgx2);
     }
@@ -372,7 +372,7 @@ void fbcon_iplan2p8_putcs(struct vc_data *conp, struct display *p,
     u32 eorx1, eorx2, fgx1, fgx2, bgx1, bgx2, fdx;
 
     bytes = p->next_line;
-    dest0 = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*16 +
+    dest0 = p->screen_base + ((yy * bytes) << fontheightlog(p)) + (xx>>1)*16 +
            (xx & 1);
 
     expand8dl(attr_fgcol(p,*s), &fgx1, &fgx2);
@@ -389,9 +389,9 @@ void fbcon_iplan2p8_putcs(struct vc_data *conp, struct display *p,
        */
 
        c = *s++ & p->charmask;
-       cdat  = p->fontdata + (c * p->fontheight);
+       cdat  = p->fontdata + (c << fontheightlog(p));
 
-       for(rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+       for(rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
            fdx = dup4l(*cdat++);
            movepl2(dest, (fdx & eorx1) ^ bgx1, (fdx & eorx2) ^ bgx2);
        }
@@ -405,9 +405,9 @@ void fbcon_iplan2p8_revc(struct display *p, int xx, int yy)
     int j;
     int bytes;
 
-    dest = p->screen_base + yy * p->fontheight * p->next_line + (xx>>1)*16 +
-          (xx & 1);
-    j = p->fontheight;
+    dest = (p->screen_base + ((yy * p->next_line) << fontheightlog(p)) +
+           (xx>>1)*16 + (xx & 1));
+    j = fontheight(p);
     bytes = p->next_line;
 
     while (j--) {
diff --git a/drivers/video/fbcon-iplan2p8.h b/drivers/video/fbcon-iplan2p8.h
deleted file mode 100644 (file)
index ba298f8..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-    /*
-     *  Atari interleaved bitplanes (8 planes) (iplan2p8)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_IPLAN2P8) || defined(CONFIG_FBCON_IPLAN2P8_MODULE)
-#define FBCON_HAS_IPLAN2P8
-#endif
-#else
-#if defined(CONFIG_FBCON_IPLAN2P8)
-#define FBCON_HAS_IPLAN2P8
-#endif
-#endif
-
-extern struct display_switch fbcon_iplan2p8;
-extern void fbcon_iplan2p8_setup(struct display *p);
-extern void fbcon_iplan2p8_bmove(struct display *p, int sy, int sx, int dy,
-                                int dx, int height, int width);
-extern void fbcon_iplan2p8_clear(struct vc_data *conp, struct display *p,
-                                int sy, int sx, int height, int width);
-extern void fbcon_iplan2p8_putc(struct vc_data *conp, struct display *p, int c,
-                               int yy, int xx);
-extern void fbcon_iplan2p8_putcs(struct vc_data *conp, struct display *p,
-                                const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_iplan2p8_revc(struct display *p, int xx, int yy);
index a4bac8fae806271b7297d450dc178b835d54a349..f2508e4cbcfeeb7ec2b3e16479d5ae43668e1507 100644 (file)
@@ -19,8 +19,8 @@
 #include <linux/fb.h>
 #include <linux/delay.h>
 
-#include "fbcon.h"
-#include "fbcon-mac.h"
+#include <video/fbcon.h>
+#include <video/fbcon-mac.h>
 
 
     /*
@@ -57,24 +57,24 @@ void fbcon_mac_bmove(struct display *p, int sy, int sx, int dy, int dx,
    int dl,dr,dt,db,dw,dlo;
    int move_up;
 
-   src = (u8 *) (p->screen_base + sy * p->fontheight * p->next_line);
-   dest = (u8 *) (p->screen_base + dy * p->fontheight * p->next_line);
+   src = (u8 *) (p->screen_base + sy * fontheight(p) * p->next_line);
+   dest = (u8 *) (p->screen_base + dy * fontheight(p) * p->next_line);
 
    if( sx == 0 && width == p->conp->vc_cols) {
-     s = height * p->fontheight * p->next_line;
+     s = height * fontheight(p) * p->next_line;
      mymemmove(dest, src, s);
      return;
    }
    
-   l = sx * p->fontwidth;
-   r = l + width * p->fontwidth;
-   t = sy * p->fontheight;
-   b = t + height * p->fontheight;
+   l = sx * fontwidth(p);
+   r = l + width * fontwidth(p);
+   t = sy * fontheight(p);
+   b = t + height * fontheight(p);
 
-   dl = dx * p->fontwidth;
-   dr = dl + width * p->fontwidth;
-   dt = dy * p->fontheight;
-   db = dt + height * p->fontheight;
+   dl = dx * fontwidth(p);
+   dr = dl + width * fontwidth(p);
+   dt = dy * fontheight(p);
+   db = dt + height * fontheight(p);
 
    /* w is the # pixels between two long-aligned points, left and right */
    w = (r&~31) - ((l+31)&~31);
@@ -143,8 +143,8 @@ void fbcon_mac_bmove(struct display *p, int sy, int sx, int dy, int dx,
    if (sy <= sx) {
      i = b;
      move_up = 0;
-     src += height * p->fontheight;
-     dest += height * p->fontheight;
+     src += height * fontheight(p);
+     dest += height * fontheight(p);
    } else {
      i = t;
      move_up = 1;
@@ -195,22 +195,22 @@ void fbcon_mac_clear(struct vc_data *conp, struct display *p, int sy, int sx,
    u8 *dest;
    int l,r,t,b,w,lo,s;
 
-   inverse = attr_reverse(p,conp->vc_attr);
+   inverse = conp ? attr_reverse(p,conp->vc_attr) : 0;
    pixel = inverse ? PIXEL_WHITE_MAC : PIXEL_BLACK_MAC;
-   dest = (u8 *) (p->screen_base + sy * p->fontheight * p->next_line);
+   dest = (u8 *) (p->screen_base + sy * fontheight(p) * p->next_line);
 
    if( sx == 0 && width == p->conp->vc_cols) {
-     s = height * p->fontheight * p->next_line;
+     s = height * fontheight(p) * p->next_line;
      if (inverse)
        mymemclear(dest, s);
      else
        mymemset(dest, s);
    }
    
-   l = sx * p->fontwidth;
-   r = l + width * p->fontwidth;
-   t = sy * p->fontheight;
-   b = t + height * p->fontheight;
+   l = sx * fontwidth(p);
+   r = l + width * fontwidth(p);
+   t = sy * fontheight(p);
+   b = t + height * fontheight(p);
    /* w is the # pixels between two long-aligned points, left and right */
    w = (r&~31) - ((l+31)&~31);
    /* lo is the # pixels between the left edge and a long-aligned left pixel */
@@ -272,23 +272,23 @@ void fbcon_mac_putc(struct vc_data *conp, struct display *p, int c, int yy,
    u8 d;
    int j;
 
-   cdat = p->fontdata+(c&p->charmask)*p->fontheight;
+   cdat = p->fontdata+(c&p->charmask)*fontheight(p);
    bold = attr_bold(p,c);
    ch_reverse = attr_reverse(p,c);
    ch_underline = attr_underline(p,c);
 
-   for (rows = 0; rows < p->fontheight; rows++) {
+   for (rows = 0; rows < fontheight(p); rows++) {
       d = *cdat++;
       if (!conp->vc_can_do_color) {
-       if (ch_underline && rows == (p->fontheight-2))
+       if (ch_underline && rows == (fontheight(p)-2))
          d = 0xff;
        else if (bold)
          d |= d>>1;
        if (ch_reverse)
          d = ~d;
       }
-      for (j = 0; j < p->fontwidth; j++) {
-       plot_pixel_mac(p, (d & 0x80) >> 7, (xx*p->fontwidth) + j, (yy*p->fontheight) + rows);
+      for (j = 0; j < fontwidth(p); j++) {
+       plot_pixel_mac(p, (d & 0x80) >> 7, (xx*fontwidth(p)) + j, (yy*fontheight(p)) + rows);
        d <<= 1;
       }
    }
@@ -311,9 +311,9 @@ void fbcon_mac_revc(struct display *p, int xx, int yy)
 {
    u_int rows, j;
 
-   for (rows = 0; rows < p->fontheight; rows++) {
-     for (j = 0; j < p->fontwidth; j++) {
-       plot_pixel_mac (p, PIXEL_INVERT_MAC, (xx*p->fontwidth)+j, (yy*p->fontheight)+rows);
+   for (rows = 0; rows < fontheight(p); rows++) {
+     for (j = 0; j < fontwidth(p); j++) {
+       plot_pixel_mac (p, PIXEL_INVERT_MAC, (xx*fontwidth(p))+j, (yy*fontheight(p))+rows);
      }
    }
 }
diff --git a/drivers/video/fbcon-mac.h b/drivers/video/fbcon-mac.h
deleted file mode 100644 (file)
index 62d2ae6..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-    /*
-     *  Mac variable bpp packed pixels (mac)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_MAC) || defined(CONFIG_FBCON_MAC_MODULE)
-#define FBCON_HAS_MAC
-#endif
-#else
-#if defined(CONFIG_FBCON_MAC)
-#define FBCON_HAS_MAC
-#endif
-#endif
-
-extern struct display_switch fbcon_mac;
-extern void fbcon_mac_setup(struct display *p);
-extern void fbcon_mac_bmove(struct display *p, int sy, int sx, int dy, int dx,
-                           int height, int width);
-extern void fbcon_mac_clear(struct vc_data *conp, struct display *p, int sy,
-                           int sx, int height, int width);
-extern void fbcon_mac_putc(struct vc_data *conp, struct display *p, int c,
-                          int yy, int xx);
-extern void fbcon_mac_putcs(struct vc_data *conp, struct display *p,
-                           const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_mac_revc(struct display *p, int xx, int yy);
index b8f575859997aab70899ee8fdacf84e25ae60042..05c74729a6c9daa7f73f5c8a75a0319380892166 100644 (file)
@@ -15,8 +15,8 @@
 #include <linux/string.h>
 #include <linux/fb.h>
 
-#include "fbcon.h"
-#include "fbcon-mfb.h"
+#include <video/fbcon.h>
+#include <video/fbcon-mfb.h>
 
 
     /*
@@ -39,21 +39,21 @@ void fbcon_mfb_bmove(struct display *p, int sy, int sx, int dy, int dx,
     u_int rows;
 
     if (sx == 0 && dx == 0 && width == p->next_line) {
-       src = p->screen_base+sy*p->fontheight*width;
-       dest = p->screen_base+dy*p->fontheight*width;
-       mymemmove(dest, src, height*p->fontheight*width);
+       src = p->screen_base+sy*fontheight(p)*width;
+       dest = p->screen_base+dy*fontheight(p)*width;
+       mymemmove(dest, src, height*fontheight(p)*width);
     } else if (dy <= sy) {
-       src = p->screen_base+sy*p->fontheight*p->next_line+sx;
-       dest = p->screen_base+dy*p->fontheight*p->next_line+dx;
-       for (rows = height*p->fontheight; rows--;) {
+       src = p->screen_base+sy*fontheight(p)*p->next_line+sx;
+       dest = p->screen_base+dy*fontheight(p)*p->next_line+dx;
+       for (rows = height*fontheight(p); rows--;) {
            mymemmove(dest, src, width);
            src += p->next_line;
            dest += p->next_line;
        }
     } else {
-       src = p->screen_base+((sy+height)*p->fontheight-1)*p->next_line+sx;
-       dest = p->screen_base+((dy+height)*p->fontheight-1)*p->next_line+dx;
-       for (rows = height*p->fontheight; rows--;) {
+       src = p->screen_base+((sy+height)*fontheight(p)-1)*p->next_line+sx;
+       dest = p->screen_base+((dy+height)*fontheight(p)-1)*p->next_line+dx;
+       for (rows = height*fontheight(p); rows--;) {
            mymemmove(dest, src, width);
            src -= p->next_line;
            dest -= p->next_line;
@@ -66,17 +66,18 @@ void fbcon_mfb_clear(struct vc_data *conp, struct display *p, int sy, int sx,
 {
     u8 *dest;
     u_int rows;
+    int inverse = conp ? attr_reverse(p,conp->vc_attr) : 0;
 
-    dest = p->screen_base+sy*p->fontheight*p->next_line+sx;
+    dest = p->screen_base+sy*fontheight(p)*p->next_line+sx;
 
     if (sx == 0 && width == p->next_line) {
-       if (attr_reverse(p,conp->vc_attr))
-           mymemset(dest, height*p->fontheight*width);
+       if (inverse)
+           mymemset(dest, height*fontheight(p)*width);
        else
-           mymemclear(dest, height*p->fontheight*width);
+           mymemclear(dest, height*fontheight(p)*width);
     } else
-       for (rows = height*p->fontheight; rows--; dest += p->next_line)
-           if (attr_reverse(p,conp->vc_attr))
+       for (rows = height*fontheight(p); rows--; dest += p->next_line)
+           if (inverse)
                mymemset(dest, width);
            else
                mymemclear_small(dest, width);
@@ -89,13 +90,13 @@ void fbcon_mfb_putc(struct vc_data *conp, struct display *p, int c, int yy,
     u_int rows, bold, revs, underl;
     u8 d;
 
-    dest = p->screen_base+yy*p->fontheight*p->next_line+xx;
-    cdat = p->fontdata+(c&p->charmask)*p->fontheight;
+    dest = p->screen_base+yy*fontheight(p)*p->next_line+xx;
+    cdat = p->fontdata+(c&p->charmask)*fontheight(p);
     bold = attr_bold(p,c);
     revs = attr_reverse(p,c);
     underl = attr_underline(p,c);
 
-    for (rows = p->fontheight; rows--; dest += p->next_line) {
+    for (rows = fontheight(p); rows--; dest += p->next_line) {
        d = *cdat++;
        if (underl && !rows)
            d = 0xff;
@@ -115,7 +116,7 @@ void fbcon_mfb_putcs(struct vc_data *conp, struct display *p,
     u8 d;
     u16 c;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
     bold = attr_bold(p,*s);
     revs = attr_reverse(p,*s);
     underl = attr_underline(p,*s);
@@ -123,8 +124,8 @@ void fbcon_mfb_putcs(struct vc_data *conp, struct display *p,
     while (count--) {
        c = *s++ & p->charmask;
        dest = dest0++;
-       cdat = p->fontdata+c*p->fontheight;
-       for (rows = p->fontheight; rows--; dest += p->next_line) {
+       cdat = p->fontdata+c*fontheight(p);
+       for (rows = fontheight(p); rows--; dest += p->next_line) {
            d = *cdat++;
            if (underl && !rows)
                d = 0xff;
@@ -142,8 +143,8 @@ void fbcon_mfb_revc(struct display *p, int xx, int yy)
     u8 *dest;
     u_int rows;
 
-    dest = p->screen_base+yy*p->fontheight*p->next_line+xx;
-    for (rows = p->fontheight; rows--; dest += p->next_line)
+    dest = p->screen_base+yy*fontheight(p)*p->next_line+xx;
+    for (rows = fontheight(p); rows--; dest += p->next_line)
        *dest = ~*dest;
 }
 
diff --git a/drivers/video/fbcon-mfb.h b/drivers/video/fbcon-mfb.h
deleted file mode 100644 (file)
index 77f312e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-    /*
-     *  Monochrome (mfb)
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_MFB) || defined(CONFIG_FBCON_MFB_MODULE)
-#define FBCON_HAS_MFB
-#endif
-#else
-#if defined(CONFIG_FBCON_MFB)
-#define FBCON_HAS_MFB
-#endif
-#endif
-
-extern struct display_switch fbcon_mfb;
-extern void fbcon_mfb_setup(struct display *p);
-extern void fbcon_mfb_bmove(struct display *p, int sy, int sx, int dy, int dx,
-                           int height, int width);
-extern void fbcon_mfb_clear(struct vc_data *conp, struct display *p, int sy,
-                           int sx, int height, int width);
-extern void fbcon_mfb_putc(struct vc_data *conp, struct display *p, int c,
-                          int yy, int xx);
-extern void fbcon_mfb_putcs(struct vc_data *conp, struct display *p,
-                           const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_mfb_revc(struct display *p, int xx, int yy);
index 3ea8a5234bfa7ebfa5c97f2e6a2fd6883497e03a..fa4d387b8888bb5e71861763a0d5240aff341674 100644 (file)
@@ -18,8 +18,8 @@
 
 #include <asm/io.h>
 
-#include "fbcon.h"
-#include "fbcon-vga.h"
+#include <video/fbcon.h>
+#include <video/fbcon-vga.h>
 
 
     /*
diff --git a/drivers/video/fbcon-vga.h b/drivers/video/fbcon-vga.h
deleted file mode 100644 (file)
index 7d62e21..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-    /*
-     *  VGA characters/attributes
-     */
-
-#include <linux/config.h>
-
-#ifdef MODULE
-#if defined(CONFIG_FBCON_VGA) || defined(CONFIG_FBCON_VGA_MODULE)
-#define FBCON_HAS_VGA
-#endif
-#else
-#if defined(CONFIG_FBCON_VGA)
-#define FBCON_HAS_VGA
-#endif
-#endif
-
-extern struct display_switch fbcon_vga;
-extern void fbcon_vga_setup(struct display *p);
-extern void fbcon_vga_bmove(struct display *p, int sy, int sx, int dy, int dx,
-                           int height, int width);
-extern void fbcon_vga_clear(struct vc_data *conp, struct display *p, int sy,
-                           int sx, int height, int width);
-extern void fbcon_vga_putc(struct vc_data *conp, struct display *p, int c,
-                          int yy, int xx);
-extern void fbcon_vga_putcs(struct vc_data *conp, struct display *p,
-                           const unsigned short *s, int count, int yy, int xx);
-extern void fbcon_vga_revc(struct display *p, int xx, int yy);
index c2b7abd512a3c4b36885b23e61a7d007eef79803..eb70db52b75c4f9ea8fb5e0ac150d2f2ea0563fb 100644 (file)
@@ -29,6 +29,8 @@
  *  added by 
  *                         Jakub Jelinek (jj@ultra.linux.cz)
  *
+ *  Random hacking by Martin Mares <mj@ucw.cz>
+ *
  *
  *  The low level operations for the various display memory organizations are
  *  now in separate source files.
@@ -54,8 +56,6 @@
 
 #undef FBCONDEBUG
 
-#define FLASHING_CURSOR                1
-
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
@@ -94,9 +94,9 @@
 #define INCLUDE_LINUX_LOGO_DATA
 #include <asm/linux_logo.h>
 
-#include "fbcon.h"
-#include "fbcon-mac.h" /* for 6x11 font on mac */
-#include "font.h"
+#include <video/fbcon.h>
+#include <video/fbcon-mac.h>   /* for 6x11 font on mac */
+#include <video/font.h>
 
 #ifdef FBCONDEBUG
 #  define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
@@ -112,6 +112,14 @@ struct display fb_display[MAX_NR_CONSOLES];
 static int logo_lines;
 static int logo_shown = -1;
 
+#define REFCOUNT(fd)   (((int *)(fd))[-1])
+#define FNTSIZE(fd)    (((int *)(fd))[-2])
+#define FNTCHARCNT(fd) (((int *)(fd))[-3])
+#define FNTSUM(fd)     (((int *)(fd))[-4])
+#define FONT_EXTRA_WORDS 4
+
+static void fbcon_free_font(struct display *p);
+
 /*
  * Emmanuel: fbcon will now use a hardware cursor if the
  * low-level driver provides a non-NULL dispsw->cursor pointer,
@@ -120,12 +128,12 @@ static int logo_shown = -1;
  * if dispsw->cursor is NULL, use Atari alike software cursor
  */
 
-#if FLASHING_CURSOR
 static int cursor_drawn = 0;
 
-#define CURSOR_DRAW_DELAY              (2)
+#define CURSOR_DRAW_DELAY              (1)
 
 /* # VBL ints between cursor state changes */
+#define ARM_CURSOR_BLINK_RATE          (10)
 #define AMIGA_CURSOR_BLINK_RATE                (20)
 #define ATARI_CURSOR_BLINK_RATE                (42)
 #define MAC_CURSOR_BLINK_RATE          (32)
@@ -135,16 +143,12 @@ static int vbl_cursor_cnt = 0;
 static int cursor_on = 0;
 static int cursor_blink_rate;
 
-static __inline__ void CURSOR_UNDRAWN(void)
+static inline void cursor_undrawn(void)
 {
     vbl_cursor_cnt = 0;
     cursor_drawn = 0;
 }
-#endif
 
-/*
- *  Scroll Method
- */
 
 #define divides(a, b)  ((!(a) || (b)%(a)) ? 0 : 1)
 
@@ -180,9 +184,7 @@ static int fbcon_scrolldelta(struct vc_data *conp, int lines);
 
 static void fbcon_setup(int con, int init, int logo);
 static __inline__ int real_y(struct display *p, int ypos);
-#if FLASHING_CURSOR
 static void fbcon_vbl_handler(int irq, void *dummy, struct pt_regs *fp);
-#endif
 static __inline__ void updatescrollmode(struct display *p);
 static __inline__ void ywrap_up(int unit, struct vc_data *conp,
                                struct display *p, int count);
@@ -197,8 +199,6 @@ static void fbcon_bmove_rec(struct display *p, int sy, int sx, int dy, int dx,
 
 static int fbcon_show_logo(void);
 
-#if FLASHING_CURSOR
-
 #ifdef CONFIG_MAC
 /*
  * On the Macintoy, there may or may not be a working VBL int. We need to prob
@@ -225,13 +225,12 @@ static void cursor_timer_handler(unsigned long dev_addr)
       cursor_timer.next = cursor_timer.next = NULL;
       add_timer(&cursor_timer);
 }
-#endif
 
 /*
  *  Low Level Operations
  */
 
-static struct display_switch fbcon_dummy;
+struct display_switch fbcon_dummy;
 
 /* NOTE: fbcon cannot be __initfunc: it may be called from take_over_console later */
 
@@ -271,39 +270,43 @@ static const char *fbcon_startup(void)
      * probe for VBL interrupts.
      */
     if (MACH_IS_MAC) {
-       int ct = 0;
-       /*
-        * Probe for VBL: set temp. handler ...
-        */
-       irqres = request_irq(IRQ_MAC_VBL, fbcon_vbl_detect, 0,
-                            "console/cursor", fbcon_vbl_detect);
-       /*
-        * ... and spin for 20 ms ...
-        */
-       while (!vbl_detected && ++ct<1000)
-          udelay(20);
+       int ct = 0;
+       /*
+        * Probe for VBL: set temp. handler ...
+        */
+       irqres = request_irq(IRQ_MAC_VBL, fbcon_vbl_detect, 0,
+                            "console/cursor", fbcon_vbl_detect);
+       vbl_detected = 0;
+
+       /*
+        * ... and spin for 20 ms ...
+        */
+       while (!vbl_detected && ++ct<1000)
+           udelay(20);
  
-       if(ct==1000)
-          printk("fbcon_startup: No VBL detected, using timer based cursor.\n");
+       if(ct==1000)
+           printk("fbcon_startup: No VBL detected, using timer based cursor.\n");
  
-       if (vbl_detected) {
-         /*
-          * interrupt based cursor ok
-          */
-          cursor_blink_rate = MAC_CURSOR_BLINK_RATE;
-          irqres = request_irq(IRQ_MAC_VBL, fbcon_vbl_handler, 0,
-                               "console/cursor", fbcon_vbl_handler);
-       } else {
-          /*
-           * VBL not detected: fall through, use timer based cursor
-           */
-           irqres = 1;
-          /* free interrupt here ?? */
-       }
+       free_irq(IRQ_MAC_VBL, fbcon_vbl_detect);
+
+       if (vbl_detected) {
+           /*
+            * interrupt based cursor ok
+            */
+           cursor_blink_rate = MAC_CURSOR_BLINK_RATE;
+           irqres = request_irq(IRQ_MAC_VBL, fbcon_vbl_handler, 0,
+                                "console/cursor", fbcon_vbl_handler);
+       } else {
+           /*
+            * VBL not detected: fall through, use timer based cursor
+            */
+           irqres = 1;
+       }
     }
 #endif /* CONFIG_MAC */
 
 #if defined(__arm__) && defined(IRQ_VSYNCPULSE)
+    cursor_blink_rate = ARM_CURSOR_BLINK_RATE;
     irqres = request_irq(IRQ_VSYNCPULSE, fbcon_vbl_handler, SA_SHIRQ,
                         "console/cursor", fbcon_vbl_handler);
 #endif
@@ -329,9 +332,6 @@ static void fbcon_init(struct vc_data *conp, int init)
     info = registered_fb[(int)con2fb_map[unit]];
 
     info->changevar = &fbcon_changevar;
-    conp->vc_display_fg = &info->display_fg;
-    if (!info->display_fg)
-        info->display_fg = conp;
     fb_display[unit] = *(info->disp);  /* copy from default */
     DPRINTK("mode:   %s\n",info->modename);
     DPRINTK("visual: %d\n",fb_display[unit].visual);
@@ -341,6 +341,10 @@ static void fbcon_init(struct vc_data *conp, int init)
     fb_display[unit].conp = conp;
     fb_display[unit].fb_info = info;
     fbcon_setup(unit, init, !init);
+    /* Must be done after fbcon_setup to prevent excess updates */
+    conp->vc_display_fg = &info->display_fg;
+    if (!info->display_fg)
+        info->display_fg = conp;
 }
 
 
@@ -349,7 +353,8 @@ static void fbcon_deinit(struct vc_data *conp)
     int unit = conp->vc_num;
     struct display *p = &fb_display[unit];
 
-    p->dispsw = NULL;
+    fbcon_free_font(p);
+    p->dispsw = &fbcon_dummy;
     p->conp = 0;
 }
 
@@ -364,29 +369,34 @@ static int fbcon_changevar(int con)
 
 static __inline__ void updatescrollmode(struct display *p)
 {
-    if (p->scrollmode == SCROLL_YREDRAW)
+    int m;
+    if (p->scrollmode & __SCROLL_YFIXED)
        return;
-    if (divides(p->ywrapstep, p->fontheight) &&
-       divides(p->fontheight, p->var.yres_virtual))
-       p->scrollmode = SCROLL_YWRAP;
-    else if (divides(p->ypanstep, p->fontheight) &&
-            p->var.yres_virtual >= p->var.yres+p->fontheight)
-       p->scrollmode = SCROLL_YPAN;
+    if (divides(p->ywrapstep, fontheight(p)) &&
+       divides(fontheight(p), p->var.yres_virtual))
+       m = __SCROLL_YWRAP;
+    else if (divides(p->ypanstep, fontheight(p)) &&
+            p->var.yres_virtual >= p->var.yres+fontheight(p))
+       m = __SCROLL_YPAN;
+    else if (p->scrollmode & __SCROLL_YNOMOVE)
+       m = __SCROLL_YREDRAW;
     else
-       p->scrollmode = SCROLL_YMOVE;
+       m = __SCROLL_YMOVE;
+    p->scrollmode = (p->scrollmode & ~__SCROLL_YMASK) | m;
 }
 
 static void fbcon_font_widths(struct display *p)
 {
     int i;
-    p->fontwidthlog = 0;
+    
+    p->_fontwidthlog = 0;
     for (i = 2; i <= 6; i++)
-       if (p->fontwidth == (1 << i))
-           p->fontwidthlog = i;
-    p->fontheightlog = 0;
+       if (fontwidth(p) == (1 << i))
+           p->_fontwidthlog = i;
+    p->_fontheightlog = 0;
     for (i = 2; i <= 6; i++)
-       if (p->fontheight == (1 << i))
-           p->fontheightlog = i;
+       if (fontheight(p) == (1 << i))
+           p->_fontheightlog = i;
 }
 
 #define fontwidthvalid(p,w) ((p)->dispsw->fontwidthmask & FONTWIDTH(w))
@@ -398,22 +408,53 @@ static void fbcon_setup(int con, int init, int logo)
     int nr_rows, nr_cols;
     int old_rows, old_cols;
     unsigned short *save = NULL, *r, *q;
+    int i, charcnt = 256;
+    struct fbcon_font_desc *font;
     /* Only if not module */
     int initmem_freed = 1;
-    struct fbcon_font_desc *font;
+    
     if (con != fg_console || initmem_freed || p->type == FB_TYPE_TEXT)
        logo = 0;
 
     p->var.xoffset = p->var.yoffset = p->yscroll = 0;  /* reset wrap/pan */
+    
+    for (i = 0; i < MAX_NR_CONSOLES; i++)
+       if (i != con && fb_display[i].fb_info == p->fb_info &&
+           fb_display[i].conp && fb_display[i].fontdata)
+               break;
+
+    fbcon_free_font(p);    
+    if (i < MAX_NR_CONSOLES) {
+       struct display *q = &fb_display[i];
+
+        if (fontwidthvalid(p,fontwidth(q))) {
+            /* If we are not the first console on this
+               fb, copy the font from that console */
+           p->_fontwidth = q->_fontwidth;
+           p->_fontheight = q->_fontheight;
+           p->_fontwidthlog = q->_fontwidthlog;
+           p->_fontheightlog = q->_fontheightlog;
+           p->fontdata = q->fontdata;
+           p->userfont = q->userfont; 
+           if (p->userfont) {
+               REFCOUNT(p->fontdata)++;
+               charcnt = FNTCHARCNT(p->fontdata);
+           }
+           con_copy_unimap(con, i);
+       }
+    }
 
-    if (!p->fb_info->fontname[0] ||
-       !(font = fbcon_find_font(p->fb_info->fontname)))
-           font = fbcon_get_default_font(p->var.xres, p->var.yres);
-    p->fontwidth = font->width;
-    p->fontheight = font->height;
-    p->fontdata = font->data;
-    fbcon_font_widths(p);
-    if (!fontwidthvalid(p,p->fontwidth)) {
+    if (!p->fontdata) {
+        if (!p->fb_info->fontname[0] ||
+           !(font = fbcon_find_font(p->fb_info->fontname)))
+               font = fbcon_get_default_font(p->var.xres, p->var.yres);
+        p->_fontwidth = font->width;
+        p->_fontheight = font->height;
+        p->fontdata = font->data;
+        fbcon_font_widths(p);
+    }
+    
+    if (!fontwidthvalid(p,fontwidth(p))) {
 #ifdef CONFIG_MAC
        if (MACH_IS_MAC)
            /* ++Geert: hack to make 6x11 fonts work on mac */
@@ -422,26 +463,26 @@ static void fbcon_setup(int con, int init, int logo)
 #endif
        {
            /* ++Geert: changed from panic() to `correct and continue' */
-           printk(KERN_ERR "fbcon_setup: No support for fontwidth %d\n", p->fontwidth);
+           printk(KERN_ERR "fbcon_setup: No support for fontwidth %d\n", fontwidth(p));
            p->dispsw = &fbcon_dummy;
        }
     }
     if (p->dispsw->set_font)
-       p->dispsw->set_font(p, p->fontwidth, p->fontheight);
+       p->dispsw->set_font(p, fontwidth(p), fontheight(p));
     updatescrollmode(p);
     
     old_cols = conp->vc_cols;
     old_rows = conp->vc_rows;
     
-    nr_cols = p->var.xres/p->fontwidth;
-    nr_rows = p->var.yres/p->fontheight;
+    nr_cols = p->var.xres/fontwidth(p);
+    nr_rows = p->var.yres/fontheight(p);
     
     if (logo) {
        /* Need to make room for the logo */
        int cnt;
        int step;
     
-       logo_lines = (LOGO_H + p->fontheight - 1) / p->fontheight;
+       logo_lines = (LOGO_H + fontheight(p) - 1) / fontheight(p);
        q = (unsigned short *)(conp->vc_origin + conp->vc_size_row * old_rows);
        step = logo_lines * old_cols;
        for (r = q - logo_lines * old_cols; r < q; r++)
@@ -454,7 +495,7 @@ static void fbcon_setup(int con, int init, int logo)
                scr_memsetw(save, conp->vc_video_erase_char, logo_lines * nr_cols * 2);
                r = q - step;
                for (cnt = 0; cnt < logo_lines; cnt++, r += i)
-                       scr_memcpyw(save + cnt * nr_cols, r, 2 * i);
+                       scr_memcpyw_to(save + cnt * nr_cols, r, 2 * i);
                r = q;
            }
        }
@@ -483,42 +524,49 @@ static void fbcon_setup(int con, int init, int logo)
        conp->vc_cols = nr_cols;
        conp->vc_rows = nr_rows;
     }
-    p->vrows = p->var.yres_virtual/p->fontheight;
+    p->vrows = p->var.yres_virtual/fontheight(p);
     conp->vc_can_do_color = p->var.bits_per_pixel != 1;
-    p->fgshift = 8;
-    p->bgshift = 12;
-    p->charmask = 0xff;
-    conp->vc_hi_font_mask = 0;
+    conp->vc_complement_mask = conp->vc_can_do_color ? 0x7700 : 0x0800;
+    if (charcnt == 256) {
+       p->conp->vc_hi_font_mask = 0;
+       p->fgshift = 8;
+       p->bgshift = 12;
+       p->charmask = 0xff;
+    } else {
+       p->conp->vc_hi_font_mask = 0x100;
+       p->conp->vc_complement_mask <<= 1;
+       p->fgshift = 9;
+       p->bgshift = 13;
+       p->charmask = 0x1ff;
+    }
 
-    if (!p->dispsw) {
+    if (p->dispsw == &fbcon_dummy)
        printk(KERN_WARNING "fbcon_setup: type %d (aux %d, depth %d) not "
               "supported\n", p->type, p->type_aux, p->var.bits_per_pixel);
-       p->dispsw = &fbcon_dummy;
-    }
     p->dispsw->setup(p);
 
     p->fgcol = p->var.bits_per_pixel > 2 ? 7 : (1<<p->var.bits_per_pixel)-1;
     p->bgcol = 0;
 
     if (!init) {
-        if (con == fg_console)
-            set_palette(); /* Unlike vgacon, we have to set palette before resize on directcolor, 
-                              so that it is drawn with correct colors */
-       vc_resize_con(nr_rows, nr_cols, con);
+       if (conp->vc_cols != nr_cols || conp->vc_rows != nr_rows)
+           vc_resize_con(nr_rows, nr_cols, con);
+       else if (CON_IS_VISIBLE(conp)) {
+           if (p->dispsw->clear_margins)
+               p->dispsw->clear_margins(conp, p, 0);
+           update_screen(con);
+       }
        if (save) {
            q = (unsigned short *)(conp->vc_origin + conp->vc_size_row * old_rows);
-           scr_memcpyw(q, save, logo_lines * nr_cols * 2);
+           scr_memcpyw_from(q, save, logo_lines * nr_cols * 2);
            conp->vc_y += logo_lines;
            conp->vc_pos += logo_lines * conp->vc_size_row;
            kfree(save);
        }
-       if (con == fg_console)
-           update_screen(con); /* So that we set origin correctly */
     }
        
     if (logo) {
-       logo_shown = fg_console;
-       fbcon_show_logo(); /* This is protected above by initmem_freed */
+       logo_shown = -2;
        conp->vc_top = logo_lines;
     }
 }
@@ -574,7 +622,7 @@ static void fbcon_clear(struct vc_data *conp, int sy, int sx, int height,
 
     if ((sy <= p->cursor_y) && (p->cursor_y < sy+height) &&
        (sx <= p->cursor_x) && (p->cursor_x < sx+width)) {
-       CURSOR_UNDRAWN();
+       cursor_undrawn();
        redraw_cursor = 1;
     }
 
@@ -601,9 +649,12 @@ static void fbcon_putc(struct vc_data *conp, int c, int ypos, int xpos)
 
     if (!p->can_soft_blank && console_blanked)
            return;
+           
+    if (vt_cons[unit]->vc_mode != KD_TEXT)
+           return;
 
     if ((p->cursor_x == xpos) && (p->cursor_y == ypos)) {
-           CURSOR_UNDRAWN();
+           cursor_undrawn();
            redraw_cursor = 1;
     }
 
@@ -624,9 +675,12 @@ static void fbcon_putcs(struct vc_data *conp, const unsigned short *s, int count
     if (!p->can_soft_blank && console_blanked)
            return;
 
+    if (vt_cons[unit]->vc_mode != KD_TEXT)
+           return;
+
     if ((p->cursor_y == ypos) && (xpos <= p->cursor_x) &&
        (p->cursor_x < (xpos + count))) {
-           CURSOR_UNDRAWN();
+           cursor_undrawn();
            redraw_cursor = 1;
     }
     p->dispsw->putcs(conp, p, s, count, real_y(p, ypos), xpos);
@@ -653,29 +707,28 @@ static void fbcon_cursor(struct vc_data *conp, int mode)
        (mode == CM_ERASE) == !cursor_on)
        return;
 
-       cursor_on = 0;
-       if (cursor_drawn)
-           p->dispsw->revc(p, p->cursor_x, real_y(p, p->cursor_y));
-
-       p->cursor_x = conp->vc_x;
-       p->cursor_y = conp->vc_y;
-
-       switch (mode) {
-           case CM_ERASE:
-               cursor_drawn = 0;
-               break;
-           case CM_MOVE:
-           case CM_DRAW:
-               if (cursor_drawn)
-                   p->dispsw->revc(p, p->cursor_x, real_y(p, p->cursor_y));
-               vbl_cursor_cnt = CURSOR_DRAW_DELAY;
-               cursor_on = 1;
-               break;
-       }
+    cursor_on = 0;
+    if (cursor_drawn)
+        p->dispsw->revc(p, p->cursor_x, real_y(p, p->cursor_y));
+
+    p->cursor_x = conp->vc_x;
+    p->cursor_y = conp->vc_y;
+
+    switch (mode) {
+        case CM_ERASE:
+            cursor_drawn = 0;
+            break;
+        case CM_MOVE:
+        case CM_DRAW:
+            if (cursor_drawn)
+               p->dispsw->revc(p, p->cursor_x, real_y(p, p->cursor_y));
+            vbl_cursor_cnt = CURSOR_DRAW_DELAY;
+            cursor_on = 1;
+            break;
+        }
 }
 
 
-#if FLASHING_CURSOR
 static void fbcon_vbl_handler(int irq, void *dummy, struct pt_regs *fp)
 {
     struct display *p;
@@ -691,7 +744,6 @@ static void fbcon_vbl_handler(int irq, void *dummy, struct pt_regs *fp)
        vbl_cursor_cnt = cursor_blink_rate;
     }
 }
-#endif
 
 static int scrollback_phys_max = 0;
 static int scrollback_max = 0;
@@ -704,7 +756,7 @@ static __inline__ void ywrap_up(int unit, struct vc_data *conp,
     if (p->yscroll >= p->vrows)        /* Deal with wrap */
        p->yscroll -= p->vrows;
     p->var.xoffset = 0;
-    p->var.yoffset = p->yscroll*p->fontheight;
+    p->var.yoffset = p->yscroll*fontheight(p);
     p->var.vmode |= FB_VMODE_YWRAP;
     p->fb_info->updatevar(unit, p->fb_info);
     scrollback_max += count;
@@ -721,7 +773,7 @@ static __inline__ void ywrap_down(int unit, struct vc_data *conp,
     if (p->yscroll < 0)                /* Deal with wrap */
        p->yscroll += p->vrows;
     p->var.xoffset = 0;
-    p->var.yoffset = p->yscroll*p->fontheight;
+    p->var.yoffset = p->yscroll*fontheight(p);
     p->var.vmode |= FB_VMODE_YWRAP;
     p->fb_info->updatevar(unit, p->fb_info);
     scrollback_max -= count;
@@ -741,9 +793,11 @@ static __inline__ void ypan_up(int unit, struct vc_data *conp,
        p->yscroll -= p->vrows-conp->vc_rows;
     }
     p->var.xoffset = 0;
-    p->var.yoffset = p->yscroll*p->fontheight;
+    p->var.yoffset = p->yscroll*fontheight(p);
     p->var.vmode &= ~FB_VMODE_YWRAP;
     p->fb_info->updatevar(unit, p->fb_info);
+    if (p->dispsw->clear_margins)
+       p->dispsw->clear_margins(conp, p, 1);
     scrollback_max += count;
     if (scrollback_max > scrollback_phys_max)
        scrollback_max = scrollback_phys_max;
@@ -761,9 +815,11 @@ static __inline__ void ypan_down(int unit, struct vc_data *conp,
        p->yscroll += p->vrows-conp->vc_rows;
     }
     p->var.xoffset = 0;
-    p->var.yoffset = p->yscroll*p->fontheight;
+    p->var.yoffset = p->yscroll*fontheight(p);
     p->var.vmode &= ~FB_VMODE_YWRAP;
     p->fb_info->updatevar(unit, p->fb_info);
+    if (p->dispsw->clear_margins)
+       p->dispsw->clear_margins(conp, p, 1);
     scrollback_max -= count;
     if (scrollback_max < 0)
        scrollback_max = 0;
@@ -777,6 +833,7 @@ static void fbcon_redraw(struct vc_data *conp, struct display *p,
     unsigned short *d = (unsigned short *)
        (conp->vc_origin + conp->vc_size_row * line);
     unsigned short *s = d + offset;
+
     while (count--) {
        unsigned short *start = s;
        unsigned short *le = (unsigned short *)
@@ -790,14 +847,16 @@ static void fbcon_redraw(struct vc_data *conp, struct display *p,
            if (attr != (c & 0xff00)) {
                attr = c & 0xff00;
                if (s > start) {
-                   p->dispsw->putcs(conp, p, start, s - start, line, x);
+                   p->dispsw->putcs(conp, p, start, s - start,
+                                    real_y(p, line), x);
                    x += s - start;
                    start = s;
                }
            }
            if (c == scr_readw(d)) {
                if (s > start) {
-                   p->dispsw->putcs(conp, p, start, s - start, line, x);
+                   p->dispsw->putcs(conp, p, start, s - start,
+                                    real_y(p, line), x);
                    x += s - start + 1;
                    start = s + 1;
                } else {
@@ -810,7 +869,7 @@ static void fbcon_redraw(struct vc_data *conp, struct display *p,
            d++;
        } while (s < le);
        if (s > start)
-           p->dispsw->putcs(conp, p, start, s - start, line, x);
+           p->dispsw->putcs(conp, p, start, s - start, real_y(p, line), x);
        if (offset > 0)
                line++;
        else {
@@ -828,6 +887,7 @@ void fbcon_redraw_bmove(struct display *p, int sy, int sx, int dy, int dx, int h
     if (sy != dy)
        panic("fbcon_redraw_bmove width sy != dy");
     /* h will be always 1, but it does not matter if we are more generic */
+
     while (h-- > 0) {
        struct vc_data *conp = p->conp;
        unsigned short *d = (unsigned short *)
@@ -880,7 +940,7 @@ static int fbcon_scroll(struct vc_data *conp, int t, int b, int dir,
     if (!p->can_soft_blank && console_blanked)
        return 0;
 
-    if (!count)
+    if (!count || vt_cons[unit]->vc_mode != KD_TEXT)
        return 0;
 
     fbcon_cursor(conp, CM_ERASE);
@@ -895,133 +955,119 @@ static int fbcon_scroll(struct vc_data *conp, int t, int b, int dir,
        case SM_UP:
            if (count > conp->vc_rows)  /* Maximum realistic size */
                count = conp->vc_rows;
-           if (vt_cons[unit]->vc_mode == KD_TEXT)
-               switch (p->scrollmode) {
-                   case SCROLL_YWRAP:
-                       if (b-t-count > 3*conp->vc_rows>>2) {
-                           if (t > 0)
-                               fbcon_bmove(conp, 0, 0, count, 0, t,
-                                           conp->vc_cols);
-                           ywrap_up(unit, conp, p, count);
-                           if (conp->vc_rows-b > 0)
-                               fbcon_bmove(conp, b-count, 0, b, 0,
-                                           conp->vc_rows-b, conp->vc_cols);
-                       } else
-                           fbcon_bmove(conp, t+count, 0, t, 0, b-t-count,
-                                       conp->vc_cols);
-                       fbcon_clear(conp, b-count, 0, count, conp->vc_cols);
-                       break;
-
-                   case SCROLL_YPAN:
-                       if (( is_txt && (b-t == conp->vc_rows)) ||
-                           (!is_txt && (b-t-count > 3*conp->vc_rows>>2))) {
-                           if (t > 0)
-                               fbcon_bmove(conp, 0, 0, count, 0, t,
-                                           conp->vc_cols);
-                           ypan_up(unit, conp, p, count);
-                           if (conp->vc_rows-b > 0)
-                               fbcon_bmove(conp, b-count, 0, b, 0,
-                                           conp->vc_rows-b, conp->vc_cols);
-                       } else
-                           fbcon_bmove(conp, t+count, 0, t, 0, b-t-count,
-                                       conp->vc_cols);
-                       fbcon_clear(conp, b-count, 0, count, conp->vc_cols);
-                       break;
-
-                   case SCROLL_YMOVE:
-                       p->dispsw->bmove(p, t+count, 0, t, 0, b-t-count,
-                                        conp->vc_cols);
-                       p->dispsw->clear(conp, p, b-count, 0, count,
-                                        conp->vc_cols);
-                       break;
-                   case SCROLL_YREDRAW:
-                       fbcon_redraw(conp, p, t, b-t-count, count*conp->vc_cols);
-                       p->dispsw->clear(conp, p, b-count, 0, count,
-                                        conp->vc_cols);
-                       scr_memsetw((unsigned short *)(conp->vc_origin + 
-                                   conp->vc_size_row * (b-count)), 
-                                   conp->vc_video_erase_char,
-                                   conp->vc_size_row * count);
-                       return 1;
-               }
-           else {
-               fbcon_bmove(conp, t+count, 0, t, 0, b-t-count, conp->vc_cols);
+           switch (p->scrollmode & __SCROLL_YMASK) {
+           case __SCROLL_YMOVE:
+               p->dispsw->bmove(p, t+count, 0, t, 0, b-t-count,
+                                conp->vc_cols);
+               p->dispsw->clear(conp, p, b-count, 0, count,
+                                conp->vc_cols);
+               break;
+
+           case __SCROLL_YWRAP:
+               if (b-t-count > 3*conp->vc_rows>>2) {
+                   if (t > 0)
+                       fbcon_bmove(conp, 0, 0, count, 0, t,
+                                   conp->vc_cols);
+                       ywrap_up(unit, conp, p, count);
+                   if (conp->vc_rows-b > 0)
+                       fbcon_bmove(conp, b-count, 0, b, 0,
+                                   conp->vc_rows-b, conp->vc_cols);
+               } else if (p->scrollmode & __SCROLL_YPANREDRAW)
+                   goto redraw_up;
+               else
+                   fbcon_bmove(conp, t+count, 0, t, 0, b-t-count,
+                               conp->vc_cols);
+               fbcon_clear(conp, b-count, 0, count, conp->vc_cols);
+               break;
+
+           case __SCROLL_YPAN:
+               if (( is_txt && (b-t == conp->vc_rows)) ||
+                   (!is_txt && (b-t-count > 3*conp->vc_rows>>2))) {
+                   if (t > 0)
+                       fbcon_bmove(conp, 0, 0, count, 0, t,
+                                   conp->vc_cols);
+                   ypan_up(unit, conp, p, count);
+                   if (conp->vc_rows-b > 0)
+                       fbcon_bmove(conp, b-count, 0, b, 0,
+                                   conp->vc_rows-b, conp->vc_cols);
+               } else if (p->scrollmode & __SCROLL_YPANREDRAW)
+                   goto redraw_up;
+               else
+                   fbcon_bmove(conp, t+count, 0, t, 0, b-t-count,
+                               conp->vc_cols);
                fbcon_clear(conp, b-count, 0, count, conp->vc_cols);
+               break;
+
+           case __SCROLL_YREDRAW:
+           redraw_up:
+               fbcon_redraw(conp, p, t, b-t-count, count*conp->vc_cols);
+               p->dispsw->clear(conp, p, real_y(p, b-count), 0,
+                                count, conp->vc_cols);
+               scr_memsetw((unsigned short *)(conp->vc_origin + 
+                           conp->vc_size_row * (b-count)), 
+                           conp->vc_video_erase_char,
+                           conp->vc_size_row * count);
+               return 1;
            }
            break;
 
        case SM_DOWN:
            if (count > conp->vc_rows)  /* Maximum realistic size */
                count = conp->vc_rows;
-           if (vt_cons[unit]->vc_mode == KD_TEXT)
-               switch (p->scrollmode) {
-                   case SCROLL_YWRAP:
-                       if (b-t-count > 3*conp->vc_rows>>2) {
-                           if (conp->vc_rows-b > 0)
-                               fbcon_bmove(conp, b, 0, b-count, 0,
-                                           conp->vc_rows-b, conp->vc_cols);
-                           ywrap_down(unit, conp, p, count);
-                           if (t > 0)
-                               fbcon_bmove(conp, count, 0, 0, 0, t,
-                                           conp->vc_cols);
-                       } else
-                           fbcon_bmove(conp, t, 0, t+count, 0, b-t-count,
-                                       conp->vc_cols);
-                       fbcon_clear(conp, t, 0, count, conp->vc_cols);
-                       break;
-
-                   case SCROLL_YPAN:
-                       if (( is_txt && (b-t == conp->vc_rows)) ||
-                           (!is_txt && (b-t-count > 3*conp->vc_rows>>2))) {
-                           if (conp->vc_rows-b > 0)
-                               fbcon_bmove(conp, b, 0, b-count, 0,
-                                           conp->vc_rows-b, conp->vc_cols);
-                           ypan_down(unit, conp, p, count);
-                           if (t > 0)
-                               fbcon_bmove(conp, count, 0, 0, 0, t,
-                                           conp->vc_cols);
-                       } else
-                           fbcon_bmove(conp, t, 0, t+count, 0, b-t-count,
-                                       conp->vc_cols);
-                       fbcon_clear(conp, t, 0, count, conp->vc_cols);
-                       break;
-
-                   case SCROLL_YMOVE:
-                       p->dispsw->bmove(p, t, 0, t+count, 0, b-t-count,
-                                        conp->vc_cols);
-                       p->dispsw->clear(conp, p, t, 0, count, conp->vc_cols);
-                       break;
-                       
-                   case SCROLL_YREDRAW:
-                       fbcon_redraw(conp, p, b - 1, b-t-count, -count*conp->vc_cols);
-                       p->dispsw->clear(conp, p, t, 0, count, conp->vc_cols);
-                       scr_memsetw((unsigned short *)(conp->vc_origin + 
-                                   conp->vc_size_row * t), 
-                                   conp->vc_video_erase_char,
-                                   conp->vc_size_row * count);
-                       return 1;
-               }
-           else {
-               /*
-                *  Fixed bmove() should end Arno's frustration with copying?
-                *  Confucius says:
-                *      Man who copies in wrong direction, end up with trashed
-                *      data
-                */
-               fbcon_bmove(conp, t, 0, t+count, 0, b-t-count, conp->vc_cols);
+           switch (p->scrollmode & __SCROLL_YMASK) {
+           case __SCROLL_YMOVE:
+               p->dispsw->bmove(p, t, 0, t+count, 0, b-t-count,
+                                conp->vc_cols);
+               p->dispsw->clear(conp, p, t, 0,
+                                count, conp->vc_cols);
+               break;
+
+           case __SCROLL_YWRAP:
+               if (b-t-count > 3*conp->vc_rows>>2) {
+                   if (conp->vc_rows-b > 0)
+                       fbcon_bmove(conp, b, 0, b-count, 0,
+                                   conp->vc_rows-b, conp->vc_cols);
+                   ywrap_down(unit, conp, p, count);
+                   if (t > 0)
+                       fbcon_bmove(conp, count, 0, 0, 0, t,
+                                   conp->vc_cols);
+               } else if (p->scrollmode & __SCROLL_YPANREDRAW)
+                   goto redraw_down;
+               else
+                   fbcon_bmove(conp, t, 0, t+count, 0, b-t-count,
+                               conp->vc_cols);
                fbcon_clear(conp, t, 0, count, conp->vc_cols);
-           }
-           break;
+               break;
 
-       case SM_LEFT:
-           fbcon_bmove(conp, 0, t+count, 0, t, conp->vc_rows, b-t-count);
-           fbcon_clear(conp, 0, b-count, conp->vc_rows, count);
-           break;
+           case __SCROLL_YPAN:
+               if (( is_txt && (b-t == conp->vc_rows)) ||
+                   (!is_txt && (b-t-count > 3*conp->vc_rows>>2))) {
+                   if (conp->vc_rows-b > 0)
+                       fbcon_bmove(conp, b, 0, b-count, 0,
+                                   conp->vc_rows-b, conp->vc_cols);
+                   ypan_down(unit, conp, p, count);
+                   if (t > 0)
+                       fbcon_bmove(conp, count, 0, 0, 0, t,
+                                   conp->vc_cols);
+               } else if (p->scrollmode & __SCROLL_YPANREDRAW)
+                   goto redraw_down;
+               else
+                   fbcon_bmove(conp, t, 0, t+count, 0, b-t-count,
+                               conp->vc_cols);
+               fbcon_clear(conp, t, 0, count, conp->vc_cols);
+               break;
 
-       case SM_RIGHT:
-           fbcon_bmove(conp, 0, t, 0, t+count, conp->vc_rows, b-t-count);
-           fbcon_clear(conp, 0, t, conp->vc_rows, count);
-           break;
+           case __SCROLL_YREDRAW:
+           redraw_down:
+               fbcon_redraw(conp, p, b - 1, b-t-count, -count*conp->vc_cols);
+               p->dispsw->clear(conp, p, real_y(p, t), 0,
+                                count, conp->vc_cols);
+               scr_memsetw((unsigned short *)(conp->vc_origin + 
+                           conp->vc_size_row * t), 
+                           conp->vc_video_erase_char,
+                           conp->vc_size_row * count);
+               return 1;
+           }
     }
     return 0;
 }
@@ -1100,12 +1146,12 @@ static int fbcon_switch(struct vc_data *conp)
                conp2->vc_top = 0;
        logo_shown = -1;
     }
-    p->var.yoffset = p->yscroll*p->fontheight;
-    switch (p->scrollmode) {
-       case SCROLL_YWRAP:
+    p->var.yoffset = p->yscroll = 0;
+    switch (p->scrollmode & __SCROLL_YMASK) {
+       case __SCROLL_YWRAP:
            scrollback_phys_max = p->vrows-conp->vc_rows;
            break;
-       case SCROLL_YPAN:
+       case __SCROLL_YPAN:
            scrollback_phys_max = p->vrows-2*conp->vc_rows;
            if (scrollback_phys_max < 0)
                scrollback_phys_max = 0;
@@ -1118,9 +1164,17 @@ static int fbcon_switch(struct vc_data *conp)
     scrollback_current = 0;
 
     if (info && info->switch_con)
-       (*info->switch_con)(conp->vc_num, info);
-    if (p->dispsw && p->dispsw->clear_margins)
-       p->dispsw->clear_margins(conp, p);
+       (*info->switch_con)(unit, info);
+    if (p->dispsw->clear_margins)
+       p->dispsw->clear_margins(conp, p, 0);
+    if (logo_shown == -2) {
+       logo_shown = fg_console;
+       fbcon_show_logo(); /* This is protected above by initmem_freed */
+       update_region(fg_console,
+                     conp->vc_origin + conp->vc_size_row * conp->vc_top,
+                     conp->vc_size_row * (conp->vc_bottom - conp->vc_top) / 2);
+       return 0;
+    }
     return 1;
 }
 
@@ -1151,7 +1205,7 @@ static int fbcon_blank(struct vc_data *conp, int blank)
                             p->var.xres_virtual*p->var.yres_virtual*
                             p->var.bits_per_pixel>>3);
             } else
-                p->dispsw->clear(conp, p, 0, 0, p->conp->vc_rows, p->conp->vc_cols);
+                p->dispsw->clear(NULL, p, 0, 0, p->conp->vc_rows, p->conp->vc_cols);
            return 0;
        } else {
            /* Tell console.c that it has to restore the screen itself */
@@ -1162,67 +1216,73 @@ static int fbcon_blank(struct vc_data *conp, int blank)
     return 0;
 }
 
+static void fbcon_free_font(struct display *p)
+{
+    if (p->userfont && p->fontdata &&
+        (--REFCOUNT(p->fontdata) == 0))
+       kfree(p->fontdata - FONT_EXTRA_WORDS*sizeof(int));
+    p->fontdata = NULL;
+    p->userfont = 0;
+}
 
 static inline int fbcon_get_font(int unit, struct console_font_op *op)
 {
     struct display *p = &fb_display[unit];
     u8 *data = op->data;
+    u8 *fontdata = p->fontdata;
     int i, j;
 
 #ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-    if (p->fontwidth != 8) return -EINVAL;
+    if (fontwidth(p) != 8) return -EINVAL;
 #endif
-    op->width = p->fontwidth;
-    op->height = p->fontheight;
+    op->width = fontwidth(p);
+    op->height = fontheight(p);
     op->charcount = (p->charmask == 0x1ff) ? 512 : 256;
     if (!op->data) return 0;
     
     if (op->width <= 8) {
        for (i = 0; i < op->charcount; i++) {
-           for (j = 0; j < p->fontheight; j++)
-               *data++ = p->fontdata[i*p->fontheight+j];
-           data += 32 - p->fontheight;
+           for (j = 0; j < fontheight(p); j++)
+               *data++ = *fontdata++;
+           memset(data, 0, 32-j);
        }
     }
 #ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
     else if (op->width <= 16) {
        for (i = 0; i < op->charcount; i++) {
-           for (j = 0; j < p->fontheight; j++) {
-               *data++ = ((u16 *)p->fontdata)[i*p->fontheight+j] >> 8;
-               *data++ = ((u16 *)p->fontdata)[i*p->fontheight+j];
+           for (j = 0; j < fontheight(p); j++) {
+               *data++ = *(u16 *)fontdata >> 8;
+               *data++ = *(u16 *)fontdata;
+               fontdata += sizeof(u16);
            }
-           data += 2 * (32 - p->fontheight);
+           memset(data, 0, 2*(32-j));
        }
     } else if (op->width <= 24) {
        for (i = 0; i < op->charcount; i++) {
-           for (j = 0; j < p->fontheight; j++) {
-               *data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 24;
-               *data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 16;
-               *data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 8;
+           for (j = 0; j < fontheight(p); j++) {
+               *data++ = *(u32 *)fontdata >> 24;
+               *data++ = *(u32 *)fontdata >> 16;
+               *data++ = *(u32 *)fontdata >> 8;
+               fontdata += sizeof(u32);
            }
-           data += 3 * (32 - p->fontheight);
+           memset(data, 0, 3*(32-j));
        }
     } else {
        for (i = 0; i < op->charcount; i++) {
-           for (j = 0; j < p->fontheight; j++) {
-               *data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 24;
-               *data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 16;
-               *data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 8;
-               *data++ = ((u32 *)p->fontdata)[i*p->fontheight+j];
+           for (j = 0; j < fontheight(p); j++) {
+               *data++ = *(u32 *)fontdata >> 24;
+               *data++ = *(u32 *)fontdata >> 16;
+               *data++ = *(u32 *)fontdata >> 8;
+               *data++ = *(u32 *)fontdata;
+               fontdata += sizeof(u32);
            }
-           data += 4 * (32 - p->fontheight);
+           memset(data, 0, 4*(32-j));
        }
     }
 #endif
     return 0;
 }
 
-
-#define REFCOUNT(fd)   (((int *)(fd))[-1])
-#define FNTSIZE(fd)    (((int *)(fd))[-2])
-#define FNTCHARCNT(fd) (((int *)(fd))[-3])
-#define FNTSUM(fd)     (((int *)(fd))[-4])
-
 static int fbcon_do_set_font(int unit, struct console_font_op *op, u8 *data, int userfont)
 {
     struct display *p = &fb_display[unit];
@@ -1233,12 +1293,12 @@ static int fbcon_do_set_font(int unit, struct console_font_op *op, u8 *data, int
     char *old_data = NULL;
 
     if (!fontwidthvalid(p,w)) {
-        if (userfont)
-           kfree(data);
+        if (userfont && op->op != KD_FONT_OP_COPY)
+           kfree(data - FONT_EXTRA_WORDS*sizeof(int));
        return -ENXIO;
     }
 
-    resize = (w != p->fontwidth) || (h != p->fontheight);
+    resize = (w != fontwidth(p)) || (h != fontheight(p));
     if (p->userfont)
         old_data = p->fontdata;
     if (userfont)
@@ -1248,8 +1308,8 @@ static int fbcon_do_set_font(int unit, struct console_font_op *op, u8 *data, int
     p->fontdata = data;
     if ((p->userfont = userfont))
         REFCOUNT(data)++;
-    p->fontwidth = w;
-    p->fontheight = h;
+    p->_fontwidth = w;
+    p->_fontheight = h;
     if (p->conp->vc_hi_font_mask && cnt == 256) {
        p->conp->vc_hi_font_mask = 0;
        p->conp->vc_complement_mask >>= 1;
@@ -1269,18 +1329,21 @@ static int fbcon_do_set_font(int unit, struct console_font_op *op, u8 *data, int
        /* reset wrap/pan */
        p->var.xoffset = p->var.yoffset = p->yscroll = 0;
        if (!p->dispsw->set_font || 
-           !p->dispsw->set_font(p, p->fontwidth, p->fontheight)) {
+           !p->dispsw->set_font(p, fontwidth(p), fontheight(p))) {
            /* Adjust the virtual screen-size to fontheight*rows */
            p->var.yres_virtual = (p->var.yres/h)*h;
        }
        p->vrows = p->var.yres_virtual/h;
        updatescrollmode(p);
        vc_resize_con( p->var.yres/h, p->var.xres/w, unit );
-    } else if (unit == fg_console)
-       update_screen( unit );
+    } else if (CON_IS_VISIBLE(p->conp)) {
+       if (p->dispsw->clear_margins)
+           p->dispsw->clear_margins(p->conp, p, 0);
+       update_screen(unit);
+    }
 
     if (old_data && (--REFCOUNT(old_data) == 0))
-       kfree( old_data - 4*sizeof(int) );
+       kfree(old_data - FONT_EXTRA_WORDS*sizeof(int));
 
     return 0;
 }
@@ -1297,8 +1360,8 @@ static inline int fbcon_copy_font(int unit, struct console_font_op *op)
     od = &fb_display[h];
     if (od->fontdata == p->fontdata)
         return 0; /* already the same font... */
-    op->width = od->fontwidth;
-    op->height = od->fontheight;
+    op->width = fontwidth(od);
+    op->height = fontheight(od);
     return fbcon_do_set_font(unit, op, od->fontdata, od->userfont);
 }
 
@@ -1309,9 +1372,10 @@ static inline int fbcon_set_font(int unit, struct console_font_op *op)
     int size = h;
     int i, j, k;
     u8 *new_data, *data = op->data, c, *p;
+#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
     u32 d;
+#else
 
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
     if (w != 8)
        return -EINVAL;
 #endif
@@ -1327,57 +1391,59 @@ static inline int fbcon_set_font(int unit, struct console_font_op *op)
     }
     size *= op->charcount;
        
-    if (!(new_data = kmalloc( 4*sizeof(int)+size, GFP_USER )))
+    if (!(new_data = kmalloc(FONT_EXTRA_WORDS*sizeof(int)+size, GFP_USER)))
         return -ENOMEM;
-    new_data += 4*sizeof(int);
+    new_data += FONT_EXTRA_WORDS*sizeof(int);
     FNTSIZE(new_data) = size;
     FNTCHARCNT(new_data) = op->charcount;
     REFCOUNT(new_data) = 0; /* usage counter */
     k = 0;
-    p = data;
+    p = new_data;
     if (w <= 8) {
        for (i = 0; i < op->charcount; i++) {
            for (j = 0; j < h; j++) {
-               c = *p++;
+               c = *data++;
                k += c;
-               new_data[i*h+j] = c;
+               *p++ = c;
            }
-           p += 32 - h;
+           data += 32 - h;
        }
     }
 #ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
     else if (w <= 16) {
        for (i = 0; i < op->charcount; i++) {
            for (j = 0; j < h; j++) {
-               d = (p[0] << 8) | p[1];
-               p += 2;
+               d = (data[0] << 8) | data[1];
+               data += 2;
                k += d;
-               ((u16 *)new_data)[i*h+j] = d;
+               *(u16 *)p = d;
+               p += sizeof(u16);
            }
-           p += 2*(32 - h);
+           data += 2*(32 - h);
        }
     } else {
        for (i = 0; i < op->charcount; i++) {
            for (j = 0; j < h; j++) {
                if (w <= 24) {
-                   d = (p[0] << 24) | 
-                       (p[1] << 16) | 
-                       (p[2] << 8);
-                   p += 3;
+                   d = (data[0] << 24) | 
+                       (data[1] << 16) | 
+                       (data[2] << 8);
+                   data += 3;
                } else {
-                   d = (p[0] << 24) | 
-                       (p[1] << 16) | 
-                       (p[2] << 8) |
-                       p[3];
-                   p += 4;
+                   d = (data[0] << 24) | 
+                       (data[1] << 16) | 
+                       (data[2] << 8) |
+                       data[3];
+                   data += 4;
                }
                k += d;
-               ((u32 *)new_data)[i*h+j] = d;
+               *(u32 *)p = d;
+               p += sizeof(u32);
            }
            if (w <= 24)
-               p += 3*(32 - h);
+               data += 3*(32 - h);
            else
-               p += 4*(32 - h);
+               data += 4*(32 - h);
        }
     }
 #endif
@@ -1389,7 +1455,7 @@ static inline int fbcon_set_font(int unit, struct console_font_op *op)
            FNTSUM(fb_display[i].fontdata) == k &&
            FNTSIZE(fb_display[i].fontdata) == size &&
            !memcmp(fb_display[i].fontdata, new_data, size)) {
-           kfree(new_data - 4*sizeof(int));
+           kfree(new_data - FONT_EXTRA_WORDS*sizeof(int));
            new_data = fb_display[i].fontdata;
            break;
        }
@@ -1495,11 +1561,11 @@ static int fbcon_scrolldelta(struct vc_data *conp, int lines)
 
     offset = p->yscroll-scrollback_current;
     limit = p->vrows;
-    switch (p->scrollmode) {
-       case SCROLL_YWRAP:
+    switch (p->scrollmode && __SCROLL_YMASK) {
+       case __SCROLL_YWRAP:
            p->var.vmode |= FB_VMODE_YWRAP;
            break;
-       case SCROLL_YPAN:
+       case __SCROLL_YPAN:
            limit -= conp->vc_rows;
            p->var.vmode &= ~FB_VMODE_YWRAP;
            break;
@@ -1509,13 +1575,18 @@ static int fbcon_scrolldelta(struct vc_data *conp, int lines)
     else if (offset >= limit)
        offset -= limit;
     p->var.xoffset = 0;
-    p->var.yoffset = offset*p->fontheight;
+    p->var.yoffset = offset*fontheight(p);
     p->fb_info->updatevar(unit, p->fb_info);
     if (!offset)
        fbcon_cursor(conp, CM_DRAW);
     return 0;
 }
 
+static inline unsigned safe_shift(unsigned d,int n)
+{
+    return n<0 ? d>>-n : d<<n;
+}
+
 __initfunc(static int fbcon_show_logo( void ))
 {
     struct display *p = &fb_display[fg_console]; /* draw to vt in foreground */
@@ -1532,10 +1603,10 @@ __initfunc(static int fbcon_show_logo( void ))
        return 0;
 
     /* Set colors if visual is PSEUDOCOLOR and we have enough colors, or for
-     * TRUECOLOR */
+     * DIRECTCOLOR */
     if ((p->visual == FB_VISUAL_PSEUDOCOLOR && depth >= 4) ||
-       p->visual == FB_VISUAL_TRUECOLOR) {
-       int is_truecolor = (p->visual == FB_VISUAL_TRUECOLOR);
+       p->visual == FB_VISUAL_DIRECTCOLOR) {
+       int is_truecolor = (p->visual == FB_VISUAL_DIRECTCOLOR);
        int use_256 = (!is_truecolor && depth >= 8) ||
                      (is_truecolor && depth >= 24);
        int first_col = use_256 ? 32 : depth > 4 ? 16 : 0;
@@ -1588,7 +1659,7 @@ __initfunc(static int fbcon_show_logo( void ))
         
 #if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \
     defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FB_SBUS)
-        if (p->visual == FB_VISUAL_TRUECOLOR) {
+        if (p->visual == FB_VISUAL_DIRECTCOLOR) {
            unsigned int val;           /* max. depth 32! */
            int bdepth;
            int redshift, greenshift, blueshift;
@@ -1629,13 +1700,21 @@ __initfunc(static int fbcon_show_logo( void ))
                        val = (pix << redshift) |
                              (pix << greenshift) |
                              (pix << blueshift);
+#ifdef __LITTLE_ENDIAN
                        for( i = 0; i < bdepth; ++i )
+#else
+                       for( i = bdepth-1; i >= 0; --i )
+#endif
                            *dst++ = val >> (i*8);
                        pix = (*src & 0x0f) | 0x10; /* lower nibble */
                        val = (pix << redshift) |
                              (pix << greenshift) |
                              (pix << blueshift);
+#ifdef __LITTLE_ENDIAN
+                       for( i = 0; i < bdepth; ++i )
+#else
                        for( i = bdepth-1; i >= 0; --i )
+#endif
                            *dst++ = val >> (i*8);
                    }
                }
@@ -1645,7 +1724,7 @@ __initfunc(static int fbcon_show_logo( void ))
 #endif
 #if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \
     defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FB_SBUS)
-       if ((depth % 8 == 0) && (p->visual == FB_VISUAL_DIRECTCOLOR)) {
+       if ((depth % 8 == 0) && (p->visual == FB_VISUAL_TRUECOLOR)) {
            /* Modes without color mapping, needs special data transformation... */
            unsigned int val;           /* max. depth 32! */
            int bdepth = depth/8;
@@ -1665,9 +1744,9 @@ __initfunc(static int fbcon_show_logo( void ))
            for( y1 = 0; y1 < LOGO_H; y1++ ) {
                dst = fb + y1*line + x*bdepth;
                for( x1 = 0; x1 < LOGO_W; x1++, src++ ) {
-                   val = ((linux_logo_red[*src-32]   & redmask)   << redshift) |
-                         ((linux_logo_green[*src-32] & greenmask) << greenshift) |
-                         ((linux_logo_blue[*src-32]  & bluemask)  << blueshift);
+                   val = safe_shift((linux_logo_red[*src-32]   & redmask), redshift) |
+                         safe_shift((linux_logo_green[*src-32] & greenmask), greenshift) |
+                         safe_shift((linux_logo_blue[*src-32]  & bluemask), blueshift);
 #ifdef __LITTLE_ENDIAN
                    for( i = 0; i < bdepth; ++i )
 #else
@@ -1766,7 +1845,7 @@ __initfunc(static int fbcon_show_logo( void ))
     /* Modes not yet supported: packed pixels with depth != 8 (does such a
      * thing exist in reality?) */
 
-    return done ? (LOGO_H + p->fontheight - 1) / p->fontheight : 0 ;
+    return done ? (LOGO_H + fontheight(p) - 1) / fontheight(p) : 0 ;
 }
 
 /*
@@ -1801,7 +1880,7 @@ struct consw fb_con = {
 
 static void fbcon_dummy_op(void) {}
 
-static struct display_switch fbcon_dummy = {
+struct display_switch fbcon_dummy = {
     (void *)fbcon_dummy_op,    /* fbcon_dummy_setup */
     (void *)fbcon_dummy_op,    /* fbcon_dummy_bmove */
     (void *)fbcon_dummy_op,    /* fbcon_dummy_clear */
@@ -1818,3 +1897,4 @@ static struct display_switch fbcon_dummy = {
 
 EXPORT_SYMBOL(fb_display);
 EXPORT_SYMBOL(fbcon_redraw_bmove);
+EXPORT_SYMBOL(fbcon_dummy);
diff --git a/drivers/video/fbcon.h b/drivers/video/fbcon.h
deleted file mode 100644 (file)
index 98091ba..0000000
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- *  linux/drivers/video/fbcon.h -- Low level frame buffer based console driver
- *
- *     Copyright (C) 1997 Geert Uytterhoeven
- *
- *  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.
- */
-
-#ifndef __VIDEO_FBCON_H
-#define __VIDEO_FBCON_H
-
-#include <linux/config.h>
-#include <linux/console_struct.h>
-
-
-    /*                                  
-     *  `switch' for the Low Level Operations
-     */
-struct display_switch {                                                
-    void (*setup)(struct display *p);
-    void (*bmove)(struct display *p, int sy, int sx, int dy, int dx,
-                 int height, int width);
-    void (*clear)(struct vc_data *conp, struct display *p, int sy, int sx,
-                 int height, int width);
-    void (*putc)(struct vc_data *conp, struct display *p, int c, int yy,
-                int xx);
-    void (*putcs)(struct vc_data *conp, struct display *p, const unsigned short *s,
-                 int count, int yy, int xx);     
-    void (*revc)(struct display *p, int xx, int yy);
-    void (*cursor)(struct display *p, int mode, int xx, int yy);
-    int  (*set_font)(struct display *p, int width, int height);
-    void (*clear_margins)(struct vc_data *conp, struct display *p);
-    unsigned int fontwidthmask;      /* 1 at (1 << (width - 1)) if width is supported */
-}; 
-
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-
-/* fontwidth w is supported by dispsw */
-#define FONTWIDTH(w)   (1 << ((8) - 1))
-/* fontwidths w1-w2 inclusive are supported by dispsw */
-#define FONTWIDTHRANGE(w1,w2)  FONTWIDTH(8)
-
-#else
-
-/* fontwidth w is supported by dispsw */
-#define FONTWIDTH(w)   (1 << ((w) - 1))
-/* fontwidths w1-w2 inclusive are supported by dispsw */
-#define FONTWIDTHRANGE(w1,w2)  (FONTWIDTH(w2+1) - FONTWIDTH(w1))
-
-#endif
-
-    /*
-     *  Attribute Decoding
-     */
-
-/* Color */
-#define attr_fgcol(p,s)    \
-       (((s) >> ((p)->fgshift)) & 0x0f)
-#define attr_bgcol(p,s)    \
-       (((s) >> ((p)->bgshift)) & 0x0f)
-#define        attr_bgcol_ec(p,conp) \
-       (((conp)->vc_video_erase_char >> ((p)->bgshift)) & 0x0f)
-
-/* Monochrome */
-#define attr_bold(p,s) \
-       ((s) & 0x200)
-#define attr_reverse(p,s) \
-       (((s) & 0x800) ^ ((p)->inverse ? 0x800 : 0))
-#define attr_underline(p,s) \
-       ((s) & 0x400)
-#define attr_blink(p,s) \
-       ((s) & 0x8000)
-       
-    /*
-     *  Scroll Method
-     */
-
-#define SCROLL_YWRAP   (0)
-#define SCROLL_YPAN    (1)
-#define SCROLL_YMOVE   (2)
-#define SCROLL_YREDRAW (3)
-
-extern void fbcon_redraw_bmove(struct display *, int, int, int, int, int, int);
-
-
-/* ================================================================= */
-/*                      Utility Assembler Functions                  */
-/* ================================================================= */
-
-
-#ifdef __mc68000__
-
-/* ====================================================================== */
-
-/* Those of a delicate disposition might like to skip the next couple of
- * pages.
- *
- * These functions are drop in replacements for memmove and
- * memset(_, 0, _). However their five instances add at least a kilobyte
- * to the object file. You have been warned.
- *
- * Not a great fan of assembler for the sake of it, but I think
- * that these routines are at least 10 times faster than their C
- * equivalents for large blits, and that's important to the lowest level of
- * a graphics driver. Question is whether some scheme with the blitter
- * would be faster. I suspect not for simple text system - not much
- * asynchrony.
- *
- * Code is very simple, just gruesome expansion. Basic strategy is to
- * increase data moved/cleared at each step to 16 bytes to reduce
- * instruction per data move overhead. movem might be faster still
- * For more than 15 bytes, we try to align the write direction on a
- * longword boundary to get maximum speed. This is even more gruesome.
- * Unaligned read/write used requires 68020+ - think this is a problem?
- *
- * Sorry!
- */
-
-
-/* ++roman: I've optimized Robert's original versions in some minor
- * aspects, e.g. moveq instead of movel, let gcc choose the registers,
- * use movem in some places...
- * For other modes than 1 plane, lots of more such assembler functions
- * were needed (e.g. the ones using movep or expanding color values).
- */
-
-/* ++andreas: more optimizations:
-   subl #65536,d0 replaced by clrw d0; subql #1,d0 for dbcc
-   addal is faster than addaw
-   movep is rather expensive compared to ordinary move's
-   some functions rewritten in C for clarity, no speed loss */
-
-static __inline__ void *mymemclear_small(void *s, size_t count)
-{
-   if (!count)
-      return(0);
-
-   __asm__ __volatile__(
-         "lsrl   #1,%1 ; jcc 1f ; moveb %2,%0@-\n\t"
-      "1: lsrl   #1,%1 ; jcc 1f ; movew %2,%0@-\n\t"
-      "1: lsrl   #1,%1 ; jcc 1f ; movel %2,%0@-\n\t"
-      "1: lsrl   #1,%1 ; jcc 1f ; movel %2,%0@- ; movel %2,%0@-\n\t"
-      "1: subql  #1,%1 ; jcs 3f\n\t"
-      "2: moveml %2/%3/%4/%5,%0@-\n\t"
-         "dbra %1,2b\n\t"
-      "3:"
-         : "=a" (s), "=d" (count)
-         :  "d" (0), "d" (0), "d" (0), "d" (0),
-            "0" ((char *)s+count), "1" (count)
-  );
-
-   return(0);
-}
-
-
-static __inline__ void *mymemclear(void *s, size_t count)
-{
-   if (!count)
-      return(0);
-
-   if (count < 16) {
-      __asm__ __volatile__(
-            "lsrl   #1,%1 ; jcc 1f ; clrb %0@+\n\t"
-         "1: lsrl   #1,%1 ; jcc 1f ; clrw %0@+\n\t"
-         "1: lsrl   #1,%1 ; jcc 1f ; clrl %0@+\n\t"
-         "1: lsrl   #1,%1 ; jcc 1f ; clrl %0@+ ; clrl %0@+\n\t"
-         "1:"
-            : "=a" (s), "=d" (count)
-            : "0" (s), "1" (count)
-     );
-   } else {
-      long tmp;
-      __asm__ __volatile__(
-            "movel %1,%2\n\t"
-            "lsrl   #1,%2 ; jcc 1f ; clrb %0@+ ; subqw #1,%1\n\t"
-            "lsrl   #1,%2 ; jcs 2f\n\t"  /* %0 increased=>bit 2 switched*/
-            "clrw   %0@+  ; subqw  #2,%1 ; jra 2f\n\t"
-         "1: lsrl   #1,%2 ; jcc 2f\n\t"
-            "clrw   %0@+  ; subqw  #2,%1\n\t"
-         "2: movew %1,%2; lsrl #2,%1 ; jeq 6f\n\t"
-            "lsrl   #1,%1 ; jcc 3f ; clrl %0@+\n\t"
-         "3: lsrl   #1,%1 ; jcc 4f ; clrl %0@+ ; clrl %0@+\n\t"
-         "4: subql  #1,%1 ; jcs 6f\n\t"
-         "5: clrl %0@+; clrl %0@+ ; clrl %0@+ ; clrl %0@+\n\t"
-            "dbra %1,5b   ; clrw %1; subql #1,%1; jcc 5b\n\t"
-         "6: movew %2,%1; btst #1,%1 ; jeq 7f ; clrw %0@+\n\t"
-         "7:            ; btst #0,%1 ; jeq 8f ; clrb %0@+\n\t"
-         "8:"
-            : "=a" (s), "=d" (count), "=d" (tmp)
-            : "0" (s), "1" (count)
-     );
-   }
-
-   return(0);
-}
-
-
-static __inline__ void *mymemset(void *s, size_t count)
-{
-   if (!count)
-      return(0);
-
-   __asm__ __volatile__(
-         "lsrl   #1,%1 ; jcc 1f ; moveb %2,%0@-\n\t"
-      "1: lsrl   #1,%1 ; jcc 1f ; movew %2,%0@-\n\t"
-      "1: lsrl   #1,%1 ; jcc 1f ; movel %2,%0@-\n\t"
-      "1: lsrl   #1,%1 ; jcc 1f ; movel %2,%0@- ; movel %2,%0@-\n\t"
-      "1: subql  #1,%1 ; jcs 3f\n\t"
-      "2: moveml %2/%3/%4/%5,%0@-\n\t"
-         "dbra %1,2b\n\t"
-      "3:"
-         : "=a" (s), "=d" (count)
-         :  "d" (-1), "d" (-1), "d" (-1), "d" (-1),
-            "0" ((char *) s + count), "1" (count)
-  );
-
-   return(0);
-}
-
-
-static __inline__ void *mymemmove(void *d, const void *s, size_t count)
-{
-   if (d < s) {
-      if (count < 16) {
-         __asm__ __volatile__(
-               "lsrl   #1,%2 ; jcc 1f ; moveb %1@+,%0@+\n\t"
-            "1: lsrl   #1,%2 ; jcc 1f ; movew %1@+,%0@+\n\t"
-            "1: lsrl   #1,%2 ; jcc 1f ; movel %1@+,%0@+\n\t"
-            "1: lsrl   #1,%2 ; jcc 1f ; movel %1@+,%0@+ ; movel %1@+,%0@+\n\t"
-            "1:"
-               : "=a" (d), "=a" (s), "=d" (count)
-               : "0" (d), "1" (s), "2" (count)
-        );
-      } else {
-         long tmp;
-         __asm__ __volatile__(
-               "movel  %0,%3\n\t"
-               "lsrl   #1,%3 ; jcc 1f ; moveb %1@+,%0@+ ; subqw #1,%2\n\t"
-               "lsrl   #1,%3 ; jcs 2f\n\t"  /* %0 increased=>bit 2 switched*/
-               "movew  %1@+,%0@+  ; subqw  #2,%2 ; jra 2f\n\t"
-            "1: lsrl   #1,%3 ; jcc 2f\n\t"
-               "movew  %1@+,%0@+  ; subqw  #2,%2\n\t"
-            "2: movew  %2,%-; lsrl #2,%2 ; jeq 6f\n\t"
-               "lsrl   #1,%2 ; jcc 3f ; movel %1@+,%0@+\n\t"
-            "3: lsrl   #1,%2 ; jcc 4f ; movel %1@+,%0@+ ; movel %1@+,%0@+\n\t"
-            "4: subql  #1,%2 ; jcs 6f\n\t"
-            "5: movel  %1@+,%0@+;movel %1@+,%0@+\n\t"
-               "movel  %1@+,%0@+;movel %1@+,%0@+\n\t"
-               "dbra   %2,5b ; clrw %2; subql #1,%2; jcc 5b\n\t"
-            "6: movew  %+,%2; btst #1,%2 ; jeq 7f ; movew %1@+,%0@+\n\t"
-            "7:              ; btst #0,%2 ; jeq 8f ; moveb %1@+,%0@+\n\t"
-            "8:"
-               : "=a" (d), "=a" (s), "=d" (count), "=d" (tmp)
-               : "0" (d), "1" (s), "2" (count)
-        );
-      }
-   } else {
-      if (count < 16) {
-         __asm__ __volatile__(
-               "lsrl   #1,%2 ; jcc 1f ; moveb %1@-,%0@-\n\t"
-            "1: lsrl   #1,%2 ; jcc 1f ; movew %1@-,%0@-\n\t"
-            "1: lsrl   #1,%2 ; jcc 1f ; movel %1@-,%0@-\n\t"
-            "1: lsrl   #1,%2 ; jcc 1f ; movel %1@-,%0@- ; movel %1@-,%0@-\n\t"
-            "1:"
-               : "=a" (d), "=a" (s), "=d" (count)
-               : "0" ((char *) d + count), "1" ((char *) s + count), "2" (count)
-        );
-      } else {
-         long tmp;
-         __asm__ __volatile__(
-               "movel %0,%3\n\t"
-               "lsrl   #1,%3 ; jcc 1f ; moveb %1@-,%0@- ; subqw #1,%2\n\t"
-               "lsrl   #1,%3 ; jcs 2f\n\t"  /* %0 increased=>bit 2 switched*/
-               "movew  %1@-,%0@-  ; subqw  #2,%2 ; jra 2f\n\t"
-            "1: lsrl   #1,%3 ; jcc 2f\n\t"
-               "movew  %1@-,%0@-  ; subqw  #2,%2\n\t"
-            "2: movew %2,%-; lsrl #2,%2 ; jeq 6f\n\t"
-               "lsrl   #1,%2 ; jcc 3f ; movel %1@-,%0@-\n\t"
-            "3: lsrl   #1,%2 ; jcc 4f ; movel %1@-,%0@- ; movel %1@-,%0@-\n\t"
-            "4: subql  #1,%2 ; jcs 6f\n\t"
-            "5: movel %1@-,%0@-;movel %1@-,%0@-\n\t"
-               "movel %1@-,%0@-;movel %1@-,%0@-\n\t"
-               "dbra %2,5b ; clrw %2; subql #1,%2; jcc 5b\n\t"
-            "6: movew %+,%2; btst #1,%2 ; jeq 7f ; movew %1@-,%0@-\n\t"
-            "7:              ; btst #0,%2 ; jeq 8f ; moveb %1@-,%0@-\n\t"
-            "8:"
-               : "=a" (d), "=a" (s), "=d" (count), "=d" (tmp)
-               : "0" ((char *) d + count), "1" ((char *) s + count), "2" (count)
-        );
-      }
-   }
-
-   return(0);
-}
-
-
-/* ++andreas: Simple and fast version of memmove, assumes size is
-   divisible by 16, suitable for moving the whole screen bitplane */
-static __inline__ void fast_memmove(char *dst, const char *src, size_t size)
-{
-  if (!size)
-    return;
-  if (dst < src)
-    __asm__ __volatile__
-      ("1:"
-       "  moveml %0@+,%/d0/%/d1/%/a0/%/a1\n"
-       "  moveml %/d0/%/d1/%/a0/%/a1,%1@\n"
-       "  addql #8,%1; addql #8,%1\n"
-       "  dbra %2,1b\n"
-       "  clrw %2; subql #1,%2\n"
-       "  jcc 1b"
-       : "=a" (src), "=a" (dst), "=d" (size)
-       : "0" (src), "1" (dst), "2" (size / 16 - 1)
-       : "d0", "d1", "a0", "a1", "memory");
-  else
-    __asm__ __volatile__
-      ("1:"
-       "  subql #8,%0; subql #8,%0\n"
-       "  moveml %0@,%/d0/%/d1/%/a0/%/a1\n"
-       "  moveml %/d0/%/d1/%/a0/%/a1,%1@-\n"
-       "  dbra %2,1b\n"
-       "  clrw %2; subql #1,%2\n"
-       "  jcc 1b"
-       : "=a" (src), "=a" (dst), "=d" (size)
-       : "0" (src + size), "1" (dst + size), "2" (size / 16 - 1)
-       : "d0", "d1", "a0", "a1", "memory");
-}
-
-#else /* !m68k */
-
-    /*
-     *  Anyone who'd like to write asm functions for other CPUs?
-     */
-
-static __inline__ void *mymemclear_small(void *s, size_t count)
-{
-    return(memset(s, 0, count));
-}
-
-static __inline__ void *mymemclear(void *s, size_t count)
-{
-    return(memset(s, 0, count));
-}
-
-static __inline__ void *mymemset(void *s, size_t count)
-{
-    return(memset(s, 255, count));
-}
-
-#ifdef __i386__
-static __inline__ void fast_memmove(void *d, const void *s, size_t count)
-{
-    if (d < s) {
-__asm__ __volatile__ (
-       "cld\n\t"
-       "shrl $1,%%ecx\n\t"
-       "jnc 1f\n\t"
-       "movsb\n"
-       "1:\tshrl $1,%%ecx\n\t"
-       "jnc 2f\n\t"
-       "movsw\n"
-       "2:\trep\n\t"
-       "movsl"
-       : /* no output */
-       :"c"(count),"D"((long)d),"S"((long)s)
-       :"cx","di","si","memory");
-    } else {
-__asm__ __volatile__ (
-       "std\n\t"
-       "shrl $1,%%ecx\n\t"
-       "jnc 1f\n\t"
-       "movb 3(%%esi),%%al\n\t"
-       "movb %%al,3(%%edi)\n\t"
-       "decl %%esi\n\t"
-       "decl %%edi\n"
-       "1:\tshrl $1,%%ecx\n\t"
-       "jnc 2f\n\t"
-       "movw 2(%%esi),%%ax\n\t"
-       "movw %%ax,2(%%edi)\n\t"
-       "decl %%esi\n\t"
-       "decl %%edi\n\t"
-       "decl %%esi\n\t"
-       "decl %%edi\n"
-       "2:\trep\n\t"
-       "movsl"
-       : /* no output */
-       :"c"(count),"D"(count-4+(long)d),"S"(count-4+(long)s)
-       :"ax","cx","di","si","memory");
-    }
-}
-
-static __inline__ void *mymemmove(char *dst, const char *src, size_t size)
-{
-    fast_memmove(dst, src, size);
-    return dst;
-}
-#else
-static __inline__ void *mymemmove(void *d, const void *s, size_t count)
-{
-    return(memmove(d, s, count));
-}
-
-static __inline__ void fast_memmove(char *dst, const char *src, size_t size)
-{
-    memmove(dst, src, size);
-}
-#endif /* !i386 */
-
-#endif /* !m68k */
-
-#endif /* __VIDEO_FBCON_H */
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
new file mode 100644 (file)
index 0000000..0178aad
--- /dev/null
@@ -0,0 +1,690 @@
+/*
+ *  linux/drivers/video/fbmem.c
+ *
+ *  Copyright (C) 1994 Martin Schaller
+ *
+ * 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/types.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/major.h>
+#include <linux/malloc.h>
+#include <linux/mman.h>
+#include <linux/tty.h>
+#include <linux/console.h>
+#include <linux/console_struct.h>
+#include <linux/init.h>
+#ifdef CONFIG_PROC_FS
+#include <linux/proc_fs.h>
+#endif
+#ifdef CONFIG_KMOD
+#include <linux/kmod.h>
+#endif
+
+#ifdef __mc68000__
+#include <asm/setup.h>
+#endif
+#ifdef __powerpc__
+#include <asm/io.h>
+#endif
+#include <asm/uaccess.h>
+#include <asm/page.h>
+#include <asm/pgtable.h>
+
+#include <linux/fb.h>
+
+
+    /*
+     *  Frame buffer device initialization and setup routines
+     */
+
+extern unsigned long acornfb_init(void);
+extern void acornfb_setup(char *options, int *ints);
+extern void amifb_init(void);
+extern void amifb_setup(char *options, int *ints);
+extern void atafb_init(void);
+extern void atafb_setup(char *options, int *ints);
+extern void macfb_init(void);
+extern void macfb_setup(char *options, int *ints);
+extern void cyberfb_init(void);
+extern void cyberfb_setup(char *options, int *ints);
+extern void retz3fb_init(void);
+extern void retz3fb_setup(char *options, int *ints);
+extern void clgenfb_init(void);
+extern void clgenfb_setup(char *options, int *ints);
+extern void vfb_init(void);
+extern void vfb_setup(char *options, int *ints);
+extern void offb_init(void);
+extern void offb_setup(char *options, int *ints);
+extern void atyfb_init(void);
+extern void atyfb_setup(char *options, int *ints);
+extern void imsttfb_init(void);
+extern void dnfb_init(void);
+extern void tgafb_init(void);
+extern void virgefb_init(void);
+extern void virgefb_setup(char *options, int *ints);
+extern void resolver_video_setup(char *options, int *ints);
+extern void s3triofb_init(void);
+extern void s3triofb_setup(char *options, int *ints);
+extern void vesafb_init(void);
+extern void vesafb_setup(char *options, int *ints);
+extern void hpfb_init(void);
+extern void hpfb_setup(char *options, int *ints);
+extern void sbusfb_init(void);
+extern void sbusfb_setup(char *options, int *ints);
+extern void valkyriefb_init(void);
+extern void valkyriefb_setup(char *options, int *ints);
+extern void g364fb_init(void);
+
+static struct {
+       const char *name;
+       void (*init)(void);
+       void (*setup)(char *options, int *ints);
+} fb_drivers[] __initdata = {
+#ifdef CONFIG_FB_RETINAZ3
+       { "retz3", retz3fb_init, retz3fb_setup },
+#endif
+#ifdef CONFIG_FB_ACORN
+       { "acorn", acornfb_init, acornfb_setup },
+#endif
+#ifdef CONFIG_FB_AMIGA
+       { "amifb", amifb_init, amifb_setup },
+#endif
+#ifdef CONFIG_FB_ATARI
+       { "atafb", atafb_init, atafb_setup },
+#endif
+#ifdef CONFIG_FB_MAC
+       { "macfb", macfb_init, macfb_setup },
+#endif
+#ifdef CONFIG_FB_CYBER
+       { "cyber", cyberfb_init, cyberfb_setup },
+#endif
+#ifdef CONFIG_FB_CLGEN
+       { "clgen", clgenfb_init, clgenfb_setup },
+#endif
+#ifdef CONFIG_FB_OF
+       { "offb", offb_init, offb_setup },
+#endif
+#ifdef CONFIG_FB_ATY
+       { "atyfb", atyfb_init, atyfb_setup },
+#endif
+#ifdef CONFIG_FB_IMSTT
+       { "imsttfb", imsttfb_init, NULL },
+#endif
+#ifdef CONFIG_APOLLO
+       { "apollo", dnfb_init, NULL },
+#endif
+#ifdef CONFIG_FB_S3TRIO
+       { "s3trio", s3triofb_init, s3triofb_setup },
+#endif 
+#ifdef CONFIG_FB_TGA
+       { "tga", tgafb_init, NULL },
+#endif
+#ifdef CONFIG_FB_VIRGE
+       { "virge", virgefb_init, virgefb_setup },
+#endif
+#ifdef CONFIG_FB_VESA
+       { "vesa", vesafb_init, vesafb_setup },
+#endif 
+#ifdef CONFIG_FB_HP300
+       { "hpfb", hpfb_init, hpfb_setup },
+#endif 
+#ifdef CONFIG_FB_SBUS
+       { "sbus", sbusfb_init, sbusfb_setup },
+#endif
+#ifdef CONFIG_FB_VALKYRIE
+       { "valkyriefb", valkyriefb_init, valkyriefb_setup },
+#endif
+#ifdef CONFIG_FB_G364
+       { "g364", g364fb_init, NULL },
+#endif
+#ifdef CONFIG_GSP_RESOLVER
+       /* Not a real frame buffer device... */
+       { "resolver", NULL, resolver_video_setup },
+#endif
+#ifdef CONFIG_FB_VIRTUAL
+       /* Must be last to avoid that vfb becomes your primary display */
+       { "vfb", vfb_init, vfb_setup },
+#endif
+};
+
+#define NUM_FB_DRIVERS (sizeof(fb_drivers)/sizeof(*fb_drivers))
+
+static void (*pref_init_funcs[FB_MAX])(void);
+static int num_pref_init_funcs __initdata = 0;
+
+
+#define GET_INODE(i) MKDEV(FB_MAJOR, (i) << FB_MODES_SHIFT)
+#define GET_FB_VAR_IDX(node) (MINOR(node) & ((1 << FB_MODES_SHIFT)-1)) 
+
+struct fb_info *registered_fb[FB_MAX];
+int num_registered_fb = 0;
+
+char con2fb_map[MAX_NR_CONSOLES];
+
+static int first_fb_vc = 0;
+static int last_fb_vc = MAX_NR_CONSOLES-1;
+static int fbcon_is_default = 1;
+
+static inline int PROC_CONSOLE(void)
+{
+       if (!current->tty)
+               return fg_console;
+
+       if (current->tty->driver.type != TTY_DRIVER_TYPE_CONSOLE)
+               /* XXX Should report error here? */
+               return fg_console;
+
+       if (MINOR(current->tty->device) < 1)
+               return fg_console;
+
+       return MINOR(current->tty->device) - 1;
+}
+
+#ifdef CONFIG_PROC_FS
+static int fbmem_read_proc(char *buf, char **start, off_t offset,
+                          int len, int *eof, void *private)
+{
+       struct fb_info **fi;
+
+       len = 0;
+       for (fi = registered_fb; fi < &registered_fb[FB_MAX] && len < 4000; fi++)
+               if (*fi)
+                       len += sprintf(buf + len, "%d %s\n",
+                                      GET_FB_IDX((*fi)->node),
+                                      (*fi)->modename);
+       *start = buf + offset;
+       return len > offset ? len - offset : 0;
+}
+#endif
+
+static ssize_t
+fb_read(struct file *file, char *buf, size_t count, loff_t *ppos)
+{
+       unsigned long p = *ppos;
+       struct inode *inode = file->f_dentry->d_inode;
+       int fbidx = GET_FB_IDX(inode->i_rdev);
+       struct fb_info *info = registered_fb[fbidx];
+       struct fb_ops *fb = info->fbops;
+       struct fb_fix_screeninfo fix;
+       char *base_addr;
+       ssize_t copy_size;
+
+       if (! fb || ! info->disp)
+               return -ENODEV;
+
+       fb->fb_get_fix(&fix,PROC_CONSOLE(), info);
+       base_addr=info->disp->screen_base;
+       copy_size=(count + p <= fix.smem_len ? count : fix.smem_len - p);
+       if (copy_to_user(buf, base_addr+p, copy_size))
+           return -EFAULT;
+       *ppos += copy_size;
+       return copy_size;
+}
+
+static ssize_t
+fb_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+{
+       unsigned long p = *ppos;
+       struct inode *inode = file->f_dentry->d_inode;
+       int fbidx = GET_FB_IDX(inode->i_rdev);
+       struct fb_info *info = registered_fb[fbidx];
+       struct fb_ops *fb = info->fbops;
+       struct fb_fix_screeninfo fix;
+       char *base_addr;
+       ssize_t copy_size;
+
+       if (! fb || ! info->disp)
+               return -ENODEV;
+
+       fb->fb_get_fix(&fix, PROC_CONSOLE(), info);
+       base_addr=info->disp->screen_base;
+       copy_size=(count + p <= fix.smem_len ? count : fix.smem_len - p);
+       if (copy_from_user(base_addr+p, buf, copy_size))
+           return -EFAULT;
+       file->f_pos += copy_size;
+       return copy_size;
+}
+
+
+static void set_con2fb_map(int unit, int newidx)
+{
+    int oldidx = con2fb_map[unit];
+    struct fb_info *oldfb, *newfb;
+    struct vc_data *conp;
+    char *fontdata;
+    unsigned short fontwidth, fontheight, fontwidthlog, fontheightlog;
+    int userfont;
+
+    if (newidx != con2fb_map[unit]) {
+       oldfb = registered_fb[oldidx];
+       newfb = registered_fb[newidx];
+       if (newfb->fbops->fb_open(newfb,0))
+          return;
+       oldfb->fbops->fb_release(oldfb,0);
+       conp = fb_display[unit].conp;
+       fontdata = fb_display[unit].fontdata;
+       fontwidth = fb_display[unit]._fontwidth;
+       fontheight = fb_display[unit]._fontheight;
+       fontwidthlog = fb_display[unit]._fontwidthlog;
+       fontheightlog = fb_display[unit]._fontheightlog;
+       userfont = fb_display[unit].userfont;
+       con2fb_map[unit] = newidx;
+       fb_display[unit] = *(newfb->disp);
+       fb_display[unit].conp = conp;
+       fb_display[unit].fontdata = fontdata;
+       fb_display[unit]._fontwidth = fontwidth;
+       fb_display[unit]._fontheight = fontheight;
+       fb_display[unit]._fontwidthlog = fontwidthlog;
+       fb_display[unit]._fontheightlog = fontheightlog;
+       fb_display[unit].userfont = userfont;
+       fb_display[unit].fb_info = newfb;
+       if (!newfb->changevar)
+          newfb->changevar = oldfb->changevar;
+       /* tell console var has changed */
+       if (newfb->changevar)
+          newfb->changevar(unit);
+    }
+}
+
+#ifdef CONFIG_KMOD
+static void try_to_load(int fb)
+{
+       char modname[16];
+
+       sprintf(modname, "fb%d", fb);
+       request_module(modname);
+}
+#endif /* CONFIG_KMOD */
+
+static int 
+fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+        unsigned long arg)
+{
+       int fbidx = GET_FB_IDX(inode->i_rdev);
+       struct fb_info *info = registered_fb[fbidx];
+       struct fb_ops *fb = info->fbops;
+       struct fb_cmap cmap;
+       struct fb_var_screeninfo var;
+       struct fb_fix_screeninfo fix;
+       struct fb_con2fbmap con2fb;
+       int i;
+       
+       if (! fb)
+               return -ENODEV;
+       switch (cmd) {
+       case FBIOGET_VSCREENINFO:
+               if ((i = fb->fb_get_var(&var, PROC_CONSOLE(), info)))
+                       return i;
+               return copy_to_user((void *) arg, &var,
+                                   sizeof(var)) ? -EFAULT : 0;
+       case FBIOPUT_VSCREENINFO:
+               if (copy_from_user(&var, (void *) arg, sizeof(var)))
+                       return -EFAULT;
+               if ((i = fb->fb_set_var(&var, PROC_CONSOLE(), info)))
+                       return i;
+               if (copy_to_user((void *) arg, &var, sizeof(var)))
+                       return -EFAULT;
+               return 0;
+       case FBIOGET_FSCREENINFO:
+               if ((i = fb->fb_get_fix(&fix, PROC_CONSOLE(), info)))
+                       return i;
+               return copy_to_user((void *) arg, &fix, sizeof(fix)) ?
+                       -EFAULT : 0;
+       case FBIOPUTCMAP:
+               if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
+                       return -EFAULT;
+               return (fb->fb_set_cmap(&cmap, 0, PROC_CONSOLE(), info));
+       case FBIOGETCMAP:
+               if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
+                       return -EFAULT;
+               return (fb->fb_get_cmap(&cmap, 0, PROC_CONSOLE(), info));
+       case FBIOPAN_DISPLAY:
+               if (copy_from_user(&var, (void *) arg, sizeof(var)))
+                       return -EFAULT;
+               if ((i=fb->fb_pan_display(&var, PROC_CONSOLE(), info)))
+                       return i;
+               if (copy_to_user((void *) arg, &var, sizeof(var)))
+                       return -EFAULT;
+               return i;
+       case FBIOGET_CON2FBMAP:
+               if (copy_from_user(&con2fb, (void *)arg, sizeof(con2fb)))
+                       return -EFAULT;
+               if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
+                   return -EINVAL;
+               con2fb.framebuffer = con2fb_map[con2fb.console-1];
+               return copy_to_user((void *)arg, &con2fb,
+                                   sizeof(con2fb)) ? -EFAULT : 0;
+       case FBIOPUT_CON2FBMAP:
+               if (copy_from_user(&con2fb, (void *)arg, sizeof(con2fb)))
+                       return - EFAULT;
+               if (con2fb.console < 0 || con2fb.console > MAX_NR_CONSOLES)
+                   return -EINVAL;
+               if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX)
+                   return -EINVAL;
+#ifdef CONFIG_KMOD
+               if (!registered_fb[con2fb.framebuffer])
+                   try_to_load(con2fb.framebuffer);
+#endif /* CONFIG_KMOD */
+               if (!registered_fb[con2fb.framebuffer])
+                   return -EINVAL;
+               if (con2fb.console != 0)
+                   set_con2fb_map(con2fb.console-1, con2fb.framebuffer);
+               else
+                   /* set them all */
+                   for (i = 0; i < MAX_NR_CONSOLES; i++)
+                       set_con2fb_map(i, con2fb.framebuffer);
+               return 0;
+       default:
+               return fb->fb_ioctl(inode, file, cmd, arg, PROC_CONSOLE(),
+                                   info);
+       }
+}
+
+static int 
+fb_mmap(struct file *file, struct vm_area_struct * vma)
+{
+       int fbidx = GET_FB_IDX(file->f_dentry->d_inode->i_rdev);
+       struct fb_info *info = registered_fb[fbidx];
+       struct fb_ops *fb = info->fbops;
+       struct fb_fix_screeninfo fix;
+       struct fb_var_screeninfo var;
+       unsigned long start;
+       u32 len;
+
+       if (!fb)
+               return -ENODEV;
+       if (fb->fb_mmap)
+               return fb->fb_mmap(info, file, vma);
+       fb->fb_get_fix(&fix, PROC_CONSOLE(), info);
+
+       /* frame buffer memory */
+       start = (unsigned long)fix.smem_start;
+       len = (start & ~PAGE_MASK)+fix.smem_len;
+       start &= PAGE_MASK;
+       len = (len+~PAGE_MASK) & PAGE_MASK;
+       if (vma->vm_offset >= len) {
+               /* memory mapped io */
+               vma->vm_offset -= len;
+               fb->fb_get_var(&var, PROC_CONSOLE(), info);
+               if (var.accel_flags)
+                       return -EINVAL;
+               start = (unsigned long)fix.mmio_start;
+               len = (start & ~PAGE_MASK)+fix.mmio_len;
+               start &= PAGE_MASK;
+               len = (len+~PAGE_MASK) & PAGE_MASK;
+       }
+       if ((vma->vm_end - vma->vm_start + vma->vm_offset) > len)
+               return -EINVAL;
+       vma->vm_offset += start;
+       if (vma->vm_offset & ~PAGE_MASK)
+               return -ENXIO;
+#if defined(__mc68000__)
+       if (CPU_IS_020_OR_030)
+               pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
+       if (CPU_IS_040_OR_060) {
+               pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
+               /* Use no-cache mode, serialized */
+               pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
+       }
+#elif defined(__powerpc__)
+       pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE|_PAGE_GUARDED;
+#elif defined(__alpha__)
+       /* Caching is off in the I/O space quadrant by design.  */
+#elif defined(__sparc__)
+       /* Should never get here, all fb drivers should have their own
+          mmap routines */
+#elif defined(__i386__)
+       if (boot_cpu_data.x86 > 3)
+               pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
+#elif defined(__mips__)
+       pgprot_val(vma->vm_page_prot) &= ~_CACHE_MASK;
+       pgprot_val(vma->vm_page_prot) |= _CACHE_UNCACHED;
+#else
+#warning What do we have to do here??
+#endif
+       if (remap_page_range(vma->vm_start, vma->vm_offset,
+                            vma->vm_end - vma->vm_start, vma->vm_page_prot))
+               return -EAGAIN;
+       vma->vm_file = file;
+       file->f_count++;
+       return 0;
+}
+
+static int
+fb_open(struct inode *inode, struct file *file)
+{
+       int fbidx = GET_FB_IDX(inode->i_rdev);
+       struct fb_info *info;
+
+#ifdef CONFIG_KMOD
+       if (!(info = registered_fb[fbidx]))
+               try_to_load(fbidx);
+#endif /* CONFIG_KMOD */
+       if (!(info = registered_fb[fbidx]))
+               return -ENODEV;
+       return info->fbops->fb_open(info,1);
+}
+
+static int 
+fb_release(struct inode *inode, struct file *file)
+{
+       int fbidx = GET_FB_IDX(inode->i_rdev);
+       struct fb_info *info = registered_fb[fbidx];
+
+       info->fbops->fb_release(info,1);
+       return 0;
+}
+
+static struct file_operations fb_fops = {
+       NULL,           /* lseek        */
+       fb_read,        /* read         */
+       fb_write,       /* write        */
+       NULL,           /* readdir      */
+       NULL,           /* poll         */
+       fb_ioctl,       /* ioctl        */
+       fb_mmap,        /* mmap         */
+       fb_open,        /* open         */
+       NULL,           /* flush        */
+       fb_release,     /* release      */
+       NULL            /* fsync        */
+};
+
+int
+register_framebuffer(struct fb_info *fb_info)
+{
+       int i, j;
+       static int fb_ever_opened[FB_MAX];
+       static int first = 1;
+
+       if (num_registered_fb == FB_MAX)
+               return -ENXIO;
+       num_registered_fb++;
+       for (i = 0 ; i < FB_MAX; i++)
+               if (!registered_fb[i])
+                       break;
+       fb_info->node=GET_INODE(i);
+       registered_fb[i] = fb_info;
+       if (!fb_ever_opened[i]) {
+               /*
+                *  We assume initial frame buffer devices can be opened this
+                *  many times
+                */
+               for (j = 0; j < MAX_NR_CONSOLES; j++)
+                       if (con2fb_map[j] == i)
+                               fb_info->fbops->fb_open(fb_info,0);
+               fb_ever_opened[i] = 1;
+       }
+
+       if (first) {
+               first = 0;
+               take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
+       }
+
+       return 0;
+}
+
+int
+unregister_framebuffer(const struct fb_info *fb_info)
+{
+       int i, j;
+
+       i = GET_FB_IDX(fb_info->node);
+       for (j = 0; j < MAX_NR_CONSOLES; j++)
+               if (con2fb_map[j] == i)
+                       return -EBUSY;
+       if (!registered_fb[i])
+               return -EINVAL; 
+       registered_fb[i]=NULL;
+       num_registered_fb--;
+       return 0;
+}
+
+#ifdef CONFIG_PROC_FS
+static struct proc_dir_entry *proc_fbmem;
+#endif
+
+__initfunc(void
+fbmem_init(void))
+{
+       int i;
+
+#ifdef CONFIG_PROC_FS
+       proc_fbmem = create_proc_entry("fb", 0, 0);
+       if (proc_fbmem)
+               proc_fbmem->read_proc = fbmem_read_proc;
+#endif
+
+       if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
+               printk("unable to get major %d for fb devs\n", FB_MAJOR);
+
+       /*
+        *  Probe for all builtin frame buffer devices
+        */
+       for (i = 0; i < num_pref_init_funcs; i++)
+               pref_init_funcs[i]();
+
+       for (i = 0; i < NUM_FB_DRIVERS; i++)
+               if (fb_drivers[i].init)
+                       fb_drivers[i].init();
+}
+
+
+int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal,
+                       const struct fb_info *fb_info)
+{
+#if 0
+       /*
+        * long long divisions .... $#%%#$ 
+        */
+    unsigned long long hpicos, vpicos;
+    const unsigned long long _1e12 = 1000000000000ULL;
+    const struct fb_monspecs *monspecs = &fb_info->monspecs;
+
+    hpicos = (unsigned long long)htotal*(unsigned long long)pixclock;
+    vpicos = (unsigned long long)vtotal*(unsigned long long)hpicos;
+    if (!vpicos)
+       return 0;
+
+    if (monspecs->hfmin == 0)
+       return 1;
+
+    if (hpicos*monspecs->hfmin > _1e12 || hpicos*monspecs->hfmax < _1e12 ||
+       vpicos*monspecs->vfmin > _1e12 || vpicos*monspecs->vfmax < _1e12)
+       return 0;
+#endif
+    return 1;
+}
+
+int fbmon_dpms(const struct fb_info *fb_info)
+{
+    return fb_info->monspecs.dpms;
+}
+
+
+    /*
+     *  Command line options
+     */
+
+__initfunc(void video_setup(char *options, int *ints))
+{
+    int i, j;
+
+    if (!options || !*options)
+           return;
+           
+    if (!strncmp(options, "map:", 4)) {
+           options += 4;
+           if (*options)
+                   for (i = 0, j = 0; i < MAX_NR_CONSOLES; i++) {
+                           if (!options[j])
+                                   j = 0;
+                           con2fb_map[i] = (options[j++]-'0') % FB_MAX;
+                   }
+           return;
+    }
+
+    if (!strncmp(options, "vc:", 3)) {
+           options += 3;
+           if (*options)
+               first_fb_vc = simple_strtoul(options, &options, 10) - 1;
+           if (first_fb_vc < 0)
+               first_fb_vc = 0;
+           if (*options++ == '-')
+               last_fb_vc = simple_strtoul(options, &options, 10) - 1;
+           fbcon_is_default = 0;
+    }
+
+    if (num_pref_init_funcs == FB_MAX)
+           return;
+
+    for (i = 0; i < NUM_FB_DRIVERS; i++) {
+           j = strlen(fb_drivers[i].name);
+           if (!strncmp(options, fb_drivers[i].name, j) &&
+               options[j] == ':') {
+                   if (!strcmp(options+j+1, "off"))
+                           fb_drivers[i].init = NULL;
+                   else {
+                           if (fb_drivers[i].init) {
+                                   pref_init_funcs[num_pref_init_funcs++] =
+                                           fb_drivers[i].init;
+                                   fb_drivers[i].init = NULL;
+                           }
+                           if (fb_drivers[i].setup)
+                                   fb_drivers[i].setup(options+j+1, ints);
+                   }
+                   return;
+           }
+    }
+    /*
+     * If we get here no fb was specified and we default to pass the
+     * options to the first frame buffer that has an init and a setup
+     * function.
+     */
+    for (i = 0; i < NUM_FB_DRIVERS; i++) {
+           if (fb_drivers[i].init && fb_drivers[i].setup) {
+                   pref_init_funcs[num_pref_init_funcs++] =
+                           fb_drivers[i].init;
+                   fb_drivers[i].init = NULL;
+
+                   fb_drivers[i].setup(options, ints);
+                   return;
+           }
+    }
+}
+
+
+    /*
+     *  Visible symbols for modules
+     */
+
+EXPORT_SYMBOL(register_framebuffer);
+EXPORT_SYMBOL(unregister_framebuffer);
diff --git a/drivers/video/font.h b/drivers/video/font.h
deleted file mode 100644 (file)
index ab4385b..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  font.h -- `Soft' font definitions
- *
- *  Created 1995 by Geert Uytterhoeven
- *
- *  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.
- */
-
-#ifndef _FONT_H_
-#define _FONT_H_
-
-#include <linux/types.h>
-
-struct fbcon_font_desc {
-    int idx;
-    char *name;
-    int width, height;
-    void *data;
-    int pref;
-};
-
-#define VGA8x8_IDX     0
-#define VGA8x16_IDX    1
-#define PEARL8x8_IDX   2
-#define VGA6x11_IDX    3
-#define SUN8x16_IDX    4
-#define SUN12x22_IDX   5
-#define ACORN8x8_IDX   6
-
-extern struct fbcon_font_desc  font_vga_8x8,
-                               font_vga_8x16,
-                               font_pearl_8x8,
-                               font_vga_6x11,
-                               font_sun_8x16,
-                               font_sun_12x22,
-                               font_acorn_8x8;
-
-/* Find a font with a specific name */
-
-extern struct fbcon_font_desc *fbcon_find_font(char *name);
-
-/* Get the default font for a specific screen size */
-
-extern struct fbcon_font_desc *fbcon_get_default_font(int xres, int yres);
-
-/* Max. length for the name of a predefined font */
-#define MAX_FONT_NAME  32
-
-#endif /* _FONT_H_ */
index 88a20e09e41cfef7d020a9fb0bce7073f9ed7b0d..362529c2b65706126b42c0cecfe84bc149b7d07d 100644 (file)
@@ -4,7 +4,7 @@
 /*                                            */
 /**********************************************/
 
-#include "font.h"
+#include <video/font.h>
 
 #define FONTDATAMAX (11*256)
 
index 26a34bce72cb25d2c7475338f4f4d2df95d8d4c3..786619712560d79ab74106e15831e305e08b0067 100644 (file)
@@ -4,7 +4,7 @@
 /*                                            */
 /**********************************************/
 
-#include "font.h"
+#include <video/font.h>
 
 #define FONTDATAMAX 4096
 
index ff0701a680feda68ca115e6cf464bc46fbee9292..6358e671f1cef1c241afee4a7fd07b800ddaa9c8 100644 (file)
@@ -4,7 +4,7 @@
 /*                                            */
 /**********************************************/
 
-#include "font.h"
+#include <video/font.h>
 
 #define FONTDATAMAX 2048
 
index 41acfd5f6611940787848ae20b0331c4b4efefa3..154d0fb39da78adc5c75d117e44cdd55afe05785 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <linux/config.h>
 
-#include "font.h"
+#include <video/font.h>
 
 static unsigned char acorndata_8x8[] = {
 /* 00 */  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */
index 1f4e40fa649504b2f854779ecc804c41cb2ef288..c8d7da5714c550f8b976eca3ff032801dbaf7adf 100644 (file)
@@ -9,7 +9,7 @@
 /*                                            */
 /**********************************************/
 
-#include "font.h"
+#include <video/font.h>
 
 #define FONTDATAMAX 2048
 
index 837e04203685c10d1c7db2a16fe40951a1ca8585..c4cd54c7a486f16a525eb2fe5d3a178673f23803 100644 (file)
@@ -1,4 +1,4 @@
-#include "font.h"
+#include <video/font.h>
 
 #define FONTDATAMAX 5632
 
index 8bf0278073a21ae88cfa5bce4a2fa843971e915e..9f5bc40b47624bf0949a78faf81b7bc0e8514560 100644 (file)
@@ -1,4 +1,4 @@
-#include "font.h"
+#include <video/font.h>
 
 #define FONTDATAMAX 4096
 
index 72f29410a46b6991f3888288bcc11415c2249294..399548730f65667cb36b60d46814f2dc98ed0863 100644 (file)
@@ -16,7 +16,7 @@
 #if defined(__mc68000__) || defined(CONFIG_APUS)
 #include <asm/setup.h>
 #endif
-#include "font.h"
+#include <video/font.h>
 
 #define NO_FONTS
 
diff --git a/drivers/video/macmodes.h b/drivers/video/macmodes.h
deleted file mode 100644 (file)
index e0e90c7..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  linux/drivers/video/macmodes.h -- Standard MacOS video modes
- *
- *     Copyright (C) 1998 Geert Uytterhoeven
- *
- *  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.
- */
-
-
-    /*
-     *  Video mode values.
-     *  These are supposed to be the same as the values that Apple uses in
-     *  MacOS.
-     */
-
-#define VMODE_NVRAM            0
-#define VMODE_512_384_60I      1       /* 512x384, 60Hz interlaced (NTSC) */
-#define VMODE_512_384_60       2       /* 512x384, 60Hz */
-#define VMODE_640_480_50I      3       /* 640x480, 50Hz interlaced (PAL) */
-#define VMODE_640_480_60I      4       /* 640x480, 60Hz interlaced (NTSC) */
-#define VMODE_640_480_60       5       /* 640x480, 60Hz (VGA) */
-#define VMODE_640_480_67       6       /* 640x480, 67Hz */
-#define VMODE_640_870_75P      7       /* 640x870, 75Hz (portrait) */
-#define VMODE_768_576_50I      8       /* 768x576, 50Hz (PAL full frame) */
-#define VMODE_800_600_56       9       /* 800x600, 56Hz */
-#define VMODE_800_600_60       10      /* 800x600, 60Hz */
-#define VMODE_800_600_72       11      /* 800x600, 72Hz */
-#define VMODE_800_600_75       12      /* 800x600, 75Hz */
-#define VMODE_832_624_75       13      /* 832x624, 75Hz */
-#define VMODE_1024_768_60      14      /* 1024x768, 60Hz */
-#define VMODE_1024_768_70      15      /* 1024x768, 70Hz (or 72Hz?) */
-#define VMODE_1024_768_75V     16      /* 1024x768, 75Hz (VESA) */
-#define VMODE_1024_768_75      17      /* 1024x768, 75Hz */
-#define VMODE_1152_870_75      18      /* 1152x870, 75Hz */
-#define VMODE_1280_960_75      19      /* 1280x960, 75Hz */
-#define VMODE_1280_1024_75     20      /* 1280x1024, 75Hz */
-#define VMODE_MAX              20
-#define VMODE_CHOOSE           99
-
-#define CMODE_NVRAM            -1
-#define CMODE_8                        0       /* 8 bits/pixel */
-#define CMODE_16               1       /* 16 (actually 15) bits/pixel */
-#define CMODE_32               2       /* 32 (actually 24) bits/pixel */
-
-
-extern int mac_vmode_to_var(int vmode, int cmode,
-                           struct fb_var_screeninfo *var);
-extern int mac_var_to_vmode(const struct fb_var_screeninfo *var, int *vmode,
-                           int *cmode);
-extern int mac_map_monitor_sense(int sense);
-
-
-    /*
-     *  Addresses in NVRAM where video mode and pixel size are stored.
-     */
-
-#define NV_VMODE               0x140f
-#define NV_CMODE               0x1410
diff --git a/drivers/video/mdacon.c b/drivers/video/mdacon.c
new file mode 100644 (file)
index 0000000..5dc6045
--- /dev/null
@@ -0,0 +1,468 @@
+/*
+ *  linux/drivers/video/mdacon.c -- Low level MDA based console driver
+ *
+ *     (c) 1998 Andrew Apted <ajapted@netspace.net.au>
+ *
+ *  This file is based on the VGA console driver (vgacon.c):
+ *     
+ *     Created 28 Sep 1997 by Geert Uytterhoeven
+ *
+ *     Rewritten by Martin Mares <mj@ucw.cz>, July 1998
+ *
+ *  and on the old console.c, vga.c and vesa_blank.c drivers:
+ *
+ *     Copyright (C) 1991, 1992  Linus Torvalds
+ *                         1995  Jay Estabrook
+ *
+ *  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/types.h>
+#include <linux/sched.h>
+#include <linux/fs.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/tty.h>
+#include <linux/console.h>
+#include <linux/console_struct.h>
+#include <linux/string.h>
+#include <linux/kd.h>
+#include <linux/malloc.h>
+#include <linux/vt_kern.h>
+#include <linux/vt_buffer.h>
+#include <linux/selection.h>
+#include <linux/ioport.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+#include <asm/vga.h>
+
+
+/* description of the hardware layout */
+
+static unsigned long   mda_vram_base;          /* Base of video memory */
+static unsigned long   mda_vram_len;           /* Size of video memory */
+static unsigned int    mda_num_columns;        /* Number of text columns */
+static unsigned int    mda_num_lines;          /* Number of text lines */
+
+static unsigned int    mda_index_port;         /* Register select port */
+static unsigned int    mda_value_port;         /* Register value port */
+static unsigned int    mda_mode_port;          /* Mode control port */
+
+/* current hardware state */
+
+static int     mda_origin_loc=-1;
+static int     mda_cursor_loc=-1;
+static int     mda_cursor_size_from=-1;
+static int     mda_cursor_size_to=-1;
+
+/* console information */
+
+static int     mda_first_vc = 12;
+static int     mda_last_vc  = 15;
+
+static struct vc_data  *mda_display_fg = NULL;
+
+#ifdef MODULE_PARM
+MODULE_PARM(mda_first_vc, "0-255i");
+MODULE_PARM(mda_last_vc,  "0-255i");
+#endif
+
+
+/*
+ * MDA could easily be classified as "pre-dinosaur hardware".
+ */
+
+static void write_mda_b(unsigned char reg, unsigned int val)
+{
+       unsigned long flags;
+
+       save_flags(flags); cli();
+
+       outb_p(reg, mda_index_port); 
+       outb_p(val, mda_value_port);
+
+       restore_flags(flags);
+}
+
+static void write_mda_w(unsigned char reg, unsigned int val)
+{
+       unsigned long flags;
+
+       save_flags(flags); cli();
+
+       outb_p(reg,   mda_index_port); outb_p(val>>8,   mda_value_port);
+       outb_p(reg+1, mda_index_port); outb_p(val&0xff, mda_value_port);
+
+       restore_flags(flags);
+}
+
+static inline void mda_set_origin(unsigned int location)
+{
+       if (mda_origin_loc == location)
+               return;
+
+       write_mda_w(0x0c, location >> 1);
+
+       mda_origin_loc = location;
+}
+
+static inline void mda_set_cursor(unsigned int location) 
+{
+       if (mda_cursor_loc == location)
+               return;
+
+       write_mda_w(0x0e, location >> 1);
+
+       mda_cursor_loc = location;
+}
+
+static inline void mda_set_cursor_size(int from, int to)
+{
+       if (mda_cursor_size_from==from && mda_cursor_size_to==to)
+               return;
+       
+       if (from > to) {
+               write_mda_b(0x0a, 0x20);        /* disable cursor */
+       } else {
+               write_mda_b(0x0a, from);        /* cursor start */
+               write_mda_b(0x0b, to);          /* cursor end */
+       }
+
+       mda_cursor_size_from = from;
+       mda_cursor_size_to   = to;
+}
+
+
+#ifndef MODULE
+__initfunc(void mdacon_setup(char *str, int *ints))
+{
+       /* command line format: mdacon=<first>,<last> */
+
+       if (ints[0] < 2)
+               return;
+
+       if (ints[1] < 0 || ints[1] >= MAX_NR_CONSOLES || 
+           ints[2] < 0 || ints[2] >= MAX_NR_CONSOLES)
+               return;
+
+       mda_first_vc = ints[1];
+       mda_last_vc  = ints[2];
+}
+#endif
+
+#ifdef MODULE
+static const char *mdacon_startup(void)
+#else
+__initfunc(static const char *mdacon_startup(void))
+#endif
+{
+       int count=0;
+       u16 saved;
+       u16 *p;
+
+       mda_num_columns = 80;
+       mda_num_lines   = 25;
+
+       mda_vram_base = VGA_MAP_MEM(0xb0000);
+       mda_vram_len  = 0x01000;
+
+       mda_index_port = 0x3b4;
+       mda_value_port = 0x3b5;
+       mda_mode_port  = 0x3b8;
+
+       /*  Make sure there is an MDA card present.
+        *  Are there smarter methods around?
+        */
+
+       p = (u16 *) mda_vram_base;
+       saved = scr_readw(p);
+
+       scr_writew(0xAA55, p); if (scr_readw(p) == 0xAA55) count++;
+       scr_writew(0x55AA, p); if (scr_readw(p) == 0x55AA) count++;
+       scr_writew(saved, p);
+
+       if (count != 2) {
+               printk("mdacon: MDA card not detected.");
+               return NULL;
+       }
+
+       printk("mdacon: MDA with %ldK of memory detected.\n",
+               mda_vram_len/1024);
+
+       return "MDA-2";
+}
+
+static void mdacon_init(struct vc_data *c, int init)
+{
+       c->vc_complement_mask = 0x0800;  /* reverse video */
+       c->vc_display_fg = &mda_display_fg;
+
+       if (init) {
+               c->vc_cols = mda_num_columns;
+               c->vc_rows = mda_num_lines;
+       } else {
+               vc_resize_con(mda_num_lines, mda_num_columns, c->vc_num);
+        }
+       
+       /* make the first MDA console visible */
+
+       if (mda_display_fg == NULL)
+               mda_display_fg = c;
+
+       MOD_INC_USE_COUNT;
+}
+
+static void mdacon_deinit(struct vc_data *c)
+{
+       /* con_set_default_unimap(c->vc_num); */
+
+       if (mda_display_fg == c)
+               mda_display_fg = NULL;
+
+       MOD_DEC_USE_COUNT;
+}
+
+static inline u16 mda_convert_attr(u16 ch)
+{
+       u16 attr = 0x0700;
+
+       /* Underline and reverse-video are mutually exclusive on MDA.
+        * Since reverse-video is used for cursors and selected areas,
+        * it takes precedence. 
+        */
+
+       if (ch & 0x0800)        attr = 0x7000;  /* reverse */
+       else if (ch & 0x0400)   attr = 0x0100;  /* underline */
+
+       return ((ch & 0x0200) << 2) |           /* intensity */ 
+               (ch & 0x8000) |                 /* blink */ 
+               (ch & 0x00ff) | attr;
+}
+
+static u8 mdacon_build_attr(struct vc_data *c, u8 color, u8 intensity, 
+                           u8 blink, u8 underline, u8 reverse)
+{
+       /* The attribute is just a bit vector:
+        *
+        *      Bit 0..1 : intensity (0..2)
+        *      Bit 2    : underline
+        *      Bit 3    : reverse
+        *      Bit 7    : blink
+        */
+
+       return (intensity & 3) |
+               ((underline & 1) << 2) |
+               ((reverse   & 1) << 3) |
+               ((blink     & 1) << 7);
+}
+
+static void mdacon_invert_region(struct vc_data *c, u16 *p, int count)
+{
+       for (; count > 0; count--) {
+               scr_writew(scr_readw(p) ^ 0x0800, p++);
+       }
+}
+
+#define MDA_ADDR(x,y)  ((u16 *) mda_vram_base + (y)*mda_num_columns + (x))
+
+static void mdacon_putc(struct vc_data *c, int ch, int y, int x)
+{
+       scr_writew(mda_convert_attr(ch), MDA_ADDR(x, y));
+}
+
+static void mdacon_putcs(struct vc_data *c, const unsigned short *s,
+                        int count, int y, int x)
+{
+       u16 *dest = MDA_ADDR(x, y);
+
+       for (; count > 0; count--) {
+               scr_writew(mda_convert_attr(*s++), dest++);
+       }
+}
+
+static void mdacon_clear(struct vc_data *c, int y, int x, 
+                         int height, int width)
+{
+       u16 *dest = MDA_ADDR(x, y);
+       u16 eattr = mda_convert_attr(c->vc_video_erase_char);
+
+       if (width <= 0 || height <= 0)
+               return;
+
+       if (x==0 && width==mda_num_columns) {
+               scr_memsetw(dest, eattr, height*width*2);
+       } else {
+               for (; height > 0; height--, dest+=mda_num_columns)
+                       scr_memsetw(dest, eattr, width*2);
+       }
+}
+                        
+static void mdacon_bmove(struct vc_data *c, int sy, int sx, 
+                        int dy, int dx, int height, int width)
+{
+       u16 *src, *dest;
+
+       if (width <= 0 || height <= 0)
+               return;
+               
+       if (sx==0 && dx==0 && width==mda_num_columns) {
+               scr_memmovew(MDA_ADDR(0,dy), MDA_ADDR(0,sy), height*width*2);
+
+       } else if (dy < sy || (dy == sy && dx < sx)) {
+               src  = MDA_ADDR(sx, sy);
+               dest = MDA_ADDR(dx, dy);
+
+               for (; height > 0; height--) {
+                       scr_memmovew(dest, src, width*2);
+                       src  += mda_num_columns;
+                       dest += mda_num_columns;
+               }
+       } else {
+               src  = MDA_ADDR(sx, sy+height-1);
+               dest = MDA_ADDR(dx, dy+height-1);
+
+               for (; height > 0; height--) {
+                       scr_memmovew(dest, src, width*2);
+                       src  -= mda_num_columns;
+                       dest -= mda_num_columns;
+               }
+       }
+}
+
+static int mdacon_switch(struct vc_data *c)
+{
+       return 1;       /* redrawing needed */
+}
+
+static int mdacon_set_palette(struct vc_data *c, unsigned char *table)
+{
+       return -EINVAL;
+}
+
+static int mdacon_blank(struct vc_data *c, int blank)
+{
+       if (blank) {
+               outb_p(0x00, mda_mode_port);    /* disable video */
+       } else {
+               outb_p(0x28, mda_mode_port);    /* enable video & blinking */
+       }
+       
+       return 0;
+}
+
+static int mdacon_font_op(struct vc_data *c, struct console_font_op *op)
+{
+       return -ENOSYS;
+}
+
+static int mdacon_scrolldelta(struct vc_data *c, int lines)
+{
+       return 0;
+}
+
+static void mdacon_cursor(struct vc_data *c, int mode)
+{
+       if (mode == CM_ERASE) {
+               mda_set_cursor(mda_vram_len - 1);
+               return;
+       }
+
+       mda_set_cursor(c->vc_y*mda_num_columns*2 + c->vc_x*2);
+
+       switch (c->vc_cursor_type & 0x0f) {
+
+               case CUR_LOWER_THIRD:   mda_set_cursor_size(10, 13); break;
+               case CUR_LOWER_HALF:    mda_set_cursor_size(7,  13); break;
+               case CUR_TWO_THIRDS:    mda_set_cursor_size(4,  13); break;
+               case CUR_BLOCK:         mda_set_cursor_size(1,  13); break;
+               case CUR_NONE:          mda_set_cursor_size(14, 13); break;
+               default:                mda_set_cursor_size(12, 13); break;
+    }
+}
+
+static int mdacon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
+{
+       u16 eattr = mda_convert_attr(c->vc_video_erase_char);
+
+       if (!lines)
+               return 0;
+
+       if (lines > c->vc_rows)   /* maximum realistic size */
+               lines = c->vc_rows;
+
+       switch (dir) {
+
+       case SM_UP:
+               scr_memmovew(MDA_ADDR(0,t), MDA_ADDR(0,t+lines),
+                               (b-t-lines)*mda_num_columns*2);
+               scr_memsetw(MDA_ADDR(0,b-lines), eattr,
+                               lines*mda_num_columns*2);
+               break;
+
+       case SM_DOWN:
+               scr_memmovew(MDA_ADDR(0,t+lines), MDA_ADDR(0,t),
+                               (b-t-lines)*mda_num_columns*2);
+               scr_memsetw(MDA_ADDR(0,t), eattr, lines*mda_num_columns*2);
+               break;
+       }
+
+       return 0;
+}
+
+
+/*
+ *  The console `switch' structure for the MDA based console
+ */
+
+struct consw mda_con = {
+       mdacon_startup,         /* con_startup */
+       mdacon_init,            /* con_init */
+       mdacon_deinit,          /* con_deinit */
+       mdacon_clear,           /* con_clear */
+       mdacon_putc,            /* con_putc */
+       mdacon_putcs,           /* con_putcs */
+       mdacon_cursor,          /* con_cursor */
+       mdacon_scroll,          /* con_scroll */
+       mdacon_bmove,           /* con_bmove */
+       mdacon_switch,          /* con_switch */
+       mdacon_blank,           /* con_blank */
+       mdacon_font_op,         /* con_font_op */
+       mdacon_set_palette,     /* con_set_palette */
+       mdacon_scrolldelta,     /* con_scrolldelta */
+       NULL,                   /* con_set_origin */
+       NULL,                   /* con_save_screen */
+       mdacon_build_attr,      /* con_build_attr */
+       mdacon_invert_region,   /* con_invert_region */
+};
+
+#ifdef MODULE
+void mda_console_init(void)
+#else
+__initfunc(void mda_console_init(void))
+#endif
+{
+       if (mda_first_vc > mda_last_vc)
+               return;
+
+       take_over_console(&mda_con, mda_first_vc, mda_last_vc, 0);
+}
+
+#ifdef MODULE
+
+int init_module(void)
+{
+       mda_console_init();
+
+       return 0;
+}
+
+void cleanup_module(void)
+{
+       give_up_console(&mda_con);
+}
+
+#endif
diff --git a/drivers/video/mdafb.c b/drivers/video/mdafb.c
deleted file mode 100644 (file)
index 35190d5..0000000
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- *  linux/drivers/video/mdafb.c -- MDA frame buffer device
- *
- *     Adapted from vgafb, May 1998 by Andrew Apted
- *
- *  This file is based on vgacon.c and vgafb.c.  Read about their
- *  contributors there.
- *
- *  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.
- */
-
-
-/* KNOWN PROBLEMS/TO DO ==================================================== *
- *
- *     -  detecting amount of memory is not yet implemented
- *
- * ========================================================================= */
-
-
-#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/malloc.h>
-#include <linux/vmalloc.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/fb.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/console.h>
-#include <linux/selection.h>
-
-#include <asm/io.h>
-#include <asm/uaccess.h>
-
-#include "fbcon.h"
-#include "fbcon-vga.h"
-
-
-#ifdef __powerpc__
-#define VGA_OFFSET _ISA_MEM_BASE;
-#else
-#define VGA_OFFSET 0x0
-#endif
-
-
-static int mda_font_height = 16;   /* !!! */
-
-
-static int currcon = 0;
-static struct display disp;
-static struct fb_info fb_info;
-
-static struct fb_fix_screeninfo fb_fix = { { 0, } };
-static struct fb_var_screeninfo fb_var = { 0, };
-
-
-/* Description of the hardware situation */
-static unsigned char mda_video_type;
-static unsigned long mda_video_mem_base;       /* Base of video memory */
-static unsigned long mda_video_mem_len;                /* End of video memory */
-static u16 mda_video_port_reg;                 /* Video register select port */
-static u16 mda_video_port_val;                 /* Video register value port */
-static unsigned long mda_video_num_columns;    /* Number of text columns */
-static unsigned long mda_video_num_lines;      /* Number of text lines */
-
-
-    /*
-     *  MDA screen access
-     */ 
-
-static inline void mda_writew(u16 val, u16 *addr)
-{
-#ifdef __powerpc__
-       st_le16(addr, val);
-#else
-       writew(val, (unsigned long)addr);
-#endif /* !__powerpc__ */
-}
-
-static inline u16 mda_readw(u16 *addr)
-{
-#ifdef __powerpc__
-       return ld_le16(addr);
-#else
-       return readw((unsigned long)addr);
-#endif /* !__powerpc__ */      
-}
-
-
-static inline void write_mda(unsigned char reg, unsigned int val)
-{
-       unsigned long flags;
-
-       save_flags(flags); cli();
-
-       outb(reg, mda_video_port_reg);
-       outb(val >> 8, mda_video_port_val);
-       outb(reg+1, mda_video_port_reg);
-       outb(val & 0xff, mda_video_port_val);
-
-       restore_flags(flags);
-}
-
-static inline void mda_set_origin(unsigned short location)
-{
-       write_mda(12, location >> 1);
-}
-
-static inline void mda_set_cursor(int location) 
-{
-       write_mda(14, location >> 1);
-}
-
-
-    /*
-     *  Move hardware mda cursor
-     */
-    
-void fbcon_mdafb_cursor(struct display *p, int mode, int x, int y)
-{
-       switch (mode) {
-               case CM_ERASE:
-                       mda_set_cursor(mda_video_mem_len - 1);
-                       break;
-
-               case CM_MOVE:
-               case CM_DRAW:
-                       mda_set_cursor(y*p->next_line + (x << 1));
-                       break;
-       }
-}
-
-
-    /*
-     *  Interface to the low level console driver
-     */
-
-void mdafb_setup(char *options, int *ints);
-static int mdafbcon_switch(int con, struct fb_info *info);
-static int mdafbcon_updatevar(int con, struct fb_info *info);
-static void mdafbcon_blank(int blank, struct fb_info *info);
-
-
-    /*
-     *  Open/Release the frame buffer device
-     */
-
-static int mdafb_open(struct fb_info *info, int user)
-{
-       MOD_INC_USE_COUNT;
-       return 0;
-}
-
-static int mdafb_release(struct fb_info *info, int user)
-{
-       MOD_DEC_USE_COUNT;
-       return 0;
-}
-
-
-    /*
-     *  Get the Fixed Part of the Display
-     */
-
-static int mdafb_get_fix(struct fb_fix_screeninfo *fix, int con,
-                        struct fb_info *info)
-{
-       memcpy(fix, &fb_fix, sizeof(fb_fix));
-       return 0;
-}
-
-
-    /*
-     *  Get the User Defined Part of the Display
-     */
-
-static int mdafb_get_var(struct fb_var_screeninfo *var, int con,
-                        struct fb_info *info)
-{
-       memcpy(var, &fb_var, sizeof(fb_var));
-       return 0;
-}
-
-
-    /*
-     *  Set the User Defined Part of the Display
-     */
-
-static int mdafb_set_var(struct fb_var_screeninfo *var, int con,
-                        struct fb_info *info)
-{
-    struct display *display;
-
-    if (con >= 0)
-       display = &fb_display[con];
-    else
-       display = &disp;        /* used during initialization */
-
-    if (var->xres > fb_var.xres || var->yres > fb_var.yres ||
-       var->xres_virtual > fb_var.xres_virtual ||
-       var->yres_virtual > fb_var.yres_virtual ||
-       var->bits_per_pixel > fb_var.bits_per_pixel ||
-       var->nonstd || !(var->accel_flags & FB_ACCELF_TEXT) ||
-       (var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED)
-       return -EINVAL;
-
-    memcpy(var, &fb_var, sizeof(fb_var));
-
-    if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
-       display->var = *var;
-       mda_set_origin(var->yoffset/mda_font_height*fb_fix.line_length);
-    }
-
-    return 0;
-}
-
-
-    /*
-     *  Pan or Wrap the Display
-     *
-     *  This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
-     */
-
-static int mdafb_pan_display(struct fb_var_screeninfo *var, int con,
-                            struct fb_info *info)
-{
-       if (var->xoffset || var->yoffset+var->yres > var->yres_virtual)
-               return -EINVAL;
-
-       mda_set_origin(var->yoffset/mda_font_height*fb_fix.line_length);
-       return 0;
-}
-
-
-    /*
-     *  Get the Colormap
-     */
-
-static int mdafb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
-                         struct fb_info *info)
-{
-       /* MDA is simply black and white */
-
-       return 0;
-}
-
-
-    /*
-     *  Set the Colormap
-     */
-
-static int mdafb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
-                         struct fb_info *info)
-{
-       /* MDA is simply black and white */
-
-       return 0;
-}
-
-
-static int mdafb_ioctl(struct inode *inode, struct file *file, u_int cmd,
-                      u_long arg, int con, struct fb_info *info)
-{
-       return -EINVAL;
-}
-
-    /*
-     *  Interface used by the world
-     */
-
-static struct fb_ops mdafb_ops = {
-       mdafb_open, mdafb_release, mdafb_get_fix, mdafb_get_var,
-       mdafb_set_var, mdafb_get_cmap, mdafb_set_cmap, mdafb_pan_display, 
-       mdafb_ioctl
-};
-
-    /*
-     *  MDA text console with hardware cursor
-     */
-
-static struct display_switch fbcon_mdafb = {
-    fbcon_vga_setup, fbcon_vga_bmove, fbcon_vga_clear, fbcon_vga_putc,
-    fbcon_vga_putcs, fbcon_vga_revc, fbcon_mdafb_cursor, NULL, NULL,
-    FONTWIDTH(8)
-};
-
-
-    /*
-     *  Initialisation
-     */
-
-__initfunc(void mdafb_init(void))
-{
-    u16 saved;
-    u16 *p;
-
-    mda_video_num_lines = 25;
-    mda_video_num_columns = 80;
-    mda_video_type = VIDEO_TYPE_MDA;
-    mda_video_mem_base = 0xb0000 + VGA_OFFSET;
-    mda_video_mem_len  = 0x01000;
-    mda_video_port_reg = 0x3b4;
-    mda_video_port_val = 0x3b5;
-
-    strcpy(fb_fix.id, "MDA-Dual-Head");
-    request_region(0x3b0, 12, "mda-2");
-    request_region(0x3bf, 1, "mda-2");
-
-    /*
-     * Find out if there is a graphics card present.
-     * Are there smarter methods around?
-     */
-    p = (u16 *)mda_video_mem_base;
-    saved = mda_readw(p);
-    mda_writew(0xAA55, p);
-    if (mda_readw(p) != 0xAA55) {
-       mda_writew(saved, p);
-       return;
-    }
-    mda_writew(0x55AA, p);
-    if (mda_readw(p) != 0x55AA) {
-       mda_writew(saved, p);
-       return;
-    }
-    mda_writew(saved, p);
-
-    fb_fix.smem_start = (char *) mda_video_mem_base;
-    fb_fix.smem_len = mda_video_mem_len;
-    fb_fix.type = FB_TYPE_TEXT;
-    fb_fix.type_aux = FB_AUX_TEXT_MDA;
-    fb_fix.visual = FB_VISUAL_PSEUDOCOLOR;
-    fb_fix.ypanstep = mda_font_height;
-    fb_fix.xpanstep = 0;
-    fb_fix.ywrapstep = 0;
-    fb_fix.line_length = 2 * mda_video_num_columns;
-    fb_fix.mmio_start = NULL;
-    fb_fix.mmio_len = 0;
-    fb_fix.accel = FB_ACCEL_NONE;
-
-    fb_var.xres = mda_video_num_columns*8;
-    fb_var.yres = mda_video_num_lines * mda_font_height;
-    fb_var.xres_virtual = fb_var.xres;
-    /* the cursor is put at the end of the video memory, hence the -2 */
-    fb_var.yres_virtual = ((fb_fix.smem_len-2)/fb_fix.line_length)*
-                         mda_font_height;
-
-    fb_var.xoffset = fb_var.yoffset = 0;
-    fb_var.bits_per_pixel = 1;
-    fb_var.grayscale = 1;
-    fb_var.red.offset = 0;
-    fb_var.red.length = 0;
-    fb_var.red.msb_right = 0;
-    fb_var.green.offset = 0;
-    fb_var.green.length = 0;
-    fb_var.green.msb_right = 0;
-    fb_var.blue.offset = 0;
-    fb_var.blue.length = 0;
-    fb_var.blue.msb_right = 0;
-    fb_var.transp.offset = 0;
-    fb_var.transp.length = 0;
-    fb_var.transp.msb_right = 0;
-    fb_var.nonstd = 0;
-    fb_var.activate = 0;
-    fb_var.height = fb_var.width = -1;
-    fb_var.accel_flags = FB_ACCELF_TEXT;
-    fb_var.pixclock = 39722;           /* 25.175 MHz */
-    fb_var.left_margin = 40;
-    fb_var.right_margin = 24;
-    fb_var.upper_margin = 39;
-    fb_var.lower_margin = 9;
-    fb_var.hsync_len = 96;
-    fb_var.vsync_len = 2;
-    fb_var.sync = 0;
-    fb_var.vmode = FB_VMODE_NONINTERLACED;
-
-    disp.var = fb_var;
-    disp.cmap.start = 0;
-    disp.cmap.len = 0;
-    disp.cmap.red = NULL;
-    disp.cmap.green = NULL;
-    disp.cmap.blue = NULL;
-    disp.cmap.transp = NULL;
-
-#ifdef __i386__
-    disp.screen_base = ioremap((unsigned long) fb_fix.smem_start, 
-                               fb_fix.smem_len);
-#else
-    disp.screen_base = bus_to_virt((unsigned long) fb_fix.smem_start);
-#endif
-    disp.visual = fb_fix.visual;
-    disp.type = fb_fix.type;
-    disp.type_aux = fb_fix.type_aux;
-    disp.ypanstep = fb_fix.ypanstep;
-    disp.ywrapstep = fb_fix.ywrapstep;
-    disp.line_length = fb_fix.line_length;
-    disp.can_soft_blank = 1;
-    disp.inverse = 0;
-    disp.dispsw = &fbcon_mdafb;
-
-    strcpy(fb_info.modename, fb_fix.id);
-    fb_info.node = -1;
-    fb_info.fbops = &mdafb_ops;
-    fb_info.disp = &disp;
-    fb_info.fontname[0] = '\0';
-    fb_info.changevar = NULL;
-    fb_info.switch_con = &mdafbcon_switch;
-    fb_info.updatevar = &mdafbcon_updatevar;
-    fb_info.blank = &mdafbcon_blank;
-
-    mdafb_set_var(&fb_var, -1, &fb_info);
-
-    if (register_framebuffer(&fb_info) < 0)
-       return;
-
-    printk("fb%d: MDA frame buffer device, using %dK of video memory\n",
-          GET_FB_IDX(fb_info.node), fb_fix.smem_len>>10);
-}
-
-__initfunc(void mdafb_setup(char *options, int *ints))
-{
-       /* nothing yet */
-}
-
-    /*
-     *  Update the `var' structure (called by fbcon.c)
-     */
-
-static int mdafbcon_updatevar(int con, struct fb_info *info)
-{
-       if (con == currcon) {
-               struct fb_var_screeninfo *var = &fb_display[currcon].var;
-
-               /* hardware scrolling */
-
-               mda_set_origin(var->yoffset / mda_font_height *
-                       fb_fix.line_length);
-       }
-
-       return 0;
-}
-
-static int mdafbcon_switch(int con, struct fb_info *info)
-{
-       currcon = con;
-       mdafbcon_updatevar(con, info);
-       return 0;
-}
-
-    /*
-     *  Blank the display.
-     */
-
-static void mdafbcon_blank(int blank, struct fb_info *info)
-{
-       if (blank) {
-               outb_p(0x00, 0x3b8);  /* disable video */
-       } else {
-               outb_p(0x08, 0x3b8);  /* enable video */
-       }
-}
-
-
-#ifdef MODULE
-int init_module(void)
-{
-       mdafb_init();
-       return 0;
-}
-
-void cleanup_module(void)
-{
-       unregister_framebuffer(&fb_info);
-}
-#endif /* MODULE */
diff --git a/drivers/video/s3blit.h b/drivers/video/s3blit.h
deleted file mode 100644 (file)
index ef93407..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/* s3 commands */
-#define S3_BITBLT       0xc011
-#define S3_TWOPOINTLINE 0x2811
-#define S3_FILLEDRECT   0x40b1
-
-#define S3_FIFO_EMPTY 0x0400
-#define S3_HDW_BUSY   0x0200
-
-/* Enhanced register mapping (MMIO mode) */
-
-#define S3_READ_SEL      0xbee8 /* offset f */
-#define S3_MULT_MISC     0xbee8 /* offset e */
-#define S3_ERR_TERM      0x92e8
-#define S3_FRGD_COLOR    0xa6e8
-#define S3_BKGD_COLOR    0xa2e8
-#define S3_PIXEL_CNTL    0xbee8 /* offset a */
-#define S3_FRGD_MIX      0xbae8
-#define S3_BKGD_MIX      0xb6e8
-#define S3_CUR_Y         0x82e8
-#define S3_CUR_X         0x86e8
-#define S3_DESTY_AXSTP   0x8ae8
-#define S3_DESTX_DIASTP  0x8ee8
-#define S3_MIN_AXIS_PCNT 0xbee8 /* offset 0 */
-#define S3_MAJ_AXIS_PCNT 0x96e8
-#define S3_CMD           0x9ae8
-#define S3_GP_STAT       0x9ae8
-#define S3_ADVFUNC_CNTL  0x4ae8
-#define S3_WRT_MASK      0xaae8
-#define S3_RD_MASK       0xaee8
-
-/* Enhanced register mapping (Packed MMIO mode, write only) */
-#define S3_ALT_CURXY     0x8100
-#define S3_ALT_CURXY2    0x8104
-#define S3_ALT_STEP      0x8108
-#define S3_ALT_STEP2     0x810c
-#define S3_ALT_ERR       0x8110
-#define S3_ALT_CMD       0x8118
-#define S3_ALT_MIX       0x8134
-#define S3_ALT_PCNT      0x8148
-#define S3_ALT_PAT       0x8168
-
-/* Drawing modes */
-#define S3_NOTCUR          0x0000
-#define S3_LOGICALZERO     0x0001
-#define S3_LOGICALONE      0x0002
-#define S3_LEAVEASIS       0x0003
-#define S3_NOTNEW          0x0004
-#define S3_CURXORNEW       0x0005
-#define S3_NOT_CURXORNEW   0x0006
-#define S3_NEW             0x0007
-#define S3_NOTCURORNOTNEW  0x0008
-#define S3_CURORNOTNEW     0x0009
-#define S3_NOTCURORNEW     0x000a
-#define S3_CURORNEW        0x000b
-#define S3_CURANDNEW       0x000c
-#define S3_NOTCURANDNEW    0x000d
-#define S3_CURANDNOTNEW    0x000e
-#define S3_NOTCURANDNOTNEW 0x000f
-
-#define S3_CRTC_ADR    0x03d4
-#define S3_CRTC_DATA   0x03d5
-
-#define S3_REG_LOCK2 0x39
-#define S3_HGC_MODE  0x45
-
-#define S3_HWGC_ORGX_H 0x46
-#define S3_HWGC_ORGX_L 0x47
-#define S3_HWGC_ORGY_H 0x48
-#define S3_HWGC_ORGY_L 0x49
-#define S3_HWGC_DX     0x4e
-#define S3_HWGC_DY     0x4f
-
-
-#define S3_LAW_CTL 0x58
diff --git a/drivers/video/sbusfb.h b/drivers/video/sbusfb.h
deleted file mode 100644 (file)
index f65ca1d..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-#include <asm/sbus.h>
-#include <asm/oplib.h>
-#include <asm/fbio.h>
-
-#include "fbcon.h"
-
-struct bt_regs {
-       volatile unsigned int addr;           /* address register */
-       volatile unsigned int color_map;      /* color map */
-       volatile unsigned int control;        /* control register */
-       volatile unsigned int cursor;         /* cursor map register */
-};
-
-struct fb_info_creator {
-       struct ffb_fbc *fbc;
-       struct ffb_dac *dac;
-       int dac_rev;
-       int xy_margin;
-};
-struct fb_info_cgsix {
-       struct bt_regs *bt;
-       struct cg6_fbc *fbc;
-       struct cg6_thc *thc;
-       struct cg6_tec *tec;
-       volatile u32 *fhc;
-};
-struct fb_info_bwtwo {
-       struct bw2_regs *regs;
-};
-struct fb_info_cgthree {
-       struct cg3_regs *regs;
-};
-struct fb_info_tcx {
-       struct bt_regs *bt;
-       struct tcx_thc *thc;
-       struct tcx_tec *tec;
-       u32 *cplane;
-};
-
-struct cg_cursor {
-       short   enable;         /* cursor is enabled */
-       struct  fbcurpos cpos;  /* position */
-       struct  fbcurpos chot;  /* hot-spot */
-       struct  fbcurpos size;  /* size of mask & image fields */
-       struct  fbcurpos hwsize; /* hw max size */
-       int     bits[2][128];   /* space for mask & image bits */
-       char    color [6];      /* cursor colors */
-};
-
-struct sbus_mmap_map {
-       unsigned long voff;
-       unsigned long poff;
-       unsigned long size;
-};
-
-#define SBUS_MMAP_FBSIZE(n) (-n)
-#define SBUS_MMAP_EMPTY        0x80000000
-
-struct fb_info_sbusfb {
-       struct fb_info info;
-       struct fb_fix_screeninfo fix;
-       struct fb_var_screeninfo var;
-       struct display disp;
-       struct display_switch dispsw;
-       struct fbtype type;
-       struct linux_sbus_device *sbdp;
-       int prom_node, prom_parent;
-       union {
-               struct fb_info_creator ffb;
-               struct fb_info_cgsix cg6;
-               struct fb_info_bwtwo bw2;
-               struct fb_info_cgthree cg3;
-               struct fb_info_tcx tcx;
-       } s;
-       unsigned char *color_map;
-       struct cg_cursor cursor;
-       unsigned char hw_cursor_shown;
-       unsigned char open;
-       unsigned char mmaped;
-       unsigned char blanked;
-       int x_margin;
-       int y_margin;
-       int vtconsole;
-       int consolecnt;
-       int emulations[4];
-       struct sbus_mmap_map *mmap_map;
-       unsigned long physbase;
-       int iospace;
-       /* Methods */
-       void (*setup)(struct display *);
-       void (*setcursor)(struct fb_info_sbusfb *);
-       void (*setcurshape)(struct fb_info_sbusfb *);
-       void (*setcursormap)(struct fb_info_sbusfb *, unsigned char *, unsigned char *, unsigned char *);
-       void (*loadcmap)(struct fb_info_sbusfb *, int, int);
-       void (*blank)(struct fb_info_sbusfb *);
-       void (*unblank)(struct fb_info_sbusfb *);
-       void (*margins)(struct fb_info_sbusfb *, struct display *, int, int);
-       void (*reset)(struct fb_info_sbusfb *);
-       void (*fill)(struct fb_info_sbusfb *, struct display *, int, int, unsigned short *);
-       void (*switch_from_graph)(struct fb_info_sbusfb *);
-       void (*restore_palette)(struct fb_info_sbusfb *);
-};
-
-extern char *creatorfb_init(struct fb_info_sbusfb *);
-extern char *cgsixfb_init(struct fb_info_sbusfb *);
-extern char *cgthreefb_init(struct fb_info_sbusfb *);
-extern char *tcxfb_init(struct fb_info_sbusfb *);
-extern char *leofb_init(struct fb_info_sbusfb *);
-extern char *bwtwofb_init(struct fb_info_sbusfb *);
-extern char *cgfourteenfb_init(struct fb_info_sbusfb *);
-
-#define sbusfbinfod(disp) ((struct fb_info_sbusfb *)(disp->fb_info))
-#define sbusfbinfo(info) ((struct fb_info_sbusfb *)(info))
-#define CM(i, j) [3*(i)+(j)]
-
-#define SBUSFBINIT_SIZECHANGE ((char *)-1)
index 1831e6b33de2214cc9a868e9db6650102d73e84b..f10840d79af70523027cca0132db4e1990ba2a5a 100644 (file)
@@ -17,8 +17,9 @@
 #include <linux/malloc.h>
 #include <linux/delay.h>
 #include <linux/fb.h>
+#include <linux/init.h>
 
-#include "fbcon.h"
+#include <video/fbcon.h>
 
 
     /*
@@ -83,13 +84,15 @@ static void xxx_detect(void)
      *  it as the default video mode
      */
 
+    struct xxxfb_par par;
+
     /* ... */
     xxx_get_par(&par);
     xxx_encode_var(&default_var, &par);
 }
 
 static int xxx_encode_fix(struct fb_fix_screeninfo *fix, struct xxxfb_par *par,
-                         const struct fb_info *fb_info)
+                         const struct fb_info *info)
 {
     /*
      *  This function should fill in the 'fix' structure based on the values
@@ -101,7 +104,7 @@ static int xxx_encode_fix(struct fb_fix_screeninfo *fix, struct xxxfb_par *par,
 }
 
 static int xxx_decode_var(struct fb_var_screeninfo *var, struct xxxfb_par *par,
-                         const struct fb_info *fb_info)
+                         const struct fb_info *info)
 {
     /*
      *  Get the video params out of 'var'. If a value doesn't fit, round it up,
@@ -122,7 +125,7 @@ static int xxx_decode_var(struct fb_var_screeninfo *var, struct xxxfb_par *par,
 }
 
 static int xxx_encode_var(struct fb_var_screeninfo *var, struct xxxfb_par *par,
-                         const struct fb_info *fb_info)
+                         const struct fb_info *info)
 {
     /*
      *  Fill the 'var' structure based on the values in 'par' and maybe other
@@ -133,7 +136,7 @@ static int xxx_encode_var(struct fb_var_screeninfo *var, struct xxxfb_par *par,
     return 0;
 }
 
-static void xxx_get_par(struct xxxfb_par *par, const struct fb_info *fb_info)
+static void xxx_get_par(struct xxxfb_par *par, const struct fb_info *info)
 {
     /*
      *  Fill the hardware's 'par' structure.
@@ -146,7 +149,7 @@ static void xxx_get_par(struct xxxfb_par *par, const struct fb_info *fb_info)
     }
 }
 
-static void xxx_set_par(struct xxxfb_par *par, const struct fb_info *fb_info)
+static void xxx_set_par(struct xxxfb_par *par, const struct fb_info *info)
 {
     /*
      *  Set the hardware according to 'par'.
@@ -159,10 +162,11 @@ static void xxx_set_par(struct xxxfb_par *par, const struct fb_info *fb_info)
 
 static int xxx_getcolreg(unsigned regno, unsigned *red, unsigned *green,
                         unsigned *blue, unsigned *transp,
-                        const struct fb_info *fb_info)
+                        const struct fb_info *info)
 {
     /*
      *  Read a single color register and split it into colors/transparent.
+     *  The return values must have a 16 bit magnitude.
      *  Return != 0 for invalid regno.
      */
 
@@ -172,12 +176,12 @@ static int xxx_getcolreg(unsigned regno, unsigned *red, unsigned *green,
 
 static int xxx_setcolreg(unsigned regno, unsigned red, unsigned green,
                         unsigned blue, unsigned transp,
-                        const struct fb_info *fb_info)
+                        const struct fb_info *info)
 {
     /*
-     *  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.
+     *  Set a single color register. The values supplied have a 16 bit
+     *  magnitude.
+     *  Return != 0 for invalid regno.
      */
 
     if (regno < 16) {
@@ -185,25 +189,29 @@ static int xxx_setcolreg(unsigned regno, unsigned red, unsigned green,
         *  Make the first 16 colors of the palette available to fbcon
         */
        if (is_cfb15)           /* RGB 555 */
-           fbcon_cfb15_cmap[regno] = be16_to_cpu((red << 10) | (green << 5) |
-                                                 blue);
+           ...fbcon_cmap.cfb16[regno] = ((red & 0xf800) >> 1) |
+                                        ((green & 0xf800) >> 6) |
+                                        ((blue & 0xf800) >> 11);
        if (is_cfb16)           /* RGB 565 */
-           fbcon_cfb16_cmap[regno] = be16_to_cpu((red << 11) | (green << 5) |
-                                                 blue);
+           ...fbcon_cmap.cfb16[regno] = (red & 0xf800) |
+                                        ((green & 0xfc00) >> 5) |
+                                        ((blue & 0xf800) >> 11);
        if (is_cfb24)           /* RGB 888 */
-           fbcon_cfb24_cmap[regno] = be32_to_cpu((red << 16) | (green << 8) |
-                                                 blue);
+           ...fbcon_cmap.cfb24[regno] = ((red & 0xff00) << 8) |
+                                        (green & 0xff00) |
+                                        ((blue & 0xff00) >> 8);
        if (is_cfb32)           /* RGBA 8888 */
-           fbcon_cfb32_cmap[regno] = be32_to_cpu((red << 24) | (green << 16) |
-                                                 (blue << 8) | transp);
+           ...fbcon_cmap.cfb32[regno] = ((red & 0xff00) << 16) |
+                                        ((green & 0xff00) << 8) |
+                                        (blue & 0xff00) |
+                                        ((transp & 0xff00) >> 8);
     }
     /* ... */
     return 0;
 }
 
 static int xxx_pan_display(struct fb_var_screeninfo *var,
-                          struct xxxfb_par *par,
-                          const struct fb_info *fb_info)
+                          struct xxxfb_par *par, const struct fb_info *info)
 {
     /*
      *  Pan (or wrap, depending on the `vmode' field) the display using the
@@ -215,7 +223,7 @@ static int xxx_pan_display(struct fb_var_screeninfo *var,
     return 0;
 }
 
-static int xxx_blank(int blank_mode, const struct fb_info *fb_info)
+static int xxx_blank(int blank_mode, const struct fb_info *info)
 {
     /*
      *  Blank the screen if blank_mode != 0, else unblank. If blank == NULL
@@ -232,30 +240,45 @@ static int xxx_blank(int blank_mode, const struct fb_info *fb_info)
     return 0;
 }
 
-static struct display_switch *xxx_get_dispsw(const void *par,
-                                            struct fb_info_gen *info)
+static void xxx_set_dispsw(const void *par, struct display *disp,
+                          struct fb_info_gen *info)
 {
+    unsigned long flags;
+
     /*
-     *  Return a pointer to appropriate low level text console operations for
-     *  the video mode `par' of your video hardware. These can be generic
-     *  software routines, or hardware accelerated routines specifically
-     *  tailored for your hardware.
-     *  If you don't have any appropriate operations, simple fill in the NULL
-     *  pointer, and there will be no text output.
+     *  Fill in a pointer to appropriate low level text console operations (and
+     *  optionally a pointer to help data) for the video mode `par' of your
+     *  video hardware. These can be generic software routines, or hardware
+     *  accelerated routines specifically tailored for your hardware.
+     *  If you don't have any appropriate operations, you must fill in a
+     *  pointer to dummy operations, and there will be no text output.
      */
+    save_flags(flags); cli();
 #ifdef FBCON_HAS_CFB8
-    if (is_cfb8)
-       return &fbcon_cfb8;
+    if (is_cfb8) {
+       disp->dispsw = fbcon_cfb8;
+    } else
 #endif
 #ifdef FBCON_HAS_CFB16
-    if (is_cfb16)
-       return &fbcon_cfb16;
+    if (is_cfb16) {
+       disp->dispsw = fbcon_cfb16;
+       disp->dispsw_data = ...fbcon_cmap.cfb16;        /* console palette */
+    } else
+#endif
+#ifdef FBCON_HAS_CFB24
+    if (is_cfb24) {
+       disp->dispsw = fbcon_cfb24;
+       disp->dispsw_data = ...fbcon_cmap.cfb24;        /* console palette */
+    } else
 #endif
 #ifdef FBCON_HAS_CFB32
-    if (is_cfb32)
-       return &fbcon_cfb32;
+    if (is_cfb32) {
+       disp->dispsw = fbcon_cfb32;
+       disp->dispsw_data = ...fbcon_cmap.cfb32;        /* console palette */
+    } else
 #endif
-    return NULL;
+       disp->dispsw = &fbcon_dummy;
+    restore_flags(flags);
 }
 
 
@@ -278,27 +301,25 @@ struct fbgen_hwswitch xxx_switch = {
 
 __initfunc(void xxxfb_init(void))
 {
-    struct fb_var_screeninfo var;
-
-    fb_info.fbhw = &xxx_switch;
-    fbhw->detect();
-    strcpy(fb_info.modename, "XXX");
-    fb_info.changevar = NULL;
-    fb_info.node = -1;
-    fb_info.fbops = &xxxfb_ops;
-    fb_info.disp = disp;
-    fb_info.switch_con = &xxxfb_switch;
-    fb_info.updatevar = &xxxfb_update_var;
-    fb_info.blank = &xxxfb_blank;
+    fb_info.gen.fbhw = &xxx_switch;
+    fb_info.gen.fbhw->detect();
+    strcpy(fb_info.gen.info.modename, "XXX");
+    fb_info.gen.info.changevar = NULL;
+    fb_info.gen.info.node = -1;
+    fb_info.gen.info.fbops = &xxxfb_ops;
+    fb_info.gen.info.disp = &disp;
+    fb_info.gen.info.switch_con = &xxxfb_switch;
+    fb_info.gen.info.updatevar = &xxxfb_update_var;
+    fb_info.gen.info.blank = &xxxfb_blank;
     /* This should give a reasonable default video mode */
-    fbgen_get_var(&disp.var, -1, &fb_info.gen);
-    fbgen_do_set_var(var, 1, &fbinfo.gen);
-    fbgen_set_disp(-1, &fb_info.gen.info);
+    fbgen_get_var(&disp.var, -1, &fb_info.gen.info);
+    fbgen_do_set_var(&disp.var, 1, &fb_info.gen);
+    fbgen_set_disp(-1, &fb_info.gen);
     fbgen_install_cmap(0, &fb_info.gen);
     if (register_framebuffer(&fb_info.gen.info) < 0)
        return;
-    printk("fb%d: %s frame buffer device\n", GET_FB_IDX(fb_info.node),
-          fb_info.modename);
+    printk("fb%d: %s frame buffer device\n", GET_FB_IDX(fb_info.gen.info.node),
+          fb_info.gen.info.modename);
 
     /* uncomment this if your driver cannot be unloaded */
     /* MOD_INC_USE_COUNT; */
@@ -316,7 +337,7 @@ void xxxfb_cleanup(struct fb_info *info)
      *  clean up all instances.
      */
 
-    unregister_framebuffer(&fb_info);
+    unregister_framebuffer(info);
     /* ... */
 }
 
index cf1534a9ae04905c047b5a92cd14895e562fc676..ede487d2a432c45180bc6c67363251e6404321dd 100644 (file)
 #include <linux/selection.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
+#include <linux/config.h>
 
 #include <asm/io.h>
+#include <asm/mtrr.h>
 
-#include "fbcon.h"
-#include "fbcon-cfb8.h"
-#include "fbcon-cfb16.h"
-#include "fbcon-cfb32.h"
+#include <video/fbcon.h>
+#include <video/fbcon-cfb8.h>
+#include <video/fbcon-cfb16.h>
+#include <video/fbcon-cfb32.h>
 
 #define dac_reg        (0x3c8)
 #define dac_val        (0x3c9)
@@ -75,19 +77,26 @@ static struct fb_var_screeninfo vesafb_defined = {
 
 static struct display disp;
 static struct fb_info fb_info;
-static struct { u_char red, green, blue, pad; } palette[256];
-
-static int inverse = 0;
+static struct { u_short blue, green, red, pad; } palette[256];
+static union {
+#ifdef FBCON_HAS_CFB16
+    u16 cfb16[16];
+#endif
+#ifdef FBCON_HAS_CFB32
+    u32 cfb32[16];
+#endif
+} fbcon_cmap;
 
-static int currcon = 0;
+static int             inverse   = 0;
+static int             currcon   = 0;
 
-/* --------------------------------------------------------------------- */
-/* speed up scrolling                                                    */
+static int             pmi_setpal = 1; /* pmi for palette changes ??? */
+static int             ypan       = 1;
+static int             ywrap      = 0;
+static unsigned short  *pmi_base  = 0;
+static void            (*pmi_start)(void);
+static void            (*pmi_pal)(void);
 
-#define USE_REDRAW   1
-#define USE_MEMMOVE  2
-  
-static int vesafb_scroll = USE_REDRAW;
 static struct display_switch vesafb_sw;
 
 /* --------------------------------------------------------------------- */
@@ -111,8 +120,37 @@ static int vesafb_release(struct fb_info *info, int user)
        return(0);
 }
 
-static int fb_update_var(int con, struct fb_info *info)
+static int vesafb_pan_display(struct fb_var_screeninfo *var, int con,
+                            struct fb_info *info)
 {
+       int offset;
+
+       if (var->xoffset)
+               return -EINVAL;
+       if (ypan && var->yoffset+var->yres > var->yres_virtual)
+               return -EINVAL;
+       if (ywrap && var->yoffset > var->yres_virtual)
+               return -EINVAL;
+
+       offset = (var->yoffset * video_linelength + var->xoffset) / 4;
+
+        __asm__ __volatile__(
+                "call *(%%edi)"
+                : /* no return value */
+                : "a" (0x4f07),         /* EAX */
+                  "b" (0),              /* EBX */
+                  "c" (offset),         /* ECX */
+                  "d" (offset >> 16),   /* EDX */
+                  "D" (&pmi_start));    /* EDI */
+       return 0;
+}
+
+static int vesafb_update_var(int con, struct fb_info *info)
+{
+       if (con == currcon && (ywrap || ypan)) {
+               struct fb_var_screeninfo *var = &fb_display[currcon].var;
+               return vesafb_pan_display(var,con,info);
+       }
        return 0;
 }
 
@@ -126,9 +164,9 @@ static int vesafb_get_fix(struct fb_fix_screeninfo *fix, int con,
        fix->smem_len=video_size;
        fix->type = video_type;
        fix->visual = video_visual;
-       fix->xpanstep=0;
-       fix->ypanstep=0;
-       fix->ywrapstep=0;
+       fix->xpanstep  = 0;
+       fix->ypanstep  = (ywrap || ypan)  ? 1 : 0;
+       fix->ywrapstep =  ywrap           ? 1 : 0;
        fix->line_length=video_linelength;
        return 0;
 }
@@ -179,19 +217,22 @@ static void vesafb_set_disp(int con)
        case 15:
        case 16:
                sw = &fbcon_cfb16;
+               display->dispsw_data = fbcon_cmap.cfb16;
                break;
 #endif
 #ifdef FBCON_HAS_CFB32
        case 32:
                sw = &fbcon_cfb32;
+               display->dispsw_data = fbcon_cmap.cfb32;
                break;
 #endif
        default:
+               sw = &fbcon_dummy;
                return;
        }
        memcpy(&vesafb_sw, sw, sizeof(*sw));
        display->dispsw = &vesafb_sw;
-       if (vesafb_scroll == USE_REDRAW) {
+       if (!ypan && !ywrap) {
                display->scrollmode = SCROLL_YREDRAW;
                vesafb_sw.bmove = fbcon_redraw_bmove;
        }
@@ -219,9 +260,41 @@ static int vesa_getcolreg(unsigned regno, unsigned *red, unsigned *green,
        *red   = palette[regno].red;
        *green = palette[regno].green;
        *blue  = palette[regno].blue;
+       *transp = 0;
        return 0;
 }
 
+#ifdef FBCON_HAS_CFB8
+
+static void vesa_setpalette(int regno, unsigned red, unsigned green, unsigned blue)
+{
+       struct { u_char blue, green, red, pad; } entry;
+
+       if (pmi_setpal) {
+               entry.red   = red   >> 10;
+               entry.green = green >> 10;
+               entry.blue  = blue  >> 10;
+               entry.pad   = 0;
+               __asm__ __volatile__(
+                "call *(%%esi)"
+                : /* no return value */
+                : "a" (0x4f09),         /* EAX */
+                  "b" (0),              /* EBX */
+                  "c" (1),              /* ECX */
+                  "d" (regno),          /* EDX */
+                  "D" (&entry),         /* EDI */
+                  "S" (&pmi_pal));      /* ESI */
+       } else {
+               /* without protected mode interface, try VGA registers... */
+               outb_p(regno,       dac_reg);
+               outb_p(red   >> 10, dac_val);
+               outb_p(green >> 10, dac_val);
+               outb_p(blue  >> 10, dac_val);
+       }
+}
+
+#endif
+
 static int vesa_setcolreg(unsigned regno, unsigned red, unsigned green,
                          unsigned blue, unsigned transp,
                          struct fb_info *fb_info)
@@ -235,7 +308,7 @@ static int vesa_setcolreg(unsigned regno, unsigned red, unsigned green,
        
        if (regno >= video_cmap_len)
                return 1;
-       
+
        palette[regno].red   = red;
        palette[regno].green = green;
        palette[regno].blue  = blue;
@@ -243,18 +316,25 @@ static int vesa_setcolreg(unsigned regno, unsigned red, unsigned green,
        switch (video_bpp) {
 #ifdef FBCON_HAS_CFB8
        case 8:
-               /* Hmm, can we do it _always_ this way ??? */
-               outb_p(regno, dac_reg);
-               outb_p(red, dac_val);
-               outb_p(green, dac_val);
-               outb_p(blue, dac_val);
+               vesa_setpalette(regno,red,green,blue);
                break;
 #endif
 #ifdef FBCON_HAS_CFB16
        case 15:
        case 16:
-               fbcon_cfb16_cmap[regno] =
-                       (red << vesafb_defined.red.offset) | (green << 5) | blue;
+               if (vesafb_defined.red.offset == 10) {
+                       /* 1:5:5:5 */
+                       fbcon_cmap.cfb16[regno] =
+                               ((red   & 0xf800) >>  1) |
+                               ((green & 0xf800) >>  6) |
+                               ((blue  & 0xf800) >> 11);
+               } else {
+                       /* 0:5:6:5 */
+                       fbcon_cmap.cfb16[regno] =
+                               ((red   & 0xf800)      ) |
+                               ((green & 0xfc00) >>  5) |
+                               ((blue  & 0xf800) >> 11);
+               }
                break;
 #endif
 #ifdef FBCON_HAS_CFB24
@@ -264,7 +344,10 @@ static int vesa_setcolreg(unsigned regno, unsigned red, unsigned green,
 #endif
 #ifdef FBCON_HAS_CFB32
        case 32:
-               fbcon_cfb32_cmap[regno] =
+               red   >>= 8;
+               green >>= 8;
+               blue  >>= 8;
+               fbcon_cmap.cfb32[regno] =
                        (red   << vesafb_defined.red.offset)   |
                        (green << vesafb_defined.green.offset) |
                        (blue  << vesafb_defined.blue.offset);
@@ -279,11 +362,9 @@ static void do_install_cmap(int con, struct fb_info *info)
        if (con != currcon)
                return;
        if (fb_display[con].cmap.len)
-               fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-                           vesa_setcolreg, info);
+               fb_set_cmap(&fb_display[con].cmap, 1, vesa_setcolreg, info);
        else
-               fb_set_cmap(fb_default_cmap(video_cmap_len),
-                           &fb_display[con].var, 1, vesa_setcolreg,
+               fb_set_cmap(fb_default_cmap(video_cmap_len), 1, vesa_setcolreg,
                            info);
 }
 
@@ -291,7 +372,7 @@ static int vesafb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
                           struct fb_info *info)
 {
        if (con == currcon) /* current console? */
-               return fb_get_cmap(cmap, &fb_display[con].var, kspc, vesa_getcolreg, info);
+               return fb_get_cmap(cmap, kspc, vesa_getcolreg, info);
        else if (fb_display[con].cmap.len) /* non default colormap? */
                fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
        else
@@ -311,19 +392,12 @@ static int vesafb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
                        return err;
        }
        if (con == currcon)                     /* current console? */
-               return fb_set_cmap(cmap, &fb_display[con].var, kspc, vesa_setcolreg, info);
+               return fb_set_cmap(cmap, kspc, vesa_setcolreg, info);
        else
                fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
        return 0;
 }
 
-static int vesafb_pan_display(struct fb_var_screeninfo *var, int con,
-                            struct fb_info *info)
-{
-       /* no panning */
-       return -EINVAL;
-}
-
 static int vesafb_ioctl(struct inode *inode, struct file *file, 
                       unsigned int cmd, unsigned long arg, int con,
                       struct fb_info *info)
@@ -355,14 +429,16 @@ void vesafb_setup(char *options, int *ints)
        for(this_opt=strtok(options,","); this_opt; this_opt=strtok(NULL,",")) {
                if (!*this_opt) continue;
                
-               printk("vesafb_setup: option %s\n", this_opt);
-               
                if (! strcmp(this_opt, "inverse"))
                        inverse=1;
                else if (! strcmp(this_opt, "redraw"))
-                       vesafb_scroll = USE_REDRAW;
-               else if (! strcmp(this_opt, "memmove"))
-                       vesafb_scroll = USE_MEMMOVE;
+                       ywrap=0,ypan=0;
+               else if (! strcmp(this_opt, "ypan"))
+                       ywrap=0,ypan=1;
+               else if (! strcmp(this_opt, "ywrap"))
+                       ywrap=1,ypan=0;
+               else if (! strcmp(this_opt, "nopal"))
+                       pmi_setpal=0;
                else if (!strncmp(this_opt, "font:", 5))
                        strcpy(fb_info.fontname, this_opt+5);
        }
@@ -372,13 +448,14 @@ static int vesafb_switch(int con, struct fb_info *info)
 {
        /* Do we have to save the colormap? */
        if (fb_display[currcon].cmap.len)
-               fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-                           vesa_getcolreg, info);
+               fb_get_cmap(&fb_display[currcon].cmap, 1, vesa_getcolreg,
+                           info);
        
        currcon = con;
        /* Install new colormap */
        do_install_cmap(con, info);
-       return 0;
+       vesafb_update_var(con,info);
+       return 1;
 }
 
 /* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */
@@ -400,24 +477,62 @@ __initfunc(void vesafb_init(void))
        video_width         = screen_info.lfb_width;
        video_height        = screen_info.lfb_height;
        video_linelength    = screen_info.lfb_linelength;
-       video_size          = video_linelength * video_height /* screen_info.lfb_size */;
+       video_size          = screen_info.lfb_size * 65536;
        video_visual = (video_bpp == 8) ?
-               FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
+               FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
         video_vbase = ioremap((unsigned long)video_base, video_size);
 
-       printk("vesafb: %dx%dx%d, linelength=%d\n",
-              video_width, video_height, video_bpp, video_linelength);
-       printk("vesafb: framebuffer at 0x%p, mapped to 0x%p, size %d\n",
-              video_base, video_vbase, video_size);
-       if (vesafb_scroll == USE_REDRAW)  printk("vesafb: scrolling=redraw\n");
-       if (vesafb_scroll == USE_MEMMOVE) printk("vesafb: scrolling=memmove\n");
-        
+       printk("vesafb: framebuffer at 0x%p, mapped to 0x%p, size %dk\n",
+              video_base, video_vbase, video_size/1024);
+       printk("vesafb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
+              video_width, video_height, video_bpp, video_linelength, screen_info.pages);
+
+       if (screen_info.vesapm_seg) {
+               printk("vesafb: protected mode interface info at %04x:%04x\n",
+                      screen_info.vesapm_seg,screen_info.vesapm_off);
+       }
+
+       if (screen_info.vesapm_seg < 0xc000)
+               ywrap = ypan = pmi_setpal = 0; /* not available or some DOS TSR ... */
+
+       if (ypan || ywrap || pmi_setpal) {
+               pmi_base  = (unsigned short*)(__PAGE_OFFSET+((unsigned long)screen_info.vesapm_seg << 4) + screen_info.vesapm_off);
+               pmi_start = (void*)((char*)pmi_base + pmi_base[1]);
+               pmi_pal   = (void*)((char*)pmi_base + pmi_base[2]);
+               printk("vesafb: pmi: set display start = %p, set palette = %p\n",pmi_start,pmi_pal);
+               if (pmi_base[3]) {
+                       printk("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("vesafb: can't handle memory requests, pmi disabled\n");
+                               ywrap = ypan = pmi_setpal = 0;
+                       }
+               }
+       }
+
        vesafb_defined.xres=video_width;
        vesafb_defined.yres=video_height;
        vesafb_defined.xres_virtual=video_width;
-       vesafb_defined.yres_virtual=video_height;
+       vesafb_defined.yres_virtual=video_size / video_linelength;
        vesafb_defined.bits_per_pixel=video_bpp;
 
+       if ((ypan || ywrap) && vesafb_defined.yres_virtual > video_height) {
+               printk("vesafb: scrolling: %s using protected mode interface, yres_virtual=%d\n",
+                      ywrap ? "ywrap" : "ypan",vesafb_defined.yres_virtual);
+       } else {
+               printk("vesafb: scrolling: redraw\n");
+               vesafb_defined.yres_virtual = video_height;
+               ypan = ywrap = 0;
+       }
+
        if (video_bpp > 8) {
                vesafb_defined.red.offset    = screen_info.red_pos;
                vesafb_defined.red.length    = screen_info.red_size;
@@ -451,6 +566,9 @@ __initfunc(void vesafb_init(void))
                video_cmap_len = 256;
        }
        request_region(0x3c0, 32, "vga+");
+#ifdef CONFIG_MTRR
+        mtrr_add((unsigned long)video_base, video_size, MTRR_TYPE_WRCOMB, 1);
+#endif
        
        strcpy(fb_info.modename, "VESA VGA");
        fb_info.changevar = NULL;
@@ -458,7 +576,7 @@ __initfunc(void vesafb_init(void))
        fb_info.fbops = &vesafb_ops;
        fb_info.disp=&disp;
        fb_info.switch_con=&vesafb_switch;
-       fb_info.updatevar=&fb_update_var;
+       fb_info.updatevar=&vesafb_update_var;
        fb_info.blank=&vesafb_blank;
        vesafb_set_disp(-1);
 
diff --git a/drivers/video/vgafb.c b/drivers/video/vgafb.c
deleted file mode 100644 (file)
index c8fc4c9..0000000
+++ /dev/null
@@ -1,764 +0,0 @@
-/*
- *  linux/drivers/video/vgafb.c -- VGA frame buffer device
- *
- *     Created 28 Mar 1998 by Geert Uytterhoeven
- *     Hardware cursor support added on 14 Apr 1998 by Emmanuel Marty
- *
- *  This file is heavily based on vgacon.c. Read about its contributors there.
- *
- *  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.
- */
-
-
-
-
-/* KNOWN PROBLEMS/TO DO ===================================================== *
- *
- *     - add support for loadable fonts and VESA blanking
- *
- *     - for now only VGA _text_ mode is supported
- *
- * KNOWN PROBLEMS/TO DO ==================================================== */
-
-
-#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/malloc.h>
-#include <linux/vmalloc.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/fb.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/selection.h>
-#include <linux/console.h>
-#include <linux/vt_kern.h>
-
-#include <asm/io.h>
-#include <asm/uaccess.h>
-
-#include "fbcon.h"
-#include "fbcon-vga.h"
-
-
-#define BLANK 0x0020
-
-#define CAN_LOAD_EGA_FONTS     /* undefine if the user must not do this */
-#define CAN_LOAD_PALETTE       /* undefine if the user must not do this */
-
-#define dac_reg        (0x3c8)
-#define dac_val        (0x3c9)
-
-#ifdef __powerpc__
-#define VGA_OFFSET _ISA_MEM_BASE;
-#else
-#define VGA_OFFSET 0x0
-#endif
-
-
-static int currcon = 0;
-static struct display disp;
-static struct fb_info fb_info;
-static struct { u_char red, green, blue, pad; } palette[16];
-
-static struct fb_fix_screeninfo fb_fix = { { 0, } };
-static struct fb_var_screeninfo fb_var = { 0, };
-
-
-/* Description of the hardware situation */
-static unsigned char vga_video_type;
-static unsigned long vga_video_mem_base;       /* Base of video memory */
-static unsigned long vga_video_mem_term;       /* End of video memory */
-static u16 vga_video_port_reg;                 /* Video register select port */
-static u16 vga_video_port_val;                 /* Video register value port */
-static unsigned long vga_video_num_columns;    /* Number of text columns */
-static unsigned long vga_video_num_lines;      /* Number of text lines */
-static int vga_can_do_color = 0;
-
-
-    /*
-     *  VGA screen access
-     */ 
-
-static inline void vga_writew(u16 val, u16 *addr)
-{
-#ifdef __powerpc__
-    st_le16(addr, val);
-#else
-    writew(val, (unsigned long)addr);
-#endif /* !__powerpc__ */
-}
-
-static inline u16 vga_readw(u16 *addr)
-{
-#ifdef __powerpc__
-    return ld_le16(addr);
-#else
-    return readw((unsigned long)addr);
-#endif /* !__powerpc__ */      
-}
-
-/*
- * By replacing the four outb_p with two back to back outw, we can reduce
- * the window of opportunity to see text mislocated to the RHS of the
- * console during heavy scrolling activity. However there is the remote
- * possibility that some pre-dinosaur hardware won't like the back to back
- * I/O. Since the Xservers get away with it, we should be able to as well.
- */
-static inline void write_vga(unsigned char reg, unsigned int val)
-{
-#ifndef SLOW_VGA
-    unsigned int v1, v2;
-
-    v1 = reg + (val & 0xff00);
-    v2 = reg + 1 + ((val << 8) & 0xff00);
-    outw(v1, vga_video_port_reg);
-    outw(v2, vga_video_port_reg);
-#else
-    outb_p(reg, vga_video_port_reg);
-    outb_p(val >> 8, vga_video_port_val);
-    outb_p(reg+1, vga_video_port_reg);
-    outb_p(val & 0xff, vga_video_port_val);
-#endif
-}
-
-static inline void vga_set_origin(unsigned short location)
-{
-       write_vga(12, location >> 1);
-}
-
-static inline void vga_set_cursor(int location)
-{
-    write_vga(14, location >> 1);
-}
-
-static void vga_set_split(unsigned short linenum)
-{
-       unsigned long flags;
-       unsigned char overflow, fontsize;
-       
-       if (vga_video_type != VIDEO_TYPE_VGAC) {
-               return;
-       }
-
-       save_flags(flags); cli();
-
-       outb_p(0x07, vga_video_port_reg);
-       overflow = inb_p(vga_video_port_val);
-
-       outb_p(0x09, vga_video_port_reg);
-       fontsize = inb_p(vga_video_port_val);
-       
-       overflow &= ~0x10; overflow |= (linenum & 0x100) ? 0x10 : 0;
-       fontsize &= ~0x40; fontsize |= (linenum & 0x200) ? 0x40 : 0;
-       linenum  &=  0xff;
-
-       outb_p(0x18, vga_video_port_reg);
-       outb_p(linenum, vga_video_port_val);
-
-       outb_p(0x07, vga_video_port_reg);
-       outb_p(overflow, vga_video_port_val);
-
-       outb_p(0x09, vga_video_port_reg);
-       outb_p(fontsize, vga_video_port_val);
-
-       restore_flags(flags);
-}
-
-static inline void vga_set_palreg(u_int regno, u_int red, 
-                                 u_int green, u_int blue)
-{
-       unsigned long flags;
-
-       save_flags(flags); cli();
-       
-       outb_p(regno, dac_reg);
-       outb_p(red,   dac_val);
-       outb_p(green, dac_val);
-       outb_p(blue,  dac_val);
-       
-       restore_flags(flags);
-}
-
-
-    /*
-     *  Interface used by the world
-     */
-
-static int vgafb_open(struct fb_info *info, int user);
-static int vgafb_release(struct fb_info *info, int user);
-static int vgafb_get_fix(struct fb_fix_screeninfo *fix, int con,
-                        struct fb_info *info);
-static int vgafb_get_var(struct fb_var_screeninfo *var, int con,
-                        struct fb_info *info);
-static int vgafb_set_var(struct fb_var_screeninfo *var, int con,
-                        struct fb_info *info);
-static int vgafb_pan_display(struct fb_var_screeninfo *var, int con,
-                            struct fb_info *info);
-static int vgafb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
-                         struct fb_info *info);
-static int vgafb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
-                         struct fb_info *info);
-static int vgafb_ioctl(struct inode *inode, struct file *file, u_int cmd,
-                      u_long arg, int con, struct fb_info *info);
-
-
-    /*
-     *  Interface to the low level console driver
-     */
-
-void vgafb_init(void);
-void vgafb_setup(char *options, int *ints);
-static int vgafbcon_switch(int con, struct fb_info *info);
-static int vgafbcon_updatevar(int con, struct fb_info *info);
-static void vgafbcon_blank(int blank, struct fb_info *info);
-
-
-    /*
-     *  VGA text console with hardware cursor
-     */
-
-static struct display_switch fbcon_vgafb;
-
-
-    /*
-     *  Internal routines
-     */
-
-static int vgafb_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
-                          u_int *transp, struct fb_info *info);
-static int vgafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
-                          u_int transp, struct fb_info *info);
-static void do_install_cmap(int con, struct fb_info *info);
-
-
-static struct fb_ops vgafb_ops = {
-    vgafb_open, vgafb_release, vgafb_get_fix, vgafb_get_var, vgafb_set_var,
-    vgafb_get_cmap, vgafb_set_cmap, vgafb_pan_display, vgafb_ioctl
-};
-
-
-    /*
-     *  Open/Release the frame buffer device
-     */
-
-static int vgafb_open(struct fb_info *info, int user)
-
-{
-    /*
-     *  Nothing, only a usage count for the moment
-     */
-
-    MOD_INC_USE_COUNT;
-    return(0);
-}
-
-static int vgafb_release(struct fb_info *info, int user)
-{
-    MOD_DEC_USE_COUNT;
-    return(0);
-}
-
-
-    /*
-     *  Get the Fixed Part of the Display
-     */
-
-static int vgafb_get_fix(struct fb_fix_screeninfo *fix, int con,
-                        struct fb_info *info)
-{
-    memcpy(fix, &fb_fix, sizeof(fb_fix));
-    return 0;
-}
-
-
-    /*
-     *  Get the User Defined Part of the Display
-     */
-
-static int vgafb_get_var(struct fb_var_screeninfo *var, int con,
-                        struct fb_info *info)
-{
-    memcpy(var, &fb_var, sizeof(fb_var));
-    return 0;
-}
-
-
-    /*
-     *  Set the User Defined Part of the Display
-     */
-
-static int vgafb_set_var(struct fb_var_screeninfo *var, int con,
-                        struct fb_info *info)
-{
-    struct display *display;
-    int oldbpp = -1, err;
-
-    if (con >= 0)
-       display = &fb_display[con];
-    else
-       display = &disp;        /* used during initialization */
-
-    if (var->xres > fb_var.xres || var->yres > fb_var.yres ||
-       var->xres_virtual > fb_var.xres_virtual ||
-       var->yres_virtual > fb_var.yres_virtual ||
-       var->bits_per_pixel > fb_var.bits_per_pixel ||
-       var->nonstd || !(var->accel_flags & FB_ACCELF_TEXT) ||
-       (var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED)
-       return -EINVAL;
-    memcpy(var, &fb_var, sizeof(fb_var));
-
-    if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
-       oldbpp = display->var.bits_per_pixel;
-       display->var = *var;
-       vga_set_origin(var->yoffset/video_font_height*fb_fix.line_length);
-    }
-
-    if (oldbpp != var->bits_per_pixel) {
-       if ((err = fb_alloc_cmap(&display->cmap, 0, 0)))
-           return err;
-       do_install_cmap(con, info);
-    }
-    return 0;
-}
-
-
-    /*
-     *  Pan or Wrap the Display
-     *
-     *  This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
-     */
-
-static int vgafb_pan_display(struct fb_var_screeninfo *var, int con,
-                            struct fb_info *info)
-{
-    if (var->xoffset || var->yoffset+var->yres > var->yres_virtual)
-       return -EINVAL;
-
-    vga_set_origin(var->yoffset/video_font_height*fb_fix.line_length);
-    return 0;
-}
-
-
-    /*
-     *  Get the Colormap
-     */
-
-static int vgafb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
-                         struct fb_info *info)
-{
-    if (con == currcon) /* current console? */
-       return fb_get_cmap(cmap, &fb_display[con].var, kspc, vgafb_getcolreg,
-                          info);
-    else if (fb_display[con].cmap.len) /* non default colormap? */
-       fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
-    else
-       fb_copy_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-                    cmap, kspc ? 0 : 2);
-    return 0;
-}
-
-
-    /*
-     *  Set the Colormap
-     */
-
-static int vgafb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
-                         struct fb_info *info)
-{
-    int err;
-
-    if (!fb_display[con].cmap.len) {    /* no colormap allocated? */
-       if ((err = fb_alloc_cmap(&fb_display[con].cmap,
-                                1<<fb_display[con].var.bits_per_pixel, 0)))
-           return err;
-    }
-    if (con == currcon) {              /* current console? */
-       err = fb_set_cmap(cmap, &fb_display[con].var, kspc, vgafb_setcolreg,
-                         info);
-       return err;
-    } else
-       fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
-    return 0;
-}
-
-
-static int vgafb_ioctl(struct inode *inode, struct file *file, u_int cmd,
-                      u_long arg, int con, struct fb_info *info)
-{
-    return -EINVAL;
-}
-
-
-    /*
-     *  Move hardware vga cursor
-     */
-
-static void fbcon_vgafb_cursor(struct display *p, int mode, int x, int y)
-{
-    switch (mode) {
-       case CM_ERASE:
-          vga_set_cursor(vga_video_mem_term - vga_video_mem_base - 1);
-          break;
-
-       case CM_MOVE:
-       case CM_DRAW:
-          vga_set_cursor(y*p->next_line + (x << 1));
-          break;
-    }
-}
-
-
-    /*
-     *  Initialisation
-     */
-
-__initfunc(void vgafb_init(void))
-{
-    u16 saved;
-    u16 *p;
-
-    if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB)
-       return;
-
-    vga_video_num_lines = ORIG_VIDEO_LINES;
-    vga_video_num_columns = ORIG_VIDEO_COLS;
-
-    if (ORIG_VIDEO_MODE == 7) {                /* Is this a monochrome display? */
-       vga_video_mem_base = 0xb0000 + VGA_OFFSET;
-       vga_video_port_reg = 0x3b4;
-       vga_video_port_val = 0x3b5;
-       if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) {
-           vga_video_type = VIDEO_TYPE_EGAM;
-           vga_video_mem_term = 0xb8000 + VGA_OFFSET;
-           strcpy(fb_fix.id, "EGA+");
-           request_region(0x3b0, 16, "ega");
-       } else {
-           vga_video_type = VIDEO_TYPE_MDA;
-           vga_video_mem_term = 0xb1000 + VGA_OFFSET;
-           strcpy(fb_fix.id, "*MDA");
-           request_region(0x3b0, 12, "mda");
-           request_region(0x3bf, 1, "mda");
-       }
-    } else {                           /* If not, it is color. */
-       vga_can_do_color = 1;
-       vga_video_mem_base = 0xb8000  + VGA_OFFSET;
-       vga_video_port_reg = 0x3d4;
-       vga_video_port_val = 0x3d5;
-       if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) {
-           int i;
-
-           vga_video_mem_term = 0xc0000 + VGA_OFFSET;
-
-           if (!ORIG_VIDEO_ISVGA) {
-               vga_video_type = VIDEO_TYPE_EGAC;
-               strcpy(fb_fix.id, "EGA");
-               request_region(0x3c0, 32, "ega");
-           } else {
-               vga_video_type = VIDEO_TYPE_VGAC;
-               strcpy(fb_fix.id, "VGA+");
-               request_region(0x3c0, 32, "vga+");
-
-#ifdef VGA_CAN_DO_64KB
-               /*
-                * get 64K rather than 32K of video RAM.
-                * This doesn't actually work on all "VGA"
-                * controllers (it seems like setting MM=01
-                * and COE=1 isn't necessarily a good idea)
-                */
-               vga_video_mem_base = 0xa0000  + VGA_OFFSET;
-               vga_video_mem_term = 0xb0000  + VGA_OFFSET;
-               outb_p(6, 0x3ce);
-               outb_p(6, 0x3cf);
-#endif
-
-               /*
-                * Normalise the palette registers, to point
-                * the 16 screen colours to the first 16
-                * DAC entries.
-                */
-
-               for (i = 0; i < 16; i++) {
-                   inb_p(0x3da);
-                   outb_p(i, 0x3c0);
-                   outb_p(i, 0x3c0);
-               }
-               outb_p(0x20, 0x3c0);
-
-               /* now set the DAC registers back to their
-                * default values */
-
-               for (i = 0; i < 16; i++) {
-                   vga_set_palreg(color_table[i], default_red[i],
-                                  default_grn[i], default_blu[i]);
-               }
-           }
-       } else {
-               vga_video_type = VIDEO_TYPE_CGA;
-               vga_video_mem_term = 0xba000 + VGA_OFFSET;
-               strcpy(fb_fix.id, "*CGA");
-               request_region(0x3d4, 2, "cga");
-       }
-    }
-
-    /*
-     * Find out if there is a graphics card present.
-     * Are there smarter methods around?
-     */
-    p = (u16 *)vga_video_mem_base;
-    saved = vga_readw(p);
-    vga_writew(0xAA55, p);
-    if (vga_readw(p) != 0xAA55) {
-       vga_writew(saved, p);
-       return;
-    }
-    vga_writew(0x55AA, p);
-    if (vga_readw(p) != 0x55AA) {
-       vga_writew(saved, p);
-       return;
-    }
-    vga_writew(saved, p);
-
-    if (vga_video_type == VIDEO_TYPE_VGAC
-       || vga_video_type == VIDEO_TYPE_EGAC
-       || vga_video_type == VIDEO_TYPE_EGAM) {
-           video_font_height = ORIG_VIDEO_POINTS;
-    } else {
-            video_font_height = 16;
-    }
-
-    /* This may be suboptimal but is a safe bet - go with it */
-    video_scan_lines = video_font_height * vga_video_num_lines;
-
-    fb_fix.smem_start = (char *) vga_video_mem_base;
-    fb_fix.smem_len = vga_video_mem_term - vga_video_mem_base;
-    fb_fix.type = FB_TYPE_TEXT;
-    fb_fix.type_aux = vga_can_do_color ? FB_AUX_TEXT_CGA : FB_AUX_TEXT_MDA;
-    fb_fix.visual = FB_VISUAL_PSEUDOCOLOR;
-    fb_fix.xpanstep = 0;
-    fb_fix.ypanstep = video_font_height;
-    fb_fix.ywrapstep = 0;
-    fb_fix.line_length = 2*vga_video_num_columns;
-    fb_fix.mmio_start = NULL;
-    fb_fix.mmio_len = 0;
-    fb_fix.accel = FB_ACCEL_NONE;
-
-    fb_var.xres = vga_video_num_columns*8;
-    fb_var.yres = vga_video_num_lines*video_font_height;
-    fb_var.xres_virtual = fb_var.xres;
-    /* the cursor is put at the end of the video memory, hence the -2 */
-    fb_var.yres_virtual = ((fb_fix.smem_len-2)/fb_fix.line_length)*
-                         video_font_height;
-
-    fb_var.xoffset = fb_var.yoffset = 0;
-    fb_var.bits_per_pixel = vga_can_do_color ? 4 : 1;
-    fb_var.grayscale = !vga_can_do_color;
-    fb_var.red.offset = 0;
-    fb_var.red.length = 6;
-    fb_var.red.msb_right = 0;
-    fb_var.green.offset = 0;
-    fb_var.green.length = 6;
-    fb_var.green.msb_right = 0;
-    fb_var.blue.offset = 0;
-    fb_var.blue.length = 6;
-    fb_var.blue.msb_right = 0;
-    fb_var.transp.offset = 0;
-    fb_var.transp.length = 0;
-    fb_var.transp.msb_right = 0;
-    fb_var.nonstd = 0;
-    fb_var.activate = 0;
-    fb_var.height = fb_var.width = -1;
-    fb_var.accel_flags = FB_ACCELF_TEXT;
-    fb_var.pixclock = 39722;           /* 25.175 MHz */
-    fb_var.left_margin = 40;
-    fb_var.right_margin = 24;
-    fb_var.upper_margin = 39;
-    fb_var.lower_margin = 9;
-    fb_var.hsync_len = 96;
-    fb_var.vsync_len = 2;
-    fb_var.sync = 0;
-    fb_var.vmode = FB_VMODE_NONINTERLACED;
-
-    disp.var = fb_var;
-    disp.cmap.start = 0;
-    disp.cmap.len = 0;
-    disp.cmap.red = NULL;
-    disp.cmap.green = NULL;
-    disp.cmap.blue = NULL;
-    disp.cmap.transp = NULL;
-
-#ifdef __i386__
-    disp.screen_base = ioremap((unsigned long) fb_fix.smem_start,
-                               fb_fix.smem_len);
-#else
-    disp.screen_base = bus_to_virt((unsigned long) fb_fix.smem_start);
-#endif
-    disp.visual = fb_fix.visual;
-    disp.type = fb_fix.type;
-    disp.type_aux = fb_fix.type_aux;
-    disp.ypanstep = fb_fix.ypanstep;
-    disp.ywrapstep = fb_fix.ywrapstep;
-    disp.line_length = fb_fix.line_length;
-    disp.can_soft_blank = vga_can_do_color;
-    disp.inverse = 0;
-    disp.dispsw = &fbcon_vgafb;
-
-    strcpy(fb_info.modename, fb_fix.id);
-    fb_info.node = -1;
-    fb_info.fbops = &vgafb_ops;
-    fb_info.disp = &disp;
-    fb_info.fontname[0] = '\0';
-    fb_info.changevar = NULL;
-    fb_info.switch_con = &vgafbcon_switch;
-    fb_info.updatevar = &vgafbcon_updatevar;
-    fb_info.blank = &vgafbcon_blank;
-
-    vgafb_set_var(&fb_var, -1, &fb_info);
-
-    if (register_framebuffer(&fb_info) < 0)
-       return;
-
-    printk("fb%d: VGA frame buffer device, using %dK of video memory\n",
-          GET_FB_IDX(fb_info.node), fb_fix.smem_len>>10);
-}
-
-__initfunc(void vgafb_setup(char *options, int *ints))
-{
-    /* nothing yet */
-}
-
-    /*
-     *  Update the `var' structure (called by fbcon.c)
-     */
-
-static int vgafbcon_updatevar(int con, struct fb_info *info)
-{
-       if (con == currcon) {
-               struct fb_var_screeninfo *var = &fb_display[currcon].var;
-
-               /* hardware scrolling */
-
-               vga_set_origin(var->yoffset / video_font_height *
-                       fb_fix.line_length);
-
-               vga_set_split(var->yres - ((var->vmode & FB_VMODE_YWRAP) ?
-                       var->yoffset+1 : 0));
-       }
-
-       return 0;
-}
-
-static int vgafbcon_switch(int con, struct fb_info *info)
-{
-    /* Do we have to save the colormap? */
-    if (fb_display[currcon].cmap.len)
-       fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-                   vgafb_getcolreg, info);
-
-    currcon = con;
-    /* Install new colormap */
-    do_install_cmap(con, info);
-    vgafbcon_updatevar(con, info);
-    return 0;
-}
-
-    /*
-     *  Blank the display.
-     */
-
-static void vgafbcon_blank(int blank, struct fb_info *info)
-{
-    int i;
-
-    if (blank)
-       for (i = 0; i < 16; i++) {
-           vga_set_palreg(i, 0, 0, 0);
-       }
-    else
-       for (i = 0; i < 16; i++) {
-           vga_set_palreg(i, palette[i].red, palette[i].green,
-                             palette[i].blue);
-       }
-}
-
-
-    /*
-     *  Read a single color register and split it into
-     *  colors/transparent. Return != 0 for invalid regno.
-     */
-
-static int vgafb_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
-                        u_int *transp, struct fb_info *info)
-{
-    if (regno > 15)
-       return 1;
-    *red = palette[regno].red;
-    *green = palette[regno].green;
-    *blue = palette[regno].blue;
-    return 0;
-}
-
-
-    /*
-     *  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.
-     */
-
-static int vgafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
-                        u_int transp, struct fb_info *info)
-{
-    if (regno > 15)
-       return 1;
-    palette[regno].red = red;
-    palette[regno].green = green;
-    palette[regno].blue = blue;
-
-    vga_set_palreg(regno, red, green, blue);
-
-    return 0;
-}
-
-static void do_install_cmap(int con, struct fb_info *info)
-{
-    if (con != currcon)
-       return;
-    if (fb_display[con].cmap.len)
-       fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-                   vgafb_setcolreg, info);
-    else
-       fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-                                   &fb_display[con].var, 1, vgafb_setcolreg,
-                                   info);
-}
-
-
-    /*
-     *  VGA text console with hardware cursor
-     */
-
-static struct display_switch fbcon_vgafb = {
-    fbcon_vga_setup, fbcon_vga_bmove, fbcon_vga_clear, fbcon_vga_putc,
-    fbcon_vga_putcs, fbcon_vga_revc, fbcon_vgafb_cursor, NULL, NULL,
-    FONTWIDTH(8)
-};
-
-
-#ifdef MODULE
-int init_module(void)
-{
-    vgafb_init();
-    return 0;
-}
-
-void cleanup_module(void)
-{
-    unregister_framebuffer(&fb_info);
-}
-#endif /* MODULE */
index 91920408867b6c173cb1ac23daef439338af12a0..4d784e474f5a3162ce10476708a1bd21b8cd748c 100644 (file)
@@ -97,7 +97,7 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
 
        /* Did FASYNC state change? */
        if ((arg ^ filp->f_flags) & FASYNC) {
-               if (filp->f_op->fasync)
+               if (filp->f_op && filp->f_op->fasync)
                        filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0);
        }
 
index 07b9489d94c273ea6f211b1c1fd8b70aca195d62..a16407c8eaba1d8186267ec3627e946bbd9d5978 100644 (file)
@@ -72,8 +72,11 @@ struct termio {
 #define N_MOUSE                2
 #define N_PPP          3
 #define N_AX25         5
-#define N_X25          6
+#define N_X25          6       /* X.25 async */
 #define N_6PACK                7
+#define N_MASC         8       /* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964                9       /* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL 10      /* Reserved for Profibus <Dave@mvhi.com> */
 
 #ifdef __KERNEL__
 /*     eof=^D          eol=\0          eol2=\0         erase=del
index 4a74e20cb8d6ba2b0a40f2db0b579f69ba27c876..2510a5b0eba9b23fe98867b62d08f8d23b13712d 100644 (file)
@@ -55,6 +55,9 @@ struct termio {
 #define N_AX25         5
 #define N_X25          6       /* X.25 async */
 #define N_6PACK                7
+#define N_MASC         8       /* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964                9       /* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL 10      /* Reserved for Profibus <Dave@mvhi.com> */
 
 #ifdef __KERNEL__
 
index dc9d624d70b534ebc01bbc2f072484890195973a..ae6f062ddbb003abb9e998c7ac7040ccbaa218cb 100644 (file)
@@ -40,7 +40,7 @@
  * fix-mapped?
  */
 enum fixed_addresses {
-#if __SMP__
+#ifdef __SMP__
        FIX_APIC_BASE,
        FIX_IO_APIC_BASE,
 #endif
index 025403081caf3e7615468576f31c88f9430bdf39..a75528b11ddb4d4855d395c7233b3b3c9a660650 100644 (file)
@@ -280,6 +280,24 @@ extern void release_thread(struct task_struct *);
 extern void copy_segments(int nr, struct task_struct *p, struct mm_struct * mm);
 extern void release_segments(struct mm_struct * mm);
 
+/*
+ * FPU lazy state save handling..
+ */
+#define unlazy_fpu(tsk) do { \
+       if (tsk->flags & PF_USEDFPU) { \
+               asm volatile("fnsave %0\n\tfwait":"=m" (tsk->tss.i387)); \
+               tsk->flags &= ~PF_USEDFPU; \
+               stts(); \
+       } \
+} while (0)
+
+#define clear_fpu(tsk) do { \
+       if (tsk->flags & PF_USEDFPU) { \
+               tsk->flags &= ~PF_USEDFPU; \
+               stts(); \
+       } \
+} while (0)
+
 /*
  * Return saved PC of a blocked thread.
  */
index b2b77853f0746d5b26948916c0ea41bb9f404761..cf6b5cd6767729bdc46b0e060a5469f971f13c3f 100644 (file)
@@ -47,7 +47,9 @@ struct termio {
 #define N_AX25         5
 #define N_X25          6       /* X.25 async */
 #define N_6PACK                7
-#define N_MASC         8       /* Reserved fo Mobitex module <kaz@cafe.net> */
+#define N_MASC         8       /* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964                9       /* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL 10      /* Reserved for Profibus <Dave@mvhi.com> */
 
 #ifdef __KERNEL__
 
index 24408872e4c8b8b355f9d2f78ae33d4d7194cee7..b17fed223804058d879e50571966fd4ac9dd6c87 100644 (file)
@@ -55,7 +55,9 @@ struct termio {
 #define N_AX25         5
 #define N_X25          6       /* X.25 async */
 #define N_6PACK                7
-#define N_MASC         8       /* Reserved fo Mobitex module <kaz@cafe.net> */
+#define N_MASC         8       /* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964                9       /* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL 10      /* Reserved for Profibus <Dave@mvhi.com> */
 
 #ifdef __KERNEL__
 
index 8293b5df1178859834aed4f9555150cdb90d4c9e..c2ea67c1503b6ff01e066d85409a82beae1fd9e7 100644 (file)
@@ -93,6 +93,9 @@ struct termio {
 #define N_AX25         5
 #define N_X25          6               /* X.25 async */
 #define N_6PACK                7
+#define N_MASC         8       /* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964                9       /* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL 10      /* Reserved for Profibus <Dave@mvhi.com> */
 
 #ifdef __KERNEL__
 
index b5e8c78df75eff7833bc47965db10ee6aa8bd4d7..c6385d4a7a91489f92490ca07389763f20b4d720 100644 (file)
@@ -175,6 +175,13 @@ struct termio {
 #define N_SLIP         1
 #define N_MOUSE                2
 #define N_PPP          3
+#define N_STRIP                4
+#define N_AX25         5
+#define N_X25          6       /* X.25 async */
+#define N_6PACK                7
+#define N_MASC         8       /* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964                9       /* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL 10      /* Reserved for Profibus <Dave@mvhi.com> */
 
 #ifdef __KERNEL__
 
index 3c681a7b1b804b241c071f3f8a42f19faef76362..234343ad6783ee5da9f60f557c60ba325ab2d895 100644 (file)
@@ -63,6 +63,9 @@ struct winsize {
 #define N_AX25         5
 #define N_X25          6
 #define N_6PACK                7
+#define N_MASC         8       /* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964                9       /* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL 10      /* Reserved for Profibus <Dave@mvhi.com> */
 
 #ifdef __KERNEL__
 
index 8a972984bc4ba23ced1a0c1f8c71d50278e96a8a..005652de9dcd0ec4723d347f174babc97ca42530 100644 (file)
@@ -63,6 +63,9 @@ struct winsize {
 #define N_AX25         5
 #define N_X25          6
 #define N_6PACK                7
+#define N_MASC         8       /* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964                9       /* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL 10      /* Reserved for Profibus <Dave@mvhi.com> */
 
 #ifdef __KERNEL__
 
index 7c631b44ae6a9230884081901e2c23140b862c7a..ca23ef8b5abb771e3f3f754c242fc890e83a361b 100644 (file)
@@ -230,50 +230,51 @@ struct fb_ops {
     */
 
 struct display {
-   /* Filled in by the frame buffer device */
+    /* Filled in by the frame buffer device */
 
-   struct fb_var_screeninfo var;    /* variable infos. yoffset and vmode */
-                                    /* are updated by fbcon.c */
-   struct fb_cmap cmap;             /* colormap */
-   char *screen_base;               /* pointer to top of virtual screen */    
+    struct fb_var_screeninfo var;   /* variable infos. yoffset and vmode */
+                                   /* are updated by fbcon.c */
+    struct fb_cmap cmap;            /* colormap */
+    char *screen_base;              /* pointer to top of virtual screen */    
                                    /* (virtual address) */
-   int visual;
-   int type;                        /* see FB_TYPE_* */
-   int type_aux;                    /* Interleave for interleaved Planes */
-   u_short ypanstep;                /* zero if no hardware ypan */
-   u_short ywrapstep;               /* zero if no hardware ywrap */
-   u_long line_length;              /* length of a line in bytes */
-   u_short can_soft_blank;          /* zero if no hardware blanking */
-   u_short inverse;                 /* != 0 text black on white as default */
+    int visual;
+    int type;                       /* see FB_TYPE_* */
+    int type_aux;                   /* Interleave for interleaved Planes */
+    u_short ypanstep;               /* zero if no hardware ypan */
+    u_short ywrapstep;              /* zero if no hardware ywrap */
+    u_long line_length;             /* length of a line in bytes */
+    u_short can_soft_blank;         /* zero if no hardware blanking */
+    u_short inverse;                /* != 0 text black on white as default */
+    struct display_switch *dispsw;  /* low level operations */
+    void *dispsw_data;             /* optional dispsw helper data */
 
 #if 0
-   struct fb_fix_cursorinfo fcrsr;
-   struct fb_var_cursorinfo *vcrsr;
-   struct fb_cursorstate crsrstate;
+    struct fb_fix_cursorinfo fcrsr;
+    struct fb_var_cursorinfo *vcrsr;
+    struct fb_cursorstate crsrstate;
 #endif
 
-   /* Filled in by the low-level console driver */
-
-   struct vc_data *conp;            /* pointer to console data */
-   struct fb_info *fb_info;         /* frame buffer for this console */
-   int vrows;                       /* number of virtual rows */
-   unsigned short cursor_x;        /* current cursor position */
-   unsigned short cursor_y;
-   int fgcol;                       /* text colors */
-   int bgcol;
-   u_long next_line;                /* offset to one line below */
-   u_long next_plane;               /* offset to next plane */
-   u_char *fontdata;                /* Font associated to this display */
-   unsigned short fontheightlog;
-   unsigned short fontwidthlog;
-   unsigned short fontheight;
-   unsigned short fontwidth;
-   int userfont;                    /* != 0 if fontdata kmalloc()ed */
-   struct display_switch *dispsw;   /* low level operations */
-   u_short scrollmode;              /* Scroll Method */
-   short yscroll;                   /* Hardware scrolling */
-   unsigned char fgshift, bgshift;
-   unsigned short charmask;        /* 0xff or 0x1ff */
+    /* Filled in by the low-level console driver */
+
+    struct vc_data *conp;           /* pointer to console data */
+    struct fb_info *fb_info;        /* frame buffer for this console */
+    int vrows;                      /* number of virtual rows */
+    unsigned short cursor_x;       /* current cursor position */
+    unsigned short cursor_y;
+    int fgcol;                      /* text colors */
+    int bgcol;
+    u_long next_line;               /* offset to one line below */
+    u_long next_plane;              /* offset to next plane */
+    u_char *fontdata;               /* Font associated to this display */
+    unsigned short _fontheightlog;
+    unsigned short _fontwidthlog;
+    unsigned short _fontheight;
+    unsigned short _fontwidth;
+    int userfont;                   /* != 0 if fontdata kmalloc()ed */
+    u_short scrollmode;             /* Scroll Method */
+    short yscroll;                  /* Hardware scrolling */
+    unsigned char fgshift, bgshift;
+    unsigned short charmask;       /* 0xff or 0x1ff */
 };
 
 
@@ -321,8 +322,8 @@ struct fbgen_hwswitch {
     int (*pan_display)(const struct fb_var_screeninfo *var,
                       struct fb_info_gen *info);
     int (*blank)(int blank_mode, struct fb_info_gen *info);
-    struct display_switch *(*get_dispsw)(const void *par,
-                                        struct fb_info_gen *info);
+    void (*set_dispsw)(const void *par, struct display *disp,
+                      struct fb_info_gen *info);
 };
 
 struct fb_info_gen {
@@ -394,14 +395,13 @@ extern struct display fb_display[MAX_NR_CONSOLES];
 extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
 extern void fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to,
                         int fsfromto);
-extern int fb_get_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var,
-                      int kspc, int (*getcolreg)(u_int, u_int *, u_int *,
-                                                 u_int *, u_int *,
-                                                 struct fb_info *),
+extern int fb_get_cmap(struct fb_cmap *cmap, int kspc,
+                      int (*getcolreg)(u_int, u_int *, u_int *, u_int *,
+                                       u_int *, struct fb_info *),
                       struct fb_info *fb_info);
-extern int fb_set_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var,
-                      int kspc, int (*setcolreg)(u_int, u_int, u_int, u_int,
-                                                 u_int, struct fb_info *),
+extern int fb_set_cmap(struct fb_cmap *cmap, int kspc,
+                      int (*setcolreg)(u_int, u_int, u_int, u_int, u_int,
+                                       struct fb_info *),
                       struct fb_info *fb_info);
 extern struct fb_cmap *fb_default_cmap(int len);
 extern void fb_invert_cmaps(void);
@@ -462,31 +462,6 @@ struct fb_cursorstate {
 #define FB_CURSOR_ON           1
 #define FB_CURSOR_FLASH                2
 
-#define FBCMD_DRAWLINE         0x4621
-#define FBCMD_MOVE             0x4622
-
-#define FB_LINE_XOR    1
-#define FB_LINE_BOX    2
-#define FB_LINE_FILLED 4
-
-struct fb_line {
-       __s32 start_x;
-       __s32 start_y;
-       __s32 end_x;
-       __s32 end_y;
-       __u32 color;
-       __u32 option;
-};
-
-struct fb_move {
-       __s32 src_x;
-       __s32 src_y;
-       __s32 dest_x;
-       __s32 dest_y;
-       __u32 height;
-       __u32 width;
-};
-
 #endif /* Preliminary */
 
 #endif /* _LINUX_FB_H */
index 269fb574cf448ef3b85a2d3839629184410d4cf2..a840395e31a0d71c5006e679c12ef034439a603f 100644 (file)
@@ -273,7 +273,7 @@ extern void parport_release(struct pardevice *dev);
 /* parport_yield relinquishes the port if it would be helpful to other
  * drivers.  The return value is the same as for parport_claim.
  */
-extern __inline__ unsigned int parport_yield(struct pardevice *dev)
+extern __inline__ int parport_yield(struct pardevice *dev)
 {
        unsigned long int timeslip = (jiffies - dev->time);
        if ((dev->port->waithead == NULL) || (timeslip < dev->timeslice))
@@ -285,7 +285,7 @@ extern __inline__ unsigned int parport_yield(struct pardevice *dev)
 /* parport_yield_blocking is the same but uses parport_claim_or_block
  * instead of parport_claim.
  */
-extern __inline__ unsigned int parport_yield_blocking(struct pardevice *dev)
+extern __inline__ int parport_yield_blocking(struct pardevice *dev)
 {
        unsigned long int timeslip = (jiffies - dev->time);
        if ((dev->port->waithead == NULL) || (timeslip < dev->timeslice))
diff --git a/include/video/fbcon-afb.h b/include/video/fbcon-afb.h
new file mode 100644 (file)
index 0000000..cbbcf00
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  FBcon low-level driver for Amiga bitplanes (afb)
+ */
+
+#ifndef _VIDEO_FBCON_AFB_H
+#define _VIDEO_FBCON_AFB_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_AFB) || defined(CONFIG_FBCON_AFB_MODULE)
+#define FBCON_HAS_AFB
+#endif
+#else
+#if defined(CONFIG_FBCON_AFB)
+#define FBCON_HAS_AFB
+#endif
+#endif
+
+extern struct display_switch fbcon_afb;
+extern void fbcon_afb_setup(struct display *p);
+extern void fbcon_afb_bmove(struct display *p, int sy, int sx, int dy, int dx,
+                           int height, int width);
+extern void fbcon_afb_clear(struct vc_data *conp, struct display *p, int sy,
+                           int sx, int height, int width);
+extern void fbcon_afb_putc(struct vc_data *conp, struct display *p, int c,
+                          int yy, int xx);
+extern void fbcon_afb_putcs(struct vc_data *conp, struct display *p,
+                           const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_afb_revc(struct display *p, int xx, int yy);
+
+#endif
diff --git a/include/video/fbcon-cfb16.h b/include/video/fbcon-cfb16.h
new file mode 100644 (file)
index 0000000..3ccc7d7
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  FBcon low-level driver for 16 bpp packed pixel (cfb16)
+ */
+
+#ifndef _VIDEO_FBCON_CFB16_H
+#define _VIDEO_FBCON_CFB16_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB16_MODULE)
+#define FBCON_HAS_CFB16
+#endif
+#else
+#if defined(CONFIG_FBCON_CFB16)
+#define FBCON_HAS_CFB16
+#endif
+#endif
+
+extern struct display_switch fbcon_cfb16;
+extern void fbcon_cfb16_setup(struct display *p);
+extern void fbcon_cfb16_bmove(struct display *p, int sy, int sx, int dy,
+                             int dx, int height, int width);
+extern void fbcon_cfb16_clear(struct vc_data *conp, struct display *p, int sy,
+                             int sx, int height, int width);
+extern void fbcon_cfb16_putc(struct vc_data *conp, struct display *p, int c,
+                            int yy, int xx);
+extern void fbcon_cfb16_putcs(struct vc_data *conp, struct display *p,
+                             const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_cfb16_revc(struct display *p, int xx, int yy);
+extern void fbcon_cfb16_clear_margins(struct vc_data *conp, struct display *p,
+                                     int bottom_only);
+
+#endif /* _VIDEO_FBCON_CFB16_H */
diff --git a/include/video/fbcon-cfb2.h b/include/video/fbcon-cfb2.h
new file mode 100644 (file)
index 0000000..5ba68a5
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  FBcon low-level driver for 2 bpp packed pixel (cfb2)
+ */
+
+#ifndef _VIDEO_FBCON_CFB2_H
+#define _VIDEO_FBCON_CFB2_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_CFB2) || defined(CONFIG_FBCON_CFB2_MODULE)
+#define FBCON_HAS_CFB2
+#endif
+#else
+#if defined(CONFIG_FBCON_CFB2)
+#define FBCON_HAS_CFB2
+#endif
+#endif
+
+extern struct display_switch fbcon_cfb2;
+extern void fbcon_cfb2_setup(struct display *p);
+extern void fbcon_cfb2_bmove(struct display *p, int sy, int sx, int dy, int dx,
+                            int height, int width);
+extern void fbcon_cfb2_clear(struct vc_data *conp, struct display *p, int sy,
+                            int sx, int height, int width);
+extern void fbcon_cfb2_putc(struct vc_data *conp, struct display *p, int c,
+                           int yy, int xx);
+extern void fbcon_cfb2_putcs(struct vc_data *conp, struct display *p,
+                            const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_cfb2_revc(struct display *p, int xx, int yy);
+
+#endif /* _VIDEO_FBCON_CFB2_H */
diff --git a/include/video/fbcon-cfb24.h b/include/video/fbcon-cfb24.h
new file mode 100644 (file)
index 0000000..77442e2
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  FBcon low-level driver for 24 bpp packed pixel (cfb24)
+ */
+
+#ifndef _VIDEO_FBCON_CFB24_H
+#define _VIDEO_FBCON_CFB24_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_CFB24) || defined(CONFIG_FBCON_CFB24_MODULE)
+#define FBCON_HAS_CFB24
+#endif
+#else
+#if defined(CONFIG_FBCON_CFB24)
+#define FBCON_HAS_CFB24
+#endif
+#endif
+
+extern struct display_switch fbcon_cfb24;
+extern void fbcon_cfb24_setup(struct display *p);
+extern void fbcon_cfb24_bmove(struct display *p, int sy, int sx, int dy,
+                             int dx, int height, int width);
+extern void fbcon_cfb24_clear(struct vc_data *conp, struct display *p, int sy,
+                             int sx, int height, int width);
+extern void fbcon_cfb24_putc(struct vc_data *conp, struct display *p, int c,
+                            int yy, int xx);
+extern void fbcon_cfb24_putcs(struct vc_data *conp, struct display *p,
+                             const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_cfb24_revc(struct display *p, int xx, int yy);
+extern void fbcon_cfb24_clear_margins(struct vc_data *conp, struct display *p,
+                                     int bottom_only);
+
+#endif /* _VIDEO_FBCON_CFB24_H */
diff --git a/include/video/fbcon-cfb32.h b/include/video/fbcon-cfb32.h
new file mode 100644 (file)
index 0000000..abac3ba
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  FBcon low-level driver for 32 bpp packed pixel (cfb32)
+ */
+
+#ifndef _VIDEO_FBCON_CFB32_H
+#define _VIDEO_FBCON_CFB32_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FBCON_CFB32_MODULE)
+#define FBCON_HAS_CFB32
+#endif
+#else
+#if defined(CONFIG_FBCON_CFB32)
+#define FBCON_HAS_CFB32
+#endif
+#endif
+
+extern struct display_switch fbcon_cfb32;
+extern void fbcon_cfb32_setup(struct display *p);
+extern void fbcon_cfb32_bmove(struct display *p, int sy, int sx, int dy,
+                             int dx, int height, int width);
+extern void fbcon_cfb32_clear(struct vc_data *conp, struct display *p, int sy,
+                             int sx, int height, int width);
+extern void fbcon_cfb32_putc(struct vc_data *conp, struct display *p, int c,
+                            int yy, int xx);
+extern void fbcon_cfb32_putcs(struct vc_data *conp, struct display *p,
+                             const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_cfb32_revc(struct display *p, int xx, int yy);
+extern void fbcon_cfb32_clear_margins(struct vc_data *conp, struct display *p,
+                                     int bottom_only);
+
+#endif /* _VIDEO_FBCON_CFB32_H */
diff --git a/include/video/fbcon-cfb4.h b/include/video/fbcon-cfb4.h
new file mode 100644 (file)
index 0000000..963befe
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  FBcon low-level driver for 4 bpp packed pixel (cfb4)
+ */
+
+#ifndef _VIDEO_FBCON_CFB4_H
+#define _VIDEO_FBCON_CFB4_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_CFB4) || defined(CONFIG_FBCON_CFB4_MODULE)
+#define FBCON_HAS_CFB4
+#endif
+#else
+#if defined(CONFIG_FBCON_CFB4)
+#define FBCON_HAS_CFB4
+#endif
+#endif
+
+extern struct display_switch fbcon_cfb4;
+extern void fbcon_cfb4_setup(struct display *p);
+extern void fbcon_cfb4_bmove(struct display *p, int sy, int sx, int dy, int dx,
+                            int height, int width);
+extern void fbcon_cfb4_clear(struct vc_data *conp, struct display *p, int sy,
+                            int sx, int height, int width);
+extern void fbcon_cfb4_putc(struct vc_data *conp, struct display *p, int c,
+                           int yy, int xx);
+extern void fbcon_cfb4_putcs(struct vc_data *conp, struct display *p,
+                            const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_cfb4_revc(struct display *p, int xx, int yy);
+
+#endif /* _VIDEO_FBCON_CFB4_H */
diff --git a/include/video/fbcon-cfb8.h b/include/video/fbcon-cfb8.h
new file mode 100644 (file)
index 0000000..96189d0
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  FBcon low-level driver for 8 bpp packed pixel (cfb8)
+ */
+
+#ifndef _VIDEO_FBCON_CFB8_H
+#define _VIDEO_FBCON_CFB8_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_CFB8) || defined(CONFIG_FBCON_CFB8_MODULE)
+#define FBCON_HAS_CFB8
+#endif
+#else
+#if defined(CONFIG_FBCON_CFB8)
+#define FBCON_HAS_CFB8
+#endif
+#endif
+
+extern struct display_switch fbcon_cfb8;
+extern void fbcon_cfb8_setup(struct display *p);
+extern void fbcon_cfb8_bmove(struct display *p, int sy, int sx, int dy, int dx,
+                            int height, int width);
+extern void fbcon_cfb8_clear(struct vc_data *conp, struct display *p, int sy,
+                            int sx, int height, int width);
+extern void fbcon_cfb8_putc(struct vc_data *conp, struct display *p, int c,
+                           int yy, int xx);
+extern void fbcon_cfb8_putcs(struct vc_data *conp, struct display *p,
+                            const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_cfb8_revc(struct display *p, int xx, int yy);
+extern void fbcon_cfb8_clear_margins(struct vc_data *conp, struct display *p,
+                                    int bottom_only);
+
+#endif /* _VIDEO_FBCON_CFB8_H */
diff --git a/include/video/fbcon-ilbm.h b/include/video/fbcon-ilbm.h
new file mode 100644 (file)
index 0000000..80f9707
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  FBcon low-level driver for Amiga interleaved bitplanes (ilbm)
+ */
+
+#ifndef _VIDEO_FBCON_ILBM_H
+#define _VIDEO_FBCON_ILBM_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_ILBM) || defined(CONFIG_FBCON_ILBM_MODULE)  
+#define FBCON_HAS_ILBM 
+#endif
+#else
+#if defined(CONFIG_FBCON_ILBM) 
+#define FBCON_HAS_ILBM 
+#endif
+#endif
+
+extern struct display_switch fbcon_ilbm;
+extern void fbcon_ilbm_setup(struct display *p);
+extern void fbcon_ilbm_bmove(struct display *p, int sy, int sx, int dy, int dx,
+                            int height, int width);
+extern void fbcon_ilbm_clear(struct vc_data *conp, struct display *p, int sy,
+                            int sx, int height, int width);
+extern void fbcon_ilbm_putc(struct vc_data *conp, struct display *p, int c,
+                           int yy, int xx);
+extern void fbcon_ilbm_putcs(struct vc_data *conp, struct display *p,
+                            const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_ilbm_revc(struct display *p, int xx, int yy);
+
+#endif /* _VIDEO_FBCON_ILBM_H */
diff --git a/include/video/fbcon-iplan2p2.h b/include/video/fbcon-iplan2p2.h
new file mode 100644 (file)
index 0000000..b728680
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  FBcon low-level driver for Atari interleaved bitplanes (2 planes) (iplan2p2)
+ */
+
+#ifndef _VIDEO_FBCON_IPLAN2P2_H
+#define _VIDEO_FBCON_IPLAN2P2_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_IPLAN2P2) || defined(CONFIG_FBCON_IPLAN2P2_MODULE)
+#define FBCON_HAS_IPLAN2P2
+#endif
+#else
+#if defined(CONFIG_FBCON_IPLAN2P2)
+#define FBCON_HAS_IPLAN2P2
+#endif
+#endif
+
+extern struct display_switch fbcon_iplan2p2;
+extern void fbcon_iplan2p2_setup(struct display *p);
+extern void fbcon_iplan2p2_bmove(struct display *p, int sy, int sx, int dy,
+                                int dx, int height, int width);
+extern void fbcon_iplan2p2_clear(struct vc_data *conp, struct display *p,
+                                int sy, int sx, int height, int width);
+extern void fbcon_iplan2p2_putc(struct vc_data *conp, struct display *p, int c,
+                               int yy, int xx);
+extern void fbcon_iplan2p2_putcs(struct vc_data *conp, struct display *p,
+                                const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_iplan2p2_revc(struct display *p, int xx, int yy);
+
+#endif /* _VIDEO_FBCON_IPLAN2P2_H */
diff --git a/include/video/fbcon-iplan2p4.h b/include/video/fbcon-iplan2p4.h
new file mode 100644 (file)
index 0000000..a701202
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  FBcon low-level driver for Atari interleaved bitplanes (4 planes) (iplan2p4)
+ */
+
+#ifndef _VIDEO_FBCON_IPLAN2P4_H
+#define _VIDEO_FBCON_IPLAN2P4_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_IPLAN2P4) || defined(CONFIG_FBCON_IPLAN2P4_MODULE)
+#define FBCON_HAS_IPLAN2P4
+#endif
+#else
+#if defined(CONFIG_FBCON_IPLAN2P4)
+#define FBCON_HAS_IPLAN2P4
+#endif
+#endif
+
+extern struct display_switch fbcon_iplan2p4;
+extern void fbcon_iplan2p4_setup(struct display *p);
+extern void fbcon_iplan2p4_bmove(struct display *p, int sy, int sx, int dy,
+                                int dx, int height, int width);
+extern void fbcon_iplan2p4_clear(struct vc_data *conp, struct display *p,
+                                int sy, int sx, int height, int width);
+extern void fbcon_iplan2p4_putc(struct vc_data *conp, struct display *p, int c,
+                               int yy, int xx);
+extern void fbcon_iplan2p4_putcs(struct vc_data *conp, struct display *p,
+                                const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_iplan2p4_revc(struct display *p, int xx, int yy);
+
+#endif /* _VIDEO_FBCON_IPLAN2P4_H */
diff --git a/include/video/fbcon-iplan2p8.h b/include/video/fbcon-iplan2p8.h
new file mode 100644 (file)
index 0000000..6691e18
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  FBcon low-level driver for Atari interleaved bitplanes (8 planes) (iplan2p8)
+ */
+
+#ifndef _VIDEO_FBCON_IPLAN2P8_H
+#define _VIDEO_FBCON_IPLAN2P8_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_IPLAN2P8) || defined(CONFIG_FBCON_IPLAN2P8_MODULE)
+#define FBCON_HAS_IPLAN2P8
+#endif
+#else
+#if defined(CONFIG_FBCON_IPLAN2P8)
+#define FBCON_HAS_IPLAN2P8
+#endif
+#endif
+
+extern struct display_switch fbcon_iplan2p8;
+extern void fbcon_iplan2p8_setup(struct display *p);
+extern void fbcon_iplan2p8_bmove(struct display *p, int sy, int sx, int dy,
+                                int dx, int height, int width);
+extern void fbcon_iplan2p8_clear(struct vc_data *conp, struct display *p,
+                                int sy, int sx, int height, int width);
+extern void fbcon_iplan2p8_putc(struct vc_data *conp, struct display *p, int c,
+                               int yy, int xx);
+extern void fbcon_iplan2p8_putcs(struct vc_data *conp, struct display *p,
+                                const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_iplan2p8_revc(struct display *p, int xx, int yy);
+
+#endif /* _VIDEO_FBCON_IPLAN2P8_H */
diff --git a/include/video/fbcon-mac.h b/include/video/fbcon-mac.h
new file mode 100644 (file)
index 0000000..b275ff9
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  FBcon low-level driver for Mac variable bpp packed pixels (mac)
+ */
+
+#ifndef _VIDEO_FBCON_MAC_H
+#define _VIDEO_FBCON_MAC_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_MAC) || defined(CONFIG_FBCON_MAC_MODULE)
+#define FBCON_HAS_MAC
+#endif
+#else
+#if defined(CONFIG_FBCON_MAC)
+#define FBCON_HAS_MAC
+#endif
+#endif
+
+extern struct display_switch fbcon_mac;
+extern void fbcon_mac_setup(struct display *p);
+extern void fbcon_mac_bmove(struct display *p, int sy, int sx, int dy, int dx,
+                           int height, int width);
+extern void fbcon_mac_clear(struct vc_data *conp, struct display *p, int sy,
+                           int sx, int height, int width);
+extern void fbcon_mac_putc(struct vc_data *conp, struct display *p, int c,
+                          int yy, int xx);
+extern void fbcon_mac_putcs(struct vc_data *conp, struct display *p,
+                           const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_mac_revc(struct display *p, int xx, int yy);
+
+#endif /* _VIDEO_FBCON_MAC_H */
diff --git a/include/video/fbcon-mfb.h b/include/video/fbcon-mfb.h
new file mode 100644 (file)
index 0000000..f74e63d
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  FBcon low-level driver for Monochrome (mfb)
+ */
+
+#ifndef _VIDEO_FBCON_MFB_H
+#define _VIDEO_FBCON_MFB_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_MFB) || defined(CONFIG_FBCON_MFB_MODULE)
+#define FBCON_HAS_MFB
+#endif
+#else
+#if defined(CONFIG_FBCON_MFB)
+#define FBCON_HAS_MFB
+#endif
+#endif
+
+extern struct display_switch fbcon_mfb;
+extern void fbcon_mfb_setup(struct display *p);
+extern void fbcon_mfb_bmove(struct display *p, int sy, int sx, int dy, int dx,
+                           int height, int width);
+extern void fbcon_mfb_clear(struct vc_data *conp, struct display *p, int sy,
+                           int sx, int height, int width);
+extern void fbcon_mfb_putc(struct vc_data *conp, struct display *p, int c,
+                          int yy, int xx);
+extern void fbcon_mfb_putcs(struct vc_data *conp, struct display *p,
+                           const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_mfb_revc(struct display *p, int xx, int yy);
+
+#endif /* _VIDEO_FBCON_MFB_H */
diff --git a/include/video/fbcon-vga.h b/include/video/fbcon-vga.h
new file mode 100644 (file)
index 0000000..e7c7b2d
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  FBcon low-level driver for VGA characters/attributes
+ */
+
+#ifndef _VIDEO_FBCON_VGA_H
+#define _VIDEO_FBCON_VGA_H
+
+#include <linux/config.h>
+
+#ifdef MODULE
+#if defined(CONFIG_FBCON_VGA) || defined(CONFIG_FBCON_VGA_MODULE)
+#define FBCON_HAS_VGA
+#endif
+#else
+#if defined(CONFIG_FBCON_VGA)
+#define FBCON_HAS_VGA
+#endif
+#endif
+
+extern struct display_switch fbcon_vga;
+extern void fbcon_vga_setup(struct display *p);
+extern void fbcon_vga_bmove(struct display *p, int sy, int sx, int dy, int dx,
+                           int height, int width);
+extern void fbcon_vga_clear(struct vc_data *conp, struct display *p, int sy,
+                           int sx, int height, int width);
+extern void fbcon_vga_putc(struct vc_data *conp, struct display *p, int c,
+                          int yy, int xx);
+extern void fbcon_vga_putcs(struct vc_data *conp, struct display *p,
+                           const unsigned short *s, int count, int yy, int xx);
+extern void fbcon_vga_revc(struct display *p, int xx, int yy);
+
+#endif /* _VIDEO_FBCON_VGA_H */
diff --git a/include/video/fbcon.h b/include/video/fbcon.h
new file mode 100644 (file)
index 0000000..76860e1
--- /dev/null
@@ -0,0 +1,482 @@
+/*
+ *  linux/drivers/video/fbcon.h -- Low level frame buffer based console driver
+ *
+ *     Copyright (C) 1997 Geert Uytterhoeven
+ *
+ *  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.
+ */
+
+#ifndef _VIDEO_FBCON_H
+#define _VIDEO_FBCON_H
+
+#include <linux/config.h>
+#include <linux/console_struct.h>
+
+
+    /*                                  
+     *  `switch' for the Low Level Operations
+     */
+struct display_switch {                                                
+    void (*setup)(struct display *p);
+    void (*bmove)(struct display *p, int sy, int sx, int dy, int dx,
+                 int height, int width);
+    /* for clear, conp may be NULL, which means use a blanking (black) color */
+    void (*clear)(struct vc_data *conp, struct display *p, int sy, int sx,
+                 int height, int width);
+    void (*putc)(struct vc_data *conp, struct display *p, int c, int yy,
+                int xx);
+    void (*putcs)(struct vc_data *conp, struct display *p, const unsigned short *s,
+                 int count, int yy, int xx);     
+    void (*revc)(struct display *p, int xx, int yy);
+    void (*cursor)(struct display *p, int mode, int xx, int yy);
+    int  (*set_font)(struct display *p, int width, int height);
+    void (*clear_margins)(struct vc_data *conp, struct display *p,
+                         int bottom_only);
+    unsigned int fontwidthmask;      /* 1 at (1 << (width - 1)) if width is supported */
+}; 
+
+extern struct display_switch fbcon_dummy;
+
+#define fontheight(p) ((p)->_fontheight)
+#define fontheightlog(p) ((p)->_fontheightlog)
+
+#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
+
+/* fontwidth w is supported by dispsw */
+#define FONTWIDTH(w)   (1 << ((8) - 1))
+/* fontwidths w1-w2 inclusive are supported by dispsw */
+#define FONTWIDTHRANGE(w1,w2)  FONTWIDTH(8)
+
+#define fontwidth(p) (8)
+#define fontwidthlog(p) (0)
+
+#else
+
+/* fontwidth w is supported by dispsw */
+#define FONTWIDTH(w)   (1 << ((w) - 1))
+/* fontwidths w1-w2 inclusive are supported by dispsw */
+#define FONTWIDTHRANGE(w1,w2)  (FONTWIDTH(w2+1) - FONTWIDTH(w1))
+
+#define fontwidth(p) ((p)->_fontwidth)
+#define fontwidthlog(p) ((p)->_fontwidthlog)
+
+#endif
+
+    /*
+     *  Attribute Decoding
+     */
+
+/* Color */
+#define attr_fgcol(p,s)    \
+       (((s) >> ((p)->fgshift)) & 0x0f)
+#define attr_bgcol(p,s)    \
+       (((s) >> ((p)->bgshift)) & 0x0f)
+#define        attr_bgcol_ec(p,conp) \
+       ((conp) ? (((conp)->vc_video_erase_char >> ((p)->bgshift)) & 0x0f) : 0)
+
+/* Monochrome */
+#define attr_bold(p,s) \
+       ((s) & 0x200)
+#define attr_reverse(p,s) \
+       (((s) & 0x800) ^ ((p)->inverse ? 0x800 : 0))
+#define attr_underline(p,s) \
+       ((s) & 0x400)
+#define attr_blink(p,s) \
+       ((s) & 0x8000)
+       
+    /*
+     *  Scroll Method
+     */
+     
+/* Internal flags */
+#define __SCROLL_YPAN          0x001
+#define __SCROLL_YWRAP         0x002
+#define __SCROLL_YMOVE         0x003
+#define __SCROLL_YREDRAW       0x004
+#define __SCROLL_YMASK         0x00f
+#define __SCROLL_YFIXED                0x010
+#define __SCROLL_YNOMOVE       0x020
+#define __SCROLL_YPANREDRAW    0x040
+
+/* Only these should be used by the drivers */
+/* Which one should you use? If you have a fast card and slow bus,
+   then probably just 0 to indicate fbcon should choose between
+   YWRAP/YPAN+MOVE/YMOVE. On the other side, if you have a fast bus
+   and even better if your card can do fonting (1->8/32bit painting),
+   you should consider either SCROLL_YREDRAW (if your card is
+   able to do neither YPAN/YWRAP), or SCROLL_YNOMOVE.
+   The best is to test it with some real life scrolling (usually, not
+   all lines on the screen are filled completely with non-space characters,
+   and REDRAW performs much better on such lines, so don't cat a file
+   with every line covering all screen columns, it would not be the right
+   benchmark).
+ */
+#define SCROLL_YREDRAW         (__SCROLL_YFIXED|__SCROLL_YREDRAW)
+#define SCROLL_YNOMOVE         (__SCROLL_YNOMOVE|__SCROLL_YPANREDRAW)
+
+extern void fbcon_redraw_bmove(struct display *, int, int, int, int, int, int);
+
+
+/* ================================================================= */
+/*                      Utility Assembler Functions                  */
+/* ================================================================= */
+
+
+#ifdef __mc68000__
+
+/* ====================================================================== */
+
+/* Those of a delicate disposition might like to skip the next couple of
+ * pages.
+ *
+ * These functions are drop in replacements for memmove and
+ * memset(_, 0, _). However their five instances add at least a kilobyte
+ * to the object file. You have been warned.
+ *
+ * Not a great fan of assembler for the sake of it, but I think
+ * that these routines are at least 10 times faster than their C
+ * equivalents for large blits, and that's important to the lowest level of
+ * a graphics driver. Question is whether some scheme with the blitter
+ * would be faster. I suspect not for simple text system - not much
+ * asynchrony.
+ *
+ * Code is very simple, just gruesome expansion. Basic strategy is to
+ * increase data moved/cleared at each step to 16 bytes to reduce
+ * instruction per data move overhead. movem might be faster still
+ * For more than 15 bytes, we try to align the write direction on a
+ * longword boundary to get maximum speed. This is even more gruesome.
+ * Unaligned read/write used requires 68020+ - think this is a problem?
+ *
+ * Sorry!
+ */
+
+
+/* ++roman: I've optimized Robert's original versions in some minor
+ * aspects, e.g. moveq instead of movel, let gcc choose the registers,
+ * use movem in some places...
+ * For other modes than 1 plane, lots of more such assembler functions
+ * were needed (e.g. the ones using movep or expanding color values).
+ */
+
+/* ++andreas: more optimizations:
+   subl #65536,d0 replaced by clrw d0; subql #1,d0 for dbcc
+   addal is faster than addaw
+   movep is rather expensive compared to ordinary move's
+   some functions rewritten in C for clarity, no speed loss */
+
+static __inline__ void *mymemclear_small(void *s, size_t count)
+{
+   if (!count)
+      return(0);
+
+   __asm__ __volatile__(
+         "lsrl   #1,%1 ; jcc 1f ; moveb %2,%0@-\n\t"
+      "1: lsrl   #1,%1 ; jcc 1f ; movew %2,%0@-\n\t"
+      "1: lsrl   #1,%1 ; jcc 1f ; movel %2,%0@-\n\t"
+      "1: lsrl   #1,%1 ; jcc 1f ; movel %2,%0@- ; movel %2,%0@-\n\t"
+      "1: subql  #1,%1 ; jcs 3f\n\t"
+      "2: moveml %2/%3/%4/%5,%0@-\n\t"
+         "dbra %1,2b\n\t"
+      "3:"
+         : "=a" (s), "=d" (count)
+         :  "d" (0), "d" (0), "d" (0), "d" (0),
+            "0" ((char *)s+count), "1" (count)
+  );
+
+   return(0);
+}
+
+
+static __inline__ void *mymemclear(void *s, size_t count)
+{
+   if (!count)
+      return(0);
+
+   if (count < 16) {
+      __asm__ __volatile__(
+            "lsrl   #1,%1 ; jcc 1f ; clrb %0@+\n\t"
+         "1: lsrl   #1,%1 ; jcc 1f ; clrw %0@+\n\t"
+         "1: lsrl   #1,%1 ; jcc 1f ; clrl %0@+\n\t"
+         "1: lsrl   #1,%1 ; jcc 1f ; clrl %0@+ ; clrl %0@+\n\t"
+         "1:"
+            : "=a" (s), "=d" (count)
+            : "0" (s), "1" (count)
+     );
+   } else {
+      long tmp;
+      __asm__ __volatile__(
+            "movel %1,%2\n\t"
+            "lsrl   #1,%2 ; jcc 1f ; clrb %0@+ ; subqw #1,%1\n\t"
+            "lsrl   #1,%2 ; jcs 2f\n\t"  /* %0 increased=>bit 2 switched*/
+            "clrw   %0@+  ; subqw  #2,%1 ; jra 2f\n\t"
+         "1: lsrl   #1,%2 ; jcc 2f\n\t"
+            "clrw   %0@+  ; subqw  #2,%1\n\t"
+         "2: movew %1,%2; lsrl #2,%1 ; jeq 6f\n\t"
+            "lsrl   #1,%1 ; jcc 3f ; clrl %0@+\n\t"
+         "3: lsrl   #1,%1 ; jcc 4f ; clrl %0@+ ; clrl %0@+\n\t"
+         "4: subql  #1,%1 ; jcs 6f\n\t"
+         "5: clrl %0@+; clrl %0@+ ; clrl %0@+ ; clrl %0@+\n\t"
+            "dbra %1,5b   ; clrw %1; subql #1,%1; jcc 5b\n\t"
+         "6: movew %2,%1; btst #1,%1 ; jeq 7f ; clrw %0@+\n\t"
+         "7:            ; btst #0,%1 ; jeq 8f ; clrb %0@+\n\t"
+         "8:"
+            : "=a" (s), "=d" (count), "=d" (tmp)
+            : "0" (s), "1" (count)
+     );
+   }
+
+   return(0);
+}
+
+
+static __inline__ void *mymemset(void *s, size_t count)
+{
+   if (!count)
+      return(0);
+
+   __asm__ __volatile__(
+         "lsrl   #1,%1 ; jcc 1f ; moveb %2,%0@-\n\t"
+      "1: lsrl   #1,%1 ; jcc 1f ; movew %2,%0@-\n\t"
+      "1: lsrl   #1,%1 ; jcc 1f ; movel %2,%0@-\n\t"
+      "1: lsrl   #1,%1 ; jcc 1f ; movel %2,%0@- ; movel %2,%0@-\n\t"
+      "1: subql  #1,%1 ; jcs 3f\n\t"
+      "2: moveml %2/%3/%4/%5,%0@-\n\t"
+         "dbra %1,2b\n\t"
+      "3:"
+         : "=a" (s), "=d" (count)
+         :  "d" (-1), "d" (-1), "d" (-1), "d" (-1),
+            "0" ((char *) s + count), "1" (count)
+  );
+
+   return(0);
+}
+
+
+static __inline__ void *mymemmove(void *d, const void *s, size_t count)
+{
+   if (d < s) {
+      if (count < 16) {
+         __asm__ __volatile__(
+               "lsrl   #1,%2 ; jcc 1f ; moveb %1@+,%0@+\n\t"
+            "1: lsrl   #1,%2 ; jcc 1f ; movew %1@+,%0@+\n\t"
+            "1: lsrl   #1,%2 ; jcc 1f ; movel %1@+,%0@+\n\t"
+            "1: lsrl   #1,%2 ; jcc 1f ; movel %1@+,%0@+ ; movel %1@+,%0@+\n\t"
+            "1:"
+               : "=a" (d), "=a" (s), "=d" (count)
+               : "0" (d), "1" (s), "2" (count)
+        );
+      } else {
+         long tmp;
+         __asm__ __volatile__(
+               "movel  %0,%3\n\t"
+               "lsrl   #1,%3 ; jcc 1f ; moveb %1@+,%0@+ ; subqw #1,%2\n\t"
+               "lsrl   #1,%3 ; jcs 2f\n\t"  /* %0 increased=>bit 2 switched*/
+               "movew  %1@+,%0@+  ; subqw  #2,%2 ; jra 2f\n\t"
+            "1: lsrl   #1,%3 ; jcc 2f\n\t"
+               "movew  %1@+,%0@+  ; subqw  #2,%2\n\t"
+            "2: movew  %2,%-; lsrl #2,%2 ; jeq 6f\n\t"
+               "lsrl   #1,%2 ; jcc 3f ; movel %1@+,%0@+\n\t"
+            "3: lsrl   #1,%2 ; jcc 4f ; movel %1@+,%0@+ ; movel %1@+,%0@+\n\t"
+            "4: subql  #1,%2 ; jcs 6f\n\t"
+            "5: movel  %1@+,%0@+;movel %1@+,%0@+\n\t"
+               "movel  %1@+,%0@+;movel %1@+,%0@+\n\t"
+               "dbra   %2,5b ; clrw %2; subql #1,%2; jcc 5b\n\t"
+            "6: movew  %+,%2; btst #1,%2 ; jeq 7f ; movew %1@+,%0@+\n\t"
+            "7:              ; btst #0,%2 ; jeq 8f ; moveb %1@+,%0@+\n\t"
+            "8:"
+               : "=a" (d), "=a" (s), "=d" (count), "=d" (tmp)
+               : "0" (d), "1" (s), "2" (count)
+        );
+      }
+   } else {
+      if (count < 16) {
+         __asm__ __volatile__(
+               "lsrl   #1,%2 ; jcc 1f ; moveb %1@-,%0@-\n\t"
+            "1: lsrl   #1,%2 ; jcc 1f ; movew %1@-,%0@-\n\t"
+            "1: lsrl   #1,%2 ; jcc 1f ; movel %1@-,%0@-\n\t"
+            "1: lsrl   #1,%2 ; jcc 1f ; movel %1@-,%0@- ; movel %1@-,%0@-\n\t"
+            "1:"
+               : "=a" (d), "=a" (s), "=d" (count)
+               : "0" ((char *) d + count), "1" ((char *) s + count), "2" (count)
+        );
+      } else {
+         long tmp;
+         __asm__ __volatile__(
+               "movel %0,%3\n\t"
+               "lsrl   #1,%3 ; jcc 1f ; moveb %1@-,%0@- ; subqw #1,%2\n\t"
+               "lsrl   #1,%3 ; jcs 2f\n\t"  /* %0 increased=>bit 2 switched*/
+               "movew  %1@-,%0@-  ; subqw  #2,%2 ; jra 2f\n\t"
+            "1: lsrl   #1,%3 ; jcc 2f\n\t"
+               "movew  %1@-,%0@-  ; subqw  #2,%2\n\t"
+            "2: movew %2,%-; lsrl #2,%2 ; jeq 6f\n\t"
+               "lsrl   #1,%2 ; jcc 3f ; movel %1@-,%0@-\n\t"
+            "3: lsrl   #1,%2 ; jcc 4f ; movel %1@-,%0@- ; movel %1@-,%0@-\n\t"
+            "4: subql  #1,%2 ; jcs 6f\n\t"
+            "5: movel %1@-,%0@-;movel %1@-,%0@-\n\t"
+               "movel %1@-,%0@-;movel %1@-,%0@-\n\t"
+               "dbra %2,5b ; clrw %2; subql #1,%2; jcc 5b\n\t"
+            "6: movew %+,%2; btst #1,%2 ; jeq 7f ; movew %1@-,%0@-\n\t"
+            "7:              ; btst #0,%2 ; jeq 8f ; moveb %1@-,%0@-\n\t"
+            "8:"
+               : "=a" (d), "=a" (s), "=d" (count), "=d" (tmp)
+               : "0" ((char *) d + count), "1" ((char *) s + count), "2" (count)
+        );
+      }
+   }
+
+   return(0);
+}
+
+
+/* ++andreas: Simple and fast version of memmove, assumes size is
+   divisible by 16, suitable for moving the whole screen bitplane */
+static __inline__ void fast_memmove(char *dst, const char *src, size_t size)
+{
+  if (!size)
+    return;
+  if (dst < src)
+    __asm__ __volatile__
+      ("1:"
+       "  moveml %0@+,%/d0/%/d1/%/a0/%/a1\n"
+       "  moveml %/d0/%/d1/%/a0/%/a1,%1@\n"
+       "  addql #8,%1; addql #8,%1\n"
+       "  dbra %2,1b\n"
+       "  clrw %2; subql #1,%2\n"
+       "  jcc 1b"
+       : "=a" (src), "=a" (dst), "=d" (size)
+       : "0" (src), "1" (dst), "2" (size / 16 - 1)
+       : "d0", "d1", "a0", "a1", "memory");
+  else
+    __asm__ __volatile__
+      ("1:"
+       "  subql #8,%0; subql #8,%0\n"
+       "  moveml %0@,%/d0/%/d1/%/a0/%/a1\n"
+       "  moveml %/d0/%/d1/%/a0/%/a1,%1@-\n"
+       "  dbra %2,1b\n"
+       "  clrw %2; subql #1,%2\n"
+       "  jcc 1b"
+       : "=a" (src), "=a" (dst), "=d" (size)
+       : "0" (src + size), "1" (dst + size), "2" (size / 16 - 1)
+       : "d0", "d1", "a0", "a1", "memory");
+}
+
+#else /* !m68k */
+
+    /*
+     *  Anyone who'd like to write asm functions for other CPUs?
+     *   (Why are these functions better than those from include/asm/string.h?)
+     */
+
+#ifndef CONFIG_SUN4
+
+static __inline__ void *mymemclear_small(void *s, size_t count)
+{
+    return(memset(s, 0, count));
+}
+
+static __inline__ void *mymemclear(void *s, size_t count)
+{
+    return(memset(s, 0, count));
+}
+
+static __inline__ void *mymemset(void *s, size_t count)
+{
+    return(memset(s, 255, count));
+}
+
+#else
+
+/* You may think that I'm crazy and that I should use generic
+   routines.  No, I'm not: sun4's framebuffer crashes if we std
+   into it, so we cannot use memset.  */
+
+static __inline__ void *sun4_memset(void *s, char val, size_t count)
+{
+    int i;
+    for(i=0; i<count;i++)
+        ((char *) s) [i] = val;
+    return s;
+}
+
+static __inline__ void *mymemset(void *s, size_t count)
+{
+    return sun4_memset(s, 255, count);
+}
+
+static __inline__ void *mymemclear(void *s, size_t count)
+{
+    return sun4_memset(s, 0, count);
+}
+
+static __inline__ void *mymemclear_small(void *s, size_t count)
+{
+    return sun4_memset(s, 0, count);
+}
+#endif
+
+#ifdef __i386__
+static __inline__ void fast_memmove(void *d, const void *s, size_t count)
+{
+    if (d < s) {
+__asm__ __volatile__ (
+       "cld\n\t"
+       "shrl $1,%%ecx\n\t"
+       "jnc 1f\n\t"
+       "movsb\n"
+       "1:\tshrl $1,%%ecx\n\t"
+       "jnc 2f\n\t"
+       "movsw\n"
+       "2:\trep\n\t"
+       "movsl"
+       : /* no output */
+       :"c"(count),"D"((long)d),"S"((long)s)
+       :"cx","di","si","memory");
+    } else {
+__asm__ __volatile__ (
+       "std\n\t"
+       "shrl $1,%%ecx\n\t"
+       "jnc 1f\n\t"
+       "movb 3(%%esi),%%al\n\t"
+       "movb %%al,3(%%edi)\n\t"
+       "decl %%esi\n\t"
+       "decl %%edi\n"
+       "1:\tshrl $1,%%ecx\n\t"
+       "jnc 2f\n\t"
+       "movw 2(%%esi),%%ax\n\t"
+       "movw %%ax,2(%%edi)\n\t"
+       "decl %%esi\n\t"
+       "decl %%edi\n\t"
+       "decl %%esi\n\t"
+       "decl %%edi\n"
+       "2:\trep\n\t"
+       "movsl\n\t"
+       "cld"
+       : /* no output */
+       :"c"(count),"D"(count-4+(long)d),"S"(count-4+(long)s)
+       :"ax","cx","di","si","memory");
+    }
+}
+
+static __inline__ void *mymemmove(char *dst, const char *src, size_t size)
+{
+    fast_memmove(dst, src, size);
+    return dst;
+}
+#else
+static __inline__ void *mymemmove(void *d, const void *s, size_t count)
+{
+    return(memmove(d, s, count));
+}
+
+static __inline__ void fast_memmove(char *dst, const char *src, size_t size)
+{
+    memmove(dst, src, size);
+}
+#endif /* !i386 */
+
+#endif /* !m68k */
+
+#endif /* _VIDEO_FBCON_H */
diff --git a/include/video/font.h b/include/video/font.h
new file mode 100644 (file)
index 0000000..bdb7fc4
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ *  font.h -- `Soft' font definitions
+ *
+ *  Created 1995 by Geert Uytterhoeven
+ *
+ *  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.
+ */
+
+#ifndef _VIDEO_FONT_H
+#define _VIDEO_FONT_H
+
+#ifdef __ASSEMBLY__
+
+#ifdef __mc68000__
+#define FBCON_FONT_DESC_idx    0
+#define FBCON_FONT_DESC_name   (FBCON_FONT_DESC_idx   +4)
+#define FBCON_FONT_DESC_width  (FBCON_FONT_DESC_name  +4)
+#define FBCON_FONT_DESC_height (FBCON_FONT_DESC_width +4)
+#define FBCON_FONT_DESC_data   (FBCON_FONT_DESC_height+4)
+#define FBCON_FONT_DESC_pref   (FBCON_FONT_DESC_data  +4)
+#endif
+
+#else /* __ASSEMBLY__ */
+
+#include <linux/types.h>
+
+struct fbcon_font_desc {
+    int idx;
+    char *name;
+    int width, height;
+    void *data;
+    int pref;
+};
+
+#define VGA8x8_IDX     0
+#define VGA8x16_IDX    1
+#define PEARL8x8_IDX   2
+#define VGA6x11_IDX    3
+#define SUN8x16_IDX    4
+#define SUN12x22_IDX   5
+#define ACORN8x8_IDX   6
+
+extern struct fbcon_font_desc  font_vga_8x8,
+                               font_vga_8x16,
+                               font_pearl_8x8,
+                               font_vga_6x11,
+                               font_sun_8x16,
+                               font_sun_12x22,
+                               font_acorn_8x8;
+
+/* Find a font with a specific name */
+
+extern struct fbcon_font_desc *fbcon_find_font(char *name);
+
+/* Get the default font for a specific screen size */
+
+extern struct fbcon_font_desc *fbcon_get_default_font(int xres, int yres);
+
+/* Max. length for the name of a predefined font */
+#define MAX_FONT_NAME  32
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _VIDEO_FONT_H */
diff --git a/include/video/macmodes.h b/include/video/macmodes.h
new file mode 100644 (file)
index 0000000..c459987
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ *  linux/drivers/video/macmodes.h -- Standard MacOS video modes
+ *
+ *     Copyright (C) 1998 Geert Uytterhoeven
+ *
+ *  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.
+ */
+
+#ifndef _VIDEO_MACMODES_H
+#define _VIDEO_MACMODES_H
+
+    /*
+     *  Video mode values.
+     *  These are supposed to be the same as the values that Apple uses in
+     *  MacOS.
+     */
+
+#define VMODE_NVRAM            0
+#define VMODE_512_384_60I      1       /* 512x384, 60Hz interlaced (NTSC) */
+#define VMODE_512_384_60       2       /* 512x384, 60Hz */
+#define VMODE_640_480_50I      3       /* 640x480, 50Hz interlaced (PAL) */
+#define VMODE_640_480_60I      4       /* 640x480, 60Hz interlaced (NTSC) */
+#define VMODE_640_480_60       5       /* 640x480, 60Hz (VGA) */
+#define VMODE_640_480_67       6       /* 640x480, 67Hz */
+#define VMODE_640_870_75P      7       /* 640x870, 75Hz (portrait) */
+#define VMODE_768_576_50I      8       /* 768x576, 50Hz (PAL full frame) */
+#define VMODE_800_600_56       9       /* 800x600, 56Hz */
+#define VMODE_800_600_60       10      /* 800x600, 60Hz */
+#define VMODE_800_600_72       11      /* 800x600, 72Hz */
+#define VMODE_800_600_75       12      /* 800x600, 75Hz */
+#define VMODE_832_624_75       13      /* 832x624, 75Hz */
+#define VMODE_1024_768_60      14      /* 1024x768, 60Hz */
+#define VMODE_1024_768_70      15      /* 1024x768, 70Hz (or 72Hz?) */
+#define VMODE_1024_768_75V     16      /* 1024x768, 75Hz (VESA) */
+#define VMODE_1024_768_75      17      /* 1024x768, 75Hz */
+#define VMODE_1152_870_75      18      /* 1152x870, 75Hz */
+#define VMODE_1280_960_75      19      /* 1280x960, 75Hz */
+#define VMODE_1280_1024_75     20      /* 1280x1024, 75Hz */
+#define VMODE_MAX              20
+#define VMODE_CHOOSE           99
+
+#define CMODE_NVRAM            -1
+#define CMODE_8                        0       /* 8 bits/pixel */
+#define CMODE_16               1       /* 16 (actually 15) bits/pixel */
+#define CMODE_32               2       /* 32 (actually 24) bits/pixel */
+
+
+extern int mac_vmode_to_var(int vmode, int cmode,
+                           struct fb_var_screeninfo *var);
+extern int mac_var_to_vmode(const struct fb_var_screeninfo *var, int *vmode,
+                           int *cmode);
+extern int mac_map_monitor_sense(int sense);
+
+
+    /*
+     *  Addresses in NVRAM where video mode and pixel size are stored.
+     */
+
+#define NV_VMODE               0x140f
+#define NV_CMODE               0x1410
+
+#endif /* _VIDEO_MACMODES_H */
diff --git a/include/video/s3blit.h b/include/video/s3blit.h
new file mode 100644 (file)
index 0000000..b1db631
--- /dev/null
@@ -0,0 +1,79 @@
+#ifndef _VIDEO_S3BLIT_H
+#define _VIDEO_S3BLIT_H
+
+/* s3 commands */
+#define S3_BITBLT       0xc011
+#define S3_TWOPOINTLINE 0x2811
+#define S3_FILLEDRECT   0x40b1
+
+#define S3_FIFO_EMPTY 0x0400
+#define S3_HDW_BUSY   0x0200
+
+/* Enhanced register mapping (MMIO mode) */
+
+#define S3_READ_SEL      0xbee8 /* offset f */
+#define S3_MULT_MISC     0xbee8 /* offset e */
+#define S3_ERR_TERM      0x92e8
+#define S3_FRGD_COLOR    0xa6e8
+#define S3_BKGD_COLOR    0xa2e8
+#define S3_PIXEL_CNTL    0xbee8 /* offset a */
+#define S3_FRGD_MIX      0xbae8
+#define S3_BKGD_MIX      0xb6e8
+#define S3_CUR_Y         0x82e8
+#define S3_CUR_X         0x86e8
+#define S3_DESTY_AXSTP   0x8ae8
+#define S3_DESTX_DIASTP  0x8ee8
+#define S3_MIN_AXIS_PCNT 0xbee8 /* offset 0 */
+#define S3_MAJ_AXIS_PCNT 0x96e8
+#define S3_CMD           0x9ae8
+#define S3_GP_STAT       0x9ae8
+#define S3_ADVFUNC_CNTL  0x4ae8
+#define S3_WRT_MASK      0xaae8
+#define S3_RD_MASK       0xaee8
+
+/* Enhanced register mapping (Packed MMIO mode, write only) */
+#define S3_ALT_CURXY     0x8100
+#define S3_ALT_CURXY2    0x8104
+#define S3_ALT_STEP      0x8108
+#define S3_ALT_STEP2     0x810c
+#define S3_ALT_ERR       0x8110
+#define S3_ALT_CMD       0x8118
+#define S3_ALT_MIX       0x8134
+#define S3_ALT_PCNT      0x8148
+#define S3_ALT_PAT       0x8168
+
+/* Drawing modes */
+#define S3_NOTCUR          0x0000
+#define S3_LOGICALZERO     0x0001
+#define S3_LOGICALONE      0x0002
+#define S3_LEAVEASIS       0x0003
+#define S3_NOTNEW          0x0004
+#define S3_CURXORNEW       0x0005
+#define S3_NOT_CURXORNEW   0x0006
+#define S3_NEW             0x0007
+#define S3_NOTCURORNOTNEW  0x0008
+#define S3_CURORNOTNEW     0x0009
+#define S3_NOTCURORNEW     0x000a
+#define S3_CURORNEW        0x000b
+#define S3_CURANDNEW       0x000c
+#define S3_NOTCURANDNEW    0x000d
+#define S3_CURANDNOTNEW    0x000e
+#define S3_NOTCURANDNOTNEW 0x000f
+
+#define S3_CRTC_ADR    0x03d4
+#define S3_CRTC_DATA   0x03d5
+
+#define S3_REG_LOCK2 0x39
+#define S3_HGC_MODE  0x45
+
+#define S3_HWGC_ORGX_H 0x46
+#define S3_HWGC_ORGX_L 0x47
+#define S3_HWGC_ORGY_H 0x48
+#define S3_HWGC_ORGY_L 0x49
+#define S3_HWGC_DX     0x4e
+#define S3_HWGC_DY     0x4f
+
+
+#define S3_LAW_CTL 0x58
+
+#endif /* _VIDEO_S3BLIT_H */
diff --git a/include/video/sbusfb.h b/include/video/sbusfb.h
new file mode 100644 (file)
index 0000000..2a6d912
--- /dev/null
@@ -0,0 +1,138 @@
+#include <linux/timer.h>
+#include <asm/sbus.h>
+#include <asm/oplib.h>
+#include <asm/fbio.h>
+
+#include <video/fbcon.h>
+
+struct bt_regs {
+       volatile unsigned int addr;           /* address register */
+       volatile unsigned int color_map;      /* color map */
+       volatile unsigned int control;        /* control register */
+       volatile unsigned int cursor;         /* cursor map register */
+};
+
+struct fb_info_creator {
+       struct ffb_fbc *fbc;
+       struct ffb_dac *dac;
+       int dac_rev;
+       int xy_margin;
+};
+struct fb_info_cgsix {
+       struct bt_regs *bt;
+       struct cg6_fbc *fbc;
+       struct cg6_thc *thc;
+       struct cg6_tec *tec;
+       volatile u32 *fhc;
+};
+struct fb_info_bwtwo {
+       struct bw2_regs *regs;
+};
+struct fb_info_cgthree {
+       struct cg3_regs *regs;
+};
+struct fb_info_tcx {
+       struct bt_regs *bt;
+       struct tcx_thc *thc;
+       struct tcx_tec *tec;
+       u32 *cplane;
+};
+struct fb_info_leo {
+       struct leo_lx_krn *lx_krn;
+       struct leo_lc_ss0_usr *lc_ss0_usr;
+       struct leo_ld_ss0 *ld_ss0;
+       struct leo_ld_ss1 *ld_ss1;
+       struct leo_cursor *cursor;
+       unsigned int extent;
+};
+struct fb_info_cgfourteen {
+       struct cg14_regs *regs;
+       struct cg14_cursor *cursor;
+       struct cg14_clut *clut;
+       int ramsize;
+       int mode;
+};
+
+struct cg_cursor {
+       char    enable;         /* cursor is enabled */
+       char    mode;           /* cursor mode */
+       struct  fbcurpos cpos;  /* position */
+       struct  fbcurpos chot;  /* hot-spot */
+       struct  fbcurpos size;  /* size of mask & image fields */
+       struct  fbcurpos hwsize; /* hw max size */
+       int     bits[2][128];   /* space for mask & image bits */
+       char    color [6];      /* cursor colors */
+       struct  timer_list timer; /* cursor timer */
+       int     blink_rate;     /* cursor blink rate */
+};
+
+struct sbus_mmap_map {
+       unsigned long voff;
+       unsigned long poff;
+       unsigned long size;
+};
+
+#define SBUS_MMAP_FBSIZE(n) (-n)
+#define SBUS_MMAP_EMPTY        0x80000000
+
+struct fb_info_sbusfb {
+       struct fb_info info;
+       struct fb_fix_screeninfo fix;
+       struct fb_var_screeninfo var;
+       struct display disp;
+       struct display_switch dispsw;
+       struct fbtype type;
+       struct linux_sbus_device *sbdp;
+       int prom_node, prom_parent;
+       union {
+               struct fb_info_creator ffb;
+               struct fb_info_cgsix cg6;
+               struct fb_info_bwtwo bw2;
+               struct fb_info_cgthree cg3;
+               struct fb_info_tcx tcx;
+               struct fb_info_leo leo;
+               struct fb_info_cgfourteen cg14;
+       } s;
+       unsigned char *color_map;
+       struct cg_cursor cursor;
+       unsigned char open;
+       unsigned char mmaped;
+       unsigned char blanked;
+       int x_margin;
+       int y_margin;
+       int vtconsole;
+       int consolecnt;
+       int graphmode;
+       int emulations[4];
+       struct sbus_mmap_map *mmap_map;
+       unsigned long physbase;
+       int iospace;
+       /* Methods */
+       void (*setup)(struct display *);
+       void (*setcursor)(struct fb_info_sbusfb *);
+       void (*setcurshape)(struct fb_info_sbusfb *);
+       void (*setcursormap)(struct fb_info_sbusfb *, unsigned char *, unsigned char *, unsigned char *);
+       void (*loadcmap)(struct fb_info_sbusfb *, struct display *, int, int);
+       void (*blank)(struct fb_info_sbusfb *);
+       void (*unblank)(struct fb_info_sbusfb *);
+       void (*margins)(struct fb_info_sbusfb *, struct display *, int, int);
+       void (*reset)(struct fb_info_sbusfb *);
+       void (*fill)(struct fb_info_sbusfb *, struct display *, int, int, unsigned short *);
+       void (*switch_from_graph)(struct fb_info_sbusfb *);
+       void (*restore_palette)(struct fb_info_sbusfb *);
+       int (*ioctl)(struct fb_info_sbusfb *, unsigned int, unsigned long);
+};
+
+extern char *creatorfb_init(struct fb_info_sbusfb *);
+extern char *cgsixfb_init(struct fb_info_sbusfb *);
+extern char *cgthreefb_init(struct fb_info_sbusfb *);
+extern char *tcxfb_init(struct fb_info_sbusfb *);
+extern char *leofb_init(struct fb_info_sbusfb *);
+extern char *bwtwofb_init(struct fb_info_sbusfb *);
+extern char *cgfourteenfb_init(struct fb_info_sbusfb *);
+
+#define sbusfbinfod(disp) ((struct fb_info_sbusfb *)(disp->fb_info))
+#define sbusfbinfo(info) ((struct fb_info_sbusfb *)(info))
+#define CM(i, j) [3*(i)+(j)]
+
+#define SBUSFBINIT_SIZECHANGE ((char *)-1)
index b7502f95fd22c41905b4a0981c991bd9b81b5ff3..94bb6947bdab587b4d526fb33d1d4f19b7e2dbf3 100644 (file)
@@ -305,6 +305,9 @@ extern void nfs_root_setup(char *str, int *ints);
 #ifdef CONFIG_FTAPE
 extern void ftape_setup(char *str, int *ints);
 #endif
+#ifdef CONFIG_MDA_CONSOLE
+extern void mdacon_setup(char *str, int *ints);
+#endif
 
 #if defined(CONFIG_SYSVIPC)
 extern void ipc_init(void);
@@ -317,10 +320,6 @@ extern void dquot_init_hash(void);
 extern void md_setup(char *str,int *ints) __init;
 #endif
 
-#ifdef __sparc__
-extern int serial_console;
-#endif
-
 /*
  * Boot command-line arguments
  */
@@ -544,10 +543,13 @@ static struct kernel_param cooked_params[] __initdata = {
 #endif
        { "panic=", panic_setup },
        { "console=", console_setup },
-#ifdef CONFIG_VT
 #ifdef CONFIG_VGA_CONSOLE
        { "no-scroll", no_scroll },
 #endif
+#ifdef CONFIG_MDA_CONSOLE
+       { "mdacon=", mdacon_setup },
+#endif
+#ifdef CONFIG_VT
        { "kbd-reset", kbd_reset_setup },
 #endif
 #ifdef CONFIG_BUGi386
index 323ecc381ea030574f33f6d544c52b9169ae17b9..6c4e8ea8eb6c557167f13f0d50918f9db87d63cd 100644 (file)
@@ -58,6 +58,7 @@ static void   call_reconnect(struct rpc_task *task);
 static u32 *   call_header(struct rpc_task *task);
 static u32 *   call_verify(struct rpc_task *task);
 
+
 /*
  * Create an RPC client
  * FIXME: This should also take a flags argument (as in task->tk_flags).
@@ -500,13 +501,12 @@ static void
 call_receive(struct rpc_task *task)
 {
        dprintk("RPC: %4d call_receive (status %d)\n", 
-                               task->tk_pid, task->tk_status);
+               task->tk_pid, task->tk_status);
 
+       task->tk_action = call_status;
        /* In case of error, evaluate status */
-       if (task->tk_status < 0) {
-               task->tk_action = call_status;
+       if (task->tk_status < 0)
                return;
-       }
 
        /* If we have no decode function, this means we're performing
         * a void call (a la lockd message passing). */
@@ -516,7 +516,6 @@ call_receive(struct rpc_task *task)
                return;
        }
 
-       task->tk_action = call_status;
        xprt_receive(task);
 }
 
@@ -579,7 +578,8 @@ call_timeout(struct rpc_task *task)
                                task->tk_pid);
                        goto minor_timeout;
                }
-               if ((to->to_initval <<= 1) > to->to_maxval)
+               to->to_initval <<= 1;
+               if (to->to_initval > to->to_maxval)
                        to->to_initval = to->to_maxval;
        }
 
@@ -592,9 +592,13 @@ call_timeout(struct rpc_task *task)
                return;
        }
        if (clnt->cl_chatty && !(task->tk_flags & RPC_CALL_MAJORSEEN)) {
-               printk("%s: server %s not responding, still trying\n",
-                       clnt->cl_protname, clnt->cl_server);
                task->tk_flags |= RPC_CALL_MAJORSEEN;
+               if (req)
+                       printk("%s: server %s not responding, still trying\n",
+                               clnt->cl_protname, clnt->cl_server);
+               else 
+                       printk("%s: task %d can't get a request slot\n",
+                               clnt->cl_protname, task->tk_pid);
        }
        if (clnt->cl_autobind)
                clnt->cl_port = 0;
index dd6d593355ddcbc05037f1f3418df1407956e547..66a5f8e0eb7b2846ac62f208f322abd9aeb8b7e1 100644 (file)
@@ -76,43 +76,52 @@ svc_serv_dequeue(struct svc_serv *serv, struct svc_rqst *rqstp)
 static inline void
 svc_release_skb(struct svc_rqst *rqstp)
 {
-       if (!rqstp->rq_skbuff)
-               return;
+       struct sk_buff *skb = rqstp->rq_skbuff;
 
-       dprintk("svc: releasing skb %p\n", rqstp->rq_skbuff);
-       skb_free_datagram(rqstp->rq_sock->sk_sk, rqstp->rq_skbuff);
+       if (!skb)
+               return;
        rqstp->rq_skbuff = NULL;
+
+       dprintk("svc: service %p, releasing skb %p\n", rqstp, skb);
+       skb_free_datagram(rqstp->rq_sock->sk_sk, skb);
 }
 
 /*
  * Queue up a socket with data pending. If there are idle nfsd
- * processes, wake'em up.
+ * processes, wake 'em up.
  * When calling this function, you should make sure it can't be interrupted
  * by the network bottom half.
  */
-static inline void
+static void
 svc_sock_enqueue(struct svc_sock *svsk)
 {
+       struct svc_serv *serv = svsk->sk_server;
        struct svc_rqst *rqstp;
-       struct svc_serv *serv;
+
+       if (serv->sv_threads && serv->sv_sockets)
+               printk(KERN_ERR
+                       "svc_sock_enqueue: threads and sockets both waiting??\n");
 
        if (svsk->sk_busy) {
                /* Don't enqueue socket while daemon is receiving */
-               dprintk("svc: socket %p not enqueued: busy\n", svsk->sk_sk);
+               dprintk("svc: socket %p busy, not enqueued\n", svsk->sk_sk);
                return;
        }
 
        /* Mark socket as busy. It will remain in this state until the
         * server has processed all pending data and put the socket back
-        * on the idle list
+        * on the idle list.
         */
        svsk->sk_busy = 1;
 
-       serv = svsk->sk_server;
        if ((rqstp = serv->sv_threads) != NULL) {
                dprintk("svc: socket %p served by daemon %p\n",
-                                               svsk->sk_sk, rqstp);
+                       svsk->sk_sk, rqstp);
                svc_serv_dequeue(serv, rqstp);
+               if (rqstp->rq_sock)
+                       printk(KERN_ERR 
+                               "svc_sock_enqueue: server %p, rq_sock=%p!\n",
+                               rqstp, rqstp->rq_sock);
                rqstp->rq_sock = svsk;
                svsk->sk_inuse++;
                wake_up(&rqstp->rq_wait);
@@ -137,7 +146,8 @@ svc_sock_dequeue(struct svc_serv *serv)
        end_bh_atomic();
 
        if (svsk) {
-               dprintk("svc: socket %p dequeued\n", svsk->sk_sk);
+               dprintk("svc: socket %p dequeued, inuse=%d\n",
+                       svsk->sk_sk, svsk->sk_inuse);
                svsk->sk_qued = 0;
        }
 
@@ -325,13 +335,12 @@ svc_recvfrom(struct svc_rqst *rqstp, struct iovec *iov, int nr, int buflen)
 static void
 svc_udp_data_ready(struct sock *sk, int count)
 {
-       struct svc_sock *svsk;
+       struct svc_sock *svsk = (struct svc_sock *)(sk->user_data);
 
-       dprintk("svc: socket %p data ready (inet %p)\n", sk->user_data, sk);
-
-       svsk = (struct svc_sock *)(sk->user_data);
        if (!svsk)
                return;
+       dprintk("svc: socket %p(inet %p), count=%d, busy=%d\n",
+               svsk, sk, count, svsk->sk_busy);
        svsk->sk_data = 1;
        svc_sock_enqueue(svsk);
 }
@@ -724,12 +733,21 @@ svc_tcp_init(struct svc_sock *svsk)
 int
 svc_recv(struct svc_serv *serv, struct svc_rqst *rqstp)
 {
-       struct wait_queue       wait = { current, NULL };
        struct svc_sock         *svsk;
        int                     len;
+       struct wait_queue       wait = { current, NULL };
 
        dprintk("svc: server %p waiting for data (to = %ld)\n",
-                                       rqstp, current->timeout);
+               rqstp, current->timeout);
+
+       if (rqstp->rq_sock)
+               printk(KERN_ERR 
+                       "svc_recv: service %p, socket not NULL!\n",
+                        rqstp);
+       if (waitqueue_active(&rqstp->rq_wait))
+               printk(KERN_ERR 
+                       "svc_recv: service %p, wait queue active!\n",
+                        rqstp);
 
 again:
        /* Initialize the buffers */
@@ -741,13 +759,10 @@ again:
 
        start_bh_atomic();
        if ((svsk = svc_sock_dequeue(serv)) != NULL) {
-               end_bh_atomic();
                rqstp->rq_sock = svsk;
-               svsk->sk_inuse++; /* N.B. where is this decremented? */
+               svsk->sk_inuse++;
        } else {
                /* No data pending. Go to sleep */
-               rqstp->rq_sock = NULL;
-               rqstp->rq_wait = NULL;
                svc_serv_enqueue(serv, rqstp);
 
                /*
@@ -759,15 +774,22 @@ again:
                end_bh_atomic();
                schedule();
 
+               remove_wait_queue(&rqstp->rq_wait, &wait);
+
+               start_bh_atomic();
                if (!(svsk = rqstp->rq_sock)) {
                        svc_serv_dequeue(serv, rqstp);
-                       if (!(svsk = rqstp->rq_sock))
-                               return signalled()? -EINTR : -EAGAIN;
+                       end_bh_atomic();
+                       dprintk("svc: server %p, no data yet\n", rqstp);
+                       return signalled()? -EINTR : -EAGAIN;
                }
        }
+       end_bh_atomic();
 
-       dprintk("svc: server %p servicing socket %p\n", rqstp, svsk);
+       dprintk("svc: server %p, socket %p, inuse=%d\n",
+                rqstp, svsk, svsk->sk_inuse);
        len = svsk->sk_recvfrom(rqstp);
+       dprintk("svc: got len=%d\n", len);
 
        /* No data, incomplete (TCP) read, or accept() */
        if (len == 0 || len == -EAGAIN) {
index d86a5b323e3be21d7a5775d8afa1c0b1026b6211..851f4d9523a9724d6dee151f6a64470db05ab228 100644 (file)
@@ -310,7 +310,7 @@ xprt_adjust_cwnd(struct rpc_xprt *xprt, int result)
                if ((cwnd >>= 1) < RPC_CWNDSCALE)
                        cwnd = RPC_CWNDSCALE;
                xprt->congtime = jiffies + ((cwnd * HZ) << 3) / RPC_CWNDSCALE;
-               dprintk("RPC:      cong %08lx, cwnd was %08lx, now %08lx, "
+               dprintk("RPC:      cong %ld, cwnd was %ld, now %ld, "
                        "time %ld ms\n", xprt->cong, xprt->cwnd, cwnd,
                        (xprt->congtime-jiffies)*1000/HZ);
                pprintk("RPC: %lu %ld cwnd\n", jiffies, cwnd);
@@ -884,11 +884,14 @@ tcp_write_space(struct sock *sk)
 static void
 xprt_timer(struct rpc_task *task)
 {
-       if (task->tk_rqstp)
+       struct rpc_rqst *req = task->tk_rqstp;
+
+       if (req) {
                xprt_adjust_cwnd(task->tk_xprt, -ETIMEDOUT);
+       }
 
-       dprintk("RPC: %4d xprt_timer (%s request)\n", task->tk_pid,
-                       task->tk_rqstp? "pending" : "backlogged");
+       dprintk("RPC: %4d xprt_timer (%s request)\n",
+               task->tk_pid, req ? "pending" : "backlogged");
 
        task->tk_status  = -ETIMEDOUT;
        task->tk_timeout = 0;
@@ -1155,12 +1158,13 @@ xprt_reserve_status(struct rpc_task *task)
        return;
 
 bad_list:
-       printk("RPC: %4d inconsistent free list (cong %ld cwnd %ld)\n",
+       printk(KERN_ERR 
+               "RPC: %4d inconsistent free list (cong %ld cwnd %ld)\n",
                task->tk_pid, xprt->cong, xprt->cwnd);
        rpc_debug = ~0;
        goto bummer;
 bad_used:
-       printk("RPC: used rqst slot %p on free list!\n", req);
+       printk(KERN_ERR "RPC: used rqst slot %p on free list!\n", req);
 bummer:
        task->tk_status = -EIO;
        xprt->free = NULL;
@@ -1216,12 +1220,16 @@ xprt_release(struct rpc_task *task)
        }
        end_bh_atomic();
 
-       /* Decrease congestion value. If congestion threshold is not yet
-        * reached, pass on the request slot.
+       /* Decrease congestion value. */
+       xprt->cong -= RPC_CWNDSCALE;
+
+#if 0
+       /* If congestion threshold is not yet reached, pass on the request slot.
         * This looks kind of kludgy, but it guarantees backlogged requests
         * are served in order.
+        * N.B. This doesn't look completely safe, as the task is still
+        * on the backlog list after wake-up.
         */
-       xprt->cong -= RPC_CWNDSCALE;
        if (!RPCXPRT_CONGESTED(xprt)) {
                struct rpc_task *next = rpc_wake_up_next(&xprt->backlog);
 
@@ -1232,9 +1240,14 @@ xprt_release(struct rpc_task *task)
                        return;
                }
        }
+#endif
 
        req->rq_next = xprt->free;
        xprt->free   = req;
+
+       /* If not congested, wake up the next backlogged process */
+       if (!RPCXPRT_CONGESTED(xprt))
+               rpc_wake_up_next(&xprt->backlog);
 }
 
 /*