staging: Add framebuffer driver for XGI chipsets

This driver handles XG20, XG21, XG40, XG42 chipsets from XGI. They're
also known as Z7,Z9,Z11 chipsets. It's based on the SiS fb driver but
has been heavily modified by XGI to support their newer chipsets.


Signed-off-by: Arnaud Patard <apatard@mandriva.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
apatard@mandriva.com 2010-05-19 10:44:14 +02:00 коммит произвёл Greg Kroah-Hartman
Родитель ad8456361f
Коммит d7636e0b07
24 изменённых файлов: 28503 добавлений и 0 удалений

Просмотреть файл

@ -141,5 +141,7 @@ source "drivers/staging/ti-st/Kconfig"
source "drivers/staging/adis16255/Kconfig"
source "drivers/staging/xgifb/Kconfig"
endif # !STAGING_EXCLUDE_BUILD
endif # STAGING

Просмотреть файл

@ -51,3 +51,4 @@ obj-$(CONFIG_CRYSTALHD) += crystalhd/
obj-$(CONFIG_CXT1E1) += cxt1e1/
obj-$(CONFIG_TI_ST) += ti-st/
obj-$(CONFIG_ADIS16255) += adis16255/
obj-$(CONFIG_FB_XGI) += xgifb/

Просмотреть файл

@ -0,0 +1,11 @@
config FB_XGI
tristate "XGI display support"
depends on FB && PCI
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
help
This driver supports notebooks with XGI Z7,Z9,Z11 PCI chips.
Say Y if you have such a graphics card.
To compile this driver as a module, choose M here: the
module will be called xgifb.ko

Просмотреть файл

@ -0,0 +1,4 @@
obj-$(CONFIG_FB_XGI) += xgifb.o
xgifb-objs := XGI_main_26.o XGI_accel.o vb_init.o vb_setmode.o vb_util.o vb_ext.o

Просмотреть файл

@ -0,0 +1,15 @@
This drivers still need a lot of work. I can list all cleanups to do but it's
going to be long. So, I'm writing "cleanups" and not the list.
Arnaud
TODO:
- clean ups
- fix build warnings when module
- sort out dup ids with SiS driver
- remove useless/wrong/unused #ifdef/code/...
- fix printk usages
- get rid of non-linux related stuff
Please send patches to:
Arnaud Patard <apatard@mandriva.com>

Просмотреть файл

@ -0,0 +1,10 @@
#ifndef _XGI_H
#define _XGI_H
#if 1
#define TWDEBUG(x)
#else
#define TWDEBUG(x) printk(KERN_INFO x "\n");
#endif
#endif

Просмотреть файл

