Re: VRAM protection in setup.c

From: jmcmullan@linuxcare.com
Date: Mon Feb 21 2000 - 00:18:49 EST


Jeff Garzik <jgarzik@mandrakesoft.com> wrote:
> I disagree. We either need to follow Linus' advice (hope and pray
> accessing 0xA0000 is ok), or we need to implement a more flexible way of
> arbitrating resource sharing of the VGA regions. Adding a hack flag to
> the resource system is not a good short-term nor long-term fix, IMHO.

        Why not do like the PCI IRQs, and add a new ``shareable'' IO region
type like this:

linux/include/ioport.h
...
#define IORESOURCE_SHAREABLE 0x00020000
...

  Such that multiple drivers can request the same region, and
do something like the following (referencing headers I've never
personally used.. ;^)

vga.c

void vga_init()
{
        ...
        allocate_resource(&iomem_resource,
                                          &vidmem,
                                          0x20000,
                                          0xA0000,0xC000, /* Not too sure about the next */
                                          IORESOURCE_MEM|IORESOURCE_SHARABLE,
                                          NULL,NULL);
        ...
}
                                          

void do_something()
{
        ...
        spin_lock(vidmem->lock);
        /* Do something to memory */
        spin_unlock(vidmem->lock);
}

-- 
Jason McMullan, Senior Linux Consultant, Linuxcare, Inc.
412.422.8077 tel, 415.701.0792 fax
jmcmullan@linuxcare.com, http://www.linuxcare.com/
Linuxcare. Support for the revolution.

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



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:26 EST