Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 2010 15:54:31 +0530
From:      Sujit K M <kmsujit@gmail.com>
To:        Cole <cole@opteqint.net>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: PCI and Resouce question
Message-ID:  <74fe56021003170324l7379e8f8mcd2da23887d78667@mail.gmail.com>
In-Reply-To: <9f206d1a1003170250r2727a55ajb636a0bdf1a2f137@mail.gmail.com>
References:  <9f206d1a1003170250r2727a55ajb636a0bdf1a2f137@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> What im trying to achieve is writing to a few registers/memory
> addresses for the memory location of BAR 0 for a pci card. I do not
> want to modify the drivers source code, since it might become
> unavailable sometime in the future. So what im looking to do is write
> another kernel module, that can obtain the cards device_t structure,
> as well as the resource structure of the card. My aim is to obtain the
> resource structure so that I can then obtain the bus_tag and
> bus_handle, and use those to write to the BAR 0 memory space.

You can still do this if you use port related functionality. But would not
be done at the device level, but at the driver level. Also the related
functionality
like poll/select as the case may be will be utilized at an device
level(device_t).


>
> My understanding is that I would use pci_find_device to obtain the
> device_t, then I think I can use bus_alloc_resource_any to obtain the
> resource, I see there used to be a bus_get_resource, but the man page
> for that no longer seems to exist, and references to it seem to have
> been removed. If there is another way or better way of doing this,
> please let me know. Also im not familiar with the specifics of
> bus_alloc_resouce_any, and I dont know if calling this function from
> another kernel module will give me the already allocated memory for
> this pci card, or will it create a new one and assign it to the BAR 0
> register on the card?

This again is at higher level than the device_t related. Would be much
more usefull
in developing HA(High Availability).

Thanks,
Sujit



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?74fe56021003170324l7379e8f8mcd2da23887d78667>