summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2011-01-25 22:15:01 +0100
committerErwan Velu <erwanaliasr1@gmail.com>2011-01-25 22:15:01 +0100
commit37d0e16d87fb520921f7465dc11d2726f6d6f163 (patch)
treecc61fba76eec3186085f3bf05b7f02b89931f33a
parentfa047d0130b92c5088e186add7db57e94bab0371 (diff)
downloadsyslinux-37d0e16d87fb520921f7465dc11d2726f6d6f163.tar.gz
ACPI: Adding DEBUG_PRINT
Adding a function to debug & print for ACPI.
-rw-r--r--com32/gplinclude/acpi/acpi.h6
-rw-r--r--com32/gpllib/acpi/acpi.c8
-rw-r--r--com32/gpllib/acpi/rsdt.c1
-rw-r--r--com32/gpllib/acpi/xsdt.c10
4 files changed, 25 insertions, 0 deletions
diff --git a/com32/gplinclude/acpi/acpi.h b/com32/gplinclude/acpi/acpi.h
index 664306b8..ed1bf9b2 100644
--- a/com32/gplinclude/acpi/acpi.h
+++ b/com32/gplinclude/acpi/acpi.h
@@ -12,6 +12,12 @@
#ifndef ACPI_H
#define ACPI_H
+
+#define DEBUG_ACPI 0
+
+void dbg_printf(const char *fmt, ...);
+#define DEBUG_PRINT(x) do { if (DEBUG_ACPI) dbg_printf x; } while (0)
+
#include <inttypes.h>
#include <stdbool.h>
#include <acpi/structs.h>
diff --git a/com32/gpllib/acpi/acpi.c b/com32/gpllib/acpi/acpi.c
index c5a76a9e..2f8f7dad 100644
--- a/com32/gpllib/acpi/acpi.c
+++ b/com32/gpllib/acpi/acpi.c
@@ -31,6 +31,14 @@
#include <memory.h>
#include "acpi/acpi.h"
+void dbg_printf(const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
+
void init_acpi(s_acpi * acpi)
{
memset(acpi, 0, sizeof(s_acpi));
diff --git a/com32/gpllib/acpi/rsdt.c b/com32/gpllib/acpi/rsdt.c
index 53398b24..53917993 100644
--- a/com32/gpllib/acpi/rsdt.c
+++ b/com32/gpllib/acpi/rsdt.c
@@ -42,6 +42,7 @@ int parse_rsdt(s_rsdt *r)
/* Searching for MADT with APIC signature */
if (memcmp(q, RSDT, sizeof(RSDT)-1) == 0) {
+ DEBUG_PRINT(("RSDT table found\n"));
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 3e1b5abe..698874ab 100644
--- a/com32/gpllib/acpi/xsdt.c
+++ b/com32/gpllib/acpi/xsdt.c
@@ -42,6 +42,7 @@ int parse_xsdt(s_acpi * acpi)
/* Searching for MADT with APIC signature */
if (memcmp(q, XSDT, sizeof(XSDT) - 1) == 0) {
+ DEBUG_PRINT(("XSDT table found\n"));
s_xsdt *x = &acpi->xsdt;
x->valid = true;
get_acpi_description_header(q, &x->header);
@@ -60,6 +61,7 @@ int parse_xsdt(s_acpi * acpi)
/* Trying to determine the pointed table */
/* Looking for FADT */
if (memcmp(adh.signature, FACP, sizeof(FACP) - 1) == 0) {
+ DEBUG_PRINT(("FACP table found\n"));
s_fadt *f = &acpi->fadt;
s_facs *fa = &acpi->facs;
s_dsdt *d = &acpi->dsdt;
@@ -88,6 +90,7 @@ int parse_xsdt(s_acpi * acpi)
get_acpi_description_header(f->x_dsdt,
&new_adh);
if (memcmp(new_adh.signature, DSDT, sizeof(DSDT) - 1) == 0) {
+ DEBUG_PRINT(("DSDT table found\n"));
d->valid = true;
d->address = f->x_dsdt;
memcpy(&d->header, &new_adh, sizeof(new_adh));
@@ -107,6 +110,7 @@ int parse_xsdt(s_acpi * acpi)
}
} /* Looking for MADT */
else if (memcmp(adh.signature, APIC, sizeof(APIC) - 1) == 0) {
+ DEBUG_PRINT(("MADT table found\n"));
s_madt *m = &acpi->madt;
/* This structure is valid, let's fill it */
m->valid = true;
@@ -114,6 +118,7 @@ int parse_xsdt(s_acpi * acpi)
memcpy(&m->header, &adh, sizeof(adh));
parse_madt(acpi);
} else if (memcmp(adh.signature, DSDT, sizeof(DSDT) - 1) == 0) {
+ DEBUG_PRINT(("DSDT table found\n"));
s_dsdt *d = &acpi->dsdt;
/* This structure is valid, let's fill it */
d->valid = true;
@@ -123,6 +128,9 @@ int parse_xsdt(s_acpi * acpi)
/* PSDT have to be considered as SSDT. Intel ACPI Spec @ 5.2.11.3 */
} else if ((memcmp(adh.signature, SSDT, sizeof(SSDT) - 1) == 0)
|| (memcmp(adh.signature, PSDT, sizeof(PSDT) - 1) == 0)) {
+
+ DEBUG_PRINT(("SSDT table found with %s \n",adh.signature));
+
if ((acpi->ssdt_count >= MAX_SSDT - 1))
break;
@@ -148,6 +156,7 @@ int parse_xsdt(s_acpi * acpi)
/* Increment the number of ssdt we have */
acpi->ssdt_count++;
} else if (memcmp(adh.signature, SBST, sizeof(SBST) - 1) == 0) {
+ DEBUG_PRINT(("SBST table found\n"));
s_sbst *s = &acpi->sbst;
/* This structure is valid, let's fill it */
s->valid = true;
@@ -155,6 +164,7 @@ int parse_xsdt(s_acpi * acpi)
memcpy(&s->header, &adh, sizeof(adh));
parse_sbst(s);
} else if (memcmp(adh.signature, ECDT, sizeof(ECDT) - 1) == 0) {
+ DEBUG_PRINT(("ECDT table found\n"));
s_ecdt *e = &acpi->ecdt;
/* This structure is valid, let's fill it */
e->valid = true;