[coreboot] New patch to review for coreboot: e3b2d0c Refactor some alignment handling

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Fri Apr 20 19:21:51 CEST 2012


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/910

-gerrit

commit e3b2d0c2af1c8fcdfb88f78dea75ff30d4e52ce2
Author: Patrick Georgi <patrick at georgi-clan.de>
Date:   Fri Apr 20 19:19:47 2012 +0200

    Refactor some alignment handling
    
    Made using coccinelle:
      @@
      expression E;
      @@
      -(E + 7) & -8
      +ALIGN(E, 8)
    
      @@
      expression E;
      @@
      -(E + 15) & -16
      +ALIGN(E, 16)
    
    Change-Id: I071d2c98cd95580d7de21d256c31b6368a3dc70b
    Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
 src/mainboard/advansus/a785e-i/acpi_tables.c       |   20 ++++++++--------
 src/mainboard/amd/bimini_fam10/acpi_tables.c       |   20 ++++++++--------
 src/mainboard/amd/dbm690t/acpi_tables.c            |    2 +-
 src/mainboard/amd/dinar/acpi_tables.c              |   18 +++++++-------
 src/mainboard/amd/inagua/acpi_tables.c             |   24 ++++++++++----------
 src/mainboard/amd/mahogany/acpi_tables.c           |    4 +-
 src/mainboard/amd/mahogany_fam10/acpi_tables.c     |   18 +++++++-------
 src/mainboard/amd/persimmon/acpi_tables.c          |   24 ++++++++++----------
 src/mainboard/amd/pistachio/acpi_tables.c          |    2 +-
 src/mainboard/amd/serengeti_cheetah/acpi_tables.c  |    4 +-
 .../amd/serengeti_cheetah_fam10/acpi_tables.c      |   20 ++++++++--------
 src/mainboard/amd/south_station/acpi_tables.c      |   24 ++++++++++----------
 src/mainboard/amd/tilapia_fam10/acpi_tables.c      |   20 ++++++++--------
 src/mainboard/amd/torpedo/acpi_tables.c            |   18 +++++++-------
 src/mainboard/amd/union_station/acpi_tables.c      |   24 ++++++++++----------
 src/mainboard/aopen/dxplplusu/acpi_tables.c        |    2 +-
 src/mainboard/asrock/939a785gmh/acpi_tables.c      |    4 +-
 src/mainboard/asrock/e350m1/acpi_tables.c          |   24 ++++++++++----------
 src/mainboard/asus/a8v-e_deluxe/acpi_tables.c      |    2 +-
 src/mainboard/asus/a8v-e_se/acpi_tables.c          |    2 +-
 src/mainboard/asus/k8v-x/acpi_tables.c             |    2 +-
 src/mainboard/asus/m2v-mx_se/acpi_tables.c         |    2 +-
 src/mainboard/asus/m2v/acpi_tables.c               |    2 +-
 src/mainboard/asus/m4a78-em/acpi_tables.c          |   20 ++++++++--------
 src/mainboard/asus/m4a785-m/acpi_tables.c          |   18 +++++++-------
 src/mainboard/asus/m5a88-v/acpi_tables.c           |   20 ++++++++--------
 src/mainboard/avalue/eax-785e/acpi_tables.c        |   20 ++++++++--------
 src/mainboard/getac/p470/acpi_tables.c             |    2 +-
 src/mainboard/gigabyte/m57sli/acpi_tables.c        |    2 +-
 src/mainboard/gigabyte/ma785gmt/acpi_tables.c      |   20 ++++++++--------
 src/mainboard/gigabyte/ma78gm/acpi_tables.c        |   20 ++++++++--------
 src/mainboard/ibase/mb899/acpi_tables.c            |    2 +-
 src/mainboard/iei/kino-780am2-fam10/acpi_tables.c  |   18 +++++++-------
 src/mainboard/intel/d945gclf/acpi_tables.c         |    2 +-
 src/mainboard/intel/eagleheights/acpi_tables.c     |    2 +-
 src/mainboard/intel/xe7501devkit/acpi_tables.c     |    2 +-
 src/mainboard/iwave/iWRainbowG6/acpi_tables.c      |    2 +-
 src/mainboard/iwill/dk8_htx/acpi_tables.c          |    4 +-
 src/mainboard/jetway/pa78vm5/acpi_tables.c         |   20 ++++++++--------
 src/mainboard/kontron/986lcd-m/acpi_tables.c       |    2 +-
 src/mainboard/kontron/kt690/acpi_tables.c          |    2 +-
 src/mainboard/lenovo/t60/acpi_tables.c             |    2 +-
 src/mainboard/lenovo/x60/acpi_tables.c             |    2 +-
 src/mainboard/msi/ms7135/acpi_tables.c             |    2 +-
 src/mainboard/msi/ms9652_fam10/acpi_tables.c       |    2 +-
 src/mainboard/roda/rk886ex/acpi_tables.c           |    2 +-
 src/mainboard/siemens/sitemp_g1p1/acpi_tables.c    |    2 +-
 src/mainboard/supermicro/h8qgi/acpi_tables.c       |   18 +++++++-------
 src/mainboard/supermicro/h8scm_fam10/acpi_tables.c |   20 ++++++++--------
 src/mainboard/technexion/tim5690/acpi_tables.c     |    2 +-
 src/mainboard/technexion/tim8690/acpi_tables.c     |    2 +-
 src/mainboard/tyan/s2891/acpi_tables.c             |    2 +-
 src/mainboard/tyan/s2892/acpi_tables.c             |    2 +-
 src/mainboard/tyan/s2895/acpi_tables.c             |    2 +-
 src/mainboard/via/epia-m/acpi_tables.c             |    2 +-
 src/mainboard/via/epia-m700/acpi_tables.c          |    2 +-
 src/mainboard/via/epia-n/acpi_tables.c             |    2 +-
 src/mainboard/via/vt8454c/acpi_tables.c            |    2 +-
 src/northbridge/amd/amdfam10/acpi.c                |    2 +-
 src/southbridge/intel/i82371eb/acpi_tables.c       |    2 +-
 60 files changed, 266 insertions(+), 266 deletions(-)