@ -0,0 +1,596 @@
/*
* XGI 300/630/730/540/315/550/650/740 frame buffer driver
* for Linux kernels 2.4.x and 2.5.x
*
* 2D acceleration part
*
* Based on the X driver's XGI300_accel.c which is
* Copyright Xavier Ducoin <x.ducoin@lectra.com>
* Copyright 2002 by Thomas Winischhofer, Vienna, Austria
* and XGI310_accel.c which is
* Copyright 2002 by Thomas Winischhofer, Vienna, Austria
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
* (see http://www.winischhofer.net/
* for more information and updates)
*/
//#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/fb.h>
#include <linux/console.h>
#include <linux/selection.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/vt_kern.h>
#include <linux/capability.h>
#include <linux/fs.h>
#include <linux/agp_backend.h>
#include <linux/types.h>
/*
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#include <linux/XGIfb.h>
#else
#include <video/XGIfb.h>
#endif
*/
#include <asm/io.h>
#ifdef CONFIG_MTRR
#include <asm/mtrr.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#include <video/fbcon.h>
#include <video/fbcon-cfb8.h>
#include <video/fbcon-cfb16.h>
#include <video/fbcon-cfb24.h>
#include <video/fbcon-cfb32.h>
#endif
#include "osdef.h"
#include "vgatypes.h"
#include "vb_struct.h"
#include "XGIfb.h"
#include "XGI_accel.h"
extern struct video_info xgi_video_info;
extern int XGIfb_accel;
static const int XGIALUConv[] =
{
0x00, /* dest = 0; 0, GXclear, 0 */
0x88, /* dest &= src; DSa, GXand, 0x1 */
0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */
0xCC, /* dest = src; S, GXcopy, 0x3 */
0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */
0xAA, /* dest = dest; D, GXnoop, 0x5 */
0x66, /* dest = ^src; DSx, GXxor, 0x6 */
0xEE, /* dest |= src; DSo, GXor, 0x7 */
0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */
0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */
0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */
0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */
0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */
0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */
0xFF, /* dest = 0xFF; 1, GXset, 0xF */
};
/* same ROP but with Pattern as Source */
static const int XGIPatALUConv[] =
{
0x00, /* dest = 0; 0, GXclear, 0 */
0xA0, /* dest &= src; DPa, GXand, 0x1 */
0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */
0xF0, /* dest = src; P, GXcopy, 0x3 */
0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */
0xAA, /* dest = dest; D, GXnoop, 0x5 */
0x5A, /* dest = ^src; DPx, GXxor, 0x6 */
0xFA, /* dest |= src; DPo, GXor, 0x7 */
0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */
0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */
0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */
0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */
0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */
0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */
0xFF, /* dest = 0xFF; 1, GXset, 0xF */
};
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34)
static const unsigned char myrops[] = {
3, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
};
#endif
/* 300 series */
#if 0
static void
XGI300Sync(void)
{
XGI300Idle
}
#endif
static void
XGI310Sync(void)
{
XGI310Idle
}
#if 0
static void
XGI300SetupForScreenToScreenCopy(int xdir, int ydir, int rop,
unsigned int planemask, int trans_color)
{
XGI300SetupDSTColorDepth(xgi_video_info.DstColor);
XGI300SetupSRCPitch(xgi_video_info.video_linelength)
XGI300SetupDSTRect(xgi_video_info.video_linelength, 0xFFF)
if(trans_color != -1) {
XGI300SetupROP(0x0A)
XGI300SetupSRCTrans(trans_color)
XGI300SetupCMDFlag(TRANSPARENT_BITBLT)
} else {
XGI300SetupROP(XGIALUConv[rop])
}
if(xdir > 0) {
XGI300SetupCMDFlag(X_INC)
}
if(ydir > 0) {
XGI300SetupCMDFlag(Y_INC)
}
}
static void
XGI300SubsequentScreenToScreenCopy(int src_x, int src_y, int dst_x, int dst_y,
int width, int height)
{
long srcbase, dstbase;
srcbase = dstbase = 0;
if (src_y >= 2048) {
srcbase = xgi_video_info.video_linelength * src_y;
src_y = 0;
}
if (dst_y >= 2048) {
dstbase = xgi_video_info.video_linelength * dst_y;
dst_y = 0;
}
XGI300SetupSRCBase(srcbase);
XGI300SetupDSTBase(dstbase);
if(!(xgi_video_info.CommandReg & X_INC)) {
src_x += width-1;
dst_x += width-1;
}
if(!(xgi_video_info.CommandReg & Y_INC)) {
src_y += height-1;
dst_y += height-1;
}
XGI300SetupRect(width, height)
XGI300SetupSRCXY(src_x, src_y)
XGI300SetupDSTXY(dst_x, dst_y)
XGI300DoCMD
}
static void
XGI300SetupForSolidFill(int color, int rop, unsigned int planemask)
{
XGI300SetupPATFG(color)
XGI300SetupDSTRect(xgi_video_info.video_linelength, 0xFFF)
XGI300SetupDSTColorDepth(xgi_video_info.DstColor);
XGI300SetupROP(XGIPatALUConv[rop])
XGI300SetupCMDFlag(PATFG)
}
static void
XGI300SubsequentSolidFillRect(int x, int y, int w, int h)
{
long dstbase;
dstbase = 0;
if(y >= 2048) {
dstbase = xgi_video_info.video_linelength * y;
y = 0;
}
XGI300SetupDSTBase(dstbase)
XGI300SetupDSTXY(x,y)
XGI300SetupRect(w,h)
XGI300SetupCMDFlag(X_INC | Y_INC | BITBLT)
XGI300DoCMD
}
#endif
/* 310/325 series ------------------------------------------------ */
static void
XGI310SetupForScreenToScreenCopy(int xdir, int ydir, int rop,
unsigned int planemask, int trans_color)
{
XGI310SetupDSTColorDepth(xgi_video_info.DstColor);
XGI310SetupSRCPitch(xgi_video_info.video_linelength)
XGI310SetupDSTRect(xgi_video_info.video_linelength, 0xFFF)
if (trans_color != -1) {
XGI310SetupROP(0x0A)
XGI310SetupSRCTrans(trans_color)
XGI310SetupCMDFlag(TRANSPARENT_BITBLT)
} else {
XGI310SetupROP(XGIALUConv[rop])
/* Set command - not needed, both 0 */
/* XGISetupCMDFlag(BITBLT | SRCVIDEO) */
}
XGI310SetupCMDFlag(xgi_video_info.XGI310_AccelDepth)
/* TW: The 310/325 series is smart enough to know the direction */
}
static void
XGI310SubsequentScreenToScreenCopy(int src_x, int src_y, int dst_x, int dst_y,
int width, int height)
{
long srcbase, dstbase;
int mymin, mymax;
srcbase = dstbase = 0;
mymin = min(src_y, dst_y);
mymax = max(src_y, dst_y);
/* Although the chip knows the direction to use
* if the source and destination areas overlap,
* that logic fails if we fiddle with the bitmap
* addresses. Therefore, we check if the source
* and destination blitting areas overlap and
* adapt the bitmap addresses synchronously
* if the coordinates exceed the valid range.
* The the areas do not overlap, we do our
* normal check.
*/
if((mymax - mymin) < height) {
if((src_y >= 2048) || (dst_y >= 2048)) {
srcbase = xgi_video_info.video_linelength * mymin;
dstbase = xgi_video_info.video_linelength * mymin;
src_y -= mymin;
dst_y -= mymin;
}
} else {
if(src_y >= 2048) {
srcbase = xgi_video_info.video_linelength * src_y;
src_y = 0;
}
if(dst_y >= 2048) {
dstbase = xgi_video_info.video_linelength * dst_y;
dst_y = 0;
}
}
XGI310SetupSRCBase(srcbase);
XGI310SetupDSTBase(dstbase);
XGI310SetupRect(width, height)
XGI310SetupSRCXY(src_x, src_y)
XGI310SetupDSTXY(dst_x, dst_y)
XGI310DoCMD
}
static void
XGI310SetupForSolidFill(int color, int rop, unsigned int planemask)
{
XGI310SetupPATFG(color)
XGI310SetupDSTRect(xgi_video_info.video_linelength, 0xFFF)
XGI310SetupDSTColorDepth(xgi_video_info.DstColor);
XGI310SetupROP(XGIPatALUConv[rop])
XGI310SetupCMDFlag(PATFG | xgi_video_info.XGI310_AccelDepth)
}
static void
XGI310SubsequentSolidFillRect(int x, int y, int w, int h)
{
long dstbase;
dstbase = 0;
if(y >= 2048) {
dstbase = xgi_video_info.video_linelength * y;
y = 0;
}
XGI310SetupDSTBase(dstbase)
XGI310SetupDSTXY(x,y)
XGI310SetupRect(w,h)
XGI310SetupCMDFlag(BITBLT)
XGI310DoCMD
}
/* --------------------------------------------------------------------- */
/* The exported routines */
int XGIfb_initaccel(void)
{
#ifdef XGIFB_USE_SPINLOCKS
spin_lock_init(&xgi_video_info.lockaccel);
#endif
return(0);
}
void XGIfb_syncaccel(void)
{
XGI310Sync();
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34) /* --- KERNEL 2.5.34 and later --- */
int fbcon_XGI_sync(struct fb_info *info)
{
if(!XGIfb_accel) return 0;
CRITFLAGS
XGI310Sync();
CRITEND
return 0;
}
void fbcon_XGI_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{
int col=0;
CRITFLAGS
if(!rect->width || !rect->height)
return;
if(!XGIfb_accel) {
cfb_fillrect(info, rect);
return;
}
switch(info->var.bits_per_pixel) {
case 8: col = rect->color;
break;
case 16: col = ((u32 *)(info->pseudo_palette))[rect->color];
break;
case 32: col = ((u32 *)(info->pseudo_palette))[rect->color];
break;
}
CRITBEGIN
XGI310SetupForSolidFill(col, myrops[rect->rop], 0);
XGI310SubsequentSolidFillRect(rect->dx, rect->dy, rect->width, rect->height);
CRITEND
XGI310Sync();
}
void fbcon_XGI_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{
int xdir, ydir;
CRITFLAGS
if(!XGIfb_accel) {
cfb_copyarea(info, area);
return;
}
if(!area->width || !area->height)
return;
if(area->sx < area->dx) xdir = 0;
else xdir = 1;
if(area->sy < area->dy) ydir = 0;
else ydir = 1;
CRITBEGIN
XGI310SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1);
XGI310SubsequentScreenToScreenCopy(area->sx, area->sy, area->dx, area->dy, area->width, area->height);
CRITEND
XGI310Sync();
}
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,33) /* ------ KERNEL <2.5.34 ------ */
void fbcon_XGI_bmove(struct display *p, int srcy, int srcx,
int dsty, int dstx, int height, int width)
{
int xdir, ydir;
CRITFLAGS
if(!xgi_video_info.accel) {
switch(xgi_video_info.video_bpp) {
case 8:
#ifdef FBCON_HAS_CFB8
fbcon_cfb8_bmove(p, srcy, srcx, dsty, dstx, height, width);
#endif
break;
case 16:
#ifdef FBCON_HAS_CFB16
fbcon_cfb16_bmove(p, srcy, srcx, dsty, dstx, height, width);
#endif
break;
case 32:
#ifdef FBCON_HAS_CFB32
fbcon_cfb32_bmove(p, srcy, srcx, dsty, dstx, height, width);
#endif
break;
}
return;
}
srcx *= fontwidth(p);
srcy *= fontheight(p);
dstx *= fontwidth(p);
dsty *= fontheight(p);
width *= fontwidth(p);
height *= fontheight(p);
if(srcx < dstx) xdir = 0;
else xdir = 1;
if(srcy < dsty) ydir = 0;
else ydir = 1;
CRITBEGIN
XGI310SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1);
XGI310SubsequentScreenToScreenCopy(srcx, srcy, dstx, dsty, width, height);
CRITEND
XGI310Sync();
#if 0
printk(KERN_INFO "XGI_bmove sx %d sy %d dx %d dy %d w %d h %d\n",
srcx, srcy, dstx, dsty, width, height);
#endif
}
static void fbcon_XGI_clear(struct vc_data *conp, struct display *p,
int srcy, int srcx, int height, int width, int color)
{
CRITFLAGS
srcx *= fontwidth(p);
srcy *= fontheight(p);
width *= fontwidth(p);
height *= fontheight(p);
CRITBEGIN
XGI310SetupForSolidFill(color, 3, 0);
XGI310SubsequentSolidFillRect(srcx, srcy, width, height);
CRITEND
XGI310Sync();
}
void fbcon_XGI_clear8(struct vc_data *conp, struct display *p,
int srcy, int srcx, int height, int width)
{
u32 bgx;
if(!xgi_video_info.accel) {
#ifdef FBCON_HAS_CFB8
fbcon_cfb8_clear(conp, p, srcy, srcx, height, width);
#endif
return;
}
bgx = attr_bgcol_ec(p, conp);
fbcon_XGI_clear(conp, p, srcy, srcx, height, width, bgx);
}
void fbcon_XGI_clear16(struct vc_data *conp, struct display *p,
int srcy, int srcx, int height, int width)
{
u32 bgx;
if(!xgi_video_info.accel) {
#ifdef FBCON_HAS_CFB16
fbcon_cfb16_clear(conp, p, srcy, srcx, height, width);
#endif
return;
}
bgx = ((u_int16_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)];
fbcon_XGI_clear(conp, p, srcy, srcx, height, width, bgx);
}
void fbcon_XGI_clear32(struct vc_data *conp, struct display *p,
int srcy, int srcx, int height, int width)
{
u32 bgx;
if(!xgi_video_info.accel) {
#ifdef FBCON_HAS_CFB32
fbcon_cfb32_clear(conp, p, srcy, srcx, height, width);
#endif
return;
}
bgx = ((u_int32_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)];
fbcon_XGI_clear(conp, p, srcy, srcx, height, width, bgx);
}
void fbcon_XGI_revc(struct display *p, int srcx, int srcy)
{
CRITFLAGS
if(!xgi_video_info.accel) {
switch(xgi_video_info.video_bpp) {
case 16:
#ifdef FBCON_HAS_CFB16
fbcon_cfb16_revc(p, srcx, srcy);
#endif
break;
case 32:
#ifdef FBCON_HAS_CFB32
fbcon_cfb32_revc(p, srcx, srcy);
#endif
break;
}
return;
}
srcx *= fontwidth(p);
srcy *= fontheight(p);
CRITBEGIN
XGI310SetupForSolidFill(0, 0x0a, 0);
XGI310SubsequentSolidFillRect(srcx, srcy, fontwidth(p), fontheight(p));
CRITEND
XGI310Sync();
}
#ifdef FBCON_HAS_CFB8
struct display_switch fbcon_XGI8 = {
setup: fbcon_cfb8_setup,
bmove: fbcon_XGI_bmove,
clear: fbcon_XGI_clear8,
putc: fbcon_cfb8_putc,
putcs: fbcon_cfb8_putcs,
revc: fbcon_cfb8_revc,
clear_margins: fbcon_cfb8_clear_margins,
fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16)
};
#endif
#ifdef FBCON_HAS_CFB16
struct display_switch fbcon_XGI16 = {
setup: fbcon_cfb16_setup,
bmove: fbcon_XGI_bmove,
clear: fbcon_XGI_clear16,
putc: fbcon_cfb16_putc,
putcs: fbcon_cfb16_putcs,
revc: fbcon_XGI_revc,
clear_margins: fbcon_cfb16_clear_margins,
fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16)
};
#endif
#ifdef FBCON_HAS_CFB32
struct display_switch fbcon_XGI32 = {
setup: fbcon_cfb32_setup,
bmove: fbcon_XGI_bmove,
clear: fbcon_XGI_clear32,
putc: fbcon_cfb32_putc,
putcs: fbcon_cfb32_putcs,
revc: fbcon_XGI_revc,
clear_margins: fbcon_cfb32_clear_margins,
fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16)
};
#endif
#endif /* KERNEL VERSION */

Просмотреть файл

