Linux Audio

Check our new training course

Embedded Linux Audio

Check our new training course
with Creative Commons CC-BY-SA
lecture materials

Bootlin logo

Elixir Cross Referencer

Loading...
  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
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only) */
/* Copyright(c) 2014 - 2020 Intel Corporation */
#ifndef __ICP_QAT_UCLO_H__
#define __ICP_QAT_UCLO_H__

#define ICP_QAT_AC_895XCC_DEV_TYPE 0x00400000
#define ICP_QAT_AC_C62X_DEV_TYPE   0x01000000
#define ICP_QAT_AC_C3XXX_DEV_TYPE  0x02000000
#define ICP_QAT_AC_4XXX_A_DEV_TYPE 0x08000000
#define ICP_QAT_UCLO_MAX_AE       12
#define ICP_QAT_UCLO_MAX_CTX      8
#define ICP_QAT_UCLO_MAX_UIMAGE   (ICP_QAT_UCLO_MAX_AE * ICP_QAT_UCLO_MAX_CTX)
#define ICP_QAT_UCLO_MAX_USTORE   0x4000
#define ICP_QAT_UCLO_MAX_XFER_REG 128
#define ICP_QAT_UCLO_MAX_GPR_REG  128
#define ICP_QAT_UCLO_MAX_LMEM_REG 1024
#define ICP_QAT_UCLO_MAX_LMEM_REG_2X 1280
#define ICP_QAT_UCLO_AE_ALL_CTX   0xff
#define ICP_QAT_UOF_OBJID_LEN     8
#define ICP_QAT_UOF_FID 0xc6c2
#define ICP_QAT_UOF_MAJVER 0x4
#define ICP_QAT_UOF_MINVER 0x11
#define ICP_QAT_UOF_OBJS        "UOF_OBJS"
#define ICP_QAT_UOF_STRT        "UOF_STRT"
#define ICP_QAT_UOF_IMAG        "UOF_IMAG"
#define ICP_QAT_UOF_IMEM        "UOF_IMEM"
#define ICP_QAT_UOF_LOCAL_SCOPE     1
#define ICP_QAT_UOF_INIT_EXPR               0
#define ICP_QAT_UOF_INIT_REG                1
#define ICP_QAT_UOF_INIT_REG_CTX            2
#define ICP_QAT_UOF_INIT_EXPR_ENDIAN_SWAP   3
#define ICP_QAT_SUOF_OBJ_ID_LEN             8
#define ICP_QAT_SUOF_FID  0x53554f46
#define ICP_QAT_SUOF_MAJVER 0x0
#define ICP_QAT_SUOF_MINVER 0x1
#define ICP_QAT_SUOF_OBJ_NAME_LEN 128
#define ICP_QAT_MOF_OBJ_ID_LEN 8
#define ICP_QAT_MOF_OBJ_CHUNKID_LEN 8
#define ICP_QAT_MOF_FID 0x00666f6d
#define ICP_QAT_MOF_MAJVER 0x0
#define ICP_QAT_MOF_MINVER 0x1
#define ICP_QAT_MOF_SYM_OBJS "SYM_OBJS"
#define ICP_QAT_SUOF_OBJS "SUF_OBJS"
#define ICP_QAT_SUOF_IMAG "SUF_IMAG"
#define ICP_QAT_SIMG_AE_INIT_SEQ_LEN    (50 * sizeof(unsigned long long))
#define ICP_QAT_SIMG_AE_INSTS_LEN       (0x4000 * sizeof(unsigned long long))

#define DSS_FWSK_MODULUS_LEN    384 /* RSA3K */
#define DSS_FWSK_EXPONENT_LEN   4
#define DSS_FWSK_PADDING_LEN    380
#define DSS_SIGNATURE_LEN       384 /* RSA3K */

#define CSS_FWSK_MODULUS_LEN    256 /* RSA2K */
#define CSS_FWSK_EXPONENT_LEN   4
#define CSS_FWSK_PADDING_LEN    252
#define CSS_SIGNATURE_LEN       256 /* RSA2K */

#define ICP_QAT_CSS_FWSK_MODULUS_LEN(handle)	((handle)->chip_info->css_3k ? \
						DSS_FWSK_MODULUS_LEN  : \
						CSS_FWSK_MODULUS_LEN)

#define ICP_QAT_CSS_FWSK_EXPONENT_LEN(handle)	((handle)->chip_info->css_3k ? \
						DSS_FWSK_EXPONENT_LEN : \
						CSS_FWSK_EXPONENT_LEN)

