Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
955 serge 1
/*
2
 * Copyright 2006-2007 Advanced Micro Devices, Inc.
3
 *
4
 * Permission is hereby granted, free of charge, to any person obtaining a
5
 * copy of this software and associated documentation files (the "Software"),
6
 * to deal in the Software without restriction, including without limitation
7
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
 * and/or sell copies of the Software, and to permit persons to whom the
9
 * Software is furnished to do so, subject to the following conditions:
10
 *
11
 * The above copyright notice and this permission notice shall be included in
12
 * all copies or substantial portions of the Software.
13
 *
14
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
 * OTHER DEALINGS IN THE SOFTWARE.
21
 */
22
 
23
/*++
24
 
25
Module Name:
26
 
27
CD_Struct.h
28
 
29
Abstract:
30
 
31
Defines Script Language commands
32
 
33
Revision History:
34
 
35
NEG:26.08.2002	Initiated.
36
--*/
37
 
38
#include "CD_binding.h"
39
#ifndef _CD_STRUCTS_H_
40
#define _CD_STRUCTS_H_
41
 
42
#ifdef		UEFI_BUILD
43
typedef	UINT16**	PTABLE_UNIT_TYPE;
44
typedef	UINTN		TABLE_UNIT_TYPE;
45
#else
46
typedef	UINT16*		PTABLE_UNIT_TYPE;
47
typedef	UINT16		TABLE_UNIT_TYPE;
48
#endif
49
 
50
#include  //This important file is dynamically generated based on the ASIC!!!!
51
 
52
#define PARSER_MAJOR_REVISION 5
53
#define PARSER_MINOR_REVISION 0
54
 
55
//#include "atombios.h"
56
#if (PARSER_TYPE==DRIVER_TYPE_PARSER)
57
#ifdef FGL_LINUX
58
#pragma pack(push,1)
59
#else
60
#pragma pack(push)
61
#pragma pack(1)
62
#endif
63
#endif
64
 
65
#include "CD_Common_Types.h"
66
#include "CD_Opcodes.h"
67
typedef UINT16				WORK_SPACE_SIZE;
68
typedef enum _CD_STATUS{
69
    CD_SUCCESS,
70
    CD_CALL_TABLE,
71
    CD_COMPLETED=0x10,
72
    CD_GENERAL_ERROR=0x80,
73
    CD_INVALID_OPCODE,
74
    CD_NOT_IMPLEMENTED,
75
    CD_EXEC_TABLE_NOT_FOUND,
76
    CD_EXEC_PARAMETER_ERROR,
77
    CD_EXEC_PARSER_ERROR,
78
    CD_INVALID_DESTINATION_TYPE,
79
    CD_UNEXPECTED_BEHAVIOR,
80
    CD_INVALID_SWITCH_OPERAND_SIZE
81
}CD_STATUS;
82
 
83
#define PARSER_STRINGS                  0
84
#define PARSER_DEC                      1
85
#define PARSER_HEX                      2
86
 
87
#define DB_CURRENT_COMMAND_TABLE	0xFF
88
 
89
#define TABLE_FORMAT_BIOS		0
90
#define TABLE_FORMAT_EASF		1
91
 
92
#define EASF_TABLE_INDEX_MASK		0xfc
93
#define EASF_TABLE_ATTR_MASK		0x03
94
 
95
#define CD_ERROR(a)    (((INTN) (a)) > CD_COMPLETED)
96
#define CD_ERROR_OR_COMPLETED(a)    (((INTN) (a)) > CD_SUCCESS)
97
 
98
 
99
#if (BIOS_PARSER==1)
100
#ifdef _H2INC
101
#define STACK_BASED
102
#else
103
extern __segment farstack;
104
#define STACK_BASED __based(farstack)
105
#endif
106
#else
107
#define STACK_BASED
108
#endif
109
 
110
typedef enum _COMPARE_FLAGS{
111
    Below,
112
    Equal,
113
    Above,
114
    NotEqual,
115
    Overflow,
116
    NoCondition
117
}COMPARE_FLAGS;
118
 
119
typedef UINT16 IO_BASE_ADDR;
120
 
121
typedef struct _BUS_DEV_FUNC_PCI_ADDR{
122
    UINT8   Register;
123
    UINT8   Function;
124
    UINT8   Device;
125
    UINT8   Bus;
126
} BUS_DEV_FUNC_PCI_ADDR;
127
 
128
typedef struct _BUS_DEV_FUNC{
129
    UINT8   Function : 3;
130
    UINT8   Device   : 5;
131
    UINT8   Bus;
132
} BUS_DEV_FUNC;
133
 
