[prev in list] [next in list] [prev in thread] [next in thread]
List: freebsd-hackers
Subject: Re: How do I alloc multiple memory regions specified in a device tree?
From: Lee D <embaudarm () gmail ! com>
Date: 2017-12-17 23:03:58
Message-ID: CANC_bnPez8c8txrnAWV2ONR1_E=AnaLYQq6_VjpRysczRfcUgw () mail ! gmail ! com
[Download RAW message or body]
On Sun, Dec 17, 2017 at 3:19 PM, Ian Lepore <ian@freebsd.org> wrote:
> On Sun, 2017-12-17 at 15:00 -0500, Lee D wrote:
>> Hi everyone.
>>
>> I have a device driver that must access registers in multiple memory
>> ranges. How do I pull those values out of the device tree?
>>
>> bus_alloc_resource_any() works, but only for the first memory range.
>> The second time I call it, it crashes the kernel.
>>
>
> The 'rid' argument is the zero-based index of the register range you
> want to allocate. Just increment rid from 0 through the number of
> offset/length tuples in the fdt regs property.
>
> You can allocate all the ranges at once with bus_alloc_resources().
> For an example, see the a10fb_spec array in arm/allwinner/a10_fb.c
>
> -- Ian
>
Thank you, I see it was staring me in the face the whole time.
Setting rid to the tuple index did the trick.
Also thanks for the info on bus_alloc_resources().
Lee
_______________________________________________
freebsd-hackers@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic