Rev 1430 | Rev 2160 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1430 | Rev 1963 | ||
---|---|---|---|
Line 22... | Line 22... | ||
22 | * Author: Stanislaw Skowronek |
22 | * Author: Stanislaw Skowronek |
23 | */ |
23 | */ |
Line 24... | Line 24... | ||
24 | 24 | ||
25 | #include |
25 | #include |
- | 26 | #include |
|
26 | #include |
27 | #include |
Line 27... | Line 28... | ||
27 | #include |
28 | #include |
Line 28... | Line 29... | ||
28 | 29 | ||
29 | #define ATOM_DEBUG |
30 | #define ATOM_DEBUG |
30 | 31 | ||
- | 32 | #include "atom.h" |
|
Line 31... | Line 33... | ||
31 | #include "atom.h" |
33 | #include "atom-names.h" |
32 | #include "atom-names.h" |
34 | #include "atom-bits.h" |
33 | #include "atom-bits.h" |
35 | #include "radeon.h" |
34 | 36 | ||
Line 50... | Line 52... | ||
50 | #define PLL_INDEX 2 |
52 | #define PLL_INDEX 2 |
51 | #define PLL_DATA 3 |
53 | #define PLL_DATA 3 |
Line 52... | Line 54... | ||
52 | 54 | ||
53 | typedef struct { |
55 | typedef struct { |
54 | struct atom_context *ctx; |
- | |
55 | 56 | struct atom_context *ctx; |
|
56 | uint32_t *ps, *ws; |
57 | uint32_t *ps, *ws; |
57 | int ps_shift; |
58 | int ps_shift; |
- | 59 | uint16_t start; |
|
- | 60 | unsigned last_jump; |
|
- | 61 | unsigned long last_jump_jiffies; |
|
58 | uint16_t start; |
62 | bool abort; |
Line 59... | Line 63... | ||
59 | } atom_exec_context; |
63 | } atom_exec_context; |
60 | 64 | ||
61 | int atom_debug = 0; |
65 | int atom_debug = 0; |
Line 62... | Line 66... | ||
62 | static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params); |
66 | static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params); |
63 | void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); |
67 | int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); |
64 | 68 | ||
65 | static uint32_t atom_arg_mask[8] = |
69 | static uint32_t atom_arg_mask[8] = |
Line 96... | Line 100... | ||
96 | #endif |
100 | #endif |
Line 97... | Line 101... | ||
97 | 101 | ||
98 | static uint32_t atom_iio_execute(struct atom_context *ctx, int base, |
102 | static uint32_t atom_iio_execute(struct atom_context *ctx, int base, |
99 | uint32_t index, uint32_t data) |
103 | uint32_t index, uint32_t data) |
- | 104 | { |
|
100 | { |
105 | struct radeon_device *rdev = ctx->card->dev->dev_private; |
- | 106 | uint32_t temp = 0xCDCDCDCD; |
|
101 | uint32_t temp = 0xCDCDCDCD; |
107 | |
102 | while (1) |
108 | while (1) |
103 | switch (CU8(base)) { |
109 | switch (CU8(base)) { |
104 | case ATOM_IIO_NOP: |
110 | case ATOM_IIO_NOP: |
105 | base++; |
111 | base++; |
106 | break; |
112 | break; |
107 | case ATOM_IIO_READ: |
113 | case ATOM_IIO_READ: |
108 | temp = ctx->card->reg_read(ctx->card, CU16(base + 1)); |
114 | temp = ctx->card->ioreg_read(ctx->card, CU16(base + 1)); |
109 | base += 3; |
115 | base += 3; |
110 | break; |
116 | break; |
- | 117 | case ATOM_IIO_WRITE: |
|
111 | case ATOM_IIO_WRITE: |
118 | if (rdev->family == CHIP_RV515) |
112 | (void)ctx->card->reg_read(ctx->card, CU16(base + 1)); |
119 | (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1)); |
113 | ctx->card->reg_write(ctx->card, CU16(base + 1), temp); |
120 | ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); |
114 | base += 3; |
121 | base += 3; |
115 | break; |
122 | break; |
116 | case ATOM_IIO_CLEAR: |
123 | case ATOM_IIO_CLEAR: |
117 | temp &= |
124 | temp &= |
Line 126... | Line 133... | ||
126 | base += 3; |
133 | base += 3; |
127 | break; |
134 | break; |
128 | case ATOM_IIO_MOVE_INDEX: |
135 | case ATOM_IIO_MOVE_INDEX: |
129 | temp &= |
136 | temp &= |
130 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
137 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
131 | CU8(base + 2)); |
138 | CU8(base + 3)); |
132 | temp |= |
139 | temp |= |
133 | ((index >> CU8(base + 2)) & |
140 | ((index >> CU8(base + 2)) & |
134 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + |
141 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + |
135 | 3); |
142 | 3); |
136 | base += 4; |
143 | base += 4; |
137 | break; |
144 | break; |
138 | case ATOM_IIO_MOVE_DATA: |
145 | case ATOM_IIO_MOVE_DATA: |
139 | temp &= |
146 | temp &= |
140 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
147 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
141 | CU8(base + 2)); |
148 | CU8(base + 3)); |
142 | temp |= |
149 | temp |= |
143 | ((data >> CU8(base + 2)) & |
150 | ((data >> CU8(base + 2)) & |
144 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + |
151 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + |
145 | 3); |
152 | 3); |
146 | base += 4; |
153 | base += 4; |
147 | break; |
154 | break; |
148 | case ATOM_IIO_MOVE_ATTR: |
155 | case ATOM_IIO_MOVE_ATTR: |
149 | temp &= |
156 | temp &= |
150 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
157 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
151 | CU8(base + 2)); |
158 | CU8(base + 3)); |
152 | temp |= |
159 | temp |= |
153 | ((ctx-> |
160 | ((ctx-> |
154 | io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - |
161 | io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - |
155 | CU8 |
162 | CU8 |
156 | (base |
163 | (base |
Line 602... | Line 609... | ||
602 | } |
609 | } |
Line 603... | Line 610... | ||
603 | 610 | ||
604 | static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg) |
611 | static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg) |
605 | { |
612 | { |
- | 613 | int idx = U8((*ptr)++); |
|
- | 614 | int r = 0; |
|
606 | int idx = U8((*ptr)++); |
615 | |
607 | if (idx < ATOM_TABLE_NAMES_CNT) |
616 | if (idx < ATOM_TABLE_NAMES_CNT) |
608 | SDEBUG(" table: %d (%s)\n", idx, atom_table_names[idx]); |
617 | SDEBUG(" table: %d (%s)\n", idx, atom_table_names[idx]); |
609 | else |
618 | else |
610 | SDEBUG(" table: %d\n", idx); |
619 | SDEBUG(" table: %d\n", idx); |
611 | if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) |
620 | if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) |
- | 621 | r = atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift); |
|
- | 622 | if (r) { |
|
- | 623 | ctx->abort = true; |
|
612 | atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift); |
624 | } |
Line 613... | Line 625... | ||
613 | } |
625 | } |
614 | 626 | ||
615 | static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) |
627 | static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) |
Line 638... | Line 650... | ||
638 | ctx->ctx->cs_above ? "GT" : "LE"); |
650 | ctx->ctx->cs_above ? "GT" : "LE"); |
639 | } |
651 | } |
Line 640... | Line 652... | ||
640 | 652 | ||
641 | static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) |
653 | static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) |
642 | { |
654 | { |
643 | uint8_t count = U8((*ptr)++); |
655 | unsigned count = U8((*ptr)++); |
644 | SDEBUG(" count: %d\n", count); |
656 | SDEBUG(" count: %d\n", count); |
645 | if (arg == ATOM_UNIT_MICROSEC) |
657 | if (arg == ATOM_UNIT_MICROSEC) |
646 | udelay(count); |
658 | udelay(count); |
647 | else |
659 | else |
648 | mdelay(count); |
660 | msleep(count); |
Line 649... | Line 661... | ||
649 | } |
661 | } |
650 | 662 | ||
651 | static void atom_op_div(atom_exec_context *ctx, int *ptr, int arg) |
663 | static void atom_op_div(atom_exec_context *ctx, int *ptr, int arg) |
Line 671... | Line 683... | ||
671 | } |
683 | } |
Line 672... | Line 684... | ||
672 | 684 | ||
673 | static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) |
685 | static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) |
674 | { |
686 | { |
- | 687 | int execute = 0, target = U16(*ptr); |
|
- | 688 | unsigned long cjiffies; |
|
675 | int execute = 0, target = U16(*ptr); |
689 | |
676 | (*ptr) += 2; |
690 | (*ptr) += 2; |
677 | switch (arg) { |
691 | switch (arg) { |
678 | case ATOM_COND_ABOVE: |
692 | case ATOM_COND_ABOVE: |
679 | execute = ctx->ctx->cs_above; |
693 | execute = ctx->ctx->cs_above; |
Line 705... | Line 719... | ||
705 | } |
719 | } |
Line 706... | Line 720... | ||
706 | 720 | ||
707 | static void atom_op_mask(atom_exec_context *ctx, int *ptr, int arg) |
721 | static void atom_op_mask(atom_exec_context *ctx, int *ptr, int arg) |
708 | { |
722 | { |
709 | uint8_t attr = U8((*ptr)++); |
723 | uint8_t attr = U8((*ptr)++); |
710 | uint32_t dst, src1, src2, saved; |
724 | uint32_t dst, mask, src, saved; |
711 | int dptr = *ptr; |
725 | int dptr = *ptr; |
712 | SDEBUG(" dst: "); |
726 | SDEBUG(" dst: "); |
713 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
- | |
714 | SDEBUG(" src1: "); |
727 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
- | 728 | mask = atom_get_src_direct(ctx, ((attr >> 3) & 7), ptr); |
|
715 | src1 = atom_get_src_direct(ctx, ((attr >> 3) & 7), ptr); |
729 | SDEBUG(" mask: 0x%08x", mask); |
716 | SDEBUG(" src2: "); |
730 | SDEBUG(" src: "); |
717 | src2 = atom_get_src(ctx, attr, ptr); |
731 | src = atom_get_src(ctx, attr, ptr); |
718 | dst &= src1; |
732 | dst &= mask; |
719 | dst |= src2; |
733 | dst |= src; |
720 | SDEBUG(" dst: "); |
734 | SDEBUG(" dst: "); |
721 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
735 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
Line 722... | Line 736... | ||
722 | } |
736 | } |
Line 879... | Line 893... | ||
879 | static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) |
893 | static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) |
880 | { |
894 | { |
881 | uint8_t attr = U8((*ptr)++), shift; |
895 | uint8_t attr = U8((*ptr)++), shift; |
882 | uint32_t saved, dst; |
896 | uint32_t saved, dst; |
883 | int dptr = *ptr; |
897 | int dptr = *ptr; |
- | 898 | uint32_t dst_align = atom_dst_to_src[(attr >> 3) & 7][(attr >> 6) & 3]; |
|
884 | SDEBUG(" dst: "); |
899 | SDEBUG(" dst: "); |
885 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
900 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
- | 901 | /* op needs to full dst value */ |
|
- | 902 | dst = saved; |
|
886 | shift = atom_get_src(ctx, attr, ptr); |
903 | shift = atom_get_src(ctx, attr, ptr); |
887 | SDEBUG(" shift: %d\n", shift); |
904 | SDEBUG(" shift: %d\n", shift); |
888 | dst <<= shift; |
905 | dst <<= shift; |
- | 906 | dst &= atom_arg_mask[dst_align]; |
|
- | 907 | dst >>= atom_arg_shift[dst_align]; |
|
889 | SDEBUG(" dst: "); |
908 | SDEBUG(" dst: "); |
890 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
909 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
891 | } |
910 | } |
Line 892... | Line 911... | ||
892 | 911 | ||
893 | static void atom_op_shr(atom_exec_context *ctx, int *ptr, int arg) |
912 | static void atom_op_shr(atom_exec_context *ctx, int *ptr, int arg) |
894 | { |
913 | { |
895 | uint8_t attr = U8((*ptr)++), shift; |
914 | uint8_t attr = U8((*ptr)++), shift; |
896 | uint32_t saved, dst; |
915 | uint32_t saved, dst; |
- | 916 | int dptr = *ptr; |
|
897 | int dptr = *ptr; |
917 | uint32_t dst_align = atom_dst_to_src[(attr >> 3) & 7][(attr >> 6) & 3]; |
898 | SDEBUG(" dst: "); |
918 | SDEBUG(" dst: "); |
- | 919 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
|
- | 920 | /* op needs to full dst value */ |
|
899 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
921 | dst = saved; |
900 | shift = atom_get_src(ctx, attr, ptr); |
922 | shift = atom_get_src(ctx, attr, ptr); |
901 | SDEBUG(" shift: %d\n", shift); |
923 | SDEBUG(" shift: %d\n", shift); |
- | 924 | dst >>= shift; |
|
- | 925 | dst &= atom_arg_mask[dst_align]; |
|
902 | dst >>= shift; |
926 | dst >>= atom_arg_shift[dst_align]; |
903 | SDEBUG(" dst: "); |
927 | SDEBUG(" dst: "); |
904 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
928 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); |
Line 905... | Line 929... | ||
905 | } |
929 | } |
Line 1102... | Line 1126... | ||
1102 | atom_op_shr, ATOM_ARG_FB}, { |
1126 | atom_op_shr, ATOM_ARG_FB}, { |
1103 | atom_op_shr, ATOM_ARG_PLL}, { |
1127 | atom_op_shr, ATOM_ARG_PLL}, { |
1104 | atom_op_shr, ATOM_ARG_MC}, { |
1128 | atom_op_shr, ATOM_ARG_MC}, { |
1105 | atom_op_debug, 0},}; |
1129 | atom_op_debug, 0},}; |
Line 1106... | Line 1130... | ||
1106 | 1130 | ||
1107 | static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params) |
1131 | static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params) |
1108 | { |
1132 | { |
1109 | int base = CU16(ctx->cmd_table + 4 + 2 * index); |
1133 | int base = CU16(ctx->cmd_table + 4 + 2 * index); |
1110 | int len, ws, ps, ptr; |
1134 | int len, ws, ps, ptr; |
1111 | unsigned char op; |
1135 | unsigned char op; |
- | 1136 | atom_exec_context ectx; |
|
Line 1112... | Line 1137... | ||
1112 | atom_exec_context ectx; |
1137 | int ret = 0; |
1113 | 1138 | ||
Line 1114... | Line 1139... | ||
1114 | if (!base) |
1139 | if (!base) |
1115 | return; |
1140 | return -EINVAL; |
1116 | 1141 | ||
1117 | len = CU16(base + ATOM_CT_SIZE_PTR); |
1142 | len = CU16(base + ATOM_CT_SIZE_PTR); |
Line 1123... | Line 1148... | ||
1123 | 1148 | ||
1124 | ectx.ctx = ctx; |
1149 | ectx.ctx = ctx; |
1125 | ectx.ps_shift = ps / 4; |
1150 | ectx.ps_shift = ps / 4; |
1126 | ectx.start = base; |
1151 | ectx.start = base; |
- | 1152 | ectx.ps = params; |
|
- | 1153 | ectx.abort = false; |
|
1127 | ectx.ps = params; |
1154 | ectx.last_jump = 0; |
1128 | if (ws) |
1155 | if (ws) |
1129 | ectx.ws = kzalloc(4 * ws, GFP_KERNEL); |
1156 | ectx.ws = kzalloc(4 * ws, GFP_KERNEL); |
1130 | else |
1157 | else |
Line 1135... | Line 1162... | ||
1135 | op = CU8(ptr++); |
1162 | op = CU8(ptr++); |
1136 | if (op < ATOM_OP_NAMES_CNT) |
1163 | if (op < ATOM_OP_NAMES_CNT) |
1137 | SDEBUG("%s @ 0x%04X\n", atom_op_names[op], ptr - 1); |
1164 | SDEBUG("%s @ 0x%04X\n", atom_op_names[op], ptr - 1); |
1138 | else |
1165 | else |
1139 | SDEBUG("[%d] @ 0x%04X\n", op, ptr - 1); |
1166 | SDEBUG("[%d] @ 0x%04X\n", op, ptr - 1); |
- | 1167 | if (ectx.abort) { |
|
- | 1168 | DRM_ERROR("atombios stuck executing %04X (len %d, WS %d, PS %d) @ 0x%04X\n", |
|
- | 1169 | base, len, ws, ps, ptr - 1); |
|
- | 1170 | ret = -EINVAL; |
|
- | 1171 | goto free; |
|
- | 1172 | } |
|
Line 1140... | Line 1173... | ||
1140 | 1173 | ||
1141 | if (op < ATOM_OP_CNT && op > 0) |
1174 | if (op < ATOM_OP_CNT && op > 0) |
1142 | opcode_table[op].func(&ectx, &ptr, |
1175 | opcode_table[op].func(&ectx, &ptr, |
1143 | opcode_table[op].arg); |
1176 | opcode_table[op].arg); |
Line 1148... | Line 1181... | ||
1148 | break; |
1181 | break; |
1149 | } |
1182 | } |
1150 | debug_depth--; |
1183 | debug_depth--; |
1151 | SDEBUG("<<\n"); |
1184 | SDEBUG("<<\n"); |
Line -... | Line 1185... | ||
- | 1185 | ||
1152 | 1186 | free: |
|
1153 | if (ws) |
1187 | if (ws) |
- | 1188 | kfree(ectx.ws); |
|
1154 | kfree(ectx.ws); |
1189 | return ret; |
Line 1155... | Line 1190... | ||
1155 | } |
1190 | } |
1156 | 1191 | ||
- | 1192 | int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) |
|
- | 1193 | { |
|
1157 | void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) |
1194 | int r; |
1158 | { |
1195 | |
1159 | mutex_lock(&ctx->mutex); |
1196 | mutex_lock(&ctx->mutex); |
1160 | /* reset reg block */ |
1197 | /* reset reg block */ |
1161 | ctx->reg_block = 0; |
1198 | ctx->reg_block = 0; |
1162 | /* reset fb window */ |
1199 | /* reset fb window */ |
1163 | ctx->fb_base = 0; |
1200 | ctx->fb_base = 0; |
1164 | /* reset io mode */ |
1201 | /* reset io mode */ |
1165 | ctx->io_mode = ATOM_IO_MM; |
1202 | ctx->io_mode = ATOM_IO_MM; |
- | 1203 | r = atom_execute_table_locked(ctx, index, params); |
|
1166 | atom_execute_table_locked(ctx, index, params); |
1204 | mutex_unlock(&ctx->mutex); |
Line 1167... | Line 1205... | ||
1167 | mutex_unlock(&ctx->mutex); |
1205 | return r; |
Line 1168... | Line 1206... | ||
1168 | } |
1206 | } |
Line 1246... | Line 1284... | ||
1246 | if (!ps[0] || !ps[1]) |
1284 | if (!ps[0] || !ps[1]) |
1247 | return 1; |
1285 | return 1; |
Line 1248... | Line 1286... | ||
1248 | 1286 | ||
1249 | if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) |
1287 | if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) |
1250 | return 1; |
1288 | return 1; |
1251 | atom_execute_table(ctx, ATOM_CMD_INIT, ps); |
- | |
1252 | - | ||
1253 | return 0; |
1289 | return atom_execute_table(ctx, ATOM_CMD_INIT, ps); |
Line 1254... | Line 1290... | ||
1254 | } |
1290 | } |
1255 | 1291 | ||
1256 | void atom_destroy(struct atom_context *ctx) |
1292 | void atom_destroy(struct atom_context *ctx) |
1257 | { |
1293 | { |
1258 | if (ctx->iio) |
1294 | if (ctx->iio) |
1259 | kfree(ctx->iio); |
1295 | kfree(ctx->iio); |
Line 1260... | Line 1296... | ||
1260 | kfree(ctx); |
1296 | kfree(ctx); |
1261 | } |
1297 | } |
1262 | 1298 | ||
1263 | void atom_parse_data_header(struct atom_context *ctx, int index, |
1299 | bool atom_parse_data_header(struct atom_context *ctx, int index, |
1264 | uint16_t * size, uint8_t * frev, uint8_t * crev, |
1300 | uint16_t * size, uint8_t * frev, uint8_t * crev, |
1265 | uint16_t * data_start) |
1301 | uint16_t * data_start) |
- | 1302 | { |
|
- | 1303 | int offset = index * 2 + 4; |
|
- | 1304 | int idx = CU16(ctx->data_table + offset); |
|
- | 1305 | u16 *mdt = (u16 *)(ctx->bios + ctx->data_table + 4); |
|
Line 1266... | Line 1306... | ||
1266 | { |
1306 | |
1267 | int offset = index * 2 + 4; |
1307 | if (!mdt[index]) |
1268 | int idx = CU16(ctx->data_table + offset); |
1308 | return false; |
1269 | 1309 | ||
1270 | if (size) |
1310 | if (size) |
1271 | *size = CU16(idx); |
1311 | *size = CU16(idx); |
1272 | if (frev) |
1312 | if (frev) |
1273 | *frev = CU8(idx + 2); |
1313 | *frev = CU8(idx + 2); |
1274 | if (crev) |
1314 | if (crev) |
Line 1275... | Line 1315... | ||
1275 | *crev = CU8(idx + 3); |
1315 | *crev = CU8(idx + 3); |
1276 | *data_start = idx; |
1316 | *data_start = idx; |
1277 | return; |
1317 | return true; |
1278 | } |
1318 | } |
1279 | 1319 | ||
- | 1320 | bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t * frev, |
|
- | 1321 | uint8_t * crev) |
|
- | 1322 | { |
|
- | 1323 | int offset = index * 2 + 4; |
|
Line 1280... | Line 1324... | ||
1280 | void atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t * frev, |
1324 | int idx = CU16(ctx->cmd_table + offset); |
1281 | uint8_t * crev) |
1325 | u16 *mct = (u16 *)(ctx->bios + ctx->cmd_table + 4); |
1282 | { |
1326 | |
1283 | int offset = index * 2 + 4; |
1327 | if (!mct[index]) |
1284 | int idx = CU16(ctx->cmd_table + offset); |
1328 | return false; |
1285 | 1329 | ||
Line 1286... | Line 1330... | ||
1286 | if (frev) |
1330 | if (frev) |
1287 | *frev = CU8(idx + 2); |
1331 | *frev = CU8(idx + 2); |
1288 | if (crev) |
1332 | if (crev) |
1289 | *crev = CU8(idx + 3); |
1333 | *crev = CU8(idx + 3); |
1290 | return; |
1334 | return true; |
1291 | } |
1335 | } |
Line 1292... | Line 1336... | ||
1292 | 1336 | ||
1293 | int atom_allocate_fb_scratch(struct atom_context *ctx) |
- | |
1294 | { |
1337 | int atom_allocate_fb_scratch(struct atom_context *ctx) |
Line 1295... | Line 1338... | ||
1295 | int index = GetIndexIntoMasterTable(DATA, VRAM_UsageByFirmware); |
1338 | { |
1296 | uint16_t data_offset; |
1339 | int index = GetIndexIntoMasterTable(DATA, VRAM_UsageByFirmware); |
1297 | int usage_bytes; |
1340 | uint16_t data_offset; |
Line 1298... | Line 1341... | ||
1298 | struct _ATOM_VRAM_USAGE_BY_FIRMWARE *firmware_usage; |
1341 | int usage_bytes = 0; |
- | 1342 | struct _ATOM_VRAM_USAGE_BY_FIRMWARE *firmware_usage; |
|
1299 | 1343 | ||
1300 | atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset); |
1344 | if (atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset)) { |
1301 | 1345 | firmware_usage = (struct _ATOM_VRAM_USAGE_BY_FIRMWARE *)(ctx->bios + data_offset); |
|
1302 | firmware_usage = (struct _ATOM_VRAM_USAGE_BY_FIRMWARE *)(ctx->bios + data_offset); |
1346 | |
1303 | 1347 | DRM_DEBUG("atom firmware requested %08x %dkb\n", |