@ -0,0 +1,511 @@
/*
* XGI 300/630/730/540/315/550/650/740 frame buffer driver
* for Linux kernels 2.4.x and 2.5.x
*
* 2D acceleration part
*
* Based on the X driver's XGI300_accel.h which is
* Copyright Xavier Ducoin <x.ducoin@lectra.com>
* Copyright 2002 by Thomas Winischhofer, Vienna, Austria
* and XGI310_accel.h which is
* Copyright 2002 by Thomas Winischhofer, Vienna, Austria
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>:
* (see http://www.winischhofer.net/
* for more information and updates)
*/
#ifndef _XGIFB_ACCEL_H
#define _XGIFB_ACCEL_H
/* Guard accelerator accesses with spin_lock_irqsave? Works well without. */
#undef XGIFB_USE_SPINLOCKS
#ifdef XGIFB_USE_SPINLOCKS
#include <linux/spinlock.h>
#define CRITBEGIN spin_lock_irqsave(&xgi_video_info.lockaccel), critflags);
#define CRITEND spin_unlock_irqrestore(&xgi_video_info.lockaccel), critflags);
#define CRITFLAGS unsigned long critflags;
#else
#define CRITBEGIN
#define CRITEND
#define CRITFLAGS
#endif
/* Definitions for the XGI engine communication. */
#define PATREGSIZE 384 /* Pattern register size. 384 bytes @ 0x8300 */
#define BR(x) (0x8200 | (x) << 2)
#define PBR(x) (0x8300 | (x) << 2)
/* XGI300 engine commands */
#define BITBLT 0x00000000 /* Blit */
#define COLOREXP 0x00000001 /* Color expand */
#define ENCOLOREXP 0x00000002 /* Enhanced color expand */
#define MULTIPLE_SCANLINE 0x00000003 /* ? */
#define LINE 0x00000004 /* Draw line */
#define TRAPAZOID_FILL 0x00000005 /* Fill trapezoid */
#define TRANSPARENT_BITBLT 0x00000006 /* Transparent Blit */
/* Additional engine commands for 310/325 */
#define ALPHA_BLEND 0x00000007 /* Alpha blend ? */
#define A3D_FUNCTION 0x00000008 /* 3D command ? */
#define CLEAR_Z_BUFFER 0x00000009 /* ? */
#define GRADIENT_FILL 0x0000000A /* Gradient fill */
#define STRETCH_BITBLT 0x0000000B /* Stretched Blit */
/* source select */
#define SRCVIDEO 0x00000000 /* source is video RAM */
#define SRCSYSTEM 0x00000010 /* source is system memory */
#define SRCCPUBLITBUF SRCSYSTEM /* source is CPU-driven BitBuffer (for color expand) */
#define SRCAGP 0x00000020 /* source is AGP memory (?) */
/* Pattern flags */
#define PATFG 0x00000000 /* foreground color */
#define PATPATREG 0x00000040 /* pattern in pattern buffer (0x8300) */
#define PATMONO 0x00000080 /* mono pattern */
/* blitting direction (300 series only) */
#define X_INC 0x00010000
#define X_DEC 0x00000000
#define Y_INC 0x00020000
#define Y_DEC 0x00000000
/* Clipping flags */
#define NOCLIP 0x00000000
#define NOMERGECLIP 0x04000000
#define CLIPENABLE 0x00040000
#define CLIPWITHOUTMERGE 0x04040000
/* Transparency */
#define OPAQUE 0x00000000
#define TRANSPARENT 0x00100000
/* ? */
#define DSTAGP 0x02000000
#define DSTVIDEO 0x02000000
/* Line */
#define LINE_STYLE 0x00800000
#define NO_RESET_COUNTER 0x00400000
#define NO_LAST_PIXEL 0x00200000
/* Subfunctions for Color/Enhanced Color Expansion (310/325 only) */
#define COLOR_TO_MONO 0x00100000
#define AA_TEXT 0x00200000
/* Some general registers for 310/325 series */
#define SRC_ADDR 0x8200
#define SRC_PITCH 0x8204
#define AGP_BASE 0x8206 /* color-depth dependent value */
#define SRC_Y 0x8208
#define SRC_X 0x820A
#define DST_Y 0x820C
#define DST_X 0x820E
#define DST_ADDR 0x8210
#define DST_PITCH 0x8214
#define DST_HEIGHT 0x8216
#define RECT_WIDTH 0x8218
#define RECT_HEIGHT 0x821A
#define PAT_FGCOLOR 0x821C
#define PAT_BGCOLOR 0x8220
#define SRC_FGCOLOR 0x8224
#define SRC_BGCOLOR 0x8228
#define MONO_MASK 0x822C
#define LEFT_CLIP 0x8234
#define TOP_CLIP 0x8236
#define RIGHT_CLIP 0x8238
#define BOTTOM_CLIP 0x823A
#define COMMAND_READY 0x823C
#define FIRE_TRIGGER 0x8240
#define PATTERN_REG 0x8300 /* 384 bytes pattern buffer */
/* Line registers */
#define LINE_X0 SRC_Y
#define LINE_X1 DST_Y
#define LINE_Y0 SRC_X
#define LINE_Y1 DST_X
#define LINE_COUNT RECT_WIDTH
#define LINE_STYLE_PERIOD RECT_HEIGHT
#define LINE_STYLE_0 MONO_MASK
#define LINE_STYLE_1 0x8230
#define LINE_XN PATTERN_REG
#define LINE_YN PATTERN_REG+2
/* Transparent bitblit registers */
#define TRANS_DST_KEY_HIGH PAT_FGCOLOR
#define TRANS_DST_KEY_LOW PAT_BGCOLOR
#define TRANS_SRC_KEY_HIGH SRC_FGCOLOR
#define TRANS_SRC_KEY_LOW SRC_BGCOLOR
/* Queue */
#define Q_BASE_ADDR 0x85C0 /* Base address of software queue (?) */
#define Q_WRITE_PTR 0x85C4 /* Current write pointer (?) */
#define Q_READ_PTR 0x85C8 /* Current read pointer (?) */
#define Q_STATUS 0x85CC /* queue status */
#define MMIO_IN8(base, offset) \
*(volatile u8 *)(((u8*)(base)) + (offset))
#define MMIO_IN16(base, offset) \
*(volatile u16 *)(void *)(((u8*)(base)) + (offset))
#define MMIO_IN32(base, offset) \
*(volatile u32 *)(void *)(((u8*)(base)) + (offset))
#define MMIO_OUT8(base, offset, val) \
*(volatile u8 *)(((u8*)(base)) + (offset)) = (val)
#define MMIO_OUT16(base, offset, val) \
*(volatile u16 *)(void *)(((u8*)(base)) + (offset)) = (val)
#define MMIO_OUT32(base, offset, val) \
*(volatile u32 *)(void *)(((u8*)(base)) + (offset)) = (val)
/* ------------- XGI 300 series -------------- */
/* Macros to do useful things with the XGI BitBLT engine */
/* BR(16) (0x8420):
bit 31 2D engine: 1 is idle,
bit 30 3D engine: 1 is idle,
bit 29 Command queue: 1 is empty
bits 28:24: Current CPU driven BitBlt buffer stage bit[4:0]
bits 15:0: Current command queue length
*/
/* TW: BR(16)+2 = 0x8242 */
int xgiCmdQueLen;
#define XGI300Idle \
{ \
while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \
while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \
while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \
xgiCmdQueLen=MMIO_IN16(xgi_video_info.mmio_vbase, 0x8240); \
}
/* TW: (do three times, because 2D engine seems quite unsure about whether or not it's idle) */
#define XGI300SetupSRCBase(base) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(0), base);\
xgiCmdQueLen --;
#define XGI300SetupSRCPitch(pitch) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT16(xgi_video_info.mmio_vbase, BR(1), pitch);\
xgiCmdQueLen --;
#define XGI300SetupSRCXY(x,y) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(2), (x)<<16 | (y) );\
xgiCmdQueLen --;
#define XGI300SetupDSTBase(base) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(4), base);\
xgiCmdQueLen --;
#define XGI300SetupDSTXY(x,y) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(3), (x)<<16 | (y) );\
xgiCmdQueLen --;
#define XGI300SetupDSTRect(x,y) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(5), (y)<<16 | (x) );\
xgiCmdQueLen --;
#define XGI300SetupDSTColorDepth(bpp) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT16(xgi_video_info.mmio_vbase, BR(1)+2, bpp);\
xgiCmdQueLen --;
#define XGI300SetupRect(w,h) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(6), (h)<<16 | (w) );\
xgiCmdQueLen --;
#define XGI300SetupPATFG(color) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(7), color);\
xgiCmdQueLen --;
#define XGI300SetupPATBG(color) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(8), color);\
xgiCmdQueLen --;
#define XGI300SetupSRCFG(color) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(9), color);\
xgiCmdQueLen --;
#define XGI300SetupSRCBG(color) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(10), color);\
xgiCmdQueLen --;
/* 0x8224 src colorkey high */
/* 0x8228 src colorkey low */
/* 0x821c dest colorkey high */
/* 0x8220 dest colorkey low */
#define XGI300SetupSRCTrans(color) \
if (xgiCmdQueLen <= 1) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8224, color);\
MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8228, color);\
xgiCmdQueLen -= 2;
#define XGI300SetupDSTTrans(color) \
if (xgiCmdQueLen <= 1) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, 0x821C, color); \
MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8220, color); \
xgiCmdQueLen -= 2;
#define XGI300SetupMONOPAT(p0,p1) \
if (xgiCmdQueLen <= 1) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(11), p0);\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(12), p1);\
xgiCmdQueLen -= 2;
#define XGI300SetupClipLT(left,top) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(13), ((left) & 0xFFFF) | (top)<<16 );\
xgiCmdQueLen--;
#define XGI300SetupClipRB(right,bottom) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 );\
xgiCmdQueLen--;
/* General */
#define XGI300SetupROP(rop) \
xgi_video_info.CommandReg = (rop) << 8;
#define XGI300SetupCMDFlag(flags) \
xgi_video_info.CommandReg |= (flags);
#define XGI300DoCMD \
if (xgiCmdQueLen <= 1) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(15), xgi_video_info.CommandReg); \
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(16), 0);\
xgiCmdQueLen -= 2;
/* Line */
#define XGI300SetupX0Y0(x,y) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(2), (y)<<16 | (x) );\
xgiCmdQueLen--;
#define XGI300SetupX1Y1(x,y) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(3), (y)<<16 | (x) );\
xgiCmdQueLen--;
#define XGI300SetupLineCount(c) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT16(xgi_video_info.mmio_vbase, BR(6), c);\
xgiCmdQueLen--;
#define XGI300SetupStylePeriod(p) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT16(xgi_video_info.mmio_vbase, BR(6)+2, p);\
xgiCmdQueLen--;
#define XGI300SetupStyleLow(ls) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(11), ls);\
xgiCmdQueLen--;
#define XGI300SetupStyleHigh(ls) \
if (xgiCmdQueLen <= 0) XGI300Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, BR(12), ls);\
xgiCmdQueLen--;
/* ----------- XGI 310/325 series --------------- */
/* Q_STATUS:
bit 31 = 1: All engines idle and all queues empty
bit 30 = 1: Hardware Queue (=HW CQ, 2D queue, 3D queue) empty
bit 29 = 1: 2D engine is idle
bit 28 = 1: 3D engine is idle
bit 27 = 1: HW command queue empty
bit 26 = 1: 2D queue empty
bit 25 = 1: 3D queue empty
bit 24 = 1: SW command queue empty
bits 23:16: 2D counter 3
bits 15:8: 2D counter 2
bits 7:0: 2D counter 1
Where is the command queue length (current amount of commands the queue
can accept) on the 310/325 series? (The current implementation is taken
from 300 series and certainly wrong...)
*/
/* TW: FIXME: xgiCmdQueLen is... where....? */
#define XGI310Idle \
{ \
while( (MMIO_IN16(xgi_video_info.mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \
while( (MMIO_IN16(xgi_video_info.mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \
xgiCmdQueLen=MMIO_IN16(xgi_video_info.mmio_vbase, Q_STATUS); \
}
#define XGI310SetupSRCBase(base) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_ADDR, base);\
xgiCmdQueLen--;
#define XGI310SetupSRCPitch(pitch) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT16(xgi_video_info.mmio_vbase, SRC_PITCH, pitch);\
xgiCmdQueLen--;
#define XGI310SetupSRCXY(x,y) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_Y, (x)<<16 | (y) );\
xgiCmdQueLen--;
#define XGI310SetupDSTBase(base) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, DST_ADDR, base);\
xgiCmdQueLen--;
#define XGI310SetupDSTXY(x,y) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, DST_Y, (x)<<16 | (y) );\
xgiCmdQueLen--;
#define XGI310SetupDSTRect(x,y) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, DST_PITCH, (y)<<16 | (x) );\
xgiCmdQueLen--;
#define XGI310SetupDSTColorDepth(bpp) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT16(xgi_video_info.mmio_vbase, AGP_BASE, bpp);\
xgiCmdQueLen--;
#define XGI310SetupRect(w,h) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, RECT_WIDTH, (h)<<16 | (w) );\
xgiCmdQueLen--;
#define XGI310SetupPATFG(color) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, PAT_FGCOLOR, color);\
xgiCmdQueLen--;
#define XGI310SetupPATBG(color) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, PAT_BGCOLOR, color);\
xgiCmdQueLen--;
#define XGI310SetupSRCFG(color) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_FGCOLOR, color);\
xgiCmdQueLen--;
#define XGI310SetupSRCBG(color) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_BGCOLOR, color);\
xgiCmdQueLen--;
#define XGI310SetupSRCTrans(color) \
if (xgiCmdQueLen <= 1) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_SRC_KEY_HIGH, color);\
MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_SRC_KEY_LOW, color);\
xgiCmdQueLen -= 2;
#define XGI310SetupDSTTrans(color) \
if (xgiCmdQueLen <= 1) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_DST_KEY_HIGH, color); \
MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_DST_KEY_LOW, color); \
xgiCmdQueLen -= 2;
#define XGI310SetupMONOPAT(p0,p1) \
if (xgiCmdQueLen <= 1) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, MONO_MASK, p0);\
MMIO_OUT32(xgi_video_info.mmio_vbase, MONO_MASK+4, p1);\
xgiCmdQueLen -= 2;
#define XGI310SetupClipLT(left,top) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, LEFT_CLIP, ((left) & 0xFFFF) | (top)<<16 );\
xgiCmdQueLen--;
#define XGI310SetupClipRB(right,bottom) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, RIGHT_CLIP, ((right) & 0xFFFF) | (bottom)<<16 );\
xgiCmdQueLen--;
#define XGI310SetupROP(rop) \
xgi_video_info.CommandReg = (rop) << 8;
#define XGI310SetupCMDFlag(flags) \
xgi_video_info.CommandReg |= (flags);
#define XGI310DoCMD \
if (xgiCmdQueLen <= 1) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, COMMAND_READY, xgi_video_info.CommandReg); \
MMIO_OUT32(xgi_video_info.mmio_vbase, FIRE_TRIGGER, 0); \
xgiCmdQueLen -= 2;
#define XGI310SetupX0Y0(x,y) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_X0, (y)<<16 | (x) );\
xgiCmdQueLen--;
#define XGI310SetupX1Y1(x,y) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_X1, (y)<<16 | (x) );\
xgiCmdQueLen--;
#define XGI310SetupLineCount(c) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT16(xgi_video_info.mmio_vbase, LINE_COUNT, c);\
xgiCmdQueLen--;
#define XGI310SetupStylePeriod(p) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT16(xgi_video_info.mmio_vbase, LINE_STYLE_PERIOD, p);\
xgiCmdQueLen--;
#define XGI310SetupStyleLow(ls) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_STYLE_0, ls);\
xgiCmdQueLen--;
#define XGI310SetupStyleHigh(ls) \
if (xgiCmdQueLen <= 0) XGI310Idle;\
MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_STYLE_1, ls);\
xgiCmdQueLen--;
int XGIfb_initaccel(void);
void XGIfb_syncaccel(void);
extern struct video_info xgi_video_info;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,33)
void fbcon_XGI_bmove(struct display *p, int srcy, int srcx, int dsty,
int dstx, int height, int width);
void fbcon_XGI_revc(struct display *p, int srcy, int srcx);
void fbcon_XGI_clear8(struct vc_data *conp, struct display *p, int srcy,
int srcx, int height, int width);
void fbcon_XGI_clear16(struct vc_data *conp, struct display *p, int srcy,
int srcx, int height, int width);
void fbcon_XGI_clear32(struct vc_data *conp, struct display *p, int srcy,
int srcx, int height, int width);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34)
extern int XGIfb_accel;
void fbcon_XGI_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
void fbcon_XGI_copyarea(struct fb_info *info, const struct fb_copyarea *area);
#endif
#endif

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,215 @@
#ifndef _LINUX_XGIFB
#define _LINUX_XGIFB
#include <linux/spinlock.h>
#include <asm/ioctl.h>
#include <asm/types.h>
#define DISPTYPE_CRT1 0x00000008L
#define DISPTYPE_CRT2 0x00000004L
#define DISPTYPE_LCD 0x00000002L
#define DISPTYPE_TV 0x00000001L
#define DISPTYPE_DISP1 DISPTYPE_CRT1
#define DISPTYPE_DISP2 (DISPTYPE_CRT2 | DISPTYPE_LCD | DISPTYPE_TV)
#define DISPMODE_SINGLE 0x00000020L
#define DISPMODE_MIRROR 0x00000010L
#define DISPMODE_DUALVIEW 0x00000040L
#define HASVB_NONE 0x00
#define HASVB_301 0x01
#define HASVB_LVDS 0x02
#define HASVB_TRUMPION 0x04
#define HASVB_LVDS_CHRONTEL 0x10
#define HASVB_302 0x20
#define HASVB_303 0x40
#define HASVB_CHRONTEL 0x80
#ifndef XGIFB_ID
#define XGIFB_ID 0x53495346 /* Identify myself with 'XGIF' */
#endif
typedef enum _XGI_CHIP_TYPE {
XGI_VGALegacy = 0,
XGI_300,
XGI_630,
XGI_730,
XGI_540,
XGI_315H,
XGI_315,
XGI_315PRO,
XGI_550,
XGI_640,
XGI_740,
XGI_650,
XGI_650M,
XGI_330 = 16,
XGI_660,
XGI_661,
XGI_760,
XG40 = 32,
XG41,
XG42,
XG45,
XG20 = 48,
XG21,
XG27,
MAX_XGI_CHIP
} XGI_CHIP_TYPE;
typedef enum _TVTYPE {
TVMODE_NTSC = 0,
TVMODE_PAL,
TVMODE_HIVISION,
TVTYPE_PALM, // vicki@030226
TVTYPE_PALN, // vicki@030226
TVTYPE_NTSCJ, // vicki@030226
TVMODE_TOTAL
} XGI_TV_TYPE;
typedef struct _XGIFB_INFO XGIfb_info;
struct _XGIFB_INFO {
unsigned long XGIfb_id;
int chip_id; /* PCI ID of detected chip */
int memory; /* video memory in KB which XGIfb manages */
int heapstart; /* heap start (= XGIfb "mem" argument) in KB */
unsigned char fbvidmode; /* current XGIfb mode */
unsigned char XGIfb_version;
unsigned char XGIfb_revision;
unsigned char XGIfb_patchlevel;
unsigned char XGIfb_caps; /* XGIfb capabilities */
int XGIfb_tqlen; /* turbo queue length (in KB) */
unsigned int XGIfb_pcibus; /* The card's PCI ID */
unsigned int XGIfb_pcislot;
unsigned int XGIfb_pcifunc;
unsigned char XGIfb_lcdpdc; /* PanelDelayCompensation */
unsigned char XGIfb_lcda; /* Detected status of LCDA for low res/text modes */
char reserved[235]; /* for future use */
};
typedef enum _TVPLUGTYPE { // vicki@030226
// TVPLUG_Legacy = 0,
// TVPLUG_COMPOSITE,
// TVPLUG_SVIDEO,
// TVPLUG_SCART,
// TVPLUG_TOTAL
TVPLUG_UNKNOWN = 0,
TVPLUG_COMPOSITE = 1,
TVPLUG_SVIDEO = 2,
TVPLUG_COMPOSITE_AND_SVIDEO = 3,
TVPLUG_SCART = 4,
TVPLUG_YPBPR_525i = 5,
TVPLUG_YPBPR_525P = 6,
TVPLUG_YPBPR_750P = 7,
TVPLUG_YPBPR_1080i = 8,
TVPLUG_TOTAL
} XGI_TV_PLUG;
struct mode_info {
int bpp;
int xres;
int yres;
int v_xres;
int v_yres;
int org_x;
int org_y;
unsigned int vrate;
};
struct ap_data {
struct mode_info minfo;
unsigned long iobase;
unsigned int mem_size;
unsigned long disp_state;
XGI_CHIP_TYPE chip;
unsigned char hasVB;
XGI_TV_TYPE TV_type;
XGI_TV_PLUG TV_plug;
unsigned long version;
char reserved[256];
};
/* If changing this, vgatypes.h must also be changed (for X driver) */
/*
* NOTE! The ioctl types used to be "size_t" by mistake, but were
* really meant to be __u32. Changed to "__u32" even though that
* changes the value on 64-bit architectures, because the value
* (with a 4-byte size) is also hardwired in vgatypes.h for user
* space exports. So "__u32" is actually more compatible, duh!
*/
#define XGIFB_GET_INFO _IOR('n',0xF8,__u32)
#define XGIFB_GET_VBRSTATUS _IOR('n',0xF9,__u32)
struct video_info{
int chip_id;
unsigned int video_size;
unsigned long video_base;
char * video_vbase;
unsigned long mmio_base;
char * mmio_vbase;
unsigned long vga_base;
unsigned long mtrr;
unsigned long heapstart;
int video_bpp;
int video_cmap_len;
int video_width;
int video_height;
int video_vwidth;
int video_vheight;
int org_x;
int org_y;
int video_linelength;
unsigned int refresh_rate;
unsigned long disp_state;
unsigned char hasVB;
unsigned char TV_type;
unsigned char TV_plug;
XGI_CHIP_TYPE chip;
unsigned char revision_id;
unsigned short DstColor;
unsigned long XGI310_AccelDepth;
unsigned long CommandReg;
spinlock_t lockaccel;
unsigned int pcibus;
unsigned int pcislot;
unsigned int pcifunc;
int accel;
unsigned short subsysvendor;
unsigned short subsysdevice;
char reserved[236];
};
extern struct video_info xgi_video_info;
#ifdef __KERNEL__
//extern void xgi_malloc(struct xgi_memreq *req);
extern void xgi_free(unsigned long base);
extern void xgi_dispinfo(struct ap_data *rec);
#endif
#endif

