[SeaBIOS] [PATCH 2/2] Simplify boot ordering by building an inclusive boot list.

Kevin O'Connor kevin at koconnor.net
Mon Dec 27 05:59:06 CET 2010


On Sun, Dec 26, 2010 at 11:33:42PM -0500, Kevin O'Connor wrote:
> Replace the bcv list with a full list of all "bootable objects".  All
> ordering can then be done on this list.  The final boot menu, drive
> mapping, and BEV list generation is then driven from this
> authoritative list.
> 
> Move "Floppy" and "DVD/CD" description prefixes into drive description
> generation code to simplify boot menu generation.
> 
> Rework QEMU's CMOS defined bootorder to work with priority scheme in
> new boot list.
> 
> Have every CBFS entry create it's own BEV entry (instead of one entry
> for all CBFS payloads).  Move CBFS payload detection code into
> coreboot.c.

Hrmm - I should probably have done the following (incremental patch)
to ensure no conflict with bootorder file reading:

diff --git a/src/boot.c b/src/boot.c
index f7cc8d5..73ac5c8 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -70,12 +70,12 @@ loadBootOrder(void)
     } while(f);
 }
 
-#define MAX_BOOT_PRIO        0xff
+#define DEFAULT_PRIO           9999
 
-int DefaultFloppyPrio = 1;
-int DefaultCDPrio = 2;
-int DefaultHDPrio = 3;
-int DefaultBEVPrio = 4;
+static int DefaultFloppyPrio = 101;
+static int DefaultCDPrio     = 102;
+static int DefaultHDPrio     = 103;
+static int DefaultBEVPrio    = 104;
 
 void
 boot_setup(void)
@@ -92,9 +92,10 @@ boot_setup(void)
             IPL.checkfloppysig = 0;
         u32 bootorder = (inb_cmos(CMOS_BIOS_BOOTFLAG2)
                          | ((inb_cmos(CMOS_BIOS_BOOTFLAG1) & 0xf0) << 4));
-        DefaultFloppyPrio = DefaultCDPrio = DefaultHDPrio = MAX_BOOT_PRIO;
+        DefaultFloppyPrio = DefaultCDPrio = DefaultHDPrio
+            = DefaultBEVPrio = DEFAULT_PRIO;
         int i;
-        for (i=1; i<4; i++) {
+        for (i=101; i<104; i++) {
             u32 val = bootorder & 0x0f;
             bootorder >>= 4;
             switch (val) {
@@ -157,14 +158,14 @@ boot_add_bev(u16 seg, u16 bev, u16 desc)
 {
     bootentry_add(IPL_TYPE_BEV, DefaultBEVPrio, SEGOFF(seg, bev).segoff
                   , desc ? MAKE_FLATPTR(seg, desc) : "Unknown");
-    DefaultBEVPrio = MAX_BOOT_PRIO;
+    DefaultBEVPrio = DEFAULT_PRIO;
 }
 
 // Add a bcv entry for an expansion card harddrive or legacy option rom
 void
 boot_add_bcv(u16 seg, u16 ip, u16 desc)
 {
-    bootentry_add(IPL_TYPE_BCV, MAX_BOOT_PRIO, SEGOFF(seg, ip).segoff
+    bootentry_add(IPL_TYPE_BCV, DEFAULT_PRIO, SEGOFF(seg, ip).segoff
                   , desc ? MAKE_FLATPTR(seg, desc) : "Legacy option rom");
 }
 
@@ -193,7 +194,7 @@ boot_add_cd(struct drive_s *drive_g)
 void
 boot_add_cbfs(void *data, const char *desc)
 {
-    bootentry_add(IPL_TYPE_CBFS, MAX_BOOT_PRIO, (u32)data, desc);
+    bootentry_add(IPL_TYPE_CBFS, DEFAULT_PRIO, (u32)data, desc);
 }
 
 



More information about the SeaBIOS mailing list