Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Cleanup boot order determination.
Determining which device to boot from should not depend on CONFIG_CDROM_BOOT
Instead, always use the cmos 0x38/0x3d for determining boot order.
  • Loading branch information
KevinOConnor committed Mar 29, 2008
1 parent 56a506d commit 840c534
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
29 changes: 9 additions & 20 deletions src/boot.c
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/cmos.h
Expand Up @@ -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
Expand Down

0 comments on commit 840c534

Please sign in to comment.