Просмотреть файл

@ -0,0 +1,153 @@
#ifndef _OSDEF_H_
#define _OSDEF_H_
/* #define WINCE_HEADER*/
/*#define WIN2000*/
/* #define TC */
#define LINUX_KERNEL
/* #define LINUX_XF86 */
/**********************************************************************/
#ifdef LINUX_KERNEL
//#include <linux/config.h>
#endif
/**********************************************************************/
#ifdef TC
#endif
#ifdef WIN2000
#endif
#ifdef WINCE_HEADER
#endif
#ifdef LINUX_XF86
#define LINUX
#endif
#ifdef LINUX_KERNEL
#define LINUX
#endif
/**********************************************************************/
#ifdef TC
#define XGI_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize);
#endif
#ifdef WIN2000
#define XGI_SetMemory(MemoryAddress,MemorySize,value) MemFill((PVOID) MemoryAddress,(ULONG) MemorySize,(UCHAR) value);
#endif
#ifdef WINCE_HEADER
#define XGI_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize);
#endif
#ifdef LINUX_XF86
#define XGI_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize)
#endif
#ifdef LINUX_KERNEL
#define XGI_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize)
#endif
/**********************************************************************/
/**********************************************************************/
#ifdef TC
#define XGI_MemoryCopy(Destination,Soruce,Length) memmove(Destination, Soruce, Length);
#endif
#ifdef WIN2000
#define XGI_MemoryCopy(Destination,Soruce,Length) /*VideoPortMoveMemory((PUCHAR)Destination , Soruce,length);*/
#endif
#ifdef WINCE_HEADER
#define XGI_MemoryCopy(Destination,Soruce,Length) memmove(Destination, Soruce, Length);
#endif
#ifdef LINUX_XF86
#define XGI_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length)
#endif
#ifdef LINUX_KERNEL
#define XGI_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length)
#endif
/**********************************************************************/
#ifdef OutPortByte
#undef OutPortByte
#endif /* OutPortByte */
#ifdef OutPortWord
#undef OutPortWord
#endif /* OutPortWord */
#ifdef OutPortLong
#undef OutPortLong
#endif /* OutPortLong */
#ifdef InPortByte
#undef InPortByte
#endif /* InPortByte */
#ifdef InPortWord
#undef InPortWord
#endif /* InPortWord */
#ifdef InPortLong
#undef InPortLong
#endif /* InPortLong */
/**********************************************************************/
/* TC */
/**********************************************************************/
#ifdef TC
#define OutPortByte(p,v) outp((unsigned short)(p),(unsigned char)(v))
#define OutPortWord(p,v) outp((unsigned short)(p),(unsigned short)(v))
#define OutPortLong(p,v) outp((unsigned short)(p),(unsigned long)(v))
#define InPortByte(p) inp((unsigned short)(p))
#define InPortWord(p) inp((unsigned short)(p))
#define InPortLong(p) ((inp((unsigned short)(p+2))<<16) | inp((unsigned short)(p)))
#endif
/**********************************************************************/
/* LINUX XF86 */
/**********************************************************************/
#ifdef LINUX_XF86
#define OutPortByte(p,v) outb((CARD16)(p),(CARD8)(v))
#define OutPortWord(p,v) outw((CARD16)(p),(CARD16)(v))
#define OutPortLong(p,v) outl((CARD16)(p),(CARD32)(v))
#define InPortByte(p) inb((CARD16)(p))
#define InPortWord(p) inw((CARD16)(p))
#define InPortLong(p) inl((CARD16)(p))
#endif
#ifdef LINUX_KERNEL
#define OutPortByte(p,v) outb((u8)(v),(p))
#define OutPortWord(p,v) outw((u16)(v),(p))
#define OutPortLong(p,v) outl((u32)(v),(p))
#define InPortByte(p) inb(p)
#define InPortWord(p) inw(p)
#define InPortLong(p) inl(p)
#endif
/**********************************************************************/
/* WIN 2000 */
/**********************************************************************/
#ifdef WIN2000
#define OutPortByte(p,v) VideoPortWritePortUchar ((PUCHAR) (p), (UCHAR) (v))
#define OutPortWord(p,v) VideoPortWritePortUshort((PUSHORT) (p), (USHORT) (v))
#define OutPortLong(p,v) VideoPortWritePortUlong ((PULONG) (p), (ULONG) (v))
#define InPortByte(p) VideoPortReadPortUchar ((PUCHAR) (p))
#define InPortWord(p) VideoPortReadPortUshort ((PUSHORT) (p))
#define InPortLong(p) VideoPortReadPortUlong ((PULONG) (p))
#endif
/**********************************************************************/
/* WIN CE */
/**********************************************************************/
#ifdef WINCE_HEADER
#define OutPortByte(p,v) WRITE_PORT_UCHAR ((PUCHAR) (p), (UCHAR) (v))
#define OutPortWord(p,v) WRITE_PORT_USHORT((PUSHORT) (p), (USHORT) (v))
#define OutPortLong(p,v) WRITE_PORT_ULONG ((PULONG) (p), (ULONG) (v))
#define InPortByte(p) READ_PORT_UCHAR ((PUCHAR) (p))
#define InPortWord(p) READ_PORT_USHORT ((PUSHORT) (p))
#define InPortLong(p) READ_PORT_ULONG ((PULONG) (p))
#endif
#endif // _OSDEF_H_

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,32 @@
#ifndef _VBEXT_
#define _VBEXT_
struct DWORDREGS {
ULONG Eax, Ebx, Ecx, Edx, Esi, Edi, Ebp;
};
struct WORDREGS {
USHORT ax, hi_ax, bx, hi_bx, cx, hi_cx, dx, hi_dx, si, hi_si, di ,hi_di, bp, hi_bp;
};
struct BYTEREGS {
UCHAR al, ah, hi_al, hi_ah, bl, bh, hi_bl, hi_bh, cl, ch, hi_cl, hi_ch, dl, dh, hi_dl, hi_dh;
};
typedef union _X86_REGS {
struct DWORDREGS e;
struct WORDREGS x;
struct BYTEREGS h;
} X86_REGS, *PX86_REGS;
extern void XGI_XG21Fun14( PXGI_HW_DEVICE_INFO pXGIHWDE, PX86_REGS pBiosArguments);
extern void XGISetDPMS( PXGI_HW_DEVICE_INFO pXGIHWDE , ULONG VESA_POWER_STATE ) ;
extern void XGI_GetSenseStatus( PXGI_HW_DEVICE_INFO HwDeviceExtension , PVB_DEVICE_INFO pVBInfo );
extern void XGINew_SetModeScratch ( PXGI_HW_DEVICE_INFO HwDeviceExtension , PVB_DEVICE_INFO pVBInfo ) ;
extern void ReadVBIOSTablData( UCHAR ChipType , PVB_DEVICE_INFO pVBInfo);
extern USHORT XGINew_SenseLCD(PXGI_HW_DEVICE_INFO,PVB_DEVICE_INFO pVBInfo);
#ifdef WIN2000
extern BOOLEAN XGI_DySense( PHW_DEVICE_EXTENSION pHWDE , PUCHAR ujConnectStatus );
#endif /* WIN2000 */
#endif

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,7 @@
#ifndef _VBINIT_
#define _VBINIT_
extern BOOLEAN XGIInitNew( PXGI_HW_DEVICE_INFO HwDeviceExtension ) ;
extern XGI21_LVDSCapStruct XGI21_LCDCapList[13];
#endif

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,40 @@
#ifndef _VBSETMODE_
#define _VBSETMODE_
extern void InitTo330Pointer(UCHAR,PVB_DEVICE_INFO);
extern void XGI_UnLockCRT2(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO );
extern void XGI_LockCRT2(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO );
extern void XGI_LongWait( PVB_DEVICE_INFO );
extern void XGI_SetCRT2ModeRegs(USHORT ModeNo,PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO );
extern void XGI_DisableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO );
extern void XGI_EnableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO );
extern void XGI_DisplayOff( PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO );
extern void XGI_DisplayOn( PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO );
extern void XGI_GetVBType(PVB_DEVICE_INFO);
extern void XGI_SenseCRT1(PVB_DEVICE_INFO );
extern void XGI_GetVGAType(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO );
extern void XGI_GetVBInfo(USHORT ModeNo,USHORT ModeIdIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO );
extern void XGI_GetTVInfo(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO );
extern void XGI_SetCRT1Offset(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO );
extern void XGI_SetLCDAGroup(USHORT ModeNo,USHORT ModeIdIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO );
extern void XGI_WaitDisply( PVB_DEVICE_INFO );
extern USHORT XGI_GetResInfo(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
extern BOOLEAN XGISetModeNew( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo ) ;
extern BOOLEAN XGI_SearchModeID( USHORT ModeNo,USHORT *ModeIdIndex, PVB_DEVICE_INFO );
extern BOOLEAN XGI_GetLCDInfo(USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO );
extern BOOLEAN XGI_BridgeIsOn( PVB_DEVICE_INFO );
extern BOOLEAN XGI_SetCRT2Group301(USHORT ModeNo, PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO);
extern USHORT XGI_GetRatePtrCRT2( PXGI_HW_DEVICE_INFO pXGIHWDE, USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO );
extern void XGI_SetXG21FPBits(PVB_DEVICE_INFO pVBInfo);
extern void XGI_SetXG27FPBits(PVB_DEVICE_INFO pVBInfo);
extern void XGI_XG21BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo);
extern void XGI_XG27BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo);
extern void XGI_XG21SetPanelDelay(USHORT tempbl, PVB_DEVICE_INFO pVBInfo);
extern BOOLEAN XGI_XG21CheckLVDSMode(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo );
extern void XGI_SetXG21LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo );
extern USHORT XGI_GetLVDSOEMTableIndex(PVB_DEVICE_INFO pVBInfo);
#endif

