[syslinux:master] acpi: Adding rsdt, cleaning structures

syslinux-bot for Erwan Velu erwan.velu at free.fr
Sun Feb 6 14:06:38 PST 2011


Commit-ID:  1e26ac19c45916b231507f28397d19582e80270b
Gitweb:     http://syslinux.zytor.com/commit/1e26ac19c45916b231507f28397d19582e80270b
Author:     Erwan Velu <erwan.velu at free.fr>
AuthorDate: Wed, 2 Dec 2009 13:04:12 +0100
Committer:  Erwan Velu <erwan.velu at free.fr>
CommitDate: Fri, 4 Dec 2009 10:19:00 +0100

acpi: Adding rsdt, cleaning structures

Impact: adding rsdt

Adding RSDT


---
 com32/gplinclude/acpi/acpi.h             |    5 +++++
 com32/gplinclude/acpi/madt.h             |   11 ++---------
 com32/gplinclude/acpi/{rsdp.h => rsdt.h} |   23 ++++++++---------------
 com32/gpllib/acpi/acpi.c                 |   20 +++++++++++++++++++-
 com32/gpllib/acpi/madt.c                 |   18 +++++++++---------
 com32/gpllib/acpi/rsdp.c                 |    1 +
 6 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/com32/gplinclude/acpi/acpi.h b/com32/gplinclude/acpi/acpi.h
index 4a83fbd..98f1063 100644
--- a/com32/gplinclude/acpi/acpi.h
+++ b/com32/gplinclude/acpi/acpi.h
@@ -14,7 +14,9 @@
 #define ACPI_H
 #include <inttypes.h>
 #include <stdbool.h>
+#include <acpi/structs.h>
 #include <acpi/rsdp.h>
+#include <acpi/rsdt.h>
 #include <acpi/madt.h>
 
 enum { ACPI_FOUND, ENO_ACPI, MADT_FOUND, ENO_MADT };
@@ -26,11 +28,14 @@ enum { ACPI_FOUND, ENO_ACPI, MADT_FOUND, ENO_MADT };
 
 typedef struct {
     s_rsdp rsdp;
+    s_rsdt rsdt;
     s_madt madt;
 } s_acpi;
 
 int parse_acpi(s_acpi * acpi);
 int search_madt(s_acpi * acpi);
 int search_rsdp(s_acpi * acpi);
+int parse_rsdt(s_acpi * acpi);
 void print_madt(s_acpi * acpi);
+uint8_t *get_acpi_description_header(uint8_t *q, s_acpi_description_header * adh);
 #endif
diff --git a/com32/gplinclude/acpi/madt.h b/com32/gplinclude/acpi/madt.h
index cb623a4..324ccd0 100644
--- a/com32/gplinclude/acpi/madt.h
+++ b/com32/gplinclude/acpi/madt.h
@@ -14,6 +14,7 @@
 #define MADT_H
 #include <inttypes.h>
 #include <stdbool.h>
