diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-12-10 17:07:38 -0600 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2015-12-15 20:12:01 +0100 |
commit | 07a1b281a864e8c2a17e29767a7abf495587b325 (patch) | |
tree | 6856167e67eeb9c56503efc7ed07204d6846eda9 /src/arch/x86 | |
parent | ecd4cfcb8695988d82069df4509b56e39794379e (diff) |
x86 acpi: remove ALIGN_CURRENT macro
The ALIGN_CURRENT macro relied on a local variable name
as well as being defined in numerous compilation units.
Replace those instances with an acpi_align_current()
inline function.
Change-Id: Iab453f2eda1addefad8a1c37d265f917bd803202
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/12707
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/arch/x86')
-rw-r--r-- | src/arch/x86/acpi.c | 27 | ||||
-rw-r--r-- | src/arch/x86/include/arch/acpi.h | 6 |
2 files changed, 19 insertions, 14 deletions
diff --git a/src/arch/x86/acpi.c b/src/arch/x86/acpi.c index 2c690c45c4..398dc26e6e 100644 --- a/src/arch/x86/acpi.c +++ b/src/arch/x86/acpi.c @@ -771,7 +771,6 @@ unsigned long __attribute__ ((weak)) fw_cfg_acpi_tables(unsigned long start) return 0; } -#define ALIGN_CURRENT current = (ALIGN(current, 16)) unsigned long write_acpi_tables(unsigned long start) { unsigned long current; @@ -794,7 +793,7 @@ unsigned long write_acpi_tables(unsigned long start) current = start; /* Align ACPI tables to 16byte */ - ALIGN_CURRENT; + current = acpi_align_current(current); fw = fw_cfg_acpi_tables(current); if (fw) @@ -844,13 +843,13 @@ unsigned long write_acpi_tables(unsigned long start) /* We need at least an RSDP and an RSDT Table */ rsdp = (acpi_rsdp_t *) current; current += sizeof(acpi_rsdp_t); - ALIGN_CURRENT; + current = acpi_align_current(current); rsdt = (acpi_rsdt_t *) current; current += sizeof(acpi_rsdt_t); - ALIGN_CURRENT; + current = acpi_align_current(current); xsdt = (acpi_xsdt_t *) current; current += sizeof(acpi_xsdt_t); - ALIGN_CURRENT; + current = acpi_align_current(current); /* clear all table memory */ memset((void *) start, 0, current - start); @@ -863,7 +862,7 @@ unsigned long write_acpi_tables(unsigned long start) current = (ALIGN(current, 64)); facs = (acpi_facs_t *) current; current += sizeof(acpi_facs_t); - ALIGN_CURRENT; + current = acpi_align_current(current); acpi_create_facs(facs); printk(BIOS_DEBUG, "ACPI: * DSDT\n"); @@ -889,12 +888,12 @@ unsigned long write_acpi_tables(unsigned long start) dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length); } - ALIGN_CURRENT; + current = acpi_align_current(current); printk(BIOS_DEBUG, "ACPI: * FADT\n"); fadt = (acpi_fadt_t *) current; current += sizeof(acpi_fadt_t); - ALIGN_CURRENT; + current = acpi_align_current(current); acpi_create_fadt(fadt, facs, dsdt); acpi_add_table(rsdp, fadt); @@ -904,7 +903,7 @@ unsigned long write_acpi_tables(unsigned long start) slic = (acpi_header_t *)current; memcpy(slic, slic_file, slic_file->length); current += slic_file->length; - ALIGN_CURRENT; + current = acpi_align_current(current); acpi_add_table(rsdp, slic); } @@ -914,7 +913,7 @@ unsigned long write_acpi_tables(unsigned long start) if (ssdt->length > sizeof(acpi_header_t)) { current += ssdt->length; acpi_add_table(rsdp, ssdt); - ALIGN_CURRENT; + current = acpi_align_current(current); } printk(BIOS_DEBUG, "ACPI: * MCFG\n"); @@ -922,7 +921,7 @@ unsigned long write_acpi_tables(unsigned long start) acpi_create_mcfg(mcfg); if (mcfg->header.length > sizeof(acpi_mcfg_t)) { current += mcfg->header.length; - ALIGN_CURRENT; + current = acpi_align_current(current); acpi_add_table(rsdp, mcfg); } @@ -931,7 +930,7 @@ unsigned long write_acpi_tables(unsigned long start) acpi_create_tcpa(tcpa); if (tcpa->header.length >= sizeof(acpi_tcpa_t)) { current += tcpa->header.length; - ALIGN_CURRENT; + current = acpi_align_current(current); acpi_add_table(rsdp, tcpa); } @@ -943,14 +942,14 @@ unsigned long write_acpi_tables(unsigned long start) current+=madt->header.length; acpi_add_table(rsdp,madt); } - ALIGN_CURRENT; + current = acpi_align_current(current); printk(BIOS_DEBUG, "current = %lx\n", current); for (dev = all_devices; dev; dev = dev->next) { if (dev->ops && dev->ops->write_acpi_tables) { current = dev->ops->write_acpi_tables(dev, current, rsdp); - ALIGN_CURRENT; + current = acpi_align_current(current); } } diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h index 79ae7edb83..276ca5210d 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -26,6 +26,7 @@ #include <stdint.h> #include <rules.h> +#include <commonlib/helpers.h> #include <device/device.h> #define RSDP_SIG "RSD PTR " /* RSDT pointer signature */ @@ -637,4 +638,9 @@ static inline int acpi_is_wakeup_s3(void) { return 0; } static inline int acpi_is_wakeup_s4(void) { return 0; } #endif +static inline uintptr_t acpi_align_current(uintptr_t current) +{ + return ALIGN(current, 16); +} + #endif /* __ASM_ACPI_H */ |