diff --git a/src/mainboard/advansus/a785e-i/acpi_tables.c b/src/mainboard/advansus/a785e-i/acpi_tables.c
index 33a0540..9642bb4 100644
--- a/src/mainboard/advansus/a785e-i/acpi_tables.c
+++ b/src/mainboard/advansus/a785e-i/acpi_tables.c
@@ -110,7 +110,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -130,7 +130,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -138,7 +138,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -146,7 +146,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -154,7 +154,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -162,7 +162,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *)current;
 	memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
@@ -191,7 +191,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		} else {
 			c = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch (sysconf.hcid[i]) {
@@ -220,7 +220,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -229,7 +229,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
@@ -237,7 +237,7 @@ unsigned long write_acpi_tables(unsigned long start)
 
 	/* FDAT */
 #if CONFIG_BOARD_HAS_FADT == 1
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
diff --git a/src/mainboard/amd/bimini_fam10/acpi_tables.c b/src/mainboard/amd/bimini_fam10/acpi_tables.c
index d7a1f24..c079b70 100644
--- a/src/mainboard/amd/bimini_fam10/acpi_tables.c
+++ b/src/mainboard/amd/bimini_fam10/acpi_tables.c
@@ -110,7 +110,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -128,7 +128,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_write_rsdt(rsdt);
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -137,14 +137,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
@@ -155,7 +155,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -163,7 +163,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -171,7 +171,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -179,7 +179,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -187,7 +187,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *)current;
 	memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
@@ -216,7 +216,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		} else {
 			c = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch (sysconf.hcid[i]) {
diff --git a/src/mainboard/amd/dbm690t/acpi_tables.c b/src/mainboard/amd/dbm690t/acpi_tables.c
index 9f91ee8..56ba93f 100644
--- a/src/mainboard/amd/dbm690t/acpi_tables.c
+++ b/src/mainboard/amd/dbm690t/acpi_tables.c
@@ -112,7 +112,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();		/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16byte */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/amd/dinar/acpi_tables.c b/src/mainboard/amd/dinar/acpi_tables.c
index db01d79..90bd546 100644
--- a/src/mainboard/amd/dinar/acpi_tables.c
+++ b/src/mainboard/amd/dinar/acpi_tables.c
@@ -195,7 +195,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -237,7 +237,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	 * We explicitly add these tables later on:
 	 */
 #ifdef UNUSED_CODE // Don't need HPET table. we have one in dsdt
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -246,7 +246,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -254,14 +254,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* HEST */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	hest = (acpi_hest_t *)current;
 	acpi_write_hest((void *)current);
 	acpi_add_table(rsdp, (void *)current);
 	current += ((acpi_header_t *)current)->length;
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT);
 	if (srat != NULL) {
@@ -273,7 +273,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT);
 	if (slit != NULL) {
@@ -285,7 +285,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA ALIB SSDT at %lx\n", current);
 	alib = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_ALIB);
 	if (alib != NULL) {
@@ -299,7 +299,7 @@ unsigned long write_acpi_tables(unsigned long start)
 
 	/* The DSDT needs additional work for the AGESA SSDT Pstate table */
 	/* Keep the comment for a while. */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA SSDT Pstate at %lx\n", current);
 	ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
 	if (ssdt != NULL) {
@@ -311,7 +311,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		printk(BIOS_DEBUG, "  AGESA SSDT Pstate table NULL. Skipping.\n");
 	}
 
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * coreboot TOM SSDT2 at %lx\n", current);
 	ssdt2 = (acpi_header_t *) current;
 	acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
diff --git a/src/mainboard/amd/inagua/acpi_tables.c b/src/mainboard/amd/inagua/acpi_tables.c
index a4504d4..0b8732a 100644
--- a/src/mainboard/amd/inagua/acpi_tables.c
+++ b/src/mainboard/amd/inagua/acpi_tables.c
@@ -155,7 +155,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -173,7 +173,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_write_rsdt(rsdt);
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current;
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -182,14 +182,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:  * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current;
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
@@ -200,7 +200,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -208,7 +208,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -216,14 +216,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* HEST */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	hest = (acpi_hest_t *)current;
 	acpi_write_hest((void *)current);
 	acpi_add_table(rsdp, (void *)current);
 	current += ((acpi_header_t *)current)->length;
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT);
 	if (srat != NULL) {
@@ -237,7 +237,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT);
 	if (slit != NULL) {
@@ -251,7 +251,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA ALIB SSDT at %lx\n", current);
 	alib = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_ALIB);
 	if (alib != NULL) {
@@ -265,7 +265,7 @@ unsigned long write_acpi_tables(unsigned long start)
 
 	/* The DSDT needs additional work for the AGESA SSDT Pstate table */
 	/* Keep the comment for a while. */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA SSDT Pstate at %lx\n", current);
 	ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
 	if (ssdt != NULL) {
@@ -277,7 +277,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		printk(BIOS_DEBUG, "  AGESA SSDT Pstate table NULL. Skipping.\n");
 	}
 
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * coreboot TOM SSDT2 at %lx\n", current);
 	ssdt2 = (acpi_header_t *) current;
 	acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
diff --git a/src/mainboard/amd/mahogany/acpi_tables.c b/src/mainboard/amd/mahogany/acpi_tables.c
index df7a48b..65d336c 100644
--- a/src/mainboard/amd/mahogany/acpi_tables.c
+++ b/src/mainboard/amd/mahogany/acpi_tables.c
@@ -123,7 +123,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -199,7 +199,7 @@ unsigned long write_acpi_tables(unsigned long start)
 			c = (u8) ('A' + i - 1 - 6);
 		}
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]);	/* pci0 and pci1 are in dsdt */
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		ssdtx = (acpi_header_t *) current;
 		switch (sysconf.hcid[i]) {
 		case 1:	/* 8132 */
diff --git a/src/mainboard/amd/mahogany_fam10/acpi_tables.c b/src/mainboard/amd/mahogany_fam10/acpi_tables.c
index 7e89881..5e48bbe 100644
--- a/src/mainboard/amd/mahogany_fam10/acpi_tables.c
+++ b/src/mainboard/amd/mahogany_fam10/acpi_tables.c
@@ -126,7 +126,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -144,7 +144,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_write_rsdt(rsdt);
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -153,14 +153,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
@@ -171,7 +171,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -179,7 +179,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -187,7 +187,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -195,7 +195,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -203,7 +203,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * coreboot PSTATE/TOM SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *) current;
 	acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
diff --git a/src/mainboard/amd/persimmon/acpi_tables.c b/src/mainboard/amd/persimmon/acpi_tables.c
index cb415fd..81936da 100644
--- a/src/mainboard/amd/persimmon/acpi_tables.c
+++ b/src/mainboard/amd/persimmon/acpi_tables.c
@@ -155,7 +155,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -173,7 +173,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_write_rsdt(rsdt);
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current;
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -182,14 +182,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:  * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current;
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
@@ -200,7 +200,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -208,7 +208,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -216,14 +216,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* HEST */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	hest = (acpi_hest_t *)current;
 	acpi_write_hest((void *)current);
 	acpi_add_table(rsdp, (void *)current);
 	current += ((acpi_header_t *)current)->length;
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT);
 	if (srat != NULL) {
@@ -237,7 +237,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT);
 	if (slit != NULL) {
@@ -251,7 +251,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA ALIB SSDT at %lx\n", current);
 	alib = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_ALIB);
 	if (alib != NULL) {
@@ -265,7 +265,7 @@ unsigned long write_acpi_tables(unsigned long start)
 
 	/* The DSDT needs additional work for the AGESA SSDT Pstate table */
 	/* Keep the comment for a while. */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA SSDT Pstate at %lx\n", current);
 	ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
 	if (ssdt != NULL) {
@@ -277,7 +277,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		printk(BIOS_DEBUG, "  AGESA SSDT Pstate table NULL. Skipping.\n");
 	}
 
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * coreboot TOM SSDT2 at %lx\n", current);
 	ssdt2 = (acpi_header_t *) current;
 	acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
diff --git a/src/mainboard/amd/pistachio/acpi_tables.c b/src/mainboard/amd/pistachio/acpi_tables.c
index 3f44b9d..47f3be5 100644
--- a/src/mainboard/amd/pistachio/acpi_tables.c
+++ b/src/mainboard/amd/pistachio/acpi_tables.c
@@ -112,7 +112,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();		/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16byte */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/amd/serengeti_cheetah/acpi_tables.c b/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
index 47bd34b..fb31750 100644
--- a/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
+++ b/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
@@ -174,7 +174,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf(); //it will get sblk, pci1234, hcdn, and sbdn
 
 	/* Align ACPI tables to 16 bytes */
-	start = ( start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -264,7 +264,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		else {
 			c  = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch(sysconf.hcid[i]) {
diff --git a/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c b/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
index 2c112f9..994034b 100644
--- a/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
+++ b/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
@@ -180,7 +180,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf(); //it will get sblk, pci1234, hcdn, and sbdn
 
 	/* Align ACPI tables to 16 bytes */
-	start = ( start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -198,7 +198,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_write_rsdt(rsdt);
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current;
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -207,14 +207,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n", dsdt, dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current;
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
@@ -225,7 +225,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -233,7 +233,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n", current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -241,7 +241,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -249,7 +249,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -257,7 +257,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *)current;
 	memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
@@ -287,7 +287,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		else {
 			c  = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch(sysconf.hcid[i]) {
diff --git a/src/mainboard/amd/south_station/acpi_tables.c b/src/mainboard/amd/south_station/acpi_tables.c
index 5c958a0..92da9fc 100644
--- a/src/mainboard/amd/south_station/acpi_tables.c
+++ b/src/mainboard/amd/south_station/acpi_tables.c
@@ -155,7 +155,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -173,7 +173,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_write_rsdt(rsdt);
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current;
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -182,14 +182,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:  * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current;
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
@@ -200,7 +200,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -208,7 +208,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -216,14 +216,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* HEST */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	hest = (acpi_hest_t *)current;
 	acpi_write_hest((void *)current);
 	acpi_add_table(rsdp, (void *)current);
 	current += ((acpi_header_t *)current)->length;
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT);
 	if (srat != NULL) {
@@ -237,7 +237,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT);
 	if (slit != NULL) {
@@ -251,7 +251,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA ALIB SSDT at %lx\n", current);
 	alib = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_ALIB);
 	if (alib != NULL) {
@@ -265,7 +265,7 @@ unsigned long write_acpi_tables(unsigned long start)
 
 	/* The DSDT needs additional work for the AGESA SSDT Pstate table */
 	/* Keep the comment for a while. */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA SSDT Pstate at %lx\n", current);
 	ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
 	if (ssdt != NULL) {
@@ -277,7 +277,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		printk(BIOS_DEBUG, "  AGESA SSDT Pstate table NULL. Skipping.\n");
 	}
 
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * coreboot TOM SSDT2 at %lx\n", current);
 	ssdt2 = (acpi_header_t *) current;
 	acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
diff --git a/src/mainboard/amd/tilapia_fam10/acpi_tables.c b/src/mainboard/amd/tilapia_fam10/acpi_tables.c
index c44fe33..d9b9dd0 100644
--- a/src/mainboard/amd/tilapia_fam10/acpi_tables.c
+++ b/src/mainboard/amd/tilapia_fam10/acpi_tables.c
@@ -110,7 +110,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -128,7 +128,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_write_rsdt(rsdt);
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -137,14 +137,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
@@ -155,7 +155,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -163,7 +163,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -171,7 +171,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -179,7 +179,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -187,7 +187,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *)current;
 	memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
@@ -216,7 +216,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		} else {
 			c = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch (sysconf.hcid[i]) {
diff --git a/src/mainboard/amd/torpedo/acpi_tables.c b/src/mainboard/amd/torpedo/acpi_tables.c
index 2e04c57..9c43252 100644
--- a/src/mainboard/amd/torpedo/acpi_tables.c
+++ b/src/mainboard/amd/torpedo/acpi_tables.c
@@ -143,7 +143,7 @@ unsigned long write_acpi_tables(unsigned long start)
   get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
 
   /* Align ACPI tables to 16 bytes */
-  start = (start + 0x0f) & -0x10;
+  start = ALIGN(start, 16);
   current = start;
 
   printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -173,7 +173,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
   /* If we want to use HPET Timers Linux wants an MADT */
-  current = (current + 0x07) & -0x08;
+  current = ALIGN(current, 8);
   printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
   madt = (acpi_madt_t *) current;
   acpi_create_madt(madt);
@@ -181,14 +181,14 @@ unsigned long write_acpi_tables(unsigned long start)
   acpi_add_table(rsdp, madt);
 
   /* HEST */
-  current = (current + 0x07) & -0x08;
+  current = ALIGN(current, 8);
   hest = (acpi_hest_t *)current;
   acpi_write_hest((void *)current);
   acpi_add_table(rsdp, (void *)current);
   current += ((acpi_header_t *)current)->length;
 
   /* SRAT */
-  current = (current + 0x07) & -0x08;
+  current = ALIGN(current, 8);
   printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
   srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT);
   if (srat != NULL) {
@@ -200,7 +200,7 @@ unsigned long write_acpi_tables(unsigned long start)
   }
 
   /* SLIT */
-  current = (current + 0x07) & -0x08;
+  current = ALIGN(current, 8);
   printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
   slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT);
   if (slit != NULL) {
@@ -212,7 +212,7 @@ unsigned long write_acpi_tables(unsigned long start)
   }
 
   /* SSDT */
-  current = (current + 0x0f) & -0x10;
+  current = ALIGN(current, 16);
   printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
   ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
   if (ssdt != NULL) {
@@ -234,7 +234,7 @@ unsigned long write_acpi_tables(unsigned long start)
   printk(BIOS_DEBUG, "ACPI:    * SSDT for PState at %lx\n", current);
 
   /* DSDT */
-  current = (current + 0x07) & -0x08;
+  current = ALIGN(current, 8);
   printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
   dsdt = (acpi_header_t *)current; // it will used by fadt
   memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -243,14 +243,14 @@ unsigned long write_acpi_tables(unsigned long start)
   printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
   /* FACS */ // it needs 64 bit alignment
-  current = (current + 0x07) & -0x08;
+  current = ALIGN(current, 8);
   printk(BIOS_DEBUG, "ACPI: * FACS at %lx\n", current);
   facs = (acpi_facs_t *) current; // it will be used by fadt
   current += sizeof(acpi_facs_t);
   acpi_create_facs(facs);
 
   /* FADT */
-  current = (current + 0x07) & -0x08;
+  current = ALIGN(current, 8);
   printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
   fadt = (acpi_fadt_t *) current;
   current += sizeof(acpi_fadt_t);
diff --git a/src/mainboard/amd/union_station/acpi_tables.c b/src/mainboard/amd/union_station/acpi_tables.c
index 5c958a0..92da9fc 100644
--- a/src/mainboard/amd/union_station/acpi_tables.c
+++ b/src/mainboard/amd/union_station/acpi_tables.c
@@ -155,7 +155,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -173,7 +173,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_write_rsdt(rsdt);
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current;
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -182,14 +182,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:  * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current;
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
@@ -200,7 +200,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -208,7 +208,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -216,14 +216,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* HEST */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	hest = (acpi_hest_t *)current;
 	acpi_write_hest((void *)current);
 	acpi_add_table(rsdp, (void *)current);
 	current += ((acpi_header_t *)current)->length;
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT);
 	if (srat != NULL) {
@@ -237,7 +237,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT);
 	if (slit != NULL) {
@@ -251,7 +251,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA ALIB SSDT at %lx\n", current);
 	alib = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_ALIB);
 	if (alib != NULL) {
@@ -265,7 +265,7 @@ unsigned long write_acpi_tables(unsigned long start)
 
 	/* The DSDT needs additional work for the AGESA SSDT Pstate table */
 	/* Keep the comment for a while. */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA SSDT Pstate at %lx\n", current);
 	ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
 	if (ssdt != NULL) {
@@ -277,7 +277,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		printk(BIOS_DEBUG, "  AGESA SSDT Pstate table NULL. Skipping.\n");
 	}
 
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * coreboot TOM SSDT2 at %lx\n", current);
 	ssdt2 = (acpi_header_t *) current;
 	acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
diff --git a/src/mainboard/aopen/dxplplusu/acpi_tables.c b/src/mainboard/aopen/dxplplusu/acpi_tables.c
index b7c789a..352708e 100644
--- a/src/mainboard/aopen/dxplplusu/acpi_tables.c
+++ b/src/mainboard/aopen/dxplplusu/acpi_tables.c
@@ -92,7 +92,7 @@ unsigned long acpi_fill_madt(unsigned long current)
 	return current;
 }
 
-#define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
 unsigned long write_acpi_tables(unsigned long start)
 {
 	unsigned long current;
diff --git a/src/mainboard/asrock/939a785gmh/acpi_tables.c b/src/mainboard/asrock/939a785gmh/acpi_tables.c
index c0d8691..41f4173 100644
--- a/src/mainboard/asrock/939a785gmh/acpi_tables.c
+++ b/src/mainboard/asrock/939a785gmh/acpi_tables.c
@@ -123,7 +123,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -178,7 +178,7 @@ unsigned long write_acpi_tables(unsigned long start)
 			c = (u8) ('A' + i - 1 - 6);
 		}
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]);	/* pci0 and pci1 are in dsdt */
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		ssdtx = (acpi_header_t *) current;
 		switch (sysconf.hcid[i]) {
 		case 1:	/* 8132 */
diff --git a/src/mainboard/asrock/e350m1/acpi_tables.c b/src/mainboard/asrock/e350m1/acpi_tables.c
index 5c958a0..92da9fc 100644
--- a/src/mainboard/asrock/e350m1/acpi_tables.c
+++ b/src/mainboard/asrock/e350m1/acpi_tables.c
@@ -155,7 +155,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -173,7 +173,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_write_rsdt(rsdt);
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current;
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -182,14 +182,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:  * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current;
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
@@ -200,7 +200,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -208,7 +208,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -216,14 +216,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* HEST */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	hest = (acpi_hest_t *)current;
 	acpi_write_hest((void *)current);
 	acpi_add_table(rsdp, (void *)current);
 	current += ((acpi_header_t *)current)->length;
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT);
 	if (srat != NULL) {
@@ -237,7 +237,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:  * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT);
 	if (slit != NULL) {
@@ -251,7 +251,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA ALIB SSDT at %lx\n", current);
 	alib = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_ALIB);
 	if (alib != NULL) {
@@ -265,7 +265,7 @@ unsigned long write_acpi_tables(unsigned long start)
 
 	/* The DSDT needs additional work for the AGESA SSDT Pstate table */
 	/* Keep the comment for a while. */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA SSDT Pstate at %lx\n", current);
 	ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
 	if (ssdt != NULL) {
@@ -277,7 +277,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		printk(BIOS_DEBUG, "  AGESA SSDT Pstate table NULL. Skipping.\n");
 	}
 
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * coreboot TOM SSDT2 at %lx\n", current);
 	ssdt2 = (acpi_header_t *) current;
 	acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
diff --git a/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c b/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
index fe8d475..a991435 100644
--- a/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
@@ -94,7 +94,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/asus/a8v-e_se/acpi_tables.c b/src/mainboard/asus/a8v-e_se/acpi_tables.c
index 218f3bb..24ac1a9 100644
--- a/src/mainboard/asus/a8v-e_se/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_se/acpi_tables.c
@@ -105,7 +105,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/asus/k8v-x/acpi_tables.c b/src/mainboard/asus/k8v-x/acpi_tables.c
index 571d136..0fe83ea 100644
--- a/src/mainboard/asus/k8v-x/acpi_tables.c
+++ b/src/mainboard/asus/k8v-x/acpi_tables.c
@@ -105,7 +105,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/asus/m2v-mx_se/acpi_tables.c b/src/mainboard/asus/m2v-mx_se/acpi_tables.c
index 3cdde41..6250629 100644
--- a/src/mainboard/asus/m2v-mx_se/acpi_tables.c
+++ b/src/mainboard/asus/m2v-mx_se/acpi_tables.c
@@ -108,7 +108,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/asus/m2v/acpi_tables.c b/src/mainboard/asus/m2v/acpi_tables.c
index 73f82d8..468b2eb 100644
--- a/src/mainboard/asus/m2v/acpi_tables.c
+++ b/src/mainboard/asus/m2v/acpi_tables.c
@@ -109,7 +109,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/asus/m4a78-em/acpi_tables.c b/src/mainboard/asus/m4a78-em/acpi_tables.c
index 3260322..fb3228b 100644
--- a/src/mainboard/asus/m4a78-em/acpi_tables.c
+++ b/src/mainboard/asus/m4a78-em/acpi_tables.c
@@ -109,7 +109,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -129,7 +129,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -137,7 +137,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -145,7 +145,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -153,7 +153,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -161,7 +161,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *)current;
 	memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
@@ -190,7 +190,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		} else {
 			c = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch (sysconf.hcid[i]) {
@@ -219,7 +219,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -228,14 +228,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
diff --git a/src/mainboard/asus/m4a785-m/acpi_tables.c b/src/mainboard/asus/m4a785-m/acpi_tables.c
index 47321b3..79f7170 100644
--- a/src/mainboard/asus/m4a785-m/acpi_tables.c
+++ b/src/mainboard/asus/m4a785-m/acpi_tables.c
@@ -128,7 +128,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -148,7 +148,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -156,7 +156,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -164,7 +164,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -172,7 +172,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -180,7 +180,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * coreboot PSTATE/TOM SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *) current;
 	acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
@@ -188,7 +188,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp,ssdt);
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -197,14 +197,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
diff --git a/src/mainboard/asus/m5a88-v/acpi_tables.c b/src/mainboard/asus/m5a88-v/acpi_tables.c
index 33a0540..9642bb4 100644
--- a/src/mainboard/asus/m5a88-v/acpi_tables.c
+++ b/src/mainboard/asus/m5a88-v/acpi_tables.c
@@ -110,7 +110,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -130,7 +130,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -138,7 +138,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -146,7 +146,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -154,7 +154,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -162,7 +162,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *)current;
 	memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
@@ -191,7 +191,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		} else {
 			c = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch (sysconf.hcid[i]) {
@@ -220,7 +220,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -229,7 +229,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
@@ -237,7 +237,7 @@ unsigned long write_acpi_tables(unsigned long start)
 
 	/* FDAT */
 #if CONFIG_BOARD_HAS_FADT == 1
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
diff --git a/src/mainboard/avalue/eax-785e/acpi_tables.c b/src/mainboard/avalue/eax-785e/acpi_tables.c
index 33a0540..9642bb4 100644
--- a/src/mainboard/avalue/eax-785e/acpi_tables.c
+++ b/src/mainboard/avalue/eax-785e/acpi_tables.c
@@ -110,7 +110,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -130,7 +130,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -138,7 +138,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -146,7 +146,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -154,7 +154,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -162,7 +162,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *)current;
 	memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
@@ -191,7 +191,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		} else {
 			c = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch (sysconf.hcid[i]) {
@@ -220,7 +220,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -229,7 +229,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
@@ -237,7 +237,7 @@ unsigned long write_acpi_tables(unsigned long start)
 
 	/* FDAT */
 #if CONFIG_BOARD_HAS_FADT == 1
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
diff --git a/src/mainboard/getac/p470/acpi_tables.c b/src/mainboard/getac/p470/acpi_tables.c
index 676d661..a4ca0a8 100644
--- a/src/mainboard/getac/p470/acpi_tables.c
+++ b/src/mainboard/getac/p470/acpi_tables.c
@@ -175,7 +175,7 @@ unsigned long acpi_fill_srat(unsigned long current)
 
 void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
 
-#define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
 unsigned long write_acpi_tables(unsigned long start)
 {
 	unsigned long current;
diff --git a/src/mainboard/gigabyte/m57sli/acpi_tables.c b/src/mainboard/gigabyte/m57sli/acpi_tables.c
index 513e478..5d1c275 100644
--- a/src/mainboard/gigabyte/m57sli/acpi_tables.c
+++ b/src/mainboard/gigabyte/m57sli/acpi_tables.c
@@ -116,7 +116,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/gigabyte/ma785gmt/acpi_tables.c b/src/mainboard/gigabyte/ma785gmt/acpi_tables.c
index 244c44a..8f0acce 100644
--- a/src/mainboard/gigabyte/ma785gmt/acpi_tables.c
+++ b/src/mainboard/gigabyte/ma785gmt/acpi_tables.c
@@ -108,7 +108,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -128,7 +128,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -136,7 +136,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -144,7 +144,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -152,7 +152,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -160,7 +160,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *)current;
 	memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
@@ -189,7 +189,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		} else {
 			c = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch (sysconf.hcid[i]) {
@@ -218,7 +218,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -227,14 +227,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
diff --git a/src/mainboard/gigabyte/ma78gm/acpi_tables.c b/src/mainboard/gigabyte/ma78gm/acpi_tables.c
index 244c44a..8f0acce 100644
--- a/src/mainboard/gigabyte/ma78gm/acpi_tables.c
+++ b/src/mainboard/gigabyte/ma78gm/acpi_tables.c
@@ -108,7 +108,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -128,7 +128,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -136,7 +136,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -144,7 +144,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -152,7 +152,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -160,7 +160,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *)current;
 	memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
@@ -189,7 +189,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		} else {
 			c = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch (sysconf.hcid[i]) {
@@ -218,7 +218,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -227,14 +227,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
diff --git a/src/mainboard/ibase/mb899/acpi_tables.c b/src/mainboard/ibase/mb899/acpi_tables.c
index 16ee302..9ff5b1d 100644
--- a/src/mainboard/ibase/mb899/acpi_tables.c
+++ b/src/mainboard/ibase/mb899/acpi_tables.c
@@ -124,7 +124,7 @@ unsigned long acpi_fill_srat(unsigned long current)
 
 void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
 
-#define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
 unsigned long write_acpi_tables(unsigned long start)
 {
 	unsigned long current;
diff --git a/src/mainboard/iei/kino-780am2-fam10/acpi_tables.c b/src/mainboard/iei/kino-780am2-fam10/acpi_tables.c
index 7e89881..5e48bbe 100644
--- a/src/mainboard/iei/kino-780am2-fam10/acpi_tables.c
+++ b/src/mainboard/iei/kino-780am2-fam10/acpi_tables.c
@@ -126,7 +126,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -144,7 +144,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_write_rsdt(rsdt);
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -153,14 +153,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
@@ -171,7 +171,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -179,7 +179,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -187,7 +187,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -195,7 +195,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -203,7 +203,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * coreboot PSTATE/TOM SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *) current;
 	acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
diff --git a/src/mainboard/intel/d945gclf/acpi_tables.c b/src/mainboard/intel/d945gclf/acpi_tables.c
index 0435bdd..d32dc81 100644
--- a/src/mainboard/intel/d945gclf/acpi_tables.c
+++ b/src/mainboard/intel/d945gclf/acpi_tables.c
@@ -115,7 +115,7 @@ unsigned long acpi_fill_srat(unsigned long current)
 void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
 #endif
 
-#define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
 unsigned long write_acpi_tables(unsigned long start)
 {
 	unsigned long current;
diff --git a/src/mainboard/intel/eagleheights/acpi_tables.c b/src/mainboard/intel/eagleheights/acpi_tables.c
index 123ddbc..ce67645 100644
--- a/src/mainboard/intel/eagleheights/acpi_tables.c
+++ b/src/mainboard/intel/eagleheights/acpi_tables.c
@@ -135,7 +135,7 @@ unsigned long acpi_fill_srat(unsigned long current)
 }
 
 
-#define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
 unsigned long write_acpi_tables(unsigned long start)
 {
 	unsigned long current;
diff --git a/src/mainboard/intel/xe7501devkit/acpi_tables.c b/src/mainboard/intel/xe7501devkit/acpi_tables.c
index 9324144..b3c20ba 100644
--- a/src/mainboard/intel/xe7501devkit/acpi_tables.c
+++ b/src/mainboard/intel/xe7501devkit/acpi_tables.c
@@ -103,7 +103,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_madt_t *madt;
 
 	/* Align ACPI tables to 16byte */
-	start   = ( start + 0x0f ) & -0x10;
+	start   = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/iwave/iWRainbowG6/acpi_tables.c b/src/mainboard/iwave/iWRainbowG6/acpi_tables.c
index a30479b..3951cff 100644
--- a/src/mainboard/iwave/iWRainbowG6/acpi_tables.c
+++ b/src/mainboard/iwave/iWRainbowG6/acpi_tables.c
@@ -127,7 +127,7 @@ unsigned long acpi_fill_srat(unsigned long current)
 
 void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
 
-#define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
 unsigned long write_acpi_tables(unsigned long start)
 {
 	unsigned long current;
diff --git a/src/mainboard/iwill/dk8_htx/acpi_tables.c b/src/mainboard/iwill/dk8_htx/acpi_tables.c
index ac1c692..b021214 100644
--- a/src/mainboard/iwill/dk8_htx/acpi_tables.c
+++ b/src/mainboard/iwill/dk8_htx/acpi_tables.c
@@ -181,7 +181,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf(); //it will get sblk, pci1234, hcdn, and sbdn
 
 	/* Align ACPI tables to 16byte */
-	start   = ( start + 0x0f ) & -0x10;
+	start   = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -251,7 +251,7 @@ unsigned long write_acpi_tables(unsigned long start)
                         c  = (uint8_t) ('A' + i - 1 - 6);
                 }
                 printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]); //pci0 and pci1 are in dsdt
-                current = (current + 0x07) & -0x08;
+                current = ALIGN(current, 8);
                 ssdtx = (acpi_header_t *)current;
                 switch(sysconf.hcid[i]) {
                 case 1: //8132
diff --git a/src/mainboard/jetway/pa78vm5/acpi_tables.c b/src/mainboard/jetway/pa78vm5/acpi_tables.c
index a043100..e444014 100644
--- a/src/mainboard/jetway/pa78vm5/acpi_tables.c
+++ b/src/mainboard/jetway/pa78vm5/acpi_tables.c
@@ -109,7 +109,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -129,7 +129,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -137,7 +137,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -145,7 +145,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -153,7 +153,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -161,7 +161,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *)current;
 	memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
@@ -190,7 +190,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		} else {
 			c = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch (sysconf.hcid[i]) {
@@ -219,7 +219,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -228,14 +228,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
diff --git a/src/mainboard/kontron/986lcd-m/acpi_tables.c b/src/mainboard/kontron/986lcd-m/acpi_tables.c
index 16ee302..9ff5b1d 100644
--- a/src/mainboard/kontron/986lcd-m/acpi_tables.c
+++ b/src/mainboard/kontron/986lcd-m/acpi_tables.c
@@ -124,7 +124,7 @@ unsigned long acpi_fill_srat(unsigned long current)
 
 void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
 
-#define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
 unsigned long write_acpi_tables(unsigned long start)
 {
 	unsigned long current;
diff --git a/src/mainboard/kontron/kt690/acpi_tables.c b/src/mainboard/kontron/kt690/acpi_tables.c
index 787a3e5..30a1f80 100644
--- a/src/mainboard/kontron/kt690/acpi_tables.c
+++ b/src/mainboard/kontron/kt690/acpi_tables.c
@@ -112,7 +112,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();		/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16byte */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/lenovo/t60/acpi_tables.c b/src/mainboard/lenovo/t60/acpi_tables.c
index 412ec47..db86317 100644
--- a/src/mainboard/lenovo/t60/acpi_tables.c
+++ b/src/mainboard/lenovo/t60/acpi_tables.c
@@ -135,7 +135,7 @@ unsigned long acpi_fill_srat(unsigned long current)
 
 void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
 
-#define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
 unsigned long write_acpi_tables(unsigned long start)
 {
 	unsigned long current;
diff --git a/src/mainboard/lenovo/x60/acpi_tables.c b/src/mainboard/lenovo/x60/acpi_tables.c
index 412ec47..db86317 100644
--- a/src/mainboard/lenovo/x60/acpi_tables.c
+++ b/src/mainboard/lenovo/x60/acpi_tables.c
@@ -135,7 +135,7 @@ unsigned long acpi_fill_srat(unsigned long current)
 
 void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
 
-#define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
 unsigned long write_acpi_tables(unsigned long start)
 {
 	unsigned long current;
diff --git a/src/mainboard/msi/ms7135/acpi_tables.c b/src/mainboard/msi/ms7135/acpi_tables.c
index 0f81cc6..4a3fbe2 100644
--- a/src/mainboard/msi/ms7135/acpi_tables.c
+++ b/src/mainboard/msi/ms7135/acpi_tables.c
@@ -186,7 +186,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
diff --git a/src/mainboard/msi/ms9652_fam10/acpi_tables.c b/src/mainboard/msi/ms9652_fam10/acpi_tables.c
index 25be32a..e905d9f 100644
--- a/src/mainboard/msi/ms9652_fam10/acpi_tables.c
+++ b/src/mainboard/msi/ms9652_fam10/acpi_tables.c
@@ -120,7 +120,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/roda/rk886ex/acpi_tables.c b/src/mainboard/roda/rk886ex/acpi_tables.c
index 412ec47..db86317 100644
--- a/src/mainboard/roda/rk886ex/acpi_tables.c
+++ b/src/mainboard/roda/rk886ex/acpi_tables.c
@@ -135,7 +135,7 @@ unsigned long acpi_fill_srat(unsigned long current)
 
 void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
 
-#define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
 unsigned long write_acpi_tables(unsigned long start)
 {
 	unsigned long current;
diff --git a/src/mainboard/siemens/sitemp_g1p1/acpi_tables.c b/src/mainboard/siemens/sitemp_g1p1/acpi_tables.c
index b79372a..bae2782 100644
--- a/src/mainboard/siemens/sitemp_g1p1/acpi_tables.c
+++ b/src/mainboard/siemens/sitemp_g1p1/acpi_tables.c
@@ -174,7 +174,7 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_ta
 	return (unsigned long) (acpigen_get_current());
 }
 
-#define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
 
 unsigned long write_acpi_tables(unsigned long start)
 {
diff --git a/src/mainboard/supermicro/h8qgi/acpi_tables.c b/src/mainboard/supermicro/h8qgi/acpi_tables.c
index 58215fc..505b87a 100644
--- a/src/mainboard/supermicro/h8qgi/acpi_tables.c
+++ b/src/mainboard/supermicro/h8qgi/acpi_tables.c
@@ -195,7 +195,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -237,7 +237,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	 * We explicitly add these tables later on:
 	 */
 #ifdef UNUSED_CODE // Don't need HPET table. we have one in dsdt
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -246,7 +246,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -254,14 +254,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* HEST */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	hest = (acpi_hest_t *)current;
 	acpi_write_hest((void *)current);
 	acpi_add_table(rsdp, (void *)current);
 	current += ((acpi_header_t *)current)->length;
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT);
 	if (srat != NULL) {
@@ -273,7 +273,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT);
 	if (slit != NULL) {
@@ -285,7 +285,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	}
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA ALIB SSDT at %lx\n", current);
 	alib = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_ALIB);
 	if (alib != NULL) {
@@ -299,7 +299,7 @@ unsigned long write_acpi_tables(unsigned long start)
 
 	/* The DSDT needs additional work for the AGESA SSDT Pstate table */
 	/* Keep the comment for a while. */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * AGESA SSDT Pstate at %lx\n", current);
 	ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
 	if (ssdt != NULL) {
@@ -311,7 +311,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		printk(BIOS_DEBUG, "  AGESA SSDT Pstate table NULL. Skipping.\n");
 	}
 
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:  * coreboot TOM SSDT2 at %lx\n", current);
 	ssdt2 = (acpi_header_t *) current;
 	acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
diff --git a/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c b/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c
index 2b2435f..854004e 100644
--- a/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c
+++ b/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c
@@ -123,7 +123,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();	/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16 bytes */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
@@ -143,7 +143,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	/*
 	 * We explicitly add these tables later on:
 	 */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * HPET at %lx\n", current);
 	hpet = (acpi_hpet_t *) current;
 	current += sizeof(acpi_hpet_t);
@@ -151,7 +151,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, hpet);
 
 	/* If we want to use HPET Timers Linux wants an MADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * MADT at %lx\n",current);
 	madt = (acpi_madt_t *) current;
 	acpi_create_madt(madt);
@@ -159,7 +159,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, madt);
 
 	/* SRAT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * SRAT at %lx\n", current);
 	srat = (acpi_srat_t *) current;
 	acpi_create_srat(srat);
@@ -167,7 +167,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, srat);
 
 	/* SLIT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:   * SLIT at %lx\n", current);
 	slit = (acpi_slit_t *) current;
 	acpi_create_slit(slit);
@@ -175,7 +175,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_add_table(rsdp, slit);
 
 	/* SSDT */
-	current = (current + 0x0f) & -0x10;
+	current = ALIGN(current, 16);
 	printk(BIOS_DEBUG, "ACPI:    * SSDT at %lx\n", current);
 	ssdt = (acpi_header_t *)current;
 	memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
@@ -204,7 +204,7 @@ unsigned long write_acpi_tables(unsigned long start)
 		} else {
 			c = (u8) ('A' + i - 1 - 6);
 		}
-		current = (current + 0x07) & -0x08;
+		current = ALIGN(current, 8);
 		printk(BIOS_DEBUG, "ACPI:    * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt
 		ssdtx = (acpi_header_t *)current;
 		switch (sysconf.hcid[i]) {
@@ -233,7 +233,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
 	/* DSDT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * DSDT at %lx\n", current);
 	dsdt = (acpi_header_t *)current; // it will used by fadt
 	memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
@@ -242,14 +242,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n",dsdt,dsdt->length);
 
 	/* FACS */ // it needs 64 bit alignment
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:	* FACS at %lx\n", current);
 	facs = (acpi_facs_t *) current; // it will be used by fadt
 	current += sizeof(acpi_facs_t);
 	acpi_create_facs(facs);
 
 	/* FADT */
-	current = (current + 0x07) & -0x08;
+	current = ALIGN(current, 8);
 	printk(BIOS_DEBUG, "ACPI:    * FADT at %lx\n", current);
 	fadt = (acpi_fadt_t *) current;
 	current += sizeof(acpi_fadt_t);
diff --git a/src/mainboard/technexion/tim5690/acpi_tables.c b/src/mainboard/technexion/tim5690/acpi_tables.c
index 787a3e5..30a1f80 100644
--- a/src/mainboard/technexion/tim5690/acpi_tables.c
+++ b/src/mainboard/technexion/tim5690/acpi_tables.c
@@ -112,7 +112,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();		/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16byte */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/technexion/tim8690/acpi_tables.c b/src/mainboard/technexion/tim8690/acpi_tables.c
index 787a3e5..30a1f80 100644
--- a/src/mainboard/technexion/tim8690/acpi_tables.c
+++ b/src/mainboard/technexion/tim8690/acpi_tables.c
@@ -112,7 +112,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	get_bus_conf();		/* it will get sblk, pci1234, hcdn, and sbdn */
 
 	/* Align ACPI tables to 16byte */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/tyan/s2891/acpi_tables.c b/src/mainboard/tyan/s2891/acpi_tables.c
index 403cca5..d3cb214 100644
--- a/src/mainboard/tyan/s2891/acpi_tables.c
+++ b/src/mainboard/tyan/s2891/acpi_tables.c
@@ -110,7 +110,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
diff --git a/src/mainboard/tyan/s2892/acpi_tables.c b/src/mainboard/tyan/s2892/acpi_tables.c
index 403cca5..d3cb214 100644
--- a/src/mainboard/tyan/s2892/acpi_tables.c
+++ b/src/mainboard/tyan/s2892/acpi_tables.c
@@ -110,7 +110,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
diff --git a/src/mainboard/tyan/s2895/acpi_tables.c b/src/mainboard/tyan/s2895/acpi_tables.c
index 1f2f5b1..8f69c70 100644
--- a/src/mainboard/tyan/s2895/acpi_tables.c
+++ b/src/mainboard/tyan/s2895/acpi_tables.c
@@ -135,7 +135,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
diff --git a/src/mainboard/via/epia-m/acpi_tables.c b/src/mainboard/via/epia-m/acpi_tables.c
index 9e42bc2..b174bae 100644
--- a/src/mainboard/via/epia-m/acpi_tables.c
+++ b/src/mainboard/via/epia-m/acpi_tables.c
@@ -47,7 +47,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16byte */
-	start   = ( start + 0x0f ) & -0x10;
+	start   = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/via/epia-m700/acpi_tables.c b/src/mainboard/via/epia-m700/acpi_tables.c
index 16c0b46..e780c4a 100644
--- a/src/mainboard/via/epia-m700/acpi_tables.c
+++ b/src/mainboard/via/epia-m700/acpi_tables.c
@@ -132,7 +132,7 @@ unsigned long write_acpi_tables(unsigned long start)
 #endif
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/via/epia-n/acpi_tables.c b/src/mainboard/via/epia-n/acpi_tables.c
index b4966bb..84aba7b 100644
--- a/src/mainboard/via/epia-n/acpi_tables.c
+++ b/src/mainboard/via/epia-n/acpi_tables.c
@@ -129,7 +129,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16byte */
-	start   = ( start + 0x0f ) & -0x10;
+	start   = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
diff --git a/src/mainboard/via/vt8454c/acpi_tables.c b/src/mainboard/via/vt8454c/acpi_tables.c
index 4b18b69..a191ada 100644
--- a/src/mainboard/via/vt8454c/acpi_tables.c
+++ b/src/mainboard/via/vt8454c/acpi_tables.c
@@ -128,7 +128,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16byte */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
diff --git a/src/northbridge/amd/amdfam10/acpi.c b/src/northbridge/amd/amdfam10/acpi.c
index 7929427..87c2d8c 100644
--- a/src/northbridge/amd/amdfam10/acpi.c
+++ b/src/northbridge/amd/amdfam10/acpi.c
@@ -362,7 +362,7 @@ unsigned long acpi_add_ssdt_pstates(acpi_rsdp_t *rsdp, unsigned long current)
 		}
 		printk(BIOS_DEBUG, "ACPI: pstate cpu_index=%02x, node_id=%02x, core_id=%02x\n", cpu_index, cpu->path.apic.node_id, cpu->path.apic.core_id);
 
-		current	  = ( current + 0x0f) & -0x10;
+		current	  = ALIGN(current, 16);
 		ssdt = (acpi_header_t *)current;
 		memcpy(ssdt, AmlCode_sspr, sizeof(acpi_header_t));
 		current += ssdt->length;
diff --git a/src/southbridge/intel/i82371eb/acpi_tables.c b/src/southbridge/intel/i82371eb/acpi_tables.c
index 84bb5b7..cdcf19a 100644
--- a/src/southbridge/intel/i82371eb/acpi_tables.c
+++ b/src/southbridge/intel/i82371eb/acpi_tables.c
@@ -113,7 +113,7 @@ unsigned long __attribute__((weak)) write_acpi_tables(unsigned long start)
 	acpi_header_t *dsdt;
 
 	/* Align ACPI tables to 16 byte. */
-	start = (start + 0x0f) & -0x10;
+	start = ALIGN(start, 16);
 	current = start;
 
 	printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);




More information about the coreboot mailing list