linux/drivers/gpu/drm/amd/amdgpu/atom.c

/*
 * Copyright 2008 Advanced Micro Devices, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Author: Stanislaw Skowronek
 */

#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/string_helpers.h>

#include <asm/unaligned.h>

#include <drm/drm_util.h>

#define ATOM_DEBUG

#include "atomfirmware.h"
#include "atom.h"
#include "atom-names.h"
#include "atom-bits.h"
#include "amdgpu.h"

#define ATOM_COND_ABOVE
#define ATOM_COND_ABOVEOREQUAL
#define ATOM_COND_ALWAYS
#define ATOM_COND_BELOW
#define ATOM_COND_BELOWOREQUAL
#define ATOM_COND_EQUAL
#define ATOM_COND_NOTEQUAL

#define ATOM_PORT_ATI
#define ATOM_PORT_PCI
#define ATOM_PORT_SYSIO

#define ATOM_UNIT_MICROSEC
#define ATOM_UNIT_MILLISEC

#define PLL_INDEX
#define PLL_DATA

#define ATOM_CMD_TIMEOUT_SEC

atom_exec_context;

int amdgpu_atom_debug;
static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t *params, int params_size);
int amdgpu_atom_execute_table(struct atom_context *ctx, int index, uint32_t *params, int params_size);

static uint32_t atom_arg_mask[8] =;
static int atom_arg_shift[8] =;

static int atom_dst_to_src[8][4] =;
static int atom_def_dst[8] =;

static int debug_depth;
#ifdef ATOM_DEBUG
static void debug_print_spaces(int n)
{}

#define DEBUG(...)
#define SDEBUG(...)
#else
#define DEBUG
#define SDEBUG
#endif

static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
				 uint32_t index, uint32_t data)
{}

static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,
				 int *ptr, uint32_t *saved, int print)
{}

static void atom_skip_src_int(atom_exec_context *ctx, uint8_t attr, int *ptr)
{}

static uint32_t atom_get_src(atom_exec_context *ctx, uint8_t attr, int *ptr)
{}

static uint32_t atom_get_src_direct(atom_exec_context *ctx, uint8_t align, int *ptr)
{}

static uint32_t atom_get_dst(atom_exec_context *ctx, int arg, uint8_t attr,
			     int *ptr, uint32_t *saved, int print)
{}

static void atom_skip_dst(atom_exec_context *ctx, int arg, uint8_t attr, int *ptr)
{}

static void atom_put_dst(atom_exec_context *ctx, int arg, uint8_t attr,
			 int *ptr, uint32_t val, uint32_t saved)
{}

static void atom_op_add(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_and(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_beep(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_compare(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_div(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_div32(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_eot(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_mask(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_move(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_mul(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_mul32(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_nop(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_or(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_postcard(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_repeat(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_restorereg(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_savereg(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_setdatablock(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_setfbbase(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_setport(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_setregblock(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_shift_left(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_shift_right(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_shr(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_sub(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_switch(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_test(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_xor(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_debug(atom_exec_context *ctx, int *ptr, int arg)
{}

static void atom_op_processds(atom_exec_context *ctx, int *ptr, int arg)
{}

static struct {} opcode_table[ATOM_OP_CNT] =;

static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t *params, int params_size)
{}

int amdgpu_atom_execute_table(struct atom_context *ctx, int index, uint32_t *params, int params_size)
{}

static int atom_iio_len[] =;

static void atom_index_iio(struct atom_context *ctx, int base)
{}

static void atom_get_vbios_name(struct atom_context *ctx)
{}

static void atom_get_vbios_date(struct atom_context *ctx)
{}

static unsigned char *atom_find_str_in_rom(struct atom_context *ctx, char *str, int start,
					   int end, int maxlen)
{}

static void atom_get_vbios_pn(struct atom_context *ctx)
{}

static void atom_get_vbios_version(struct atom_context *ctx)
{}

struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)
{}

int amdgpu_atom_asic_init(struct atom_context *ctx)
{}

void amdgpu_atom_destroy(struct atom_context *ctx)
{}

bool amdgpu_atom_parse_data_header(struct atom_context *ctx, int index,
			    uint16_t *size, uint8_t *frev, uint8_t *crev,
			    uint16_t *data_start)
{}

bool amdgpu_atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t *frev,
			   uint8_t *crev)
{}