bus_.*_resource() and rid
Pokala, Ravi
rpokala at panasas.com
Mon Sep 28 18:53:06 UTC 2015
-----Original Message-----
From: John Baldwin <jhb at freebsd.org>
Date: 2015-09-28, Monday at 11:09
To: Ravi Pokala <rpokala at panasas.com>
Cc: Francois Tigeot <ftigeot at wolfpond.org>, "cem at FreeBSD.org"
<cem at freebsd.org>, "freebsd-hackers at freebsd.org"
<freebsd-hackers at freebsd.org>
Subject: Re: bus_.*_resource() and rid
>Ah, I did mean to include 'struct resource_i' as part of 'struct
>resource'.
>They are really stored as the same structure, and you can use
>rman_get_rid()
>on a struct resource.
Okay, I think I see how that works.
>> I have a one-line change to dump_rman() to include the RID along w/ the
>> start and end address. That at least got me what I was interested in
>>from
>> ddb.
>
>Neat, can you share that?
It's a very complicated diff. ;-)
--- sys/kern/subr_rman.c (revision 288339)
+++ sys/kern/subr_rman.c (working copy)
@@ -1051,7 +1051,7 @@
devname = "nomatch";
} else
devname = NULL;
- db_printf(" 0x%lx-0x%lx ", r->r_start, r->r_end);
+ db_printf(" 0x%lx-0x%lx (%d)", r->r_start, r->r_end, r->r_rid);
if (devname != NULL)
db_printf("(%s)\n", devname);
else
>> As for `devinfo', it looks like (struct u_resource) and (struct u_rman)
>> don't include the RID either:
>
>Fooey. That would be a bit of a PITA to fix then.
Yeah. Alas!
>So there's actually a 'resource_list_add_next()' that bus drivers can use
>that
>does this, but that doesn't help you in this case. :(
Yeah, looks like it needs a (struct resource_list *), which I don't know
how to get.
Hmm... perhaps:
struct resource_list *rl =
bus_get_resource_list(device_get_parent(dev), dev);
rid = resource_list_add_next(rl, SYS_RES_IOPORT, start, end, count);
I'll try that.
Thanks!
-Ravi
More information about the freebsd-hackers
mailing list