summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_dsp_library_load.h
blob: 8c14dda20b275303be4d7351fa9b867b55ff0f79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// SPDX-License-Identifier: GPL-2.0+
// Copyright 2018 NXP
// Copyright (c) 2012-2013 by Tensilica Inc.

#ifndef FSL_DSP_LIBRARY_LOAD_H
#define FSL_DSP_LIBRARY_LOAD_H

#include "fsl_dsp_pool.h"

#define Elf32_Byte  unsigned char
#define xt_ptr      unsigned long
#define xt_int      int
#define xt_uint     unsigned int
#define xt_ulong    unsigned long

struct xtlib_packaged_library;

enum {
	XTLIB_NO_ERR = 0,
	XTLIB_NOT_ELF = 1,
	XTLIB_NOT_DYNAMIC = 2,
	XTLIB_NOT_STATIC = 3,
	XTLIB_NO_DYNAMIC_SEGMENT = 4,
	XTLIB_UNKNOWN_SYMBOL = 5,
	XTLIB_NOT_ALIGNED = 6,
	XTLIB_NOT_SPLITLOAD = 7,
	XTLIB_RELOCATION_ERR = 8
};

enum lib_type {
	DSP_CODEC_LIB = 1,
	DSP_CODEC_WRAP_LIB
};

struct xtlib_loader_globals {
	int err;
	int byteswap;
};

struct xtlib_pil_info {
	xt_uint  dst_addr;
	xt_uint  src_offs;
	xt_uint  dst_data_addr;
	xt_uint  src_data_offs;
	xt_uint  start_sym;
	xt_uint  text_addr;
	xt_uint  init;
	xt_uint  fini;
	xt_uint  rel;
	xt_int  rela_count;
	xt_uint  hash;
	xt_uint  symtab;
	xt_uint  strtab;
	xt_int  align;
};

struct icm_xtlib_pil_info {
	struct xtlib_pil_info pil_info;
	unsigned int lib_type;
};

struct lib_dnld_info_t {
	unsigned long pbuf_code;
	unsigned long pbuf_data;
	unsigned int size_code;
	unsigned int size_data;
	struct xtlib_pil_info *ppil_inf;
	unsigned int lib_on_dpu;    /* 0: not loaded, 1: loaded. */
};

struct lib_info {
	struct xtlib_pil_info  pil_info;
	struct xtlib_loader_globals	xtlib_globals;

	struct xf_pool	 *code_section_pool;
	struct xf_pool	 *data_section_pool;

	void        *code_buf_virt;
	unsigned int code_buf_phys;
	unsigned int code_buf_size;
	void        *data_buf_virt;
	unsigned int data_buf_phys;
	unsigned int data_buf_size;

	const char   *filename;
	unsigned int lib_type;
};

long xf_load_lib(struct xf_client *client, struct xf_handle *handle, struct lib_info *lib_info);
long xf_unload_lib(struct xf_client *client, struct xf_handle *handle, struct lib_info *lib_info);

#endif