[syslinux:master] acpi: Fixing madt detection

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


Commit-ID:  b41c3a43e84f00727d5fbe8b7a2c4e598bc0a3ca
Gitweb:     http://syslinux.zytor.com/commit/b41c3a43e84f00727d5fbe8b7a2c4e598bc0a3ca
Author:     Erwan Velu <erwan.velu at free.fr>
AuthorDate: Wed, 2 Dec 2009 15:40:11 +0100
Committer:  Erwan Velu <erwan.velu at free.fr>
CommitDate: Fri, 4 Dec 2009 10:19:01 +0100

acpi: Fixing madt detection

Impact: Fixing madt detection

Fixing madt detection


---
 com32/gplinclude/acpi/acpi.h |    6 +--
 com32/gplinclude/acpi/madt.h |    1 +
 com32/gplinclude/acpi/rsdt.h |    1 +
 com32/gpllib/acpi/fadt.c     |    5 ++-
 com32/gpllib/acpi/madt.c     |   64 +++++++++++++++--------------------------
 com32/gpllib/acpi/rsdt.c     |    5 +--
 com32/gpllib/acpi/xsdt.c     |    7 ++++
 7 files changed, 40 insertions(+), 49 deletions(-)

diff --git a/com32/gplinclude/acpi/acpi.h b/com32/gplinclude/acpi/acpi.h
index 5c8ea6e..d95976a 100644
--- a/com32/gplinclude/acpi/acpi.h
+++ b/com32/gplinclude/acpi/acpi.h
@@ -37,10 +37,8 @@ typedef struct {
 } 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);
 int parse_xsdt(s_acpi * acpi);
-void print_madt(s_acpi * acpi);
+int parse_madt(s_acpi * acpi);
+int search_rsdp(s_acpi *acpi);
 void 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 324ccd0..c7a63c5 100644
--- a/com32/gplinclude/acpi/madt.h
+++ b/com32/gplinclude/acpi/madt.h
@@ -47,4 +47,5 @@ typedef struct {
     bool valid;
 } s_madt;
 
+void print_madt(s_madt *madt);
 #endif
diff --git a/com32/gplinclude/acpi/rsdt.h b/com32/gplinclude/acpi/rsdt.h
index 1b6850f..7919820 100644
--- a/com32/gplinclude/acpi/rsdt.h
+++ b/com32/gplinclude/acpi/rsdt.h
@@ -25,4 +25,5 @@ typedef struct {
     bool valid;
 } s_rsdt;
 
+int parse_rsdt(s_rsdt * rsdt);
 #endif
diff --git a/com32/gpllib/acpi/fadt.c b/com32/gpllib/acpi/fadt.c
index 54ce311..90fb04b 100644
--- a/com32/gpllib/acpi/fadt.c
+++ b/com32/gpllib/acpi/fadt.c
@@ -34,12 +34,13 @@
 
 void parse_fadt(s_fadt * f)
 {
-    /* Let's seach for XSDT table */
+    /* Let's seach for FADT table */
     uint8_t *q;
 
     /* Fixing table name */
     strcpy(f->header.signature,"FADT");
-    /* Let's start for the base address */
+    
+    /* Copying remaining structs */
     q = (uint64_t *) (f->address+ACPI_HEADER_SIZE);
     cp_struct(&f->firmware_ctrl);
     cp_struct(&f->dsdt_address);
diff --git a/com32/gpllib/acpi/madt.c b/com32/gpllib/acpi/madt.c
index 7f9ed2b..26f32fb 100644
--- a/com32/gpllib/acpi/madt.c
+++ b/com32/gpllib/acpi/madt.c
@@ -71,51 +71,35 @@ static uint8_t *add_apic_structure(s_acpi * acpi, uint8_t * q)
     return q;
 }
 
-int search_madt(s_acpi * acpi)
+int parse_madt(s_acpi *acpi)
 {
-    uint8_t *p, *q;
+    /* Let's seach for FADT table */
+    uint8_t *q;
     s_madt *m = &acpi->madt;
-    
-    //p = (uint64_t *) acpi->base_address;	/* The start address to look at the APIC table */
-/*    for (q = p; q < p + acpi->size; q += 1) {
-	m->address=(uint32_t) q;
-	uint8_t *save = q;
-	if (memcmp(q, "APIC", 4) == 0) {
-	    cp_str_struct(m->signature);
-	    cp_struct(&m->length);
-	    cp_struct(&m->revision);
-	    cp_struct(&m->checksum);
-	    cp_str_struct(m->oem_id);
-	    cp_str_struct(m->oem_table_id);
-	    cp_struct(&m->oem_revision);
-	    cp_str_struct(m->creator_id);
-	    cp_struct(&m->creator_revision);
-	    cp_struct(&m->local_apic_address);
-	    cp_struct(&m->flags);
 
-	    while (q < (save + m->length)) {
-		q = add_apic_structure(acpi, q);
-	    }
-	    m->valid = true;
-	    return MADT_FOUND;
-	}
-    }*/
-    return -ENO_MADT;
+    /* Fixing table name */
+    strcpy(m->header.signature,"MADT");
+
+    /* Copying remaining structs */
+    q = (uint64_t *) (m->address+ACPI_HEADER_SIZE);
+    while (q < (m->address + m->header.length)) {
+	q=add_apic_structure(acpi, q);
+    }
 }
 
-void print_madt(s_acpi * acpi)
+void print_madt(s_madt * madt)
 {
-    if (!acpi->madt.valid)
+    if (!madt->valid)
 	return;
-    printf("MADT Table @ 0x%08x\n",acpi->madt.address);
-    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);
+    printf("MADT Table @ 0x%08x\n",madt->address);
+    printf(" signature      : %s\n", madt->header.signature);
+    printf(" length         : %d\n", madt->header.length);
+    printf(" revision       : %u\n", madt->header.revision);
+    printf(" checksum       : %u\n", madt->header.checksum);
+    printf(" oem id         : %s\n", madt->header.oem_id);
+    printf(" oem table id   : %s\n", madt->header.oem_table_id);
+    printf(" oem revision   : %u\n", madt->header.oem_revision);
+    printf(" oem creator id : %s\n", madt->header.creator_id);
+    printf(" oem creator rev: %u\n", madt->header.creator_revision);
+    printf(" APIC address   : 0x%08x\n", madt->local_apic_address);
 }
diff --git a/com32/gpllib/acpi/rsdt.c b/com32/gpllib/acpi/rsdt.c
index 03bc28b..98ff241 100644
--- a/com32/gpllib/acpi/rsdt.c
+++ b/com32/gpllib/acpi/rsdt.c
@@ -32,17 +32,16 @@
 #include <dprintf.h>
 #include "acpi/acpi.h"
 
-int parse_rsdt(s_acpi * acpi)
+int parse_rsdt(s_rsdt *r)
 {
     /* Let's seach for RSDT table */
     uint8_t *q;
 
     /* Let's start for the base address */
-    q = (uint32_t *) acpi->rsdt.address;
+    q = (uint32_t *) r->address;
 
     /* Searching for MADT with APIC signature */
     if (memcmp(q, "RSDT", 4) == 0) {
-	s_rsdt *r = &acpi->rsdt;
 	r->valid = true;
 	get_acpi_description_header(q, &r->header);
 
diff --git a/com32/gpllib/acpi/xsdt.c b/com32/gpllib/acpi/xsdt.c
index 5cefd87..dc68801 100644
--- a/com32/gpllib/acpi/xsdt.c
+++ b/com32/gpllib/acpi/xsdt.c
@@ -64,6 +64,13 @@ int parse_xsdt(s_acpi * acpi)
 		    f->address=*p;
 		    memcpy(&f->header,&adh,sizeof(adh));
 		    parse_fadt(f);
+	    } else if (memcmp(adh.signature, "APIC", 4) == 0) {
+		    s_madt *m = &acpi->madt;
+		    m->valid=true;
+		    m->address=*p;
+		    memcpy(&m->header,&adh,sizeof(adh));
+		    parse_madt(acpi);
+	    } else {
 	    }
 	    x->entry_count++;
 	}



More information about the Syslinux-commits mailing list