#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/moduleparam.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/pci.h>
#include <video/permedia2.h>
#include <video/cvisionppc.h>
#if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)
#error "The endianness of the target host has not been defined."
#endif
#if !defined(CONFIG_PCI)
#error "Only generic PCI cards supported."
#endif
#undef PM2FB_MASTER_DEBUG
#ifdef PM2FB_MASTER_DEBUG
#define DPRINTK …
#else
#define DPRINTK(a, b...) …
#endif
#define PM2_PIXMAP_SIZE …
static int hwcursor = …;
static char *mode_option;
static bool lowhsync;
static bool lowvsync;
static bool noaccel;
static bool nomtrr;
struct pm2fb_par
{ … };
static struct fb_fix_screeninfo pm2fb_fix = …;
static const struct fb_var_screeninfo pm2fb_var = …;
static inline u32 pm2_RD(struct pm2fb_par *p, s32 off)
{ … }
static inline void pm2_WR(struct pm2fb_par *p, s32 off, u32 v)
{ … }
static inline u32 pm2_RDAC_RD(struct pm2fb_par *p, s32 idx)
{ … }
static inline u32 pm2v_RDAC_RD(struct pm2fb_par *p, s32 idx)
{ … }
static inline void pm2_RDAC_WR(struct pm2fb_par *p, s32 idx, u32 v)
{ … }
static inline void pm2v_RDAC_WR(struct pm2fb_par *p, s32 idx, u32 v)
{ … }
#ifdef CONFIG_FB_PM2_FIFO_DISCONNECT
#define WAIT_FIFO(p, a) …
#else
static inline void WAIT_FIFO(struct pm2fb_par *p, u32 a)
{
while (pm2_RD(p, PM2R_IN_FIFO_SPACE) < a)
cpu_relax();
}
#endif
#define PACKPP(p0, p1, p2) …
static const struct { … } pp_table[] = …;
static u32 partprod(u32 xres)
{ … }
static u32 to3264(u32 timing, int bpp, int is64)
{ … }
static void pm2_mnp(u32 clk, unsigned char *mm, unsigned char *nn,
unsigned char *pp)
{ … }
static void pm2v_mnp(u32 clk, unsigned char *mm, unsigned char *nn,
unsigned char *pp)
{ … }
static void clear_palette(struct pm2fb_par *p)
{ … }
static void reset_card(struct pm2fb_par *p)
{ … }
static void reset_config(struct pm2fb_par *p)
{ … }
static void set_aperture(struct pm2fb_par *p, u32 depth)
{ … }
static void set_color(struct pm2fb_par *p, unsigned char regno,
unsigned char r, unsigned char g, unsigned char b)
{ … }
static void set_memclock(struct pm2fb_par *par, u32 clk)
{ … }
static void set_pixclock(struct pm2fb_par *par, u32 clk)
{ … }
static void set_video(struct pm2fb_par *p, u32 video)
{ … }
static int pm2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{ … }
static int pm2fb_set_par(struct fb_info *info)
{ … }
static int pm2fb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp,
struct fb_info *info)
{ … }
static int pm2fb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info)
{ … }
static int pm2fb_blank(int blank_mode, struct fb_info *info)
{ … }
static int pm2fb_sync(struct fb_info *info)
{ … }
static void pm2fb_fillrect(struct fb_info *info,
const struct fb_fillrect *region)
{ … }
static void pm2fb_copyarea(struct fb_info *info,
const struct fb_copyarea *area)
{ … }
static void pm2fb_imageblit(struct fb_info *info, const struct fb_image *image)
{ … }
static const u8 cursor_bits_lookup[16] = …;
static int pm2vfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
{ … }
static int pm2fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
{ … }
static const struct fb_ops pm2fb_ops = …;
static int pm2fb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{ … }
static void pm2fb_remove(struct pci_dev *pdev)
{ … }
static const struct pci_device_id pm2fb_id_table[] = …;
static struct pci_driver pm2fb_driver = …;
MODULE_DEVICE_TABLE(pci, pm2fb_id_table);
#ifndef MODULE
static int __init pm2fb_setup(char *options)
{ … }
#endif
static int __init pm2fb_init(void)
{ … }
module_init(…) …;
#ifdef MODULE
static void __exit pm2fb_exit(void)
{
pci_unregister_driver(&pm2fb_driver);
}
#endif
#ifdef MODULE
module_exit(pm2fb_exit);
module_param(mode_option, charp, 0);
MODULE_PARM_DESC(mode_option, "Initial video mode e.g. '648x480-8@60'");
module_param_named(mode, mode_option, charp, 0);
MODULE_PARM_DESC(mode, "Initial video mode e.g. '648x480-8@60' (deprecated)");
module_param(lowhsync, bool, 0);
MODULE_PARM_DESC(lowhsync, "Force horizontal sync low regardless of mode");
module_param(lowvsync, bool, 0);
MODULE_PARM_DESC(lowvsync, "Force vertical sync low regardless of mode");
module_param(noaccel, bool, 0);
MODULE_PARM_DESC(noaccel, "Disable acceleration");
module_param(hwcursor, int, 0644);
MODULE_PARM_DESC(hwcursor, "Enable hardware cursor "
"(1=enable, 0=disable, default=1)");
module_param(nomtrr, bool, 0);
MODULE_PARM_DESC(nomtrr, "Disable MTRR support (0 or 1=disabled) (default=0)");
MODULE_AUTHOR("Jim Hague <[email protected]>");
MODULE_DESCRIPTION("Permedia2 framebuffer device driver");
MODULE_LICENSE("GPL");
#endif