[syslinux:master] acpi: Adding xsdt
syslinux-bot for Erwan Velu
erwan.velu at free.fr
Sun Feb 6 14:06:43 PST 2011
Commit-ID: 4558b351e2720d91bd2847afb74a28e19d0d0028
Gitweb: http://syslinux.zytor.com/commit/4558b351e2720d91bd2847afb74a28e19d0d0028
Author: Erwan Velu <erwan.velu at free.fr>
AuthorDate: Wed, 2 Dec 2009 14:24:17 +0100
Committer: Erwan Velu <erwan.velu at free.fr>
CommitDate: Fri, 4 Dec 2009 10:19:01 +0100
acpi: Adding xsdt
Impact: Adding XSDT
Adding XSDT
---
com32/gplinclude/acpi/acpi.h | 5 +++-
com32/gplinclude/acpi/{rsdp.h => structs.h} | 28 ++++++++++++------------
com32/gplinclude/acpi/{rsdt.h => xsdt.h} | 10 ++++----
com32/gpllib/acpi/acpi.c | 9 ++++---
com32/gpllib/acpi/rsdp.c | 3 +-
com32/gpllib/acpi/rsdt.c | 21 ++++++++++++------
com32/gpllib/acpi/{rsdt.c => xsdt.c} | 30 ++++++++++++++++++---------
7 files changed, 64 insertions(+), 42 deletions(-)
diff --git a/com32/gplinclude/acpi/acpi.h b/com32/gplinclude/acpi/acpi.h
index 98f1063..a8005d1 100644
--- a/com32/gplinclude/acpi/acpi.h
+++ b/com32/gplinclude/acpi/acpi.h
@@ -18,6 +18,7 @@
#include <acpi/rsdp.h>
#include <acpi/rsdt.h>
#include <acpi/madt.h>
+#include <acpi/xsdt.h>
enum { ACPI_FOUND, ENO_ACPI, MADT_FOUND, ENO_MADT };
@@ -29,6 +30,7 @@ enum { ACPI_FOUND, ENO_ACPI, MADT_FOUND, ENO_MADT };
typedef struct {
s_rsdp rsdp;
s_rsdt rsdt;
+ s_xsdt xsdt;
s_madt madt;
} s_acpi;
@@ -36,6 +38,7 @@ 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);
-uint8_t *get_acpi_description_header(uint8_t *q, s_acpi_description_header * adh);
+void get_acpi_description_header(uint8_t *q, s_acpi_description_header * adh);
#endif
diff --git a/com32/gplinclude/acpi/rsdp.h b/com32/gplinclude/acpi/structs.h
similarity index 66%
copy from com32/gplinclude/acpi/rsdp.h
copy to com32/gplinclude/acpi/structs.h
index df4da2d..b5e1772 100644
--- a/com32/gplinclude/acpi/rsdp.h
+++ b/com32/gplinclude/acpi/structs.h
@@ -10,26 +10,26 @@
*
* ----------------------------------------------------------------------- */
-#ifndef RSDP_H
-#define RSDP_H
+#ifndef ACPI_STRUCTS_H
+#define ACPI_STRUCTS_H
#include <inttypes.h>
#include <stdbool.h>
-#define RSDP_MIN_ADDRESS 0x0E0000
-#define RSDP_MAX_ADDRESS 0x0FFFFF
-enum { RSDP_TABLE_FOUND };
+/* This value define the real size of the acpi structure
+ * Our is bigger as we manage the \0 of strings
+ * */
+#define ACPI_HEADER_SIZE 36
typedef struct {
- uint64_t address;
- uint8_t signature[8 + 1];
+ uint8_t signature[4 + 1];
+ uint32_t length;
+ uint8_t revision;
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;
- bool valid;
-} s_rsdp;
+ 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;
#endif
diff --git a/com32/gplinclude/acpi/rsdt.h b/com32/gplinclude/acpi/xsdt.h
similarity index 89%
copy from com32/gplinclude/acpi/rsdt.h
copy to com32/gplinclude/acpi/xsdt.h
index 1b6850f..7a08dbf 100644
--- a/com32/gplinclude/acpi/rsdt.h
+++ b/com32/gplinclude/acpi/xsdt.h
@@ -10,19 +10,19 @@
*
* ----------------------------------------------------------------------- */
-#ifndef RSDT_H
-#define RSDT_H
+#ifndef XSDT_H
+#define XSDT_H
#include <inttypes.h>
#include <stdbool.h>
-enum { RSDT_TABLE_FOUND };
+enum { XSDT_TABLE_FOUND };
typedef struct {
uint32_t address;
s_acpi_description_header header;
- uint32_t entry[255];
+ uint64_t entry[255];
uint8_t entry_count;
bool valid;
-} s_rsdt;
+} s_xsdt;
#endif
diff --git a/com32/gpllib/acpi/acpi.c b/com32/gpllib/acpi/acpi.c
index b3ef058..707ff3c 100644
--- a/com32/gpllib/acpi/acpi.c
+++ b/com32/gpllib/acpi/acpi.c
@@ -45,14 +45,16 @@ int parse_acpi(s_acpi * acpi)
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)
+ /* Let's seach for RSDT table
+ * That's not a big deal not having it, XSDT is far more relevant */
+ parse_rsdt(acpi);
+ if ((ret_val = parse_xsdt(acpi)) != XSDT_TABLE_FOUND)
return ret_val;
return ACPI_FOUND;
}
-uint8_t *get_acpi_description_header(uint8_t *q, s_acpi_description_header * adh)
+void get_acpi_description_header(uint8_t * q, s_acpi_description_header * adh)
{
cp_str_struct(adh->signature);
cp_struct(&adh->length);
@@ -63,5 +65,4 @@ uint8_t *get_acpi_description_header(uint8_t *q, s_acpi_description_header * adh
cp_struct(&adh->oem_revision);
cp_str_struct(adh->creator_id);
cp_struct(&adh->creator_revision);
- return q;
}
diff --git a/com32/gpllib/acpi/rsdp.c b/com32/gpllib/acpi/rsdp.c
index aa7b9a2..a71a7a2 100644
--- a/com32/gpllib/acpi/rsdp.c
+++ b/com32/gpllib/acpi/rsdp.c
@@ -54,7 +54,8 @@ 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;
+ acpi->rsdt.address = r->rsdt_address;
+ acpi->xsdt.address = r->xsdt_address;
return RSDP_TABLE_FOUND;
}
}
diff --git a/com32/gpllib/acpi/rsdt.c b/com32/gpllib/acpi/rsdt.c
index db2b201..03bc28b 100644
--- a/com32/gpllib/acpi/rsdt.c
+++ b/com32/gpllib/acpi/rsdt.c
@@ -38,15 +38,22 @@ int parse_rsdt(s_acpi * acpi)
uint8_t *q;
/* Let's start for the base address */
- q = (uint64_t *) acpi->rsdt.address;
+ q = (uint32_t *) acpi->rsdt.address;
- /* Searching for MADT with APIC signature */
- if (memcmp(q, "RSDT", 4) == 0) {
- s_rsdt *r = &acpi->rsdt;
- r->valid = true;
- q=get_acpi_description_header(q, &r->header);
- return RSDT_TABLE_FOUND;
+ /* 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);
+
+ uint32_t *p = NULL;
+ for (p = (uint32_t *) (r->address + ACPI_HEADER_SIZE);
+ p < (uint32_t *) (r->address + r->header.length); p++) {
+ r->entry[r->entry_count] = (uint32_t) * p;
+ r->entry_count++;
}
+ return RSDT_TABLE_FOUND;
+ }
return -RSDT_TABLE_FOUND;
}
diff --git a/com32/gpllib/acpi/rsdt.c b/com32/gpllib/acpi/xsdt.c
similarity index 68%
copy from com32/gpllib/acpi/rsdt.c
copy to com32/gpllib/acpi/xsdt.c
index db2b201..f61dbd5 100644
--- a/com32/gpllib/acpi/rsdt.c
+++ b/com32/gpllib/acpi/xsdt.c
@@ -32,21 +32,31 @@
#include <dprintf.h>
#include "acpi/acpi.h"
-int parse_rsdt(s_acpi * acpi)
+int parse_xsdt(s_acpi * acpi)
{
- /* Let's seach for RSDT table */
+ /* Let's seach for XSDT table */
uint8_t *q;
/* Let's start for the base address */
- q = (uint64_t *) acpi->rsdt.address;
+ q = (uint64_t *) acpi->xsdt.address;
- /* Searching for MADT with APIC signature */
- if (memcmp(q, "RSDT", 4) == 0) {
- s_rsdt *r = &acpi->rsdt;
- r->valid = true;
- q=get_acpi_description_header(q, &r->header);
- return RSDT_TABLE_FOUND;
+ /* Searching for MADT with APIC signature */
+ if (memcmp(q, "XSDT", 4) == 0) {
+ s_xsdt *x = &acpi->xsdt;
+ x->valid = true;
+ get_acpi_description_header(q, &x->header);
+
+ 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;
+ x->entry_count++;
}
+ return XSDT_TABLE_FOUND;
+ }
- return -RSDT_TABLE_FOUND;
+ return -XSDT_TABLE_FOUND;
}
More information about the Syslinux-commits
mailing list