~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.h,v 1.2 2003/01/29 15:42:16 eich Exp $ */
 
2
/*
 
3
 * Copyright 1998,1999 by Alan Hourihane, Wigan, England.
 
4
 *
 
5
 * Permission to use, copy, modify, distribute, and sell this software and its
 
6
 * documentation for any purpose is hereby granted without fee, provided that
 
7
 * the above copyright notice appear in all copies and that both that
 
8
 * copyright notice and this permission notice appear in supporting
 
9
 * documentation, and that the name of Alan Hourihane not be used in
 
10
 * advertising or publicity pertaining to distribution of the software without
 
11
 * specific, written prior permission.  Alan Hourihane makes no representations
 
12
 * about the suitability of this software for any purpose.  It is provided
 
13
 * "as is" without express or implied warranty.
 
14
 *
 
15
 * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
16
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 
17
 * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
18
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 
19
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 
20
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 
21
 * PERFORMANCE OF THIS SOFTWARE.
 
22
 *
 
23
 * Authors:  Alan Hourihane, alanh@fairlite.demon.co.uk
 
24
 *           Mike Chapman <mike@paranoia.com>,
 
25
 *           Juanjo Santamarta <santamarta@ctv.es>,
 
26
 *           Mitani Hiroshi <hmitani@drl.mei.co.jp>
 
27
 *           David Thomas <davtom@dream.org.uk>
 
28
 *           Thomas Winischhofer <thomas@winischhofer.net>
 
29
 */
 
30
 
 
31
/* Definitions for the SIS engine communication. ------------------------------------ */
 
32
 
 
33
/* For pre-530 chipsets only!!! */
 
34
 
 
35
/* Engine Registers for 1st generation engines (5597/5598/6326) */
 
36
const int sisReg32MMIO[] = {
 
37
            0x8280,0x8284,0x8288,0x828C,0x8290,0x8294,
 
38
            0x8298,0x829C,0x82A0,0x82A4,0x82A8,0x82AC
 
39
};
 
40
 
 
41
#define BR(x) sisReg32MMIO[x]
 
42
 
 
43
/* These are done using Memory Mapped IO, of the registers */
 
44
/*
 
45
 * Modified for Sis by Xavier Ducoin (xavier@rd.lectra.fr)
 
46
 *
 
47
 */
 
48
 
 
49
/* Command Reg 0 (0x82aa, [15:0]) */
 
50
#define sisSRCBG            0x0000   /* source select */
 
51
#define sisSRCFG            0x0001
 
52
#define sisSRCVIDEO         0x0002
 
53
#define sisSRCSYSTEM        0x0003
 
54
 
 
55
#define sisPATFG            0x0004   /* pattern select */
 
56
#define sisPATREG           0x0008
 
57
#define sisPATBG            0x0000
 
58
 
 
59
#define sisLEFT2RIGHT       0x0010   /* Direction select */
 
60
#define sisRIGHT2LEFT       0x0000
 
61
#define sisTOP2BOTTOM       0x0020
 
62
#define sisBOTTOM2TOP       0x0000
 
63
#define sisXINCREASE        sisLEFT2RIGHT
 
64
#define sisYINCREASE        sisTOP2BOTTOM
 
65
 
 
66
#define sisCLIPENABL        0x0040   /* Clipping select */
 
67
#define sisCLIPINTRN        0x0080
 
68
#define sisCLIPEXTRN        0x0000
 
69
 
 
70
#define sisCMDBLT           0x0000   /* Command select */
 
71
#define sisCMDBLTMSK        0x0100
 
72
#define sisCMDCOLEXP        0x0200
 
73
#define sisCMDLINE          0x0300
 
74
#define sisFLGECOLEXP       0x2000
 
75
#define sisCMDECOLEXP       (sisCMDCOLEXP | sisFLGECOLEXP)
 
76
 
 
77
#define sisLASTPIX          0x0800   /* Line parameters */
 
78
#define sisXMAJOR           0x0400
 
79
 
 
80
 
 
81
/* Macros to do useful things with the SIS BitBLT engine */
 
82
 
 
83
#define sisBLTSync \
 
84
  while(MMIO_IN16(pSiS->IOBase, BR(10) + 2) & 0x4000) {}
 
