aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-05-18 00:20:53 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-05-18 00:20:53 -0400
commitabc7597692b8c74ca91d86a17c9f2590952323cf (patch)
treecd56e4be3dad745ad82f35c67ddd85ffa841bb64
parent88c00ee5799bd5aca5b8ae900e645d121896581c (diff)
downloadseabios-hppa-abc7597692b8c74ca91d86a17c9f2590952323cf.zip
seabios-hppa-abc7597692b8c74ca91d86a17c9f2590952323cf.tar.gz
seabios-hppa-abc7597692b8c74ca91d86a17c9f2590952323cf.tar.bz2
Establish boot order in post stage.
Read boot order nvram fields in post stage and store in a variable. Change boot menu to update boot order instead of using separate variables.
-rw-r--r--src/biosvar.h3
-rw-r--r--src/boot.c22
-rw-r--r--src/post.c5
-rw-r--r--src/post_menu.c5
4 files changed, 15 insertions, 20 deletions
diff --git a/src/biosvar.h b/src/biosvar.h
index d2d7b9f..9668f31 100644
--- a/src/biosvar.h
+++ b/src/biosvar.h
@@ -213,7 +213,8 @@ struct ipl_s {
struct ipl_entry_s table[8];
u16 count;
u16 sequence;
- u16 bootfirst;
+ u32 bootorder;
+ u8 checkfloppysig;
};
#define IPL_TYPE_FLOPPY 0x01
diff --git a/src/boot.c b/src/boot.c
index 53577ec..12226d6 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -8,7 +8,6 @@
#include "util.h" // irq_enable
#include "biosvar.h" // struct bregs
#include "config.h" // CONFIG_*
-#include "cmos.h" // inb_cmos
#include "ata.h" // ata_detect
#include "disk.h" // cdrom_boot
@@ -23,7 +22,7 @@ char pnp_string[] VISIBLE16 __attribute__((aligned (2))) = " $PnP";
//--------------------------------------------------------------------------
static const char drivetypes[][10]={
- "", "Floppy","Hard Disk","CD-Rom", "Network"
+ "", "Floppy", "Hard Disk", "CD-Rom", "Network"
};
void
@@ -86,24 +85,14 @@ try_boot(u16 seq_nr)
SET_EBDA(ipl.sequence, seq_nr);
- u16 bootdev = inb_cmos(CMOS_BIOS_BOOTFLAG2);
- bootdev |= ((inb_cmos(CMOS_BIOS_BOOTFLAG1) & 0xf0) << 4);
+ u32 bootdev = GET_EBDA(ipl.bootorder);
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");
- /* Translate from CMOS runes to an IPL table offset by subtracting 1 */
+ /* Translate bootdev to an IPL table offset by subtracting 1 */
bootdev -= 1;
if (bootdev >= GET_EBDA(ipl.count)) {
@@ -142,9 +131,8 @@ try_boot(u16 seq_nr)
}
/* Always check the signature on a HDD boot sector; on FDD,
- * only do the check if the CMOS doesn't tell us to skip it */
- if ((type != IPL_TYPE_FLOPPY)
- || !((inb_cmos(CMOS_BIOS_BOOTFLAG1) & 0x01))) {
+ * only do the check if configured for it */
+ if (type != IPL_TYPE_FLOPPY || GET_EBDA(ipl.checkfloppysig)) {
if (GET_FARVAR(bootseg, *(u16*)0x1fe) != 0xaa55) {
print_boot_failure(type, 0);
return;
diff --git a/src/post.c b/src/post.c
index 573dfc8..1464572 100644
--- a/src/post.c
+++ b/src/post.c
@@ -131,7 +131,10 @@ init_boot_vectors()
ebda->ipl.count = ip - ebda->ipl.table;
ebda->ipl.sequence = 0xffff;
- ebda->ipl.bootfirst = 0xffff;
+ ebda->ipl.bootorder = (inb_cmos(CMOS_BIOS_BOOTFLAG2)
+ | ((inb_cmos(CMOS_BIOS_BOOTFLAG1) & 0xf0) << 4));
+ if (!(inb_cmos(CMOS_BIOS_BOOTFLAG1) & 1))
+ ebda->ipl.checkfloppysig = 1;
}
static void
diff --git a/src/post_menu.c b/src/post_menu.c
index 91b18fe..4526e44 100644
--- a/src/post_menu.c
+++ b/src/post_menu.c
@@ -73,7 +73,10 @@ interactive_bootmenu()
/* ESC or F12 */
break;
if (scan_code <= count + 1) {
- SET_EBDA(ipl.bootfirst, scan_code - 1);
+ // Add user choice to the boot order.
+ u16 choice = scan_code - 1;
+ u32 bootorder = GET_EBDA(ipl.bootorder);
+ SET_EBDA(ipl.bootorder, (bootorder << 4) | choice);
break;
}
}