Просмотреть файл

@ -0,0 +1,534 @@
#ifndef _VB_STRUCT_
#define _VB_STRUCT_
#ifdef _INITNEW_
#define EXTERN
#else
#define EXTERN extern
#endif
typedef struct _XGI_PanelDelayTblStruct
{
UCHAR timer[2];
} XGI_PanelDelayTblStruct;
typedef struct _XGI_LCDDataStruct
{
USHORT RVBHCMAX;
USHORT RVBHCFACT;
USHORT VGAHT;
USHORT VGAVT;
USHORT LCDHT;
USHORT LCDVT;
} XGI_LCDDataStruct;
typedef struct _XGI_LVDSCRT1HDataStruct
{
UCHAR Reg[8];
} XGI_LVDSCRT1HDataStruct;
typedef struct _XGI_LVDSCRT1VDataStruct
{
UCHAR Reg[7];
} XGI_LVDSCRT1VDataStruct;
typedef struct _XGI_TVDataStruct
{
USHORT RVBHCMAX;
USHORT RVBHCFACT;
USHORT VGAHT;
USHORT VGAVT;
USHORT TVHDE;
USHORT TVVDE;
USHORT RVBHRS;
UCHAR FlickerMode;
USHORT HALFRVBHRS;
UCHAR RY1COE;
UCHAR RY2COE;
UCHAR RY3COE;
UCHAR RY4COE;
} XGI_TVDataStruct;
typedef struct _XGI_LVDSDataStruct
{
USHORT VGAHT;
USHORT VGAVT;
USHORT LCDHT;
USHORT LCDVT;
} XGI_LVDSDataStruct;
typedef struct _XGI_LVDSDesStruct
{
USHORT LCDHDES;
USHORT LCDVDES;
} XGI_LVDSDesStruct;
typedef struct _XGI_LVDSCRT1DataStruct
{
UCHAR CR[15];
} XGI_LVDSCRT1DataStruct;
/*add for LCDA*/
typedef struct _XGI_StStruct
{
UCHAR St_ModeID;
USHORT St_ModeFlag;
UCHAR St_StTableIndex;
UCHAR St_CRT2CRTC;
UCHAR St_CRT2CRTC2;
UCHAR St_ResInfo;
UCHAR VB_StTVFlickerIndex;
UCHAR VB_StTVEdgeIndex;
UCHAR VB_StTVYFilterIndex;
} XGI_StStruct;
typedef struct _XGI_StandTableStruct
{
UCHAR CRT_COLS;
UCHAR ROWS;
UCHAR CHAR_HEIGHT;
USHORT CRT_LEN;
UCHAR SR[4];
UCHAR MISC;
UCHAR CRTC[0x19];
UCHAR ATTR[0x14];
UCHAR GRC[9];
} XGI_StandTableStruct;
typedef struct _XGI_ExtStruct
{
UCHAR Ext_ModeID;
USHORT Ext_ModeFlag;
USHORT Ext_ModeInfo;
USHORT Ext_Point;
USHORT Ext_VESAID;
UCHAR Ext_VESAMEMSize;
UCHAR Ext_RESINFO;
UCHAR VB_ExtTVFlickerIndex;
UCHAR VB_ExtTVEdgeIndex;
UCHAR VB_ExtTVYFilterIndex;
UCHAR REFindex;
} XGI_ExtStruct;
typedef struct _XGI_Ext2Struct
{
USHORT Ext_InfoFlag;
UCHAR Ext_CRT1CRTC;
UCHAR Ext_CRTVCLK;
UCHAR Ext_CRT2CRTC;
UCHAR Ext_CRT2CRTC2;
UCHAR ModeID;
USHORT XRes;
USHORT YRes;
/* USHORT ROM_OFFSET; */
} XGI_Ext2Struct;
typedef struct _XGI_MCLKDataStruct
{
UCHAR SR28,SR29,SR2A;
USHORT CLOCK;
} XGI_MCLKDataStruct;
typedef struct _XGI_ECLKDataStruct
{
UCHAR SR2E,SR2F,SR30;
USHORT CLOCK;
} XGI_ECLKDataStruct;
typedef struct _XGI_VCLKDataStruct
{
UCHAR SR2B,SR2C;
USHORT CLOCK;
} XGI_VCLKDataStruct;
typedef struct _XGI_VBVCLKDataStruct
{
UCHAR Part4_A,Part4_B;
USHORT CLOCK;
} XGI_VBVCLKDataStruct;
typedef struct _XGI_StResInfoStruct
{
USHORT HTotal;
USHORT VTotal;
} XGI_StResInfoStruct;
typedef struct _XGI_ModeResInfoStruct
{
USHORT HTotal;
USHORT VTotal;
UCHAR XChar;
UCHAR YChar;
} XGI_ModeResInfoStruct;
typedef struct _XGI_LCDNBDesStruct
{
UCHAR NB[12];
} XGI_LCDNBDesStruct;
/*add for new UNIVGABIOS*/
typedef struct _XGI_LCDDesStruct
{
USHORT LCDHDES;
USHORT LCDHRS;
USHORT LCDVDES;
USHORT LCDVRS;
} XGI_LCDDesStruct;
typedef struct _XGI_LCDDataTablStruct
{
UCHAR PANELID;
USHORT MASK;
USHORT CAP;
USHORT DATAPTR;
} XGI_LCDDataTablStruct;
typedef struct _XGI_TVTablDataStruct
{
USHORT MASK;
USHORT CAP;
USHORT DATAPTR;
} XGI_TVDataTablStruct;
typedef struct _XGI330_LCDDesDataStruct
{
USHORT LCDHDES;
USHORT LCDHRS;
USHORT LCDVDES;
USHORT LCDVRS;
} XGI330_LCDDataDesStruct;
typedef struct _XGI330_LVDSDataStruct
{
USHORT VGAHT;
USHORT VGAVT;
USHORT LCDHT;
USHORT LCDVT;
} XGI330_LVDSDataStruct;
typedef struct _XGI330_LCDDesDataStruct2
{
USHORT LCDHDES;
USHORT LCDHRS;
USHORT LCDVDES;
USHORT LCDVRS;
USHORT LCDHSync;
USHORT LCDVSync;
} XGI330_LCDDataDesStruct2;
typedef struct _XGI330_LCDDataStruct
{
USHORT RVBHCMAX;
USHORT RVBHCFACT;
USHORT VGAHT;
USHORT VGAVT;
USHORT LCDHT;
USHORT LCDVT;
} XGI330_LCDDataStruct;
typedef struct _XGI330_TVDataStruct
{
USHORT RVBHCMAX;
USHORT RVBHCFACT;
USHORT VGAHT;
USHORT VGAVT;
USHORT TVHDE;
USHORT TVVDE;
USHORT RVBHRS;
UCHAR FlickerMode;
USHORT HALFRVBHRS;
} XGI330_TVDataStruct;
typedef struct _XGI330_LCDDataTablStruct
{
UCHAR PANELID;
USHORT MASK;
USHORT CAP;
USHORT DATAPTR;
} XGI330_LCDDataTablStruct;
typedef struct _XGI330_TVDataTablStruct
{
USHORT MASK;
USHORT CAP;
USHORT DATAPTR;
} XGI330_TVDataTablStruct;
typedef struct _XGI330_CHTVDataStruct
{
USHORT VGAHT;
USHORT VGAVT;
USHORT LCDHT;
USHORT LCDVT;
} XGI330_CHTVDataStruct;
typedef struct _XGI_TimingHStruct
{
UCHAR data[8];
} XGI_TimingHStruct;
typedef struct _XGI_TimingVStruct
{
UCHAR data[7];
} XGI_TimingVStruct;
typedef struct _XGI_CH7007TV_TimingHStruct
{
UCHAR data[10];
} XGI_CH7007TV_TimingHStruct;
typedef struct _XGI_CH7007TV_TimingVStruct
{
UCHAR data[10];
} XGI_CH7007TV_TimingVStruct;
typedef struct _XGI_XG21CRT1Struct
{
UCHAR ModeID,CR02,CR03,CR15,CR16;
} XGI_XG21CRT1Struct;
typedef struct _XGI330_CHTVRegDataStruct
{
UCHAR Reg[16];
} XGI330_CHTVRegDataStruct;
typedef struct _XGI330_LCDCapStruct
{
UCHAR LCD_ID;
USHORT LCD_Capability;
UCHAR LCD_SetFlag;
UCHAR LCD_DelayCompensation;
UCHAR LCD_HSyncWidth;
UCHAR LCD_VSyncWidth;
UCHAR LCD_VCLK;
UCHAR LCDA_VCLKData1;
UCHAR LCDA_VCLKData2;
UCHAR LCUCHAR_VCLKData1;
UCHAR LCUCHAR_VCLKData2;
UCHAR PSC_S1;
UCHAR PSC_S2;
UCHAR PSC_S3;
UCHAR PSC_S4;
UCHAR PSC_S5;
UCHAR PWD_2B;
UCHAR PWD_2C;
UCHAR PWD_2D;
UCHAR PWD_2E;
UCHAR PWD_2F;
UCHAR Spectrum_31;
UCHAR Spectrum_32;
UCHAR Spectrum_33;
UCHAR Spectrum_34;
} XGI330_LCDCapStruct;
typedef struct _XGI21_LVDSCapStruct
{
USHORT LVDS_Capability;
USHORT LVDSHT;
USHORT LVDSVT;
USHORT LVDSHDE;
USHORT LVDSVDE;
USHORT LVDSHFP;
USHORT LVDSVFP;
USHORT LVDSHSYNC;
USHORT LVDSVSYNC;
UCHAR VCLKData1;
UCHAR VCLKData2;
UCHAR PSC_S1;
UCHAR PSC_S2;
UCHAR PSC_S3;
UCHAR PSC_S4;
UCHAR PSC_S5;
} XGI21_LVDSCapStruct;
typedef struct _XGI_CRT1TableStruct
{
UCHAR CR[16];
} XGI_CRT1TableStruct;
typedef struct _XGI330_VCLKDataStruct
{
UCHAR SR2B,SR2C;
USHORT CLOCK;
} XGI330_VCLKDataStruct;
typedef struct _XGI301C_Tap4TimingStruct
{
USHORT DE;
UCHAR Reg[64]; /* C0-FF */
} XGI301C_Tap4TimingStruct;
typedef struct _XGI_New_StandTableStruct
{
UCHAR CRT_COLS;
UCHAR ROWS;
UCHAR CHAR_HEIGHT;
USHORT CRT_LEN;
UCHAR SR[4];
UCHAR MISC;
UCHAR CRTC[0x19];
UCHAR ATTR[0x14];
UCHAR GRC[9];
} XGI_New_StandTableStruct;
typedef UCHAR DRAM8Type[8];
typedef UCHAR DRAM4Type[4];
typedef UCHAR DRAM32Type[32];
typedef UCHAR DRAM2Type[2];
typedef struct _VB_DEVICE_INFO VB_DEVICE_INFO;
typedef VB_DEVICE_INFO * PVB_DEVICE_INFO;
struct _VB_DEVICE_INFO
{
BOOLEAN ISXPDOS;
ULONG P3c4,P3d4,P3c0,P3ce,P3c2,P3cc;
ULONG P3ca,P3c6,P3c7,P3c8,P3c9,P3da;
ULONG Part0Port,Part1Port,Part2Port;
ULONG Part3Port,Part4Port,Part5Port;
USHORT RVBHCFACT,RVBHCMAX,RVBHRS;
USHORT VGAVT,VGAHT,VGAVDE,VGAHDE;
USHORT VT,HT,VDE,HDE;
USHORT LCDHRS,LCDVRS,LCDHDES,LCDVDES;
USHORT ModeType;
USHORT IF_DEF_LVDS,IF_DEF_TRUMPION,IF_DEF_DSTN;/* ,IF_DEF_FSTN; add for dstn */
USHORT IF_DEF_CRT2Monitor,IF_DEF_VideoCapture;
USHORT IF_DEF_LCDA,IF_DEF_CH7017,IF_DEF_YPbPr,IF_DEF_ScaleLCD,IF_DEF_OEMUtil,IF_DEF_PWD;
USHORT IF_DEF_ExpLink;
USHORT IF_DEF_CH7005,IF_DEF_HiVision;
USHORT IF_DEF_CH7007; /* Billy 2007/05/03 */
USHORT LCDResInfo,LCDTypeInfo, VBType;/*301b*/
USHORT VBInfo,TVInfo,LCDInfo, Set_VGAType;
USHORT VBExtInfo;/*301lv*/
USHORT SetFlag;
USHORT NewFlickerMode;
USHORT SelectCRT2Rate;
PUCHAR ROMAddr;
PUCHAR FBAddr;
ULONG BaseAddr;
ULONG RelIO;
DRAM4Type *CR6B;
DRAM4Type *CR6E;
DRAM32Type *CR6F;
DRAM2Type *CR89;
DRAM8Type *SR15; /* pointer : point to array */
DRAM8Type *CR40;
UCHAR *pSoftSetting;
UCHAR *pOutputSelect;
USHORT *pRGBSenseData;
USHORT *pRGBSenseData2; /*301b*/
USHORT *pVideoSenseData;
USHORT *pVideoSenseData2;
USHORT *pYCSenseData;
USHORT *pYCSenseData2;
UCHAR *pSR07;
UCHAR *CR49;
UCHAR *pSR1F;
UCHAR *AGPReg;
UCHAR *SR16;
UCHAR *pSR21;
UCHAR *pSR22;
UCHAR *pSR23;
UCHAR *pSR24;
UCHAR *SR25;
UCHAR *pSR31;
UCHAR *pSR32;
UCHAR *pSR33;
UCHAR *pSR36; /* alan 12/07/2006 */
UCHAR *pCRCF;
UCHAR *pCRD0; /* alan 12/07/2006 */
UCHAR *pCRDE; /* alan 12/07/2006 */
UCHAR *pCR8F; /* alan 12/07/2006 */
UCHAR *pSR40; /* alan 12/07/2006 */
UCHAR *pSR41; /* alan 12/07/2006 */
UCHAR *pDVOSetting;
UCHAR *pCR2E;
UCHAR *pCR2F;
UCHAR *pCR46;
UCHAR *pCR47;
UCHAR *pCRT2Data_1_2;
UCHAR *pCRT2Data_4_D;
UCHAR *pCRT2Data_4_E;
UCHAR *pCRT2Data_4_10;
XGI_MCLKDataStruct *MCLKData;
XGI_ECLKDataStruct *ECLKData;
UCHAR *XGI_TVDelayList;
UCHAR *XGI_TVDelayList2;
UCHAR *CHTVVCLKUNTSC;
UCHAR *CHTVVCLKONTSC;
UCHAR *CHTVVCLKUPAL;
UCHAR *CHTVVCLKOPAL;
UCHAR *NTSCTiming;
UCHAR *PALTiming;
UCHAR *HiTVExtTiming;
UCHAR *HiTVSt1Timing;
UCHAR *HiTVSt2Timing;
UCHAR *HiTVTextTiming;
UCHAR *YPbPr750pTiming;
UCHAR *YPbPr525pTiming;
UCHAR *YPbPr525iTiming;
UCHAR *HiTVGroup3Data;
UCHAR *HiTVGroup3Simu;
UCHAR *HiTVGroup3Text;
UCHAR *Ren525pGroup3;
UCHAR *Ren750pGroup3;
UCHAR *ScreenOffset;
UCHAR *pXGINew_DRAMTypeDefinition;
UCHAR *pXGINew_I2CDefinition ;
UCHAR *pXGINew_CR97 ;
XGI330_LCDCapStruct *LCDCapList;
XGI21_LVDSCapStruct *XG21_LVDSCapList;
XGI_TimingHStruct *TimingH;
XGI_TimingVStruct *TimingV;
XGI_StStruct *SModeIDTable;
XGI_StandTableStruct *StandTable;
XGI_ExtStruct *EModeIDTable;
XGI_Ext2Struct *RefIndex;
/* XGINew_CRT1TableStruct *CRT1Table; */
XGI_CRT1TableStruct *XGINEWUB_CRT1Table;
XGI_VCLKDataStruct *VCLKData;
XGI_VBVCLKDataStruct *VBVCLKData;
XGI_StResInfoStruct *StResInfo;
XGI_ModeResInfoStruct *ModeResInfo;
XGI_XG21CRT1Struct *UpdateCRT1;
}; /* _VB_DEVICE_INFO */
typedef struct
{
USHORT Horizontal_ACTIVE;
USHORT Horizontal_FP;
USHORT Horizontal_SYNC;
USHORT Horizontal_BP;
USHORT Vertical_ACTIVE;
USHORT Vertical_FP;
USHORT Vertical_SYNC;
USHORT Vertical_BP;
double DCLK;
UCHAR FrameRate;
UCHAR Interlace;
USHORT Margin;
} TimingInfo;
#define _VB_STRUCT_
#endif /* _VB_STRUCT_ */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,263 @@
#include "osdef.h"
#include "vb_def.h"
#include "vgatypes.h"
#include "vb_struct.h"
#ifdef LINUX_KERNEL
#include "XGIfb.h"
#include <asm/io.h>
#include <linux/types.h>
#endif
#ifdef TC
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <dos.h>
#endif
#ifdef WIN2000
#include <dderror.h>
#include <devioctl.h>
#include <miniport.h>
#include <ntddvdeo.h>
#include <video.h>
#include "xgiv.h"
#include "dd_i2c.h"
#include "tools.h"
#endif
#ifdef LINUX_XF86
#include "xf86.h"
#include "xf86PciInfo.h"
#include "xgi.h"
#include "xgi_regs.h"
#endif
void XGINew_SetReg1( ULONG , USHORT , USHORT ) ;
void XGINew_SetReg2( ULONG , USHORT , USHORT ) ;
void XGINew_SetReg3( ULONG , USHORT ) ;
void XGINew_SetReg4( ULONG , ULONG ) ;
UCHAR XGINew_GetReg1( ULONG , USHORT) ;
UCHAR XGINew_GetReg2( ULONG ) ;
ULONG XGINew_GetReg3( ULONG ) ;
void XGINew_ClearDAC( PUCHAR ) ;
void XGINew_SetRegANDOR(ULONG Port,USHORT Index,USHORT DataAND,USHORT DataOR);
void XGINew_SetRegOR(ULONG Port,USHORT Index,USHORT DataOR);
void XGINew_SetRegAND(ULONG Port,USHORT Index,USHORT DataAND);
/* --------------------------------------------------------------------- */
/* Function : XGINew_SetReg1 */
/* Input : */
/* Output : */
/* Description : SR CRTC GR */
/* --------------------------------------------------------------------- */
void XGINew_SetReg1( ULONG port , USHORT index , USHORT data )
{
#ifdef LINUX_XF86
OutPortByte( ( PUCHAR )(ULONG)port , index ) ;
OutPortByte( ( PUCHAR )(ULONG)port + 1 , data ) ;
#else
OutPortByte( port , index ) ;
OutPortByte( port + 1 , data ) ;
#endif
}
/* --------------------------------------------------------------------- */
/* Function : XGINew_SetReg2 */
/* Input : */
/* Output : */
/* Description : AR( 3C0 ) */
/* --------------------------------------------------------------------- */
/*void XGINew_SetReg2( ULONG port , USHORT index , USHORT data )
{
InPortByte( ( PUCHAR )port + 0x3da - 0x3c0 ) ;
OutPortByte( XGINew_P3c0 , index ) ;
OutPortByte( XGINew_P3c0 , data ) ;
OutPortByte( XGINew_P3c0 , 0x20 ) ;
}*/
/* --------------------------------------------------------------------- */
/* Function : */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGINew_SetReg3( ULONG port , USHORT data )
{
OutPortByte( port , data ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGINew_SetReg4 */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGINew_SetReg4( ULONG port , ULONG data )
{
OutPortLong( port , data ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGINew_GetReg1 */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
UCHAR XGINew_GetReg1( ULONG port , USHORT index )
{
UCHAR data ;
#ifdef LINUX_XF86
OutPortByte( ( PUCHAR )(ULONG)port , index ) ;
data = InPortByte( ( PUCHAR )(ULONG)port + 1 ) ;
#else
OutPortByte( port , index ) ;
data = InPortByte( port + 1 ) ;
#endif
return( data ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGINew_GetReg2 */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
UCHAR XGINew_GetReg2( ULONG port )
{
UCHAR data ;
data = InPortByte( port ) ;
return( data ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGINew_GetReg3 */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
ULONG XGINew_GetReg3( ULONG port )
{
ULONG data ;
data = InPortLong( port ) ;
return( data ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGINew_SetRegANDOR */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGINew_SetRegANDOR( ULONG Port , USHORT Index , USHORT DataAND , USHORT DataOR )
{
USHORT temp ;
temp = XGINew_GetReg1( Port , Index ) ; /* XGINew_Part1Port index 02 */
temp = ( temp & ( DataAND ) ) | DataOR ;
XGINew_SetReg1( Port , Index , temp ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGINew_SetRegAND */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGINew_SetRegAND(ULONG Port,USHORT Index,USHORT DataAND)
{
USHORT temp ;
temp = XGINew_GetReg1( Port , Index ) ; /* XGINew_Part1Port index 02 */
temp &= DataAND ;
XGINew_SetReg1( Port , Index , temp ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGINew_SetRegOR */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGINew_SetRegOR( ULONG Port , USHORT Index , USHORT DataOR )
{
USHORT temp ;
temp = XGINew_GetReg1( Port , Index ) ; /* XGINew_Part1Port index 02 */
temp |= DataOR ;
XGINew_SetReg1( Port , Index , temp ) ;
}
/* --------------------------------------------------------------------- */
/* Function : NewDelaySecond */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void NewDelaySeconds( int seconds )
{
#ifdef WIN2000
int j ;
#endif
int i ;
for( i = 0 ; i < seconds ; i++ )
{
#ifdef TC
delay( 1000 ) ;
#endif
#ifdef WIN2000
for ( j = 0 ; j < 20000 ; j++ )
VideoPortStallExecution( 50 ) ;
#endif
#ifdef WINCE_HEADER
#endif
#ifdef LINUX_KERNEL
#endif
}
}
/* --------------------------------------------------------------------- */
/* Function : Newdebugcode */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void Newdebugcode( UCHAR code )
{
// OutPortByte ( 0x80 , code ) ;
/* OutPortByte ( 0x300 , code ) ; */
/* NewDelaySeconds( 0x3 ) ; */
}

Просмотреть файл

@ -0,0 +1,15 @@
#ifndef _VBUTIL_
#define _VBUTIL_
extern void NewDelaySeconds( int );
extern void Newdebugcode( UCHAR );
extern void XGINew_SetReg1(ULONG, USHORT, USHORT);
extern void XGINew_SetReg3(ULONG, USHORT);
extern UCHAR XGINew_GetReg1(ULONG, USHORT);
extern UCHAR XGINew_GetReg2(ULONG);
extern void XGINew_SetReg4(ULONG, ULONG);
extern ULONG XGINew_GetReg3(ULONG);
extern void XGINew_SetRegOR(ULONG Port,USHORT Index,USHORT DataOR);
extern void XGINew_SetRegAND(ULONG Port,USHORT Index,USHORT DataAND);
extern void XGINew_SetRegANDOR(ULONG Port,USHORT Index,USHORT DataAND,USHORT DataOR);
#endif

Просмотреть файл

@ -0,0 +1,325 @@
#ifndef _VGATYPES_
#define _VGATYPES_
#include "osdef.h"
#ifdef LINUX_XF86
#include "xf86Version.h"
#include "xf86Pci.h"
#endif
#ifdef LINUX_KERNEL /* We don't want the X driver to depend on kernel source */
#include <linux/ioctl.h>
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef CHAR
typedef char CHAR;
#endif
#ifndef SHORT
typedef short SHORT;
#endif
#ifndef LONG
typedef long LONG;
#endif
#ifndef UCHAR
typedef unsigned char UCHAR;
#endif
#ifndef USHORT
typedef unsigned short USHORT;
#endif
#ifndef ULONG
typedef unsigned long ULONG;
#endif
#ifndef PUCHAR
typedef UCHAR *PUCHAR;
#endif
#ifndef PUSHORT
typedef USHORT *PUSHORT;
#endif
#ifndef PLONGU
typedef ULONG *PULONG;
#endif
#ifndef VOID
typedef void VOID;
#endif
#ifndef PVOID
typedef void *PVOID;
#endif
#ifndef BOOLEAN
typedef UCHAR BOOLEAN;
#endif
/*
#ifndef bool
typedef UCHAR bool;
#endif
*/
#ifdef LINUX_KERNEL
typedef unsigned long XGIIOADDRESS;
#endif
#ifdef LINUX_XF86
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,0,0,0)
typedef unsigned char IOADDRESS;
typedef unsigned char XGIIOADDRESS;
#else
typedef IOADDRESS XGIIOADDRESS;
#endif
#endif
#ifndef VBIOS_VER_MAX_LENGTH
#define VBIOS_VER_MAX_LENGTH 4
#endif
#ifndef WIN2000
#ifndef LINUX_KERNEL /* For the linux kernel, this is defined in xgifb.h */
#ifndef XGI_CHIP_TYPE
typedef enum _XGI_CHIP_TYPE {
XGI_VGALegacy = 0,
#ifdef LINUX_XF86
XGI_530,
XGI_OLD,
#endif
XGI_300,
XGI_630,
XGI_640,
XGI_315H,
XGI_315,
XGI_315PRO,
XGI_550,
XGI_650,
XGI_650M,
XGI_740,
XGI_330,
XGI_661,
XGI_660,
XGI_760,
XG40 = 32,
XG41,
XG42,
XG45,
XG20 = 48,
XG21,
XG27,
MAX_XGI_CHIP
} XGI_CHIP_TYPE;
#endif
#endif
#ifndef XGI_VB_CHIP_TYPE
typedef enum _XGI_VB_CHIP_TYPE {
VB_CHIP_Legacy = 0,
VB_CHIP_301,
VB_CHIP_301B,
VB_CHIP_301LV,
VB_CHIP_302,
VB_CHIP_302B,
VB_CHIP_302LV,
VB_CHIP_301C,
VB_CHIP_302ELV,
VB_CHIP_UNKNOWN, /* other video bridge or no video bridge */
MAX_VB_CHIP
} XGI_VB_CHIP_TYPE;
#endif
#ifndef XGI_LCD_TYPE
typedef enum _XGI_LCD_TYPE {
LCD_INVALID = 0,
LCD_320x480, /* FSTN, DSTN */
LCD_640x480,
LCD_640x480_2, /* FSTN, DSTN */
LCD_640x480_3, /* FSTN, DSTN */
LCD_800x600,
LCD_848x480,
LCD_1024x600,
LCD_1024x768,
LCD_1152x768,
LCD_1152x864,
LCD_1280x720,
LCD_1280x768,
LCD_1280x800,
LCD_1280x960,
LCD_1280x1024,
LCD_1400x1050,
LCD_1600x1200,
LCD_1680x1050,
LCD_1920x1440,
LCD_2048x1536,
LCD_CUSTOM,
LCD_UNKNOWN
} XGI_LCD_TYPE;
#endif
#endif /* not WIN2000 */
#ifndef PXGI_DSReg
typedef struct _XGI_DSReg
{
UCHAR jIdx;
UCHAR jVal;
} XGI_DSReg, *PXGI_DSReg;
#endif
#ifndef XGI_HW_DEVICE_INFO
typedef struct _XGI_HW_DEVICE_INFO XGI_HW_DEVICE_INFO, *PXGI_HW_DEVICE_INFO;
typedef BOOLEAN (*PXGI_QUERYSPACE) (PXGI_HW_DEVICE_INFO, ULONG, ULONG, ULONG *);
struct _XGI_HW_DEVICE_INFO
{
ULONG ulExternalChip; /* NO VB or other video bridge*/
/* if ujVBChipID = VB_CHIP_UNKNOWN, */
#ifdef LINUX_XF86
PCITAG PciTag; /* PCI Tag */
#endif
PUCHAR pjVirtualRomBase; /* ROM image */
BOOLEAN UseROM; /* Use the ROM image if provided */
PVOID pDevice;
PUCHAR pjVideoMemoryAddress;/* base virtual memory address */
/* of Linear VGA memory */
ULONG ulVideoMemorySize; /* size, in bytes, of the memory on the board */
PUCHAR pjIOAddress; /* base I/O address of VGA ports (0x3B0) */
PUCHAR pjCustomizedROMImage;
PUCHAR pj2ndVideoMemoryAddress;
ULONG ul2ndVideoMemorySize;
PUCHAR pj2ndIOAddress;
/*#ifndef WIN2000
XGIIOADDRESS pjIOAddress; // base I/O address of VGA ports (0x3B0)
#endif */
UCHAR jChipType; /* Used to Identify Graphics Chip */
/* defined in the data structure type */
/* "XGI_CHIP_TYPE" */
UCHAR jChipRevision; /* Used to Identify Graphics Chip Revision */
UCHAR ujVBChipID; /* the ID of video bridge */
/* defined in the data structure type */
/* "XGI_VB_CHIP_TYPE" */
BOOLEAN bNewScratch;
ULONG ulCRT2LCDType; /* defined in the data structure type */
ULONG usExternalChip; /* NO VB or other video bridge (other than */
/* video bridge) */
BOOLEAN bIntegratedMMEnabled;/* supporting integration MM enable */
BOOLEAN bSkipDramSizing; /* True: Skip video memory sizing. */
BOOLEAN bSkipSense;
BOOLEAN bIsPowerSaving; /* True: XGIInit() is invoked by power management,
otherwise by 2nd adapter's initialzation */
PXGI_DSReg pSR; /* restore SR registers in initial function. */
/* end data :(idx, val) = (FF, FF). */
/* Note : restore SR registers if */
/* bSkipDramSizing = TRUE */
PXGI_DSReg pCR; /* restore CR registers in initial function. */
/* end data :(idx, val) = (FF, FF) */
/* Note : restore cR registers if */
/* bSkipDramSizing = TRUE */
/*
#endif
*/
PXGI_QUERYSPACE pQueryVGAConfigSpace;
PXGI_QUERYSPACE pQueryNorthBridgeSpace;
UCHAR szVBIOSVer[VBIOS_VER_MAX_LENGTH];
};
#endif
/* Addtional IOCTL for communication xgifb <> X driver */
/* If changing this, xgifb.h must also be changed (for xgifb) */
#ifdef LINUX_XF86 /* We don't want the X driver to depend on the kernel source */
/* ioctl for identifying and giving some info (esp. memory heap start) */
#define XGIFB_GET_INFO 0x80046ef8 /* Wow, what a terrible hack... */
/* Structure argument for XGIFB_GET_INFO ioctl */
typedef struct _XGIFB_INFO xgifb_info, *pxgifb_info;
struct _XGIFB_INFO {
CARD32 xgifb_id; /* for identifying xgifb */
#ifndef XGIFB_ID
#define XGIFB_ID 0x53495346 /* Identify myself with 'XGIF' */
#endif
CARD32 chip_id; /* PCI ID of detected chip */
CARD32 memory; /* video memory in KB which xgifb manages */
CARD32 heapstart; /* heap start (= xgifb "mem" argument) in KB */
CARD8 fbvidmode; /* current xgifb mode */
CARD8 xgifb_version;
CARD8 xgifb_revision;
CARD8 xgifb_patchlevel;
CARD8 xgifb_caps; /* xgifb's capabilities */
CARD32 xgifb_tqlen; /* turbo queue length (in KB) */
CARD32 xgifb_pcibus; /* The card's PCI ID */
CARD32 xgifb_pcislot;
CARD32 xgifb_pcifunc;
CARD8 xgifb_lcdpdc;
CARD8 xgifb_lcda;
CARD32 xgifb_vbflags;
CARD32 xgifb_currentvbflags;
CARD32 xgifb_scalelcd;
CARD32 xgifb_specialtiming;
CARD8 xgifb_haveemi;
CARD8 xgifb_emi30,xgifb_emi31,xgifb_emi32,xgifb_emi33;
CARD8 xgifb_haveemilcd;
CARD8 xgifb_lcdpdca;
CARD8 reserved[212]; /* for future use */
};
#endif
#endif