summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/atombios_crtc.c20
-rw-r--r--src/atombios_output.c32
-rw-r--r--src/radeon_atombios.c113
-rw-r--r--src/radeon_atombios.h5
4 files changed, 87 insertions, 83 deletions
diff --git a/src/atombios_crtc.c b/src/atombios_crtc.c
index 8b89bcd5..54724752 100644
--- a/src/atombios_crtc.c
+++ b/src/atombios_crtc.c
@@ -86,7 +86,7 @@ atombios_lock_crtc(atomBiosHandlePtr atomBIOS, int crtc, int lock)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &crtc_data;
- if (RHDAtomBiosFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(atomBIOS->pScrn, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("%s CRTC %d success\n", lock? "Lock":"Unlock", crtc);
return ATOM_SUCCESS ;
}
@@ -109,7 +109,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->pScrn, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("%s CRTC %d success\n", state? "Enable":"Disable", crtc);
return ATOM_SUCCESS ;
}
@@ -132,7 +132,7 @@ atombios_enable_crtc_memreq(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->pScrn, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("%s CRTC memreq %d success\n", state? "Enable":"Disable", crtc);
return ATOM_SUCCESS ;
}
@@ -156,7 +156,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->pScrn, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("%s CRTC %d success\n", state? "Blank":"Unblank", crtc);
return ATOM_SUCCESS ;
}
@@ -230,7 +230,7 @@ atombios_set_crtc_timing(xf86CrtcPtr crtc, DisplayModePtr mode)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &param;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Set CRTC Timing success\n");
return ATOM_SUCCESS ;
}
@@ -281,7 +281,7 @@ atombios_set_crtc_dtd_timing(xf86CrtcPtr crtc, DisplayModePtr mode)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &param;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Set DTD CRTC Timing success\n");
return ATOM_SUCCESS ;
}
@@ -450,7 +450,7 @@ static uint32_t atombios_adjust_pll(xf86CrtcPtr crtc, DisplayModePtr mode, int *
args.v1.ucEncodeMode = atombios_get_encoder_mode(output);
ErrorF("before %d\n", args.v1.usPixelClock);
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
adjusted_clock = le16_to_cpu(args.v1.usPixelClock) * 10;
}
ErrorF("after %d\n", args.v1.usPixelClock);
@@ -468,7 +468,7 @@ static uint32_t atombios_adjust_pll(xf86CrtcPtr crtc, DisplayModePtr mode, int *
// args.v3.sInput.ucDispPllConfig |= DISPPLL_CONFIG_SS_ENABLE;
ErrorF("before %d 0x%x\n", args.v3.sInput.usPixelClock, args.v3.sInput.ucDispPllConfig);
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
adjusted_clock = args.v3.sOutput.ulDispPllFreq * 10;
if (args.v3.sOutput.ucRefDiv) {
pll_flags |= RADEON_PLL_USE_REF_DIV;
@@ -567,7 +567,7 @@ atombios_crtc_set_dcpll(xf86CrtcPtr crtc)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &args;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Set DCPLL success\n");
return;
}
@@ -709,7 +709,7 @@ atombios_crtc_set_pll(xf86CrtcPtr crtc, DisplayModePtr mode)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &args;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Set CRTC %d PLL success\n", radeon_crtc->crtc_id);
return;
}
diff --git a/src/atombios_output.c b/src/atombios_output.c
index bfaeb6ba..6c908870 100644
--- a/src/atombios_output.c
+++ b/src/atombios_output.c
@@ -233,7 +233,7 @@ atombios_output_dac_setup(xf86OutputPtr output, int action)
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->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Output DAC%d setup success\n", num);
return ATOM_SUCCESS;
}
@@ -297,7 +297,7 @@ atombios_output_tv_setup(xf86OutputPtr output, int action)
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->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Output TV setup success\n");
return ATOM_SUCCESS;
}
@@ -332,7 +332,7 @@ atombios_external_tmds_setup(xf86OutputPtr output, int action)
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->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("External TMDS setup success\n");
return ATOM_SUCCESS;
}
@@ -363,7 +363,7 @@ atombios_output_ddia_setup(xf86OutputPtr output, int action)
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->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("DDIA setup success\n");
return ATOM_SUCCESS;
}
@@ -502,7 +502,7 @@ atombios_output_digital_setup(xf86OutputPtr output, int action)
data.exec.index = index;
data.exec.dataSpace = (void *)&space;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Output digital setup success\n");
return ATOM_SUCCESS;
}
@@ -825,7 +825,7 @@ atombios_output_dig_encoder_setup(xf86OutputPtr output, int action)
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->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Output DIG%d encoder setup success\n", radeon_output->dig_encoder);
return ATOM_SUCCESS;
}
@@ -1010,7 +1010,7 @@ atombios_output_dig_transmitter_setup(xf86OutputPtr output, int action, uint8_t
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->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
if (IS_DCE32_VARIANT)
ErrorF("Output UNIPHY%d transmitter setup success\n", num);
else
@@ -1295,7 +1295,7 @@ atombios_output_yuv_setup(xf86OutputPtr output, Bool enable)
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->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
OUTREG(reg, temp);
@@ -1356,7 +1356,7 @@ atombios_output_overscan_setup(xf86OutputPtr output, DisplayModePtr mode, Displa
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &overscan_param;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Set CRTC %d Overscan success\n", radeon_crtc->crtc_id);
return ATOM_SUCCESS ;
}
@@ -1439,7 +1439,7 @@ atombios_output_scaler_setup(xf86OutputPtr output)
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->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
if (radeon_output->active_device & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT)
&& info->ChipFamily >= CHIP_FAMILY_RV515 && info->ChipFamily <= CHIP_FAMILY_RV570) {
ErrorF("forcing TV scaler\n");
@@ -1548,7 +1548,7 @@ atombios_output_dpms(xf86OutputPtr output, int mode)
reg = INREG(RADEON_BIOS_3_SCRATCH);
OUTREG(RADEON_BIOS_3_SCRATCH, reg & ~ATOM_S3_DFP2I_ACTIVE);
}
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS)
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS)
ErrorF("Output %s enable success\n",
device_name[radeon_get_device_index(radeon_output->active_device)]);
else
@@ -1580,7 +1580,7 @@ atombios_output_dpms(xf86OutputPtr output, int mode)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &disp_data;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data)
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data)
== ATOM_SUCCESS)
ErrorF("Output %s disable success\n",
device_name[radeon_get_device_index(radeon_output->active_device)]);
@@ -1734,7 +1734,7 @@ atombios_set_output_crtc_source(xf86OutputPtr output)
data.exec.index = index;
data.exec.dataSpace = (void *)&space;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Set CRTC %d Source success\n", radeon_crtc->crtc_id);
return;
}
@@ -2005,7 +2005,7 @@ atom_bios_dac_load_detect(atomBiosHandlePtr atomBIOS, xf86OutputPtr output)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &dac_data;
- if (RHDAtomBiosFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(atomBIOS->pScrn, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Dac detection success\n");
return ATOM_SUCCESS ;
}
@@ -2118,7 +2118,7 @@ retry:
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &args;
- RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data);
+ RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data);
if (args.v1.ucReplyStatus && !args.v1.ucDataOutLen) {
if (args.v1.ucReplyStatus == 0x20 && retry_count++ < 10)
goto retry;
@@ -2159,7 +2159,7 @@ RADEONDPEncoderService(xf86OutputPtr output, int action, uint8_t ucconfig, uint8
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &args;
- RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data);
+ RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data);
ErrorF("%s: %d %d\n", __func__, action, args.ucStatus);
return args.ucStatus;
diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c
index 207783b0..61ef528a 100644
--- a/src/radeon_atombios.c
+++ b/src/radeon_atombios.c
@@ -228,7 +228,7 @@ CailDebug(int scrnIndex, const char *format, ...)
va_end(ap);
}
# define CAILFUNC(ptr) \
- CailDebug(((atomBiosHandlePtr)(ptr))->scrnIndex, "CAIL: %s\n", __func__)
+ CailDebug(((atomBiosHandlePtr)(ptr))->pScrn->scrnIndex, "CAIL: %s\n", __func__)
# endif
@@ -414,10 +414,10 @@ rhdAtomGetFbBaseAndSize(atomBiosHandlePtr handle, unsigned int *base,
unsigned int *size)
{
AtomBiosArgRec data;
- if (RHDAtomBiosFunc(handle->scrnIndex, handle, GET_FW_FB_SIZE, &data)
+ if (RHDAtomBiosFunc(handle->pScrn, handle, GET_FW_FB_SIZE, &data)
== ATOM_SUCCESS) {
if (data.val == 0) {
- xf86DrvMsg(handle->scrnIndex, X_WARNING, "%s: AtomBIOS specified VRAM "
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_WARNING, "%s: AtomBIOS specified VRAM "
"scratch space size invalid\n", __func__);
return FALSE;
}
@@ -425,7 +425,7 @@ rhdAtomGetFbBaseAndSize(atomBiosHandlePtr handle, unsigned int *base,
*size = (int)data.val;
} else
return FALSE;
- if (RHDAtomBiosFunc(handle->scrnIndex, handle, GET_FW_FB_START, &data)
+ if (RHDAtomBiosFunc(handle->pScrn, handle, GET_FW_FB_START, &data)
== ATOM_SUCCESS) {
if (data.val == 0)
return FALSE;
@@ -450,32 +450,32 @@ rhdAtomAllocateFbScratch(atomBiosHandlePtr handle,
handle->fbBase = 0;
if (rhdAtomGetFbBaseAndSize(handle, &fb_base, &fb_size)) {
- xf86DrvMsg(handle->scrnIndex, X_INFO, "AtomBIOS requests %ikB"
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_INFO, "AtomBIOS requests %ikB"
" of VRAM scratch space\n",fb_size);
fb_size *= 1024; /* convert to bytes */
- xf86DrvMsg(handle->scrnIndex, X_INFO, "AtomBIOS VRAM scratch base: 0x%x\n",
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_INFO, "AtomBIOS VRAM scratch base: 0x%x\n",
fb_base);
} else {
fb_size = 20 * 1024;
- xf86DrvMsg(handle->scrnIndex, X_INFO, " default to: %i\n",fb_size);
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_INFO, " default to: %i\n",fb_size);
}
if (fb_base && fb_size && size) {
/* 4k align */
fb_size = (fb_size & ~(uint32_t)0xfff) + ((fb_size & 0xfff) ? 1 : 0);
if ((fb_base + fb_size) > (start + size)) {
- xf86DrvMsg(handle->scrnIndex, X_WARNING,
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_WARNING,
"%s: FW FB scratch area %i (size: %i)"
" extends beyond available framebuffer size %i\n",
__func__, fb_base, fb_size, size);
} else if ((fb_base + fb_size) < (start + size)) {
- xf86DrvMsg(handle->scrnIndex, X_WARNING,
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_WARNING,
"%s: FW FB scratch area not located "
"at the end of VRAM. Scratch End: "
"0x%x VRAM End: 0x%x\n", __func__,
(unsigned int)(fb_base + fb_size),
size);
} else if (fb_base < start) {
- xf86DrvMsg(handle->scrnIndex, X_WARNING,
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_WARNING,
"%s: FW FB scratch area extends below "
"the base of the free VRAM: 0x%x Base: 0x%x\n",
__func__, (unsigned int)(fb_base), start);
@@ -487,7 +487,7 @@ rhdAtomAllocateFbScratch(atomBiosHandlePtr handle,
}
if (!handle->fbBase) {
- xf86DrvMsg(handle->scrnIndex, X_INFO,
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_INFO,
"Cannot get VRAM scratch space. "
"Allocating in main memory instead\n");
handle->scratchBase = calloc(fb_size,1);
@@ -503,24 +503,24 @@ rhdAtomASICInit(atomBiosHandlePtr handle)
ASIC_INIT_PS_ALLOCATION asicInit;
AtomBiosArgRec data;
- RHDAtomBiosFunc(handle->scrnIndex, handle,
+ RHDAtomBiosFunc(handle->pScrn, handle,
GET_DEFAULT_ENGINE_CLOCK,
&data);
asicInit.sASICInitClocks.ulDefaultEngineClock = cpu_to_le32(data.val / 10);/*in 10 Khz*/
- RHDAtomBiosFunc(handle->scrnIndex, handle,
+ RHDAtomBiosFunc(handle->pScrn, handle,
GET_DEFAULT_MEMORY_CLOCK,
&data);
asicInit.sASICInitClocks.ulDefaultMemoryClock = cpu_to_le32(data.val / 10);/*in 10 Khz*/
data.exec.dataSpace = NULL;
data.exec.index = 0x0;
data.exec.pspace = &asicInit;
- xf86DrvMsg(handle->scrnIndex, X_INFO, "Calling ASIC Init\n");
- if (RHDAtomBiosFunc(handle->scrnIndex, handle,
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_INFO, "Calling ASIC Init\n");
+ if (RHDAtomBiosFunc(handle->pScrn, handle,
ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
- xf86DrvMsg(handle->scrnIndex, X_INFO, "ASIC_INIT Successful\n");
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_INFO, "ASIC_INIT Successful\n");
return TRUE;
}
- xf86DrvMsg(handle->scrnIndex, X_INFO, "ASIC_INIT Failed\n");
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_INFO, "ASIC_INIT Failed\n");
return FALSE;
}
@@ -538,7 +538,7 @@ atombios_clk_gating_setup(ScrnInfoPtr pScrn, Bool enable)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &dynclk_data;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Dynamic clock gating %s success\n", enable? "enable" : "disable");
return ATOM_SUCCESS;
}
@@ -568,7 +568,7 @@ atombios_static_pwrmgt_setup(ScrnInfoPtr pScrn, Bool enable)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &pwrmgt_data;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
ErrorF("Static power management %s success\n", enable? "enable" : "disable");
return ATOM_SUCCESS;
}
@@ -595,7 +595,7 @@ atombios_set_engine_clock(ScrnInfoPtr pScrn, uint32_t engclock)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &eng_clock_ps;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
/* ErrorF("Set engine clock success\n"); */
return ATOM_SUCCESS;
}
@@ -623,7 +623,7 @@ atombios_set_memory_clock(ScrnInfoPtr pScrn, uint32_t memclock)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &mem_clock_ps;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
/* ErrorF("Set memory clock success\n"); */
return ATOM_SUCCESS;
}
@@ -637,8 +637,8 @@ static AtomBiosResult
rhdAtomInit(atomBiosHandlePtr unused1, AtomBiosRequestID unused2,
AtomBiosArgPtr data)
{
- int scrnIndex = data->val;
- RADEONInfoPtr info = RADEONPTR(xf86Screens[scrnIndex]);
+ ScrnInfoPtr pScrn = data->pScrn;
+ RADEONInfoPtr info = RADEONPTR(pScrn);
atomDataTablesPtr atomDataPtr;
unsigned int cmd_offset;
atomBiosHandlePtr handle = NULL;
@@ -652,20 +652,20 @@ rhdAtomInit(atomBiosHandlePtr unused1, AtomBiosRequestID unused2,
#endif
if (!(atomDataPtr = calloc(1, sizeof(atomDataTables)))) {
- xf86DrvMsg(scrnIndex,X_ERROR,"Cannot allocate memory for "
+ xf86DrvMsg(pScrn->scrnIndex,X_ERROR,"Cannot allocate memory for "
"ATOM BIOS data tabes\n");
goto error;
}
- if (!rhdAtomGetDataTable(scrnIndex, info->VBIOS, atomDataPtr, &cmd_offset, BIOSImageSize))
+ if (!rhdAtomGetDataTable(pScrn->scrnIndex, info->VBIOS, atomDataPtr, &cmd_offset, BIOSImageSize))
goto error1;
if (!(handle = calloc(1, sizeof(atomBiosHandleRec)))) {
- xf86DrvMsg(scrnIndex,X_ERROR,"Cannot allocate memory\n");
+ xf86DrvMsg(pScrn->scrnIndex,X_ERROR,"Cannot allocate memory\n");
goto error1;
}
handle->BIOSBase = info->VBIOS;
handle->atomDataPtr = atomDataPtr;
handle->cmd_offset = cmd_offset;
- handle->scrnIndex = scrnIndex;
+ handle->pScrn = pScrn;
#if XSERVER_LIBPCIACCESS
handle->device = info->PciInfo;
#else
@@ -869,7 +869,7 @@ rhdAtomLvdsDDC(atomBiosHandlePtr handle, uint32_t offset, unsigned char *record)
/* for testing */
{
- xf86MonPtr mon = xf86InterpretEDID(handle->scrnIndex,EDIDBlock);
+ xf86MonPtr mon = xf86InterpretEDID(handle->pScrn->scrnIndex,EDIDBlock);
xf86PrintEDID(mon);
free(mon);
}
@@ -882,7 +882,7 @@ rhdAtomLvdsDDC(atomBiosHandlePtr handle, uint32_t offset, unsigned char *record)
break;
default:
- xf86DrvMsg(handle->scrnIndex, X_ERROR,
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_ERROR,
"%s: unknown record type: %x\n",__func__,*record);
return NULL;
}
@@ -1240,7 +1240,7 @@ rhdAtomGPIOI2CInfoQuery(atomBiosHandlePtr handle,
case ATOM_GPIO_I2C_CLK_MASK:
if ((sizeof(ATOM_COMMON_TABLE_HEADER)
+ (*val * sizeof(ATOM_GPIO_I2C_ASSIGMENT))) > size) {
- xf86DrvMsg(handle->scrnIndex, X_ERROR, "%s: GPIO_I2C Device "
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_ERROR, "%s: GPIO_I2C Device "
"num %lu exeeds table size %u\n",__func__,
(unsigned long)val,
size);
@@ -1498,7 +1498,7 @@ xf86MonPtr radeon_atom_get_edid(xf86OutputPtr output)
data.exec.dataSpace = (void *)&space;
data.exec.pspace = &edid_data;
- if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS)
+ if (RHDAtomBiosFunc(info->atomBIOS->pScrn, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS)
ErrorF("Atom Get EDID success\n");
else
ErrorF("Atom Get EDID failed\n");
@@ -2651,7 +2651,7 @@ static AtomBiosResult
rhdAtomExec (atomBiosHandlePtr handle,
AtomBiosRequestID unused, AtomBiosArgPtr data)
{
- RADEONInfoPtr info = RADEONPTR (xf86Screens[handle->scrnIndex]);
+ RADEONInfoPtr info = RADEONPTR (handle->pScrn);
Bool ret = FALSE;
char *msg;
int idx = data->exec.index;
@@ -2665,7 +2665,7 @@ rhdAtomExec (atomBiosHandlePtr handle,
return ATOM_FAILED;
if (handle->fbBase) {
if (!info->FB) {
- xf86DrvMsg(handle->scrnIndex, X_ERROR, "%s: "
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_ERROR, "%s: "
"Cannot exec AtomBIOS: framebuffer not mapped\n",
__func__);
return ATOM_FAILED;
@@ -2678,16 +2678,16 @@ rhdAtomExec (atomBiosHandlePtr handle,
handle->BIOSBase,
&msg);
if (!ret)
- xf86DrvMsg(handle->scrnIndex, X_ERROR, "%s\n",msg);
+ xf86DrvMsg(handle->pScrn->scrnIndex, X_ERROR, "%s\n",msg);
else
- xf86DrvMsgVerb(handle->scrnIndex, X_INFO, 5, "%s\n",msg);
+ xf86DrvMsgVerb(handle->pScrn->scrnIndex, X_INFO, 5, "%s\n",msg);
return (ret) ? ATOM_SUCCESS : ATOM_FAILED;
}
# endif
AtomBiosResult
-RHDAtomBiosFunc(int scrnIndex, atomBiosHandlePtr handle,
+RHDAtomBiosFunc(ScrnInfoPtr pScrn, atomBiosHandlePtr handle,
AtomBiosRequestID id, AtomBiosArgPtr data)
{
AtomBiosResult ret = ATOM_FAILED;
@@ -2708,12 +2708,12 @@ RHDAtomBiosFunc(int scrnIndex, atomBiosHandlePtr handle,
}
if (req_func == NULL) {
- xf86DrvMsg(scrnIndex, X_ERROR, "Unknown AtomBIOS request: %i\n",id);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unknown AtomBIOS request: %i\n",id);
return ATOM_NOT_IMPLEMENTED;
}
/* Hack for now */
if (id == ATOMBIOS_INIT)
- data->val = scrnIndex;
+ data->pScrn = pScrn;
if (id == ATOMBIOS_INIT || handle)
ret = req_func(handle, id, data);
@@ -2722,15 +2722,15 @@ RHDAtomBiosFunc(int scrnIndex, atomBiosHandlePtr handle,
switch (msg_f) {
case MSG_FORMAT_DEC:
- xf86DrvMsg(scrnIndex,X_INFO,"%s: %li\n", msg,
+ xf86DrvMsg(pScrn->scrnIndex,X_INFO,"%s: %li\n", msg,
(unsigned long) data->val);
break;
case MSG_FORMAT_HEX:
- xf86DrvMsg(scrnIndex,X_INFO,"%s: 0x%lx\n",msg ,
+ xf86DrvMsg(pScrn->scrnIndex,X_INFO,"%s: 0x%lx\n",msg ,
(unsigned long) data->val);
break;
case MSG_FORMAT_NONE:
- xf86DrvMsgVerb(scrnIndex, 7, X_INFO,
+ xf86DrvMsgVerb(pScrn->scrnIndex, 7, X_INFO,
"Call to %s succeeded\n", msg);
break;
}
@@ -2742,11 +2742,11 @@ RHDAtomBiosFunc(int scrnIndex, atomBiosHandlePtr handle,
switch (msg_f) {
case MSG_FORMAT_DEC:
case MSG_FORMAT_HEX:
- xf86DrvMsgVerb(scrnIndex, 1, X_WARNING,
+ xf86DrvMsgVerb(pScrn->scrnIndex, 1, X_WARNING,
"Call to %s %s\n", msg, result);
break;
case MSG_FORMAT_NONE:
- xf86DrvMsg(scrnIndex,X_INFO,"Query for %s: %s\n", msg, result);
+ xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Query for %s: %s\n", msg, result);
break;
}
}
@@ -2786,7 +2786,7 @@ CailDelayMicroSeconds(VOID *CAIL, UINT32 delay)
UINT32
CailReadATIRegister(VOID* CAIL, UINT32 idx)
{
- ScrnInfoPtr pScrn = xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex];
+ ScrnInfoPtr pScrn = ((atomBiosHandlePtr)CAIL)->pScrn;
RADEONInfoPtr info = RADEONPTR(pScrn);
RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
unsigned char *RADEONMMIO = pRADEONEnt->MMIO;
@@ -2808,7 +2808,7 @@ CailReadATIRegister(VOID* CAIL, UINT32 idx)
VOID
CailWriteATIRegister(VOID *CAIL, UINT32 idx, UINT32 data)
{
- ScrnInfoPtr pScrn = xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex];
+ ScrnInfoPtr pScrn = ((atomBiosHandlePtr)CAIL)->pScrn;
RADEONInfoPtr info = RADEONPTR(pScrn);
RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
unsigned char *RADEONMMIO = pRADEONEnt->MMIO;
@@ -2828,7 +2828,7 @@ CailWriteATIRegister(VOID *CAIL, UINT32 idx, UINT32 data)
UINT32
CailReadFBData(VOID* CAIL, UINT32 idx)
{
- ScrnInfoPtr pScrn = xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex];
+ ScrnInfoPtr pScrn = ((atomBiosHandlePtr)CAIL)->pScrn;
RADEONInfoPtr info = RADEONPTR(pScrn);
UINT32 ret;
@@ -2842,7 +2842,7 @@ CailReadFBData(VOID* CAIL, UINT32 idx)
ret = *(uint32_t*)((uint8_t*)(((atomBiosHandlePtr)CAIL)->scratchBase) + idx);
/*DEBUGP(ErrorF("%s(%x) = %x\n",__func__,idx,ret));*/
} else {
- xf86DrvMsg(((atomBiosHandlePtr)CAIL)->scrnIndex,X_ERROR,
+ xf86DrvMsg(pScrn->scrnIndex,X_ERROR,
"%s: no fbbase set\n",__func__);
return 0;
}
@@ -2852,24 +2852,25 @@ CailReadFBData(VOID* CAIL, UINT32 idx)
VOID
CailWriteFBData(VOID *CAIL, UINT32 idx, UINT32 data)
{
+ ScrnInfoPtr pScrn = ((atomBiosHandlePtr)CAIL)->pScrn;
CAILFUNC(CAIL);
/*DEBUGP(ErrorF("%s(%x,%x)\n",__func__,idx,data));*/
if (((atomBiosHandlePtr)CAIL)->fbBase) {
uint8_t *FBBase = (uint8_t*)
- RADEONPTR(xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex])->FB;
+ RADEONPTR(pScrn)->FB;
*((uint32_t*)(FBBase + (((atomBiosHandlePtr)CAIL)->fbBase) + idx)) = data;
} else if (((atomBiosHandlePtr)CAIL)->scratchBase) {
*(uint32_t*)((uint8_t*)(((atomBiosHandlePtr)CAIL)->scratchBase) + idx) = data;
} else
- xf86DrvMsg(((atomBiosHandlePtr)CAIL)->scrnIndex,X_ERROR,
+ xf86DrvMsg(pScrn->scrnIndex,X_ERROR,
"%s: no fbbase set\n",__func__);
}
ULONG
CailReadMC(VOID *CAIL, ULONG Address)
{
- ScrnInfoPtr pScrn = xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex];
+ ScrnInfoPtr pScrn = ((atomBiosHandlePtr)CAIL)->pScrn;
ULONG ret;
CAILFUNC(CAIL);
@@ -2882,7 +2883,7 @@ CailReadMC(VOID *CAIL, ULONG Address)
VOID
CailWriteMC(VOID *CAIL, ULONG Address, ULONG data)
{
- ScrnInfoPtr pScrn = xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex];
+ ScrnInfoPtr pScrn = ((atomBiosHandlePtr)CAIL)->pScrn;
CAILFUNC(CAIL);
/*DEBUGP(ErrorF("%s(%x,%x)\n",__func__,Address,data));*/
@@ -2894,14 +2895,16 @@ CailWriteMC(VOID *CAIL, ULONG Address, ULONG data)
VOID
CailReadPCIConfigData(VOID*CAIL, VOID* ret, UINT32 idx,UINT16 size)
{
- pci_device_cfg_read(RADEONPTR(xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex])->PciInfo,
+ ScrnInfoPtr pScrn = ((atomBiosHandlePtr)CAIL)->pScrn;
+ pci_device_cfg_read(RADEONPTR(pScrn)->PciInfo,
ret,idx << 2 , size >> 3, NULL);
}
VOID
CailWritePCIConfigData(VOID*CAIL,VOID*src,UINT32 idx,UINT16 size)
{
- pci_device_cfg_write(RADEONPTR(xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex])->PciInfo,
+ ScrnInfoPtr pScrn = ((atomBiosHandlePtr)CAIL)->pScrn;
+ pci_device_cfg_write(RADEONPTR(pScrn)->PciInfo,
src, idx << 2, size >> 3, NULL);
}
@@ -2963,7 +2966,7 @@ CailWritePCIConfigData(VOID*CAIL,VOID*src,UINT32 idx,UINT16 size)
ULONG
CailReadPLL(VOID *CAIL, ULONG Address)
{
- ScrnInfoPtr pScrn = xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex];
+ ScrnInfoPtr pScrn = ((atomBiosHandlePtr)CAIL)->pScrn;
ULONG ret;
CAILFUNC(CAIL);
@@ -2976,7 +2979,7 @@ CailReadPLL(VOID *CAIL, ULONG Address)
VOID
CailWritePLL(VOID *CAIL, ULONG Address,ULONG Data)
{
- ScrnInfoPtr pScrn = xf86Screens[((atomBiosHandlePtr)CAIL)->scrnIndex];
+ ScrnInfoPtr pScrn = ((atomBiosHandlePtr)CAIL)->pScrn;
CAILFUNC(CAIL);
/*DEBUGP(ErrorF("%s(%x,%x)\n",__func__,Address,Data));*/
diff --git a/src/radeon_atombios.h b/src/radeon_atombios.h
index 866c4bf3..0671b8d0 100644
--- a/src/radeon_atombios.h
+++ b/src/radeon_atombios.h
@@ -105,10 +105,11 @@ typedef union AtomBiosArg
DisplayModePtr modes;
AtomExecRec exec;
AtomFbRec fb;
+ ScrnInfoPtr pScrn;
} AtomBiosArgRec, *AtomBiosArgPtr;
extern AtomBiosResult
-RHDAtomBiosFunc(int scrnIndex, atomBiosHandlePtr handle,
+RHDAtomBiosFunc(ScrnInfoPtr pScrn, atomBiosHandlePtr handle,
AtomBiosRequestID id, AtomBiosArgPtr data);
extern Bool
@@ -254,7 +255,7 @@ typedef struct _atomDataTables
} atomDataTables, *atomDataTablesPtr;
typedef struct _atomBiosHandle {
- int scrnIndex;
+ ScrnInfoPtr pScrn;
unsigned char *BIOSBase;
atomDataTablesPtr atomDataPtr;
unsigned int cmd_offset;