libpciaccess x86 backend

Tiago Vignatti tiago.vignatti at nokia.com
Tue Jan 19 11:10:37 PST 2010


On Tue, Jan 19, 2010 at 06:37:43PM +0100, ext Samuel Thibault wrote:
> Tiago Vignatti, le Tue 19 Jan 2010 18:44:06 +0200, a écrit :
> >
> > change the name for gnuhurd_pci.c makes more sense for me, given all file
> > there now are OS related.
> 
> Err, as I said, this is not specific to GNU/Hurd at all, it's just
> an x86 backend that can be used for any OS that doesn't have a PCI
> interface.  Olaf, cc-ed, can probably comment on that.

right.

But we have to go carefully with it and see if we will not be overlapping code
with libx86 - which currently is only doing real mode calls, but has already a
lot of IO related stuff: 

    http://cgit.freedesktop.org/~vignatti/libx86/tree/src/lrmi/common_io.c 

So yeah, we'll have to move code from X server to either libx86 or
libpciaccess. Not both.

(note though we are not using yet libx86 with X server, nor anything. But we
will)


> > No, you're being selfish :)
> >
> > We should pick all PCI Vendors and Devices ID instead. Basically import all
> > hw/xfree86/common/xf86PciInfo.h and patch X server to remove it.
> 
> You mean move a header from the X server to libpciaccess?  While I
> agree it can make sense, it seems well beyond the goal of my patch, and
> I don't really want to support all the breakage that will be brought
> (xf86PciInfo.h is installed by the X server so anybody could already be
> using it).

in another patch set looks good, yeah.

> + * Read a VGA rom using the 0xc0000 mapping.
> + */
> +static int
> +pci_device_x86_read_rom(struct pci_device *dev, void *buffer)
> +{
> +    void *bios;
> +    int memfd;
> +
> +    if ((dev->device_class & 0x00ffff00) !=
> +        ((PCIC_DISPLAY << 16) | ( PCIS_DISPLAY_VGA << 8))) {
> +       return ENOSYS;
> +    }
> +
> +    memfd = open("/dev/mem", O_RDONLY);
> +    if (memfd == -1)
> +       return errno;
> +
> +    bios = mmap(NULL, dev->rom_size, PROT_READ, 0, memfd, 0xc0000);
> +    if (bios == MAP_FAILED) {
> +       close(memfd);
> +       return errno;
> +    }
> +
> +    memcpy(buffer, bios, dev->rom_size);
> +
> +    munmap(bios, dev->rom_size);
> +    close(memfd);
> +
> +    return 0;
> +}

for instance, with this one now, we'll have pretty much same implementations
inside X, libpciacccess and libx86.


Cheers,

            Tiago


More information about the xorg-devel mailing list