[SeaBIOS] [PATCH 1/6] pci: don't reorder entries when moving to 64bit list

Gerd Hoffmann kraxel at redhat.com
Tue Nov 26 13:24:09 CET 2013


Otherwise the 64bit bars are not mapped in largest
first order, thereby messing up the alignment.

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 src/fw/pciinit.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
index 34279a4..84bb65b 100644
--- a/src/fw/pciinit.c
+++ b/src/fw/pciinit.c
@@ -574,14 +574,19 @@ static u64 pci_region_sum(struct pci_region *r)
 static void pci_region_migrate_64bit_entries(struct pci_region *from,
                                              struct pci_region *to)
 {
-    struct hlist_node *n, **last = &to->list.first;
+    struct hlist_node *n, *last = NULL;
     struct pci_region_entry *entry;
     hlist_for_each_entry_safe(entry, n, &from->list, node) {
         if (!entry->is64)
             continue;
         // Move from source list to destination list.
         hlist_del(&entry->node);
-        hlist_add(&entry->node, last);
+        if (hlist_empty(&to->list)) {
+            hlist_add_head(&entry->node, &to->list);
+        } else {
+            hlist_add_after(&entry->node, last);
+        }
+        last = &entry->node;
     }
 }
 
-- 
1.8.3.1




More information about the SeaBIOS mailing list