#define ICP_QAT_CSS_FWSK_PAD_LEN(handle)	((handle)->chip_info->css_3k ? \
						DSS_FWSK_PADDING_LEN : \
						CSS_FWSK_PADDING_LEN)

#define ICP_QAT_CSS_FWSK_PUB_LEN(handle)	(ICP_QAT_CSS_FWSK_MODULUS_LEN(handle) + \
						ICP_QAT_CSS_FWSK_EXPONENT_LEN(handle) + \
						ICP_QAT_CSS_FWSK_PAD_LEN(handle))

#define ICP_QAT_CSS_SIGNATURE_LEN(handle)	((handle)->chip_info->css_3k ? \
						DSS_SIGNATURE_LEN : \
						CSS_SIGNATURE_LEN)

#define ICP_QAT_CSS_AE_IMG_LEN     (sizeof(struct icp_qat_simg_ae_mode) + \
				    ICP_QAT_SIMG_AE_INIT_SEQ_LEN +         \
				    ICP_QAT_SIMG_AE_INSTS_LEN)
#define ICP_QAT_CSS_AE_SIMG_LEN(handle) (sizeof(struct icp_qat_css_hdr) + \
					ICP_QAT_CSS_FWSK_PUB_LEN(handle) + \
					ICP_QAT_CSS_SIGNATURE_LEN(handle) + \
					ICP_QAT_CSS_AE_IMG_LEN)
#define ICP_QAT_AE_IMG_OFFSET(handle) (sizeof(struct icp_qat_css_hdr) + \
					ICP_QAT_CSS_FWSK_MODULUS_LEN(handle) + \
					ICP_QAT_CSS_FWSK_EXPONENT_LEN(handle) + \
					ICP_QAT_CSS_SIGNATURE_LEN(handle))
#define ICP_QAT_CSS_RSA4K_MAX_IMAGE_LEN    0x40000
#define ICP_QAT_CSS_RSA3K_MAX_IMAGE_LEN    0x30000

#define ICP_QAT_CTX_MODE(ae_mode) ((ae_mode) & 0xf)
#define ICP_QAT_NN_MODE(ae_mode) (((ae_mode) >> 0x4) & 0xf)
#define ICP_QAT_SHARED_USTORE_MODE(ae_mode) (((ae_mode) >> 0xb) & 0x1)
#define RELOADABLE_CTX_SHARED_MODE(ae_mode) (((ae_mode) >> 0xc) & 0x1)

#define ICP_QAT_LOC_MEM0_MODE(ae_mode) (((ae_mode) >> 0x8) & 0x1)
#define ICP_QAT_LOC_MEM1_MODE(ae_mode) (((ae_mode) >> 0x9) & 0x1)
#define ICP_QAT_LOC_MEM2_MODE(ae_mode) (((ae_mode) >> 0x6) & 0x1)
#define ICP_QAT_LOC_MEM3_MODE(ae_mode) (((ae_mode) >> 0x7) & 0x1)
#define ICP_QAT_LOC_TINDEX_MODE(ae_mode) (((ae_mode) >> 0xe) & 0x1)

enum icp_qat_uof_mem_region {
	ICP_QAT_UOF_SRAM_REGION = 0x0,
	ICP_QAT_UOF_LMEM_REGION = 0x3,
	ICP_QAT_UOF_UMEM_REGION = 0x5
};

enum icp_qat_uof_regtype {
	ICP_NO_DEST	= 0,
	ICP_GPA_REL	= 1,
	ICP_GPA_ABS	= 2,
	ICP_GPB_REL	= 3,
	ICP_GPB_ABS	= 4,
	ICP_SR_REL	= 5,
	ICP_SR_RD_REL	= 6,
	ICP_SR_WR_REL	= 7,
	ICP_SR_ABS	= 8,
	ICP_SR_RD_ABS	= 9,
	ICP_SR_WR_ABS	= 10,
	ICP_DR_REL	= 19,
	ICP_DR_RD_REL	= 20,
	ICP_DR_WR_REL	= 21,
	ICP_DR_ABS	= 22,
	ICP_DR_RD_ABS	= 23,
	ICP_DR_WR_ABS	= 24,
	ICP_LMEM	= 26,
	ICP_LMEM0	= 27,
	ICP_LMEM1	= 28,
	ICP_NEIGH_REL	= 31,
	ICP_LMEM2	= 61,
	ICP_LMEM3	= 62,
};

