[syslinux:master] acpi: Adding MADT address

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


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

acpi: Adding MADT address

Impact:

Adding MADT address in structure


---
 com32/gplinclude/acpi/madt.h |    1 +
 com32/gpllib/acpi/madt.c     |   21 ++++++++++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/com32/gplinclude/acpi/madt.h b/com32/gplinclude/acpi/madt.h
index 30969f2..10e0d42 100644
--- a/com32/gplinclude/acpi/madt.h
+++ b/com32/gplinclude/acpi/madt.h
@@ -37,6 +37,7 @@ typedef struct {
 } s_processor_local_apic;
 
 typedef struct {
+    uint32_t address;
     uint8_t signature[4 + 1];
     uint32_t length;
     uint8_t revision;
diff --git a/com32/gpllib/acpi/madt.c b/com32/gpllib/acpi/madt.c
index 830a89d..518c541 100644
--- a/com32/gpllib/acpi/madt.c
+++ b/com32/gpllib/acpi/madt.c
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <memory.h>
+#include <dprintf.h>
 #include "acpi/acpi.h"
 
 static void print_local_apic_structure(s_processor_local_apic * sla,
@@ -46,11 +47,10 @@ static uint8_t *add_apic_structure(s_acpi * acpi, uint8_t * q)
     uint8_t length = *q;
     q++;
     s_processor_local_apic *sla;
+    s_madt *madt = &acpi->madt;
     switch (type) {
     case PROCESSOR_LOCAL_APIC:
-	sla =
-	    &acpi->madt.processor_local_apic[acpi->madt.
-					     processor_local_apic_count];
+	sla=&madt->processor_local_apic[madt->processor_local_apic_count];
 	sla->length = length;
 	sla->acpi_id = *q;
 	q++;
@@ -58,11 +58,13 @@ static uint8_t *add_apic_structure(s_acpi * acpi, uint8_t * q)
 	q++;
 	memcpy(&sla->flags, q, 4);
 	q += 4;
-	print_local_apic_structure(sla, acpi->madt.processor_local_apic_count);
-	acpi->madt.processor_local_apic_count++;
+#ifdef DEBUG 
+	print_local_apic_structure(sla, madt->processor_local_apic_count);
+#endif
+	madt->processor_local_apic_count++;
 	break;
     default:
-	printf("APIC structure type %u, size=%u \n", type, length);
+	dprintf("APIC structure type %u, size=%u \n", type, length);
 	q += length - 2;
 	break;
     }
@@ -74,15 +76,16 @@ static uint8_t *add_apic_structure(s_acpi * acpi, uint8_t * q)
 int search_madt(s_acpi * acpi)
 {
     uint8_t *p, *q;
+    s_madt *m = &acpi->madt;
     if (!acpi->acpi_valid)
 	return -ENO_ACPI;
 
-    p = (uint8_t *) acpi->base_address;	/* The start address to look at the APIC table */
+    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;
 	/* Searching for MADT with APIC signature */
 	if (memcmp(q, "APIC", 4) == 0) {
-	    s_madt *m = &acpi->madt;
 	    cp_str_struct(m->signature, 4);
 	    cp_struct(&m->length, 4);
 	    cp_struct(&m->revision, 1);
@@ -110,7 +113,7 @@ void print_madt(s_acpi * acpi)
 {
     if (!acpi->madt_valid)
 	return;
-    printf("MADT Table\n");
+    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);



More information about the Syslinux-commits mailing list