summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2012-04-20 19:19:47 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2012-04-20 21:18:02 +0200
commit26b00e6d3954dcfa00ee4d7c874161b2fbdd2ce2 (patch)
treecc4549a622b5cd43578b0cabe2cfb622114c4b11 /src/mainboard
parentd6e4d518b1dbfdcfbea7b56113530900ba3e03b1 (diff)
downloadcoreboot-26b00e6d3954dcfa00ee4d7c874161b2fbdd2ce2.tar.xz
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@georgi-clan.de> Reviewed-on: http://review.coreboot.org/910 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/advansus/a785e-i/acpi_tables.c20
-rw-r--r--src/mainboard/amd/bimini_fam10/acpi_tables.c20
-rw-r--r--src/mainboard/amd/dbm690t/acpi_tables.c2
-rw-r--r--src/mainboard/amd/dinar/acpi_tables.c18
-rw-r--r--src/mainboard/amd/inagua/acpi_tables.c24
-rw-r--r--src/mainboard/amd/mahogany/acpi_tables.c4
-rw-r--r--src/mainboard/amd/mahogany_fam10/acpi_tables.c18
-rw-r--r--src/mainboard/amd/persimmon/acpi_tables.c24
-rw-r--r--src/mainboard/amd/pistachio/acpi_tables.c2
-rw-r--r--src/mainboard/amd/serengeti_cheetah/acpi_tables.c4
-rw-r--r--src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c20
-rw-r--r--src/mainboard/amd/south_station/acpi_tables.c24
-rw-r--r--src/mainboard/amd/tilapia_fam10/acpi_tables.c20
-rw-r--r--src/mainboard/amd/torpedo/acpi_tables.c18
-rw-r--r--src/mainboard/amd/union_station/acpi_tables.c24
-rw-r--r--src/mainboard/aopen/dxplplusu/acpi_tables.c2
-rw-r--r--src/mainboard/asrock/939a785gmh/acpi_tables.c4
-rw-r--r--src/mainboard/asrock/e350m1/acpi_tables.c24
-rw-r--r--src/mainboard/asus/a8v-e_deluxe/acpi_tables.c2
-rw-r--r--src/mainboard/asus/a8v-e_se/acpi_tables.c2
-rw-r--r--src/mainboard/asus/k8v-x/acpi_tables.c2
-rw-r--r--src/mainboard/asus/m2v-mx_se/acpi_tables.c2
-rw-r--r--src/mainboard/asus/m2v/acpi_tables.c2
-rw-r--r--src/mainboard/asus/m4a78-em/acpi_tables.c20
-rw-r--r--src/mainboard/asus/m4a785-m/acpi_tables.c18
-rw-r--r--src/mainboard/asus/m5a88-v/acpi_tables.c20
-rw-r--r--src/mainboard/avalue/eax-785e/acpi_tables.c20
-rw-r--r--src/mainboard/getac/p470/acpi_tables.c2
-rw-r--r--src/mainboard/gigabyte/m57sli/acpi_tables.c2
-rw-r--r--src/mainboard/gigabyte/ma785gmt/acpi_tables.c20
-rw-r--r--src/mainboard/gigabyte/ma78gm/acpi_tables.c20
-rw-r--r--src/mainboard/ibase/mb899/acpi_tables.c2
-rw-r--r--src/mainboard/iei/kino-780am2-fam10/acpi_tables.c18
-rw-r--r--src/mainboard/intel/d945gclf/acpi_tables.c2
-rw-r--r--src/mainboard/intel/eagleheights/acpi_tables.c2
-rw-r--r--src/mainboard/intel/xe7501devkit/acpi_tables.c2
-rw-r--r--src/mainboard/iwave/iWRainbowG6/acpi_tables.c2
-rw-r--r--src/mainboard/iwill/dk8_htx/acpi_tables.c4
-rw-r--r--src/mainboard/jetway/pa78vm5/acpi_tables.c20
-rw-r--r--src/mainboard/kontron/986lcd-m/acpi_tables.c2
-rw-r--r--src/mainboard/kontron/kt690/acpi_tables.c2
-rw-r--r--src/mainboard/lenovo/t60/acpi_tables.c2
-rw-r--r--src/mainboard/lenovo/x60/acpi_tables.c2
-rw-r--r--src/mainboard/msi/ms7135/acpi_tables.c2
-rw-r--r--src/mainboard/msi/ms9652_fam10/acpi_tables.c2
-rw-r--r--src/mainboard/roda/rk886ex/acpi_tables.c2
-rw-r--r--src/mainboard/siemens/sitemp_g1p1/acpi_tables.c2
-rw-r--r--src/mainboard/supermicro/h8qgi/acpi_tables.c18
-rw-r--r--src/mainboard/supermicro/h8scm_fam10/acpi_tables.c20
-rw-r--r--src/mainboard/technexion/tim5690/acpi_tables.c2
-rw-r--r--src/mainboard/technexion/tim8690/acpi_tables.c2
-rw-r--r--src/mainboard/tyan/s2891/acpi_tables.c2
-rw-r--r--src/mainboard/tyan/s2892/acpi_tables.c2
-rw-r--r--src/mainboard/tyan/s2895/acpi_tables.c2
-rw-r--r--src/mainboard/via/epia-m/acpi_tables.c2
-rw-r--r--src/mainboard/via/epia-m700/acpi_tables.c2
-rw-r--r--src/mainboard/via/epia-n/acpi_tables.c2
-rw-r--r--src/mainboard/via/vt8454c/acpi_tables.c2
58 files changed, 264 insertions, 264 deletions
diff --git a/src/mainboard/advansus/a785e-i/acpi_tables.c b/src/mainboard/advansus/a785e-i/acpi_tables.c
index 33a0540dc3..9642bb4e19 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 d7a1f24e6c..c079b709eb 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 9f91ee8496..56ba93f3fd 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 db01d79f52..90bd54665d 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 a4504d4d64..0b8732ae74 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 df7a48bd84..65d336cda4 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 7e89881e95..5e48bbe497 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 cb415fdfe9..81936da912 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 3f44b9df09..47f3be5a73 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 47bd34b90e..fb31750077 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 2c112f92a8..994034ba82 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 5c958a0ec0..92da9fc8eb 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 c44fe33374..d9b9dd0fed 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 2e04c57352..9c432528ee 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 5c958a0ec0..92da9fc8eb 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 b7c789a55b..352708ee2c 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 c0d8691afe..41f417335f 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 5c958a0ec0..92da9fc8eb 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 fe8d4757ee..a991435d8f 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 218f3bb8bc..24ac1a9a76 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 571d13618f..0fe83ea26e 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 3cdde418a7..625062999d 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 73f82d8f69..468b2ebdae 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 3260322638..fb3228ba56 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 47321b3620..79f717049a 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 33a0540dc3..9642bb4e19 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 33a0540dc3..9642bb4e19 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 676d6610be..a4ca0a8eba 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 513e47896a..5d1c275809 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 244c44a3a5..8f0acce4e1 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 244c44a3a5..8f0acce4e1 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 16ee302784..9ff5b1da27 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 7e89881e95..5e48bbe497 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 0435bddc92..d32dc811f8 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 123ddbcb6b..ce67645ca8 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 9324144026..b3c20ba797 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 a30479b3b5..3951cff17e 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 ac1c692580..b02121477d 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 a043100b67..e44401404c 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 16ee302784..9ff5b1da27 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 787a3e51ba..30a1f804e7 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 412ec47ed0..db86317c97 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 412ec47ed0..db86317c97 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 0f81cc69ab..4a3fbe296b 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 25be32ae4c..e905d9f4c5 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 412ec47ed0..db86317c97 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 b79372aee7..bae2782399 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 58215fc5ed..505b87ab2a 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 2b2435fb8c..854004e3f8 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 787a3e51ba..30a1f804e7 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 787a3e51ba..30a1f804e7 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 403cca56e8..d3cb214aac 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 403cca56e8..d3cb214aac 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 1f2f5b148b..8f69c7006a 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 9e42bc25a5..b174bae958 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 16c0b46b43..e780c4a020 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 b4966bb1db..84aba7b430 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 4b18b69b4c..a191ada0f4 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);