enum icp_qat_css_fwtype {
	CSS_AE_FIRMWARE = 0,
	CSS_MMP_FIRMWARE = 1
};

struct icp_qat_uclo_page {
	struct icp_qat_uclo_encap_page *encap_page;
	struct icp_qat_uclo_region *region;
	unsigned int flags;
};

struct icp_qat_uclo_region {
	struct icp_qat_uclo_page *loaded;
	struct icp_qat_uclo_page *page;
};

struct icp_qat_uclo_aeslice {
	struct icp_qat_uclo_region *region;
	struct icp_qat_uclo_page *page;
	struct icp_qat_uclo_page *cur_page[ICP_QAT_UCLO_MAX_CTX];
	struct icp_qat_uclo_encapme *encap_image;
	unsigned int ctx_mask_assigned;
	unsigned int new_uaddr[ICP_QAT_UCLO_MAX_CTX];
};

struct icp_qat_uclo_aedata {
	unsigned int slice_num;
	unsigned int eff_ustore_size;
	struct icp_qat_uclo_aeslice ae_slices[ICP_QAT_UCLO_MAX_CTX];
};

struct icp_qat_uof_encap_obj {
	char *beg_uof;
	struct icp_qat_uof_objhdr *obj_hdr;
	struct icp_qat_uof_chunkhdr *chunk_hdr;
	struct icp_qat_uof_varmem_seg *var_mem_seg;
};

struct icp_qat_uclo_encap_uwblock {
	unsigned int start_addr;
	unsigned int words_num;
	u64 micro_words;
};

struct icp_qat_uclo_encap_page {
	unsigned int def_page;
	unsigned int page_region;
	unsigned int beg_addr_v;
	unsigned int beg_addr_p;
	unsigned int micro_words_num;
	unsigned int uwblock_num;
	struct icp_qat_uclo_encap_uwblock *uwblock;
};

struct icp_qat_uclo_encapme {
	struct icp_qat_uof_image *img_ptr;
	struct icp_qat_uclo_encap_page *page;
	unsigned int ae_reg_num;
	struct icp_qat_uof_ae_reg *ae_reg;
	unsigned int init_regsym_num;
	struct icp_qat_uof_init_regsym *init_regsym;
	unsigned int sbreak_num;
	struct icp_qat_uof_sbreak *sbreak;
	unsigned int uwords_num;
};

struct icp_qat_uclo_init_mem_table {
	unsigned int entry_num;
	struct icp_qat_uof_initmem *init_mem;
};

struct icp_qat_uclo_objhdr {
	char *file_buff;
	unsigned int checksum;
	unsigned int size;
};

struct icp_qat_uof_strtable {
	unsigned int table_len;
	unsigned int reserved;
	u64 strings;
};

struct icp_qat_uclo_objhandle {
	unsigned int prod_type;
	unsigned int prod_rev;
	struct icp_qat_uclo_objhdr *obj_hdr;
	struct icp_qat_uof_encap_obj encap_uof_obj;
	struct icp_qat_uof_strtable str_table;
	struct icp_qat_uclo_encapme ae_uimage[ICP_QAT_UCLO_MAX_UIMAGE];
	struct icp_qat_uclo_aedata ae_data[ICP_QAT_UCLO_MAX_AE];
	struct icp_qat_uclo_init_mem_table init_mem_tab;
	struct icp_qat_uof_batch_init *lm_init_tab[ICP_QAT_UCLO_MAX_AE];
	struct icp_qat_uof_batch_init *umem_init_tab[ICP_QAT_UCLO_MAX_AE];
	int uimage_num;
	int uword_in_bytes;
	int global_inited;
	unsigned int ae_num;
	unsigned int ustore_phy_size;
	void *obj_buf;
	u64 *uword_buf;
};

struct icp_qat_uof_uword_block {
	unsigned int start_addr;
	unsigned int words_num;
	unsigned int uword_offset;
	unsigned int reserved;
};

struct icp_qat_uof_filehdr {
	unsigned short file_id;
	unsigned short reserved1;
	char min_ver;
	char maj_ver;
	unsigned short reserved2;
	unsigned short max_chunks;
	unsigned short num_chunks;
};

struct icp_qat_uof_filechunkhdr {
	char chunk_id[ICP_QAT_UOF_OBJID_LEN];
	unsigned int checksum;
	unsigned int offset;
	unsigned int size;
};

