plat/marvell/a8k/common/mss/mss_scp_bootloader.c
/* The Armada 8K has 5 service CPUs and Armada 7K has 3. Therefore it was
 * required to provide a method for loading firmware to all of the service CPUs.
 * To achieve that, the scp_bl2 image in fact is file containing up to 5
 * concatenated firmwares and this routine splits concatenated image into single
 * images dedicated for appropriate service CPU and then load them.
 */
The Armada 8K has 5 service CPUs and Armada 7K has 3. Therefore it was
required to provide a method for loading firmware to all of the service CPUs.
To achieve that, the scp_bl2 image in fact is file containing up to 5
concatenated firmwares and this routine splits concatenated image into single
images dedicated for appropriate service CPU and then load them.
The Armada 8K has 5 service CPUs and Armada 7K has 3 . Therefore it was required to provide a method for loading firmware to all of the service CPUs . To achieve that the scp_bl2 image in fact is file containing up to 5 concatenated firmwares and this routine splits concatenated image into single images dedicated for appropriate service CPU and then load them .
static int split_and_load_bl2_image(void *image)
{
	file_header_t *file_hdr;
	img_header_t *img_hdr;
	uintptr_t single_img;
	int i;
	file_hdr = (file_header_t *)image;
	if (file_hdr->magic != FILE_MAGIC) {
		ERROR("SCP_BL2 wrong img format\n");
		return -1;
	}
	if (file_hdr->nr_of_imgs > MAX_NR_OF_FILES) {
		ERROR("SCP_BL2 concatenated image contains to many images\n");
		return -1;
	}
	img_hdr = (img_header_t *)((uintptr_t)image + sizeof(file_header_t));
	single_img = (uintptr_t)image + sizeof(file_header_t) +
				    sizeof(img_header_t) * file_hdr->nr_of_imgs;
	NOTICE("SCP_BL2 contains %d concatenated images\n",
							  file_hdr->nr_of_imgs);
	for (i = 0; i < file_hdr->nr_of_imgs; i++) {
		if (img_hdr->version != HEADER_VERSION) {
			ERROR("Wrong header, img corrupted exiting\n");
			return -1;
		}
		load_img_to_cm3(img_hdr->type, single_img, img_hdr->length);
		single_img += img_hdr->length;
		img_hdr++;
	}
	return 0;
}
static int split_and_load_bl2_image ( void * image ) { file_header_t * file_hdr ; img_header_t * img_hdr ; uintptr_t single_img ; int i ; file_hdr = ( file_header_t * ) image ; if ( file_hdr -> magic != FILE_MAGIC ) { ERROR ( " \n " ) ; return -1 ; } if ( file_hdr -> nr_of_imgs > MAX_NR_OF_FILES ) { ERROR ( " \n " ) ; return -1 ; } img_hdr = ( img_header_t * ) ( ( uintptr_t ) image + sizeof ( file_header_t ) ) ; single_img = ( uintptr_t ) image + sizeof ( file_header_t ) + sizeof ( img_header_t ) * file_hdr -> nr_of_imgs ; NOTICE ( " \n " , file_hdr -> nr_of_imgs ) ; for ( i = 0 ; i < file_hdr -> nr_of_imgs ; i ++ ) { if ( img_hdr -> version != HEADER_VERSION ) { ERROR ( " \n " ) ; return -1 ; } load_img_to_cm3 ( img_hdr -> type , single_img , img_hdr -> length ) ; single_img += img_hdr -> length ; img_hdr ++ ; } return 0 ; }
The Armada 8K has 5 service CPUs and Armada 7K has 3.
The Armada 8K has 5 service CPUs and Armada 7K has 3 .
/* Before loading make sanity check on header */ /* Prepare offsets for next run */