From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org, tony.luck@intel.com, linux-pci@vger.kernel.org
Subject: Re: [RFC/PATCH 2/2] powerpc: Add legacy PCI access via sysfs
Date: Fri, 3 Oct 2008 08:59:12 -0700 [thread overview]
Message-ID: <200810030859.12335.jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <20081003094953.A7F4EDE184@ozlabs.org>
On Friday, October 3, 2008 2:49 am Benjamin Herrenschmidt wrote:
> + /* WARNING: The generic code is idiotic. It gets passed a pointer
> + * to what can be a 1, 2 or 4 byte quantity and always reads that
> + * as a u32, which means that we have to correct the location of
> + * the data read within those 32 bits for size 1 and 2
> + */
> + switch(size) {
> + case 1:
> + out_8(addr, val >> 24);
> + return 1;
> + case 2:
> + if (port & 1)
> + return -EINVAL;
> + out_le16(addr, val >> 16);
> + return 2;
> + case 4:
> + if (port & 3)
> + return -EINVAL;
> + out_le32(addr, val);
> + return 4;
> + }
> + return -EINVAL;
Feel free to change the generic code if it makes things easier for you, the
only limitation is that we have to live within the generic sysfs read/write
functions. Obviously I didn't worry about it when doing this code on ia64...
Jesse
next prev parent reply other threads:[~2008-10-03 16:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-03 9:49 [RFC/PATCH 2/2] powerpc: Add legacy PCI access via sysfs Benjamin Herrenschmidt
2008-10-03 15:59 ` Jesse Barnes [this message]
2008-10-03 21:52 ` Benjamin Herrenschmidt
2008-10-03 22:09 ` Jesse Barnes
2008-10-03 22:16 ` Benjamin Herrenschmidt
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=200810030859.12335.jbarnes@virtuousgeek.org \
--to=jbarnes@virtuousgeek.org \
--cc=benh@kernel.crashing.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=tony.luck@intel.com \
/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).