linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Murray <andrew.murray@arm.com>
To: linux-pci@vger.kernel.org
Subject: PCI IO and IO_COND
Date: Thu, 4 Apr 2013 13:55:29 +0100	[thread overview]
Message-ID: <20130404125529.GA21798@arm.com> (raw)

Hello,

I have a question regarding the IO_COND macro in lib/iomap.c...

If you have a system which uses GENERIC_IOMAP and you use default values for
PIO_OFFSET, PIO_MASK and PIO_RESERVED - it doesn't seem possible to use the
ioreadX functions to access the first address of the IO port, i.e.
addr=PIO_OFFSET (assuming that you would want to).

/*
 * Ugly macros are a way of life.
 */
#define IO_COND(addr, is_pio, is_mmio) do {			\
	unsigned long port = (unsigned long __force)addr;	\
	if (port >= PIO_RESERVED) {				\
		is_mmio;					\
	} else if (port > PIO_OFFSET) {				\
		port &= PIO_MASK;				\
		is_pio;						\
	} else							\
		bad_io_access(port, #is_pio );			\
} while (0)

Should the first else be '} else if (port >= PIO_OFFSET)' or am I missing
something here?

I can see that on ARM where IO is used for PCI, the pcibios_min_io variable
probably prevents accesses to addr=PIO_OFFSET as it introduces an additional
offset.

Thanks,

Andrew Murray

                 reply	other threads:[~2013-04-04 12:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20130404125529.GA21798@arm.com \
    --to=andrew.murray@arm.com \
    --cc=linux-pci@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).