ast.h revision de78e416
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
23#include <string.h>
24#include <stdlib.h>
25
26#include "ast_pcirename.h"
27
28/* Compiler Options */
29#define	Accel_2D
30/* #define MMIO_2D */
31#define HWC
32/* #define PATCH_ABI_VERSION */
33
34/* Vendor & Device Info */
35#ifndef PCI_VENDOR_AST
36#define PCI_VENDOR_AST			0x1A03
37#endif
38
39#ifndef	PCI_CHIP_AST2000
40#define PCI_CHIP_AST2000		0x2000
41#endif
42
43#ifndef	PCI_CHIP_AST2100
44#define PCI_CHIP_AST2100		0x2010
45#endif
46
47typedef enum _CHIP_ID {
48    VGALegacy,
49    AST2000,
50    AST2100,
51    AST1100,
52    AST2200,
53    AST2150
54} CHIP_ID;
55
56/* AST REC Info */
57#define AST_NAME 			"AST"
58#define AST_DRIVER_NAME 		"ast"
59#define AST_MAJOR_VERSION 		PACKAGE_VERSION_MAJOR
60#define AST_MINOR_VERSION 		PACKAGE_VERSION_MINOR
61#define AST_PATCH_VERSION		PACKAGE_VERSION_PATCHLEVEL
62#define AST_VERSION	\
63        ((AST_MAJOR_VERSION << 20) | (AST_MINOR_VERSION << 10) | AST_PATCH_VERSION)
64
65/* Customized Info */
66#define DEFAULT_VIDEOMEM_SIZE		0x00800000
67#define DEFAULT_MMIO_SIZE		0x00020000
68#define DEFAULT_CMDQ_SIZE		0x00100000
69#define MIN_CMDQ_SIZE			0x00040000
70#define CMD_QUEUE_GUARD_BAND    	0x00000020
71#define DEFAULT_HWC_NUM			0x00000002
72
73/* Patch Info */
74#define ABI_VIDEODRV_VERSION_PATCH	SET_ABI_VERSION(0, 5)
75
76/* Data Type Definition */
77typedef INT32  		LONG;
78typedef CARD8   	UCHAR;
79typedef CARD16  	USHORT;
80typedef CARD32  	ULONG;
81
82/* Data Structure Definition */
83typedef struct _ASTRegRec {
84    UCHAR 	ExtCRTC[0x50];
85
86} ASTRegRec, *ASTRegPtr;
87
88typedef struct _VIDEOMODE {
89
90    int			ScreenWidth;
91    int			ScreenHeight;
92    int			bitsPerPixel;
93    int			ScreenPitch;
94
95} VIDEOMODE, *PVIDEOMODE;
96
97typedef struct {
98
99    ULONG		ulCMDQSize;
100    ULONG		ulCMDQType;
101
102    ULONG		ulCMDQOffsetAddr;
103    UCHAR       	*pjCMDQVirtualAddr;
104
105    UCHAR       	*pjCmdQBasePort;
106    UCHAR       	*pjWritePort;
107    UCHAR       	*pjReadPort;
108    UCHAR       	*pjEngStatePort;
109
110    ULONG		ulCMDQMask;
111    ULONG		ulCurCMDQueueLen;
112
113    ULONG		ulWritePointer;
114    ULONG		ulReadPointer;
115
116    ULONG		ulReadPointer_OK;		/* for Eng_DBGChk */
117
118} CMDQINFO, *PCMDQINFO;
119
120typedef struct {
121
122    int			HWC_NUM;
123    int			HWC_NUM_Next;
124
125    ULONG		ulHWCOffsetAddr;
126    UCHAR       	*pjHWCVirtualAddr;
127
128    USHORT		cursortype;
129    USHORT		width;
130    USHORT   		height;
131    USHORT		offset_x;
132    USHORT   		offset_y;
133    ULONG		fg;
134    ULONG		bg;
135
136    UCHAR               cursorpattern[1024];
137
138} HWCINFO, *PHWCINFO;
139
140typedef struct _ASTRec {
141
142    EntityInfoPtr 	pEnt;
143#ifndef XSERVER_LIBPCIACCESS
144	pciVideoPtr		PciInfo;
145	PCITAG			PciTag;
146#else
147	struct pci_device       *PciInfo;
148#endif
149
150    OptionInfoPtr 	Options;
151    DisplayModePtr      ModePtr;
152    FBLinearPtr 	pCMDQPtr;
153    XAAInfoRecPtr	AccelInfoPtr;
154    xf86CursorInfoPtr   HWCInfoPtr;
155    FBLinearPtr 	pHWCPtr;
156
157    CloseScreenProcPtr CloseScreen;
158    ScreenBlockHandlerProcPtr BlockHandler;
159
160    UCHAR		jChipType;
161    UCHAR		jDRAMType;
162
163    Bool 		noAccel;
164    Bool 		noHWC;
165    Bool 		MMIO2D;
166    int			ENGCaps;
167    int			DBGSelect;
168    Bool		VGA2Clone;
169
170    ULONG     		FBPhysAddr;		/* Frame buffer physical address     */
171    ULONG     		MMIOPhysAddr;     	/* MMIO region physical address      */
172    ULONG     		BIOSPhysAddr;     	/* BIOS physical address             */
173
174    UCHAR     		*FBVirtualAddr;   	/* Map of frame buffer               */
175    UCHAR     		*MMIOVirtualAddr; 	/* Map of MMIO region                */
176
177    unsigned long	FbMapSize;
178    unsigned long	MMIOMapSize;
179
180    IOADDRESS		IODBase;        	/* Base of PIO memory area */
181    IOADDRESS		PIOOffset;
182    IOADDRESS		RelocateIO;
183
184    VIDEOMODE 		VideoModeInfo;
185    ASTRegRec           SavedReg;
186    CMDQINFO		CMDQInfo;
187    HWCINFO    		HWCInfo;
188    ULONG		ulCMDReg;
189    Bool		EnableClip;
190
191    int			clip_left;
192    int			clip_top;
193    int			clip_right;
194    int			clip_bottom;
195
196} ASTRec, *ASTRecPtr;
197
198#define ASTPTR(p) ((ASTRecPtr)((p)->driverPrivate))
199
200/* Include Files */
201#include "ast_mode.h"
202#include "ast_vgatool.h"
203#include "ast_2dtool.h"
204#include "ast_cursor.h"
205