From 35250f5b110da0749929f160ceb21f0286fb01b9 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 14 Jul 2015 17:33:24 +0200 Subject: [PATCH] bios: add romboot When firmware is small enough, it can be interesting to run code from an embedded blockram memory (faster and not impacted by memory controller activity). It can also be a fallback option in case boot from flash failed. To use this, define ROM_BOOT_ADDRESS and initialize the blockram with the firmware data. --- software/bios/boot.c | 11 +++++++++++ software/bios/boot.h | 1 + software/bios/main.c | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/software/bios/boot.c b/software/bios/boot.c index b40e65983..54b778994 100644 --- a/software/bios/boot.c +++ b/software/bios/boot.c @@ -269,3 +269,14 @@ void flashboot(void) boot(0, 0, 0, MAIN_RAM_BASE); } #endif + +#ifdef ROM_BOOT_ADDRESS +/* When firmware is small enough, it can be interesting to run code from an + embedded blockram memory (faster and not impacted by memory controller + activity). Define ROM_BOOT_ADDRESS for that and initialize the blockram + with the firmware data. */ +void romboot(void) +{ + boot(0, 0, 0, ROM_BOOT_ADDRESS); +} +#endif diff --git a/software/bios/boot.h b/software/bios/boot.h index 97a30e52d..aa9cd88ad 100644 --- a/software/bios/boot.h +++ b/software/bios/boot.h @@ -4,5 +4,6 @@ void serialboot(void); void netboot(void); void flashboot(void); +void romboot(void); #endif /* __BOOT_H */ diff --git a/software/bios/main.c b/software/bios/main.c index 938ebe3e9..2a9aaa986 100644 --- a/software/bios/main.c +++ b/software/bios/main.c @@ -325,6 +325,9 @@ static void help(void) puts("serialboot - boot via SFL"); #ifdef FLASH_BOOT_ADDRESS puts("flashboot - boot from flash"); +#endif +#ifdef ROM_BOOT_ADDRESS + puts("romboot - boot from embedded rom"); #endif puts("revision - display revision"); #ifdef CSR_SDRAM_BASE @@ -365,6 +368,9 @@ static void do_command(char *c) #ifdef FLASH_BOOT_ADDRESS else if(strcmp(token, "flashboot") == 0) flashboot(); +#endif +#ifdef ROM_BOOT_ADDRESS + else if(strcmp(token, "romboot") == 0) romboot(); #endif else if(strcmp(token, "serialboot") == 0) serialboot(); #ifdef CSR_ETHMAC_BASE @@ -506,6 +512,9 @@ static void boot_sequence(void) if(test_user_abort()) { #ifdef FLASH_BOOT_ADDRESS flashboot(); +#endif +#ifdef ROM_BOOT_ADDRESS + romboot(); #endif serialboot(); #ifdef CSR_ETHMAC_BASE