1bbfff196SMarkus Armbruster #include "qemu/osdep.h" 2862b4a29SBALATON Zoltan #include "ati_int.h" 3862b4a29SBALATON Zoltan 4862b4a29SBALATON Zoltan #ifdef DEBUG_ATI 5862b4a29SBALATON Zoltan struct ati_regdesc { 6862b4a29SBALATON Zoltan const char *name; 7862b4a29SBALATON Zoltan int num; 8862b4a29SBALATON Zoltan }; 9862b4a29SBALATON Zoltan 10862b4a29SBALATON Zoltan static struct ati_regdesc ati_reg_names[] = { 11862b4a29SBALATON Zoltan {"MM_INDEX", 0x0000}, 12862b4a29SBALATON Zoltan {"MM_DATA", 0x0004}, 13862b4a29SBALATON Zoltan {"CLOCK_CNTL_INDEX", 0x0008}, 14862b4a29SBALATON Zoltan {"CLOCK_CNTL_DATA", 0x000c}, 15862b4a29SBALATON Zoltan {"BIOS_0_SCRATCH", 0x0010}, 16862b4a29SBALATON Zoltan {"BUS_CNTL", 0x0030}, 17862b4a29SBALATON Zoltan {"BUS_CNTL1", 0x0034}, 18862b4a29SBALATON Zoltan {"GEN_INT_CNTL", 0x0040}, 19862b4a29SBALATON Zoltan {"CRTC_GEN_CNTL", 0x0050}, 20862b4a29SBALATON Zoltan {"CRTC_EXT_CNTL", 0x0054}, 21862b4a29SBALATON Zoltan {"DAC_CNTL", 0x0058}, 22c82c7336SBALATON Zoltan {"GPIO_VGA_DDC", 0x0060}, 23c82c7336SBALATON Zoltan {"GPIO_DVI_DDC", 0x0064}, 24862b4a29SBALATON Zoltan {"GPIO_MONID", 0x0068}, 25862b4a29SBALATON Zoltan {"I2C_CNTL_1", 0x0094}, 26862b4a29SBALATON Zoltan {"PALETTE_INDEX", 0x00b0}, 27862b4a29SBALATON Zoltan {"PALETTE_DATA", 0x00b4}, 28862b4a29SBALATON Zoltan {"CNFG_CNTL", 0x00e0}, 29862b4a29SBALATON Zoltan {"GEN_RESET_CNTL", 0x00f0}, 30862b4a29SBALATON Zoltan {"CNFG_MEMSIZE", 0x00f8}, 31*1d8d4d86SBALATON Zoltan {"CONFIG_APER_0_BASE", 0x0100}, 32*1d8d4d86SBALATON Zoltan {"CONFIG_APER_1_BASE", 0x0104}, 33*1d8d4d86SBALATON Zoltan {"CONFIG_APER_SIZE", 0x0108}, 34*1d8d4d86SBALATON Zoltan {"CONFIG_REG_1_BASE", 0x010c}, 35*1d8d4d86SBALATON Zoltan {"CONFIG_REG_APER_SIZE", 0x0110}, 36862b4a29SBALATON Zoltan {"MEM_CNTL", 0x0140}, 37862b4a29SBALATON Zoltan {"MC_FB_LOCATION", 0x0148}, 38862b4a29SBALATON Zoltan {"MC_AGP_LOCATION", 0x014C}, 39862b4a29SBALATON Zoltan {"MC_STATUS", 0x0150}, 40862b4a29SBALATON Zoltan {"MEM_POWER_MISC", 0x015c}, 41862b4a29SBALATON Zoltan {"AGP_BASE", 0x0170}, 42862b4a29SBALATON Zoltan {"AGP_CNTL", 0x0174}, 43862b4a29SBALATON Zoltan {"AGP_APER_OFFSET", 0x0178}, 44862b4a29SBALATON Zoltan {"PCI_GART_PAGE", 0x017c}, 45862b4a29SBALATON Zoltan {"PC_NGUI_MODE", 0x0180}, 46862b4a29SBALATON Zoltan {"PC_NGUI_CTLSTAT", 0x0184}, 47862b4a29SBALATON Zoltan {"MPP_TB_CONFIG", 0x01C0}, 48862b4a29SBALATON Zoltan {"MPP_GP_CONFIG", 0x01C8}, 49862b4a29SBALATON Zoltan {"VIPH_CONTROL", 0x01D0}, 50862b4a29SBALATON Zoltan {"CRTC_H_TOTAL_DISP", 0x0200}, 51862b4a29SBALATON Zoltan {"CRTC_H_SYNC_STRT_WID", 0x0204}, 52862b4a29SBALATON Zoltan {"CRTC_V_TOTAL_DISP", 0x0208}, 53862b4a29SBALATON Zoltan {"CRTC_V_SYNC_STRT_WID", 0x020c}, 54862b4a29SBALATON Zoltan {"CRTC_VLINE_CRNT_VLINE", 0x0210}, 55862b4a29SBALATON Zoltan {"CRTC_CRNT_FRAME", 0x0214}, 56862b4a29SBALATON Zoltan {"CRTC_GUI_TRIG_VLINE", 0x0218}, 57862b4a29SBALATON Zoltan {"CRTC_OFFSET", 0x0224}, 58862b4a29SBALATON Zoltan {"CRTC_OFFSET_CNTL", 0x0228}, 59862b4a29SBALATON Zoltan {"CRTC_PITCH", 0x022c}, 60862b4a29SBALATON Zoltan {"OVR_CLR", 0x0230}, 61862b4a29SBALATON Zoltan {"OVR_WID_LEFT_RIGHT", 0x0234}, 62862b4a29SBALATON Zoltan {"OVR_WID_TOP_BOTTOM", 0x0238}, 63862b4a29SBALATON Zoltan {"CUR_OFFSET", 0x0260}, 64862b4a29SBALATON Zoltan {"CUR_HORZ_VERT_POSN", 0x0264}, 65862b4a29SBALATON Zoltan {"CUR_HORZ_VERT_OFF", 0x0268}, 66862b4a29SBALATON Zoltan {"CUR_CLR0", 0x026c}, 67862b4a29SBALATON Zoltan {"CUR_CLR1", 0x0270}, 68862b4a29SBALATON Zoltan {"LVDS_GEN_CNTL", 0x02d0}, 69862b4a29SBALATON Zoltan {"DDA_CONFIG", 0x02e0}, 70862b4a29SBALATON Zoltan {"DDA_ON_OFF", 0x02e4}, 71862b4a29SBALATON Zoltan {"VGA_DDA_CONFIG", 0x02e8}, 72862b4a29SBALATON Zoltan {"VGA_DDA_ON_OFF", 0x02ec}, 73862b4a29SBALATON Zoltan {"CRTC2_H_TOTAL_DISP", 0x0300}, 74862b4a29SBALATON Zoltan {"CRTC2_H_SYNC_STRT_WID", 0x0304}, 75862b4a29SBALATON Zoltan {"CRTC2_V_TOTAL_DISP", 0x0308}, 76862b4a29SBALATON Zoltan {"CRTC2_V_SYNC_STRT_WID", 0x030c}, 77862b4a29SBALATON Zoltan {"CRTC2_VLINE_CRNT_VLINE", 0x0310}, 78862b4a29SBALATON Zoltan {"CRTC2_CRNT_FRAME", 0x0314}, 79862b4a29SBALATON Zoltan {"CRTC2_GUI_TRIG_VLINE", 0x0318}, 80862b4a29SBALATON Zoltan {"CRTC2_OFFSET", 0x0324}, 81862b4a29SBALATON Zoltan {"CRTC2_OFFSET_CNTL", 0x0328}, 82862b4a29SBALATON Zoltan {"CRTC2_PITCH", 0x032c}, 83862b4a29SBALATON Zoltan {"DDA2_CONFIG", 0x03e0}, 84862b4a29SBALATON Zoltan {"DDA2_ON_OFF", 0x03e4}, 85862b4a29SBALATON Zoltan {"CRTC2_GEN_CNTL", 0x03f8}, 86862b4a29SBALATON Zoltan {"CRTC2_STATUS", 0x03fc}, 87862b4a29SBALATON Zoltan {"OV0_SCALE_CNTL", 0x0420}, 88862b4a29SBALATON Zoltan {"SUBPIC_CNTL", 0x0540}, 89862b4a29SBALATON Zoltan {"PM4_BUFFER_OFFSET", 0x0700}, 90862b4a29SBALATON Zoltan {"PM4_BUFFER_CNTL", 0x0704}, 91862b4a29SBALATON Zoltan {"PM4_BUFFER_WM_CNTL", 0x0708}, 92862b4a29SBALATON Zoltan {"PM4_BUFFER_DL_RPTR_ADDR", 0x070c}, 93862b4a29SBALATON Zoltan {"PM4_BUFFER_DL_RPTR", 0x0710}, 94862b4a29SBALATON Zoltan {"PM4_BUFFER_DL_WPTR", 0x0714}, 95862b4a29SBALATON Zoltan {"PM4_VC_FPU_SETUP", 0x071c}, 96862b4a29SBALATON Zoltan {"PM4_FPU_CNTL", 0x0720}, 97862b4a29SBALATON Zoltan {"PM4_VC_FORMAT", 0x0724}, 98862b4a29SBALATON Zoltan {"PM4_VC_CNTL", 0x0728}, 99862b4a29SBALATON Zoltan {"PM4_VC_I01", 0x072c}, 100862b4a29SBALATON Zoltan {"PM4_VC_VLOFF", 0x0730}, 101862b4a29SBALATON Zoltan {"PM4_VC_VLSIZE", 0x0734}, 102862b4a29SBALATON Zoltan {"PM4_IW_INDOFF", 0x0738}, 103862b4a29SBALATON Zoltan {"PM4_IW_INDSIZE", 0x073c}, 104862b4a29SBALATON Zoltan {"PM4_FPU_FPX0", 0x0740}, 105862b4a29SBALATON Zoltan {"PM4_FPU_FPY0", 0x0744}, 106862b4a29SBALATON Zoltan {"PM4_FPU_FPX1", 0x0748}, 107862b4a29SBALATON Zoltan {"PM4_FPU_FPY1", 0x074c}, 108862b4a29SBALATON Zoltan {"PM4_FPU_FPX2", 0x0750}, 109862b4a29SBALATON Zoltan {"PM4_FPU_FPY2", 0x0754}, 110862b4a29SBALATON Zoltan {"PM4_FPU_FPY3", 0x0758}, 111862b4a29SBALATON Zoltan {"PM4_FPU_FPY4", 0x075c}, 112862b4a29SBALATON Zoltan {"PM4_FPU_FPY5", 0x0760}, 113862b4a29SBALATON Zoltan {"PM4_FPU_FPY6", 0x0764}, 114862b4a29SBALATON Zoltan {"PM4_FPU_FPR", 0x0768}, 115862b4a29SBALATON Zoltan {"PM4_FPU_FPG", 0x076c}, 116862b4a29SBALATON Zoltan {"PM4_FPU_FPB", 0x0770}, 117862b4a29SBALATON Zoltan {"PM4_FPU_FPA", 0x0774}, 118862b4a29SBALATON Zoltan {"PM4_FPU_INTXY0", 0x0780}, 119862b4a29SBALATON Zoltan {"PM4_FPU_INTXY1", 0x0784}, 120862b4a29SBALATON Zoltan {"PM4_FPU_INTXY2", 0x0788}, 121862b4a29SBALATON Zoltan {"PM4_FPU_INTARGB", 0x078c}, 122862b4a29SBALATON Zoltan {"PM4_FPU_FPTWICEAREA", 0x0790}, 123862b4a29SBALATON Zoltan {"PM4_FPU_DMAJOR01", 0x0794}, 124862b4a29SBALATON Zoltan {"PM4_FPU_DMAJOR12", 0x0798}, 125862b4a29SBALATON Zoltan {"PM4_FPU_DMAJOR02", 0x079c}, 126862b4a29SBALATON Zoltan {"PM4_FPU_STAT", 0x07a0}, 127862b4a29SBALATON Zoltan {"PM4_STAT", 0x07b8}, 128862b4a29SBALATON Zoltan {"PM4_TEST_CNTL", 0x07d0}, 129862b4a29SBALATON Zoltan {"PM4_MICROCODE_ADDR", 0x07d4}, 130862b4a29SBALATON Zoltan {"PM4_MICROCODE_RADDR", 0x07d8}, 131862b4a29SBALATON Zoltan {"PM4_MICROCODE_DATAH", 0x07dc}, 132862b4a29SBALATON Zoltan {"PM4_MICROCODE_DATAL", 0x07e0}, 133862b4a29SBALATON Zoltan {"PM4_CMDFIFO_ADDR", 0x07e4}, 134862b4a29SBALATON Zoltan {"PM4_CMDFIFO_DATAH", 0x07e8}, 135862b4a29SBALATON Zoltan {"PM4_CMDFIFO_DATAL", 0x07ec}, 136862b4a29SBALATON Zoltan {"PM4_BUFFER_ADDR", 0x07f0}, 137862b4a29SBALATON Zoltan {"PM4_BUFFER_DATAH", 0x07f4}, 138862b4a29SBALATON Zoltan {"PM4_BUFFER_DATAL", 0x07f8}, 139862b4a29SBALATON Zoltan {"PM4_MICRO_CNTL", 0x07fc}, 140862b4a29SBALATON Zoltan {"CAP0_TRIG_CNTL", 0x0950}, 141862b4a29SBALATON Zoltan {"CAP1_TRIG_CNTL", 0x09c0}, 142862b4a29SBALATON Zoltan {"RBBM_STATUS", 0x0e40}, 143862b4a29SBALATON Zoltan {"PM4_FIFO_DATA_EVEN", 0x1000}, 144862b4a29SBALATON Zoltan {"PM4_FIFO_DATA_ODD", 0x1004}, 145862b4a29SBALATON Zoltan {"DST_OFFSET", 0x1404}, 146862b4a29SBALATON Zoltan {"DST_PITCH", 0x1408}, 147862b4a29SBALATON Zoltan {"DST_WIDTH", 0x140c}, 148862b4a29SBALATON Zoltan {"DST_HEIGHT", 0x1410}, 149862b4a29SBALATON Zoltan {"SRC_X", 0x1414}, 150862b4a29SBALATON Zoltan {"SRC_Y", 0x1418}, 151862b4a29SBALATON Zoltan {"DST_X", 0x141c}, 152862b4a29SBALATON Zoltan {"DST_Y", 0x1420}, 153862b4a29SBALATON Zoltan {"SRC_PITCH_OFFSET", 0x1428}, 154862b4a29SBALATON Zoltan {"DST_PITCH_OFFSET", 0x142c}, 155862b4a29SBALATON Zoltan {"SRC_Y_X", 0x1434}, 156862b4a29SBALATON Zoltan {"DST_Y_X", 0x1438}, 157862b4a29SBALATON Zoltan {"DST_HEIGHT_WIDTH", 0x143c}, 158862b4a29SBALATON Zoltan {"DP_GUI_MASTER_CNTL", 0x146c}, 159862b4a29SBALATON Zoltan {"BRUSH_SCALE", 0x1470}, 160862b4a29SBALATON Zoltan {"BRUSH_Y_X", 0x1474}, 161862b4a29SBALATON Zoltan {"DP_BRUSH_BKGD_CLR", 0x1478}, 162862b4a29SBALATON Zoltan {"DP_BRUSH_FRGD_CLR", 0x147c}, 163862b4a29SBALATON Zoltan {"DST_WIDTH_X", 0x1588}, 164862b4a29SBALATON Zoltan {"DST_HEIGHT_WIDTH_8", 0x158c}, 165862b4a29SBALATON Zoltan {"SRC_X_Y", 0x1590}, 166862b4a29SBALATON Zoltan {"DST_X_Y", 0x1594}, 167862b4a29SBALATON Zoltan {"DST_WIDTH_HEIGHT", 0x1598}, 168862b4a29SBALATON Zoltan {"DST_WIDTH_X_INCY", 0x159c}, 169862b4a29SBALATON Zoltan {"DST_HEIGHT_Y", 0x15a0}, 170862b4a29SBALATON Zoltan {"DST_X_SUB", 0x15a4}, 171862b4a29SBALATON Zoltan {"DST_Y_SUB", 0x15a8}, 172862b4a29SBALATON Zoltan {"SRC_OFFSET", 0x15ac}, 173862b4a29SBALATON Zoltan {"SRC_PITCH", 0x15b0}, 174862b4a29SBALATON Zoltan {"DST_HEIGHT_WIDTH_BW", 0x15b4}, 175862b4a29SBALATON Zoltan {"CLR_CMP_CNTL", 0x15c0}, 176862b4a29SBALATON Zoltan {"CLR_CMP_CLR_SRC", 0x15c4}, 177862b4a29SBALATON Zoltan {"CLR_CMP_CLR_DST", 0x15c8}, 178862b4a29SBALATON Zoltan {"CLR_CMP_MASK", 0x15cc}, 179862b4a29SBALATON Zoltan {"DP_SRC_FRGD_CLR", 0x15d8}, 180862b4a29SBALATON Zoltan {"DP_SRC_BKGD_CLR", 0x15dc}, 181862b4a29SBALATON Zoltan {"DST_BRES_ERR", 0x1628}, 182862b4a29SBALATON Zoltan {"DST_BRES_INC", 0x162c}, 183862b4a29SBALATON Zoltan {"DST_BRES_DEC", 0x1630}, 184862b4a29SBALATON Zoltan {"DST_BRES_LNTH", 0x1634}, 185862b4a29SBALATON Zoltan {"DST_BRES_LNTH_SUB", 0x1638}, 186862b4a29SBALATON Zoltan {"SC_LEFT", 0x1640}, 187862b4a29SBALATON Zoltan {"SC_RIGHT", 0x1644}, 188862b4a29SBALATON Zoltan {"SC_TOP", 0x1648}, 189862b4a29SBALATON Zoltan {"SC_BOTTOM", 0x164c}, 190862b4a29SBALATON Zoltan {"SRC_SC_RIGHT", 0x1654}, 191862b4a29SBALATON Zoltan {"SRC_SC_BOTTOM", 0x165c}, 192862b4a29SBALATON Zoltan {"GUI_DEBUG0", 0x16a0}, 193862b4a29SBALATON Zoltan {"GUI_DEBUG1", 0x16a4}, 194862b4a29SBALATON Zoltan {"GUI_TIMEOUT", 0x16b0}, 195862b4a29SBALATON Zoltan {"GUI_TIMEOUT0", 0x16b4}, 196862b4a29SBALATON Zoltan {"GUI_TIMEOUT1", 0x16b8}, 197862b4a29SBALATON Zoltan {"GUI_PROBE", 0x16bc}, 198862b4a29SBALATON Zoltan {"DP_CNTL", 0x16c0}, 199862b4a29SBALATON Zoltan {"DP_DATATYPE", 0x16c4}, 200862b4a29SBALATON Zoltan {"DP_MIX", 0x16c8}, 201862b4a29SBALATON Zoltan {"DP_WRITE_MASK", 0x16cc}, 202862b4a29SBALATON Zoltan {"DP_CNTL_XDIR_YDIR_YMAJOR", 0x16d0}, 203862b4a29SBALATON Zoltan {"DEFAULT_OFFSET", 0x16e0}, 204862b4a29SBALATON Zoltan {"DEFAULT_PITCH", 0x16e4}, 205862b4a29SBALATON Zoltan {"DEFAULT_SC_BOTTOM_RIGHT", 0x16e8}, 206862b4a29SBALATON Zoltan {"SC_TOP_LEFT", 0x16ec}, 207862b4a29SBALATON Zoltan {"SC_BOTTOM_RIGHT", 0x16f0}, 208862b4a29SBALATON Zoltan {"SRC_SC_BOTTOM_RIGHT", 0x16f4}, 209862b4a29SBALATON Zoltan {"DST_TILE", 0x1700}, 210862b4a29SBALATON Zoltan {"WAIT_UNTIL", 0x1720}, 211862b4a29SBALATON Zoltan {"CACHE_CNTL", 0x1724}, 212862b4a29SBALATON Zoltan {"GUI_STAT", 0x1740}, 213862b4a29SBALATON Zoltan {"PC_GUI_MODE", 0x1744}, 214862b4a29SBALATON Zoltan {"PC_GUI_CTLSTAT", 0x1748}, 215862b4a29SBALATON Zoltan {"PC_DEBUG_MODE", 0x1760}, 216862b4a29SBALATON Zoltan {"BRES_DST_ERR_DEC", 0x1780}, 217862b4a29SBALATON Zoltan {"TRAIL_BRES_T12_ERR_DEC", 0x1784}, 218862b4a29SBALATON Zoltan {"TRAIL_BRES_T12_INC", 0x1788}, 219862b4a29SBALATON Zoltan {"DP_T12_CNTL", 0x178c}, 220862b4a29SBALATON Zoltan {"DST_BRES_T1_LNTH", 0x1790}, 221862b4a29SBALATON Zoltan {"DST_BRES_T2_LNTH", 0x1794}, 222862b4a29SBALATON Zoltan {"SCALE_SRC_HEIGHT_WIDTH", 0x1994}, 223862b4a29SBALATON Zoltan {"SCALE_OFFSET_0", 0x1998}, 224862b4a29SBALATON Zoltan {"SCALE_PITCH", 0x199c}, 225862b4a29SBALATON Zoltan {"SCALE_X_INC", 0x19a0}, 226862b4a29SBALATON Zoltan {"SCALE_Y_INC", 0x19a4}, 227862b4a29SBALATON Zoltan {"SCALE_HACC", 0x19a8}, 228862b4a29SBALATON Zoltan {"SCALE_VACC", 0x19ac}, 229862b4a29SBALATON Zoltan {"SCALE_DST_X_Y", 0x19b0}, 230862b4a29SBALATON Zoltan {"SCALE_DST_HEIGHT_WIDTH", 0x19b4}, 231862b4a29SBALATON Zoltan {"SCALE_3D_CNTL", 0x1a00}, 232862b4a29SBALATON Zoltan {"SCALE_3D_DATATYPE", 0x1a20}, 233862b4a29SBALATON Zoltan {"SETUP_CNTL", 0x1bc4}, 234862b4a29SBALATON Zoltan {"SOLID_COLOR", 0x1bc8}, 235862b4a29SBALATON Zoltan {"WINDOW_XY_OFFSET", 0x1bcc}, 236862b4a29SBALATON Zoltan {"DRAW_LINE_POINT", 0x1bd0}, 237862b4a29SBALATON Zoltan {"SETUP_CNTL_PM4", 0x1bd4}, 238862b4a29SBALATON Zoltan {"DST_PITCH_OFFSET_C", 0x1c80}, 239862b4a29SBALATON Zoltan {"DP_GUI_MASTER_CNTL_C", 0x1c84}, 240862b4a29SBALATON Zoltan {"SC_TOP_LEFT_C", 0x1c88}, 241862b4a29SBALATON Zoltan {"SC_BOTTOM_RIGHT_C", 0x1c8c}, 242862b4a29SBALATON Zoltan {"CLR_CMP_MASK_3D", 0x1A28}, 243862b4a29SBALATON Zoltan {"MISC_3D_STATE_CNTL_REG", 0x1CA0}, 244862b4a29SBALATON Zoltan {"MC_SRC1_CNTL", 0x19D8}, 245862b4a29SBALATON Zoltan {"TEX_CNTL", 0x1800}, 246862b4a29SBALATON Zoltan {"RAGE128_MPP_TB_CONFIG", 0x01c0}, 247862b4a29SBALATON Zoltan {NULL, -1} 248862b4a29SBALATON Zoltan }; 249862b4a29SBALATON Zoltan 250862b4a29SBALATON Zoltan const char *ati_reg_name(int num) 251862b4a29SBALATON Zoltan { 252862b4a29SBALATON Zoltan int i; 253862b4a29SBALATON Zoltan 254862b4a29SBALATON Zoltan num &= ~3; 255862b4a29SBALATON Zoltan for (i = 0; ati_reg_names[i].name; i++) { 256862b4a29SBALATON Zoltan if (ati_reg_names[i].num == num) { 257862b4a29SBALATON Zoltan return ati_reg_names[i].name; 258862b4a29SBALATON Zoltan } 259862b4a29SBALATON Zoltan } 260862b4a29SBALATON Zoltan return "unknown"; 261862b4a29SBALATON Zoltan } 262862b4a29SBALATON Zoltan #else 263862b4a29SBALATON Zoltan const char *ati_reg_name(int num) 264862b4a29SBALATON Zoltan { 265862b4a29SBALATON Zoltan return ""; 266862b4a29SBALATON Zoltan } 267862b4a29SBALATON Zoltan #endif 268