Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/55476 )
Change subject: device: Add log_resource() ......................................................................
device: Add log_resource()
Change-Id: I21b030dc42dcb8e462b29f49499be5fd31ea38f5 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/device/device_util.c M src/include/device/resource.h 2 files changed, 15 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/55476/1
diff --git a/src/device/device_util.c b/src/device/device_util.c index 5c3d66b..96c86d2 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -940,3 +940,12 @@ type_name = type_names[type]; return type_name; } + +void log_resource(const char *type, const struct device *dev, const struct resource *res, + const char *srcfile, const int line) +{ + printk(BIOS_SPEW, "%s:%d res: %s, dev: %s, index: 0x%lx, base: 0x%llx, " + "end: 0x%llx, size_kb: 0x%llx\n", + srcfile, line, type, dev_path(dev), res->index, res->base, + resource_end(res), res->size / KiB); +} diff --git a/src/include/device/resource.h b/src/include/device/resource.h index 098d0b6..80c8b6e 100644 --- a/src/include/device/resource.h +++ b/src/include/device/resource.h @@ -89,6 +89,12 @@ return (void *)(uintptr_t)((res->base + offset) & ~mask); }
+void log_resource(const char *type, const struct device *dev, const struct resource *res, + const char *srcfile, const int line); + +#define LOG_RESOURCE(type, dev, res) \ + if (CONFIG(DEBUG_RESOURCES)) log_resource(type, dev, res, __func__, __LINE__) + /* * Pick largest resource on the bus using the given mask and type. * Params: