[SeaBIOS] [PATCH 2/2] fw/acpi: Do not create a hole between 640 KiB and 1 MiB in SRAT

Filippo Sironi sironi at amazon.de
Fri Jan 27 02:18:40 CET 2017


A commodity BIOS does not punch a memory hole between 640 KiB and 1 MiB
in SRAT. Make SeaBIOS behave in the same way.

Signed-off-by: Filippo Sironi <sironi at amazon.de>
---
 src/fw/acpi.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/fw/acpi.c b/src/fw/acpi.c
index 864c247..32889df 100644
--- a/src/fw/acpi.c
+++ b/src/fw/acpi.c
@@ -520,7 +520,7 @@ build_srat(void)
     struct system_resource_affinity_table *srat;
     int srat_size = sizeof(*srat) +
         sizeof(struct srat_processor_affinity) * max_cpu +
-        sizeof(struct srat_memory_affinity) * (nb_numa_nodes + 2);
+        sizeof(struct srat_memory_affinity) * (nb_numa_nodes + 1);
 
     srat = malloc_high(srat_size);
     if (!srat) {
@@ -557,22 +557,16 @@ build_srat(void)
     int slots = 0;
     u64 mem_len, mem_base, next_base = 0;
 
-    acpi_build_srat_memory(numamem, 0, 640*1024, 0, 1);
-    next_base = 1024 * 1024;
-    numamem++;
-    slots++;
-    for (i = 1; i < nb_numa_nodes + 1; ++i) {
+    for (i = 0; i < nb_numa_nodes; ++i) {
         mem_base = next_base;
         mem_len = *numadata++;
-        if (i == 1)
-            mem_len -= 1024 * 1024;
         next_base = mem_base + mem_len;
 
         /* Cut out the PCI hole */
         if (mem_base <= RamSize && next_base > RamSize) {
             mem_len -= next_base - RamSize;
             if (mem_len > 0) {
-                acpi_build_srat_memory(numamem, mem_base, mem_len, i-1, 1);
+                acpi_build_srat_memory(numamem, mem_base, mem_len, i, 1);
                 numamem++;
                 slots++;
             }
@@ -580,11 +574,11 @@ build_srat(void)
             mem_len = next_base - RamSize;
             next_base += (1ULL << 32) - RamSize;
         }
-        acpi_build_srat_memory(numamem, mem_base, mem_len, i-1, 1);
+        acpi_build_srat_memory(numamem, mem_base, mem_len, i, 1);
         numamem++;
         slots++;
     }
-    for (; slots < nb_numa_nodes + 2; slots++) {
+    for (; slots < nb_numa_nodes + 1; slots++) {
         acpi_build_srat_memory(numamem, 0, 0, 0, 0);
         numamem++;
     }
-- 
2.7.4




More information about the SeaBIOS mailing list