> Warner,
> 
> > rid = 0x10;
> > res1 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE);
> ...
> > should do the trick.  Change SYS_RES_MEMORY to SYS_RES_IOPORT if it is
> > I/O mapped rather than memory mapped.
> > 
> > In case it wasn't clear, the rid is the offset into the config space
> > where the BAR register that you want to use is.  Multiples of 4 only
> > need apply.
> 
> Thanks, that helps.  BUT...
> At first I thought "res1" would be the base address I was looking for.
> However, it appears (boy I wish this stuff was documented!) that
> bus_alloc_resource returns a "struct resource *".  But I looked and
> looked and I can't find the definition of what a "struct resource" is.
> So I'm still in the dark as to how to get my I/O base address from
> the pointer returned by the bus_alloc_resource.  How do I do that?

You don't.

You use rman_get_bustag() and rman_get_bushandle() to get the bus tag and 
bus handle for the region, and then pass these to the bus_space_read_? 
and bus_space_write_? functions when you want to perform your I/O.

You're probably looking at code that thinks it can do "inb" and so forth; 
sorry, we don't do that anymore (and if you want this code to work on 
anything other than an x86 system, you need to come to grips with this).

If you're fighting a legacy codebase, you've got an interesting time 
ahead of you with six separate regions; just hacking around this with 
preprocessor macros isn't going to be terribly easy.

-- 
\\ Give a man a fish, and you feed him for a day. \\  Mike Smith
\\ Tell him he should learn how to fish himself,  \\  [EMAIL PROTECTED]
\\ and he'll hate you for a lifetime.             \\  [EMAIL PROTECTED]




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to