Cleanup boot order determination.
authorKevin O'Connor <kevin@koconnor.net>
Sat, 29 Mar 2008 18:04:34 +0000 (14:04 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 29 Mar 2008 18:04:34 +0000 (14:04 -0400)
Determining which device to boot from should not depend on CONFIG_CDROM_BOOT
Instead, always use the cmos 0x38/0x3d for determining boot order.

src/boot.c
src/cmos.h

index 153ea24d2d581fb445d7422db57028f340dae2eb..c1f88469d570ef56e31419a257b3def77734adc8 100644 (file)
@@ -71,26 +71,15 @@ try_boot(u16 seq_nr)
     u8 bootdrv = 0;
     u16 bootdev, bootip;
 
-    // XXX - why different bootdev check based on CONFIG_CDROM_BOOT?
-    if (CONFIG_CDROM_BOOT) {
-        bootdev = inb_cmos(CMOS_BIOS_BOOTFLAG2);
-        bootdev |= ((inb_cmos(CMOS_BIOS_BOOTFLAG1) & 0xf0) << 4);
-        bootdev >>= 4 * seq_nr;
-        bootdev &= 0xf;
-        if (bootdev == 0)
-            BX_PANIC("No bootable device.\n");
-
-        /* Translate from CMOS runes to an IPL table offset by subtracting 1 */
-        bootdev -= 1;
-    } else {
-        if (seq_nr ==2)
-            BX_PANIC("No more boot devices.");
-        if (!!(inb_cmos(CMOS_BIOS_CONFIG) & 0x20) ^ (seq_nr == 1))
-            /* Boot from floppy if the bit is set or it's the second boot */
-            bootdev = 0x00;
-        else
-            bootdev = 0x01;
-    }
+    bootdev = inb_cmos(CMOS_BIOS_BOOTFLAG2);
+    bootdev |= ((inb_cmos(CMOS_BIOS_BOOTFLAG1) & 0xf0) << 4);
+    bootdev >>= 4 * seq_nr;
+    bootdev &= 0xf;
+    if (bootdev == 0)
+        BX_PANIC("No bootable device.\n");
+
+    /* Translate from CMOS runes to an IPL table offset by subtracting 1 */
+    bootdev -= 1;
 
     if (bootdev >= GET_EBDA(ipl.count)) {
         BX_INFO("Invalid boot device (0x%x)\n", bootdev);
index d1ff8b311d801430bf7cbca6fe1bdd195fc61777..3bc4bef3055bc67f77ba00bc4d59a9d6b858eda1 100644 (file)
@@ -32,7 +32,6 @@
 #define CMOS_DISK_DRIVE2_TYPE    0x1a
 #define CMOS_DISK_DRIVE1_CYL     0x1b
 #define CMOS_DISK_DRIVE2_CYL     0x24
-#define CMOS_BIOS_CONFIG         0x2d
 #define CMOS_MEM_EXTMEM_LOW      0x30
 #define CMOS_MEM_EXTMEM_HIGH     0x31
 #define CMOS_CENTURY             0x32