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 | |
parent | ecd4cfcb8695988d82069df4509b56e39794379e (diff) | |
download | coreboot-07a1b281a864e8c2a17e29767a7abf495587b325.tar.gz coreboot-07a1b281a864e8c2a17e29767a7abf495587b325.tar.bz2 coreboot-07a1b281a864e8c2a17e29767a7abf495587b325.zip |
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>
-rw-r--r-- | src/arch/x86/acpi.c | 27 | ||||
-rw-r--r-- | src/arch/x86/include/arch/acpi.h | 6 | ||||
-rw-r--r-- | src/mainboard/getac/p470/acpi_tables.c | 5 | ||||
-rw-r--r-- | src/northbridge/intel/gm45/acpi.c | 5 | ||||
-rw-r--r-- | src/northbridge/intel/sandybridge/acpi.c | 5 | ||||
-rw-r--r-- | src/soc/intel/braswell/acpi.c | 8 | ||||
-rw-r--r-- | src/soc/intel/fsp_baytrail/acpi.c | 6 | ||||
-rw-r--r-- | src/soc/intel/skylake/acpi.c | 3 | ||||
-rw-r--r-- | src/soc/intel/skylake/igd.c | 2 | ||||
-rw-r--r-- | src/soc/intel/skylake/include/soc/acpi.h | 2 | ||||
-rw-r--r-- | src/southbridge/intel/lynxpoint/lpc.c | 9 |
11 files changed, 36 insertions, 42 deletions
diff --git a/src/arch/x86/acpi.c b/src/arch/x86/acpi.c index 2c690c45c4d6..398dc26e6e37 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 79ae7edb83de..276ca5210d02 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 */ diff --git a/src/mainboard/getac/p470/acpi_tables.c b/src/mainboard/getac/p470/acpi_tables.c index 7228f5c25a1b..34d6f3494ac9 100644 --- a/src/mainboard/getac/p470/acpi_tables.c +++ b/src/mainboard/getac/p470/acpi_tables.c @@ -81,7 +81,6 @@ static long acpi_create_ecdt(acpi_ecdt_t * ecdt) return header->length; } -#define ALIGN_CURRENT current = (ALIGN(current, 16)) unsigned long mainboard_write_acpi_tables(device_t device, unsigned long start, acpi_rsdp_t *rsdp) @@ -92,12 +91,12 @@ unsigned long mainboard_write_acpi_tables(device_t device, current = start; /* Align ACPI tables to 16byte */ - ALIGN_CURRENT; + current = acpi_align_current(current); printk(BIOS_DEBUG, "ACPI: * ECDT\n"); ecdt = (acpi_header_t *)current; current += acpi_create_ecdt((acpi_ecdt_t *)current); - ALIGN_CURRENT; + current = acpi_align_current(current); acpi_add_table(rsdp, ecdt); printk(BIOS_DEBUG, "current = %lx\n", current); diff --git a/src/northbridge/intel/gm45/acpi.c b/src/northbridge/intel/gm45/acpi.c index 21a8cd5102b0..8990c3b14021 100644 --- a/src/northbridge/intel/gm45/acpi.c +++ b/src/northbridge/intel/gm45/acpi.c @@ -104,7 +104,6 @@ static unsigned long acpi_fill_dmar(unsigned long current) return current; } -#define ALIGN_CURRENT current = (ALIGN(current, 16)) unsigned long northbridge_write_acpi_tables(device_t device, unsigned long start, struct acpi_rsdp *rsdp) @@ -118,10 +117,10 @@ unsigned long northbridge_write_acpi_tables(device_t device, dmar = (acpi_dmar_t *) current; acpi_create_dmar(dmar, 0, acpi_fill_dmar); current += dmar->header.length; - ALIGN_CURRENT; + current = acpi_align_current(current); acpi_add_table(rsdp, dmar); - ALIGN_CURRENT; + current = acpi_align_current(current); printk(BIOS_DEBUG, "current = %lx\n", current); diff --git a/src/northbridge/intel/sandybridge/acpi.c b/src/northbridge/intel/sandybridge/acpi.c index eebf99c0525c..4953144349ee 100644 --- a/src/northbridge/intel/sandybridge/acpi.c +++ b/src/northbridge/intel/sandybridge/acpi.c @@ -235,7 +235,6 @@ static unsigned long acpi_fill_dmar(unsigned long current) return current; } -#define ALIGN_CURRENT current = (ALIGN(current, 16)) unsigned long northbridge_write_acpi_tables(struct device *const dev, unsigned long current, struct acpi_rsdp *const rsdp) @@ -248,10 +247,10 @@ unsigned long northbridge_write_acpi_tables(struct device *const dev, acpi_dmar_t *const dmar = (acpi_dmar_t *)current; acpi_create_dmar(dmar, DMAR_INTR_REMAP, acpi_fill_dmar); current += dmar->header.length; - ALIGN_CURRENT; + current = acpi_align_current(current); acpi_add_table(rsdp, dmar); - ALIGN_CURRENT; + current = acpi_align_current(current); printk(BIOS_DEBUG, "current = %lx\n", current); diff --git a/src/soc/intel/braswell/acpi.c b/src/soc/intel/braswell/acpi.c index 505b52cac3f7..f7c37481d8b7 100644 --- a/src/soc/intel/braswell/acpi.c +++ b/src/soc/intel/braswell/acpi.c @@ -472,8 +472,6 @@ unsigned long acpi_madt_irq_overrides(unsigned long current) return current; } -#define ALIGN_CURRENT current = (ALIGN(current, 16)) - unsigned long southcluster_write_acpi_tables(device_t device, unsigned long current, struct acpi_rsdp *rsdp) @@ -481,7 +479,7 @@ unsigned long southcluster_write_acpi_tables(device_t device, acpi_header_t *ssdt2; current = acpi_write_hpet(device, current, rsdp); - ALIGN_CURRENT; + current = acpi_align_current(current); #if CONFIG_GOP_SUPPORT igd_opregion_t *opregion; @@ -490,7 +488,7 @@ unsigned long southcluster_write_acpi_tables(device_t device, opregion = (igd_opregion_t *)current; init_igd_opregion(opregion); current += sizeof(igd_opregion_t); - ALIGN_CURRENT; + current = acpi_align_current(current); #endif ssdt2 = (acpi_header_t *)current; @@ -501,7 +499,7 @@ unsigned long southcluster_write_acpi_tables(device_t device, acpi_add_table(rsdp, ssdt2); printk(BIOS_DEBUG, "ACPI: * SSDT2 @ %p Length %x\n",ssdt2, ssdt2->length); - ALIGN_CURRENT; + current = acpi_align_current(current); } else { ssdt2 = NULL; printk(BIOS_DEBUG, "ACPI: * SSDT2 not generated.\n"); diff --git a/src/soc/intel/fsp_baytrail/acpi.c b/src/soc/intel/fsp_baytrail/acpi.c index b9258729a8b6..2aa8c00c8c21 100644 --- a/src/soc/intel/fsp_baytrail/acpi.c +++ b/src/soc/intel/fsp_baytrail/acpi.c @@ -556,8 +556,6 @@ unsigned long acpi_madt_irq_overrides(unsigned long current) return current; } -#define ALIGN_CURRENT current = (ALIGN(current, 16)) - unsigned long southcluster_write_acpi_tables(device_t device, unsigned long current, struct acpi_rsdp *rsdp) @@ -565,7 +563,7 @@ unsigned long southcluster_write_acpi_tables(device_t device, acpi_header_t *ssdt2; current = acpi_write_hpet(device, current, rsdp); - ALIGN_CURRENT; + current = acpi_align_current(current); ssdt2 = (acpi_header_t *)current; memset(ssdt2, 0, sizeof(acpi_header_t)); @@ -575,7 +573,7 @@ unsigned long southcluster_write_acpi_tables(device_t device, acpi_add_table(rsdp, ssdt2); printk(BIOS_DEBUG, "ACPI: * SSDT2 @ %p Length %x\n",ssdt2, ssdt2->length); - ALIGN_CURRENT; + current = acpi_align_current(current); } else { ssdt2 = NULL; printk(BIOS_DEBUG, "ACPI: * SSDT2 not generated.\n"); diff --git a/src/soc/intel/skylake/acpi.c b/src/soc/intel/skylake/acpi.c index 36b5bb40170d..4892656b8971 100644 --- a/src/soc/intel/skylake/acpi.c +++ b/src/soc/intel/skylake/acpi.c @@ -542,8 +542,7 @@ unsigned long southcluster_write_acpi_tables(device_t device, struct acpi_rsdp *rsdp) { current = acpi_write_hpet(device, current, rsdp); - ALIGN_CURRENT; - return current; + return acpi_align_current(current); } void southcluster_inject_dsdt(device_t device) diff --git a/src/soc/intel/skylake/igd.c b/src/soc/intel/skylake/igd.c index f92917690e4e..9268c095f5dc 100644 --- a/src/soc/intel/skylake/igd.c +++ b/src/soc/intel/skylake/igd.c @@ -177,7 +177,7 @@ static unsigned long write_acpi_igd_opregion(device_t device, opregion = (igd_opregion_t *)current; init_igd_opregion(opregion); current += sizeof(igd_opregion_t); - ALIGN_CURRENT; + current = acpi_align_current(current); printk(BIOS_DEBUG, "current = %lx\n", current); return current; diff --git a/src/soc/intel/skylake/include/soc/acpi.h b/src/soc/intel/skylake/include/soc/acpi.h index 08408f9d2c79..77e87267f132 100644 --- a/src/soc/intel/skylake/include/soc/acpi.h +++ b/src/soc/intel/skylake/include/soc/acpi.h @@ -26,8 +26,6 @@ #define PSS_LATENCY_TRANSITION 10 #define PSS_LATENCY_BUSMASTER 10 -#define ALIGN_CURRENT current = (ALIGN(current, 16)) - void acpi_fill_in_fadt(acpi_fadt_t *fadt); unsigned long acpi_madt_irq_overrides(unsigned long current); void acpi_mainboard_gnvs(global_nvs_t *gnvs); diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c index 93bd25133d12..f4c3826aa929 100644 --- a/src/southbridge/intel/lynxpoint/lpc.c +++ b/src/southbridge/intel/lynxpoint/lpc.c @@ -781,7 +781,6 @@ static void southbridge_inject_dsdt(device_t dev) } } -#define ALIGN_CURRENT current = (ALIGN(current, 16)) static unsigned long southbridge_write_acpi_tables(device_t device, unsigned long start, struct acpi_rsdp *rsdp) @@ -793,7 +792,7 @@ static unsigned long southbridge_write_acpi_tables(device_t device, current = start; /* Align ACPI tables to 16byte */ - ALIGN_CURRENT; + current = acpi_align_current(current); /* * We explicitly add these tables later on: @@ -802,18 +801,18 @@ static unsigned long southbridge_write_acpi_tables(device_t device, hpet = (acpi_hpet_t *) current; current += sizeof(acpi_hpet_t); - ALIGN_CURRENT; + current = acpi_align_current(current); acpi_create_intel_hpet(hpet); acpi_add_table(rsdp, hpet); - ALIGN_CURRENT; + current = acpi_align_current(current); printk(BIOS_DEBUG, "ACPI: * SSDT2\n"); ssdt = (acpi_header_t *)current; acpi_create_serialio_ssdt(ssdt); current += ssdt->length; acpi_add_table(rsdp, ssdt); - ALIGN_CURRENT; + current = acpi_align_current(current); printk(BIOS_DEBUG, "current = %lx\n", current); return current; |