85
 
 
86
/* According to SiS 6326 2D programming guide, 16 bits position at   */
 
87
/* 0x82A8 returns queue free. But this don't work, so don't wait     */
 
88
/* anything when turbo-queue is enabled. If there are frequent syncs */
 
89
/* this should work. But not for xaa_benchmark :-(     */
 
90
 
 
91
/* TW: Bit 16 only applies to the hardware queue, not the software
 
92
 *     (=turbo) queue.
 
93
 */
 
94
 
 
95
#define sisBLTWAIT \
 
96
  if(!pSiS->TurboQueue) { \
 
97
    while(MMIO_IN16(pSiS->IOBase, BR(10) + 2) & 0x4000) {} \
 
98
  } else { \
 
99
    sisBLTSync \
 
100
  }
 
101
 
 
102
#define sisSETPATREG() \
 
103
   ((unsigned char *)(pSiS->IOBase + BR(11)))
 
104
 
 
105
#define sisSETPATREGL() \
 
106
   ((unsigned long *)(pSiS->IOBase + BR(11)))
 
107
 
 
108
/* trigger command */
 
109
#define sisSETCMD(op) \
 
110
  { \
 
111
  unsigned long temp; \
 
112
  MMIO_OUT16(pSiS->IOBase, BR(10) + 2, op); \
 
113
  temp = MMIO_IN32(pSiS->IOBase, BR(10)); \
 
114
  }
 
115
 
 
116
/* set foreground color and fg ROP */
 
117
#define sisSETFGROPCOL(rop, color) \
 
118
   MMIO_OUT32(pSiS->IOBase, BR(4), ((rop << 24) | (color & 0xFFFFFF)));
 
119
 
 
120
/* set background color and bg ROP */
 
121
#define sisSETBGROPCOL(rop, color) \
 
122
   MMIO_OUT32(pSiS->IOBase, BR(5), ((rop << 24) | (color & 0xFFFFFF)));
 
123
 
 
124
/* background color */
 
125
#define sisSETBGCOLOR(bgColor) \
 
126
   MMIO_OUT32(pSiS->IOBase, BR(5), (bgColor));
 
127
#if 0
 
128
  *(volatile unsigned int *)(pSiS->IOBase + BR(5)) = (bgColor)
 
129
#endif
 
130
 
 
131
/* foreground color */
 
132
#define sisSETFGCOLOR(fgColor) \
 
133
   MMIO_OUT32(pSiS->IOBase, BR(4), (fgcolor));
 
134
#if 0
 
135
  *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = (fgColor)
 
136
#endif
 
137
 
 
138
/* ROP */
 
139
#define sisSETROPFG(op) \
 
140
   MMIO_OUT8(pSiS->IOBase, BR(4) + 3, op);
 
141
#if 0
 
142
  *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = ((*(volatile unsigned int *)(pSiS->IOBase + BR(4)))&0xffffff) | (op<<24)
 
143
#endif
 
144
 
 
145
#define sisSETROPBG(op) \
 
146
  MMIO_OUT8(pSiS->IOBase, BR(5) + 3, op);
 
147
#if 0
 
148
  *(volatile unsigned int *)(pSiS->IOBase + BR(5)) = ((*(volatile unsigned int *)(pSiS->IOBase + BR(5)))&0xffffff) | (op<<24)
 
149
#endif
 
150
 
 
151
#define sisSETROP(op) \
 
152
   sisSETROPFG(op); sisSETROPBG(op);
 
153
 
 
154
/* source and dest address */
 
155
#define sisSETSRCADDR(srcAddr) \
 
156
  MMIO_OUT32(pSiS->IOBase, BR(0), (srcAddr & 0x3FFFFFL));
 
157
#if 0
 
158
  *(volatile unsigned int *)(pSiS->IOBase + BR(0)) = srcAddr & 0x3FFFFFL
 
159
#endif
 
160
 
 
161
#define sisSETDSTADDR(dstAddr) \
 
162
  MMIO_OUT32(pSiS->IOBase, BR(1), (dstAddr & 0x3FFFFFL));
 
163
#if 0
 
164
  *(volatile unsigned int *)(pSiS->IOBase + BR(1)) = dstAddr & 0x3FFFFFL
 
165
#endif
 
166
 
 
167
/* pitch */
 
