summaryrefslogtreecommitdiff
path: root/src/ast.h
blob: 0757e644e8c53bd17ed3c878b32b3b7416c12962 (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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/*
 * Copyright (c) 2005 ASPEED Technology Inc.
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of the authors not be used in
 * advertising or publicity pertaining to distribution of the software without
 * specific, written prior permission.  The authors makes no representations
 * about the suitability of this software for any purpose.  It is provided
 * "as is" without express or implied warranty.
 *
 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 */

#include <string.h>
#include <stdlib.h>

#include "ast_pcirename.h"

/* Compiler Options */
#define	Accel_2D
/* #define MMIO_2D */
#define HWC
/* #define PATCH_ABI_VERSION */

/* Vendor & Device Info */
#ifndef PCI_VENDOR_AST
#define PCI_VENDOR_AST			0x1A03	
#endif	

#ifndef	PCI_CHIP_AST2000
#define PCI_CHIP_AST2000		0x2000		
#endif

#ifndef	PCI_CHIP_AST2100
#define PCI_CHIP_AST2100		0x2010
#endif

typedef enum _CHIP_ID {
    VGALegacy,
    AST2000,
    AST2100,
    AST1100,
    AST2200,
    AST2150
} CHIP_ID;

/* AST REC Info */
#define AST_NAME 			"AST"
#define AST_DRIVER_NAME 		"ast"
#define AST_MAJOR_VERSION 		PACKAGE_VERSION_MAJOR
#define AST_MINOR_VERSION 		PACKAGE_VERSION_MINOR
#define AST_PATCH_VERSION		PACKAGE_VERSION_PATCHLEVEL
#define AST_VERSION	\
        ((AST_MAJOR_VERSION << 20) | (AST_MINOR_VERSION << 10) | AST_PATCH_VERSION)

/* Customized Info */
#define DEFAULT_VIDEOMEM_SIZE		0x00800000
#define DEFAULT_MMIO_SIZE		0x00020000
#define DEFAULT_CMDQ_SIZE		0x00100000
#define MIN_CMDQ_SIZE			0x00040000
#define CMD_QUEUE_GUARD_BAND    	0x00000020
#define DEFAULT_HWC_NUM			0x00000002

/* Patch Info */
#define ABI_VIDEODRV_VERSION_PATCH	SET_ABI_VERSION(0, 5)

/* Data Type Definition */
typedef INT32  		LONG;
typedef CARD8   	UCHAR;
typedef CARD16  	USHORT;
typedef CARD32  	ULONG;

/* Data Structure Definition */
typedef struct _ASTRegRec {
    UCHAR 	ExtCRTC[0x50];
    
} ASTRegRec, *ASTRegPtr;

typedef struct _VIDEOMODE {

    int			ScreenWidth;
    int			ScreenHeight;
    int			bitsPerPixel;
    int			ScreenPitch;
    	
} VIDEOMODE, *PVIDEOMODE;

typedef struct {

    ULONG		ulCMDQSize;
    ULONG		ulCMDQType;
    
    ULONG		ulCMDQOffsetAddr;
    UCHAR       	*pjCMDQVirtualAddr;
    
    UCHAR       	*pjCmdQBasePort;
    UCHAR       	*pjWritePort;    
    UCHAR       	*pjReadPort;     
    UCHAR       	*pjEngStatePort;
          
    ULONG		ulCMDQMask;
    ULONG		ulCurCMDQueueLen;
                
    ULONG		ulWritePointer;
    ULONG		ulReadPointer;
    
    ULONG		ulReadPointer_OK;		/* for Eng_DBGChk */
    
} CMDQINFO, *PCMDQINFO;

typedef struct {

    int			HWC_NUM;
    int			HWC_NUM_Next;

    ULONG		ulHWCOffsetAddr;
    UCHAR       	*pjHWCVirtualAddr;
    
    USHORT		cursortype;
    USHORT		width;
    USHORT   		height;   
    USHORT		offset_x;
    USHORT   		offset_y;
    ULONG		fg;
    ULONG		bg;

    UCHAR               cursorpattern[1024];    
        
} HWCINFO, *PHWCINFO;

typedef struct _ASTRec {
	
    EntityInfoPtr 	pEnt;
#ifndef XSERVER_LIBPCIACCESS	
	pciVideoPtr		PciInfo;
	PCITAG			PciTag;
#else
	struct pci_device       *PciInfo;
#endif

    OptionInfoPtr 	Options;
    DisplayModePtr      ModePtr;		    
    FBLinearPtr 	pCMDQPtr;    
    XAAInfoRecPtr	AccelInfoPtr;
    xf86CursorInfoPtr   HWCInfoPtr;
    FBLinearPtr 	pHWCPtr;    

    CloseScreenProcPtr CloseScreen;
    ScreenBlockHandlerProcPtr BlockHandler;

    UCHAR		jChipType;
    UCHAR		jDRAMType;
             
    Bool 		noAccel;
    Bool 		noHWC;
    Bool 		MMIO2D;
    int			ENGCaps;
    int			DBGSelect;
    Bool		VGA2Clone;
              	
    ULONG     		FBPhysAddr;		/* Frame buffer physical address     */
    ULONG     		MMIOPhysAddr;     	/* MMIO region physical address      */
    ULONG     		BIOSPhysAddr;     	/* BIOS physical address             */
    
    UCHAR     		*FBVirtualAddr;   	/* Map of frame buffer               */
    UCHAR     		*MMIOVirtualAddr; 	/* Map of MMIO region                */

    unsigned long	FbMapSize;
    unsigned long	MMIOMapSize;
       
    IOADDRESS		IODBase;        	/* Base of PIO memory area */
    IOADDRESS		PIOOffset;
    IOADDRESS		RelocateIO;
    
    VIDEOMODE 		VideoModeInfo;
    ASTRegRec           SavedReg;
    CMDQINFO		CMDQInfo;
    HWCINFO    		HWCInfo;
    ULONG		ulCMDReg;   
    Bool		EnableClip;

    int			clip_left;    
    int			clip_top;
    int			clip_right;    
    int			clip_bottom;    	
   		
} ASTRec, *ASTRecPtr;
	
#define ASTPTR(p) ((ASTRecPtr)((p)->driverPrivate))

/* Include Files */
#include "ast_mode.h"
#include "ast_vgatool.h"
#include "ast_2dtool.h"
#include "ast_cursor.h"