linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PCI IO and IO_COND
@ 2013-04-04 12:55 Andrew Murray
  0 siblings, 0 replies; only message in thread
From: Andrew Murray @ 2013-04-04 12:55 UTC (permalink / raw)
  To: linux-pci

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-04-04 12:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-04 12:55 PCI IO and IO_COND Andrew Murray

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).