1 2/************************************************************************** 3 4Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. 5All Rights Reserved. 6 7Permission is hereby granted, free of charge, to any person obtaining a 8copy of this software and associated documentation files (the 9"Software"), to deal in the Software without restriction, including 10without limitation the rights to use, copy, modify, merge, publish, 11distribute, sub license, and/or sell copies of the Software, and to 12permit persons to whom the Software is furnished to do so, subject to 13the following conditions: 14 15The above copyright notice and this permission notice (including the 16next paragraph) shall be included in all copies or substantial portions 17of the Software. 18 19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 22IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR 23ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 27**************************************************************************/ 28 29/* 30 * Authors: 31 * Daryll Strauss <daryll@precisioninsight.com> 32 * 33 */ 34 35#ifndef _I740_H_ 36#define _I740_H_ 37 38#include "i740_pcirename.h" 39 40#include "xf86Pci.h" 41 42#include "i740_reg.h" 43#include "i740_macros.h" 44 45#ifdef HAVE_XAA_H 46#include "xaa.h" 47#endif 48#include "xf86Cursor.h" 49 50#include "compat-api.h" 51/* Globals */ 52/* Memory mapped register access macros */ 53#define INREG8(addr) *(volatile CARD8 *)(pI740->MMIOBase + (addr)) 54#define INREG16(addr) *(volatile CARD16 *)(pI740->MMIOBase + (addr)) 55#define INREG(addr) *(volatile CARD32 *)(pI740->MMIOBase + (addr)) 56#define OUTREG8(addr, val) *(volatile CARD8 *)(pI740->MMIOBase + (addr)) = (val) 57#define OUTREG16(addr, val) *(volatile CARD16 *)(pI740->MMIOBase + (addr)) = (val) 58#define OUTREG(addr, val) *(volatile CARD32 *)(pI740->MMIOBase + (addr)) = (val) 59 60#define PCI_VENDOR_REAL3D 0x003D 61#define PCI_CHIP_I740_PCI 0x00D1 62#define PCI_VENDOR_INTEL 0x8086 63#define PCI_CHIP_I740_AGP 0x7800 64 65typedef struct _I740Rec *I740Ptr; 66 67typedef void (*I740WriteIndexedByteFunc)(I740Ptr pI740, int addr, 68 unsigned char index, char value); 69typedef char (*I740ReadIndexedByteFunc)(I740Ptr pI740, int addr, 70 unsigned char index); 71typedef void (*I740WriteByteFunc)(I740Ptr pI740, int addr, unsigned char value); 72typedef char (*I740ReadByteFunc)(I740Ptr pI740, int addr); 73 74typedef struct { 75 unsigned char DisplayControl; 76 unsigned char PixelPipeCfg0; 77 unsigned char PixelPipeCfg1; 78 unsigned char PixelPipeCfg2; 79 unsigned char VideoClk2_M; 80 unsigned char VideoClk2_N; 81 unsigned char VideoClk2_MN_MSBs; 82 unsigned char VideoClk2_DivisorSel; 83 unsigned char PLLControl; 84 unsigned char AddressMapping; 85 unsigned char IOControl; 86 unsigned char BitBLTControl; 87 unsigned char ExtVertTotal; 88 unsigned char ExtVertDispEnd; 89 unsigned char ExtVertSyncStart; 90 unsigned char ExtVertBlankStart; 91 unsigned char ExtHorizTotal; 92 unsigned char ExtHorizBlank; 93 unsigned char ExtOffset; 94 unsigned char InterlaceControl; 95 unsigned int LMI_FIFO_Watermark; 96} I740RegRec, *I740RegPtr; 97 98typedef struct _I740Rec { 99 unsigned char *MMIOBase; 100 unsigned char *FbBase; 101 long FbMapSize; 102 int cpp; 103 int MaxClock; 104 int CursorStart; 105 int Chipset; 106 unsigned long LinearAddr; 107 unsigned long MMIOAddr; 108 EntityInfoPtr pEnt; 109 pciVideoPtr PciInfo; 110#ifndef XSERVER_LIBPCIACCESS 111 PCITAG PciTag; 112#endif 113 int HasSGRAM; 114 I740RegRec SavedReg; 115 I740RegRec ModeReg; 116#ifdef HAVE_XAA_H 117 XAAInfoRecPtr AccelInfoRec; 118#endif 119 xf86CursorInfoPtr CursorInfoRec; 120 FBAreaPtr CursorData; 121 CloseScreenProcPtr CloseScreen; 122 GFX2DOPREG_BLTER_FULL_LOAD bltcmd; 123 Bool usePIO; 124 I740WriteIndexedByteFunc writeControl; 125 I740ReadIndexedByteFunc readControl; 126 I740WriteByteFunc writeStandard; 127 I740ReadByteFunc readStandard; 128 OptionInfoPtr Options; 129 130 /*DGA*/ 131 DGAModePtr DGAModes; 132 int numDGAModes; 133 Bool DGAactive; 134 int DGAViewportStatus; 135 BoxRec FbMemBox; 136 /*-*/ 137 138 /*I2C*/ 139 I2CBusPtr rc_i2c; 140 /*-*/ 141 142 /*-*/ /*Overlay*/ 143 XF86VideoAdaptorPtr adaptor; 144 unsigned long OverlayStart; 145 unsigned long OverlayPhysical; 146 int colorKey; 147 ScreenBlockHandlerProcPtr BlockHandler; 148 int ov_offset_x,ov_offset_y; 149 /*-*/ 150 151 Bool usevgacompat; 152 Bool NoAccel; 153} I740Rec; 154 155#define I740PTR(p) ((I740Ptr)((p)->driverPrivate)) 156 157extern Bool I740CursorInit(ScreenPtr pScreen); 158extern Bool I740AccelInit(ScreenPtr pScreen); 159void I740SetPIOAccess(I740Ptr pI740); 160void I740SetMMIOAccess(I740Ptr pI740); 161void I740InitVideo(ScreenPtr pScreen); 162 163Bool I740SwitchMode(SWITCH_MODE_ARGS_DECL); 164void I740AdjustFrame(ADJUST_FRAME_ARGS_DECL); 165 166Bool I740_I2CInit(ScrnInfoPtr pScrn); 167 168#define minb(p) MMIO_IN8(pI740->MMIOBase, (p)) 169#define moutb(p,v) MMIO_OUT8(pI740->MMIOBase, (p),(v)) 170 171#endif 172