[PATCH 2/2] I/O port access routines

Mark Kettenis mark.kettenis at xs4all.nl
Wed Nov 18 15:13:52 PST 2009


> From: Adam Jackson <ajax at redhat.com>
> Date: Wed, 18 Nov 2009 14:28:57 -0500
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  include/pciaccess.h     |   14 ++++
>  src/Makefile.am         |    1 +
>  src/common_io.c         |   95 ++++++++++++++++++++++++
>  src/linux_sysfs.c       |  184 ++++++++++++++++++++++++++++++++++++----------
>  src/pciaccess_private.h |    9 +++
>  5 files changed, 263 insertions(+), 40 deletions(-)
>  create mode 100644 src/common_io.c

Oh, you actually went ahead and implemented this.  Cool!

I feel a bit guilty now, but I do have a few comments.  I think the
interface to "open" io should actually allow one to specify a range,
much in the same way as pci_device_map_range() does.  Perhaps the
right way to do this is simply to make pci_device_map_range() accept a
PCI_DEV_MAP_FLAG_IO flag.  You'd still need to use the pci_io_xxx
functions on the returned address to handle x86 machines properly of
course.

Regarding those pci_io_xxx functions, would it be better to encode the
access size a bit more explicit, like the config space access functions?

pci_io_read_u8()
pci_io_read_u16()
pci_io_read_u32()

pci_io_write_u8()
pci_io_write_u16()
pci_io_write_u32()

The 'b' in inb/outb is unambiguous, but the 'w' and the 'l' already
didn't make sense for 32-bit machines, let alone now that we have
64-bit machines.


More information about the xorg-devel mailing list