Index: Kconfig
===================================================================
RCS file: /home/linux-m68k/cvsroot/linux/drivers/video/Kconfig,v
retrieving revision 1.12
diff -u -p -r1.12 Kconfig
--- Kconfig	8 Feb 2007 02:48:52 -0000	1.12
+++ Kconfig	17 Apr 2007 02:48:34 -0000
@@ -417,6 +417,13 @@ config FB_ATARI
 	  This is the frame buffer device driver for the builtin graphics
 	  chipset found in Ataris.
 
+config FB_ARANYM
+	bool "ARAnyM emulator natfeat card support"
+	depends on (FB = y) && NATFEAT && ATARI
+	help
+	  This is the frame buffer device driver for the ARAnyM builtin
+	  natfeat graphics.
+
 config FB_OF
 	bool "Open Firmware frame buffer device support"
 	depends on (FB = y) && (PPC64 || PPC_OF)
Index: Makefile
===================================================================
RCS file: /home/linux-m68k/cvsroot/linux/drivers/video/Makefile,v
retrieving revision 1.32
diff -u -p -r1.32 Makefile
--- Makefile	8 Feb 2007 02:48:52 -0000	1.32
+++ Makefile	17 Apr 2007 02:48:34 -0000
@@ -65,6 +65,7 @@ obj-$(CONFIG_FB_TCX)              += tcx
 obj-$(CONFIG_FB_LEO)              += leo.o sbuslib.o
 obj-$(CONFIG_FB_SGIVW)            += sgivwfb.o
 obj-$(CONFIG_FB_ACORN)            += acornfb.o
+obj-$(CONFIG_FB_ARANYM)           += aranymfb.o
 obj-$(CONFIG_FB_ATARI)            += atafb.o c2p.o atafb_mfb.o \
                                      atafb_iplan2p2.o atafb_iplan2p4.o atafb_iplan2p8.o
 obj-$(CONFIG_FB_MAC)              += macfb.o
