summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMarc Jones <marcjones@sysproconsulting.com>2020-10-12 11:44:46 -0600
committerMarc Jones <marc@marcjonesconsulting.com>2020-10-29 16:43:00 +0000
commit5b5c52e8ded9e6ef320bc01fec63ed042cac90c1 (patch)
tree32906dddbc9da39d10c57ab8720ec9971fccc629 /src/include
parentb544fe48af76e5aae7537d95b62191e1fed2bc45 (diff)
downloadcoreboot-5b5c52e8ded9e6ef320bc01fec63ed042cac90c1.tar.xz
include/device/device.h: Move resource debug macros
Add general debug macros that print resource information. These are available to select if DEFAULT_CONSOLE_LOGLEVEL_8. The macros are helpful in debugging complex resource allocation with multiple buses. The macros are moved from soc/intel/xeon_sp, where they were originally developed. Change-Id: I2bdab7770ca5ee5901f17a8af3a9a1001b6702e4 Signed-off-by: Marc Jones <marcjones@sysproconsulting.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46304 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jay Talbott <JayTalbott@sysproconsulting.com> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/device/device.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 3a0795e526..eb9ef42eef 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -261,6 +261,24 @@ void show_one_resource(int debug_level, struct device *dev,
struct resource *resource, const char *comment);
void show_all_devs_resources(int debug_level, const char *msg);
+/* Debug macros */
+#if CONFIG(DEBUG_RESOURCES)
+#include <console/console.h>
+#define LOG_MEM_RESOURCE(type, dev, index, base_kb, size_kb) \
+ printk(BIOS_SPEW, "%s:%d res: %s, dev: %s, index: 0x%x, base: 0x%llx, " \
+ "end: 0x%llx, size_kb: 0x%llx\n", \
+ __func__, __LINE__, type, dev_path(dev), index, (base_kb << 10), \
+ (base_kb << 10) + (size_kb << 10) - 1, size_kb)
+
+#define LOG_IO_RESOURCE(type, dev, index, base, size) \
+ printk(BIOS_SPEW, "%s:%d res: %s, dev: %s, index: 0x%x, base: 0x%llx, " \
+ "end: 0x%llx, size: 0x%llx\n", \
+ __func__, __LINE__, type, dev_path(dev), index, base, base + size - 1, size)
+#else /* DEBUG_RESOURCES*/
+#define LOG_MEM_RESOURCE(type, dev, index, base_kb, size_kb)
+#define LOG_IO_RESOURCE(type, dev, index, base, size)
+#endif /* DEBUG_RESOURCES*/
+
/* Rounding for boundaries.
* Due to some chip bugs, go ahead and round IO to 16
*/