summaryrefslogtreecommitdiff
path: root/driver/xf86-video-i740/src/i740.h
blob: 3439d7d9bf4f19fa98334d34c96739294f845865 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171

/**************************************************************************

Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

**************************************************************************/

/*
 * Authors:
 *   Daryll Strauss <daryll@precisioninsight.com>
 *
 */

#ifndef _I740_H_
#define _I740_H_

#include "i740_pcirename.h"

#include "xf86Pci.h"

#include "i740_reg.h"
#include "i740_macros.h"

#ifdef HAVE_XAA_H
#include "xaa.h"
#endif
#include "xf86Cursor.h"

#include "compat-api.h"
/* Globals */
/* Memory mapped register access macros */
#define INREG8(addr)        *(volatile CARD8  *)(pI740->MMIOBase + (addr))
#define INREG16(addr)       *(volatile CARD16 *)(pI740->MMIOBase + (addr))
#define INREG(addr)         *(volatile CARD32 *)(pI740->MMIOBase + (addr))
#define OUTREG8(addr, val)  *(volatile CARD8  *)(pI740->MMIOBase + (addr)) = (val)
#define OUTREG16(addr, val) *(volatile CARD16 *)(pI740->MMIOBase + (addr)) = (val)
#define OUTREG(addr, val)   *(volatile CARD32 *)(pI740->MMIOBase + (addr)) = (val)

#define PCI_VENDOR_REAL3D		0x003D
#define PCI_CHIP_I740_PCI		0x00D1
#define PCI_VENDOR_INTEL		0x8086
#define PCI_CHIP_I740_AGP		0x7800

typedef struct _I740Rec *I740Ptr;

typedef void (*I740WriteIndexedByteFunc)(I740Ptr pI740, int addr, 
					 unsigned char index, char value);
typedef char (*I740ReadIndexedByteFunc)(I740Ptr pI740, int addr, 
					unsigned char index);
typedef void (*I740WriteByteFunc)(I740Ptr pI740, int addr, unsigned char value);
typedef char (*I740ReadByteFunc)(I740Ptr pI740, int addr);

typedef struct {
  unsigned char DisplayControl;
  unsigned char PixelPipeCfg0;
  unsigned char PixelPipeCfg1;
  unsigned char PixelPipeCfg2;
  unsigned char VideoClk2_M;
  unsigned char VideoClk2_N;
  unsigned char VideoClk2_MN_MSBs;
  unsigned char VideoClk2_DivisorSel;
  unsigned char PLLControl;
  unsigned char AddressMapping;
  unsigned char IOControl;
  unsigned char BitBLTControl;
  unsigned char ExtVertTotal;
  unsigned char ExtVertDispEnd;
  unsigned char ExtVertSyncStart;
  unsigned char ExtVertBlankStart;
  unsigned char ExtHorizTotal;
  unsigned char ExtHorizBlank;
  unsigned char ExtOffset;
  unsigned char InterlaceControl;
  unsigned int  LMI_FIFO_Watermark;
} I740RegRec, *I740RegPtr;

typedef struct _I740Rec {
  unsigned char *MMIOBase;
  unsigned char *FbBase;
  long FbMapSize;
  int cpp;
  int MaxClock;
  int CursorStart;
  int Chipset;
  unsigned long LinearAddr;
  unsigned long MMIOAddr;
  EntityInfoPtr pEnt;
  pciVideoPtr PciInfo;
#ifndef XSERVER_LIBPCIACCESS
  PCITAG PciTag;
#endif
  int HasSGRAM;
  I740RegRec SavedReg;
  I740RegRec ModeReg;
#ifdef HAVE_XAA_H
  XAAInfoRecPtr AccelInfoRec;
#endif
  xf86CursorInfoPtr CursorInfoRec;
  FBAreaPtr CursorData;
  CloseScreenProcPtr CloseScreen;
  GFX2DOPREG_BLTER_FULL_LOAD bltcmd;
  Bool usePIO;
  I740WriteIndexedByteFunc writeControl;
  I740ReadIndexedByteFunc readControl;
  I740WriteByteFunc writeStandard;
  I740ReadByteFunc readStandard;
  OptionInfoPtr Options;

  /*DGA*/
  DGAModePtr DGAModes;
  int numDGAModes;
  Bool DGAactive;
  int DGAViewportStatus;
  BoxRec FbMemBox;
  /*-*/

  /*I2C*/
  I2CBusPtr             rc_i2c;
  /*-*/

  /*-*/ /*Overlay*/
  XF86VideoAdaptorPtr adaptor;
  unsigned long OverlayStart;
  unsigned long OverlayPhysical;
  int colorKey;
  ScreenBlockHandlerProcPtr BlockHandler;
  int ov_offset_x,ov_offset_y;
  /*-*/

  Bool usevgacompat;
  Bool NoAccel;
} I740Rec;

#define I740PTR(p) ((I740Ptr)((p)->driverPrivate))

extern Bool I740CursorInit(ScreenPtr pScreen);
extern Bool I740AccelInit(ScreenPtr pScreen);
void I740SetPIOAccess(I740Ptr pI740);
void I740SetMMIOAccess(I740Ptr pI740);
void I740InitVideo(ScreenPtr pScreen);

Bool I740SwitchMode(SWITCH_MODE_ARGS_DECL);
void I740AdjustFrame(ADJUST_FRAME_ARGS_DECL);

Bool I740_I2CInit(ScrnInfoPtr pScrn);

#define minb(p) MMIO_IN8(pI740->MMIOBase, (p))
#define moutb(p,v) MMIO_OUT8(pI740->MMIOBase, (p),(v))

#endif