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>
This commit is contained in:
Aaron Durbin 2015-12-10 17:07:38 -06:00
parent ecd4cfcb86
commit 07a1b281a8
11 changed files with 36 additions and 42 deletions

View File

@ -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);
}
}

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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");

View File

@ -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");

View File

@ -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)

View File

@ -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;

View File

@ -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);

View File

@ -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;