[PATCH v3 3/3] commands: iomem: add support for printing type/attributes
Sascha Hauer
s.hauer at pengutronix.de
Tue Jun 10 03:18:41 PDT 2025
On Thu, Jun 05, 2025 at 09:44:01PM +0200, Ahmad Fatoum wrote:
> To make it easier to verify attributes, let's teach iomem to print the
> newly added information. This intentionally only operates on the
> resources, the mmuinfo command is what should print information actually
> in the page tables.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
> ---
> v2 -> v3:
> - new commit
> ---
> commands/iomemport.c | 55 +++++++++++++++++++++++++++++++----
> common/resource.c | 66 ++++++++++++++++++++++++++++++++++++++++++
> include/linux/ioport.h | 3 ++
> 3 files changed, 119 insertions(+), 5 deletions(-)
>
> diff --git a/commands/iomemport.c b/commands/iomemport.c
> index bbe41f571b48..04d7b100a755 100644
> --- a/commands/iomemport.c
> +++ b/commands/iomemport.c
> @@ -6,13 +6,23 @@
> #include <asm/io.h>
> #include <common.h>
> #include <command.h>
> +#include <getopt.h>
> +#include <range.h>
>
> -static void __print_resources(struct resource *res, int indent)
> +static void __print_resources(struct resource *res, int indent,
> + ulong *addr, bool verbose)
> {
> + char buf[64];
> struct resource *r;
> resource_size_t size = resource_size(res);
> int i;
>
> + if (addr && !region_overlap_end(*addr, *addr, res->start, res->end))
> + return;
> +
> + if (verbose)
> + printf("%-58s", resource_typeattr_format(buf, sizeof(buf), res) ?: "");
> +
> for (i = 0; i < indent; i++)
> printf(" ");
>
> @@ -22,26 +32,61 @@ static void __print_resources(struct resource *res, int indent)
> res->name);
>
> list_for_each_entry(r, &res->children, sibling) {
> - __print_resources(r, indent + 1);
> + __print_resources(r, indent + 1, addr, verbose);
> }
> +
> }
>
> -static void print_resources(struct resource *res)
> +static void print_resources(struct resource *res, ulong *addr, bool verbose)
> {
Dropped this patch:
commands/iomemport.c: In function 'do_ioport':
commands/iomemport.c:95:9: error: too few arguments to function 'print_resources'
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list