Index: aranymfb.c
===================================================================
RCS file: aranymfb.c
diff -N aranymfb.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ aranymfb.c	17 Apr 2007 02:48:35 -0000
@@ -0,0 +1,1149 @@
+/*
+ * linux/drivers/video/skeletonfb.c -- Skeleton for a frame buffer device
+ *
+ *  Modified to new api Jan 2001 by James Simmons (jsimmons@transvirtual.com)
+ *
+ *  Created 28 Dec 1997 by Geert Uytterhoeven
+ *
+ *
+ *  I have started rewriting this driver as a example of the upcoming new API
+ *  The primary goal is to remove the console code from fbdev and place it
+ *  into fbcon.c. This reduces the code and makes writing a new fbdev driver
+ *  easy since the author doesn't need to worry about console internals. It
+ *  also allows the ability to run fbdev without a console/tty system on top 
+ *  of it. 
+ *
+ *  First the roles of struct fb_info and struct display have changed. Struct
+ *  display will go away. The way the the new framebuffer console code will
+ *  work is that it will act to translate data about the tty/console in 
+ *  struct vc_data to data in a device independent way in struct fb_info. Then
+ *  various functions in struct fb_ops will be called to store the device 
+ *  dependent state in the par field in struct fb_info and to change the 
+ *  hardware to that state. This allows a very clean separation of the fbdev
+ *  layer from the console layer. It also allows one to use fbdev on its own
+ *  which is a bounus for embedded devices. The reason this approach works is  
+ *  for each framebuffer device when used as a tty/console device is allocated
+ *  a set of virtual terminals to it. Only one virtual terminal can be active 
+ *  per framebuffer device. We already have all the data we need in struct 
+ *  vc_data so why store a bunch of colormaps and other fbdev specific data
+ *  per virtual terminal. 
+ *
+ *  As you can see doing this makes the con parameter pretty much useless
+ *  for struct fb_ops functions, as it should be. Also having struct  
+ *  fb_var_screeninfo and other data in fb_info pretty much eliminates the 
+ *  need for get_fix and get_var. Once all drivers use the fix, var, and cmap
+ *  fbcon can be written around these fields. This will also eliminate the
+ *  need to regenerate struct fb_var_screeninfo, struct fb_fix_screeninfo
+ *  struct fb_cmap every time get_var, get_fix, get_cmap functions are called
+ *  as many drivers do now. 
+ *
+ *  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/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <asm/natfeat.h>
+
+#include "aranymfb.h"
+#if 0
+#include "../../arch/m68k/atari/natfeat.h"
+#endif
+
+/*
+ *  If your driver supports multiple boards, you should make the  
+ *  below data types arrays, or allocate them dynamically (using kmalloc()). 
+ */ 
+
+/* 
+ * This structure defines the hardware state of the graphics card. Normally
+ * you place this in a header file in linux/include/video. This file usually
+ * also includes register information. That allows other driver subsystems
+ * and userland applications the ability to use the same header file to 
+ * avoid duplicate work and easy porting of software. 
+ */
+struct aranym_par {
+	/* dummy */
+};
+
+static u16 opaque_pattern[16] = {
+	0xffff, 0xffff, 0xffff, 0xffff,
+	0xffff, 0xffff, 0xffff, 0xffff,
+	0xffff, 0xffff, 0xffff, 0xffff,
+	0xffff, 0xffff, 0xffff, 0xffff,
+};
+
+static u32 pseudo_palette[16];
+
+/*
+ * Here we define the default structs fb_fix_screeninfo and fb_var_screeninfo
+ * if we don't use modedb. If we do use modedb see aranymfb_init how to use it
+ * to get a fb_var_screeninfo. Otherwise define a default var as well. 
+ */
+static struct fb_fix_screeninfo aranymfb_fix __initdata = {
+	.id =		"ARAnyM", 
+	.type =		FB_TYPE_PACKED_PIXELS,
+	.visual =	FB_VISUAL_TRUECOLOR,
+	.xpanstep =	1,
+	.ypanstep =	1,
+	.ywrapstep =	1, 
+	.accel =	FB_ACCEL_NONE,
+};
+
+    /*
+     * 	Modern graphical hardware not only supports pipelines but some 
+     *  also support multiple monitors where each display can have its  
+     *  its own unique data. In this case each display could be  
+     *  represented by a separate framebuffer device thus a separate 
+     *  struct fb_info. Now the struct aranym_par represents the graphics
+     *  hardware state thus only one exist per card. In this case the 
+     *  struct aranym_par for each graphics card would be shared between 
+     *  every struct fb_info that represents a framebuffer on that card. 
+     *  This allows when one display changes it video resolution (info->var) 
+     *  the other displays know instantly. Each display can always be
+     *  aware of the entire hardware state that affects it because they share
+     *  the same aranym_par struct. The other side of the coin is multiple
+     *  graphics cards that pass data around until it is finally displayed
+     *  on one monitor. Such examples are the voodoo 1 cards and high end
+     *  NUMA graphics servers. For this case we have a bunch of pars, each
+     *  one that represents a graphics state, that belong to one struct 
+     *  fb_info. Their you would want to have *par point to a array of device
+     *  states and have each struct fb_ops function deal with all those 
+     *  states. I hope this covers every possible hardware design. If not
+     *  feel free to send your ideas at jsimmons@users.sf.net 
+     */
+
+    /*
+     *  If your driver supports multiple boards or it supports multiple 
+     *  framebuffers, you should make these arrays, or allocate them 
+     *  dynamically using framebuffer_alloc() and free them with
+     *  framebuffer_release().
+     */ 
+static struct fb_info info;
+
+    /* 
+     * Each one represents the state of the hardware. Most hardware have
+     * just one hardware state. These here represent the default state(s). 
+     */
+static struct aranym_par __initdata current_par;
+
+static char *mode __initdata = NULL;
+
+
+int aranymfb_setup(char*);
+
+/**
+ *	aranymfb_open - Optional function. Called when the framebuffer is
+ *		     first accessed.
+ *	@info: frame buffer structure that represents a single frame buffer
+ *	@user: tell us if the userland (value=1) or the console is accessing
+ *	       the framebuffer. 
+ *
+ *	This function is the first function called in the framebuffer api.
+ *	Usually you don't need to provide this function. The case where it 
+ *	is used is to change from a text mode hardware state to a graphics
+ * 	mode state. 
+ *
+ *	Returns negative errno on error, or zero on success.
+ */
+static int aranymfb_open(struct fb_info *info, int user)
+{
+
+	nf_fb_aranym_openwk();
+	return 0;
+}
+
+/**
+ *	aranymfb_release - Optional function. Called when the framebuffer 
+ *			device is closed. 
+ *	@info: frame buffer structure that represents a single frame buffer
+ *	@user: tell us if the userland (value=1) or the console is accessing
+ *	       the framebuffer. 
+ *	
+ *	Thus function is called when we close /dev/fb or the framebuffer 
+ *	console system is released. Usually you don't need this function.
+ *	The case where it is usually used is to go from a graphics state
+ *	to a text mode state.
+ *
+ *	Returns negative errno on error, or zero on success.
+ */
+static int aranymfb_release(struct fb_info *info, int user)
+{
+	nf_fb_aranym_closewk();
+	return 0;
+}
+
+/**
+ *      aranymfb_check_var - Optional function. Validates a var passed in. 
+ *      @var: frame buffer variable screen structure
+ *      @info: frame buffer structure that represents a single frame buffer 
+ *
+ *	Checks to see if the hardware supports the state requested by
+ *	var passed in. This function does not alter the hardware state!!! 
+ *	This means the data stored in struct fb_info and struct aranym_par do 
+ *      not change. This includes the var inside of struct fb_info. 
+ *	Do NOT change these. This function can be called on its own if we
+ *	intent to only test a mode and not actually set it. The stuff in 
+ *	modedb.c is a example of this. If the var passed in is slightly 
+ *	off by what the hardware can support then we alter the var PASSED in
+ *	to what we can do.
+ *
+ *      For values that are off, this function must round them _up_ to the
+ *      next value that is supported by the hardware.  If the value is
+ *      greater than the highest value supported by the hardware, then this
+ *      function must return -EINVAL.
+ *
+ *      Exception to the above rule:  Some drivers have a fixed mode, ie,
+ *      the hardware is already set at boot up, and cannot be changed.  In
+ *      this case, it is more acceptable that this function just return
+ *      a copy of the currently working var (info->var). Better is to not
+ *      implement this function, as the upper layer will do the copying
+ *      of the current var for you.
+ *
+ *      Note:  This is the only function where the contents of var can be
+ *      freely adjusted after the driver has been registered. If you find
+ *      that you have code outside of this function that alters the content
+ *      of var, then you are doing something wrong.  Note also that the
+ *      contents of info->var must be left untouched at all times after
+ *      driver registration.
+ *
+ *	Returns negative errno on error, or zero on success.
+ */
+static int aranymfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
+{
+	/* copy the var contents */
+	*var = info->var;
+
+	/* we don't have anything that just checks the resolution and therefore
+	 * we simply instruct ARAnyM to change it resolution to whatever values
+	 * where have here (it is safe in terms of HW limits as NF layer (or
+	 * the underlying graphics library is responsible to check that and set
+	 * the closest possible settings. */
+	nf_fb_aranym_set_resolution(var->xres, var->yres, var->bits_per_pixel, 75 /*dummy*/);
+
+#if FIXME__
+	/* As it might have been adjusted within the resolution switch function
+	 * above we need to fetch the real values used in ARAnyM and stick it
+	 * into the var variable to set the resolution again */
+	var->xres = nf_fb_aranym_get_width();
+	var->yres = nf_fb_aranym_get_height();
+	var->bits_per_pixel = nf_fb_aranym_get_bpp();
+#endif
+
+	/* set the virtual resolution to double the size to enable panning */
+	var->xres_virtual = var->xres << 1;
+	var->yres_virtual = var->yres << 1;
+
+#if FIXME__
+	/* TODO: this is to be perhaps added to the fVDI NF interface */
+	fb_aranym_get_colcomponent( 0, &var->red.length, &var->red.offset);
+	fb_aranym_get_colcomponent( 1, &var->green.length, &var->green.offset);
+	fb_aranym_get_colcomponent( 2, &var->blue.length, &var->blue.offset);
+	fb_aranym_get_colcomponent( 3, &var->transp.length, &var->transp.offset);
+#else
+	var->red.offset=16;
+	var->red.length=8;
+	var->red.msb_right=0;
+	var->green.offset=8;
+	var->green.length=8;
+	var->green.msb_right=0;
+	var->blue.offset=0;
+	var->blue.length=8;
+	var->blue.msb_right=0;
+
+	var->transp.offset=0;
+	var->transp.length=0;
+	var->transp.msb_right=0;
+#endif
+
+	/* FIXME: add something here?? */
+	var->vmode = FB_VMODE_NONINTERLACED;
+
+    return 0;	   	
+}
+
+/**
+ *      aranymfb_set_par - Optional function. Alters the hardware state.
+ *      @info: frame buffer structure that represents a single frame buffer
+ *
+ *	Using the fb_var_screeninfo in fb_info we set the resolution of the
+ *	this particular framebuffer. This function alters the par AND the
+ *	fb_fix_screeninfo stored in fb_info. It doesn't not alter var in 
+ *	fb_info since we are using that data. This means we depend on the
+ *	data in var inside fb_info to be supported by the hardware. 
+ *
+ *      This function is also used to recover/restore the hardware to a
+ *      known working state.
+ *
+ *	aranymfb_check_var is always called before aranymfb_set_par to ensure that
+ *      the contents of var is always valid.
+ *
+ *	Again if you can't change the resolution you don't need this function.
+ *
+ *      However, even if your hardware does not support mode changing,
+ *      a set_par might be needed to at least initialize the hardware to
+ *      a known working state, especially if it came back from another
+ *      process that also modifies the same hardware, such as X.
+ *
+ *      If this is the case, a combination such as the following should work:
+ *
+ *      static int aranymfb_check_var(struct fb_var_screeninfo *var,
+ *                                struct fb_info *info)
+ *      {
+ *              *var = info->var;
+ *              return 0;
+ *      }
+ *
+ *      static int aranymfb_set_par(struct fb_info *info)
+ *      {
+ *              init your hardware here
+ *      }
+ *
+ *	Returns negative errno on error, or zero on success.
+ */
+static int aranymfb_set_par(struct fb_info *info)
+{
+    /* these were possibly adjusted in check_var, but it doesn't hurt to
+     * set the resolution here */
+    nf_fb_aranym_set_resolution(info->var.xres, info->var.yres, info->var.bits_per_pixel, 75);
+
+#ifndef FIXME__
+    /* FIXME: ARAnyM fVDI interface doesn't provide its real SDL surface
+     * layout info */
+    if ( info->var.bits_per_pixel <= 8 ) {
+	    info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
+    } else {
+	    info->fix.visual = FB_VISUAL_TRUECOLOR;
+    }
+#endif
+
+    return 0;	
+}
+
+/**
+ *  	aranymfb_setcolreg - Optional function. Sets a color register.
+ *      @regno: Which register in the CLUT we are programming 
+ *      @red: The red value which can be up to 16 bits wide 
+ *	@green: The green value which can be up to 16 bits wide 
+ *	@blue:  The blue value which can be up to 16 bits wide.
+ *	@transp: If supported, the alpha value which can be up to 16 bits wide.
+ *      @info: frame buffer info structure
+ * 
+ *  	Set a single color register. The values supplied have a 16 bit
+ *  	magnitude which needs to be scaled in this function for the hardware. 
+ *	Things to take into consideration are how many color registers, if
+ *	any, are supported with the current color visual. With truecolor mode
+ *	no color palettes are supported. Here a pseudo palette is created
+ *	which we store the value in pseudo_palette in struct fb_info. For
+ *	pseudocolor mode we have a limited color palette. To deal with this
+ *	we can program what color is displayed for a particular pixel value.
+ *	DirectColor is similar in that we can program each color field. If
+ *	we have a static colormap we don't need to implement this function. 
+ * 
+ *	Returns negative errno on error, or zero on success.
+ */
+static int aranymfb_setcolreg(unsigned regno, unsigned red, unsigned green,
+			   unsigned blue, unsigned transp,
+			   struct fb_info *info)
+{
+    if (regno >= 256)  /* no. of hw registers */
+       return -EINVAL;
+    /*
+     * Program hardware... do anything you want with transp
+     */
+
+    /* grayscale works only partially under directcolor */
+    if (info->var.grayscale) {
+       /* grayscale = 0.30*R + 0.59*G + 0.11*B */
+       red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
+    }
+
+    /* Directcolor:
+     *   var->{color}.offset contains start of bitfield
+     *   var->{color}.length contains length of bitfield
+     *   {hardwarespecific} contains width of DAC
+     *   pseudo_palette[X] is programmed to (X << red.offset) |
+     *                                      (X << green.offset) |
+     *                                      (X << blue.offset)
+     *   RAMDAC[X] is programmed to (red, green, blue)
+     *   color depth = SUM(var->{color}.length)
+     *
+     * Pseudocolor:
+     *    var->{color}.offset is 0
+     *    var->{color}.length contains width of DAC or the number of unique
+     *                        colors available (color depth)
+     *    pseudo_palette is not used
+     *    RAMDAC[X] is programmed to (red, green, blue)
+     *    color depth = var->{color}.length
+     *
+     * Static pseudocolor:
+     *    same as Pseudocolor, but the RAMDAC is not programmed (read-only)
+     *
+     * Mono01/Mono10:
+     *    Has only 2 values, black on white or white on black (fg on bg),
+     *    var->{color}.offset is 0
+     *    white = (1 << var->{color}.length) - 1, black = 0
+     *    pseudo_palette is not used
+     *    RAMDAC does not exist
+     *    color depth is always 2
+     *
+     * Truecolor:
+     *    does not use RAMDAC (usually has 3 of them).
+     *    var->{color}.offset contains start of bitfield
+     *    var->{color}.length contains length of bitfield
+     *    pseudo_palette is programmed to (red << red.offset) |
+     *                                    (green << green.offset) |
+     *                                    (blue << blue.offset) |
+     *                                    (transp << transp.offset)
+     *    RAMDAC does not exist
+     *    color depth = SUM(var->{color}.length})
+     *
+     *  The color depth is used by fbcon for choosing the logo and also
+     *  for color palette transformation if color depth < 4
+     *
+     *  As can be seen from the above, the field bits_per_pixel is _NOT_
+     *  a criteria for describing the color visual.
+     *
+     *  A common mistake is assuming that bits_per_pixel <= 8 is pseudocolor,
+     *  and higher than that, true/directcolor.  This is incorrect, one needs
+     *  to look at the fix->visual.
+     *
+     *  Another common mistake is using bits_per_pixel to calculate the color
+     *  depth.  The bits_per_pixel field does not directly translate to color
+     *  depth. You have to compute for the color depth (using the color
+     *  bitfields) and fix->visual as seen above.
+     */
+
+#if 0
+    /*
+     * This is the point where the color is converted to something that
+     * is acceptable by the hardware.
+     */
+#define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
+    red = CNVT_TOHW(red, info->var.red.length);
+    green = CNVT_TOHW(green, info->var.green.length);
+    blue = CNVT_TOHW(blue, info->var.blue.length);
+    transp = CNVT_TOHW(transp, info->var.transp.length);
+#undef CNVT_TOHW
+#else
+    /*
+     * This is the point where the color is converted to base 1000
+     * RGBA values that are normally used in Atari VDI.
+     */
+#define CNVT_TO1K(val,width) ((((val)*(1000))+0x7FFF-(val))>>16)
+    red = CNVT_TO1K(red, 8);
+    green = CNVT_TO1K(green, 8);
+    blue = CNVT_TO1K(blue, 8);
+    transp = CNVT_TO1K(transp, 8);
+#undef CNVT_TO1K
+#endif
+
+
+    /*
+     * This is the point where the function feeds the color to the hardware
+     * palette after converting the colors to something acceptable by
+     * the hardware. Note, only FB_VISUAL_DIRECTCOLOR and
+     * FB_VISUAL_PSEUDOCOLOR visuals need to write to the hardware palette.
+     * If you have code that writes to the hardware CLUT, and it's not
+     * any of the above visuals, then you are doing something wrong.
+     */
+#if 0
+    if (info->fix.visual == FB_VISUAL_DIRECTCOLOR ||
+	info->fix.visual == FB_VISUAL_TRUECOLOR)
+	    write_{red|green|blue|transp}_to_clut();
+#endif
+
+    /* This is the point were you need to fill up the contents of
+     * info->pseudo_palette. This structure is used _only_ by fbcon, thus
+     * it only contains 16 entries to match the number of colors supported
+     * by the console. The pseudo_palette is used only if the visual is
+     * in directcolor or truecolor mode.  With other visuals, the
+     * pseudo_palette is not used. (This might change in the future.)
+     *
+     * The contents of the pseudo_palette is in raw pixel format.  Ie, each
+     * entry can be written directly to the framebuffer without any conversion.
+     * The pseudo_palette is (void *).  However, if using the generic
+     * drawing functions (cfb_imageblit, cfb_fillrect), the pseudo_palette
+     * must be casted to (u32 *) _regardless_ of the bits per pixel. If the
+     * driver is using its own drawing functions, then it can use whatever
+     * size it wants.
+     */
+    if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
+	info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
+	    u32 v;
+
+	    if (regno >= 16)
+		    return -EINVAL;
+
+#if 0
+	    v = (red << info->var.red.offset) |
+		    (green << info->var.green.offset) |
+		    (blue << info->var.blue.offset) |
+		    (transp << info->var.transp.offset);
+#else
+	    /* get the real HW value */
+	    v = nf_fb_aranym_get_hwcolor( regno, red, green, blue);
+#endif
+
+	    printk(KERN_INFO "fb%d: setcolor: %d: %d, %d, %d -> %lx\n", info->node,
+			    regno, red, green, blue, v);
+
+	    ((u32*)(info->pseudo_palette))[regno] = v;
+    } else {
+	    static const u8 vdi_colours[] = { 0,2,3,6,4,7,5,8,9,10,11,14,12,15,13,255 };
+#define toVdiColors( color ) \
+	    ( (color)<ARRAY_SIZE(vdi_colours) ? vdi_colours[color] : color)
+
+	    /* set the palette color (for the VDI pen) */
+	    nf_fb_aranym_set_color( toVdiColors(regno), red, green, blue);
+#undef toVdiColors( color )
+    }
+
+    return 0;
+}
+
+/**
+ *      aranymfb_copyarea - REQUIRED function. Can use generic routines if
+ *                       non acclerated hardware and packed pixel based.
+ *                       Copies one area of the screen to another area.
+ *
+ *      @info: frame buffer structure that represents a single frame buffer
+ *      @area: Structure providing the data to copy the framebuffer contents
+ *	       from one region to another.
+ *
+ *      This drawing operation copies a rectangular area from one area of the
+ *	screen to another area.
+ */
+void aranymfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) 
+{
+/*
+ *      @dx: The x and y coordinates of the upper left hand corner of the
+ *	@dy: destination area on the screen.
+ *      @width: How wide the rectangle is we want to copy.
+ *      @height: How tall the rectangle is we want to copy.
+ *      @sx: The x and y coordinates of the upper left hand corner of the
+ *      @sy: source area on the screen.
+ */
+	printk(KERN_INFO "fb%d: copyarea: %ld, %ld, %ld, %ld\n", p->node,
+			area->dx, area->dy, area->width, area->height);
+
+	nf_fb_aranym_blit_area(0UL /* src is screen */, area->sx, area->sy,
+			0UL /* dst is screen */, area->dx, area->dy,
+			area->width, area->height,
+			3 /* rop: opaque blit */);
+}
+
+
+/**
+ *      aranymfb_pan_display - NOT a required function. Pans the display.
+ *      @var: frame buffer variable screen structure
+ *      @info: frame buffer structure that represents a single frame buffer
+ *
+ *	Pan (or wrap, depending on the `vmode' field) the display using the
+ *  	`xoffset' and `yoffset' fields of the `var' structure.
+ *  	If the values don't fit, return -EINVAL.
+ *
+ *      Returns negative errno on error, or zero on success.
+ */
+static int aranymfb_pan_display(struct fb_var_screeninfo *var,
+			     struct fb_info *p)
+{
+	struct fb_copyarea area;
+	area.dx = 0;
+	area.dy = 0;
+	area.sx = var->xoffset;
+	area.sy = var->yoffset;
+	area.width = var->xres - var->xoffset;
+	area.height = var->yres - var->yoffset;
+
+	printk(KERN_INFO "fb%d: pan_display: from %d, %d, %d, %d\n", p->node,
+			area.sx, area.sy, area.width, area.height);
+
+	aranymfb_copyarea(p, &area);
+	return 0;
+}
+
+/**
+ *      aranymfb_blank - NOT a required function. Blanks the display.
+ *      @blank_mode: the blank mode we want. 
+ *      @info: frame buffer structure that represents a single frame buffer
+ *
+ *      Blank the screen if blank_mode != FB_BLANK_UNBLANK, else unblank.
+ *      Return 0 if blanking succeeded, != 0 if un-/blanking failed due to
+ *      e.g. a video mode which doesn't support it.
+ *
+ *      Implements VESA suspend and powerdown modes on hardware that supports
+ *      disabling hsync/vsync:
+ *
+ *      FB_BLANK_NORMAL = display is blanked, syncs are on.
+ *      FB_BLANK_HSYNC_SUSPEND = hsync off
+ *      FB_BLANK_VSYNC_SUSPEND = vsync off
+ *      FB_BLANK_POWERDOWN =  hsync and vsync off
+ *
+ *      If implementing this function, at least support FB_BLANK_UNBLANK.
+ *      Return !0 for any modes that are unimplemented.
+ *
+ */
+static int aranymfb_blank(int blank_mode, const struct fb_info *info)
+{
+    /* ... */
+    return 0;
+}
+
+/* ------------ Accelerated Functions --------------------- */
+
+/*
+ * We provide our own functions if we have hardware acceleration
+ * or non packed pixel format layouts. If we have no hardware 
+ * acceleration, we can use a generic unaccelerated function. If using
+ * a pack pixel format just use the functions in cfb_*.c. Each file 
+ * has one of the three different accel functions we support.
+ */
+
+/**
+ *      aranymfb_fillrect - REQUIRED function. Can use generic routines if 
+ *		 	 non acclerated hardware and packed pixel based.
+ *			 Draws a rectangle on the screen.		
+ *
+ *      @info: frame buffer structure that represents a single frame buffer
+ *	@region: The structure representing the rectangular region we 
+ *		 wish to draw to.
+ *
+ *	This drawing operation places/removes a retangle on the screen 
+ *	depending on the rastering operation with the value of color which
+ *	is in the current color depth format.
+ */
+void aranymfb_fillrect(struct fb_info *p, const struct fb_fillrect *region)
+{
+/*	Meaning of struct fb_fillrect
+ *
+ *	@dx: The x and y corrdinates of the upper left hand corner of the 
+ *	@dy: area we want to draw to. 
+ *	@width: How wide the rectangle is we want to draw.
+ *	@height: How tall the rectangle is we want to draw.
+ *	@color:	The color to fill in the rectangle with. 
+ *	@rop: The raster operation. We can draw the rectangle with a COPY
+ *	      of XOR which provides erasing effect. 
+ */
+	u32 color;
+
+	if (p->fix.visual == FB_VISUAL_TRUECOLOR ||
+	    p->fix.visual == FB_VISUAL_DIRECTCOLOR) {
+		color = ((u32*)(p->pseudo_palette))[region->color];
+	} else {
+		color = region->color;
+	}	
+
+	nf_fb_aranym_fill_area(region->dx, region->dy,
+		region->width, region->height, opaque_pattern,
+		color, 0x00UL, region->rop == ROP_XOR ? 3 : 1,
+		0 /*unused*/);
+}
+
+/**
+ *      aranymfb_imageblit - REQUIRED function. Can use generic routines if
+ *                        non acclerated hardware and packed pixel based.
+ *                        Copies a image from system memory to the screen. 
+ *
+ *      @info: frame buffer structure that represents a single frame buffer
+ *	@image:	structure defining the image.
+ *
+ *      This drawing operation draws a image on the screen. It can be a 
+ *	mono image (needed for font handling) or a color image (needed for
+ *	tux). 
+ */
+void aranymfb_imageblit(struct fb_info *p, const struct fb_image *image) 
+{
+/*
+ *      @dx: The x and y coordinates of the upper left hand corner of the
+ *	@dy: destination area to place the image on the screen.
+ *      @width: How wide the image is we want to copy.
+ *      @height: How tall the image is we want to copy.
+ *      @fg_color: For mono bitmap images this is color data for     
+ *      @bg_color: the foreground and background of the image to
+ *		   write directly to the frmaebuffer.
+ *	@depth:	How many bits represent a single pixel for this image.
+ *	@data: The actual data used to construct the image on the display.
+ *	@cmap: The colormap used for color images.   
+ */
+
+/*
+ * The generic function, cfb_imageblit, expects that the bitmap scanlines are
+ * padded to the next byte.  Most hardware accelerators may require padding to
+ * the next u16 or the next u32.  If that is the case, the driver can specify
+ * this by setting info->pixmap.scan_align = 2 or 4.  See a more
+ * comprehensive description of the pixmap below.
+ */
+
+	struct MFDB src;
+
+	src.fd_addr = (u32)image->data;
+	src.fd_width = image->width;
+	src.fd_height = image->height;
+	src.fd_planes = image->depth;
+	src.fd_wdwidth = ( src.fd_width + 7 ) >> 3;
+	src.fd_stand = 0x1000; /* FIXME: HACK fd_wdwidth is actually one color plane byte pitch here */
+
+#if 0
+	printk(KERN_INFO "fb%d: imageblit: %ld, %ld, %ld, %ld [%ld, %ld]\n", p->node,
+			image->dx, image->dy, image->width, image->height, image->fg_color, image->bg_color);
+#endif
+	if ( src.fd_planes == 1 ) {
+		u32 fgcolor, bgcolor;
+
+		if (p->fix.visual == FB_VISUAL_TRUECOLOR ||
+		    p->fix.visual == FB_VISUAL_DIRECTCOLOR) {
+			fgcolor = ((u32*)(p->pseudo_palette))[image->fg_color];
+			bgcolor = ((u32*)(p->pseudo_palette))[image->bg_color];
+		} else {
+			fgcolor = image->fg_color;
+			bgcolor = image->bg_color;
+		}	
+
+		nf_fb_aranym_expand_area(&src, 0, 0, 0UL,
+				image->dx, image->dy, image->width, image->height, 1 /*fg color use only*/, fgcolor, bgcolor);
+	} else {
+		/* This is only for the Tux logo display */
+#if 1
+		src.fd_wdwidth = (src.fd_planes * src.fd_width) >> 6; /* FIXME: hmm, really??? WHY? */
+#else
+		src.fd_wdwidth = (src.fd_planes * src.fd_width) >> 3;
+#endif
+		src.fd_stand |= 0x100; /* 8bit chunky (ARAnyM fVDI driver extension) */
+
+		/* FIXME: needs c2p conversion or make ARAnyM mode to be chunky */
+		nf_fb_aranym_blit_area(&src, 0, 0, 0UL,
+				image->dx, image->dy, image->width, image->height, 3);
+	}
+}
+
+#if 0
+/**
+ *	aranymfb_cursor - 	OPTIONAL. If your hardware lacks support
+ *			for a cursor, leave this field NULL.
+ *
+ *      @info: frame buffer structure that represents a single frame buffer
+ *	@cursor: structure defining the cursor to draw.
+ *
+ *      This operation is used to set or alter the properities of the
+ *	cursor.
+ *
+ *	Returns negative errno on error, or zero on success.
+ */
+int aranymfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
+{
+/*
+ *      @set: 	Which fields we are altering in struct fb_cursor 
+ *	@enable: Disable or enable the cursor 
+ *      @rop: 	The bit operation we want to do. 
+ *      @mask:  This is the cursor mask bitmap. 
+ *      @dest:  A image of the area we are going to display the cursor.
+ *		Used internally by the driver.	 
+ *      @hot:	The hot spot. 
+ *	@image:	The actual data for the cursor image.
+ *
+ *      NOTES ON FLAGS (cursor->set):
+ *
+ *      FB_CUR_SETIMAGE - the cursor image has changed (cursor->image.data)
+ *      FB_CUR_SETPOS   - the cursor position has changed (cursor->image.dx|dy)
+ *      FB_CUR_SETHOT   - the cursor hot spot has changed (cursor->hot.dx|dy)
+ *      FB_CUR_SETCMAP  - the cursor colors has changed (cursor->fg_color|bg_color)
+ *      FB_CUR_SETSHAPE - the cursor bitmask has changed (cursor->mask)
+ *      FB_CUR_SETSIZE  - the cursor size has changed (cursor->width|height)
+ *      FB_CUR_SETALL   - everything has changed
+ *
+ *      NOTES ON ROPs (cursor->rop, Raster Operation)
+ *
+ *      ROP_XOR         - cursor->image.data XOR cursor->mask
+ *      ROP_COPY        - curosr->image.data AND cursor->mask
+ *
+ *      OTHER NOTES:
+ *
+ *      - fbcon only supports a 2-color cursor (cursor->image.depth = 1)
+ *      - The fb_cursor structure, @cursor, _will_ always contain valid
+ *        fields, whether any particular bitfields in cursor->set is set
+ *        or not.
+ */
+}
+
+/**
+ *	aranymfb_rotate -  NOT a required function. If your hardware
+ *			supports rotation the whole screen then 
+ *			you would provide a hook for this. 
+ *
+ *      @info: frame buffer structure that represents a single frame buffer
+ *	@angle: The angle we rotate the screen.   
+ *
+ *      This operation is used to set or alter the properities of the
+ *	cursor.
+ */
+void aranymfb_rotate(struct fb_info *info, int angle)
+{
+/* Will be deprecated */
+}
+
+/**
+ *	aranymfb_poll - NOT a required function. The purpose of this
+ *		     function is to provide a way for some process
+ *		     to wait until a specific hardware event occurs
+ *		     for the framebuffer device.
+ * 				 
+ *      @info: frame buffer structure that represents a single frame buffer
+ *	@wait: poll table where we store process that await a event.     
+ */
+void aranymfb_poll(struct fb_info *info, poll_table *wait)
+{
+}
+
+/**
+ *	aranymfb_sync - NOT a required function. Normally the accel engine 
+ *		     for a graphics card take a specific amount of time.
+ *		     Often we have to wait for the accelerator to finish
+ *		     its operation before we can write to the framebuffer
+ *		     so we can have consistent display output. 
+ *
+ *      @info: frame buffer structure that represents a single frame buffer
+ *
+ *      If the driver has implemented its own hardware-based drawing function,
+ *      implementing this function is highly recommended.
+ */
+void aranymfb_sync(struct fb_info *info)
+{
+}
+#endif
+
+/* ------------------------------------------------------------------------- */
+
+    /*
+     *  Frame buffer operations
+     */
+
+static struct fb_ops aranymfb_ops = {
+	.owner		= THIS_MODULE,
+	.fb_open	= aranymfb_open,
+#if 0
+	.fb_read	= aranymfb_read,
+	.fb_write	= aranymfb_write,
+#endif
+	.fb_release	= aranymfb_release,
+	.fb_set_par	= aranymfb_set_par,	
+	.fb_check_var	= aranymfb_check_var,
+	.fb_setcolreg	= aranymfb_setcolreg,
+#if 0
+	.fb_blank	= aranymfb_blank,
+	.fb_pan_display	= aranymfb_pan_display,	
+#endif
+	.fb_fillrect	= aranymfb_fillrect, 	/* Needed !!! */ 
+	.fb_copyarea	= aranymfb_copyarea,	/* Needed !!! */ 
+	.fb_imageblit	= aranymfb_imageblit,	/* Needed !!! */
+#if 0
+	.fb_cursor	= aranymfb_cursor,		/* Optional !!! */
+	.fb_rotate	= aranymfb_rotate,
+	.fb_poll	= aranymfb_poll,
+	.fb_sync	= aranymfb_sync,
+	.fb_ioctl	= aranymfb_ioctl,
+	.fb_mmap	= aranymfb_mmap,
+#endif
+};
+
+/* ------------------------------------------------------------------------- */
+
+    /*
+     *  Initialization
+     */
+
+static int __init aranymfb_probe (struct platform_device *dev)
+{
+    struct fb_info *info;
+    struct aranym_par *par;
+    int cmap_len, retval;	
+
+    /*
+     * Quit if the VM doesn't support ARAnyM's 'fVDI' NatFeat
+     */
+    if ( !is_nf_fb_aranym() )
+	    return -ENODEV;
+
+    /*
+     * Dynamically allocate info and par
+     */
+    info = framebuffer_alloc(sizeof(struct aranym_par), &dev->dev);
+
+    if (!info) {
+	    /* goto error path */
+    }
+
+    par = info->par;
+
+    /* 
+     * Here we set the screen_base to the virtual memory address
+     * for the framebuffer. Usually we obtain the resource address
+     * from the bus layer and then translate it to virtual memory
+     * space via ioremap. Consult ioport.h. 
+     */
+#if 0
+    info->screen_base = framebuffer_virtual_memory;
+#endif
+    info->fbops = &aranymfb_ops;
+    info->fix = aranymfb_fix; /* this will be the only time aranymfb_fix will be
+			    * used, so mark it as __initdata
+			    */
+    info->pseudo_palette = pseudo_palette; /* The pseudopalette is an
+					    * 16-member array
+					    */
+    /*
+     * Set up flags to indicate what sort of acceleration your
+     * driver can provide (pan/wrap/copyarea/etc.) and whether it
+     * is a module -- see FBINFO_* in include/linux/fb.h
+     *
+     * If your hardware can support any of the hardware accelerated functions
+     * fbcon performance will improve if info->flags is set properly.
+     *
+     * FBINFO_HWACCEL_COPYAREA - hardware moves
+     * FBINFO_HWACCEL_FILLRECT - hardware fills
+     * FBINFO_HWACCEL_IMAGEBLIT - hardware mono->color expansion
+     * FBINFO_HWACCEL_YPAN - hardware can pan display in y-axis
+     * FBINFO_HWACCEL_YWRAP - hardware can wrap display in y-axis
+     * FBINFO_HWACCEL_DISABLED - supports hardware accels, but disabled
+     * FBINFO_READS_FAST - if set, prefer moves over mono->color expansion
+     * FBINFO_MISC_TILEBLITTING - hardware can do tile blits
+     *
+     * NOTE: These are for fbcon use only.
+     */
+    info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_IMAGEBLIT |
+	    FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT;
+#if FIXME__
+    |
+	    FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
+#endif
+
+/********************* This stage is optional ******************************/
+#if 0
+     /*
+     * The struct pixmap is a scratch pad for the drawing functions. This
+     * is where the monochrome bitmap is constructed by the higher layers
+     * and then passed to the accelerator.  For drivers that uses
+     * cfb_imageblit, you can skip this part.  For those that have a more
+     * rigorous requirement, this stage is needed
+     */
+
+    /* PIXMAP_SIZE should be small enough to optimize drawing, but not
+     * large enough that memory is wasted.  A safe size is
+     * (max_xres * max_font_height/8). max_xres is driver dependent,
+     * max_font_height is 32.
+     */
+    info->pixmap.addr = kmalloc(PIXMAP_SIZE, GFP_KERNEL);
+    if (!info->pixmap.addr) {
+	    /* goto error */
+    }
+
+    info->pixmap.size = PIXMAP_SIZE;
+
+    /*
+     * FB_PIXMAP_SYSTEM - memory is in system ram
+     * FB_PIXMAP_IO     - memory is iomapped
+     * FB_PIXMAP_SYNC   - if set, will call fb_sync() per access to pixmap,
+     *                    usually if FB_PIXMAP_IO is set.
+     *
+     * Currently, FB_PIXMAP_IO is unimplemented.
+     */
+    info->pixmap.flags = FB_PIXMAP_SYSTEM;
+
+    /*
+     * scan_align is the number of padding for each scanline.  It is in bytes.
+     * Thus for accelerators that need padding to the next u32, put 4 here.
+     */
+    info->pixmap.scan_align = 4;
+
+    /*
+     * buf_align is the amount to be padded for the buffer. For example,
+     * the i810fb needs a scan_align of 2 but expects it to be fed with
+     * dwords, so a buf_align = 4 is required.
+     */
+    info->pixmap.buf_align = 4;
+
+    /* access_align is how many bits can be accessed from the framebuffer
+     * ie. some epson cards allow 16-bit access only.  Most drivers will
+     * be safe with u32 here.
+     *
+     * NOTE: This field is currently unused.
+     */
+    info->pixmap.scan_align = 32
+#endif
+/***************************** End optional stage ***************************/
+
+    /*
+     * This should give a reasonable default video mode. The following is
+     * done when we can set a video mode. 
+     */
+    if (!mode)
+	mode = "640x480-8@60";
+
+    retval = fb_find_mode(&info->var, info, mode, NULL, 0, NULL, 8);
+    if (!retval || retval == 4)
+	return -EINVAL;			
+
+#if 0
+	memset(var, 0, sizeof(struct fb_var_screeninfo));
+	var->red.offset=0;
+	var->red.length=(external_pmode == -1) ? external_depth/3 : 
+			(external_vgaiobase ? external_bitspercol : 0);
+	var->red.msb_right=0;
+	var->grayscale=0;
+
+	var->pixclock=31041;
+	var->left_margin=120;		/* these are surely incorrect 	*/
+	var->right_margin=100;
+	var->upper_margin=8;
+	var->lower_margin=16;
+	var->hsync_len=140;
+	var->vsync_len=30;
+
+	var->height=-1;
+	var->width=-1;
+
+	var->sync=0;
+
+	var->xres = external_xres;
+	var->yres = external_yres;
+	var->xres_virtual = external_xres_virtual;
+	var->bits_per_pixel = external_depth;
+	
+	var->blue=var->green=var->red;
+	var->yres_virtual=var->yres;
+	var->xoffset=0;
+	var->yoffset=0;
+	var->nonstd=0;
+	var->activate=0;
+	var->vmode=FB_VMODE_NONINTERLACED;
+#endif
+
+    /* This has to been done !!! */	
+    fb_alloc_cmap(&info->cmap, 1<<info->var.bits_per_pixel, 0);
+	
+    /*
+     * For drivers that can...
+     */
+    aranymfb_check_var(&info->var, info);
+
+    /*
+     * Does a call to fb_set_par() before register_framebuffer needed?  This
+     * will depend on you and the hardware.  If you are sure that your driver
+     * is the only device in the system, a call to fb_set_par() is safe.
+     *
+     * Hardware in x86 systems has a VGA core.  Calling set_par() at this
+     * point will corrupt the VGA console, so it might be safer to skip a
+     * call to set_par here and just allow fbcon to do it for you.
+     */
+    /* aranymfb_set_par(info); */
+
+    if (register_framebuffer(info) < 0)
+	return -EINVAL;
+    printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node,
+	   info->fix.id);
+    platform_set_drvdata(dev, info);
+    return 0;
+}
+
+    /*
+     *  Cleanup
+     */
+static int aranymfb_remove(struct platform_device *dev)
+{
+	struct fb_info *info = platform_get_drvdata(dev);
+
+	if (info) {
+		unregister_framebuffer(info);
+		fb_dealloc_cmap(&info->cmap);
+		/* ... */
+		framebuffer_release(info);
+	}
+
+	return 0;
+}
+
+/* for platform devices */
+static struct platform_driver aranymfb_driver = {
+	.probe = aranymfb_probe,
+	.remove = aranymfb_remove,
+	.driver = {
+		.name = "aranymfb",
+	},
+};
+
+static struct platform_device aranymfb_device = {
+	.name = "aranymfb",
+};
+
+static int __init aranymfb_init(void)
+{
+	int ret;
+	/*
+	 *  For kernel boot options (in 'video=aranymfb:<options>' format)
+	 */
+#ifndef MODULE
+	char *option = NULL;
+
+	if (fb_get_options("aranymfb", &option))
+		return -ENODEV;
+	aranymfb_setup(option);
+#endif
+	ret = platform_driver_register(&aranymfb_driver);
+
+	if (!ret) {
+		ret = platform_device_register(&aranymfb_device);
+		if (ret)
+			platform_driver_unregister(&aranymfb_driver);
+	}
+
+	return ret;
+}
+
+static void __exit aranymfb_exit(void)
+{
+	platform_device_unregister(&aranymfb_device);
+	platform_driver_unregister(&aranymfb_driver);
+}
+
+    /*
+     *  Setup
+     */
+
+/* 
+ * Only necessary if your driver takes special options,
+ * otherwise we fall back on the generic fb_setup().
+ */
+int __init aranymfb_setup(char *options)
+{
+    /* Parse user speficied options (`video=aranymfb:') */
+	char * opt;
+	if (!options || !*options)
+		return 0;
+	while((opt = strsep(&options,",")) != NULL ) {
+		if (!*opt) continue;
+
+		mode = opt;
+	}
+	return 0;
+}
+
+/* ------------------------------------------------------------------------- */
+
+
+    /*
+     *  Modularization
+     */
+
+module_init(aranymfb_init);
+module_exit(aranymfb_exit);
+
+MODULE_LICENSE("GPL");
Index: aranymfb.h
===================================================================
RCS file: aranymfb.h
diff -N aranymfb.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ aranymfb.h	17 Apr 2007 02:48:35 -0000
@@ -0,0 +1,144 @@
+/*
+ * STanda 2004
+ *
+ * GPL
+ */
+
+/*******************************/
+/* NatFeat Framebuffer support */
+#ifdef CONFIG_FB_ARANYM
+
+#ifndef _FVDIDRV_NFAPI_H
+#define _FVDIDRV_NFAPI_H
+
+/* if you change anything in the enum {} below you have to increase
+   this FVDIDRV_NFAPI_VERSION!
+
+   fVDI v0.960 driver API, fVDI Natfeat v1.400
+*/
+#define FVDIDRV_NFAPI_VERSION    0x14000960L
+
+enum {
+	FVDI_GET_VERSION = 0,	/* subID = 0 */
+	FVDI_GET_PIXEL,
+	FVDI_PUT_PIXEL,
+	FVDI_MOUSE,
+	FVDI_EXPAND_AREA,
+	FVDI_FILL_AREA,
+	FVDI_BLIT_AREA,
+	FVDI_LINE,
+	FVDI_FILL_POLYGON,
+	FVDI_GET_HWCOLOR,
+	FVDI_SET_COLOR,
+	FVDI_GET_FBADDR,
+	FVDI_SET_RESOLUTION,
+	FVDI_GET_WIDTH,
+	FVDI_GET_HEIGHT,
+	FVDI_OPENWK,
+	FVDI_CLOSEWK,
+	FVDI_GETBPP,
+	FVDI_EVENT,
+	FVDI_TEXT_AREA
+#if 0
+	, FVDI_GETCOMPONENT
+#endif
+};
+
+
+static long nfFvdiID = 0;
+
+#define FVDI(a)	(nfFvdiID + a)
+
+static inline int is_nf_fb_aranym(void)
+{
+	if (1 /* nf_ops */) {
+		if (nfFvdiID == 0) {
+			nfFvdiID = nf_get_id("FVDI");
+		}
+	}
+	return (nfFvdiID != 0);
+}
+
+
+static inline int nf_fb_aranym_set_resolution(long width, long height, long depth, long frequency)
+{
+	return nf_call(FVDI(FVDI_SET_RESOLUTION), width, height, depth, frequency);
+}
+
+
+/**
+ * Initiates the ARAnyM's fVDI NatFeat display. Turns off the VIDEL
+ * chip emulation rendering.
+ **/
+static inline int nf_fb_aranym_openwk(void)
+{
+	return nf_call(FVDI(FVDI_OPENWK));
+}
+
+/**
+ * Terminates the ARAnyM's fVDI NatFeat display. Turns on the VIDEL
+ * chip emulation rendering.
+ **/
+static inline int nf_fb_aranym_closewk(void)
+{
+	return nf_call(FVDI(FVDI_CLOSEWK));
+}
+
+
+/**
+ * This is the VDI (GEM component) image blit function
+ * parameter structure.
+ *
+ * Documented e.g. in 'The Atari Compendium' book.
+ **/
+struct MFDB
+{
+	u32 fd_addr;
+	u16 fd_width;
+	u16 fd_height;
+	u16 fd_wdwidth;
+	u16 fd_stand;
+	u16 fd_planes;
+	u16 reserved1;
+	u16 reserved2;
+	u16 reserved3;
+} __attribute__((packed));
+
+static inline int nf_fb_aranym_blit_area(struct MFDB *src, long src_x, long src_y, struct MFDB *dst,
+		long dst_x, long dst_y, long w, long h, long operation)
+{
+	return nf_call(FVDI(FVDI_BLIT_AREA), NULL /*vwk*/, src, src_x, src_y,
+			dst, dst_x, dst_y, w, h, operation);
+}
+
+static inline int nf_fb_aranym_expand_area(void *src, long src_x, long src_y,
+		void *dst, long dst_x, long dst_y, long w, long h,
+		long operation, long fg_color, long bg_color)
+{
+	return nf_call(FVDI(FVDI_EXPAND_AREA), NULL /*vwk*/, src, src_x, src_y, dst,
+			dst_x, dst_y, w, h, operation, fg_color, bg_color);
+}
+
+static inline long nf_fb_aranym_fill_area(long x, long y, long w, long h, short *pattern,
+		long fg_color, long bg_color, long mode, long interior_style)
+{
+	return nf_call(FVDI(FVDI_FILL_AREA), NULL /*vwk*/, x, y, w, h, pattern,
+			fg_color, bg_color, mode,
+			interior_style);
+}
+
+static inline u32 nf_fb_aranym_get_hwcolor(int index, long red, long green, long blue)
+{
+	u32 hwvalue;
+	nf_call(FVDI(FVDI_GET_HWCOLOR), (long)index, red, green, blue, &hwvalue);
+	return hwvalue;
+}
+
+static inline int nf_fb_aranym_set_color(int index, long red, long green, long blue)
+{
+	return nf_call(FVDI(FVDI_SET_COLOR), (long)index, red, green, blue, NULL /*vwk*/);
+}
+
+#endif /* _FVDIDRV_NFAPI_H */
+
+#endif  /* CONFIG_FB_ARANYM */