134
#ifndef	UEFI_BUILD
135
typedef struct _PCI_CONFIG_ACCESS_CF8{
136
    UINT32  Reg     : 8;
137
    UINT32  Func    : 3;
138
    UINT32  Dev     : 5;
139
    UINT32  Bus     : 8;
140
    UINT32  Reserved: 7;
141
    UINT32  Enable  : 1;
142
} PCI_CONFIG_ACCESS_CF8;
143
#endif
144
 
145
typedef enum _MEM_RESOURCE {
146
    Stack_Resource,
147
    FrameBuffer_Resource,
148
    BIOS_Image_Resource
149
}MEM_RESOURCE;
150
 
151
typedef enum _PORTS{
152
    ATI_RegsPort,
153
    PCI_Port,
154
    SystemIO_Port
155
}PORTS;
156
 
157
typedef enum _OPERAND_TYPE {
158
    typeRegister,
159
    typeParamSpace,
160
    typeWorkSpace,
161
    typeFrameBuffer,
162
    typeIndirect,
163
    typeDirect,
164
    typePLL,
165
    typeMC
166
}OPERAND_TYPE;
167
 
168
typedef enum _DESTINATION_OPERAND_TYPE {
169
    destRegister,
170
    destParamSpace,
171
    destWorkSpace,
172
    destFrameBuffer,
173
    destPLL,
174
    destMC
175
}DESTINATION_OPERAND_TYPE;
176
 
177
typedef enum _SOURCE_OPERAND_TYPE {
178
    sourceRegister,
179
    sourceParamSpace,
180
    sourceWorkSpace,
181
    sourceFrameBuffer,
182
    sourceIndirect,
183
    sourceDirect,
184
    sourcePLL,
185
    sourceMC
186
}SOURCE_OPERAND_TYPE;
187
 
188
typedef enum _ALIGNMENT_TYPE {
189
    alignmentDword,
190
    alignmentLowerWord,
191
    alignmentMiddleWord,
192
    alignmentUpperWord,
193
    alignmentByte0,
194
    alignmentByte1,
195
    alignmentByte2,
196
    alignmentByte3
197
}ALIGNMENT_TYPE;
198
 
199
 
200
#define INDIRECT_IO_READ    0
201
#define INDIRECT_IO_WRITE   0x80
202
#define INDIRECT_IO_MM      0
203
#define INDIRECT_IO_PLL     1
204
#define INDIRECT_IO_MC      2
205
 
206
typedef struct _PARAMETERS_TYPE{
207
    UINT8	Destination;
208
    UINT8	Source;
209
}PARAMETERS_TYPE;
210
/* The following structures don't used to allocate any type of objects(variables).
211
   they are serve the only purpose: Get proper access to data(commands), found in the tables*/
212
typedef struct _PA_BYTE_BYTE{
213
    UINT8		PA_Destination;
214
    UINT8		PA_Source;
215
    UINT8		PA_Padding[8];
216
}PA_BYTE_BYTE;
217
typedef struct _PA_BYTE_WORD{
218
    UINT8		PA_Destination;
219
    UINT16		PA_Source;
220
    UINT8		PA_Padding[7];
221
}PA_BYTE_WORD;
222
typedef struct _PA_BYTE_DWORD{
223
    UINT8		PA_Destination;
224
    UINT32		PA_Source;
225
    UINT8		PA_Padding[5];
226
}PA_BYTE_DWORD;
227
typedef struct _PA_WORD_BYTE{
228
    UINT16		PA_Destination;
229
    UINT8		PA_Source;
230
    UINT8		PA_Padding[7];
231
}PA_WORD_BYTE;
232
typedef struct _PA_WORD_WORD{
233
    UINT16		PA_Destination;
234
    UINT16		PA_Source;
235
    UINT8		PA_Padding[6];
236
}PA_WORD_WORD;
237
typedef struct _PA_WORD_DWORD{
238
    UINT16		PA_Destination;
239
    UINT32		PA_Source;
240
    UINT8		PA_Padding[4];
241
}PA_WORD_DWORD;
242
typedef struct _PA_WORD_XX{
243
    UINT16		PA_Destination;
244
    UINT8		PA_Padding[8];
245
}PA_WORD_XX;
246
typedef struct _PA_BYTE_XX{
247
    UINT8		PA_Destination;
248
    UINT8		PA_Padding[9];
249
}PA_BYTE_XX;
250
/*The following 6 definitions used for Mask operation*/
251
typedef struct _PA_BYTE_BYTE_BYTE{
252
    UINT8		PA_Destination;
253
    UINT8		PA_AndMaskByte;
254
    UINT8		PA_OrMaskByte;
255
    UINT8		PA_Padding[7];
256
}PA_BYTE_BYTE_BYTE;
257
typedef struct _PA_BYTE_WORD_WORD{
258
    UINT8		PA_Destination;
259
    UINT16		PA_AndMaskWord;
260
    UINT16		PA_OrMaskWord;
261
    UINT8		PA_Padding[5];
262
}PA_BYTE_WORD_WORD;
263
typedef struct _PA_BYTE_DWORD_DWORD{
264
    UINT8		PA_Destination;
265
    UINT32		PA_AndMaskDword;
266
    UINT32		PA_OrMaskDword;
267
    UINT8		PA_Padding;
268
}PA_BYTE_DWORD_DWORD;
269
typedef struct _PA_WORD_BYTE_BYTE{
270
    UINT16		PA_Destination;
271
    UINT8		PA_AndMaskByte;
272
    UINT8		PA_OrMaskByte;
273
    UINT8		PA_Padding[6];
274
}PA_WORD_BYTE_BYTE;
275
typedef struct _PA_WORD_WORD_WORD{
276
    UINT16		PA_Destination;
277
    UINT16		PA_AndMaskWord;
278
    UINT16		PA_OrMaskWord;
279
    UINT8		PA_Padding[4];
280
}PA_WORD_WORD_WORD;
281
typedef struct _PA_WORD_DWORD_DWORD{
282
    UINT16		PA_Destination;
283
    UINT32		PA_AndMaskDword;
284
    UINT32		PA_OrMaskDword;
285
}PA_WORD_DWORD_DWORD;
286
 
287
 
288
typedef union _PARAMETER_ACCESS {
289
    PA_BYTE_XX			ByteXX;
290
    PA_BYTE_BYTE		ByteByte;
291
    PA_BYTE_WORD		ByteWord;
292
    PA_BYTE_DWORD		ByteDword;
293
    PA_WORD_BYTE		WordByte;
294
    PA_WORD_WORD		WordWord;
295
    PA_WORD_DWORD		WordDword;
296
    PA_WORD_XX			WordXX;
297
/*The following 6 definitions used for Mask operation*/
298
    PA_BYTE_BYTE_BYTE	ByteByteAndByteOr;
299
    PA_BYTE_WORD_WORD	ByteWordAndWordOr;
300
    PA_BYTE_DWORD_DWORD	ByteDwordAndDwordOr;
301
    PA_WORD_BYTE_BYTE	WordByteAndByteOr;
302
    PA_WORD_WORD_WORD	WordWordAndWordOr;
303
    PA_WORD_DWORD_DWORD	WordDwordAndDwordOr;
304
}PARAMETER_ACCESS;
305
 
306
typedef	struct _COMMAND_ATTRIBUTE {
307
    UINT8		Source:3;
308
    UINT8		SourceAlignment:3;
309
    UINT8		DestinationAlignment:2;
310
}COMMAND_ATTRIBUTE;
311
 
312
typedef struct _SOURCE_DESTINATION_ALIGNMENT{
313
    UINT8					DestAlignment;
314
    UINT8					SrcAlignment;
315
}SOURCE_DESTINATION_ALIGNMENT;
316
typedef struct _MULTIPLICATION_RESULT{
317
    UINT32									Low32Bit;
318
    UINT32									High32Bit;
319
}MULTIPLICATION_RESULT;
320
typedef struct _DIVISION_RESULT{
321
    UINT32									Quotient32;
322
    UINT32									Reminder32;
323
}DIVISION_RESULT;
324
typedef union _DIVISION_MULTIPLICATION_RESULT{
325
    MULTIPLICATION_RESULT		Multiplication;
326
    DIVISION_RESULT					Division;
327
}DIVISION_MULTIPLICATION_RESULT;
328
typedef struct _COMMAND_HEADER {
329
    UINT8					Opcode;
330
    COMMAND_ATTRIBUTE		Attribute;
331
}COMMAND_HEADER;
332
 
333
typedef struct _GENERIC_ATTRIBUTE_COMMAND{
334
    COMMAND_HEADER			Header;
335
    PARAMETER_ACCESS		Parameters;
336
} GENERIC_ATTRIBUTE_COMMAND;
337
 
338
typedef struct	_COMMAND_TYPE_1{
339
    UINT8					Opcode;
340
    PARAMETER_ACCESS		Parameters;
341
} COMMAND_TYPE_1;
342
 
343
typedef struct	_COMMAND_TYPE_OPCODE_OFFSET16{
344
    UINT8					Opcode;
345
    UINT16					CD_Offset16;
346
} COMMAND_TYPE_OPCODE_OFFSET16;
347
 
348
typedef struct	_COMMAND_TYPE_OPCODE_OFFSET32{
349
    UINT8					Opcode;
350
    UINT32					CD_Offset32;
351
} COMMAND_TYPE_OPCODE_OFFSET32;
352
 
353
typedef struct	_COMMAND_TYPE_OPCODE_VALUE_BYTE{
354
    UINT8					Opcode;
355
    UINT8					Value;
356
} COMMAND_TYPE_OPCODE_VALUE_BYTE;
357
 
