atom.c (7b0a9e8302522d5f7bb7fab6b8a3c8ce8181609c) atom.c (c31ad97f1886a2ff0f3356dc31d50c57944365da)
1/*
2 * Copyright 2008 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 44 unchanged lines hidden (view full) ---

53 struct atom_context *ctx;
54
55 uint32_t *ps, *ws;
56 int ps_shift;
57 uint16_t start;
58} atom_exec_context;
59
60int atom_debug = 0;
1/*
2 * Copyright 2008 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 44 unchanged lines hidden (view full) ---

53 struct atom_context *ctx;
54
55 uint32_t *ps, *ws;
56 int ps_shift;
57 uint16_t start;
58} atom_exec_context;
59
60int atom_debug = 0;
61static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params);
61void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params);
62
63static uint32_t atom_arg_mask[8] =
64 { 0xFFFFFFFF, 0xFFFF, 0xFFFF00, 0xFFFF0000, 0xFF, 0xFF00, 0xFF0000,
650xFF000000 };
66static int atom_arg_shift[8] = { 0, 0, 8, 16, 0, 8, 16, 24 };
67
68static int atom_dst_to_src[8][4] = {

--- 499 unchanged lines hidden (view full) ---

568static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg)
569{
570 int idx = U8((*ptr)++);
571 if (idx < ATOM_TABLE_NAMES_CNT)
572 SDEBUG(" table: %d (%s)\n", idx, atom_table_names[idx]);
573 else
574 SDEBUG(" table: %d\n", idx);
575 if (U16(ctx->ctx->cmd_table + 4 + 2 * idx))
62void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params);
63
64static uint32_t atom_arg_mask[8] =
65 { 0xFFFFFFFF, 0xFFFF, 0xFFFF00, 0xFFFF0000, 0xFF, 0xFF00, 0xFF0000,
660xFF000000 };
67static int atom_arg_shift[8] = { 0, 0, 8, 16, 0, 8, 16, 24 };
68
69static int atom_dst_to_src[8][4] = {

--- 499 unchanged lines hidden (view full) ---

569static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg)
570{
571 int idx = U8((*ptr)++);
572 if (idx < ATOM_TABLE_NAMES_CNT)
573 SDEBUG(" table: %d (%s)\n", idx, atom_table_names[idx]);
574 else
575 SDEBUG(" table: %d\n", idx);
576 if (U16(ctx->ctx->cmd_table + 4 + 2 * idx))
576 atom_execute_table(ctx->ctx, idx, ctx->ps + ctx->ps_shift);
577 atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift);
577}
578
579static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg)
580{
581 uint8_t attr = U8((*ptr)++);
582 uint32_t saved;
583 int dptr = *ptr;
584 attr &= 0x38;

--- 450 unchanged lines hidden (view full) ---

1035 atom_op_shr, ATOM_ARG_REG}, {
1036 atom_op_shr, ATOM_ARG_PS}, {
1037 atom_op_shr, ATOM_ARG_WS}, {
1038 atom_op_shr, ATOM_ARG_FB}, {
1039 atom_op_shr, ATOM_ARG_PLL}, {
1040 atom_op_shr, ATOM_ARG_MC}, {
1041atom_op_debug, 0},};
1042
578}
579
580static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg)
581{
582 uint8_t attr = U8((*ptr)++);
583 uint32_t saved;
584 int dptr = *ptr;
585 attr &= 0x38;

--- 450 unchanged lines hidden (view full) ---

1036 atom_op_shr, ATOM_ARG_REG}, {
1037 atom_op_shr, ATOM_ARG_PS}, {
1038 atom_op_shr, ATOM_ARG_WS}, {
1039 atom_op_shr, ATOM_ARG_FB}, {
1040 atom_op_shr, ATOM_ARG_PLL}, {
1041 atom_op_shr, ATOM_ARG_MC}, {
1042atom_op_debug, 0},};
1043
1043void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
1044static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params)
1044{
1045 int base = CU16(ctx->cmd_table + 4 + 2 * index);
1046 int len, ws, ps, ptr;
1047 unsigned char op;
1048 atom_exec_context ectx;
1049
1050 if (!base)
1051 return;

--- 35 unchanged lines hidden (view full) ---

1087 }
1088 debug_depth--;
1089 SDEBUG("<<\n");
1090
1091 if (ws)
1092 kfree(ectx.ws);
1093}
1094
1045{
1046 int base = CU16(ctx->cmd_table + 4 + 2 * index);
1047 int len, ws, ps, ptr;
1048 unsigned char op;
1049 atom_exec_context ectx;
1050
1051 if (!base)
1052 return;

--- 35 unchanged lines hidden (view full) ---

1088 }
1089 debug_depth--;
1090 SDEBUG("<<\n");
1091
1092 if (ws)
1093 kfree(ectx.ws);
1094}
1095
1096void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
1097{
1098 mutex_lock(&ctx->mutex);
1099 atom_execute_table_locked(ctx, index, params);
1100 mutex_unlock(&ctx->mutex);
1101}
1102
1095static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 };
1096
1097static void atom_index_iio(struct atom_context *ctx, int base)
1098{
1099 ctx->iio = kzalloc(2 * 256, GFP_KERNEL);
1100 while (CU8(base) == ATOM_IIO_START) {
1101 ctx->iio[CU8(base + 1)] = base + 2;
1102 base += 2;

--- 139 unchanged lines hidden ---
1103static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 };
1104
1105static void atom_index_iio(struct atom_context *ctx, int base)
1106{
1107 ctx->iio = kzalloc(2 * 256, GFP_KERNEL);
1108 while (CU8(base) == ATOM_IIO_START) {
1109 ctx->iio[CU8(base + 1)] = base + 2;
1110 base += 2;

--- 139 unchanged lines hidden ---