linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Randall Hyde" <randyhyde@earthlink.net>
To: <linux-kernel@vger.kernel.org>
Subject: mmap to Access PCI space?
Date: Thu, 23 Oct 2003 20:36:12 -0700	[thread overview]
Message-ID: <06d801c399df$f8af9880$6501a8c0@rhyde> (raw)
In-Reply-To: 102420030310.18374.4e89@comcast.net

Hi All,
I need to access a couple of SATA chips from a user-mode
program (yep, running as root). I know for a fact that my
chip resides at address 0xfc300000 (/proc/iomem and /proc/ide/siimage
tells me this).  Can I do a mmap like the following to access the registers
on ths chip?

fdDevMem = open( "/dev/mem", O_RDWR );
ptr =
    mmap
    (
        NULL,
        4096,
        PROT_READ | PROT_WRITE,
        MAP_SHARED,
        fdDevMem,
        0xfc300000
    );

When I try this, I get a valid pointer back, but it doesn't seem to
be mapped to my si3112 chip register bank.

I've also used code like the following:
ptr =
    mmap
    (
        0xfc300000,
        4096,
        PROT_READ | PROT_WRITE,
        MAP_SHARED | MAP_ANONYMOUS,
        -1,
        0
    );

Same story.
If I use MAP_FIXED and/or MAP_PRIVATE, the mmap call fails.

What am I doing wrong here?
Thanks,
Randy Hyde


  reply	other threads:[~2003-10-24  3:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-24  3:10 2.6.0-test8 scsi logging not working jtholmesjr
2003-10-24  3:36 ` Randall Hyde [this message]
2003-10-24  7:57   ` mmap to Access PCI space? David S. Miller
2003-10-24  5:17 ` 2.6.0-test8 scsi logging not working Mike Anderson

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='06d801c399df$f8af9880$6501a8c0@rhyde' \
    --to=randyhyde@earthlink.net \
    --cc=linux-kernel@vger.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).