[syslinux:master] acpi: Adding FADT

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


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

acpi: Adding FADT

Impact: Adding FADT

Adding FADT


---
 com32/gplinclude/acpi/acpi.h                |    2 ++
 com32/gplinclude/acpi/{xsdt.h => fadt.h}    |   16 +++++++++-------
 com32/{hdt/hdt-ata.c => gpllib/acpi/fadt.c} |   26 +++++++++++++++++---------
 com32/gpllib/acpi/xsdt.c                    |   14 +++++++++++++-
 4 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/com32/gplinclude/acpi/acpi.h b/com32/gplinclude/acpi/acpi.h
index a8005d1..5c8ea6e 100644
--- a/com32/gplinclude/acpi/acpi.h
+++ b/com32/gplinclude/acpi/acpi.h
@@ -19,6 +19,7 @@
 #include <acpi/rsdt.h>
 #include <acpi/madt.h>
 #include <acpi/xsdt.h>
+#include <acpi/fadt.h>
 
 enum { ACPI_FOUND, ENO_ACPI, MADT_FOUND, ENO_MADT };
 
@@ -31,6 +32,7 @@ typedef struct {
     s_rsdp rsdp;
     s_rsdt rsdt;
     s_xsdt xsdt;
+    s_fadt fadt;
     s_madt madt;
 } s_acpi;
 
diff --git a/com32/gplinclude/acpi/xsdt.h b/com32/gplinclude/acpi/fadt.h
similarity index 77%
copy from com32/gplinclude/acpi/xsdt.h
copy to com32/gplinclude/acpi/fadt.h
index 7a08dbf..abc8dd6 100644
--- a/com32/gplinclude/acpi/xsdt.h
+++ b/com32/gplinclude/acpi/fadt.h
@@ -10,19 +10,21 @@
  *
  * ----------------------------------------------------------------------- */
 
-#ifndef XSDT_H
-#define XSDT_H
+#ifndef FADT_H
+#define FADT_H
 #include <inttypes.h>
 #include <stdbool.h>
 
-enum { XSDT_TABLE_FOUND };
+enum { FADT_TABLE_FOUND };
 
 typedef struct {
-    uint32_t address;
+    uint64_t address;
     s_acpi_description_header header;
-    uint64_t entry[255];
-    uint8_t entry_count;
     bool valid;
-} s_xsdt;
+    uint32_t firmware_ctrl;
+    uint32_t dsdt_address;
+    /* To be filled later */
+} s_fadt;
 
+void parse_fadt(s_fadt * fadt);
 #endif
diff --git a/com32/hdt/hdt-ata.c b/com32/gpllib/acpi/fadt.c
similarity index 78%
copy from com32/hdt/hdt-ata.c
copy to com32/gpllib/acpi/fadt.c
index 9ba17ba..54ce311 100644
--- a/com32/hdt/hdt-ata.c
+++ b/com32/gpllib/acpi/fadt.c
@@ -24,15 +24,23 @@
  *   OTHER DEALINGS IN THE SOFTWARE.
  *
  * -----------------------------------------------------------------------
- */
+*/
 
-#include <string.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <console.h>
-#include <disk/geom.h>
-#include <disk/util.h>
+#include <string.h>
+#include <memory.h>
+#include <dprintf.h>
+#include "acpi/acpi.h"
+
+void parse_fadt(s_fadt * f)
+{
+    /* Let's seach for XSDT table */
+    uint8_t *q;
 
-#include "com32io.h"
-#include "hdt-common.h"
-#include "hdt-ata.h"
+    /* Fixing table name */
+    strcpy(f->header.signature,"FADT");
+    /* Let's start for the base address */
+    q = (uint64_t *) (f->address+ACPI_HEADER_SIZE);
+    cp_struct(&f->firmware_ctrl);
+    cp_struct(&f->dsdt_address);
+}
diff --git a/com32/gpllib/acpi/xsdt.c b/com32/gpllib/acpi/xsdt.c
index f61dbd5..5cefd87 100644
--- a/com32/gpllib/acpi/xsdt.c
+++ b/com32/gpllib/acpi/xsdt.c
@@ -46,13 +46,25 @@ int parse_xsdt(s_acpi * acpi)
 	x->valid = true;
 	get_acpi_description_header(q, &x->header);
 
+	/* We now have a set of pointers to some tables */
 	uint64_t *p = NULL;
 	for (p = (uint64_t *) (x->address + ACPI_HEADER_SIZE);
 	     p < (uint64_t *) (x->address + x->header.length); p++) {
 	    s_acpi_description_header adh;
 	    memset(&adh, 0, sizeof(adh));
-	    get_acpi_description_header((uint8_t *) * p, &adh);
 	    x->entry[x->entry_count] = (uint64_t) * p;
+
+	    /* Let's grab the pointed table header */
+	    get_acpi_description_header((uint8_t *) * p, &adh);
+
+	    /* Trying to determine the pointed table */
+	    if (memcmp(adh.signature, "FACP", 4) == 0) {
+		    s_fadt *f = &acpi->fadt;
+		    f->valid=true;
+		    f->address=*p;
+		    memcpy(&f->header,&adh,sizeof(adh));
+		    parse_fadt(f);
+	    }
 	    x->entry_count++;
 	}
 	return XSDT_TABLE_FOUND;



More information about the Syslinux-commits mailing list