Re: [patch 2.5] VGA IO on systems with multiple PCI IO domains

From: Ivan Kokshaysky (ink@jurassic.park.msu.ru)
Date: Mon Jan 27 2003 - 05:40:10 EST


On Mon, Jan 27, 2003 at 10:46:45AM +0100, Martin Mares wrote:
> > What about some kind of ioport_remap() that would take a pci_bus and an
> > port range as arguments ? If pci_bus is NULL, that would match a
> > "legacy" ISA bus (non-PCI machine or default ISA bus for machines where
> > that makes sense).
> >
> > What do you think ?
>
> Looks good, but maybe we should use some other functions than iob() et al.
> to do I/O on the remapped addresses.

What about this (what we'd have on alpha):

int
legacy_ioport_remap(struct resource *res)
{
        switch (res->start) {
        case 0x3c0: /* VGA */
                res->start += pci_vga_hose->io_space->start;
                res->end += pci_vga_hose->io_space->start;
        case ???
                ...
        default:
                return -ENODEV;
        }
        return request_resource(pci_vga_hose->io_space, res);
}

void
legacy_ioport_unmap(struct resource *res)
{
        release_resource(res);
}

Then vgacon.c would be changed like this:

...
- request_resource(&ioport_resource, &vga_console_resource);
+ if (legacy_ioport_remap(&vga_console_resource) < 0)
+ goto failure;
...

And all in/out port calls would use respective resource.start+offset:
...
- outb_p(6, 0x3ce)
+ outb_p(6, vga_console_resource.start + 0xe);

No need for other special IO functions then.

Ivan.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jan 31 2003 - 22:00:16 EST