Rev 1321 | Rev 1428 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1321 | Rev 1403 | ||
---|---|---|---|
Line 56... | Line 56... | ||
56 | int ps_shift; |
56 | int ps_shift; |
57 | uint16_t start; |
57 | uint16_t start; |
58 | } atom_exec_context; |
58 | } atom_exec_context; |
Line 59... | Line 59... | ||
59 | 59 | ||
- | 60 | int atom_debug = 0; |
|
60 | int atom_debug = 0; |
61 | static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params); |
Line 61... | Line 62... | ||
61 | void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); |
62 | void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); |
62 | 63 | ||
63 | static uint32_t atom_arg_mask[8] = |
64 | static uint32_t atom_arg_mask[8] = |
Line 243... | Line 244... | ||
243 | val = gctx->fb_base; |
244 | val = gctx->fb_base; |
244 | break; |
245 | break; |
245 | case ATOM_WS_ATTRIBUTES: |
246 | case ATOM_WS_ATTRIBUTES: |
246 | val = gctx->io_attr; |
247 | val = gctx->io_attr; |
247 | break; |
248 | break; |
- | 249 | case ATOM_WS_REGPTR: |
|
- | 250 | val = gctx->reg_block; |
|
- | 251 | break; |
|
248 | default: |
252 | default: |
249 | val = ctx->ws[idx]; |
253 | val = ctx->ws[idx]; |
250 | } |
254 | } |
251 | break; |
255 | break; |
252 | case ATOM_ARG_ID: |
256 | case ATOM_ARG_ID: |
Line 382... | Line 386... | ||
382 | static uint32_t atom_get_src(atom_exec_context *ctx, uint8_t attr, int *ptr) |
386 | static uint32_t atom_get_src(atom_exec_context *ctx, uint8_t attr, int *ptr) |
383 | { |
387 | { |
384 | return atom_get_src_int(ctx, attr, ptr, NULL, 1); |
388 | return atom_get_src_int(ctx, attr, ptr, NULL, 1); |
385 | } |
389 | } |
Line -... | Line 390... | ||
- | 390 | ||
- | 391 | static uint32_t atom_get_src_direct(atom_exec_context *ctx, uint8_t align, int *ptr) |
|
- | 392 | { |
|
- | 393 | uint32_t val = 0xCDCDCDCD; |
|
- | 394 | ||
- | 395 | switch (align) { |
|
- | 396 | case ATOM_SRC_DWORD: |
|
- | 397 | val = U32(*ptr); |
|
- | 398 | (*ptr) += 4; |
|
- | 399 | break; |
|
- | 400 | case ATOM_SRC_WORD0: |
|
- | 401 | case ATOM_SRC_WORD8: |
|
- | 402 | case ATOM_SRC_WORD16: |
|
- | 403 | val = U16(*ptr); |
|
- | 404 | (*ptr) += 2; |
|
- | 405 | break; |
|
- | 406 | case ATOM_SRC_BYTE0: |
|
- | 407 | case ATOM_SRC_BYTE8: |
|
- | 408 | case ATOM_SRC_BYTE16: |
|
- | 409 | case ATOM_SRC_BYTE24: |
|
- | 410 | val = U8(*ptr); |
|
- | 411 | (*ptr)++; |
|
- | 412 | break; |
|
- | 413 | } |
|
- | 414 | return val; |
|
- | 415 | } |
|
386 | 416 | ||
387 | static uint32_t atom_get_dst(atom_exec_context *ctx, int arg, uint8_t attr, |
417 | static uint32_t atom_get_dst(atom_exec_context *ctx, int arg, uint8_t attr, |
388 | int *ptr, uint32_t *saved, int print) |
418 | int *ptr, uint32_t *saved, int print) |
389 | { |
419 | { |
390 | return atom_get_src_int(ctx, |
420 | return atom_get_src_int(ctx, |
Line 479... | Line 509... | ||
479 | gctx->fb_base = val; |
509 | gctx->fb_base = val; |
480 | break; |
510 | break; |
481 | case ATOM_WS_ATTRIBUTES: |
511 | case ATOM_WS_ATTRIBUTES: |
482 | gctx->io_attr = val; |
512 | gctx->io_attr = val; |
483 | break; |
513 | break; |
- | 514 | case ATOM_WS_REGPTR: |
|
- | 515 | gctx->reg_block = val; |
|
- | 516 | break; |
|
484 | default: |
517 | default: |
485 | ctx->ws[idx] = val; |
518 | ctx->ws[idx] = val; |
486 | } |
519 | } |
487 | break; |
520 | break; |
488 | case ATOM_ARG_FB: |
521 | case ATOM_ARG_FB: |
Line 571... | Line 604... | ||
571 | if (idx < ATOM_TABLE_NAMES_CNT) |
604 | if (idx < ATOM_TABLE_NAMES_CNT) |
572 | SDEBUG(" table: %d (%s)\n", idx, atom_table_names[idx]); |
605 | SDEBUG(" table: %d (%s)\n", idx, atom_table_names[idx]); |
573 | else |
606 | else |
574 | SDEBUG(" table: %d\n", idx); |
607 | SDEBUG(" table: %d\n", idx); |
575 | if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) |
608 | if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) |
576 | atom_execute_table(ctx->ctx, idx, ctx->ps + ctx->ps_shift); |
609 | atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift); |
577 | } |
610 | } |
Line 578... | Line 611... | ||
578 | 611 | ||
579 | static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) |
612 | static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) |
580 | { |
613 | { |
Line 674... | Line 707... | ||
674 | uint32_t dst, src1, src2, saved; |
707 | uint32_t dst, src1, src2, saved; |
675 | int dptr = *ptr; |
708 | int dptr = *ptr; |
676 | SDEBUG(" dst: "); |
709 | SDEBUG(" dst: "); |
677 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
710 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
678 | SDEBUG(" src1: "); |
711 | SDEBUG(" src1: "); |
679 | src1 = atom_get_src(ctx, attr, ptr); |
712 | src1 = atom_get_src_direct(ctx, ((attr >> 3) & 7), ptr); |
680 | SDEBUG(" src2: "); |
713 | SDEBUG(" src2: "); |
681 | src2 = atom_get_src(ctx, attr, ptr); |
714 | src2 = atom_get_src(ctx, attr, ptr); |
682 | dst &= src1; |
715 | dst &= src1; |
683 | dst |= src2; |
716 | dst |= src2; |
684 | SDEBUG(" dst: "); |
717 | SDEBUG(" dst: "); |
Line 806... | Line 839... | ||
806 | ctx->ctx->reg_block = U16(*ptr); |
839 | ctx->ctx->reg_block = U16(*ptr); |
807 | (*ptr) += 2; |
840 | (*ptr) += 2; |
808 | SDEBUG(" base: 0x%04X\n", ctx->ctx->reg_block); |
841 | SDEBUG(" base: 0x%04X\n", ctx->ctx->reg_block); |
809 | } |
842 | } |
Line -... | Line 843... | ||
- | 843 | ||
- | 844 | static void atom_op_shift_left(atom_exec_context *ctx, int *ptr, int arg) |
|
- | 845 | { |
|
- | 846 | uint8_t attr = U8((*ptr)++), shift; |
|
- | 847 | uint32_t saved, dst; |
|
- | 848 | int dptr = *ptr; |
|
- | 849 | attr &= 0x38; |
|
- | 850 | attr |= atom_def_dst[attr >> 3] << 6; |
|
- | 851 | SDEBUG(" dst: "); |
|
- | 852 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
|
- | 853 | shift = atom_get_src_direct(ctx, ATOM_SRC_BYTE0, ptr); |
|
- | 854 | SDEBUG(" shift: %d\n", shift); |
|
- | 855 | dst <<= shift; |
|
- | 856 | SDEBUG(" dst: "); |
|
- | 857 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
|
- | 858 | } |
|
- | 859 | ||
- | 860 | static void atom_op_shift_right(atom_exec_context *ctx, int *ptr, int arg) |
|
- | 861 | { |
|
- | 862 | uint8_t attr = U8((*ptr)++), shift; |
|
- | 863 | uint32_t saved, dst; |
|
- | 864 | int dptr = *ptr; |
|
- | 865 | attr &= 0x38; |
|
- | 866 | attr |= atom_def_dst[attr >> 3] << 6; |
|
- | 867 | SDEBUG(" dst: "); |
|
- | 868 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
|
- | 869 | shift = atom_get_src_direct(ctx, ATOM_SRC_BYTE0, ptr); |
|
- | 870 | SDEBUG(" shift: %d\n", shift); |
|
- | 871 | dst >>= shift; |
|
- | 872 | SDEBUG(" dst: "); |
|
- | 873 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
|
- | 874 | } |
|
810 | 875 | ||
811 | static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) |
876 | static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) |
812 | { |
877 | { |
813 | uint8_t attr = U8((*ptr)++), shift; |
878 | uint8_t attr = U8((*ptr)++), shift; |
814 | uint32_t saved, dst; |
879 | uint32_t saved, dst; |
815 | int dptr = *ptr; |
880 | int dptr = *ptr; |
816 | attr &= 0x38; |
881 | attr &= 0x38; |
817 | attr |= atom_def_dst[attr >> 3] << 6; |
882 | attr |= atom_def_dst[attr >> 3] << 6; |
818 | SDEBUG(" dst: "); |
883 | SDEBUG(" dst: "); |
819 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
884 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
820 | shift = U8((*ptr)++); |
885 | shift = atom_get_src(ctx, attr, ptr); |
821 | SDEBUG(" shift: %d\n", shift); |
886 | SDEBUG(" shift: %d\n", shift); |
822 | dst <<= shift; |
887 | dst <<= shift; |
823 | SDEBUG(" dst: "); |
888 | SDEBUG(" dst: "); |
824 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
889 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
Line 831... | Line 896... | ||
831 | int dptr = *ptr; |
896 | int dptr = *ptr; |
832 | attr &= 0x38; |
897 | attr &= 0x38; |
833 | attr |= atom_def_dst[attr >> 3] << 6; |
898 | attr |= atom_def_dst[attr >> 3] << 6; |
834 | SDEBUG(" dst: "); |
899 | SDEBUG(" dst: "); |
835 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
900 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
836 | shift = U8((*ptr)++); |
901 | shift = atom_get_src(ctx, attr, ptr); |
837 | SDEBUG(" shift: %d\n", shift); |
902 | SDEBUG(" shift: %d\n", shift); |
838 | dst >>= shift; |
903 | dst >>= shift; |
839 | SDEBUG(" dst: "); |
904 | SDEBUG(" dst: "); |
840 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
905 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
841 | } |
906 | } |
Line 934... | Line 999... | ||
934 | atom_op_or, ATOM_ARG_PS}, { |
999 | atom_op_or, ATOM_ARG_PS}, { |
935 | atom_op_or, ATOM_ARG_WS}, { |
1000 | atom_op_or, ATOM_ARG_WS}, { |
936 | atom_op_or, ATOM_ARG_FB}, { |
1001 | atom_op_or, ATOM_ARG_FB}, { |
937 | atom_op_or, ATOM_ARG_PLL}, { |
1002 | atom_op_or, ATOM_ARG_PLL}, { |
938 | atom_op_or, ATOM_ARG_MC}, { |
1003 | atom_op_or, ATOM_ARG_MC}, { |
939 | atom_op_shl, ATOM_ARG_REG}, { |
1004 | atom_op_shift_left, ATOM_ARG_REG}, { |
940 | atom_op_shl, ATOM_ARG_PS}, { |
1005 | atom_op_shift_left, ATOM_ARG_PS}, { |
941 | atom_op_shl, ATOM_ARG_WS}, { |
1006 | atom_op_shift_left, ATOM_ARG_WS}, { |
942 | atom_op_shl, ATOM_ARG_FB}, { |
1007 | atom_op_shift_left, ATOM_ARG_FB}, { |
943 | atom_op_shl, ATOM_ARG_PLL}, { |
1008 | atom_op_shift_left, ATOM_ARG_PLL}, { |
944 | atom_op_shl, ATOM_ARG_MC}, { |
1009 | atom_op_shift_left, ATOM_ARG_MC}, { |
945 | atom_op_shr, ATOM_ARG_REG}, { |
1010 | atom_op_shift_right, ATOM_ARG_REG}, { |
946 | atom_op_shr, ATOM_ARG_PS}, { |
1011 | atom_op_shift_right, ATOM_ARG_PS}, { |
947 | atom_op_shr, ATOM_ARG_WS}, { |
1012 | atom_op_shift_right, ATOM_ARG_WS}, { |
948 | atom_op_shr, ATOM_ARG_FB}, { |
1013 | atom_op_shift_right, ATOM_ARG_FB}, { |
949 | atom_op_shr, ATOM_ARG_PLL}, { |
1014 | atom_op_shift_right, ATOM_ARG_PLL}, { |
950 | atom_op_shr, ATOM_ARG_MC}, { |
1015 | atom_op_shift_right, ATOM_ARG_MC}, { |
951 | atom_op_mul, ATOM_ARG_REG}, { |
1016 | atom_op_mul, ATOM_ARG_REG}, { |
952 | atom_op_mul, ATOM_ARG_PS}, { |
1017 | atom_op_mul, ATOM_ARG_PS}, { |
953 | atom_op_mul, ATOM_ARG_WS}, { |
1018 | atom_op_mul, ATOM_ARG_WS}, { |
954 | atom_op_mul, ATOM_ARG_FB}, { |
1019 | atom_op_mul, ATOM_ARG_FB}, { |
955 | atom_op_mul, ATOM_ARG_PLL}, { |
1020 | atom_op_mul, ATOM_ARG_PLL}, { |
Line 1038... | Line 1103... | ||
1038 | atom_op_shr, ATOM_ARG_FB}, { |
1103 | atom_op_shr, ATOM_ARG_FB}, { |
1039 | atom_op_shr, ATOM_ARG_PLL}, { |
1104 | atom_op_shr, ATOM_ARG_PLL}, { |
1040 | atom_op_shr, ATOM_ARG_MC}, { |
1105 | atom_op_shr, ATOM_ARG_MC}, { |
1041 | atom_op_debug, 0},}; |
1106 | atom_op_debug, 0},}; |
Line 1042... | Line 1107... | ||
1042 | 1107 | ||
1043 | void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) |
1108 | static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params) |
1044 | { |
1109 | { |
1045 | int base = CU16(ctx->cmd_table + 4 + 2 * index); |
1110 | int base = CU16(ctx->cmd_table + 4 + 2 * index); |
1046 | int len, ws, ps, ptr; |
1111 | int len, ws, ps, ptr; |
1047 | unsigned char op; |
1112 | unsigned char op; |
Line 1055... | Line 1120... | ||
1055 | ps = CU8(base + ATOM_CT_PS_PTR) & ATOM_CT_PS_MASK; |
1120 | ps = CU8(base + ATOM_CT_PS_PTR) & ATOM_CT_PS_MASK; |
1056 | ptr = base + ATOM_CT_CODE_PTR; |
1121 | ptr = base + ATOM_CT_CODE_PTR; |
Line 1057... | Line 1122... | ||
1057 | 1122 | ||
Line 1058... | Line -... | ||
1058 | SDEBUG(">> execute %04X (len %d, WS %d, PS %d)\n", base, len, ws, ps); |
- | |
1059 | - | ||
1060 | /* reset reg block */ |
1123 | SDEBUG(">> execute %04X (len %d, WS %d, PS %d)\n", base, len, ws, ps); |
1061 | ctx->reg_block = 0; |
1124 | |
1062 | ectx.ctx = ctx; |
1125 | ectx.ctx = ctx; |
1063 | ectx.ps_shift = ps / 4; |
1126 | ectx.ps_shift = ps / 4; |
1064 | ectx.start = base; |
1127 | ectx.start = base; |
Line 1090... | Line 1153... | ||
1090 | 1153 | ||
1091 | if (ws) |
1154 | if (ws) |
1092 | kfree(ectx.ws); |
1155 | kfree(ectx.ws); |
Line -... | Line 1156... | ||
- | 1156 | } |
|
- | 1157 | ||
- | 1158 | void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) |
|
- | 1159 | { |
|
- | 1160 | mutex_lock(&ctx->mutex); |
|
- | 1161 | /* reset reg block */ |
|
- | 1162 | ctx->reg_block = 0; |
|
- | 1163 | /* reset fb window */ |
|
- | 1164 | ctx->fb_base = 0; |
|
- | 1165 | /* reset io mode */ |
|
- | 1166 | ctx->io_mode = ATOM_IO_MM; |
|
- | 1167 | atom_execute_table_locked(ctx, index, params); |
|
- | 1168 | mutex_unlock(&ctx->mutex); |
|
1093 | } |
1169 | } |
Line 1094... | Line 1170... | ||
1094 | 1170 | ||
1095 | static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; |
1171 | static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; |
1096 | 1172 |