diff options
-rw-r--r-- | product/rddanielxlr/mcp_romfw/config_bootloader.c | 11 | ||||
-rw-r--r-- | product/rddanielxlr/mcp_romfw/config_rddanielxlr_rom.c | 19 | ||||
-rw-r--r-- | product/rddanielxlr/mcp_romfw/firmware.mk | 5 | ||||
-rw-r--r-- | product/rddanielxlr/module/mscp_rom/include/mod_mscp_rom.h | 45 | ||||
-rw-r--r-- | product/rddanielxlr/module/mscp_rom/src/Makefile | 11 | ||||
-rw-r--r-- | product/rddanielxlr/module/mscp_rom/src/mod_mscp_rom.c | 105 | ||||
-rw-r--r-- | product/rddanielxlr/scp_romfw/config_bootloader.c | 24 | ||||
-rw-r--r-- | product/rddanielxlr/scp_romfw/config_scp_rom.c | 21 | ||||
-rw-r--r-- | product/rddanielxlr/scp_romfw/firmware.mk | 5 |
9 files changed, 41 insertions, 205 deletions
diff --git a/product/rddanielxlr/mcp_romfw/config_bootloader.c b/product/rddanielxlr/mcp_romfw/config_bootloader.c new file mode 100644 index 00000000..903ee767 --- /dev/null +++ b/product/rddanielxlr/mcp_romfw/config_bootloader.c @@ -0,0 +1,11 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <fwk_module.h> + +struct fwk_module_config config_bootloader = { +}; diff --git a/product/rddanielxlr/mcp_romfw/config_rddanielxlr_rom.c b/product/rddanielxlr/mcp_romfw/config_rddanielxlr_rom.c deleted file mode 100644 index a8af750a..00000000 --- a/product/rddanielxlr/mcp_romfw/config_rddanielxlr_rom.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Arm SCP/MCP Software - * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "mcp_software_mmap.h" - -#include <mod_mscp_rom.h> - -#include <fwk_module.h> - -const struct fwk_module_config config_mscp_rom = { - .data = &((struct mscp_rom_config) { - .ramfw_ram_base = MCP_RAM0_BASE, - .ramfw_flash_size = 0, - }) -}; diff --git a/product/rddanielxlr/mcp_romfw/firmware.mk b/product/rddanielxlr/mcp_romfw/firmware.mk index 7b9f96e3..8c1c4551 100644 --- a/product/rddanielxlr/mcp_romfw/firmware.mk +++ b/product/rddanielxlr/mcp_romfw/firmware.mk @@ -16,11 +16,12 @@ BS_FIRMWARE_MODULE_HEADERS_ONLY := \ BS_FIRMWARE_MODULES := \ pl011 \ clock \ - mscp_rom + bootloader \ + isys_rom BS_FIRMWARE_SOURCES := \ config_pl011.c \ config_clock.c \ - config_rddanielxlr_rom.c + config_bootloader.c include $(BS_DIR)/firmware.mk diff --git a/product/rddanielxlr/module/mscp_rom/include/mod_mscp_rom.h b/product/rddanielxlr/module/mscp_rom/include/mod_mscp_rom.h deleted file mode 100644 index 1cf3be61..00000000 --- a/product/rddanielxlr/module/mscp_rom/include/mod_mscp_rom.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Arm SCP/MCP Software - * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef MOD_MSCP_ROM_H -#define MOD_MSCP_ROM_H - -#include <stdint.h> - -/*! - * \addtogroup GroupSCPModule MSCP Product Modules - * \{ - */ - -/*! - * \defgroup GroupSCP ROM Support - * \{ - */ - -/*! - * \brief Module configuration data. - */ -struct mscp_rom_config { - /*! Base address in RAM at which RAM firmware image has to be loaded */ - const uintptr_t ramfw_ram_base; - - /*! Base address of RAM firmware image on the NOR flash memory */ - const uintptr_t ramfw_flash_base; - - /*! The size of the RAM firmware image on the NOR flash memory */ - const unsigned int ramfw_flash_size; -}; - -/*! - * \} - */ - -/*! - * \} - */ - -#endif /* MOD_MSCP_ROM_H */ diff --git a/product/rddanielxlr/module/mscp_rom/src/Makefile b/product/rddanielxlr/module/mscp_rom/src/Makefile deleted file mode 100644 index ad0d7e5e..00000000 --- a/product/rddanielxlr/module/mscp_rom/src/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# -# Arm SCP/MCP Software -# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause -# - -BS_LIB_NAME := MSCP ROM -BS_LIB_SOURCES := mod_mscp_rom.c - -include $(BS_DIR)/lib.mk diff --git a/product/rddanielxlr/module/mscp_rom/src/mod_mscp_rom.c b/product/rddanielxlr/module/mscp_rom/src/mod_mscp_rom.c deleted file mode 100644 index 095f36a5..00000000 --- a/product/rddanielxlr/module/mscp_rom/src/mod_mscp_rom.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Arm SCP/MCP Software - * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include <mod_mscp_rom.h> - -#include <fwk_interrupt.h> -#include <fwk_log.h> -#include <fwk_module.h> -#include <fwk_module_idx.h> -#include <fwk_status.h> -#include <fwk_thread.h> - -#include <fmw_cmsis.h> - -#include <stdint.h> -#include <string.h> - -static const struct mscp_rom_config *rom_config; - -enum rom_event { - ROM_EVENT_RUN, - ROM_EVENT_COUNT -}; - -/* - * This function assumes that the RAM firmware image is located at the beginning - * of the SCP/MCP RAM. The reset handler will be at offset 0x4 (the second entry - * of the vector table). - */ -static void jump_to_ramfw(void) -{ - uintptr_t const *reset_base = - (uintptr_t *)(rom_config->ramfw_ram_base + 0x4); - void (*ramfw_reset_handler)(void); - - /* - * Disable interrupts for the duration of the ROM firmware to RAM firmware - * transition. - */ - fwk_interrupt_global_disable(); - - ramfw_reset_handler = (void (*)(void))*reset_base; - - /* Set the vector table offset register to ramfw vector table */ - SCB->VTOR = rom_config->ramfw_ram_base; - - /* - * Execute the RAM firmware's reset handler to pass control from ROM - * firmware to the RAM firmware. - */ - ramfw_reset_handler(); -} - -static int mscp_rom_init(fwk_id_t module_id, unsigned int element_count, - const void *data) -{ - rom_config = data; - - return FWK_SUCCESS; -} - -static int mscp_rom_start(fwk_id_t id) -{ - int status; - struct fwk_event event = { - .source_id = FWK_ID_MODULE(FWK_MODULE_IDX_MSCP_ROM), - .target_id = FWK_ID_MODULE(FWK_MODULE_IDX_MSCP_ROM), - .id = FWK_ID_EVENT(FWK_MODULE_IDX_MSCP_ROM, ROM_EVENT_RUN), - }; - - status = fwk_thread_put_event(&event); - - return status; -} - -static int mscp_rom_process_event(const struct fwk_event *event, - struct fwk_event *resp) -{ - FWK_LOG_INFO("[ROM] Loading RAM firmware\n"); - - if (rom_config->ramfw_flash_size != 0) { - memcpy((void *)rom_config->ramfw_ram_base, - (uint8_t *)rom_config->ramfw_flash_base, - rom_config->ramfw_flash_size); - } - - FWK_LOG_INFO("[ROM] Starting RAM firmware execution\n"); - jump_to_ramfw(); - - return FWK_SUCCESS; -} - -/* Module descriptor */ -const struct fwk_module module_mscp_rom = { - .name = "MSCP_ROM", - .type = FWK_MODULE_TYPE_SERVICE, - .event_count = ROM_EVENT_COUNT, - .init = mscp_rom_init, - .start = mscp_rom_start, - .process_event = mscp_rom_process_event, -}; diff --git a/product/rddanielxlr/scp_romfw/config_bootloader.c b/product/rddanielxlr/scp_romfw/config_bootloader.c new file mode 100644 index 00000000..34d4ad0e --- /dev/null +++ b/product/rddanielxlr/scp_romfw/config_bootloader.c @@ -0,0 +1,24 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "scp_mmap.h" +#include "scp_software_mmap.h" + +#include <mod_bootloader.h> + +#include <fwk_module.h> + +static const struct mod_bootloader_config bootloader_module_config = { + .source_base = SCP_RAMFW_IMAGE_FLASH_BASE, + .source_size = SCP_RAMFW_IMAGE_FLASH_SIZE, + .destination_base = SCP_ITC_RAM_BASE, + .destination_size = SCP_RAMFW_IMAGE_FLASH_SIZE, +}; + +struct fwk_module_config config_bootloader = { + .data = &bootloader_module_config, +}; diff --git a/product/rddanielxlr/scp_romfw/config_scp_rom.c b/product/rddanielxlr/scp_romfw/config_scp_rom.c deleted file mode 100644 index 93b41811..00000000 --- a/product/rddanielxlr/scp_romfw/config_scp_rom.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Arm SCP/MCP Software - * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "scp_mmap.h" -#include "scp_software_mmap.h" - -#include <mod_mscp_rom.h> - -#include <fwk_module.h> - -const struct fwk_module_config config_mscp_rom = { - .data = &((struct mscp_rom_config) { - .ramfw_ram_base = SCP_ITC_RAM_BASE, - .ramfw_flash_base = SCP_RAMFW_IMAGE_FLASH_BASE, - .ramfw_flash_size = SCP_RAMFW_IMAGE_FLASH_SIZE, - }) -}; diff --git a/product/rddanielxlr/scp_romfw/firmware.mk b/product/rddanielxlr/scp_romfw/firmware.mk index 1239ac8c..902b3432 100644 --- a/product/rddanielxlr/scp_romfw/firmware.mk +++ b/product/rddanielxlr/scp_romfw/firmware.mk @@ -20,13 +20,14 @@ BS_FIRMWARE_MODULES := \ pcid \ pl011 \ clock \ - mscp_rom \ + bootloader \ + isys_rom BS_FIRMWARE_SOURCES := \ config_sid.c \ config_system_info.c \ config_pl011.c \ config_clock.c \ - config_scp_rom.c \ + config_bootloader.c include $(BS_DIR)/firmware.mk |