+#include <acpi/acpi.h>
 
 enum {
     PROCESSOR_LOCAL_APIC = 0,
@@ -38,15 +39,7 @@ typedef struct {
 
 typedef struct {
     uint32_t address;
-    uint8_t signature[4 + 1];
-    uint32_t length;
-    uint8_t revision;
-    uint8_t checksum;
-    uint8_t oem_id[6 + 1];
-    uint8_t oem_table_id[8 + 1];
-    uint32_t oem_revision;
-    uint8_t creator_id[4 + 1];
-    uint32_t creator_revision;
+    s_acpi_description_header header;
     uint32_t local_apic_address;
     uint32_t flags;
     s_processor_local_apic processor_local_apic[MAX_SLP];
diff --git a/com32/gplinclude/acpi/rsdp.h b/com32/gplinclude/acpi/rsdt.h
similarity index 64%
copy from com32/gplinclude/acpi/rsdp.h
copy to com32/gplinclude/acpi/rsdt.h
index df4da2d..1b6850f 100644
--- a/com32/gplinclude/acpi/rsdp.h
+++ b/com32/gplinclude/acpi/rsdt.h
@@ -10,26 +10,19 @@
  *
  * ----------------------------------------------------------------------- */
 
-#ifndef RSDP_H
-#define RSDP_H
+#ifndef RSDT_H
+#define RSDT_H
 #include <inttypes.h>
 #include <stdbool.h>
 
-#define RSDP_MIN_ADDRESS 0x0E0000
-#define RSDP_MAX_ADDRESS 0x0FFFFF
-enum { RSDP_TABLE_FOUND };
+enum { RSDT_TABLE_FOUND };
 
 typedef struct {
-    uint64_t address;
-    uint8_t signature[8 + 1];
-    uint8_t checksum;
-    uint8_t oem_id[6 + 1];
-    uint8_t revision;
-    uint32_t rsdt_address;
-    uint32_t length;
-    uint32_t xsdt_address;
-    uint8_t extended_checksum;
+    uint32_t address;
+    s_acpi_description_header header;
+    uint32_t entry[255];
+    uint8_t entry_count;
     bool valid;
-} s_rsdp;
+} s_rsdt;
 
 #endif
diff --git a/com32/gpllib/acpi/acpi.c b/com32/gpllib/acpi/acpi.c
index e9298fd..b3ef058 100644
--- a/com32/gpllib/acpi/acpi.c
+++ b/com32/gpllib/acpi/acpi.c
@@ -41,9 +41,27 @@ int parse_acpi(s_acpi * acpi)
     int ret_val;
     init_acpi(acpi);
 
-    /* Let's seach for RSDT table */
+    /* Let's seach for RSDP table */
     if ((ret_val = search_rsdp(acpi)) != RSDP_TABLE_FOUND)
 	return ret_val;
 
+    /* Let's seach for RSDT table */
+    if ((ret_val = parse_rsdt(acpi)) != RSDT_TABLE_FOUND)
+	return ret_val;
+
     return ACPI_FOUND;
 }
+
+uint8_t *get_acpi_description_header(uint8_t *q, s_acpi_description_header * adh)
+{
+    cp_str_struct(adh->signature);
+    cp_struct(&adh->length);
+    cp_struct(&adh->revision);
+    cp_struct(&adh->checksum);
+    cp_str_struct(adh->oem_id);
+    cp_str_struct(adh->oem_table_id);
+    cp_struct(&adh->oem_revision);
+    cp_str_struct(adh->creator_id);
+    cp_struct(&adh->creator_revision);
+    return q;
+}
diff --git a/com32/gpllib/acpi/madt.c b/com32/gpllib/acpi/madt.c
index 6e8a038..7f9ed2b 100644
--- a/com32/gpllib/acpi/madt.c
+++ b/com32/gpllib/acpi/madt.c
@@ -108,14 +108,14 @@ void print_madt(s_acpi * acpi)
     if (!acpi->madt.valid)
 	return;
     printf("MADT Table @ 0x%08x\n",acpi->madt.address);
-    printf(" signature      : %s\n", acpi->madt.signature);
-    printf(" length         : %d\n", acpi->madt.length);
-    printf(" revision       : %u\n", acpi->madt.revision);
-    printf(" checksum       : %u\n", acpi->madt.checksum);
-    printf(" oem id         : %s\n", acpi->madt.oem_id);
-    printf(" oem table id   : %s\n", acpi->madt.oem_table_id);
-    printf(" oem revision   : %u\n", acpi->madt.oem_revision);
-    printf(" oem creator id : %s\n", acpi->madt.creator_id);
-    printf(" oem creator rev: %u\n", acpi->madt.creator_revision);
+    printf(" signature      : %s\n", acpi->madt.header.signature);
+    printf(" length         : %d\n", acpi->madt.header.length);
+    printf(" revision       : %u\n", acpi->madt.header.revision);
+    printf(" checksum       : %u\n", acpi->madt.header.checksum);
+    printf(" oem id         : %s\n", acpi->madt.header.oem_id);
+    printf(" oem table id   : %s\n", acpi->madt.header.oem_table_id);
+    printf(" oem revision   : %u\n", acpi->madt.header.oem_revision);
+    printf(" oem creator id : %s\n", acpi->madt.header.creator_id);
+    printf(" oem creator rev: %u\n", acpi->madt.header.creator_revision);
     printf(" APIC address   : 0x%08x\n", acpi->madt.local_apic_address);
 }
diff --git a/com32/gpllib/acpi/rsdp.c b/com32/gpllib/acpi/rsdp.c
index 66f258b..aa7b9a2 100644
--- a/com32/gpllib/acpi/rsdp.c
+++ b/com32/gpllib/acpi/rsdp.c
@@ -54,6 +54,7 @@ int search_rsdp(s_acpi * acpi)
 	    cp_struct(&r->xsdt_address);
 	    cp_struct(&r->extended_checksum);
 	    q += 3;		/* reserved field */
+	    acpi->rsdt.address=r->rsdt_address;
 	    return RSDP_TABLE_FOUND;
 	}
     }



More information about the Syslinux-commits mailing list