struct icp_qat_uof_objhdr {
	unsigned int ac_dev_type;
	unsigned short min_cpu_ver;
	unsigned short max_cpu_ver;
	short max_chunks;
	short num_chunks;
	unsigned int reserved1;
	unsigned int reserved2;
};

struct icp_qat_uof_chunkhdr {
	char chunk_id[ICP_QAT_UOF_OBJID_LEN];
	unsigned int offset;
	unsigned int size;
};

struct icp_qat_uof_memvar_attr {
	unsigned int offset_in_byte;
	unsigned int value;
};

struct icp_qat_uof_initmem {
	unsigned int sym_name;
	char region;
	char scope;
	unsigned short reserved1;
	unsigned int addr;
	unsigned int num_in_bytes;
	unsigned int val_attr_num;
};

struct icp_qat_uof_init_regsym {
	unsigned int sym_name;
	char init_type;
	char value_type;
	char reg_type;
	unsigned char ctx;
	unsigned int reg_addr;
	unsigned int value;
};

struct icp_qat_uof_varmem_seg {
	unsigned int sram_base;
	unsigned int sram_size;
	unsigned int sram_alignment;
	unsigned int sdram_base;
	unsigned int sdram_size;
	unsigned int sdram_alignment;
	unsigned int sdram1_base;
	unsigned int sdram1_size;
	unsigned int sdram1_alignment;
	unsigned int scratch_base;
	unsigned int scratch_size;
	unsigned int scratch_alignment;
};

struct icp_qat_uof_gtid {
	char tool_id[ICP_QAT_UOF_OBJID_LEN];
	int tool_ver;
	unsigned int reserved1;
	unsigned int reserved2;
};

struct icp_qat_uof_sbreak {
	unsigned int page_num;
	unsigned int virt_uaddr;
	unsigned char sbreak_type;
	unsigned char reg_type;
	unsigned short reserved1;
	unsigned int addr_offset;
	unsigned int reg_addr;
};

struct icp_qat_uof_code_page {
	unsigned int page_region;
	unsigned int page_num;
	unsigned char def_page;
	unsigned char reserved2;
	unsigned short reserved1;
	unsigned int beg_addr_v;
	unsigned int beg_addr_p;
	unsigned int neigh_reg_tab_offset;
	unsigned int uc_var_tab_offset;
	unsigned int imp_var_tab_offset;
	unsigned int imp_expr_tab_offset;
	unsigned int code_area_offset;
};

struct icp_qat_uof_image {
	unsigned int img_name;
	unsigned int ae_assigned;
	unsigned int ctx_assigned;
	unsigned int ac_dev_type;
	unsigned int entry_address;
	unsigned int fill_pattern[2];
	unsigned int reloadable_size;
	unsigned char sensitivity;
	unsigned char reserved;
	unsigned short ae_mode;
	unsigned short max_ver;
	unsigned short min_ver;
	unsigned short image_attrib;
	unsigned short reserved2;
	unsigned short page_region_num;
	unsigned short numpages;
	unsigned int reg_tab_offset;
	unsigned int init_reg_sym_tab;
	unsigned int sbreak_tab;
	unsigned int app_metadata;
};

struct icp_qat_uof_objtable {
	unsigned int entry_num;
};

struct icp_qat_uof_ae_reg {
	unsigned int name;
	unsigned int vis_name;
	unsigned short type;
	unsigned short addr;
	unsigned short access_mode;
	unsigned char visible;
	unsigned char reserved1;
	unsigned short ref_count;
	unsigned short reserved2;
	unsigned int xo_id;
};

struct icp_qat_uof_code_area {
	unsigned int micro_words_num;
	unsigned int uword_block_tab;
};

struct icp_qat_uof_batch_init {
	unsigned int ae;
	unsigned int addr;
	unsigned int *value;
	unsigned int size;
	struct icp_qat_uof_batch_init *next;
};

struct icp_qat_suof_img_hdr {
	char          *simg_buf;
	unsigned long simg_len;
	char          *css_header;
	char          *css_key;
	char          *css_signature;
	char          *css_simg;
	unsigned long simg_size;
	unsigned int  ae_num;
	unsigned int  ae_mask;
	unsigned int  fw_type;
	unsigned long simg_name;
	unsigned long appmeta_data;
};

struct icp_qat_suof_img_tbl {
	unsigned int num_simgs;
	struct icp_qat_suof_img_hdr *simg_hdr;
};

