@@ -3,7 +3,7 @@
#include "libcflat.h"
-#define ACPI_SIGNATURE(c1, c2, c3, c4) \
+#define ACPI_SIGNATURE(c1, c2, c3, c4) \
((c1) | ((c2) << 8) | ((c3) << 16) | ((c4) << 24))
#define RSDP_SIGNATURE ACPI_SIGNATURE('R','S','D','P')
@@ -11,9 +11,9 @@
#define FACP_SIGNATURE ACPI_SIGNATURE('F','A','C','P')
#define FACS_SIGNATURE ACPI_SIGNATURE('F','A','C','S')
-#define ACPI_SIGNATURE_8BYTE(c1, c2, c3, c4, c5, c6, c7, c8) \
- ((uint64_t)(ACPI_SIGNATURE(c1, c2, c3, c4))) | \
- ((uint64_t)(ACPI_SIGNATURE(c5, c6, c7, c8)) << 32)
+#define ACPI_SIGNATURE_8BYTE(c1, c2, c3, c4, c5, c6, c7, c8) \
+ (((uint64_t)(ACPI_SIGNATURE(c1, c2, c3, c4))) | \
+ ((uint64_t)(ACPI_SIGNATURE(c5, c6, c7, c8)) << 32))
#define RSDP_SIGNATURE_8BYTE (ACPI_SIGNATURE_8BYTE('R', 'S', 'D', ' ', 'P', 'T', 'R', ' '))
@@ -34,20 +34,20 @@ struct rsdp_descriptor { /* Root System Descriptor Pointer */
u32 length; /* Length of table, in bytes, including header */ \
u8 revision; /* ACPI Specification minor version # */ \
u8 checksum; /* To make sum of entire table == 0 */ \
- u8 oem_id [6]; /* OEM identification */ \
- u8 oem_table_id [8]; /* OEM table identification */ \
+ u8 oem_id[6]; /* OEM identification */ \
+ u8 oem_table_id[8]; /* OEM table identification */ \
u32 oem_revision; /* OEM revision number */ \
- u8 asl_compiler_id [4]; /* ASL compiler vendor ID */ \
+ u8 asl_compiler_id[4]; /* ASL compiler vendor ID */ \
u32 asl_compiler_revision; /* ASL compiler revision number */
struct acpi_table {
ACPI_TABLE_HEADER_DEF
- char data[0];
+ char data[];
};
struct rsdt_descriptor_rev1 {
ACPI_TABLE_HEADER_DEF
- u32 table_offset_entry[1];
+ u32 table_offset_entry[];
};
struct fadt_descriptor_rev1 {
@@ -11,9 +11,9 @@ void set_efi_rsdp(struct rsdp_descriptor *rsdp)
static struct rsdp_descriptor *get_rsdp(void)
{
- if (efi_rsdp == NULL) {
+ if (efi_rsdp == NULL)
printf("Can't find RSDP from UEFI, maybe set_efi_rsdp() was not called\n");
- }
+
return efi_rsdp;
}
#else
@@ -28,9 +28,8 @@ static struct rsdp_descriptor *get_rsdp(void)
break;
}
- if (addr == 0x100000) {
+ if (addr == 0x100000)
return NULL;
- }
return rsdp;
}
@@ -38,18 +37,18 @@ static struct rsdp_descriptor *get_rsdp(void)
void *find_acpi_table_addr(u32 sig)
{
- struct rsdp_descriptor *rsdp;
struct rsdt_descriptor_rev1 *rsdt;
+ struct rsdp_descriptor *rsdp;
void *end;
int i;
/* FACS is special... */
if (sig == FACS_SIGNATURE) {
struct fadt_descriptor_rev1 *fadt;
+
fadt = find_acpi_table_addr(FACP_SIGNATURE);
if (!fadt)
return NULL;
-
return (void *)(ulong) fadt->firmware_ctrl;
}
@@ -72,9 +71,10 @@ void *find_acpi_table_addr(u32 sig)
end = (void *)rsdt + rsdt->length;
for (i = 0; (void *)&rsdt->table_offset_entry[i] < end; i++) {
struct acpi_table *t = (void *)(ulong) rsdt->table_offset_entry[i];
- if (t && t->signature == sig) {
+
+ if (t && t->signature == sig)
return t;
- }
}
+
return NULL;
}