nsc.h revision 71d7fec4
1/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc.h,v 1.5tsi Exp $ */
2/*
3 * $Workfile: nsc.h $
4 * $Revision: 1.1.1.1 $
5 * $Author: mrg $
6 *
7 * File Contents: This file contains the data structures Geode driver.
8 *
9 * Project:       Geode Xfree Frame buffer device driver.
10 *
11 */
12
13/*
14 * NSC_LIC_ALTERNATIVE_PREAMBLE
15 *
16 * Revision 1.0
17 *
18 * National Semiconductor Alternative GPL-BSD License
19 *
20 * National Semiconductor Corporation licenses this software
21 * ("Software"):
22 *
23 * National Xfree frame buffer driver
24 *
25 * under one of the two following licenses, depending on how the
26 * Software is received by the Licensee.
27 *
28 * If this Software is received as part of the Linux Framebuffer or
29 * other GPL licensed software, then the GPL license designated
30 * NSC_LIC_GPL applies to this Software; in all other circumstances
31 * then the BSD-style license designated NSC_LIC_BSD shall apply.
32 *
33 * END_NSC_LIC_ALTERNATIVE_PREAMBLE */
34
35/* NSC_LIC_BSD
36 *
37 * National Semiconductor Corporation Open Source License for
38 *
39 * National Xfree frame buffer driver
40 *
41 * (BSD License with Export Notice)
42 *
43 * Copyright (c) 1999-2001
44 * National Semiconductor Corporation.
45 * All rights reserved.
46 *
47 * Redistribution and use in source and binary forms, with or without
48 * modification, are permitted provided that the following conditions
49 * are met:
50 *
51 *   * Redistributions of source code must retain the above copyright
52 *     notice, this list of conditions and the following disclaimer.
53 *
54 *   * Redistributions in binary form must reproduce the above
55 *     copyright notice, this list of conditions and the following
56 *     disclaimer in the documentation and/or other materials provided
57 *     with the distribution.
58 *
59 *   * Neither the name of the National Semiconductor Corporation nor
60 *     the names of its contributors may be used to endorse or promote
61 *     products derived from this software without specific prior
62 *     written permission.
63 *
64 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
65 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
66 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
67 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
68 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
69 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
70 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
71 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
72 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
73 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
74 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
75 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
76 * OF SUCH DAMAGE.
77 *
78 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
79 * YOUR JURISDICTION. It is licensee's responsibility to comply with
80 * any export regulations applicable in licensee's jurisdiction. Under
81 * CURRENT (2001) U.S. export regulations this software
82 * is eligible for export from the U.S. and can be downloaded by or
83 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
84 * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
85 * Syria, Sudan, Afghanistan and any other country to which the U.S.
86 * has embargoed goods and services.
87 *
88 * END_NSC_LIC_BSD */
89
90/* NSC_LIC_GPL
91 *
92 * National Semiconductor Corporation Gnu General Public License for
93 *
94 * Geode Xfree frame buffer driver
95 *
96 * (GPL License with Export Notice)
97 *
98 * Copyright (c) 1999-2001
99 * National Semiconductor Corporation.
100 * All rights reserved.
101 *
102 * Redistribution and use in source and binary forms, with or without
103 * modification, are permitted under the terms of the GNU General
104 * Public License as published by the Free Software Foundation; either
105 * version 2 of the License, or (at your option) any later version
106 *
107 * In addition to the terms of the GNU General Public License, neither
108 * the name of the National Semiconductor Corporation nor the names of
109 * its contributors may be used to endorse or promote products derived
110 * from this software without specific prior written permission.
111 *
112 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
113 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
114 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
115 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
116 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
117 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
118 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
119 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
120 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
121 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
122 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
123 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
124 * OF SUCH DAMAGE. See the GNU General Public License for more details.
125 *
126 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
127 * YOUR JURISDICTION. It is licensee's responsibility to comply with
128 * any export regulations applicable in licensee's jurisdiction. Under
129 * CURRENT (2001) U.S. export regulations this software
130 * is eligible for export from the U.S. and can be downloaded by or
131 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
132 * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
133 * Syria, Sudan, Afghanistan and any other country to which the U.S.
134 * has embargoed goods and services.
135 *
136 * You should have received a copy of the GNU General Public License
137 * along with this file; if not, write to the Free Software Foundation,
138 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
139 *
140 * END_NSC_LIC_GPL */
141
142#ifndef _NSC_GEODE_H_
143#define _NSC_GEODE_H_
144
145#include <string.h>
146#include <stdio.h>
147
148#include "xaa.h"
149#include "xf86Cursor.h"
150#if !defined(STB_X)
151#include "vgaHW.h"
152#endif
153#include "xf86int10.h"
154#include "xf86xv.h"
155
156#if defined(STB_X)
157#define GFX(func) Gal_##func
158#define GFX2(func) Gal2_##func
159#define OPTACCEL(func) func
160#else /* STB_X */
161#define GFX(func) gfx_##func
162#define GFX2(func) gfx2_##func
163
164#if defined(OPT_ACCEL)
165#define OPTACCEL(func) OPT##func
166#else /* OPT_ACCEL */
167#define OPTACCEL(func) func
168#endif /* OPT_ACCEL */
169
170#endif /* STB_X */
171
172#define GEODEPTR(p) ((GeodePtr)((p)->driverPrivate))
173
174#define DebugPort(_Val) gfx_outb(0x84, (_Val));
175
176#define DEFAULT_NUM_OF_BUF 20		/* default # of buffers */
177
178#if defined(MYDBG)
179#define DEBUGMSG(cond, drv_msg) if((cond)) xf86DrvMsg drv_msg
180#else
181#define DEBUGMSG(cond, drv_msg)
182#endif
183
184/* Overlay Transparency Key */
185#define TRANSPARENCY_KEY 255
186
187#if defined(EXTERN)
188unsigned char DCount = 0;
189
190#if defined(STB_X)
191void
192gfx_outb(unsigned short port, unsigned char data)
193{
194   __asm__ volatile ("outb %0,%1"::"a" (data), "d"(port));
195}
196#endif
197#else
198extern unsigned char DCount;
199
200#if defined(STB_X)
201extern void gfx_outb(unsigned short port, unsigned char data);
202extern unsigned char gfx_inb(unsigned short port);
203#endif
204#endif
205
206#if defined(STB_X)
207#include "nsc_galproto.h"
208#else
209extern void gfx_write_reg32(int offset, int data);
210extern void gfx_write_reg16(int offset, short data);
211extern void gfx_write_reg8(int offset, char data);
212extern int gfx_read_reg32(int offset);
213extern short gfx_read_reg16(int offset);
214extern void gfx_write_vid32(int offset, int data);
215extern int gfx_read_vid32(int offset);
216extern unsigned char gfx_inb(unsigned short port);
217extern void gfx_outb(unsigned short port, unsigned char data);
218extern unsigned short gfx_inw(unsigned short port);
219extern void gfx_outw(unsigned short port, unsigned short data);
220extern unsigned long gfx_ind(unsigned short port);
221extern void gfx_outd(unsigned short port, unsigned long data);
222
223#include "gfx_rtns.h"
224#include "gfx_defs.h"
225#include "gfx_regs.h"
226#include "panel.h"
227
228typedef struct __TVPARAMS
229{
230   unsigned int dwFlags;
231   unsigned short wWidth;
232   unsigned short wHeight;
233   unsigned short wStandard;
234   unsigned short wType;
235   unsigned short wOutput;
236   unsigned short wResolution;
237   Bool bState;
238}
239TVPARAMS, *PTVPARAMS;
240
241typedef struct __DISPLAYTIMING
242{
243   unsigned int dwDotClock;
244   unsigned short wPitch;
245   unsigned short wBpp;
246   unsigned short wHTotal;
247   unsigned short wHActive;
248   unsigned short wHSyncStart;
249   unsigned short wHSyncEnd;
250   unsigned short wHBlankStart;
251   unsigned short wHBlankEnd;
252   unsigned short wVTotal;
253   unsigned short wVActive;
254   unsigned short wVSyncStart;
255   unsigned short wVSyncEnd;
256   unsigned short wVBlankStart;
257   unsigned short wVBlankEnd;
258   unsigned short wPolarity;
259}
260DISPLAYTIMING, *PDISPLAYTIMING;
261
262/* TV Timings */
263typedef struct __TVTIMING
264{
265   unsigned long HorzTim;
266   unsigned long HorzSync;
267   unsigned long VertSync;
268   unsigned long LineEnd;
269   unsigned long VertDownscale;
270   unsigned long HorzScaling;
271   unsigned long TimCtrl1;
272   unsigned long TimCtrl2;
273   unsigned long Subfreq;
274   unsigned long DispPos;
275   unsigned long DispSize;
276   unsigned long Debug;
277   unsigned long DacCtrl;
278   unsigned int DotClock;
279}
280TVTIMING, *PTVTIMING;
281
282#endif /* STB_X */
283
284typedef struct _VESARec
285{
286   xf86Int10InfoPtr pInt;
287}
288VESARec, *VESAPtr;
289
290typedef struct
291{
292   /* Private struct for the server */
293   unsigned long cpu_version;		/* [7:0] Type:1=GXLV,2=SC1400 */
294   /* [15:8] Major version */
295   /* [23:16] Minor version */
296   unsigned long vid_version;		/* [7:0] Type:1=CS5530,2=SC1400 */
297
298   EntityInfoPtr pEnt;
299   ScreenBlockHandlerProcPtr BlockHandler;	/* needed for video */
300   int DetectedChipSet;
301   int Chipset;
302   unsigned long FBLinearAddr;
303   unsigned char *FBBase;
304   unsigned long FBSize;
305   unsigned int cpu_reg_size;
306   unsigned int gp_reg_size;
307   unsigned int vid_reg_size;
308   int Pitch;
309   Bool HWCursor;
310   Bool NoAccel;
311   unsigned long VideoKey;
312
313   Bool TVSupport;
314#if defined(STB_X)
315   GAL_TVPARAMS TvParam;
316#else
317   TVPARAMS TvParam;
318#endif					/* STB_X */
319
320   int TVOx, TVOy, TVOw, TVOh;
321   Bool TV_Overscan_On;
322
323   Bool Panel;
324
325   /* Flatpanel support from Bios */
326   int FPBX;				/* xres */
327   int FPBY;				/* yres */
328   int FPBB;				/* bpp */
329   int FPBF;				/* freq */
330
331   int Rotate;
332   Bool ShadowFB;
333   unsigned char *ShadowPtr;
334   int ShadowPitch;
335   void (*PointerMoved) (int index, int x, int y);
336   /* CloseScreen function.        */
337   CloseScreenProcPtr CloseScreen;
338
339   Bool Compression;
340   unsigned int CBOffset;
341   unsigned int CBPitch;
342   unsigned int CBSize;
343   unsigned long CursorStartOffset;
344   unsigned int CursorSize;
345   xf86CursorInfoPtr CursorInfo;
346   int CursorXHot;
347   int CursorYHot;
348   unsigned long OffscreenStartOffset;
349   unsigned int OffscreenSize;
350
351	/***Image Write structures ***/
352
353   /* offset in video memory for ImageWrite Buffers */
354   unsigned char **AccelImageWriteBufferOffsets;
355   int NoOfImgBuffers;
356   FBAreaPtr CompressionArea;
357   FBAreaPtr AccelImgArea;
358/*****************************************/
359/* Saved Console State */
360#if defined(STB_X)
361   GAL_VGAMODEDATA FBgfxVgaRegs;
362   GAL_DISPLAYTIMING FBgfxdisplaytiming;
363   GAL_TVTIMING FBgfxtvtiming;
364#else
365   gfx_vga_struct FBgfxVgaRegs;
366   DISPLAYTIMING FBgfxdisplaytiming;
367   TVTIMING FBtvtiming;
368#endif					/* STB_X */
369   int FBVGAActive;
370   unsigned int FBTVActive;
371   unsigned int FBTVEnabled;
372   unsigned long FBDisplayOffset;
373
374   VESAPtr vesa;
375
376   /* compression */
377   int FBCompressionEnable;
378   unsigned long FBCompressionOffset;
379   unsigned short FBCompressionPitch;
380   unsigned short FBCompressionSize;
381
382   /* Save the Cursor offset of the FB */
383   unsigned long FBCursorOffset;
384/*****************************************/
385
386   XAAInfoRecPtr AccelInfoRec;
387
388   DGAModePtr DGAModes;
389   int numDGAModes;
390   Bool DGAactive;
391   int DGAViewportStatus;
392/*****************************************/
393   int video_x;
394   int video_y;
395   short video_w;
396   short video_h;
397   short video_srcw;
398   short video_srch;
399   short video_dstw;
400   short video_dsth;
401   int video_id;
402   int video_offset;
403   ScrnInfoPtr video_scrnptr;
404   BOOL OverlayON;
405
406   int videoKey;
407   XF86VideoAdaptorPtr adaptor;
408   int OverlaySkewX;
409   int OverlaySkewY;
410   int VideoZoomMax;
411}
412GeodeRec, *GeodePtr;
413
414/* option flags are self-explanatory */
415typedef enum
416{
417   OPTION_SW_CURSOR,
418   OPTION_HW_CURSOR,
419   OPTION_NOCOMPRESSION,
420   OPTION_NOACCEL,
421   OPTION_TV_SUPPORT,
422   OPTION_TV_OUTPUT,
423   OPTION_TV_OVERSCAN,
424   OPTION_SHADOW_FB,
425   OPTION_ROTATE,
426   OPTION_FLATPANEL,
427   OPTION_FLATPANEL_INFO,
428   OPTION_FLATPANEL_IN_BIOS,
429   OPTION_COLOR_KEY,
430   OPTION_OSM,
431   OPTION_OSM_IMG_BUFS,
432   OPTION_DONT_PROGRAM
433}
434GeodeOpts;
435
436#endif /* _NSC_GEODE_H_ */
437