Commit 250883f3 authored by David S. Miller's avatar David S. Miller

[FRAMEBUFFER]: Convert creatorfb to new APIs.

parent 743b21c5
......@@ -809,12 +809,12 @@ config FB_SBUS
help
Say Y if you want support for SBUS or UPA based frame buffer device.
config FB_CREATOR
bool "Creator/Creator3D support"
config FB_FFB
bool "Creator/Creator3D/Elite3D support"
depends on FB_SBUS && SPARC64
help
This is the frame buffer device driver for the Creator and Creator3D
graphics boards.
This is the frame buffer device driver for the Creator, Creator3D,
and Elite3D graphics boards.
config FB_TCX
bool "TCX (SS4/SS5 only) support"
......
......@@ -48,14 +48,6 @@ obj-$(CONFIG_FB_VGA16) += vga16fb.o cfbfillrect.o cfbcopyarea.o \
obj-$(CONFIG_FB_VIRGE) += virgefb.o
obj-$(CONFIG_FB_G364) += g364fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_FM2) += fm2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_CREATOR) += creatorfb.o sbusfb.o
obj-$(CONFIG_FB_CGSIX) += cgsixfb.o sbusfb.o
obj-$(CONFIG_FB_BWTWO) += bwtwofb.o sbusfb.o
obj-$(CONFIG_FB_CGTHREE) += cgthreefb.o sbusfb.o
obj-$(CONFIG_FB_TCX) += tcxfb.o sbusfb.o
obj-$(CONFIG_FB_CGFOURTEEN) += cgfourteenfb.o sbusfb.o
obj-$(CONFIG_FB_P9100) += p9100fb.o sbusfb.o
obj-$(CONFIG_FB_LEO) += leofb.o sbusfb.o
obj-$(CONFIG_FB_STI) += stifb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
......@@ -78,6 +70,18 @@ obj-$(CONFIG_FB_E1355) += epson1355fb.o
obj-$(CONFIG_FB_PVR2) += pvr2fb.o
obj-$(CONFIG_FB_VOODOO1) += sstfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
# One by one these are being converted over to the new APIs
#obj-$(CONFIG_FB_CREATOR) += creatorfb.o sbusfb.o
#obj-$(CONFIG_FB_CGSIX) += cgsixfb.o sbusfb.o
#obj-$(CONFIG_FB_BWTWO) += bwtwofb.o sbusfb.o
#obj-$(CONFIG_FB_CGTHREE) += cgthreefb.o sbusfb.o
#obj-$(CONFIG_FB_TCX) += tcxfb.o sbusfb.o
#obj-$(CONFIG_FB_CGFOURTEEN) += cgfourteenfb.o sbusfb.o
#obj-$(CONFIG_FB_P9100) += p9100fb.o sbusfb.o
#obj-$(CONFIG_FB_LEO) += leofb.o sbusfb.o
obj-$(CONFIG_FB_FFB) += ffb.o sbuslib.o cfbimgblt.o cfbcopyarea.o
# Files generated that shall be removed upon make clean
clean-files := promcon_tbl.c
......
......@@ -103,8 +103,6 @@ extern int hgafb_setup(char*);
extern int matroxfb_init(void);
extern int matroxfb_setup(char*);
extern int hpfb_init(void);
extern int sbusfb_init(void);
extern int sbusfb_setup(char*);
extern int control_init(void);
extern int control_setup(char*);
extern int platinum_init(void);
......@@ -146,6 +144,8 @@ extern int sstfb_init(void);
extern int sstfb_setup(char*);
extern int i810fb_init(void);
extern int i810fb_setup(char*);
extern int ffb_init(void);
extern int ffb_setup(char*);
static struct {
const char *name;
......@@ -153,13 +153,6 @@ static struct {
int (*setup)(char*);
} fb_drivers[] __initdata = {
#ifdef CONFIG_FB_SBUS
/*
* Sbusfb must be initialized _before_ other frame buffer devices that
* use PCI probing
*/
{ "sbus", sbusfb_init, sbusfb_setup },
#endif
/*
* Chipset specific drivers that use resource management
*/
......@@ -244,6 +237,9 @@ static struct {
#ifdef CONFIG_FB_STI
{ "stifb", stifb_init, stifb_setup },
#endif
#ifdef CONFIG_FB_FFB
{ "ffb", ffb_init, ffb_setup },
#endif
/*
* Generic drivers that are used as fallbacks
......
This diff is collapsed.
/* sbuslib.c: Helper library for SBUS framebuffer drivers.
*
* Copyright (C) 2003 David S. Miller (davem@redhat.com)
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/fb.h>
#include <asm/oplib.h>
#include "sbuslib.h"
void sbusfb_fill_var(struct fb_var_screeninfo *var, int prom_node, int bpp)
{
memset(var, 0, sizeof(*var));
var->xres = prom_getintdefault(prom_node, "width", 1152);
var->yres = prom_getintdefault(prom_node, "height", 900);
var->xres_virtual = var->xres;
var->yres_virtual = var->yres;
var->bits_per_pixel = bpp;
}
EXPORT_SYMBOL(sbusfb_fill_var);
static unsigned long sbusfb_mmapsize(long size, unsigned long fbsize)
{
if (size == SBUS_MMAP_EMPTY) return 0;
if (size >= 0) return size;
return fbsize * (-size);
}
int sbusfb_mmap_helper(struct sbus_mmap_map *map,
unsigned long physbase,
unsigned long fbsize,
unsigned long iospace,
struct vm_area_struct *vma)
{
unsigned int size, page, r, map_size;
unsigned long map_offset = 0;
unsigned long off;
int i;
size = vma->vm_end - vma->vm_start;
if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
return -EINVAL;
off = vma->vm_pgoff << PAGE_SHIFT;
/* To stop the swapper from even considering these pages */
vma->vm_flags |= (VM_SHM | VM_IO | VM_LOCKED);
/* Each page, see which map applies */
for (page = 0; page < size; ){
map_size = 0;
for (i = 0; map[i].size; i++)
if (map[i].voff == off+page) {
map_size = sbusfb_mmapsize(map[i].size, fbsize);
#ifdef __sparc_v9__
#define POFF_MASK (PAGE_MASK|0x1UL)
#else
#define POFF_MASK (PAGE_MASK)
#endif
map_offset = (physbase + map[i].poff) & POFF_MASK;
break;
}
if (!map_size){
page += PAGE_SIZE;
continue;
}
if (page + map_size > size)
map_size = size - page;
r = io_remap_page_range(vma,
vma->vm_start + page,
map_offset, map_size,
vma->vm_page_prot, iospace);
if (r)
return -EAGAIN;
page += map_size;
}
return 0;
}
/* sbuslib.h: SBUS fb helper library interfaces */
#ifndef _SBUSLIB_H
#define _SBUSLIB_H
struct sbus_mmap_map {
unsigned long voff;
unsigned long poff;
unsigned long size;
};
#define SBUS_MMAP_FBSIZE(n) (-n)
#define SBUS_MMAP_EMPTY 0x80000000
extern void sbusfb_fill_var(struct fb_var_screeninfo *var, int prom_node, int bpp);
struct vm_area_struct;
extern int sbusfb_mmap_helper(struct sbus_mmap_map *map,
unsigned long physbase, unsigned long fbsize,
unsigned long iospace,
struct vm_area_struct *vma);
#endif /* _SBUSLIB_H */
#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 xy_margin;
int fifo_cache;
u64 yx_margin;
int fg_cache;
int bg_cache;
int dac_rev;
};
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 fb_info_p9100 {
struct p9100_ctrl *ctrl;
volatile u32 *fbmem;
};
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 display disp;
struct display_switch dispsw;
struct fbtype type;
struct sbus_dev *sbdp;
spinlock_t lock;
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;
struct fb_info_p9100 p9100;
} 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);
int (*blank)(struct fb_info_sbusfb *);
int (*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 *);
extern char *p9100fb_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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment