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 25Module Name: 26 27Decoder.h 28 29Abstract: 30 31Includes all helper headers 32 33Revision History: 34 35NEG:27.08.2002 Initiated. 36--*/ 37#ifndef _DECODER_H_ 38#define _DECODER_H_ 39#define WS_QUOTIENT_C 64 40#define WS_REMINDER_C (WS_QUOTIENT_C+1) 41#define WS_DATAPTR_C (WS_REMINDER_C+1) 42#define WS_SHIFT_C (WS_DATAPTR_C+1) 43#define WS_OR_MASK_C (WS_SHIFT_C+1) 44#define WS_AND_MASK_C (WS_OR_MASK_C+1) 45#define WS_FB_WINDOW_C (WS_AND_MASK_C+1) 46#define WS_ATTRIBUTES_C (WS_FB_WINDOW_C+1) 47#define WS_REGPTR_C (WS_ATTRIBUTES_C+1) 48#define PARSER_VERSION_MAJOR 0x00000000 49#define PARSER_VERSION_MINOR 0x0000000E 50#define PARSER_VERSION (PARSER_VERSION_MAJOR | PARSER_VERSION_MINOR) 51 52#include "CD_Common_Types.h" 53 54#include "atombios.h" 55 56/* these depends on some struct defined in atombios.h */ 57#include "CD_binding.h" 58#include "CD_hw_services.h" 59#include "CD_Structs.h" 60#include "CD_Opcodes.h" 61#include "CD_Definitions.h" 62 63#if ATOM_BIG_ENDIAN 64extern UINT16 ATOM_BSWAP16(UINT16 x); 65extern UINT32 ATOM_BSWAP32(UINT32 x); 66 67#define CPU_TO_UINT16LE(x) ATOM_BSWAP16(x) 68#define CPU_TO_UINT32LE(x) ATOM_BSWAP32(x) 69#define UINT16LE_TO_CPU(x) ATOM_BSWAP16(x) 70#define UINT32LE_TO_CPU(x) ATOM_BSWAP32(x) 71#else 72#define CPU_TO_UINT16LE(x) (x) 73#define CPU_TO_UINT32LE(x) (x) 74#define UINT16LE_TO_CPU(x) (x) 75#define UINT32LE_TO_CPU(x) (x) 76#endif 77 78#define SOURCE_ONLY_CMD_TYPE 0//0xFE 79#define SOURCE_DESTINATION_CMD_TYPE 1//0xFD 80#define DESTINATION_ONLY_CMD_TYPE 2//0xFC 81 82#define ACCESS_TYPE_BYTE 0//0xF9 83#define ACCESS_TYPE_WORD 1//0xF8 84#define ACCESS_TYPE_DWORD 2//0xF7 85#define SWITCH_TYPE_ACCESS 3//0xF6 86 87#define CD_CONTINUE 0//0xFB 88#define CD_STOP 1//0xFA 89 90 91#define IS_END_OF_TABLE(cmd) ((cmd) == EOT_OPCODE) 92#define IS_COMMAND_VALID(cmd) (((cmd)<=LastValidCommand)&&((cmd)>=FirstValidCommand)) 93#define IS_IT_SHIFT_COMMAND(Opcode) ((Opcode<=SHIFT_RIGHT_MC_OPCODE)&&(Opcode>=SHIFT_LEFT_REG_OPCODE)) 94#define IS_IT_XXXX_COMMAND(Group, Opcode) ((Opcode<=Group##_MC_OPCODE)&&(Opcode>=Group##_REG_OPCODE)) 95#define CheckCaseAndAdjustIP_Macro(size) \ 96 if (pParserTempData->SourceData32==(UINT32)((CASE_OFFSET*)pParserTempData->pWorkingTableData->IP)->XX_Access.size##.Access.Value){\ 97 pParserTempData->CommandSpecific.ContinueSwitch = CD_STOP;\ 98 pParserTempData->pWorkingTableData->IP =(COMMAND_HEADER_POINTER *) RELATIVE_TO_TABLE(((CASE_OFFSET*)pParserTempData->pWorkingTableData->IP)->XX_Access.size##.Access.JumpOffset);\ 99 }else{\ 100 pParserTempData->pWorkingTableData->IP+=(sizeof (CASE_##size##ACCESS)\ 101 +sizeof(((CASE_OFFSET*)pParserTempData->pWorkingTableData->IP)->CaseSignature));\ 102 } 103 104#endif 105/* pWorkingTableData->pCmd->Header.Attribute.SourceAlignment=alignmentLowerWord;\*/ 106 107// EOF 108