1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2b889fcf6SDavid Howells /* 3b889fcf6SDavid Howells * sisfb.h - definitions for the SiS framebuffer driver 4b889fcf6SDavid Howells * 5b889fcf6SDavid Howells * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. 6b889fcf6SDavid Howells * 7b889fcf6SDavid Howells * This program is free software; you can redistribute it and/or modify 8b889fcf6SDavid Howells * it under the terms of the GNU General Public License as published by 9b889fcf6SDavid Howells * the Free Software Foundation; either version 2 of the named License, 10b889fcf6SDavid Howells * or any later version. 11b889fcf6SDavid Howells * 12b889fcf6SDavid Howells * This program is distributed in the hope that it will be useful, 13b889fcf6SDavid Howells * but WITHOUT ANY WARRANTY; without even the implied warranty of 14b889fcf6SDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15b889fcf6SDavid Howells * GNU General Public License for more details. 16b889fcf6SDavid Howells * 17b889fcf6SDavid Howells * You should have received a copy of the GNU General Public License 18b889fcf6SDavid Howells * along with this program; if not, write to the Free Software 19b889fcf6SDavid Howells * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA 20b889fcf6SDavid Howells */ 21b889fcf6SDavid Howells 22b889fcf6SDavid Howells #ifndef _UAPI_LINUX_SISFB_H_ 23b889fcf6SDavid Howells #define _UAPI_LINUX_SISFB_H_ 24b889fcf6SDavid Howells 25b889fcf6SDavid Howells #include <linux/types.h> 26b889fcf6SDavid Howells #include <asm/ioctl.h> 27b889fcf6SDavid Howells 28b889fcf6SDavid Howells /**********************************************/ 29b889fcf6SDavid Howells /* PUBLIC */ 30b889fcf6SDavid Howells /**********************************************/ 31b889fcf6SDavid Howells 32b889fcf6SDavid Howells /* vbflags, public (others in sis.h) */ 33b889fcf6SDavid Howells #define CRT2_DEFAULT 0x00000001 34b889fcf6SDavid Howells #define CRT2_LCD 0x00000002 35b889fcf6SDavid Howells #define CRT2_TV 0x00000004 36b889fcf6SDavid Howells #define CRT2_VGA 0x00000008 37b889fcf6SDavid Howells #define TV_NTSC 0x00000010 38b889fcf6SDavid Howells #define TV_PAL 0x00000020 39b889fcf6SDavid Howells #define TV_HIVISION 0x00000040 40b889fcf6SDavid Howells #define TV_YPBPR 0x00000080 41b889fcf6SDavid Howells #define TV_AVIDEO 0x00000100 42b889fcf6SDavid Howells #define TV_SVIDEO 0x00000200 43b889fcf6SDavid Howells #define TV_SCART 0x00000400 44b889fcf6SDavid Howells #define TV_PALM 0x00001000 45b889fcf6SDavid Howells #define TV_PALN 0x00002000 46b889fcf6SDavid Howells #define TV_NTSCJ 0x00001000 47b889fcf6SDavid Howells #define TV_CHSCART 0x00008000 48b889fcf6SDavid Howells #define TV_CHYPBPR525I 0x00010000 49b889fcf6SDavid Howells #define CRT1_VGA 0x00000000 50b889fcf6SDavid Howells #define CRT1_LCDA 0x00020000 51b889fcf6SDavid Howells #define VGA2_CONNECTED 0x00040000 52b889fcf6SDavid Howells #define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */ 53b889fcf6SDavid Howells #define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */ 54b889fcf6SDavid Howells #define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */ 55b889fcf6SDavid Howells #define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */ 56b889fcf6SDavid Howells 57b889fcf6SDavid Howells /* Aliases: */ 58b889fcf6SDavid Howells #define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA) 59b889fcf6SDavid Howells #define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ) 60b889fcf6SDavid Howells #define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I) 61b889fcf6SDavid Howells 62b889fcf6SDavid Howells /* Only if TV_YPBPR is set: */ 63b889fcf6SDavid Howells #define TV_YPBPR525I TV_NTSC 64b889fcf6SDavid Howells #define TV_YPBPR525P TV_PAL 65b889fcf6SDavid Howells #define TV_YPBPR750P TV_PALM 66b889fcf6SDavid Howells #define TV_YPBPR1080I TV_PALN 67b889fcf6SDavid Howells #define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I) 68b889fcf6SDavid Howells 69b889fcf6SDavid Howells #define VB_DISPTYPE_DISP2 CRT2_ENABLE 70b889fcf6SDavid Howells #define VB_DISPTYPE_CRT2 CRT2_ENABLE 71b889fcf6SDavid Howells #define VB_DISPTYPE_DISP1 VB_DISPTYPE_CRT1 72b889fcf6SDavid Howells #define VB_DISPMODE_SINGLE VB_SINGLE_MODE 73b889fcf6SDavid Howells #define VB_DISPMODE_MIRROR VB_MIRROR_MODE 74b889fcf6SDavid Howells #define VB_DISPMODE_DUAL VB_DUALVIEW_MODE 75b889fcf6SDavid Howells #define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) 76b889fcf6SDavid Howells 77b889fcf6SDavid Howells /* Structure argument for SISFB_GET_INFO ioctl */ 78b889fcf6SDavid Howells struct sisfb_info { 79b889fcf6SDavid Howells __u32 sisfb_id; /* for identifying sisfb */ 80b889fcf6SDavid Howells #ifndef SISFB_ID 81b889fcf6SDavid Howells #define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ 82b889fcf6SDavid Howells #endif 83b889fcf6SDavid Howells __u32 chip_id; /* PCI-ID of detected chip */ 84b889fcf6SDavid Howells __u32 memory; /* total video memory in KB */ 85b889fcf6SDavid Howells __u32 heapstart; /* heap start offset in KB */ 86b889fcf6SDavid Howells __u8 fbvidmode; /* current sisfb mode */ 87b889fcf6SDavid Howells 88b889fcf6SDavid Howells __u8 sisfb_version; 89b889fcf6SDavid Howells __u8 sisfb_revision; 90b889fcf6SDavid Howells __u8 sisfb_patchlevel; 91b889fcf6SDavid Howells 92b889fcf6SDavid Howells __u8 sisfb_caps; /* sisfb capabilities */ 93b889fcf6SDavid Howells 94b889fcf6SDavid Howells __u32 sisfb_tqlen; /* turbo queue length (in KB) */ 95b889fcf6SDavid Howells 96b889fcf6SDavid Howells __u32 sisfb_pcibus; /* The card's PCI ID */ 97b889fcf6SDavid Howells __u32 sisfb_pcislot; 98b889fcf6SDavid Howells __u32 sisfb_pcifunc; 99b889fcf6SDavid Howells 100b889fcf6SDavid Howells __u8 sisfb_lcdpdc; /* PanelDelayCompensation */ 101b889fcf6SDavid Howells 102b889fcf6SDavid Howells __u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */ 103b889fcf6SDavid Howells 104b889fcf6SDavid Howells __u32 sisfb_vbflags; 105b889fcf6SDavid Howells __u32 sisfb_currentvbflags; 106b889fcf6SDavid Howells 107b889fcf6SDavid Howells __u32 sisfb_scalelcd; 108b889fcf6SDavid Howells __u32 sisfb_specialtiming; 109b889fcf6SDavid Howells 110b889fcf6SDavid Howells __u8 sisfb_haveemi; 111b889fcf6SDavid Howells __u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; 112b889fcf6SDavid Howells __u8 sisfb_haveemilcd; 113b889fcf6SDavid Howells 114b889fcf6SDavid Howells __u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */ 115b889fcf6SDavid Howells 116b889fcf6SDavid Howells __u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */ 117b889fcf6SDavid Howells 118b889fcf6SDavid Howells __u32 sisfb_heapsize; /* heap size (in KB) */ 119b889fcf6SDavid Howells __u32 sisfb_videooffset; /* Offset of viewport in video memory (in bytes) */ 120b889fcf6SDavid Howells 121b889fcf6SDavid Howells __u32 sisfb_curfstn; /* currently running FSTN/DSTN mode */ 122b889fcf6SDavid Howells __u32 sisfb_curdstn; 123b889fcf6SDavid Howells 124b889fcf6SDavid Howells __u16 sisfb_pci_vendor; /* PCI vendor (SiS or XGI) */ 125b889fcf6SDavid Howells 126b889fcf6SDavid Howells __u32 sisfb_vbflags2; /* ivideo->vbflags2 */ 127b889fcf6SDavid Howells 128b889fcf6SDavid Howells __u8 sisfb_can_post; /* sisfb can POST this card */ 129b889fcf6SDavid Howells __u8 sisfb_card_posted; /* card is POSTED */ 130b889fcf6SDavid Howells __u8 sisfb_was_boot_device; /* This card was the boot video device (ie is primary) */ 131b889fcf6SDavid Howells 132b889fcf6SDavid Howells __u8 reserved[183]; /* for future use */ 133b889fcf6SDavid Howells }; 134b889fcf6SDavid Howells 135b889fcf6SDavid Howells #define SISFB_CMD_GETVBFLAGS 0x55AA0001 /* no arg; result[1] = vbflags */ 136b889fcf6SDavid Howells #define SISFB_CMD_SWITCHCRT1 0x55AA0010 /* arg[0]: 99 = query, 0 = off, 1 = on */ 137b889fcf6SDavid Howells /* more to come */ 138b889fcf6SDavid Howells 139b889fcf6SDavid Howells #define SISFB_CMD_ERR_OK 0x80000000 /* command succeeded */ 140b889fcf6SDavid Howells #define SISFB_CMD_ERR_LOCKED 0x80000001 /* sisfb is locked */ 141b889fcf6SDavid Howells #define SISFB_CMD_ERR_EARLY 0x80000002 /* request before sisfb took over gfx system */ 142b889fcf6SDavid Howells #define SISFB_CMD_ERR_NOVB 0x80000003 /* No video bridge */ 143b889fcf6SDavid Howells #define SISFB_CMD_ERR_NOCRT2 0x80000004 /* can't change CRT1 status, CRT2 disabled */ 144b889fcf6SDavid Howells /* more to come */ 145b889fcf6SDavid Howells #define SISFB_CMD_ERR_UNKNOWN 0x8000ffff /* Unknown command */ 146b889fcf6SDavid Howells #define SISFB_CMD_ERR_OTHER 0x80010000 /* Other error */ 147b889fcf6SDavid Howells 148b889fcf6SDavid Howells /* Argument for SISFB_CMD ioctl */ 149b889fcf6SDavid Howells struct sisfb_cmd { 150b889fcf6SDavid Howells __u32 sisfb_cmd; 151b889fcf6SDavid Howells __u32 sisfb_arg[16]; 152b889fcf6SDavid Howells __u32 sisfb_result[4]; 153b889fcf6SDavid Howells }; 154b889fcf6SDavid Howells 155b889fcf6SDavid Howells /* Additional IOCTLs for communication sisfb <> X driver */ 156b889fcf6SDavid Howells /* If changing this, vgatypes.h must also be changed (for X driver) */ 157b889fcf6SDavid Howells 158b889fcf6SDavid Howells /* ioctl for identifying and giving some info (esp. memory heap start) */ 159b889fcf6SDavid Howells #define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32) 160b889fcf6SDavid Howells #define SISFB_GET_INFO _IOR(0xF3,0x01,struct sisfb_info) 161b889fcf6SDavid Howells 162b889fcf6SDavid Howells /* ioctrl to get current vertical retrace status */ 163b889fcf6SDavid Howells #define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32) 164b889fcf6SDavid Howells 165b889fcf6SDavid Howells /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ 166b889fcf6SDavid Howells #define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32) 167b889fcf6SDavid Howells #define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32) 168b889fcf6SDavid Howells 169b889fcf6SDavid Howells /* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/ 170b889fcf6SDavid Howells #define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32) 171b889fcf6SDavid Howells #define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32) 172b889fcf6SDavid Howells 173b889fcf6SDavid Howells /* ioctl for internal sisfb commands (sisfbctrl) */ 174b889fcf6SDavid Howells #define SISFB_COMMAND _IOWR(0xF3,0x05,struct sisfb_cmd) 175b889fcf6SDavid Howells 176b889fcf6SDavid Howells /* ioctl for locking sisfb (no register access during lock) */ 177b889fcf6SDavid Howells /* As of now, only used to avoid register access during 178b889fcf6SDavid Howells * the ioctls listed above. 179b889fcf6SDavid Howells */ 180b889fcf6SDavid Howells #define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32) 181b889fcf6SDavid Howells 182b889fcf6SDavid Howells /* ioctls 0xF3 up to 0x3F reserved for sisfb */ 183b889fcf6SDavid Howells 184b889fcf6SDavid Howells /****************************************************************/ 185b889fcf6SDavid Howells /* The following are deprecated and should not be used anymore: */ 186b889fcf6SDavid Howells /****************************************************************/ 187b889fcf6SDavid Howells /* ioctl for identifying and giving some info (esp. memory heap start) */ 188b889fcf6SDavid Howells #define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32) 189b889fcf6SDavid Howells /* ioctrl to get current vertical retrace status */ 190b889fcf6SDavid Howells #define SISFB_GET_VBRSTATUS_OLD _IOR('n',0xF9,__u32) 191b889fcf6SDavid Howells /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ 192b889fcf6SDavid Howells #define SISFB_GET_AUTOMAXIMIZE_OLD _IOR('n',0xFA,__u32) 193b889fcf6SDavid Howells #define SISFB_SET_AUTOMAXIMIZE_OLD _IOW('n',0xFA,__u32) 194b889fcf6SDavid Howells /****************************************************************/ 195b889fcf6SDavid Howells /* End of deprecated ioctl numbers */ 196b889fcf6SDavid Howells /****************************************************************/ 197b889fcf6SDavid Howells 198b889fcf6SDavid Howells /* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */ 199b889fcf6SDavid Howells struct sis_memreq { 200b889fcf6SDavid Howells __u32 offset; 201b889fcf6SDavid Howells __u32 size; 202b889fcf6SDavid Howells }; 203b889fcf6SDavid Howells 204b889fcf6SDavid Howells /**********************************************/ 205b889fcf6SDavid Howells /* PRIVATE */ 206b889fcf6SDavid Howells /* (for IN-KERNEL usage only) */ 207b889fcf6SDavid Howells /**********************************************/ 208b889fcf6SDavid Howells 209b889fcf6SDavid Howells 210b889fcf6SDavid Howells #endif /* _UAPI_LINUX_SISFB_H_ */ 211