diff --git a/litex/soc/software/bios/boot.c b/litex/soc/software/bios/boot.c index 7a4336aab..257aaa076 100644 --- a/litex/soc/software/bios/boot.c +++ b/litex/soc/software/bios/boot.c @@ -1,5 +1,5 @@ +// This file is Copyright (c) 2014-2020 Florent Kermarrec // This file is Copyright (c) 2013-2014 Sebastien Bourdeauducq -// This file is Copyright (c) 2014-2019 Florent Kermarrec // This file is Copyright (c) 2018 Ewen McNeill // This file is Copyright (c) 2018 Felix Held // This file is Copyright (c) 2019 Gabriel L. Somlo @@ -35,9 +35,17 @@ #include #include +/*-----------------------------------------------------------------------*/ +/* Helpers */ +/*-----------------------------------------------------------------------*/ + #define max(x, y) (((x) > (y)) ? (x) : (y)) #define min(x, y) (((x) < (y)) ? (x) : (y)) +/*-----------------------------------------------------------------------*/ +/* Boot */ +/*-----------------------------------------------------------------------*/ + extern void boot_helper(unsigned long r1, unsigned long r2, unsigned long r3, unsigned long addr); static void __attribute__((noreturn)) boot(unsigned long r1, unsigned long r2, unsigned long r3, unsigned long addr) @@ -73,6 +81,25 @@ enum { ACK_OK }; +/*-----------------------------------------------------------------------*/ +/* ROM Boot */ +/*-----------------------------------------------------------------------*/ + +#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 + +/*-----------------------------------------------------------------------*/ +/* Serial Boot */ +/*-----------------------------------------------------------------------*/ + static int check_ack(void) { int recognized; @@ -241,6 +268,10 @@ int serialboot(void) return 1; } +/*-----------------------------------------------------------------------*/ +/* Ethernet Boot */ +/*-----------------------------------------------------------------------*/ + #ifdef CSR_ETHMAC_BASE #ifndef LOCALIP1 @@ -355,6 +386,10 @@ void netboot(void) #endif +/*-----------------------------------------------------------------------*/ +/* Flash Boot */ +/*-----------------------------------------------------------------------*/ + #ifdef FLASH_BOOT_ADDRESS /* On systems with external SDRAM we copy out of the SPI flash into the SDRAM @@ -498,16 +533,9 @@ void flashboot(void) } #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 +/*-----------------------------------------------------------------------*/ +/* SDCard Boot */ +/*-----------------------------------------------------------------------*/ #if defined(CSR_SPISDCARD_BASE) || defined(CSR_SDCORE_BASE)