Lines Matching +full:ati +full:- +full:base
37 #include "atom-names.h"
38 #include "atom-bits.h"
96 while (n--) in debug_print_spaces()
107 static uint32_t atom_iio_execute(struct atom_context *ctx, int base, in atom_iio_execute() argument
110 struct radeon_device *rdev = ctx->card->dev->dev_private; in atom_iio_execute()
114 switch (CU8(base)) { in atom_iio_execute()
116 base++; in atom_iio_execute()
119 temp = ctx->card->ioreg_read(ctx->card, CU16(base + 1)); in atom_iio_execute()
120 base += 3; in atom_iio_execute()
123 if (rdev->family == CHIP_RV515) in atom_iio_execute()
124 (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1)); in atom_iio_execute()
125 ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); in atom_iio_execute()
126 base += 3; in atom_iio_execute()
130 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << in atom_iio_execute()
131 CU8(base + 2)); in atom_iio_execute()
132 base += 3; in atom_iio_execute()
136 (0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + in atom_iio_execute()
138 base += 3; in atom_iio_execute()
142 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << in atom_iio_execute()
143 CU8(base + 3)); in atom_iio_execute()
145 ((index >> CU8(base + 2)) & in atom_iio_execute()
146 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + in atom_iio_execute()
148 base += 4; in atom_iio_execute()
152 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << in atom_iio_execute()
153 CU8(base + 3)); in atom_iio_execute()
155 ((data >> CU8(base + 2)) & in atom_iio_execute()
156 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + in atom_iio_execute()
158 base += 4; in atom_iio_execute()
162 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << in atom_iio_execute()
163 CU8(base + 3)); in atom_iio_execute()
165 ((ctx-> in atom_iio_execute()
166 io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - in atom_iio_execute()
168 (base in atom_iio_execute()
171 << CU8(base + 3); in atom_iio_execute()
172 base += 4; in atom_iio_execute()
186 struct atom_context *gctx = ctx->ctx; in atom_get_src_int()
195 idx += gctx->reg_block; in atom_get_src_int()
196 switch (gctx->io_mode) { in atom_get_src_int()
198 val = gctx->card->reg_read(gctx->card, idx); in atom_get_src_int()
207 if (!(gctx->io_mode & 0x80)) { in atom_get_src_int()
211 if (!gctx->iio[gctx->io_mode & 0x7F]) { in atom_get_src_int()
213 gctx->io_mode & 0x7F); in atom_get_src_int()
218 gctx->iio[gctx->io_mode & 0x7F], in atom_get_src_int()
227 val = get_unaligned_le32((u32 *)&ctx->ps[idx]); in atom_get_src_int()
238 val = gctx->divmul[0]; in atom_get_src_int()
241 val = gctx->divmul[1]; in atom_get_src_int()
244 val = gctx->data_block; in atom_get_src_int()
247 val = gctx->shift; in atom_get_src_int()
250 val = 1 << gctx->shift; in atom_get_src_int()
253 val = ~(1 << gctx->shift); in atom_get_src_int()
256 val = gctx->fb_base; in atom_get_src_int()
259 val = gctx->io_attr; in atom_get_src_int()
262 val = gctx->reg_block; in atom_get_src_int()
265 val = ctx->ws[idx]; in atom_get_src_int()
272 if (gctx->data_block) in atom_get_src_int()
273 DEBUG("ID[0x%04X+%04X]", idx, gctx->data_block); in atom_get_src_int()
277 val = U32(idx + gctx->data_block); in atom_get_src_int()
282 if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) { in atom_get_src_int()
284 gctx->fb_base + (idx * 4), gctx->scratch_size_bytes); in atom_get_src_int()
287 val = gctx->scratch[(gctx->fb_base / 4) + idx]; in atom_get_src_int()
323 val = gctx->card->pll_read(gctx->card, idx); in atom_get_src_int()
330 val = gctx->card->mc_read(gctx->card, idx); in atom_get_src_int()
340 DEBUG(".[31:0] -> 0x%08X\n", val); in atom_get_src_int()
343 DEBUG(".[15:0] -> 0x%04X\n", val); in atom_get_src_int()
346 DEBUG(".[23:8] -> 0x%04X\n", val); in atom_get_src_int()
349 DEBUG(".[31:16] -> 0x%04X\n", val); in atom_get_src_int()
352 DEBUG(".[7:0] -> 0x%02X\n", val); in atom_get_src_int()
355 DEBUG(".[15:8] -> 0x%02X\n", val); in atom_get_src_int()
358 DEBUG(".[23:16] -> 0x%02X\n", val); in atom_get_src_int()
361 DEBUG(".[31:24] -> 0x%02X\n", val); in atom_get_src_int()
456 struct atom_context *gctx = ctx->ctx; in atom_put_dst()
467 idx += gctx->reg_block; in atom_put_dst()
468 switch (gctx->io_mode) { in atom_put_dst()
471 gctx->card->reg_write(gctx->card, idx, in atom_put_dst()
474 gctx->card->reg_write(gctx->card, idx, val); in atom_put_dst()
483 if (!(gctx->io_mode & 0x80)) { in atom_put_dst()
487 if (!gctx->iio[gctx->io_mode & 0xFF]) { in atom_put_dst()
489 gctx->io_mode & 0x7F); in atom_put_dst()
492 atom_iio_execute(gctx, gctx->iio[gctx->io_mode & 0xFF], in atom_put_dst()
500 ctx->ps[idx] = cpu_to_le32(val); in atom_put_dst()
508 gctx->divmul[0] = val; in atom_put_dst()
511 gctx->divmul[1] = val; in atom_put_dst()
514 gctx->data_block = val; in atom_put_dst()
517 gctx->shift = val; in atom_put_dst()
523 gctx->fb_base = val; in atom_put_dst()
526 gctx->io_attr = val; in atom_put_dst()
529 gctx->reg_block = val; in atom_put_dst()
532 ctx->ws[idx] = val; in atom_put_dst()
538 if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) { in atom_put_dst()
540 gctx->fb_base + (idx * 4), gctx->scratch_size_bytes); in atom_put_dst()
542 gctx->scratch[(gctx->fb_base / 4) + idx] = val; in atom_put_dst()
549 gctx->card->pll_write(gctx->card, idx, val); in atom_put_dst()
555 gctx->card->mc_write(gctx->card, idx, val); in atom_put_dst()
560 DEBUG(".[31:0] <- 0x%08X\n", old_val); in atom_put_dst()
563 DEBUG(".[15:0] <- 0x%04X\n", old_val); in atom_put_dst()
566 DEBUG(".[23:8] <- 0x%04X\n", old_val); in atom_put_dst()
569 DEBUG(".[31:16] <- 0x%04X\n", old_val); in atom_put_dst()
572 DEBUG(".[7:0] <- 0x%02X\n", old_val); in atom_put_dst()
575 DEBUG(".[15:8] <- 0x%02X\n", old_val); in atom_put_dst()
578 DEBUG(".[23:16] <- 0x%02X\n", old_val); in atom_put_dst()
581 DEBUG(".[31:24] <- 0x%02X\n", old_val); in atom_put_dst()
628 if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) in atom_op_calltable()
629 r = atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift); in atom_op_calltable()
631 ctx->abort = true; in atom_op_calltable()
655 ctx->ctx->cs_equal = (dst == src); in atom_op_compare()
656 ctx->ctx->cs_above = (dst > src); in atom_op_compare()
657 SDEBUG(" result: %s %s\n", ctx->ctx->cs_equal ? "EQ" : "NE", in atom_op_compare()
658 ctx->ctx->cs_above ? "GT" : "LE"); in atom_op_compare()
682 ctx->ctx->divmul[0] = dst / src; in atom_op_div()
683 ctx->ctx->divmul[1] = dst % src; in atom_op_div()
685 ctx->ctx->divmul[0] = 0; in atom_op_div()
686 ctx->ctx->divmul[1] = 0; in atom_op_div()
703 execute = ctx->ctx->cs_above; in atom_op_jump()
706 execute = ctx->ctx->cs_above || ctx->ctx->cs_equal; in atom_op_jump()
712 execute = !(ctx->ctx->cs_above || ctx->ctx->cs_equal); in atom_op_jump()
715 execute = !ctx->ctx->cs_above; in atom_op_jump()
718 execute = ctx->ctx->cs_equal; in atom_op_jump()
721 execute = !ctx->ctx->cs_equal; in atom_op_jump()
728 if (ctx->last_jump == (ctx->start + target)) { in atom_op_jump()
730 if (time_after(cjiffies, ctx->last_jump_jiffies)) { in atom_op_jump()
731 cjiffies -= ctx->last_jump_jiffies; in atom_op_jump()
734 ctx->abort = true; in atom_op_jump()
738 ctx->last_jump_jiffies = jiffies; in atom_op_jump()
741 ctx->last_jump = ctx->start + target; in atom_op_jump()
742 ctx->last_jump_jiffies = jiffies; in atom_op_jump()
744 *ptr = ctx->start + target; in atom_op_jump()
790 ctx->ctx->divmul[0] = dst * src; in atom_op_mul()
839 ctx->ctx->data_block = 0; in atom_op_setdatablock()
841 ctx->ctx->data_block = ctx->start; in atom_op_setdatablock()
843 ctx->ctx->data_block = U16(ctx->ctx->data_table + 4 + 2 * idx); in atom_op_setdatablock()
844 SDEBUG(" base: 0x%04X\n", ctx->ctx->data_block); in atom_op_setdatablock()
851 ctx->ctx->fb_base = atom_get_src(ctx, attr, ptr); in atom_op_setfbbase()
865 ctx->ctx->io_mode = ATOM_IO_MM; in atom_op_setport()
867 ctx->ctx->io_mode = ATOM_IO_IIO | port; in atom_op_setport()
871 ctx->ctx->io_mode = ATOM_IO_PCI; in atom_op_setport()
875 ctx->ctx->io_mode = ATOM_IO_SYSIO; in atom_op_setport()
883 ctx->ctx->reg_block = U16(*ptr); in atom_op_setregblock()
885 SDEBUG(" base: 0x%04X\n", ctx->ctx->reg_block); in atom_op_setregblock()
967 dst -= src; in atom_op_sub()
988 *ptr = ctx->start + target; in atom_op_switch()
1007 ctx->ctx->cs_equal = ((dst & src) == 0); in atom_op_test()
1008 SDEBUG(" result: %s\n", ctx->ctx->cs_equal ? "EQ" : "NE"); in atom_op_test()
1160 int base = CU16(ctx->cmd_table + 4 + 2 * index); in atom_execute_table_locked() local
1166 if (!base) in atom_execute_table_locked()
1167 return -EINVAL; in atom_execute_table_locked()
1169 len = CU16(base + ATOM_CT_SIZE_PTR); in atom_execute_table_locked()
1170 ws = CU8(base + ATOM_CT_WS_PTR); in atom_execute_table_locked()
1171 ps = CU8(base + ATOM_CT_PS_PTR) & ATOM_CT_PS_MASK; in atom_execute_table_locked()
1172 ptr = base + ATOM_CT_CODE_PTR; in atom_execute_table_locked()
1174 SDEBUG(">> execute %04X (len %d, WS %d, PS %d)\n", base, len, ws, ps); in atom_execute_table_locked()
1178 ectx.start = base; in atom_execute_table_locked()
1191 SDEBUG("%s @ 0x%04X\n", atom_op_names[op], ptr - 1); in atom_execute_table_locked()
1193 SDEBUG("[%d] @ 0x%04X\n", op, ptr - 1); in atom_execute_table_locked()
1196 base, len, ws, ps, ptr - 1); in atom_execute_table_locked()
1197 ret = -EINVAL; in atom_execute_table_locked()
1210 debug_depth--; in atom_execute_table_locked()
1222 mutex_lock(&ctx->mutex); in atom_execute_table_scratch_unlocked()
1224 ctx->data_block = 0; in atom_execute_table_scratch_unlocked()
1226 ctx->reg_block = 0; in atom_execute_table_scratch_unlocked()
1228 ctx->fb_base = 0; in atom_execute_table_scratch_unlocked()
1230 ctx->io_mode = ATOM_IO_MM; in atom_execute_table_scratch_unlocked()
1232 ctx->divmul[0] = 0; in atom_execute_table_scratch_unlocked()
1233 ctx->divmul[1] = 0; in atom_execute_table_scratch_unlocked()
1235 mutex_unlock(&ctx->mutex); in atom_execute_table_scratch_unlocked()
1242 mutex_lock(&ctx->scratch_mutex); in atom_execute_table()
1244 mutex_unlock(&ctx->scratch_mutex); in atom_execute_table()
1250 static void atom_index_iio(struct atom_context *ctx, int base) in atom_index_iio() argument
1252 ctx->iio = kzalloc(2 * 256, GFP_KERNEL); in atom_index_iio()
1253 if (!ctx->iio) in atom_index_iio()
1255 while (CU8(base) == ATOM_IIO_START) { in atom_index_iio()
1256 ctx->iio[CU8(base + 1)] = base + 2; in atom_index_iio()
1257 base += 2; in atom_index_iio()
1258 while (CU8(base) != ATOM_IIO_END) in atom_index_iio()
1259 base += atom_iio_len[CU8(base)]; in atom_index_iio()
1260 base += 3; in atom_index_iio()
1266 int base; in atom_parse() local
1276 ctx->card = card; in atom_parse()
1277 ctx->bios = bios; in atom_parse()
1287 pr_info("Invalid ATI magic\n"); in atom_parse()
1292 base = CU16(ATOM_ROM_TABLE_PTR); in atom_parse()
1294 (CSTR(base + ATOM_ROM_MAGIC_PTR), ATOM_ROM_MAGIC, in atom_parse()
1301 ctx->cmd_table = CU16(base + ATOM_ROM_CMD_PTR); in atom_parse()
1302 ctx->data_table = CU16(base + ATOM_ROM_DATA_PTR); in atom_parse()
1303 atom_index_iio(ctx, CU16(ctx->data_table + ATOM_DATA_IIO_PTR) + 4); in atom_parse()
1304 if (!ctx->iio) { in atom_parse()
1309 str = CSTR(CU16(base + ATOM_ROM_MSG_PTR)); in atom_parse()
1327 struct radeon_device *rdev = ctx->card->dev->dev_private; in atom_asic_init()
1328 int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); in atom_asic_init()
1339 if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) in atom_asic_init()
1347 if (rdev->family < CHIP_R600) { in atom_asic_init()
1348 if (CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_SPDFANCNTL)) in atom_asic_init()
1356 kfree(ctx->iio); in atom_destroy()
1365 int idx = CU16(ctx->data_table + offset); in atom_parse_data_header()
1366 u16 *mdt = (u16 *)(ctx->bios + ctx->data_table + 4); in atom_parse_data_header()
1385 int idx = CU16(ctx->cmd_table + offset); in atom_parse_cmd_header()
1386 u16 *mct = (u16 *)(ctx->bios + ctx->cmd_table + 4); in atom_parse_cmd_header()
1406 firmware_usage = (struct _ATOM_VRAM_USAGE_BY_FIRMWARE *)(ctx->bios + data_offset); in atom_allocate_fb_scratch()
1409 le32_to_cpu(firmware_usage->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware), in atom_allocate_fb_scratch()
1410 le16_to_cpu(firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb)); in atom_allocate_fb_scratch()
1412 usage_bytes = le16_to_cpu(firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb) * 1024; in atom_allocate_fb_scratch()
1414 ctx->scratch_size_bytes = 0; in atom_allocate_fb_scratch()
1418 ctx->scratch = kzalloc(usage_bytes, GFP_KERNEL); in atom_allocate_fb_scratch()
1419 if (!ctx->scratch) in atom_allocate_fb_scratch()
1420 return -ENOMEM; in atom_allocate_fb_scratch()
1421 ctx->scratch_size_bytes = usage_bytes; in atom_allocate_fb_scratch()