From 7b23ae0e8938eb71453cbc28c2cc74c14a4039ae Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Fri, 4 Jul 2014 16:14:37 +0300 Subject: AGESA: Trace execution with AGESAWRAPPER() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement logging just once to have uniform output. Change-Id: I8db694a3bf6b1af459bdf98f7acb99edf4dd07f7 Signed-off-by: Kyösti Mälkki Reviewed-on: http://review.coreboot.org/6180 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan --- src/northbridge/amd/agesa/agesawrapper_call.h | 36 ++++++++++++++++++++++ src/northbridge/amd/agesa/family10/northbridge.c | 6 +--- src/northbridge/amd/agesa/family12/northbridge.c | 18 ++--------- src/northbridge/amd/agesa/family14/northbridge.c | 13 ++------ src/northbridge/amd/agesa/family15/northbridge.c | 7 ++--- src/northbridge/amd/agesa/family15tn/northbridge.c | 15 +++------ src/northbridge/amd/agesa/family16kb/northbridge.c | 15 +++------ 7 files changed, 53 insertions(+), 57 deletions(-) create mode 100644 src/northbridge/amd/agesa/agesawrapper_call.h (limited to 'src/northbridge/amd/agesa') diff --git a/src/northbridge/amd/agesa/agesawrapper_call.h b/src/northbridge/amd/agesa/agesawrapper_call.h new file mode 100644 index 0000000000..e654b8a4b6 --- /dev/null +++ b/src/northbridge/amd/agesa/agesawrapper_call.h @@ -0,0 +1,36 @@ +/* + * This file is part of the coreboot project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _AGESAWRAPPER_CALL_H_ +#define _AGESAWRAPPER_CALL_H_ + +#include +#include +#include "AGESA.h" + +static inline u32 do_agesawrapper(AGESA_STATUS (*func)(void), const char *name) +{ + AGESA_STATUS ret; + printk(BIOS_DEBUG, "agesawrapper_%s() entry\n", name); + ret = func(); + printk(BIOS_DEBUG, "agesawrapper_%s() AGESA_STATUS = %x\n", name, ret); + return (u32)ret; +} + +#define AGESAWRAPPER(func) do_agesawrapper(agesawrapper_ ## func, #func) + +#endif diff --git a/src/northbridge/amd/agesa/family10/northbridge.c b/src/northbridge/amd/agesa/family10/northbridge.c index 4b2d003462..d3d64791c5 100644 --- a/src/northbridge/amd/agesa/family10/northbridge.c +++ b/src/northbridge/amd/agesa/family10/northbridge.c @@ -831,13 +831,9 @@ static void amdfam10_domain_read_resources(device_t dev) static void amdfam10_domain_enable_resources(device_t dev) { - u32 val; /* Must be called after PCI enumeration and resource allocation */ printk(BIOS_DEBUG, "\nFam10 - %s: AmdInitMid.\n", __func__); - val = agesawrapper_amdinitmid(); - if (val) { - printk(BIOS_DEBUG, "agesawrapper_amdinitmid failed: %x \n", val); - } + AGESAWRAPPER(amdinitmid); printk(BIOS_DEBUG, " ader - leaving %s.\n", __func__); } diff --git a/src/northbridge/amd/agesa/family12/northbridge.c b/src/northbridge/amd/agesa/family12/northbridge.c index 7d71624b6f..65212dce10 100644 --- a/src/northbridge/amd/agesa/family12/northbridge.c +++ b/src/northbridge/amd/agesa/family12/northbridge.c @@ -36,6 +36,7 @@ #include "northbridge.h" #include "sb_cimx.h" #include "agesawrapper.h" +#include //#define FX_DEVS NODE_NUMS #define FX_DEVS 1 @@ -766,15 +767,9 @@ printk(BIOS_DEBUG, " adsr - leaving this lovely routine.\n"); static void domain_enable_resources(device_t dev) { -// u32 val; /* Must be called after PCI enumeration and resource allocation */ -// printk(BIOS_DEBUG, "\nFam12h - northbridge.c - %s - agesawrapper_amdinitmid - Start.\n",__func__); printk(BIOS_DEBUG, "\nFam12h - northbridge.c - %s - Start.\n",__func__); -// val = agesawrapper_amdinitmid (); -// if(val) { -// printk(BIOS_DEBUG, "agesawrapper_amdinitmid failed: %x \n", val); -// } -// printk(BIOS_DEBUG, "Fam12h - northbridge.c - %s - agesawrapper_amdinitmid - End.\n",__func__); +// AGESAWRAPPER(amdinitmid); printk(BIOS_DEBUG, "Fam12h - northbridge.c - %s - End.\n",__func__); } @@ -810,8 +805,6 @@ static void cpu_bus_set_resources(device_t dev) static void cpu_bus_init(device_t dev) { - u32 val; - printk(BIOS_DEBUG, "\nFam12h - northbridge.c - %s - Start.\n",__func__); initialize_cpus(dev->link_list); @@ -830,12 +823,7 @@ static void cpu_bus_init(device_t dev) #endif // #if CONFIG_SOUTHBRIDGE_AMD_CIMX_SB900 /* Must be called after PCI enumeration and resource allocation */ - printk(BIOS_DEBUG, "\nFam12h - northbridge.c - %s - agesawrapper_amdinitmid - Start.\n",__func__); - val = agesawrapper_amdinitmid (); - if(val) { - printk(BIOS_DEBUG, "agesawrapper_amdinitmid failed: %x \n", val); - } - printk(BIOS_DEBUG, "Fam12h - northbridge.c - %s - agesawrapper_amdinitmid - End.\n",__func__); + AGESAWRAPPER(amdinitmid); printk(BIOS_DEBUG, "Fam12h - northbridge.c - %s - End.\n",__func__); } diff --git a/src/northbridge/amd/agesa/family14/northbridge.c b/src/northbridge/amd/agesa/family14/northbridge.c index 41de9cc297..57502e915b 100644 --- a/src/northbridge/amd/agesa/family14/northbridge.c +++ b/src/northbridge/amd/agesa/family14/northbridge.c @@ -35,6 +35,7 @@ #include #include "agesawrapper.h" +#include #include "northbridge.h" #if CONFIG_AMD_SB_CIMX #include @@ -758,8 +759,6 @@ static void domain_set_resources(device_t dev) static void domain_enable_resources(device_t dev) { - u32 val; - #if CONFIG_AMD_SB_CIMX if (!acpi_is_wakeup_s3()) { sb_After_Pci_Init(); @@ -772,14 +771,8 @@ static void domain_enable_resources(device_t dev) /* Must be called after PCI enumeration and resource allocation */ printk(BIOS_DEBUG, "\nFam14h - %s\n", __func__); - if (!acpi_is_wakeup_s3()) { - printk(BIOS_DEBUG, "agesawrapper_amdinitmid "); - val = agesawrapper_amdinitmid (); - if (val) - printk(BIOS_DEBUG, "error level: %x \n", val); - else - printk(BIOS_DEBUG, "passed.\n"); - } + if (!acpi_is_wakeup_s3()) + AGESAWRAPPER(amdinitmid); printk(BIOS_DEBUG, " ader - leaving domain_enable_resources.\n"); } diff --git a/src/northbridge/amd/agesa/family15/northbridge.c b/src/northbridge/amd/agesa/family15/northbridge.c index eada06f415..34f58d33a2 100644 --- a/src/northbridge/amd/agesa/family15/northbridge.c +++ b/src/northbridge/amd/agesa/family15/northbridge.c @@ -40,6 +40,7 @@ #include #include #include "agesawrapper.h" +#include #include "northbridge.h" #define MAX_NODE_NUMS (MAX_NODES * MAX_DIES) @@ -588,13 +589,9 @@ static void domain_read_resources(device_t dev) static void domain_enable_resources(device_t dev) { - u32 val; /* Must be called after PCI enumeration and resource allocation */ printk(BIOS_DEBUG, "\nFam15 - %s: AmdInitMid.\n", __func__); - val = agesawrapper_amdinitmid(); - if (val) { - printk(BIOS_DEBUG, "agesawrapper_amdinitmid failed: %x \n", val); - } + AGESAWRAPPER(amdinitmid); printk(BIOS_DEBUG, " Fam15 - leaving %s.\n", __func__); } diff --git a/src/northbridge/amd/agesa/family15tn/northbridge.c b/src/northbridge/amd/agesa/family15tn/northbridge.c index 8241f54694..3e2c6350a2 100644 --- a/src/northbridge/amd/agesa/family15tn/northbridge.c +++ b/src/northbridge/amd/agesa/family15tn/northbridge.c @@ -41,6 +41,7 @@ #include #include #include "agesawrapper.h" +#include #include "northbridge.h" #define MAX_NODE_NUMS (MAX_NODES * MAX_DIES) @@ -555,20 +556,12 @@ static void domain_read_resources(device_t dev) static void domain_enable_resources(device_t dev) { - u32 val; if (acpi_is_wakeup_s3()) - agesawrapper_fchs3laterestore(); + AGESAWRAPPER(fchs3laterestore); /* Must be called after PCI enumeration and resource allocation */ - printk(BIOS_DEBUG, "\nFam15 - %s: AmdInitMid.\n", __func__); - if (!acpi_is_wakeup_s3()) { - printk(BIOS_DEBUG, "agesawrapper_amdinitmid "); - val = agesawrapper_amdinitmid (); - if (val) - printk(BIOS_DEBUG, "error level: %x \n", val); - else - printk(BIOS_DEBUG, "passed.\n"); - } + if (!acpi_is_wakeup_s3()) + AGESAWRAPPER(amdinitmid); printk(BIOS_DEBUG, " ader - leaving %s.\n", __func__); } diff --git a/src/northbridge/amd/agesa/family16kb/northbridge.c b/src/northbridge/amd/agesa/family16kb/northbridge.c index 5b431411a2..5572282799 100644 --- a/src/northbridge/amd/agesa/family16kb/northbridge.c +++ b/src/northbridge/amd/agesa/family16kb/northbridge.c @@ -41,6 +41,7 @@ #include #include #include "agesawrapper.h" +#include #include "northbridge.h" #define MAX_NODE_NUMS (MAX_NODES * MAX_DIES) @@ -559,20 +560,12 @@ static void domain_read_resources(device_t dev) static void domain_enable_resources(device_t dev) { - u32 val; if (acpi_is_wakeup_s3()) - agesawrapper_fchs3laterestore(); + AGESAWRAPPER(fchs3laterestore); /* Must be called after PCI enumeration and resource allocation */ - printk(BIOS_DEBUG, "\nFam16 - domain_enable_resources: AmdInitMid.\n"); - if (!acpi_is_wakeup_s3()) { - printk(BIOS_DEBUG, "agesawrapper_amdinitmid "); - val = agesawrapper_amdinitmid (); - if (val) - printk(BIOS_DEBUG, "error level: %x \n", val); - else - printk(BIOS_DEBUG, "passed.\n"); - } + if (!acpi_is_wakeup_s3()) + AGESAWRAPPER(amdinitmid); printk(BIOS_DEBUG, " ader - leaving domain_enable_resources.\n"); } -- cgit v1.2.3