162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * SiS 300/540/630[S]/730[S], 462306a36Sopenharmony_ci * SiS 315[E|PRO]/550/[M]65x/[M]661[F|M]X/740/[M]741[GX]/330/[M]76x[GX], 562306a36Sopenharmony_ci * XGI V3XT/V5/V8, Z7 662306a36Sopenharmony_ci * frame buffer driver for Linux kernels >=2.4.14 and >=2.6.3 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Copyright (C) 2001-2005 Thomas Winischhofer, Vienna, Austria. 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#ifndef _SIS_H_ 1262306a36Sopenharmony_ci#define _SIS_H_ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include <video/sisfb.h> 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#include "vgatypes.h" 1762306a36Sopenharmony_ci#include "vstruct.h" 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#define VER_MAJOR 1 2062306a36Sopenharmony_ci#define VER_MINOR 8 2162306a36Sopenharmony_ci#define VER_LEVEL 9 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#include <linux/spinlock.h> 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#ifdef CONFIG_COMPAT 2662306a36Sopenharmony_ci#define SIS_NEW_CONFIG_COMPAT 2762306a36Sopenharmony_ci#endif /* CONFIG_COMPAT */ 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci#undef SISFBDEBUG 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci#ifdef SISFBDEBUG 3262306a36Sopenharmony_ci#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) 3362306a36Sopenharmony_ci#define TWDEBUG(x) printk(KERN_INFO x "\n"); 3462306a36Sopenharmony_ci#else 3562306a36Sopenharmony_ci#define DPRINTK(fmt, args...) 3662306a36Sopenharmony_ci#define TWDEBUG(x) 3762306a36Sopenharmony_ci#endif 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define SISFAIL(x) do { printk(x "\n"); return -EINVAL; } while(0) 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci/* To be included in pci_ids.h */ 4262306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_SI_650_VGA 4362306a36Sopenharmony_ci#define PCI_DEVICE_ID_SI_650_VGA 0x6325 4462306a36Sopenharmony_ci#endif 4562306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_SI_650 4662306a36Sopenharmony_ci#define PCI_DEVICE_ID_SI_650 0x0650 4762306a36Sopenharmony_ci#endif 4862306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_SI_651 4962306a36Sopenharmony_ci#define PCI_DEVICE_ID_SI_651 0x0651 5062306a36Sopenharmony_ci#endif 5162306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_SI_740 5262306a36Sopenharmony_ci#define PCI_DEVICE_ID_SI_740 0x0740 5362306a36Sopenharmony_ci#endif 5462306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_SI_330 5562306a36Sopenharmony_ci#define PCI_DEVICE_ID_SI_330 0x0330 5662306a36Sopenharmony_ci#endif 5762306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_SI_660_VGA 5862306a36Sopenharmony_ci#define PCI_DEVICE_ID_SI_660_VGA 0x6330 5962306a36Sopenharmony_ci#endif 6062306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_SI_661 6162306a36Sopenharmony_ci#define PCI_DEVICE_ID_SI_661 0x0661 6262306a36Sopenharmony_ci#endif 6362306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_SI_741 6462306a36Sopenharmony_ci#define PCI_DEVICE_ID_SI_741 0x0741 6562306a36Sopenharmony_ci#endif 6662306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_SI_660 6762306a36Sopenharmony_ci#define PCI_DEVICE_ID_SI_660 0x0660 6862306a36Sopenharmony_ci#endif 6962306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_SI_760 7062306a36Sopenharmony_ci#define PCI_DEVICE_ID_SI_760 0x0760 7162306a36Sopenharmony_ci#endif 7262306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_SI_761 7362306a36Sopenharmony_ci#define PCI_DEVICE_ID_SI_761 0x0761 7462306a36Sopenharmony_ci#endif 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci#ifndef PCI_VENDOR_ID_XGI 7762306a36Sopenharmony_ci#define PCI_VENDOR_ID_XGI 0x18ca 7862306a36Sopenharmony_ci#endif 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_XGI_20 8162306a36Sopenharmony_ci#define PCI_DEVICE_ID_XGI_20 0x0020 8262306a36Sopenharmony_ci#endif 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_XGI_40 8562306a36Sopenharmony_ci#define PCI_DEVICE_ID_XGI_40 0x0040 8662306a36Sopenharmony_ci#endif 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci/* To be included in fb.h */ 8962306a36Sopenharmony_ci#ifndef FB_ACCEL_SIS_GLAMOUR_2 9062306a36Sopenharmony_ci#define FB_ACCEL_SIS_GLAMOUR_2 40 /* SiS 315, 65x, 740, 661, 741 */ 9162306a36Sopenharmony_ci#endif 9262306a36Sopenharmony_ci#ifndef FB_ACCEL_SIS_XABRE 9362306a36Sopenharmony_ci#define FB_ACCEL_SIS_XABRE 41 /* SiS 330 ("Xabre"), 76x */ 9462306a36Sopenharmony_ci#endif 9562306a36Sopenharmony_ci#ifndef FB_ACCEL_XGI_VOLARI_V 9662306a36Sopenharmony_ci#define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari Vx (V3XT, V5, V8) */ 9762306a36Sopenharmony_ci#endif 9862306a36Sopenharmony_ci#ifndef FB_ACCEL_XGI_VOLARI_Z 9962306a36Sopenharmony_ci#define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ 10062306a36Sopenharmony_ci#endif 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci/* ivideo->caps */ 10362306a36Sopenharmony_ci#define HW_CURSOR_CAP 0x80 10462306a36Sopenharmony_ci#define TURBO_QUEUE_CAP 0x40 10562306a36Sopenharmony_ci#define AGP_CMD_QUEUE_CAP 0x20 10662306a36Sopenharmony_ci#define VM_CMD_QUEUE_CAP 0x10 10762306a36Sopenharmony_ci#define MMIO_CMD_QUEUE_CAP 0x08 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci/* For 300 series */ 11062306a36Sopenharmony_ci#define TURBO_QUEUE_AREA_SIZE (512 * 1024) /* 512K */ 11162306a36Sopenharmony_ci#define HW_CURSOR_AREA_SIZE_300 4096 /* 4K */ 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci/* For 315/Xabre series */ 11462306a36Sopenharmony_ci#define COMMAND_QUEUE_AREA_SIZE (512 * 1024) /* 512K */ 11562306a36Sopenharmony_ci#define COMMAND_QUEUE_AREA_SIZE_Z7 (128 * 1024) /* 128k for XGI Z7 */ 11662306a36Sopenharmony_ci#define HW_CURSOR_AREA_SIZE_315 16384 /* 16K */ 11762306a36Sopenharmony_ci#define COMMAND_QUEUE_THRESHOLD 0x1F 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci#define SIS_OH_ALLOC_SIZE 4000 12062306a36Sopenharmony_ci#define SENTINEL 0x7fffffff 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci#define SEQ_ADR 0x14 12362306a36Sopenharmony_ci#define SEQ_DATA 0x15 12462306a36Sopenharmony_ci#define DAC_ADR 0x18 12562306a36Sopenharmony_ci#define DAC_DATA 0x19 12662306a36Sopenharmony_ci#define CRTC_ADR 0x24 12762306a36Sopenharmony_ci#define CRTC_DATA 0x25 12862306a36Sopenharmony_ci#define DAC2_ADR (0x16-0x30) 12962306a36Sopenharmony_ci#define DAC2_DATA (0x17-0x30) 13062306a36Sopenharmony_ci#define VB_PART1_ADR (0x04-0x30) 13162306a36Sopenharmony_ci#define VB_PART1_DATA (0x05-0x30) 13262306a36Sopenharmony_ci#define VB_PART2_ADR (0x10-0x30) 13362306a36Sopenharmony_ci#define VB_PART2_DATA (0x11-0x30) 13462306a36Sopenharmony_ci#define VB_PART3_ADR (0x12-0x30) 13562306a36Sopenharmony_ci#define VB_PART3_DATA (0x13-0x30) 13662306a36Sopenharmony_ci#define VB_PART4_ADR (0x14-0x30) 13762306a36Sopenharmony_ci#define VB_PART4_DATA (0x15-0x30) 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci#define SISSR ivideo->SiS_Pr.SiS_P3c4 14062306a36Sopenharmony_ci#define SISCR ivideo->SiS_Pr.SiS_P3d4 14162306a36Sopenharmony_ci#define SISDACA ivideo->SiS_Pr.SiS_P3c8 14262306a36Sopenharmony_ci#define SISDACD ivideo->SiS_Pr.SiS_P3c9 14362306a36Sopenharmony_ci#define SISPART1 ivideo->SiS_Pr.SiS_Part1Port 14462306a36Sopenharmony_ci#define SISPART2 ivideo->SiS_Pr.SiS_Part2Port 14562306a36Sopenharmony_ci#define SISPART3 ivideo->SiS_Pr.SiS_Part3Port 14662306a36Sopenharmony_ci#define SISPART4 ivideo->SiS_Pr.SiS_Part4Port 14762306a36Sopenharmony_ci#define SISPART5 ivideo->SiS_Pr.SiS_Part5Port 14862306a36Sopenharmony_ci#define SISDAC2A SISPART5 14962306a36Sopenharmony_ci#define SISDAC2D (SISPART5 + 1) 15062306a36Sopenharmony_ci#define SISMISCR (ivideo->SiS_Pr.RelIO + 0x1c) 15162306a36Sopenharmony_ci#define SISMISCW ivideo->SiS_Pr.SiS_P3c2 15262306a36Sopenharmony_ci#define SISINPSTAT (ivideo->SiS_Pr.RelIO + 0x2a) 15362306a36Sopenharmony_ci#define SISPEL ivideo->SiS_Pr.SiS_P3c6 15462306a36Sopenharmony_ci#define SISVGAENABLE (ivideo->SiS_Pr.RelIO + 0x13) 15562306a36Sopenharmony_ci#define SISVID (ivideo->SiS_Pr.RelIO + 0x02 - 0x30) 15662306a36Sopenharmony_ci#define SISCAP (ivideo->SiS_Pr.RelIO + 0x00 - 0x30) 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci#define IND_SIS_PASSWORD 0x05 /* SRs */ 15962306a36Sopenharmony_ci#define IND_SIS_COLOR_MODE 0x06 16062306a36Sopenharmony_ci#define IND_SIS_RAMDAC_CONTROL 0x07 16162306a36Sopenharmony_ci#define IND_SIS_DRAM_SIZE 0x14 16262306a36Sopenharmony_ci#define IND_SIS_MODULE_ENABLE 0x1E 16362306a36Sopenharmony_ci#define IND_SIS_PCI_ADDRESS_SET 0x20 16462306a36Sopenharmony_ci#define IND_SIS_TURBOQUEUE_ADR 0x26 16562306a36Sopenharmony_ci#define IND_SIS_TURBOQUEUE_SET 0x27 16662306a36Sopenharmony_ci#define IND_SIS_POWER_ON_TRAP 0x38 16762306a36Sopenharmony_ci#define IND_SIS_POWER_ON_TRAP2 0x39 16862306a36Sopenharmony_ci#define IND_SIS_CMDQUEUE_SET 0x26 16962306a36Sopenharmony_ci#define IND_SIS_CMDQUEUE_THRESHOLD 0x27 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci#define IND_SIS_AGP_IO_PAD 0x48 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci#define SIS_CRT2_WENABLE_300 0x24 /* Part1 */ 17462306a36Sopenharmony_ci#define SIS_CRT2_WENABLE_315 0x2F 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci#define SIS_PASSWORD 0x86 /* SR05 */ 17762306a36Sopenharmony_ci 17862306a36Sopenharmony_ci#define SIS_INTERLACED_MODE 0x20 /* SR06 */ 17962306a36Sopenharmony_ci#define SIS_8BPP_COLOR_MODE 0x0 18062306a36Sopenharmony_ci#define SIS_15BPP_COLOR_MODE 0x1 18162306a36Sopenharmony_ci#define SIS_16BPP_COLOR_MODE 0x2 18262306a36Sopenharmony_ci#define SIS_32BPP_COLOR_MODE 0x4 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci#define SIS_ENABLE_2D 0x40 /* SR1E */ 18562306a36Sopenharmony_ci 18662306a36Sopenharmony_ci#define SIS_MEM_MAP_IO_ENABLE 0x01 /* SR20 */ 18762306a36Sopenharmony_ci#define SIS_PCI_ADDR_ENABLE 0x80 18862306a36Sopenharmony_ci 18962306a36Sopenharmony_ci#define SIS_AGP_CMDQUEUE_ENABLE 0x80 /* 315/330/340 series SR26 */ 19062306a36Sopenharmony_ci#define SIS_VRAM_CMDQUEUE_ENABLE 0x40 19162306a36Sopenharmony_ci#define SIS_MMIO_CMD_ENABLE 0x20 19262306a36Sopenharmony_ci#define SIS_CMD_QUEUE_SIZE_512k 0x00 19362306a36Sopenharmony_ci#define SIS_CMD_QUEUE_SIZE_1M 0x04 19462306a36Sopenharmony_ci#define SIS_CMD_QUEUE_SIZE_2M 0x08 19562306a36Sopenharmony_ci#define SIS_CMD_QUEUE_SIZE_4M 0x0C 19662306a36Sopenharmony_ci#define SIS_CMD_QUEUE_RESET 0x01 19762306a36Sopenharmony_ci#define SIS_CMD_AUTO_CORR 0x02 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_ci#define SIS_CMD_QUEUE_SIZE_Z7_64k 0x00 /* XGI Z7 */ 20062306a36Sopenharmony_ci#define SIS_CMD_QUEUE_SIZE_Z7_128k 0x04 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ci#define SIS_SIMULTANEOUS_VIEW_ENABLE 0x01 /* CR30 */ 20362306a36Sopenharmony_ci#define SIS_MODE_SELECT_CRT2 0x02 20462306a36Sopenharmony_ci#define SIS_VB_OUTPUT_COMPOSITE 0x04 20562306a36Sopenharmony_ci#define SIS_VB_OUTPUT_SVIDEO 0x08 20662306a36Sopenharmony_ci#define SIS_VB_OUTPUT_SCART 0x10 20762306a36Sopenharmony_ci#define SIS_VB_OUTPUT_LCD 0x20 20862306a36Sopenharmony_ci#define SIS_VB_OUTPUT_CRT2 0x40 20962306a36Sopenharmony_ci#define SIS_VB_OUTPUT_HIVISION 0x80 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci#define SIS_VB_OUTPUT_DISABLE 0x20 /* CR31 */ 21262306a36Sopenharmony_ci#define SIS_DRIVER_MODE 0x40 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ci#define SIS_VB_COMPOSITE 0x01 /* CR32 */ 21562306a36Sopenharmony_ci#define SIS_VB_SVIDEO 0x02 21662306a36Sopenharmony_ci#define SIS_VB_SCART 0x04 21762306a36Sopenharmony_ci#define SIS_VB_LCD 0x08 21862306a36Sopenharmony_ci#define SIS_VB_CRT2 0x10 21962306a36Sopenharmony_ci#define SIS_CRT1 0x20 22062306a36Sopenharmony_ci#define SIS_VB_HIVISION 0x40 22162306a36Sopenharmony_ci#define SIS_VB_YPBPR 0x80 22262306a36Sopenharmony_ci#define SIS_VB_TV (SIS_VB_COMPOSITE | SIS_VB_SVIDEO | \ 22362306a36Sopenharmony_ci SIS_VB_SCART | SIS_VB_HIVISION | SIS_VB_YPBPR) 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ci#define SIS_EXTERNAL_CHIP_MASK 0x0E /* CR37 (< SiS 660) */ 22662306a36Sopenharmony_ci#define SIS_EXTERNAL_CHIP_SIS301 0x01 /* in CR37 << 1 ! */ 22762306a36Sopenharmony_ci#define SIS_EXTERNAL_CHIP_LVDS 0x02 22862306a36Sopenharmony_ci#define SIS_EXTERNAL_CHIP_TRUMPION 0x03 22962306a36Sopenharmony_ci#define SIS_EXTERNAL_CHIP_LVDS_CHRONTEL 0x04 23062306a36Sopenharmony_ci#define SIS_EXTERNAL_CHIP_CHRONTEL 0x05 23162306a36Sopenharmony_ci#define SIS310_EXTERNAL_CHIP_LVDS 0x02 23262306a36Sopenharmony_ci#define SIS310_EXTERNAL_CHIP_LVDS_CHRONTEL 0x03 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ci#define SIS_AGP_2X 0x20 /* CR48 */ 23562306a36Sopenharmony_ci 23662306a36Sopenharmony_ci/* vbflags, private entries (others in sisfb.h) */ 23762306a36Sopenharmony_ci#define VB_CONEXANT 0x00000800 /* 661 series only */ 23862306a36Sopenharmony_ci#define VB_TRUMPION VB_CONEXANT /* 300 series only */ 23962306a36Sopenharmony_ci#define VB_302ELV 0x00004000 24062306a36Sopenharmony_ci#define VB_301 0x00100000 /* Video bridge type */ 24162306a36Sopenharmony_ci#define VB_301B 0x00200000 24262306a36Sopenharmony_ci#define VB_302B 0x00400000 24362306a36Sopenharmony_ci#define VB_30xBDH 0x00800000 /* 30xB DH version (w/o LCD support) */ 24462306a36Sopenharmony_ci#define VB_LVDS 0x01000000 24562306a36Sopenharmony_ci#define VB_CHRONTEL 0x02000000 24662306a36Sopenharmony_ci#define VB_301LV 0x04000000 24762306a36Sopenharmony_ci#define VB_302LV 0x08000000 24862306a36Sopenharmony_ci#define VB_301C 0x10000000 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_ci#define VB_SISBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV) 25162306a36Sopenharmony_ci#define VB_VIDEOBRIDGE (VB_SISBRIDGE | VB_LVDS | VB_CHRONTEL | VB_CONEXANT) 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_ci/* vbflags2 (static stuff only!) */ 25462306a36Sopenharmony_ci#define VB2_SISUMC 0x00000001 25562306a36Sopenharmony_ci#define VB2_301 0x00000002 /* Video bridge type */ 25662306a36Sopenharmony_ci#define VB2_301B 0x00000004 25762306a36Sopenharmony_ci#define VB2_301C 0x00000008 25862306a36Sopenharmony_ci#define VB2_307T 0x00000010 25962306a36Sopenharmony_ci#define VB2_302B 0x00000800 26062306a36Sopenharmony_ci#define VB2_301LV 0x00001000 26162306a36Sopenharmony_ci#define VB2_302LV 0x00002000 26262306a36Sopenharmony_ci#define VB2_302ELV 0x00004000 26362306a36Sopenharmony_ci#define VB2_307LV 0x00008000 26462306a36Sopenharmony_ci#define VB2_30xBDH 0x08000000 /* 30xB DH version (w/o LCD support) */ 26562306a36Sopenharmony_ci#define VB2_CONEXANT 0x10000000 26662306a36Sopenharmony_ci#define VB2_TRUMPION 0x20000000 26762306a36Sopenharmony_ci#define VB2_LVDS 0x40000000 26862306a36Sopenharmony_ci#define VB2_CHRONTEL 0x80000000 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ci#define VB2_SISLVDSBRIDGE (VB2_301LV | VB2_302LV | VB2_302ELV | VB2_307LV) 27162306a36Sopenharmony_ci#define VB2_SISTMDSBRIDGE (VB2_301 | VB2_301B | VB2_301C | VB2_302B | VB2_307T) 27262306a36Sopenharmony_ci#define VB2_SISBRIDGE (VB2_SISLVDSBRIDGE | VB2_SISTMDSBRIDGE) 27362306a36Sopenharmony_ci 27462306a36Sopenharmony_ci#define VB2_SISTMDSLCDABRIDGE (VB2_301C | VB2_307T) 27562306a36Sopenharmony_ci#define VB2_SISLCDABRIDGE (VB2_SISTMDSLCDABRIDGE | VB2_301LV | VB2_302LV | VB2_302ELV | VB2_307LV) 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci#define VB2_SISHIVISIONBRIDGE (VB2_301 | VB2_301B | VB2_302B) 27862306a36Sopenharmony_ci#define VB2_SISYPBPRBRIDGE (VB2_301C | VB2_307T | VB2_SISLVDSBRIDGE) 27962306a36Sopenharmony_ci#define VB2_SISYPBPRARBRIDGE (VB2_301C | VB2_307T | VB2_307LV) 28062306a36Sopenharmony_ci#define VB2_SISTAP4SCALER (VB2_301C | VB2_307T | VB2_302ELV | VB2_307LV) 28162306a36Sopenharmony_ci#define VB2_SISTVBRIDGE (VB2_SISHIVISIONBRIDGE | VB2_SISYPBPRBRIDGE) 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_ci#define VB2_SISVGA2BRIDGE (VB2_301 | VB2_301B | VB2_301C | VB2_302B | VB2_307T) 28462306a36Sopenharmony_ci 28562306a36Sopenharmony_ci#define VB2_VIDEOBRIDGE (VB2_SISBRIDGE | VB2_LVDS | VB2_CHRONTEL | VB2_CONEXANT) 28662306a36Sopenharmony_ci 28762306a36Sopenharmony_ci#define VB2_30xB (VB2_301B | VB2_301C | VB2_302B | VB2_307T) 28862306a36Sopenharmony_ci#define VB2_30xBLV (VB2_30xB | VB2_SISLVDSBRIDGE) 28962306a36Sopenharmony_ci#define VB2_30xC (VB2_301C | VB2_307T) 29062306a36Sopenharmony_ci#define VB2_30xCLV (VB2_301C | VB2_307T | VB2_302ELV| VB2_307LV) 29162306a36Sopenharmony_ci#define VB2_SISEMIBRIDGE (VB2_302LV | VB2_302ELV | VB2_307LV) 29262306a36Sopenharmony_ci#define VB2_LCD162MHZBRIDGE (VB2_301C | VB2_307T) 29362306a36Sopenharmony_ci#define VB2_LCDOVER1280BRIDGE (VB2_301C | VB2_307T | VB2_302LV | VB2_302ELV | VB2_307LV) 29462306a36Sopenharmony_ci#define VB2_LCDOVER1600BRIDGE (VB2_307T | VB2_307LV) 29562306a36Sopenharmony_ci#define VB2_RAMDAC202MHZBRIDGE (VB2_301C | VB2_307T) 29662306a36Sopenharmony_ci 29762306a36Sopenharmony_ci/* I/O port access functions */ 29862306a36Sopenharmony_ci 29962306a36Sopenharmony_civoid SiS_SetReg(SISIOADDRESS, u8, u8); 30062306a36Sopenharmony_civoid SiS_SetRegByte(SISIOADDRESS, u8); 30162306a36Sopenharmony_civoid SiS_SetRegShort(SISIOADDRESS, u16); 30262306a36Sopenharmony_civoid SiS_SetRegLong(SISIOADDRESS, u32); 30362306a36Sopenharmony_civoid SiS_SetRegANDOR(SISIOADDRESS, u8, u8, u8); 30462306a36Sopenharmony_civoid SiS_SetRegAND(SISIOADDRESS, u8, u8); 30562306a36Sopenharmony_civoid SiS_SetRegOR(SISIOADDRESS, u8, u8); 30662306a36Sopenharmony_ciu8 SiS_GetReg(SISIOADDRESS, u8); 30762306a36Sopenharmony_ciu8 SiS_GetRegByte(SISIOADDRESS); 30862306a36Sopenharmony_ciu16 SiS_GetRegShort(SISIOADDRESS); 30962306a36Sopenharmony_ciu32 SiS_GetRegLong(SISIOADDRESS); 31062306a36Sopenharmony_ci 31162306a36Sopenharmony_ci/* Chrontel TV, DDC and DPMS functions */ 31262306a36Sopenharmony_ci/* from init.c */ 31362306a36Sopenharmony_cibool SiSInitPtr(struct SiS_Private *SiS_Pr); 31462306a36Sopenharmony_ciunsigned short SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay, 31562306a36Sopenharmony_ci int VDisplay, int Depth, bool FSTN, 31662306a36Sopenharmony_ci unsigned short CustomT, int LCDwith, int LCDheight, 31762306a36Sopenharmony_ci unsigned int VBFlags2); 31862306a36Sopenharmony_ciunsigned short SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay, 31962306a36Sopenharmony_ci int VDisplay, int Depth, unsigned int VBFlags2); 32062306a36Sopenharmony_ciunsigned short SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay, 32162306a36Sopenharmony_ci int VDisplay, int Depth, unsigned int VBFlags2); 32262306a36Sopenharmony_ci 32362306a36Sopenharmony_civoid SiS_DisplayOn(struct SiS_Private *SiS_Pr); 32462306a36Sopenharmony_civoid SiS_DisplayOff(struct SiS_Private *SiS_Pr); 32562306a36Sopenharmony_civoid SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr); 32662306a36Sopenharmony_civoid SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable); 32762306a36Sopenharmony_civoid SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable); 32862306a36Sopenharmony_ciunsigned short SiS_GetModeFlag(struct SiS_Private *SiS_Pr, unsigned short ModeNo, 32962306a36Sopenharmony_ci unsigned short ModeIdIndex); 33062306a36Sopenharmony_cibool SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr); 33162306a36Sopenharmony_ci 33262306a36Sopenharmony_cibool SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *ModeNo, 33362306a36Sopenharmony_ci unsigned short *ModeIdIndex); 33462306a36Sopenharmony_ciunsigned short SiS_GetModePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, 33562306a36Sopenharmony_ci unsigned short ModeIdIndex); 33662306a36Sopenharmony_ciunsigned short SiS_GetRefCRTVCLK(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide); 33762306a36Sopenharmony_ciunsigned short SiS_GetRefCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide); 33862306a36Sopenharmony_ciunsigned short SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short ModeNo, 33962306a36Sopenharmony_ci unsigned short ModeIdIndex); 34062306a36Sopenharmony_ciunsigned short SiS_GetOffset(struct SiS_Private *SiS_Pr,unsigned short ModeNo, 34162306a36Sopenharmony_ci unsigned short ModeIdIndex, unsigned short RRTI); 34262306a36Sopenharmony_ci#ifdef CONFIG_FB_SIS_300 34362306a36Sopenharmony_civoid SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *idx1, 34462306a36Sopenharmony_ci unsigned short *idx2); 34562306a36Sopenharmony_ciunsigned short SiS_GetFIFOThresholdB300(unsigned short idx1, unsigned short idx2); 34662306a36Sopenharmony_ciunsigned short SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index); 34762306a36Sopenharmony_ci#endif 34862306a36Sopenharmony_civoid SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex); 34962306a36Sopenharmony_cibool SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); 35062306a36Sopenharmony_civoid SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth); 35162306a36Sopenharmony_civoid SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo, 35262306a36Sopenharmony_ci unsigned short ModeIdIndex); 35362306a36Sopenharmony_civoid SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, int xres, 35462306a36Sopenharmony_ci int yres, struct fb_var_screeninfo *var, bool writeres); 35562306a36Sopenharmony_ci 35662306a36Sopenharmony_ci/* From init301.c: */ 35762306a36Sopenharmony_ciextern void SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, 35862306a36Sopenharmony_ci unsigned short ModeIdIndex, int chkcrt2mode); 35962306a36Sopenharmony_ciextern void SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, 36062306a36Sopenharmony_ci unsigned short ModeIdIndex); 36162306a36Sopenharmony_ciextern void SiS_SetYPbPr(struct SiS_Private *SiS_Pr); 36262306a36Sopenharmony_ciextern void SiS_SetTVMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo, 36362306a36Sopenharmony_ci unsigned short ModeIdIndex); 36462306a36Sopenharmony_ciextern void SiS_UnLockCRT2(struct SiS_Private *SiS_Pr); 36562306a36Sopenharmony_ciextern void SiS_DisableBridge(struct SiS_Private *); 36662306a36Sopenharmony_ciextern bool SiS_SetCRT2Group(struct SiS_Private *, unsigned short); 36762306a36Sopenharmony_ciextern unsigned short SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, 36862306a36Sopenharmony_ci unsigned short ModeIdIndex); 36962306a36Sopenharmony_ciextern void SiS_WaitRetrace1(struct SiS_Private *SiS_Pr); 37062306a36Sopenharmony_ciextern unsigned short SiS_GetResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, 37162306a36Sopenharmony_ci unsigned short ModeIdIndex); 37262306a36Sopenharmony_ciextern unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short tempax); 37362306a36Sopenharmony_ciextern unsigned short SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, 37462306a36Sopenharmony_ci unsigned short ModeIdIndex, unsigned short RRTI); 37562306a36Sopenharmony_ciextern bool SiS_IsVAMode(struct SiS_Private *); 37662306a36Sopenharmony_ciextern bool SiS_IsDualEdge(struct SiS_Private *); 37762306a36Sopenharmony_ci 37862306a36Sopenharmony_ci#ifdef CONFIG_FB_SIS_300 37962306a36Sopenharmony_ciextern unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg); 38062306a36Sopenharmony_ciextern void sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg, 38162306a36Sopenharmony_ci unsigned int val); 38262306a36Sopenharmony_ci#endif 38362306a36Sopenharmony_ci#ifdef CONFIG_FB_SIS_315 38462306a36Sopenharmony_ciextern void sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg, 38562306a36Sopenharmony_ci unsigned char val); 38662306a36Sopenharmony_ciextern unsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg); 38762306a36Sopenharmony_ci#endif 38862306a36Sopenharmony_ci 38962306a36Sopenharmony_ci 39062306a36Sopenharmony_ci/* MMIO access macros */ 39162306a36Sopenharmony_ci#define MMIO_IN8(base, offset) readb((base+offset)) 39262306a36Sopenharmony_ci#define MMIO_IN16(base, offset) readw((base+offset)) 39362306a36Sopenharmony_ci#define MMIO_IN32(base, offset) readl((base+offset)) 39462306a36Sopenharmony_ci 39562306a36Sopenharmony_ci#define MMIO_OUT8(base, offset, val) writeb(((u8)(val)), (base+offset)) 39662306a36Sopenharmony_ci#define MMIO_OUT16(base, offset, val) writew(((u16)(val)), (base+offset)) 39762306a36Sopenharmony_ci#define MMIO_OUT32(base, offset, val) writel(((u32)(val)), (base+offset)) 39862306a36Sopenharmony_ci 39962306a36Sopenharmony_ci/* Queue control MMIO registers */ 40062306a36Sopenharmony_ci#define Q_BASE_ADDR 0x85C0 /* Base address of software queue */ 40162306a36Sopenharmony_ci#define Q_WRITE_PTR 0x85C4 /* Current write pointer */ 40262306a36Sopenharmony_ci#define Q_READ_PTR 0x85C8 /* Current read pointer */ 40362306a36Sopenharmony_ci#define Q_STATUS 0x85CC /* queue status */ 40462306a36Sopenharmony_ci 40562306a36Sopenharmony_ci#define MMIO_QUEUE_PHYBASE Q_BASE_ADDR 40662306a36Sopenharmony_ci#define MMIO_QUEUE_WRITEPORT Q_WRITE_PTR 40762306a36Sopenharmony_ci#define MMIO_QUEUE_READPORT Q_READ_PTR 40862306a36Sopenharmony_ci 40962306a36Sopenharmony_ci#ifndef FB_BLANK_UNBLANK 41062306a36Sopenharmony_ci#define FB_BLANK_UNBLANK 0 41162306a36Sopenharmony_ci#endif 41262306a36Sopenharmony_ci#ifndef FB_BLANK_NORMAL 41362306a36Sopenharmony_ci#define FB_BLANK_NORMAL 1 41462306a36Sopenharmony_ci#endif 41562306a36Sopenharmony_ci#ifndef FB_BLANK_VSYNC_SUSPEND 41662306a36Sopenharmony_ci#define FB_BLANK_VSYNC_SUSPEND 2 41762306a36Sopenharmony_ci#endif 41862306a36Sopenharmony_ci#ifndef FB_BLANK_HSYNC_SUSPEND 41962306a36Sopenharmony_ci#define FB_BLANK_HSYNC_SUSPEND 3 42062306a36Sopenharmony_ci#endif 42162306a36Sopenharmony_ci#ifndef FB_BLANK_POWERDOWN 42262306a36Sopenharmony_ci#define FB_BLANK_POWERDOWN 4 42362306a36Sopenharmony_ci#endif 42462306a36Sopenharmony_ci 42562306a36Sopenharmony_cienum _SIS_LCD_TYPE { 42662306a36Sopenharmony_ci LCD_INVALID = 0, 42762306a36Sopenharmony_ci LCD_800x600, 42862306a36Sopenharmony_ci LCD_1024x768, 42962306a36Sopenharmony_ci LCD_1280x1024, 43062306a36Sopenharmony_ci LCD_1280x960, 43162306a36Sopenharmony_ci LCD_640x480, 43262306a36Sopenharmony_ci LCD_1600x1200, 43362306a36Sopenharmony_ci LCD_1920x1440, 43462306a36Sopenharmony_ci LCD_2048x1536, 43562306a36Sopenharmony_ci LCD_320x240, /* FSTN */ 43662306a36Sopenharmony_ci LCD_1400x1050, 43762306a36Sopenharmony_ci LCD_1152x864, 43862306a36Sopenharmony_ci LCD_1152x768, 43962306a36Sopenharmony_ci LCD_1280x768, 44062306a36Sopenharmony_ci LCD_1024x600, 44162306a36Sopenharmony_ci LCD_320x240_2, /* DSTN */ 44262306a36Sopenharmony_ci LCD_320x240_3, /* DSTN */ 44362306a36Sopenharmony_ci LCD_848x480, 44462306a36Sopenharmony_ci LCD_1280x800, 44562306a36Sopenharmony_ci LCD_1680x1050, 44662306a36Sopenharmony_ci LCD_1280x720, 44762306a36Sopenharmony_ci LCD_1280x854, 44862306a36Sopenharmony_ci LCD_CUSTOM, 44962306a36Sopenharmony_ci LCD_UNKNOWN 45062306a36Sopenharmony_ci}; 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_cienum _SIS_CMDTYPE { 45362306a36Sopenharmony_ci MMIO_CMD = 0, 45462306a36Sopenharmony_ci AGP_CMD_QUEUE, 45562306a36Sopenharmony_ci VM_CMD_QUEUE, 45662306a36Sopenharmony_ci}; 45762306a36Sopenharmony_ci 45862306a36Sopenharmony_cistruct SIS_OH { 45962306a36Sopenharmony_ci struct SIS_OH *poh_next; 46062306a36Sopenharmony_ci struct SIS_OH *poh_prev; 46162306a36Sopenharmony_ci u32 offset; 46262306a36Sopenharmony_ci u32 size; 46362306a36Sopenharmony_ci}; 46462306a36Sopenharmony_ci 46562306a36Sopenharmony_cistruct SIS_OHALLOC { 46662306a36Sopenharmony_ci struct SIS_OHALLOC *poha_next; 46762306a36Sopenharmony_ci struct SIS_OH aoh[1]; 46862306a36Sopenharmony_ci}; 46962306a36Sopenharmony_ci 47062306a36Sopenharmony_cistruct SIS_HEAP { 47162306a36Sopenharmony_ci struct SIS_OH oh_free; 47262306a36Sopenharmony_ci struct SIS_OH oh_used; 47362306a36Sopenharmony_ci struct SIS_OH *poh_freelist; 47462306a36Sopenharmony_ci struct SIS_OHALLOC *poha_chain; 47562306a36Sopenharmony_ci u32 max_freesize; 47662306a36Sopenharmony_ci struct sis_video_info *vinfo; 47762306a36Sopenharmony_ci}; 47862306a36Sopenharmony_ci 47962306a36Sopenharmony_ci/* Our "par" */ 48062306a36Sopenharmony_cistruct sis_video_info { 48162306a36Sopenharmony_ci int cardnumber; 48262306a36Sopenharmony_ci struct fb_info *memyselfandi; 48362306a36Sopenharmony_ci 48462306a36Sopenharmony_ci struct SiS_Private SiS_Pr; 48562306a36Sopenharmony_ci 48662306a36Sopenharmony_ci struct sisfb_info sisfbinfo; /* For ioctl SISFB_GET_INFO */ 48762306a36Sopenharmony_ci 48862306a36Sopenharmony_ci struct fb_var_screeninfo default_var; 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_ci struct fb_fix_screeninfo sisfb_fix; 49162306a36Sopenharmony_ci u32 pseudo_palette[16]; 49262306a36Sopenharmony_ci 49362306a36Sopenharmony_ci struct sisfb_monitor { 49462306a36Sopenharmony_ci u16 hmin; 49562306a36Sopenharmony_ci u16 hmax; 49662306a36Sopenharmony_ci u16 vmin; 49762306a36Sopenharmony_ci u16 vmax; 49862306a36Sopenharmony_ci u32 dclockmax; 49962306a36Sopenharmony_ci u8 feature; 50062306a36Sopenharmony_ci bool datavalid; 50162306a36Sopenharmony_ci } sisfb_thismonitor; 50262306a36Sopenharmony_ci 50362306a36Sopenharmony_ci unsigned short chip_id; /* PCI ID of chip */ 50462306a36Sopenharmony_ci unsigned short chip_vendor; /* PCI ID of vendor */ 50562306a36Sopenharmony_ci char myid[40]; 50662306a36Sopenharmony_ci 50762306a36Sopenharmony_ci struct pci_dev *nbridge; 50862306a36Sopenharmony_ci struct pci_dev *lpcdev; 50962306a36Sopenharmony_ci 51062306a36Sopenharmony_ci int mni; /* Mode number index */ 51162306a36Sopenharmony_ci 51262306a36Sopenharmony_ci unsigned long video_size; 51362306a36Sopenharmony_ci unsigned long video_base; 51462306a36Sopenharmony_ci unsigned long mmio_size; 51562306a36Sopenharmony_ci unsigned long mmio_base; 51662306a36Sopenharmony_ci unsigned long vga_base; 51762306a36Sopenharmony_ci 51862306a36Sopenharmony_ci unsigned long video_offset; 51962306a36Sopenharmony_ci 52062306a36Sopenharmony_ci unsigned long UMAsize, LFBsize; 52162306a36Sopenharmony_ci 52262306a36Sopenharmony_ci void __iomem *video_vbase; 52362306a36Sopenharmony_ci void __iomem *mmio_vbase; 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci unsigned char *bios_abase; 52662306a36Sopenharmony_ci 52762306a36Sopenharmony_ci int wc_cookie; 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ci u32 sisfb_mem; 53062306a36Sopenharmony_ci 53162306a36Sopenharmony_ci u32 sisfb_parm_mem; 53262306a36Sopenharmony_ci int sisfb_accel; 53362306a36Sopenharmony_ci int sisfb_ypan; 53462306a36Sopenharmony_ci int sisfb_max; 53562306a36Sopenharmony_ci int sisfb_userom; 53662306a36Sopenharmony_ci int sisfb_useoem; 53762306a36Sopenharmony_ci int sisfb_mode_idx; 53862306a36Sopenharmony_ci int sisfb_parm_rate; 53962306a36Sopenharmony_ci int sisfb_crt1off; 54062306a36Sopenharmony_ci int sisfb_forcecrt1; 54162306a36Sopenharmony_ci int sisfb_crt2type; 54262306a36Sopenharmony_ci int sisfb_crt2flags; 54362306a36Sopenharmony_ci int sisfb_dstn; 54462306a36Sopenharmony_ci int sisfb_fstn; 54562306a36Sopenharmony_ci int sisfb_tvplug; 54662306a36Sopenharmony_ci int sisfb_tvstd; 54762306a36Sopenharmony_ci int sisfb_nocrt2rate; 54862306a36Sopenharmony_ci 54962306a36Sopenharmony_ci u32 heapstart; /* offset */ 55062306a36Sopenharmony_ci void __iomem *sisfb_heap_start; /* address */ 55162306a36Sopenharmony_ci void __iomem *sisfb_heap_end; /* address */ 55262306a36Sopenharmony_ci u32 sisfb_heap_size; 55362306a36Sopenharmony_ci int havenoheap; 55462306a36Sopenharmony_ci 55562306a36Sopenharmony_ci struct SIS_HEAP sisfb_heap; /* This card's vram heap */ 55662306a36Sopenharmony_ci 55762306a36Sopenharmony_ci int video_bpp; 55862306a36Sopenharmony_ci int video_cmap_len; 55962306a36Sopenharmony_ci int video_width; 56062306a36Sopenharmony_ci int video_height; 56162306a36Sopenharmony_ci unsigned int refresh_rate; 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_ci unsigned int chip; 56462306a36Sopenharmony_ci unsigned int chip_real_id; 56562306a36Sopenharmony_ci u8 revision_id; 56662306a36Sopenharmony_ci int sisvga_enabled; /* PCI device was enabled */ 56762306a36Sopenharmony_ci 56862306a36Sopenharmony_ci int video_linelength; /* real pitch */ 56962306a36Sopenharmony_ci int scrnpitchCRT1; /* pitch regarding interlace */ 57062306a36Sopenharmony_ci 57162306a36Sopenharmony_ci u16 DstColor; /* For 2d acceleration */ 57262306a36Sopenharmony_ci u32 SiS310_AccelDepth; 57362306a36Sopenharmony_ci u32 CommandReg; 57462306a36Sopenharmony_ci int cmdqueuelength; /* Current (for accel) */ 57562306a36Sopenharmony_ci u32 cmdQueueSize; /* Total size in KB */ 57662306a36Sopenharmony_ci 57762306a36Sopenharmony_ci spinlock_t lockaccel; /* Do not use outside of kernel! */ 57862306a36Sopenharmony_ci 57962306a36Sopenharmony_ci unsigned int pcibus; 58062306a36Sopenharmony_ci unsigned int pcislot; 58162306a36Sopenharmony_ci unsigned int pcifunc; 58262306a36Sopenharmony_ci 58362306a36Sopenharmony_ci int accel; 58462306a36Sopenharmony_ci int engineok; 58562306a36Sopenharmony_ci 58662306a36Sopenharmony_ci u16 subsysvendor; 58762306a36Sopenharmony_ci u16 subsysdevice; 58862306a36Sopenharmony_ci 58962306a36Sopenharmony_ci u32 vbflags; /* Replacing deprecated stuff from above */ 59062306a36Sopenharmony_ci u32 currentvbflags; 59162306a36Sopenharmony_ci u32 vbflags2; 59262306a36Sopenharmony_ci 59362306a36Sopenharmony_ci int lcdxres, lcdyres; 59462306a36Sopenharmony_ci int lcddefmodeidx, tvdefmodeidx, defmodeidx; 59562306a36Sopenharmony_ci u32 CRT2LCDType; /* defined in "SIS_LCD_TYPE" */ 59662306a36Sopenharmony_ci u32 curFSTN, curDSTN; 59762306a36Sopenharmony_ci 59862306a36Sopenharmony_ci int current_bpp; 59962306a36Sopenharmony_ci int current_width; 60062306a36Sopenharmony_ci int current_height; 60162306a36Sopenharmony_ci int current_htotal; 60262306a36Sopenharmony_ci int current_vtotal; 60362306a36Sopenharmony_ci int current_linelength; 60462306a36Sopenharmony_ci __u32 current_pixclock; 60562306a36Sopenharmony_ci int current_refresh_rate; 60662306a36Sopenharmony_ci 60762306a36Sopenharmony_ci unsigned int current_base; 60862306a36Sopenharmony_ci 60962306a36Sopenharmony_ci u8 mode_no; 61062306a36Sopenharmony_ci u8 rate_idx; 61162306a36Sopenharmony_ci int modechanged; 61262306a36Sopenharmony_ci unsigned char modeprechange; 61362306a36Sopenharmony_ci 61462306a36Sopenharmony_ci u8 sisfb_lastrates[128]; 61562306a36Sopenharmony_ci 61662306a36Sopenharmony_ci int newrom; 61762306a36Sopenharmony_ci int haveXGIROM; 61862306a36Sopenharmony_ci int registered; 61962306a36Sopenharmony_ci int warncount; 62062306a36Sopenharmony_ci 62162306a36Sopenharmony_ci int sisvga_engine; 62262306a36Sopenharmony_ci int hwcursor_size; 62362306a36Sopenharmony_ci int CRT2_write_enable; 62462306a36Sopenharmony_ci u8 caps; 62562306a36Sopenharmony_ci 62662306a36Sopenharmony_ci u8 detectedpdc; 62762306a36Sopenharmony_ci u8 detectedpdca; 62862306a36Sopenharmony_ci u8 detectedlcda; 62962306a36Sopenharmony_ci 63062306a36Sopenharmony_ci void __iomem *hwcursor_vbase; 63162306a36Sopenharmony_ci 63262306a36Sopenharmony_ci int chronteltype; 63362306a36Sopenharmony_ci int tvxpos, tvypos; 63462306a36Sopenharmony_ci u8 p2_1f,p2_20,p2_2b,p2_42,p2_43,p2_01,p2_02; 63562306a36Sopenharmony_ci int tvx, tvy; 63662306a36Sopenharmony_ci 63762306a36Sopenharmony_ci u8 sisfblocked; 63862306a36Sopenharmony_ci 63962306a36Sopenharmony_ci struct sisfb_info sisfb_infoblock; 64062306a36Sopenharmony_ci 64162306a36Sopenharmony_ci struct sisfb_cmd sisfb_command; 64262306a36Sopenharmony_ci 64362306a36Sopenharmony_ci u32 sisfb_id; 64462306a36Sopenharmony_ci 64562306a36Sopenharmony_ci u8 sisfb_can_post; 64662306a36Sopenharmony_ci u8 sisfb_card_posted; 64762306a36Sopenharmony_ci u8 sisfb_was_boot_device; 64862306a36Sopenharmony_ci 64962306a36Sopenharmony_ci struct sis_video_info *next; 65062306a36Sopenharmony_ci}; 65162306a36Sopenharmony_ci 65262306a36Sopenharmony_ci/* from sis_accel.c */ 65362306a36Sopenharmony_ciextern void fbcon_sis_fillrect(struct fb_info *info, 65462306a36Sopenharmony_ci const struct fb_fillrect *rect); 65562306a36Sopenharmony_ciextern void fbcon_sis_copyarea(struct fb_info *info, 65662306a36Sopenharmony_ci const struct fb_copyarea *area); 65762306a36Sopenharmony_ciextern int fbcon_sis_sync(struct fb_info *info); 65862306a36Sopenharmony_ci 65962306a36Sopenharmony_ci/* Internal 2D accelerator functions */ 66062306a36Sopenharmony_ciextern int sisfb_initaccel(struct sis_video_info *ivideo); 66162306a36Sopenharmony_ciextern void sisfb_syncaccel(struct sis_video_info *ivideo); 66262306a36Sopenharmony_ci 66362306a36Sopenharmony_ci/* Internal general routines */ 66462306a36Sopenharmony_ci#ifdef CONFIG_FB_SIS_300 66562306a36Sopenharmony_ciunsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg); 66662306a36Sopenharmony_civoid sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg, unsigned int val); 66762306a36Sopenharmony_ciunsigned int sisfb_read_lpc_pci_dword(struct SiS_Private *SiS_Pr, int reg); 66862306a36Sopenharmony_ci#endif 66962306a36Sopenharmony_ci#ifdef CONFIG_FB_SIS_315 67062306a36Sopenharmony_civoid sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg, unsigned char val); 67162306a36Sopenharmony_ciunsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg); 67262306a36Sopenharmony_ci#endif 67362306a36Sopenharmony_ci 67462306a36Sopenharmony_ci/* SiS-specific exported functions */ 67562306a36Sopenharmony_civoid sis_malloc(struct sis_memreq *req); 67662306a36Sopenharmony_civoid sis_malloc_new(struct pci_dev *pdev, struct sis_memreq *req); 67762306a36Sopenharmony_civoid sis_free(u32 base); 67862306a36Sopenharmony_civoid sis_free_new(struct pci_dev *pdev, u32 base); 67962306a36Sopenharmony_ci 68062306a36Sopenharmony_ci/* Routines from init.c/init301.c */ 68162306a36Sopenharmony_ciextern unsigned short SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay, 68262306a36Sopenharmony_ci int VDisplay, int Depth, bool FSTN, unsigned short CustomT, 68362306a36Sopenharmony_ci int LCDwith, int LCDheight, unsigned int VBFlags2); 68462306a36Sopenharmony_ciextern unsigned short SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay, 68562306a36Sopenharmony_ci int VDisplay, int Depth, unsigned int VBFlags2); 68662306a36Sopenharmony_ciextern unsigned short SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay, 68762306a36Sopenharmony_ci int VDisplay, int Depth, unsigned int VBFlags2); 68862306a36Sopenharmony_ciextern void SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr); 68962306a36Sopenharmony_ciextern bool SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); 69062306a36Sopenharmony_ciextern void SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable); 69162306a36Sopenharmony_ciextern void SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable); 69262306a36Sopenharmony_ci 69362306a36Sopenharmony_ciextern bool SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr); 69462306a36Sopenharmony_ci 69562306a36Sopenharmony_ciextern bool sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno, 69662306a36Sopenharmony_ci int *htotal, int *vtotal, unsigned char rateindex); 69762306a36Sopenharmony_ciextern int sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr, 69862306a36Sopenharmony_ci unsigned char modeno, unsigned char rateindex); 69962306a36Sopenharmony_ciextern int sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno, 70062306a36Sopenharmony_ci unsigned char rateindex, struct fb_var_screeninfo *var); 70162306a36Sopenharmony_ci 70262306a36Sopenharmony_ci 70362306a36Sopenharmony_ci#endif 704