168
#define sisSETPITCH(srcPitch,dstPitch) \
 
169
  MMIO_OUT32(pSiS->IOBase, BR(2), ((((dstPitch) & 0xFFFF) << 16) | ((srcPitch) & 0xFFFF)));
 
170
#if 0
 
171
  *(volatile unsigned int *)(pSiS->IOBase + BR(2)) = ((dstPitch&0xFFFF)<<16)| \
 
172
      (srcPitch&0xFFFF)
 
173
#endif
 
174
 
 
175
#define sisSETSRCPITCH(srcPitch) \
 
176
  MMIO_OUT16(pSiS->IOBase, BR(2), ((srcPitch) & 0xFFFF));
 
177
 
 
178
#define sisSETDSTPITCH(dstPitch) \
 
179
  MMIO_OUT16(pSiS->IOBase, BR(2) + 2, ((dstPitch) & 0xFFFF));
 
180
 
 
181
/* Height and width
 
182
 * According to SIS 2D Engine Programming Guide
 
183
 * height -1, width - 1 independant of Bpp
 
184
 */
 
185
#define sisSETHEIGHTWIDTH(Height, Width) \
 
186
  MMIO_OUT32(pSiS->IOBase, BR(3), ((((Height) & 0xFFFF) << 16) | ((Width) & 0xFFFF)));
 
187
#if 0
 
188
  *(volatile unsigned int *)(pSiS->IOBase + BR(3)) = (((Height)&0xFFFF)<<16)| \
 
189
      ((Width)&0xFFFF)
 
190
#endif
 
191
 
 
192
/* Clipping */
 
193
#define sisSETCLIPTOP(x, y) \
 
194
   MMIO_OUT32(pSiS->IOBase, BR(8), ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF)));
 
195
#if 0
 
196
  *(volatile unsigned int *)(pSiS->IOBase + BR(8)) = (((y)&0xFFFF)<<16)| \
 
197
      ((x)&0xFFFF)
 
198
#endif
 
199
 
 
200
#define sisSETCLIPBOTTOM(x, y) \
 
201
   MMIO_OUT32(pSiS->IOBase, BR(9), ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF)));
 
202
#if 0
 
203
  *(volatile unsigned int *)(pSiS->IOBase + BR(9)) = (((y)&0xFFFF)<<16)| \
 
204
      ((x)&0xFFFF)
 
205
#endif
 
206
 
 
207
/* Line drawing */
 
208
#define sisSETXStart(XStart) \
 
209
  MMIO_OUT32(pSiS->IOBase, BR(0), ((XStart) & 0xFFFF));
 
210
#if 0
 
211
  *(volatile unsigned int *)(pSiS->IOBase + BR(0)) = XStart&0xFFFF
 
212
#endif
 
213
 
 
214
#define sisSETYStart(YStart) \
 
215
  MMIO_OUT32(pSiS->IOBase, BR(1), ((YStart) & 0xFFFF));
 
216
#if 0
 
217
  *(volatile unsigned int *)(pSiS->IOBase + BR(1)) = YStart&0xFFFF
 
218
#endif
 
219
 
 
220
#define sisSETLineMajorCount(MajorAxisCount) \
 
221
   MMIO_OUT32(pSiS->IOBase, BR(3), ((MajorAxisCount) & 0xFFFF));
 
222
#if 0
 
223
  *(volatile unsigned int *)(pSiS->IOBase + BR(3)) = MajorAxisCount&0xFFFF
 
224
#endif
 
225
 
 
226
#define sisSETLineSteps(K1,K2) \
 
227
   MMIO_OUT32(pSiS->IOBase, BR(6), ((((K1) & 0xFFFF) << 16) | ((K2) & 0xFFFF)));
 
228
#if 0
 
229
  *(volatile unsigned int *)(pSiS->IOBase + BR(6)) = (((K1)&0xFFFF)<<16)| \
 
230
      ((K2)&0xFFFF)
 
231
#endif
 
232
 
 
233
#define sisSETLineErrorTerm(ErrorTerm) \
 
234
   MMIO_OUT16(pSiS->IOBase, BR(7), (ErrorTerm));
 
235
#if 0
 
236
  *(volatile unsigned short *)(pSiS->IOBase + BR(7)) = ErrorTerm
 
237
#endif