/* * Copyright 2007 Egbert Eich * Copyright 2007 Luc Verhaegen * Copyright 2007 Matthias Hopf * Copyright 2007 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. */ #ifndef RHD_ATOMBIOS_H_ # define RHD_ATOMBIOS_H_ #include "radeon.h" typedef enum { ATOMBIOS_INIT, ATOMBIOS_TEARDOWN, ATOMBIOS_EXEC, ATOMBIOS_ALLOCATE_FB_SCRATCH, ATOM_QUERY_FUNCS = 0x1000, GET_DEFAULT_ENGINE_CLOCK = ATOM_QUERY_FUNCS, GET_DEFAULT_MEMORY_CLOCK, GET_MAX_PIXEL_CLOCK_PLL_OUTPUT, GET_MIN_PIXEL_CLOCK_PLL_OUTPUT, GET_MAX_PIXEL_CLOCK_PLL_INPUT, GET_MIN_PIXEL_CLOCK_PLL_INPUT, GET_MAX_PIXEL_CLK, GET_REF_CLOCK, ATOM_VRAM_QUERIES, GET_FW_FB_START = ATOM_VRAM_QUERIES, GET_FW_FB_SIZE, ATOM_TMDS_QUERIES, ATOM_TMDS_FREQUENCY = ATOM_TMDS_QUERIES, ATOM_TMDS_PLL_CHARGE_PUMP, ATOM_TMDS_PLL_DUTY_CYCLE, ATOM_TMDS_PLL_VCO_GAIN, ATOM_TMDS_PLL_VOLTAGE_SWING, FUNC_END } AtomBiosFunc; typedef enum { ATOM_SUCCESS, ATOM_FAILED, ATOM_NOT_IMPLEMENTED } AtomBiosResult; typedef struct { int index; pointer pspace; pointer *dataSpace; } AtomExec, *AtomExecPtr; typedef struct { unsigned int start; unsigned int size; } AtomFb, *AtomFbPtr; typedef union { CARD32 val; pointer ptr; atomBIOSHandlePtr atomp; AtomExec exec; AtomFb fb; } AtomBIOSArg, *AtomBIOSArgPtr; extern void atombios_get_command_table_version(atomBIOSHandlePtr atomBIOS, int index, int *major, int *minor); extern AtomBiosResult RHDAtomBIOSFunc(int scrnIndex, atomBIOSHandlePtr handle, AtomBiosFunc func, AtomBIOSArgPtr data); /* only for testing */ void rhdTestAtomBIOS(atomBIOSHandlePtr atomBIOS); #ifdef ATOM_BIOS //# include "rhd_atomwrapper.h" # include "xf86int10.h" # ifdef ATOM_BIOS_PARSER # define INT8 INT8 # define INT16 INT16 # define INT32 INT32 # include "CD_Common_Types.h" # else # ifndef ULONG typedef unsigned int ULONG; # define ULONG ULONG # endif # ifndef UCHAR typedef unsigned char UCHAR; # define UCHAR UCHAR # endif # ifndef USHORT typedef unsigned short USHORT; # define USHORT USHORT # endif # endif #include "atombios.h" typedef struct _atomDataTables { unsigned char *UtilityPipeLine; ATOM_MULTIMEDIA_CAPABILITY_INFO *MultimediaCapabilityInfo; ATOM_MULTIMEDIA_CONFIG_INFO *MultimediaConfigInfo; ATOM_STANDARD_VESA_TIMING *StandardVESA_Timing; union { void *base; ATOM_FIRMWARE_INFO *FirmwareInfo; ATOM_FIRMWARE_INFO_V1_2 *FirmwareInfo_V_1_2; ATOM_FIRMWARE_INFO_V1_3 *FirmwareInfo_V_1_3; ATOM_FIRMWARE_INFO_V1_4 *FirmwareInfo_V_1_4; } FirmwareInfo; ATOM_DAC_INFO *DAC_Info; union { void *base; ATOM_LVDS_INFO *LVDS_Info; ATOM_LVDS_INFO_V12 *LVDS_Info_v12; } LVDS_Info; ATOM_TMDS_INFO *TMDS_Info; ATOM_ANALOG_TV_INFO *AnalogTV_Info; union { void *base; ATOM_SUPPORTED_DEVICES_INFO *SupportedDevicesInfo; ATOM_SUPPORTED_DEVICES_INFO_2 *SupportedDevicesInfo_2; ATOM_SUPPORTED_DEVICES_INFO_2d1 *SupportedDevicesInfo_2d1; } SupportedDevicesInfo; ATOM_GPIO_I2C_INFO *GPIO_I2C_Info; ATOM_VRAM_USAGE_BY_FIRMWARE *VRAM_UsageByFirmware; ATOM_GPIO_PIN_LUT *GPIO_Pin_LUT; ATOM_VESA_TO_INTENAL_MODE_LUT *VESA_ToInternalModeLUT; union { void *base; ATOM_COMPONENT_VIDEO_INFO *ComponentVideoInfo; ATOM_COMPONENT_VIDEO_INFO_V21 *ComponentVideoInfo_v21; } ComponentVideoInfo; /**/unsigned char *PowerPlayInfo; COMPASSIONATE_DATA *CompassionateData; ATOM_DISPLAY_DEVICE_PRIORITY_INFO *SaveRestoreInfo; /**/unsigned char *PPLL_SS_Info; ATOM_OEM_INFO *OemInfo; ATOM_XTMDS_INFO *XTMDS_Info; ATOM_ASIC_MVDD_INFO *MclkSS_Info; ATOM_OBJECT_HEADER *Object_Header; INDIRECT_IO_ACCESS *IndirectIOAccess; ATOM_MC_INIT_PARAM_TABLE *MC_InitParameter; /**/unsigned char *ASIC_VDDC_Info; ATOM_ASIC_INTERNAL_SS_INFO *ASIC_InternalSS_Info; /**/unsigned char *TV_VideoMode; union { void *base; ATOM_VRAM_INFO_V2 *VRAM_Info_v2; ATOM_VRAM_INFO_V3 *VRAM_Info_v3; } VRAM_Info; ATOM_MEMORY_TRAINING_INFO *MemoryTrainingInfo; union { void *base; ATOM_INTEGRATED_SYSTEM_INFO *IntegratedSystemInfo; ATOM_INTEGRATED_SYSTEM_INFO_V2 *IntegratedSystemInfo_v2; } IntegratedSystemInfo; ATOM_ASIC_PROFILING_INFO *ASIC_ProfilingInfo; ATOM_VOLTAGE_OBJECT_INFO *VoltageObjectInfo; ATOM_POWER_SOURCE_INFO *PowerSourceInfo; } atomDataTables, *atomDataTablesPtr; typedef struct _atomBIOSHandle { int scrnIndex; unsigned char *BIOSBase; atomDataTablesPtr atomDataPtr; pointer *scratchBase; CARD32 fbBase; int cmd_offset; #if XSERVER_LIBPCIACCESS struct pci_device *device; #else PCITAG PciTag; #endif } atomBIOSHandle; #endif #endif /* RHD_ATOMBIOS_H_ */