diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-04-05 15:51:12 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-04-05 15:51:12 -0400 |
commit | e0113c99c083d9b812216e120aff9eb9806de91b (patch) | |
tree | 1b861afb2b61f9cc02580161c15da77af38a3397 /src/boot.c | |
parent | 567e4e3d349150e252f0d2914d6631e766308490 (diff) | |
download | seabios-hppa-e0113c99c083d9b812216e120aff9eb9806de91b.zip seabios-hppa-e0113c99c083d9b812216e120aff9eb9806de91b.tar.gz seabios-hppa-e0113c99c083d9b812216e120aff9eb9806de91b.tar.bz2 |
Forward port new boot menu features from bochs bios.
Support boot menu during last stage of post.
Improve description of option roms.
Support printf of "%.s" to force printing strings on stack.
Enhance memcpy so that it also works in real-mode.
Diffstat (limited to 'src/boot.c')
-rw-r--r-- | src/boot.c | 50 |
1 files changed, 39 insertions, 11 deletions
@@ -26,17 +26,36 @@ static const char drivetypes[][10]={ "", "Floppy","Hard Disk","CD-Rom", "Network" }; -static void -print_boot_device(u16 type) +void +printf_bootdev(u16 bootdev) { + u16 type = GET_EBDA(ipl.table[bootdev].type); + /* NIC appears as type 0x80 */ if (type == IPL_TYPE_BEV) type = 0x4; if (type == 0 || type > 0x4) BX_PANIC("Bad drive type\n"); - printf("Booting from %s...\n", drivetypes[type]); + printf("%s", drivetypes[type]); + + /* print product string if BEV */ + void *far_description = (void*)GET_EBDA(ipl.table[bootdev].description); + if (type == 4 && far_description != 0) { + char description[33]; + /* first 32 bytes are significant */ + memcpy(MAKE_FARPTR(GET_SEG(SS), &description), far_description, 32); + /* terminate string */ + description[32] = 0; + printf(" [%.s]", description); + } +} - // XXX - latest cvs has BEV description +static void +print_boot_device(u16 bootdev) +{ + printf("Booting from "); + printf_bootdev(bootdev); + printf("...\n"); } //-------------------------------------------------------------------------- @@ -67,14 +86,20 @@ try_boot(u16 seq_nr) SET_EBDA(ipl.sequence, seq_nr); - u16 bootseg; - u8 bootdrv = 0; - u16 bootdev, bootip; - - bootdev = inb_cmos(CMOS_BIOS_BOOTFLAG2); + u16 bootdev = inb_cmos(CMOS_BIOS_BOOTFLAG2); bootdev |= ((inb_cmos(CMOS_BIOS_BOOTFLAG1) & 0xf0) << 4); bootdev >>= 4 * seq_nr; bootdev &= 0xf; + + /* Read user selected device */ + u16 bootfirst = GET_EBDA(ipl.bootfirst); + if (bootfirst != 0xFFFF) { + bootdev = bootfirst; + /* Reset boot sequence */ + SET_EBDA(ipl.bootfirst, 0xFFFF); + SET_EBDA(ipl.sequence, 0xFFFF); + } + if (bootdev == 0) BX_PANIC("No bootable device.\n"); @@ -85,12 +110,15 @@ try_boot(u16 seq_nr) BX_INFO("Invalid boot device (0x%x)\n", bootdev); return; } - u16 type = GET_EBDA(ipl.table[bootdev].type); /* Do the loading, and set up vector as a far pointer to the boot * address, and bootdrv as the boot drive */ - print_boot_device(type); + print_boot_device(bootdev); + + u16 type = GET_EBDA(ipl.table[bootdev].type); + u16 bootseg, bootip; + u8 bootdrv = 0; struct bregs cr; switch(type) { case IPL_TYPE_FLOPPY: /* FDD */ |