aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2011-01-25 20:38:39 +0100
committerErwan Velu <erwanaliasr1@gmail.com>2011-01-25 20:38:39 +0100
commit2cb593ae927a80e856a255c9e484d16038033f62 (patch)
tree5e51ec84d466eb64c81a1ad7d646d86195d12364
parenta2e75985f250d0c6869e4b65f437c3483236c887 (diff)
downloadsyslinux-2cb593ae927a80e856a255c9e484d16038033f62.tar.gz
syslinux-2cb593ae927a80e856a255c9e484d16038033f62.tar.xz
syslinux-2cb593ae927a80e856a255c9e484d16038033f62.zip
ACPI: On the road to cleaning ;)
-rw-r--r--com32/gplinclude/acpi/dsdt.h2
-rw-r--r--com32/gplinclude/acpi/ecdt.h2
-rw-r--r--com32/gplinclude/acpi/facs.h2
-rw-r--r--com32/gplinclude/acpi/fadt.h10
-rw-r--r--com32/gplinclude/acpi/madt.h2
-rw-r--r--com32/gplinclude/acpi/rsdp.h6
-rw-r--r--com32/gplinclude/acpi/rsdt.h4
-rw-r--r--com32/gplinclude/acpi/sbst.h2
-rw-r--r--com32/gplinclude/acpi/ssdt.h2
-rw-r--r--com32/gplinclude/acpi/xsdt.h4
-rw-r--r--com32/gpllib/acpi/dsdt.c4
-rw-r--r--com32/gpllib/acpi/ecdt.c3
-rw-r--r--com32/gpllib/acpi/facs.c2
-rw-r--r--com32/gpllib/acpi/fadt.c2
-rw-r--r--com32/gpllib/acpi/madt.c3
-rw-r--r--com32/gpllib/acpi/rsdp.c13
-rw-r--r--com32/gpllib/acpi/rsdt.c10
-rw-r--r--com32/gpllib/acpi/sbst.c2
-rw-r--r--com32/gpllib/acpi/xsdt.c30
-rw-r--r--com32/hdt/hdt-cli-acpi.c25
20 files changed, 61 insertions, 69 deletions
diff --git a/com32/gplinclude/acpi/dsdt.h b/com32/gplinclude/acpi/dsdt.h
index fcb6280d..a90b5ad9 100644
--- a/com32/gplinclude/acpi/dsdt.h
+++ b/com32/gplinclude/acpi/dsdt.h
@@ -18,7 +18,7 @@
#define DSDT "DSDT"
typedef struct {
- uint64_t address;
+ uint8_t *address;
s_acpi_description_header header;
uint8_t *definition_block;
bool valid;
diff --git a/com32/gplinclude/acpi/ecdt.h b/com32/gplinclude/acpi/ecdt.h
index 0f8f3ca4..e2a486a0 100644
--- a/com32/gplinclude/acpi/ecdt.h
+++ b/com32/gplinclude/acpi/ecdt.h
@@ -21,7 +21,7 @@
#define EC_ID_OFFSET 65
typedef struct {
- uint64_t address;
+ uint8_t *address;
s_acpi_description_header header;
bool valid;
uint32_t warning_energy_level;
diff --git a/com32/gplinclude/acpi/facs.h b/com32/gplinclude/acpi/facs.h
index 4435eab4..0601f1f0 100644
--- a/com32/gplinclude/acpi/facs.h
+++ b/com32/gplinclude/acpi/facs.h
@@ -25,7 +25,7 @@
#define OWNED 1<<1
typedef struct {
- uint64_t address;
+ uint8_t *address;
uint8_t signature[4+1];
uint8_t length;
uint32_t hardware_signature;
diff --git a/com32/gplinclude/acpi/fadt.h b/com32/gplinclude/acpi/fadt.h
index 16ee0fa4..e71f2554 100644
--- a/com32/gplinclude/acpi/fadt.h
+++ b/com32/gplinclude/acpi/fadt.h
@@ -61,11 +61,11 @@ enum { PM_UNSPECIFIED = 0,
#define FORCE_APIC_PHYSICAL_DESTINATION_MODE 1<<19
typedef struct {
- uint64_t address;
+ uint8_t *address;
s_acpi_description_header header;
bool valid;
- uint32_t firmware_ctrl;
- uint32_t dsdt_address;
+ uint8_t *firmware_ctrl;
+ uint8_t *dsdt_address;
uint8_t reserved;
uint8_t prefered_pm_profile;
uint16_t sci_int;
@@ -105,8 +105,8 @@ typedef struct {
s_gas reset_reg;
uint8_t reset_value;
uint8_t reserved_3[3];
- uint64_t x_firmware_ctrl;
- uint64_t x_dsdt;
+ uint8_t *x_firmware_ctrl;
+ uint8_t *x_dsdt;
s_gas x_pm1a_evt_blk;
s_gas x_pm1b_evt_blk;
s_gas x_pm1a_cnt_blk;
diff --git a/com32/gplinclude/acpi/madt.h b/com32/gplinclude/acpi/madt.h
index d918a2fa..39c25a70 100644
--- a/com32/gplinclude/acpi/madt.h
+++ b/com32/gplinclude/acpi/madt.h
@@ -129,7 +129,7 @@ typedef struct {
} __attribute__ ((packed)) s_local_sapic;
typedef struct {
- uint64_t address;
+ uint8_t *address;
s_acpi_description_header header;
uint32_t local_apic_address;
uint32_t flags;
diff --git a/com32/gplinclude/acpi/rsdp.h b/com32/gplinclude/acpi/rsdp.h
index 1d8126c1..ea6804f2 100644
--- a/com32/gplinclude/acpi/rsdp.h
+++ b/com32/gplinclude/acpi/rsdp.h
@@ -23,14 +23,14 @@
enum { RSDP_TABLE_FOUND };
typedef struct {
- uint64_t address;
+ uint8_t *address;
uint8_t signature[8 + 1];
uint8_t checksum;
uint8_t oem_id[6 + 1];
uint8_t revision;
- uint32_t rsdt_address;
+ uint8_t *rsdt_address;
uint32_t length;
- uint32_t xsdt_address;
+ uint8_t *xsdt_address;
uint8_t extended_checksum;
bool valid;
} s_rsdp;
diff --git a/com32/gplinclude/acpi/rsdt.h b/com32/gplinclude/acpi/rsdt.h
index c3c198c9..2c9b9e44 100644
--- a/com32/gplinclude/acpi/rsdt.h
+++ b/com32/gplinclude/acpi/rsdt.h
@@ -20,9 +20,9 @@ enum { RSDT_TABLE_FOUND };
#define RSDT "RSDT"
typedef struct {
- uint32_t address;
+ uint8_t *address;
s_acpi_description_header header;
- uint32_t entry[255];
+ uint8_t *entry[255];
uint8_t entry_count;
bool valid;
} s_rsdt;
diff --git a/com32/gplinclude/acpi/sbst.h b/com32/gplinclude/acpi/sbst.h
index 6e3aa104..4ae785b6 100644
--- a/com32/gplinclude/acpi/sbst.h
+++ b/com32/gplinclude/acpi/sbst.h
@@ -18,7 +18,7 @@
#define SBST "SBST"
typedef struct {
- uint64_t address;
+ uint8_t *address;
s_acpi_description_header header;
bool valid;
uint32_t warning_energy_level;
diff --git a/com32/gplinclude/acpi/ssdt.h b/com32/gplinclude/acpi/ssdt.h
index 1ace3661..93eb020e 100644
--- a/com32/gplinclude/acpi/ssdt.h
+++ b/com32/gplinclude/acpi/ssdt.h
@@ -19,7 +19,7 @@
#define PSDT "PSDT"
typedef struct {
- uint64_t address;
+ uint8_t *address;
s_acpi_description_header header;
uint8_t *definition_block;
bool valid;
diff --git a/com32/gplinclude/acpi/xsdt.h b/com32/gplinclude/acpi/xsdt.h
index a87e2a05..4d4ca0c9 100644
--- a/com32/gplinclude/acpi/xsdt.h
+++ b/com32/gplinclude/acpi/xsdt.h
@@ -20,9 +20,9 @@ enum { XSDT_TABLE_FOUND };
#define XSDT "XSDT"
typedef struct {
- uint32_t address;
+ uint8_t *address;
s_acpi_description_header header;
- uint64_t entry[255];
+ uint8_t *entry[255];
uint8_t entry_count;
bool valid;
} s_xsdt;
diff --git a/com32/gpllib/acpi/dsdt.c b/com32/gpllib/acpi/dsdt.c
index fbc1e2a5..71174223 100644
--- a/com32/gpllib/acpi/dsdt.c
+++ b/com32/gpllib/acpi/dsdt.c
@@ -36,12 +36,12 @@
void parse_dsdt(s_dsdt * d)
{
uint8_t *q;
- q = (uint64_t *) (d->address+ACPI_HEADER_SIZE);
+ q = (d->address+ACPI_HEADER_SIZE);
/* Searching how much definition blocks we must copy */
uint32_t definition_block_size=d->header.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);
+ memcpy(d->definition_block,(d->address+ACPI_HEADER_SIZE),definition_block_size);
}
}
diff --git a/com32/gpllib/acpi/ecdt.c b/com32/gpllib/acpi/ecdt.c
index 5cbdd604..41f92e35 100644
--- a/com32/gpllib/acpi/ecdt.c
+++ b/com32/gpllib/acpi/ecdt.c
@@ -29,13 +29,14 @@
#include <stdio.h>
#include <string.h>
#include <memory.h>
+#include <stdlib.h>
#include <dprintf.h>
#include "acpi/acpi.h"
void parse_ecdt(s_ecdt * e)
{
uint8_t *q;
- q = (uint64_t *) (e->address + ACPI_HEADER_SIZE);
+ q = (e->address + ACPI_HEADER_SIZE);
/* Copying remaining structs */
cp_struct(&e->ec_control);
diff --git a/com32/gpllib/acpi/facs.c b/com32/gpllib/acpi/facs.c
index 0fc0b6bd..3cb5637f 100644
--- a/com32/gpllib/acpi/facs.c
+++ b/com32/gpllib/acpi/facs.c
@@ -35,7 +35,7 @@
void parse_facs(s_facs * f)
{
uint8_t *q;
- q = (uint64_t *) (f->address + ACPI_HEADER_SIZE);
+ q = (f->address + ACPI_HEADER_SIZE);
if (memcmp(q, FACS, sizeof(FACS) - 1) == 0) {
f->valid = true;
cp_str_struct(f->signature);
diff --git a/com32/gpllib/acpi/fadt.c b/com32/gpllib/acpi/fadt.c
index 935d208d..fafc524c 100644
--- a/com32/gpllib/acpi/fadt.c
+++ b/com32/gpllib/acpi/fadt.c
@@ -41,7 +41,7 @@ void parse_fadt(s_fadt * f)
memcpy(f->header.signature,FADT,sizeof(FADT));
/* Copying remaining structs */
- q = (uint64_t *) (f->address+ACPI_HEADER_SIZE);
+ q = (f->address+ACPI_HEADER_SIZE);
cp_struct(&f->firmware_ctrl);
cp_struct(&f->dsdt_address);
cp_struct(&f->reserved);
diff --git a/com32/gpllib/acpi/madt.c b/com32/gpllib/acpi/madt.c
index c3b7ec5d..fa5772a4 100644
--- a/com32/gpllib/acpi/madt.c
+++ b/com32/gpllib/acpi/madt.c
@@ -30,6 +30,7 @@
#include <string.h>
#include <memory.h>
#include <dprintf.h>
+#include <stdlib.h>
#include "acpi/acpi.h"
/* Parse the apic structures */
@@ -156,7 +157,7 @@ void parse_madt(s_acpi * acpi)
memcpy(m->header.signature, MADT, sizeof(MADT));
/* Copying remaining structs */
- q = (uint8_t *) (m->address + ACPI_HEADER_SIZE);
+ q = (m->address + ACPI_HEADER_SIZE);
cp_struct(&m->local_apic_address);
cp_struct(&m->flags);
diff --git a/com32/gpllib/acpi/rsdp.c b/com32/gpllib/acpi/rsdp.c
index 0199cc34..d81ab2c2 100644
--- a/com32/gpllib/acpi/rsdp.c
+++ b/com32/gpllib/acpi/rsdp.c
@@ -35,16 +35,15 @@
int search_rsdp(s_acpi * acpi)
{
/* Let's seach for RSDT table */
- uint8_t *p, *q;
+ uint8_t *q;
/* Let's start for the base address */
- p = (uint64_t *) RSDP_MIN_ADDRESS;
- for (q = p; q < RSDP_MAX_ADDRESS; q += 16) {
+ for (q = (uint8_t *)RSDP_MIN_ADDRESS; q < (uint8_t *)RSDP_MAX_ADDRESS; q+=16 ) {
/* Searching for RSDP with "RSD PTR" signature */
if (memcmp(q, RSDP, sizeof(RSDP)-1) == 0) {
s_rsdp *r = &acpi->rsdp;
r->valid = true;
- r->address = (uint64_t) q;
+ r->address = q;
cp_str_struct(r->signature);
cp_struct(&r->checksum);
cp_str_struct(r->oem_id);
@@ -68,13 +67,13 @@ void print_rsdp(s_acpi * acpi)
if (!r->valid)
return;
- printf("RSDP Table @ 0x%016llx\n", r->address);
+ printf("RSDP Table @ 0x%p\n", r->address);
printf(" signature : %s\n", r->signature);
printf(" checksum : %u\n", r->checksum);
printf(" oem id : %s\n", r->oem_id);
printf(" revision : %u\n", r->revision);
- printf(" RDST address : 0x%08x\n", r->rsdt_address);
+ printf(" RDST address : %p\n", r->rsdt_address);
printf(" length : %u\n", r->length);
- printf(" XSDT address : 0x%08x\n", r->xsdt_address);
+ printf(" XSDT address : %p\n", r->xsdt_address);
printf(" extended checksum : %u\n", r->extended_checksum);
}
diff --git a/com32/gpllib/acpi/rsdt.c b/com32/gpllib/acpi/rsdt.c
index cfba4d17..53398b24 100644
--- a/com32/gpllib/acpi/rsdt.c
+++ b/com32/gpllib/acpi/rsdt.c
@@ -38,17 +38,17 @@ int parse_rsdt(s_rsdt *r)
uint8_t *q;
/* Let's start for the base address */
- q = (uint32_t *) r->address;
+ q = r->address;
/* Searching for MADT with APIC signature */
if (memcmp(q, RSDT, sizeof(RSDT)-1) == 0) {
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;
+ uint8_t *p = NULL;
+ for (p = (r->address + ACPI_HEADER_SIZE);
+ p < (r->address + r->header.length); p++) {
+ r->entry[r->entry_count] = p;
r->entry_count++;
}
return RSDT_TABLE_FOUND;
diff --git a/com32/gpllib/acpi/sbst.c b/com32/gpllib/acpi/sbst.c
index 6a41168b..016b953c 100644
--- a/com32/gpllib/acpi/sbst.c
+++ b/com32/gpllib/acpi/sbst.c
@@ -35,7 +35,7 @@
void parse_sbst(s_sbst * s)
{
uint8_t *q;
- q = (uint64_t *) (s->address+ACPI_HEADER_SIZE);
+ q = (s->address+ACPI_HEADER_SIZE);
/* Copying remaining structs */
cp_struct(&s->warning_energy_level);
diff --git a/com32/gpllib/acpi/xsdt.c b/com32/gpllib/acpi/xsdt.c
index ff222b0c..d563593c 100644
--- a/com32/gpllib/acpi/xsdt.c
+++ b/com32/gpllib/acpi/xsdt.c
@@ -38,7 +38,7 @@ int parse_xsdt(s_acpi * acpi)
uint8_t *q;
/* Let's start for the base address */
- q = (uint64_t *) acpi->xsdt.address;
+ q = acpi->xsdt.address;
/* Searching for MADT with APIC signature */
if (memcmp(q, XSDT, sizeof(XSDT) - 1) == 0) {
@@ -47,15 +47,15 @@ int parse_xsdt(s_acpi * acpi)
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++) {
+ uint8_t *p = NULL;
+ for (p = (x->address + ACPI_HEADER_SIZE);
+ p < (x->address + x->header.length); p++) {
s_acpi_description_header adh;
memset(&adh, 0, sizeof(adh));
- x->entry[x->entry_count] = (uint64_t) * p;
+ x->entry[x->entry_count] = p;
/* Let's grab the pointed table header */
- get_acpi_description_header((uint8_t *) * p, &adh);
+ get_acpi_description_header(p, &adh);
/* Trying to determine the pointed table */
/* Looking for FADT */
@@ -65,7 +65,7 @@ int parse_xsdt(s_acpi * acpi)
s_dsdt *d = &acpi->dsdt;
/* This structure is valid, let's fill it */
f->valid = true;
- f->address = *p;
+ f->address = p;
memcpy(&f->header, &adh, sizeof(adh));
parse_fadt(f);
@@ -85,7 +85,7 @@ int parse_xsdt(s_acpi * acpi)
* FADT points to it, let's try to detect it */
if (d->valid == false) {
s_acpi_description_header new_adh;
- get_acpi_description_header((uint8_t *) f->x_dsdt,
+ get_acpi_description_header(f->x_dsdt,
&new_adh);
if (memcmp(new_adh.signature, DSDT, sizeof(DSDT) - 1) == 0) {
d->valid = true;
@@ -94,7 +94,7 @@ int parse_xsdt(s_acpi * acpi)
parse_dsdt(d);
} else {
/* Let's try again */
- get_acpi_description_header((uint8_t *) f->dsdt_address,
+ get_acpi_description_header(f->dsdt_address,
&new_adh);
if (memcmp(new_adh.signature, DSDT, sizeof(DSDT) - 1) ==
0) {
@@ -110,14 +110,14 @@ int parse_xsdt(s_acpi * acpi)
s_madt *m = &acpi->madt;
/* This structure is valid, let's fill it */
m->valid = true;
- m->address = *p;
+ m->address = p;
memcpy(&m->header, &adh, sizeof(adh));
parse_madt(acpi);
} else if (memcmp(adh.signature, DSDT, sizeof(DSDT) - 1) == 0) {
s_dsdt *d = &acpi->dsdt;
/* This structure is valid, let's fill it */
d->valid = true;
- d->address = *p;
+ d->address = p;
memcpy(&d->header, &adh, sizeof(adh));
parse_dsdt(d);
/* PSDT have to be considered as SSDT. Intel ACPI Spec @ 5.2.11.3 */
@@ -134,7 +134,7 @@ int parse_xsdt(s_acpi * acpi)
/* This structure is valid, let's fill it */
s->valid = true;
- s->address = *p;
+ s->address = p;
memcpy(&s->header, &adh, sizeof(adh));
/* Searching how much definition blocks we must copy */
@@ -142,7 +142,7 @@ int parse_xsdt(s_acpi * acpi)
if ((s->definition_block =
malloc(definition_block_size)) != NULL) {
memcpy(s->definition_block,
- (uint64_t *) (s->address + ACPI_HEADER_SIZE),
+ (s->address + ACPI_HEADER_SIZE),
definition_block_size);
}
/* Increment the number of ssdt we have */
@@ -151,14 +151,14 @@ int parse_xsdt(s_acpi * acpi)
s_sbst *s = &acpi->sbst;
/* This structure is valid, let's fill it */
s->valid = true;
- s->address = *p;
+ s->address = p;
memcpy(&s->header, &adh, sizeof(adh));
parse_sbst(s);
} else if (memcmp(adh.signature, ECDT, sizeof(ECDT) - 1) == 0) {
s_ecdt *e = &acpi->ecdt;
/* This structure is valid, let's fill it */
e->valid = true;
- e->address = *p;
+ e->address = p;
memcpy(&e->header, &adh, sizeof(adh));
parse_ecdt(e);
}
diff --git a/com32/hdt/hdt-cli-acpi.c b/com32/hdt/hdt-cli-acpi.c
index 7f4a380c..17ec306d 100644
--- a/com32/hdt/hdt-cli-acpi.c
+++ b/com32/hdt/hdt-cli-acpi.c
@@ -34,32 +34,23 @@
#include <errno.h>
#include <acpi/acpi.h>
-/* Print ACPI's table header in a defined formating
- * this particular version is made for displaying 32bit addresses*/
-static void show_header_32(uint32_t address, s_acpi_description_header * h)
-{
- more_printf("%-4s v%03x %-6s %-7s 0x%08x %-4s 0x%08x @ 0x%016x\n",
- h->signature, h->revision, h->oem_id, h->oem_table_id,
- h->oem_revision, h->creator_id, h->creator_revision, address)
-}
-
/* Print ACPI's table header in a defined formating */
-static void show_header(uint64_t address, s_acpi_description_header * h)
+static void show_header(uint8_t *address, s_acpi_description_header * h)
{
- more_printf("%-4s v%03x %-6s %-7s 0x%08x %-4s 0x%08x @ 0x%016llx\n",
+ more_printf("%-4s v%03x %-6s %-7s 0x%08x %-4s 0x%08x @ 0x%p\n",
h->signature, h->revision, h->oem_id, h->oem_table_id,
h->oem_revision, h->creator_id, h->creator_revision, address)
}
/* That's an helper to visualize columns*/
-void show_table_separator()
+static void show_table_separator(void)
{
more_printf
("----|----|------|--------|----------|-------|-----------|--------------------\n");
}
/* Display the main header before displaying the ACPI tables */
-void show_table_name()
+static void show_table_name(void)
{
more_printf
("ACPI rev oem table_id oem_rev creator creat_rev @ address \n");
@@ -84,16 +75,16 @@ void main_show_acpi(int argc __unused, char **argv __unused,
if (hardware->acpi.rsdp.valid) {
s_rsdp *r = &hardware->acpi.rsdp;
more_printf
- ("RSDP v%03x %-6s @ 0x%016llx\n",
+ ("RSDP v%03x %-6s @ %p\n",
r->revision, r->oem_id, r->address);
}
if (hardware->acpi.rsdt.valid)
- show_header_32(hardware->acpi.rsdt.address,
+ show_header(hardware->acpi.rsdt.address,
&hardware->acpi.rsdt.header);
if (hardware->acpi.xsdt.valid)
- show_header_32(hardware->acpi.xsdt.address,
+ show_header(hardware->acpi.xsdt.address,
&hardware->acpi.xsdt.header);
if (hardware->acpi.fadt.valid)
@@ -122,7 +113,7 @@ void main_show_acpi(int argc __unused, char **argv __unused,
if (hardware->acpi.facs.valid) {
s_facs *fa = &hardware->acpi.facs;
more_printf
- ("FACS @ 0x%016llx\n",
+ ("FACS @ 0x%p\n",
fa->address);
}
}