Re: query regarding BAR mapping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 26, 2014 at 5:50 AM, Bob Biloxi <iambobbiloxi@xxxxxxxxx> wrote:
> Hi All,
>
> I am writing a driver for PCIe network device. I am still trying to
> learn, so my question might be like a simple one as I do not
> understand most of the things.

You should start by looking at and copying an existing, working
driver.  bnx2x and ixgbe are examples for some current hardware, but
they are big and complicated.  e100 is older but simpler.  A
networking person could give better advice.

> From the BAR0 address that I read, the memory size is around 256MB.
> But I have only 128MB at my disposal.

The BAR determines the size in MMIO space.  I'm not sure what you mean
by "have only 128MB at my disposal."  If you have limited virtual
memory space and your driver doesn't need the whole MMIO region, you
can just map the part you need.

> So my question is how do i map this BAR so as to access the MMIO region.

pci_iomap() is a good place to start.  That gives you an __iomem
address that you can then pass to ioread*() and iowrite*() to access
the MMIO region.  It maps the entire region, so if you need less,
you'd probably use ioremap() directly.

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux