/*1* sisfb.h - definitions for the SiS framebuffer driver2*3* Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria.4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the named License,8* or any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA18*/1920#ifndef _LINUX_SISFB_H_21#define _LINUX_SISFB_H_2223#include <linux/types.h>24#include <asm/ioctl.h>2526/**********************************************/27/* PUBLIC */28/**********************************************/2930/* vbflags, public (others in sis.h) */31#define CRT2_DEFAULT 0x0000000132#define CRT2_LCD 0x0000000233#define CRT2_TV 0x0000000434#define CRT2_VGA 0x0000000835#define TV_NTSC 0x0000001036#define TV_PAL 0x0000002037#define TV_HIVISION 0x0000004038#define TV_YPBPR 0x0000008039#define TV_AVIDEO 0x0000010040#define TV_SVIDEO 0x0000020041#define TV_SCART 0x0000040042#define TV_PALM 0x0000100043#define TV_PALN 0x0000200044#define TV_NTSCJ 0x0000100045#define TV_CHSCART 0x0000800046#define TV_CHYPBPR525I 0x0001000047#define CRT1_VGA 0x0000000048#define CRT1_LCDA 0x0002000049#define VGA2_CONNECTED 0x0004000050#define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */51#define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */52#define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */53#define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */5455/* Aliases: */56#define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA)57#define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ)58#define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I)5960/* Only if TV_YPBPR is set: */61#define TV_YPBPR525I TV_NTSC62#define TV_YPBPR525P TV_PAL63#define TV_YPBPR750P TV_PALM64#define TV_YPBPR1080I TV_PALN65#define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I)6667#define VB_DISPTYPE_DISP2 CRT2_ENABLE68#define VB_DISPTYPE_CRT2 CRT2_ENABLE69#define VB_DISPTYPE_DISP1 VB_DISPTYPE_CRT170#define VB_DISPMODE_SINGLE VB_SINGLE_MODE71#define VB_DISPMODE_MIRROR VB_MIRROR_MODE72#define VB_DISPMODE_DUAL VB_DUALVIEW_MODE73#define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE)7475/* Structure argument for SISFB_GET_INFO ioctl */76struct sisfb_info {77__u32 sisfb_id; /* for identifying sisfb */78#ifndef SISFB_ID79#define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */80#endif81__u32 chip_id; /* PCI-ID of detected chip */82__u32 memory; /* total video memory in KB */83__u32 heapstart; /* heap start offset in KB */84__u8 fbvidmode; /* current sisfb mode */8586__u8 sisfb_version;87__u8 sisfb_revision;88__u8 sisfb_patchlevel;8990__u8 sisfb_caps; /* sisfb capabilities */9192__u32 sisfb_tqlen; /* turbo queue length (in KB) */9394__u32 sisfb_pcibus; /* The card's PCI ID */95__u32 sisfb_pcislot;96__u32 sisfb_pcifunc;9798__u8 sisfb_lcdpdc; /* PanelDelayCompensation */99100__u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */101102__u32 sisfb_vbflags;103__u32 sisfb_currentvbflags;104105__u32 sisfb_scalelcd;106__u32 sisfb_specialtiming;107108__u8 sisfb_haveemi;109__u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33;110__u8 sisfb_haveemilcd;111112__u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */113114__u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */115116__u32 sisfb_heapsize; /* heap size (in KB) */117__u32 sisfb_videooffset; /* Offset of viewport in video memory (in bytes) */118119__u32 sisfb_curfstn; /* currently running FSTN/DSTN mode */120__u32 sisfb_curdstn;121122__u16 sisfb_pci_vendor; /* PCI vendor (SiS or XGI) */123124__u32 sisfb_vbflags2; /* ivideo->vbflags2 */125126__u8 sisfb_can_post; /* sisfb can POST this card */127__u8 sisfb_card_posted; /* card is POSTED */128__u8 sisfb_was_boot_device; /* This card was the boot video device (ie is primary) */129130__u8 reserved[183]; /* for future use */131};132133#define SISFB_CMD_GETVBFLAGS 0x55AA0001 /* no arg; result[1] = vbflags */134#define SISFB_CMD_SWITCHCRT1 0x55AA0010 /* arg[0]: 99 = query, 0 = off, 1 = on */135/* more to come */136137#define SISFB_CMD_ERR_OK 0x80000000 /* command succeeded */138#define SISFB_CMD_ERR_LOCKED 0x80000001 /* sisfb is locked */139#define SISFB_CMD_ERR_EARLY 0x80000002 /* request before sisfb took over gfx system */140#define SISFB_CMD_ERR_NOVB 0x80000003 /* No video bridge */141#define SISFB_CMD_ERR_NOCRT2 0x80000004 /* can't change CRT1 status, CRT2 disabled */142/* more to come */143#define SISFB_CMD_ERR_UNKNOWN 0x8000ffff /* Unknown command */144#define SISFB_CMD_ERR_OTHER 0x80010000 /* Other error */145146/* Argument for SISFB_CMD ioctl */147struct sisfb_cmd {148__u32 sisfb_cmd;149__u32 sisfb_arg[16];150__u32 sisfb_result[4];151};152153/* Additional IOCTLs for communication sisfb <> X driver */154/* If changing this, vgatypes.h must also be changed (for X driver) */155156/* ioctl for identifying and giving some info (esp. memory heap start) */157#define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32)158#define SISFB_GET_INFO _IOR(0xF3,0x01,struct sisfb_info)159160/* ioctrl to get current vertical retrace status */161#define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32)162163/* ioctl to enable/disable panning auto-maximize (like nomax parameter) */164#define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32)165#define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32)166167/* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/168#define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32)169#define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32)170171/* ioctl for internal sisfb commands (sisfbctrl) */172#define SISFB_COMMAND _IOWR(0xF3,0x05,struct sisfb_cmd)173174/* ioctl for locking sisfb (no register access during lock) */175/* As of now, only used to avoid register access during176* the ioctls listed above.177*/178#define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32)179180/* ioctls 0xF3 up to 0x3F reserved for sisfb */181182/****************************************************************/183/* The following are deprecated and should not be used anymore: */184/****************************************************************/185/* ioctl for identifying and giving some info (esp. memory heap start) */186#define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32)187/* ioctrl to get current vertical retrace status */188#define SISFB_GET_VBRSTATUS_OLD _IOR('n',0xF9,__u32)189/* ioctl to enable/disable panning auto-maximize (like nomax parameter) */190#define SISFB_GET_AUTOMAXIMIZE_OLD _IOR('n',0xFA,__u32)191#define SISFB_SET_AUTOMAXIMIZE_OLD _IOW('n',0xFA,__u32)192/****************************************************************/193/* End of deprecated ioctl numbers */194/****************************************************************/195196/* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */197struct sis_memreq {198__u32 offset;199__u32 size;200};201202/**********************************************/203/* PRIVATE */204/* (for IN-KERNEL usage only) */205/**********************************************/206207#ifdef __KERNEL__208209#include <linux/pci.h>210211#define UNKNOWN_VGA 0212#define SIS_300_VGA 1213#define SIS_315_VGA 2214215#define SISFB_HAVE_MALLOC_NEW216extern void sis_malloc(struct sis_memreq *req);217extern void sis_malloc_new(struct pci_dev *pdev, struct sis_memreq *req);218219extern void sis_free(u32 base);220extern void sis_free_new(struct pci_dev *pdev, u32 base);221#endif222223#endif224225226