Archives par étiquette : seabios

Patch SLIC pour Seabios.

Yop!

Petit patch pour rajouter une injection direct d’un dump de table SLIC dans la table acpi de la machine virtuelle sans modifier kvm/qemu.
Ça copie aussi oem_id et oem_table_id de la table SLIC dans la table RSDT.

Voici le diff.

--- acpi.c.orig	2011-12-24 18:03:11.346256959 +0100
+++ acpi.c	2011-12-24 17:58:07.368750605 +0100
@@ -628,6 +628,11 @@

     u16 i, external_tables = qemu_cfg_acpi_additional_tables();

+    #define SLIC_SIGNATURE 0x43494C53 // SLIC
+    #define HACK_SLIC_SIGNATURE 0x43314C35 // HACK SLIC
+    struct acpi_table_header *slic;
+    slic = 0;
+
     for(i = 0; i < external_tables; i++) {
         u16 len = qemu_cfg_next_acpi_table_len();
         void *addr = malloc_high(len);
@@ -635,7 +640,13 @@
             warn_noalloc();
             continue;
         }
-        ACPI_INIT_TABLE(qemu_cfg_next_acpi_table_load(addr, len));
+        struct acpi_table_header *acpi_ext_table;
+        acpi_ext_table = qemu_cfg_next_acpi_table_load(addr, len);
+        if (acpi_ext_table->signature == HACK_SLIC_SIGNATURE) {
+                acpi_ext_table = acpi_ext_table+1;
+                slic = acpi_ext_table;
+        }
+        ACPI_INIT_TABLE(acpi_ext_table);
         if (tbl_idx == MAX_ACPI_TABLES) {
             warn_noalloc();
             break;
@@ -653,7 +664,19 @@
     memset(rsdt, 0, rsdt_len);
     memcpy(rsdt->table_offset_entry, tables, sizeof(u32) * tbl_idx);

-    build_header((void*)rsdt, RSDT_SIGNATURE, rsdt_len, 1);
+    if (slic->signature == SLIC_SIGNATURE){
+        rsdt->signature = RSDT_SIGNATURE;
+        rsdt->length = cpu_to_le32(rsdt_len);
+        rsdt->revision = 1;
+        memcpy(rsdt->oem_id, slic->oem_id, 6);
+        memcpy(rsdt->oem_table_id, slic->oem_table_id, 8);
+        memcpy(rsdt->asl_compiler_id, CONFIG_APPNAME4, 4);
+        rsdt->oem_revision = cpu_to_le32(1);
+        rsdt->asl_compiler_revision = cpu_to_le32(1);
+        rsdt->checksum -= checksum(rsdt, rsdt_len);
+    } else {
+        build_header((void*)rsdt, RSDT_SIGNATURE, rsdt_len, 1);
+    }

     // Build rsdp pointer table
     memset(rsdp, 0, sizeof(*rsdp));

acpi_slic.patch bios.bin


Merci, pour les commentaires.