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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
/*
* Copyright (c) 2006 Advanced Micro Devices, Inc.
*
* 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS 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.
*
* Neither the name of the Advanced Micro Devices, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*/
/*
* Base include file for the Cimarron library. This file should be modified
* and included in any Cimarron-based project.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/*----------------------------------------------------------------------*/
/* MODULE SETTINGS */
/* The following #defines affect which modules are included in the */
/* project. */
/*----------------------------------------------------------------------*/
#define CIMARRON_INCLUDE_GP 1
#define CIMARRON_INCLUDE_VG 1
#define CIMARRON_INCLUDE_VIP 1
#define CIMARRON_INCLUDE_VOP 1
#define CIMARRON_INCLUDE_VIDEO 1
#define CIMARRON_INCLUDE_INIT 1
#define CIMARRON_INCLUDE_VG_READ_ROUTINES 1
#define CIMARRON_INCLUDE_DF_READ_ROUTINES 1
#define CIMARRON_INCLUDE_VIP_READ_ROUTINES 1
#define CIMARRON_INCLUDE_VOP_READ_ROUTINES 1
/*----------------------------------------------------------------------*/
/* HARDWARE ACCESS SETTINGS */
/* The following #defines affect how the Cimarron macros access the */
/* hardware. The hardware access macros are broken up into groups. */
/* Each group includes an enabling #define as well as several #define */
/* options that modify the macro configuration that is included. */
/* If the enabling define is deleted or all options are set to 0, the */
/* corresponding macros must be implemented by the user. The */
/* combinations are explained as follows: */
/* must be manually defined by the user. This allows a user to use the */
/* cim_defs.h file for only those macros that suit the needs of his/her */
/* project. For example, a user may need custom implementations of the */
/* I/O and MSR macros, but may still want to use the default macros to */
/* read and write hardware registers. The combinations are explained as */
/* follows: */
/* */
/* Register Group: */
/* Disabling define: */
/* CIMARRON_EXCLUDE_REGISTER_ACCESS_MACROS */
/* Define this setting to exclude the register access macros. */
/* This setting is the inverse of the other group settings in */
/* that these macros are included by default. This allows the */
/* cim_defs.h file to be included outside of cimarron.c for */
/* basic operations. */
/* */
/* Memory Group: */
/* Enabling define: */
/* CIMARRON_INCLUDE_STRING_MACROS */
/* Options: */
/* CIMARRON_OPTIMIZE_ASSEMBLY */
/* Set to 1 to allow the use of inline assembly when writing */
/* large chunks of data to memory. Essentially, this allows */
/* a rep movsd in place of a slower C for-loop. */
/* CIMARRON_OPTIMIZE_FORLOOP */
/* Define for C only data writes. */
/* */
/* MSR Group: */
/* Enabling define: */
/* CIMARRON_INCLUDE_MSR_MACROS */
/* Options: */
/* CIMARRON_MSR_DIRECT_ASM */
/* Set to 1 to allow the use of the rdmsr and wrmsr opcodes in */
/* inline assembly. */
/* CIMARRON_MSR_VSA_IO */
/* Set to 1 to access MSRs using a VSAII virtual register. */
/* CIMARRON_MSR_KERNEL_ROUTINE */
/* Set to 1 to access MSRs using a wrapper routine in the */
/* Linux kernel. */
/* */
/* IO Group: */
/* Enabling define: */
/* CIMARRON_INCLUDE_IO_MACROS */
/* Options: */
/* CIMARRON_IO_DIRECT_ACCESS */
/* Set to 1 to perform IO accesses using inline assembly. */
/* CIMARRON_IO_ABSTRACTED_ASM */
/* Set to 1 to perform IO using abstracted IO in Linux. */
/* */
/* Custom Group: */
/* Disabling define: */
/* CIMARRON_EXCLUDE_CUSTOM_MACROS */
/* By default, the custom macros (the macros used by */
/* gp_custom_convert_blt) are mapped to the normal command */
/* string macros. Setting this to 1 allows the user to */
/* create a custom implementation. */
/*----------------------------------------------------------------------*/
/* UNCOMMENT THE FOLLOWING LINE TO EXCLUDE BASIC REGISTER ACCESS MACROS */
/* #define CIMARRON_EXCLUDE_REGISTER_ACCESS_MACROS */
#define CIMARRON_INCLUDE_STRING_MACROS
#define CIMARRON_OPTIMIZE_ASSEMBLY 0
#define CIMARRON_OPTIMIZE_FORLOOP 0
#define CIMARRON_OPTIMIZE_ABSTRACTED_ASM 1
#define CIMARRON_INCLUDE_MSR_MACROS
#define CIMARRON_MSR_DIRECT_ASM 0
#define CIMARRON_MSR_VSA_IO 0
#define CIMARRON_MSR_ABSTRACTED_ASM 0
#define CIMARRON_MSR_KERNEL_ROUTINE 0
#define CIMARRON_MSR_HOOKS 1
#define CIMARRON_INCLUDE_IO_MACROS
#define CIMARRON_IO_DIRECT_ACCESS 0
#define CIMARRON_IO_ABSTRACTED_ASM 1
/*
* UNCOMMENT THE FOLLOWING LINE TO IMPLEMENT CUSTOM MACROS FOR
* GP_CUSTOM_CONVERT_BLT
*/
/* #define CIMARRON_EXCLUDE_CUSTOM_MACROS */
/*----------------------------------------------------------------------*/
/* MODULE VARIABLES */
/* The following #defines affect how global variables in each Cimarron */
/* module are defined. These variables can be made static (to prevent */
/* naming conflicts) or they can be defined without the static keyword */
/* (to allow extern references). */
/*----------------------------------------------------------------------*/
#if 1
#define CIMARRON_STATIC static
#else
#define CIMARRON_STATIC
#endif
/*----------------------------------------------------------------------*/
/* CIMARRON GLOBAL VARIABLES */
/* These globals are used by the hardware access macros. They must be */
/* initialized by the application to point to the memory-mapped */
/* registers of their respective blocks. */
/*----------------------------------------------------------------------*/
unsigned char *cim_gp_ptr = (unsigned char *)0;
unsigned char *cim_fb_ptr = (unsigned char *)0;
unsigned char *cim_cmd_base_ptr = (unsigned char *)0;
unsigned char *cim_cmd_ptr = (unsigned char *)0;
unsigned char *cim_vid_ptr = (unsigned char *)0;
unsigned char *cim_vip_ptr = (unsigned char *)0;
unsigned char *cim_vg_ptr = (unsigned char *)0;
/* Define hooks for reading and writing MSRs - this is a major hack
* to share the MSR code with the GX code */
#ifdef CIMARRON_MSR_HOOKS
void (*cim_rdmsr) (unsigned long, unsigned long *, unsigned long *);
void (*cim_wrmsr) (unsigned long, unsigned long, unsigned long);
#endif
/*----------------------------------------------------------------------*/
/* INCLUDE RELEVANT CIMARRON HEADERS */
/*----------------------------------------------------------------------*/
/* HARDWARE REGISTER DEFINITIONS */
#include "cim_regs.h"
/* ROUTINE DEFINITIONS */
/* All routines have a prototype, even those that are not included */
/* via #ifdefs. This prevents the user from having to include the */
/* correct #defines anywhere he/she wants to call a Cimarron routine. */
#include "cim_rtns.h"
/* HARDWARE ACCESS MACROS */
#include "cim_defs.h"
/*----------------------------------------------------------------------*/
/* CIMARRON MODULES */
/* Modules and sub-modules are included based on user settings. Note */
/* that excluding one or more modules may result in functionality */
/* holes. */
/*----------------------------------------------------------------------*/
/* GRAPHICS PROCESSOR */
#if CIMARRON_INCLUDE_GP
#include "cim_gp.c"
#endif
/* VIDEO GENERATOR */
#if CIMARRON_INCLUDE_VG
#include "cim_modes.c"
#include "cim_vg.c"
#endif
/* DISPLAY FILTER */
#if CIMARRON_INCLUDE_VIDEO
#include "cim_filter.c"
#include "cim_df.c"
#endif
/* INITIALIZATION AND DETECTION */
#if CIMARRON_INCLUDE_INIT
#include "cim_init.c"
#endif
/* VIP SUPPORT */
#if CIMARRON_INCLUDE_VIP
#include "cim_vip.c"
#endif
/* VOP SUPPORT */
#if CIMARRON_INCLUDE_VOP
#include "cim_vop.c"
#endif
/* MSR ACCESS */
/* This module is used to access machine-specific registers. */
/* It cannot be excluded from a project. */
#include "cim_msr.c"
|