From b0a9c5ccf31514630755e9a5d15204a55a47740f Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Fri, 7 Oct 2011 23:01:55 +0200 Subject: mptable: Refactor mptable generation some more The last couple of lines of every mptable function were mostly identical. Refactor into common code, a new function mptable_finalize. Coccinelle script: @@ identifier mc; @@ ( -mc->mpe_checksum = smp_compute_checksum(smp_next_mpc_entry(mc), mc->mpe_length); -mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length); -printk(BIOS_DEBUG, "Wrote the mp table end at: %p - %p\n", mc, smp_next_mpe_entry(mc)); -return smp_next_mpe_entry(mc); +return mptable_finalize(mc); | -mc->mpe_checksum = smp_compute_checksum(smp_next_mpc_entry(mc), mc->mpe_length); -mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length); -return smp_next_mpe_entry(mc); +return mptable_finalize(mc); ) Change-Id: Ib2270d800bdd486c5eb49b328544d36bd2298c9e Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/246 Tested-by: build bot (Jenkins) Reviewed-by: Marc Jones --- src/mainboard/asus/a8n_e/mptable.c | 7 +------ src/mainboard/asus/a8v-e_deluxe/mptable.c | 6 +----- src/mainboard/asus/a8v-e_se/mptable.c | 6 +----- src/mainboard/asus/m2n-e/mptable.c | 7 +------ src/mainboard/asus/m2v/mptable.c | 6 +----- src/mainboard/asus/m4a78-em/mptable.c | 7 +------ src/mainboard/asus/m4a785-m/mptable.c | 7 +------ src/mainboard/asus/p2b-d/mptable.c | 7 +------ src/mainboard/asus/p2b-ds/mptable.c | 7 +------ 9 files changed, 9 insertions(+), 51 deletions(-) (limited to 'src/mainboard/asus') diff --git a/src/mainboard/asus/a8n_e/mptable.c b/src/mainboard/asus/a8n_e/mptable.c index d790c76ee8..349ae74979 100644 --- a/src/mainboard/asus/a8n_e/mptable.c +++ b/src/mainboard/asus/a8n_e/mptable.c @@ -113,12 +113,7 @@ static void *smp_write_config_table(void *v) /* There is no extension information... */ /* Compute the checksums. */ - mc->mpe_checksum = - smp_compute_checksum(smp_next_mpc_entry(mc), mc->mpe_length); - mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length); - printk(BIOS_DEBUG, "Wrote the mp table end at: %p - %p\n", - mc, smp_next_mpe_entry(mc)); - return smp_next_mpe_entry(mc); + return mptable_finalize(mc); } unsigned long write_smp_table(unsigned long addr) diff --git a/src/mainboard/asus/a8v-e_deluxe/mptable.c b/src/mainboard/asus/a8v-e_deluxe/mptable.c index 6c67533af5..999dd6cd33 100644 --- a/src/mainboard/asus/a8v-e_deluxe/mptable.c +++ b/src/mainboard/asus/a8v-e_deluxe/mptable.c @@ -105,11 +105,7 @@ static void *smp_write_config_table(void *v) /* There is no extension information... */ /* Compute the checksums. */ - mc->mpe_checksum = smp_compute_checksum(smp_next_mpc_entry(mc), - mc->mpe_length); - mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length); - - return smp_next_mpe_entry(mc); + return mptable_finalize(mc); } unsigned long write_smp_table(unsigned long addr) diff --git a/src/mainboard/asus/a8v-e_se/mptable.c b/src/mainboard/asus/a8v-e_se/mptable.c index 6c67533af5..999dd6cd33 100644 --- a/src/mainboard/asus/a8v-e_se/mptable.c +++ b/src/mainboard/asus/a8v-e_se/mptable.c @@ -105,11 +105,7 @@ static void *smp_write_config_table(void *v) /* There is no extension information... */ /* Compute the checksums. */ - mc->mpe_checksum = smp_compute_checksum(smp_next_mpc_entry(mc), - mc->mpe_length); - mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length); - - return smp_next_mpe_entry(mc); + return mptable_finalize(mc); } unsigned long write_smp_table(unsigned long addr) diff --git a/src/mainboard/asus/m2n-e/mptable.c b/src/mainboard/asus/m2n-e/mptable.c index 716c754eec..29b9d07e44 100644 --- a/src/mainboard/asus/m2n-e/mptable.c +++ b/src/mainboard/asus/m2n-e/mptable.c @@ -94,12 +94,7 @@ static void *smp_write_config_table(void *v) mptable_lintsrc(mc, bus_isa); /* Compute the checksums. */ - mc->mpe_checksum = - smp_compute_checksum(smp_next_mpc_entry(mc), mc->mpe_length); - mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length); - printk(BIOS_DEBUG, "Wrote the mp table end at: %p - %p\n", - mc, smp_next_mpe_entry(mc)); - return smp_next_mpe_entry(mc); + return mptable_finalize(mc); } unsigned long write_smp_table(unsigned long addr) diff --git a/src/mainboard/asus/m2v/mptable.c b/src/mainboard/asus/m2v/mptable.c index 9dd57f5c1d..5dc340a9ba 100644 --- a/src/mainboard/asus/m2v/mptable.c +++ b/src/mainboard/asus/m2v/mptable.c @@ -136,11 +136,7 @@ static void *smp_write_config_table(void *v) /* There is no extension information... */ /* Compute the checksums. */ - mc->mpe_checksum = smp_compute_checksum(smp_next_mpc_entry(mc), - mc->mpe_length); - mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length); - - return smp_next_mpe_entry(mc); + return mptable_finalize(mc); } unsigned long write_smp_table(unsigned long addr) diff --git a/src/mainboard/asus/m4a78-em/mptable.c b/src/mainboard/asus/m4a78-em/mptable.c index 024e87a015..4bf3480fcf 100644 --- a/src/mainboard/asus/m4a78-em/mptable.c +++ b/src/mainboard/asus/m4a78-em/mptable.c @@ -160,12 +160,7 @@ static void *smp_write_config_table(void *v) /* There is no extension information... */ /* Compute the checksums */ - mc->mpe_checksum = - smp_compute_checksum(smp_next_mpc_entry(mc), mc->mpe_length); - mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length); - printk(BIOS_DEBUG, "Wrote the mp table end at: %p - %p\n", - mc, smp_next_mpe_entry(mc)); - return smp_next_mpe_entry(mc); + return mptable_finalize(mc); } unsigned long write_smp_table(unsigned long addr) diff --git a/src/mainboard/asus/m4a785-m/mptable.c b/src/mainboard/asus/m4a785-m/mptable.c index 024e87a015..4bf3480fcf 100644 --- a/src/mainboard/asus/m4a785-m/mptable.c +++ b/src/mainboard/asus/m4a785-m/mptable.c @@ -160,12 +160,7 @@ static void *smp_write_config_table(void *v) /* There is no extension information... */ /* Compute the checksums */ - mc->mpe_checksum = - smp_compute_checksum(smp_next_mpc_entry(mc), mc->mpe_length); - mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length); - printk(BIOS_DEBUG, "Wrote the mp table end at: %p - %p\n", - mc, smp_next_mpe_entry(mc)); - return smp_next_mpe_entry(mc); + return mptable_finalize(mc); } unsigned long write_smp_table(unsigned long addr) diff --git a/src/mainboard/asus/p2b-d/mptable.c b/src/mainboard/asus/p2b-d/mptable.c index 7030023f33..43f3a85f1e 100644 --- a/src/mainboard/asus/p2b-d/mptable.c +++ b/src/mainboard/asus/p2b-d/mptable.c @@ -52,12 +52,7 @@ static void *smp_write_config_table(void *v) mptable_lintsrc(mc, isa_bus); /* Compute the checksums. */ - mc->mpe_checksum = - smp_compute_checksum(smp_next_mpc_entry(mc), mc->mpe_length); - mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length); - printk(BIOS_DEBUG, "Wrote the mp table end at: %p - %p\n", - mc, smp_next_mpe_entry(mc)); - return smp_next_mpe_entry(mc); + return mptable_finalize(mc); } unsigned long write_smp_table(unsigned long addr) diff --git a/src/mainboard/asus/p2b-ds/mptable.c b/src/mainboard/asus/p2b-ds/mptable.c index 31d360dfde..153c62c5c6 100644 --- a/src/mainboard/asus/p2b-ds/mptable.c +++ b/src/mainboard/asus/p2b-ds/mptable.c @@ -53,12 +53,7 @@ static void *smp_write_config_table(void *v) mptable_lintsrc(mc, 0x1); /* Compute the checksums. */ - mc->mpe_checksum = - smp_compute_checksum(smp_next_mpc_entry(mc), mc->mpe_length); - mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length); - printk(BIOS_DEBUG, "Wrote the mp table end at: %p - %p\n", - mc, smp_next_mpe_entry(mc)); - return smp_next_mpe_entry(mc); + return mptable_finalize(mc); } unsigned long write_smp_table(unsigned long addr) -- cgit v1.2.3