@@ -73,73 +73,6 @@ static int get_mem_zone_type(struct image *image, Elf32_Shdr *section)
7373 return SOF_FW_BLK_TYPE_INVALID ;
7474}
7575
76- static int fw_version_copy (struct snd_sof_logs_header * header ,
77- const struct module * module )
78- {
79- Elf32_Shdr * section = NULL ;
80- struct sof_ipc_ext_data_hdr * ext_hdr = NULL ;
81- void * buffer = NULL ;
82-
83- if (module -> fw_ready_index <= 0 )
84- return 0 ;
85-
86- section = & module -> section [module -> fw_ready_index ];
87-
88- buffer = calloc (1 , section -> size );
89- if (!buffer )
90- return - ENOMEM ;
91-
92- fseek (module -> fd , section -> off , SEEK_SET );
93- size_t count = fread (buffer , 1 ,
94- section -> size , module -> fd );
95-
96- if (count != section -> size ) {
97- fprintf (stderr , "error: can't read ready section %d\n" , - errno );
98- free (buffer );
99- return - errno ;
100- }
101-
102- memcpy (& header -> version ,
103- & ((struct sof_ipc_fw_ready * )buffer )-> version ,
104- sizeof (header -> version ));
105-
106- /* fw_ready structure contains main (primarily kernel)
107- * ABI version.
108- */
109-
110- fprintf (stdout , "fw abi main version: %d:%d:%d\n" ,
111- SOF_ABI_VERSION_MAJOR (header -> version .abi_version ),
112- SOF_ABI_VERSION_MINOR (header -> version .abi_version ),
113- SOF_ABI_VERSION_PATCH (header -> version .abi_version ));
114-
115- /* let's find dbg abi version, which the log client
116- * is interested in and override the kernel's one.
117- *
118- * skip the base fw-ready record and begin from the first extension.
119- */
120- ext_hdr = buffer + ((struct sof_ipc_fw_ready * )buffer )-> hdr .size ;
121- while ((uintptr_t )ext_hdr < (uintptr_t )buffer + section -> size ) {
122- if (ext_hdr -> type == SOF_IPC_EXT_USER_ABI_INFO ) {
123- header -> version .abi_version =
124- ((struct sof_ipc_user_abi_version * )
125- ext_hdr )-> abi_dbg_version ;
126- break ;
127- }
128- //move to the next entry
129- ext_hdr = (struct sof_ipc_ext_data_hdr * )
130- ((uint8_t * )ext_hdr + ext_hdr -> hdr .size );
131- }
132-
133- fprintf (stdout , "fw abi dbg version: %d:%d:%d\n" ,
134- SOF_ABI_VERSION_MAJOR (header -> version .abi_version ),
135- SOF_ABI_VERSION_MINOR (header -> version .abi_version ),
136- SOF_ABI_VERSION_PATCH (header -> version .abi_version ));
137-
138- free (buffer );
139-
140- return 0 ;
141- }
142-
14376static int block_idx ;
14477
14578static int write_block (struct image * image , struct module * module ,
@@ -442,135 +375,6 @@ static int simple_write_firmware(struct image *image)
442375 return 0 ;
443376}
444377
445- static int write_logs_dictionary (struct image * image )
446- {
447- struct snd_sof_logs_header header ;
448- int i , ret = 0 ;
449- void * buffer = NULL ;
450-
451- memcpy (header .sig , SND_SOF_LOGS_SIG , SND_SOF_LOGS_SIG_SIZE );
452- header .data_offset = sizeof (struct snd_sof_logs_header );
453-
454- for (i = 0 ; i < image -> num_modules ; i ++ ) {
455- struct module * module = & image -> module [i ];
456-
457- /* extract fw_version from fw_ready message located
458- * in .fw_ready section
459- */
460- ret = fw_version_copy (& header , module );
461- if (ret < 0 )
462- goto out ;
463-
464- if (module -> logs_index > 0 ) {
465- Elf32_Shdr * section =
466- & module -> section [module -> logs_index ];
467-
468- header .base_address = section -> vaddr ;
469- header .data_length = section -> size ;
470-
471- fwrite (& header , sizeof (struct snd_sof_logs_header ), 1 ,
472- image -> ldc_out_fd );
473-
474- buffer = calloc (1 , section -> size );
475- if (!buffer )
476- return - ENOMEM ;
477-
478- fseek (module -> fd , section -> off , SEEK_SET );
479- size_t count = fread (buffer , 1 , section -> size ,
480- module -> fd );
481- if (count != section -> size ) {
482- fprintf (stderr ,
483- "error: can't read logs section %d\n" ,
484- - errno );
485- ret = - errno ;
486- goto out ;
487- }
488- count = fwrite (buffer , 1 , section -> size ,
489- image -> ldc_out_fd );
490- if (count != section -> size ) {
491- fprintf (stderr ,
492- "error: can't write section %d\n" ,
493- - errno );
494- ret = - errno ;
495- goto out ;
496- }
497-
498- fprintf (stdout , "logs dictionary: size %u\n" ,
499- header .data_length + header .data_offset );
500- fprintf (stdout , "including fw version of size: %lu\n" ,
501- (unsigned long )sizeof (header .version ));
502- }
503- }
504- out :
505- if (buffer )
506- free (buffer );
507-
508- return ret ;
509- }
510-
511- static int write_uids_dictionary (struct image * image )
512- {
513- struct snd_sof_uids_header header ;
514- Elf32_Shdr * section ;
515- int i , ret = 0 ;
516- void * buffer = NULL ;
517-
518- memcpy (header .sig , SND_SOF_UIDS_SIG , SND_SOF_UIDS_SIG_SIZE );
519- header .data_offset = sizeof (struct snd_sof_uids_header );
520-
521- for (i = 0 ; i < image -> num_modules ; i ++ ) {
522- struct module * module = & image -> module [i ];
523-
524- if (module -> uids_index <= 0 )
525- continue ;
526- section = & module -> section [module -> uids_index ];
527-
528- header .base_address = section -> vaddr ;
529- header .data_length = section -> size ;
530-
531- fwrite (& header , sizeof (struct snd_sof_uids_header ), 1 ,
532- image -> ldc_out_fd );
533-
534- buffer = calloc (1 , section -> size );
535- if (!buffer )
536- return - ENOMEM ;
537- fseek (module -> fd , section -> off , SEEK_SET );
538- if (fread (buffer , 1 , section -> size , module -> fd ) !=
539- section -> size ) {
540- fprintf (stderr , "error: can't read uids section %d\n" ,
541- - errno );
542- ret = - errno ;
543- goto out ;
544- }
545- if (fwrite (buffer , 1 , section -> size , image -> ldc_out_fd ) !=
546- section -> size ) {
547- fprintf (stderr , "error: cant't write section %d\n" ,
548- - errno );
549- ret = - errno ;
550- goto out ;
551- }
552- fprintf (stdout , "uids dictionary: size %u\n" ,
553- header .data_length + header .data_offset );
554- }
555- out :
556- free (buffer );
557- return ret ;
558- }
559-
560- int write_dictionaries (struct image * image )
561- {
562- int ret = 0 ;
563-
564- ret = write_logs_dictionary (image );
565- if (ret )
566- goto out ;
567-
568- ret = write_uids_dictionary (image );
569-
570- out :
571- return ret ;
572- }
573-
574378const struct adsp machine_byt = {
575379 .name = "byt" ,
576380 .mem_zones = {
0 commit comments