From 104154b48e0fcf1047af2722a8ecef8935698f1a Mon Sep 17 00:00:00 2001 From: Steven James Date: Mon, 26 May 2003 11:51:59 +0000 Subject: [PATCH] Minor updates --- util/baremetal/bootselect/bootselect.c | 20 ++++++++++++++++---- util/baremetal/bootselect/chooser.c | 17 +++++++++++++---- util/baremetal/lib/elfboot.c | 1 + 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/util/baremetal/bootselect/bootselect.c b/util/baremetal/bootselect/bootselect.c index 14d7af271d..981a5976d5 100644 --- a/util/baremetal/bootselect/bootselect.c +++ b/util/baremetal/bootselect/bootselect.c @@ -24,7 +24,11 @@ char buffer[16]; extern struct stream rom_stream; -struct lb_memory *lbmem; + +inline void reset(void) +{ + outb(0x0e, 0xcf9); +} int main(void) { int blocks; @@ -35,10 +39,18 @@ int main(void) { DPRINTF("Got lbmem struct: %08x\n", (unsigned int) lbmem); - if(choose_stream(&rom_stream) <0) - return(-1); + switch(choose_stream(&rom_stream)) { + case -1: + return(-1); + break; + case -2: + reset(); + break; - elfboot(&rom_stream, preboot_param); + default: + elfboot(&rom_stream, preboot_param); + break; + } } outb(0x0e, 0x3f9); diff --git a/util/baremetal/bootselect/chooser.c b/util/baremetal/bootselect/chooser.c index 0a6546eac2..82cd88a7b0 100644 --- a/util/baremetal/bootselect/chooser.c +++ b/util/baremetal/bootselect/chooser.c @@ -16,10 +16,11 @@ #include #include +int stream_default=1; int choose_stream(struct stream *stream) { - int stream_count, i,j; + int stream_count, i,j,max; tag_head *directory, *current; if(stream->init() < 0) { @@ -50,7 +51,8 @@ int choose_stream(struct stream *stream) current += current->block_count+1; } - j=1; + max = j; + if(iskey()) { j = ttys0_rx_char(); j=-1; @@ -58,6 +60,10 @@ int choose_stream(struct stream *stream) while(j<0) { printk_info("Choose a stream: "); j = ttys0_rx_char(); + + if(j == 'r' || j == 'R') + return(-2); + if(j == 0x1b || j == 'x') return(-1); @@ -65,12 +71,15 @@ int choose_stream(struct stream *stream) printk_info(" INVALID RESPONSE\n"); j=-1; } else - j-=0x30; + stream_default = (j-=0x30); } } + if(stream_default == max) + return(-2); - stream->load_tag(j); + stream->load_tag(stream_default); + stream_default++; return(0); } diff --git a/util/baremetal/lib/elfboot.c b/util/baremetal/lib/elfboot.c index d819b2b01a..508836ced9 100644 --- a/util/baremetal/lib/elfboot.c +++ b/util/baremetal/lib/elfboot.c @@ -676,6 +676,7 @@ int elfboot(struct stream *stream, pre_boot_param_t *param) printk_err("Cannot Load ELF Image\n"); post_code(0xff); + return(-1); } return 0;