ast.h revision 7fe5393c
1/* 2 * Copyright (c) 2005 ASPEED Technology Inc. 3 * 4 * Permission to use, copy, modify, distribute, and sell this software and its 5 * documentation for any purpose is hereby granted without fee, provided that 6 * the above copyright notice appear in all copies and that both that 7 * copyright notice and this permission notice appear in supporting 8 * documentation, and that the name of the authors not be used in 9 * advertising or publicity pertaining to distribution of the software without 10 * specific, written prior permission. The authors makes no representations 11 * about the suitability of this software for any purpose. It is provided 12 * "as is" without express or implied warranty. 13 * 14 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 20 * PERFORMANCE OF THIS SOFTWARE. 21 */ 22/* Compiler Options */ 23#define Accel_2D 24/* #define MMIO_2D */ 25#define HWC 26#define AstVideo 27/* #define PATCH_ABI_VERSION */ 28#define Support_ShadowFB 29 30#include <string.h> 31#include <stdlib.h> 32 33#ifdef HAVE_XAA_H 34#include "xaa.h" 35#endif 36 37#include "ast_pcirename.h" 38 39#include "compat-api.h" 40 41#ifdef Support_ShadowFB 42#include "shadow.h" 43#endif 44 45/* Vendor & Device Info */ 46#ifndef PCI_VENDOR_AST 47#define PCI_VENDOR_AST 0x1A03 48#endif 49 50#ifndef PCI_CHIP_AST2000 51#define PCI_CHIP_AST2000 0x2000 52#endif 53 54#ifndef PCI_CHIP_AST2100 55#define PCI_CHIP_AST2100 0x2010 56#endif 57 58#ifndef PCI_CHIP_AST1180 59#define PCI_CHIP_AST1180 0x1180 60#endif 61 62typedef enum _CHIP_ID { 63 VGALegacy, 64 AST2000, 65 AST2100, 66 AST1100, 67 AST2200, 68 AST2150, 69 AST2300, 70 AST1180 71} CHIP_ID; 72 73/* AST REC Info */ 74#define AST_NAME "AST" 75#define AST_DRIVER_NAME "ast" 76#define AST_MAJOR_VERSION PACKAGE_VERSION_MAJOR 77#define AST_MINOR_VERSION PACKAGE_VERSION_MINOR 78#define AST_PATCH_VERSION PACKAGE_VERSION_PATCHLEVEL 79#define AST_VERSION \ 80 ((AST_MAJOR_VERSION << 20) | (AST_MINOR_VERSION << 10) | AST_PATCH_VERSION) 81 82/* Customized Info */ 83#define DEFAULT_VIDEOMEM_SIZE 0x00800000 84#define DEFAULT_MMIO_SIZE 0x00020000 85#define DEFAULT_CMDQ_SIZE 0x00100000 86#define MIN_CMDQ_SIZE 0x00040000 87#define CMD_QUEUE_GUARD_BAND 0x00000020 88#define DEFAULT_HWC_NUM 0x00000002 89 90/* Patch Info */ 91#define ABI_VIDEODRV_VERSION_PATCH SET_ABI_VERSION(0, 5) 92 93/* Data Type Definition */ 94typedef INT32 LONG; 95typedef CARD8 UCHAR; 96typedef CARD16 USHORT; 97typedef CARD32 ULONG; 98 99/* Data Structure Definition */ 100typedef struct _ASTRegRec { 101 102 UCHAR ExtCRTC[0x50]; 103 104 UCHAR MISC; 105 UCHAR SEQ[4]; 106 UCHAR CRTC[25]; 107 UCHAR AR[20]; 108 UCHAR GR[9]; 109 UCHAR DAC[256][3]; 110 111 ULONG GFX[12]; 112 113 UCHAR REGA4; 114 ULONG ENG8044; 115} ASTRegRec, *ASTRegPtr; 116 117typedef struct _VIDEOMODE { 118 119 int ScreenWidth; 120 int ScreenHeight; 121 int bitsPerPixel; 122 int ScreenPitch; 123 124} VIDEOMODE, *PVIDEOMODE; 125 126typedef struct { 127 128 ULONG ulCMDQSize; 129 ULONG ulCMDQType; 130 131 ULONG ulCMDQOffsetAddr; 132 UCHAR *pjCMDQVirtualAddr; 133 134 UCHAR *pjCmdQBasePort; 135 UCHAR *pjWritePort; 136 UCHAR *pjReadPort; 137 UCHAR *pjEngStatePort; 138 139 ULONG ulCMDQMask; 140 ULONG ulCurCMDQueueLen; 141 142 ULONG ulWritePointer; 143 ULONG ulReadPointer; 144 145 ULONG ulReadPointer_OK; /* for Eng_DBGChk */ 146 147} CMDQINFO, *PCMDQINFO; 148 149typedef struct { 150 151 int HWC_NUM; 152 int HWC_NUM_Next; 153 154 ULONG ulHWCOffsetAddr; 155 UCHAR *pjHWCVirtualAddr; 156 157 USHORT cursortype; 158 USHORT width; 159 USHORT height; 160 USHORT offset_x; 161 USHORT offset_y; 162 ULONG fg; 163 ULONG bg; 164 165 UCHAR cursorpattern[1024]; 166 167} HWCINFO, *PHWCINFO; 168 169typedef struct _ASTPortPrivRec{ 170 FBLinearPtr linear; 171 FBAreaPtr fbAreaPtr; 172 int fbSize; 173 CARD32 bufAddr[2]; 174 175 unsigned char currentBuf; 176 177 short drw_x, drw_y, drw_w, drw_h; 178 short src_x, src_y, src_w, src_h; 179 int id; 180 short srcPitch, height; 181 182 INT32 brightness; 183 INT32 contrast; 184 INT32 saturation; 185 INT32 hue; 186 187 INT32 gammaR; 188 INT32 gammaG; 189 INT32 gammaB; 190 191 RegionRec clip; 192 CARD32 colorKey; 193 194 CARD32 videoStatus; 195 Time offTime; 196 Time freeTime; 197 198 CARD32 displayMode; 199 200 int pitch; 201 int offset; 202} ASTPortPrivRec, *ASTPortPrivPtr; 203 204typedef struct _ASTRec { 205 206 EntityInfoPtr pEnt; 207#ifndef XSERVER_LIBPCIACCESS 208 pciVideoPtr PciInfo; 209 PCITAG PciTag; 210#else 211 struct pci_device *PciInfo; 212#endif 213 214 OptionInfoPtr Options; 215 DisplayModePtr ModePtr; 216 FBLinearPtr pCMDQPtr; 217#ifdef HAVE_XAA_H 218 XAAInfoRecPtr AccelInfoPtr; 219#endif 220 xf86CursorInfoPtr HWCInfoPtr; 221 FBLinearPtr pHWCPtr; 222 223 CloseScreenProcPtr CloseScreen; 224 ScreenBlockHandlerProcPtr BlockHandler; 225 226 UCHAR jChipType; 227 UCHAR jDRAMType; 228 ULONG ulDRAMBusWidth ; 229 ULONG ulDRAMSize; 230 ULONG ulVRAMSize; 231 ULONG ulVRAMBase; 232 ULONG ulMCLK; 233 234 Bool noAccel; 235 Bool noHWC; 236 Bool MMIO2D; 237 int ENGCaps; 238 int DBGSelect; 239 Bool VGA2Clone; 240 Bool SupportWideScreen; 241 242 ULONG FBPhysAddr; /* Frame buffer physical address */ 243 ULONG MMIOPhysAddr; /* MMIO region physical address */ 244 ULONG BIOSPhysAddr; /* BIOS physical address */ 245 246 UCHAR *FBVirtualAddr; /* Map of frame buffer */ 247 UCHAR *MMIOVirtualAddr; /* Map of MMIO region */ 248 249 unsigned long FbMapSize; 250 unsigned long MMIOMapSize; 251 252 IOADDRESS IODBase; /* Base of PIO memory area */ 253 IOADDRESS PIOOffset; 254 IOADDRESS RelocateIO; 255 256 VIDEOMODE VideoModeInfo; 257 ASTRegRec SavedReg; 258 CMDQINFO CMDQInfo; 259 HWCINFO HWCInfo; 260 ULONG ulCMDReg; 261 Bool EnableClip; 262 263 int clip_left; 264 int clip_top; 265 int clip_right; 266 int clip_bottom; 267 268 int mon_h_active; /* Monitor Info. */ 269 int mon_v_active; 270 271#ifdef AstVideo 272 XF86VideoAdaptorPtr adaptor; 273 Atom xvBrightness, xvContrast, xvColorKey, xvHue, xvSaturation; 274 Atom xvGammaRed, xvGammaGreen, xvGammaBlue; 275#endif 276 277#ifdef Support_ShadowFB 278 Bool shadowFB; 279 Bool shadowFB_validation; 280 void *shadow; 281 ShadowUpdateProc update; 282 ShadowWindowProc window; 283 CreateScreenResourcesProcPtr CreateScreenResources; 284#endif 285 286} ASTRec, *ASTRecPtr, *ASTPtr; 287 288#define ASTPTR(p) ((ASTRecPtr)((p)->driverPrivate)) 289 290/* Include Files */ 291#include "ast_mode.h" 292#include "ast_vgatool.h" 293#include "ast_2dtool.h" 294#include "ast_cursor.h" 295