[SeaBIOS] [PATCH v2 2/6] boot: track the PCI class of BCV/BEV boot entries

Paolo Bonzini pbonzini at redhat.com
Wed Oct 17 18:23:44 CEST 2012


In order to find network devices in the boot list, remember the PCI class
for each BCV/BEV (which is also present in the PNP header as the device
type code).

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
 src/boot.c       | 10 ++++++----
 src/boot.h       |  4 ++--
 src/optionroms.c |  8 +++++---
 3 file modificati, 13 inserzioni(+), 9 rimozioni(-)

diff --git a/src/boot.c b/src/boot.c
index b9bcb57..2835008 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -339,9 +339,10 @@ static inline int defPrio(int priority, int defaultprio) {
 
 // Add a BEV vector for a given pnp compatible option rom.
 void
-boot_add_bev(u16 seg, u16 bev, u16 desc, int prio)
+boot_add_bev(u16 seg, u16 bev, u16 desc, u16 class, int prio)
 {
-    bootentry_add(IPL_TYPE_BEV, defPrio(prio, DefaultBEVPrio)
+    class &= 0xF;
+    bootentry_add(IPL_TYPE_BEV | class, defPrio(prio, DefaultBEVPrio)
                   , SEGOFF(seg, bev).segoff
                   , desc ? MAKE_FLATPTR(seg, desc) : "Unknown");
     DefaultBEVPrio = DEFAULT_PRIO;
@@ -349,9 +350,10 @@ boot_add_bev(u16 seg, u16 bev, u16 desc, int prio)
 
 // Add a bcv entry for an expansion card harddrive or legacy option rom
 void
-boot_add_bcv(u16 seg, u16 ip, u16 desc, int prio)
+boot_add_bcv(u16 seg, u16 ip, u16 desc, u16 class, int prio)
 {
-    bootentry_add(IPL_TYPE_BCV, defPrio(prio, DefaultHDPrio)
+    class &= 0xF;
+    bootentry_add(IPL_TYPE_BCV | class, defPrio(prio, DefaultHDPrio)
                   , SEGOFF(seg, ip).segoff
                   , desc ? MAKE_FLATPTR(seg, desc) : "Legacy option rom");
 }
diff --git a/src/boot.h b/src/boot.h
index afe9f2e..c237af7 100644
--- a/src/boot.h
+++ b/src/boot.h
@@ -4,8 +4,8 @@
 
 // boot.c
 void boot_setup(void);
-void boot_add_bev(u16 seg, u16 bev, u16 desc, int prio);
-void boot_add_bcv(u16 seg, u16 ip, u16 desc, int prio);
+void boot_add_bev(u16 seg, u16 bev, u16 desc, u16 class, int prio);
+void boot_add_bcv(u16 seg, u16 ip, u16 desc, u16 class, int prio);
 struct drive_s;
 void boot_add_floppy(struct drive_s *drive_g, const char *desc, int prio);
 void boot_add_hd(struct drive_s *drive_g, const char *desc, int prio);
diff --git a/src/optionroms.c b/src/optionroms.c
index 00697b2..1f03de8 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -386,18 +386,20 @@ optionrom_setup(void)
         if (! pnp) {
             // Legacy rom.
             boot_add_bcv(FLATPTR_TO_SEG(rom), OPTION_ROM_INITVECTOR, 0
-                         , getRomPriority(sources, rom, 0));
+                         , 0, getRomPriority(sources, rom, 0));
             continue;
         }
         // PnP rom - check for BEV and BCV boot capabilities.
+        // Note that the PNP type_lo field is the same as a PCI class
+        // (http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/devids.txt)
         int instance = 0;
         while (pnp) {
             if (pnp->bev)
                 boot_add_bev(FLATPTR_TO_SEG(rom), pnp->bev, pnp->productname
-                             , getRomPriority(sources, rom, instance++));
+                             , pnp->type_lo, getRomPriority(sources, rom, instance++));
             else if (pnp->bcv)
                 boot_add_bcv(FLATPTR_TO_SEG(rom), pnp->bcv, pnp->productname
-                             , getRomPriority(sources, rom, instance++));
+                             , pnp->type_lo, getRomPriority(sources, rom, instance++));
             else
                 break;
             pnp = get_pnp_next(rom, pnp);
-- 
1.7.12.1





More information about the SeaBIOS mailing list