358
typedef union  _COMMAND_SPECIFIC_UNION{
359
    UINT8	ContinueSwitch;
360
    UINT8	ControlOperandSourcePosition;
361
    UINT8	IndexInMasterTable;
362
} COMMAND_SPECIFIC_UNION;
363
 
364
 
365
typedef struct _CD_GENERIC_BYTE{
366
    UINT16					CommandType:3;
367
    UINT16					CurrentParameterSize:3;
368
    UINT16					CommandAccessType:3;
369
    UINT16					CurrentPort:2;
370
    UINT16					PS_SizeInDwordsUsedByCallingTable:5;
371
}CD_GENERIC_BYTE;
372
 
373
typedef UINT8	COMMAND_TYPE_OPCODE_ONLY;
374
 
375
typedef UINT8  COMMAND_HEADER_POINTER;
376
 
377
 
378
#if (PARSER_TYPE==BIOS_TYPE_PARSER)
379
 
380
typedef struct _DEVICE_DATA	{
381
    UINT32	STACK_BASED		*pParameterSpace;
382
    UINT8									*pBIOS_Image;
383
    UINT8							format;
384
#if (IO_INTERFACE==PARSER_INTERFACE)
385
    IO_BASE_ADDR					IOBase;
386
#endif
387
}  DEVICE_DATA;
388
 
389
#else
390
 
391
typedef struct _DEVICE_DATA	{
392
    UINT32							*pParameterSpace;
393
    VOID								*CAIL;
394
    UINT8 							*pBIOS_Image;
395
    UINT32							format;
396
} DEVICE_DATA;
397
 
398
#endif
399
 
400
struct _PARSER_TEMP_DATA;
401
typedef UINT32 WORKSPACE_POINTER;
402
 
403
struct	_WORKING_TABLE_DATA{
404
    UINT8																		* pTableHead;
405
    COMMAND_HEADER_POINTER									* IP;			// Commands pointer
406
    WORKSPACE_POINTER	STACK_BASED						* pWorkSpace;
407
    struct _WORKING_TABLE_DATA STACK_BASED  * prevWorkingTableData;
408
};
409
 
410
 
411
 
412
typedef struct	_PARSER_TEMP_DATA{
413
    DEVICE_DATA	STACK_BASED							*pDeviceData;
414
    struct _WORKING_TABLE_DATA STACK_BASED		*pWorkingTableData;
415
    UINT32															SourceData32;
416
    UINT32															DestData32;
417
    DIVISION_MULTIPLICATION_RESULT			MultiplicationOrDivision;
418
    UINT32															Index;
419
    UINT32					                    CurrentFB_Window;
420
    UINT32					                    IndirectData;
421
    UINT16															CurrentRegBlock;
422
    TABLE_UNIT_TYPE													CurrentDataBlock;
423
    UINT16                              AttributesData;
424
//  UINT8                               *IndirectIOTable;
425
    UINT8                               *IndirectIOTablePointer;
426
    GENERIC_ATTRIBUTE_COMMAND						*pCmd;			//CurrentCommand;
427
    SOURCE_DESTINATION_ALIGNMENT  			CD_Mask;
428
    PARAMETERS_TYPE											ParametersType;
429
    CD_GENERIC_BYTE											Multipurpose;
430
    UINT8																CompareFlags;
431
    COMMAND_SPECIFIC_UNION							CommandSpecific;
432
    CD_STATUS														Status;
433
    UINT8                               Shift2MaskConverter;
434
    UINT8															  CurrentPortID;
435
} PARSER_TEMP_DATA;
436
 
437
 
438
typedef struct _WORKING_TABLE_DATA  WORKING_TABLE_DATA;
439
 
440
 
441
 
442
typedef VOID (*COMMANDS_DECODER)(PARSER_TEMP_DATA STACK_BASED * pParserTempData);
443
typedef VOID (*WRITE_IO_FUNCTION)(PARSER_TEMP_DATA STACK_BASED * pParserTempData);
444
typedef UINT32 (*READ_IO_FUNCTION)(PARSER_TEMP_DATA STACK_BASED * pParserTempData);
445
typedef UINT32 (*CD_GET_PARAMETERS)(PARSER_TEMP_DATA STACK_BASED * pParserTempData);
446
 
447
typedef struct _COMMANDS_PROPERTIES
448
{
449
    COMMANDS_DECODER  function;
450
    UINT8             destination;
451
    UINT8             headersize;
452
} COMMANDS_PROPERTIES;
453
 
454
typedef struct _INDIRECT_IO_PARSER_COMMANDS
455
{
456
    COMMANDS_DECODER  func;
457
    UINT8             csize;
458
} INDIRECT_IO_PARSER_COMMANDS;
459
 
460
#if (PARSER_TYPE==DRIVER_TYPE_PARSER)
461
#pragma pack(pop)
462
#endif
463
 
464
#endif