From b6448ba5fc18847e901a5a55daa1af58e0c07300 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 28 May 2013 16:15:30 +0200 Subject: [PATCH] bios: remove rescue --- software/bios/Makefile | 3 +-- software/bios/boot-helper.S | 2 +- software/bios/boot.c | 18 +++++++----------- software/bios/main.c | 19 ++++--------------- 4 files changed, 13 insertions(+), 29 deletions(-) diff --git a/software/bios/Makefile b/software/bios/Makefile index 95d182c4..16f2503f 100644 --- a/software/bios/Makefile +++ b/software/bios/Makefile @@ -15,7 +15,6 @@ all: bios.bin $(M2DIR)/tools/mkmmimg $@ write bios.elf: linker.ld $(OBJECTS) libs -bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs %.elf: $(LD) $(LDFLAGS) -T $< -N -o $@ $(OBJECTS) \ @@ -43,6 +42,6 @@ flash: bios.bin m1nor bios.bin clean: - $(RM) $(OBJECTS) $(OBJECTS:.o=.d) bios.elf bios.bin bios-rescue.elf bios-rescue.bin .*~ *~ + $(RM) $(OBJECTS) $(OBJECTS:.o=.d) bios.elf bios.bin .*~ *~ .PHONY: all main.o clean libs flash diff --git a/software/bios/boot-helper.S b/software/bios/boot-helper.S index da99182a..d668f70f 100644 --- a/software/bios/boot-helper.S +++ b/software/bios/boot-helper.S @@ -7,4 +7,4 @@ boot_helper: nop nop nop - call r5 + call r4 diff --git a/software/bios/boot.c b/software/bios/boot.c index b37f1524..365bbb50 100644 --- a/software/bios/boot.c +++ b/software/bios/boot.c @@ -14,16 +14,15 @@ #include #include "boot.h" -extern int rescue; -extern void boot_helper(unsigned int r1, unsigned int r2, unsigned int r3, unsigned int r4, unsigned int addr); +extern void boot_helper(unsigned int r1, unsigned int r2, unsigned int r3, unsigned int addr); -static void __attribute__((noreturn)) boot(unsigned int r1, unsigned int r2, unsigned int r3, unsigned int r4, unsigned int addr) +static void __attribute__((noreturn)) boot(unsigned int r1, unsigned int r2, unsigned int r3, unsigned int addr) { printf("Executing booted program.\n"); uart_sync(); irq_setmask(0); irq_setie(0); - boot_helper(r1, r2, r3, r4, addr); + boot_helper(r1, r2, r3, addr); while(1); } @@ -137,7 +136,7 @@ void serialboot(void) |((unsigned int)frame.payload[2] << 8) |((unsigned int)frame.payload[3] << 0); uart_write(SFL_ACK_SUCCESS); - boot(cmdline_adr, initrdstart_adr, initrdend_adr, rescue, addr); + boot(cmdline_adr, initrdstart_adr, initrdend_adr, addr); break; } case SFL_CMD_CMDLINE: @@ -234,7 +233,7 @@ void netboot(void) } else initrdend_adr = initrdstart_adr + size; - boot(cmdline_adr, initrdstart_adr, initrdend_adr, rescue, SDRAM_BASE); + boot(cmdline_adr, initrdstart_adr, initrdend_adr, SDRAM_BASE); } void flashboot(void) @@ -245,10 +244,7 @@ void flashboot(void) unsigned int got_crc; printf("Booting from flash...\n"); - if(rescue) - flashbase = (unsigned int *)FLASH_OFFSET_RESCUE_APP; - else - flashbase = (unsigned int *)FLASH_OFFSET_REGULAR_APP; + flashbase = (unsigned int *)FLASH_OFFSET_REGULAR_APP; length = *flashbase++; crc = *flashbase++; if((length < 32) || (length > 4*1024*1024)) { @@ -263,5 +259,5 @@ void flashboot(void) printf("CRC failed (expected %08x, got %08x)\n", crc, got_crc); return; } - boot(0, 0, 0, rescue, SDRAM_BASE); + boot(0, 0, 0, SDRAM_BASE); } diff --git a/software/bios/main.c b/software/bios/main.c index 8e372a57..4d326f43 100644 --- a/software/bios/main.c +++ b/software/bios/main.c @@ -375,7 +375,6 @@ static void do_command(char *c) printf("Command not found\n"); } -int rescue; extern unsigned int _edata; static void crcbios(void) @@ -391,7 +390,7 @@ static void crcbios(void) * We also use the address of _edata to know the length * of our code. */ - offset_bios = rescue ? FLASH_OFFSET_RESCUE_BIOS : FLASH_OFFSET_REGULAR_BIOS; + offset_bios = FLASH_OFFSET_REGULAR_BIOS; expected_crc = _edata; length = (unsigned int)&_edata - offset_bios; actual_crc = crc32((unsigned char *)offset_bios, length); @@ -488,15 +487,9 @@ static int test_user_abort(void) static void boot_sequence(void) { if(test_user_abort()) { - if(rescue) { - serialboot(); - netboot(); - flashboot(); - } else { - flashboot(); - serialboot(); - netboot(); - } + flashboot(); + serialboot(); + netboot(); printf("No boot medium found\n"); } } @@ -506,15 +499,11 @@ int main(int i, char **c) char buffer[64]; int ddr_ok; - rescue = !((unsigned int)main > FLASH_OFFSET_REGULAR_BIOS); - irq_setmask(0); irq_setie(1); uart_init(); puts(banner); crcbios(); - if(rescue) - printf("Rescue mode\n"); id_print(); ethreset(); print_mac(); -- 2.30.2