linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Pratyush Anand <pratyush.anand@st.com>,
	shiv prakash Agarwal <chhotu.shiv@gmail.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Yinghai Lu <yinghai@kernel.org>
Subject: Re: PCIE: Program pcie device private registers
Date: Tue, 04 Mar 2014 11:10:49 -0700	[thread overview]
Message-ID: <1393956649.2895.128.camel@ul30vt.home> (raw)
In-Reply-To: <CAErSpo7s7fdUZH6zXr3ZWHq8s+zQ_5_sszzBZWrqFOh+jXHUgA@mail.gmail.com>

On Tue, 2014-03-04 at 10:45 -0700, Bjorn Helgaas wrote:
> On Mon, Mar 3, 2014 at 8:59 PM, Pratyush Anand <pratyush.anand@st.com> wrote:
> > On Thu, Feb 27, 2014 at 05:12:38PM +0800, shiv prakash Agarwal wrote:
> >>    Hi All,
> >>
> >>
> >>
> >>    One query:
> >>
> >>
> >>
> >>    We can program config space registers of a pcie device using setpci but
> >>    how can we program private registers of a pcie device?
> >
> > You mean application specific registers?
> > These registers will not be accessible through any generic user space program.
> >
> > If you want to access them for debug purposes then you can provide
> > support in your driver.
> 
> If the registers are in config space, you can use setpci, even if they
> are non-architected registers specific to the device.
> 
> If they are in MMIO space, you can use lspci to learn where the BARs
> are mapped, and then use something like rdwrmem
> (http://cmp.felk.cvut.cz/~pisa/linux/rdwrmem.c) to access the
> registers.
> 
> If they are in I/O port space, you can again use lspci to learn where
> they are mapped, and then use ioperm()/iopl()/inb()/outb()/etc.

The pci-sysfs resource# files are probably an easier alternative.  MMIO
regions can be mmap'd and I/O port regions support direct read/write.
Thanks,

Alex


  reply	other threads:[~2014-03-04 18:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAHH3p5JzL-9T-Hn=fp1S9=URzycpKTy6toaA0AjQfJYt7mQXsA@mail.gmail.com>
2014-02-27 22:57 ` PCIE: Program pcie device private registers Yinghai Lu
2014-03-04  3:59 ` Pratyush Anand
2014-03-04 17:45   ` Bjorn Helgaas
2014-03-04 18:10     ` Alex Williamson [this message]
2014-02-27  9:13 shiv prakash Agarwal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393956649.2895.128.camel@ul30vt.home \
    --to=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=chhotu.shiv@gmail.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=pratyush.anand@st.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).