summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Deucher <alex@botch2.(none)>2007-11-18 17:44:36 -0500
committerAlex Deucher <alex@botch2.(none)>2007-11-18 17:44:36 -0500
commit1cd7cc3e6758ab1012f3ced6e958a1517f45557f (patch)
tree9657c25396f6a807231d72ae8bdf3444628f8cfe /src
parentb155fa872ee4ca5d801e942aee6e619cef104f35 (diff)
WIP: new atom code comples.
I commented out the object parsing for the time being as using it will require some thought as to new output related data structures.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am11
-rw-r--r--src/atombios_crtc.c26
-rw-r--r--src/atombios_output.c30
-rw-r--r--src/radeon_atombios.c281
-rw-r--r--src/radeon_atombios.h2
-rw-r--r--src/radeon_atomwrapper.c8
-rw-r--r--src/radeon_probe.h12
7 files changed, 226 insertions, 144 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 9bad63dd..46e5ca10 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,10 +32,11 @@ R128_DRI_SRCS = r128_dri.c
RADEON_DRI_SRCS = radeon_dri.c
endif
-RADEON_ATOMBIOS_SOURCES = AtomBios/CD_Operations.c\
- AtomBios/Decoder.c\
- AtomBios/hwserv_drv.c \
- AtomBios/includes/atombios.h \
+RADEON_ATOMBIOS_SOURCES = \
+ AtomBios/CD_Operations.c \
+ AtomBios/Decoder.c \
+ AtomBios/hwserv_drv.c \
+ AtomBios/includes/atombios.h \
AtomBios/includes/CD_binding.h \
AtomBios/includes/CD_Common_Types.h \
AtomBios/includes/CD_Definitions.h \
@@ -43,6 +44,7 @@ RADEON_ATOMBIOS_SOURCES = AtomBios/CD_Operations.c\
AtomBios/includes/CD_Opcodes.h \
AtomBios/includes/CD_Structs.h \
AtomBios/includes/Decoder.h \
+ AtomBios/includes/ObjectID.h \
AtomBios/includes/regsdef.h
@@ -202,6 +204,7 @@ EXTRA_DIST = \
radeon_version.h \
radeon_video.h \
radeon_tv.h \
+ radeon_atomwrapper.h \
theatre200.h \
theatre_detect.h \
theatre.h \
diff --git a/src/atombios_crtc.c b/src/atombios_crtc.c
index 9305592e..d0c6a065 100644
--- a/src/atombios_crtc.c
+++ b/src/atombios_crtc.c
@@ -53,10 +53,10 @@
#endif
AtomBiosResult
-atombios_enable_crtc(atomBIOSHandlePtr atomBIOS, int crtc, int state)
+atombios_enable_crtc(atomBiosHandlePtr atomBIOS, int crtc, int state)
{
ENABLE_CRTC_PS_ALLOCATION crtc_data;
- AtomBIOSArg data;
+ AtomBiosArgRec data;
unsigned char *space;
crtc_data.ucCRTC = crtc;
@@ -66,7 +66,7 @@ atombios_enable_crtc(atomBIOSHandlePtr atomBIOS, int crtc, int state)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &crtc_data;
- if (RHDAtomBIOSFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("%s CRTC %d success\n", state? "Enable":"Disable", crtc);
return ATOM_SUCCESS ;
}
@@ -76,11 +76,11 @@ atombios_enable_crtc(atomBIOSHandlePtr atomBIOS, int crtc, int state)
}
AtomBiosResult
-atombios_blank_crtc(atomBIOSHandlePtr atomBIOS, int crtc, int state)
+atombios_blank_crtc(atomBiosHandlePtr atomBIOS, int crtc, int state)
{
BLANK_CRTC_PS_ALLOCATION crtc_data;
unsigned char *space;
- AtomBIOSArg data;
+ AtomBiosArgRec data;
memset(&crtc_data, 0, sizeof(crtc_data));
crtc_data.ucCRTC = crtc;
@@ -90,7 +90,7 @@ atombios_blank_crtc(atomBIOSHandlePtr atomBIOS, int crtc, int state)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &crtc_data;
- if (RHDAtomBIOSFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("%s CRTC %d success\n", state? "Blank":"Unblank", crtc);
return ATOM_SUCCESS ;
}
@@ -130,16 +130,16 @@ atombios_crtc_dpms(xf86CrtcPtr crtc, int mode)
}
static AtomBiosResult
-atombios_set_crtc_timing(atomBIOSHandlePtr atomBIOS, SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION *crtc_param)
+atombios_set_crtc_timing(atomBiosHandlePtr atomBIOS, SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION *crtc_param)
{
- AtomBIOSArg data;
+ AtomBiosArgRec data;
unsigned char *space;
data.exec.index = GetIndexIntoMasterTable(COMMAND, SetCRTC_Timing);
data.exec.dataSpace = (void *)&space;
data.exec.pspace = crtc_param;
- if (RHDAtomBIOSFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Set CRTC Timing success\n");
return ATOM_SUCCESS ;
}
@@ -267,7 +267,7 @@ atombios_crtc_set_pll(xf86CrtcPtr crtc, DisplayModePtr mode)
int major, minor;
SET_PIXEL_CLOCK_PS_ALLOCATION spc_param;
void *ptr;
- AtomBIOSArg data;
+ AtomBiosArgRec data;
unsigned char *space;
RADEONSavePtr save = &info->ModeReg;
@@ -320,7 +320,7 @@ atombios_crtc_set_pll(xf86CrtcPtr crtc, DisplayModePtr mode)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = ptr;
- if (RHDAtomBIOSFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Set CRTC PLL success\n");
return;
}
@@ -336,7 +336,7 @@ atombios_set_crtc_source(xf86CrtcPtr crtc)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
RADEONInfoPtr info = RADEONPTR(pScrn);
- AtomBIOSArg data;
+ AtomBiosArgRec data;
unsigned char *space;
SELECT_CRTC_SOURCE_PS_ALLOCATION crtc_src_param;
int index = GetIndexIntoMasterTable(COMMAND, SelectCRTC_Source);
@@ -388,7 +388,7 @@ atombios_set_crtc_source(xf86CrtcPtr crtc)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &crtc_src_param;
- if (RHDAtomBIOSFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Set CRTC Source success\n");
return;
}
diff --git a/src/atombios_output.c b/src/atombios_output.c
index 28934550..d0f73391 100644
--- a/src/atombios_output.c
+++ b/src/atombios_output.c
@@ -43,10 +43,10 @@
#include "radeon_atombios.h"
static AtomBiosResult
-atom_bios_display_device_control(atomBIOSHandlePtr atomBIOS, int device, Bool state)
+atom_bios_display_device_control(atomBiosHandlePtr atomBIOS, int device, Bool state)
{
DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION disp_data;
- AtomBIOSArg data;
+ AtomBiosArgRec data;
unsigned char *space;
disp_data.ucAction = state;
@@ -54,7 +54,7 @@ atom_bios_display_device_control(atomBIOSHandlePtr atomBIOS, int device, Bool st
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &disp_data;
- if (RHDAtomBIOSFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Output %d enable success\n", device);
return ATOM_SUCCESS;
}
@@ -64,7 +64,7 @@ atom_bios_display_device_control(atomBIOSHandlePtr atomBIOS, int device, Bool st
}
static void
-atom_bios_enable_crt(atomBIOSHandlePtr atomBIOS, int dac, Bool state)
+atom_bios_enable_crt(atomBiosHandlePtr atomBIOS, int dac, Bool state)
{
int output;
if (dac == DAC_PRIMARY)
@@ -81,7 +81,7 @@ atombios_output_dac_setup(xf86OutputPtr output, DisplayModePtr mode)
RADEONOutputPrivatePtr radeon_output = output->driver_private;
RADEONInfoPtr info = RADEONPTR(output->scrn);
DAC_ENCODER_CONTROL_PS_ALLOCATION disp_data;
- AtomBIOSArg data;
+ AtomBiosArgRec data;
unsigned char *space;
disp_data.ucAction = 1;
@@ -94,7 +94,7 @@ atombios_output_dac_setup(xf86OutputPtr output, DisplayModePtr mode)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &disp_data;
- if (RHDAtomBIOSFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Output DAC %d enable success\n", radeon_output->DACType);
return ATOM_SUCCESS;
}
@@ -115,7 +115,7 @@ atombios_external_tmds_setup(xf86OutputPtr output, DisplayModePtr mode)
{
RADEONInfoPtr info = RADEONPTR(output->scrn);
ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION disp_data;
- AtomBIOSArg data;
+ AtomBiosArgRec data;
unsigned char *space;
disp_data.sXTmdsEncoder.ucEnable = 1;
@@ -132,7 +132,7 @@ atombios_external_tmds_setup(xf86OutputPtr output, DisplayModePtr mode)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &disp_data;
- if (RHDAtomBIOSFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("External TMDS enable success\n");
return ATOM_SUCCESS;
}
@@ -146,7 +146,7 @@ atombios_output_tmds1_setup(xf86OutputPtr output, DisplayModePtr mode)
{
RADEONInfoPtr info = RADEONPTR(output->scrn);
TMDS1_ENCODER_CONTROL_PS_ALLOCATION disp_data;
- AtomBIOSArg data;
+ AtomBiosArgRec data;
unsigned char *space;
disp_data.ucAction = 1;
@@ -159,7 +159,7 @@ atombios_output_tmds1_setup(xf86OutputPtr output, DisplayModePtr mode)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &disp_data;
- if (RHDAtomBIOSFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Output TMDS1 enable success\n");
return ATOM_SUCCESS;
}
@@ -180,7 +180,7 @@ atombios_output_tmds2_setup(xf86OutputPtr output, DisplayModePtr mode)
{
RADEONInfoPtr info = RADEONPTR(output->scrn);
TMDS2_ENCODER_CONTROL_PS_ALLOCATION disp_data;
- AtomBIOSArg data;
+ AtomBiosArgRec data;
unsigned char *space;
disp_data.ucAction = 1;
@@ -193,7 +193,7 @@ atombios_output_tmds2_setup(xf86OutputPtr output, DisplayModePtr mode)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &disp_data;
- if (RHDAtomBIOSFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Output TMDS2 enable success\n");
return ATOM_SUCCESS;
}
@@ -332,10 +332,10 @@ atombios_output_mode_set(xf86OutputPtr output,
}
static AtomBiosResult
-atom_bios_dac_load_detect(atomBIOSHandlePtr atomBIOS, int dac)
+atom_bios_dac_load_detect(atomBiosHandlePtr atomBIOS, int dac)
{
DAC_LOAD_DETECTION_PS_ALLOCATION dac_data;
- AtomBIOSArg data;
+ AtomBiosArgRec data;
unsigned char *space;
dac_data.sDacload.usDeviceID = 0;
@@ -346,7 +346,7 @@ atom_bios_dac_load_detect(atomBIOSHandlePtr atomBIOS, int dac)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &dac_data;
- if (RHDAtomBIOSFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Dac detection success\n");
return ATOM_SUCCESS ;
diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c
index d12f631b..15612fb9 100644
--- a/src/radeon_atombios.c
+++ b/src/radeon_atombios.c
@@ -28,10 +28,11 @@
#endif
#include "xf86.h"
#include "xf86_OSproc.h"
-//#include "xf86_ansic.h"
#include "radeon.h"
#include "radeon_atombios.h"
+#include "radeon_atomwrapper.h"
+#include "radeon_probe.h"
#include "radeon_macros.h"
#include "xorg-server.h"
@@ -178,11 +179,34 @@ enum {
legacyBIOSMax = 0x10000
};
+#define DEBUGP(x) {x;}
+#define LOG_DEBUG 7
+
# ifdef ATOM_BIOS_PARSER
# define LOG_CAIL LOG_DEBUG + 1
static void
+RHDDebug(int scrnIndex, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(scrnIndex, X_INFO, LOG_DEBUG, format, ap);
+ va_end(ap);
+}
+
+static void
+RHDDebugCont(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(-1, X_NONE, LOG_DEBUG, format, ap);
+ va_end(ap);
+}
+
+static void
CailDebug(int scrnIndex, const char *format, ...)
{
va_list ap;
@@ -207,8 +231,9 @@ rhdAtomAnalyzeCommonHdr(ATOM_COMMON_TABLE_HEADER *hdr)
static int
rhdAtomAnalyzeRomHdr(unsigned char *rombase,
- ATOM_ROM_HEADER *hdr,
- unsigned int *data_offset)
+ ATOM_ROM_HEADER *hdr,
+ unsigned int *data_offset,
+ unsigned int *command_offset)
{
if (!rhdAtomAnalyzeCommonHdr(&hdr->sHeader)) {
return FALSE;
@@ -221,6 +246,7 @@ rhdAtomAnalyzeRomHdr(unsigned char *rombase,
rombase + hdr->usBIOS_BootupMessageOffset);
*data_offset = hdr->usMasterDataTableOffset;
+ *command_offset = hdr->usMasterCommandTableOffset;
return TRUE;
}
@@ -242,7 +268,7 @@ rhdAtomAnalyzeRomDataTable(unsigned char *base, int offset,
return TRUE;
}
-static Bool
+Bool
rhdAtomGetTableRevisionAndSize(ATOM_COMMON_TABLE_HEADER *hdr,
CARD8 *contentRev,
CARD8 *formatRev,
@@ -320,10 +346,13 @@ rhdAtomAnalyzeMasterDataTable(unsigned char *base,
}
static Bool
-rhdAtomGetDataTable(int scrnIndex, unsigned char *base,
- atomDataTables *atomDataPtr, unsigned int BIOSImageSize)
+rhdAtomGetDataTable(int scrnIndex,
+ unsigned char *base,
+ atomDataTables *atomDataPtr,
+ unsigned int *cmd_offset,
+ unsigned int BIOSImageSize)
{
- unsigned int data_offset;
+ unsigned int data_offset;
unsigned int atom_romhdr_off = *(unsigned short*)
(base + OFFSET_TO_POINTER_TO_ATOM_ROM_HEADER);
ATOM_ROM_HEADER *atom_rom_hdr =
@@ -343,7 +372,7 @@ rhdAtomGetDataTable(int scrnIndex, unsigned char *base,
return FALSE;
}
xf86DrvMsg(scrnIndex, X_INFO, "ATOM BIOS Rom: \n");
- if (!rhdAtomAnalyzeRomHdr(base, atom_rom_hdr, &data_offset)) {
+ if (!rhdAtomAnalyzeRomHdr(base, atom_rom_hdr, &data_offset, cmd_offset)) {
xf86DrvMsg(scrnIndex, X_ERROR, "RomHeader invalid\n");
return FALSE;
}
@@ -353,6 +382,11 @@ rhdAtomGetDataTable(int scrnIndex, unsigned char *base,
__func__);
}
+ if (cmd_offset + sizeof (ATOM_MASTER_COMMAND_TABLE) > BIOSImageSize) {
+ xf86DrvMsg(scrnIndex,X_ERROR,"%s: Atom command table outside of BIOS\n",
+ __func__);
+ }
+
if (!rhdAtomAnalyzeMasterDataTable(base, (ATOM_MASTER_DATA_TABLE *)
(base + data_offset),
atomDataPtr)) {
@@ -509,6 +543,7 @@ rhdAtomInit(atomBiosHandlePtr unused1, AtomBiosRequestID unused2,
RADEONInfoPtr info = RADEONPTR(xf86Screens[scrnIndex]);
unsigned char *ptr;
atomDataTablesPtr atomDataPtr;
+ unsigned int cmd_offset;
atomBiosHandlePtr handle = NULL;
unsigned int BIOSImageSize = 0;
data->atomhandle = NULL;
@@ -562,7 +597,7 @@ rhdAtomInit(atomBiosHandlePtr unused1, AtomBiosRequestID unused2,
"ATOM BIOS data tabes\n");
goto error;
}
- if (!rhdAtomGetDataTable(scrnIndex, ptr, atomDataPtr,BIOSImageSize))
+ if (!rhdAtomGetDataTable(scrnIndex, ptr, atomDataPtr, &cmd_offset, BIOSImageSize))
goto error1;
if (!(handle = xcalloc(1, sizeof(atomBiosHandleRec)))) {
xf86DrvMsg(scrnIndex,X_ERROR,"Cannot allocate memory\n");
@@ -570,6 +605,7 @@ rhdAtomInit(atomBiosHandlePtr unused1, AtomBiosRequestID unused2,
}
handle->BIOSBase = ptr;
handle->atomDataPtr = atomDataPtr;
+ handle->cmd_offset = cmd_offset;
handle->scrnIndex = scrnIndex;
#if XSERVER_LIBPCIACCESS
handle->device = info->PciInfo;
@@ -1234,6 +1270,10 @@ rhdAtomFirmwareInfoQuery(atomBiosHandlePtr handle,
return ATOM_SUCCESS;
}
+#if 0
+#define RHD_CONNECTORS_MAX 4
+#define MAX_OUTPUTS_PER_CONNECTOR 2
+
#define Limit(n,max,name) ((n >= max) ? ( \
xf86DrvMsg(handle->scrnIndex,X_ERROR,"%s: %s %i exceeds maximum %i\n", \
__func__,name,n,max), TRUE) : FALSE)
@@ -1241,116 +1281,118 @@ rhdAtomFirmwareInfoQuery(atomBiosHandlePtr handle,
static const struct _rhd_connector_objs
{
char *name;
- rhdConnectorType con;
+ RADEONConnectorTypeATOM con;
} rhd_connector_objs[] = {
- { "NONE", RHD_CONNECTOR_NONE },
- { "SINGLE_LINK_DVI_I", RHD_CONNECTOR_DVI },
- { "DUAL_LINK_DVI_I", RHD_CONNECTOR_DVI_DUAL },
- { "SINGLE_LINK_DVI_D", RHD_CONNECTOR_DVI },
- { "DUAL_LINK_DVI_D", RHD_CONNECTOR_DVI_DUAL },
- { "VGA", RHD_CONNECTOR_VGA },
- { "COMPOSITE", RHD_CONNECTOR_TV },
- { "SVIDEO", RHD_CONNECTOR_TV, },
- { "D_CONNECTOR", RHD_CONNECTOR_NONE, },
- { "9PIN_DIN", RHD_CONNECTOR_NONE },
- { "SCART", RHD_CONNECTOR_TV },
- { "HDMI_TYPE_A", RHD_CONNECTOR_NONE },
- { "HDMI_TYPE_B", RHD_CONNECTOR_NONE },
- { "HDMI_TYPE_B", RHD_CONNECTOR_NONE },
- { "LVDS", RHD_CONNECTOR_PANEL },
- { "7PIN_DIN", RHD_CONNECTOR_TV },
- { "PCIE_CONNECTOR", RHD_CONNECTOR_NONE },
- { "CROSSFIRE", RHD_CONNECTOR_NONE },
- { "HARDCODE_DVI", RHD_CONNECTOR_NONE },
- { "DISPLAYPORT", RHD_CONNECTOR_NONE}
+ { "NONE", CONNECTOR_NONE_ATOM },
+ { "SINGLE_LINK_DVI_I", CONNECTOR_DVI_I_ATOM },
+ { "DUAL_LINK_DVI_I", CONNECTOR_DVI_I_ATOM },
+ { "SINGLE_LINK_DVI_D", CONNECTOR_DVI_D_ATOM },
+ { "DUAL_LINK_DVI_D", CONNECTOR_DVI_D_ATOM },
+ { "VGA", CONNECTOR_VGA_ATOM },
+ { "COMPOSITE", CONNECTOR_CTV_ATOM },
+ { "SVIDEO", CONNECTOR_STV_ATOM },
+ { "D_CONNECTOR", CONNECTOR_NONE_ATOM },
+ { "9PIN_DIN", CONNECTOR_NONE_ATOM },
+ { "SCART", CONNECTOR_SCART_ATOM },
+ { "HDMI_TYPE_A", CONNECTOR_HDMI_TYPE_A_ATOM },
+ { "HDMI_TYPE_B", CONNECTOR_HDMI_TYPE_B_ATOM },
+ { "HDMI_TYPE_B", CONNECTOR_HDMI_TYPE_B_ATOM },
+ { "LVDS", CONNECTOR_LVDS_ATOM },
+ { "7PIN_DIN", CONNECTOR_STV_ATOM },
+ { "PCIE_CONNECTOR", CONNECTOR_NONE_ATOM },
+ { "CROSSFIRE", CONNECTOR_NONE_ATOM },
+ { "HARDCODE_DVI", CONNECTOR_NONE_ATOM },
+ { "DISPLAYPORT", CONNECTOR_DISPLAY_PORT_ATOM }
};
static const int n_rhd_connector_objs = sizeof (rhd_connector_objs) / sizeof(struct _rhd_connector_objs);
static const struct _rhd_encoders
{
char *name;
- rhdOutputType ot;
+ RADEONOutputTypeATOM ot;
} rhd_encoders[] = {
- { "NONE", RHD_OUTPUT_NONE },
- { "INTERNAL_LVDS", RHD_OUTPUT_LVDS },
- { "INTERNAL_TMDS1", RHD_OUTPUT_TMDSA },
- { "INTERNAL_TMDS2", RHD_OUTPUT_TMDSB },
- { "INTERNAL_DAC1", RHD_OUTPUT_DACA },
- { "INTERNAL_DAC2", RHD_OUTPUT_DACB },
- { "INTERNAL_SDVOA", RHD_OUTPUT_NONE },
- { "INTERNAL_SDVOB", RHD_OUTPUT_NONE },
- { "SI170B", RHD_OUTPUT_NONE },
- { "CH7303", RHD_OUTPUT_NONE },
- { "CH7301", RHD_OUTPUT_NONE },
- { "INTERNAL_DVO1", RHD_OUTPUT_NONE },
- { "EXTERNAL_SDVOA", RHD_OUTPUT_NONE },
- { "EXTERNAL_SDVOB", RHD_OUTPUT_NONE },
- { "TITFP513", RHD_OUTPUT_NONE },
- { "INTERNAL_LVTM1", RHD_OUTPUT_LVTMA },
- { "VT1623", RHD_OUTPUT_NONE },
- { "HDMI_SI1930", RHD_OUTPUT_NONE },
- { "HDMI_INTERNAL", RHD_OUTPUT_NONE },
- { "INTERNAL_KLDSCP_TMDS1", RHD_OUTPUT_TMDSA },
- { "INTERNAL_KLSCP_DVO1", RHD_OUTPUT_NONE },
- { "INTERNAL_KLDSCP_DAC1", RHD_OUTPUT_DACA },
- { "INTERNAL_KLDSCP_DAC2", RHD_OUTPUT_DACB },
- { "SI178", RHD_OUTPUT_NONE },
- { "MVPU_FPGA", RHD_OUTPUT_NONE },
- { "INTERNAL_DDI", RHD_OUTPUT_NONE },
- { "VT1625", RHD_OUTPUT_NONE },
- { "HDMI_SI1932", RHD_OUTPUT_NONE },
- { "AN9801", RHD_OUTPUT_NONE },
- { "DP501", RHD_OUTPUT_NONE },
+ { "NONE", OUTPUT_NONE_ATOM },
+ { "INTERNAL_LVDS", OUTPUT_LVDS_ATOM },
+ { "INTERNAL_TMDS1", OUTPUT_TMDSA_ATOM },
+ { "INTERNAL_TMDS2", OUTPUT_TMDSB_ATOM },
+ { "INTERNAL_DAC1", OUTPUT_DACA_ATOM },
+ { "INTERNAL_DAC2", OUTPUT_DACB_ATOM },
+ { "INTERNAL_SDVOA", OUTPUT_NONE_ATOM },
+ { "INTERNAL_SDVOB", OUTPUT_NONE_ATOM },
+ { "SI170B", OUTPUT_NONE_ATOM },
+ { "CH7303", OUTPUT_NONE_ATOM },
+ { "CH7301", OUTPUT_NONE_ATOM },
+ { "INTERNAL_DVO1", OUTPUT_NONE_ATOM },
+ { "EXTERNAL_SDVOA", OUTPUT_NONE_ATOM },
+ { "EXTERNAL_SDVOB", OUTPUT_NONE_ATOM },
+ { "TITFP513", OUTPUT_NONE_ATOM },
+ { "INTERNAL_LVTM1", OUTPUT_LVTMA_ATOM },
+ { "VT1623", OUTPUT_NONE_ATOM },
+ { "HDMI_SI1930", OUTPUT_NONE_ATOM },
+ { "HDMI_INTERNAL", OUTPUT_NONE_ATOM },
+ { "INTERNAL_KLDSCP_TMDS1", OUTPUT_TMDSA_ATOM },
+ { "INTERNAL_KLSCP_DVO1", OUTPUT_NONE_ATOM },
+ { "INTERNAL_KLDSCP_DAC1", OUTPUT_DACA_ATOM },
+ { "INTERNAL_KLDSCP_DAC2", OUTPUT_DACB_ATOM },
+ { "SI178", OUTPUT_NONE_ATOM },
+ { "MVPU_FPGA", OUTPUT_NONE_ATOM },
+ { "INTERNAL_DDI", OUTPUT_NONE_ATOM },
+ { "VT1625", OUTPUT_NONE_ATOM },
+ { "HDMI_SI1932", OUTPUT_NONE_ATOM },
+ { "AN9801", OUTPUT_NONE_ATOM },
+ { "DP501", OUTPUT_NONE_ATOM },
};
static const int n_rhd_encoders = sizeof (rhd_encoders) / sizeof(struct _rhd_encoders);
static const struct _rhd_connectors
{
char *name;
- rhdConnectorType con;
+ RADEONConnectorTypeATOM con;
Bool dual;
} rhd_connectors[] = {
- {"NONE", RHD_CONNECTOR_NONE, FALSE },
- {"VGA", RHD_CONNECTOR_VGA, FALSE },
- {"DVI-I", RHD_CONNECTOR_DVI, TRUE },
- {"DVI-D", RHD_CONNECTOR_DVI, FALSE },
- {"DVI-A", RHD_CONNECTOR_DVI, FALSE },
- {"SVIDEO", RHD_CONNECTOR_TV, FALSE },
- {"COMPOSITE", RHD_CONNECTOR_TV, FALSE },
- {"PANEL", RHD_CONNECTOR_PANEL, FALSE },
- {"DIGITAL_LINK", RHD_CONNECTOR_NONE, FALSE },
- {"SCART", RHD_CONNECTOR_TV, FALSE },
- {"HDMI Type A", RHD_CONNECTOR_NONE, FALSE },
- {"HDMI Type B", RHD_CONNECTOR_NONE, FALSE },
- {"UNKNOWN", RHD_CONNECTOR_NONE, FALSE },
- {"UNKNOWN", RHD_CONNECTOR_NONE, FALSE },
- {"DVI+DIN", RHD_CONNECTOR_NONE, FALSE }
+ {"NONE", CONNECTOR_NONE_ATOM, FALSE },
+ {"VGA", CONNECTOR_VGA_ATOM, FALSE },
+ {"DVI-I", CONNECTOR_DVI_I_ATOM, TRUE },
+ {"DVI-D", CONNECTOR_DVI_D_ATOM, FALSE },
+ {"DVI-A", CONNECTOR_DVI_A_ATOM, FALSE },
+ {"SVIDEO", CONNECTOR_STV_ATOM, FALSE },
+ {"COMPOSITE", CONNECTOR_CTV_ATOM, FALSE },
+ {"PANEL", CONNECTOR_LVDS_ATOM, FALSE },
+ {"DIGITAL_LINK", CONNECTOR_DIGITAL_ATOM, FALSE },
+ {"SCART", CONNECTOR_SCART_ATOM, FALSE },
+ {"HDMI Type A", CONNECTOR_HDMI_TYPE_A_ATOM, FALSE },
+ {"HDMI Type B", CONNECTOR_HDMI_TYPE_B_ATOM, FALSE },
+ {"UNKNOWN", CONNECTOR_NONE_ATOM, FALSE },
+ {"UNKNOWN", CONNECTOR_NONE_ATOM, FALSE },
+ {"DVI+DIN", CONNECTOR_NONE_ATOM, FALSE }
};
static const int n_rhd_connectors = sizeof(rhd_connectors) / sizeof(struct _rhd_connectors);
static const struct _rhd_devices
{
char *name;
- rhdOutputType ot;
+ RADEONOutputTypeATOM ot;
} rhd_devices[] = {
- {" CRT1", RHD_OUTPUT_NONE },
- {" LCD1", RHD_OUTPUT_LVTMA },
- {" TV1", RHD_OUTPUT_NONE },
- {" DFP1", RHD_OUTPUT_TMDSA },
- {" CRT2", RHD_OUTPUT_NONE },
- {" LCD2", RHD_OUTPUT_LVTMA },
- {" TV2", RHD_OUTPUT_NONE },
- {" DFP2", RHD_OUTPUT_LVTMA },
- {" CV", RHD_OUTPUT_NONE },
- {" DFP3", RHD_OUTPUT_LVTMA }
+ {" CRT1", OUTPUT_NONE_ATOM },
+ {" LCD1", OUTPUT_LVTMA_ATOM },
+ {" TV1", OUTPUT_NONE_ATOM },
+ {" DFP1", OUTPUT_TMDSA_ATOM },
+ {" CRT2", OUTPUT_NONE_ATOM },
+ {" LCD2", OUTPUT_LVTMA_ATOM },
+ {" TV2", OUTPUT_NONE_ATOM },
+ {" DFP2", OUTPUT_LVTMA_ATOM },
+ {" CV", OUTPUT_NONE_ATOM },
+ {" DFP3", OUTPUT_LVTMA_ATOM }
};
static const int n_rhd_devices = sizeof(rhd_devices) / sizeof(struct _rhd_devices);
static const rhdDDC hwddc[] = { RHD_DDC_0, RHD_DDC_1, RHD_DDC_2, RHD_DDC_3 };
static const int n_hwddc = sizeof(hwddc) / sizeof(rhdDDC);
-static const rhdOutputType acc_dac[] = { RHD_OUTPUT_NONE, RHD_OUTPUT_DACA,
- RHD_OUTPUT_DACB, RHD_OUTPUT_DAC_EXTERNAL };
+static const rhdOutputType acc_dac[] = { OUTPUT_NONE_ATOM,
+ OUTPUT_DACA_ATOM,
+ OUTPUT_DACB_ATOM,
+ OUTPUT_DAC_EXTERNAL_ATOM };
static const int n_acc_dac = sizeof(acc_dac) / sizeof (rhdOutputType);
/*
@@ -1743,7 +1785,7 @@ rhdAtomConnectorInfoFromSupportedDevices(atomBiosHandlePtr handle,
ATOM_CONNECTOR_INFO_I2C ci
= atomDataPtr->SupportedDevicesInfo.SupportedDevicesInfo->asConnInfo[n];
- devices[n].ot = RHD_OUTPUT_NONE;
+ devices[n].ot = OUTPUT_NONE_ATOM;
if (!(atomDataPtr->SupportedDevicesInfo
.SupportedDevicesInfo->usDeviceSupport & (1 << n)))
@@ -1774,11 +1816,11 @@ rhdAtomConnectorInfoFromSupportedDevices(atomBiosHandlePtr handle,
n_acc_dac, "bfAssociatedDAC")) {
if ((devices[n].ot
= acc_dac[ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC])
- == RHD_OUTPUT_NONE) {
+ == OUTPUT_NONE_ATOM) {
devices[n].ot = rhd_devices[n].ot;
}
} else
- devices[n].ot = RHD_OUTPUT_NONE;
+ devices[n].ot = OUTPUT_NONE_ATOM;
RHDDebugCont("Output: %x ",devices[n].ot);
@@ -1834,15 +1876,15 @@ rhdAtomConnectorInfoFromSupportedDevices(atomBiosHandlePtr handle,
for (n = 0; n < ATOM_MAX_SUPPORTED_DEVICE; n++) {
int i;
- if (devices[n].ot == RHD_OUTPUT_NONE)
+ if (devices[n].ot == OUTPUT_NONE_ATOM)
continue;
- if (devices[n].con == RHD_CONNECTOR_NONE)
+ if (devices[n].con == CONNECTOR_NONE_ATOM)
continue;
cp[ncon].DDC = devices[n].ddc;
cp[ncon].HPD = devices[n].hpd;
cp[ncon].Output[0] = devices[n].ot;
- cp[ncon].Output[1] = RHD_OUTPUT_NONE;
+ cp[ncon].Output[1] = OUTPUT_NONE_ATOM;
cp[ncon].Type = devices[n].con;
cp[ncon].Name = xf86strdup(devices[n].name);
cp[ncon].Name = RhdAppendString(cp[ncon].Name, devices[n].outputName);
@@ -1861,14 +1903,14 @@ rhdAtomConnectorInfoFromSupportedDevices(atomBiosHandlePtr handle,
if (devices[n].ddc != devices[i].ddc)
continue;
- if (((devices[n].ot == RHD_OUTPUT_DACA
- || devices[n].ot == RHD_OUTPUT_DACB)
- && (devices[i].ot == RHD_OUTPUT_LVTMA
- || devices[i].ot == RHD_OUTPUT_TMDSA))
- || ((devices[i].ot == RHD_OUTPUT_DACA
- || devices[i].ot == RHD_OUTPUT_DACB)
- && (devices[n].ot == RHD_OUTPUT_LVTMA
- || devices[n].ot == RHD_OUTPUT_TMDSA))) {
+ if (((devices[n].ot == OUTPUT_DACA_ATOM
+ || devices[n].ot == OUTPUT_DACB_ATOM)
+ && (devices[i].ot == OUTPUT_LVTMA_ATOM
+ || devices[i].ot == OUTPUT_TMDSA_ATOM))
+ || ((devices[i].ot == OUTPUT_DACA_ATOM
+ || devices[i].ot == OUTPUT_DACB_ATOM)
+ && (devices[n].ot == OUTPUT_LVTMA_ATOM
+ || devices[n].ot == OUTPUT_TMDSA_ATOM))) {
cp[ncon].Output[1] = devices[i].ot;
@@ -1877,7 +1919,7 @@ rhdAtomConnectorInfoFromSupportedDevices(atomBiosHandlePtr handle,
cp[ncon].Name = RhdAppendString(cp[ncon].Name,
devices[i].outputName);
- devices[i].ot = RHD_OUTPUT_NONE; /* zero the device */
+ devices[i].ot = OUTPUT_NONE_ATOM; /* zero the device */
}
}
}
@@ -1909,6 +1951,7 @@ rhdAtomConnectorInfo(atomBiosHandlePtr handle,
return rhdAtomConnectorInfoFromSupportedDevices(handle,
&data->connectorInfo);
}
+#endif
# ifdef ATOM_BIOS_PARSER
static AtomBiosResult
@@ -2047,6 +2090,9 @@ CailDelayMicroSeconds(VOID *CAIL, UINT32 delay)
UINT32
CailReadATIRegister(VOID* CAIL, UINT32 idx)
{
+ ScrnInfoPtr pScrn = xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
UINT32 ret;
CAILFUNC(CAIL);
@@ -2094,8 +2140,6 @@ CailReadFBData(VOID* CAIL, UINT32 idx)
VOID
CailWriteFBData(VOID *CAIL, UINT32 idx, UINT32 data)
{
- ScrnInfoPtr pScrn = xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex];
- RADEONInfoPtr info = RADEONPTR(pScrn);
CAILFUNC(CAIL);
DEBUGP(ErrorF("%s(%x,%x)\n",__func__,idx,data));
@@ -2221,14 +2265,31 @@ VOID
CailWritePLL(VOID *CAIL, ULONG Address,ULONG Data)
{
ScrnInfoPtr pScrn = xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex];
- RADEONInfoPtr info = RADEONPTR(pScrn);
- unsigned char *RADEONMMIO = info->MMIO;
CAILFUNC(CAIL);
DEBUGP(ErrorF("%s(%x,%x)\n",__func__,Address,Data));
RADEONOUTPLL(pScrn, Address, Data);
}
-# endif
+void
+atombios_get_command_table_version(atomBiosHandlePtr atomBIOS, int index, int *major, int *minor)
+{
+ ATOM_MASTER_COMMAND_TABLE *cmd_table = atomBIOS->BIOSBase + atomBIOS->cmd_offset;
+ ATOM_MASTER_LIST_OF_COMMAND_TABLES *table_start;
+ ATOM_COMMON_ROM_COMMAND_TABLE_HEADER *table_hdr;
+
+ unsigned short *ptr;
+ unsigned short offset;
+
+ table_start = &cmd_table->ListOfCommandTables;
+
+ offset = *(((unsigned short *)table_start) + index);
+
+ table_hdr = atomBIOS->BIOSBase + offset;
+
+ *major = table_hdr->CommonHeader.ucTableFormatRevision;
+ *minor = table_hdr->CommonHeader.ucTableContentRevision;
+}
+
#endif /* ATOM_BIOS */
diff --git a/src/radeon_atombios.h b/src/radeon_atombios.h
index 5e8cc245..33925a52 100644
--- a/src/radeon_atombios.h
+++ b/src/radeon_atombios.h
@@ -134,6 +134,7 @@ typedef unsigned short USHORT;
# include "atombios.h"
# include "ObjectID.h"
+
/*
* This works around a bug in atombios.h where
* ATOM_MAX_SUPPORTED_DEVICE_INFO is specified incorrectly.
@@ -218,6 +219,7 @@ typedef struct _atomBiosHandle {
int scrnIndex;
unsigned char *BIOSBase;
atomDataTablesPtr atomDataPtr;
+ unsigned int cmd_offset;
pointer *scratchBase;
CARD32 fbBase;
#if XSERVER_LIBPCIACCESS
diff --git a/src/radeon_atomwrapper.c b/src/radeon_atomwrapper.c
index cdcb5322..259366c2 100644
--- a/src/radeon_atomwrapper.c
+++ b/src/radeon_atomwrapper.c
@@ -23,7 +23,11 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "radeon_atomwrapper.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+//#include "radeon_atomwrapper.h"
#define INT32 INT32
#include "CD_Common_Types.h"
@@ -36,7 +40,7 @@ ParseTableWrapper(void *pspace, int index, void *handle, void *BIOSBase,
{
DEVICE_DATA deviceData;
int ret = 0;
-
+
/* FILL OUT PARAMETER SPACE */
deviceData.pParameterSpace = (UINT32*) pspace;
deviceData.CAIL = handle;
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 6bf0dced..5f098a78 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -106,6 +106,18 @@ typedef enum
CONNECTOR_UNSUPPORTED_ATOM
} RADEONConnectorTypeATOM;
+typedef enum {
+ OUTPUT_NONE_ATOM,
+ OUTPUT_DAC_EXTERNAL_ATOM,
+ OUTPUT_DACA_ATOM,
+ OUTPUT_DACB_ATOM,
+ OUTPUT_TMDSA_ATOM,
+ OUTPUT_LVTMA_ATOM,
+ OUTPUT_TMDSB_ATOM,
+ OUTPUT_LVDS_ATOM,
+ OUTPUT_LVTMB_ATOM
+} RADEONOutputTypeATOM;
+
typedef enum
{
DAC_UNKNOWN = -1,