From 68e6dc983223ead50362af45d9465045ae2b2d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Mon, 14 Jun 2021 00:40:22 +0300 Subject: device: Add log_resource() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will replace LOG_{MEM/IO}_RESOURCE macros once the new resource constructors are available. Change-Id: I21b030dc42dcb8e462b29f49499be5fd31ea38f5 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/55476 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans --- src/include/device/resource.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/include') diff --git a/src/include/device/resource.h b/src/include/device/resource.h index fb1f691190..6f16c03818 100644 --- a/src/include/device/resource.h +++ b/src/include/device/resource.h @@ -90,6 +90,15 @@ static inline void *res2mmio(const struct resource *res, unsigned long offset, 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) \ + do { \ + if (CONFIG(DEBUG_RESOURCES) && (dev) && (res)) \ + log_resource(type, (dev), (res), __func__, __LINE__); \ + } while (0) + /* * Pick largest resource on the bus using the given mask and type. * Params: -- cgit v1.2.3