device: Add log_resource()

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 <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55476
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Kyösti Mälkki 2021-06-14 00:40:22 +03:00 committed by Felix Held
commit 68e6dc9832
2 changed files with 18 additions and 0 deletions

View file

@ -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: