aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2015-10-02 14:26:41 -0400
committerAlex Deucher <alexander.deucher@amd.com>2015-10-14 16:16:24 -0400
commitc2fe16aa36d2bc976f7e79600d3a118fafdcc8dc (patch)
tree79eb184bcc9e81769a6e3729bef187c6ef6b8e30
parentc9c145021f8fc8445fb07d16073696330b6186c8 (diff)
drm/amdgpu/atom: add support for new div32 opcodes (v3)
Better precision than the regular div opcode. v2: drop 64 bit divide v3: fix op handling. This actually is a 64 bit divide. Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/atom.c25
-rw-r--r--drivers/gpu/drm/amd/amdgpu/atom.h2
2 files changed, 25 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index 474357d019b2..1b50e6c13fb3 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -685,6 +685,27 @@ static void atom_op_div(atom_exec_context *ctx, int *ptr, int arg)
685 } 685 }
686} 686}
687 687
688static void atom_op_div32(atom_exec_context *ctx, int *ptr, int arg)
689{
690 uint64_t val64;
691 uint8_t attr = U8((*ptr)++);
692 uint32_t dst, src;
693 SDEBUG(" src1: ");
694 dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1);
695 SDEBUG(" src2: ");
696 src = atom_get_src(ctx, attr, ptr);
697 if (src != 0) {
698 val64 = dst;
699 val64 |= ((uint64_t)ctx->ctx->divmul[1]) << 32;
700 do_div(val64, src);
701 ctx->ctx->divmul[0] = lower_32_bits(val64);
702 ctx->ctx->divmul[1] = upper_32_bits(val64);
703 } else {
704 ctx->ctx->divmul[0] = 0;
705 ctx->ctx->divmul[1] = 0;
706 }
707}
708
688static void atom_op_eot(atom_exec_context *ctx, int *ptr, int arg) 709static void atom_op_eot(atom_exec_context *ctx, int *ptr, int arg)
689{ 710{
690 /* functionally, a nop */ 711 /* functionally, a nop */
@@ -1176,7 +1197,9 @@ static struct {
1176 atom_op_debug, 0}, { 1197 atom_op_debug, 0}, {
1177 atom_op_processds, 0}, { 1198 atom_op_processds, 0}, {
1178 atom_op_mul32, ATOM_ARG_PS}, { 1199 atom_op_mul32, ATOM_ARG_PS}, {
1179 atom_op_mul32, ATOM_ARG_WS}, 1200 atom_op_mul32, ATOM_ARG_WS}, {
1201 atom_op_div32, ATOM_ARG_PS}, {
1202 atom_op_div32, ATOM_ARG_WS},
1180}; 1203};
1181 1204
1182static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params) 1205static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params)
diff --git a/drivers/gpu/drm/amd/amdgpu/atom.h b/drivers/gpu/drm/amd/amdgpu/atom.h
index a940eb3bb512..fece8f45dc7a 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.h
+++ b/drivers/gpu/drm/amd/amdgpu/atom.h
@@ -60,7 +60,7 @@
60#define ATOM_CT_PS_MASK 0x7F 60#define ATOM_CT_PS_MASK 0x7F
61#define ATOM_CT_CODE_PTR 6 61#define ATOM_CT_CODE_PTR 6
62 62
63#define ATOM_OP_CNT 125 63#define ATOM_OP_CNT 127
64#define ATOM_OP_EOT 91 64#define ATOM_OP_EOT 91
65 65
66#define ATOM_CASE_MAGIC 0x63 66#define ATOM_CASE_MAGIC 0x63