From c487381d50b280a0dce09e00cd29620be9598c90 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 10 Jan 2025 17:00:01 -0700 Subject: abuf: Provide a way to get the buffer address In many cases it is useful to get the address of a buffer, e.g. when booting from it. Add a function to handle this. Signed-off-by: Simon Glass --- lib/abuf.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/abuf.c b/lib/abuf.c index 937c3df351e..8156177c773 100644 --- a/lib/abuf.c +++ b/lib/abuf.c @@ -26,6 +26,12 @@ void abuf_map_sysmem(struct abuf *abuf, ulong addr, size_t size) { abuf_set(abuf, map_sysmem(addr, size), size); } + +ulong abuf_addr(const struct abuf *abuf) +{ + return map_to_sysmem(abuf->data); +} + #else /* copied from lib/string.c for convenience */ static char *memdup(const void *src, size_t len) -- cgit v1.2.3