[syslinux:master] acpi: Adding SSDT & PSDT
syslinux-bot for Erwan Velu
erwan.velu at free.fr
Sun Feb 6 14:06:54 PST 2011
Commit-ID: cb32b8d13d9c313527ef20e6df52aab9830ff0d6
Gitweb: http://syslinux.zytor.com/commit/cb32b8d13d9c313527ef20e6df52aab9830ff0d6
Author: Erwan Velu <erwan.velu at free.fr>
AuthorDate: Wed, 2 Dec 2009 16:52:34 +0100
Committer: Erwan Velu <erwan.velu at free.fr>
CommitDate: Fri, 4 Dec 2009 10:19:01 +0100
acpi: Adding SSDT & PSDT
Impact: Adding SSDT & PSDT
Adding SSDT & PSDT
---
com32/gplinclude/acpi/acpi.h | 5 +++++
com32/gplinclude/acpi/{dsdt.h => ssdt.h} | 6 +++---
com32/gpllib/acpi/acpi.c | 2 +-
com32/gpllib/acpi/xsdt.c | 29 ++++++++++++++++++++++++++++-
4 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/com32/gplinclude/acpi/acpi.h b/com32/gplinclude/acpi/acpi.h
index d5c1249..25aacb3 100644
--- a/com32/gplinclude/acpi/acpi.h
+++ b/com32/gplinclude/acpi/acpi.h
@@ -21,9 +21,12 @@
#include <acpi/fadt.h>
#include <acpi/madt.h>
#include <acpi/dsdt.h>
+#include <acpi/ssdt.h>
enum { ACPI_FOUND, ENO_ACPI, MADT_FOUND, ENO_MADT };
+#define MAX_SSDT 128
+
/* This macro are used to extract ACPI structures
* please be careful about the q (interator) naming */
#define cp_struct(dest) memcpy(dest,q,sizeof(*dest)); q+=sizeof(*dest)
@@ -36,6 +39,8 @@ typedef struct {
s_fadt fadt;
s_madt madt;
s_dsdt dsdt;
+ s_ssdt *ssdt[MAX_SSDT];
+ uint8_t ssdt_count;
} s_acpi;
int parse_acpi(s_acpi * acpi);
diff --git a/com32/gplinclude/acpi/dsdt.h b/com32/gplinclude/acpi/ssdt.h
similarity index 94%
copy from com32/gplinclude/acpi/dsdt.h
copy to com32/gplinclude/acpi/ssdt.h
index abcbdf8..0170d39 100644
--- a/com32/gplinclude/acpi/dsdt.h
+++ b/com32/gplinclude/acpi/ssdt.h
@@ -10,8 +10,8 @@
*
* ----------------------------------------------------------------------- */
-#ifndef DSDT_H
-#define DSDT_H
+#ifndef SSDT_H
+#define SSDT_H
#include <inttypes.h>
#include <stdbool.h>
@@ -20,6 +20,6 @@ typedef struct {
s_acpi_description_header header;
uint8_t *definition_block;
bool valid;
-} s_dsdt;
+} s_ssdt;
#endif
diff --git a/com32/gpllib/acpi/acpi.c b/com32/gpllib/acpi/acpi.c
index 707ff3c..c5a76a9 100644
--- a/com32/gpllib/acpi/acpi.c
+++ b/com32/gpllib/acpi/acpi.c
@@ -47,7 +47,7 @@ int parse_acpi(s_acpi * acpi)
/* Let's seach for RSDT table
* That's not a big deal not having it, XSDT is far more relevant */
- parse_rsdt(acpi);
+ parse_rsdt(&acpi->rsdt);
if ((ret_val = parse_xsdt(acpi)) != XSDT_TABLE_FOUND)
return ret_val;
diff --git a/com32/gpllib/acpi/xsdt.c b/com32/gpllib/acpi/xsdt.c
index c75fd56..a1ecb55 100644
--- a/com32/gpllib/acpi/xsdt.c
+++ b/com32/gpllib/acpi/xsdt.c
@@ -60,26 +60,53 @@ int parse_xsdt(s_acpi * acpi)
/* Trying to determine the pointed table */
if (memcmp(adh.signature, "FACP", 4) == 0) {
s_fadt *f = &acpi->fadt;
+ /* This structure is valid, let's fill it */
f->valid=true;
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;
+ /* This structure is valid, let's fill it */
m->valid=true;
m->address=*p;
memcpy(&m->header,&adh,sizeof(adh));
parse_madt(acpi);
} else if (memcmp(adh.signature, "DSDT", 4) == 0) {
s_dsdt *d = &acpi->dsdt;
- uint32_t definition_block_size=adh.length-ACPI_HEADER_SIZE;
+
+ /* This structure is valid, let's fill it */
d->valid=true;
d->address=*p;
memcpy(&d->header,&adh,sizeof(adh));
+
+ /* Searching how much definition blocks we must copy */
+ uint32_t definition_block_size=adh.length-ACPI_HEADER_SIZE;
if ((d->definition_block=malloc(definition_block_size)) != NULL) {
memcpy(d->definition_block,(uint64_t *)(d->address+ACPI_HEADER_SIZE),definition_block_size);
}
+ /* PSDT have to be considered as SSDT. Intel ACPI Spec @ 5.2.11.3 */
+ } else if ((memcmp(adh.signature, "SSDT", 4) == 0) || (memcmp(adh.signature, "PSDT", 4))) {
+ if ((acpi->ssdt_count >= MAX_SSDT-1)) break;
+
+ /* We can have many SSDT, so let's allocate a new one */
+ if ((acpi->ssdt[acpi->ssdt_count]=malloc(sizeof(s_ssdt))) == NULL) break;
+ s_ssdt *s = acpi->ssdt[acpi->ssdt_count];
+
+ /* This structure is valid, let's fill it */
+ s->valid=true;
+ s->address=*p;
+ memcpy(&s->header,&adh,sizeof(adh));
+
+ /* Searching how much definition blocks we must copy */
+ uint32_t definition_block_size=adh.length-ACPI_HEADER_SIZE;
+ if ((s->definition_block=malloc(definition_block_size)) != NULL) {
+ memcpy(s->definition_block,(uint64_t *)(s->address+ACPI_HEADER_SIZE),definition_block_size);
+ }
+ /* Increment the number of ssdt we have */
+ acpi->ssdt_count++;
}
+
x->entry_count++;
}
return XSDT_TABLE_FOUND;
More information about the Syslinux-commits
mailing list