void plat_arm_pwrc_setup(void) { mhu_secure_init(); }
int css_scp_boot_image_xfer(void *image, unsigned int image_size) { uint32_t response; uint32_t checksum; cmd_info_payload_t *cmd_info_payload; cmd_data_payload_t *cmd_data_payload; assert((uintptr_t) image == SCP_BL2_BASE); if ((image_size == 0) || (image_size % 4 != 0)) { ERROR("Invalid size for the SCP_BL2 image. Must be a multiple of " "4 bytes and not zero (current size = 0x%x)\n", image_size); return -1; } /* Extract the checksum from the image */ checksum = *(uint32_t *) image; image = (char *) image + sizeof(checksum); image_size -= sizeof(checksum); mhu_secure_init(); VERBOSE("Send info about the SCP_BL2 image to be transferred to SCP\n"); /* * Send information about the SCP firmware image about to be transferred * to SCP */ scp_boot_message_start(); BOM_CMD_HEADER->id = BOOT_CMD_INFO; cmd_info_payload = BOM_CMD_PAYLOAD; cmd_info_payload->image_size = image_size; cmd_info_payload->checksum = checksum; scp_boot_message_send(sizeof(*cmd_info_payload)); #if CSS_DETECT_PRE_1_7_0_SCP { const uint32_t deprecated_scp_nack_cmd = 0x404; uint32_t mhu_status; VERBOSE("Detecting SCP version incompatibility\n"); mhu_status = mhu_secure_message_wait(); if (mhu_status == deprecated_scp_nack_cmd) { ERROR("Detected an incompatible version of the SCP firmware.\n"); ERROR("Only versions from v1.7.0 onwards are supported.\n"); ERROR("Please update the SCP firmware.\n"); return -1; } VERBOSE("SCP version looks OK\n"); } #endif /* CSS_DETECT_PRE_1_7_0_SCP */ response = scp_boot_message_wait(sizeof(response)); scp_boot_message_end(); if (response != 0) { ERROR("SCP BOOT_CMD_INFO returned error %u\n", response); return -1; } VERBOSE("Transferring SCP_BL2 image to SCP\n"); /* Transfer SCP_BL2 image to SCP */ scp_boot_message_start(); BOM_CMD_HEADER->id = BOOT_CMD_DATA; cmd_data_payload = BOM_CMD_PAYLOAD; cmd_data_payload->offset = (uintptr_t) image - ARM_TRUSTED_SRAM_BASE; cmd_data_payload->block_size = image_size; scp_boot_message_send(sizeof(*cmd_data_payload)); response = scp_boot_message_wait(sizeof(response)); scp_boot_message_end(); if (response != 0) { ERROR("SCP BOOT_CMD_DATA returned error %u\n", response); return -1; } return 0; }