struct icp_qat_suof_handle {
	unsigned int  file_id;
	unsigned int  check_sum;
	char          min_ver;
	char          maj_ver;
	char          fw_type;
	char          *suof_buf;
	unsigned int  suof_size;
	char          *sym_str;
	unsigned int  sym_size;
	struct icp_qat_suof_img_tbl img_table;
};

struct icp_qat_fw_auth_desc {
	unsigned int   img_len;
	unsigned int   ae_mask;
	unsigned int   css_hdr_high;
	unsigned int   css_hdr_low;
	unsigned int   img_high;
	unsigned int   img_low;
	unsigned int   signature_high;
	unsigned int   signature_low;
	unsigned int   fwsk_pub_high;
	unsigned int   fwsk_pub_low;
	unsigned int   img_ae_mode_data_high;
	unsigned int   img_ae_mode_data_low;
	unsigned int   img_ae_init_data_high;
	unsigned int   img_ae_init_data_low;
	unsigned int   img_ae_insts_high;
	unsigned int   img_ae_insts_low;
};

struct icp_qat_auth_chunk {
	struct icp_qat_fw_auth_desc fw_auth_desc;
	u64 chunk_size;
	u64 chunk_bus_addr;
};

struct icp_qat_css_hdr {
	unsigned int module_type;
	unsigned int header_len;
	unsigned int header_ver;
	unsigned int module_id;
	unsigned int module_vendor;
	unsigned int date;
	unsigned int size;
	unsigned int key_size;
	unsigned int module_size;
	unsigned int exponent_size;
	unsigned int fw_type;
	unsigned int reserved[21];
};

struct icp_qat_simg_ae_mode {
	unsigned int     file_id;
	unsigned short   maj_ver;
	unsigned short   min_ver;
	unsigned int     dev_type;
	unsigned short   devmax_ver;
	unsigned short   devmin_ver;
	unsigned int     ae_mask;
	unsigned int     ctx_enables;
	char             fw_type;
	char             ctx_mode;
	char             nn_mode;
	char             lm0_mode;
	char             lm1_mode;
	char             scs_mode;
	char             lm2_mode;
	char             lm3_mode;
	char             tindex_mode;
	unsigned char    reserved[7];
	char             simg_name[256];
	char             appmeta_data[256];
};

struct icp_qat_suof_filehdr {
	unsigned int     file_id;
	unsigned int     check_sum;
	char             min_ver;
	char             maj_ver;
	char             fw_type;
	char             reserved;
	unsigned short   max_chunks;
	unsigned short   num_chunks;
};

struct icp_qat_suof_chunk_hdr {
	char chunk_id[ICP_QAT_SUOF_OBJ_ID_LEN];
	u64 offset;
	u64 size;
};

struct icp_qat_suof_strtable {
	unsigned int tab_length;
	unsigned int strings;
};

struct icp_qat_suof_objhdr {
	unsigned int img_length;
	unsigned int reserved;
};

struct icp_qat_mof_file_hdr {
	unsigned int file_id;
	unsigned int checksum;
	char min_ver;
	char maj_ver;
	unsigned short reserved;
	unsigned short max_chunks;
	unsigned short num_chunks;
};

struct icp_qat_mof_chunkhdr {
	char chunk_id[ICP_QAT_MOF_OBJ_ID_LEN];
	u64 offset;
	u64 size;
};

struct icp_qat_mof_str_table {
	unsigned int tab_len;
	unsigned int strings;
};

struct icp_qat_mof_obj_hdr {
	unsigned short max_chunks;
	unsigned short num_chunks;
	unsigned int reserved;
};

struct icp_qat_mof_obj_chunkhdr {
	char chunk_id[ICP_QAT_MOF_OBJ_CHUNKID_LEN];
	u64 offset;
	u64 size;
	unsigned int name;
	unsigned int reserved;
};

struct icp_qat_mof_objhdr {
	char *obj_name;
	char *obj_buf;
	unsigned int obj_size;
};

struct icp_qat_mof_table {
	unsigned int num_objs;
	struct icp_qat_mof_objhdr *obj_hdr;
};

struct icp_qat_mof_handle {
	unsigned int file_id;
	unsigned int checksum;
	char min_ver;
	char maj_ver;
	char *mof_buf;
	u32 mof_size;
	char *sym_str;
	unsigned int sym_size;
	char *uobjs_hdr;
	char *sobjs_hdr;
	struct icp_qat_mof_table obj_table;
};
#endif