soc/intel/xeon_sp: Move function debug macros

Move the macros for printing debug information to debug.h in the
common console include directory and device include file.
These are available if the platform selects DEFAULT_CONSOLE_LOGLEVEL_8.

The macros could be used by any platform.

Change-Id: Ie237bdf8cdc42c76f38a0c820fdc92e81095f47c
Signed-off-by: Marc Jones <marcjones@sysproconsulting.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/46093
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jay Talbott <JayTalbott@sysproconsulting.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Marc Jones 2020-10-12 11:58:46 -06:00 committed by Marc Jones
parent 5b5c52e8de
commit 8b522db474
9 changed files with 51 additions and 31 deletions

View File

@ -1123,6 +1123,16 @@ config TRACE
of calling function. Please note some printk related functions
are omitted from trace to have good looking console dumps.
config DEBUG_FUNC
bool "Enable function entry and exit reporting macros" if DEFAULT_CONSOLE_LOGLEVEL_8
default n
help
This option enables additional function entry and exit debug messages
for select functions. If supported, this is less output than
the TRACE option.
Note: This option will increase the size of the coreboot image.
If unsure, say N.
config DEBUG_COVERAGE
bool "Debug code coverage"
default n

View File

@ -0,0 +1,22 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef _CONSOLE_DEBUG_H_
#define _CONSOLE_DEBUG_H_
#if CONFIG(DEBUG_FUNC)
#include <console/console.h>
#define FUNC_ENTER() \
printk(BIOS_SPEW, "%s:%s:%d: ENTER\n", __FILE__, __func__, __LINE__)
#define FUNC_EXIT() \
printk(BIOS_SPEW, "%s:%s:%d: EXIT\n", __FILE__, __func__, __LINE__)
#else /* FUNC_DEBUG */
#define FUNC_ENTER()
#define FUNC_EXIT()
#endif /* FUNC_DEBUG */
#endif

View File

@ -279,6 +279,20 @@ void show_all_devs_resources(int debug_level, const char *msg);
#define LOG_IO_RESOURCE(type, dev, index, base, size)
#endif /* DEBUG_RESOURCES*/
#if CONFIG(DEBUG_FUNC)
#include <console/console.h>
#define DEV_FUNC_ENTER(dev) \
printk(BIOS_SPEW, "%s:%s:%d: ENTER (dev: %s)\n", \
__FILE__, __func__, __LINE__, dev_path(dev))
#define DEV_FUNC_EXIT(dev) \
printk(BIOS_SPEW, "%s:%s:%d: EXIT (dev: %s)\n", __FILE__, \
__func__, __LINE__, dev_path(dev))
#else /* DEBUG_FUNC */
#define DEV_FUNC_ENTER(dev)
#define DEV_FUNC_EXIT(dev)
#endif /* DEBUG_FUNC */
/* Rounding for boundaries.
* Due to some chip bugs, go ahead and round IO to 16
*/

View File

@ -3,6 +3,7 @@
#include <arch/ioapic.h>
#include <assert.h>
#include <console/console.h>
#include <console/debug.h>
#include <cpu/x86/lapic.h>
#include <device/pci.h>
#include <fsp/api.h>

View File

@ -4,6 +4,7 @@
#include <acpi/acpi.h>
#include <assert.h>
#include <console/console.h>
#include <console/debug.h>
#include <cpu/cpu.h>
#include <cpu/intel/microcode.h>
#include <cpu/intel/turbo.h>

View File

@ -3,24 +3,8 @@
#ifndef _SOC_UTIL_H_
#define _SOC_UTIL_H_
#include <console/console.h>
#include <hob_iiouds.h>
#include <hob_memmap.h>
#include <stdint.h>
#define DEV_FUNC_ENTER(dev) \
printk(BIOS_SPEW, "%s:%s:%d: ENTER (dev: %s)\n", \
__FILE__, __func__, __LINE__, dev_path(dev))
#define DEV_FUNC_EXIT(dev) \
printk(BIOS_SPEW, "%s:%s:%d: EXIT (dev: %s)\n", __FILE__, \
__func__, __LINE__, dev_path(dev))
#define FUNC_ENTER() \
printk(BIOS_SPEW, "%s:%s:%d: ENTER\n", __FILE__, __func__, __LINE__)
#define FUNC_EXIT() \
printk(BIOS_SPEW, "%s:%s:%d: EXIT\n", __FILE__, __func__, __LINE__)
struct iiostack_resource {
uint8_t no_of_stacks;

View File

@ -3,25 +3,10 @@
#ifndef _XEON_SP_SOC_UTIL_H_
#define _XEON_SP_SOC_UTIL_H_
#include <console/console.h>
#include <hob_iiouds.h>
void get_cpubusnos(uint32_t *bus0, uint32_t *bus1, uint32_t *bus2, uint32_t *bus3);
void unlock_pam_regions(void);
void get_stack_busnos(uint32_t *bus);
#define DEV_FUNC_ENTER(dev) \
printk(BIOS_SPEW, "%s:%s:%d: ENTER (dev: %s)\n", \
__FILE__, __func__, __LINE__, dev_path(dev))
#define DEV_FUNC_EXIT(dev) \
printk(BIOS_SPEW, "%s:%s:%d: EXIT (dev: %s)\n", __FILE__, \
__func__, __LINE__, dev_path(dev))
#define FUNC_ENTER() \
printk(BIOS_SPEW, "%s:%s:%d: ENTER\n", __FILE__, __func__, __LINE__)
#define FUNC_EXIT() \
printk(BIOS_SPEW, "%s:%s:%d: EXIT\n", __FILE__, __func__, __LINE__)
#endif

View File

@ -2,6 +2,8 @@
#include <cbfs.h>
#include <assert.h>
#include <console/console.h>
#include <console/debug.h>
#include <post.h>
#include <device/pci.h>
#include <soc/acpi.h>

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <console/console.h>
#include <console/debug.h>
#include <intelblocks/cpulib.h>
#include <cpu/cpu.h>
#include <cpu/x86/mtrr.h>